19.6.4.5.6 Function spi_transceive_buffer_wait()
Sends and receives a buffer of length SPI characters.
enum status_code spi_transceive_buffer_wait( struct spi_module *const module, uint8_t * tx_data, uint8_t * rx_data, uint16_t length)
This function will send and receive a buffer of data via the SPI.
In master mode the SPI characters will be sent immediately and the received SPI character will be read as soon as the shifting of the SPI character is complete.
In slave mode this function will place the data to be sent into the transmit buffer. It will then block until an SPI master has shifted the complete buffer and the received data is available.
Data direction | Parameter name | Description |
---|---|---|
[in] |
module |
Pointer to the software instance struct |
[in] |
tx_data |
Pointer to the buffer to transmit |
[out] |
rx_data |
Pointer to the buffer where received data will be stored |
[in] |
length |
Number of SPI characters to transfer |
Returns
Status of the operation.
Return value | Description |
---|---|
STATUS_OK |
If the operation was completed |
STATUS_ERR_INVALID_ARG |
If invalid argument(s) were provided |
STATUS_ERR_TIMEOUT |
If the operation was not completed within the timeout in slave mode |
STATUS_ERR_DENIED |
If the receiver is not enabled |
STATUS_ERR_OVERFLOW |
If the data is overflown |