Rename "Firmware" to "KeyboardConfig" for clarity in main.py and to illustrate separation of KeyboardConfig/InternalState

This commit is contained in:
Josh Klar 2019-07-20 14:53:30 -07:00
parent e8c3b5ac70
commit 1e9625ae0e
No known key found for this signature in database
GPG Key ID: A4A0C7B4E8EEE222
33 changed files with 71 additions and 71 deletions

View File

@ -5,17 +5,17 @@ Keymaps in KMK are simple Python class objects with various attributes assigned
The basics of what you'll need to get started are:
- Import the `Firmware` object for your keyboard from `kmk.boards` (or, if
handwiring your keyboard, import `Firmware` from the appropriate MCU for your
- Import the `KeyboardConfig` object for your keyboard from `kmk.boards` (or, if
handwiring your keyboard, import `KeyboardConfig` from the appropriate MCU for your
board from `kmk.mcus`. See `hardware.md` for the list of supported boards and
map this to the correct Python module under either of those paths.
- Add a file to `user_keymaps/your_username` called whatever you'd like
- Assign a `Firmware` instance to a variable (ex. `keyboard = Firmware()` - note
- Assign a `KeyboardConfig` instance to a variable (ex. `keyboard = KeyboardConfig()` - note
the parentheses)
- Make sure this `Firmware` instance is actually run at the end of the file with
- Make sure this `KeyboardConfig` instance is actually run at the end of the file with
a block such as the following:
```python
@ -85,14 +85,14 @@ matrix pins (in somewhat of a "spider" setup), utilizing most of the above
features:
```python
from kmk.boards.klarank import Firmware
from kmk.boards.klarank import KeyboardConfig
from kmk.consts import UnicodeMode
from kmk.keycodes import KC
from kmk.keycodes import generate_leader_dictionary_seq as glds
from kmk.macros.simple import send_string
from kmk.macros.unicode import compile_unicode_string_sequences as cuss
keyboard = Firmware()
keyboard = KeyboardConfig()
keyboard.debug_enabled = True
keyboard.unicode_mode = UnicodeMode.LINUX

View File

@ -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 Firmware
from kmk.boards.klarank import KeyboardConfig
from kmk.keycodes import KC
from kmk.macros.simple import send_string
keyboard = Firmware()
keyboard = KeyboardConfig()
keyboard.tap_time = 750

View File

@ -1,9 +1,9 @@
from kmk.consts import DiodeOrientation
from kmk.mcus.circuitpython_usbhid import Firmware as _Firmware
from kmk.mcus.circuitpython_usbhid import KeyboardConfig as _KeyboardConfig
from kmk.pins import Pin as P
class Firmware(_Firmware):
class KeyboardConfig(_KeyboardConfig):
col_pins = (P.D9, P.D10, P.D11, P.D12, P.D13, P.SCL)
row_pins = (P.A3, P.A4, P.A5, P.SCK, P.MOSI)
diode_orientation = DiodeOrientation.COLUMNS

View File

@ -1,11 +1,11 @@
import board
from kmk.consts import DiodeOrientation
from kmk.mcus.circuitpython_usbhid import Firmware as _Firmware
from kmk.mcus.circuitpython_usbhid import KeyboardConfig as _KeyboardConfig
from kmk.pins import Pin as P
class Firmware(_Firmware):
class KeyboardConfig(_KeyboardConfig):
col_pins = (P.A0, P.A1, P.A2, P.A3, P.A4, P.A5, P.SCK, P.MOSI)
row_pins = (P.TX, P.RX, P.SDA, P.SCL, P.D13, P.D12, P.D11, P.D10)
diode_orientation = DiodeOrientation.COLUMNS

View File

@ -1,11 +1,11 @@
import board
from kmk.consts import DiodeOrientation
from kmk.mcus.circuitpython_usbhid import Firmware as _Firmware
from kmk.mcus.circuitpython_usbhid import KeyboardConfig as _KeyboardConfig
from kmk.pins import Pin as P
class Firmware(_Firmware):
class KeyboardConfig(_KeyboardConfig):
col_pins = (P.RX, P.D13, P.A0, P.D11, P.A4, P.A5, P.D10, P.D9, P.SCK)
diode_orientation = DiodeOrientation.COLUMNS
rgb_pixel_pin = board.TX

View File

@ -1,11 +1,11 @@
import board
from kmk.consts import DiodeOrientation
from kmk.mcus.circuitpython_usbhid import Firmware as _Firmware
from kmk.mcus.circuitpython_usbhid import KeyboardConfig as _KeyboardConfig
from kmk.pins import Pin as P
class Firmware(_Firmware):
class KeyboardConfig(_KeyboardConfig):
col_pins = (P.A1, P.A2, P.A3, P.A4, P.A5, P.SCK, P.MOSI)
row_pins = (P.A0, P.D11, P.D10, P.D9)
diode_orientation = DiodeOrientation.COLUMNS

View File

@ -1,11 +1,11 @@
import board
from kmk.consts import DiodeOrientation
from kmk.mcus.circuitpython_usbhid import Firmware as _Firmware
from kmk.mcus.circuitpython_usbhid import KeyboardConfig as _KeyboardConfig
from kmk.pins import Pin as P
class Firmware(_Firmware):
class KeyboardConfig(_KeyboardConfig):
col_pins = (P.A2, P.A3, P.A4, P.A5, P.SCK, P.MOSI)
row_pins = (P.D11, P.D10, P.D9, P.D7, P.D13)
diode_orientation = DiodeOrientation.COLUMNS

View File

@ -1,12 +1,12 @@
import board
from kmk.consts import DiodeOrientation
from kmk.mcus.circuitpython_usbhid import Firmware as _Firmware
from kmk.mcus.circuitpython_usbhid import KeyboardConfig as _KeyboardConfig
from kmk.pins import Pin as P
from kmk.util import intify_coordinate as ic
class Firmware(_Firmware):
class KeyboardConfig(_KeyboardConfig):
# 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 }

View File

@ -1,11 +1,11 @@
import board
from kmk.consts import DiodeOrientation
from kmk.mcus.circuitpython_usbhid import Firmware as _Firmware
from kmk.mcus.circuitpython_usbhid import KeyboardConfig as _KeyboardConfig
from kmk.pins import Pin as P
class Firmware(_Firmware):
class KeyboardConfig(_KeyboardConfig):
col_pins = (P.SDA, P.A2, P.A3, P.A4, P.A5, P.SCK, P.MOSI)
row_pins = (P.TX, P.A0, P.RX, P.A1, P.D11, P.D9, P.D12, P.D10)
diode_orientation = DiodeOrientation.COLUMNS

View File

@ -1,11 +1,11 @@
import board
from kmk.consts import DiodeOrientation
from kmk.mcus.circuitpython_usbhid import Firmware as _Firmware
from kmk.mcus.circuitpython_usbhid import KeyboardConfig as _KeyboardConfig
from kmk.pins import Pin as P
class Firmware(_Firmware):
class KeyboardConfig(_KeyboardConfig):
col_pins = (P.A2, P.A3, P.A4, P.A5, P.SCK, P.A0)
row_pins = (P.D11, P.D10, P.D9, P.D7)
diode_orientation = DiodeOrientation.COLUMNS

View File

@ -1,11 +1,11 @@
import board
from kmk.consts import DiodeOrientation
from kmk.mcus.circuitpython_usbhid import Firmware as _Firmware
from kmk.mcus.circuitpython_usbhid import KeyboardConfig as _KeyboardConfig
from kmk.pins import Pin as P
class Firmware(_Firmware):
class KeyboardConfig(_KeyboardConfig):
col_pins = (P.A2, P.A3, P.A4, P.A5, P.SCK, P.MOSI)
row_pins = (P.D13, P.D11, P.D10, P.D9)
diode_orientation = DiodeOrientation.COLUMNS

View File

@ -1,11 +1,11 @@
import board
from kmk.consts import DiodeOrientation
from kmk.mcus.circuitpython_usbhid import Firmware as _Firmware
from kmk.mcus.circuitpython_usbhid import KeyboardConfig as _KeyboardConfig
from kmk.pins import Pin as P
class Firmware(_Firmware):
class KeyboardConfig(_KeyboardConfig):
col_pins = (P.A2, P.A3, P.A4, P.A5, P.SCK, P.MOSI)
row_pins = (P.D13, P.D11, P.D10, P.D9, P.D7)
diode_orientation = DiodeOrientation.COLUMNS

View File

@ -1,11 +1,11 @@
import board
from kmk.consts import DiodeOrientation
from kmk.mcus.circuitpython_usbhid import Firmware as _Firmware
from kmk.mcus.circuitpython_usbhid import KeyboardConfig as _KeyboardConfig
from kmk.pins import Pin as P
class Firmware(_Firmware):
class KeyboardConfig(_KeyboardConfig):
col_pins = (P.RX, P.A1, P.A2, P.A3, P.A4, P.A5)
row_pins = (P.D13, P.D11, P.D10, P.D9, P.D7)
diode_orientation = DiodeOrientation.COLUMNS

View File

@ -1,11 +1,11 @@
import board
from kmk.consts import DiodeOrientation
from kmk.mcus.circuitpython_usbhid import Firmware as _Firmware
from kmk.mcus.circuitpython_usbhid import KeyboardConfig as _KeyboardConfig
from kmk.pins import Pin as P
class Firmware(_Firmware):
class KeyboardConfig(_KeyboardConfig):
# Will need additional work and testing
col_pins = (P.A1, P.A2, P.A3, P.A4, P.A5, P.SCK, P.MOSI, P.D12)
row_pins = (P.A0, P.D13, P.D11, P.D10, P.D9, P.D7)

View File

@ -1,11 +1,11 @@
import board
from kmk.consts import DiodeOrientation
from kmk.mcus.circuitpython_usbhid import Firmware as _Firmware
from kmk.mcus.circuitpython_usbhid import KeyboardConfig as _KeyboardConfig
from kmk.pins import Pin as P
class Firmware(_Firmware):
class KeyboardConfig(_KeyboardConfig):
col_pins = (P.A2, P.A3, P.A4, P.A5, P.SCK, P.MOSI)
row_pins = (P.D11, P.D10, P.D9, P.RX, P.D13)
diode_orientation = DiodeOrientation.COLUMNS

View File

@ -1,9 +1,9 @@
from kmk.consts import DiodeOrientation
from kmk.mcus.circuitpython_usbhid import Firmware as _Firmware
from kmk.mcus.circuitpython_usbhid import KeyboardConfig as _KeyboardConfig
from kmk.pins import Pin as P
class Firmware(_Firmware):
class KeyboardConfig(_KeyboardConfig):
col_pins = (P.A0, P.A1, P.A2, P.A3, P.A4, P.A5, P.SCK, P.MOSI)
row_pins = (P.TX, P.RX, P.SDA, P.SCL, P.D9, P.D10, P.D12, P.D11, P.D13)
diode_orientation = DiodeOrientation.COLUMNS

View File

@ -1,11 +1,11 @@
import board
from kmk.consts import DiodeOrientation
from kmk.mcus.circuitpython_usbhid import Firmware as _Firmware
from kmk.mcus.circuitpython_usbhid import KeyboardConfig as _KeyboardConfig
from kmk.pins import Pin as P
class Firmware(_Firmware):
class KeyboardConfig(_KeyboardConfig):
col_pins = (P.A1, P.A2, P.A3, P.A4, P.A5, P.SCK, P.MOSI)
row_pins = (P.D13, P.D11, P.D10, P.D9, P.D7)
diode_orientation = DiodeOrientation.COLUMNS

View File

@ -1,11 +1,11 @@
import board
from kmk.consts import DiodeOrientation
from kmk.mcus.circuitpython_usbhid import Firmware as _Firmware
from kmk.mcus.circuitpython_usbhid import KeyboardConfig as _KeyboardConfig
from kmk.pins import Pin as P
class Firmware(_Firmware):
class KeyboardConfig(_KeyboardConfig):
col_pins = (P.A0, P.A1, P.A2, P.A3, P.A4, P.A5, P.SCK)
row_pins = (P.D13, P.D11, P.D10, P.D9, P.D7)
diode_orientation = DiodeOrientation.COLUMNS

View File

@ -1,11 +1,11 @@
import board
from kmk.consts import DiodeOrientation
from kmk.mcus.circuitpython_usbhid import Firmware as _Firmware
from kmk.mcus.circuitpython_usbhid import KeyboardConfig as _KeyboardConfig
from kmk.pins import Pin as P
class Firmware(_Firmware):
class KeyboardConfig(_KeyboardConfig):
col_pins = (P.A5, P.A4, P.A3, P.A2, P.A1, P.A0)
row_pins = (P.D7, P.D9, P.D10, P.D11)
diode_orientation = DiodeOrientation.COLUMNS

View File

@ -1,11 +1,11 @@
import board
from kmk.consts import DiodeOrientation
from kmk.mcus.circuitpython_usbhid import Firmware as _Firmware
from kmk.mcus.circuitpython_usbhid import KeyboardConfig as _KeyboardConfig
from kmk.pins import Pin as P
class Firmware(_Firmware):
class KeyboardConfig(_KeyboardConfig):
col_pins = (P.MOSI, P.SCK, P.A5, P.A4, P.A3, P.A2)
row_pins = (P.D11, P.D10, P.D9, P.D7)
diode_orientation = DiodeOrientation.COLUMNS

View File

@ -1,9 +1,9 @@
from kmk.consts import DiodeOrientation
from kmk.mcus.circuitpython_usbhid import Firmware as _Firmware
from kmk.mcus.circuitpython_usbhid import KeyboardConfig as _KeyboardConfig
from kmk.pins import Pin as P
from kmk.util import intify_coordinate as ic
# Implements what used to be handled by Firmware.swap_indicies for this
# Implements what used to be handled by KeyboardConfig.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)
@ -24,7 +24,7 @@ def r3_swap(col):
return col
class Firmware(_Firmware):
class KeyboardConfig(_KeyboardConfig):
# physical, visible cols (SCK, MO, MI, RX, TX, D4)
# physical, visible rows (10, 11, 12, 13) (9, 6, 5, SCL)
col_pins = (P.SCK, P.MOSI, P.MISO, P.RX, P.TX, P.D4)

View File

@ -53,7 +53,7 @@ from kmk.util import intify_coordinate as ic
from kmk import led, rgb # isort:skip
class Firmware:
class KeyboardConfig:
debug_enabled = False
keymap = None
@ -95,7 +95,7 @@ class Firmware:
def __repr__(self):
return (
'Firmware('
'KeyboardConfig('
'debug_enabled={} '
'keymap=truncated '
'coord_mapping=truncated '

View File

@ -1,6 +1,6 @@
from kmk.firmware import Firmware as _Firmware
from kmk.hid import CircuitPythonUSB_HID
from kmk.keyboard_config import KeyboardConfig as _KeyboardConfig
class Firmware(_Firmware):
class KeyboardConfig(_KeyboardConfig):
hid_helper = CircuitPythonUSB_HID

View File

@ -1,7 +1,7 @@
from kmk.boards.converter.fourtypercentclub.luddite import Firmware
from kmk.boards.converter.fourtypercentclub.luddite import KeyboardConfig
from kmk.keys import KC
keyboard = Firmware()
keyboard = KeyboardConfig()
_______ = KC.TRNS
XXXXXXX = KC.NO

View File

@ -1,7 +1,7 @@
from kmk.boards.converter.keebio.nyquist_r2 import Firmware
from kmk.boards.converter.keebio.nyquist_r2 import KeyboardConfig
from kmk.keys import KC
keyboard = Firmware()
keyboard = KeyboardConfig()
_______ = KC.TRNS
XXXXXXX = KC.NO

View File

@ -2,11 +2,11 @@ from kmk.consts import DiodeOrientation, UnicodeMode
from kmk.handlers.sequences import (compile_unicode_string_sequences,
send_string)
from kmk.keys import KC
from kmk.mcus.circuitpython_usbhid import Firmware
from kmk.mcus.circuitpython_usbhid import KeyboardConfig
from kmk.pins import Pin as P
from kmk.types import AttrDict
keyboard = Firmware()
keyboard = KeyboardConfig()
'''
Converter/handwire:

View File

@ -2,11 +2,11 @@ from kmk.consts import DiodeOrientation, UnicodeMode
from kmk.handlers.sequences import (compile_unicode_string_sequences,
send_string)
from kmk.keys import KC
from kmk.mcus.circuitpython_usbhid import Firmware
from kmk.mcus.circuitpython_usbhid import KeyboardConfig
from kmk.pins import Pin as P
from kmk.types import AttrDict
keyboard = Firmware()
keyboard = KeyboardConfig()
keyboard.col_pins = (P.A0, P.A1, P.A2, P.A3, P.A4, P.A5, P.SCK, P.MOSI, P.MISO, P.RX, P.TX, P.D4)
keyboard.row_pins = (P.D10, P.D11, P.D12, P.D13)

View File

@ -1,9 +1,9 @@
from kmk.boards.converter.keebio.levinson_r2 import Firmware
from kmk.boards.converter.keebio.levinson_r2 import KeyboardConfig
from kmk.consts import LeaderMode, UnicodeMode
from kmk.handlers.sequences import compile_unicode_string_sequences
from kmk.keys import KC
keyboard = Firmware()
keyboard = KeyboardConfig()
# ------------------User level config variables ---------------------------------------
keyboard.leader_mode = LeaderMode.TIMEOUT

View File

@ -1,7 +1,7 @@
from kmk.boards.converter.fourtypercentclub.luddite import Firmware
from kmk.boards.converter.fourtypercentclub.luddite import KeyboardConfig
from kmk.keys import KC
keyboard = Firmware()
keyboard = KeyboardConfig()
# ---------------------------------- Config --------------------------------------------

View File

@ -1,7 +1,7 @@
from kmk.boards.converter.keebio.nyquist_r2 import Firmware
from kmk.boards.converter.keebio.nyquist_r2 import KeyboardConfig
from kmk.keys import KC
keyboard = Firmware()
keyboard = KeyboardConfig()
# ------------------User level config variables ---------------------------------------
keyboard.tap_time = 150

View File

@ -1,10 +1,10 @@
from kmk.boards.converter.keebio.iris_r2 import Firmware
from kmk.boards.converter.keebio.iris_r2 import KeyboardConfig
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 = Firmware()
keyboard = KeyboardConfig()
keyboard.debug_enabled = False
keyboard.unicode_mode = UnicodeMode.LINUX

View File

@ -1,10 +1,10 @@
from kmk.boards.klarank import Firmware
from kmk.boards.klarank import KeyboardConfig
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 = Firmware()
keyboard = KeyboardConfig()
keyboard.debug_enabled = True
keyboard.unicode_mode = UnicodeMode.LINUX

View File

@ -1,9 +1,9 @@
from kmk.boards.converter.keebio.levinson_r2 import Firmware
from kmk.boards.converter.keebio.levinson_r2 import KeyboardConfig
from kmk.consts import LeaderMode, UnicodeMode
from kmk.handlers.sequences import compile_unicode_string_sequences
from kmk.keys import KC
keyboard = Firmware()
keyboard = KeyboardConfig()
# ------------------User level config variables ---------------------------------------
keyboard.leader_mode = LeaderMode.TIMEOUT