introduce consistent naming scheme

This commit is contained in:
xs5871 2022-04-10 12:46:40 +00:00 committed by Kyle Brown
parent e395e89864
commit 175f0c6a97
6 changed files with 12 additions and 12 deletions

View File

@ -39,7 +39,7 @@ import sys
from kmk.extensions.rgb import RGB, AnimationModes
from kmk.kmk_keyboard import KMKKeyboard
from kmk.scanners.native_keypad_scanner import keys_scanner
from kmk.scanners.keypad import KeysScanner
# fmt: off
@ -91,4 +91,4 @@ class Keybow(KMKKeyboard):
extensions = [rgb_ext]
def __init__(self):
self.matrix = keys_scanner(_KEY_CFG)
self.matrix = KeysScanner(_KEY_CFG)

View File

@ -24,7 +24,7 @@ key switches, then adds [BOOT] in (4,0). [RESET] can't be mapped as a key.
import board
from kmk.kmk_keyboard import KMKKeyboard
from kmk.scanners.native_keypad_scanner import keys_scanner
from kmk.scanners.keypad import KeysScanner
# fmt: off
_KEY_CFG = [
@ -43,4 +43,4 @@ class Keybow2040(KMKKeyboard):
'''
def __init__(self):
self.matrix = keys_scanner(_KEY_CFG)
self.matrix = KeysScanner(_KEY_CFG)

View File

@ -4,7 +4,7 @@ from kmk.consts import KMK_RELEASE, UnicodeMode
from kmk.hid import BLEHID, USBHID, AbstractHID, HIDModes
from kmk.keys import KC
from kmk.kmktime import ticks_add, ticks_diff
from kmk.scanners.native_keypad_scanner import keypad_matrix
from kmk.scanners.keypad import MatrixScanner
class Sandbox:
@ -304,7 +304,7 @@ class KMKKeyboard:
if self.matrix is None:
if self.debug_enabled:
print('Initialising default matrix scanner.')
self.matrix = keypad_matrix(
self.matrix = MatrixScanner(
col_pins=self.col_pins,
row_pins=self.row_pins,
direction=self.diode_orientation,

View File

@ -3,7 +3,7 @@ import keypad
from kmk.scanners import DiodeOrientation, Scanner
class NativeKeypadScanner(Scanner):
class KeypadScanner(Scanner):
'''
Translation layer around a CircuitPython 7 keypad scanner.
@ -39,7 +39,7 @@ class NativeKeypadScanner(Scanner):
return ev
def keypad_matrix(row_pins, col_pins, direction=DiodeOrientation.COLUMNS):
def MatrixScanner(row_pins, col_pins, direction=DiodeOrientation.COLUMNS):
'''
Row/Column matrix using the CircuitPython 7 keypad scanner.
@ -53,10 +53,10 @@ def keypad_matrix(row_pins, col_pins, direction=DiodeOrientation.COLUMNS):
kp = keypad.KeyMatrix(
row_pins, col_pins, columns_to_anodes=(direction == DiodeOrientation.COLUMNS)
)
return NativeKeypadScanner(pin_map, kp)
return KeypadScanner(pin_map, kp)
def keys_scanner(pins):
def KeysScanner(pins):
'''
GPIO-per-key 'matrix' using the native CircuitPython 7 keypad scanner.
@ -66,4 +66,4 @@ def keys_scanner(pins):
kp = keypad.Keys(
[pins[r][c] for (r, c) in pin_map], value_when_pressed=False, pull=True
)
return NativeKeypadScanner(pin_map, kp)
return KeypadScanner(pin_map, kp)

View File

@ -7,7 +7,7 @@ from kmk.hid import HIDModes
from kmk.keys import ModifierKey
from kmk.kmk_keyboard import KMKKeyboard
from kmk.scanners import DiodeOrientation
from kmk.scanners.digitalio_matrix import MatrixScanner
from kmk.scanners.digitalio import MatrixScanner
class DigitalInOut(Mock):