Struct mpu9250::SpiDevice

source ·
pub struct SpiDevice<SPI, GPIO> { /* private fields */ }
Expand description

A SPI device. Use a SPI device when the MPU9250 is connected via SPI

Implementations§

source§

impl<SPI, NCS, E> SpiDevice<SPI, NCS>where SPI: Write<u8, Error = E> + Transfer<u8, Error = E>, NCS: OutputPin,

source

pub fn new(spi: SPI, ncs: NCS) -> Self

Create a new SpiDevice

Trait Implementations§

source§

impl<SPI, NCS, E, EO> Device for SpiDevice<SPI, NCS>where SPI: Write<u8, Error = E> + Transfer<u8, Error = E>, NCS: OutputPin<Error = EO>,

§

type Error = SpiError<E, EO>

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<SPI, NCS, E, EO> NineDOFDevice for SpiDevice<SPI, NCS>where SPI: Write<u8, Error = E> + Transfer<u8, Error = E>, NCS: OutputPin<Error = EO>,

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<SPI, GPIO> RefUnwindSafe for SpiDevice<SPI, GPIO>where GPIO: RefUnwindSafe, SPI: RefUnwindSafe,

§

impl<SPI, GPIO> Send for SpiDevice<SPI, GPIO>where GPIO: Send, SPI: Send,

§

impl<SPI, GPIO> Sync for SpiDevice<SPI, GPIO>where GPIO: Sync, SPI: Sync,

§

impl<SPI, GPIO> Unpin for SpiDevice<SPI, GPIO>where GPIO: Unpin, SPI: Unpin,

§

impl<SPI, GPIO> UnwindSafe for SpiDevice<SPI, GPIO>where GPIO: UnwindSafe, SPI: 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.