-
Notifications
You must be signed in to change notification settings - Fork 0
/
lcd-rgb-keypad.dts
166 lines (138 loc) · 3.41 KB
/
lcd-rgb-keypad.dts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
// Definitions for MCP23017 Gpio Extender from Microchip Semiconductor
/dts-v1/;
/plugin/;
/ {
compatible = "brcm,bcm2708";
fragment@0 {
target = <&i2c_arm>;
__overlay__ {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
mcp23017: mcp@20 {
compatible = "microchip,mcp23017";
reg = <0x20>;
gpio-controller;
#gpio-cells = <2>;
//#interrupt-cells=<2>;
//interrupt-parent = <&gpio>;
//interrupts = <4 2>;
//interrupt-controller;
//microchip,irq-mirror;
status = "okay";
gpiokeys: pinmux0 {
pins = "gpio0", "gpio1", "gpio2", "gpio3", "gpio4";
bias-pull-up;
};
gpioleds: pinmux1 {
pins = "gpio6", "gpio7", "gpio8";
bias-pull-up;
};
gpiolcd: pinmux2 {
pins = "gpio5", "gpio9", "gpio10", "gpio11", "gpio12", "gpio13", "gpio14", "gpio15";
bias-pull-up;
};
};
};
};
// Display
fragment@1 {
target-path = "/";
__overlay__ {
auxdisplay: auxdisplay {
compatible = "hit,hd44780";
// 0->GPIO_ACTIVE_HIGH
data-gpios = <&mcp23017 12 0>, /*Port GPB4*/
<&mcp23017 11 0>, /*Port GPB3*/
<&mcp23017 10 0>, /*Port GPB2*/
<&mcp23017 9 0>; /*Port GPB1*/
enable-gpios = <&mcp23017 13 0>; //Port GPB5
rw-gpios = <&mcp23017 14 0>; //Port GPB6
rs-gpios = <&mcp23017 15 0>; //Port GPB7
backlight-gpios = <&mcp23017 5 1>; //Port GPA5 (invert command)
display-height-chars = <2>;
display-width-chars = <16>;
pinctrl-names = "default";
pinctrl-0 = <&gpiolcd>;
status = "okay";
};
};
};
// RGB Led
// led R Port GPA6
// led G Port GPA7
// led B Port GPB0
fragment@2 {
target-path = "/";
__overlay__ {
expander_leds {
compatible = "gpio-leds";
pinctrl-names = "default";
pinctrl-0 = <&gpioleds>;
status = "okay";
led0: red {
label = "red";
gpios = <&mcp23017 6 1>;
default-state = "off";
};
led1: green {
label = "green";
gpios = <&mcp23017 7 1>;
default-state = "off";
};
led2: blue {
label = "blue";
gpios = <&mcp23017 8 1>;
default-state = "off";
};
};
};
};
// TODO Buttons (need to be fixed and tested)
// Button Select GPA0
// Button Right GPA1
// Button Down GPA2
// Button Up GPA3
// Button Left GPA4
fragment@3 {
target-path = "/";
__overlay__ {
keypad: keypad {
//compatible = "gpio-keys"; // NOT POSSIBLE BECAUSE Interrupt pins are not wired on my mcp23017 board
compatible = "gpio-keys-polled";
poll-interval = <100>;
#address-cells = <1>;
#size-cells = <0>;
autorepeat;
pinctrl-names = "default";
pinctrl-0 = <&gpiokeys>;
status = "okay";
enter: enter {
label = "GPIO Key Select";
linux,code = <28>; // Enter
gpios = <&mcp23017 0 1>;
};
right: right {
label = "GPIO Key RIGHT";
linux,code = <106>;
gpios = <&mcp23017 1 1>;
};
down: down {
label = "GPIO Key DOWN";
linux,code = <108>;
gpios = <&mcp23017 2 1>;
};
up: up {
label = "GPIO Key UP";
linux,code = <103>;
gpios = <&mcp23017 3 1>;
};
left: left {
label = "GPIO Key LEFT";
linux,code = <105>;
gpios = <&mcp23017 4 1>;
};
};
};
};
};