Trait Ccs811AppMode

Source
pub trait Ccs811AppMode: Sealed {
    type Error;
    type ModeChangeError;
    type BootModeType;

    // Required methods
    fn set_mode(&mut self, mode: MeasurementMode) -> Result<(), Self::Error>;
    fn has_data_ready(&mut self) -> Result<bool, Self::Error>;
    fn data(&mut self) -> Result<AlgorithmResult, Self::Error>;
    fn raw_data(&mut self) -> Result<(u8, u16), Self::Error>;
    fn baseline(&mut self) -> Result<[u8; 2], Self::Error>;
    fn set_baseline(&mut self, baseline: [u8; 2]) -> Result<(), Self::Error>;
    fn set_environment(
        &mut self,
        humidity_percentage: f32,
        temperature_celsius: f32,
    ) -> Result<(), Self::Error>;
    fn set_interrupt_mode(
        &mut self,
        mode: InterruptMode,
    ) -> Result<(), Self::Error>;
    fn set_eco2_thresholds(
        &mut self,
        low_to_medium: u16,
        medium_to_high: u16,
    ) -> Result<(), Self::Error>;
    fn software_reset(self) -> Result<Self::BootModeType, Self::ModeChangeError>;
}
Expand description

Methods available when on application mode

Required Associated Types§

Source

type Error

Error type

Source

type ModeChangeError

Boot/App mode change error

Source

type BootModeType

Boot mode type

Required Methods§

Source

fn set_mode(&mut self, mode: MeasurementMode) -> Result<(), Self::Error>

Set the measurement mode

NOTE: When changing to a new mode with a lower sample rate, place the device in Idle mode for at least 10 minutes before enabling the new mode.

Source

fn has_data_ready(&mut self) -> Result<bool, Self::Error>

Check if there is a new data sample ready.

Source

fn data(&mut self) -> Result<AlgorithmResult, Self::Error>

Get the algorithm results data.

Returns a tuple containing the current and voltage through the sensor in the format: (current, voltage). The current is a value between 0uA and 63uA. The voltage contains the value as computed in the ADC. (1023 = 1.65V)

Source

fn raw_data(&mut self) -> Result<(u8, u16), Self::Error>

Get the raw sensor data.

Returns a tuple containing the current and voltage through the sensor in the format: (current, voltage). The current is a value between 0uA and 63uA. The voltage contains the value as computed in the ADC. (1023 = 1.65V)

Source

fn baseline(&mut self) -> Result<[u8; 2], Self::Error>

Get the current baseline

Source

fn set_baseline(&mut self, baseline: [u8; 2]) -> Result<(), Self::Error>

Set the baseline

Source

fn set_environment( &mut self, humidity_percentage: f32, temperature_celsius: f32, ) -> Result<(), Self::Error>

Set the environment temperature and relative humidity.

The humidity must be provided as percentage: [0.0..100.0]. The temperature must be provided in Celsius. (Theoretical max: 254.99805ºC)

Source

fn set_interrupt_mode(&mut self, mode: InterruptMode) -> Result<(), Self::Error>

Configure the interrupt generation.

Source

fn set_eco2_thresholds( &mut self, low_to_medium: u16, medium_to_high: u16, ) -> Result<(), Self::Error>

Set the eCO2 threshold values for interrupt generation (in ppm).

An interrupt will be asserted if the value moved from the current range by 50 ppm.

Source

fn software_reset(self) -> Result<Self::BootModeType, Self::ModeChangeError>

Restart the device in boot mode.

2ms should be waited before doing any other operation.

Implementors§

Source§

impl<I2C, CommE, PinE, NWAKE, WAKEDELAY> Ccs811AppMode for Ccs811<I2C, NWAKE, WAKEDELAY, App>
where I2C: I2c<Error = CommE>, NWAKE: OutputPin<Error = PinE>, WAKEDELAY: DelayNs,

Source§

type Error = Error<CommE, PinE>

Source§

type ModeChangeError = ModeChangeError<Error<CommE, PinE>, Ccs811<I2C, NWAKE, WAKEDELAY, App>>

Source§

type BootModeType = Ccs811<I2C, NWAKE, WAKEDELAY, Boot>

Source§

impl<I2C, E> Ccs811AppMode for Ccs811Awake<I2C, App>
where I2C: I2c<Error = E>,