├── .cargo └── config.toml ├── .github └── workflows │ └── buildtest.yml ├── .gitignore ├── .vscode └── settings.json ├── Cargo.lock ├── Cargo.toml ├── LICENSE ├── README.md ├── example_keymap.json ├── memory.x └── src ├── keycodes.rs ├── main.rs ├── mcu.rs ├── mcu └── rp2040.rs └── test.rs /.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [target.thumbv7m-none-eabi] 2 | # uncomment this to make `cargo run` execute programs on QEMU 3 | # runner = "qemu-system-arm -cpu cortex-m3 -machine lm3s6965evb -nographic -semihosting-config enable=on,target=native -kernel" 4 | 5 | [target.thumbv6m-none-eabi] 6 | # uncomment this to make `cargo run` execute programs on QEMU 7 | runner = "qemu-system-arm -cpu cortex-m0 -machine raspi-pico -nographic -semihosting-config enable=on,target=native -kernel" 8 | # runner = "elf2uf2-rs -d" 9 | 10 | # runner = "picotool load -x -t elf" 11 | # runner = "probe-run --chip RP2040" 12 | 13 | [target.thumbv7em-none-eabi] 14 | # uncomment this to make `cargo run` execute programs on QEMU 15 | # runner = "qemu-system-arm -cpu cortex-m4 -machine lm3s6965evb -nographic -semihosting-config enable=on,target=native -kernel" 16 | 17 | [target.thumbv7em-none-eabihf] 18 | # uncomment this to make `cargo run` execute programs on QEMU 19 | # runner = "qemu-system-arm -cpu cortex-m4 -machine lm3s6965evb -nographic -semihosting-config enable=on,target=native -kernel" 20 | 21 | [target.'cfg(all(target_arch = "arm", target_os = "none"))'] 22 | # uncomment ONE of these three option to make `cargo run` start a GDB session 23 | # which option to pick depends on your system 24 | # runner = "arm-none-eabi-gdb -q -x openocd.gdb" 25 | # runner = "gdb-multiarch -q -x openocd.gdb" 26 | # runner = "gdb -q -x openocd.gdb" 27 | 28 | rustflags = [ # ??? 29 | # This is needed if your flash or ram addresses are not aligned to 0x10000 in memory.x 30 | # See https://github.com/rust-embedded/cortex-m-quickstart/pull/95 31 | "-C", "link-arg=--nmagic", 32 | 33 | # LLD (shipped with the Rust toolchain) is used as the default linker 34 | # "-C", "link-arg=-Tlink.x", 35 | 36 | # if you run into problems with LLD switch to the GNU linker by commenting out 37 | # this line 38 | # "-C", "linker=arm-none-eabi-ld", 39 | 40 | # if you need to link to pre-compiled C libraries provided by a C toolchain 41 | # use GCC as the linker by commenting out both lines above and then 42 | # uncommenting the three lines below 43 | # "-C", "linker=arm-none-eabi-gcc", 44 | # "-C", "link-arg=-Wl,-Tlink.x", 45 | # "-C", "link-arg=-nostartfiles", 46 | 47 | # "-C", "linker=flip-link", 48 | # Flag required for defmt, when using probe-run 49 | # "-C", "link-arg=-Tdefmt.x", 50 | ] 51 | 52 | [build] 53 | # Pick ONE of these compilation targets 54 | target = "thumbv6m-none-eabi" # Cortex-M0 and Cortex-M0+ 55 | #target = "thumbv7m-none-eabi" # Cortex-M3 56 | # target = "thumbv7em-none-eabi" # Cortex-M4 and Cortex-M7 (no FPU) 57 | # target = "thumbv7em-none-eabihf" # Cortex-M4F and Cortex-M7F (with FPU) 58 | # target = "thumbv8m.base-none-eabi" # Cortex-M23 59 | # target = "thumbv8m.main-none-eabi" # Cortex-M33 (no FPU) 60 | # target = "thumbv8m.main-none-eabihf" # Cortex-M33 (with FPU) 61 | 62 | # compiler caching tool for improved Rust build times 63 | # in ~/.cargo/config.toml 64 | rustc-wrapper = "sccache" 65 | # around 2x faster Rust build times 66 | # see https://twitter.com/0atman/status/1590118756226805762 67 | # https://github.com/mozilla/sccache 68 | 69 | -------------------------------------------------------------------------------- /.github/workflows/buildtest.yml: -------------------------------------------------------------------------------- 1 | name: Build-Test 2 | 3 | on: 4 | push: 5 | branches-ignore: 6 | - 'main' 7 | pull_request: 8 | branches: 9 | - 'main' 10 | workflow_dispatch: 11 | 12 | jobs: 13 | test: 14 | name: Build Test 15 | 16 | strategy: 17 | fail-fast: false 18 | matrix: 19 | variant: 20 | - "" # debug 21 | - "--release" 22 | target: 23 | - thumbv6m-none-eabi 24 | # - thumbv7m-none-eabi 25 | # - thumbv7em-none-eabi 26 | # - thumbv7em-none-eabihf 27 | # platform: [ 28 | # ubuntu-latest, 29 | # macos-latest, 30 | # windows-latest 31 | # ] 32 | 33 | runs-on: ubuntu-latest 34 | #runs-on: ${{ matrix.platform }} 35 | timeout-minutes: 15 36 | 37 | steps: 38 | - name: Checkout Repository on PR on main branch 39 | if: github.event_name == 'pull_request' 40 | uses: actions/checkout@v3 41 | # with: 42 | # ref: ${{ github.event.pull_request.head.sha }} 43 | - name: Checkout Repository on push 44 | if: github.event_name == 'push' 45 | uses: actions/checkout@v3 46 | with: 47 | ref: ${{ github.ref }} 48 | - name: Setup Rust toolchain 49 | uses: actions-rs/toolchain@v1 50 | with: 51 | profile: minimal 52 | toolchain: stable 53 | target: ${{ matrix.target }} 54 | override: true 55 | components: rustfmt, clippy 56 | - name: cargo fmt 57 | uses: actions-rs/cargo@v1 58 | continue-on-error: true 59 | with: 60 | command: fmt 61 | args: --all -- --check 62 | - name: cargo clippy 63 | uses: actions-rs/cargo@v1 64 | continue-on-error: true 65 | with: 66 | command: clippy 67 | args: -- -D warnings 68 | - name: cargo test 69 | uses: actions-rs/cargo@v1 70 | continue-on-error: true 71 | with: 72 | command: test 73 | args: --no-fail-fast --all 74 | - name: cargo build 75 | uses: actions-rs/cargo@v1 76 | with: 77 | command: build 78 | args: ${{ matrix.variant }} --target=${{ matrix.target }} 79 | #- name: cargo build 80 | # run: cargo build ${{ matrix.variant }} --target=${{ matrix.target }} 81 | 82 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | /target/ 4 | /debug/ 5 | 6 | # Remove Cargo.lock from gitignore if creating a binary, leave it for libraries 7 | # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html 8 | #Cargo.lock 9 | 10 | # These are backup files generated by rustfmt 11 | **/*.rs.bk 12 | 13 | # VSCode files 14 | .vscode/* 15 | !.vscode/settings.json 16 | 17 | # MSVC Windows builds of rustc generate these, which store debugging information 18 | *.pdb 19 | 20 | # Mac/OSX files 21 | .DS_Store 22 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.checkOnSave.command": "clippy", 3 | "[rust]": { 4 | "editor.formatOnSave": true, 5 | "editor.inlayHints.enabled" : true 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "addr2line" 7 | version = "0.19.0" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" 10 | dependencies = [ 11 | "gimli", 12 | ] 13 | 14 | [[package]] 15 | name = "adler" 16 | version = "1.0.2" 17 | source = "registry+https://github.com/rust-lang/crates.io-index" 18 | checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" 19 | 20 | [[package]] 21 | name = "aho-corasick" 22 | version = "0.7.19" 23 | source = "registry+https://github.com/rust-lang/crates.io-index" 24 | checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e" 25 | dependencies = [ 26 | "memchr", 27 | ] 28 | 29 | [[package]] 30 | name = "atomic-polyfill" 31 | version = "0.1.10" 32 | source = "registry+https://github.com/rust-lang/crates.io-index" 33 | checksum = "9c041a8d9751a520ee19656232a18971f18946a7900f1520ee4400002244dd89" 34 | dependencies = [ 35 | "critical-section", 36 | ] 37 | 38 | [[package]] 39 | name = "autocfg" 40 | version = "1.1.0" 41 | source = "registry+https://github.com/rust-lang/crates.io-index" 42 | checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" 43 | 44 | [[package]] 45 | name = "backtrace" 46 | version = "0.3.67" 47 | source = "registry+https://github.com/rust-lang/crates.io-index" 48 | checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca" 49 | dependencies = [ 50 | "addr2line", 51 | "cc", 52 | "cfg-if", 53 | "libc", 54 | "miniz_oxide", 55 | "object", 56 | "rustc-demangle", 57 | ] 58 | 59 | [[package]] 60 | name = "bare-metal" 61 | version = "0.2.5" 62 | source = "registry+https://github.com/rust-lang/crates.io-index" 63 | checksum = "5deb64efa5bd81e31fcd1938615a6d98c82eafcbcd787162b6f63b91d6bac5b3" 64 | dependencies = [ 65 | "rustc_version 0.2.3", 66 | ] 67 | 68 | [[package]] 69 | name = "bare-metal" 70 | version = "1.0.0" 71 | source = "registry+https://github.com/rust-lang/crates.io-index" 72 | checksum = "f8fe8f5a8a398345e52358e18ff07cc17a568fbca5c6f73873d3a62056309603" 73 | 74 | [[package]] 75 | name = "bit_field" 76 | version = "0.10.1" 77 | source = "registry+https://github.com/rust-lang/crates.io-index" 78 | checksum = "dcb6dd1c2376d2e096796e234a70e17e94cc2d5d54ff8ce42b28cef1d0d359a4" 79 | 80 | [[package]] 81 | name = "bitfield" 82 | version = "0.13.2" 83 | source = "registry+https://github.com/rust-lang/crates.io-index" 84 | checksum = "46afbd2983a5d5a7bd740ccb198caf5b82f45c40c09c0eed36052d91cb92e719" 85 | 86 | [[package]] 87 | name = "bitflags" 88 | version = "1.3.2" 89 | source = "registry+https://github.com/rust-lang/crates.io-index" 90 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" 91 | 92 | [[package]] 93 | name = "bitvec" 94 | version = "0.22.3" 95 | source = "registry+https://github.com/rust-lang/crates.io-index" 96 | checksum = "5237f00a8c86130a0cc317830e558b966dd7850d48a953d998c813f01a41b527" 97 | dependencies = [ 98 | "funty", 99 | "radium", 100 | "tap", 101 | "wyz", 102 | ] 103 | 104 | [[package]] 105 | name = "byteorder" 106 | version = "1.3.4" 107 | source = "registry+https://github.com/rust-lang/crates.io-index" 108 | checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" 109 | 110 | [[package]] 111 | name = "cc" 112 | version = "1.0.78" 113 | source = "registry+https://github.com/rust-lang/crates.io-index" 114 | checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d" 115 | 116 | [[package]] 117 | name = "cfg-if" 118 | version = "1.0.0" 119 | source = "registry+https://github.com/rust-lang/crates.io-index" 120 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 121 | 122 | [[package]] 123 | name = "color-eyre" 124 | version = "0.6.2" 125 | source = "registry+https://github.com/rust-lang/crates.io-index" 126 | checksum = "5a667583cca8c4f8436db8de46ea8233c42a7d9ae424a82d338f2e4675229204" 127 | dependencies = [ 128 | "backtrace", 129 | "color-spantrace", 130 | "eyre", 131 | "indenter", 132 | "once_cell", 133 | "owo-colors", 134 | "tracing-error", 135 | ] 136 | 137 | [[package]] 138 | name = "color-spantrace" 139 | version = "0.2.0" 140 | source = "registry+https://github.com/rust-lang/crates.io-index" 141 | checksum = "1ba75b3d9449ecdccb27ecbc479fdc0b87fa2dd43d2f8298f9bf0e59aacc8dce" 142 | dependencies = [ 143 | "once_cell", 144 | "owo-colors", 145 | "tracing-core", 146 | "tracing-error", 147 | ] 148 | 149 | [[package]] 150 | name = "cortex-m" 151 | version = "0.7.6" 152 | source = "registry+https://github.com/rust-lang/crates.io-index" 153 | checksum = "70858629a458fdfd39f9675c4dc309411f2a3f83bede76988d81bf1a0ecee9e0" 154 | dependencies = [ 155 | "bare-metal 0.2.5", 156 | "bitfield", 157 | "embedded-hal", 158 | "volatile-register", 159 | ] 160 | 161 | [[package]] 162 | name = "cortex-m-rt" 163 | version = "0.7.1" 164 | source = "registry+https://github.com/rust-lang/crates.io-index" 165 | checksum = "3c433da385b720d5bb9f52362fa2782420798e68d40d67bfe4b0d992aba5dfe7" 166 | dependencies = [ 167 | "cortex-m-rt-macros", 168 | ] 169 | 170 | [[package]] 171 | name = "cortex-m-rt-macros" 172 | version = "0.7.0" 173 | source = "registry+https://github.com/rust-lang/crates.io-index" 174 | checksum = "f0f6f3e36f203cfedbc78b357fb28730aa2c6dc1ab060ee5c2405e843988d3c7" 175 | dependencies = [ 176 | "proc-macro2 1.0.47", 177 | "quote 1.0.21", 178 | "syn 1.0.103", 179 | ] 180 | 181 | [[package]] 182 | name = "cortex-m-rtic" 183 | version = "0.6.0-rc.4" 184 | source = "registry+https://github.com/rust-lang/crates.io-index" 185 | checksum = "e8a39a6cfe367f56464ea089489c8ce8a0d14ad0e6dd7bc3770050bb1785ce02" 186 | dependencies = [ 187 | "bare-metal 1.0.0", 188 | "cortex-m", 189 | "cortex-m-rtic-macros", 190 | "heapless", 191 | "rtic-core", 192 | "rtic-monotonic", 193 | "version_check", 194 | ] 195 | 196 | [[package]] 197 | name = "cortex-m-rtic-macros" 198 | version = "0.6.0-rc.4" 199 | source = "registry+https://github.com/rust-lang/crates.io-index" 200 | checksum = "1794cde3951be8de7c9e41a4ff6c4ebeca9d1adb2a053513f64061803d6cae92" 201 | dependencies = [ 202 | "proc-macro-error", 203 | "proc-macro2 1.0.47", 204 | "quote 1.0.21", 205 | "rtic-syntax", 206 | "syn 1.0.103", 207 | ] 208 | 209 | [[package]] 210 | name = "critical-section" 211 | version = "0.2.7" 212 | source = "registry+https://github.com/rust-lang/crates.io-index" 213 | checksum = "95da181745b56d4bd339530ec393508910c909c784e8962d15d722bacf0bcbcd" 214 | dependencies = [ 215 | "bare-metal 1.0.0", 216 | "cfg-if", 217 | "cortex-m", 218 | "riscv", 219 | ] 220 | 221 | [[package]] 222 | name = "defmt" 223 | version = "0.3.2" 224 | source = "registry+https://github.com/rust-lang/crates.io-index" 225 | checksum = "d3a0ae7494d9bff013d7b89471f4c424356a71e9752e0c78abe7e6c608a16bb3" 226 | dependencies = [ 227 | "bitflags", 228 | "defmt-macros", 229 | ] 230 | 231 | [[package]] 232 | name = "defmt-macros" 233 | version = "0.3.3" 234 | source = "registry+https://github.com/rust-lang/crates.io-index" 235 | checksum = "8500cbe4cca056412efce4215a63d0bc20492942aeee695f23b624a53e0a6854" 236 | dependencies = [ 237 | "defmt-parser", 238 | "proc-macro-error", 239 | "proc-macro2 1.0.47", 240 | "quote 1.0.21", 241 | "syn 1.0.103", 242 | ] 243 | 244 | [[package]] 245 | name = "defmt-parser" 246 | version = "0.3.1" 247 | source = "registry+https://github.com/rust-lang/crates.io-index" 248 | checksum = "0db23d29972d99baa3de2ee2ae3f104c10564a6d05a346eb3f4c4f2c0525a06e" 249 | 250 | [[package]] 251 | name = "delegate" 252 | version = "0.7.0" 253 | source = "registry+https://github.com/rust-lang/crates.io-index" 254 | checksum = "d70a2d4995466955a415223acf3c9c934b9ff2339631cdf4ffc893da4bacd717" 255 | dependencies = [ 256 | "proc-macro2 1.0.47", 257 | "quote 1.0.21", 258 | "syn 1.0.103", 259 | ] 260 | 261 | [[package]] 262 | name = "embedded-hal" 263 | version = "0.2.7" 264 | source = "registry+https://github.com/rust-lang/crates.io-index" 265 | checksum = "35949884794ad573cf46071e41c9b60efb0cb311e3ca01f7af807af1debc66ff" 266 | dependencies = [ 267 | "nb 0.1.3", 268 | "void", 269 | ] 270 | 271 | [[package]] 272 | name = "embedded-time" 273 | version = "0.12.1" 274 | source = "registry+https://github.com/rust-lang/crates.io-index" 275 | checksum = "d7a4b4d10ac48d08bfe3db7688c402baadb244721f30a77ce360bd24c3dffe58" 276 | dependencies = [ 277 | "num", 278 | ] 279 | 280 | [[package]] 281 | name = "encode_unicode" 282 | version = "0.3.6" 283 | source = "registry+https://github.com/rust-lang/crates.io-index" 284 | checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" 285 | 286 | [[package]] 287 | name = "eyre" 288 | version = "0.6.8" 289 | source = "registry+https://github.com/rust-lang/crates.io-index" 290 | checksum = "4c2b6b5a29c02cdc822728b7d7b8ae1bab3e3b05d44522770ddd49722eeac7eb" 291 | dependencies = [ 292 | "indenter", 293 | "once_cell", 294 | ] 295 | 296 | [[package]] 297 | name = "frunk" 298 | version = "0.4.1" 299 | source = "registry+https://github.com/rust-lang/crates.io-index" 300 | checksum = "a89c703bf50009f383a0873845357cc400a95fc535f836feddfe015d7df6e1e0" 301 | dependencies = [ 302 | "frunk_core", 303 | "frunk_derives", 304 | ] 305 | 306 | [[package]] 307 | name = "frunk_core" 308 | version = "0.4.1" 309 | source = "registry+https://github.com/rust-lang/crates.io-index" 310 | checksum = "2a446d01a558301dca28ef43222864a9fa2bd9a2e71370f769d5d5d5ec9f3537" 311 | 312 | [[package]] 313 | name = "frunk_derives" 314 | version = "0.4.1" 315 | source = "registry+https://github.com/rust-lang/crates.io-index" 316 | checksum = "b83164912bb4c97cfe0772913c7af7387ee2e00cb6d4636fb65a35b3d0c8f173" 317 | dependencies = [ 318 | "frunk_proc_macro_helpers", 319 | "quote 1.0.21", 320 | "syn 1.0.103", 321 | ] 322 | 323 | [[package]] 324 | name = "frunk_proc_macro_helpers" 325 | version = "0.1.1" 326 | source = "registry+https://github.com/rust-lang/crates.io-index" 327 | checksum = "015425591bbeb0f5b8a75593340f1789af428e9f887a4f1e36c0c471f067ef50" 328 | dependencies = [ 329 | "frunk_core", 330 | "proc-macro2 1.0.47", 331 | "quote 1.0.21", 332 | "syn 1.0.103", 333 | ] 334 | 335 | [[package]] 336 | name = "fstrings" 337 | version = "0.1.4" 338 | source = "registry+https://github.com/rust-lang/crates.io-index" 339 | checksum = "c1a50737a7f425f55fc4120a4aac34b0e5d2faf2ac0f80765a41a3c409627b0f" 340 | dependencies = [ 341 | "fstrings-proc-macro", 342 | "proc-macro-hack", 343 | ] 344 | 345 | [[package]] 346 | name = "fstrings-proc-macro" 347 | version = "0.1.4" 348 | source = "registry+https://github.com/rust-lang/crates.io-index" 349 | checksum = "fd35ca783646f51528988ad7eb8e16864ebf1b2f98b88f1da2099c0215ded39e" 350 | dependencies = [ 351 | "proc-macro-hack", 352 | "proc-macro2 0.4.30", 353 | "proc-quote", 354 | "syn 0.15.44", 355 | ] 356 | 357 | [[package]] 358 | name = "funty" 359 | version = "1.2.0" 360 | source = "registry+https://github.com/rust-lang/crates.io-index" 361 | checksum = "1847abb9cb65d566acd5942e94aea9c8f547ad02c98e1649326fc0e8910b8b1e" 362 | 363 | [[package]] 364 | name = "gimli" 365 | version = "0.27.0" 366 | source = "registry+https://github.com/rust-lang/crates.io-index" 367 | checksum = "dec7af912d60cdbd3677c1af9352ebae6fb8394d165568a2234df0fa00f87793" 368 | 369 | [[package]] 370 | name = "hash32" 371 | version = "0.2.1" 372 | source = "registry+https://github.com/rust-lang/crates.io-index" 373 | checksum = "b0c35f58762feb77d74ebe43bdbc3210f09be9fe6742234d573bacc26ed92b67" 374 | dependencies = [ 375 | "byteorder", 376 | ] 377 | 378 | [[package]] 379 | name = "hashbrown" 380 | version = "0.12.3" 381 | source = "registry+https://github.com/rust-lang/crates.io-index" 382 | checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" 383 | 384 | [[package]] 385 | name = "heapless" 386 | version = "0.7.16" 387 | source = "registry+https://github.com/rust-lang/crates.io-index" 388 | checksum = "db04bc24a18b9ea980628ecf00e6c0264f3c1426dac36c00cb49b6fbad8b0743" 389 | dependencies = [ 390 | "atomic-polyfill", 391 | "hash32", 392 | "rustc_version 0.4.0", 393 | "spin", 394 | "stable_deref_trait", 395 | ] 396 | 397 | [[package]] 398 | name = "indenter" 399 | version = "0.3.3" 400 | source = "registry+https://github.com/rust-lang/crates.io-index" 401 | checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" 402 | 403 | [[package]] 404 | name = "indexmap" 405 | version = "1.9.1" 406 | source = "registry+https://github.com/rust-lang/crates.io-index" 407 | checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" 408 | dependencies = [ 409 | "autocfg", 410 | "hashbrown", 411 | ] 412 | 413 | [[package]] 414 | name = "inheritance" 415 | version = "0.0.1-alpha.2" 416 | source = "registry+https://github.com/rust-lang/crates.io-index" 417 | checksum = "a3ac13fb8490903827ae294798f664ab42d24313040f3bdb5eeea6c9d0a50099" 418 | dependencies = [ 419 | "inheritance-proc-macro", 420 | ] 421 | 422 | [[package]] 423 | name = "inheritance-proc-macro" 424 | version = "0.0.1-alpha.2" 425 | source = "registry+https://github.com/rust-lang/crates.io-index" 426 | checksum = "a21ead35b99559bea33e01a2c544904913e7ba14907f62f94b0d31e606f8bb8f" 427 | dependencies = [ 428 | "fstrings", 429 | "proc-macro-crate", 430 | "proc-macro2 1.0.47", 431 | "quote 1.0.21", 432 | "syn 1.0.103", 433 | ] 434 | 435 | [[package]] 436 | name = "lazy_static" 437 | version = "1.4.0" 438 | source = "registry+https://github.com/rust-lang/crates.io-index" 439 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" 440 | 441 | [[package]] 442 | name = "libc" 443 | version = "0.2.139" 444 | source = "registry+https://github.com/rust-lang/crates.io-index" 445 | checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" 446 | 447 | [[package]] 448 | name = "lock_api" 449 | version = "0.4.9" 450 | source = "registry+https://github.com/rust-lang/crates.io-index" 451 | checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" 452 | dependencies = [ 453 | "autocfg", 454 | "scopeguard", 455 | ] 456 | 457 | [[package]] 458 | name = "log" 459 | version = "0.4.17" 460 | source = "registry+https://github.com/rust-lang/crates.io-index" 461 | checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" 462 | dependencies = [ 463 | "cfg-if", 464 | ] 465 | 466 | [[package]] 467 | name = "memchr" 468 | version = "2.5.0" 469 | source = "registry+https://github.com/rust-lang/crates.io-index" 470 | checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" 471 | 472 | [[package]] 473 | name = "miniz_oxide" 474 | version = "0.6.2" 475 | source = "registry+https://github.com/rust-lang/crates.io-index" 476 | checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" 477 | dependencies = [ 478 | "adler", 479 | ] 480 | 481 | [[package]] 482 | name = "nb" 483 | version = "0.1.3" 484 | source = "registry+https://github.com/rust-lang/crates.io-index" 485 | checksum = "801d31da0513b6ec5214e9bf433a77966320625a37860f910be265be6e18d06f" 486 | dependencies = [ 487 | "nb 1.0.0", 488 | ] 489 | 490 | [[package]] 491 | name = "nb" 492 | version = "1.0.0" 493 | source = "registry+https://github.com/rust-lang/crates.io-index" 494 | checksum = "546c37ac5d9e56f55e73b677106873d9d9f5190605e41a856503623648488cae" 495 | 496 | [[package]] 497 | name = "num" 498 | version = "0.3.1" 499 | source = "registry+https://github.com/rust-lang/crates.io-index" 500 | checksum = "8b7a8e9be5e039e2ff869df49155f1c06bd01ade2117ec783e56ab0932b67a8f" 501 | dependencies = [ 502 | "num-complex", 503 | "num-integer", 504 | "num-iter", 505 | "num-rational", 506 | "num-traits", 507 | ] 508 | 509 | [[package]] 510 | name = "num-complex" 511 | version = "0.3.1" 512 | source = "registry+https://github.com/rust-lang/crates.io-index" 513 | checksum = "747d632c0c558b87dbabbe6a82f3b4ae03720d0646ac5b7b4dae89394be5f2c5" 514 | dependencies = [ 515 | "num-traits", 516 | ] 517 | 518 | [[package]] 519 | name = "num-integer" 520 | version = "0.1.45" 521 | source = "registry+https://github.com/rust-lang/crates.io-index" 522 | checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" 523 | dependencies = [ 524 | "autocfg", 525 | "num-traits", 526 | ] 527 | 528 | [[package]] 529 | name = "num-iter" 530 | version = "0.1.43" 531 | source = "registry+https://github.com/rust-lang/crates.io-index" 532 | checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" 533 | dependencies = [ 534 | "autocfg", 535 | "num-integer", 536 | "num-traits", 537 | ] 538 | 539 | [[package]] 540 | name = "num-rational" 541 | version = "0.3.2" 542 | source = "registry+https://github.com/rust-lang/crates.io-index" 543 | checksum = "12ac428b1cb17fce6f731001d307d351ec70a6d202fc2e60f7d4c5e42d8f4f07" 544 | dependencies = [ 545 | "autocfg", 546 | "num-integer", 547 | "num-traits", 548 | ] 549 | 550 | [[package]] 551 | name = "num-traits" 552 | version = "0.2.15" 553 | source = "registry+https://github.com/rust-lang/crates.io-index" 554 | checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" 555 | dependencies = [ 556 | "autocfg", 557 | ] 558 | 559 | [[package]] 560 | name = "num_enum" 561 | version = "0.5.7" 562 | source = "registry+https://github.com/rust-lang/crates.io-index" 563 | checksum = "cf5395665662ef45796a4ff5486c5d41d29e0c09640af4c5f17fd94ee2c119c9" 564 | dependencies = [ 565 | "num_enum_derive", 566 | ] 567 | 568 | [[package]] 569 | name = "num_enum_derive" 570 | version = "0.5.7" 571 | source = "registry+https://github.com/rust-lang/crates.io-index" 572 | checksum = "3b0498641e53dd6ac1a4f22547548caa6864cc4933784319cd1775271c5a46ce" 573 | dependencies = [ 574 | "proc-macro2 1.0.47", 575 | "quote 1.0.21", 576 | "syn 1.0.103", 577 | ] 578 | 579 | [[package]] 580 | name = "object" 581 | version = "0.30.0" 582 | source = "registry+https://github.com/rust-lang/crates.io-index" 583 | checksum = "239da7f290cfa979f43f85a8efeee9a8a76d0827c356d37f9d3d7254d6b537fb" 584 | dependencies = [ 585 | "memchr", 586 | ] 587 | 588 | [[package]] 589 | name = "once_cell" 590 | version = "1.17.0" 591 | source = "registry+https://github.com/rust-lang/crates.io-index" 592 | checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" 593 | 594 | [[package]] 595 | name = "owo-colors" 596 | version = "3.5.0" 597 | source = "registry+https://github.com/rust-lang/crates.io-index" 598 | checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f" 599 | 600 | [[package]] 601 | name = "packed_struct" 602 | version = "0.10.0" 603 | source = "registry+https://github.com/rust-lang/crates.io-index" 604 | checksum = "9c48e482b9a59ad6c2cdb06f7725e7bd33fe3525baaf4699fde7bfea6a5b77b1" 605 | dependencies = [ 606 | "bitvec", 607 | "packed_struct_codegen", 608 | ] 609 | 610 | [[package]] 611 | name = "packed_struct_codegen" 612 | version = "0.10.0" 613 | source = "registry+https://github.com/rust-lang/crates.io-index" 614 | checksum = "56e3692b867ec1d48ccb441e951637a2cc3130d0912c0059e48319e1c83e44bc" 615 | dependencies = [ 616 | "proc-macro2 1.0.47", 617 | "quote 1.0.21", 618 | "syn 1.0.103", 619 | ] 620 | 621 | [[package]] 622 | name = "panic-halt" 623 | version = "0.2.0" 624 | source = "registry+https://github.com/rust-lang/crates.io-index" 625 | checksum = "de96540e0ebde571dc55c73d60ef407c653844e6f9a1e2fdbd40c07b9252d812" 626 | 627 | [[package]] 628 | name = "panic-probe" 629 | version = "0.3.0" 630 | source = "registry+https://github.com/rust-lang/crates.io-index" 631 | checksum = "3ab1f00eac22bd18f8e5cae9555f2820b3a0c166b5b556ee3e203746ea6dcf3a" 632 | dependencies = [ 633 | "cortex-m", 634 | "defmt", 635 | ] 636 | 637 | [[package]] 638 | name = "pin-project-lite" 639 | version = "0.2.9" 640 | source = "registry+https://github.com/rust-lang/crates.io-index" 641 | checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" 642 | 643 | [[package]] 644 | name = "proc-macro-crate" 645 | version = "0.1.5" 646 | source = "registry+https://github.com/rust-lang/crates.io-index" 647 | checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" 648 | dependencies = [ 649 | "toml", 650 | ] 651 | 652 | [[package]] 653 | name = "proc-macro-error" 654 | version = "1.0.4" 655 | source = "registry+https://github.com/rust-lang/crates.io-index" 656 | checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" 657 | dependencies = [ 658 | "proc-macro-error-attr", 659 | "proc-macro2 1.0.47", 660 | "quote 1.0.21", 661 | "syn 1.0.103", 662 | "version_check", 663 | ] 664 | 665 | [[package]] 666 | name = "proc-macro-error-attr" 667 | version = "1.0.4" 668 | source = "registry+https://github.com/rust-lang/crates.io-index" 669 | checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" 670 | dependencies = [ 671 | "proc-macro2 1.0.47", 672 | "quote 1.0.21", 673 | "version_check", 674 | ] 675 | 676 | [[package]] 677 | name = "proc-macro-hack" 678 | version = "0.5.20+deprecated" 679 | source = "registry+https://github.com/rust-lang/crates.io-index" 680 | checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" 681 | 682 | [[package]] 683 | name = "proc-macro2" 684 | version = "0.4.30" 685 | source = "registry+https://github.com/rust-lang/crates.io-index" 686 | checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" 687 | dependencies = [ 688 | "unicode-xid", 689 | ] 690 | 691 | [[package]] 692 | name = "proc-macro2" 693 | version = "1.0.47" 694 | source = "registry+https://github.com/rust-lang/crates.io-index" 695 | checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" 696 | dependencies = [ 697 | "unicode-ident", 698 | ] 699 | 700 | [[package]] 701 | name = "proc-quote" 702 | version = "0.2.2" 703 | source = "registry+https://github.com/rust-lang/crates.io-index" 704 | checksum = "fa612543f23fda013e1e6ce30b5285a9d313c6e582e57b4ceca74eb5b85685b5" 705 | dependencies = [ 706 | "proc-macro-hack", 707 | "proc-macro2 0.4.30", 708 | "proc-quote-impl", 709 | "quote 0.6.13", 710 | "syn 0.15.44", 711 | ] 712 | 713 | [[package]] 714 | name = "proc-quote-impl" 715 | version = "0.2.2" 716 | source = "registry+https://github.com/rust-lang/crates.io-index" 717 | checksum = "f785f0f8cd00b7945efc3f3bdf8205eb06af5aacec598d83e67f41dc8d101fda" 718 | dependencies = [ 719 | "proc-macro-hack", 720 | "proc-macro2 0.4.30", 721 | "quote 0.6.13", 722 | ] 723 | 724 | [[package]] 725 | name = "quote" 726 | version = "0.6.13" 727 | source = "registry+https://github.com/rust-lang/crates.io-index" 728 | checksum = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" 729 | dependencies = [ 730 | "proc-macro2 0.4.30", 731 | ] 732 | 733 | [[package]] 734 | name = "quote" 735 | version = "1.0.21" 736 | source = "registry+https://github.com/rust-lang/crates.io-index" 737 | checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" 738 | dependencies = [ 739 | "proc-macro2 1.0.47", 740 | ] 741 | 742 | [[package]] 743 | name = "radium" 744 | version = "0.6.2" 745 | source = "registry+https://github.com/rust-lang/crates.io-index" 746 | checksum = "643f8f41a8ebc4c5dc4515c82bb8abd397b527fc20fd681b7c011c2aee5d44fb" 747 | 748 | [[package]] 749 | name = "regex" 750 | version = "1.7.0" 751 | source = "registry+https://github.com/rust-lang/crates.io-index" 752 | checksum = "e076559ef8e241f2ae3479e36f97bd5741c0330689e217ad51ce2c76808b868a" 753 | dependencies = [ 754 | "aho-corasick", 755 | "memchr", 756 | "regex-syntax", 757 | ] 758 | 759 | [[package]] 760 | name = "regex-syntax" 761 | version = "0.6.28" 762 | source = "registry+https://github.com/rust-lang/crates.io-index" 763 | checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" 764 | 765 | [[package]] 766 | name = "riscv" 767 | version = "0.7.0" 768 | source = "registry+https://github.com/rust-lang/crates.io-index" 769 | checksum = "6907ccdd7a31012b70faf2af85cd9e5ba97657cc3987c4f13f8e4d2c2a088aba" 770 | dependencies = [ 771 | "bare-metal 1.0.0", 772 | "bit_field", 773 | "riscv-target", 774 | ] 775 | 776 | [[package]] 777 | name = "riscv-target" 778 | version = "0.1.2" 779 | source = "registry+https://github.com/rust-lang/crates.io-index" 780 | checksum = "88aa938cda42a0cf62a20cfe8d139ff1af20c2e681212b5b34adb5a58333f222" 781 | dependencies = [ 782 | "lazy_static", 783 | "regex", 784 | ] 785 | 786 | [[package]] 787 | name = "rmk_firmware" 788 | version = "0.1.0" 789 | dependencies = [ 790 | "color-eyre", 791 | "cortex-m", 792 | "cortex-m-rt", 793 | "cortex-m-rtic", 794 | "defmt", 795 | "embedded-hal", 796 | "embedded-time", 797 | "inheritance", 798 | "log", 799 | "panic-halt", 800 | "panic-probe", 801 | "usb-device", 802 | "usbd-hid", 803 | "usbd-human-interface-device", 804 | "usbd-serial", 805 | ] 806 | 807 | [[package]] 808 | name = "rtic-core" 809 | version = "0.3.1" 810 | source = "registry+https://github.com/rust-lang/crates.io-index" 811 | checksum = "8bd58a6949de8ff797a346a28d9f13f7b8f54fa61bb5e3cb0985a4efb497a5ef" 812 | 813 | [[package]] 814 | name = "rtic-monotonic" 815 | version = "0.1.0-rc.2" 816 | source = "registry+https://github.com/rust-lang/crates.io-index" 817 | checksum = "7e019d674efea87f510f6857e8a381cab2781b415d37d34564440d902eb6c946" 818 | 819 | [[package]] 820 | name = "rtic-syntax" 821 | version = "0.5.0-rc.2" 822 | source = "registry+https://github.com/rust-lang/crates.io-index" 823 | checksum = "f60670421cd7af9cb6e0562cc093710c634ff6e2374c2d664c82aa315b3c7ea4" 824 | dependencies = [ 825 | "indexmap", 826 | "proc-macro2 1.0.47", 827 | "quote 1.0.21", 828 | "syn 1.0.103", 829 | ] 830 | 831 | [[package]] 832 | name = "rustc-demangle" 833 | version = "0.1.21" 834 | source = "registry+https://github.com/rust-lang/crates.io-index" 835 | checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" 836 | 837 | [[package]] 838 | name = "rustc_version" 839 | version = "0.2.3" 840 | source = "registry+https://github.com/rust-lang/crates.io-index" 841 | checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" 842 | dependencies = [ 843 | "semver 0.9.0", 844 | ] 845 | 846 | [[package]] 847 | name = "rustc_version" 848 | version = "0.4.0" 849 | source = "registry+https://github.com/rust-lang/crates.io-index" 850 | checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" 851 | dependencies = [ 852 | "semver 1.0.14", 853 | ] 854 | 855 | [[package]] 856 | name = "scopeguard" 857 | version = "1.1.0" 858 | source = "registry+https://github.com/rust-lang/crates.io-index" 859 | checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" 860 | 861 | [[package]] 862 | name = "semver" 863 | version = "0.9.0" 864 | source = "registry+https://github.com/rust-lang/crates.io-index" 865 | checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" 866 | dependencies = [ 867 | "semver-parser", 868 | ] 869 | 870 | [[package]] 871 | name = "semver" 872 | version = "1.0.14" 873 | source = "registry+https://github.com/rust-lang/crates.io-index" 874 | checksum = "e25dfac463d778e353db5be2449d1cce89bd6fd23c9f1ea21310ce6e5a1b29c4" 875 | 876 | [[package]] 877 | name = "semver-parser" 878 | version = "0.7.0" 879 | source = "registry+https://github.com/rust-lang/crates.io-index" 880 | checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" 881 | 882 | [[package]] 883 | name = "serde" 884 | version = "1.0.147" 885 | source = "registry+https://github.com/rust-lang/crates.io-index" 886 | checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965" 887 | 888 | [[package]] 889 | name = "sharded-slab" 890 | version = "0.1.4" 891 | source = "registry+https://github.com/rust-lang/crates.io-index" 892 | checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" 893 | dependencies = [ 894 | "lazy_static", 895 | ] 896 | 897 | [[package]] 898 | name = "spin" 899 | version = "0.9.4" 900 | source = "registry+https://github.com/rust-lang/crates.io-index" 901 | checksum = "7f6002a767bff9e83f8eeecf883ecb8011875a21ae8da43bffb817a57e78cc09" 902 | dependencies = [ 903 | "lock_api", 904 | ] 905 | 906 | [[package]] 907 | name = "ssmarshal" 908 | version = "1.0.0" 909 | source = "registry+https://github.com/rust-lang/crates.io-index" 910 | checksum = "f3e6ad23b128192ed337dfa4f1b8099ced0c2bf30d61e551b65fda5916dbb850" 911 | dependencies = [ 912 | "encode_unicode", 913 | "serde", 914 | ] 915 | 916 | [[package]] 917 | name = "stable_deref_trait" 918 | version = "1.2.0" 919 | source = "registry+https://github.com/rust-lang/crates.io-index" 920 | checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" 921 | 922 | [[package]] 923 | name = "syn" 924 | version = "0.15.44" 925 | source = "registry+https://github.com/rust-lang/crates.io-index" 926 | checksum = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" 927 | dependencies = [ 928 | "proc-macro2 0.4.30", 929 | "quote 0.6.13", 930 | "unicode-xid", 931 | ] 932 | 933 | [[package]] 934 | name = "syn" 935 | version = "1.0.103" 936 | source = "registry+https://github.com/rust-lang/crates.io-index" 937 | checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d" 938 | dependencies = [ 939 | "proc-macro2 1.0.47", 940 | "quote 1.0.21", 941 | "unicode-ident", 942 | ] 943 | 944 | [[package]] 945 | name = "tap" 946 | version = "1.0.1" 947 | source = "registry+https://github.com/rust-lang/crates.io-index" 948 | checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" 949 | 950 | [[package]] 951 | name = "thread_local" 952 | version = "1.1.4" 953 | source = "registry+https://github.com/rust-lang/crates.io-index" 954 | checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180" 955 | dependencies = [ 956 | "once_cell", 957 | ] 958 | 959 | [[package]] 960 | name = "toml" 961 | version = "0.5.10" 962 | source = "registry+https://github.com/rust-lang/crates.io-index" 963 | checksum = "1333c76748e868a4d9d1017b5ab53171dfd095f70c712fdb4653a406547f598f" 964 | dependencies = [ 965 | "serde", 966 | ] 967 | 968 | [[package]] 969 | name = "tracing" 970 | version = "0.1.37" 971 | source = "registry+https://github.com/rust-lang/crates.io-index" 972 | checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" 973 | dependencies = [ 974 | "cfg-if", 975 | "pin-project-lite", 976 | "tracing-core", 977 | ] 978 | 979 | [[package]] 980 | name = "tracing-core" 981 | version = "0.1.30" 982 | source = "registry+https://github.com/rust-lang/crates.io-index" 983 | checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" 984 | dependencies = [ 985 | "once_cell", 986 | "valuable", 987 | ] 988 | 989 | [[package]] 990 | name = "tracing-error" 991 | version = "0.2.0" 992 | source = "registry+https://github.com/rust-lang/crates.io-index" 993 | checksum = "d686ec1c0f384b1277f097b2f279a2ecc11afe8c133c1aabf036a27cb4cd206e" 994 | dependencies = [ 995 | "tracing", 996 | "tracing-subscriber", 997 | ] 998 | 999 | [[package]] 1000 | name = "tracing-subscriber" 1001 | version = "0.3.16" 1002 | source = "registry+https://github.com/rust-lang/crates.io-index" 1003 | checksum = "a6176eae26dd70d0c919749377897b54a9276bd7061339665dd68777926b5a70" 1004 | dependencies = [ 1005 | "sharded-slab", 1006 | "thread_local", 1007 | "tracing-core", 1008 | ] 1009 | 1010 | [[package]] 1011 | name = "unicode-ident" 1012 | version = "1.0.5" 1013 | source = "registry+https://github.com/rust-lang/crates.io-index" 1014 | checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3" 1015 | 1016 | [[package]] 1017 | name = "unicode-xid" 1018 | version = "0.1.0" 1019 | source = "registry+https://github.com/rust-lang/crates.io-index" 1020 | checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" 1021 | 1022 | [[package]] 1023 | name = "usb-device" 1024 | version = "0.2.9" 1025 | source = "registry+https://github.com/rust-lang/crates.io-index" 1026 | checksum = "1f6cc3adc849b5292b4075fc0d5fdcf2f24866e88e336dd27a8943090a520508" 1027 | 1028 | [[package]] 1029 | name = "usbd-hid" 1030 | version = "0.5.2" 1031 | source = "registry+https://github.com/rust-lang/crates.io-index" 1032 | checksum = "183b7e65bbd75512aedf250deda89394c74ae3118b79fe41f159e8503e1d5d7f" 1033 | dependencies = [ 1034 | "serde", 1035 | "ssmarshal", 1036 | "usb-device", 1037 | "usbd-hid-macros", 1038 | ] 1039 | 1040 | [[package]] 1041 | name = "usbd-hid-descriptors" 1042 | version = "0.1.2" 1043 | source = "registry+https://github.com/rust-lang/crates.io-index" 1044 | checksum = "dcbee8c6735e90894fba04770bc41e11fd3c5256018856e15dc4dd1e6c8a3dd1" 1045 | dependencies = [ 1046 | "bitfield", 1047 | ] 1048 | 1049 | [[package]] 1050 | name = "usbd-hid-macros" 1051 | version = "0.5.2" 1052 | source = "registry+https://github.com/rust-lang/crates.io-index" 1053 | checksum = "78bd005b3aa54e62905d99df49a75d11888bb958eb780adb5e8f2029733077df" 1054 | dependencies = [ 1055 | "byteorder", 1056 | "proc-macro2 1.0.47", 1057 | "quote 1.0.21", 1058 | "serde", 1059 | "syn 1.0.103", 1060 | "usbd-hid-descriptors", 1061 | ] 1062 | 1063 | [[package]] 1064 | name = "usbd-human-interface-device" 1065 | version = "0.2.1" 1066 | source = "registry+https://github.com/rust-lang/crates.io-index" 1067 | checksum = "4f01ee9d05b01603f4d6ee43e7d0ebe140f16567d6ff99fde0dc1ea6e7564e65" 1068 | dependencies = [ 1069 | "delegate", 1070 | "embedded-time", 1071 | "frunk", 1072 | "heapless", 1073 | "log", 1074 | "num_enum", 1075 | "packed_struct", 1076 | "usb-device", 1077 | ] 1078 | 1079 | [[package]] 1080 | name = "usbd-serial" 1081 | version = "0.1.1" 1082 | source = "registry+https://github.com/rust-lang/crates.io-index" 1083 | checksum = "db75519b86287f12dcf0d171c7cf4ecc839149fe9f3b720ac4cfce52959e1dfe" 1084 | dependencies = [ 1085 | "embedded-hal", 1086 | "nb 0.1.3", 1087 | "usb-device", 1088 | ] 1089 | 1090 | [[package]] 1091 | name = "valuable" 1092 | version = "0.1.0" 1093 | source = "registry+https://github.com/rust-lang/crates.io-index" 1094 | checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" 1095 | 1096 | [[package]] 1097 | name = "vcell" 1098 | version = "0.1.3" 1099 | source = "registry+https://github.com/rust-lang/crates.io-index" 1100 | checksum = "77439c1b53d2303b20d9459b1ade71a83c716e3f9c34f3228c00e6f185d6c002" 1101 | 1102 | [[package]] 1103 | name = "version_check" 1104 | version = "0.9.4" 1105 | source = "registry+https://github.com/rust-lang/crates.io-index" 1106 | checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" 1107 | 1108 | [[package]] 1109 | name = "void" 1110 | version = "1.0.2" 1111 | source = "registry+https://github.com/rust-lang/crates.io-index" 1112 | checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" 1113 | 1114 | [[package]] 1115 | name = "volatile-register" 1116 | version = "0.2.1" 1117 | source = "registry+https://github.com/rust-lang/crates.io-index" 1118 | checksum = "9ee8f19f9d74293faf70901bc20ad067dc1ad390d2cbf1e3f75f721ffee908b6" 1119 | dependencies = [ 1120 | "vcell", 1121 | ] 1122 | 1123 | [[package]] 1124 | name = "wyz" 1125 | version = "0.4.0" 1126 | source = "registry+https://github.com/rust-lang/crates.io-index" 1127 | checksum = "129e027ad65ce1453680623c3fb5163cbf7107bfe1aa32257e7d0e63f9ced188" 1128 | dependencies = [ 1129 | "tap", 1130 | ] 1131 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "rmk_firmware" 3 | version = "0.1.0" 4 | edition = "2021" 5 | # authors = ["Lucas Placentino"] #deprecated ? 6 | description = "RMK - Rust keyboard firmware, based on QMK and KMK" 7 | documentation = "https://obsilab.github.io/rmk_docs/" #TODO need to change url "https://rmk.obsilab.com/docs" 8 | # homepage = "https://rmk.obsilab.com/" #TODO need to change url 9 | readme = "README.md" 10 | repository = "https://github.com/ObsiLab/rmk_firmware" 11 | license = "MIT" 12 | # license-file = "LICENSE" 13 | keywords = ["keyboard","firmware","qmk","rmk","kmk"] 14 | categories = ["embedded","hardware-support"] # [...,"no-std"] ? 15 | 16 | # prevents from accidentily publishing to crates.io : 17 | publish = false 18 | # ! REMOVE IF PUBLISHING TO crates.io 19 | 20 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 21 | 22 | # rp2040 = true # ? for [cfg(rp2040)] 23 | 24 | # [badges] # used ? 25 | # maintenance = ["experimental"] # used ? 26 | # rp2040 = true # ? for [cfg(rp2040)] 27 | 28 | [dependencies] 29 | 30 | # test: 31 | inheritance = { version = "0.0.1-alpha.2", features = ["specialization"] } #less repetitive code for implementing traits 32 | 33 | log = "0.4" #? 34 | 35 | # v1 test 36 | usbd-human-interface-device = "0.3.1" 37 | # embedded_hal = "0.2.5" # features? # rather than rp-hal, to run on any mcu 38 | 39 | 40 | # ? -- ARM -- 41 | cortex-m = "0.7.3" 42 | cortex-m-rt = ">=0.6.15,<0.8" 43 | cortex-m-rtic = "0.6.0-rc.4" 44 | embedded-hal = { version = "0.2.5", features = ["unproven"] } 45 | embedded-time = "0.12.0" 46 | 47 | # ? 48 | defmt = "0.3.0" 49 | # defmt = { version = ">=0.2.0, <0.4", optional = true } 50 | panic-halt= "0.2.0" 51 | panic-probe = { version = "0.3.0", features = ["print-defmt"] } 52 | 53 | # ? -- USB -- 54 | usb-device= "0.2.8" 55 | usbd-serial = "0.1.1" 56 | usbd-hid = "0.5.0" 57 | # prefer usbd-human-interface-device = "0.3.1" # ? 58 | 59 | 60 | # -- RP-HAL: -- 61 | # You can use any BSP. Uncomment this to use for example : 62 | # rp-pico = "0.3.0" 63 | # sparkfun-pro-micro-rp2040 = "0.2.0" 64 | # If you're not going to use a Board Support Package you'll need these: 65 | #rp2040-hal = { version="0.4.0", features=["rt"] } 66 | #rp2040-boot2 = "0.2.0" 67 | # prefer to use only embedded-hal? ot use any MCU 68 | 69 | 70 | 71 | [dev-dependencies] 72 | color-eyre = "0.6.2" # colored error messages 73 | 74 | # [profile.dev] 75 | # lto = true 76 | # incremental = false 77 | # opt-level = "z" 78 | # debug = true 79 | #? panic = "abort" # avoid needing to define the unstable eh_personality lang item 80 | 81 | # [profile.release] 82 | # strip = true # Strip symbols from binary 83 | # opt-level = "z" # "z" ("s"??) optimize for binary size, default optimizes for runtime speed 84 | # lto = true # enable link time optimization 85 | # codegen-units = 1 # maximize size reduction optimizations at the expense of build time 86 | # incremental = false 87 | #? panic = "abort" 88 | 89 | # [features] 90 | # default = ["boot2"] 91 | # boot2 = ["rp2040-boot2"] 92 | 93 | 94 | # --- End of file --- 95 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 ObsiLab 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # RMK - a Rust Keyboard Firmware ⌨️ 4 | Originally made for the [Quanta keyboard](https://github.com/ObsiLab/Quanta). 5 | ## _**----- 🏗️ THIS IS A WORK IN PROGRESS 🚧 -----**_ 6 | 7 |
8 |

Table Of Contents 📑

9 | 10 | > - [📖 Docs](#-docs) 11 | > - [▶️ Getting started](#%EF%B8%8F-getting-started) 12 | > - [_yes_](#yes-) 13 | > - [🔡 Details](#-details) 14 | > - [📝 Authors and Contributors](#-authors-and-contributors) 15 | > - [Author](#author-) 16 | > - [Contributors](#contributors-) 17 | > - [🌟 Acknowledgements](#-acknowledgements) 18 | > - [🧑‍🤝‍🧑 Contributing](#-contributing) 19 | > - [®️ License](#%EF%B8%8F-license) 20 | 21 |
22 | 23 | # 📖 Docs 24 | https://rmk.obsilab.com 25 | 26 | ## ▶️ Getting started 27 | ### _yes_ : 28 | _WIP_ 29 | 30 | ### Keymap 31 | Make a keymap.json file _manually_, based on [example_keymap.json](example_keymap.json). 32 | ```json 33 | { 34 | "name": "Example Keymap", 35 | "version": 1.0, 36 | "author": "RMK", 37 | "layers": 2, 38 | "max_rows": 3, 39 | "max_columns": 3, 40 | "description": "Experimental. An example keymap for RMK firmware, 3x3 key matrix with two layers.", 41 | "layer1": { 42 | "row1": ["KEY_Q", "KEY_W", "KEY_E"], 43 | "row2": ["KEY_A", "KEY_S", "KEY_D"], 44 | "row3": ["KEY_null", "KEY_null", "KEY_null"] 45 | }, 46 | "layer2": { 47 | "row1": ["KEY_TRNS", "KEY_T", "KEY_MEDIA_PLAY_PAUSE"] 48 | } 49 | } 50 | ``` 51 | Or use **[RMK GUI Configurator (RGC)](https://github.com/ObsiLab/RGC)** (_WIP_). 52 | 53 | ----------------- 54 | 55 | # 🔡 Details 56 | 57 | ## 📝 Authors and Contributors 58 | ### Author : 59 | - [Lucas Placentino](https://github.com/LucasPlacentino) 60 | ### Contributors : 61 | - [List of contributors](../../graphs/contributors) 62 | 63 | ## 🌟 Acknowledgements 64 | #### 💡 Inspired by [**QMK**](https://github.com/qmk/qmk_firmware) and [**KMK**](https://github.com/KMKfw/kmk_firmware). 65 | 66 | #### 🧱 Based off of: 67 | - https://github.com/Innectic/rmk 68 | - https://github.com/rp-rs/rp-hal 69 | - https://github.com/dlkj/usbd-human-interface-device 70 | - https://github.com/TeXitoi/keyberon 71 | - https://github.com/camrbuss/pinci 72 | - https://github.com/ChrisChrisLoLo/keezyboost40/tree/master/firmware/keezus 73 | 74 | ## 🧑‍🤝‍🧑 Contributing 75 | _[...](CONTRIBUTING.md)_ 76 | 77 | ## ®️ License 78 | Licensed under an [**MIT License**](LICENSE) 79 | 80 | ------------------- 81 | 82 | > _[↑ Go To TOP](#TOP)_ 83 | -------------------------------------------------------------------------------- /example_keymap.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Example Keymap", 3 | "version": 1.0, 4 | "author": "RMK", 5 | "layers": 2, 6 | "max_rows": 3, 7 | "max_columns": 3, 8 | "description": "Experimental. An example keymap for RMK firmware, 3x3 key matrix with two layers.", 9 | "layer1": { 10 | "row1": ["KEY_Q", "KEY_W", "KEY_E"], 11 | "row2": ["KEY_A", "KEY_S", "KEY_D"], 12 | "row3": ["KEY_null", "KEY_null", "KEY_null"] 13 | }, 14 | "layer2": { 15 | "row1": ["KEY_TRNS", "KEY_T", "KEY_MEDIA_PLAY_PAUSE"] 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /memory.x: -------------------------------------------------------------------------------- 1 | /* NEDDED ? */ 2 | 3 | /* End of file */ 4 | -------------------------------------------------------------------------------- /src/keycodes.rs: -------------------------------------------------------------------------------- 1 | // check https://gist.github.com/MightyPork/6da26e382a7ad91b5496ee55fdc73db2 2 | // or https://github.com/TeXitoi/keyberon/blob/45b8810e50e87e63adb8629f96778a86affda507/src/key_code.rs 3 | 4 | -------------------------------------------------------------------------------- /src/main.rs: -------------------------------------------------------------------------------- 1 | // main.rs file 2 | // RMK_firmware 3 | // @link https://github.com/ObsiLab/rmk_firmware 4 | // Created by Lucas Placentino - 0bsilab 5 | 6 | #![no_std] 7 | // don't link the Rust standard library 8 | #![no_main] 9 | // see #[entry] below, from cortex_m_rt::entry 10 | 11 | // ---- const : ---- 12 | 13 | const XTAL_FREQ_HZ: u32 = 12_000_000u32; // RPi Pico/RP2040 crystal freq 14 | // needed? : 15 | const NBKEYS: usize = 3; // ! number of keys on the keyboard (80 ?), automatically get from keymap json or toml or other? 16 | 17 | // ---- use : ---- 18 | 19 | use panic_halt as _; 20 | 21 | // usbd hid 22 | use usbd_human_interface_device::page::Keyboard; 23 | //use usbd_human_interface_device::device::keyboard::{KeyboardLedsReport, NKROBootKeyboardInterface}; 24 | use embedded_hal as hal; 25 | use embedded_hal::digital::v2::*; 26 | use embedded_hal::prelude::*; 27 | use embedded_time::duration::Milliseconds; 28 | use usb_device::class_prelude::*; 29 | use usb_device::prelude::*; 30 | use usbd_human_interface_device::device::keyboard::NKROBootKeyboardInterface; 31 | use usbd_human_interface_device::prelude::*; 32 | //? use embedded_time::rate::Hertz; 33 | use core::convert::Infallible; 34 | use hal::pac; 35 | //use rp2040_hal as hal; // prefer embedded_hal ? 36 | //?use hal::Clock; 37 | use cortex_m_rt::entry; 38 | 39 | // ? : 40 | use embedded_time::clock::Error; 41 | use embedded_time::duration::Fraction; 42 | use embedded_time::Instant; 43 | pub const SCALING_FACTOR: Fraction = Fraction::new(1, 1_000_000u32); 44 | use crate::hal::Timer; // only with rp2040_hal ? 45 | // ? use hal::Timer; 46 | pub struct TimerClock<'a> { 47 | timer: &'a Timer, 48 | } 49 | 50 | impl<'a> TimerClock<'a> { 51 | pub fn new(timer: &'a Timer) -> Self { 52 | Self { timer } 53 | } 54 | } 55 | 56 | impl<'a> embedded_time::clock::Clock for TimerClock<'a> { 57 | type T = u32; 58 | const SCALING_FACTOR: Fraction = SCALING_FACTOR; 59 | 60 | fn try_now(&self) -> Result, Error> { 61 | Ok(Instant::new(self.timer.get_counter_low())) 62 | } 63 | } 64 | 65 | // --------------- 66 | /* 67 | 68 | use log::info; 69 | 70 | // The macro for our start-up function 71 | use cortex_m_rt::entry; 72 | 73 | // Ensure we halt the program on panic (if we don't mention this crate it won't be linked) 74 | use panic_halt as _; 75 | 76 | // Alias for our HAL crate 77 | use rp2040_hal as hal; 78 | 79 | // A shorter alias for the Peripheral Access Crate, which provides low-level 80 | // register access 81 | use hal::pac; 82 | 83 | //? Some traits we need (blinky sample code) 84 | //use embedded_hal::digital::v2::InputPin; 85 | //use embedded_hal::digital::v2::OutputPin; 86 | //use embedded_hal::digital::v2::ToggleableOutputPin; 87 | use embedded_time::fixed_point::FixedPoint; 88 | use rp2040_hal::clocks::Clock; 89 | 90 | /// The linker will place this boot block at the start of our program image. We 91 | /// need this to help the ROM bootloader get our code up and running. 92 | #[link_section = ".boot2"] 93 | #[used] 94 | pub static BOOT2: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080; 95 | 96 | /// External high-speed crystal on the Raspberry Pi Pico board is 12 MHz. Adjust 97 | /// if your board has a different frequency 98 | const XTAL_FREQ_HZ: u32 = 12_000_000u32; 99 | 100 | 101 | /// Entry point to our bare-metal application. 102 | /// 103 | /// The `#[entry]` macro ensures the Cortex-M start-up code calls this function 104 | /// as soon as all global variables are initialised. 105 | #[entry] 106 | //fn main() -> () { 107 | fn main() -> ! { 108 | // right one 109 | info!("Program start"); 110 | 111 | // Grab our singleton objects 112 | let mut pac = pac::Peripherals::take().unwrap(); 113 | let core = pac::CorePeripherals::take().unwrap(); 114 | 115 | // Set up the watchdog driver - needed by the clock setup code 116 | let mut watchdog = hal::Watchdog::new(pac.WATCHDOG); 117 | 118 | // Configure the clocks 119 | let _clocks = hal::clocks::init_clocks_and_plls( 120 | //? _clocks or just clocks 121 | XTAL_FREQ_HZ, 122 | pac.XOSC, 123 | pac.CLOCKS, 124 | pac.PLL_SYS, 125 | pac.PLL_USB, 126 | &mut pac.RESETS, 127 | &mut watchdog, 128 | ) 129 | .ok() 130 | .unwrap(); 131 | 132 | let mut delay = cortex_m::delay::Delay::new(core.SYST, _clocks.system_clock.freq().integer()); 133 | 134 | // The single-cycle I/O block controls our GPIO pins 135 | let sio = hal::Sio::new(pac.SIO); 136 | 137 | // Set the pins to their default state 138 | let pins = hal::gpio::Pins::new( 139 | pac.IO_BANK0, 140 | pac.PADS_BANK0, 141 | sio.gpio_bank0, 142 | &mut pac.RESETS, 143 | ); 144 | 145 | loop { // loop ? 146 | // ... 147 | 148 | info!("printing Hello World"); 149 | //println!("Hello, world!"); 150 | } 151 | } 152 | */ 153 | 154 | /* 155 | 156 | =========================== TEST 2 : ================================ 157 | 158 | */ 159 | 160 | // * test 161 | #[cfg(rp2040)] 162 | use crate::mcu::rp2040::*; 163 | //#[cfg_attr(predicate, attr)] 164 | pub mod mcu; 165 | 166 | const USBVID: u16 = 0x1209; 167 | const USBPID: u16 = 0x0001; 168 | // ! need to get PID from pid.codes (VID 0x1209) 169 | 170 | ///main function test 2 171 | #[entry] 172 | fn main() -> ! { 173 | // * test 174 | #[cfg(rp2040)] 175 | let test_mcu = mcu::rp2040::RP2040::new("RP2040", 8); 176 | 177 | let mut pac = pac::Peripherals::take().unwrap(); 178 | 179 | let mut watchdog = hal::Watchdog::new(pac.WATCHDOG); 180 | let clocks = hal::clocks::init_clocks_and_plls( 181 | XTAL_FREQ_HZ, 182 | pac.XOSC, 183 | pac.CLOCKS, 184 | pac.PLL_SYS, 185 | pac.PLL_USB, 186 | &mut pac.RESETS, 187 | &mut watchdog, 188 | ) 189 | .ok() 190 | .unwrap(); 191 | 192 | let timer = hal::Timer::new(pac.TIMER, &mut pac.RESETS); 193 | 194 | let sio = hal::Sio::new(pac.SIO); 195 | let pins = hal::gpio::Pins::new( 196 | pac.IO_BANK0, 197 | pac.PADS_BANK0, 198 | sio.gpio_bank0, 199 | &mut pac.RESETS, 200 | ); 201 | 202 | let clock = TimerClock::new(&timer); 203 | 204 | let usb_bus = UsbBusAllocator::new(hal::usb::UsbBus::new( 205 | pac.USBCTRL_REGS, 206 | pac.USBCTRL_DPRAM, 207 | clocks.usb_clock, 208 | true, 209 | &mut pac.RESETS, 210 | )); 211 | 212 | let mut keyboard = UsbHidClassBuilder::new() 213 | .add_interface( 214 | NKROBootKeyboardInterface::default_config(&clock), // ! clock ?? clock=TimerClock:new(&timer) ?? 215 | ) 216 | .build(&usb_bus); 217 | 218 | let mut usb_dev = UsbDeviceBuilder::new(&usb_bus, UsbVidPid(USBVID, USBPID)) // ! need to get PID from pid.codes (VID 0x1209) 219 | .manufacturer("0bsilab") 220 | .product("Quanta Keyboard") 221 | .serial_number("TESTv1") 222 | //.serial_number("MYVERYOWNQUANTAKEYBOARD") 223 | .supports_remote_wakeup(false) //? should test this 224 | .max_packet_size_0(8) 225 | .build(); 226 | 227 | let mut led_pin = pins.gpio13.into_push_pull_output(); // ! check pin // used for caps lock led 228 | led_pin.set_low().ok(); 229 | 230 | let keys: &[&dyn InputPin] = &[ 231 | // ! check pins, length must be == NBKEYS, maybe autogenerate ? 232 | &pins.gpio1.into_pull_up_input(), 233 | &pins.gpio2.into_pull_up_input(), 234 | &pins.gpio3.into_pull_up_input(), //* etc 235 | ]; 236 | 237 | let reset_button = pins.gpio0.into_pull_up_input(); // ! check pin 238 | 239 | let mut input_count_down = timer.count_down(); 240 | input_count_down.start(Milliseconds(1)); // ! check and test 10ms ? 241 | 242 | let mut tick_count_down = timer.count_down(); 243 | tick_count_down.start(Milliseconds(1)); // ! check ms 244 | 245 | loop { 246 | // ! check 247 | if reset_button.is_low().unwrap() { 248 | hal::rom_data::reset_to_usb_boot(0x1 << 13, 0x0); 249 | } 250 | 251 | //Poll the keys every millisecond 252 | if input_count_down.wait().is_ok() { 253 | let keys = key_press(keys); 254 | 255 | match keyboard.interface().write_report(&keys) { 256 | Err(UsbHidError::WouldBlock) => {} 257 | Err(UsbHidError::Duplicate) => {} 258 | Ok(_) => {} 259 | Err(error) => { 260 | panic!("Keyboard report (write) error: {:?}", error) 261 | } 262 | }; 263 | } 264 | 265 | if tick_count_down.wait().is_ok() { 266 | match keyboard.interface().tick() { 267 | Err(UsbHidError::WouldBlock) => {} 268 | Ok(_) => {} 269 | Err(error) => { 270 | panic!("Keyboard tick error: {:?}", error) 271 | } 272 | }; 273 | } 274 | 275 | if usb_dev.poll(&mut [&mut keyboard]) { 276 | match keyboard.interface().read_report() { 277 | // check if caps lock, etc, is on 278 | Err(UsbError::WouldBlock) => { 279 | // blank 280 | } 281 | Err(error) => { 282 | panic!("Keyboard report (read) error: {:?}", error) 283 | } 284 | Ok(leds) => { 285 | led_pin.set_state(PinState::from(leds.caps_lock)).ok(); //turns on the caps lock LED 286 | } 287 | } 288 | } 289 | 290 | // needed? : 291 | log::logger().flush(); 292 | } 293 | } 294 | 295 | // ! TODO ---------- create a Key Struct and implement the key_press fn below for it ---------- 296 | // ! TODO create a Key from Struct for each key that is in the keymap JSON/TOML/other 297 | 298 | ///key_press function, sends key that is pressed 299 | fn key_press(keys: &[&dyn InputPin]) -> [Keyboard; NBKEYS] { 300 | // ! put keys in a json, toml or something 301 | [ 302 | //arrow UP: 303 | if keys[0].is_low().unwrap() { 304 | Keyboard::UpArrow 305 | } else { 306 | Keyboard::NoEventIndicated 307 | }, 308 | //arrow LEFT: 309 | if keys[1].is_low().unwrap() { 310 | Keyboard::LeftArrow 311 | } else { 312 | Keyboard::NoEventIndicated 313 | }, 314 | //arrow RIGHT: 315 | if keys[2].is_low().unwrap() { 316 | Keyboard::RightArrow 317 | } else { 318 | Keyboard::NoEventIndicated 319 | }, 320 | ] 321 | } 322 | 323 | /* 324 | 325 | ===========TEST 3========= 326 | 327 | */ 328 | 329 | /* 330 | use usbd_human_interface_device::page::Keyboard; 331 | use usbd_human_interface_device::device::keyboard::{KeyboardLedsReport, NKROBootKeyboardInterface}; 332 | use usbd_human_interface_device::prelude::*; 333 | 334 | 335 | let usb_alloc = UsbBusAllocator::new(usb_bus); 336 | 337 | let mut keyboard = UsbHidClassBuilder::new() 338 | .add_interface( 339 | NKROBootKeyboardInterface::default_config(&clock), 340 | ) 341 | .build(&usb_alloc); 342 | 343 | let mut usb_dev = UsbDeviceBuilder::new(&usb_alloc, UsbVidPid(0x1209, 0x0001)) 344 | .manufacturer("usbd-human-interface-device") 345 | .product("NKRO Keyboard") 346 | .serial_number("TEST") 347 | .build(); 348 | 349 | loop { 350 | 351 | let keys = if pin.is_high().unwrap() { 352 | &[Keyboard::A] 353 | } else { 354 | &[Keyboard::NoEventIndicated] 355 | }; 356 | 357 | keyboard.interface().write_report(keys).ok(); 358 | keyboard.interface().tick().unwrap(); 359 | 360 | if usb_dev.poll(&mut [&mut keyboard]) { 361 | match keyboard.interface().read_report() { 362 | 363 | Ok(l) => { 364 | update_leds(l); 365 | } 366 | _ => {} 367 | } 368 | } 369 | } 370 | */ 371 | 372 | // End of file 373 | -------------------------------------------------------------------------------- /src/mcu.rs: -------------------------------------------------------------------------------- 1 | pub mod rp2040; 2 | 3 | trait MCU { 4 | fn new(name: &'static str, nb_gpios: u8) -> Self; 5 | 6 | fn set_gpio_high(&self, pin: u8); 7 | } 8 | -------------------------------------------------------------------------------- /src/mcu/rp2040.rs: -------------------------------------------------------------------------------- 1 | #[cfg(debug)] 2 | use defmt::println; 3 | 4 | use crate::mcu::MCU; 5 | 6 | pub struct RP2040 { 7 | name: &'static str, 8 | nb_gpios: u8, 9 | } 10 | 11 | // implement methods for the RP2040 struct 12 | impl RP2040 { 13 | pub fn rpi() { 14 | #[cfg(debug)] 15 | println!("RPi!") 16 | } 17 | } 18 | 19 | // implement the MCU trait for the RP2040 struct 20 | impl MCU for RP2040 { 21 | fn new(name: &'static str, nb_gpios: u8) -> Self { 22 | Self { name , nb_gpios: 8 } 23 | } 24 | 25 | fn set_gpio_high(&self, pin: u8) { 26 | //rp2040_hal.setHigh(pin) 27 | #[cfg(debug)] 28 | println!("set_gpio_high: {}", pin) 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/test.rs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | * =================== TEST 3 ====================== 4 | 5 | */ 6 | 7 | //?#![no_std] // don't link the Rust standard library 8 | // #![cfg_attr(not(test), no_std)] // only link the Rust standard library when testing 9 | #![no_main] // see #[entry] below, from cortex_m_rt::entry 10 | 11 | use core::convert::Infallible; 12 | use cortex_m_rt::entry; 13 | use embedded_hal as hal; // rather than rp2040_hal ? 14 | use embedded_hal::digital::v2::*; 15 | use embedded_hal::prelude::*; 16 | use embedded_time::duration::Milliseconds; 17 | use hal::pac; 18 | //use rp2040_hal as hal; // prefer embedded_hal ? 19 | use usb_device::class_prelude::*; 20 | use usb_device::prelude::*; 21 | use usbd_human_interface_device::device::keyboard::{ 22 | KeyboardLedsReport, NKROBootKeyboardInterface, 23 | }; 24 | use usbd_human_interface_device::page::Keyboard; 25 | use usbd_human_interface_device::prelude::*; 26 | 27 | // ?? ----- : 28 | use embedded_time::clock::Error; 29 | use embedded_time::duration::Fraction; 30 | use embedded_time::Instant; 31 | pub const SCALING_FACTOR: Fraction = Fraction::new(1, 1_000_000u32); 32 | use crate::hal::Timer; // only with rp2040_hal ? 33 | // ? use hal::Timer; 34 | 35 | const USBVID: u16 = 0x1209; 36 | const USBPID: u16 = 0x0001; 37 | // ! need to get PID from pid.codes (VID 0x1209) 38 | 39 | pub struct TimerClock<'a> { 40 | timer: &'a Timer, 41 | } 42 | 43 | impl<'a> TimerClock<'a> { 44 | pub fn new(timer: &'a Timer) -> Self { 45 | Self { timer } 46 | } 47 | } 48 | 49 | impl<'a> embedded_time::clock::Clock for TimerClock<'a> { 50 | type T = u32; 51 | const SCALING_FACTOR: Fraction = SCALING_FACTOR; 52 | 53 | fn try_now(&self) -> Result, Error> { 54 | Ok(Instant::new(self.timer.get_counter_low())) 55 | } 56 | } 57 | // ?? ----- 58 | 59 | const NBKEYS: usize = 3; 60 | const XTAL_FREQ_HZ: u32 = 12_000_000u32; 61 | 62 | #[entry] 63 | fn main() -> ! { 64 | let mut pac = pac::Peripherals::take().unwrap(); 65 | 66 | let mut watchdog = hal::Watchdog::new(pac.WATCHDOG); 67 | let clocks = hal::clocks::init_clocks_and_plls( 68 | XTAL_FREQ_HZ, 69 | pac.XOSC, 70 | pac.CLOCKS, 71 | pac.PLL_SYS, 72 | pac.PLL_USB, 73 | &mut pac.RESETS, 74 | &mut watchdog, 75 | ) 76 | .ok() 77 | .unwrap(); 78 | 79 | let timer = hal::Timer::new(pac.TIMER, &mut pac.RESETS); 80 | 81 | let sio = hal::Sio::new(pac.SIO); 82 | let pins = hal::gpio::Pins::new( 83 | pac.IO_BANK0, 84 | pac.PADS_BANK0, 85 | sio.gpio_bank0, 86 | &mut pac.RESETS, 87 | ); 88 | 89 | let usb_bus = UsbBusAllocator::new(hal::usb::UsbBus::new( 90 | pac.USBCTRL_REGS, 91 | pac.USBCTRL_DPRAM, 92 | clocks.usb_clock, 93 | true, 94 | &mut pac.RESETS, 95 | )); 96 | 97 | let clock = TimerClock::new(&timer); 98 | 99 | let usb_alloc = UsbBusAllocator::new(usb_bus); 100 | 101 | let mut keyboard = UsbHidClassBuilder::new() 102 | .add_interface(NKROBootKeyboardInterface::default_config(&clock)) 103 | .build(&usb_alloc); 104 | 105 | let mut usb_dev = UsbDeviceBuilder::new(&usb_alloc, UsbVidPid(USBVID, USBPID)) 106 | .manufacturer("usbd-human-interface-device") 107 | .product("NKRO Keyboard") 108 | .serial_number("TEST") 109 | .build(); 110 | 111 | let keys: &[&dyn InputPin] = &[ 112 | // ! check pins, length must be == NBKEYS, maybe autogenerate ? 113 | &pins.gpio1.into_pull_up_input(), 114 | &pins.gpio2.into_pull_up_input(), 115 | &pins.gpio3.into_pull_up_input(), //* etc 116 | ]; 117 | 118 | let mut input_count_down = timer.count_down(); 119 | input_count_down.start(Milliseconds(1)); // ! check and test 10ms ? 120 | 121 | loop { 122 | if input_count_down.wait().is_ok() { 123 | let keys = key_press(keys); 124 | } 125 | 126 | /* 127 | let keys = if pin.is_high().unwrap() { 128 | &[Keyboard::A] 129 | } else { 130 | &[Keyboard::NoEventIndicated] 131 | }; 132 | */ 133 | 134 | keyboard.interface().write_report(&keys).ok(); 135 | 136 | keyboard.interface().tick().unwrap(); 137 | 138 | /* // ?? 139 | if usb_dev.poll(&mut [&mut keyboard]) { 140 | match keyboard.interface().read_report() { 141 | 142 | Ok(l) => { 143 | update_leds(l); 144 | } 145 | _ => {} 146 | } 147 | } 148 | */ 149 | keyboard.interface().read_report().ok(); // ? 150 | } 151 | } 152 | 153 | fn key_press(keys: &[&dyn InputPin]) -> [Keyboard; NBKEYS] { 154 | // ! put keys in a json, toml or something 155 | [ 156 | //arrow UP: 157 | if keys[0].is_low().unwrap() { 158 | Keyboard::UpArrow 159 | } else { 160 | Keyboard::NoEventIndicated 161 | }, 162 | //arrow LEFT: 163 | if keys[1].is_low().unwrap() { 164 | Keyboard::LeftArrow 165 | } else { 166 | Keyboard::NoEventIndicated 167 | }, 168 | //arrow RIGHT: 169 | if keys[2].is_low().unwrap() { 170 | Keyboard::RightArrow 171 | } else { 172 | Keyboard::NoEventIndicated 173 | }, 174 | ] 175 | } 176 | 177 | // End of file 178 | --------------------------------------------------------------------------------