Example Application 1.0.0
A Zephyr-based example application
Loading...
Searching...
No Matches
custom_button.h
1/*
2 * Copyright (c) 2026 IAR Systems AB
3 * SPDX-License-Identifier: Apache-2.0
4 */
5
6#pragma once
7
8#include <zephyr/device.h>
9#include <zephyr/drivers/gpio.h>
10
12 struct gpio_dt_spec gpio;
13};
14
15int button_init(const struct device *dev);
16
17bool button_is_pressed(const struct device *dev);
18
19#define BUTTON_DEFINE(inst) \
20 static const struct button_config button_cfg_##inst = { \
21 .gpio = GPIO_DT_SPEC_GET(DT_INST(inst, custom_button), gpios), \
22 }; \
23 \
24 DEVICE_DT_INST_DEFINE(inst, \
25 button_init, \
26 NULL, \
27 NULL, \
28 &button_cfg_##inst, \
29 POST_KERNEL, \
30 CONFIG_BUTTON_INIT_PRIORITY, \
31 NULL);
32
33#define DT_DRV_COMPAT custom_button
Definition custom_button.h:11