First commit

This commit is contained in:
Miguel I.
2025-09-02 18:12:30 +02:00
commit 71b3c6f703
865 changed files with 114028 additions and 0 deletions

17
drivers/button/button.c Normal file
View File

@@ -0,0 +1,17 @@
#include "button.h"
#include <zephyr/sys/printk.h>
#define BUTTON_NODE DT_NODELABEL(button0)
static const struct gpio_dt_spec button = GPIO_DT_SPEC_GET(BUTTON_NODE, gpios);
void button_init(void) {
if (!device_is_ready(button.port)) {
printk("Button device not ready\n");
return;
}
gpio_pin_configure_dt(&button, GPIO_INPUT);
}
int button_read(void) {
return gpio_pin_get_dt(&button);
}

9
drivers/button/button.h Normal file
View File

@@ -0,0 +1,9 @@
#ifndef BUTTON_H
#define BUTTON_H
#include <zephyr/drivers/gpio.h>
void button_init(void);
int button_read(void);
#endif // BUTTON_H