Struct Ccs811

Source
pub struct Ccs811<I2C> { /* private fields */ }
Expand description

Ccs811 device driver.

Implementations§

Source§

impl<I2C, E> Ccs811<I2C>
where I2C: Write<Error = E> + WriteRead<Error = E> + Read<Error = E>,

Source

pub fn new(i2c: I2C, address: u8) -> Self

Create new instance of the Ccs811 device.

Source

pub fn destroy(self) -> I2C

Destroy driver instance, return I²C bus instance.

Source

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

Enter App mode

Source

pub fn set_meas_mode( &mut self, drive_mode: DriveMode, interrupt: InterruptDataReady, threshold: InterruptThreshold, ) -> Result<(), E>

Set MEAS_MODE Register

Source

pub fn get_meas_mode(&mut self, data: &mut [u8; 1]) -> Result<(), E>

Get MEAS_MODE Register

Source

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

Perform a SwReset, which brings firmware in Boot Mode.

Source

pub fn hw_info(&mut self) -> Result<[u8; 2], E>

Returns [HwId;HwVersion]

Source

pub fn fw_info(&mut self) -> Result<[u8; 4], E>

Returns [FwBootVersion;FwAppVersion]

Source

pub fn raw_data(&mut self) -> Result<[u8; 2], E>

Returns RAW_DATA

Source

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

Set a previosuly retrieved baseline

“A previously stored value may be written back to this two byte register and the Algorithms will use the new value in its calculations (until it adjusts it as part of its internal Automatic Baseline Correction). For more information, refer to ams application note AN000370: CCS811 Clean Air Baseline Save and Restore.”

Source

pub fn get_baseline(&mut self, baseline: &mut [u8; 2]) -> Result<(), E>

Retrieves Baseline

Source

pub fn get_status(&mut self, status: &mut [u8; 1]) -> Result<(), E>

Retrieves Status register

Source

pub fn get_error_id(&mut self) -> Result<u8, E>

Retrieves Error_Id register

Source

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

Get result

Trait Implementations§

Source§

impl<I2C: Debug> Debug for Ccs811<I2C>

Source§

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

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

impl<I2C: Default> Default for Ccs811<I2C>

Source§

fn default() -> Ccs811<I2C>

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

Auto Trait Implementations§

§

impl<I2C> Freeze for Ccs811<I2C>
where I2C: Freeze,

§

impl<I2C> RefUnwindSafe for Ccs811<I2C>
where I2C: RefUnwindSafe,

§

impl<I2C> Send for Ccs811<I2C>
where I2C: Send,

§

impl<I2C> Sync for Ccs811<I2C>
where I2C: Sync,

§

impl<I2C> Unpin for Ccs811<I2C>
where I2C: Unpin,

§

impl<I2C> UnwindSafe for Ccs811<I2C>
where 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>,

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.