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
This commit is contained in:
Martins Polakovs 2024-04-21 13:46:29 +03:00 committed by GitHub
parent acb9f44642
commit 5d05d607ee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 121 additions and 65 deletions

View file

@ -10,9 +10,9 @@ checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711"
[[package]] [[package]]
name = "atomic-polyfill" name = "atomic-polyfill"
version = "1.0.3" version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8cf2bce30dfe09ef0bfaef228b9d414faaf7e563035494d7fe092dba54b300f4" checksum = "c314e70d181aa6053b26e3f7fbf86d1dfff84f816a6175b967666b3506ef7289"
dependencies = [ dependencies = [
"critical-section", "critical-section",
] ]
@ -38,6 +38,18 @@ version = "0.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46afbd2983a5d5a7bd740ccb198caf5b82f45c40c09c0eed36052d91cb92e719" 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]] [[package]]
name = "cfg-if" name = "cfg-if"
version = "1.0.0" version = "1.0.0"
@ -51,7 +63,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ec610d8f49840a5b376c69663b6369e71f4b34484b9b2eb29fb918d92516cb9" checksum = "8ec610d8f49840a5b376c69663b6369e71f4b34484b9b2eb29fb918d92516cb9"
dependencies = [ dependencies = [
"bare-metal 0.2.5", "bare-metal 0.2.5",
"bitfield", "bitfield 0.13.2",
"embedded-hal 0.2.7", "embedded-hal 0.2.7",
"volatile-register", "volatile-register",
] ]
@ -78,18 +90,18 @@ dependencies = [
[[package]] [[package]]
name = "crc-any" name = "crc-any"
version = "2.4.4" version = "2.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c01a5e1f881f6fb6099a7bdf949e946719fd4f1fefa56264890574febf0eb6d0" checksum = "774646b687f63643eb0f4bf13dc263cb581c8c9e57973b6ddf78bda3994d88df"
dependencies = [ dependencies = [
"debug-helper", "debug-helper",
] ]
[[package]] [[package]]
name = "critical-section" name = "critical-section"
version = "1.1.2" version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7059fff8937831a9ae6f0fe4d658ffabf58f2ca96aa9dec1c889f936f705f216" checksum = "6548a0ad5d2549e111e1f6a11a6c2e2d00ce6a3dafe22948d67c2b443f775e52"
[[package]] [[package]]
name = "debug-helper" name = "debug-helper"
@ -99,9 +111,9 @@ checksum = "f578e8e2c440e7297e008bb5486a3a8a194775224bbc23729b0dbdfaeebf162e"
[[package]] [[package]]
name = "either" name = "either"
version = "1.10.0" version = "1.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91"
[[package]] [[package]]
name = "embedded-dma" name = "embedded-dma"
@ -138,10 +150,26 @@ dependencies = [
] ]
[[package]] [[package]]
name = "equivalent" name = "embedded-hal-nb"
version = "1.0.1" version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" 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]] [[package]]
name = "frunk" name = "frunk"
@ -167,7 +195,7 @@ checksum = "b0fa992f1656e1707946bbba340ad244f0814009ef8c0118eb7b658395f19a2e"
dependencies = [ dependencies = [
"frunk_proc_macro_helpers", "frunk_proc_macro_helpers",
"quote", "quote",
"syn 2.0.51", "syn 2.0.53",
] ]
[[package]] [[package]]
@ -179,7 +207,7 @@ dependencies = [
"frunk_core", "frunk_core",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.51", "syn 2.0.53",
] ]
[[package]] [[package]]
@ -193,21 +221,21 @@ dependencies = [
[[package]] [[package]]
name = "futures-core" name = "futures-core"
version = "0.3.30" version = "0.3.28"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c"
[[package]] [[package]]
name = "futures-task" name = "futures-task"
version = "0.3.30" version = "0.3.28"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65"
[[package]] [[package]]
name = "futures-util" name = "futures-util"
version = "0.3.30" version = "0.3.28"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533"
dependencies = [ dependencies = [
"futures-core", "futures-core",
"futures-task", "futures-task",
@ -222,16 +250,35 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d758ba1b47b00caf47f24925c0074ecb20d6dfcffe7f6d53395c0465674841a" checksum = "1d758ba1b47b00caf47f24925c0074ecb20d6dfcffe7f6d53395c0465674841a"
[[package]] [[package]]
name = "hashbrown" name = "hash32"
version = "0.14.3" version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index" 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]] [[package]]
name = "indexmap" name = "indexmap"
version = "2.2.3" version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "233cf39063f058ea2caae4091bf4a3ef70a653afbc026f5c4a4135d114e3c177" checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d"
dependencies = [ dependencies = [
"equivalent", "equivalent",
"hashbrown", "hashbrown",
@ -292,15 +339,15 @@ dependencies = [
[[package]] [[package]]
name = "paste" name = "paste"
version = "1.0.14" version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79"
[[package]] [[package]]
name = "pin-project-lite" name = "pin-project-lite"
version = "0.2.13" version = "0.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116"
[[package]] [[package]]
name = "pin-utils" name = "pin-utils"
@ -351,9 +398,9 @@ dependencies = [
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.78" version = "1.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e"
dependencies = [ dependencies = [
"unicode-ident", "unicode-ident",
] ]
@ -375,9 +422,9 @@ checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
[[package]] [[package]]
name = "rp-pico" name = "rp-pico"
version = "0.8.0" version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6341771e6f8e5d130b2b3cbc23435b7847761adf198af09f4b2a60407d43bd56" checksum = "b9342d3ac7011ac688300979e9b52a81f0add1d05feb02868cf94bfee0705b28"
dependencies = [ dependencies = [
"cortex-m-rt", "cortex-m-rt",
"fugit", "fugit",
@ -397,14 +444,19 @@ dependencies = [
[[package]] [[package]]
name = "rp2040-hal" name = "rp2040-hal"
version = "0.9.2" version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ff2b9ae7e6dd6720fd9f64250c9087260e50fe98b6b032ccca65be3581167ca" checksum = "449f2ce321925c3931ca8da415d5037ac7882194675d0a7087777b61c31d72b7"
dependencies = [ dependencies = [
"bitfield 0.14.0",
"cortex-m", "cortex-m",
"critical-section", "critical-section",
"embedded-dma", "embedded-dma",
"embedded-hal 0.2.7", "embedded-hal 0.2.7",
"embedded-hal 1.0.0",
"embedded-hal-async",
"embedded-hal-nb",
"embedded-io",
"frunk", "frunk",
"fugit", "fugit",
"itertools", "itertools",
@ -433,9 +485,9 @@ dependencies = [
[[package]] [[package]]
name = "rp2040-pac" name = "rp2040-pac"
version = "0.5.0" version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12d9d8375815f543f54835d01160d4e47f9e2cae75f17ff8f1ec19ce1da96e4c" checksum = "83cbcd3f7a0ca7bbe61dc4eb7e202842bee4e27b769a7bf3a4a72fa399d6e404"
dependencies = [ dependencies = [
"cortex-m", "cortex-m",
"cortex-m-rt", "cortex-m-rt",
@ -458,7 +510,7 @@ dependencies = [
[[package]] [[package]]
name = "rtic" name = "rtic"
version = "2.0.1" version = "2.1.1"
dependencies = [ dependencies = [
"atomic-polyfill", "atomic-polyfill",
"bare-metal 1.0.0", "bare-metal 1.0.0",
@ -484,13 +536,13 @@ checksum = "d9369355b04d06a3780ec0f51ea2d225624db777acbc60abd8ca4832da5c1a42"
[[package]] [[package]]
name = "rtic-macros" name = "rtic-macros"
version = "2.0.1" version = "2.1.0"
dependencies = [ dependencies = [
"indexmap", "indexmap",
"proc-macro-error", "proc-macro-error",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.51", "syn 2.0.53",
] ]
[[package]] [[package]]
@ -500,7 +552,6 @@ dependencies = [
"atomic-polyfill", "atomic-polyfill",
"cfg-if", "cfg-if",
"cortex-m", "cortex-m",
"embedded-hal 1.0.0",
"fugit", "fugit",
"rp2040-pac", "rp2040-pac",
"rtic-time", "rtic-time",
@ -561,9 +612,9 @@ dependencies = [
[[package]] [[package]]
name = "syn" name = "syn"
version = "2.0.51" version = "2.0.53"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ab617d94515e94ae53b8406c628598680aa0c9587474ecbe58188f7b345d66c" checksum = "7383cd0e49fff4b6b90ca5670bfd3e9d6a733b3f90c686605aa7eec8c4996032"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -572,15 +623,19 @@ dependencies = [
[[package]] [[package]]
name = "unicode-ident" name = "unicode-ident"
version = "1.0.12" version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0"
[[package]] [[package]]
name = "usb-device" name = "usb-device"
version = "0.2.9" version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f6cc3adc849b5292b4075fc0d5fdcf2f24866e88e336dd27a8943090a520508" checksum = "98816b1accafbb09085168b90f27e93d790b4bfa19d883466b5e53315b5f06a6"
dependencies = [
"heapless",
"portable-atomic",
]
[[package]] [[package]]
name = "vcell" name = "vcell"
@ -602,9 +657,9 @@ checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
[[package]] [[package]]
name = "volatile-register" name = "volatile-register"
version = "0.2.2" version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "de437e2a6208b014ab52972a27e59b33fa2920d3e00fe05026167a1c509d19cc" checksum = "9ee8f19f9d74293faf70901bc20ad067dc1ad390d2cbf1e3f75f721ffee908b6"
dependencies = [ dependencies = [
"vcell", "vcell",
] ]

View file

@ -22,7 +22,7 @@ features = ["rp2040"]
cortex-m = "0.7" cortex-m = "0.7"
embedded-hal = { version = "0.2.7", features = ["unproven"] } embedded-hal = { version = "0.2.7", features = ["unproven"] }
fugit = "0.3" fugit = "0.3"
rp-pico = "0.8.0" rp-pico = "0.9.0"
panic-probe = "0.3" panic-probe = "0.3"
[profile.dev] [profile.dev]

View file

@ -14,7 +14,7 @@ mod app {
gpio::{ gpio::{
self, self,
bank0::{Gpio2, Gpio25, Gpio3}, bank0::{Gpio2, Gpio25, Gpio3},
FunctionSioOutput, PullNone, PullUp, FunctionSio, PullNone, PullUp, SioOutput,
}, },
pac, pac,
sio::Sio, sio::Sio,
@ -41,7 +41,7 @@ mod app {
#[local] #[local]
struct Local { struct Local {
led: gpio::Pin<Gpio25, FunctionSioOutput, PullNone>, led: gpio::Pin<Gpio25, FunctionSio<SioOutput>, PullNone>,
i2c: &'static mut I2CBus, i2c: &'static mut I2CBus,
} }
@ -82,14 +82,14 @@ mod app {
led.set_low().unwrap(); led.set_low().unwrap();
// Init I2C pins // Init I2C pins
let sda_pin = gpioa let sda_pin: gpio::Pin<_, gpio::FunctionI2C, _> = gpioa
.gpio2 .gpio2
.into_pull_up_disabled() .into_pull_up_disabled()
.into_function::<gpio::FunctionI2C>(); .reconfigure();
let scl_pin = gpioa let scl_pin: gpio::Pin<_, gpio::FunctionI2C, _> = gpioa
.gpio3 .gpio3
.into_pull_up_disabled() .into_pull_up_disabled()
.into_function::<gpio::FunctionI2C>(); .reconfigure();
// Init I2C itself, using MaybeUninit to overwrite the previously // Init I2C itself, using MaybeUninit to overwrite the previously
// uninitialized i2c_ctx variable without dropping its value // uninitialized i2c_ctx variable without dropping its value

View file

@ -13,6 +13,7 @@ For each category, *Added*, *Changed*, *Fixed* add new entries at the top!
- Most timer tick rates are now configurable - Most timer tick rates are now configurable
- Tweak `build.rs` to avoid warnings in Nightly 1.78+ - Tweak `build.rs` to avoid warnings in Nightly 1.78+
- Removed unused `rust-toolchain.toml` - Removed unused `rust-toolchain.toml`
- RP2040 PAC 0.6 support
## v1.5.0 - 2024-01-10 ## v1.5.0 - 2024-01-10

View file

@ -42,7 +42,7 @@ cortex-m = { version = "0.7.6", optional = true }
critical-section = { version = "1", optional = true } critical-section = { version = "1", optional = true }
# RP2040 # RP2040
rp2040-pac = { version = ">=0.2.0,<0.6", optional = true } rp2040-pac = { version = "0.6", optional = true }
# nRF52 # nRF52
nrf52810-pac = { version = "0.12.2", optional = true } nrf52810-pac = { version = "0.12.2", optional = true }

View file

@ -51,9 +51,9 @@ impl TimerBackend {
/// ///
/// Use the prelude macros instead. /// Use the prelude macros instead.
pub fn _start(timer: TIMER, resets: &RESETS) { pub fn _start(timer: TIMER, resets: &RESETS) {
resets.reset.modify(|_, w| w.timer().clear_bit()); resets.reset().modify(|_, w| w.timer().clear_bit());
while resets.reset_done.read().timer().bit_is_clear() {} while resets.reset_done().read().timer().bit_is_clear() {}
timer.inte.modify(|_, w| w.alarm_0().bit(true)); timer.inte().modify(|_, w| w.alarm_0().bit(true));
TIMER_QUEUE.initialize(Self {}); TIMER_QUEUE.initialize(Self {});
@ -76,10 +76,10 @@ impl TimerQueueBackend for TimerBackend {
fn now() -> Self::Ticks { fn now() -> Self::Ticks {
let timer = Self::timer(); let timer = Self::timer();
let mut hi0 = timer.timerawh.read().bits(); let mut hi0 = timer.timerawh().read().bits();
loop { loop {
let low = timer.timerawl.read().bits(); let low = timer.timerawl().read().bits();
let hi1 = timer.timerawh.read().bits(); let hi1 = timer.timerawh().read().bits();
if hi0 == hi1 { if hi0 == hi1 {
break ((u64::from(hi0) << 32) | u64::from(low)); break ((u64::from(hi0) << 32) | u64::from(low));
} }
@ -102,12 +102,12 @@ impl TimerQueueBackend for TimerBackend {
}; };
Self::timer() Self::timer()
.alarm0 .alarm0()
.write(|w| unsafe { w.bits(val as u32) }); .write(|w| unsafe { w.bits(val as u32) });
} }
fn clear_compare_flag() { 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() { fn pend_interrupt() {