More clear matrix scan function

This commit is contained in:
Josh Klar 2018-10-18 23:33:04 -07:00
parent 9089106316
commit 85ab403d22
No known key found for this signature in database
GPG Key ID: 220F99BD7DB7A99E
2 changed files with 8 additions and 2 deletions

View File

@ -94,7 +94,7 @@ class Firmware:
print("Firin' lazers. Keyboard is booted.")
while True:
for update in self.matrix.scan_for_pressed():
for update in self.matrix.scan_for_changes():
if update is not None:
self._state.matrix_changed(
update[0],

View File

@ -59,7 +59,13 @@ class MatrixScanner:
self.state = bytearray(self.len_state_arrays)
self.report = bytearray(3)
def scan_for_pressed(self):
def scan_for_changes(self):
'''
Poll the matrix for changes and return either None (if nothing updated)
or a bytearray (reused in later runs so copy this if you need the raw
array itself for some crazy reason) consisting of (row, col, pressed)
which are (int, int, bool)
'''
ba_idx = 0
any_changed = False