5 #include <twr_scheduler.h>
31 TWR_SGP30_STATE_ERROR = -1,
32 TWR_SGP30_STATE_INITIALIZE = 0,
33 TWR_SGP30_STATE_GET_FEATURE_SET = 1,
34 TWR_SGP30_STATE_READ_FEATURE_SET = 2,
35 TWR_SGP30_STATE_INIT_AIR_QUALITY = 3,
36 TWR_SGP30_STATE_SET_HUMIDITY = 4,
37 TWR_SGP30_STATE_MEASURE_AIR_QUALITY = 5,
38 TWR_SGP30_STATE_READ_AIR_QUALITY = 6
51 twr_sgp30_state_t _state;
55 bool _measurement_valid;
twr_i2c_channel_t
I2C channels.
size_t twr_scheduler_task_id_t
Task ID assigned by scheduler.
twr_sgp30_event_t
Callback events.
bool twr_sgp30_measure(twr_sgp30_t *self)
Start measurement manually.
bool twr_sgp30_get_tvoc_ppb(twr_sgp30_t *self, uint16_t *ppb)
Get measured TVOC in ppb (parts per billion)
void twr_sgp30_set_update_interval(twr_sgp30_t *self, twr_tick_t interval)
Set measurement interval.
struct twr_sgp30_t twr_sgp30_t
SGP30 instance.
void twr_sgp30_init(twr_sgp30_t *self, twr_i2c_channel_t i2c_channel, uint8_t i2c_address)
Initialize SGP30.
float twr_sgp30_set_compensation(twr_sgp30_t *self, float *t_celsius, float *rh_percentage)
Set sensor compensation (absolute humidity is calculated from temperature and relative humidity)
void twr_sgp30_deinit(twr_sgp30_t *self)
Deinitialize SGP30.
void twr_sgp30_set_event_handler(twr_sgp30_t *self, void(*event_handler)(twr_sgp30_t *, twr_sgp30_event_t, void *), void *event_param)
Set callback function.
bool twr_sgp30_get_co2eq_ppm(twr_sgp30_t *self, uint16_t *ppm)
Get measured CO2eq in ppm (parts per million)
@ TWR_SGP30_EVENT_ERROR
Error event.
@ TWR_SGP30_EVENT_UPDATE
Update event.
uint64_t twr_tick_t
Timestamp data type.