diff --git a/boards/dfrobot/firebeetle2_esp32c6/firebeetle2_esp32c6_hpcore.dts b/boards/dfrobot/firebeetle2_esp32c6/firebeetle2_esp32c6_hpcore.dts index 77f1fa0..5c8dbfa 100644 --- a/boards/dfrobot/firebeetle2_esp32c6/firebeetle2_esp32c6_hpcore.dts +++ b/boards/dfrobot/firebeetle2_esp32c6/firebeetle2_esp32c6_hpcore.dts @@ -25,9 +25,18 @@ aliases { sw0 = &user_button1; + led0 = &green_led; watchdog0 = &wdt0; }; + leds: leds { + compatible = "gpio-leds"; + green_led: led_0 { + gpios = <&gpio0 13 GPIO_ACTIVE_LOW>; + label = "User LED1"; + }; + }; + gpio_keys { compatible = "gpio-keys"; user_button1: button_1 { @@ -71,6 +80,10 @@ status = "okay"; }; +&usb_serial { + status = "okay"; +}; + &wifi { status = "okay"; }; diff --git a/prj.conf b/prj.conf index 01de97a..c6baee6 100644 --- a/prj.conf +++ b/prj.conf @@ -1,5 +1 @@ CONFIG_PRINTK=y -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n -CONFIG_USB_DEVICE_STACK=y -CONFIG_USB_DEVICE_CDC_ACM=y diff --git a/src/main.c b/src/main.c index b270dcd..a3aff8b 100644 --- a/src/main.c +++ b/src/main.c @@ -1,7 +1,36 @@ #include +#include + +#define LED0_NODE DT_ALIAS(led0) void main(void) { + const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(LED0_NODE, gpios); + int ret; + + if (!gpio_is_ready_dt(&led)) { + return; + } + + ret = gpio_pin_configure_dt(&led, GPIO_OUTPUT_ACTIVE); + if (ret < 0) { + return; + } + printk("Hello World! %s\n", CONFIG_BOARD); + + while (1) { + ret = gpio_pin_toggle_dt(&led); + if (ret < 0) { + return; + } + k_msleep(100); + + ret = gpio_pin_toggle_dt(&led); + if (ret < 0) { + return; + } + k_msleep(300); + } }