testing
This commit is contained in:
37
src/main.c
Normal file
37
src/main.c
Normal file
@@ -0,0 +1,37 @@
|
||||
#include <zephyr/devicetree.h>
|
||||
#include <zephyr/drivers/gpio.h>
|
||||
#include <zephyr/kernel.h>
|
||||
#include <zephyr/drivers/uart.h>
|
||||
|
||||
#define SLEEP_MS 2000
|
||||
|
||||
#define LED_NODE DT_ALIAS(led0)
|
||||
#if !DT_NODE_HAS_STATUS(LED_NODE, okay)
|
||||
#error "led0 not enabled in devicetree"
|
||||
#endif
|
||||
|
||||
static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(LED_NODE, gpios);
|
||||
|
||||
int main(void)
|
||||
{
|
||||
printk("app started\n");
|
||||
|
||||
if (!gpio_is_ready_dt(&led))
|
||||
{
|
||||
printk("LED GPIO not ready\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ret = gpio_pin_configure_dt(&led, GPIO_OUTPUT_ACTIVE);
|
||||
if (ret < 0)
|
||||
{
|
||||
printk("LED GPIO configure failed: %d\n", ret);
|
||||
return 0;
|
||||
}
|
||||
|
||||
char incoming;
|
||||
int i = 0;
|
||||
while (1)
|
||||
{
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user