keymap updates and test Flake8 exemption.

One more time
This commit is contained in:
Luke D Russell 2022-06-21 09:41:15 +10:00 committed by Kyle Brown
parent 10572d71f6
commit 5c8f33fc3e
6 changed files with 63 additions and 65 deletions

View File

@ -4,16 +4,10 @@
A 36 or 42 key keyboard with support for per key LEDs, 2 rotary encoders (EC11 or evqwgd001), and a feature in the center (EC11, OLED (128x64), or pimoroni trackball). KMK support is available for the BYO MCU option only.
`kb-kb2040.py` is designed to work with a KB2040.
Use `kb2040/kb.py` when using a KB2040 MCU.
`kb-nn.py` is designed to work with a Nice!Nano.
- [Layers](https://github.com/KMKfw/kmk_firmware/tree/master/docs/layers.md) Need more keys than switches? Use layers.
- [RGB](https://github.com/KMKfw/kmk_firmware/tree/master/docs/rgb.md) Light it up
Instructions:
* Copy the kmk directory as a whole into the root directory of your KB2040.
* Copy <gitroot>/lib/neopixel* to <usbroot>/lib/.
* Copy kb.py and main.py in this folder to <usbroot>/.
Use `nice_nano/kb.py` when using a Nice!Nano v2 MCU.
> Note: The Nice!Nano doesn't have a lot of ROM, so there are a couple of extra steps. See guidance [over here](../../docs/Officially_Supported_Microcontrollers.md#nicenano).
An example `main.py` file is included for each MCU.

View File

@ -3,7 +3,6 @@ import board
from kmk.kmk_keyboard import KMKKeyboard as _KMKKeyboard
from kmk.scanners import DiodeOrientation
class KMKKeyboard(_KMKKeyboard):
col_pins = (
board.P1_06,
@ -35,5 +34,4 @@ class KMKKeyboard(_KMKKeyboard):
41, 43, 44, 45, 46, 47, 42, 40,
]
encoder_pins = ((board.P0_20, board.P0_17, board.P0_09, False))

View File

@ -0,0 +1,59 @@
import board
import kb
from kmk.keys import KC
from kmk.modules.layers import Layers
from kmk.modules.combos import Combos, Sequence
keyboard = kb.KMKKeyboard()
keyboard.modules = [
Layers(),
Combos(),
]
keyboard.combos = Combos()
# Convenience variables for the Keymap
_______ = KC.TRNS
xxxxxxx = KC.NO
L1_TAB = KC.LT(1, KC.TAB, prefer_hold=True, tap_interrupted=False, tap_time=250)
L2_ENT = KC.LT(2, KC.ENT, prefer_hold=True, tap_interrupted=False, tap_time=250)
keyboard.combos = [
Sequence((KC.LEADER, KC.A), KC.LCTL(KC.A)), # select All
Sequence((KC.LEADER, KC.T), KC.LCTL(KC.X)), # cuT
Sequence((KC.LEADER, KC.C), KC.LCTL(KC.C)), # Copy
Sequence((KC.LEADER, KC.P), KC.LCTL(KC.P)), # Copy
Sequence((KC.LEADER, KC.U), KC.LCTL(KC.Z)), # Undo
Sequence((KC.LEADER, KC.Y), KC.LCTL(KC.Y)), # redo
]
# flake8: noqa
keyboard.keymap = [
[ # 0: Colemak-DH letters
KC.ESC, KC.Q, KC.W, KC.F, KC.P, KC.B, KC.J, KC.L, KC.U, KC.Y, KC.SCLN, KC.LEADER,
KC.LCTL, KC.A, KC.R, KC.S, KC.T, KC.G, xxxxxxx, KC.M, KC.N, KC.E, KC.I, KC.O, KC.QUOT,
KC.LALT, KC.Z, KC.X, KC.C, KC.D, KC.V, KC.K, KC.H, KC.COMM, KC.DOT, KC.SLSH, KC.BSLS,
xxxxxxx, KC.LGUI, KC.LSFT, KC.BSPC, L1_TAB, KC.SPACE,L2_ENT, xxxxxxx,
],
[ # 1: Nav & Numbers
KC.TAB, KC.N1, KC.N2, KC.N3, KC.N4, KC.N5, KC.N6, KC.N7, KC.N8, KC.N9, KC.N0, KC.DEL,
_______, KC.LPRN, KC.LEFT, KC.UP, KC.RIGHT,KC.RPRN, _______, xxxxxxx, KC.PLUS, KC.EQL, xxxxxxx, xxxxxxx, xxxxxxx,
_______, KC.LBRC, KC.LCBR, KC.DOWN, KC.RCBR, KC.RBRC, xxxxxxx, KC.MINS, KC.UNDS, xxxxxxx, xxxxxxx, xxxxxxx,
_______, _______, _______, KC.DEL, _______, _______, _______, _______,
],
[ # 2: F-row & Board Functions
KC.F12, KC.F1, KC.F2, KC.F3, KC.F4, KC.F5, KC.F6, KC.F7, KC.F8, KC.F9, KC.F10, KC.F11,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______,
],
]
keyboard.debug_enabled = False
if __name__ == '__main__':
keyboard.go()

View File

@ -1,53 +0,0 @@
import board
import kb_nn
from kmk.keys import KC
from kmk.modules.encoder import EncoderHandler
from kmk.modules.layers import Layers
encoder_handler = EncoderHandler()
encoder_handler.pins = kb_nn.encoder_pins
keyboard = kb_nn.KMKKeyboard()
keyboard.modules.append(Layers())
_______ = KC.TRNS
xxxxxxx = KC.NO
L1_BSPC = KC.LT(1, KC.BSPC, prefer_hold=True, tap_interrupted=False, tap_time=250)
BTAB = KC.LSFT(KC.TAB)
# keymap
keyboard.keymap = [
[ # Layer 0: Colemak-DH letters
KC.ESC , KC.Q , KC.W , KC.F, KC.P, KC.B, KC.J , KC.L , KC.U , KC.Y , KC.SCLN, KC.BSPC,
KC.LGUI, KC.A , KC.R , KC.S, KC.T, KC.G, xxxxxxx, KC.M , KC.N , KC.E , KC.I , KC.O , KC.QUOT,
KC.LALT, KC.Z , KC.X , KC.C, KC.D, KC.V, KC.K , KC.H , KC.COMM, KC.DOT , KC.SLSH, KC.BSLS,
xxxxxxx, KC.LCTL, KC.SPC, KC.MO(1), KC.MO(1), KC.RSFT , KC.ENT , xxxxxxx,
],
[ #Layer 1: Nav & Numbers
KC.TAB, KC.N1 , KC.N2 , KC.N3 , KC.N4 , KC.N5 , KC.N6 , KC.N7 , KC.N8 , KC.N9, KC.N0 , KC.DEL ,
_______, KC.LPRN, KC.LEFT, KC.UP , KC.RIGHT, KC.RPRN, _______, xxxxxxx, KC.PPLS, KC.PEQL, xxxxxxx, xxxxxxx, xxxxxxx,
_______, KC.LBRC, KC.LCBR, KC.DOWN, KC.RCBR, KC.RBRC, KC.EQL , KC.PMNS, KC.UNDS, xxxxxxx, xxxxxxx, xxxxxxx,
_______, _______, _______, _______, _______, _______, _______, _______,
],
[
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______,
],
[ #Blank
xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx,
xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx,
xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx,
xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx,
],
]
# keymap
keyboard.debug_enabled = False
if __name__ == '__main__':
keyboard.go()