Loading...
Searching...
No Matches
scd30.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2020 Puhang Ding
3 * 2020 Jan Schlichter
4 * 2020 Nishchay Agrawal
5 *
6 * This file is subject to the terms and conditions of the GNU Lesser
7 * General Public License v2.1. See the file LICENSE in the top level
8 * directory for more details.
9 */
10
24#ifndef SCD30_H
25#define SCD30_H
26
27#include "periph/i2c.h"
28#include "saul.h"
29#include "xtimer.h"
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
38#define SCD30_VERSION 0xD100
39#define SCD30_STATUS 0x0202
42#define SCD30_DATA 0x0300
44#define SCD30_START 0x0010
45#define SCD30_STOP 0x0104
46#define SCD30_SOFT_RESET 0xD304
48#define SCD30_INTERVAL 0x4600
50#define SCD30_ASC 0x5306
51#define SCD30_FRC 0x5204
52#define SCD30_T_OFFSET 0x5403
53#define SCD30_A_OFFSET 0x5102
59enum {
60 SCD30_OK = 0,
65};
66
75
79typedef struct {
81 uint8_t i2c_addr;
83
87typedef struct {
89} scd30_t;
90
99int8_t scd30_init(scd30_t *dev, const scd30_params_t *params);
100
111int8_t scd30_set_param(const scd30_t *dev, uint16_t param, uint16_t val);
112
123int8_t scd30_get_param(scd30_t *dev, uint16_t param, uint16_t *val);
124
134
145
158int scd30_start_periodic_measurement(scd30_t *dev, uint16_t *interval,
159 uint16_t *apc);
160
169
177int8_t scd30_reset(scd30_t *dev);
178
179#ifdef __cplusplus
180}
181#endif
182
183#endif /* SCD30_H */
uint_fast8_t i2c_t
Default i2c_t type definition.
Definition i2c.h:151
Low-level I2C peripheral driver interface definition.
uint8_t scd30_read_periodic(scd30_t *dev, scd30_measurement_t *result)
read co2 concentration, temperature and relative humidity when continuous measurements are being take...
int8_t scd30_reset(scd30_t *dev)
Soft reset sensor.
int8_t scd30_get_param(scd30_t *dev, uint16_t param, uint16_t *val)
Get value set for a configuration parameter on the device.
int scd30_start_periodic_measurement(scd30_t *dev, uint16_t *interval, uint16_t *apc)
Initializes Continuous Measurements.
int8_t scd30_stop_measurements(const scd30_t *dev)
Stop Continuous measurements.
@ SCD30_CRC_ERROR
Invalid value or length.
Definition scd30.h:63
@ SCD30_NO_NEW_DATA
No new data.
Definition scd30.h:64
@ SCD30_INVALID_VALUE
Device doesn't exist.
Definition scd30.h:62
@ SCD30_COM_FAILED
Communication with device failed.
Definition scd30.h:61
int8_t scd30_init(scd30_t *dev, const scd30_params_t *params)
Initialize SCD30.
int8_t scd30_set_param(const scd30_t *dev, uint16_t param, uint16_t val)
Set a configuration parameter of device.
int8_t scd30_read_triggered(scd30_t *dev, scd30_measurement_t *result)
read CO2 concentration, temperature and relative humidity once
Measurement from SCD30 sensor.
Definition scd30.h:70
float temperature
Temperature measured in °C.
Definition scd30.h:72
float co2_concentration
CO2 concentration in ppm.
Definition scd30.h:71
float relative_humidity
Relative humidity measured in %.
Definition scd30.h:73
Device initialization parameters.
Definition scd30.h:79
i2c_t i2c_dev
I2C device which is used.
Definition scd30.h:80
uint8_t i2c_addr
I2C address.
Definition scd30.h:81
Device descriptor for the SCD30 sensor.
Definition scd30.h:87
scd30_params_t params
Device initialization parameters.
Definition scd30.h:88
Functionality for reading [S]ensor [A]ctuator [U]ber [L]ayer sensors as SenML.
xtimer interface definitions