I²C driver for the SCD30 environmental sensor. More...
#include <stddef.h>#include "freertos/FreeRTOS.h"#include "freertos/task.h"#include "rom/ets_sys.h"#include "esp_err.h"#include "i2c_bus.h"#include "esp_log.h"Go to the source code of this file.
Data Structures | |
| struct | scd30_dev_t |
| Structure representing the SCD30 device on an I²C bus. More... | |
Macros | |
| #define | SCD30_I2C_ADDR (0x61) |
| Default I²C address for SCD30 sensors. | |
Typedefs | |
| typedef uint16_t | p_mbar_t |
| Type for pressure [mbar]. | |
| typedef uint16_t | i_sec_t |
| Type for measurement interval [s]. | |
| typedef uint16_t | uco2_ppm_t |
| Type for CO₂ concentration [ppm] (forced recalibration only). | |
| typedef uint16_t | tx100_celsius_t |
| Type for temperature [°C × 100]. | |
| typedef uint16_t | alt_m_t |
| Type for altitude [m]. | |
| typedef float | t_celsius_t |
| Type for temperature [°C]. | |
| typedef float | rh_percent_t |
| Type for relative humidity [%]. | |
| typedef float | co2_ppm_t |
| Type for CO₂ [ppm]. | |
| typedef uint8_t | i2c_addr_t |
| Type for I²C addresses. | |
| typedef void * | scd30_handle_t |
| Opaque handle for an SCD30 sensor. | |
Functions | |
| scd30_handle_t | scd30_i2c_create (i2c_bus_handle_t bus, i2c_addr_t dev_addr) |
| Create a handle for an SCD30 sensor but does not apply any configuration. | |
| scd30_handle_t | scd30_i2c_init (i2c_bus_handle_t bus, i2c_addr_t dev_addr) |
| Initialize the SCD30 sensor on the I²C bus with a default configuration. | |
| void | scd30_i2c_delete (scd30_handle_t sensor) |
| Deinitialize the SCD30 sensor and free resources. | |
| esp_err_t | scd30_i2c_trigger_continuous_measurement (scd30_handle_t sensor, p_mbar_t p_comp) |
| Trigger continuous measurement. | |
| esp_err_t | scd30_i2c_stop_continuous_measurement (scd30_handle_t sensor) |
| Stop continuous measurement. | |
| esp_err_t | scd30_i2c_read_measurement_interval (scd30_handle_t sensor, i_sec_t *interval) |
| Read the measurement interval. | |
| esp_err_t | scd30_i2c_write_measurement_interval (scd30_handle_t sensor, i_sec_t interval) |
| Set measurement interval. | |
| esp_err_t | scd30_i2c_read_data_ready_status (scd30_handle_t sensor, bool *data_ready) |
| Check whether new measurement data is available for read-out. | |
| esp_err_t | scd30_i2c_read_measurement (scd30_handle_t sensor, co2_ppm_t *co2, t_celsius_t *temperature, rh_percent_t *humidity) |
| Read CO₂, temperature and humidity measurements. | |
| esp_err_t | scd30_i2c_read_automatic_self_calibration (scd30_handle_t sensor, bool *enabled) |
| Get automatic self calibration (ASC) state. | |
| esp_err_t | scd30_i2c_write_automatic_self_calibration (scd30_handle_t sensor, bool enabled) |
| Enable or disable automatic self calibration (ASC). | |
| esp_err_t | scd30_i2c_read_forced_recalibration_value (scd30_handle_t sensor, uco2_ppm_t *frc) |
| Get forced recalibration (FRC) value. | |
| esp_err_t | scd30_i2c_write_forced_recalibration_value (scd30_handle_t sensor, uco2_ppm_t target) |
| Set forced recalibration (FRC) value. | |
| esp_err_t | scd30_i2c_read_temperature_offset_ticks (scd30_handle_t sensor, tx100_celsius_t *offset) |
| Get temperature offset in ticks. | |
| esp_err_t | scd30_i2c_read_temperature_offset (scd30_handle_t sensor, t_celsius_t *offset) |
| Get temperature offset. | |
| esp_err_t | scd30_i2c_write_temperature_offset_ticks (scd30_handle_t sensor, tx100_celsius_t offset) |
| Set temperature offset in ticks. | |
| esp_err_t | scd30_i2c_write_temperature_offset (scd30_handle_t sensor, t_celsius_t offset) |
| Set temperature offset. | |
| esp_err_t | scd30_i2c_read_sensor_altitude (scd30_handle_t sensor, alt_m_t *altitude) |
| Get configured sensor altitude. | |
| esp_err_t | scd30_i2c_write_sensor_altitude (scd30_handle_t sensor, alt_m_t altitude) |
| Set sensor altitude above sea level. | |
| esp_err_t | scd30_i2c_read_firmware_version (scd30_handle_t sensor, uint16_t *firmware_version) |
| Get firmware version. | |
| esp_err_t | scd30_i2c_soft_reset (scd30_handle_t sensor) |
| Reset the sensor. | |
I²C driver for the SCD30 environmental sensor.
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see https://www.gnu.org/licenses/.