Firmware SDK
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
bc_sgpc3

Driver for SGPC3 VOC gas sensor. More...

Typedefs

typedef struct bc_sgpc3_t bc_sgpc3_t
 SGPC3 instance.
 

Enumerations

enum  bc_sgpc3_event_t {
  BC_SGPC3_EVENT_ERROR = 0,
  BC_SGPC3_EVENT_UPDATE = 1
}
 Callback events. More...
 

Functions

void bc_sgpc3_init (bc_sgpc3_t *self, bc_i2c_channel_t i2c_channel, uint8_t i2c_address)
 Initialize SGPC3. More...
 
void bc_sgpc3_set_event_handler (bc_sgpc3_t *self, void(*event_handler)(bc_sgpc3_t *, bc_sgpc3_event_t, void *), void *event_param)
 Set callback function. More...
 
void bc_sgpc3_set_update_interval (bc_sgpc3_t *self, bc_tick_t interval)
 Set measurement interval. More...
 
bool bc_sgpc3_measure (bc_sgpc3_t *self)
 Start measurement manually. More...
 
bool bc_sgpc3_get_tvoc_ppb (bc_sgpc3_t *self, uint16_t *ppb)
 Get measured TVOC in ppb (parts per billion) More...
 
float bc_sgpc3_set_compensation (bc_sgpc3_t *self, float *t_celsius, float *rh_percentage)
 Set sensor compensation (absolute humidity is calculated from temperature and relative humidity) More...
 

Detailed Description

Driver for SGPC3 VOC gas sensor.

Enumeration Type Documentation

Callback events.

Enumerator
BC_SGPC3_EVENT_ERROR 

Error event.

BC_SGPC3_EVENT_UPDATE 

Update event.

Definition at line 13 of file bc_sgpc3.h.

Function Documentation

bool bc_sgpc3_get_tvoc_ppb ( bc_sgpc3_t self,
uint16_t *  ppb 
)

Get measured TVOC in ppb (parts per billion)

Parameters
[in]selfInstance
[out]ppbPointer to variable where result will be stored
Returns
true When value is valid
false When value is invalid

Definition at line 74 of file bc_sgpc3.c.

Referenced by bc_tag_voc_lp_get_tvoc_ppb().

Here is the caller graph for this function:

void bc_sgpc3_init ( bc_sgpc3_t self,
bc_i2c_channel_t  i2c_channel,
uint8_t  i2c_address 
)

Initialize SGPC3.

Parameters
[in]selfInstance
[in]i2c_channelI2C channel
[in]i2c_addressI2C device address

Definition at line 18 of file bc_sgpc3.c.

Referenced by bc_tag_voc_lp_init().

Here is the call graph for this function:

Here is the caller graph for this function:

bool bc_sgpc3_measure ( bc_sgpc3_t self)

Start measurement manually.

Parameters
[in]selfInstance
Returns
true On success
false When other measurement is in progress

Definition at line 55 of file bc_sgpc3.c.

Referenced by bc_sgpc3_set_update_interval(), and bc_tag_voc_lp_measure().

Here is the caller graph for this function:

float bc_sgpc3_set_compensation ( bc_sgpc3_t self,
float *  t_celsius,
float *  rh_percentage 
)

Set sensor compensation (absolute humidity is calculated from temperature and relative humidity)

Parameters
[in]selfInstance
[in]t_celsiusPointer to variable holding temperature in degrees of celsius (must be NULL if not available)
[in]rh_percentagePointer to variable holding relative humidity in percentage (must be NULL if not available)
Returns
Absolute humidity in grams per cubic meter

Definition at line 86 of file bc_sgpc3.c.

Referenced by bc_tag_voc_lp_set_compensation().

Here is the caller graph for this function:

void bc_sgpc3_set_event_handler ( bc_sgpc3_t self,
void(*)(bc_sgpc3_t *, bc_sgpc3_event_t, void *)  event_handler,
void *  event_param 
)

Set callback function.

Parameters
[in]selfInstance
[in]event_handlerFunction address
[in]event_paramOptional event parameter (can be NULL)

Definition at line 33 of file bc_sgpc3.c.

Referenced by bc_tag_voc_lp_set_event_handler().

Here is the caller graph for this function:

void bc_sgpc3_set_update_interval ( bc_sgpc3_t self,
bc_tick_t  interval 
)

Set measurement interval.

Parameters
[in]selfInstance
[in]intervalMeasurement interval

Definition at line 39 of file bc_sgpc3.c.

Referenced by bc_tag_voc_lp_set_update_interval().

Here is the call graph for this function:

Here is the caller graph for this function: