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.

Table 19-37. Parameters
Data directionParameter nameDescription

[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.

Table 19-38. Return Values
Return valueDescription

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