forked from alibenpeng/ruwido_hidusb
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathkeymap.h
303 lines (287 loc) · 11.3 KB
/
keymap.h
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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
// Ruwido Merlin IR Keycodes
#define MERLIN_MOD_CONTROL_LEFT 0x08AB
#define MERLIN_MOD_SHIFT_LEFT 0x08AC
#define MERLIN_MOD_ALT_LEFT 0x0A2D
#define MERLIN_MOD_ALT_RIGHT 0x0A39
#define MERLIN_KEY_A 0x0AB3
#define MERLIN_KEY_B 0x0AB4
#define MERLIN_KEY_C 0x0AB9
#define MERLIN_KEY_D 0x0AE8
#define MERLIN_KEY_E 0x0ACB
#define MERLIN_KEY_F 0x0ACC
#define MERLIN_KEY_G 0x02B5
#define MERLIN_KEY_H 0x0AD8
#define MERLIN_KEY_I 0x0AE3
#define MERLIN_KEY_J 0x0AE4
#define MERLIN_KEY_K 0x0AE9
#define MERLIN_KEY_L 0x0BA8
#define MERLIN_KEY_M 0x0B2B
#define MERLIN_KEY_N 0x0B2C
#define MERLIN_KEY_O 0x02CD
#define MERLIN_KEY_P 0x0B38
#define MERLIN_KEY_Q 0x02D3
#define MERLIN_KEY_R 0x02D4
#define MERLIN_KEY_S 0x02D9
#define MERLIN_KEY_T 0x0B68
#define MERLIN_KEY_U 0x0B8B
#define MERLIN_KEY_V 0x0B8C
#define MERLIN_KEY_W 0x02E5
#define MERLIN_KEY_X 0x0B98
#define MERLIN_KEY_Y 0x0BA3
#define MERLIN_KEY_Z 0x0BA4
#define MERLIN_KEY_1 0x0BA9
#define MERLIN_KEY_2 0x0EA8
#define MERLIN_KEY_3 0x0CAB
#define MERLIN_KEY_4 0x0CAC
#define MERLIN_KEY_5 0x032D
#define MERLIN_KEY_6 0x0CB8
#define MERLIN_KEY_7 0x0333
#define MERLIN_KEY_8 0x0334
#define MERLIN_KEY_9 0x0339
#define MERLIN_KEY_0 0x0CE8
#define MERLIN_KEY_TAB 0x0358
#define MERLIN_KEY_COMMA 0x0399
#define MERLIN_KEY_PERIOD 0x0E68
#define MERLIN_KEY_SLASH 0x0E8B
#define MERLIN_KEY_SEMICOLON 0x0E38
#define MERLIN_KEY_QUOTE 0x0393
#define MERLIN_KEY_EQUALS 0x0369
#define MERLIN_KEY_BACKSPACE 0x0CD5
#define MERLIN_KEY_ENTER 0x034B
#define MERLIN_KEY_SPACE 0x0363
#define MERLIN_KEY_POWER 0x034C
#define MERLIN_KEY_P_ 0x05A3
#define MERLIN_KEY_M_ 0x05A4
#define MERLIN_KEY_S_ 0x0598
#define MERLIN_KEY_TEXT 0x0E98
#define MERLIN_KEY_EXIT 0x0D54
#define MERLIN_KEY_RED 0x06A8
#define MERLIN_KEY_GREEN 0x08AB
#define MERLIN_KEY_VT 0x0D53
#define MERLIN_KEY_YELLOW 0x08AC
#define MERLIN_KEY_BLUE 0x062D
#define MERLIN_KEY_REWIND 0x0EA4
#define MERLIN_KEY_FASTFORWARD 0x0AA8
#define MERLIN_KEY_PLAYPAUSE 0x0EA9
#define MERLIN_KEY_FM 0x0568
#define MERLIN_KEY_STOP 0x02AB
#define MERLIN_KEY_HELP 0x0D59
#define MERLIN_KEY_REC 0x0633
#define MERLIN_KEY_UP 0x0D4D
#define MERLIN_KEY_DOWN 0x052C
#define MERLIN_KEY_LEFT 0x052B
#define MERLIN_KEY_RIGHT 0x03A8
#define MERLIN_KEY_OK 0x058B
#define MERLIN_KEY_VOLPLUS 0x02AC
#define MERLIN_KEY_VOLMINUS 0x04AD
#define MERLIN_KEY_CHPLUS 0x02B8
#define MERLIN_KEY_CHMINUS 0x04B3
// Alice remote IR Keycodes
#define ALICE_KEY_POWER
#define ALICE_KEY_1
#define ALICE_KEY_2
#define ALICE_KEY_3
#define ALICE_KEY_4
#define ALICE_KEY_5
#define ALICE_KEY_6
#define ALICE_KEY_7
#define ALICE_KEY_8
#define ALICE_KEY_9
#define ALICE_KEY_0
#define ALICE_KEY_TV
#define ALICE_KEY_LIST
#define ALICE_KEY_INFO
#define ALICE_KEY_EPG
#define ALICE_KEY_ESC
#define ALICE_KEY_MOVIE
#define ALICE_KEY_UP
#define ALICE_KEY_DOWN
#define ALICE_KEY_LEFT
#define ALICE_KEY_RIGHT
#define ALICE_KEY_OK
#define ALICE_KEY_RED
#define ALICE_KEY_GREEN
#define ALICE_KEY_YELLOW
#define ALICE_KEY_BLUE
#define ALICE_KEY_VOLPLUS
#define ALICE_KEY_VOLMINUS
#define ALICE_KEY_CHPLUS
#define ALICE_KEY_CHMINUS
#define ALICE_KEY_ALICE
#define ALICE_KEY_PLAYPAUSE
#define ALICE_KEY_LAST
#define ALICE_KEY_REWIND
#define ALICE_KEY_FASTFORWARD
#define ALICE_KEY_NEXT
#define ALICE_KEY_MUTE
#define ALICE_KEY_STOP
#define ALICE_KEY_REC
#define ALICE_KEY_TXT
/* Keyboard usage values, see usb.org's HID-usage-tables document, chapter
* 10 Keyboard/Keypad Page for more codes.
*/
#define MOD_CONTROL_LEFT (1<<0)
#define MOD_SHIFT_LEFT (1<<1)
#define MOD_ALT_LEFT (1<<2)
#define MOD_ALT_RIGHT (1<<6)
#define KEY_A 4
#define KEY_B 5
#define KEY_C 6
#define KEY_D 7
#define KEY_E 8
#define KEY_F 9
#define KEY_G 10
#define KEY_H 11
#define KEY_I 12
#define KEY_J 13
#define KEY_K 14
#define KEY_L 15
#define KEY_M 16
#define KEY_N 17
#define KEY_O 18
#define KEY_P 19
#define KEY_Q 20
#define KEY_R 21
#define KEY_S 22
#define KEY_T 23
#define KEY_U 24
#define KEY_V 25
#define KEY_W 26
#define KEY_X 27
#define KEY_Y 28
#define KEY_Z 29
#define KEY_1 30
#define KEY_2 31
#define KEY_3 32
#define KEY_4 33
#define KEY_5 34
#define KEY_6 35
#define KEY_7 36
#define KEY_8 37
#define KEY_9 38
#define KEY_0 39
#define KEY_TAB 43
#define KEY_COMMA 54
#define KEY_PERIOD 55
#define KEY_SLASH 56
#define KEY_SEMICOLON 51
#define KEY_QUOTE 52
#define KEY_EQUALS 46
#define KEY_BACKSPACE 42
#define KEY_ENTER 40
#define KEY_SPACE 44
#define KEY_POWER 102
#define KEY_P_ 19
#define KEY_M_ 127 // mute
#define KEY_S_ 22
#define KEY_TEXT 0
#define KEY_EXIT 41 // escape
#define KEY_RED 47 // [
#define KEY_GREEN 0 // control
#define KEY_VT 45 // -
#define KEY_YELLOW 0 // shift
#define KEY_BLUE 48 // ]
#define KEY_REWIND 0
#define KEY_FASTFORWARD 0
#define KEY_PLAYPAUSE 0
#define KEY_FM 0
#define KEY_STOP 0
#define KEY_HELP 0
#define KEY_REC 0
#define KEY_UP 82
#define KEY_DOWN 81
#define KEY_LEFT 80
#define KEY_RIGHT 79
#define KEY_OK 88
#define KEY_VOLPLUS 128
#define KEY_VOLMINUS 129
#define KEY_CHPLUS 0
#define KEY_CHMINUS 0
// Keymapping array (could/should this be in progmem?)
#define NUM_MODS 4
#define NUM_KEYS 73
struct keymap_t {
uint32_t merlin;
uint8_t usb;
};
struct keymap_t modmap[NUM_MODS] = {
{ MERLIN_MOD_CONTROL_LEFT, MOD_CONTROL_LEFT },
{ MERLIN_MOD_SHIFT_LEFT, MOD_SHIFT_LEFT },
{ MERLIN_MOD_ALT_LEFT, MOD_ALT_LEFT },
{ MERLIN_MOD_ALT_RIGHT, MOD_ALT_RIGHT },
};
struct keymap_t keymap[NUM_KEYS] = {
{ MERLIN_KEY_A, KEY_A },
{ MERLIN_KEY_B, KEY_B },
{ MERLIN_KEY_C, KEY_C },
{ MERLIN_KEY_D, KEY_D },
{ MERLIN_KEY_E, KEY_E },
{ MERLIN_KEY_F, KEY_F },
{ MERLIN_KEY_G, KEY_G },
{ MERLIN_KEY_H, KEY_H },
{ MERLIN_KEY_I, KEY_I },
{ MERLIN_KEY_J, KEY_J },
{ MERLIN_KEY_K, KEY_K },
{ MERLIN_KEY_L, KEY_L },
{ MERLIN_KEY_M, KEY_M },
{ MERLIN_KEY_N, KEY_N },
{ MERLIN_KEY_O, KEY_O },
{ MERLIN_KEY_P, KEY_P },
{ MERLIN_KEY_Q, KEY_Q },
{ MERLIN_KEY_R, KEY_R },
{ MERLIN_KEY_S, KEY_S },
{ MERLIN_KEY_T, KEY_T },
{ MERLIN_KEY_U, KEY_U },
{ MERLIN_KEY_V, KEY_V },
{ MERLIN_KEY_W, KEY_W },
{ MERLIN_KEY_X, KEY_X },
{ MERLIN_KEY_Y, KEY_Y },
{ MERLIN_KEY_Z, KEY_Z },
{ MERLIN_KEY_1, KEY_1 },
{ MERLIN_KEY_2, KEY_2 },
{ MERLIN_KEY_3, KEY_3 },
{ MERLIN_KEY_4, KEY_4 },
{ MERLIN_KEY_5, KEY_5 },
{ MERLIN_KEY_6, KEY_6 },
{ MERLIN_KEY_7, KEY_7 },
{ MERLIN_KEY_8, KEY_8 },
{ MERLIN_KEY_9, KEY_9 },
{ MERLIN_KEY_0, KEY_0 },
{ MERLIN_KEY_TAB, KEY_TAB },
{ MERLIN_KEY_COMMA, KEY_COMMA },
{ MERLIN_KEY_PERIOD, KEY_PERIOD },
{ MERLIN_KEY_SLASH, KEY_SLASH },
{ MERLIN_KEY_SEMICOLON, KEY_SEMICOLON },
{ MERLIN_KEY_QUOTE, KEY_QUOTE },
{ MERLIN_KEY_EQUALS, KEY_EQUALS },
{ MERLIN_KEY_BACKSPACE, KEY_BACKSPACE },
{ MERLIN_KEY_ENTER, KEY_ENTER },
{ MERLIN_KEY_SPACE, KEY_SPACE },
{ MERLIN_KEY_POWER, KEY_POWER },
{ MERLIN_KEY_P_, KEY_P_ },
{ MERLIN_KEY_M_, KEY_M_ },
{ MERLIN_KEY_S_, KEY_S_ },
{ MERLIN_KEY_TEXT, KEY_TEXT },
{ MERLIN_KEY_EXIT, KEY_EXIT },
{ MERLIN_KEY_RED, KEY_RED },
{ MERLIN_KEY_GREEN, KEY_GREEN },
{ MERLIN_KEY_VT, KEY_VT },
{ MERLIN_KEY_YELLOW, KEY_YELLOW },
{ MERLIN_KEY_BLUE, KEY_BLUE },
{ MERLIN_KEY_REWIND, KEY_REWIND },
{ MERLIN_KEY_FASTFORWARD, KEY_FASTFORWARD },
{ MERLIN_KEY_PLAYPAUSE, KEY_PLAYPAUSE },
{ MERLIN_KEY_FM, KEY_FM },
{ MERLIN_KEY_STOP, KEY_STOP },
{ MERLIN_KEY_HELP, KEY_HELP },
{ MERLIN_KEY_REC, KEY_REC },
{ MERLIN_KEY_UP, KEY_UP },
{ MERLIN_KEY_DOWN, KEY_DOWN },
{ MERLIN_KEY_LEFT, KEY_LEFT },
{ MERLIN_KEY_RIGHT, KEY_RIGHT },
{ MERLIN_KEY_OK, KEY_OK },
{ MERLIN_KEY_VOLPLUS, KEY_VOLPLUS },
{ MERLIN_KEY_VOLMINUS, KEY_VOLMINUS },
{ MERLIN_KEY_CHPLUS, KEY_CHPLUS },
{ MERLIN_KEY_CHMINUS, KEY_CHMINUS },
};