/******************************************************************************** * Copyright: (C) 2020 LingYun IoT System Studio * All rights reserved. * * Filename: ds18b20.h * Description: This head file is get temperature by DS18B20 on RaspberryPi * * Version: 1.0.0(2020年04月15日) * Author: Guo Wenxue * ChangeLog: 1, Release initial version on "2020年04月15日 23时37分38秒" * ********************************************************************************/ #ifndef _DS18B20_H_ #define _DS18B20_H_ #include /* description: get temperature by DS18B20 on RaspberryPi * return value: 0: Successfully <0: Failure * output value: $temp: temperature value saved in two bytes: * byte[0]: fractional part, two digits after * byte[1]: integer part */ int ds18b20_get_temperature(uint16_t *temp); #define temper_integer(x) (((x)>>8) & 0xFF) #define temper_fract(x) ( (x) & 0xFF) #endif /* ----- #ifndef _DS18B20_H_ ----- */