1
1
#include <avr/pgmspace.h>
2
2
// Lookup table to convert ascii characters in to keyboard scan codes
3
3
// Format: most signifficant bit indicates if scan code should be sent with shift modifier
4
- // remaining 7 bits are to be used as scan code number.
4
+ // next most significant bit is used for AltGr modifier
5
+ // remaining 6 bits are to be used as scan code number.
6
+ // scan codes correspond to the key position as if it were an US 104 keyboard
7
+
5
8
#define Shift 0x80
6
9
#define AltGr 0x40
10
+
7
11
const unsigned char ascii_to_scan_code_table [] PROGMEM = {
8
12
// ASCII Code HID Usage Key pos on a US Keyboard
9
13
// /* ASCII: 0 */ 0,
@@ -14,9 +18,9 @@ const unsigned char ascii_to_scan_code_table[] PROGMEM = {
14
18
// /* ASCII: 5 */ 0,
15
19
// /* ASCII: 6 */ 0,
16
20
// /* ASCII: 7 */ 0,
17
- /* ASCII: 8 BS */ 0x2a , // BS 42, // backspace
18
- /* ASCII: 9 TAB */ 0x2b , // HT 43, // HT '\t' (horizontal tab)
19
- /* ASCII: 10 LF */ 0x28 , // LF 0,
21
+ /* ASCII: 8 BS */ 0x2a , // BS
22
+ /* ASCII: 9 TAB */ 0x2b , // HT
23
+ /* ASCII: 10 LF */ 0x28 , // LF
20
24
/* ASCII: 11 */ 0 ,
21
25
/* ASCII: 12 */ 0 ,
22
26
/* ASCII: 13 */ 0 ,
@@ -33,7 +37,7 @@ const unsigned char ascii_to_scan_code_table[] PROGMEM = {
33
37
/* ASCII: 24 */ 0 ,
34
38
/* ASCII: 25 */ 0 ,
35
39
/* ASCII: 26 */ 0 ,
36
- /* ASCII: 27 ESC */ 0x29 , // ESC 41,
40
+ /* ASCII: 27 ESC */ 0x29 , // ESC
37
41
/* ASCII: 28 */ 0 ,
38
42
/* ASCII: 29 */ 0 ,
39
43
/* ASCII: 30 */ 0 ,
0 commit comments