Struct capsules::spi::SpiSlave [] [src]

pub struct SpiSlave<'a, S: SpiSlaveDevice + 'a> {
    spi_slave: &'a S,
    busy: Cell<bool>,
    app: MapCell<SlaveApp>,
    kernel_read: TakeCell<'static, [u8]>,
    kernel_write: TakeCell<'static, [u8]>,
    kernel_len: Cell<usize>,
}

Fields

Methods

impl<'a, S: SpiSlaveDevice> SpiSlave<'a, S>
[src]

[src]

[src]

[src]

Trait Implementations

impl<'a, S: SpiSlaveDevice> Driver for SpiSlave<'a, S>
[src]

[src]

Provide read/write buffers to SpiSlave

  • allow_num 0: Provides an app_read buffer to receive transfers into.

  • allow_num 1: Provides an app_write buffer to send transfers from.

[src]

Setup callbacks for SpiSlave

  • subscribe_num 0: Sets up a callback for when read_write completes. This is called after completing a transfer/reception with the Spi master. Note that this occurs after the pending DMA transfer initiated by read_write_bytes completes.

  • subscribe_num 1: Sets up a callback for when the chip select line is driven low, meaning that the slave was selected by the Spi master. This occurs immediately before a data transfer.

[src]

  • 0: check if present
  • 1: read/write buffers
    • read and write buffers optional
    • fails if arg1 (bytes to write) > write_buffer.len()
  • 2: get chip select
    • returns current selected peripheral
    • in slave mode, always returns 0
  • 3: set clock phase on current peripheral
    • 0 is sample leading
    • non-zero is sample trailing
  • 4: get clock phase on current peripheral
    • 0 is sample leading
    • non-zero is sample trailing
  • 5: set clock polarity on current peripheral
    • 0 is idle low
    • non-zero is idle high
  • 6: get clock polarity on current peripheral
    • 0 is idle low
    • non-zero is idle high
  • x: lock spi
    • if you perform an operation without the lock, it implicitly acquires the lock before the operation and releases it after
    • while an app holds the lock no other app can issue operations on SPI (they are buffered)
    • not implemented or currently supported
  • x+1: unlock spi
    • does nothing if lock not held
    • not implemented or currently supported

impl<'a, S: SpiSlaveDevice> SpiSlaveClient for SpiSlave<'a, S>
[src]

[src]

This is called as a DMA interrupt when a transfer has completed

[src]

This is called whenever the slave is selected by the master