A basic 2x2 matrix that can auto-flash to a Feather with a compatible bootloader

This commit is contained in:
Josh Klar
2018-09-02 20:06:53 -07:00
parent 6de723c376
commit e9d448af44
17 changed files with 303 additions and 0 deletions

0
kmk/common/__init__.py Normal file
View File

9
kmk/common/consts.py Normal file
View 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
View 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