Firmware SDK
|
Driver for 1wire ds18b20. More...
Typedefs | |
typedef struct twr_ds18b20_t | twr_ds18b20_t |
BigClown ds18b20 instance. | |
typedef struct twr_ds18b20_sensor_t | twr_ds18b20_sensor_t |
Enumerations | |
enum | twr_ds18b20_event_t { TWR_DS18B20_EVENT_ERROR = -1 , TWR_DS18B20_EVENT_UPDATE = 0 } |
Callback events. More... | |
Functions | |
void | twr_ds18b20_init_single (twr_ds18b20_t *self, twr_ds18b20_resolution_bits_t resolution) |
Initialize single ds18b20 over channel B on Sensor Module. More... | |
void | twr_ds18b20_init_multiple (twr_ds18b20_t *self, twr_ds18b20_sensor_t *sensors, int sensor_count, twr_ds18b20_resolution_bits_t resolution) |
Initialize multiple ds18b20 over channel B on Sensor Module. More... | |
void | twr_ds18b20_init (twr_ds18b20_t *self, twr_onewire_t *onewire, twr_ds18b20_sensor_t *sensors, int sensor_count, twr_ds18b20_resolution_bits_t resolution) |
Initialize ds18b20. More... | |
void | twr_ds18b20_set_event_handler (twr_ds18b20_t *self, void(*event_handler)(twr_ds18b20_t *, uint64_t _device_address, twr_ds18b20_event_t, void *), void *event_param) |
Set callback function. More... | |
void | twr_ds18b20_set_update_interval (twr_ds18b20_t *self, twr_tick_t interval) |
Set measurement interval. More... | |
bool | twr_ds18b20_measure (twr_ds18b20_t *self) |
Start measurement manually. More... | |
bool | twr_ds18b20_get_temperature_raw (twr_ds18b20_t *self, uint64_t device_address, int16_t *raw) |
Get measured temperature in degrees of Celsius. More... | |
bool | twr_ds18b20_get_temperature_celsius (twr_ds18b20_t *self, uint64_t _device_address, float *celsius) |
Get measured temperature in degrees of Celsius. More... | |
int | twr_ds18b20_get_index_by_device_address (twr_ds18b20_t *self, uint64_t device_address) |
Get device index by its device address. More... | |
uint64_t | twr_ds182b0_get_short_address (twr_ds18b20_t *self, uint8_t index) |
Get device index by its device address. More... | |
int | twr_ds18b20_get_sensor_found (twr_ds18b20_t *self) |
Get number of found sensor. More... | |
void | twr_ds18b20_rescan (twr_ds18b20_t *self) |
Request to rescan the bus. | |
void | twr_ds18b20_set_power_dynamic (twr_ds18b20_t *self, bool on) |
Set power dynamic, Turns VDD on and pull 4k7 only for measurement. More... | |
Driver for 1wire ds18b20.
enum twr_ds18b20_event_t |
Callback events.
Enumerator | |
---|---|
TWR_DS18B20_EVENT_ERROR | Error event. |
TWR_DS18B20_EVENT_UPDATE | Update event. |
Definition at line 15 of file twr_ds18b20.h.
uint64_t twr_ds182b0_get_short_address | ( | twr_ds18b20_t * | self, |
uint8_t | index | ||
) |
Get device index by its device address.
[in] | self | Instance |
[in] | index | Index |
Definition at line 106 of file twr_ds18b20.c.
int twr_ds18b20_get_index_by_device_address | ( | twr_ds18b20_t * | self, |
uint64_t | device_address | ||
) |
Get device index by its device address.
[in] | self | Instance |
[in] | device_address | 64b device address |
Definition at line 93 of file twr_ds18b20.c.
Referenced by twr_ds18b20_get_temperature_celsius(), and twr_ds18b20_get_temperature_raw().
int twr_ds18b20_get_sensor_found | ( | twr_ds18b20_t * | self | ) |
Get number of found sensor.
[in] | self | Instance |
Definition at line 120 of file twr_ds18b20.c.
bool twr_ds18b20_get_temperature_celsius | ( | twr_ds18b20_t * | self, |
uint64_t | _device_address, | ||
float * | celsius | ||
) |
Get measured temperature in degrees of Celsius.
[in] | self | Instance |
[in] | device_address | 64b device address |
[in] | celsius | Pointer to variables where results will be stored |
Definition at line 166 of file twr_ds18b20.c.
bool twr_ds18b20_get_temperature_raw | ( | twr_ds18b20_t * | self, |
uint64_t | device_address, | ||
int16_t * | raw | ||
) |
Get measured temperature in degrees of Celsius.
[in] | self | Instance |
[in] | device_address | 64b device address |
Get measured temperature as raw values
Definition at line 147 of file twr_ds18b20.c.
void twr_ds18b20_init | ( | twr_ds18b20_t * | self, |
twr_onewire_t * | onewire, | ||
twr_ds18b20_sensor_t * | sensors, | ||
int | sensor_count, | ||
twr_ds18b20_resolution_bits_t | resolution | ||
) |
Initialize ds18b20.
[in] | self | Instance |
[in] | onewire | Pointer on instance 1-Wire |
[in] | sensors | Sensor array |
[in] | sensor_count | Max count sensors |
[in] | resolution | Resolution |
Definition at line 36 of file twr_ds18b20.c.
Referenced by twr_ds18b20_init_multiple(), and twr_ds18b20_init_single().
void twr_ds18b20_init_multiple | ( | twr_ds18b20_t * | self, |
twr_ds18b20_sensor_t * | sensors, | ||
int | sensor_count, | ||
twr_ds18b20_resolution_bits_t | resolution | ||
) |
Initialize multiple ds18b20 over channel B on Sensor Module.
[in] | self | Instance |
[in] | sensors | Sensor array |
[in] | sensor_count | Max count sensors |
[in] | resolution | Resolution |
Definition at line 30 of file twr_ds18b20.c.
void twr_ds18b20_init_single | ( | twr_ds18b20_t * | self, |
twr_ds18b20_resolution_bits_t | resolution | ||
) |
Initialize single ds18b20 over channel B on Sensor Module.
[in] | self | Instance |
[in] | resolution | Resolution |
Definition at line 23 of file twr_ds18b20.c.
bool twr_ds18b20_measure | ( | twr_ds18b20_t * | self | ) |
Start measurement manually.
[in] | self | Instance |
Definition at line 79 of file twr_ds18b20.c.
Referenced by twr_ds18b20_set_update_interval().
void twr_ds18b20_set_event_handler | ( | twr_ds18b20_t * | self, |
void(*)(twr_ds18b20_t *, uint64_t _device_address, twr_ds18b20_event_t, void *) | event_handler, | ||
void * | event_param | ||
) |
Set callback function.
[in] | self | Instance |
[in] | event_handler | Function address |
[in] | event_param | Optional event parameter (can be NULL) |
Definition at line 56 of file twr_ds18b20.c.
void twr_ds18b20_set_power_dynamic | ( | twr_ds18b20_t * | self, |
bool | on | ||
) |
Set power dynamic, Turns VDD on and pull 4k7 only for measurement.
[in] | self | Instance |
[in] | on | True enable dynamic, False disable dynamic |
Definition at line 142 of file twr_ds18b20.c.
void twr_ds18b20_set_update_interval | ( | twr_ds18b20_t * | self, |
twr_tick_t | interval | ||
) |
Set measurement interval.
[in] | self | Instance |
[in] | interval | Measurement interval |
Definition at line 63 of file twr_ds18b20.c.