Struct mpu9250::I2cDevice

source ·
pub struct I2cDevice<I2C> { /* private fields */ }
Expand description

An I2C device. Use I2CDevice when the MPU9250 is connected via I2C

Implementations§

source§

impl<E, I2C> I2cDevice<I2C>where I2C: Read<Error = E> + Write<Error = E> + WriteRead<Error = E>,

source

pub fn new(i2c: I2C) -> Self

Create a new I2C device

Trait Implementations§

source§

impl<E, I2C> Device for I2cDevice<I2C>where I2C: Read<Error = E> + Write<Error = E> + WriteRead<Error = E>,

§

type Error = I2CError<E>

The type of error for all results
source§

fn read_many( &mut self, reg: Register, buffer: &mut [u8] ) -> Result<(), Self::Error>

Read many values from register
source§

fn write(&mut self, reg: Register, val: u8) -> Result<(), Self::Error>

Write the provided value to register
source§

fn write_many( &mut self, reg: Register, buffer: &[u8] ) -> Result<(), Self::Error>

Write the provided data block (up to 16 bytes) to register
source§

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

Read a single value from the register
source§

fn modify<F>(&mut self, reg: Register, f: F) -> Result<(), Self::Error>where F: FnOnce(u8) -> u8,

Modify the value in the register using the provided closure. The closure accepts the current value of the register, permitting conditional checks before modification.
source§

impl<I2C, E> NineDOFDevice for I2cDevice<I2C>where I2C: Read<Error = E> + Write<Error = E> + WriteRead<Error = E>,

source§

fn read_9dof( &mut self, reg: Register, buffer: &mut [u8; 21] ) -> Result<(), <Self as Device>::Error>

Perform a 9DOF reading Read more

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

impl<I2C> UnwindSafe for I2cDevice<I2C>where I2C: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.