16.8.1.2.2 Workflow

  1. 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));
    
  2. Enter an infinite loop to continuously echo received values on the USART.
    while (true) {
        if (usart_read_wait(&usart_instance, &temp) == STATUS_OK) {
            while (usart_write_wait(&usart_instance, temp) != STATUS_OK) {
            }
        }
    }
    
  3. Perform a blocking read of the USART, storing the received character into the previously declared temporary variable.
    if (usart_read_wait(&usart_instance, &temp) == STATUS_OK) {
    
  4. Echo the received variable back to the USART via a blocking write.
    while (usart_write_wait(&usart_instance, temp) != STATUS_OK) {
    }