M5Unit-ENV 1.2.0 git rev:d576302
|
SCD40 unit component. More...
#include <unit_SCD40.hpp>
Classes | |
struct | config_t |
Settings for begin. More... | |
Public Member Functions | |
UnitSCD40 (const uint8_t addr=DEFAULT_ADDRESS) | |
virtual bool | begin () override |
virtual void | update (const bool force=false) override |
Settings for begin | |
config_t | config () const |
Gets the configration. | |
void | config (const config_t &cfg) |
Set the configration. | |
Measurement data by periodic | |
uint16_t | co2 () const |
Oldest measured CO2 concentration (ppm) | |
float | temperature () const |
Oldest measured temperature (Celsius) | |
float | celsius () const |
Oldest measured temperature (Celsius) | |
float | fahrenheit () const |
Oldest measured temperature (Fahrenheit) | |
float | humidity () const |
Oldest measured humidity (RH) | |
Periodic measurement | |
bool | startPeriodicMeasurement (const scd4x::Mode mode=scd4x::Mode::Normal) |
Start periodic measurement. | |
bool | startLowPowerPeriodicMeasurement () |
Start low power periodic measurement. | |
bool | stopPeriodicMeasurement (const uint32_t duration=scd4x::STOP_PERIODIC_MEASUREMENT_DURATION) |
Stop periodic measurement. | |
On-Chip Output Signal Compensation | |
bool | writeTemperatureOffset (const float offset, const uint32_t duration=scd4x::SET_TEMPERATURE_OFFSET_DURATION) |
Write the temperature offset. | |
bool | readTemperatureOffset (float &offset) |
Read the temperature offset. | |
bool | writeSensorAltitude (const uint16_t altitude, const uint32_t duration=scd4x::SET_SENSOR_ALTITUDE_DURATION) |
Write the sensor altitude. | |
bool | readSensorAltitude (uint16_t &altitude) |
Read the sensor altitude. | |
bool | writeAmbientPressure (const float pressure, const uint32_t duration=scd4x::SET_AMBIENT_PRESSURE_DURATION) |
Write the ambient pressure. | |
Field Calibration | |
bool | performForcedRecalibration (const uint16_t concentration, int16_t &correction) |
Perform forced recalibration. | |
bool | writeAutomaticSelfCalibrationEnabled (const bool enabled=true, const uint32_t duration=scd4x::SET_AUTOMATIC_SELF_CALIBRATION_ENABLED_DURATION) |
Enable/disable automatic self calibration. | |
bool | readAutomaticSelfCalibrationEnabled (bool &enabled) |
Check if automatic self calibration is enabled. | |
Advanced Features | |
bool | writePersistSettings (const uint32_t duration=scd4x::PERSIST_SETTINGS_DURATION) |
Write sensor settings from RAM to EEPROM. | |
bool | readSerialNumber (char *serialNumber) |
Read the serial number string. | |
bool | readSerialNumber (uint64_t &serialNumber) |
Read the serial number value. | |
bool | performSelfTest (bool &malfunction) |
Perform self test. | |
bool | performFactoryReset (const uint32_t duration=scd4x::PERFORM_FACTORY_RESET_DURATION) |
Peform factory reset. | |
bool | reInit (const uint32_t duration=scd4x::REINIT_DURATION) |
Re-initialize the sensor, load settings from EEPROM. | |
Protected Member Functions | |
bool | start_periodic_measurement (const scd4x::Mode mode=scd4x::Mode::Normal) |
bool | stop_periodic_measurement (const uint32_t duration=scd4x::STOP_PERIODIC_MEASUREMENT_DURATION) |
bool | read_data_ready_status () |
bool | read_measurement (scd4x::Data &d, const bool all=true) |
M5_UNIT_COMPONENT_PERIODIC_MEASUREMENT_ADAPTER_HPP_BUILDER (UnitSCD40, scd4x::Data) | |
Protected Attributes | |
std::unique_ptr< m5::container::CircularBuffer< scd4x::Data > > | _data {} |
config_t | _cfg {} |
SCD40 unit component.
bool m5::unit::UnitSCD40::performFactoryReset | ( | const uint32_t | duration = scd4x::PERFORM_FACTORY_RESET_DURATION | ) |
Peform factory reset.
Reset all settings to the factory values
bool m5::unit::UnitSCD40::performForcedRecalibration | ( | const uint16_t | concentration, |
int16_t & | correction ) |
Perform forced recalibration.
concentration | Unit:ppm | |
[out] | correction | The FRC correction value |
bool m5::unit::UnitSCD40::performSelfTest | ( | bool & | malfunction | ) |
Perform self test.
[out] | True | if malfunction detected |
bool m5::unit::UnitSCD40::readAutomaticSelfCalibrationEnabled | ( | bool & | enabled | ) |
Check if automatic self calibration is enabled.
[out] | enabled | True if automatic self calibration is enabled |
bool m5::unit::UnitSCD40::readSensorAltitude | ( | uint16_t & | altitude | ) |
Read the sensor altitude.
[out] | altitude | Altitude value |
duration | Max command duration(ms) |
bool m5::unit::UnitSCD40::readSerialNumber | ( | char * | serialNumber | ) |
Read the serial number string.
[out] | serialNumber | Output buffer |
bool m5::unit::UnitSCD40::readSerialNumber | ( | uint64_t & | serialNumber | ) |
Read the serial number value.
[out] | serialNumber | serial number value |
bool m5::unit::UnitSCD40::readTemperatureOffset | ( | float & | offset | ) |
Read the temperature offset.
[out] | offset | Offset value |
duration | Max command duration(ms) |
bool m5::unit::UnitSCD40::reInit | ( | const uint32_t | duration = scd4x::REINIT_DURATION | ) |
Re-initialize the sensor, load settings from EEPROM.
|
inline |
Start low power periodic measurement.
|
inline |
Start periodic measurement.
mode | Measurement mode |
|
inline |
Stop periodic measurement.
duration | Max command duration(ms) |
bool m5::unit::UnitSCD40::writeAmbientPressure | ( | const float | pressure, |
const uint32_t | duration = scd4x::SET_AMBIENT_PRESSURE_DURATION ) |
Write the ambient pressure.
Define the ambient pressure in Pascals, so RH and CO2 are compensated for atmospheric pressure setAmbientPressure overrides setSensorAltitude
presure | Unit: pascals (>= 0.0f) |
duration | Max command duration(ms) |
bool m5::unit::UnitSCD40::writeAutomaticSelfCalibrationEnabled | ( | const bool | enabled = true, |
const uint32_t | duration = scd4x::SET_AUTOMATIC_SELF_CALIBRATION_ENABLED_DURATION ) |
Enable/disable automatic self calibration.
enabled | Enable automatic self calibration if true |
bool m5::unit::UnitSCD40::writePersistSettings | ( | const uint32_t | duration = scd4x::PERSIST_SETTINGS_DURATION | ) |
Write sensor settings from RAM to EEPROM.
bool m5::unit::UnitSCD40::writeSensorAltitude | ( | const uint16_t | altitude, |
const uint32_t | duration = scd4x::SET_SENSOR_ALTITUDE_DURATION ) |
Write the sensor altitude.
Define the sensor altitude in metres above sea level, so RH and CO2 arecompensated for atmospheric pressure Default altitude is 0m
altitude | Unit:metres |
duration | Max command duration(ms) |
bool m5::unit::UnitSCD40::writeTemperatureOffset | ( | const float | offset, |
const uint32_t | duration = scd4x::SET_TEMPERATURE_OFFSET_DURATION ) |
Write the temperature offset.
Define how warm the sensor is compared to ambient, so RH and T are temperature compensated. Has no effect on the CO2 reading Default offsetis 4C
offset | (0 <= offset < 175) |
duration | Max command duration(ms) |