Struct Ccs811

Source
pub struct Ccs811<I2C, NWAKE, WAKEDELAY, MODE> { /* private fields */ }
Expand description

CCS811 device driver

Convenience wrapper arount Ccs811Awake which handles waking up the device on each operation.

Implementations§

Source§

impl<I2C, NWAKE, WAKEDELAY> Ccs811<I2C, NWAKE, WAKEDELAY, Boot>

Source

pub fn new( i2c: I2C, address: SlaveAddr, n_wake_pin: NWAKE, wake_delay: WAKEDELAY, ) -> Self

Create new instance of the CCS811 device.

See Ccs811Awake for the case where the nWAKE pin is not used.

Source§

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

Source

pub fn destroy(self) -> (I2C, NWAKE, WAKEDELAY)

Destroy driver instance, return I²C bus, nWAKE pin and wake delay instances.

Trait Implementations§

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>

Error type
Source§

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

Boot/App mode change error
Source§

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

Boot mode type
Source§

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

Set the measurement mode Read more
Source§

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

Check if there is a new data sample ready.
Source§

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

Get the raw sensor data. Read more
Source§

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

Get the algorithm results data. Read more
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. Read more
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). Read more
Source§

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

Configure the interrupt generation.
Source§

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

Restart the device in boot mode. Read more
Source§

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

Source§

type Error = Error<CommE, PinE>

Error type
Source§

type ModeChangeError = ModeChangeError<<Ccs811<I2C, NWAKE, WAKEDELAY, Boot> as Ccs811BootMode>::Error, Ccs811<I2C, NWAKE, WAKEDELAY, Boot>>

Boot/App mode change error
Source§

type TargetType = Ccs811<I2C, NWAKE, WAKEDELAY, App>

Application mode type
Source§

fn start_application(self) -> Result<Self::TargetType, Self::ModeChangeError>

Start application mode Read more
Source§

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

Verify application. Read more
Source§

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

Erase application. Read more
Source§

fn download_application<D: DelayNs>( &mut self, bin: &[u8], delay: &mut D, ) -> Result<(), Self::Error>

Download new application. Read more
Source§

fn update_application<D: DelayNs>( &mut self, bin: &[u8], delay: &mut D, ) -> Result<(), Self::Error>

Reset, erase, download new application and verify it in one step. Read more
Source§

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

Restart the device in boot mode. Read more
Source§

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

Source§

type Error = Error<CommE, PinE>

Error type
Source§

fn firmware_mode(&mut self) -> Result<FirmwareMode, Self::Error>

Get the firmware mode.
Source§

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

Check if a valid application firmware is loaded.
Source§

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

Get the hardware ID (0x81 for the CCS81x family of devices)
Source§

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

Get the hardware version (major, minor) ((1,X) for the CCS81x family of devices)
Source§

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

Get the firmware bootloader verion (major, minor, trivial)
Source§

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

Get the firmware application verion (major, minor, trivial)
Source§

impl<I2C: Debug, NWAKE: Debug, WAKEDELAY: Debug, MODE: Debug> Debug for Ccs811<I2C, NWAKE, WAKEDELAY, MODE>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<I2C, NWAKE, WAKEDELAY, MODE> Freeze for Ccs811<I2C, NWAKE, WAKEDELAY, MODE>
where NWAKE: Freeze, WAKEDELAY: Freeze, I2C: Freeze,

§

impl<I2C, NWAKE, WAKEDELAY, MODE> RefUnwindSafe for Ccs811<I2C, NWAKE, WAKEDELAY, MODE>
where NWAKE: RefUnwindSafe, WAKEDELAY: RefUnwindSafe, I2C: RefUnwindSafe, MODE: RefUnwindSafe,

§

impl<I2C, NWAKE, WAKEDELAY, MODE> Send for Ccs811<I2C, NWAKE, WAKEDELAY, MODE>
where NWAKE: Send, WAKEDELAY: Send, I2C: Send, MODE: Send,

§

impl<I2C, NWAKE, WAKEDELAY, MODE> Sync for Ccs811<I2C, NWAKE, WAKEDELAY, MODE>
where NWAKE: Sync, WAKEDELAY: Sync, I2C: Sync, MODE: Sync,

§

impl<I2C, NWAKE, WAKEDELAY, MODE> Unpin for Ccs811<I2C, NWAKE, WAKEDELAY, MODE>
where NWAKE: Unpin, WAKEDELAY: Unpin, I2C: Unpin, MODE: Unpin,

§

impl<I2C, NWAKE, WAKEDELAY, MODE> UnwindSafe for Ccs811<I2C, NWAKE, WAKEDELAY, MODE>
where NWAKE: UnwindSafe, WAKEDELAY: UnwindSafe, I2C: UnwindSafe, MODE: 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.