Firmware SDK
|
Driver for HTS221 humidity sensor. More...
Typedefs | |
typedef struct twr_hts221_t | twr_hts221_t |
HTS221 instance. | |
Enumerations | |
enum | twr_hts221_event_t { TWR_HTS221_EVENT_ERROR = 0 , TWR_HTS221_EVENT_UPDATE = 1 } |
Callback events. More... | |
Functions | |
void | twr_hts221_init (twr_hts221_t *self, twr_i2c_channel_t i2c_channel, uint8_t i2c_address) |
Initialize HTS221. More... | |
void | twr_hts221_deinit (twr_hts221_t *self) |
Deinitialize HTS221. More... | |
void | twr_hts221_set_event_handler (twr_hts221_t *self, void(*event_handler)(twr_hts221_t *, twr_hts221_event_t, void *), void *event_param) |
Set callback function. More... | |
void | twr_hts221_set_update_interval (twr_hts221_t *self, twr_tick_t interval) |
Set measurement interval. More... | |
bool | twr_hts221_measure (twr_hts221_t *self) |
Start measurement manually. More... | |
bool | twr_hts221_get_humidity_percentage (twr_hts221_t *self, float *percentage) |
Get measured humidity as percentage. More... | |
Driver for HTS221 humidity sensor.
enum twr_hts221_event_t |
Callback events.
Enumerator | |
---|---|
TWR_HTS221_EVENT_ERROR | Error event. |
TWR_HTS221_EVENT_UPDATE | Update event. |
Definition at line 13 of file twr_hts221.h.
void twr_hts221_deinit | ( | twr_hts221_t * | self | ) |
Deinitialize HTS221.
[in] | self | Instance |
Definition at line 71 of file twr_hts221.c.
bool twr_hts221_get_humidity_percentage | ( | twr_hts221_t * | self, |
float * | percentage | ||
) |
Get measured humidity as percentage.
[in] | self | Instance |
[in] | percentage | Pointer to variable where result will be stored |
Definition at line 120 of file twr_hts221.c.
Referenced by twr_tag_humidity_get_humidity_percentage().
void twr_hts221_init | ( | twr_hts221_t * | self, |
twr_i2c_channel_t | i2c_channel, | ||
uint8_t | i2c_address | ||
) |
Initialize HTS221.
[in] | self | Instance |
[in] | i2c_channel | I2C channel |
[in] | i2c_address | I2C device address |
Definition at line 53 of file twr_hts221.c.
Referenced by twr_tag_humidity_init().
bool twr_hts221_measure | ( | twr_hts221_t * | self | ) |
Start measurement manually.
[in] | self | Instance |
Definition at line 106 of file twr_hts221.c.
Referenced by twr_hts221_set_update_interval(), and twr_tag_humidity_measure().
void twr_hts221_set_event_handler | ( | twr_hts221_t * | self, |
void(*)(twr_hts221_t *, twr_hts221_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 84 of file twr_hts221.c.
Referenced by twr_tag_humidity_init().
void twr_hts221_set_update_interval | ( | twr_hts221_t * | self, |
twr_tick_t | interval | ||
) |
Set measurement interval.
[in] | self | Instance |
[in] | interval | Measurement interval |
Definition at line 90 of file twr_hts221.c.
Referenced by twr_tag_humidity_set_update_interval().