16.6.4.2.4 Function usart_read_buffer_wait()
Receive a buffer of length characters via the USART.
enum status_code usart_read_buffer_wait( struct usart_module *const module, uint8_t * rx_data, uint16_t length)
This blocking function will receive a block of length characters via the USART.
Data direction | Parameter name | Description |
---|---|---|
[in] |
module |
Pointer to USART software instance struct |
[out] |
rx_data |
Pointer to receive buffer |
[in] |
length |
Number of characters to receive |
#define RX_LEN 3
uint16_t rx_buf[RX_LEN] = {0x0,};
usart_read_buffer_wait(&module, (uint8_t*)rx_buf, RX_LEN);
Returns
Status of the operation.
Return value | Description |
---|---|
STATUS_OK |
If operation was completed |
STATUS_ERR_INVALID_ARG |
If operation was not completed, due to an invalid argument being supplied |
STATUS_ERR_TIMEOUT |
If operation was not completed, due to USART module timing out |
STATUS_ERR_BAD_FORMAT |
If the operation was not completed, due to a configuration mismatch between USART and the sender |
STATUS_ERR_BAD_OVERFLOW |
If the operation was not completed, due to the baudrate being too low or the system frequency being too high |
STATUS_ERR_BAD_DATA |
If the operation was not completed, due to data being corrupted |
STATUS_ERR_DENIED |
If the receiver is not enabled |