Bme680

Struct Bme680 

Source
pub struct Bme680<I2C, STATE> { /* private fields */ }
Expand description

The main BME680 driver structure.

Use Bme680::new(...) to start. The STATE generic tracks initialization.

Implementations§

Source§

impl<I2C, E> Bme680<I2C, Idle>
where I2C: I2c<Error = E>,

Source

pub fn new(i2c: I2C, address: u8) -> Bme680<I2C, Uninitialized>

Creates a new driver instance in the Uninitialized state.

Source§

impl<I2C, E> Bme680<I2C, Uninitialized>
where I2C: I2c<Error = E>,

Source

pub fn init(self, delay: &mut impl DelayNs) -> Result<Bme680<I2C, Ready>, E>

Initializes the sensor: performs a soft-reset and loads factory calibration data.

This transitions the driver state from Uninitialized to Ready.

Source§

impl<I2C, E> Bme680<I2C, Ready>
where I2C: I2c<Error = E>,

Source

pub fn configure_sensor(&mut self, config: &mut Config) -> Result<(), E>

Applies a full sensor configuration.

Source

pub fn set_gas_heater_profile( &mut self, config: GasProfile, amb_temp: Celsius, ) -> Result<(), E>

Configures heating duration and target temperature for a gas profile.

Source

pub fn read_new_data( &mut self, delay: &mut impl DelayNs, ) -> Result<Measurement, E>

Triggers a measurement in ‘Forced Mode’, waits for completion, and returns compensated data.

Source

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

Reads the Chip ID from the sensor (expected value: 0x61).

Source

pub fn select_gas_profile(&mut self, profile: &GasProfile) -> Result<(), E>

Selects one of the 10 available gas heater profiles.

Trait Implementations§

Source§

impl<I2C: Clone, STATE: Clone> Clone for Bme680<I2C, STATE>

Source§

fn clone(&self) -> Bme680<I2C, STATE>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<I2C: Debug, STATE: Debug> Debug for Bme680<I2C, STATE>

Source§

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

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

impl<I2C: Copy, STATE: Copy> Copy for Bme680<I2C, STATE>

Auto Trait Implementations§

§

impl<I2C, STATE> Freeze for Bme680<I2C, STATE>
where I2C: Freeze,

§

impl<I2C, STATE> RefUnwindSafe for Bme680<I2C, STATE>
where I2C: RefUnwindSafe, STATE: RefUnwindSafe,

§

impl<I2C, STATE> Send for Bme680<I2C, STATE>
where I2C: Send, STATE: Send,

§

impl<I2C, STATE> Sync for Bme680<I2C, STATE>
where I2C: Sync, STATE: Sync,

§

impl<I2C, STATE> Unpin for Bme680<I2C, STATE>
where I2C: Unpin, STATE: Unpin,

§

impl<I2C, STATE> UnwindSafe for Bme680<I2C, STATE>
where I2C: UnwindSafe, STATE: 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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.