[][src]Trait embedded_ccs811::Ccs811AppMode

pub trait Ccs811AppMode: Sealed {
    type Error;
    type ModeChangeError;
    type BootModeType;
    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>; }

Methods available when on application mode

Associated Types

type Error

Error type

type ModeChangeError

Boot/App mode change error

type BootModeType

Boot mode type

Loading content...

Required methods

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.

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

Check if there is a new data sample ready.

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)

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)

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

Get the current baseline

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

Set the baseline

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)

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

Configure the interrupt generation.

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.

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

Restart the device in boot mode.

2ms should be waited before doing any other operation.

Loading content...

Implementors

impl<I2C, CommE, PinE, NWAKE, WAKEDELAY> Ccs811AppMode for Ccs811<I2C, NWAKE, WAKEDELAY, App> where
    I2C: Write<Error = CommE> + WriteRead<Error = CommE>,
    NWAKE: OutputPin<Error = PinE>,
    WAKEDELAY: DelayUs<u8>, 
[src]

type Error = Error<CommE, PinE>

type ModeChangeError = ModeChangeError<Error<CommE, PinE>, Self>

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

impl<I2C, E> Ccs811AppMode for Ccs811Awake<I2C, App> where
    I2C: Write<Error = E> + WriteRead<Error = E>, 
[src]

type Error = ErrorAwake<E>

type ModeChangeError = ModeChangeError<ErrorAwake<E>, Self>

type BootModeType = Ccs811Awake<I2C, Boot>

Loading content...