From 1771bf38619e861e683c04c606105346d54bec0a Mon Sep 17 00:00:00 2001 From: Christoffer Martinsson Date: Sun, 17 Nov 2024 15:12:06 +0100 Subject: [PATCH] Updated file scrtucture. Updated layout for 52 key version --- .gitignore | 3 + README.md | 40 +- .../cmdr_mainboard.kicad_prl | 8 + .../cmdr_mainboard.kicad_pro | 36 +- eCAD/cmdr-keyboard-mainboard-42/fp-info-cache | 2326 ++++++++--------- rp2040_42/.cargo/config | 42 + rp2040_42/Cargo.toml | 54 + rp2040_42/memory.x | 15 + rp2040_42/pico-load | 12 + rp2040_42/src/button_matrix.rs | 98 + rp2040_42/src/layout.rs | 203 ++ rp2040_42/src/main.rs | 379 +++ rp2040_42/src/status_led.rs | 142 + rp2040_51/Cargo.lock | 595 +++++ rp2040_51/src/button_matrix.rs | 2 +- rp2040_51/src/layout.rs | 106 +- rp2040_51/src/main.rs | 27 +- rp2040_51/src/status_led.rs | 2 +- 18 files changed, 2847 insertions(+), 1243 deletions(-) create mode 100644 rp2040_42/.cargo/config create mode 100644 rp2040_42/Cargo.toml create mode 100644 rp2040_42/memory.x create mode 100755 rp2040_42/pico-load create mode 100644 rp2040_42/src/button_matrix.rs create mode 100644 rp2040_42/src/layout.rs create mode 100644 rp2040_42/src/main.rs create mode 100644 rp2040_42/src/status_led.rs create mode 100644 rp2040_51/Cargo.lock diff --git a/.gitignore b/.gitignore index a49e1f5..798a280 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,6 @@ teensylc/.ccls-cache teensylc/.pio/build eCAD/cmdr-keyboard-mainboard-42/cmdr_mainboard-backups eCAD/cmdr-keyboard-mainboard-51/cmdr_mainboard-backups +rp2040_51/target/debug +rp2040_51/target/thumbv6m-none-eabi/debug +rp2040_51/target diff --git a/README.md b/README.md index 18e4db4..b6f3b89 100644 --- a/README.md +++ b/README.md @@ -4,28 +4,28 @@ ## Layout -```cpp +```text Layer 0 - --------------------------------------------- --------------------------------------------- - | Tab | Q | W | E | R | T | F1 | | F4 | Y | U | I | O | P | Å | - | LCtrl | A | S | D | F | G | F2 | | F5 | H | J | K | L | Ö | Ä | - | Shift | Z | X | C | V | B | F3 |-----| F6 | N | M | , | . | - | Shift | - --------------------| Alt | Fn | Spc | BSpc| Gui |Enter| Spc | Fn |AG+Fn|-------------------- - ------------------------------------------------------- + -------------------------------------- ------ ------ -------------------------------------- + | Tab | Q | W | E | R | T || Lck | |PrSrc|| Y | U | I | O | P | Å | + | LCtrl | A | S | D | F | G || M2 | | M5 || H | J | K | L | Ö | Ä | + | Shift | Z | X | C | V | B || M3 |-----| M6 || N | M | ,; | .: | -_ | Shift | + --------------------| Alt | Fn | Spc || BSpc| Gui |Enter|| Spc | Fn |AG+Fn|-------------------- + ------------------ ----------------- ------------------ Layer 1 (Fn) - --------------------------------------------- --------------------------------------------- - | Esc | F1 | F2 | F3 | F4 | F5 | F1 | | F4 | F6 | F7 | F8 | F9 | F10 | | - | LCtrl | 1 | 2 | 3 | 4 | 5 | F2 | | F5 | 6 | 7 | 8 | 9 | 0 | | - | Shift | 6 | 7 | 8 | 9 | 0 | F3 |-----| F6 | < | ´ | ' | ¨ | + | Shift | - --------------------| Alt | Fn | Spc | BSpc| Gui |Enter| Spc | Fn |AG+Fn|-------------------- - ------------------------------------------------------- + -------------------------------------- ------ ------ -------------------------------------- + | Esc | F1 | F2 | F3 | F4 | F5 || M1 | | M4 || F6 | F7 | F8 | F9 | F10 | Del | + | LCtrl | 1! | 2"@ | 3#£ | 4¤$ | 5% || M2 | | M5 || 6& | 7/{ | 8([ | 9)] | 0=} | Enter | + | Shift | 6& | 7/{ | 8([ | 9)] | 0=} || M3 |-----| M6 || <>| | ´`± | '*´ | ¨^~ | +?\ | Shift | + --------------------| Alt | Fn | Spc || BSpc| Gui |Enter|| Spc | Fn |AG+Fn|-------------------- + ------------------ ----------------- ------------------ Layer 2 (Fn + Fn) - --------------------------------------------- --------------------------------------------- - | F11 | F12 | F13 | F14 | F15 | F16 | F1 | | F4 | § |GuiLK| | | CpLk| | - | LCtrl | | | F17 | F18 | F19 | F2 | | F5 | Left| Down| Up |Right| Del | | - | Shift | F20 | F21 | F22 | F23 | F24 | F3 |-----| F6 | Home| PgD | PgU | End | Ins | Shift | - --------------------| Alt | Fn | Spc | BSpc| Gui |Enter| Spc | Fn |AG+Fn|-------------------- - ------------------------------------------------------- + -------------------------------------- ------ ------ -------------------------------------- + | Esc | F11 | F12 | F13 | F14 | || M1 | | M4 || § | | | | CpLk| Del | + | LCtrl | F15 | F16 | F17 | F18 | F19 || M2 | | M5 || Left| Down| Up |Right| | Enter | + | Shift | F20 | F21 | F22 | F23 | F24 || M3 |-----| M6 || Home| PgD | PgU | End | Ins | Shift | + --------------------| Alt | Fn | Spc || BSpc| Gui |Enter|| Spc | Fn |AG+Fn|-------------------- + ------------------ ----------------- ------------------ ``` ## Features @@ -67,7 +67,7 @@ Rust embedded, rp2040 HAL ## Layout -```cpp +```text Layer 0 --------------------------------------- --------------------------------------- | Tab | Q | W | E | R | T | | Y | U | I | O | P | Å | diff --git a/eCAD/cmdr-keyboard-mainboard-42/cmdr_mainboard.kicad_prl b/eCAD/cmdr-keyboard-mainboard-42/cmdr_mainboard.kicad_prl index ef5d262..c6394eb 100644 --- a/eCAD/cmdr-keyboard-mainboard-42/cmdr_mainboard.kicad_prl +++ b/eCAD/cmdr-keyboard-mainboard-42/cmdr_mainboard.kicad_prl @@ -3,10 +3,12 @@ "active_layer": 31, "active_layer_preset": "", "auto_track_width": true, + "hidden_netclasses": [], "hidden_nets": [], "high_contrast_mode": 0, "net_color_mode": 1, "opacity": { + "images": 0.6, "pads": 1.0, "tracks": 1.0, "vias": 1.0, @@ -67,6 +69,12 @@ "visible_layers": "fffffff_ffffffff", "zone_display_mode": 0 }, + "git": { + "repo_password": "", + "repo_type": "", + "repo_username": "", + "ssh_key": "" + }, "meta": { "filename": "cmdr_mainboard.kicad_prl", "version": 3 diff --git a/eCAD/cmdr-keyboard-mainboard-42/cmdr_mainboard.kicad_pro b/eCAD/cmdr-keyboard-mainboard-42/cmdr_mainboard.kicad_pro index 4133d04..f619100 100644 --- a/eCAD/cmdr-keyboard-mainboard-42/cmdr_mainboard.kicad_pro +++ b/eCAD/cmdr-keyboard-mainboard-42/cmdr_mainboard.kicad_pro @@ -1,5 +1,6 @@ { "board": { + "3dviewports": [], "design_settings": { "defaults": { "board_outline_line_width": 0.049999999999999996, @@ -131,7 +132,15 @@ "zones_allow_external_fillets": false, "zones_use_no_outline": true }, - "layer_presets": [] + "ipc2581": { + "dist": "", + "distpn": "", + "internal_id": "", + "mfg": "", + "mpn": "" + }, + "layer_presets": [], + "viewports": [] }, "boards": [], "cvpcb": { @@ -353,7 +362,7 @@ "net_settings": { "classes": [ { - "bus_width": 12.0, + "bus_width": 12, "clearance": 0.2, "diff_pair_gap": 0.25, "diff_pair_via_gap": 0.25, @@ -367,10 +376,10 @@ "track_width": 0.25, "via_diameter": 0.8, "via_drill": 0.4, - "wire_width": 6.0 + "wire_width": 6 }, { - "bus_width": 12.0, + "bus_width": 12, "clearance": 0.2, "diff_pair_gap": 0.25, "diff_pair_via_gap": 0.25, @@ -379,29 +388,36 @@ "microvia_diameter": 0.3, "microvia_drill": 0.1, "name": "Power", - "nets": [ - "+5V" - ], "pcb_color": "rgba(0, 0, 0, 0.000)", "schematic_color": "rgba(0, 0, 0, 0.000)", "track_width": 0.5, "via_diameter": 0.8, "via_drill": 0.4, - "wire_width": 6.0 + "wire_width": 6 } ], "meta": { - "version": 2 + "version": 3 }, - "net_colors": null + "net_colors": null, + "netclass_assignments": null, + "netclass_patterns": [ + { + "netclass": "Power", + "pattern": "+5V" + } + ] }, "pcbnew": { "last_paths": { "gencad": "", "idf": "", "netlist": "", + "plot": "", + "pos_files": "", "specctra_dsn": "", "step": "../../mechanics/cmdr_mainboard.step", + "svg": "", "vrml": "" }, "page_layout_descr_file": "" diff --git a/eCAD/cmdr-keyboard-mainboard-42/fp-info-cache b/eCAD/cmdr-keyboard-mainboard-42/fp-info-cache index 659142f..b6262ba 100644 --- a/eCAD/cmdr-keyboard-mainboard-42/fp-info-cache +++ b/eCAD/cmdr-keyboard-mainboard-42/fp-info-cache @@ -1,1163 +1,1163 @@ -275360114319497 -MountingHole -MountingHole_2.1mm -Mounting Hole 2.1mm, no annular -mounting hole 2.1mm no annular -0 -0 -0 -MountingHole -MountingHole_2.2mm_M2 -Mounting Hole 2.2mm, no annular, M2 -mounting hole 2.2mm no annular m2 -0 -0 -0 -MountingHole -MountingHole_2.2mm_M2_DIN965 -Mounting Hole 2.2mm, no annular, M2, DIN965 -mounting hole 2.2mm no annular m2 din965 -0 -0 -0 -MountingHole -MountingHole_2.2mm_M2_DIN965_Pad -Mounting Hole 2.2mm, M2, DIN965 -mounting hole 2.2mm m2 din965 -0 -1 -1 -MountingHole -MountingHole_2.2mm_M2_DIN965_Pad_TopBottom -Mounting Hole 2.2mm, M2, DIN965 -mounting hole 2.2mm m2 din965 -0 -3 -1 -MountingHole -MountingHole_2.2mm_M2_DIN965_Pad_TopOnly -Mounting Hole 2.2mm, M2, DIN965 -mounting hole 2.2mm m2 din965 -0 -2 -1 -MountingHole -MountingHole_2.2mm_M2_ISO7380 -Mounting Hole 2.2mm, no annular, M2, ISO7380 -mounting hole 2.2mm no annular m2 iso7380 -0 -0 -0 -MountingHole -MountingHole_2.2mm_M2_ISO7380_Pad -Mounting Hole 2.2mm, M2, ISO7380 -mounting hole 2.2mm m2 iso7380 -0 -1 -1 -MountingHole -MountingHole_2.2mm_M2_ISO7380_Pad_TopBottom -Mounting Hole 2.2mm, M2, ISO7380 -mounting hole 2.2mm m2 iso7380 -0 -3 -1 -MountingHole -MountingHole_2.2mm_M2_ISO7380_Pad_TopOnly -Mounting Hole 2.2mm, M2, ISO7380 -mounting hole 2.2mm m2 iso7380 -0 -2 -1 -MountingHole -MountingHole_2.2mm_M2_ISO14580 -Mounting Hole 2.2mm, no annular, M2, ISO14580 -mounting hole 2.2mm no annular m2 iso14580 -0 -0 -0 -MountingHole -MountingHole_2.2mm_M2_ISO14580_Pad -Mounting Hole 2.2mm, M2, ISO14580 -mounting hole 2.2mm m2 iso14580 -0 -1 -1 -MountingHole -MountingHole_2.2mm_M2_ISO14580_Pad_TopBottom -Mounting Hole 2.2mm, M2, ISO14580 -mounting hole 2.2mm m2 iso14580 -0 -3 -1 -MountingHole -MountingHole_2.2mm_M2_ISO14580_Pad_TopOnly -Mounting Hole 2.2mm, M2, ISO14580 -mounting hole 2.2mm m2 iso14580 -0 -2 -1 -MountingHole -MountingHole_2.2mm_M2_Pad -Mounting Hole 2.2mm, M2 -mounting hole 2.2mm m2 -0 -1 -1 -MountingHole -MountingHole_2.2mm_M2_Pad_TopBottom -Mounting Hole 2.2mm, M2 -mounting hole 2.2mm m2 -0 -3 -1 -MountingHole -MountingHole_2.2mm_M2_Pad_TopOnly -Mounting Hole 2.2mm, M2 -mounting hole 2.2mm m2 -0 -2 -1 -MountingHole -MountingHole_2.2mm_M2_Pad_Via -Mounting Hole 2.2mm, M2 -mounting hole 2.2mm m2 -0 -9 -1 -MountingHole -MountingHole_2.5mm -Mounting Hole 2.5mm, no annular -mounting hole 2.5mm no annular -0 -0 -0 -MountingHole -MountingHole_2.5mm_Pad -Mounting Hole 2.5mm -mounting hole 2.5mm -0 -1 -1 -MountingHole -MountingHole_2.5mm_Pad_TopBottom -Mounting Hole 2.5mm -mounting hole 2.5mm -0 -3 -1 -MountingHole -MountingHole_2.5mm_Pad_TopOnly -Mounting Hole 2.5mm -mounting hole 2.5mm -0 -2 -1 -MountingHole -MountingHole_2.5mm_Pad_Via -Mounting Hole 2.5mm -mounting hole 2.5mm -0 -9 -1 -MountingHole -MountingHole_2.7mm -Mounting Hole 2.7mm, no annular -mounting hole 2.7mm no annular -0 -0 -0 -MountingHole -MountingHole_2.7mm_M2.5 -Mounting Hole 2.7mm, no annular, M2.5 -mounting hole 2.7mm no annular m2.5 -0 -0 -0 -MountingHole -MountingHole_2.7mm_M2.5_DIN965 -Mounting Hole 2.7mm, no annular, M2.5, DIN965 -mounting hole 2.7mm no annular m2.5 din965 -0 -0 -0 -MountingHole -MountingHole_2.7mm_M2.5_DIN965_Pad -Mounting Hole 2.7mm, M2.5, DIN965 -mounting hole 2.7mm m2.5 din965 -0 -1 -1 -MountingHole -MountingHole_2.7mm_M2.5_DIN965_Pad_TopBottom -Mounting Hole 2.7mm, M2.5, DIN965 -mounting hole 2.7mm m2.5 din965 -0 -3 -1 -MountingHole -MountingHole_2.7mm_M2.5_DIN965_Pad_TopOnly -Mounting Hole 2.7mm, M2.5, DIN965 -mounting hole 2.7mm m2.5 din965 -0 -2 -1 -MountingHole -MountingHole_2.7mm_M2.5_ISO7380 -Mounting Hole 2.7mm, no annular, M2.5, ISO7380 -mounting hole 2.7mm no annular m2.5 iso7380 -0 -0 -0 -MountingHole -MountingHole_2.7mm_M2.5_ISO7380_Pad -Mounting Hole 2.7mm, M2.5, ISO7380 -mounting hole 2.7mm m2.5 iso7380 -0 -1 -1 -MountingHole -MountingHole_2.7mm_M2.5_ISO7380_Pad_TopBottom -Mounting Hole 2.7mm, M2.5, ISO7380 -mounting hole 2.7mm m2.5 iso7380 -0 -3 -1 -MountingHole -MountingHole_2.7mm_M2.5_ISO7380_Pad_TopOnly -Mounting Hole 2.7mm, M2.5, ISO7380 -mounting hole 2.7mm m2.5 iso7380 -0 -2 -1 -MountingHole -MountingHole_2.7mm_M2.5_ISO14580 -Mounting Hole 2.7mm, no annular, M2.5, ISO14580 -mounting hole 2.7mm no annular m2.5 iso14580 -0 -0 -0 -MountingHole -MountingHole_2.7mm_M2.5_ISO14580_Pad -Mounting Hole 2.7mm, M2.5, ISO14580 -mounting hole 2.7mm m2.5 iso14580 -0 -1 -1 -MountingHole -MountingHole_2.7mm_M2.5_ISO14580_Pad_TopBottom -Mounting Hole 2.7mm, M2.5, ISO14580 -mounting hole 2.7mm m2.5 iso14580 -0 -3 -1 -MountingHole -MountingHole_2.7mm_M2.5_ISO14580_Pad_TopOnly -Mounting Hole 2.7mm, M2.5, ISO14580 -mounting hole 2.7mm m2.5 iso14580 -0 -2 -1 -MountingHole -MountingHole_2.7mm_M2.5_Pad -Mounting Hole 2.7mm, M2.5 -mounting hole 2.7mm m2.5 -0 -1 -1 -MountingHole -MountingHole_2.7mm_M2.5_Pad_TopBottom -Mounting Hole 2.7mm, M2.5 -mounting hole 2.7mm m2.5 -0 -3 -1 -MountingHole -MountingHole_2.7mm_M2.5_Pad_TopOnly -Mounting Hole 2.7mm, M2.5 -mounting hole 2.7mm m2.5 -0 -2 -1 -MountingHole -MountingHole_2.7mm_M2.5_Pad_Via -Mounting Hole 2.7mm -mounting hole 2.7mm -0 -9 -1 -MountingHole -MountingHole_2.7mm_Pad -Mounting Hole 2.7mm -mounting hole 2.7mm -0 -1 -1 -MountingHole -MountingHole_2.7mm_Pad_TopBottom -Mounting Hole 2.7mm -mounting hole 2.7mm -0 -3 -1 -MountingHole -MountingHole_2.7mm_Pad_TopOnly -Mounting Hole 2.7mm -mounting hole 2.7mm -0 -2 -1 -MountingHole -MountingHole_2.7mm_Pad_Via -Mounting Hole 2.7mm -mounting hole 2.7mm -0 -9 -1 -MountingHole -MountingHole_2mm -Mounting Hole 2mm, no annular -mounting hole 2mm no annular -0 -0 -0 -MountingHole -MountingHole_3.2mm_M3 -Mounting Hole 3.2mm, no annular, M3 -mounting hole 3.2mm no annular m3 -0 -0 -0 -MountingHole -MountingHole_3.2mm_M3_DIN965 -Mounting Hole 3.2mm, no annular, M3, DIN965 -mounting hole 3.2mm no annular m3 din965 -0 -0 -0 -MountingHole -MountingHole_3.2mm_M3_DIN965_Pad -Mounting Hole 3.2mm, M3, DIN965 -mounting hole 3.2mm m3 din965 -0 -1 -1 -MountingHole -MountingHole_3.2mm_M3_DIN965_Pad_TopBottom -Mounting Hole 3.2mm, M3, DIN965 -mounting hole 3.2mm m3 din965 -0 -3 -1 -MountingHole -MountingHole_3.2mm_M3_DIN965_Pad_TopOnly -Mounting Hole 3.2mm, M3, DIN965 -mounting hole 3.2mm m3 din965 -0 -2 -1 -MountingHole -MountingHole_3.2mm_M3_ISO7380 -Mounting Hole 3.2mm, no annular, M3, ISO7380 -mounting hole 3.2mm no annular m3 iso7380 -0 -0 -0 -MountingHole -MountingHole_3.2mm_M3_ISO7380_Pad -Mounting Hole 3.2mm, M3, ISO7380 -mounting hole 3.2mm m3 iso7380 -0 -1 -1 -MountingHole -MountingHole_3.2mm_M3_ISO7380_Pad_TopBottom -Mounting Hole 3.2mm, M3, ISO7380 -mounting hole 3.2mm m3 iso7380 -0 -3 -1 -MountingHole -MountingHole_3.2mm_M3_ISO7380_Pad_TopOnly -Mounting Hole 3.2mm, M3, ISO7380 -mounting hole 3.2mm m3 iso7380 -0 -2 -1 -MountingHole -MountingHole_3.2mm_M3_ISO14580 -Mounting Hole 3.2mm, no annular, M3, ISO14580 -mounting hole 3.2mm no annular m3 iso14580 -0 -0 -0 -MountingHole -MountingHole_3.2mm_M3_ISO14580_Pad -Mounting Hole 3.2mm, M3, ISO14580 -mounting hole 3.2mm m3 iso14580 -0 -1 -1 -MountingHole -MountingHole_3.2mm_M3_ISO14580_Pad_TopBottom -Mounting Hole 3.2mm, M3, ISO14580 -mounting hole 3.2mm m3 iso14580 -0 -3 -1 -MountingHole -MountingHole_3.2mm_M3_ISO14580_Pad_TopOnly -Mounting Hole 3.2mm, M3, ISO14580 -mounting hole 3.2mm m3 iso14580 -0 -2 -1 -MountingHole -MountingHole_3.2mm_M3_Pad -Mounting Hole 3.2mm, M3 -mounting hole 3.2mm m3 -0 -1 -1 -MountingHole -MountingHole_3.2mm_M3_Pad_TopBottom -Mounting Hole 3.2mm, M3 -mounting hole 3.2mm m3 -0 -3 -1 -MountingHole -MountingHole_3.2mm_M3_Pad_TopOnly -Mounting Hole 3.2mm, M3 -mounting hole 3.2mm m3 -0 -2 -1 -MountingHole -MountingHole_3.2mm_M3_Pad_Via -Mounting Hole 3.2mm, M3 -mounting hole 3.2mm m3 -0 -9 -1 -MountingHole -MountingHole_3.5mm -Mounting Hole 3.5mm, no annular -mounting hole 3.5mm no annular -0 -0 -0 -MountingHole -MountingHole_3.5mm_Pad -Mounting Hole 3.5mm -mounting hole 3.5mm -0 -1 -1 -MountingHole -MountingHole_3.5mm_Pad_TopBottom -Mounting Hole 3.5mm -mounting hole 3.5mm -0 -3 -1 -MountingHole -MountingHole_3.5mm_Pad_TopOnly -Mounting Hole 3.5mm -mounting hole 3.5mm -0 -2 -1 -MountingHole -MountingHole_3.5mm_Pad_Via -Mounting Hole 3.5mm -mounting hole 3.5mm -0 -9 -1 -MountingHole -MountingHole_3.7mm -Mounting Hole 3.7mm, no annular -mounting hole 3.7mm no annular -0 -0 -0 -MountingHole -MountingHole_3.7mm_Pad -Mounting Hole 3.7mm -mounting hole 3.7mm -0 -1 -1 -MountingHole -MountingHole_3.7mm_Pad_TopBottom -Mounting Hole 3.7mm -mounting hole 3.7mm -0 -3 -1 -MountingHole -MountingHole_3.7mm_Pad_TopOnly -Mounting Hole 3.7mm -mounting hole 3.7mm -0 -2 -1 -MountingHole -MountingHole_3.7mm_Pad_Via -Mounting Hole 3.7mm -mounting hole 3.7mm -0 -9 -1 -MountingHole -MountingHole_3mm -Mounting Hole 3mm, no annular -mounting hole 3mm no annular -0 -0 -0 -MountingHole -MountingHole_3mm_Pad -Mounting Hole 3mm -mounting hole 3mm -0 -1 -1 -MountingHole -MountingHole_3mm_Pad_TopBottom -Mounting Hole 3mm -mounting hole 3mm -0 -3 -1 -MountingHole -MountingHole_3mm_Pad_TopOnly -Mounting Hole 3mm -mounting hole 3mm -0 -2 -1 -MountingHole -MountingHole_3mm_Pad_Via -Mounting Hole 3mm -mounting hole 3mm -0 -9 -1 -MountingHole -MountingHole_4.3mm_M4 -Mounting Hole 4.3mm, no annular, M4 -mounting hole 4.3mm no annular m4 -0 -0 -0 -MountingHole -MountingHole_4.3mm_M4_DIN965 -Mounting Hole 4.3mm, no annular, M4, DIN965 -mounting hole 4.3mm no annular m4 din965 -0 -0 -0 -MountingHole -MountingHole_4.3mm_M4_DIN965_Pad -Mounting Hole 4.3mm, M4, DIN965 -mounting hole 4.3mm m4 din965 -0 -1 -1 -MountingHole -MountingHole_4.3mm_M4_DIN965_Pad_TopBottom -Mounting Hole 4.3mm, M4, DIN965 -mounting hole 4.3mm m4 din965 -0 -3 -1 -MountingHole -MountingHole_4.3mm_M4_DIN965_Pad_TopOnly -Mounting Hole 4.3mm, M4, DIN965 -mounting hole 4.3mm m4 din965 -0 -2 -1 -MountingHole -MountingHole_4.3mm_M4_ISO7380 -Mounting Hole 4.3mm, no annular, M4, ISO7380 -mounting hole 4.3mm no annular m4 iso7380 -0 -0 -0 -MountingHole -MountingHole_4.3mm_M4_ISO7380_Pad -Mounting Hole 4.3mm, M4, ISO7380 -mounting hole 4.3mm m4 iso7380 -0 -1 -1 -MountingHole -MountingHole_4.3mm_M4_ISO7380_Pad_TopBottom -Mounting Hole 4.3mm, M4, ISO7380 -mounting hole 4.3mm m4 iso7380 -0 -3 -1 -MountingHole -MountingHole_4.3mm_M4_ISO7380_Pad_TopOnly -Mounting Hole 4.3mm, M4, ISO7380 -mounting hole 4.3mm m4 iso7380 -0 -2 -1 -MountingHole -MountingHole_4.3mm_M4_ISO14580 -Mounting Hole 4.3mm, no annular, M4, ISO14580 -mounting hole 4.3mm no annular m4 iso14580 -0 -0 -0 -MountingHole -MountingHole_4.3mm_M4_ISO14580_Pad -Mounting Hole 4.3mm, M4, ISO14580 -mounting hole 4.3mm m4 iso14580 -0 -1 -1 -MountingHole -MountingHole_4.3mm_M4_ISO14580_Pad_TopBottom -Mounting Hole 4.3mm, M4, ISO14580 -mounting hole 4.3mm m4 iso14580 -0 -3 -1 -MountingHole -MountingHole_4.3mm_M4_ISO14580_Pad_TopOnly -Mounting Hole 4.3mm, M4, ISO14580 -mounting hole 4.3mm m4 iso14580 -0 -2 -1 -MountingHole -MountingHole_4.3mm_M4_Pad -Mounting Hole 4.3mm, M4 -mounting hole 4.3mm m4 -0 -1 -1 -MountingHole -MountingHole_4.3mm_M4_Pad_TopBottom -Mounting Hole 4.3mm, M4 -mounting hole 4.3mm m4 -0 -3 -1 -MountingHole -MountingHole_4.3mm_M4_Pad_TopOnly -Mounting Hole 4.3mm, M4 -mounting hole 4.3mm m4 -0 -2 -1 -MountingHole -MountingHole_4.3mm_M4_Pad_Via -Mounting Hole 4.3mm, M4 -mounting hole 4.3mm m4 -0 -9 -1 -MountingHole -MountingHole_4.3x6.2mm_M4_Pad -Mounting Hole 4.3x6.2mm, M4 -mounting hole 4.3x6.2mm m4 -0 -1 -1 -MountingHole -MountingHole_4.3x6.2mm_M4_Pad_Via -Mounting Hole 4.3x6.2mm, M4 -mounting hole 4.3x6.2mm m4 -0 -17 -1 -MountingHole -MountingHole_4.5mm -Mounting Hole 4.5mm, no annular -mounting hole 4.5mm no annular -0 -0 -0 -MountingHole -MountingHole_4.5mm_Pad -Mounting Hole 4.5mm -mounting hole 4.5mm -0 -1 -1 -MountingHole -MountingHole_4.5mm_Pad_TopBottom -Mounting Hole 4.5mm -mounting hole 4.5mm -0 -3 -1 -MountingHole -MountingHole_4.5mm_Pad_TopOnly -Mounting Hole 4.5mm -mounting hole 4.5mm -0 -2 -1 -MountingHole -MountingHole_4.5mm_Pad_Via -Mounting Hole 4.5mm -mounting hole 4.5mm -0 -9 -1 -MountingHole -MountingHole_4mm -Mounting Hole 4mm, no annular -mounting hole 4mm no annular -0 -0 -0 -MountingHole -MountingHole_4mm_Pad -Mounting Hole 4mm -mounting hole 4mm -0 -1 -1 -MountingHole -MountingHole_4mm_Pad_TopBottom -Mounting Hole 4mm -mounting hole 4mm -0 -3 -1 -MountingHole -MountingHole_4mm_Pad_TopOnly -Mounting Hole 4mm -mounting hole 4mm -0 -2 -1 -MountingHole -MountingHole_4mm_Pad_Via -Mounting Hole 4mm -mounting hole 4mm -0 -9 -1 -MountingHole -MountingHole_5.3mm_M5 -Mounting Hole 5.3mm, no annular, M5 -mounting hole 5.3mm no annular m5 -0 -0 -0 -MountingHole -MountingHole_5.3mm_M5_DIN965 -Mounting Hole 5.3mm, no annular, M5, DIN965 -mounting hole 5.3mm no annular m5 din965 -0 -0 -0 -MountingHole -MountingHole_5.3mm_M5_DIN965_Pad -Mounting Hole 5.3mm, M5, DIN965 -mounting hole 5.3mm m5 din965 -0 -1 -1 -MountingHole -MountingHole_5.3mm_M5_DIN965_Pad_TopBottom -Mounting Hole 5.3mm, M5, DIN965 -mounting hole 5.3mm m5 din965 -0 -3 -1 -MountingHole -MountingHole_5.3mm_M5_DIN965_Pad_TopOnly -Mounting Hole 5.3mm, M5, DIN965 -mounting hole 5.3mm m5 din965 -0 -2 -1 -MountingHole -MountingHole_5.3mm_M5_ISO7380 -Mounting Hole 5.3mm, no annular, M5, ISO7380 -mounting hole 5.3mm no annular m5 iso7380 -0 -0 -0 -MountingHole -MountingHole_5.3mm_M5_ISO7380_Pad -Mounting Hole 5.3mm, M5, ISO7380 -mounting hole 5.3mm m5 iso7380 -0 -1 -1 -MountingHole -MountingHole_5.3mm_M5_ISO7380_Pad_TopBottom -Mounting Hole 5.3mm, M5, ISO7380 -mounting hole 5.3mm m5 iso7380 -0 -3 -1 -MountingHole -MountingHole_5.3mm_M5_ISO7380_Pad_TopOnly -Mounting Hole 5.3mm, M5, ISO7380 -mounting hole 5.3mm m5 iso7380 -0 -2 -1 -MountingHole -MountingHole_5.3mm_M5_ISO14580 -Mounting Hole 5.3mm, no annular, M5, ISO14580 -mounting hole 5.3mm no annular m5 iso14580 -0 -0 -0 -MountingHole -MountingHole_5.3mm_M5_ISO14580_Pad -Mounting Hole 5.3mm, M5, ISO14580 -mounting hole 5.3mm m5 iso14580 -0 -1 -1 -MountingHole -MountingHole_5.3mm_M5_ISO14580_Pad_TopBottom -Mounting Hole 5.3mm, M5, ISO14580 -mounting hole 5.3mm m5 iso14580 -0 -3 -1 -MountingHole -MountingHole_5.3mm_M5_ISO14580_Pad_TopOnly -Mounting Hole 5.3mm, M5, ISO14580 -mounting hole 5.3mm m5 iso14580 -0 -2 -1 -MountingHole -MountingHole_5.3mm_M5_Pad -Mounting Hole 5.3mm, M5 -mounting hole 5.3mm m5 -0 -1 -1 -MountingHole -MountingHole_5.3mm_M5_Pad_TopBottom -Mounting Hole 5.3mm, M5 -mounting hole 5.3mm m5 -0 -3 -1 -MountingHole -MountingHole_5.3mm_M5_Pad_TopOnly -Mounting Hole 5.3mm, M5 -mounting hole 5.3mm m5 -0 -2 -1 -MountingHole -MountingHole_5.3mm_M5_Pad_Via -Mounting Hole 5.3mm, M5 -mounting hole 5.3mm m5 -0 -9 -1 -MountingHole -MountingHole_5.5mm -Mounting Hole 5.5mm, no annular -mounting hole 5.5mm no annular -0 -0 -0 -MountingHole -MountingHole_5.5mm_Pad -Mounting Hole 5.5mm -mounting hole 5.5mm -0 -1 -1 -MountingHole -MountingHole_5.5mm_Pad_TopBottom -Mounting Hole 5.5mm -mounting hole 5.5mm -0 -3 -1 -MountingHole -MountingHole_5.5mm_Pad_TopOnly -Mounting Hole 5.5mm -mounting hole 5.5mm -0 -2 -1 -MountingHole -MountingHole_5.5mm_Pad_Via -Mounting Hole 5.5mm -mounting hole 5.5mm -0 -9 -1 -MountingHole -MountingHole_5mm -Mounting Hole 5mm, no annular -mounting hole 5mm no annular -0 -0 -0 -MountingHole -MountingHole_5mm_Pad -Mounting Hole 5mm -mounting hole 5mm -0 -1 -1 -MountingHole -MountingHole_5mm_Pad_TopBottom -Mounting Hole 5mm -mounting hole 5mm -0 -3 -1 -MountingHole -MountingHole_5mm_Pad_TopOnly -Mounting Hole 5mm -mounting hole 5mm -0 -2 -1 -MountingHole -MountingHole_5mm_Pad_Via -Mounting Hole 5mm -mounting hole 5mm -0 -9 -1 -MountingHole -MountingHole_6.4mm_M6 -Mounting Hole 6.4mm, no annular, M6 -mounting hole 6.4mm no annular m6 -0 -0 -0 -MountingHole -MountingHole_6.4mm_M6_DIN965 -Mounting Hole 6.4mm, no annular, M6, DIN965 -mounting hole 6.4mm no annular m6 din965 -0 -0 -0 -MountingHole -MountingHole_6.4mm_M6_DIN965_Pad -Mounting Hole 6.4mm, M6, DIN965 -mounting hole 6.4mm m6 din965 -0 -1 -1 -MountingHole -MountingHole_6.4mm_M6_DIN965_Pad_TopBottom -Mounting Hole 6.4mm, M6, DIN965 -mounting hole 6.4mm m6 din965 -0 -3 -1 -MountingHole -MountingHole_6.4mm_M6_DIN965_Pad_TopOnly -Mounting Hole 6.4mm, M6, DIN965 -mounting hole 6.4mm m6 din965 -0 -2 -1 -MountingHole -MountingHole_6.4mm_M6_ISO7380 -Mounting Hole 6.4mm, no annular, M6, ISO7380 -mounting hole 6.4mm no annular m6 iso7380 -0 -0 -0 -MountingHole -MountingHole_6.4mm_M6_ISO7380_Pad -Mounting Hole 6.4mm, M6, ISO7380 -mounting hole 6.4mm m6 iso7380 -0 -1 -1 -MountingHole -MountingHole_6.4mm_M6_ISO7380_Pad_TopBottom -Mounting Hole 6.4mm, M6, ISO7380 -mounting hole 6.4mm m6 iso7380 -0 -3 -1 -MountingHole -MountingHole_6.4mm_M6_ISO7380_Pad_TopOnly -Mounting Hole 6.4mm, M6, ISO7380 -mounting hole 6.4mm m6 iso7380 -0 -2 -1 -MountingHole -MountingHole_6.4mm_M6_ISO14580 -Mounting Hole 6.4mm, no annular, M6, ISO14580 -mounting hole 6.4mm no annular m6 iso14580 -0 -0 -0 -MountingHole -MountingHole_6.4mm_M6_ISO14580_Pad -Mounting Hole 6.4mm, M6, ISO14580 -mounting hole 6.4mm m6 iso14580 -0 -1 -1 -MountingHole -MountingHole_6.4mm_M6_ISO14580_Pad_TopBottom -Mounting Hole 6.4mm, M6, ISO14580 -mounting hole 6.4mm m6 iso14580 -0 -3 -1 -MountingHole -MountingHole_6.4mm_M6_ISO14580_Pad_TopOnly -Mounting Hole 6.4mm, M6, ISO14580 -mounting hole 6.4mm m6 iso14580 -0 -2 -1 -MountingHole -MountingHole_6.4mm_M6_Pad -Mounting Hole 6.4mm, M6 -mounting hole 6.4mm m6 -0 -1 -1 -MountingHole -MountingHole_6.4mm_M6_Pad_TopBottom -Mounting Hole 6.4mm, M6 -mounting hole 6.4mm m6 -0 -3 -1 -MountingHole -MountingHole_6.4mm_M6_Pad_TopOnly -Mounting Hole 6.4mm, M6 -mounting hole 6.4mm m6 -0 -2 -1 -MountingHole -MountingHole_6.4mm_M6_Pad_Via -Mounting Hole 6.4mm, M6 -mounting hole 6.4mm m6 -0 -9 -1 -MountingHole -MountingHole_6.5mm -Mounting Hole 6.5mm, no annular -mounting hole 6.5mm no annular -0 -0 -0 -MountingHole -MountingHole_6.5mm_Pad -Mounting Hole 6.5mm -mounting hole 6.5mm -0 -1 -1 -MountingHole -MountingHole_6.5mm_Pad_TopBottom -Mounting Hole 6.5mm -mounting hole 6.5mm -0 -3 -1 -MountingHole -MountingHole_6.5mm_Pad_TopOnly -Mounting Hole 6.5mm -mounting hole 6.5mm -0 -2 -1 -MountingHole -MountingHole_6.5mm_Pad_Via -Mounting Hole 6.5mm -mounting hole 6.5mm -0 -9 -1 -MountingHole -MountingHole_6mm -Mounting Hole 6mm, no annular -mounting hole 6mm no annular -0 -0 -0 -MountingHole -MountingHole_6mm_Pad -Mounting Hole 6mm -mounting hole 6mm -0 -1 -1 -MountingHole -MountingHole_6mm_Pad_TopBottom -Mounting Hole 6mm -mounting hole 6mm -0 -3 -1 -MountingHole -MountingHole_6mm_Pad_TopOnly -Mounting Hole 6mm -mounting hole 6mm -0 -2 -1 -MountingHole -MountingHole_6mm_Pad_Via -Mounting Hole 6mm -mounting hole 6mm -0 -9 -1 -MountingHole -MountingHole_8.4mm_M8 -Mounting Hole 8.4mm, no annular, M8 -mounting hole 8.4mm no annular m8 -0 -0 -0 -MountingHole -MountingHole_8.4mm_M8_Pad -Mounting Hole 8.4mm, M8 -mounting hole 8.4mm m8 -0 -1 -1 -MountingHole -MountingHole_8.4mm_M8_Pad_TopBottom -Mounting Hole 8.4mm, M8 -mounting hole 8.4mm m8 -0 -3 -1 -MountingHole -MountingHole_8.4mm_M8_Pad_TopOnly -Mounting Hole 8.4mm, M8 -mounting hole 8.4mm m8 -0 -2 -1 -MountingHole -MountingHole_8.4mm_M8_Pad_Via -Mounting Hole 8.4mm, M8 -mounting hole 8.4mm m8 -0 -9 -1 +275360114319497 +MountingHole +MountingHole_2.1mm +Mounting Hole 2.1mm, no annular +mounting hole 2.1mm no annular +0 +0 +0 +MountingHole +MountingHole_2.2mm_M2 +Mounting Hole 2.2mm, no annular, M2 +mounting hole 2.2mm no annular m2 +0 +0 +0 +MountingHole +MountingHole_2.2mm_M2_DIN965 +Mounting Hole 2.2mm, no annular, M2, DIN965 +mounting hole 2.2mm no annular m2 din965 +0 +0 +0 +MountingHole +MountingHole_2.2mm_M2_DIN965_Pad +Mounting Hole 2.2mm, M2, DIN965 +mounting hole 2.2mm m2 din965 +0 +1 +1 +MountingHole +MountingHole_2.2mm_M2_DIN965_Pad_TopBottom +Mounting Hole 2.2mm, M2, DIN965 +mounting hole 2.2mm m2 din965 +0 +3 +1 +MountingHole +MountingHole_2.2mm_M2_DIN965_Pad_TopOnly +Mounting Hole 2.2mm, M2, DIN965 +mounting hole 2.2mm m2 din965 +0 +2 +1 +MountingHole +MountingHole_2.2mm_M2_ISO7380 +Mounting Hole 2.2mm, no annular, M2, ISO7380 +mounting hole 2.2mm no annular m2 iso7380 +0 +0 +0 +MountingHole +MountingHole_2.2mm_M2_ISO7380_Pad +Mounting Hole 2.2mm, M2, ISO7380 +mounting hole 2.2mm m2 iso7380 +0 +1 +1 +MountingHole +MountingHole_2.2mm_M2_ISO7380_Pad_TopBottom +Mounting Hole 2.2mm, M2, ISO7380 +mounting hole 2.2mm m2 iso7380 +0 +3 +1 +MountingHole +MountingHole_2.2mm_M2_ISO7380_Pad_TopOnly +Mounting Hole 2.2mm, M2, ISO7380 +mounting hole 2.2mm m2 iso7380 +0 +2 +1 +MountingHole +MountingHole_2.2mm_M2_ISO14580 +Mounting Hole 2.2mm, no annular, M2, ISO14580 +mounting hole 2.2mm no annular m2 iso14580 +0 +0 +0 +MountingHole +MountingHole_2.2mm_M2_ISO14580_Pad +Mounting Hole 2.2mm, M2, ISO14580 +mounting hole 2.2mm m2 iso14580 +0 +1 +1 +MountingHole +MountingHole_2.2mm_M2_ISO14580_Pad_TopBottom +Mounting Hole 2.2mm, M2, ISO14580 +mounting hole 2.2mm m2 iso14580 +0 +3 +1 +MountingHole +MountingHole_2.2mm_M2_ISO14580_Pad_TopOnly +Mounting Hole 2.2mm, M2, ISO14580 +mounting hole 2.2mm m2 iso14580 +0 +2 +1 +MountingHole +MountingHole_2.2mm_M2_Pad +Mounting Hole 2.2mm, M2 +mounting hole 2.2mm m2 +0 +1 +1 +MountingHole +MountingHole_2.2mm_M2_Pad_TopBottom +Mounting Hole 2.2mm, M2 +mounting hole 2.2mm m2 +0 +3 +1 +MountingHole +MountingHole_2.2mm_M2_Pad_TopOnly +Mounting Hole 2.2mm, M2 +mounting hole 2.2mm m2 +0 +2 +1 +MountingHole +MountingHole_2.2mm_M2_Pad_Via +Mounting Hole 2.2mm, M2 +mounting hole 2.2mm m2 +0 +9 +1 +MountingHole +MountingHole_2.5mm +Mounting Hole 2.5mm, no annular +mounting hole 2.5mm no annular +0 +0 +0 +MountingHole +MountingHole_2.5mm_Pad +Mounting Hole 2.5mm +mounting hole 2.5mm +0 +1 +1 +MountingHole +MountingHole_2.5mm_Pad_TopBottom +Mounting Hole 2.5mm +mounting hole 2.5mm +0 +3 +1 +MountingHole +MountingHole_2.5mm_Pad_TopOnly +Mounting Hole 2.5mm +mounting hole 2.5mm +0 +2 +1 +MountingHole +MountingHole_2.5mm_Pad_Via +Mounting Hole 2.5mm +mounting hole 2.5mm +0 +9 +1 +MountingHole +MountingHole_2.7mm +Mounting Hole 2.7mm, no annular +mounting hole 2.7mm no annular +0 +0 +0 +MountingHole +MountingHole_2.7mm_M2.5 +Mounting Hole 2.7mm, no annular, M2.5 +mounting hole 2.7mm no annular m2.5 +0 +0 +0 +MountingHole +MountingHole_2.7mm_M2.5_DIN965 +Mounting Hole 2.7mm, no annular, M2.5, DIN965 +mounting hole 2.7mm no annular m2.5 din965 +0 +0 +0 +MountingHole +MountingHole_2.7mm_M2.5_DIN965_Pad +Mounting Hole 2.7mm, M2.5, DIN965 +mounting hole 2.7mm m2.5 din965 +0 +1 +1 +MountingHole +MountingHole_2.7mm_M2.5_DIN965_Pad_TopBottom +Mounting Hole 2.7mm, M2.5, DIN965 +mounting hole 2.7mm m2.5 din965 +0 +3 +1 +MountingHole +MountingHole_2.7mm_M2.5_DIN965_Pad_TopOnly +Mounting Hole 2.7mm, M2.5, DIN965 +mounting hole 2.7mm m2.5 din965 +0 +2 +1 +MountingHole +MountingHole_2.7mm_M2.5_ISO7380 +Mounting Hole 2.7mm, no annular, M2.5, ISO7380 +mounting hole 2.7mm no annular m2.5 iso7380 +0 +0 +0 +MountingHole +MountingHole_2.7mm_M2.5_ISO7380_Pad +Mounting Hole 2.7mm, M2.5, ISO7380 +mounting hole 2.7mm m2.5 iso7380 +0 +1 +1 +MountingHole +MountingHole_2.7mm_M2.5_ISO7380_Pad_TopBottom +Mounting Hole 2.7mm, M2.5, ISO7380 +mounting hole 2.7mm m2.5 iso7380 +0 +3 +1 +MountingHole +MountingHole_2.7mm_M2.5_ISO7380_Pad_TopOnly +Mounting Hole 2.7mm, M2.5, ISO7380 +mounting hole 2.7mm m2.5 iso7380 +0 +2 +1 +MountingHole +MountingHole_2.7mm_M2.5_ISO14580 +Mounting Hole 2.7mm, no annular, M2.5, ISO14580 +mounting hole 2.7mm no annular m2.5 iso14580 +0 +0 +0 +MountingHole +MountingHole_2.7mm_M2.5_ISO14580_Pad +Mounting Hole 2.7mm, M2.5, ISO14580 +mounting hole 2.7mm m2.5 iso14580 +0 +1 +1 +MountingHole +MountingHole_2.7mm_M2.5_ISO14580_Pad_TopBottom +Mounting Hole 2.7mm, M2.5, ISO14580 +mounting hole 2.7mm m2.5 iso14580 +0 +3 +1 +MountingHole +MountingHole_2.7mm_M2.5_ISO14580_Pad_TopOnly +Mounting Hole 2.7mm, M2.5, ISO14580 +mounting hole 2.7mm m2.5 iso14580 +0 +2 +1 +MountingHole +MountingHole_2.7mm_M2.5_Pad +Mounting Hole 2.7mm, M2.5 +mounting hole 2.7mm m2.5 +0 +1 +1 +MountingHole +MountingHole_2.7mm_M2.5_Pad_TopBottom +Mounting Hole 2.7mm, M2.5 +mounting hole 2.7mm m2.5 +0 +3 +1 +MountingHole +MountingHole_2.7mm_M2.5_Pad_TopOnly +Mounting Hole 2.7mm, M2.5 +mounting hole 2.7mm m2.5 +0 +2 +1 +MountingHole +MountingHole_2.7mm_M2.5_Pad_Via +Mounting Hole 2.7mm +mounting hole 2.7mm +0 +9 +1 +MountingHole +MountingHole_2.7mm_Pad +Mounting Hole 2.7mm +mounting hole 2.7mm +0 +1 +1 +MountingHole +MountingHole_2.7mm_Pad_TopBottom +Mounting Hole 2.7mm +mounting hole 2.7mm +0 +3 +1 +MountingHole +MountingHole_2.7mm_Pad_TopOnly +Mounting Hole 2.7mm +mounting hole 2.7mm +0 +2 +1 +MountingHole +MountingHole_2.7mm_Pad_Via +Mounting Hole 2.7mm +mounting hole 2.7mm +0 +9 +1 +MountingHole +MountingHole_2mm +Mounting Hole 2mm, no annular +mounting hole 2mm no annular +0 +0 +0 +MountingHole +MountingHole_3.2mm_M3 +Mounting Hole 3.2mm, no annular, M3 +mounting hole 3.2mm no annular m3 +0 +0 +0 +MountingHole +MountingHole_3.2mm_M3_DIN965 +Mounting Hole 3.2mm, no annular, M3, DIN965 +mounting hole 3.2mm no annular m3 din965 +0 +0 +0 +MountingHole +MountingHole_3.2mm_M3_DIN965_Pad +Mounting Hole 3.2mm, M3, DIN965 +mounting hole 3.2mm m3 din965 +0 +1 +1 +MountingHole +MountingHole_3.2mm_M3_DIN965_Pad_TopBottom +Mounting Hole 3.2mm, M3, DIN965 +mounting hole 3.2mm m3 din965 +0 +3 +1 +MountingHole +MountingHole_3.2mm_M3_DIN965_Pad_TopOnly +Mounting Hole 3.2mm, M3, DIN965 +mounting hole 3.2mm m3 din965 +0 +2 +1 +MountingHole +MountingHole_3.2mm_M3_ISO7380 +Mounting Hole 3.2mm, no annular, M3, ISO7380 +mounting hole 3.2mm no annular m3 iso7380 +0 +0 +0 +MountingHole +MountingHole_3.2mm_M3_ISO7380_Pad +Mounting Hole 3.2mm, M3, ISO7380 +mounting hole 3.2mm m3 iso7380 +0 +1 +1 +MountingHole +MountingHole_3.2mm_M3_ISO7380_Pad_TopBottom +Mounting Hole 3.2mm, M3, ISO7380 +mounting hole 3.2mm m3 iso7380 +0 +3 +1 +MountingHole +MountingHole_3.2mm_M3_ISO7380_Pad_TopOnly +Mounting Hole 3.2mm, M3, ISO7380 +mounting hole 3.2mm m3 iso7380 +0 +2 +1 +MountingHole +MountingHole_3.2mm_M3_ISO14580 +Mounting Hole 3.2mm, no annular, M3, ISO14580 +mounting hole 3.2mm no annular m3 iso14580 +0 +0 +0 +MountingHole +MountingHole_3.2mm_M3_ISO14580_Pad +Mounting Hole 3.2mm, M3, ISO14580 +mounting hole 3.2mm m3 iso14580 +0 +1 +1 +MountingHole +MountingHole_3.2mm_M3_ISO14580_Pad_TopBottom +Mounting Hole 3.2mm, M3, ISO14580 +mounting hole 3.2mm m3 iso14580 +0 +3 +1 +MountingHole +MountingHole_3.2mm_M3_ISO14580_Pad_TopOnly +Mounting Hole 3.2mm, M3, ISO14580 +mounting hole 3.2mm m3 iso14580 +0 +2 +1 +MountingHole +MountingHole_3.2mm_M3_Pad +Mounting Hole 3.2mm, M3 +mounting hole 3.2mm m3 +0 +1 +1 +MountingHole +MountingHole_3.2mm_M3_Pad_TopBottom +Mounting Hole 3.2mm, M3 +mounting hole 3.2mm m3 +0 +3 +1 +MountingHole +MountingHole_3.2mm_M3_Pad_TopOnly +Mounting Hole 3.2mm, M3 +mounting hole 3.2mm m3 +0 +2 +1 +MountingHole +MountingHole_3.2mm_M3_Pad_Via +Mounting Hole 3.2mm, M3 +mounting hole 3.2mm m3 +0 +9 +1 +MountingHole +MountingHole_3.5mm +Mounting Hole 3.5mm, no annular +mounting hole 3.5mm no annular +0 +0 +0 +MountingHole +MountingHole_3.5mm_Pad +Mounting Hole 3.5mm +mounting hole 3.5mm +0 +1 +1 +MountingHole +MountingHole_3.5mm_Pad_TopBottom +Mounting Hole 3.5mm +mounting hole 3.5mm +0 +3 +1 +MountingHole +MountingHole_3.5mm_Pad_TopOnly +Mounting Hole 3.5mm +mounting hole 3.5mm +0 +2 +1 +MountingHole +MountingHole_3.5mm_Pad_Via +Mounting Hole 3.5mm +mounting hole 3.5mm +0 +9 +1 +MountingHole +MountingHole_3.7mm +Mounting Hole 3.7mm, no annular +mounting hole 3.7mm no annular +0 +0 +0 +MountingHole +MountingHole_3.7mm_Pad +Mounting Hole 3.7mm +mounting hole 3.7mm +0 +1 +1 +MountingHole +MountingHole_3.7mm_Pad_TopBottom +Mounting Hole 3.7mm +mounting hole 3.7mm +0 +3 +1 +MountingHole +MountingHole_3.7mm_Pad_TopOnly +Mounting Hole 3.7mm +mounting hole 3.7mm +0 +2 +1 +MountingHole +MountingHole_3.7mm_Pad_Via +Mounting Hole 3.7mm +mounting hole 3.7mm +0 +9 +1 +MountingHole +MountingHole_3mm +Mounting Hole 3mm, no annular +mounting hole 3mm no annular +0 +0 +0 +MountingHole +MountingHole_3mm_Pad +Mounting Hole 3mm +mounting hole 3mm +0 +1 +1 +MountingHole +MountingHole_3mm_Pad_TopBottom +Mounting Hole 3mm +mounting hole 3mm +0 +3 +1 +MountingHole +MountingHole_3mm_Pad_TopOnly +Mounting Hole 3mm +mounting hole 3mm +0 +2 +1 +MountingHole +MountingHole_3mm_Pad_Via +Mounting Hole 3mm +mounting hole 3mm +0 +9 +1 +MountingHole +MountingHole_4.3mm_M4 +Mounting Hole 4.3mm, no annular, M4 +mounting hole 4.3mm no annular m4 +0 +0 +0 +MountingHole +MountingHole_4.3mm_M4_DIN965 +Mounting Hole 4.3mm, no annular, M4, DIN965 +mounting hole 4.3mm no annular m4 din965 +0 +0 +0 +MountingHole +MountingHole_4.3mm_M4_DIN965_Pad +Mounting Hole 4.3mm, M4, DIN965 +mounting hole 4.3mm m4 din965 +0 +1 +1 +MountingHole +MountingHole_4.3mm_M4_DIN965_Pad_TopBottom +Mounting Hole 4.3mm, M4, DIN965 +mounting hole 4.3mm m4 din965 +0 +3 +1 +MountingHole +MountingHole_4.3mm_M4_DIN965_Pad_TopOnly +Mounting Hole 4.3mm, M4, DIN965 +mounting hole 4.3mm m4 din965 +0 +2 +1 +MountingHole +MountingHole_4.3mm_M4_ISO7380 +Mounting Hole 4.3mm, no annular, M4, ISO7380 +mounting hole 4.3mm no annular m4 iso7380 +0 +0 +0 +MountingHole +MountingHole_4.3mm_M4_ISO7380_Pad +Mounting Hole 4.3mm, M4, ISO7380 +mounting hole 4.3mm m4 iso7380 +0 +1 +1 +MountingHole +MountingHole_4.3mm_M4_ISO7380_Pad_TopBottom +Mounting Hole 4.3mm, M4, ISO7380 +mounting hole 4.3mm m4 iso7380 +0 +3 +1 +MountingHole +MountingHole_4.3mm_M4_ISO7380_Pad_TopOnly +Mounting Hole 4.3mm, M4, ISO7380 +mounting hole 4.3mm m4 iso7380 +0 +2 +1 +MountingHole +MountingHole_4.3mm_M4_ISO14580 +Mounting Hole 4.3mm, no annular, M4, ISO14580 +mounting hole 4.3mm no annular m4 iso14580 +0 +0 +0 +MountingHole +MountingHole_4.3mm_M4_ISO14580_Pad +Mounting Hole 4.3mm, M4, ISO14580 +mounting hole 4.3mm m4 iso14580 +0 +1 +1 +MountingHole +MountingHole_4.3mm_M4_ISO14580_Pad_TopBottom +Mounting Hole 4.3mm, M4, ISO14580 +mounting hole 4.3mm m4 iso14580 +0 +3 +1 +MountingHole +MountingHole_4.3mm_M4_ISO14580_Pad_TopOnly +Mounting Hole 4.3mm, M4, ISO14580 +mounting hole 4.3mm m4 iso14580 +0 +2 +1 +MountingHole +MountingHole_4.3mm_M4_Pad +Mounting Hole 4.3mm, M4 +mounting hole 4.3mm m4 +0 +1 +1 +MountingHole +MountingHole_4.3mm_M4_Pad_TopBottom +Mounting Hole 4.3mm, M4 +mounting hole 4.3mm m4 +0 +3 +1 +MountingHole +MountingHole_4.3mm_M4_Pad_TopOnly +Mounting Hole 4.3mm, M4 +mounting hole 4.3mm m4 +0 +2 +1 +MountingHole +MountingHole_4.3mm_M4_Pad_Via +Mounting Hole 4.3mm, M4 +mounting hole 4.3mm m4 +0 +9 +1 +MountingHole +MountingHole_4.3x6.2mm_M4_Pad +Mounting Hole 4.3x6.2mm, M4 +mounting hole 4.3x6.2mm m4 +0 +1 +1 +MountingHole +MountingHole_4.3x6.2mm_M4_Pad_Via +Mounting Hole 4.3x6.2mm, M4 +mounting hole 4.3x6.2mm m4 +0 +17 +1 +MountingHole +MountingHole_4.5mm +Mounting Hole 4.5mm, no annular +mounting hole 4.5mm no annular +0 +0 +0 +MountingHole +MountingHole_4.5mm_Pad +Mounting Hole 4.5mm +mounting hole 4.5mm +0 +1 +1 +MountingHole +MountingHole_4.5mm_Pad_TopBottom +Mounting Hole 4.5mm +mounting hole 4.5mm +0 +3 +1 +MountingHole +MountingHole_4.5mm_Pad_TopOnly +Mounting Hole 4.5mm +mounting hole 4.5mm +0 +2 +1 +MountingHole +MountingHole_4.5mm_Pad_Via +Mounting Hole 4.5mm +mounting hole 4.5mm +0 +9 +1 +MountingHole +MountingHole_4mm +Mounting Hole 4mm, no annular +mounting hole 4mm no annular +0 +0 +0 +MountingHole +MountingHole_4mm_Pad +Mounting Hole 4mm +mounting hole 4mm +0 +1 +1 +MountingHole +MountingHole_4mm_Pad_TopBottom +Mounting Hole 4mm +mounting hole 4mm +0 +3 +1 +MountingHole +MountingHole_4mm_Pad_TopOnly +Mounting Hole 4mm +mounting hole 4mm +0 +2 +1 +MountingHole +MountingHole_4mm_Pad_Via +Mounting Hole 4mm +mounting hole 4mm +0 +9 +1 +MountingHole +MountingHole_5.3mm_M5 +Mounting Hole 5.3mm, no annular, M5 +mounting hole 5.3mm no annular m5 +0 +0 +0 +MountingHole +MountingHole_5.3mm_M5_DIN965 +Mounting Hole 5.3mm, no annular, M5, DIN965 +mounting hole 5.3mm no annular m5 din965 +0 +0 +0 +MountingHole +MountingHole_5.3mm_M5_DIN965_Pad +Mounting Hole 5.3mm, M5, DIN965 +mounting hole 5.3mm m5 din965 +0 +1 +1 +MountingHole +MountingHole_5.3mm_M5_DIN965_Pad_TopBottom +Mounting Hole 5.3mm, M5, DIN965 +mounting hole 5.3mm m5 din965 +0 +3 +1 +MountingHole +MountingHole_5.3mm_M5_DIN965_Pad_TopOnly +Mounting Hole 5.3mm, M5, DIN965 +mounting hole 5.3mm m5 din965 +0 +2 +1 +MountingHole +MountingHole_5.3mm_M5_ISO7380 +Mounting Hole 5.3mm, no annular, M5, ISO7380 +mounting hole 5.3mm no annular m5 iso7380 +0 +0 +0 +MountingHole +MountingHole_5.3mm_M5_ISO7380_Pad +Mounting Hole 5.3mm, M5, ISO7380 +mounting hole 5.3mm m5 iso7380 +0 +1 +1 +MountingHole +MountingHole_5.3mm_M5_ISO7380_Pad_TopBottom +Mounting Hole 5.3mm, M5, ISO7380 +mounting hole 5.3mm m5 iso7380 +0 +3 +1 +MountingHole +MountingHole_5.3mm_M5_ISO7380_Pad_TopOnly +Mounting Hole 5.3mm, M5, ISO7380 +mounting hole 5.3mm m5 iso7380 +0 +2 +1 +MountingHole +MountingHole_5.3mm_M5_ISO14580 +Mounting Hole 5.3mm, no annular, M5, ISO14580 +mounting hole 5.3mm no annular m5 iso14580 +0 +0 +0 +MountingHole +MountingHole_5.3mm_M5_ISO14580_Pad +Mounting Hole 5.3mm, M5, ISO14580 +mounting hole 5.3mm m5 iso14580 +0 +1 +1 +MountingHole +MountingHole_5.3mm_M5_ISO14580_Pad_TopBottom +Mounting Hole 5.3mm, M5, ISO14580 +mounting hole 5.3mm m5 iso14580 +0 +3 +1 +MountingHole +MountingHole_5.3mm_M5_ISO14580_Pad_TopOnly +Mounting Hole 5.3mm, M5, ISO14580 +mounting hole 5.3mm m5 iso14580 +0 +2 +1 +MountingHole +MountingHole_5.3mm_M5_Pad +Mounting Hole 5.3mm, M5 +mounting hole 5.3mm m5 +0 +1 +1 +MountingHole +MountingHole_5.3mm_M5_Pad_TopBottom +Mounting Hole 5.3mm, M5 +mounting hole 5.3mm m5 +0 +3 +1 +MountingHole +MountingHole_5.3mm_M5_Pad_TopOnly +Mounting Hole 5.3mm, M5 +mounting hole 5.3mm m5 +0 +2 +1 +MountingHole +MountingHole_5.3mm_M5_Pad_Via +Mounting Hole 5.3mm, M5 +mounting hole 5.3mm m5 +0 +9 +1 +MountingHole +MountingHole_5.5mm +Mounting Hole 5.5mm, no annular +mounting hole 5.5mm no annular +0 +0 +0 +MountingHole +MountingHole_5.5mm_Pad +Mounting Hole 5.5mm +mounting hole 5.5mm +0 +1 +1 +MountingHole +MountingHole_5.5mm_Pad_TopBottom +Mounting Hole 5.5mm +mounting hole 5.5mm +0 +3 +1 +MountingHole +MountingHole_5.5mm_Pad_TopOnly +Mounting Hole 5.5mm +mounting hole 5.5mm +0 +2 +1 +MountingHole +MountingHole_5.5mm_Pad_Via +Mounting Hole 5.5mm +mounting hole 5.5mm +0 +9 +1 +MountingHole +MountingHole_5mm +Mounting Hole 5mm, no annular +mounting hole 5mm no annular +0 +0 +0 +MountingHole +MountingHole_5mm_Pad +Mounting Hole 5mm +mounting hole 5mm +0 +1 +1 +MountingHole +MountingHole_5mm_Pad_TopBottom +Mounting Hole 5mm +mounting hole 5mm +0 +3 +1 +MountingHole +MountingHole_5mm_Pad_TopOnly +Mounting Hole 5mm +mounting hole 5mm +0 +2 +1 +MountingHole +MountingHole_5mm_Pad_Via +Mounting Hole 5mm +mounting hole 5mm +0 +9 +1 +MountingHole +MountingHole_6.4mm_M6 +Mounting Hole 6.4mm, no annular, M6 +mounting hole 6.4mm no annular m6 +0 +0 +0 +MountingHole +MountingHole_6.4mm_M6_DIN965 +Mounting Hole 6.4mm, no annular, M6, DIN965 +mounting hole 6.4mm no annular m6 din965 +0 +0 +0 +MountingHole +MountingHole_6.4mm_M6_DIN965_Pad +Mounting Hole 6.4mm, M6, DIN965 +mounting hole 6.4mm m6 din965 +0 +1 +1 +MountingHole +MountingHole_6.4mm_M6_DIN965_Pad_TopBottom +Mounting Hole 6.4mm, M6, DIN965 +mounting hole 6.4mm m6 din965 +0 +3 +1 +MountingHole +MountingHole_6.4mm_M6_DIN965_Pad_TopOnly +Mounting Hole 6.4mm, M6, DIN965 +mounting hole 6.4mm m6 din965 +0 +2 +1 +MountingHole +MountingHole_6.4mm_M6_ISO7380 +Mounting Hole 6.4mm, no annular, M6, ISO7380 +mounting hole 6.4mm no annular m6 iso7380 +0 +0 +0 +MountingHole +MountingHole_6.4mm_M6_ISO7380_Pad +Mounting Hole 6.4mm, M6, ISO7380 +mounting hole 6.4mm m6 iso7380 +0 +1 +1 +MountingHole +MountingHole_6.4mm_M6_ISO7380_Pad_TopBottom +Mounting Hole 6.4mm, M6, ISO7380 +mounting hole 6.4mm m6 iso7380 +0 +3 +1 +MountingHole +MountingHole_6.4mm_M6_ISO7380_Pad_TopOnly +Mounting Hole 6.4mm, M6, ISO7380 +mounting hole 6.4mm m6 iso7380 +0 +2 +1 +MountingHole +MountingHole_6.4mm_M6_ISO14580 +Mounting Hole 6.4mm, no annular, M6, ISO14580 +mounting hole 6.4mm no annular m6 iso14580 +0 +0 +0 +MountingHole +MountingHole_6.4mm_M6_ISO14580_Pad +Mounting Hole 6.4mm, M6, ISO14580 +mounting hole 6.4mm m6 iso14580 +0 +1 +1 +MountingHole +MountingHole_6.4mm_M6_ISO14580_Pad_TopBottom +Mounting Hole 6.4mm, M6, ISO14580 +mounting hole 6.4mm m6 iso14580 +0 +3 +1 +MountingHole +MountingHole_6.4mm_M6_ISO14580_Pad_TopOnly +Mounting Hole 6.4mm, M6, ISO14580 +mounting hole 6.4mm m6 iso14580 +0 +2 +1 +MountingHole +MountingHole_6.4mm_M6_Pad +Mounting Hole 6.4mm, M6 +mounting hole 6.4mm m6 +0 +1 +1 +MountingHole +MountingHole_6.4mm_M6_Pad_TopBottom +Mounting Hole 6.4mm, M6 +mounting hole 6.4mm m6 +0 +3 +1 +MountingHole +MountingHole_6.4mm_M6_Pad_TopOnly +Mounting Hole 6.4mm, M6 +mounting hole 6.4mm m6 +0 +2 +1 +MountingHole +MountingHole_6.4mm_M6_Pad_Via +Mounting Hole 6.4mm, M6 +mounting hole 6.4mm m6 +0 +9 +1 +MountingHole +MountingHole_6.5mm +Mounting Hole 6.5mm, no annular +mounting hole 6.5mm no annular +0 +0 +0 +MountingHole +MountingHole_6.5mm_Pad +Mounting Hole 6.5mm +mounting hole 6.5mm +0 +1 +1 +MountingHole +MountingHole_6.5mm_Pad_TopBottom +Mounting Hole 6.5mm +mounting hole 6.5mm +0 +3 +1 +MountingHole +MountingHole_6.5mm_Pad_TopOnly +Mounting Hole 6.5mm +mounting hole 6.5mm +0 +2 +1 +MountingHole +MountingHole_6.5mm_Pad_Via +Mounting Hole 6.5mm +mounting hole 6.5mm +0 +9 +1 +MountingHole +MountingHole_6mm +Mounting Hole 6mm, no annular +mounting hole 6mm no annular +0 +0 +0 +MountingHole +MountingHole_6mm_Pad +Mounting Hole 6mm +mounting hole 6mm +0 +1 +1 +MountingHole +MountingHole_6mm_Pad_TopBottom +Mounting Hole 6mm +mounting hole 6mm +0 +3 +1 +MountingHole +MountingHole_6mm_Pad_TopOnly +Mounting Hole 6mm +mounting hole 6mm +0 +2 +1 +MountingHole +MountingHole_6mm_Pad_Via +Mounting Hole 6mm +mounting hole 6mm +0 +9 +1 +MountingHole +MountingHole_8.4mm_M8 +Mounting Hole 8.4mm, no annular, M8 +mounting hole 8.4mm no annular m8 +0 +0 +0 +MountingHole +MountingHole_8.4mm_M8_Pad +Mounting Hole 8.4mm, M8 +mounting hole 8.4mm m8 +0 +1 +1 +MountingHole +MountingHole_8.4mm_M8_Pad_TopBottom +Mounting Hole 8.4mm, M8 +mounting hole 8.4mm m8 +0 +3 +1 +MountingHole +MountingHole_8.4mm_M8_Pad_TopOnly +Mounting Hole 8.4mm, M8 +mounting hole 8.4mm m8 +0 +2 +1 +MountingHole +MountingHole_8.4mm_M8_Pad_Via +Mounting Hole 8.4mm, M8 +mounting hole 8.4mm m8 +0 +9 +1 diff --git a/rp2040_42/.cargo/config b/rp2040_42/.cargo/config new file mode 100644 index 0000000..ed10a10 --- /dev/null +++ b/rp2040_42/.cargo/config @@ -0,0 +1,42 @@ +# +# Cargo Configuration for the https://github.com/rp-rs/rp-hal.git repository. +# +# Copyright (c) The RP-RS Developers, 2021 +# +# You might want to make a similar file in your own repository if you are +# writing programs for Raspberry Silicon microcontrollers. +# +# This file is MIT or Apache-2.0 as per the repository README.md file +# + +[build] +# Set the default target to match the Cortex-M0+ in the RP2040 +target = "thumbv6m-none-eabi" + +# Target specific options +[target.thumbv6m-none-eabi] +# Pass some extra options to rustc, some of which get passed on to the linker. +# +# * linker argument --nmagic turns off page alignment of sections (which saves +# flash space) +# * linker argument -Tlink.x tells the linker to use link.x as the linker +# script. This is usually provided by the cortex-m-rt crate, and by default +# the version in that crate will include a file called `memory.x` which +# describes the particular memory layout for your specific chip. +# * inline-threshold=5 makes the compiler more aggressive and inlining functions +# * no-vectorize-loops turns off the loop vectorizer (seeing as the M0+ doesn't +# have SIMD) +rustflags = [ + "-C", "link-arg=--nmagic", + "-C", "link-arg=-Tlink.x", + "-C", "inline-threshold=5", + "-C", "no-vectorize-loops", +] + +# This runner will make a UF2 file and then copy it to a mounted RP2040 in USB +# Bootloader mode: +runner = "elf2uf2-rs -d" + +# This runner will find a supported SWD debug probe and flash your RP2040 over +# SWD: +# runner = "probe-run --chip RP2040" diff --git a/rp2040_42/Cargo.toml b/rp2040_42/Cargo.toml new file mode 100644 index 0000000..22abcb5 --- /dev/null +++ b/rp2040_42/Cargo.toml @@ -0,0 +1,54 @@ +[package] +name = "rp2040" +version = "0.1.0" +edition = "2021" + +[dependencies] +cortex-m = "0.7.2" +waveshare-rp2040-zero = "0.6.0" +rp2040-boot2 = { version = "0.2.0", optional = true } +rp2040-hal = { version = "0.8.0" } +cortex-m-rt = { version = "0.7", optional = true } +panic-halt= "0.2.0" +embedded-hal ="0.2.5" +fugit = "0.3.5" +nb = "1.0.0" +smart-leds = "0.3.0" +smart-leds-trait = "0.2.1" +ws2812-pio = "0.6.0" +usbd-human-interface-device = "0.4.2" +usb-device = "0.2" +packed_struct = { version = "0.10", default-features = false } +pio = "0.2.0" + +[features] +# This is the set of features we enable by default +default = ["boot2", "rt", "critical-section-impl", "rom-func-cache"] + +# critical section that is safe for multicore use +critical-section-impl = ["rp2040-hal/critical-section-impl"] + +# 2nd stage bootloaders for rp2040 +boot2 = ["rp2040-boot2"] + +# Minimal startup / runtime for Cortex-M microcontrollers +rt = ["cortex-m-rt","rp2040-hal/rt"] + +# This enables a fix for USB errata 5: USB device fails to exit RESET state on busy USB bus. +# Only required for RP2040 B0 and RP2040 B1, but it doesn't hurt to enable it +rp2040-e5 = ["rp2040-hal/rp2040-e5"] + +# Memoize(cache) ROM function pointers on first use to improve performance +rom-func-cache = ["rp2040-hal/rom-func-cache"] + +# Disable automatic mapping of language features (like floating point math) to ROM functions +disable-intrinsics = ["rp2040-hal/disable-intrinsics"] + +# This enables ROM functions for f64 math that were not present in the earliest RP2040s +rom-v2-intrinsics = ["rp2040-hal/rom-v2-intrinsics"] + +[[bin]] +name = "rp2040" +test = false +bench = false + diff --git a/rp2040_42/memory.x b/rp2040_42/memory.x new file mode 100644 index 0000000..4077aab --- /dev/null +++ b/rp2040_42/memory.x @@ -0,0 +1,15 @@ +MEMORY { + BOOT2 : ORIGIN = 0x10000000, LENGTH = 0x100 + FLASH : ORIGIN = 0x10000100, LENGTH = 2048K - 0x100 + RAM : ORIGIN = 0x20000000, LENGTH = 256K +} + +EXTERN(BOOT2_FIRMWARE) + +SECTIONS { + /* ### Boot loader */ + .boot2 ORIGIN(BOOT2) : + { + KEEP(*(.boot2)); + } > BOOT2 +} INSERT BEFORE .text; diff --git a/rp2040_42/pico-load b/rp2040_42/pico-load new file mode 100755 index 0000000..2a31890 --- /dev/null +++ b/rp2040_42/pico-load @@ -0,0 +1,12 @@ +#!/bin/bash +sudo umount /mnt/usb +while [ ! -f /mnt/usb/INFO_UF2.TXT ]; do + sudo mount /dev/sda1 /mnt/usb -o umask=000 + sleep 1 +done +set -e +# cargo build --release --example waveshare_rp2040_zero_neopixel_rainbow +cargo run --release +# elf2uf2-rs $1 +# cp $1.uf2 /mnt/usb +sudo umount /mnt/usb diff --git a/rp2040_42/src/button_matrix.rs b/rp2040_42/src/button_matrix.rs new file mode 100644 index 0000000..2c7e0da --- /dev/null +++ b/rp2040_42/src/button_matrix.rs @@ -0,0 +1,98 @@ +//! Project: CMtec CMDR Keyboard 42 +//! Date: 2023-07-01 +//! Author: Christoffer Martinsson +//! Email: cm@cmtec.se +//! License: Please refer to LICENSE in root directory + +use core::convert::Infallible; +use cortex_m::delay::Delay; +use embedded_hal::digital::v2::*; + +/// Button matrix driver +/// +/// # Example +/// ``` +/// let button_matrix: ButtonMatrix<4, 6, 48> = ButtonMatrix::new(row_pins, col_pins, 5); +/// ``` +pub struct ButtonMatrix<'a, const R: usize, const C: usize, const N: usize> { + rows: &'a [&'a dyn InputPin; R], + cols: &'a mut [&'a mut dyn OutputPin; C], + pressed: [bool; N], + debounce: u8, + debounce_counter: [u8; N], +} + +impl<'a, const R: usize, const C: usize, const N: usize> ButtonMatrix<'a, R, C, N> { + /// Creates a new button matrix. + /// + /// # Arguments + /// + /// * `rows` - An array of references to the row pins. + /// * `cols` - An array of references to the column pins. + /// * `debounce` - The debounce time in number of scans. + pub fn new( + rows: &'a [&'a dyn InputPin; R], + cols: &'a mut [&'a mut dyn OutputPin; C], + debounce: u8, + ) -> Self { + Self { + rows, + cols, + pressed: [false; N], + debounce, + debounce_counter: [0; N], + } + } + + /// Initializes the button matrix. + /// This should be called once before scanning the matrix. + pub fn init_pins(&mut self) { + for col in self.cols.iter_mut() { + col.set_high().unwrap(); + } + } + + /// Scans the button matrix and updates the pressed state of each button. + /// This should be called at regular intervals. + /// Allow at least 5 times the delay compared to the needed button latency. + /// + /// # Arguments + /// + /// * `delay` - A mutable reference to a delay object. + pub fn scan_matrix(&mut self, delay: &mut Delay) { + for col_index in 0..self.cols.len() { + self.cols[col_index].set_low().unwrap(); + delay.delay_us(10); + self.process_column(col_index); + self.cols[col_index].set_high().unwrap(); + delay.delay_us(10); + } + } + + /// Processes a column of the button matrix. + /// + /// # Arguments + /// + /// * `col_index` - The index of the column to process. + fn process_column(&mut self, col_index: usize) { + for row_index in 0..self.rows.len() { + let button_index: usize = col_index + (row_index * C); + let current_state = self.rows[row_index].is_low().unwrap(); + + if current_state == self.pressed[button_index] { + self.debounce_counter[button_index] = 0; + continue; + } + + self.debounce_counter[button_index] += 1; + if self.debounce_counter[button_index] >= self.debounce { + self.pressed[button_index] = current_state; + } + } + } + + /// Returns an array of booleans indicating whether each button is pressed. + pub fn buttons_pressed(&mut self) -> [bool; N] { + self.pressed + } +} diff --git a/rp2040_42/src/layout.rs b/rp2040_42/src/layout.rs new file mode 100644 index 0000000..c3f72f8 --- /dev/null +++ b/rp2040_42/src/layout.rs @@ -0,0 +1,203 @@ +//! Project: CMtec CMDR Keyboard 42 +//! Date: 2023-07-01 +//! Author: Christoffer Martinsson +//! Email: cm@cmtec.se +//! License: Please refer to LICENSE in root directory + +// Button index map: +// ------------------------------------- ------------------------------------- +// | 0 | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 10 | 11 | +// | 12 | 13 | 14 | 15 | 16 | 17 | | 18 | 19 | 20 | 21 | 22 | 23 | +// | 24 | 25 | 26 | 27 | 28 | 29 | | 30 | 31 | 32 | 33 | 34 | 35 | +// ------------------| 39 | 40 | 41 | | 42 | 43 | 44 |------------------ +// 36 37 38 ------------------- ------------------- 45 46 47 +// +// Swedish keymap conversion table: +// US Swedish +// -------------------------- +// Grave § +// Semicolon ö +// Apostrophe ä +// LeftBrace å +// ForwardSlash - +// NonUSBackslash < +// Equal ´ +// Backslash ' +// RightBrace ^ +// Minus + +// LeftAlt Alt +// RightAlt AltGr + +use crate::NUMBER_OF_KEYS; +use usbd_human_interface_device::page::Keyboard; + +/// Function (Fn) buttons index (need two buttons) +/// Button 41 are used both as Fn and RightAlt (AltGr) for better ergonomics. +/// This means that RightAlt is only available on layer 1 keys. +pub const FN_BUTTONS: [u8; 3] = [40, 43, 44]; + +/// Sticky button [index, layer] +pub const STICKY_BUTTON: [u8; 2] = [7, 2]; + +/// Button map to HID key (three Function layers) +pub const MAP: [[Keyboard; NUMBER_OF_KEYS]; 3] = [ + [ + // Function layer 0 + // HID Key // Button Index + // ----------------------------------------- + Keyboard::Tab, // 0 + Keyboard::Q, // 1 + Keyboard::W, // 2 + Keyboard::E, // 3 + Keyboard::R, // 4 + Keyboard::T, // 5 + Keyboard::Y, // 6 + Keyboard::U, // 7 + Keyboard::I, // 8 + Keyboard::O, // 9 + Keyboard::P, // 10 + Keyboard::LeftBrace, // 11 å + Keyboard::LeftControl, // 12 + Keyboard::A, // 13 + Keyboard::S, // 14 + Keyboard::D, // 15 + Keyboard::F, // 16 + Keyboard::G, // 17 + Keyboard::H, // 18 + Keyboard::J, // 19 + Keyboard::K, // 20 + Keyboard::L, // 21 + Keyboard::Semicolon, // 22 ö + Keyboard::Apostrophe, // 23 ä + Keyboard::LeftShift, // 24 + Keyboard::Z, // 25 + Keyboard::X, // 26 + Keyboard::C, // 27 + Keyboard::V, // 28 + Keyboard::B, // 29 + Keyboard::N, // 30 + Keyboard::M, // 31 + Keyboard::Comma, // 32 + Keyboard::Dot, // 33 + Keyboard::ForwardSlash, // 34 - + Keyboard::RightShift, // 35 + Keyboard::NoEventIndicated, // 36 no button connected + Keyboard::NoEventIndicated, // 37 no button connected + Keyboard::NoEventIndicated, // 38 no button connected + Keyboard::LeftAlt, // 39 + Keyboard::NoEventIndicated, // 40 Fn (= will never trigg this layer) + Keyboard::Space, // 41 + Keyboard::Space, // 42 + Keyboard::NoEventIndicated, // 43 Fn (= will never trigg this layer) + Keyboard::NoEventIndicated, // 44 Fn (= will never trigg this layer) + Keyboard::NoEventIndicated, // 45 no button connected + Keyboard::NoEventIndicated, // 46 no button connected + Keyboard::NoEventIndicated, // 47 no button connected + ], + [ + // Function layer 1 + // HID Key // Button Index + // ----------------------------------------- + Keyboard::Escape, // 0 + Keyboard::F1, // 1 + Keyboard::F2, // 2 + Keyboard::F3, // 3 + Keyboard::F4, // 4 + Keyboard::F5, // 5 + Keyboard::F6, // 6 + Keyboard::F7, // 7 + Keyboard::F8, // 8 + Keyboard::F9, // 9 + Keyboard::F10, // 10 + Keyboard::DeleteBackspace, // 11 + Keyboard::LeftControl, // 12 + Keyboard::Keyboard1, // 13 + Keyboard::Keyboard2, // 14 + Keyboard::Keyboard3, // 15 + Keyboard::Keyboard4, // 16 + Keyboard::Keyboard5, // 17 + Keyboard::Keyboard6, // 18 + Keyboard::Keyboard7, // 19 + Keyboard::Keyboard8, // 20 + Keyboard::Keyboard9, // 21 + Keyboard::Keyboard0, // 22 + Keyboard::ReturnEnter, // 23 + Keyboard::LeftShift, // 24 + Keyboard::Keyboard6, // 25 + Keyboard::Keyboard7, // 26 + Keyboard::Keyboard8, // 27 + Keyboard::Keyboard9, // 28 + Keyboard::Keyboard0, // 29 + Keyboard::NonUSBackslash, // 30 < + Keyboard::Equal, // 31 ´ + Keyboard::Backslash, // 32 ' + Keyboard::RightBrace, // 33 ^ + Keyboard::Minus, // 34 + + Keyboard::RightShift, // 35 + Keyboard::NoEventIndicated, // 36 no button connected + Keyboard::NoEventIndicated, // 37 no button connected + Keyboard::NoEventIndicated, // 38 no button connected + Keyboard::LeftAlt, // 39 + Keyboard::NoEventIndicated, // 40 Fn + Keyboard::DeleteBackspace, // 41 + Keyboard::DeleteBackspace, // 42 + Keyboard::NoEventIndicated, // 43 Fn + Keyboard::RightAlt, // 44 Fn + Keyboard::NoEventIndicated, // 45 no button connected + Keyboard::NoEventIndicated, // 46 no button connected + Keyboard::NoEventIndicated, // 47 no button connected + ], + [ + // Function layer 2 + // HID Key // Button Index + // ----------------------------------------- + Keyboard::NoEventIndicated, // 0 + Keyboard::F11, // 1 + Keyboard::F12, // 2 + Keyboard::F13, // 3 + Keyboard::F14, // 4 + Keyboard::NoEventIndicated, // 5 + Keyboard::Grave, // 6 § + Keyboard::NoEventIndicated, // 7 STICKY lock + Keyboard::LeftGUI, // 8 + Keyboard::NoEventIndicated, // 9 + Keyboard::CapsLock, // 10 + Keyboard::DeleteBackspace, // 11 + Keyboard::LeftControl, // 12 + Keyboard::F15, // 13 + Keyboard::F16, // 14 + Keyboard::F17, // 15 + Keyboard::F18, // 16 + Keyboard::F19, // 17 + Keyboard::LeftArrow, // 18 + Keyboard::DownArrow, // 19 + Keyboard::UpArrow, // 20 + Keyboard::RightArrow, // 21 + Keyboard::DeleteForward, // 22 + Keyboard::ReturnEnter, // 23 + Keyboard::LeftShift, // 24 + Keyboard::F20, // 25 + Keyboard::F21, // 26 + Keyboard::F22, // 27 + Keyboard::F23, // 28 + Keyboard::F24, // 29 + Keyboard::Home, // 30 + Keyboard::PageDown, // 31 + Keyboard::PageUp, // 32 + Keyboard::End, // 33 + Keyboard::Insert, // 34 + Keyboard::RightShift, // 35 + Keyboard::NoEventIndicated, // 36 no button connected + Keyboard::NoEventIndicated, // 37 no button connected + Keyboard::NoEventIndicated, // 38 no button connected + Keyboard::LeftAlt, // 39 + Keyboard::NoEventIndicated, // 40 Fn + Keyboard::LeftGUI, // 41 + Keyboard::DeleteBackspace, // 42 + Keyboard::NoEventIndicated, // 43 Fn + Keyboard::NoEventIndicated, // 44 Fn + Keyboard::NoEventIndicated, // 45 no button connected + Keyboard::NoEventIndicated, // 46 no button connected + Keyboard::NoEventIndicated, // 47 no button connected + ], +]; diff --git a/rp2040_42/src/main.rs b/rp2040_42/src/main.rs new file mode 100644 index 0000000..ee3854f --- /dev/null +++ b/rp2040_42/src/main.rs @@ -0,0 +1,379 @@ +//! Project: CMtec CMDR Keyboard 42 +//! Date: 2023-07-01 +//! Author: Christoffer Martinsson +//! Email: cm@cmtec.se +//! License: Please refer to LICENSE in root directory + +#![no_std] +#![no_main] + +mod button_matrix; +mod layout; +mod status_led; + +use button_matrix::ButtonMatrix; +use core::convert::Infallible; +use cortex_m::delay::Delay; +use embedded_hal::digital::v2::*; +use embedded_hal::timer::CountDown; +use fugit::ExtU32; +use panic_halt as _; +use rp2040_hal::{ + gpio::{Function, FunctionConfig, PinId, ValidPinMode}, + pio::StateMachineIndex, +}; +use status_led::{StatusMode, Ws2812StatusLed}; +use usb_device::class_prelude::*; +use usb_device::prelude::*; +use usbd_human_interface_device::page::Keyboard; +use usbd_human_interface_device::prelude::*; +use waveshare_rp2040_zero::entry; +use waveshare_rp2040_zero::{ + hal::{ + clocks::{init_clocks_and_plls, Clock}, + pac, + pio::PIOExt, + timer::Timer, + watchdog::Watchdog, + Sio, + }, + Pins, XOSC_CRYSTAL_FREQ, +}; + +// Public constants +pub const KEY_ROWS: usize = 4; +pub const KEY_COLS: usize = 12; +pub const NUMBER_OF_KEYS: usize = KEY_ROWS * KEY_COLS; + +// Public types +#[derive(Copy, Clone, Default)] +pub struct KeyboardButton { + pub pressed: bool, + pub previous_pressed: bool, + pub fn_mode: u8, +} + +#[entry] +fn main() -> ! { + // Grab our singleton objects + let mut pac = pac::Peripherals::take().unwrap(); + + // Set up the watchdog driver - needed by the clock setup code + let mut watchdog = Watchdog::new(pac.WATCHDOG); + + // Configure clocks and PLLs + let clocks = init_clocks_and_plls( + XOSC_CRYSTAL_FREQ, + pac.XOSC, + pac.CLOCKS, + pac.PLL_SYS, + pac.PLL_USB, + &mut pac.RESETS, + &mut watchdog, + ) + .ok() + .unwrap(); + + let core = pac::CorePeripherals::take().unwrap(); + + // The single-cycle I/O block controls our GPIO pins + let sio = Sio::new(pac.SIO); + + // Set the pins to their default state + let pins = Pins::new( + pac.IO_BANK0, + pac.PADS_BANK0, + sio.gpio_bank0, + &mut pac.RESETS, + ); + + // Setting up array with pins connected to button rows + let button_matrix_row_pins: &[&dyn InputPin; KEY_ROWS] = &[ + &pins.gp0.into_pull_up_input(), + &pins.gp1.into_pull_up_input(), + &pins.gp29.into_pull_up_input(), + &pins.gp28.into_pull_up_input(), + ]; + + // Setting up array with pins connected to button columns + let button_matrix_col_pins: &mut [&mut dyn OutputPin; KEY_COLS] = &mut [ + &mut pins.gp12.into_push_pull_output(), + &mut pins.gp13.into_push_pull_output(), + &mut pins.gp14.into_push_pull_output(), + &mut pins.gp15.into_push_pull_output(), + &mut pins.gp26.into_push_pull_output(), + &mut pins.gp27.into_push_pull_output(), + &mut pins.gp7.into_push_pull_output(), + &mut pins.gp8.into_push_pull_output(), + &mut pins.gp6.into_push_pull_output(), + &mut pins.gp9.into_push_pull_output(), + &mut pins.gp10.into_push_pull_output(), + &mut pins.gp11.into_push_pull_output(), + ]; + + // Create button matrix object that scans all the PCB buttons + let mut button_matrix: ButtonMatrix = + ButtonMatrix::new(button_matrix_row_pins, button_matrix_col_pins, 5); + + // Configure USB + let usb_bus = UsbBusAllocator::new(waveshare_rp2040_zero::hal::usb::UsbBus::new( + pac.USBCTRL_REGS, + pac.USBCTRL_DPRAM, + clocks.usb_clock, + true, + &mut pac.RESETS, + )); + + let mut keyboard = UsbHidClassBuilder::new() + .add_device( + usbd_human_interface_device::device::keyboard::NKROBootKeyboardConfig::default(), + ) + .build(&usb_bus); + + let mut usb_dev = UsbDeviceBuilder::new(&usb_bus, UsbVidPid(0x1209, 0x0001)) + .manufacturer("CMtec") + .product("CMDR keyboard") + .serial_number("0001") + .build(); + + // Create status LED + let (mut pio, sm0, _, _, _) = pac.PIO0.split(&mut pac.RESETS); + let mut status_led = Ws2812StatusLed::new( + pins.neopixel.into_mode(), + &mut pio, + sm0, + clocks.peripheral_clock.freq(), + ); + + // Create keyboard button array + let mut buttons: [KeyboardButton; NUMBER_OF_KEYS] = [KeyboardButton::default(); NUMBER_OF_KEYS]; + + // Create timers/delays + let timer = Timer::new(pac.TIMER, &mut pac.RESETS); + let mut delay = Delay::new(core.SYST, clocks.system_clock.freq().to_Hz()); + + let mut usb_hid_report_count_down = timer.count_down(); + usb_hid_report_count_down.start(10.millis()); + + let mut usb_tick_count_down = timer.count_down(); + usb_tick_count_down.start(1.millis()); + + let mut status_led_count_down = timer.count_down(); + status_led_count_down.start(250.millis()); + + let mut start_count_down = timer.count_down(); + start_count_down.start(5000.millis()); + + // Create variables to track caps lock and fn mode + let mut caps_lock_active: bool = false; + let mut fn_mode: u8; + let mut sticky_state: u8 = 0; + let mut sticky_key: Keyboard = Keyboard::NoEventIndicated; + let mut started: bool = false; + + // Initialize button matrix + button_matrix.init_pins(); + + // Scan matrix to get initial state + for _ in 0..10 { + button_matrix.scan_matrix(&mut delay); + } + + // Check if esc key is pressed while power on. If yes then enter bootloader + if button_matrix.buttons_pressed()[0] { + status_led.update(StatusMode::Bootloader); + let gpio_activity_pin_mask: u32 = 0; + let disable_interface_mask: u32 = 0; + rp2040_hal::rom_data::reset_to_usb_boot(gpio_activity_pin_mask, disable_interface_mask); + } + + loop { + if status_led_count_down.wait().is_ok() { + update_status_led(&mut status_led, &caps_lock_active, &sticky_state, &started); + } + + if start_count_down.wait().is_ok() && !started { + started = true; + } + + if usb_hid_report_count_down.wait().is_ok() { + let pressed_keys = button_matrix.buttons_pressed(); + + fn_mode = get_fn_mode(pressed_keys); + + if !caps_lock_active && sticky_state != 2 { + update_status_led(&mut status_led, &caps_lock_active, &sticky_state, &started); + } + + for (index, key) in pressed_keys.iter().enumerate() { + buttons[index].pressed = *key; + } + + let keyboard_report = + get_keyboard_report(&mut buttons, fn_mode, &mut sticky_state, &mut sticky_key); + + match keyboard.device().write_report(keyboard_report) { + Err(UsbHidError::WouldBlock) => {} + Err(UsbHidError::Duplicate) => {} + Ok(_) => {} + Err(e) => { + status_led.update(StatusMode::Error); + core::panic!("Failed to write keyboard report: {:?}", e) + } + }; + } + + if usb_tick_count_down.wait().is_ok() { + button_matrix.scan_matrix(&mut delay); + + match keyboard.tick() { + Err(UsbHidError::WouldBlock) => {} + Ok(_) => {} + Err(e) => { + status_led.update(StatusMode::Error); + core::panic!("Failed to process keyboard tick: {:?}", e) + } + }; + } + + if usb_dev.poll(&mut [&mut keyboard]) { + match keyboard.device().read_report() { + Err(UsbError::WouldBlock) => {} + Err(e) => { + status_led.update(StatusMode::Error); + core::panic!("Failed to read keyboard report: {:?}", e) + } + Ok(leds) => { + caps_lock_active = leds.caps_lock; + } + } + } + } +} + +/// Update status LED colour based on function layer and capslock +/// +/// Normal = Off (OFF) +/// STICKY lock = blue/falshing blue (ACTIVITY) +/// Capslock active = flashing red (WARNING) +/// Error = steady red (ERROR) +/// +/// # Arguments +/// * `status_led` - Reference to status LED +/// * `caps_lock_active` - Is capslock active +fn update_status_led( + status_led: &mut Ws2812StatusLed, + caps_lock_active: &bool, + sticky_state: &u8, + started: &bool, +) where + P: PIOExt + FunctionConfig, + I: PinId, + Function

: ValidPinMode, + SM: StateMachineIndex, +{ + if *caps_lock_active { + status_led.update(StatusMode::Warning); + } else if *sticky_state == 1 { + status_led.update(StatusMode::Activity); + } else if *sticky_state == 2 { + status_led.update(StatusMode::ActivityFlash); + } else if !(*started) { + status_led.update(StatusMode::Normal); + } else { + status_led.update(StatusMode::Off); + } +} + +/// Get current Fn mode (0, 1 or 2) +/// layout::FN_BUTTONS contains the keycodes for each Fn key +/// +/// # Arguments +/// +/// * `pressed_keys` - Array of pressed keys +fn get_fn_mode(pressed_keys: [bool; NUMBER_OF_KEYS]) -> u8 { + // Check how many Fn keys are pressed + let mut active_fn_keys = layout::FN_BUTTONS + .iter() + .filter(|button_id| pressed_keys[**button_id as usize]) + .count() as u8; + + // Limit Fn mode to 2 + if active_fn_keys > 2 { + active_fn_keys = 2; + } + active_fn_keys +} + +/// Generate keyboard report based on pressed keys and Fn mode (0, 1 or 2) +/// layout::MAP contains the keycodes for each key in each Fn mode +/// +/// # Arguments +/// +/// * `matrix_keys` - Array of pressed keys +/// * `fn_mode` - Current function layer +/// * `sticky_state` - Is STICKY lock active +/// * `sticky_key` - the key pressed after STICKY lock was activated +fn get_keyboard_report( + matrix_keys: &mut [KeyboardButton; NUMBER_OF_KEYS], + fn_mode: u8, + sticky_state: &mut u8, + sticky_key: &mut Keyboard, +) -> [Keyboard; NUMBER_OF_KEYS] { + let mut keyboard_report: [Keyboard; NUMBER_OF_KEYS] = + [Keyboard::NoEventIndicated; NUMBER_OF_KEYS]; + + // Filter report based on Fn mode and pressed keys + for (index, key) in matrix_keys.iter_mut().enumerate() { + // Check if STICKY button is pressed (SET STICKY) + if key.pressed != key.previous_pressed + && key.pressed + && index as u8 == layout::STICKY_BUTTON[0] + && fn_mode == layout::STICKY_BUTTON[1] + && *sticky_state == 0 + { + *sticky_state = 1; + } + // Check if STICKY button is pressed (CLEAR STICKY) + else if key.pressed != key.previous_pressed + && key.pressed + && index as u8 == layout::STICKY_BUTTON[0] + && fn_mode == layout::STICKY_BUTTON[1] + && *sticky_state != 0 + { + *sticky_state = 0; + *sticky_key = Keyboard::NoEventIndicated; + } + + // Set fn mode for the pressed button + if key.pressed != key.previous_pressed && key.pressed { + key.fn_mode = fn_mode; + } + key.previous_pressed = key.pressed; + + // Skip key if defined as NoEventIndicated + if layout::MAP[key.fn_mode as usize][index] == Keyboard::NoEventIndicated { + continue; + } + + // If STICKY lock is active, hold index key pressed until STICKY lock key is pressed + // again + if *sticky_state == 1 && key.pressed { + *sticky_key = layout::MAP[key.fn_mode as usize][index]; + *sticky_state = 2; + } + + // Add defined HID key to the report + if key.pressed { + keyboard_report[index] = layout::MAP[key.fn_mode as usize][index]; + } + } + + /// Index of STICKY key in keyboard report + /// Index 36, 37, 38, 45, 46, 47 are not used by any other keys + const STICKY_REPORT_INDEX: usize = 46; + // Add sticky key to the report + keyboard_report[STICKY_REPORT_INDEX] = *sticky_key; + + keyboard_report +} diff --git a/rp2040_42/src/status_led.rs b/rp2040_42/src/status_led.rs new file mode 100644 index 0000000..8d95e59 --- /dev/null +++ b/rp2040_42/src/status_led.rs @@ -0,0 +1,142 @@ +//! Project: CMtec CMDR Keyboard 42 +//! Date: 2023-07-01 +//! Author: Christoffer Martinsson +//! Email: cm@cmtec.se +//! License: Please refer to LICENSE in root directory + +use rp2040_hal::{ + gpio::{Function, FunctionConfig, Pin, PinId, ValidPinMode}, + pio::{PIOExt, StateMachineIndex, UninitStateMachine, PIO}, +}; +use smart_leds::{SmartLedsWrite, RGB8}; +use ws2812_pio::Ws2812Direct; + +/// Status LED modes +/// +/// * OFF = Syatem offline +/// * NORMAL = All system Ok +/// * ACTIVITY = System activity +/// * OTHER = Other activity +/// * WARNING = Warning +/// * ERROR = Error +/// * BOOTLOADER = Bootloader active +#[allow(dead_code)] +#[derive(PartialEq, Eq, Copy, Clone)] +pub enum StatusMode { + Off = 0, + Normal = 1, + Activity = 2, + ActivityFlash = 3, + Other = 4, + OtherFlash = 5, + Warning = 6, + Error = 7, + Bootloader = 8, +} +#[warn(dead_code)] + +/// Status LED driver +/// This driver uses the PIO state machine to drive a WS2812 LED +/// +/// # Example +/// +/// ``` +/// let mut status_led = Ws2812StatusLed::new( +/// pins.neopixel.into_mode(), +/// &mut pio, +/// sm0, +/// clocks.peripheral_clock.freq(), +/// ); +/// ``` +pub struct Ws2812StatusLed +where + I: PinId, + P: PIOExt + FunctionConfig, + Function

: ValidPinMode, + SM: StateMachineIndex, +{ + ws2812_direct: Ws2812Direct, + state: bool, +} + +impl Ws2812StatusLed +where + I: PinId, + P: PIOExt + FunctionConfig, + Function

: ValidPinMode, + SM: StateMachineIndex, +{ + /// Creates a new instance of this driver. + /// + /// # Arguments + /// + /// * `pin` - PIO pin + /// * `pio` - PIO instance + /// * `sm` - PIO state machine + /// * `clock_freq` - PIO clock frequency + pub fn new( + pin: Pin>, + pio: &mut PIO

, + sm: UninitStateMachine<(P, SM)>, + clock_freq: fugit::HertzU32, + ) -> Self { + // prepare the PIO program + let ws2812_direct = Ws2812Direct::new(pin, pio, sm, clock_freq); + let state = false; + Self { + ws2812_direct, + state, + } + } + + /// Update status LED + /// Depending on the mode, the LED will be set to a different colour + /// + /// * OFF = off + /// * NORMAL = green + /// * ACTIVITY = blue + /// * OTHER = orange + /// * WARNING = red (flashing) + /// * ERROR = red + /// * BOOTLOADER = purple + /// + /// Make sure to call this function regularly to keep the LED flashing + pub fn update(&mut self, mode: StatusMode) { + let colors: [RGB8; 9] = [ + (0, 0, 0).into(), // Off + (10, 7, 0).into(), // Green + (10, 4, 10).into(), // Blue + (10, 4, 10).into(), // Blue + (5, 10, 0).into(), // Orange + (5, 10, 0).into(), // Orange + (2, 20, 0).into(), // Red + (2, 20, 0).into(), // Red + (0, 10, 10).into(), // Purple + ]; + + if (mode == StatusMode::ActivityFlash + || mode == StatusMode::OtherFlash + || mode == StatusMode::Warning) + && !self.state + { + self.ws2812_direct + .write([colors[mode as usize]].iter().copied()) + .unwrap(); + self.state = true; + } else if mode == StatusMode::ActivityFlash + || mode == StatusMode::OtherFlash + || mode == StatusMode::Warning + || mode == StatusMode::Off + { + self.ws2812_direct + .write([colors[0]].iter().copied()) + .unwrap(); + self.state = false; + } else { + self.ws2812_direct + .write([colors[mode as usize]].iter().copied()) + .unwrap(); + self.state = true; + } + } +} diff --git a/rp2040_51/Cargo.lock b/rp2040_51/Cargo.lock new file mode 100644 index 0000000..09fa749 --- /dev/null +++ b/rp2040_51/Cargo.lock @@ -0,0 +1,595 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "arrayvec" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" + +[[package]] +name = "bare-metal" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5deb64efa5bd81e31fcd1938615a6d98c82eafcbcd787162b6f63b91d6bac5b3" +dependencies = [ + "rustc_version", +] + +[[package]] +name = "bitfield" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46afbd2983a5d5a7bd740ccb198caf5b82f45c40c09c0eed36052d91cb92e719" + +[[package]] +name = "bitvec" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + +[[package]] +name = "bytemuck" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8334215b81e418a0a7bdb8ef0849474f40bb10c8b71f1c4ed315cff49f32494d" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "cortex-m" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ec610d8f49840a5b376c69663b6369e71f4b34484b9b2eb29fb918d92516cb9" +dependencies = [ + "bare-metal", + "bitfield", + "embedded-hal", + "volatile-register", +] + +[[package]] +name = "cortex-m-rt" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "801d4dec46b34c299ccf6b036717ae0fce602faa4f4fe816d9013b9a7c9f5ba6" +dependencies = [ + "cortex-m-rt-macros", +] + +[[package]] +name = "cortex-m-rt-macros" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e37549a379a9e0e6e576fd208ee60394ccb8be963889eebba3ffe0980364f472" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", +] + +[[package]] +name = "crc-any" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a62ec9ff5f7965e4d7280bd5482acd20aadb50d632cf6c1d74493856b011fa73" +dependencies = [ + "debug-helper", +] + +[[package]] +name = "critical-section" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b" + +[[package]] +name = "debug-helper" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f578e8e2c440e7297e008bb5486a3a8a194775224bbc23729b0dbdfaeebf162e" + +[[package]] +name = "either" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" + +[[package]] +name = "embedded-dma" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "994f7e5b5cb23521c22304927195f236813053eb9c065dd2226a32ba64695446" +dependencies = [ + "stable_deref_trait", +] + +[[package]] +name = "embedded-hal" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35949884794ad573cf46071e41c9b60efb0cb311e3ca01f7af807af1debc66ff" +dependencies = [ + "nb 0.1.3", + "void", +] + +[[package]] +name = "frunk" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "874b6a17738fc273ec753618bac60ddaeac48cb1d7684c3e7bd472e57a28b817" +dependencies = [ + "frunk_core", + "frunk_derives", +] + +[[package]] +name = "frunk_core" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3529a07095650187788833d585c219761114005d5976185760cf794d265b6a5c" + +[[package]] +name = "frunk_derives" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e99b8b3c28ae0e84b604c75f721c21dc77afb3706076af5e8216d15fd1deaae3" +dependencies = [ + "frunk_proc_macro_helpers", + "quote", + "syn 2.0.87", +] + +[[package]] +name = "frunk_proc_macro_helpers" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05a956ef36c377977e512e227dcad20f68c2786ac7a54dacece3746046fea5ce" +dependencies = [ + "frunk_core", + "proc-macro2", + "quote", + "syn 2.0.87", +] + +[[package]] +name = "fugit" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17186ad64927d5ac8f02c1e77ccefa08ccd9eaa314d5a4772278aa204a22f7e7" +dependencies = [ + "gcd", +] + +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + +[[package]] +name = "gcd" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d758ba1b47b00caf47f24925c0074ecb20d6dfcffe7f6d53395c0465674841a" + +[[package]] +name = "hash32" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606" +dependencies = [ + "byteorder", +] + +[[package]] +name = "heapless" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" +dependencies = [ + "hash32", + "stable_deref_trait", +] + +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + +[[package]] +name = "nb" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "801d31da0513b6ec5214e9bf433a77966320625a37860f910be265be6e18d06f" +dependencies = [ + "nb 1.1.0", +] + +[[package]] +name = "nb" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d" + +[[package]] +name = "num_enum" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f646caf906c20226733ed5b1374287eb97e3c2a5c227ce668c1f2ce20ae57c9" +dependencies = [ + "num_enum_derive 0.5.11", +] + +[[package]] +name = "num_enum" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e613fc340b2220f734a8595782c551f1250e969d87d3be1ae0579e8d4065179" +dependencies = [ + "num_enum_derive 0.7.3", +] + +[[package]] +name = "num_enum_derive" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcbff9bc912032c62bf65ef1d5aea88983b420f4f839db1e9b0c281a25c9c799" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "num_enum_derive" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", +] + +[[package]] +name = "option-block" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0f2c5d345596a14d7c8b032a68f437955f0059f2eb9a5972371c84f7eef3227" + +[[package]] +name = "packed_struct" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36b29691432cc9eff8b282278473b63df73bea49bc3ec5e67f31a3ae9c3ec190" +dependencies = [ + "bitvec", + "packed_struct_codegen", +] + +[[package]] +name = "packed_struct_codegen" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cd6706dfe50d53e0f6aa09e12c034c44faacd23e966ae5a209e8bdb8f179f98" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "panic-halt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de96540e0ebde571dc55c73d60ef407c653844e6f9a1e2fdbd40c07b9252d812" + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "pio" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76e09694b50f89f302ed531c1f2a7569f0be5867aee4ab4f8f729bbeec0078e3" +dependencies = [ + "arrayvec", + "num_enum 0.5.11", + "paste", +] + +[[package]] +name = "proc-macro2" +version = "1.0.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" + +[[package]] +name = "rgb" +version = "0.8.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57397d16646700483b67d2dd6511d79318f9d057fdbd21a4066aeac8b41d310a" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "rp2040" +version = "0.1.0" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "embedded-hal", + "fugit", + "nb 1.1.0", + "packed_struct", + "panic-halt", + "pio", + "rp2040-boot2", + "rp2040-hal", + "smart-leds", + "smart-leds-trait", + "usb-device", + "usbd-human-interface-device", + "waveshare-rp2040-zero", + "ws2812-pio", +] + +[[package]] +name = "rp2040-boot2" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c773ec49b836077aa144b58dc7654a243e1eecdb6cf0d25361ae7c7600fabd8" +dependencies = [ + "crc-any", +] + +[[package]] +name = "rp2040-hal" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1369bb84862d7f69391a96606b2f29a00bfce7f29a749e23d5f01fc3f607ada0" +dependencies = [ + "cortex-m", + "critical-section", + "embedded-dma", + "embedded-hal", + "fugit", + "itertools", + "nb 1.1.0", + "paste", + "pio", + "rand_core", + "rp2040-hal-macros", + "rp2040-pac", + "usb-device", + "vcell", + "void", +] + +[[package]] +name = "rp2040-hal-macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86479063e497efe1ae81995ef9071f54fd1c7427e04d6c5b84cde545ff672a5e" +dependencies = [ + "cortex-m-rt", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "rp2040-pac" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9192cafbb40d717c9e0ddf767aaf9c69fee1b4e48d22ed853b57b11f6d9f3d7e" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "vcell", +] + +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +dependencies = [ + "semver", +] + +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +dependencies = [ + "semver-parser", +] + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" + +[[package]] +name = "smart-leds" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38dd45fa275f70b4110eac5f5182611ad384f88bb22b68b9a9c3cafd7015290b" +dependencies = [ + "smart-leds-trait", +] + +[[package]] +name = "smart-leds-trait" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebf6d833fa93f16a1c1874e62c2aebe8567e5bdd436d59bf543ed258b6f7a8e3" +dependencies = [ + "rgb", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + +[[package]] +name = "unicode-ident" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" + +[[package]] +name = "usb-device" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f6cc3adc849b5292b4075fc0d5fdcf2f24866e88e336dd27a8943090a520508" + +[[package]] +name = "usbd-human-interface-device" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d69710303c06f23a1259d086bfb241212ae1ccfb5d582ebd596bb042d662ed73" +dependencies = [ + "frunk", + "fugit", + "heapless", + "num_enum 0.7.3", + "option-block", + "packed_struct", + "usb-device", +] + +[[package]] +name = "vcell" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77439c1b53d2303b20d9459b1ade71a83c716e3f9c34f3228c00e6f185d6c002" + +[[package]] +name = "void" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" + +[[package]] +name = "volatile-register" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de437e2a6208b014ab52972a27e59b33fa2920d3e00fe05026167a1c509d19cc" +dependencies = [ + "vcell", +] + +[[package]] +name = "waveshare-rp2040-zero" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e36889ce533ed216200dc2e2179d1fba8f9ba432da2d69406dc2cfe1edc7e89" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "rp2040-boot2", + "rp2040-hal", +] + +[[package]] +name = "ws2812-pio" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d219e3b43c1e14305b36363060c0348d560314e235d999cf492bbbab1f38e8d" +dependencies = [ + "cortex-m", + "embedded-hal", + "fugit", + "nb 1.1.0", + "pio", + "rp2040-hal", + "smart-leds-trait", +] + +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] diff --git a/rp2040_51/src/button_matrix.rs b/rp2040_51/src/button_matrix.rs index 2c7e0da..e093b99 100644 --- a/rp2040_51/src/button_matrix.rs +++ b/rp2040_51/src/button_matrix.rs @@ -1,4 +1,4 @@ -//! Project: CMtec CMDR Keyboard 42 +//! Project: CMtec CMDR Keyboard 51 //! Date: 2023-07-01 //! Author: Christoffer Martinsson //! Email: cm@cmtec.se diff --git a/rp2040_51/src/layout.rs b/rp2040_51/src/layout.rs index c3f72f8..7b2f3bf 100644 --- a/rp2040_51/src/layout.rs +++ b/rp2040_51/src/layout.rs @@ -1,17 +1,17 @@ -//! Project: CMtec CMDR Keyboard 42 +//! Project: CMtec CMDR Keyboard 51 //! Date: 2023-07-01 //! Author: Christoffer Martinsson //! Email: cm@cmtec.se //! License: Please refer to LICENSE in root directory // Button index map: -// ------------------------------------- ------------------------------------- -// | 0 | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 10 | 11 | -// | 12 | 13 | 14 | 15 | 16 | 17 | | 18 | 19 | 20 | 21 | 22 | 23 | -// | 24 | 25 | 26 | 27 | 28 | 29 | | 30 | 31 | 32 | 33 | 34 | 35 | -// ------------------| 39 | 40 | 41 | | 42 | 43 | 44 |------------------ -// 36 37 38 ------------------- ------------------- 45 46 47 -// +// ------------------------------------- ------------------------------------- +// | 0 | 1 | 2 | 3 | 4 | 5 | 48 51 | 6 | 7 | 8 | 9 | 10 | 11 | +// | 12 | 13 | 14 | 15 | 16 | 17 | 49 52 | 18 | 19 | 20 | 21 | 22 | 23 | +// | 24 | 25 | 26 | 27 | 28 | 29 | 50 53 | 30 | 31 | 32 | 33 | 34 | 35 | +// ------------------| 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 |------------------ +// ------------------------------------------------------ 45 46 47 +// 54 55 56 57 58 59 // Swedish keymap conversion table: // US Swedish // -------------------------- @@ -34,10 +34,10 @@ use usbd_human_interface_device::page::Keyboard; /// Function (Fn) buttons index (need two buttons) /// Button 41 are used both as Fn and RightAlt (AltGr) for better ergonomics. /// This means that RightAlt is only available on layer 1 keys. -pub const FN_BUTTONS: [u8; 3] = [40, 43, 44]; +pub const FN_BUTTONS: [u8; 3] = [37, 43, 44]; /// Sticky button [index, layer] -pub const STICKY_BUTTON: [u8; 2] = [7, 2]; +pub const STICKY_BUTTON: [u8; 2] = [48, 0]; /// Button map to HID key (three Function layers) pub const MAP: [[Keyboard; NUMBER_OF_KEYS]; 3] = [ @@ -81,18 +81,30 @@ pub const MAP: [[Keyboard; NUMBER_OF_KEYS]; 3] = [ Keyboard::Dot, // 33 Keyboard::ForwardSlash, // 34 - Keyboard::RightShift, // 35 - Keyboard::NoEventIndicated, // 36 no button connected - Keyboard::NoEventIndicated, // 37 no button connected - Keyboard::NoEventIndicated, // 38 no button connected - Keyboard::LeftAlt, // 39 - Keyboard::NoEventIndicated, // 40 Fn (= will never trigg this layer) - Keyboard::Space, // 41 + Keyboard::LeftAlt, // 36 + Keyboard::NoEventIndicated, // 37 Fn (= will never trigg this layer) + Keyboard::Space, // 38 + Keyboard::DeleteBackspace, // 39 no button connected + Keyboard::LeftGUI, // 40 no button connected + Keyboard::ReturnEnter, // 41 no button connected Keyboard::Space, // 42 Keyboard::NoEventIndicated, // 43 Fn (= will never trigg this layer) Keyboard::NoEventIndicated, // 44 Fn (= will never trigg this layer) Keyboard::NoEventIndicated, // 45 no button connected Keyboard::NoEventIndicated, // 46 no button connected Keyboard::NoEventIndicated, // 47 no button connected + Keyboard::NoEventIndicated, // 48 no button connected + Keyboard::F2, // 49 no button connected + Keyboard::F3, // 50 no button connected + Keyboard::PrintScreen, // 51 no button connected + Keyboard::F5, // 52 no button connected + Keyboard::F6, // 53 no button connected + Keyboard::NoEventIndicated, // 54 no button connected + Keyboard::NoEventIndicated, // 55 no button connected + Keyboard::NoEventIndicated, // 56 no button connected + Keyboard::NoEventIndicated, // 57 no button connected + Keyboard::NoEventIndicated, // 58 no button connected + Keyboard::NoEventIndicated, // 59 no button connected ], [ // Function layer 1 @@ -134,24 +146,36 @@ pub const MAP: [[Keyboard; NUMBER_OF_KEYS]; 3] = [ Keyboard::RightBrace, // 33 ^ Keyboard::Minus, // 34 + Keyboard::RightShift, // 35 - Keyboard::NoEventIndicated, // 36 no button connected - Keyboard::NoEventIndicated, // 37 no button connected - Keyboard::NoEventIndicated, // 38 no button connected - Keyboard::LeftAlt, // 39 - Keyboard::NoEventIndicated, // 40 Fn - Keyboard::DeleteBackspace, // 41 - Keyboard::DeleteBackspace, // 42 - Keyboard::NoEventIndicated, // 43 Fn - Keyboard::RightAlt, // 44 Fn + Keyboard::LeftAlt, // 36 + Keyboard::NoEventIndicated, // 37 Fn (= will never trigg this layer) + Keyboard::Space, // 38 + Keyboard::DeleteBackspace, // 39 no button connected + Keyboard::LeftGUI, // 40 no button connected + Keyboard::ReturnEnter, // 41 no button connected + Keyboard::Space, // 42 + Keyboard::NoEventIndicated, // 43 Fn (= will never trigg this layer) + Keyboard::RightAlt, // 44 Fn (= will never trigg this layer) Keyboard::NoEventIndicated, // 45 no button connected Keyboard::NoEventIndicated, // 46 no button connected Keyboard::NoEventIndicated, // 47 no button connected + Keyboard::F1, // 48 no button connected + Keyboard::F2, // 49 no button connected + Keyboard::F3, // 50 no button connected + Keyboard::F4, // 51 no button connected + Keyboard::F5, // 52 no button connected + Keyboard::F6, // 53 no button connected + Keyboard::NoEventIndicated, // 54 no button connected + Keyboard::NoEventIndicated, // 55 no button connected + Keyboard::NoEventIndicated, // 56 no button connected + Keyboard::NoEventIndicated, // 57 no button connected + Keyboard::NoEventIndicated, // 58 no button connected + Keyboard::NoEventIndicated, // 59 no button connected ], [ // Function layer 2 // HID Key // Button Index // ----------------------------------------- - Keyboard::NoEventIndicated, // 0 + Keyboard::Escape, // 0 Keyboard::F11, // 1 Keyboard::F12, // 2 Keyboard::F13, // 3 @@ -187,17 +211,29 @@ pub const MAP: [[Keyboard; NUMBER_OF_KEYS]; 3] = [ Keyboard::End, // 33 Keyboard::Insert, // 34 Keyboard::RightShift, // 35 - Keyboard::NoEventIndicated, // 36 no button connected - Keyboard::NoEventIndicated, // 37 no button connected - Keyboard::NoEventIndicated, // 38 no button connected - Keyboard::LeftAlt, // 39 - Keyboard::NoEventIndicated, // 40 Fn - Keyboard::LeftGUI, // 41 - Keyboard::DeleteBackspace, // 42 - Keyboard::NoEventIndicated, // 43 Fn - Keyboard::NoEventIndicated, // 44 Fn + Keyboard::LeftAlt, // 36 + Keyboard::NoEventIndicated, // 37 Fn (= will never trigg this layer) + Keyboard::Space, // 38 + Keyboard::DeleteBackspace, // 39 no button connected + Keyboard::LeftGUI, // 40 no button connected + Keyboard::ReturnEnter, // 41 no button connected + Keyboard::Space, // 42 + Keyboard::NoEventIndicated, // 43 Fn (= will never trigg this layer) + Keyboard::NoEventIndicated, // 44 Fn (= will never trigg this layer) Keyboard::NoEventIndicated, // 45 no button connected Keyboard::NoEventIndicated, // 46 no button connected Keyboard::NoEventIndicated, // 47 no button connected + Keyboard::F1, // 48 no button connected + Keyboard::F2, // 49 no button connected + Keyboard::F3, // 50 no button connected + Keyboard::F4, // 51 no button connected + Keyboard::F5, // 52 no button connected + Keyboard::F6, // 53 no button connected + Keyboard::NoEventIndicated, // 54 no button connected + Keyboard::NoEventIndicated, // 55 no button connected + Keyboard::NoEventIndicated, // 56 no button connected + Keyboard::NoEventIndicated, // 57 no button connected + Keyboard::NoEventIndicated, // 58 no button connected + Keyboard::NoEventIndicated, // 59 no button connected ], ]; diff --git a/rp2040_51/src/main.rs b/rp2040_51/src/main.rs index ee3854f..da95d88 100644 --- a/rp2040_51/src/main.rs +++ b/rp2040_51/src/main.rs @@ -1,4 +1,4 @@ -//! Project: CMtec CMDR Keyboard 42 +//! Project: CMtec CMDR Keyboard 51 //! Date: 2023-07-01 //! Author: Christoffer Martinsson //! Email: cm@cmtec.se @@ -41,7 +41,7 @@ use waveshare_rp2040_zero::{ }; // Public constants -pub const KEY_ROWS: usize = 4; +pub const KEY_ROWS: usize = 5; pub const KEY_COLS: usize = 12; pub const NUMBER_OF_KEYS: usize = KEY_ROWS * KEY_COLS; @@ -89,26 +89,27 @@ fn main() -> ! { // Setting up array with pins connected to button rows let button_matrix_row_pins: &[&dyn InputPin; KEY_ROWS] = &[ - &pins.gp0.into_pull_up_input(), - &pins.gp1.into_pull_up_input(), &pins.gp29.into_pull_up_input(), - &pins.gp28.into_pull_up_input(), + &pins.gp26.into_pull_up_input(), + &pins.gp15.into_pull_up_input(), + &pins.gp10.into_pull_up_input(), + &pins.gp9.into_pull_up_input(), ]; // Setting up array with pins connected to button columns let button_matrix_col_pins: &mut [&mut dyn OutputPin; KEY_COLS] = &mut [ + &mut pins.gp11.into_push_pull_output(), &mut pins.gp12.into_push_pull_output(), &mut pins.gp13.into_push_pull_output(), &mut pins.gp14.into_push_pull_output(), - &mut pins.gp15.into_push_pull_output(), - &mut pins.gp26.into_push_pull_output(), &mut pins.gp27.into_push_pull_output(), - &mut pins.gp7.into_push_pull_output(), - &mut pins.gp8.into_push_pull_output(), + &mut pins.gp28.into_push_pull_output(), + &mut pins.gp2.into_push_pull_output(), + &mut pins.gp3.into_push_pull_output(), + &mut pins.gp4.into_push_pull_output(), + &mut pins.gp5.into_push_pull_output(), &mut pins.gp6.into_push_pull_output(), - &mut pins.gp9.into_push_pull_output(), - &mut pins.gp10.into_push_pull_output(), - &mut pins.gp11.into_push_pull_output(), + &mut pins.gp7.into_push_pull_output(), ]; // Create button matrix object that scans all the PCB buttons @@ -133,7 +134,7 @@ fn main() -> ! { let mut usb_dev = UsbDeviceBuilder::new(&usb_bus, UsbVidPid(0x1209, 0x0001)) .manufacturer("CMtec") .product("CMDR keyboard") - .serial_number("0001") + .serial_number("0002") .build(); // Create status LED diff --git a/rp2040_51/src/status_led.rs b/rp2040_51/src/status_led.rs index 8d95e59..e87d41e 100644 --- a/rp2040_51/src/status_led.rs +++ b/rp2040_51/src/status_led.rs @@ -1,4 +1,4 @@ -//! Project: CMtec CMDR Keyboard 42 +//! Project: CMtec CMDR Keyboard 51 //! Date: 2023-07-01 //! Author: Christoffer Martinsson //! Email: cm@cmtec.se