19.6.4.5.4 Function spi_read_buffer_wait()

Reads buffer of length SPI characters.

enum status_code spi_read_buffer_wait( struct spi_module *const module, uint8_t * rx_data, uint16_t length, uint16_t dummy)

This function will read a buffer of data from an SPI peripheral by sending dummy SPI character if in master mode, or by waiting for data in slave mode.

Note: If address matching is enabled for the slave, the first character received and placed in the buffer will be the address.
Table 19-33. Parameters
Data directionParameter nameDescription

[in]

module

Pointer to the software instance struct

[out]

rx_data

Data buffer for received data

[in]

length

Length of data to receive

[in]

dummy

8- or 9-bit dummy byte to shift out in master mode

Returns

Status of the read operation.

Table 19-34. Return Values
Return valueDescription

STATUS_OK

If the read was completed

STATUS_ABORTED

If transaction was ended by master before entire buffer was transferred

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