Skip to content

Commit

Permalink
Lint II
Browse files Browse the repository at this point in the history
  • Loading branch information
regicidalplutophage authored Nov 7, 2024
1 parent 192bd40 commit e1d1b61
Showing 1 changed file with 28 additions and 28 deletions.
56 changes: 28 additions & 28 deletions kmk/scanners/keypad.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,37 @@


class KeypadScanner(Scanner):
'''
"""
Translation layer around a CircuitPython 7 keypad scanner.
:param pin_map: A sequence of (row, column) tuples for each key.
:param kp: An instance of the keypad class.
'''
"""

@property
def key_count(self):
return self.keypad.key_count

def scan_for_changes(self):
'''
"""
Scan for key events and return a key report if an event exists.
The key report is a byte array with contents [row, col, True if pressed else False]
'''
"""
ev = self.keypad.events.get()
if ev and self.offset:
return keypad.Event(ev.key_number + self.offset, ev.pressed)
return ev


class MatrixScanner(KeypadScanner):
'''
"""
Row/Column matrix using the CircuitPython 7 keypad scanner.
:param row_pins: A sequence of pins used for rows.
:param col_pins: A sequence of pins used for columns.
:param direction: The diode orientation of the matrix.
'''
"""

def __init__(
self,
Expand All @@ -49,16 +49,16 @@ def __init__(
args = [
row_pins,
column_pins,
]
]
for i in args:
if i is None:
args.pop(i)
kwargs = {
'columns_to_anodes': columns_to_anodes,
'interval': interval,
'debounce_threshold': debounce_threshold,
'max_events': max_events,
}
"columns_to_anodes": columns_to_anodes,
"interval": interval,
"debounce_threshold": debounce_threshold,
"max_events": max_events,
}
for key, value in kwargs.items():
if value is None:
kwargs.pop(key)
Expand All @@ -67,11 +67,11 @@ def __init__(


class KeysScanner(KeypadScanner):
'''
"""
GPIO-per-key 'matrix' using the native CircuitPython 7 keypad scanner.
:param pins: An array of arrays of CircuitPython Pin objects, such that pins[r][c] is the pin for row r, column c.
'''
"""

def __init__(
self,
Expand All @@ -85,17 +85,17 @@ def __init__(
):
args = [
pins,
]
]
for i in args:
if i is None:
args.pop(i)
kwargs = {
'value_when_pressed': value_when_pressed,
'pull': pull,
'interval': interval,
'debounce_threshold': debounce_threshold,
'max_events': max_events,
}
"value_when_pressed": value_when_pressed,
"pull": pull,
"interval": interval,
"debounce_threshold": debounce_threshold,
"max_events": max_events,
}
for key, value in kwargs.items():
if value is None:
kwargs.pop(key)
Expand All @@ -122,17 +122,17 @@ def __init__(
data,
latch,
key_count,
]
]
for i in args:
if i is None:
args.pop(i)
kwargs = {
'value_to_latch': value_to_latch,
'value_when_pressed': value_when_pressed,
'interval': interval,
'debounce_threshold': debounce_threshold,
'max_events': max_events,
}
"value_to_latch": value_to_latch,
"value_when_pressed": value_when_pressed,
"interval": interval,
"debounce_threshold": debounce_threshold,
"max_events": max_events,
}
for key, value in kwargs.items():
if value is None:
kwargs.pop(key)
Expand Down

0 comments on commit e1d1b61

Please sign in to comment.