The core functions for using an RTOS SPI master driver instance after it has been initialized and started. These functions may be used by both the host and any client tiles that RPC has been enabled for.
◆ rtos_spi_master_delay_before_next_transfer()
If there is a minimum amount of idle time that is required by the device between transfers within a single transaction, then this may be called between each transfer where a delay is required.
This function will return immediately. If the call for the next transfer happens before the minimum time specified has elapsed, the delay will occur then before the transfer begins.
- Note
- This must be called during a transaction, otherwise the behavior is unspecified.
-
Technically the next transfer will occur no earlier than
delay_ticks
after this function is called, so this should be called immediately following a transfer, rather than immediately before the next.
- Parameters
-
ctx | A pointer to the SPI device instance. |
delay_ticks | The number of reference clock ticks to delay. |
◆ rtos_spi_master_transaction_end()
Ends a transaction with the specified SPI device on a SPI bus. This leaves chip select de-asserted.
- Parameters
-
ctx | A pointer to the SPI device instance. |
◆ rtos_spi_master_transaction_start()
Starts a transaction with the specified SPI device on a SPI bus. This leaves chip select asserted.
- Parameters
-
ctx | A pointer to the SPI device instance. |
◆ rtos_spi_master_transfer()
Transfers data to and from the specified SPI device on a SPI bus. The transaction must already have been started by calling rtos_spi_master_transaction_start() on the same device instance. This may be called multiple times during a single transaction.
This function may return before the transfer is complete when data_in is NULL, as the actual transfer operation is queued and executed by a thread created by the driver.
- Parameters
-
ctx | A pointer to the SPI device instance. |
data_out | Pointer to the data to transfer to the device. This may be NULL if there is no data to send. |
data_in | Pointer to the buffer to save the received data to. This may be NULL if the received data is not needed. |
len | The number of bytes to transfer in each direction. This number of bytes must be available in both the data_out and data_in buffers if they are not NULL. |