16.6.4.2.3 Function usart_write_buffer_wait()

Transmit a buffer of characters via the USART.

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

This blocking function will transmit a block of length characters via the USART.

Note: Using this function in combination with the interrupt (_job) functions is not recommended as it has no functionality to check if there is an ongoing interrupt driven operation running or not.
Table 16-11. Parameters
Data directionParameter nameDescription

[in]

module

Pointer to USART software instance struct

[in]

tx_data

Pointer to data to transmit

[in]

length

Number of characters 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_wait(&module, (uint8_t*)tx_buf, TX_LEN);

Returns

Status of the operation.

Table 16-12. Return Values
Return valueDescription

STATUS_OK

If operation was completed

STATUS_ERR_INVALID_ARG

If operation was not completed, due to invalid arguments

STATUS_ERR_TIMEOUT

If operation was not completed, due to USART module timing out

STATUS_ERR_DENIED

If the transmitter is not enabled