Skip to content

Commit f832718

Browse files
committed
hack: dts hacks on nrf52dk
west build -p -b nrf52dk_nrf52832 samples/basic/blinky -DCONFIG_I2C=y -DCONFIG_KSCAN=y -DCONFIG_SENSOR=y
1 parent c1fa3ad commit f832718

File tree

2 files changed

+62
-6
lines changed

2 files changed

+62
-6
lines changed

boards/arm/nrf52dk_nrf52832/nrf52dk_nrf52832-pinctrl.dtsi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@
2525

2626
i2c0_default: i2c0_default {
2727
group1 {
28-
psels = <NRF_PSEL(TWIM_SDA, 0, 26)>,
29-
<NRF_PSEL(TWIM_SCL, 0, 27)>;
28+
psels = <NRF_PSEL(TWIM_SDA, 0, 27)>,
29+
<NRF_PSEL(TWIM_SCL, 0, 26)>;
3030
};
3131
};
3232

3333
i2c0_sleep: i2c0_sleep {
3434
group1 {
35-
psels = <NRF_PSEL(TWIM_SDA, 0, 26)>,
36-
<NRF_PSEL(TWIM_SCL, 0, 27)>;
35+
psels = <NRF_PSEL(TWIM_SDA, 0, 27)>,
36+
<NRF_PSEL(TWIM_SCL, 0, 26)>;
3737
low-power-enable;
3838
};
3939
};

boards/arm/nrf52dk_nrf52832/nrf52dk_nrf52832.dts

Lines changed: 58 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
/dts-v1/;
99
#include <nordic/nrf52832_qfaa.dtsi>
10+
#include <dt-bindings/input/input-event-codes.h>
1011
#include "nrf52dk_nrf52832-pinctrl.dtsi"
1112

1213
/ {
@@ -22,6 +23,26 @@
2223
zephyr,sram = &sram0;
2324
zephyr,flash = &flash0;
2425
zephyr,code-partition = &slot0_partition;
26+
zephyr,keyboard-scan = &kscan_adapter;
27+
};
28+
29+
kscan_adapter: kscan-adapter {
30+
compatible = "zephyr,kscan-adapter";
31+
input = <&ft5336>;
32+
};
33+
34+
abs-to-rel {
35+
compatible = "zephyr,input-abs-to-rel";
36+
input = <&qdec>;
37+
};
38+
39+
longpress {
40+
compatible = "zephyr,input-longpress";
41+
input = <&buttons>;
42+
input-code = <INPUT_KEY_3>;
43+
short-code = <INPUT_KEY_A>;
44+
long-codes = <INPUT_KEY_B>, <INPUT_KEY_C>, <INPUT_KEY_D>;
45+
long-delays-ms = <500>, <1000>, <2000>;
2546
};
2647

2748
leds {
@@ -51,23 +72,27 @@
5172
};
5273
};
5374

54-
buttons {
55-
compatible = "gpio-keys";
75+
buttons: buttons {
76+
compatible = "zephyr,gpio-keys";
5677
button0: button_0 {
5778
gpios = <&gpio0 13 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
5879
label = "Push button switch 0";
80+
zephyr,code = <INPUT_KEY_0>;
5981
};
6082
button1: button_1 {
6183
gpios = <&gpio0 14 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
6284
label = "Push button switch 1";
85+
zephyr,code = <INPUT_KEY_1>;
6386
};
6487
button2: button_2 {
6588
gpios = <&gpio0 15 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
6689
label = "Push button switch 2";
90+
zephyr,code = <INPUT_KEY_2>;
6791
};
6892
button3: button_3 {
6993
gpios = <&gpio0 16 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
7094
label = "Push button switch 3";
95+
zephyr,code = <INPUT_KEY_3>;
7196
};
7297
};
7398

@@ -128,6 +153,31 @@
128153
watchdog0 = &wdt0;
129154
};
130155
};
156+
&pinctrl {
157+
qdec_default: qdec_default {
158+
group1 {
159+
psels = <NRF_PSEL(QDEC_A, 0, 29)>,
160+
<NRF_PSEL(QDEC_B, 0, 31)>;
161+
};
162+
};
163+
164+
qdec_sleep: qdec_sleep {
165+
group1 {
166+
psels = <NRF_PSEL(QDEC_A, 0, 29)>,
167+
<NRF_PSEL(QDEC_B, 0, 31)>;
168+
low-power-enable;
169+
};
170+
};
171+
};
172+
173+
&qdec {
174+
status = "okay";
175+
led-pre = <0>;
176+
steps = <360>;
177+
pinctrl-0 = <&qdec_default>;
178+
pinctrl-1 = <&qdec_sleep>;
179+
pinctrl-names = "default", "sleep";
180+
};
131181

132182
&adc {
133183
status = "okay";
@@ -156,6 +206,12 @@ arduino_i2c: &i2c0 {
156206
pinctrl-0 = <&i2c0_default>;
157207
pinctrl-1 = <&i2c0_sleep>;
158208
pinctrl-names = "default", "sleep";
209+
210+
ft5336: ft5336@38 {
211+
compatible = "focaltech,ft5336";
212+
reg = <0x38>;
213+
int-gpios = <&gpio0 2 GPIO_ACTIVE_LOW>;
214+
};
159215
};
160216

161217
&i2c1 {

0 commit comments

Comments
 (0)