2016-02-04 18:52:57 +00:00
|
|
|
#ifndef DRIVER_DS18B20_H_
|
|
|
|
#define DRIVER_DS18B20_H_
|
|
|
|
|
2016-02-18 12:51:16 +00:00
|
|
|
typedef struct {
|
2016-02-04 18:52:57 +00:00
|
|
|
uint8_t id;
|
|
|
|
uint8_t major;
|
|
|
|
uint8_t minor;
|
2016-02-18 12:51:16 +00:00
|
|
|
} ds_sensor_t;
|
2016-02-04 18:52:57 +00:00
|
|
|
|
|
|
|
// Scan all ds18b20 sensors on bus and return its amount.
|
2016-02-18 12:51:16 +00:00
|
|
|
// Result are saved in array of ds_sensor_t structure.
|
2016-02-04 18:52:57 +00:00
|
|
|
// Cause printf in esp sdk don`t support float,
|
|
|
|
// I split result as two number (major, minor).
|
2016-02-18 12:51:16 +00:00
|
|
|
uint8_t readDS18B20(uint8_t pin, ds_sensor_t *result);
|
2016-02-04 18:52:57 +00:00
|
|
|
|
|
|
|
// This method is just to demonstrate how to read
|
|
|
|
// temperature from single dallas chip.
|
|
|
|
float read_single_DS18B20(uint8_t pin);
|
|
|
|
|
|
|
|
#endif
|