Trait capsules_extra::bus::Bus

source ·
pub trait Bus<'a, A: BusAddr> {
    // Required methods
    fn set_addr(&self, addr: A) -> Result<(), ErrorCode>;
    fn write(
        &self,
        data_width: DataWidth,
        buffer: &'static mut [u8],
        len: usize,
    ) -> Result<(), (ErrorCode, &'static mut [u8])>;
    fn read(
        &self,
        data_width: DataWidth,
        buffer: &'static mut [u8],
        len: usize,
    ) -> Result<(), (ErrorCode, &'static mut [u8])>;
    fn set_client(&self, client: &'a dyn Client);
}

Required Methods§

source

fn set_addr(&self, addr: A) -> Result<(), ErrorCode>

Set the address to write to

If the underlying bus does not support addresses (eg UART) this function returns ENOSUPPORT

source

fn write( &self, data_width: DataWidth, buffer: &'static mut [u8], len: usize, ) -> Result<(), (ErrorCode, &'static mut [u8])>

Write data items to the previously set address

data_width specifies the encoding of the data items placed in the buffer len specifies the number of data items (the number of bytes is len * data_width.width_in_bytes)

source

fn read( &self, data_width: DataWidth, buffer: &'static mut [u8], len: usize, ) -> Result<(), (ErrorCode, &'static mut [u8])>

Read data items from the previously set address

data_width specifies the encoding of the data items placed in the buffer len specifies the number of data items (the number of bytes is len * data_width.width_in_bytes)

source

fn set_client(&self, client: &'a dyn Client)

Implementors§

source§

impl<'a, A: BusAddr + Into<BusAddr8080>, B: Bus8080<'static>> Bus<'a, A> for Bus8080Bus<'a, B>

source§

impl<'a, A: BusAddr, I: I2CDevice> Bus<'a, A> for I2CMasterBus<'a, I>

source§

impl<'a, A: BusAddr, S: SpiMasterDevice<'a>> Bus<'a, A> for SpiMasterBus<'a, S>