Struct Bme280Bus

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

BME280 bus.

Implementations§

Source§

impl<I2C, E> Bme280Bus<I2C>
where I2C: I2c<Error = E>,

Source

pub fn new(bus: I2C, address: Address) -> Self

Creates a new Bme280Bus from a I2C peripheral, and an I2C device address.

§Example
use bme280_multibus::i2c1::{Address, Bme280Bus};

let mut bme: Bme280Bus<_> = Bme280Bus::new(i2c, Address::SdoGnd);
Source

pub fn free(self) -> I2C

Free the I2C bus from the BME280.

§Example
use bme280_multibus::i2c1::{Address, Bme280Bus};

let mut bme: Bme280Bus<_> = Bme280Bus::new(i2c, Address::SdoGnd);
let mut i2c = bme.free();

Trait Implementations§

Source§

impl<I2C, E> Bme280Bus for Bme280Bus<I2C>
where I2C: I2c<Error = E>,

Source§

type Error = E

BME280 bus error.
Source§

fn read_regs(&mut self, reg: u8, buf: &mut [u8]) -> Result<(), Self::Error>

Read from the BME280. Read more
Source§

fn write_reg(&mut self, reg: u8, data: u8) -> Result<(), Self::Error>

Write a single register to the BME280. Read more
Source§

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

Read the calibration from the chip.
Source§

impl<I2C: Debug> Debug for Bme280Bus<I2C>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

impl<I2C> UnwindSafe for Bme280Bus<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.