Struct Scd30

Source
pub struct Scd30<I2C> { /* private fields */ }
Expand description

Interface for the SCD30 CO2 sensor by Sensirion.

Implementations§

Source§

impl<I2C: I2c<Error = I2cErr>, I2cErr: Error> Scd30<I2C>

Source

pub fn new(i2c: I2C) -> Self

Create a new SCD30 interface.

Source

pub fn trigger_continuous_measurements( &mut self, pressure_compensation: Option<AmbientPressureCompensation>, ) -> Result<(), Scd30Error<I2cErr>>

Start continuous measurements. This is stored in non-volatile memory. After power-cycling the device, it will continue measuring without being send a measurement command. Additionally an AmbientPressure value can be send, to compensate for ambient pressure. Default ambient pressure is 1013.25 mBar, can be configured in the range of 700 mBar to 1400 mBar.

Source

pub fn stop_continuous_measurements(&mut self) -> Result<(), Scd30Error<I2cErr>>

Stop continuous measurements.

Source

pub fn set_measurement_interval( &mut self, interval: MeasurementInterval, ) -> Result<(), Scd30Error<I2cErr>>

Configures the measurement interval in seconds, ranging from to 2s to 1800s.

Source

pub fn get_measurement_interval( &mut self, ) -> Result<MeasurementInterval, Scd30Error<I2cErr>>

Reads out the configured continuous measurement interval

Source

pub fn is_data_ready(&mut self) -> Result<DataStatus, Scd30Error<I2cErr>>

Checks whether a measurement is ready for readout.

Source

pub fn read_measurement(&mut self) -> Result<Measurement, Scd30Error<I2cErr>>

Reads out a Measurement from the sensor.

Source

pub fn set_automatic_self_calibration( &mut self, setting: AutomaticSelfCalibration, ) -> Result<(), Scd30Error<I2cErr>>

Activates or deactivates automatic self-calibration.

Source

pub fn get_automatic_self_calibration( &mut self, ) -> Result<AutomaticSelfCalibration, Scd30Error<I2cErr>>

Reads out the current state of the automatic self-calibration.

Source

pub fn set_forced_recalibration( &mut self, frc: ForcedRecalibrationValue, ) -> Result<(), Scd30Error<I2cErr>>

Configures the forced re-calibration (FRC) value to compensate for sensor drift. The value can range from 400 ppm to 2000 ppm.

Source

pub fn get_forced_recalibration( &mut self, ) -> Result<ForcedRecalibrationValue, Scd30Error<I2cErr>>

Reads out the configured value of the forced re-calibration (FRC) value.

Source

pub fn set_temperature_offset( &mut self, offset: TemperatureOffset, ) -> Result<(), Scd30Error<I2cErr>>

Configures the temperature offset to compensate for self-heating electric components. The value can range from 0.0 °C to 6553.5 °C.

Source

pub fn get_temperature_offset( &mut self, ) -> Result<TemperatureOffset, Scd30Error<I2cErr>>

Reads out the configured temperature offset.

Source

pub fn set_altitude_compensation( &mut self, altitude: AltitudeCompensation, ) -> Result<(), Scd30Error<I2cErr>>

Configures the altitude compensation. The value can range from 0 m to 65535 m above sea level.

Source

pub fn get_altitude_compensation( &mut self, ) -> Result<AltitudeCompensation, Scd30Error<I2cErr>>

Reads out the configured altitude compensation.

Source

pub fn read_firmware_version( &mut self, ) -> Result<FirmwareVersion, Scd30Error<I2cErr>>

Reads out the version of the firmware deployed on the sensor.

Source

pub fn soft_reset(&mut self) -> Result<(), Scd30Error<I2cErr>>

Executes a soft reset of the sensor.

Source

pub fn shutdown(self) -> I2C

Consumes the sensor and returns the contained I2C peripheral.

Auto Trait Implementations§

§

impl<I2C> Freeze for Scd30<I2C>
where I2C: Freeze,

§

impl<I2C> RefUnwindSafe for Scd30<I2C>
where I2C: RefUnwindSafe,

§

impl<I2C> Send for Scd30<I2C>
where I2C: Send,

§

impl<I2C> Sync for Scd30<I2C>
where I2C: Sync,

§

impl<I2C> Unpin for Scd30<I2C>
where I2C: Unpin,

§

impl<I2C> UnwindSafe for Scd30<I2C>
where I2C: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.