pub trait SpiSlaveClient {
    fn chip_selected(&self);
    fn read_write_done(
        write_buffer: Option<&'static mut [u8]>,
        read_buffer: Option<&'static mut [u8]>,
        len: usize,
        status: Result<(), ErrorCode>
    ); }
Expand description

Trait for SPI peripherals (slaves) to receive callbacks when the corresponding controller (master) issues operations. A SPI operation begins with a callback of chip_selected. If the client has provided buffers with SpiSlave::read_write_bytes, these buffers are written from and read into until the operation completes or one of them fills, at which point a SpiSlaveClient::read_write_done callback is called. If the client needs to read/write more it can call SpiSlave::read_write_bytes again. Note that there is no notification when the chip select line goes high.

Required Methods

Notification that the chip select has been brought low.

Callback issued when the controller completes an SPI operation to this peripheral. write_buffer and read_buffer are the values passed in the previous call to SpiSlave::read_write_bytes. The len parameter specifies how many bytes were written from/read into Some values of these buffers. len may be shorter than the size of these buffers if the operation did not fill them.