Expand description
STCC4 CO2 sensor driver (no-std).
This crate provides a platform agnostic driver for the Sensirion STCC4 CO2 sensor.
It supports both blocking and async modes via embedded-hal and embedded-hal-async.
§Features
async(default): Enables async support viaembedded-hal-async.defmt: Enablesdefmt::Formatderives and addsdefmtlogging statements.serde: Enablesserdesupport for public data types (no std features).
§Usage (blocking)
use stcc4::blocking::Stcc4;
let mut stcc4 = Stcc4::new(delay, i2c);
stcc4.start_continuous_measurement().ok();
let measurement = stcc4.read_measurement().ok();
stcc4.stop_continuous_measurement().ok();§Usage (async)
use stcc4::asynchronous::Stcc4;
let mut stcc4 = Stcc4::new(delay, i2c);
stcc4.start_continuous_measurement().await.ok();
let measurement = stcc4.read_measurement().await.ok();
stcc4.stop_continuous_measurement().await.ok();Modules§
- asynchronous
- Async API
- blocking
- Blocking API
Structs§
- FrcCorrection
- Forced recalibration correction (ppm).
- Measurement
- Represents a measured sample from the sensor.
- Product
Id - Product ID and serial number.
- Self
Test Result - Self test result (raw word + helpers).
- Sensor
Status - Sensor status (16-bit word).
Enums§
- Stcc4
Error - Represents any error that may happen during communication.
Constants§
- EXIT_
SLEEP_ PAYLOAD - Exit sleep payload byte (not acknowledged by the sensor).
- I2C_
GENERAL_ CALL_ ADDR - General call I2C address.
- SOFT_
RESET_ CMD - Soft reset command (general call, not acknowledged by the sensor).
- STCC4_
ADDR_ ALT - Alternative I2C address.
- STCC4_
ADDR_ DEFAULT - Default I2C address.