forked from vekkt0r/novatools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
matrix.py
112 lines (108 loc) · 1.84 KB
/
matrix.py
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
#
# Quick hack to print out org mode table of the keyboard matrix
#
key_indexes = {
'esc': 0x21,
'f1': 0x20,
'f2': 0x24,
'f3': 0x25,
'f4': 0x23,
'f5': 0x22,
'f6': 0x52,
'f7': 0x4a,
'f8': 0x42,
'f9': 0x5a,
'f10': 0x6a,
'f11': 0x7a,
'f12': 0x72,
'printscr': 0x62,
'scroll': 0x77,
'pause': 0x76,
'tilde': 0x10,
'1': 0x08,
'2': 0x00,
'3': 0x18,
'4': 0x28,
'5': 0x38,
'6': 0x30,
'7': 0x50,
'8': 0x48,
'9': 0x40,
'0': 0x58,
'-': 0x68,
'=': 0x78,
'bkspc': 0x70,
'ins': 0x60,
'home': 0x67,
'pgup': 0x66,
'tab': 0x15,
'q': 0xd,
'w': 0x5,
'e': 0x1d,
'r': 0x2d,
't': 0x3d,
'y': 0x35,
'u': 0x55,
'i': 0x4d,
'o': 0x45,
'p': 0x5d,
'[': 0x6d,
']': 0x7d,
'\\': 0x75,
'del': 0x65,
'end': 0x7f,
'pgup': 0x7e,
'caps': 0x14,
'a': 0xc,
's': 0x4,
'd': 0x1c,
'f': 0x2c,
'g': 0x3c,
'h': 0x34,
'j': 0x54,
'k': 0x4c,
'l': 0x44,
';': 0x5c,
'\'': 0x6c,
'ret': 0x7c,
'shift_l': 0x13,
'z': 0x3,
'x': 0x1b,
'c': 0x2b,
'v': 0x3b,
'b': 0x33,
'n': 0x53,
'm': 0x4b,
',': 0x43,
'.': 0x5b,
'/': 0x6b,
'shift_r': 0x7b,
'up': 0x6e,
'ctrl_l': 0x11,
'super_l': 0x9,
'alt_l': 0x1,
'spc': 0x31,
'alt_r': 0x59,
'super_r': 0x69,
'fn': 0x79,
'ctrl_r': 0x71,
'left': 0x61,
'down': 0x6f,
'right': 0x73,
}
matrix = {}
for key,code in key_indexes.iteritems():
matrix[code] = key
print '|\t',
for col in range(0,16):
print '| %d\t' % col,
print '\n|-'
for row in range(0,8):
print '|%d\t' % row,
for col in range(0,16):
idx = row + (col << 3)
if idx in matrix:
print '| %s\t' % matrix[idx],
else:
print '| \t',
print