EFR32 Blue Gecko 12 Software Documentation  efr32bg12-doc-5.1.2
usbkbdscancodes.c
Go to the documentation of this file.
1 /**************************************************************************/
17 #include <stdint.h>
18 #include "usbkbdscancodes.h"
19 
20 static const uint8_t Scancode2Ascii[];
21 
22 /***************************************************************************/
32 char USB_HidScancodeToAscii(uint8_t scancode)
33 {
34  return Scancode2Ascii[ scancode ];
35 }
36 
37 /**************************************************************************/
43 static const uint8_t Scancode2Ascii[ 256 ] =
44 {
45  /* Dec Hex Usage */
46  /* --------------------------------------- */
47  0, /* 0 00 Reserved (no event indicated) */
48  0, /* 1 01 Keyboard ErrorRollOver */
49  0, /* 2 02 Keyboard POSTFail */
50  0, /* 3 03 Keyboard ErrorUndefined */
51  'a', /* 4 04 Keyboard a and A */
52  'b', /* 5 05 Keyboard b and B */
53  'c', /* 6 06 Keyboard c and C */
54  'd', /* 7 07 Keyboard d and D */
55  'e', /* 8 08 Keyboard e and E */
56  'f', /* 9 09 Keyboard f and F */
57  'g', /* 10 0A Keyboard g and G */
58  'h', /* 11 0B Keyboard h and H */
59  'i', /* 12 0C Keyboard i and I */
60  'j', /* 13 0D Keyboard j and J */
61  'k', /* 14 0E Keyboard k and K */
62  'l', /* 15 0F Keyboard l and L */
63  'm', /* 16 10 Keyboard m and M */
64  'n', /* 17 11 Keyboard n and N */
65  'o', /* 18 12 Keyboard o and O */
66  'p', /* 19 13 Keyboard p and P */
67  'q', /* 20 14 Keyboard q and Q */
68  'r', /* 21 15 Keyboard r and R */
69  's', /* 22 16 Keyboard s and S */
70  't', /* 23 17 Keyboard t and T */
71  'u', /* 24 18 Keyboard u and U */
72  'v', /* 25 19 Keyboard v and V */
73  'w', /* 26 1A Keyboard w and W */
74  'x', /* 27 1B Keyboard x and X */
75  'y', /* 28 1C Keyboard y and Y */
76  'z', /* 29 1D Keyboard z and Z */
77  '1', /* 30 1E Keyboard 1 and ! */
78  '2', /* 31 1F Keyboard 2 and @ */
79  '3', /* 32 20 Keyboard 3 and # */
80  '4', /* 33 21 Keyboard 4 and $ */
81  '5', /* 34 22 Keyboard 5 and % */
82  '6', /* 35 23 Keyboard 6 and ^ */
83  '7', /* 36 24 Keyboard 7 and & */
84  '8', /* 37 25 Keyboard 8 and * */
85  '9', /* 38 26 Keyboard 9 and ( */
86  '0', /* 39 27 Keyboard 0 and ) */
87  '\r', /* 40 28 Keyboard Return(ENTER) */
88  0, /* 41 29 Keyboard ESCAPE */
89  0, /* 42 2A Keyboard DELETE(Backspace) */
90  0, /* 43 2B Keyboard Tab */
91  ' ', /* 44 2C Keyboard Spacebar */
92  '-', /* 45 2D Keyboard - and (underscore) */
93  '=', /* 46 2E Keyboard = and + */
94  '[', /* 47 2F Keyboard [ and { */
95  ']', /* 48 30 Keyboard ] and } */
96  '\\', /* 49 31 Keyboard \ and | */
97  '#', /* 50 32 Keyboard Non-US# and ~ */
98  ';', /* 51 33 Keyboard ; and : */
99  0, /* 52 34 Keyboard "english writing left single and double quotation mark" */
100  '`', /* 53 35 Keyboard Grave Accent ` and Tilde ~ */
101  ',', /* 54 36 Keyboard , and < */
102  '.', /* 55 37 Keyboard . and > */
103  '/', /* 56 38 Keyboard / and ? */
104  0, /* 57 39 Keyboard CapsLock */
105  0, /* 58 3A Keyboard F1 */
106  0, /* 59 3B Keyboard F2 */
107  0, /* 60 3C Keyboard F3 */
108  0, /* 61 3D Keyboard F4 */
109  0, /* 62 3E Keyboard F5 */
110  0, /* 63 3F Keyboard F6 */
111  0, /* 64 40 Keyboard F7 */
112  0, /* 65 41 Keyboard F8 */
113  0, /* 66 42 Keyboard F9 */
114  0, /* 67 43 Keyboard F10 */
115  0, /* 68 44 Keyboard F11 */
116  0, /* 69 45 Keyboard F12 */
117  0, /* 70 46 Keyboard PrintScreen */
118  0, /* 71 47 Keyboard ScrollLock */
119  0, /* 72 48 Keyboard Pause */
120  0, /* 73 49 Keyboard Insert */
121  0, /* 74 4A Keyboard Home */
122  0, /* 75 4B Keyboard PageUp */
123  0, /* 76 4C Keyboard Delete Forward */
124  0, /* 77 4D Keyboard End */
125  0, /* 78 4E Keyboard PageDown */
126  0, /* 79 4F Keyboard RightArrow */
127  0, /* 80 50 Keyboard LeftArrow */
128  0, /* 81 51 Keyboard DownArrow */
129  0, /* 82 52 Keyboard UpArrow */
130  0, /* 83 53 Keypad NumLock and Clear */
131  '/', /* 84 54 Keypad / */
132  '*', /* 85 55 Keypad * */
133  '-', /* 86 56 Keypad - */
134  '+', /* 87 57 Keypad + */
135  '\r', /* 88 58 Keypad ENTER */
136  '1', /* 89 59 Keypad 1 and End */
137  '2', /* 90 5A Keypad 2 and Down Arrow */
138  '3', /* 91 5B Keypad 3 and PageDn */
139  '4', /* 92 5C Keypad 4 and Left Arrow */
140  '5', /* 93 5D Keypad 5 */
141  '6', /* 94 5E Keypad 6 and Right Arrow */
142  '7', /* 95 5F Keypad 7 and Home */
143  '8', /* 96 60 Keypad 8 and Up Arrow */
144  '9', /* 97 61 Keypad 9 and PageUp */
145  '0', /* 98 62 Keypad 0 and Insert */
146  '.', /* 99 63 Keypad . and Delete */
147  '\\', /* 100 64 Keyboard Non-US\ and | */
148  0, /* 101 65 Keyboard Application */
149  0, /* 102 66 Keyboard Power */
150  '=', /* 103 67 Keypad = */
151  0, /* 104 68 Keyboard F13 */
152  0, /* 105 69 Keyboard F14 */
153  0, /* 106 6A Keyboard F15 */
154  0, /* 107 6B Keyboard F16 */
155  0, /* 108 6C Keyboard F17 */
156  0, /* 109 6D Keyboard F18 */
157  0, /* 110 6E Keyboard F19 */
158  0, /* 111 6F Keyboard F20 */
159  0, /* 112 70 Keyboard F21 */
160  0, /* 113 71 Keyboard F22 */
161  0, /* 114 72 Keyboard F23 */
162  0, /* 115 73 Keyboard F24 */
163  0, /* 116 74 Keyboard Execute */
164  0, /* 117 75 Keyboard Help */
165  0, /* 118 76 Keyboard Menu */
166  0, /* 119 77 Keyboard Select */
167  0, /* 120 78 Keyboard Stop */
168  0, /* 121 79 Keyboard Again */
169  0, /* 122 7A Keyboard Undo */
170  0, /* 123 7B Keyboard Cut */
171  0, /* 124 7C Keyboard Copy */
172  0, /* 125 7D Keyboard Paste */
173  0, /* 126 7E Keyboard Find */
174  0, /* 127 7F Keyboard Mute */
175  0, /* 128 80 Keyboard Volume Up */
176  0, /* 129 81 Keyboard Volume Down */
177  0, /* 130 82 Keyboard Locking Caps Lock */
178  0, /* 131 83 Keyboard Locking Num Lock */
179  0, /* 132 84 Keyboard Locking Scroll Lock */
180  ',', /* 133 85 Keypad Comma */
181  '=', /* 134 86 Keypad Equal Sign */
182  0, /* 135 87 Keyboard International 1 */
183  0, /* 136 88 Keyboard International 2 */
184  0, /* 137 89 Keyboard International 3 */
185  0, /* 138 8A Keyboard International 4 */
186  0, /* 139 8B Keyboard International 5 */
187  0, /* 140 8C Keyboard International 6 */
188  0, /* 141 8D Keyboard International 7 */
189  0, /* 142 8E Keyboard International 8 */
190  0, /* 143 8F Keyboard International 9 */
191  0, /* 144 90 Keyboard LANG1 */
192  0, /* 145 91 Keyboard LANG2 */
193  0, /* 146 92 Keyboard LANG3 */
194  0, /* 147 93 Keyboard LANG4 */
195  0, /* 148 94 Keyboard LANG5 */
196  0, /* 149 95 Keyboard LANG6 */
197  0, /* 150 96 Keyboard LANG7 */
198  0, /* 151 97 Keyboard LANG8 */
199  0, /* 152 98 Keyboard LANG9 */
200  0, /* 153 99 Keyboard AlternateErase */
201  0, /* 154 9A Keyboard SysReq/Attention */
202  0, /* 155 9B Keyboard Cancel */
203  0, /* 156 9C Keyboard Clear */
204  0, /* 157 9D Keyboard Prior */
205  '\r', /* 158 9E Keyboard Return */
206  0, /* 159 9F Keyboard Separator */
207  0, /* 160 A0 Keyboard Out */
208  0, /* 161 A1 Keyboard Oper */
209  0, /* 162 A2 Keyboard Clear/Again */
210  0, /* 163 A3 Keyboard CrSel/Props */
211  0, /* 164 A4 Keyboard ExSel */
212  0, /* 165-175 A5-AF Reserved */
213  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
214  0, /* 176 B0 Keypad 00 */
215  0, /* 177 B1 Keypad 000 */
216  ',', /* 178 B2 Thousands Separator */
217  '.', /* 179 B3 Decimal Separator */
218  0, /* 180 B4 Currency Unit */
219  0, /* 181 B5 Currency Sub-unit */
220  '(', /* 182 B6 Keypad ( */
221  ')', /* 183 B7 Keypad ) */
222  '{', /* 184 B8 Keypad { */
223  '}', /* 185 B9 Keypad } */
224  0, /* 186 BA Keypad Tab */
225  0, /* 187 BB Keypad Backspace */
226  'A', /* 188 BC Keypad A */
227  'B', /* 189 BD Keypad B */
228  'C', /* 190 BE Keypad C */
229  'D', /* 191 BF Keypad D */
230  'E', /* 192 C0 Keypad E */
231  'F', /* 193 C1 Keypad F */
232  '^', /* 194 C2 Keypad XOR */
233  '^', /* 195 C3 Keypad ^ */
234  '%', /* 196 C4 Keypad % */
235  '<', /* 197 C5 Keypad < */
236  '>', /* 198 C6 Keypad > */
237  '&', /* 199 C7 Keypad & */
238  0, /* 200 C8 Keypad && */
239  '|', /* 201 C9 Keypad | */
240  0, /* 202 CA Keypad || */
241  ':', /* 203 CB Keypad : */
242  '#', /* 204 CC Keypad # */
243  ' ', /* 205 CD Keypad Space */
244  '@', /* 206 CE Keypad @ */
245  '!', /* 207 CF Keypad ! */
246  0, /* 208 D0 Keypad Memory Store */
247  0, /* 209 D1 Keypad Memory Recall */
248  0, /* 210 D2 Keypad Memory Clear */
249  0, /* 211 D3 Keypad Memory Add */
250  0, /* 212 D4 Keypad Memory Subtract */
251  0, /* 213 D5 Keypad Memory Multiply */
252  0, /* 214 D6 Keypad Memory Divide */
253  0, /* 215 D7 Keypad +/- */
254  0, /* 216 D8 Keypad Clear */
255  0, /* 217 D9 Keypad Clear Entry */
256  0, /* 218 DA Keypad Binary */
257  0, /* 219 DB Keypad Octal */
258  0, /* 220 DC Keypad Decimal */
259  0, /* 221 DD Keypad Hexadecimal */
260  0, 0, /* 222-223 DE-DF Reserved */
261  0, /* 224 E0 Keyboard LeftControl */
262  0, /* 225 E1 Keyboard LeftShift */
263  0, /* 226 E2 Keyboard LeftAlt */
264  0, /* 227 E3 Keyboard Left GUI */
265  0, /* 228 E4 Keyboard RightControl */
266  0, /* 229 E5 Keyboard RightShift */
267  0, /* 230 E6 Keyboard RightAlt */
268  0, /* 231 E7 Keyboard Right GUI */
269  0, /* 232-255 E8-FF Reserved */
270  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
271 };
char USB_HidScancodeToAscii(uint8_t scancode)
Converts the keyboard scancode to ASCII.
USB HID keyboard scancodes.
static const uint8_t Scancode2Ascii[]
Table of keyboard scancode to ASCII mappings. Refer to the "HID Usage Tables" standard document from ...