summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorhathach <[email protected]>2022-11-18 21:50:00 +0700
committerhathach <[email protected]>2022-11-18 21:50:00 +0700
commita6001fc8f2cfe0db2cf5ba410b49961781ce1803 (patch)
tree41a393d762fe6ee46197d097a24487f60815aae9 /examples
parentb00529e287c13197f80787f5126626b0d08c06a1 (diff)
update uart read for lpc18/43 for testing
Diffstat (limited to 'examples')
-rw-r--r--examples/device/board_test/src/main.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/examples/device/board_test/src/main.c b/examples/device/board_test/src/main.c
index 5e28cbb27..74beda55f 100644
--- a/examples/device/board_test/src/main.c
+++ b/examples/device/board_test/src/main.c
@@ -56,7 +56,7 @@ int main(void)
{
uint32_t interval_ms = board_button_read() ? BLINK_PRESSED : BLINK_UNPRESSED;
- // Blink every interval ms
+ // Blink and print every interval ms
if ( !(board_millis() - start_ms < interval_ms) )
{
board_uart_write(HELLO_STR, strlen(HELLO_STR));
@@ -66,6 +66,13 @@ int main(void)
board_led_write(led_state);
led_state = 1 - led_state; // toggle
}
+
+ // echo
+ uint8_t ch;
+ if ( board_uart_read(&ch, 1) )
+ {
+ board_uart_write(&ch, 1);
+ }
}
return 0;