sync
This commit is contained in:
parent
4e87357519
commit
ab6954902a
|
|
@ -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";
|
||||
};
|
||||
|
|
|
|||
4
prj.conf
4
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
|
||||
|
|
|
|||
29
src/main.c
29
src/main.c
|
|
@ -1,7 +1,36 @@
|
|||
#include <zephyr/kernel.h>
|
||||
#include <zephyr/drivers/gpio.h>
|
||||
|
||||
#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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue