19.6.4.5.2 Function spi_write_buffer_wait()

Sends a buffer of length SPI characters.

enum status_code spi_write_buffer_wait( struct spi_module *const module, const uint8_t * tx_data, uint16_t length)

This function will send a buffer of SPI characters via the SPI and discard any data that is received. To both send and receive a buffer of data, use the spi_transceive_buffer_wait function.

Note that this function does not handle the _SS (slave select) pin(s) in master mode; this must be handled by the user application.

Table 19-29. Parameters
Data directionParameter nameDescription

[in]

module

Pointer to the software instance struct

[in]

tx_data

Pointer to the buffer to transmit

[in]

length

Number of SPI characters to transfer

Returns

Status of the write operation.

Table 19-30. Return Values
Return valueDescription

STATUS_OK

If the write 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