# CMDR keyboard 42 (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_ ![image](keyboard_42_green.jpg) ## Layout ```text 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+RShift` runtime chord and power-on detection on button index 0. - Status LED heartbeat derived from joystick 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. ## Install script (`install.sh`) The repository includes a host automation helper for the RP2040 firmware. - Quick start: `./install.sh check` (compilation + clippy) or `./install.sh test` (full suite including host-side tests). - Flashing: `./install.sh flash --local` for direct UF2 copy on Linux/macOS, or `./install.sh flash --ssh --target user@host --mount /path` for remote deployments. - Cleaning: `./install.sh clean` removes cargo artefacts, generated binaries and UF2 images. - Prerequisites are validated automatically (Rust toolchain, `thumbv6m-none-eabi`, `cargo-binutils`, `uf2conv.py`, optional SSH settings). - Script output uses colour-coded sections for readability and fails fast on missing dependencies or connectivity issues. ## 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 [Schematics](eCAD/cmdr_mainboard_42_v1.pdf) [patch instruction](/eCAD/rp2040_42_patch_instruction.md) - 1x rp2040 Zero - 36x Cherry MX compatible switches - 6x Kailh Choc low profile switches - 42x 1N4148 diodes - 1x PCB [Gerber files](eCAD/cmdr_mainboard_42_gerber_v1.zip) (please see [patch instructions](/eCAD/rp2040_42_patch_instruction.md)) - 1x MCU cover [STL file](mCAD/cmdr_keyboard_42_cover.stl) - 1x 6x3 Cherry MX mounting jig (optional) [STL file](mCAD/cmdr_mounting_jig-MountingJig.stl) ---