Interface

Trait Interface 

Source
pub trait Interface {
    type Error;

    // Required methods
    fn read_register(
        &mut self,
        register: u8,
        buffer: &mut [u8],
    ) -> Result<(), Self::Error>;
    fn write_register(
        &mut self,
        register: u8,
        bytes: &[u8],
    ) -> Result<(), Self::Error>;
}
Expand description

This Trait allows all the other Bus agnostic code to interface with a common bus independent api

The trait is not meant to be supper preferment as any code that needs to be particularly preformat probably wants to go in bus specific code.

Required Associated Types§

Required Methods§

Source

fn read_register( &mut self, register: u8, buffer: &mut [u8], ) -> Result<(), Self::Error>

Source

fn write_register( &mut self, register: u8, bytes: &[u8], ) -> Result<(), Self::Error>

Implementors§

Source§

impl<'a, I2C, E, const ADDRESS: u8> Interface for I2CPeripheral<'a, I2C, E, ADDRESS>
where I2C: Read<Error = E> + Write<Error = E> + WriteRead<Error = E>,

Source§

impl<'a, SPI, CS, E> Interface for SPIPeripheral<'a, SPI, CS, E>
where SPI: Transfer<u8, Error = E>, CS: OutputPin,