forked from trustcrypto/OnlyKey-Firmware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
keylayouts.h
318 lines (298 loc) · 13.9 KB
/
keylayouts.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
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
/* Modifications
* Tim Steiner
* Copyright (c) 2015-2018, CryptoTrust LLC.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by CryptoTrust LLC. for
* the OnlyKey Project (http://www.crp.to/ok)"
*
* 4. The names "OnlyKey" and "OnlyKey Project" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For written permission, please contact
* admin@crp.to.
*
* 5. Products derived from this software may not be called "OnlyKey"
* nor may "OnlyKey" or "CryptoTrust" appear in their names without
* specific prior written permission. For written permission, please
* contact admin@crp.to.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by CryptoTrust LLC. for
* the OnlyKey Project (http://www.crp.to/ok)"
*
* 7. Redistributions in any form must be accompanied by information on
* how to obtain complete source code for this software and any
* accompanying software that uses this software. The source code
* must either be included in the distribution or be available for
* no more than the cost of distribution plus a nominal fee, and must
* be freely redistributable under reasonable conditions. For a
* binary file, complete source code means the source code for all
* modules it contains.
*
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS
* ARE GRANTED BY THIS LICENSE. IF SOFTWARE RECIPIENT INSTITUTES PATENT
* LITIGATION AGAINST ANY ENTITY (INCLUDING A CROSS-CLAIM OR COUNTERCLAIM
* IN A LAWSUIT) ALLEGING THAT THIS SOFTWARE (INCLUDING COMBINATIONS OF THE
* SOFTWARE WITH OTHER SOFTWARE OR HARDWARE) INFRINGES SUCH SOFTWARE
* RECIPIENT'S PATENT(S), THEN SUCH SOFTWARE RECIPIENT'S RIGHTS GRANTED BY
* THIS LICENSE SHALL TERMINATE AS OF THE DATE SUCH LITIGATION IS FILED. IF
* ANY PROVISION OF THIS AGREEMENT IS INVALID OR UNENFORCEABLE UNDER
* APPLICABLE LAW, IT SHALL NOT AFFECT THE VALIDITY OR ENFORCEABILITY OF THE
* REMAINDER OF THE TERMS OF THIS AGREEMENT, AND WITHOUT FURTHER ACTION
* BY THE PARTIES HERETO, SUCH PROVISION SHALL BE REFORMED TO THE MINIMUM
* EXTENT NECESSARY TO MAKE SUCH PROVISION VALID AND ENFORCEABLE. ALL
* SOFTWARE RECIPIENT'S RIGHTS UNDER THIS AGREEMENT SHALL TERMINATE IF IT
* FAILS TO COMPLY WITH ANY OF THE MATERIAL TERMS OR CONDITIONS OF THIS
* AGREEMENT AND DOES NOT CURE SUCH FAILURE IN A REASONABLE PERIOD OF
* TIME AFTER BECOMING AWARE OF SUCH NONCOMPLIANCE. THIS SOFTWARE IS
* PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/* Original Teensyduino Core Library
* http://www.pjrc.com/teensy/
* Copyright (c) 2013 PJRC.COM, LLC.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* 1. The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* 2. If the Software is incorporated into a build system that allows
* selection among a list of target devices, then similar target
* devices manufactured by PJRC.COM must be included in the list of
* target devices and selectable in the same manner.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef KEYLAYOUTS_H__
#define KEYLAYOUTS_H__
#include <stdint.h>
#include <avr/pgmspace.h>
#ifdef __cplusplus
extern "C"{
#endif
#define LAYOUT_USA_ENGLISH 0x01
#define LAYOUT_CANADIAN_FRENCH 0x02
#define LAYOUT_CANADIAN_MULTILINGUAL 0x03
#define LAYOUT_DANISH 0x04
#define LAYOUT_FINNISH 0x05
#define LAYOUT_FRENCH 0x06
#define LAYOUT_FRENCH_BELGIAN 0x07
#define LAYOUT_FRENCH_SWISS 0x08
#define LAYOUT_GERMAN 0x09
#define LAYOUT_GERMAN_MAC 0x0A
#define LAYOUT_GERMAN_SWISS 0x0B
#define LAYOUT_ICELANDIC 0x0C
#define LAYOUT_IRISH 0x0D
#define LAYOUT_ITALIAN 0x0E
#define LAYOUT_NORWEGIAN 0x0F
#define LAYOUT_PORTUGUESE 0x10
#define LAYOUT_PORTUGUESE_BRAZILIAN 0x11
#define LAYOUT_SPANISH 0x12
#define LAYOUT_SPANISH_LATIN_AMERICA 0x13
#define LAYOUT_SWEDISH 0x14
#define LAYOUT_TURKISH 0x15
#define LAYOUT_UNITED_KINGDOM 0x16
#define LAYOUT_US_INTERNATIONAL 0x17
#define LAYOUT_CZECH 0x18
#define LAYOUT_SERBIAN_LATIN_ONLY 0x19
// http://en.wikipedia.org/wiki/Keyboard_layout
#define MODIFIERKEY_CTRL ( 0x01 | 0xE000 )
#define MODIFIERKEY_SHIFT ( 0x02 | 0xE000 )
#define MODIFIERKEY_ALT ( 0x04 | 0xE000 )
#define MODIFIERKEY_GUI ( 0x08 | 0xE000 )
#define MODIFIERKEY_LEFT_CTRL ( 0x01 | 0xE000 )
#define MODIFIERKEY_LEFT_SHIFT ( 0x02 | 0xE000 )
#define MODIFIERKEY_LEFT_ALT ( 0x04 | 0xE000 )
#define MODIFIERKEY_LEFT_GUI ( 0x08 | 0xE000 )
#define MODIFIERKEY_RIGHT_CTRL ( 0x10 | 0xE000 )
#define MODIFIERKEY_RIGHT_SHIFT ( 0x20 | 0xE000 )
#define MODIFIERKEY_RIGHT_ALT ( 0x40 | 0xE000 )
#define MODIFIERKEY_RIGHT_GUI ( 0x80 | 0xE000 )
#define KEY_SYSTEM_POWER_DOWN ( 0x81 | 0xE200 )
#define KEY_SYSTEM_SLEEP ( 0x82 | 0xE200 )
#define KEY_SYSTEM_WAKE_UP ( 0x83 | 0xE200 )
#define KEY_MEDIA_PLAY ( 0xB0 | 0xE400 )
#define KEY_MEDIA_PAUSE ( 0xB1 | 0xE400 )
#define KEY_MEDIA_RECORD ( 0xB2 | 0xE400 )
#define KEY_MEDIA_FAST_FORWARD ( 0xB3 | 0xE400 )
#define KEY_MEDIA_REWIND ( 0xB4 | 0xE400 )
#define KEY_MEDIA_NEXT_TRACK ( 0xB5 | 0xE400 )
#define KEY_MEDIA_PREV_TRACK ( 0xB6 | 0xE400 )
#define KEY_MEDIA_STOP ( 0xB7 | 0xE400 )
#define KEY_MEDIA_EJECT ( 0xB8 | 0xE400 )
#define KEY_MEDIA_RANDOM_PLAY ( 0xB9 | 0xE400 )
#define KEY_MEDIA_PLAY_PAUSE ( 0xCD | 0xE400 )
#define KEY_MEDIA_PLAY_SKIP ( 0xCE | 0xE400 )
#define KEY_MEDIA_MUTE ( 0xE2 | 0xE400 )
#define KEY_MEDIA_VOLUME_INC ( 0xE9 | 0xE400 )
#define KEY_MEDIA_VOLUME_DEC ( 0xEA | 0xE400 )
#define KEY_A ( 4 | 0xF000 )
#define KEY_B ( 5 | 0xF000 )
#define KEY_C ( 6 | 0xF000 )
#define KEY_D ( 7 | 0xF000 )
#define KEY_E ( 8 | 0xF000 )
#define KEY_F ( 9 | 0xF000 )
#define KEY_G ( 10 | 0xF000 )
#define KEY_H ( 11 | 0xF000 )
#define KEY_I ( 12 | 0xF000 )
#define KEY_J ( 13 | 0xF000 )
#define KEY_K ( 14 | 0xF000 )
#define KEY_L ( 15 | 0xF000 )
#define KEY_M ( 16 | 0xF000 )
#define KEY_N ( 17 | 0xF000 )
#define KEY_O ( 18 | 0xF000 )
#define KEY_P ( 19 | 0xF000 )
#define KEY_Q ( 20 | 0xF000 )
#define KEY_R ( 21 | 0xF000 )
#define KEY_S ( 22 | 0xF000 )
#define KEY_T ( 23 | 0xF000 )
#define KEY_U ( 24 | 0xF000 )
#define KEY_V ( 25 | 0xF000 )
#define KEY_W ( 26 | 0xF000 )
#define KEY_X ( 27 | 0xF000 )
#define KEY_Y ( 28 | 0xF000 )
#define KEY_Z ( 29 | 0xF000 )
#define KEY_1 ( 30 | 0xF000 )
#define KEY_2 ( 31 | 0xF000 )
#define KEY_3 ( 32 | 0xF000 )
#define KEY_4 ( 33 | 0xF000 )
#define KEY_5 ( 34 | 0xF000 )
#define KEY_6 ( 35 | 0xF000 )
#define KEY_7 ( 36 | 0xF000 )
#define KEY_8 ( 37 | 0xF000 )
#define KEY_9 ( 38 | 0xF000 )
#define KEY_0 ( 39 | 0xF000 )
#define KEY_ENTER ( 40 | 0xF000 )
#define KEY_ESC ( 41 | 0xF000 )
#define KEY_BACKSPACE ( 42 | 0xF000 )
#define KEY_TAB ( 43 | 0xF000 )
#define KEY_SPACE ( 44 | 0xF000 )
#define KEY_MINUS ( 45 | 0xF000 )
#define KEY_EQUAL ( 46 | 0xF000 )
#define KEY_LEFT_BRACE ( 47 | 0xF000 )
#define KEY_RIGHT_BRACE ( 48 | 0xF000 )
#define KEY_BACKSLASH ( 49 | 0xF000 )
#define KEY_NON_US_NUM ( 50 | 0xF000 )
#define KEY_SEMICOLON ( 51 | 0xF000 )
#define KEY_QUOTE ( 52 | 0xF000 )
#define KEY_TILDE ( 53 | 0xF000 )
#define KEY_COMMA ( 54 | 0xF000 )
#define KEY_PERIOD ( 55 | 0xF000 )
#define KEY_SLASH ( 56 | 0xF000 )
#define KEY_CAPS_LOCK ( 57 | 0xF000 )
#define KEY_F1 ( 58 | 0xF000 )
#define KEY_F2 ( 59 | 0xF000 )
#define KEY_F3 ( 60 | 0xF000 )
#define KEY_F4 ( 61 | 0xF000 )
#define KEY_F5 ( 62 | 0xF000 )
#define KEY_F6 ( 63 | 0xF000 )
#define KEY_F7 ( 64 | 0xF000 )
#define KEY_F8 ( 65 | 0xF000 )
#define KEY_F9 ( 66 | 0xF000 )
#define KEY_F10 ( 67 | 0xF000 )
#define KEY_F11 ( 68 | 0xF000 )
#define KEY_F12 ( 69 | 0xF000 )
#define KEY_PRINTSCREEN ( 70 | 0xF000 )
#define KEY_SCROLL_LOCK ( 71 | 0xF000 )
#define KEY_PAUSE ( 72 | 0xF000 )
#define KEY_INSERT ( 73 | 0xF000 )
#define KEY_HOME ( 74 | 0xF000 )
#define KEY_PAGE_UP ( 75 | 0xF000 )
#define KEY_DELETE ( 76 | 0xF000 )
#define KEY_END ( 77 | 0xF000 )
#define KEY_PAGE_DOWN ( 78 | 0xF000 )
#define KEY_RIGHT ( 79 | 0xF000 )
#define KEY_LEFT ( 80 | 0xF000 )
#define KEY_DOWN ( 81 | 0xF000 )
#define KEY_UP ( 82 | 0xF000 )
#define KEY_NUM_LOCK ( 83 | 0xF000 )
#define KEYPAD_SLASH ( 84 | 0xF000 )
#define KEYPAD_ASTERIX ( 85 | 0xF000 )
#define KEYPAD_MINUS ( 86 | 0xF000 )
#define KEYPAD_PLUS ( 87 | 0xF000 )
#define KEYPAD_ENTER ( 88 | 0xF000 )
#define KEYPAD_1 ( 89 | 0xF000 )
#define KEYPAD_2 ( 90 | 0xF000 )
#define KEYPAD_3 ( 91 | 0xF000 )
#define KEYPAD_4 ( 92 | 0xF000 )
#define KEYPAD_5 ( 93 | 0xF000 )
#define KEYPAD_6 ( 94 | 0xF000 )
#define KEYPAD_7 ( 95 | 0xF000 )
#define KEYPAD_8 ( 96 | 0xF000 )
#define KEYPAD_9 ( 97 | 0xF000 )
#define KEYPAD_0 ( 98 | 0xF000 )
#define KEYPAD_PERIOD ( 99 | 0xF000 )
#define KEY_NON_US_BS ( 100 | 0xF000 )
#define KEY_MENU ( 101 | 0xF000 )
#define KEY_F13 ( 104 | 0xF000 )
#define KEY_F14 ( 105 | 0xF000 )
#define KEY_F15 ( 106 | 0xF000 )
#define KEY_F16 ( 107 | 0xF000 )
#define KEY_F17 ( 108 | 0xF000 )
#define KEY_F18 ( 109 | 0xF000 )
#define KEY_F19 ( 110 | 0xF000 )
#define KEY_F20 ( 111 | 0xF000 )
#define KEY_F21 ( 112 | 0xF000 )
#define KEY_F22 ( 113 | 0xF000 )
#define KEY_F23 ( 114 | 0xF000 )
#define KEY_F24 ( 115 | 0xF000 )
// for compatibility with Leonardo's slightly different names
#define KEY_UP_ARROW KEY_UP
#define KEY_DOWN_ARROW KEY_DOWN
#define KEY_LEFT_ARROW KEY_LEFT
#define KEY_RIGHT_ARROW KEY_RIGHT
#define KEY_RETURN KEY_ENTER
#define KEY_LEFT_CTRL MODIFIERKEY_LEFT_CTRL
#define KEY_LEFT_SHIFT MODIFIERKEY_LEFT_SHIFT
#define KEY_LEFT_ALT MODIFIERKEY_LEFT_ALT
#define KEY_LEFT_GUI MODIFIERKEY_LEFT_GUI
#define KEY_RIGHT_CTRL MODIFIERKEY_RIGHT_CTRL
#define KEY_RIGHT_SHIFT MODIFIERKEY_RIGHT_SHIFT
#define KEY_RIGHT_ALT MODIFIERKEY_RIGHT_ALT
#define KEY_RIGHT_GUI MODIFIERKEY_RIGHT_GUI
#define KEYCODE_TYPE uint16_t
extern void update_keyboard_layout();
extern KEYCODE_TYPE keycodes_ascii[];
extern KEYCODE_TYPE keycodes_iso_8859_1[];
#ifdef __cplusplus
} // extern "C"
#endif
#endif