16.6.4.6.3 Function usart_write_buffer_job()

Asynchronous buffer write.

enum status_code usart_write_buffer_job( struct usart_module *const module, uint8_t * tx_data, uint16_t length)

Sets up the driver to write a given buffer over the USART. If registered and enabled, a callback function will be called.

Table 16-28. Parameters
Data directionParameter nameDescription

[in]

module

Pointer to USART software instance struct

[in]

tx_data

Pointer do data buffer to transmit

[in]

length

Length of the data to transmit

Note: If using 9-bit data, the array that *tx_data point to should be defined as uint16_t array and should be casted to uint8_t* pointer. Because it is an address pointer, the highest byte is not discarded. For example:
#define TX_LEN 3
uint16_t tx_buf[TX_LEN] = {0x0111, 0x0022, 0x0133};
usart_write_buffer_job(&module, (uint8_t*)tx_buf, TX_LEN);

Returns

Status of the operation.

Table 16-29. Return Values
Return valueDescription

STATUS_OK

If operation was completed successfully.

STATUS_BUSY

If operation was not completed, due to the USART module being busy

STATUS_ERR_INVALID_ARG

If operation was not completed, due to invalid arguments

STATUS_ERR_DENIED

If the transmitter is not enabled