diff --git a/firmware/Cargo.lock b/firmware/Cargo.lock index f0d28b0..0048f56 100644 --- a/firmware/Cargo.lock +++ b/firmware/Cargo.lock @@ -10,9 +10,9 @@ checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" -version = "1.1.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "bare-metal" @@ -29,6 +29,12 @@ version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46afbd2983a5d5a7bd740ccb198caf5b82f45c40c09c0eed36052d91cb92e719" +[[package]] +name = "bitfield" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d7e60934ceec538daadb9d8432424ed043a904d8e0243f3c6446bce549a46ac" + [[package]] name = "bitflags" version = "1.3.2" @@ -48,8 +54,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ec610d8f49840a5b376c69663b6369e71f4b34484b9b2eb29fb918d92516cb9" dependencies = [ "bare-metal", - "bitfield", - "embedded-hal", + "bitfield 0.13.2", + "embedded-hal 0.2.7", "volatile-register", ] @@ -75,9 +81,9 @@ dependencies = [ [[package]] name = "crc-any" -version = "2.4.3" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "774646b687f63643eb0f4bf13dc263cb581c8c9e57973b6ddf78bda3994d88df" +checksum = "a62ec9ff5f7965e4d7280bd5482acd20aadb50d632cf6c1d74493856b011fa73" dependencies = [ "debug-helper", ] @@ -96,9 +102,9 @@ checksum = "f578e8e2c440e7297e008bb5486a3a8a194775224bbc23729b0dbdfaeebf162e" [[package]] name = "defmt" -version = "0.3.5" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8a2d011b2fee29fb7d659b83c43fce9a2cb4df453e16d441a51448e448f3f98" +checksum = "a99dd22262668b887121d4672af5a64b238f026099f1a2a1b322066c9ecfe9e0" dependencies = [ "bitflags", "defmt-macros", @@ -106,31 +112,31 @@ dependencies = [ [[package]] name = "defmt-macros" -version = "0.3.6" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54f0216f6c5acb5ae1a47050a6645024e6edafc2ee32d421955eccfef12ef92e" +checksum = "e3a9f309eff1f79b3ebdf252954d90ae440599c26c2c553fe87a2d17195f2dcb" dependencies = [ "defmt-parser", "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.67", ] [[package]] name = "defmt-parser" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "269924c02afd7f94bc4cecbfa5c379f6ffcf9766b3408fe63d22c728654eccd0" +checksum = "ff4a5fefe330e8d7f31b16a318f9ce81000d8e35e69b93eae154d16d2278f70f" dependencies = [ "thiserror", ] [[package]] name = "defmt-rtt" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "609923761264dd99ed9c7d209718cda4631c5fe84668e0f0960124cbb844c49f" +checksum = "bab697b3dbbc1750b7c8b821aa6f6e7f2480b47a99bc057a2ed7b170ebef0c51" dependencies = [ "critical-section", "defmt", @@ -138,9 +144,9 @@ dependencies = [ [[package]] name = "either" -version = "1.9.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b" [[package]] name = "embedded-dma" @@ -161,6 +167,37 @@ dependencies = [ "void", ] +[[package]] +name = "embedded-hal" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89" + +[[package]] +name = "embedded-hal-async" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c4c685bbef7fe13c3c6dd4da26841ed3980ef33e841cddfa15ce8a8fb3f1884" +dependencies = [ + "embedded-hal 1.0.0", +] + +[[package]] +name = "embedded-hal-nb" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fba4268c14288c828995299e59b12babdbe170f6c6d73731af1b4648142e8605" +dependencies = [ + "embedded-hal 1.0.0", + "nb 1.1.0", +] + +[[package]] +name = "embedded-io" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" + [[package]] name = "embedded-time" version = "0.12.1" @@ -200,7 +237,7 @@ checksum = "b0fa992f1656e1707946bbba340ad244f0814009ef8c0118eb7b658395f19a2e" dependencies = [ "frunk_proc_macro_helpers", "quote", - "syn 2.0.39", + "syn 2.0.67", ] [[package]] @@ -212,7 +249,7 @@ dependencies = [ "frunk_core", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.67", ] [[package]] @@ -230,6 +267,25 @@ 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" @@ -248,7 +304,7 @@ dependencies = [ "critical-section", "defmt", "defmt-rtt", - "embedded-hal", + "embedded-hal 1.0.0", "embedded-time", "panic-probe", "panic-reset", @@ -297,19 +353,18 @@ dependencies = [ [[package]] name = "num-integer" -version = "0.1.45" +version = "0.1.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" dependencies = [ - "autocfg", "num-traits", ] [[package]] name = "num-iter" -version = "0.1.43" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" dependencies = [ "autocfg", "num-integer", @@ -329,9 +384,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.17" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] @@ -358,9 +413,9 @@ dependencies = [ [[package]] name = "panic-probe" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa6fa5645ef5a760cd340eaa92af9c1ce131c8c09e7f8926d8a24b59d26652b9" +checksum = "4047d9235d1423d66cc97da7d07eddb54d4f154d6c13805c6d0793956f4f25b0" dependencies = [ "cortex-m", "defmt", @@ -377,9 +432,9 @@ dependencies = [ [[package]] name = "paste" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] name = "pio" @@ -392,6 +447,12 @@ dependencies = [ "paste", ] +[[package]] +name = "portable-atomic" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0" + [[package]] name = "proc-macro-error" version = "1.0.4" @@ -418,18 +479,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.69" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.33" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] @@ -451,14 +512,19 @@ dependencies = [ [[package]] name = "rp2040-hal" -version = "0.9.0" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ec610f738b69100fbe75f3b835501b669d41c889ac9a62ef284f8e6d1f17385" +checksum = "d11e711940087f2cdff8aeae9f4b902e2014c06a00b39a1092686b81ec973d6f" dependencies = [ + "bitfield 0.14.0", "cortex-m", "critical-section", "embedded-dma", - "embedded-hal", + "embedded-hal 0.2.7", + "embedded-hal 1.0.0", + "embedded-hal-async", + "embedded-hal-nb", + "embedded-io", "frunk", "fugit", "itertools", @@ -487,9 +553,9 @@ dependencies = [ [[package]] name = "rp2040-pac" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12d9d8375815f543f54835d01160d4e47f9e2cae75f17ff8f1ec19ce1da96e4c" +checksum = "83cbcd3f7a0ca7bbe61dc4eb7e202842bee4e27b769a7bf3a4a72fa399d6e404" dependencies = [ "cortex-m", "cortex-m-rt", @@ -523,22 +589,22 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.192" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bca2a08484b285dcb282d0f67b26cadc0df8b19f8c12502c13d966bf9482f001" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.192" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.67", ] [[package]] @@ -570,9 +636,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.39" +version = "2.0.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" +checksum = "ff8655ed1d86f3af4ee3fd3263786bc14245ad17c4c7e85ba7187fb3ae028c90" dependencies = [ "proc-macro2", "quote", @@ -581,22 +647,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.50" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" +checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.50" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" +checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.67", ] [[package]] @@ -607,15 +673,19 @@ checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "usb-device" -version = "0.2.9" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f6cc3adc849b5292b4075fc0d5fdcf2f24866e88e336dd27a8943090a520508" +checksum = "98816b1accafbb09085168b90f27e93d790b4bfa19d883466b5e53315b5f06a6" +dependencies = [ + "heapless", + "portable-atomic", +] [[package]] name = "usbd-hid" -version = "0.6.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "975bd411f4a939986751ea09992a24fa47c4d25c6ed108d04b4c2999a4fd0132" +checksum = "41a2d4546ca3e6a5c6a85584e5caf29feabf3ec35d6cd6b772eb35bd3cff7256" dependencies = [ "serde", "ssmarshal", @@ -629,7 +699,7 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcbee8c6735e90894fba04770bc41e11fd3c5256018856e15dc4dd1e6c8a3dd1" dependencies = [ - "bitfield", + "bitfield 0.13.2", ] [[package]] diff --git a/firmware/Cargo.toml b/firmware/Cargo.toml index e38f6be..ad2cf50 100644 --- a/firmware/Cargo.toml +++ b/firmware/Cargo.toml @@ -8,14 +8,14 @@ license = "MIT OR Apache-2.0 OR Zlib" [dependencies] cortex-m = "0.7" cortex-m-rt = "0.7" -embedded-hal = "0.2" +embedded-hal = "1" embedded-time = "0.12" panic-reset = "0.1" rp2040-boot2 = "0.3" -rp2040-hal = { version = "0.9", features = ["rt", "critical-section-impl"] } -usb-device = "0.2" -usbd-hid = "0.6" -critical-section = { version = "1.0.0" } +rp2040-hal = { version = "0.10", features = ["rt", "critical-section-impl"] } +usb-device = "0.3" +usbd-hid = "0.7" +critical-section = { version = "1" } # Dependencies for debug probe defmt = "0.3" # Macros and support for deferred formatting logging diff --git a/firmware/src/key_scan.rs b/firmware/src/key_scan.rs index 1b70c70..d0cadac 100644 --- a/firmware/src/key_scan.rs +++ b/firmware/src/key_scan.rs @@ -5,7 +5,7 @@ use crate::{ use core::{convert::Infallible, ops::Deref}; use cortex_m::delay::Delay; -use embedded_hal::digital::v2::InputPin; +use embedded_hal::digital::InputPin; use usbd_hid::descriptor::KeyboardReport; use crate::{debounce::Debounce, key_codes::KeyCode}; @@ -25,8 +25,8 @@ impl Deref for KeyScan KeyScan { pub fn scan( - rows: [&dyn InputPin; NUM_ROWS], - columns: &mut [&mut dyn embedded_hal::digital::v2::OutputPin; NUM_COLS], + rows: &mut [&mut dyn InputPin; NUM_ROWS], + columns: &mut [&mut dyn embedded_hal::digital::OutputPin; NUM_COLS], delay: &mut Delay, debounce: &mut Debounce, ) -> Self { @@ -36,7 +36,7 @@ impl KeyScan { gpio_col.set_high().unwrap(); delay.delay_us(10); - for (gpio_row, matrix_row) in rows.iter().zip(matrix_col.iter_mut()) { + for (gpio_row, matrix_row) in rows.iter_mut().zip(matrix_col.iter_mut()) { *matrix_row = gpio_row.is_high().unwrap(); } diff --git a/firmware/src/main.rs b/firmware/src/main.rs index 4d2e1d7..02592c3 100644 --- a/firmware/src/main.rs +++ b/firmware/src/main.rs @@ -16,7 +16,7 @@ use core::{cell::RefCell, convert::Infallible}; use critical_section::Mutex; use defmt::{error, info, warn}; use defmt_rtt as _; -use embedded_hal::digital::v2::{InputPin, OutputPin}; +use embedded_hal::digital::{InputPin, OutputPin}; use panic_probe as _; use rp2040_hal::{ pac::{self, interrupt}, @@ -103,13 +103,13 @@ fn main() -> ! { rp2040_hal::gpio::Pins::new(pac.IO_BANK0, pac.PADS_BANK0, sio.gpio_bank0, &mut pac.RESETS); // Set up keyboard matrix pins. - let rows: [&dyn InputPin; NUM_ROWS] = [ - &pins.gpio26.into_pull_down_input(), - &pins.gpio25.into_pull_down_input(), - &pins.gpio27.into_pull_down_input(), - &pins.gpio28.into_pull_down_input(), - &pins.gpio15.into_pull_down_input(), - &pins.gpio24.into_pull_down_input(), + let mut rows: [&mut dyn InputPin; NUM_ROWS] = [ + &mut pins.gpio26.into_pull_down_input(), + &mut pins.gpio25.into_pull_down_input(), + &mut pins.gpio27.into_pull_down_input(), + &mut pins.gpio28.into_pull_down_input(), + &mut pins.gpio15.into_pull_down_input(), + &mut pins.gpio24.into_pull_down_input(), ]; let mut cols: [&mut dyn OutputPin; NUM_COLS] = [ @@ -143,7 +143,7 @@ fn main() -> ! { let mut debounce: Debounce = Debounce::new(DEBOUNCE_TICKS, modifier_mask); // Do an initial scan of the keys so that we immediately have something to report to the host when asked. - let scan = KeyScan::scan(rows, &mut cols, &mut delay, &mut debounce); + let scan = KeyScan::scan(&mut rows, &mut cols, &mut delay, &mut debounce); critical_section::with(|cs| { KEYBOARD_REPORT.replace(cs, scan.into()); }); @@ -189,10 +189,11 @@ fn main() -> ! { // https://github.com/obdev/v-usb/blob/7a28fdc685952412dad2b8842429127bc1cf9fa7/usbdrv/USB-IDs-for-free.txt#L128 let keyboard_usb_device = UsbDeviceBuilder::new(bus_ref, UsbVidPid(0x16c0, 0x27db)) - .manufacturer("bschwind") - .product("key ripper") .supports_remote_wakeup(true) + .strings(&[StringDescriptors::default().manufacturer("bschwind").product("key ripper")]) + .unwrap() .build(); + unsafe { // Note (safety): This is safe as interrupts haven't been started yet USB_HID = Some(hid_endpoint); @@ -204,7 +205,7 @@ fn main() -> ! { } info!("Entering main loop"); loop { - let scan = KeyScan::scan(rows, &mut cols, &mut delay, &mut debounce); + let scan = KeyScan::scan(&mut rows, &mut cols, &mut delay, &mut debounce); critical_section::with(|cs| { KEYBOARD_REPORT.replace(cs, scan.into()); });