diff --git a/matrix.py b/matrix.py new file mode 100644 index 0000000..85e246e --- /dev/null +++ b/matrix.py @@ -0,0 +1,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