23
23
*
24
24
*/
25
25
26
- #if 1
27
26
#include <stdlib.h>
28
27
#include <stdio.h>
29
28
#include <string.h>
@@ -52,7 +51,7 @@ int main(void) {
52
51
53
52
// Blink and print every interval ms
54
53
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 ));
56
55
57
56
start_ms = board_millis ();
58
57
@@ -61,57 +60,12 @@ int main(void) {
61
60
}
62
61
63
62
// 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 );
106
66
}
107
-
108
- led_state = !led_state ;
109
- printf ("LED state: %s\n" , led_state ? "ON" : "OFF" );
110
- k_msleep (SLEEP_TIME_MS );
111
67
}
112
- return 0 ;
113
68
}
114
- #endif
115
69
116
70
#if TUSB_MCU_VENDOR_ESPRESSIF
117
71
void app_main (void ) {
0 commit comments