Firmware SDK
twr_tag_voc_lp.c
1 #include <twr_tag_voc_lp.h>
2 
4 {
5  twr_sgpc3_init(self, i2c_channel, 0x58);
6 }
7 
8 void twr_tag_voc_lp_set_event_handler(twr_tag_voc_lp_t *self, void (*event_handler)(twr_tag_voc_lp_t *, twr_tag_voc_lp_event_t, void *), void *event_param)
9 {
10  twr_sgpc3_set_event_handler(self, (void (*)(twr_sgpc3_t *, twr_sgpc3_event_t, void *)) event_handler, event_param);
11 }
12 
14 {
15  twr_sgpc3_set_update_interval(self, interval);
16 }
17 
19 {
20  return twr_sgpc3_measure(self);
21 }
22 
24 {
25  return twr_sgpc3_get_tvoc_ppb(self, ppb);
26 }
27 
28 float twr_tag_voc_lp_set_compensation(twr_tag_voc_lp_t *self, float *t_celsius, float *rh_percentage)
29 {
30  return twr_sgpc3_set_compensation(self, t_celsius, rh_percentage);
31 }
twr_i2c_channel_t
I2C channels.
Definition: twr_i2c.h:16
twr_sgpc3_event_t
Callback events.
Definition: twr_sgpc3.h:14
void twr_sgpc3_set_update_interval(twr_sgpc3_t *self, twr_tick_t interval)
Set measurement interval.
Definition: twr_sgpc3.c:46
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)
Definition: twr_sgpc3.c:93
bool twr_sgpc3_measure(twr_sgpc3_t *self)
Start measurement manually.
Definition: twr_sgpc3.c:62
bool twr_sgpc3_get_tvoc_ppb(twr_sgpc3_t *self, uint16_t *ppb)
Get measured TVOC in ppb (parts per billion)
Definition: twr_sgpc3.c:81
void twr_sgpc3_init(twr_sgpc3_t *self, twr_i2c_channel_t i2c_channel, uint8_t i2c_address)
Initialize SGPC3.
Definition: twr_sgpc3.c:18
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.
Definition: twr_sgpc3.c:40
struct twr_sgpc3_t twr_sgpc3_t
SGPC3 instance.
Definition: twr_sgpc3.h:25
void twr_tag_voc_lp_init(twr_tag_voc_lp_t *self, twr_i2c_channel_t i2c_channel)
Initialize HARDWARIO VOC-LP Module.
Definition: twr_tag_voc_lp.c:3
void twr_tag_voc_lp_set_update_interval(twr_tag_voc_lp_t *self, twr_tick_t interval)
Set measurement interval.
bool twr_tag_voc_lp_measure(twr_tag_voc_lp_t *self)
Start measurement manually.
float twr_tag_voc_lp_set_compensation(twr_tag_voc_lp_t *self, float *t_celsius, float *rh_percentage)
Set sensor compensation (absolute humidity is calculated from temperature and relative humidity)
void twr_tag_voc_lp_set_event_handler(twr_tag_voc_lp_t *self, void(*event_handler)(twr_tag_voc_lp_t *, twr_tag_voc_lp_event_t, void *), void *event_param)
Set callback function.
Definition: twr_tag_voc_lp.c:8
twr_sgpc3_t twr_tag_voc_lp_t
HARDWARIO VOC-LP Module instance.
bool twr_tag_voc_lp_get_tvoc_ppb(twr_tag_voc_lp_t *self, uint16_t *ppb)
Get measured TVOC in ppb (parts per billion)
twr_tag_voc_lp_event_t
Callback events.
uint64_t twr_tick_t
Timestamp data type.
Definition: twr_tick.h:16