pub struct Spi<R> {
    pub regs: R,
    pub cfg: SpiConfig,
}
Expand description

Represents a Serial Peripheral Interface (SPI) peripheral.

Fields

regs: Rcfg: SpiConfig

Implementations

Initialize an SPI peripheral, including configuration register writes, and enabling and resetting its RCC peripheral clock.

Change the SPI baud rate.

L44 RM, section 40.4.9: “Procedure for disabling the SPI” When SPI is disabled, it is mandatory to follow the disable procedures described in this paragraph. It is important to do this before the system enters a low-power mode when the peripheral clock is stopped. Ongoing transactions can be corrupted in this case. In some modes the disable procedure is the only way to stop continuous communication running.

Read a single byte if available, or block until it’s available. See L44 RM, section 40.4.9: Data transmission and reception procedures.

Write a single byte if available, or block until it’s available. See L44 RM, section 40.4.9: Data transmission and reception procedures.

Write multiple bytes on the SPI line, blocking until complete. See L44 RM, section 40.4.9: Data transmission and reception procedures.

Read multiple bytes to a buffer, blocking until complete. See L44 RM, section 40.4.9: Data transmission and reception procedures.

Trait Implementations

An enumeration of SPI errors

Reads the word stored in the shift register Read more

Sends a word to the slave

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Error type

Sends words to the slave. Returns the words received from the slave

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Error type

Sends words to the slave, ignoring all the incoming words