34.1.5.6 spi_m_async_set_mode
Set SPI mode.
int32_t spi_m_async_set_mode(
struct spi_m_async_descriptor * spi,
const enum spi_transfer_mode mode
)
Set the SPI transfer mode (spi_transfer_mode), which controls the clock polarity and clock phase:
-
Mode 0: leading edge is rising edge, data sample on leading edge.
-
Mode 1: leading edge is rising edge, data sample on trailing edge.
-
Mode 2: leading edge is falling edge, data sample on leading edge.
-
Mode 3: leading edge is falling edge, data sample on trailing edge.
Parameters
- spi
-
Type: struct spi_m_async_descriptor Struct *
Pointer to the HAL SPI instance.
- mode
-
Type: const enum spi_transfer_mode
The mode (spi_transfer_mode).
Returns
Type: int32_t
Operation status.
- ERR_NONE
-
Success.
- ERR_BUSY
-
Busy, CS activated.