BMP180

Struct BMP180 

Source
pub struct BMP180<T, D> { /* private fields */ }
Expand description

Represents an uninitialized version of the sensor.

Implementations§

Source§

impl<T: I2c, D: DelayNs> BMP180<T, D>

Source

pub fn new(i2c: T, delay: D) -> Self

Creates a new instance of BMP180 sensor.

Source

pub fn initialize( self, ) -> Result<InitializedBMP180<T, D>, CustomError<T::Error>>

Initializes the BMP180 sensor.

Source

pub fn set_address(&mut self, address: u8)

Sets the I2C address of the sensor.

Source

pub fn write_and_read_exact_bytes<const BYTES: usize>( &mut self, command: &[u8], ) -> Result<[u8; BYTES], CustomError<T::Error>>

Writes data to the sensor and reads back exactly the specified number of bytes.

Source

pub fn write_and_read_range( &mut self, command: &[u8], buffer: &mut [u8], ) -> Result<(), CustomError<T::Error>>

Writes data to the sensor and reads back a range of bytes.

Source

pub fn write_and_read_single_byte( &mut self, command: &[u8], ) -> Result<u8, CustomError<T::Error>>

Write and read a single byte back.

Source

pub fn write(&mut self, command: &[u8]) -> Result<(), CustomError<T::Error>>

Writes data to the sensor.

Trait Implementations§

Source§

impl<T: I2c, D: DelayNs> Common<T> for BMP180<T, D>

Source§

fn read_chip_id(&mut self) -> Result<u8, CustomError<T::Error>>

Reads the chip identifier.

The returned value is hardcoded by the manufacturer and should be equivalent to 0x55.

Source§

fn reset(&mut self) -> Result<(), CustomError<T::Error>>

Resets the device.

Source§

fn check_connection(&mut self) -> Result<(), CustomError<T::Error>>

Tests the connection to the device. Read more

Auto Trait Implementations§

§

impl<T, D> Freeze for BMP180<T, D>
where T: Freeze, D: Freeze,

§

impl<T, D> RefUnwindSafe for BMP180<T, D>

§

impl<T, D> Send for BMP180<T, D>
where T: Send, D: Send,

§

impl<T, D> Sync for BMP180<T, D>
where T: Sync, D: Sync,

§

impl<T, D> Unpin for BMP180<T, D>
where T: Unpin, D: Unpin,

§

impl<T, D> UnwindSafe for BMP180<T, D>
where T: UnwindSafe, D: 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.