implement support for multiple scanners at once

fixup
This commit is contained in:
xs5871
2022-04-16 20:04:42 +00:00
committed by Kyle Brown
parent c7490087b6
commit 7ff77b97bb
5 changed files with 31 additions and 17 deletions

View File

@@ -22,7 +22,12 @@ class Scanner:
Base class for scanners.
'''
coord_mapping = None
# for split keyboards, the offset value will be assigned in Split module
offset = 0
@property
def coord_mapping(self):
return tuple(range(self.offset, self.offset + self.key_count))
@property
def key_count(self):
@@ -34,4 +39,4 @@ class Scanner:
The key report is a byte array with contents [row, col, True if pressed else False]
'''
pass
raise NotImplementedError

View File

@@ -78,7 +78,6 @@ class MatrixScanner(Scanner):
self.rollover_cols_every_rows = self.len_rows
self._key_count = self.len_cols * self.len_rows
self.coord_mapping = tuple(range(self.key_count))
self.state = bytearray(self.key_count)
@property

View File

@@ -12,9 +12,6 @@ class KeypadScanner(Scanner):
'''
def __init__(self):
# for split keyboards, the offset value will be assigned in Split module
self.offset = 0
self.coord_mapping = tuple(range(self.key_count))
self.curr_event = keypad.Event()
@property