Loading...
Searching...
No Matches

Driver for the Sensirion SPS30 Particulate Matter Sensor. More...

Detailed Description

Driver for the Sensirion SPS30 Particulate Matter Sensor.

Author
Michel Rottleuthner miche.nosp@m.l.ro.nosp@m.ttleu.nosp@m.thne.nosp@m.r@haw.nosp@m.-ham.nosp@m.burg..nosp@m.de

Definition in file sps30.h.

#include <stdbool.h>
#include "periph/gpio.h"
#include "periph/i2c.h"
+ Include dependency graph for sps30.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  sps30_params_t
 SPS30 device parameters. More...
 
struct  sps30_t
 SPS30 device instance. More...
 
struct  sps30_data_t
 Set of measured particulate matter values. More...
 

Macros

#define SPS30_FAN_CLEAN_S   (10U)
 Seconds the fan cleaning process takes in seconds.
 
#define SPS30_SER_ART_LEN   (32U)
 Length of serial and article code string.
 
#define SPS30_DEFAULT_ACI_S   (604800UL)
 Default fan auto-clean interval in seconds (1 week)
 
#define CONFIG_SPS30_ERROR_RETRY   (500U)
 Maximum number of automatic retries on communication errors.
 

Enumerations

enum  sps30_error_code_t { SPS30_OK = 0 , SPS30_CRC_ERROR , SPS30_I2C_ERROR }
 SPS30 error codes (returned as negative values) More...
 

Functions

int sps30_init (sps30_t *dev, const sps30_params_t *params)
 Initialize SPS30 sensor driver.
 
int sps30_start_measurement (const sps30_t *dev)
 Enable the measurement action.
 
int sps30_stop_measurement (const sps30_t *dev)
 Stops the measurement action.
 
bool sps30_data_ready (const sps30_t *dev, int *error)
 Ask the device if a measurement is ready for reading.
 
int sps30_read_measurement (const sps30_t *dev, sps30_data_t *data)
 Read a set of particulate matter measurements.
 
int sps30_read_ac_interval (const sps30_t *dev, uint32_t *seconds)
 Read the fan auto-clean interval.
 
int sps30_write_ac_interval (const sps30_t *dev, uint32_t seconds)
 Write the fan auto-clean interval.
 
int sps30_start_fan_clean (const sps30_t *dev)
 Run a fan cleaning cycle manually.
 
int sps30_read_article_code (const sps30_t *dev, char *str, size_t len)
 Read the article code from the sensor as string.
 
int sps30_read_serial_number (const sps30_t *dev, char *str, size_t len)
 Read the serial number from the sensor as string.
 
int sps30_reset (const sps30_t *dev)
 Reset the sensor.
 
int sps30_sleep (const sps30_t *dev)
 Put the sensor in sleep mode.
 
int sps30_wakeup (const sps30_t *dev)
 Wake up sensor from sleep mode (returns sensor to Idle mode)