]> mj.ucw.cz Git - home-hw.git/blob - lib/ds18b20.h
BSB: An attempt at sending
[home-hw.git] / lib / ds18b20.h
1 /*
2  *      Interface to DS18B20 Temperature Sensors
3  *
4  *      (c) 2019 Martin Mareš <mj@ucw.cz>
5  */
6
7 #ifndef _DS18B20_H
8 #define _DS18B20_H
9
10 struct ds_sensor {
11         byte address[8];        // All zeroes if sensor does not exist.
12                                 // Otherwise, address[0] is guaranteed to be non-zero.
13         int current_temp;       // Temperature in m°C or DS_TEMP_UNKNOWN
14 };
15
16 extern struct ds_sensor ds_sensors[DS_NUM_SENSORS];
17
18 #define DS_TEMP_UNKNOWN 0x7fffffff
19
20 void ds_init(void);
21 void ds_step(void);
22
23 #endif