spi_m_os_set_mode

Set SPI mode.

int32_t spi_m_os_set_mode(
    struct spi_m_os_descriptor *const 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_os_descriptor Struct *const

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.