CMDR Keyboard (swedish layout)
This HW(PCB) was original made for use with the TeensyLC module and is reused by patching it to fit the rp2040-zero module
Layout
Layer 0
--------------------------------------- ---------------------------------------
| Tab | Q | W | E | R | T | | Y | U | I | O | P | Å |
| LCtrl | A | S | D | F | G | | H | J | K | L | Ö | Ä |
| Shift | Z | X | C | V | B | | N | M | ,; | .: | -_ | Shift |
--------------------| Alt | Fn | Spc | |Enter| Fn |AG+Fn|--------------------
------------------- -------------------
Layer 1 (Fn)
--------------------------------------- ---------------------------------------
| Esc | F1 | F2 | F3 | F4 | F5 | | F6 | F7 | F8 | F9 | F10 | BSpc |
| LCtrl | 1! | 2"@ | 3#£ | 4¤$ | 5% | | 6& | 7/{ | 8([ | 9)] | 0=} | Enter |
| Shift | 6& | 7/{ | 8([ | 9)] | 0=} | | <>| | ´`± | '*´ | ¨^~ | +?\ | Shift |
--------------------| Alt | Fn | Spc | | BSpc| Fn |AG+Fn|--------------------
------------------- -------------------
Layer 2 (Fn + Fn)
--------------------------------------- ---------------------------------------
| Esc | F11 | F12 | F13 | F14 |PrSrc| | § | SLk | Gui | OSLk| CpLk| BSpc |
| LCtrl | F15 | F16 | F17 | F18 | F19 | | Left| Down| Up |Right| Del | Enter |
| Shift | F20 | F21 | F22 | F23 | F24 | | Home| PgD | PgU | End | Ins | Shift |
--------------------| Alt | Fn | Spc | | BSpc| Fn |AG+Fn|--------------------
------------------- -------------------
Firmware features
- 42 key split layout (36 finger keys + 6 thumb keys) with a Swedish-centric NKRO HID mapping across three layers.
- Function layer system with two Fn keys (40/43/44) enabling sticky lock, OS lock and deep modifier combos without ghosting.
- High-speed matrix scanning (250 µs cadence) with scan-based debounce, per-key press spacing protection and idle/suspend rate throttling.
- Bootloader entry options including
Fn+Fn+LCtrl+LShift+RShiftruntime chord and power-on detection on button index 0. - Status LED heartbeat carried over from the earlier CMDR firmware: startup heartbeat, activity/idle transitions, sticky-state colors, Caps Lock flash, suspend blanking and error signalling.
- Power-aware USB handling that drops scan frequency 20× during suspend while honouring wake-on-input and immediate resume.
Development workflow
Recurring tasks are defined in the root Justfile:
- Build-check the embedded target:
just check - Run host-side tests:
just test - Remove build artifacts:
just clean - Build and copy a UF2 to a mounted RP2040:
just flash(auto-detects/Volumes/*,/media/*,/run/media/*; override withmount=/pathand optionaltimeout=30seconds) - Build, then transfer a UF2 over SSH:
just flash-ssh target=user@host mount=/media/user/RPI-RP2
The flash recipes rely on python3, the bundled rp2040/uf2conv.py, tools/copy_uf2.py, and cargo objcopy (install with rustup component add llvm-tools-preview and cargo install cargo-binutils). For SSH transfers you also need passwordless access or supply a key path, e.g. just flash-ssh target=user@host mount=/media/user/RPI-RP2 key=~/.ssh/id_ed25519.
Build environment rp2040 Zero
Rust embedded, rp2040 HAL
- Cargo (cargo.toml)
- rustup target add thumbv6m-none-eabi
- Use install script to flash device
- Flashing via rp2040 USB bootloader
- Pressing reset/boot button on rp2040 Zero board
- Pressing upper left corner on the keyboard when connecting the usb cable
- Pressing Fn+Fn+Shift+Shift+Ctrl
Hardware
- 1x rp2040 Zero
- 36x Cherry MX compatible switches
- 6x Kailh Choc low profile switches
- 42x 1N4148 diodes
- 1x PCB Gerber files (please see patch instructions)
- 1x MCU cover STL file
- 1x 6x3 Cherry MX mounting jig (optional) STL file
Languages
Rust
79.2%
Python
17.9%
Just
2.9%
