From 5d05d607eefde4a659150f8180457b0eed37bc8c Mon Sep 17 00:00:00 2001 From: Martins Polakovs Date: Sun, 21 Apr 2024 13:46:29 +0300 Subject: [PATCH] Bump rp2040-pac to 0.6 in rtic-monotonics (#905) * Support rp2040-pac v0.6 in rtic-monotonics * Add changelog entry * Fix rp2040_local_i2c_init example --- examples/rp2040_local_i2c_init/Cargo.lock | 153 ++++++++++++++------- examples/rp2040_local_i2c_init/Cargo.toml | 2 +- examples/rp2040_local_i2c_init/src/main.rs | 12 +- rtic-monotonics/CHANGELOG.md | 1 + rtic-monotonics/Cargo.toml | 2 +- rtic-monotonics/src/rp2040.rs | 16 +-- 6 files changed, 121 insertions(+), 65 deletions(-) diff --git a/examples/rp2040_local_i2c_init/Cargo.lock b/examples/rp2040_local_i2c_init/Cargo.lock index d4c01558aa..66666f85f8 100644 --- a/examples/rp2040_local_i2c_init/Cargo.lock +++ b/examples/rp2040_local_i2c_init/Cargo.lock @@ -10,9 +10,9 @@ checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "atomic-polyfill" -version = "1.0.3" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cf2bce30dfe09ef0bfaef228b9d414faaf7e563035494d7fe092dba54b300f4" +checksum = "c314e70d181aa6053b26e3f7fbf86d1dfff84f816a6175b967666b3506ef7289" dependencies = [ "critical-section", ] @@ -38,6 +38,18 @@ 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 = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + [[package]] name = "cfg-if" version = "1.0.0" @@ -51,7 +63,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ec610d8f49840a5b376c69663b6369e71f4b34484b9b2eb29fb918d92516cb9" dependencies = [ "bare-metal 0.2.5", - "bitfield", + "bitfield 0.13.2", "embedded-hal 0.2.7", "volatile-register", ] @@ -78,18 +90,18 @@ dependencies = [ [[package]] name = "crc-any" -version = "2.4.4" +version = "2.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c01a5e1f881f6fb6099a7bdf949e946719fd4f1fefa56264890574febf0eb6d0" +checksum = "774646b687f63643eb0f4bf13dc263cb581c8c9e57973b6ddf78bda3994d88df" dependencies = [ "debug-helper", ] [[package]] name = "critical-section" -version = "1.1.2" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7059fff8937831a9ae6f0fe4d658ffabf58f2ca96aa9dec1c889f936f705f216" +checksum = "6548a0ad5d2549e111e1f6a11a6c2e2d00ce6a3dafe22948d67c2b443f775e52" [[package]] name = "debug-helper" @@ -99,9 +111,9 @@ checksum = "f578e8e2c440e7297e008bb5486a3a8a194775224bbc23729b0dbdfaeebf162e" [[package]] name = "either" -version = "1.10.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" +checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" [[package]] name = "embedded-dma" @@ -138,10 +150,26 @@ dependencies = [ ] [[package]] -name = "equivalent" -version = "1.0.1" +name = "embedded-hal-nb" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +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 = "equivalent" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88bffebc5d80432c9b140ee17875ff173a8ab62faad5b257da912bd2f6c1c0a1" [[package]] name = "frunk" @@ -167,7 +195,7 @@ checksum = "b0fa992f1656e1707946bbba340ad244f0814009ef8c0118eb7b658395f19a2e" dependencies = [ "frunk_proc_macro_helpers", "quote", - "syn 2.0.51", + "syn 2.0.53", ] [[package]] @@ -179,7 +207,7 @@ dependencies = [ "frunk_core", "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.53", ] [[package]] @@ -193,21 +221,21 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.30" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" +checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" [[package]] name = "futures-task" -version = "0.3.30" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" +checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" [[package]] name = "futures-util" -version = "0.3.30" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" dependencies = [ "futures-core", "futures-task", @@ -222,16 +250,35 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d758ba1b47b00caf47f24925c0074ecb20d6dfcffe7f6d53395c0465674841a" [[package]] -name = "hashbrown" -version = "0.14.3" +name = "hash32" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +checksum = "47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606" +dependencies = [ + "byteorder", +] + +[[package]] +name = "hashbrown" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" + +[[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 = "indexmap" -version = "2.2.3" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "233cf39063f058ea2caae4091bf4a3ef70a653afbc026f5c4a4135d114e3c177" +checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" dependencies = [ "equivalent", "hashbrown", @@ -292,15 +339,15 @@ dependencies = [ [[package]] name = "paste" -version = "1.0.14" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" +checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79" [[package]] name = "pin-project-lite" -version = "0.2.13" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" +checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" [[package]] name = "pin-utils" @@ -351,9 +398,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.78" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" +checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e" dependencies = [ "unicode-ident", ] @@ -375,9 +422,9 @@ checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" [[package]] name = "rp-pico" -version = "0.8.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6341771e6f8e5d130b2b3cbc23435b7847761adf198af09f4b2a60407d43bd56" +checksum = "b9342d3ac7011ac688300979e9b52a81f0add1d05feb02868cf94bfee0705b28" dependencies = [ "cortex-m-rt", "fugit", @@ -397,14 +444,19 @@ dependencies = [ [[package]] name = "rp2040-hal" -version = "0.9.2" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ff2b9ae7e6dd6720fd9f64250c9087260e50fe98b6b032ccca65be3581167ca" +checksum = "449f2ce321925c3931ca8da415d5037ac7882194675d0a7087777b61c31d72b7" dependencies = [ + "bitfield 0.14.0", "cortex-m", "critical-section", "embedded-dma", "embedded-hal 0.2.7", + "embedded-hal 1.0.0", + "embedded-hal-async", + "embedded-hal-nb", + "embedded-io", "frunk", "fugit", "itertools", @@ -433,9 +485,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", @@ -458,7 +510,7 @@ dependencies = [ [[package]] name = "rtic" -version = "2.0.1" +version = "2.1.1" dependencies = [ "atomic-polyfill", "bare-metal 1.0.0", @@ -484,13 +536,13 @@ checksum = "d9369355b04d06a3780ec0f51ea2d225624db777acbc60abd8ca4832da5c1a42" [[package]] name = "rtic-macros" -version = "2.0.1" +version = "2.1.0" dependencies = [ "indexmap", "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.53", ] [[package]] @@ -500,7 +552,6 @@ dependencies = [ "atomic-polyfill", "cfg-if", "cortex-m", - "embedded-hal 1.0.0", "fugit", "rp2040-pac", "rtic-time", @@ -561,9 +612,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.51" +version = "2.0.53" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ab617d94515e94ae53b8406c628598680aa0c9587474ecbe58188f7b345d66c" +checksum = "7383cd0e49fff4b6b90ca5670bfd3e9d6a733b3f90c686605aa7eec8c4996032" dependencies = [ "proc-macro2", "quote", @@ -572,15 +623,19 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[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 = "vcell" @@ -602,9 +657,9 @@ checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" [[package]] name = "volatile-register" -version = "0.2.2" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de437e2a6208b014ab52972a27e59b33fa2920d3e00fe05026167a1c509d19cc" +checksum = "9ee8f19f9d74293faf70901bc20ad067dc1ad390d2cbf1e3f75f721ffee908b6" dependencies = [ "vcell", ] diff --git a/examples/rp2040_local_i2c_init/Cargo.toml b/examples/rp2040_local_i2c_init/Cargo.toml index 300bedee08..2f893dc47d 100644 --- a/examples/rp2040_local_i2c_init/Cargo.toml +++ b/examples/rp2040_local_i2c_init/Cargo.toml @@ -22,7 +22,7 @@ features = ["rp2040"] cortex-m = "0.7" embedded-hal = { version = "0.2.7", features = ["unproven"] } fugit = "0.3" -rp-pico = "0.8.0" +rp-pico = "0.9.0" panic-probe = "0.3" [profile.dev] diff --git a/examples/rp2040_local_i2c_init/src/main.rs b/examples/rp2040_local_i2c_init/src/main.rs index 799376c214..7ae51fb276 100644 --- a/examples/rp2040_local_i2c_init/src/main.rs +++ b/examples/rp2040_local_i2c_init/src/main.rs @@ -14,7 +14,7 @@ mod app { gpio::{ self, bank0::{Gpio2, Gpio25, Gpio3}, - FunctionSioOutput, PullNone, PullUp, + FunctionSio, PullNone, PullUp, SioOutput, }, pac, sio::Sio, @@ -41,7 +41,7 @@ mod app { #[local] struct Local { - led: gpio::Pin, + led: gpio::Pin, PullNone>, i2c: &'static mut I2CBus, } @@ -82,14 +82,14 @@ mod app { led.set_low().unwrap(); // Init I2C pins - let sda_pin = gpioa + let sda_pin: gpio::Pin<_, gpio::FunctionI2C, _> = gpioa .gpio2 .into_pull_up_disabled() - .into_function::(); - let scl_pin = gpioa + .reconfigure(); + let scl_pin: gpio::Pin<_, gpio::FunctionI2C, _> = gpioa .gpio3 .into_pull_up_disabled() - .into_function::(); + .reconfigure(); // Init I2C itself, using MaybeUninit to overwrite the previously // uninitialized i2c_ctx variable without dropping its value diff --git a/rtic-monotonics/CHANGELOG.md b/rtic-monotonics/CHANGELOG.md index f114a18384..14d239d4e4 100644 --- a/rtic-monotonics/CHANGELOG.md +++ b/rtic-monotonics/CHANGELOG.md @@ -13,6 +13,7 @@ For each category, *Added*, *Changed*, *Fixed* add new entries at the top! - Most timer tick rates are now configurable - Tweak `build.rs` to avoid warnings in Nightly 1.78+ - Removed unused `rust-toolchain.toml` +- RP2040 PAC 0.6 support ## v1.5.0 - 2024-01-10 diff --git a/rtic-monotonics/Cargo.toml b/rtic-monotonics/Cargo.toml index 81df2402b8..c9756dc2d2 100644 --- a/rtic-monotonics/Cargo.toml +++ b/rtic-monotonics/Cargo.toml @@ -42,7 +42,7 @@ cortex-m = { version = "0.7.6", optional = true } critical-section = { version = "1", optional = true } # RP2040 -rp2040-pac = { version = ">=0.2.0,<0.6", optional = true } +rp2040-pac = { version = "0.6", optional = true } # nRF52 nrf52810-pac = { version = "0.12.2", optional = true } diff --git a/rtic-monotonics/src/rp2040.rs b/rtic-monotonics/src/rp2040.rs index d4f590fedc..9c5a1ddfe4 100644 --- a/rtic-monotonics/src/rp2040.rs +++ b/rtic-monotonics/src/rp2040.rs @@ -51,9 +51,9 @@ impl TimerBackend { /// /// Use the prelude macros instead. pub fn _start(timer: TIMER, resets: &RESETS) { - resets.reset.modify(|_, w| w.timer().clear_bit()); - while resets.reset_done.read().timer().bit_is_clear() {} - timer.inte.modify(|_, w| w.alarm_0().bit(true)); + resets.reset().modify(|_, w| w.timer().clear_bit()); + while resets.reset_done().read().timer().bit_is_clear() {} + timer.inte().modify(|_, w| w.alarm_0().bit(true)); TIMER_QUEUE.initialize(Self {}); @@ -76,10 +76,10 @@ impl TimerQueueBackend for TimerBackend { fn now() -> Self::Ticks { let timer = Self::timer(); - let mut hi0 = timer.timerawh.read().bits(); + let mut hi0 = timer.timerawh().read().bits(); loop { - let low = timer.timerawl.read().bits(); - let hi1 = timer.timerawh.read().bits(); + let low = timer.timerawl().read().bits(); + let hi1 = timer.timerawh().read().bits(); if hi0 == hi1 { break ((u64::from(hi0) << 32) | u64::from(low)); } @@ -102,12 +102,12 @@ impl TimerQueueBackend for TimerBackend { }; Self::timer() - .alarm0 + .alarm0() .write(|w| unsafe { w.bits(val as u32) }); } fn clear_compare_flag() { - Self::timer().intr.modify(|_, w| w.alarm_0().bit(true)); + Self::timer().intr().modify(|_, w| w.alarm_0().bit(true)); } fn pend_interrupt() {