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

Driver for SPS30 PM sensor. More...

Typedefs

typedef struct bc_sps30_t bc_sps30_t
 SPS30 instance.
 

Enumerations

enum  bc_sps30_event_t {
  BC_SPS30_EVENT_ERROR = 0,
  BC_SPS30_EVENT_UPDATE = 1
}
 Callback events. More...
 

Functions

void bc_sps30_init (bc_sps30_t *self, bc_i2c_channel_t i2c_channel, uint8_t i2c_address)
 Initialize SPS30. More...
 
void bc_sps30_set_event_handler (bc_sps30_t *self, void(*event_handler)(bc_sps30_t *, bc_sps30_event_t, void *), void *event_param)
 Set callback function. More...
 
void bc_sps30_set_startup_time (bc_sps30_t *self, bc_tick_t startup_time)
 Set startup time (how long the fan blows air before the measurement) More...
 
void bc_sps30_set_update_interval (bc_sps30_t *self, bc_tick_t interval)
 Set measurement interval. More...
 
bool bc_sps30_measure (bc_sps30_t *self)
 Start measurement manually. More...
 
bool bc_sps30_get_mass_concentration (bc_sps30_t *self, bc_sps30_mass_concentration_t *mass_concentration)
 Get measured mass concentration in μg/m3. More...
 
bool bc_sps30_get_number_concentration (bc_sps30_t *self, bc_sps30_number_concentration_t *number_concentration)
 Get measured number concentration in #/cm3. More...
 
bool bc_sps30_get_typical_particle_size (bc_sps30_t *self, float *typical_particle_size)
 Get measured typical particle size in μm. More...
 

Detailed Description

Driver for SPS30 PM sensor.

Enumeration Type Documentation

Callback events.

Enumerator
BC_SPS30_EVENT_ERROR 

Error event.

BC_SPS30_EVENT_UPDATE 

Update event.

Definition at line 13 of file bc_sps30.h.

Function Documentation

bool bc_sps30_get_mass_concentration ( bc_sps30_t self,
bc_sps30_mass_concentration_t *  mass_concentration 
)

Get measured mass concentration in μg/m3.

Parameters
[in]selfInstance
[out]mass_concentrationPointer to mass concentration structure
Returns
true When value is valid
false When value is invalid

Definition at line 75 of file bc_sps30.c.

bool bc_sps30_get_number_concentration ( bc_sps30_t self,
bc_sps30_number_concentration_t *  number_concentration 
)

Get measured number concentration in #/cm3.

Parameters
[in]selfInstance
[out]number_concentrationPointer to number concentration structure
Returns
true When value is valid
false When value is invalid

Definition at line 90 of file bc_sps30.c.

bool bc_sps30_get_typical_particle_size ( bc_sps30_t self,
float *  typical_particle_size 
)

Get measured typical particle size in μm.

Parameters
[in]selfInstance
[out]typical_particle_sizePointer to typical particle size
Returns
true When value is valid
false When value is invalid

Definition at line 106 of file bc_sps30.c.

void bc_sps30_init ( bc_sps30_t self,
bc_i2c_channel_t  i2c_channel,
uint8_t  i2c_address 
)

Initialize SPS30.

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

Definition at line 20 of file bc_sps30.c.

Here is the call graph for this function:

bool bc_sps30_measure ( bc_sps30_t self)

Start measurement manually.

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

Definition at line 60 of file bc_sps30.c.

Here is the call graph for this function:

void bc_sps30_set_event_handler ( bc_sps30_t self,
void(*)(bc_sps30_t *, bc_sps30_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 35 of file bc_sps30.c.

void bc_sps30_set_startup_time ( bc_sps30_t self,
bc_tick_t  startup_time 
)

Set startup time (how long the fan blows air before the measurement)

Parameters
[in]selfInstance
[in]intervalStartup time

Definition at line 41 of file bc_sps30.c.

void bc_sps30_set_update_interval ( bc_sps30_t self,
bc_tick_t  interval 
)

Set measurement interval.

Parameters
[in]selfInstance
[in]intervalMeasurement interval

Definition at line 46 of file bc_sps30.c.

Here is the call graph for this function: