Custom matrix scanners

- Introduce Scanner base class for MatrixScanner
- Create new Scanner using built-in keypad module
- Allow overriding the scanner used by KMKKeyboard
This commit is contained in:
Ellie
2021-10-04 01:40:18 +11:00
committed by Kyle Brown
parent e7d306cf30
commit 57ba0fe8b2
5 changed files with 153 additions and 7 deletions

View File

@@ -290,12 +290,18 @@ class KMKKeyboard:
self._hid_send_enabled = True
def _init_matrix(self):
self.matrix = self.matrix_scanner(
cols=self.col_pins,
rows=self.row_pins,
diode_orientation=self.diode_orientation,
rollover_cols_every_rows=getattr(self, 'rollover_cols_every_rows', None),
)
if self.matrix is None:
print('Initialising matrix scanner from self.matrix_scanner')
self.matrix = self.matrix_scanner(
cols=self.col_pins,
rows=self.row_pins,
diode_orientation=self.diode_orientation,
rollover_cols_every_rows=getattr(
self, 'rollover_cols_every_rows', None
),
)
else:
print('Matrix scanner already set, not overwriting.')
return self