16.8.2.2.2 Workflow
- Enable global interrupts, so that the callbacks can be fired.
system_interrupt_enable_global();
- Send a string to the USART to show the demo is running, blocking until all characters have been sent.
uint8_t
string
[] =
"Hello World!\r\n"
;
usart_write_buffer_wait(&usart_instance,
string
,
sizeof
(
string
));
- Enter an infinite loop to continuously echo received values on the USART.
while
(
true
) {
- Perform an asynchronous read of the USART, which will fire the registered callback when characters are received.
usart_read_buffer_job(&usart_instance,
(uint8_t *)rx_buffer, MAX_RX_BUFFER_LENGTH);