Added some code snippets
All checks were successful
Build & Publish / build (push) Successful in 8m21s
All checks were successful
Build & Publish / build (push) Successful in 8m21s
This commit is contained in:
21
snippets/led/code.txt
Normal file
21
snippets/led/code.txt
Normal file
@@ -0,0 +1,21 @@
|
||||
int blink_led(void) {
|
||||
int ret;
|
||||
|
||||
if (!gpio_is_ready_dt(&led)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = gpio_pin_configure_dt(&led, GPIO_OUTPUT_ACTIVE);
|
||||
if (ret < 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
ret = gpio_pin_toggle_dt(&led);
|
||||
if (ret < 0) {
|
||||
return 0;
|
||||
}
|
||||
k_msleep(1000);
|
||||
}
|
||||
return 0;
|
||||
}
|
2
snippets/led/imports.txt
Normal file
2
snippets/led/imports.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
#include <zephyr/drivers/gpio.h>
|
||||
#define LED0_NODE DT_ALIAS(led0)
|
Reference in New Issue
Block a user