pub struct AsyncScd4x<I2c, Delay, State> { /* private fields */ }
Expand description
Interface to SCD4x sensor over I²C
Implementations§
Source§impl<I2C, D> Scd4x<I2C, D, Idle>
impl<I2C, D> Scd4x<I2C, D, Idle>
Sourcepub fn new(i2c: I2C, delay: D) -> Self
pub fn new(i2c: I2C, delay: D) -> Self
Create a new sensor using an I²C interface and a delay function using
the sensor’s default address DEFAULT_ADDRESS
)
Sourcepub fn new_with_address(i2c: I2C, address: u8, delay: D) -> Self
pub fn new_with_address(i2c: I2C, address: u8, delay: D) -> Self
Create a new sensor using an I²C interface and a delay function using a custom address
Sourcepub async fn set_temperature_offset(
&mut self,
temperature_offset: Temperature,
) -> Result<(), Error>
pub async fn set_temperature_offset( &mut self, temperature_offset: Temperature, ) -> Result<(), Error>
Sourcepub async fn get_temperature_offset(&mut self) -> Result<Temperature, Error>
pub async fn get_temperature_offset(&mut self) -> Result<Temperature, Error>
Sourcepub async fn set_sensor_altitude(
&mut self,
sensor_altitude: Altitude,
) -> Result<(), Error>
pub async fn set_sensor_altitude( &mut self, sensor_altitude: Altitude, ) -> Result<(), Error>
Sourcepub async fn get_sensor_altitude(&mut self) -> Result<Altitude, Error>
pub async fn get_sensor_altitude(&mut self) -> Result<Altitude, Error>
Sourcepub async fn perform_forced_recalibration(
&mut self,
co2: Co2,
) -> Result<Option<Co2>, Error>
pub async fn perform_forced_recalibration( &mut self, co2: Co2, ) -> Result<Option<Co2>, Error>
Sourcepub async fn set_automatic_self_calibration_enabled(
&mut self,
enabled: bool,
) -> Result<(), Error>
pub async fn set_automatic_self_calibration_enabled( &mut self, enabled: bool, ) -> Result<(), Error>
Set whether automatic self-calibration is enabled
§Errors
Return an error if it cannot communicate with the sensor.
Sourcepub async fn get_automatic_self_calibration_enabled(
&mut self,
) -> Result<bool, Error>
pub async fn get_automatic_self_calibration_enabled( &mut self, ) -> Result<bool, Error>
Query whether automatic self-calibration is enabled
§Errors
Return an error if it cannot communicate with the sensor.
Sourcepub async fn start_low_power_periodic_measurement(
self,
) -> Result<Scd4x<I2C, D, Measuring>, Error>
pub async fn start_low_power_periodic_measurement( self, ) -> Result<Scd4x<I2C, D, Measuring>, Error>
Start low-power periodic measurement
§Errors
Return an error if it cannot communicate with the sensor.
Sourcepub async fn persist_settings(&mut self) -> Result<(), Error>
pub async fn persist_settings(&mut self) -> Result<(), Error>
Sourcepub async fn get_serial_number(&mut self) -> Result<u64, Error>
pub async fn get_serial_number(&mut self) -> Result<u64, Error>
Sourcepub async fn perform_self_test(&mut self) -> Result<bool, Error>
pub async fn perform_self_test(&mut self) -> Result<bool, Error>
Sourcepub async fn perform_factory_reset(&mut self) -> Result<(), Error>
pub async fn perform_factory_reset(&mut self) -> Result<(), Error>
Sourcepub async fn reinit(&mut self) -> Result<(), Error>
pub async fn reinit(&mut self) -> Result<(), Error>
Reinitialize the sensor
Send a soft-reset signal, obtain the calibration coefficients, and set default sampling configuration.
Note that the default sampling configuration disables measurement of temperature, pressure and humidity.
§Errors
Return an error if it cannot communicate with the sensor.
Source§impl<I2C, D> Scd4x<I2C, D, Measuring>
impl<I2C, D> Scd4x<I2C, D, Measuring>
Sourcepub fn new_in_measuring(i2c: I2C, delay: D) -> Self
pub fn new_in_measuring(i2c: I2C, delay: D) -> Self
Create a new sensor in measuring state using an I²C interface and a
delay function using the sensor’s default address DEFAULT_ADDRESS
)
Sourcepub fn new_in_measuring_with_address(i2c: I2C, address: u8, delay: D) -> Self
pub fn new_in_measuring_with_address(i2c: I2C, address: u8, delay: D) -> Self
Create a new sensor in measuring state using an I²C interface and a delay function