5 #include <twr_scheduler.h>
31 TWR_HDC2080_STATE_ERROR = -1,
32 TWR_HDC2080_STATE_INITIALIZE = 0,
33 TWR_HDC2080_STATE_MEASURE = 1,
34 TWR_HDC2080_STATE_READ = 2,
35 TWR_HDC2080_STATE_UPDATE = 3
37 } twr_hdc2080_state_t;
47 bool _measurement_active;
49 twr_hdc2080_state_t _state;
52 bool _temperature_valid;
53 uint16_t _reg_humidity;
54 uint16_t _reg_temperature;
twr_hdc2080_event_t
Callback events.
struct twr_hdc2080_t twr_hdc2080_t
HDC2080 instance.
void twr_hdc2080_init(twr_hdc2080_t *self, twr_i2c_channel_t i2c_channel, uint8_t i2c_address)
Initialize HDC2080.
bool twr_hdc2080_get_temperature_celsius(twr_hdc2080_t *self, float *celsius)
Get measured temperature in degrees of Celsius.
bool twr_hdc2080_get_temperature_raw(twr_hdc2080_t *self, uint16_t *raw)
Get measured temperature as raw value.
void twr_hdc2080_deinit(twr_hdc2080_t *self)
Deinitialize HDC2080.
bool twr_hdc2080_measure(twr_hdc2080_t *self)
Start measurement manually.
bool twr_hdc2080_get_humidity_percentage(twr_hdc2080_t *self, float *percentage)
Get measured humidity as percentage.
bool twr_hdc2080_get_humidity_raw(twr_hdc2080_t *self, uint16_t *raw)
Get measured humidity as raw value.
void twr_hdc2080_set_update_interval(twr_hdc2080_t *self, twr_tick_t interval)
Set measurement interval.
void twr_hdc2080_set_event_handler(twr_hdc2080_t *self, void(*event_handler)(twr_hdc2080_t *, twr_hdc2080_event_t, void *), void *event_param)
Set callback function.
@ TWR_HDC2080_EVENT_UPDATE
Update event.
@ TWR_HDC2080_EVENT_ERROR
Error event.
twr_i2c_channel_t
I2C channels.
size_t twr_scheduler_task_id_t
Task ID assigned by scheduler.
uint64_t twr_tick_t
Timestamp data type.