APUE Learning Example Source Code
guowenxue
2023-11-06 f63647218e192628aa8598d504e064529398f159
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/********************************************************************************
 *      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 <guowenxue@gmail.com>
 *      ChangeLog:  1, Release initial version on "2020年04月15日 23时37分38秒"
 *                 
 ********************************************************************************/
 
#ifndef  _DS18B20_H_
#define  _DS18B20_H_
 
#include <stdint.h>
 
/*  description: get temperature by DS18B20 on RaspberryPi
 * return value: 0: Successfully   <0: Failure
 * output value: $temp: temperature value saved in two bytes:
 *                     byte[0]: integer part
 *                     byte[1]: fractional part, two digits after
 */
int ds18b20_get_temperature(uint16_t *temp);
 
#endif   /* ----- #ifndef _DS18B20_H_  ----- */