Device driver interface for the SCD30 sensor. More...

Detailed Description

#include "periph/i2c.h"
#include "saul.h"
#include "xtimer.h"
+ Include dependency graph for scd30.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  scd30_measurement_t
 Measurement from SCD30 sensor. More...
 
struct  scd30_params_t
 Device initialization parameters. More...
 
struct  scd30_t
 Device descriptor for the SCD30 sensor. More...
 

Macros

#define SCD30_VERSION   0xD100
 SCD30 Configuration parameter commands. More...
 
#define SCD30_STATUS   0x0202
 Get data ready status from scd30 device.
 
#define SCD30_DATA   0x0300
 Get data from scd30 device.
 
#define SCD30_START   0x0010
 Start measuring data from scd30 device.
 
#define SCD30_STOP   0x0104
 Stop measuring data from scd30 device.
 
#define SCD30_SOFT_RESET   0xD304
 Soft reset scd30 device.
 
#define SCD30_INTERVAL   0x4600
 Set measurement interval (2-1800 seconds)
 
#define SCD30_ASC   0x5306
 De-Activate Automatic Self-Calibration.
 
#define SCD30_FRC   0x5204
 Forced Recalibration. More...
 
#define SCD30_T_OFFSET   0x5403
 Set temperature Offset in 0.01 Celsius.
 
#define SCD30_A_OFFSET   0x5102
 Altitude Compensation in meters above sea level.
 

Enumerations

enum  {
  SCD30_OK = 0, SCD30_COM_FAILED = -1, SCD30_INVALID_VALUE = -2, SCD30_CRC_ERROR = -3,
  SCD30_NO_NEW_DATA = -4
}
 Status and error codes for return values. More...
 

Functions

int8_t scd30_init (scd30_t *dev, const scd30_params_t *params)
 Initialize SCD30. More...
 
int8_t scd30_set_param (const scd30_t *dev, uint16_t param, uint16_t val)
 Set a configuration parameter of device. More...
 
int8_t scd30_get_param (scd30_t *dev, uint16_t param, uint16_t *val)
 Get value set for a configuration parameter on the device. More...
 
int8_t scd30_read_triggered (scd30_t *dev, scd30_measurement_t *result)
 read CO2 concentration, temperature and relative humidity once More...
 
uint8_t scd30_read_periodic (scd30_t *dev, scd30_measurement_t *result)
 read co2 concentration, temperature and relative humidity when continuous measurements are being taken More...
 
int scd30_start_periodic_measurement (scd30_t *dev, uint16_t *interval, uint16_t *apc)
 Initializes Continuous Measurements. More...
 
int8_t scd30_stop_measurements (const scd30_t *dev)
 Stop Continuous measurements. More...
 
int8_t scd30_reset (scd30_t *dev)
 Soft reset sensor. More...
 

Macro Definition Documentation

◆ SCD30_FRC

#define SCD30_FRC   0x5204

Forced Recalibration.

400-2000ppm

Definition at line 51 of file scd30.h.

◆ SCD30_VERSION

#define SCD30_VERSION   0xD100

SCD30 Configuration parameter commands.

Get scd30 version

Definition at line 38 of file scd30.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Status and error codes for return values.

Enumerator
SCD30_COM_FAILED 

Communication with device failed.

SCD30_INVALID_VALUE 

Device doesn't exist.

SCD30_CRC_ERROR 

Invalid value or length.

SCD30_NO_NEW_DATA 

No new data.

Definition at line 59 of file scd30.h.

Function Documentation

◆ scd30_get_param()

int8_t scd30_get_param ( scd30_t dev,
uint16_t  param,
uint16_t *  val 
)

Get value set for a configuration parameter on the device.

Parameters
devscd30 device
paramparam to be set/operation to be performed param codes mentioned in scd30_internal
valPointer to the value to be set for that parameter
Returns
SCD30_OK on success

◆ scd30_init()

int8_t scd30_init ( scd30_t dev,
const scd30_params_t params 
)

Initialize SCD30.

Parameters
devscd30 device
paramsscd30 device params
Returns
SCD30_OK if device started

◆ scd30_read_periodic()

uint8_t scd30_read_periodic ( scd30_t dev,
scd30_measurement_t result 
)

read co2 concentration, temperature and relative humidity when continuous measurements are being taken

Parameters
devscd30 device
resultstruct to store result
Returns
SCD30_OK on success

◆ scd30_read_triggered()

int8_t scd30_read_triggered ( scd30_t dev,
scd30_measurement_t result 
)

read CO2 concentration, temperature and relative humidity once

Parameters
devscd30 device
resultValues are stored in this struct
Returns
SCD30_OK on success

◆ scd30_reset()

int8_t scd30_reset ( scd30_t dev)

Soft reset sensor.

Parameters
devscd30 dev device
Returns
SCD30_OK if soft reset successful

◆ scd30_set_param()

int8_t scd30_set_param ( const scd30_t dev,
uint16_t  param,
uint16_t  val 
)

Set a configuration parameter of device.

Parameters
devscd30 device
paramparam to be set/operation to be performed param codes mentioned in scd30_internal
valvalue to be set for that parameter
Returns
SCD30_OK on success

◆ scd30_start_periodic_measurement()

int scd30_start_periodic_measurement ( scd30_t dev,
uint16_t *  interval,
uint16_t *  apc 
)

Initializes Continuous Measurements.

Parameters
devscd30 device
intervalInterval at which new measurements have to be taken in seconds (between 2 and 1800 seconds, both inclusive)
apcAverage Pressure Compensation 0 to disable pressure compensation 700-1400 mBar for valid pressure compensation
Returns
SCD30_OK if device started

◆ scd30_stop_measurements()

int8_t scd30_stop_measurements ( const scd30_t dev)

Stop Continuous measurements.

Parameters
devscd30 dev device
Returns
SCD30_OK if measurement stopped