[−][src]Trait mpu9250::Device
An MPU communication device abstraction
This allows us to generalize the device over either an I2C or SPI peripheral
Associated Types
type Error
The type of error for all results
Required methods
fn read_many(
&mut self,
reg: Register,
buffer: &mut [u8]
) -> Result<(), Self::Error>
&mut self,
reg: Register,
buffer: &mut [u8]
) -> Result<(), Self::Error>
Read many values from register
fn write(&mut self, reg: Register, val: u8) -> Result<(), Self::Error>
Write the provided value to register
fn write_many(
&mut self,
reg: Register,
buffer: &[u8]
) -> Result<(), Self::Error>
&mut self,
reg: Register,
buffer: &[u8]
) -> Result<(), Self::Error>
Write the provided data block (up to 16 bytes) to register
Provided methods
fn read(&mut self, reg: Register) -> Result<u8, Self::Error>
Read a single value from the register
fn modify<F>(&mut self, reg: Register, f: F) -> Result<(), Self::Error> where
F: FnOnce(u8) -> u8,
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.
Implementors
impl<E, I2C> Device for I2cDevice<I2C> where
I2C: Read<Error = E> + Write<Error = E> + WriteRead<Error = E>,
[src]
I2C: Read<Error = E> + Write<Error = E> + WriteRead<Error = E>,
type Error = I2CError<E>
fn read_many(
&mut self,
reg: Register,
buffer: &mut [u8]
) -> Result<(), Self::Error>
[src]
&mut self,
reg: Register,
buffer: &mut [u8]
) -> Result<(), Self::Error>
fn write(&mut self, reg: Register, val: u8) -> Result<(), Self::Error>
[src]
fn write_many(
&mut self,
reg: Register,
buffer: &[u8]
) -> Result<(), Self::Error>
[src]
&mut self,
reg: Register,
buffer: &[u8]
) -> Result<(), Self::Error>
impl<SPI, NCS, E, EO> Device for SpiDevice<SPI, NCS> where
SPI: Write<u8, Error = E> + Transfer<u8, Error = E>,
NCS: OutputPin<Error = EO>,
[src]
SPI: Write<u8, Error = E> + Transfer<u8, Error = E>,
NCS: OutputPin<Error = EO>,