Struct sam4l::spi::Spi [] [src]

pub struct Spi {
    registers: *mut Registers,
    client: Cell<Option<&'static SpiMasterClient>>,
    dma_read: Cell<Option<&'static DMAChannel>>,
    dma_write: Cell<Option<&'static DMAChannel>>,
    transfers_in_progress: Cell<u8>,
    dma_length: Cell<usize>,
    slave_client: Cell<Option<&'static SpiSlaveClient>>,
    role: Cell<SpiRole>,
}

The SAM4L supports four peripherals.

Fields

Methods

impl Spi
[src]

[src]

Creates a new SPI object, with peripheral 0 selected

[src]

[src]

[src]

[src]

Sets the approximate baud rate for the active peripheral, and return the actual baud rate set.

Since the only supported baud rates are (system clock / n) where n is an integer from 1 to 255, the exact baud rate may not be available. In that case, the next lower baud rate will be selected.

The lowest available baud rate is 188235 baud. If the requested rate is lower, 188235 baud will be selected.

[src]

[src]

[src]

[src]

[src]

[src]

[src]

Returns the currently active peripheral

[src]

Returns the value of CSR0, CSR1, CSR2, or CSR3, whichever corresponds to the active peripheral

[src]

Set the DMA channels used for reading and writing.

[src]

[src]

[src]

Asynchronous buffer read/write of SPI. returns SUCCESS if operation starts (will receive callback through SpiMasterClient), returns EBUSY if the operation does not start.

Trait Implementations

impl SpiMaster for Spi
[src]

[src]

[src]

By default, initialize SPI to operate at 40KHz, clock is idle on low, and sample on the leading edge.

[src]

[src]

Write a byte to the SPI and discard the read; if an asynchronous operation is outstanding, do nothing.

[src]

Write 0 to the SPI and return the read; if an asynchronous operation is outstanding, do nothing.

[src]

Write a byte to the SPI and return the read; if an asynchronous operation is outstanding, do nothing.

[src]

Asynchronous buffer read/write of SPI. write_buffer must be Some; read_buffer may be None; if read_buffer is Some, then length of read/write is the minimum of two buffer lengths; returns SUCCESS if operation starts (will receive callback through SpiMasterClient), returns EBUSY if the operation does not start.

[src]

Returns the actual rate set

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

Tell the SPI peripheral what to use as a chip select pin. The type of the argument is based on what makes sense for the peripheral when this trait is implemented. Read more

impl SpiSlave for Spi
[src]

[src]

[src]

Returns true if there is a client.

[src]

[src]

This sets the value in the TDR register, to be sent as soon as the chip select pin is low.

[src]

[src]

[src]

[src]

[src]

impl DMAClient for Spi
[src]

[src]