|
Firmware SDK
|
Driver for SGPC3 VOC gas sensor. More...
Typedefs | |
| typedef struct twr_sgpc3_t | twr_sgpc3_t |
| SGPC3 instance. | |
Enumerations | |
| enum | twr_sgpc3_event_t { TWR_SGPC3_EVENT_ERROR = 0 , TWR_SGPC3_EVENT_UPDATE = 1 } |
| Callback events. More... | |
Functions | |
| void | twr_sgpc3_init (twr_sgpc3_t *self, twr_i2c_channel_t i2c_channel, uint8_t i2c_address) |
| Initialize SGPC3. More... | |
| void | twr_sgpc3_deinit (twr_sgpc3_t *self) |
| Deinitialize SGPC3. More... | |
| 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. More... | |
| void | twr_sgpc3_set_update_interval (twr_sgpc3_t *self, twr_tick_t interval) |
| Set measurement interval. More... | |
| bool | twr_sgpc3_measure (twr_sgpc3_t *self) |
| Start measurement manually. More... | |
| bool | twr_sgpc3_get_tvoc_ppb (twr_sgpc3_t *self, uint16_t *ppb) |
| Get measured TVOC in ppb (parts per billion) More... | |
| 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) More... | |
Driver for SGPC3 VOC gas sensor.
| enum twr_sgpc3_event_t |
Callback events.
| Enumerator | |
|---|---|
| TWR_SGPC3_EVENT_ERROR | Error event. |
| TWR_SGPC3_EVENT_UPDATE | Update event. |
Definition at line 13 of file twr_sgpc3.h.
| void twr_sgpc3_deinit | ( | twr_sgpc3_t * | self | ) |
Deinitialize SGPC3.
| [in] | self | Instance |
Definition at line 33 of file twr_sgpc3.c.

| bool twr_sgpc3_get_tvoc_ppb | ( | twr_sgpc3_t * | self, |
| uint16_t * | ppb | ||
| ) |
Get measured TVOC in ppb (parts per billion)
| [in] | self | Instance |
| [out] | ppb | Pointer to variable where result will be stored |
Definition at line 81 of file twr_sgpc3.c.
Referenced by twr_tag_voc_lp_get_tvoc_ppb().

| void twr_sgpc3_init | ( | twr_sgpc3_t * | self, |
| twr_i2c_channel_t | i2c_channel, | ||
| uint8_t | i2c_address | ||
| ) |
Initialize SGPC3.
| [in] | self | Instance |
| [in] | i2c_channel | I2C channel |
| [in] | i2c_address | I2C device address |
Definition at line 18 of file twr_sgpc3.c.
Referenced by twr_tag_voc_lp_init().


| bool twr_sgpc3_measure | ( | twr_sgpc3_t * | self | ) |
Start measurement manually.
| [in] | self | Instance |
Definition at line 62 of file twr_sgpc3.c.
Referenced by twr_sgpc3_set_update_interval(), and twr_tag_voc_lp_measure().

| 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)
| [in] | self | Instance |
| [in] | t_celsius | Pointer to variable holding temperature in degrees of celsius (must be NULL if not available) |
| [in] | rh_percentage | Pointer to variable holding relative humidity in percentage (must be NULL if not available) |
Definition at line 93 of file twr_sgpc3.c.
Referenced by twr_tag_voc_lp_set_compensation().

| void twr_sgpc3_set_event_handler | ( | twr_sgpc3_t * | self, |
| void(*)(twr_sgpc3_t *, twr_sgpc3_event_t, void *) | event_handler, | ||
| void * | event_param | ||
| ) |
Set callback function.
| [in] | self | Instance |
| [in] | event_handler | Function address |
| [in] | event_param | Optional event parameter (can be NULL) |
Definition at line 40 of file twr_sgpc3.c.
Referenced by twr_tag_voc_lp_set_event_handler().

| void twr_sgpc3_set_update_interval | ( | twr_sgpc3_t * | self, |
| twr_tick_t | interval | ||
| ) |
Set measurement interval.
| [in] | self | Instance |
| [in] | interval | Measurement interval |
Definition at line 46 of file twr_sgpc3.c.
Referenced by twr_tag_voc_lp_set_update_interval().

