19.6.4.5.1 Function spi_write()

Transfers a single SPI character.

enum status_code spi_write( struct spi_module * module, uint16_t tx_data)

This function will send a single SPI character via SPI and ignore any data shifted in by the connected device. To both send and receive data, use the spi_transceive_wait function or use the spi_read function after writing a character. The spi_is_ready_to_write function should be called before calling this function.

Note that this function does not handle the SS (Slave Select) pin(s) in master mode; this must be handled from the user application.

Note: In slave mode, the data will not be transferred before a master initiates a transaction.
Table 19-27. Parameters
Data directionParameter nameDescription

[in]

module

Pointer to the software instance struct

[in]

tx_data

Data to transmit

Returns

Status of the procedure.

Table 19-28. Return Values
Return valueDescription

STATUS_OK

If the data was written

STATUS_BUSY

If the last write was not completed