Rename KeyboardConfig to KMKKeyboard - prepping for later merge with InternalState
This commit is contained in:
parent
b03ae32e7d
commit
666c0a4f08
@ -1,7 +1,7 @@
|
||||
# Configuring KMK
|
||||
|
||||
KMK is configured through a rather large plain-old-Python class called
|
||||
`KeyboardConfig`. Subclasses of this configuration exist which pre-fill defaults
|
||||
`KMKKeyboard`. Subclasses of this configuration exist which pre-fill defaults
|
||||
for various known keyboards (for example, many Keebio keyboards are supported
|
||||
through our ItsyBitsy to ProMicro pinout adapter). This class is the main
|
||||
interface between end users and the inner workings of KMK. Let's dive in!
|
||||
@ -17,13 +17,13 @@ interface between end users and the inner workings of KMK. Let's dive in!
|
||||
corruption bugs, or you might just have bad luck and delete the wrong file
|
||||
some day.
|
||||
|
||||
- Import the `KeyboardConfig` object for your keyboard from `kmk.boards` (or, if
|
||||
handwiring your keyboard, import `KeyboardConfig` from `kmk.keyboard_config`).
|
||||
- Import the `KMKKeyboard` object for your keyboard from `kmk.boards` (or, if
|
||||
handwiring your keyboard, import `KMKKeyboard` from `kmk.kmk_keyboard`).
|
||||
|
||||
- Assign a `KeyboardConfig` instance to a variable (ex. `keyboard = KeyboardConfig()` - note
|
||||
- Assign a `KMKKeyboard` instance to a variable (ex. `keyboard = KMKKeyboard()` - note
|
||||
the parentheses)
|
||||
|
||||
- Make sure this `KeyboardConfig` instance is actually run at the end of the file with
|
||||
- Make sure this `KMKKeyboard` instance is actually run at the end of the file with
|
||||
a block such as the following:
|
||||
|
||||
```python
|
||||
|
@ -40,11 +40,11 @@ Here's an example of all this in action:
|
||||
|
||||
```python
|
||||
# user_keymaps/some_silly_example.py
|
||||
from kmk.boards.klarank import KeyboardConfig
|
||||
from kmk.boards.klarank import KMKKeyboard
|
||||
from kmk.keycodes import KC
|
||||
from kmk.macros.simple import send_string
|
||||
|
||||
keyboard = KeyboardConfig()
|
||||
keyboard = KMKKeyboard()
|
||||
|
||||
keyboard.tap_time = 750
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
import board
|
||||
|
||||
from kmk.keyboard_config import KeyboardConfig as _KeyboardConfig
|
||||
from kmk.kmk_keyboard import KMKKeyboard as _KMKKeyboard
|
||||
from kmk.matrix import DiodeOrientation
|
||||
|
||||
|
||||
class KeyboardConfig(_KeyboardConfig):
|
||||
class KMKKeyboard(_KMKKeyboard):
|
||||
col_pins = (board.D9, board.D10, board.D11, board.D12, board.D13, board.SCL)
|
||||
row_pins = (board.A3, board.A4, board.A5, board.SCK, board.MOSI)
|
||||
diode_orientation = DiodeOrientation.COLUMNS
|
||||
|
@ -1,10 +1,10 @@
|
||||
import board
|
||||
|
||||
from kmk.keyboard_config import KeyboardConfig as _KeyboardConfig
|
||||
from kmk.kmk_keyboard import KMKKeyboard as _KMKKeyboard
|
||||
from kmk.matrix import DiodeOrientation
|
||||
|
||||
|
||||
class KeyboardConfig(_KeyboardConfig):
|
||||
class KMKKeyboard(_KMKKeyboard):
|
||||
col_pins = (
|
||||
board.A0,
|
||||
board.A1,
|
||||
|
@ -1,10 +1,10 @@
|
||||
import board
|
||||
|
||||
from kmk.keyboard_config import KeyboardConfig as _KeyboardConfig
|
||||
from kmk.kmk_keyboard import KMKKeyboard as _KMKKeyboard
|
||||
from kmk.matrix import DiodeOrientation
|
||||
|
||||
|
||||
class KeyboardConfig(_KeyboardConfig):
|
||||
class KMKKeyboard(_KMKKeyboard):
|
||||
col_pins = (
|
||||
board.RX,
|
||||
board.D13,
|
||||
|
@ -1,10 +1,10 @@
|
||||
import board
|
||||
|
||||
from kmk.keyboard_config import KeyboardConfig as _KeyboardConfig
|
||||
from kmk.kmk_keyboard import KMKKeyboard as _KMKKeyboard
|
||||
from kmk.matrix import DiodeOrientation
|
||||
|
||||
|
||||
class KeyboardConfig(_KeyboardConfig):
|
||||
class KMKKeyboard(_KMKKeyboard):
|
||||
col_pins = (board.A1, board.A2, board.A3, board.A4, board.A5, board.SCK, board.MOSI)
|
||||
row_pins = (board.A0, board.D11, board.D10, board.D9)
|
||||
diode_orientation = DiodeOrientation.COLUMNS
|
||||
|
@ -1,10 +1,10 @@
|
||||
import board
|
||||
|
||||
from kmk.keyboard_config import KeyboardConfig as _KeyboardConfig
|
||||
from kmk.kmk_keyboard import KMKKeyboard as _KMKKeyboard
|
||||
from kmk.matrix import DiodeOrientation
|
||||
|
||||
|
||||
class KeyboardConfig(_KeyboardConfig):
|
||||
class KMKKeyboard(_KMKKeyboard):
|
||||
col_pins = (board.A2, board.A3, board.A4, board.A5, board.SCK, board.MOSI)
|
||||
row_pins = (board.D11, board.D10, board.D9, board.D7, board.D13)
|
||||
diode_orientation = DiodeOrientation.COLUMNS
|
||||
|
@ -1,11 +1,11 @@
|
||||
import board
|
||||
|
||||
from kmk.keyboard_config import KeyboardConfig as _KeyboardConfig
|
||||
from kmk.kmk_keyboard import KMKKeyboard as _KMKKeyboard
|
||||
from kmk.matrix import DiodeOrientation
|
||||
from kmk.matrix import intify_coordinate as ic
|
||||
|
||||
|
||||
class KeyboardConfig(_KeyboardConfig):
|
||||
class KMKKeyboard(_KMKKeyboard):
|
||||
# Pin mappings for converter board found at hardware/README.md
|
||||
# QMK: MATRIX_COL_PINS { F6, F7, B1, B3, B2, B6 }
|
||||
# QMK: MATRIX_ROW_PINS { D7, E6, B4, D2, D4 }
|
||||
|
@ -1,10 +1,10 @@
|
||||
import board
|
||||
|
||||
from kmk.keyboard_config import KeyboardConfig as _KeyboardConfig
|
||||
from kmk.kmk_keyboard import KMKKeyboard as _KMKKeyboard
|
||||
from kmk.matrix import DiodeOrientation
|
||||
|
||||
|
||||
class KeyboardConfig(_KeyboardConfig):
|
||||
class KMKKeyboard(_KMKKeyboard):
|
||||
col_pins = (
|
||||
board.SDA,
|
||||
board.A2,
|
||||
|
@ -1,10 +1,10 @@
|
||||
import board
|
||||
|
||||
from kmk.keyboard_config import KeyboardConfig as _KeyboardConfig
|
||||
from kmk.kmk_keyboard import KMKKeyboard as _KMKKeyboard
|
||||
from kmk.matrix import DiodeOrientation
|
||||
|
||||
|
||||
class KeyboardConfig(_KeyboardConfig):
|
||||
class KMKKeyboard(_KMKKeyboard):
|
||||
col_pins = (board.A2, board.A3, board.A4, board.A5, board.SCK, board.A0)
|
||||
row_pins = (board.D11, board.D10, board.D9, board.D7)
|
||||
diode_orientation = DiodeOrientation.COLUMNS
|
||||
|
@ -1,10 +1,10 @@
|
||||
import board
|
||||
|
||||
from kmk.keyboard_config import KeyboardConfig as _KeyboardConfig
|
||||
from kmk.kmk_keyboard import KMKKeyboard as _KMKKeyboard
|
||||
from kmk.matrix import DiodeOrientation
|
||||
|
||||
|
||||
class KeyboardConfig(_KeyboardConfig):
|
||||
class KMKKeyboard(_KMKKeyboard):
|
||||
col_pins = (board.A2, board.A3, board.A4, board.A5, board.SCK, board.MOSI)
|
||||
row_pins = (board.D13, board.D11, board.D10, board.D9)
|
||||
diode_orientation = DiodeOrientation.COLUMNS
|
||||
|
@ -1,10 +1,10 @@
|
||||
import board
|
||||
|
||||
from kmk.keyboard_config import KeyboardConfig as _KeyboardConfig
|
||||
from kmk.kmk_keyboard import KMKKeyboard as _KMKKeyboard
|
||||
from kmk.matrix import DiodeOrientation
|
||||
|
||||
|
||||
class KeyboardConfig(_KeyboardConfig):
|
||||
class KMKKeyboard(_KMKKeyboard):
|
||||
col_pins = (board.A2, board.A3, board.A4, board.A5, board.SCK, board.MOSI)
|
||||
row_pins = (board.D13, board.D11, board.D10, board.D9, board.D7)
|
||||
diode_orientation = DiodeOrientation.COLUMNS
|
||||
|
@ -1,10 +1,10 @@
|
||||
import board
|
||||
|
||||
from kmk.keyboard_config import KeyboardConfig as _KeyboardConfig
|
||||
from kmk.kmk_keyboard import KMKKeyboard as _KMKKeyboard
|
||||
from kmk.matrix import DiodeOrientation
|
||||
|
||||
|
||||
class KeyboardConfig(_KeyboardConfig):
|
||||
class KMKKeyboard(_KMKKeyboard):
|
||||
col_pins = (board.RX, board.A1, board.A2, board.A3, board.A4, board.A5)
|
||||
row_pins = (board.D13, board.D11, board.D10, board.D9, board.D7)
|
||||
diode_orientation = DiodeOrientation.COLUMNS
|
||||
|
@ -1,10 +1,10 @@
|
||||
import board
|
||||
|
||||
from kmk.keyboard_config import KeyboardConfig as _KeyboardConfig
|
||||
from kmk.kmk_keyboard import KMKKeyboard as _KMKKeyboard
|
||||
from kmk.matrix import DiodeOrientation
|
||||
|
||||
|
||||
class KeyboardConfig(_KeyboardConfig):
|
||||
class KMKKeyboard(_KMKKeyboard):
|
||||
# Will need additional work and testing
|
||||
col_pins = (
|
||||
board.A1,
|
||||
|
@ -1,10 +1,10 @@
|
||||
import board
|
||||
|
||||
from kmk.keyboard_config import KeyboardConfig as _KeyboardConfig
|
||||
from kmk.kmk_keyboard import KMKKeyboard as _KMKKeyboard
|
||||
from kmk.matrix import DiodeOrientation
|
||||
|
||||
|
||||
class KeyboardConfig(_KeyboardConfig):
|
||||
class KMKKeyboard(_KMKKeyboard):
|
||||
col_pins = (board.A2, board.A3, board.A4, board.A5, board.SCK, board.MOSI)
|
||||
row_pins = (board.D11, board.D10, board.D9, board.RX, board.D13)
|
||||
diode_orientation = DiodeOrientation.COLUMNS
|
||||
|
@ -1,10 +1,10 @@
|
||||
import board
|
||||
|
||||
from kmk.keyboard_config import KeyboardConfig as _KeyboardConfig
|
||||
from kmk.kmk_keyboard import KMKKeyboard as _KMKKeyboard
|
||||
from kmk.matrix import DiodeOrientation
|
||||
|
||||
|
||||
class KeyboardConfig(_KeyboardConfig):
|
||||
class KMKKeyboard(_KMKKeyboard):
|
||||
col_pins = (
|
||||
board.A0,
|
||||
board.A1,
|
||||
|
@ -1,10 +1,10 @@
|
||||
import board
|
||||
|
||||
from kmk.keyboard_config import KeyboardConfig as _KeyboardConfig
|
||||
from kmk.kmk_keyboard import KMKKeyboard as _KMKKeyboard
|
||||
from kmk.matrix import DiodeOrientation
|
||||
|
||||
|
||||
class KeyboardConfig(_KeyboardConfig):
|
||||
class KMKKeyboard(_KMKKeyboard):
|
||||
col_pins = (board.A1, board.A2, board.A3, board.A4, board.A5, board.SCK, board.MOSI)
|
||||
row_pins = (board.D13, board.D11, board.D10, board.D9, board.D7)
|
||||
diode_orientation = DiodeOrientation.COLUMNS
|
||||
|
@ -1,10 +1,10 @@
|
||||
import board
|
||||
|
||||
from kmk.keyboard_config import KeyboardConfig as _KeyboardConfig
|
||||
from kmk.kmk_keyboard import KMKKeyboard as _KMKKeyboard
|
||||
from kmk.matrix import DiodeOrientation
|
||||
|
||||
|
||||
class KeyboardConfig(_KeyboardConfig):
|
||||
class KMKKeyboard(_KMKKeyboard):
|
||||
col_pins = (board.A0, board.A1, board.A2, board.A3, board.A4, board.A5, board.SCK)
|
||||
row_pins = (board.D13, board.D11, board.D10, board.D9, board.D7)
|
||||
diode_orientation = DiodeOrientation.COLUMNS
|
||||
|
@ -1,10 +1,10 @@
|
||||
import board
|
||||
|
||||
from kmk.keyboard_config import KeyboardConfig as _KeyboardConfig
|
||||
from kmk.kmk_keyboard import KMKKeyboard as _KMKKeyboard
|
||||
from kmk.matrix import DiodeOrientation
|
||||
|
||||
|
||||
class KeyboardConfig(_KeyboardConfig):
|
||||
class KMKKeyboard(_KMKKeyboard):
|
||||
col_pins = (board.A5, board.A4, board.A3, board.A2, board.A1, board.A0)
|
||||
row_pins = (board.D7, board.D9, board.D10, board.D11)
|
||||
diode_orientation = DiodeOrientation.COLUMNS
|
||||
|
@ -1,10 +1,10 @@
|
||||
import board
|
||||
|
||||
from kmk.keyboard_config import KeyboardConfig as _KeyboardConfig
|
||||
from kmk.kmk_keyboard import KMKKeyboard as _KMKKeyboard
|
||||
from kmk.matrix import DiodeOrientation
|
||||
|
||||
|
||||
class KeyboardConfig(_KeyboardConfig):
|
||||
class KMKKeyboard(_KMKKeyboard):
|
||||
col_pins = (board.MOSI, board.SCK, board.A5, board.A4, board.A3, board.A2)
|
||||
row_pins = (board.D11, board.D10, board.D9, board.D7)
|
||||
diode_orientation = DiodeOrientation.COLUMNS
|
||||
|
@ -1,10 +1,10 @@
|
||||
import board
|
||||
|
||||
from kmk.keyboard_config import KeyboardConfig as _KeyboardConfig
|
||||
from kmk.kmk_keyboard import KMKKeyboard as _KMKKeyboard
|
||||
from kmk.matrix import DiodeOrientation
|
||||
from kmk.matrix import intify_coordinate as ic
|
||||
|
||||
# Implements what used to be handled by KeyboardConfig.swap_indicies for this
|
||||
# Implements what used to be handled by KMKKeyboard.swap_indicies for this
|
||||
# board, by flipping various row3 (bottom physical row) keys so their
|
||||
# coord_mapping matches what the user pressed (even if the wiring
|
||||
# underneath is sending different coordinates)
|
||||
@ -18,7 +18,7 @@ def r3_swap(col):
|
||||
return col
|
||||
|
||||
|
||||
class KeyboardConfig(_KeyboardConfig):
|
||||
class KMKKeyboard(_KMKKeyboard):
|
||||
# physical, visible cols (SCK, MO, MI, RX, TX, D4)
|
||||
# physical, visible rows (10, 11, 12, 13) (9, 6, 5, SCL)
|
||||
col_pins = (board.SCK, board.MOSI, board.MISO, board.RX, board.TX, board.D4)
|
||||
|
@ -16,7 +16,7 @@ from kmk.matrix import MatrixScanner
|
||||
from kmk.matrix import intify_coordinate as ic
|
||||
|
||||
|
||||
class KeyboardConfig:
|
||||
class KMKKeyboard:
|
||||
debug_enabled = False
|
||||
|
||||
keymap = None
|
||||
@ -56,7 +56,7 @@ class KeyboardConfig:
|
||||
|
||||
def __repr__(self):
|
||||
return (
|
||||
'KeyboardConfig('
|
||||
'KMKKeyboard('
|
||||
'debug_enabled={} '
|
||||
'keymap=truncated '
|
||||
'coord_mapping=truncated '
|
@ -1,7 +1,7 @@
|
||||
from kmk.boards.converter.fourtypercentclub.luddite import KeyboardConfig
|
||||
from kmk.boards.converter.fourtypercentclub.luddite import KMKKeyboard
|
||||
from kmk.keys import KC
|
||||
|
||||
keyboard = KeyboardConfig()
|
||||
keyboard = KMKKeyboard()
|
||||
|
||||
_______ = KC.TRNS
|
||||
XXXXXXX = KC.NO
|
||||
|
@ -1,7 +1,7 @@
|
||||
from kmk.boards.converter.keebio.nyquist_r2 import KeyboardConfig
|
||||
from kmk.boards.converter.keebio.nyquist_r2 import KMKKeyboard
|
||||
from kmk.keys import KC
|
||||
|
||||
keyboard = KeyboardConfig()
|
||||
keyboard = KMKKeyboard()
|
||||
|
||||
_______ = KC.TRNS
|
||||
XXXXXXX = KC.NO
|
||||
|
@ -2,12 +2,12 @@ import board
|
||||
|
||||
from kmk.consts import UnicodeMode
|
||||
from kmk.handlers.sequences import compile_unicode_string_sequences, send_string
|
||||
from kmk.keyboard_config import KeyboardConfig
|
||||
from kmk.keys import KC
|
||||
from kmk.kmk_keyboard import KMKKeyboard
|
||||
from kmk.matrix import DiodeOrientation
|
||||
from kmk.types import AttrDict
|
||||
|
||||
keyboard = KeyboardConfig()
|
||||
keyboard = KMKKeyboard()
|
||||
|
||||
'''
|
||||
Converter/handwire:
|
||||
|
@ -2,12 +2,12 @@ import board
|
||||
|
||||
from kmk.consts import UnicodeMode
|
||||
from kmk.handlers.sequences import compile_unicode_string_sequences, send_string
|
||||
from kmk.keyboard_config import KeyboardConfig
|
||||
from kmk.keys import KC
|
||||
from kmk.kmk_keyboard import KMKKeyboard
|
||||
from kmk.matrix import DiodeOrientation
|
||||
from kmk.types import AttrDict
|
||||
|
||||
keyboard = KeyboardConfig()
|
||||
keyboard = KMKKeyboard()
|
||||
|
||||
keyboard.col_pins = (board.A0, board.A1, board.A2, board.A3, board.A4, board.A5, board.SCK, board.MOSI, board.MISO, board.RX, board.TX, board.D4)
|
||||
keyboard.row_pins = (board.D10, board.D11, board.D12, board.D13)
|
||||
|
@ -1,9 +1,9 @@
|
||||
from kmk.boards.converter.keebio.levinson_r2 import KeyboardConfig
|
||||
from kmk.boards.converter.keebio.levinson_r2 import KMKKeyboard
|
||||
from kmk.consts import LeaderMode, UnicodeMode
|
||||
from kmk.handlers.sequences import compile_unicode_string_sequences
|
||||
from kmk.keys import KC
|
||||
|
||||
keyboard = KeyboardConfig()
|
||||
keyboard = KMKKeyboard()
|
||||
|
||||
# ------------------User level config variables ---------------------------------------
|
||||
keyboard.leader_mode = LeaderMode.TIMEOUT
|
||||
|
@ -1,7 +1,7 @@
|
||||
from kmk.boards.converter.fourtypercentclub.luddite import KeyboardConfig
|
||||
from kmk.boards.converter.fourtypercentclub.luddite import KMKKeyboard
|
||||
from kmk.keys import KC
|
||||
|
||||
keyboard = KeyboardConfig()
|
||||
keyboard = KMKKeyboard()
|
||||
|
||||
# ---------------------------------- Config --------------------------------------------
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
from kmk.boards.converter.keebio.nyquist_r2 import KeyboardConfig
|
||||
from kmk.boards.converter.keebio.nyquist_r2 import KMKKeyboard
|
||||
from kmk.keys import KC
|
||||
|
||||
keyboard = KeyboardConfig()
|
||||
keyboard = KMKKeyboard()
|
||||
|
||||
# ------------------User level config variables ---------------------------------------
|
||||
keyboard.tap_time = 150
|
||||
|
@ -1,10 +1,10 @@
|
||||
from kmk.boards.converter.keebio.iris_r2 import KeyboardConfig
|
||||
from kmk.boards.converter.keebio.iris_r2 import KMKKeyboard
|
||||
from kmk.consts import LeaderMode, UnicodeMode
|
||||
from kmk.handlers.sequences import compile_unicode_string_sequences as cuss
|
||||
from kmk.handlers.sequences import send_string
|
||||
from kmk.keys import KC
|
||||
|
||||
keyboard = KeyboardConfig()
|
||||
keyboard = KMKKeyboard()
|
||||
|
||||
keyboard.debug_enabled = False
|
||||
keyboard.unicode_mode = UnicodeMode.LINUX
|
||||
|
@ -1,10 +1,10 @@
|
||||
from kmk.boards.klarank import KeyboardConfig
|
||||
from kmk.boards.klarank import KMKKeyboard
|
||||
from kmk.consts import LeaderMode, UnicodeMode
|
||||
from kmk.handlers.sequences import compile_unicode_string_sequences as cuss
|
||||
from kmk.handlers.sequences import send_string
|
||||
from kmk.keys import KC, make_key
|
||||
|
||||
keyboard = KeyboardConfig()
|
||||
keyboard = KMKKeyboard()
|
||||
|
||||
keyboard.debug_enabled = True
|
||||
keyboard.unicode_mode = UnicodeMode.LINUX
|
||||
|
@ -1,9 +1,9 @@
|
||||
from kmk.boards.converter.keebio.levinson_r2 import KeyboardConfig
|
||||
from kmk.boards.converter.keebio.levinson_r2 import KMKKeyboard
|
||||
from kmk.consts import LeaderMode, UnicodeMode
|
||||
from kmk.handlers.sequences import compile_unicode_string_sequences
|
||||
from kmk.keys import KC
|
||||
|
||||
keyboard = KeyboardConfig()
|
||||
keyboard = KMKKeyboard()
|
||||
|
||||
# ------------------User level config variables ---------------------------------------
|
||||
keyboard.leader_mode = LeaderMode.TIMEOUT
|
||||
|
Loading…
x
Reference in New Issue
Block a user