diff --git a/.gitignore b/.gitignore index fd21187..cb63671 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,4 @@ fp-info-cache # Exported BOM files *.xml *.csv +backplate-gerbers/ diff --git a/README.md b/README.md index 20122da..c074e3e 100755 --- a/README.md +++ b/README.md @@ -33,6 +33,8 @@ It should now behave as a keyboard. This macropad uses KMK for it's firmware. KMK is a flexible circuitpython based project for mechanical keyboards that offers a lot of options. The basic firmware for the RSMP is simple, in that every button outputs a letter. To customize the behavior, you can modify `main.py`. +As an example of layers, the bottom left button will output a space when tapped, and when held, the buttons will output numbers and various symbols instead of letters. + ## Credits - [KMK](https://github.com/KMKfw/kmk_firmware) - Keyboard software diff --git a/firmware/kmk/extensions/international.py b/firmware/kmk/extensions/international.py index eab8087..ddca8fd 100755 --- a/firmware/kmk/extensions/international.py +++ b/firmware/kmk/extensions/international.py @@ -1,4 +1,5 @@ '''Adds international keys''' + from kmk.extensions import Extension from kmk.keys import make_key diff --git a/firmware/kmk/keys.py b/firmware/kmk/keys.py index 364eccf..76f5565 100755 --- a/firmware/kmk/keys.py +++ b/firmware/kmk/keys.py @@ -806,7 +806,7 @@ def _argumented_key(*user_args, **user_kwargs) -> Key: if meta: key = Key( - NEXT_AVAILABLE_KEY, meta=meta, *constructor_args, **constructor_kwargs + NEXT_AVAILABLE_KEY, *constructor_args, meta=meta, **constructor_kwargs ) NEXT_AVAILABLE_KEY += 1 diff --git a/firmware/kmk/kmk_keyboard.py b/firmware/kmk/kmk_keyboard.py index 54f72af..f8daca7 100755 --- a/firmware/kmk/kmk_keyboard.py +++ b/firmware/kmk/kmk_keyboard.py @@ -67,7 +67,6 @@ class KMKKeyboard: _trigger_powersave_enable = False _trigger_powersave_disable = False _go_args = None - _processing_timeouts = False _resume_buffer = [] _resume_buffer_x = [] @@ -76,8 +75,6 @@ class KMKKeyboard: # overhead (the underlying list was never used anyway) active_layers = [0] - _timeouts = {} - def __repr__(self) -> str: return self.__class__.__name__ diff --git a/firmware/kmk/modules/combos.py b/firmware/kmk/modules/combos.py index 8284e30..2adf348 100755 --- a/firmware/kmk/modules/combos.py +++ b/firmware/kmk/modules/combos.py @@ -303,7 +303,7 @@ def on_timeout(self, keyboard, combo): self.reset_combo(keyboard, combo) def send_key_buffer(self, keyboard): - for (int_coord, key, is_pressed) in self._key_buffer: + for int_coord, key, is_pressed in self._key_buffer: keyboard.resume_process_key(self, key, is_pressed, int_coord) def activate(self, keyboard, combo): diff --git a/firmware/kmk/modules/holdtap.py b/firmware/kmk/modules/holdtap.py index 29a3e12..22f20c3 100755 --- a/firmware/kmk/modules/holdtap.py +++ b/firmware/kmk/modules/holdtap.py @@ -222,7 +222,7 @@ def send_key_buffer(self, keyboard): return reprocess = False - for (int_coord, key, is_pressed) in self.key_buffer: + for int_coord, key, is_pressed in self.key_buffer: keyboard.resume_process_key(self, key, is_pressed, int_coord, reprocess) if isinstance(key.meta, HoldTapKeyMeta): reprocess = True diff --git a/firmware/kmk/modules/layers.py b/firmware/kmk/modules/layers.py index 098a02f..8db1322 100755 --- a/firmware/kmk/modules/layers.py +++ b/firmware/kmk/modules/layers.py @@ -1,4 +1,5 @@ '''One layer isn't enough. Adds keys to get to more of them''' + from kmk.keys import KC, make_argumented_key from kmk.modules.holdtap import HoldTap, HoldTapKeyMeta from kmk.utils import Debug diff --git a/firmware/kmk/modules/pimoroni_trackball.py b/firmware/kmk/modules/pimoroni_trackball.py index 78a5d2a..4f20b51 100755 --- a/firmware/kmk/modules/pimoroni_trackball.py +++ b/firmware/kmk/modules/pimoroni_trackball.py @@ -1,6 +1,7 @@ ''' Extension handles usage of Trackball Breakout by Pimoroni ''' + from micropython import const import math @@ -310,7 +311,6 @@ def __init__(self, trackball, **kwargs): super().__init__(1, **kwargs) def deinit(self): - super().deinit() self.trackball.set_rgbw(0, 0, 0, 0) def _transmit(self, b): diff --git a/firmware/kmk/modules/split.py b/firmware/kmk/modules/split.py index 2d5b4a0..164a9a2 100755 --- a/firmware/kmk/modules/split.py +++ b/firmware/kmk/modules/split.py @@ -1,4 +1,5 @@ '''Enables splitting keyboards wirelessly or wired''' + import busio from micropython import const from supervisor import runtime, ticks_ms diff --git a/firmware/kmk/quickpin/pro_micro/liatris.py b/firmware/kmk/quickpin/pro_micro/liatris.py new file mode 100755 index 0000000..b65af7e --- /dev/null +++ b/firmware/kmk/quickpin/pro_micro/liatris.py @@ -0,0 +1,43 @@ +import board + +pinout = [ + # Left, top->bottom + board.TX, + board.RX, + None, # GND + None, # GND + board.SDA, + board.SCL, + board.D4, + board.D5, # C6 + board.D6, # D7 + board.D7, # E6 + board.D8, # B4 + board.D9, # B5 + # Right, bottom->top + board.D21, # B6 + board.D23, # B2 + board.D20, # B3 + board.D22, # B1 + board.D26, # F7 + board.D27, # F6 + board.D28, # F5 + board.D29, # F4 + None, # 3.3v + None, # RST + None, # GND + None, # RAW + # Bottom, left->right + board.D12, + board.D13, + board.D14, + board.D15, + board.D16, + # Internal + board.NEOPIXEL, + board.VBUS_SENSE, + board.POWER_LED, + board.I2C, + board.SPI, + board.UART, +] diff --git a/firmware/kmk/scanners/digitalio.py b/firmware/kmk/scanners/digitalio.py index 43345fe..73ffb61 100755 --- a/firmware/kmk/scanners/digitalio.py +++ b/firmware/kmk/scanners/digitalio.py @@ -5,6 +5,16 @@ from kmk.scanners import DiodeOrientation, Scanner +def ensure_DIO(x): + # __class__.__name__ is used instead of isinstance as the MCP230xx lib + # does not use the digitalio.DigitalInOut, but rather a self defined one: + # https://github.com/adafruit/Adafruit_CircuitPython_MCP230xx/blob/3f04abbd65ba5fa938fcb04b99e92ae48a8c9406/adafruit_mcp230xx/digital_inout.py#L33 + if x.__class__.__name__ == 'DigitalInOut': + return x + else: + return digitalio.DigitalInOut(x) + + class MatrixScanner(Scanner): def __init__( self, @@ -32,37 +42,13 @@ def __init__( self.diode_orientation = diode_orientation - # __class__.__name__ is used instead of isinstance as the MCP230xx lib - # does not use the digitalio.DigitalInOut, but rather a self defined one: - # https://github.com/adafruit/Adafruit_CircuitPython_MCP230xx/blob/3f04abbd65ba5fa938fcb04b99e92ae48a8c9406/adafruit_mcp230xx/digital_inout.py#L33 - if self.diode_orientation == DiodeOrientation.COL2ROW: - self.anodes = [ - x - if x.__class__.__name__ == 'DigitalInOut' - else digitalio.DigitalInOut(x) - for x in cols - ] - self.cathodes = [ - x - if x.__class__.__name__ == 'DigitalInOut' - else digitalio.DigitalInOut(x) - for x in rows - ] + self.anodes = [ensure_DIO(x) for x in cols] + self.cathodes = [ensure_DIO(x) for x in rows] self.translate_coords = True elif self.diode_orientation == DiodeOrientation.ROW2COL: - self.anodes = [ - x - if x.__class__.__name__ == 'DigitalInOut' - else digitalio.DigitalInOut(x) - for x in rows - ] - self.cathodes = [ - x - if x.__class__.__name__ == 'DigitalInOut' - else digitalio.DigitalInOut(x) - for x in cols - ] + self.anodes = [ensure_DIO(x) for x in rows] + self.cathodes = [ensure_DIO(x) for x in cols] self.translate_coords = False else: raise ValueError(f'Invalid DiodeOrientation: {self.diode_orienttaion}') diff --git a/firmware/kmk/transports/pio_uart.py b/firmware/kmk/transports/pio_uart.py index 0b30df6..108d9b4 100755 --- a/firmware/kmk/transports/pio_uart.py +++ b/firmware/kmk/transports/pio_uart.py @@ -2,6 +2,7 @@ Circuit Python wrapper around PIO implementation of UART Original source of these examples: https://github.com/adafruit/Adafruit_CircuitPython_PIOASM/tree/main/examples (MIT) ''' + import rp2pio from array import array diff --git a/firmware/main.py b/firmware/main.py index 57ad427..88f8c0d 100755 --- a/firmware/main.py +++ b/firmware/main.py @@ -1,8 +1,4 @@ -import board -import digitalio - from kb import KMKKeyboard -from storage import getmount from kmk.keys import KC from kmk.modules.layers import Layers @@ -13,9 +9,6 @@ layers = Layers() -# data_pin = board.GP1 if split_side == SplitSide.LEFT else board.GP0 -# data_pin2 = board.GP0 if split_side == SplitSide.LEFT else board.GP1 - layers_ext = Layers() layers_ext.tap_time = 100 @@ -26,23 +19,23 @@ # _______ = KC.TRNS # XXXXXXX = KC.NO -# LYR_LOWER = 1 -# LYR_RAISE = 2 -# LOWER = KC.MO(LYR_LOWER) -# RAISE = KC.MO(LYR_RAISE) -# ADJUST = KC.LT(3, KC.SPC) - -# MT_RSEN = KC.MT(KC.ENT, KC.RSFT) -# KC_LRGR = KC.LT(LYR_LOWER, KC.GRV) -# KC_RSSP = KC.LT(LYR_RAISE, KC.SPC) +LAYER_ALT = 1 +KCALT = KC.LT(LAYER_ALT, KC.SPC) keyboard.keymap = [ - [ #QWERTY + [ KC.A, KC.B, KC.C, KC.D, KC.E, KC.F, KC.J, KC.K, KC.L, KC.M, KC.N, KC.O, KC.P, KC.Q, KC.R, KC.S, - KC.T, KC.U, KC.V, KC.W, + KCALT, KC.U, KC.V, KC.W, + ], + [ + KC.N1, KC.N2, KC.N3, KC.N4, + KC.N5, KC.N6, KC.N7, KC.N8, + KC.N9, KC.N0, KC.LBRACKET, KC.RBRACKET, + KC.QUOTE, KC.COMMA, KC.GRAVE, KC.DOT, + KC.SLASH, KC.MINUS, KC.EQUAL, KC.ENTER, ], ]