Loading...
Searching...
No Matches

Interface for controlling SDS011 Laser Dust Sensor. More...

Detailed Description

Interface for controlling SDS011 Laser Dust 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 sds011.h.

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

Go to the source code of this file.

Data Structures

struct  sds011_params_t
 Configuration parameters for SDS011 Laser Dust Sensor. More...
 
struct  sds011_data_t
 Data type for storing SDS011 sensor readings. More...
 
struct  sds011_t
 Device descriptor definition for SDS011 Laser Dust Sensor. More...
 

Macros

#define SDS011_DEVID_WILDCARD   (0xFFFF)
 SDS011 wildcard address to address all devices.
 

Typedefs

typedef enum sds011_reporting_mode sds011_reporting_mode_t
 Report mode of the SDS011 sensor.
 
typedef enum sds011_working_mode sds011_working_mode_t
 Work/sleep mode of the SDS011 sensor.
 
typedef void(* sds011_callback_t) (sds011_data_t *data, void *ctx)
 callback for measurements actively reported by the SDS011 sensor
 

Enumerations

enum  { SDS011_OK , SDS011_INVALID_RESPONSE , SDS011_INVALID_CHKSUM , SDS011_ERROR }
 Named return values. More...
 
enum  sds011_reporting_mode { SDS011_RMODE_ACTIVE = 0 , SDS011_RMODE_QUERY = 1 }
 Report mode of the SDS011 sensor. More...
 
enum  sds011_working_mode { SDS011_WMODE_SLEEP = 0 , SDS011_WMODE_WORK = 1 }
 Work/sleep mode of the SDS011 sensor. More...
 

Functions

int sds011_init (sds011_t *dev, const sds011_params_t *params)
 Initialize SDS011 Laser Dust Sensor.
 
void sds011_power_on (const sds011_t *dev)
 Enable power supply of SDS011 laser dust sensor.
 
void sds011_power_off (const sds011_t *dev)
 Disable power supply of SDS011 laser dust sensor.
 
int sds011_read (sds011_t *dev, sds011_data_t *data)
 Read measurement values from SDS011 laser dust sensor.
 
int sds011_register_callback (sds011_t *dev, sds011_callback_t cb, void *ctx)
 Register measurement callback.
 
int sds011_get_reporting_mode (sds011_t *dev, sds011_reporting_mode_t *mode)
 Get the current reporting mode of the sensor.
 
int sds011_set_reporting_mode (sds011_t *dev, sds011_reporting_mode_t mode)
 Set the reporting mode of the sensor.
 
int sds011_get_working_mode (sds011_t *dev, sds011_working_mode_t *mode)
 Get current working mode of the sensor.
 
int sds011_set_working_mode (sds011_t *dev, sds011_working_mode_t mode)
 Set working mode of the sensor.
 
int sds011_get_working_period (sds011_t *dev, uint8_t *minutes)
 Get current working period of the sensor.
 
int sds011_set_working_period (sds011_t *dev, uint8_t minutes)
 Set working period of the sensor.
 
int sds011_get_fw_version (sds011_t *dev, uint8_t *year, uint8_t *mon, uint8_t *day)
 Get firmware version of the sensor.
 
int sds011_set_dev_id (sds011_t *dev, uint16_t sens_dev_id)
 Set device ID of the sensor.