Struct scd4x::Scd4x

source ·
pub struct Scd4x<I2C, D> { /* private fields */ }
Expand description

SCD4X sensor instance. Use related methods to take measurements.

Implementations§

source§

impl<I2C, D, E> Scd4x<I2C, D>
where I2C: I2c<Error = E>, D: DelayNs,

source

pub fn new(i2c: I2C, delay: D) -> Self

source

pub fn destroy(self) -> I2C

source

pub fn start_periodic_measurement(&mut self) -> Result<(), Error<E>>

Start periodic measurement, signal update interval is 5 seconds. This command is only available in idle mode.

source

pub fn stop_periodic_measurement(&mut self) -> Result<(), Error<E>>

Stop periodic measurement and return to idle mode for sensor configuration or to safe energy. This command is only available in measurement mode.

source

pub fn sensor_output(&mut self) -> Result<RawSensorData, Error<E>>

Read raw sensor data

source

pub fn measurement(&mut self) -> Result<SensorData, Error<E>>

Read converted sensor data

source

pub fn temperature_offset(&mut self) -> Result<f32, Error<E>>

Get sensor temperature offset

source

pub fn set_temperature_offset(&mut self, offset: f32) -> Result<(), Error<E>>

Set sensor temperature offset

source

pub fn altitude(&mut self) -> Result<u16, Error<E>>

Get sensor altitude in meters above sea level.

source

pub fn set_altitude(&mut self, altitude: u16) -> Result<(), Error<E>>

Set sensor altitude in meters above sea level.

source

pub fn set_ambient_pressure( &mut self, pressure_hpa: u16 ) -> Result<(), Error<E>>

Set ambient pressure to enable continious pressure compensation

source

pub fn forced_recalibration( &mut self, target_co2_concentration: u16 ) -> Result<u16, Error<E>>

Perform forced recalibration

source

pub fn automatic_self_calibration(&mut self) -> Result<bool, Error<E>>

Get the status of automatic self-calibration

source

pub fn set_automatic_self_calibration( &mut self, enabled: bool ) -> Result<(), Error<E>>

Enable or disable automatic self-calibration

source

pub fn start_low_power_periodic_measurements(&mut self) -> Result<(), Error<E>>

Start low power periodic measurements

source

pub fn data_ready_status(&mut self) -> Result<bool, Error<E>>

Check whether new measurement data is available for read-out.

source

pub fn persist_settings(&mut self) -> Result<(), Error<E>>

Save settings to non-volatile memory

source

pub fn serial_number(&mut self) -> Result<u64, Error<E>>

Get 48-bit serial number

source

pub fn self_test_is_ok(&mut self) -> Result<bool, Error<E>>

End-of-line test to confirm sensor functionality.

source

pub fn factory_reset(&mut self) -> Result<(), Error<E>>

Initiates the reset of all configurations stored in the EEPROM and erases the FRC and ASC algorithm history.

source

pub fn reinit(&mut self) -> Result<(), Error<E>>

The reinit command reinitializes the sensor by reloading user settings from EEPROM.

Trait Implementations§

source§

impl<I2C: Debug, D: Debug> Debug for Scd4x<I2C, D>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<I2C: Default, D: Default> Default for Scd4x<I2C, D>

source§

fn default() -> Scd4x<I2C, D>

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<I2C, D> RefUnwindSafe for Scd4x<I2C, D>

§

impl<I2C, D> Send for Scd4x<I2C, D>
where D: Send, I2C: Send,

§

impl<I2C, D> Sync for Scd4x<I2C, D>
where D: Sync, I2C: Sync,

§

impl<I2C, D> Unpin for Scd4x<I2C, D>
where D: Unpin, I2C: Unpin,

§

impl<I2C, D> UnwindSafe for Scd4x<I2C, D>
where D: UnwindSafe, 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>,

§

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>,

§

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.