Struct bme280_multibus::spi::Bme280Bus
source · [−]pub struct Bme280Bus<SPI, CS> { /* private fields */ }Expand description
BME280 bus.
Implementations
sourceimpl<SPI, CS, SpiError, PinError> Bme280Bus<SPI, CS> where
SPI: Transfer<u8, Error = SpiError> + Write<u8, Error = SpiError>,
CS: OutputPin<Error = PinError>,
impl<SPI, CS, SpiError, PinError> Bme280Bus<SPI, CS> where
SPI: Transfer<u8, Error = SpiError> + Write<u8, Error = SpiError>,
CS: OutputPin<Error = PinError>,
sourcepub fn new(bus: SPI, cs: CS) -> Self
pub fn new(bus: SPI, cs: CS) -> 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::spi::Bme280Bus;
use embedded_hal::digital::v2::OutputPin;
pin.set_high()?;
let mut bme: Bme280Bus<_, _> = Bme280Bus::new(spi, pin);Trait Implementations
sourceimpl<SPI, CS, SpiError, PinError> Bme280Bus for Bme280Bus<SPI, CS> where
SPI: Transfer<u8, Error = SpiError> + Write<u8, Error = SpiError>,
CS: OutputPin<Error = PinError>,
impl<SPI, CS, SpiError, PinError> Bme280Bus for Bme280Bus<SPI, CS> where
SPI: Transfer<u8, Error = SpiError> + Write<u8, Error = SpiError>,
CS: OutputPin<Error = PinError>,
sourcefn read_regs(&mut self, reg: u8, buf: &mut [u8]) -> Result<(), Self::Error>
fn read_regs(&mut self, reg: u8, buf: &mut [u8]) -> Result<(), Self::Error>
Read from the BME280. Read more
sourcefn write_reg(&mut self, reg: u8, data: u8) -> Result<(), Self::Error>
fn write_reg(&mut self, reg: u8, data: u8) -> Result<(), Self::Error>
Write a single register to the BME280. Read more
sourcefn calibration(&mut self) -> Result<Calibration, Self::Error>
fn calibration(&mut self) -> Result<Calibration, Self::Error>
Read the calibration from the chip.
Auto Trait Implementations
impl<SPI, CS> RefUnwindSafe for Bme280Bus<SPI, CS> where
CS: RefUnwindSafe,
SPI: RefUnwindSafe,
impl<SPI, CS> Send for Bme280Bus<SPI, CS> where
CS: Send,
SPI: Send,
impl<SPI, CS> Sync for Bme280Bus<SPI, CS> where
CS: Sync,
SPI: Sync,
impl<SPI, CS> Unpin for Bme280Bus<SPI, CS> where
CS: Unpin,
SPI: Unpin,
impl<SPI, CS> UnwindSafe for Bme280Bus<SPI, CS> where
CS: UnwindSafe,
SPI: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more