Skip to content

Commit 8d8fb5b

Browse files
henrikbrixandersenkartben
authored andcommitted
boards: others: neorv32: add GPIO buttons
Add buttons connected via GPIOs 0 to 3 for the NEORV32 MinimalBoot and UP5Kdemo board variants. Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
1 parent 0366df3 commit 8d8fb5b

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed

boards/others/neorv32/neorv32_neorv32_minimalboot.dts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include <neorv32.dtsi>
1010
#include <mem.h>
11+
#include <zephyr/dt-bindings/input/input-event-codes.h>
1112

1213
/ {
1314
model = "NEORV32 MinimalBoot";
@@ -21,6 +22,10 @@
2122
pwm-led0 = &pwm_led0;
2223
pwm-led1 = &pwm_led1;
2324
pwm-led2 = &pwm_led2;
25+
sw0 = &btn0;
26+
sw1 = &btn1;
27+
sw3 = &btn2;
28+
sw4 = &btn3;
2429
};
2530

2631
chosen {
@@ -55,6 +60,34 @@
5560
};
5661
};
5762

63+
gpio_keys {
64+
compatible = "gpio-keys";
65+
66+
btn0: btn0 {
67+
label = "BTN0";
68+
gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
69+
zephyr,code = <INPUT_KEY_0>;
70+
};
71+
72+
btn1: btn1 {
73+
label = "BTN1";
74+
gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
75+
zephyr,code = <INPUT_KEY_1>;
76+
};
77+
78+
btn2: btn2 {
79+
label = "BTN2";
80+
gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
81+
zephyr,code = <INPUT_KEY_2>;
82+
};
83+
84+
btn3: btn3 {
85+
label = "BTN3";
86+
gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
87+
zephyr,code = <INPUT_KEY_3>;
88+
};
89+
};
90+
5891
pwmleds {
5992
compatible = "pwm-leds";
6093

boards/others/neorv32/neorv32_neorv32_up5kdemo.dts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include <neorv32.dtsi>
1010
#include <mem.h>
11+
#include <zephyr/dt-bindings/input/input-event-codes.h>
1112

1213
/ {
1314
model = "NEORV32 UP5KDemo";
@@ -21,6 +22,10 @@
2122
pwm-led0 = &pwm_led0;
2223
pwm-led1 = &pwm_led1;
2324
pwm-led2 = &pwm_led2;
25+
sw0 = &btn0;
26+
sw1 = &btn1;
27+
sw3 = &btn2;
28+
sw4 = &btn3;
2429
};
2530

2631
chosen {
@@ -55,6 +60,34 @@
5560
};
5661
};
5762

63+
gpio_keys {
64+
compatible = "gpio-keys";
65+
66+
btn0: btn0 {
67+
label = "BTN0";
68+
gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
69+
zephyr,code = <INPUT_KEY_0>;
70+
};
71+
72+
btn1: btn1 {
73+
label = "BTN1";
74+
gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
75+
zephyr,code = <INPUT_KEY_1>;
76+
};
77+
78+
btn2: btn2 {
79+
label = "BTN2";
80+
gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
81+
zephyr,code = <INPUT_KEY_2>;
82+
};
83+
84+
btn3: btn3 {
85+
label = "BTN3";
86+
gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
87+
zephyr,code = <INPUT_KEY_3>;
88+
};
89+
};
90+
5891
pwmleds {
5992
compatible = "pwm-leds";
6093

0 commit comments

Comments
 (0)