2323 *
2424 */
2525
26- #if 1
2726#include <stdlib.h>
2827#include <stdio.h>
2928#include <string.h>
@@ -52,7 +51,7 @@ int main(void) {
5251
5352 // Blink and print every interval ms
5453 if (!(board_millis () - start_ms < interval_ms )) {
55- // board_uart_write(HELLO_STR, strlen(HELLO_STR));
54+ board_uart_write (HELLO_STR , strlen (HELLO_STR ));
5655
5756 start_ms = board_millis ();
5857
@@ -61,57 +60,12 @@ int main(void) {
6160 }
6261
6362 // echo
64- // uint8_t ch;
65- // if (board_uart_read(&ch, 1) > 0) {
66- // board_uart_write(&ch, 1);
67- // }
68- }
69- }
70-
71- #else
72- #include <stdio.h>
73- #include <zephyr/kernel.h>
74- #include <zephyr/drivers/gpio.h>
75-
76- /* 1000 msec = 1 sec */
77- #define SLEEP_TIME_MS 200
78-
79- /* The devicetree node identifier for the "led0" alias. */
80- #define LED0_NODE DT_ALIAS(led0)
81-
82- /*
83- * A build error on this line means your board is unsupported.
84- * See the sample documentation for information on how to fix this.
85- */
86- static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET (LED0_NODE , gpios );
87-
88- int main (void )
89- {
90- int ret ;
91- bool led_state = true;
92-
93- if (!gpio_is_ready_dt (& led )) {
94- return 0 ;
95- }
96-
97- ret = gpio_pin_configure_dt (& led , GPIO_OUTPUT_ACTIVE );
98- if (ret < 0 ) {
99- return 0 ;
100- }
101-
102- while (1 ) {
103- ret = gpio_pin_toggle_dt (& led );
104- if (ret < 0 ) {
105- return 0 ;
63+ uint8_t ch ;
64+ if (board_uart_read (& ch , 1 ) > 0 ) {
65+ board_uart_write (& ch , 1 );
10666 }
107-
108- led_state = !led_state ;
109- printf ("LED state: %s\n" , led_state ? "ON" : "OFF" );
110- k_msleep (SLEEP_TIME_MS );
11167 }
112- return 0 ;
11368}
114- #endif
11569
11670#if TUSB_MCU_VENDOR_ESPRESSIF
11771void app_main (void ) {
0 commit comments