Struct Bme280Bus

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

BME280 bus.

Implementations§

Source§

impl<SPI> Bme280Bus<SPI>

Source

pub fn new(spi: SPI) -> Self

Creates a new Bme280Bus from a SPI peripheral and a chip select digital I/O pin.

§Safety

The chip select pin must be high before being passed to this function.

§Example
use bme280_multibus::spi1::Bme280Bus;

let mut bme: Bme280Bus<_> = Bme280Bus::new(spi);
Source

pub fn free(self) -> SPI

Free the SPI bus and CS pin from the BME280.

§Example
use bme280_multibus::spi1::Bme280Bus;

let mut bme: Bme280Bus<_> = Bme280Bus::new(spi);
let mut spi = bme.free();

Trait Implementations§

Source§

impl<SPI> Bme280Bus for Bme280Bus<SPI>
where SPI: SpiDevice,

Source§

type Error = <SPI as ErrorType>::Error

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<SPI> Bme280BusAsync for Bme280Bus<SPI>
where SPI: SpiDevice,

Source§

type Error = <SPI as ErrorType>::Error

BME280 bus error.
Source§

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

Read from the BME280. Read more
Source§

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

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

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

Read the calibration from the chip.
Source§

impl<SPI: Debug> Debug for Bme280Bus<SPI>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

impl<SPI> UnwindSafe for Bme280Bus<SPI>
where SPI: 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.