19.6.4.5.5 Function spi_transceive_wait()
Sends and reads a single SPI character.
enum status_code spi_transceive_wait( struct spi_module *const module, uint16_t tx_data, uint16_t * rx_data)
This function will transfer a single SPI character via SPI and return the SPI character that is shifted into the shift register.
In master mode the SPI character will be sent immediately and the received SPI character will be read as soon as the shifting of the data 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 a complete SPI character, and the received data is available.
Data direction | Parameter name | Description |
---|---|---|
[in] |
module |
Pointer to the software instance struct |
[in] |
tx_data |
SPI character to transmit |
[out] |
rx_data |
Pointer to store the received SPI character |
Returns
Status of the operation.
Return value | Description |
---|---|
STATUS_OK |
If the operation was completed |
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 incoming data is overflown |