5 #include <twr_scheduler.h>
31 TWR_SGPC3_STATE_ERROR = -1,
32 TWR_SGPC3_STATE_INITIALIZE = 0,
33 TWR_SGPC3_STATE_GET_FEATURE_SET = 1,
34 TWR_SGPC3_STATE_READ_FEATURE_SET = 2,
35 TWR_SGPC3_STATE_SET_POWER_MODE = 3,
36 TWR_SGPC3_STATE_INIT_AIR_QUALITY = 4,
37 TWR_SGPC3_STATE_SET_HUMIDITY = 5,
38 TWR_SGPC3_STATE_MEASURE_AIR_QUALITY = 6,
39 TWR_SGPC3_STATE_READ_AIR_QUALITY = 7
52 twr_sgpc3_state_t _state;
56 bool _measurement_valid;
twr_i2c_channel_t
I2C channels.
size_t twr_scheduler_task_id_t
Task ID assigned by scheduler.
twr_sgpc3_event_t
Callback events.
void twr_sgpc3_set_update_interval(twr_sgpc3_t *self, twr_tick_t interval)
Set measurement interval.
float twr_sgpc3_set_compensation(twr_sgpc3_t *self, float *t_celsius, float *rh_percentage)
Set sensor compensation (absolute humidity is calculated from temperature and relative humidity)
bool twr_sgpc3_measure(twr_sgpc3_t *self)
Start measurement manually.
void twr_sgpc3_deinit(twr_sgpc3_t *self)
Deinitialize SGPC3.
bool twr_sgpc3_get_tvoc_ppb(twr_sgpc3_t *self, uint16_t *ppb)
Get measured TVOC in ppb (parts per billion)
void twr_sgpc3_init(twr_sgpc3_t *self, twr_i2c_channel_t i2c_channel, uint8_t i2c_address)
Initialize SGPC3.
void twr_sgpc3_set_event_handler(twr_sgpc3_t *self, void(*event_handler)(twr_sgpc3_t *, twr_sgpc3_event_t, void *), void *event_param)
Set callback function.
struct twr_sgpc3_t twr_sgpc3_t
SGPC3 instance.
@ TWR_SGPC3_EVENT_UPDATE
Update event.
@ TWR_SGPC3_EVENT_ERROR
Error event.
uint64_t twr_tick_t
Timestamp data type.