summaryrefslogtreecommitdiff
path: root/examples/device/board_test/src
diff options
context:
space:
mode:
authorhathach <[email protected]>2025-07-09 13:07:13 +0700
committerhathach <[email protected]>2025-07-09 13:07:13 +0700
commit386f5518992166dec0830659b21663aeddae4fc8 (patch)
treec143f921067c6fbe0bbc9d68c8864b9b1fc71d11 /examples/device/board_test/src
parent965e26de1dcbd87c3b0e371857bc4ad0b9b3e840 (diff)
parent04fb5873effebb3dff770e3257ed789ee36f3846 (diff)
Merge branch 'refs/heads/master' into fork/ChrisDeadman/hcd-samd-support
Diffstat (limited to 'examples/device/board_test/src')
-rw-r--r--examples/device/board_test/src/main.c27
-rw-r--r--examples/device/board_test/src/tusb_config.h2
2 files changed, 19 insertions, 10 deletions
diff --git a/examples/device/board_test/src/main.c b/examples/device/board_test/src/main.c
index 91799eb89..d91a8760e 100644
--- a/examples/device/board_test/src/main.c
+++ b/examples/device/board_test/src/main.c
@@ -49,25 +49,34 @@ int main(void) {
while (1) {
uint32_t interval_ms = board_button_read() ? BLINK_PRESSED : BLINK_UNPRESSED;
+ int ch = board_getchar();
+ if (ch > 0) {
+ board_putchar(ch);
+ #ifndef LOGGER_UART
+ board_uart_write(&ch, 1);
+ #endif
+ }
+
// Blink and print every interval ms
if (!(board_millis() - start_ms < interval_ms)) {
- board_uart_write(HELLO_STR, strlen(HELLO_STR));
-
start_ms = board_millis();
+ if (ch < 0) {
+ // skip if echoing
+ printf(HELLO_STR);
+
+ #ifndef LOGGER_UART
+ board_uart_write(HELLO_STR, strlen(HELLO_STR));
+ #endif
+ }
+
board_led_write(led_state);
led_state = 1 - led_state; // toggle
}
-
- // echo
- uint8_t ch;
- if (board_uart_read(&ch, 1) > 0) {
- board_uart_write(&ch, 1);
- }
}
}
-#if CFG_TUSB_MCU == OPT_MCU_ESP32S2 || CFG_TUSB_MCU == OPT_MCU_ESP32S3
+#ifdef ESP_PLATFORM
void app_main(void) {
main();
}
diff --git a/examples/device/board_test/src/tusb_config.h b/examples/device/board_test/src/tusb_config.h
index 89c27d1c0..81829d450 100644
--- a/examples/device/board_test/src/tusb_config.h
+++ b/examples/device/board_test/src/tusb_config.h
@@ -44,7 +44,7 @@
#endif
// Espressif IDF requires "freertos/" prefix in include path
-#if TUP_MCU_ESPRESSIF
+#ifdef ESP_PLATFORM
#define CFG_TUSB_OS_INC_PATH freertos/
#endif