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§
sourcefn set_addr(&self, addr: A) -> Result<(), ErrorCode>
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
sourcefn write(
&self,
data_width: DataWidth,
buffer: &'static mut [u8],
len: usize,
) -> Result<(), (ErrorCode, &'static mut [u8])>
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)
sourcefn read(
&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])>
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)