More clear matrix scan function
This commit is contained in:
parent
9089106316
commit
85ab403d22
@ -94,7 +94,7 @@ class Firmware:
|
|||||||
print("Firin' lazers. Keyboard is booted.")
|
print("Firin' lazers. Keyboard is booted.")
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
for update in self.matrix.scan_for_pressed():
|
for update in self.matrix.scan_for_changes():
|
||||||
if update is not None:
|
if update is not None:
|
||||||
self._state.matrix_changed(
|
self._state.matrix_changed(
|
||||||
update[0],
|
update[0],
|
||||||
|
@ -59,7 +59,13 @@ class MatrixScanner:
|
|||||||
self.state = bytearray(self.len_state_arrays)
|
self.state = bytearray(self.len_state_arrays)
|
||||||
self.report = bytearray(3)
|
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
|
ba_idx = 0
|
||||||
any_changed = False
|
any_changed = False
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user