Fix direct GPIO scanner for split keyboards
https://github.com/KMKfw/kmk_firmware/issues/372
This commit is contained in:
parent
4b03ba846a
commit
89351fc203
@ -1,6 +1,7 @@
|
||||
import keypad
|
||||
|
||||
from kmk.scanners import DiodeOrientation, Scanner
|
||||
from kmk.matrix import DiodeOrientation, KeyEvent
|
||||
from kmk.scanners import Scanner
|
||||
|
||||
|
||||
class NativeKeypadScanner(Scanner):
|
||||
@ -14,6 +15,8 @@ class NativeKeypadScanner(Scanner):
|
||||
def __init__(self, pin_map, kp):
|
||||
self.pin_map = pin_map
|
||||
self.keypad = kp
|
||||
# for split keyboards, the offset value will be assigned in Split module
|
||||
self.offset = 0
|
||||
self.coord_mapping = list(range(len(pin_map)))
|
||||
|
||||
self.curr_event = keypad.Event()
|
||||
@ -27,7 +30,10 @@ class NativeKeypadScanner(Scanner):
|
||||
ev = self.curr_event
|
||||
has_event = self.keypad.events.get_into(ev)
|
||||
if has_event:
|
||||
return ev
|
||||
if self.offset:
|
||||
return KeyEvent(ev.key_number + self.offset, ev.pressed)
|
||||
else:
|
||||
return ev
|
||||
|
||||
|
||||
def keypad_matrix(row_pins, col_pins, direction=DiodeOrientation.COLUMNS):
|
||||
|
Loading…
x
Reference in New Issue
Block a user