#include "button.h" #include #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); }