A basic 2x2 matrix that can auto-flash to a Feather with a compatible bootloader
This commit is contained in:
0
kmk/common/__init__.py
Normal file
0
kmk/common/__init__.py
Normal file
9
kmk/common/consts.py
Normal file
9
kmk/common/consts.py
Normal file
@@ -0,0 +1,9 @@
|
||||
class DiodeOrientation:
|
||||
'''
|
||||
Orientation of diodes on handwired boards. You can think of:
|
||||
COLUMNS = vertical
|
||||
ROWS = horizontal
|
||||
'''
|
||||
|
||||
COLUMNS = 0
|
||||
ROWS = 1
|
18
kmk/common/keymap.py
Normal file
18
kmk/common/keymap.py
Normal file
@@ -0,0 +1,18 @@
|
||||
class Keymap:
|
||||
def __init__(self, map):
|
||||
self.map = map
|
||||
self.state = [
|
||||
[False for _ in row]
|
||||
for row in self.map
|
||||
]
|
||||
|
||||
def parse(self, matrix):
|
||||
for ridx, row in enumerate(matrix):
|
||||
for cidx, col in enumerate(row):
|
||||
if col != self.state[ridx][cidx]:
|
||||
print('{}: {}'.format(
|
||||
'KEYDOWN' if col else 'KEYUP',
|
||||
self.map[ridx][cidx],
|
||||
))
|
||||
|
||||
self.state = matrix
|
Reference in New Issue
Block a user