[][src]Trait lsm9ds1::interface::Interface

pub trait Interface {
    type Error;
    fn write(
        &mut self,
        sensor: Sensor,
        addr: u8,
        value: u8
    ) -> Result<(), Self::Error>;
fn read(
        &mut self,
        sensor: Sensor,
        addr: u8,
        buffer: &mut [u8]
    ) -> Result<(), Self::Error>; }

Interface Trait. SpiInterface and I2cInterface implement this.

Associated Types

type Error

Loading content...

Required methods

fn write(
    &mut self,
    sensor: Sensor,
    addr: u8,
    value: u8
) -> Result<(), Self::Error>

Writes a byte to a sensor's specified register address.

Arguments

  • sensor - Sensor to talk to
  • addr - register address
  • value - value to write

fn read(
    &mut self,
    sensor: Sensor,
    addr: u8,
    buffer: &mut [u8]
) -> Result<(), Self::Error>

Reads multiple bytes from a sensor's specified register address.

Arguments

  • sensor - Sensor to talk to
  • addr - register address
  • buffer - buffer to store read data
Loading content...

Implementors

impl<I2C, CommE> Interface for I2cInterface<I2C> where
    I2C: WriteRead<Error = CommE> + Write<Error = CommE>, 
[src]

Implementation of Interface

type Error = Error<CommE>

impl<SPI, AG, M, CommE, PinE> Interface for SpiInterface<SPI, AG, M> where
    SPI: Transfer<u8, Error = CommE> + Write<u8, Error = CommE>,
    AG: OutputPin<Error = PinE>,
    M: OutputPin<Error = PinE>, 
[src]

Implementation of Interface

type Error = Error<CommE, PinE>

Loading content...