Skip to main content

Transport

Trait Transport 

Source
pub trait Transport<'a> {
    // Required methods
    fn set_client(&self, client: &'a dyn TransportClient);
    fn send(
        &self,
        kind: DataKind,
        buffer: &'static mut [u8],
        len: usize,
    ) -> Result<(), (ErrorCode, &'static mut [u8])>;
}
Expand description

Bus that connects the controller.

Required Methods§

Source

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

Source

fn send( &self, kind: DataKind, buffer: &'static mut [u8], len: usize, ) -> Result<(), (ErrorCode, &'static mut [u8])>

Send buffer[1..len] to the controller as kind bytes.

buffer[0] is reserved for the transport (e.g. the I2C control byte). On success, TransportClient::send_done returns the buffer. len includes this byte.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<'a, I: I2CDevice<'a>> Transport<'a> for I2CTransport<'a, I>

Source§

impl<'a, S: SpiMaster<'a>, P: Output> Transport<'a> for SpiTransport<'a, S, P>