summaryrefslogtreecommitdiff
path: root/examples/device
diff options
context:
space:
mode:
authorhathach <[email protected]>2019-10-18 17:50:29 +0700
committerhathach <[email protected]>2019-10-18 17:50:29 +0700
commit558b4dbde3b9c5e575de08399bad94ae2737d697 (patch)
tree519a057d2afbb65075b8cf059e3eb0d332010237 /examples/device
parent90b6b5d137af680e807bc2909d9d0e79b9f118ce (diff)
change DEBUG optimization option from O0 to Og
add uart write to board test example
Diffstat (limited to 'examples/device')
-rw-r--r--examples/device/board_test/src/main.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/examples/device/board_test/src/main.c b/examples/device/board_test/src/main.c
index 0126110ed..16aad95f8 100644
--- a/examples/device/board_test/src/main.c
+++ b/examples/device/board_test/src/main.c
@@ -42,6 +42,8 @@ enum {
BLINK_UNPRESSED = 1000
};
+#define HELLO_STR "Hello from TinyUSB\n"
+
int main(void)
{
board_init();
@@ -49,13 +51,20 @@ int main(void)
uint32_t start_ms = 0;
bool led_state = false;
+
while (1)
{
uint32_t interval_ms = board_button_read() ? BLINK_PRESSED : BLINK_UNPRESSED;
+ // uart echo
+// uint8_t ch;
+// if ( board_uart_read(&ch, 1) ) board_uart_write(&ch, 1);
+
// Blink every interval ms
if ( !(board_millis() - start_ms < interval_ms) )
{
+ board_uart_write(HELLO_STR, strlen(HELLO_STR));
+
start_ms = board_millis();
board_led_write(led_state);