Make user keymaps fully declarative
This removes the need for the user to define... most things, honestly. Notably, `main()` is no longer the end user's responsibility. This also allows us to do fun stuff going forward like validating keymaps for sanity (ex: the key assigned to `KC_MO(x)` should be assigned to `KC_TRNS` on the target layer or the user will never be able to escape that layer). This also disambiguates `BOARD` to always refer to an actual slab of silicon, renaming to `USER_KEYMAP`. Entrypoints are now a bit more wild, and mostly-unsupported boards no longer have working entrypoints. It's probably just time to scrap those boards for now (until we have BLE HID and/or bitbang USB HID, at least).
This commit is contained in:
44
user_keymaps/kdb424/handwire_planck_pyboard.py
Normal file
44
user_keymaps/kdb424/handwire_planck_pyboard.py
Normal file
@@ -0,0 +1,44 @@
|
||||
# flake8: noqa
|
||||
from logging import DEBUG
|
||||
|
||||
import machine
|
||||
|
||||
from kmk.common.consts import DiodeOrientation
|
||||
from kmk.common.keycodes import KC
|
||||
from kmk.firmware import Firmware
|
||||
from kmk.micropython.pyb_hid import HIDHelper
|
||||
|
||||
|
||||
def main():
|
||||
p = machine.Pin.board
|
||||
|
||||
cols = (p.Y12, p.Y11, p.Y10, p.Y9, p.X8, p.X7, p.X6, p.X5, p.X4, p.X3, p.X2, p.X1)
|
||||
rows = (p.Y1, p.Y2, p.Y3, p.Y4)
|
||||
|
||||
diode_orientation = DiodeOrientation.COLUMNS
|
||||
|
||||
keymap = [
|
||||
[
|
||||
[KC.ESC, KC.QUOTE, KC.COMMA, KC.DOT, KC.P, KC.Y, KC.F, KC.G, KC.C, KC.R, KC.L, KC.BKSP],
|
||||
[KC.TAB, KC.A, KC.O, KC.E, KC.U, KC.I, KC.D, KC.H, KC.T, KC.N, KC.S, KC.ENT],
|
||||
[KC.LSFT, KC.SCLN, KC.Q, KC.J, KC.K, KC.X, KC.B, KC.M, KC.W, KC.V, KC.Z, KC.SLSH],
|
||||
[KC.CTRL, KC.GUI, KC.ALT, KC.RESET, KC.MO(1), KC.SPC, KC.SPC, KC.A, KC.LEFT, KC.DOWN, KC.UP, KC.RIGHT],
|
||||
],
|
||||
[
|
||||
[KC.A, KC.QUOTE, KC.COMMA, KC.DOT, KC.P, KC.Y, KC.F, KC.G, KC.C, KC.R, KC.L, KC.BACKSPACE],
|
||||
[KC.TAB, KC.A, KC.O, KC.E, KC.U, KC.I, KC.D, KC.H, KC.T, KC.N, KC.S, KC.ENT],
|
||||
[KC.LSFT, KC.SCOLON, KC.Q, KC.J, KC.K, KC.X, KC.B, KC.M, KC.W, KC.V, KC.Z, KC.SLSH],
|
||||
[KC.CTRL, KC.GUI, KC.ALT, KC.RESET, KC.MO(1), KC.SPC, KC.SPC, KC.A, KC.LEFT, KC.DOWN, KC.UP, KC.RIGHT],
|
||||
],
|
||||
]
|
||||
|
||||
firmware = Firmware(
|
||||
keymap=keymap,
|
||||
row_pins=rows,
|
||||
col_pins=cols,
|
||||
diode_orientation=diode_orientation,
|
||||
hid=HIDHelper,
|
||||
log_level=DEBUG,
|
||||
)
|
||||
|
||||
firmware.go()
|
29
user_keymaps/klardotsh/threethree_matrix_pyboard.py
Normal file
29
user_keymaps/klardotsh/threethree_matrix_pyboard.py
Normal file
@@ -0,0 +1,29 @@
|
||||
import machine
|
||||
|
||||
from kmk.common.consts import DiodeOrientation
|
||||
from kmk.common.keycodes import KC
|
||||
from kmk.entrypoints.handwire.pyboard import main
|
||||
|
||||
p = machine.Pin.board
|
||||
cols = (p.X10, p.X11, p.X12)
|
||||
rows = (p.X1, p.X2, p.X3)
|
||||
|
||||
diode_orientation = DiodeOrientation.COLUMNS
|
||||
|
||||
keymap = [
|
||||
[
|
||||
[KC.MO(1), KC.H, KC.RESET],
|
||||
[KC.MO(2), KC.I, KC.ENTER],
|
||||
[KC.LCTRL, KC.SPACE, KC.LSHIFT],
|
||||
],
|
||||
[
|
||||
[KC.TRNS, KC.B, KC.C],
|
||||
[KC.NO, KC.D, KC.E],
|
||||
[KC.F, KC.G, KC.H],
|
||||
],
|
||||
[
|
||||
[KC.X, KC.Y, KC.Z],
|
||||
[KC.TRNS, KC.N, KC.O],
|
||||
[KC.R, KC.P, KC.Q],
|
||||
],
|
||||
]
|
28
user_keymaps/klardotsh/twotwo_matrix_feather.py
Normal file
28
user_keymaps/klardotsh/twotwo_matrix_feather.py
Normal file
@@ -0,0 +1,28 @@
|
||||
from logging import DEBUG
|
||||
|
||||
import board
|
||||
|
||||
from kmk.common.consts import DiodeOrientation
|
||||
from kmk.firmware import Firmware
|
||||
|
||||
|
||||
def main():
|
||||
cols = (board.A4, board.A5)
|
||||
rows = (board.D27, board.A6)
|
||||
|
||||
diode_orientation = DiodeOrientation.COLUMNS
|
||||
|
||||
keymap = [
|
||||
['A', 'B'],
|
||||
['C', 'D'],
|
||||
]
|
||||
|
||||
firmware = Firmware(
|
||||
keymap=keymap,
|
||||
row_pins=rows,
|
||||
col_pins=cols,
|
||||
diode_orientation=diode_orientation,
|
||||
log_level=DEBUG,
|
||||
)
|
||||
|
||||
firmware.go()
|
5
user_keymaps/noop.py
Normal file
5
user_keymaps/noop.py
Normal file
@@ -0,0 +1,5 @@
|
||||
import sys
|
||||
|
||||
|
||||
def main():
|
||||
sys.exit(0)
|
Reference in New Issue
Block a user