16.6.4.6.4 Function usart_read_buffer_job()

Asynchronous buffer read.

enum status_code usart_read_buffer_job( struct usart_module *const module, uint8_t * rx_data, uint16_t length)

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

Table 16-30. Parameters
Data directionParameter nameDescription

[in]

module

Pointer to USART software instance struct

[out]

rx_data

Pointer to data buffer to receive

[in]

length

Data buffer length

Note: If using 9-bit data, the array that *rx_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 RX_LEN 3
uint16_t rx_buf[RX_LEN] = {0x0,};
usart_read_buffer_job(&module, (uint8_t*)rx_buf, RX_LEN);

Returns

Status of the operation.

Table 16-31. Return Values
Return valueDescription

STATUS_OK

If operation was completed

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