Firmware SDK
twr_tag_voc.c
1 #include <twr_tag_voc.h>
2 
4 {
5  twr_sgp30_init(self, i2c_channel, 0x58);
6 }
7 
8 void twr_tag_voc_set_event_handler(twr_tag_voc_t *self, void (*event_handler)(twr_tag_voc_t *, twr_tag_voc_event_t, void *), void *event_param)
9 {
10  twr_sgp30_set_event_handler(self, (void (*)(twr_sgp30_t *, twr_sgp30_event_t, void *)) event_handler, event_param);
11 }
12 
14 {
15  twr_sgp30_set_update_interval(self, interval);
16 }
17 
19 {
20  return twr_sgp30_measure(self);
21 }
22 
23 bool twr_tag_voc_get_co2eq_ppm(twr_tag_voc_t *self, uint16_t *ppm)
24 {
25  return twr_sgp30_get_co2eq_ppm(self, ppm);
26 }
27 
28 bool twr_tag_voc_get_tvoc_ppb(twr_tag_voc_t *self, uint16_t *ppb)
29 {
30  return twr_sgp30_get_tvoc_ppb(self, ppb);
31 }
32 
33 float twr_tag_voc_set_compensation(twr_tag_voc_t *self, float *t_celsius, float *rh_percentage)
34 {
35  return twr_sgp30_set_compensation(self, t_celsius, rh_percentage);
36 }
twr_i2c_channel_t
I2C channels.
Definition: twr_i2c.h:16
twr_sgp30_event_t
Callback events.
Definition: twr_sgp30.h:14
bool twr_sgp30_measure(twr_sgp30_t *self)
Start measurement manually.
Definition: twr_sgp30.c:61
bool twr_sgp30_get_tvoc_ppb(twr_sgp30_t *self, uint16_t *ppb)
Get measured TVOC in ppb (parts per billion)
Definition: twr_sgp30.c:92
void twr_sgp30_set_update_interval(twr_sgp30_t *self, twr_tick_t interval)
Set measurement interval.
Definition: twr_sgp30.c:45
struct twr_sgp30_t twr_sgp30_t
SGP30 instance.
Definition: twr_sgp30.h:25
void twr_sgp30_init(twr_sgp30_t *self, twr_i2c_channel_t i2c_channel, uint8_t i2c_address)
Initialize SGP30.
Definition: twr_sgp30.c:17
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)
Definition: twr_sgp30.c:104
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.
Definition: twr_sgp30.c:39
bool twr_sgp30_get_co2eq_ppm(twr_sgp30_t *self, uint16_t *ppm)
Get measured CO2eq in ppm (parts per million)
Definition: twr_sgp30.c:80
void twr_tag_voc_set_update_interval(twr_tag_voc_t *self, twr_tick_t interval)
Set measurement interval.
Definition: twr_tag_voc.c:13
twr_sgp30_t twr_tag_voc_t
HARDWARIO VOC Module instance.
Definition: twr_tag_voc.h:24
twr_tag_voc_event_t
Callback events.
Definition: twr_tag_voc.h:13
bool twr_tag_voc_measure(twr_tag_voc_t *self)
Start measurement manually.
Definition: twr_tag_voc.c:18
void twr_tag_voc_set_event_handler(twr_tag_voc_t *self, void(*event_handler)(twr_tag_voc_t *, twr_tag_voc_event_t, void *), void *event_param)
Set callback function.
Definition: twr_tag_voc.c:8
bool twr_tag_voc_get_tvoc_ppb(twr_tag_voc_t *self, uint16_t *ppb)
Get measured TVOC in ppb (parts per billion)
Definition: twr_tag_voc.c:28
bool twr_tag_voc_get_co2eq_ppm(twr_tag_voc_t *self, uint16_t *ppm)
Get measured CO2eq in ppm (parts per million)
Definition: twr_tag_voc.c:23
float twr_tag_voc_set_compensation(twr_tag_voc_t *self, float *t_celsius, float *rh_percentage)
Set sensor compensation (absolute humidity is calculated from temperature and relative humidity)
Definition: twr_tag_voc.c:33
void twr_tag_voc_init(twr_tag_voc_t *self, twr_i2c_channel_t i2c_channel)
Initialize HARDWARIO VOC Module.
Definition: twr_tag_voc.c:3
uint64_t twr_tick_t
Timestamp data type.
Definition: twr_tick.h:16