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§
Sourcetype ModeChangeError
type ModeChangeError
Boot/App mode change error
Sourcetype BootModeType
type BootModeType
Boot mode type
Required Methods§
Sourcefn set_mode(&mut self, mode: MeasurementMode) -> Result<(), Self::Error>
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.
Sourcefn has_data_ready(&mut self) -> Result<bool, Self::Error>
fn has_data_ready(&mut self) -> Result<bool, Self::Error>
Check if there is a new data sample ready.
Sourcefn data(&mut self) -> Result<AlgorithmResult, Self::Error>
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)
Sourcefn raw_data(&mut self) -> Result<(u8, u16), Self::Error>
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)
Sourcefn set_environment(
&mut self,
humidity_percentage: f32,
temperature_celsius: f32,
) -> Result<(), Self::Error>
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)
Sourcefn set_interrupt_mode(&mut self, mode: InterruptMode) -> Result<(), Self::Error>
fn set_interrupt_mode(&mut self, mode: InterruptMode) -> Result<(), Self::Error>
Configure the interrupt generation.
Sourcefn set_eco2_thresholds(
&mut self,
low_to_medium: u16,
medium_to_high: u16,
) -> Result<(), Self::Error>
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.
Sourcefn software_reset(self) -> Result<Self::BootModeType, Self::ModeChangeError>
fn software_reset(self) -> Result<Self::BootModeType, Self::ModeChangeError>
Restart the device in boot mode.
2ms should be waited before doing any other operation.