Struct stm32_hal2::spi::Spi[][src]

pub struct Spi<R> { /* fields omitted */ }
Expand description

Represents a Serial Peripheral Interface (SPI) peripheral.

Implementations

Configures the SPI peripheral to operate in full duplex master mode

Change the baud rate of the SPI

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.

Transmit data using DMA. See L44 RM, section 40.4.9: Communication using DMA. Note that the channel argument has no effect on F3 and L4.

Receive data using DMA. See L44 RM, section 40.4.9: Communication using DMA. Note taht the channel argument has no effect on F3 and L4.

Stop a DMA transfer. Stops the channel, and disables the txdmaen and rxdmaen bits. Run this after each transfer completes - you may wish to do this in an interrupt (eg DMA transfer complete) instead of blocking.

Enable an interrupt. Note that unlike on other peripherals, there’s no explicit way to clear these. RM: “Writing to the transmit data register always clears the TXE bit. The TXE flag is set by hardware.”

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.

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.