Firmware SDK
|
Driver for SPS30 PM sensor. More...
Typedefs | |
typedef struct twr_sps30_t | twr_sps30_t |
SPS30 instance. | |
Enumerations | |
enum | twr_sps30_event_t { TWR_SPS30_EVENT_ERROR = 0 , TWR_SPS30_EVENT_UPDATE = 1 } |
Callback events. More... | |
Functions | |
void | twr_sps30_init (twr_sps30_t *self, twr_i2c_channel_t i2c_channel, uint8_t i2c_address) |
Initialize SPS30. More... | |
void | twr_sps30_set_event_handler (twr_sps30_t *self, void(*event_handler)(twr_sps30_t *, twr_sps30_event_t, void *), void *event_param) |
Set callback function. More... | |
void | twr_sps30_set_startup_time (twr_sps30_t *self, twr_tick_t startup_time) |
Set startup time (how long the fan blows air before the measurement) More... | |
void | twr_sps30_set_update_interval (twr_sps30_t *self, twr_tick_t interval) |
Set measurement interval. More... | |
bool | twr_sps30_measure (twr_sps30_t *self) |
Start measurement manually. More... | |
bool | twr_sps30_get_mass_concentration (twr_sps30_t *self, twr_sps30_mass_concentration_t *mass_concentration) |
Get measured mass concentration in μg/m3. More... | |
bool | twr_sps30_get_number_concentration (twr_sps30_t *self, twr_sps30_number_concentration_t *number_concentration) |
Get measured number concentration in #/cm3. More... | |
bool | twr_sps30_get_typical_particle_size (twr_sps30_t *self, float *typical_particle_size) |
Get measured typical particle size in μm. More... | |
Driver for SPS30 PM sensor.
enum twr_sps30_event_t |
Callback events.
Enumerator | |
---|---|
TWR_SPS30_EVENT_ERROR | Error event. |
TWR_SPS30_EVENT_UPDATE | Update event. |
Definition at line 13 of file twr_sps30.h.
bool twr_sps30_get_mass_concentration | ( | twr_sps30_t * | self, |
twr_sps30_mass_concentration_t * | mass_concentration | ||
) |
Get measured mass concentration in μg/m3.
[in] | self | Instance |
[out] | mass_concentration | Pointer to mass concentration structure |
Definition at line 75 of file twr_sps30.c.
bool twr_sps30_get_number_concentration | ( | twr_sps30_t * | self, |
twr_sps30_number_concentration_t * | number_concentration | ||
) |
Get measured number concentration in #/cm3.
[in] | self | Instance |
[out] | number_concentration | Pointer to number concentration structure |
Definition at line 90 of file twr_sps30.c.
bool twr_sps30_get_typical_particle_size | ( | twr_sps30_t * | self, |
float * | typical_particle_size | ||
) |
Get measured typical particle size in μm.
[in] | self | Instance |
[out] | typical_particle_size | Pointer to typical particle size |
Definition at line 106 of file twr_sps30.c.
void twr_sps30_init | ( | twr_sps30_t * | self, |
twr_i2c_channel_t | i2c_channel, | ||
uint8_t | i2c_address | ||
) |
Initialize SPS30.
[in] | self | Instance |
[in] | i2c_channel | I2C channel |
[in] | i2c_address | I2C device address |
Definition at line 20 of file twr_sps30.c.
bool twr_sps30_measure | ( | twr_sps30_t * | self | ) |
Start measurement manually.
[in] | self | Instance |
Definition at line 60 of file twr_sps30.c.
void twr_sps30_set_event_handler | ( | twr_sps30_t * | self, |
void(*)(twr_sps30_t *, twr_sps30_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 35 of file twr_sps30.c.
void twr_sps30_set_startup_time | ( | twr_sps30_t * | self, |
twr_tick_t | startup_time | ||
) |
Set startup time (how long the fan blows air before the measurement)
[in] | self | Instance |
[in] | interval | Startup time |
Definition at line 41 of file twr_sps30.c.
void twr_sps30_set_update_interval | ( | twr_sps30_t * | self, |
twr_tick_t | interval | ||
) |
Set measurement interval.
[in] | self | Instance |
[in] | interval | Measurement interval |
Definition at line 46 of file twr_sps30.c.