From c04b02e7c97a48927058637b33a4e60bc715aea5 Mon Sep 17 00:00:00 2001 From: Jonathan 'theJPster' Pallant Date: Sun, 15 Jun 2025 13:36:11 +0100 Subject: [PATCH] Require exclusive access to the RESET peripheral for RP2040/RP2350 If you don't have exclusive access to the RESET peripheral, someone else could race you on the read/modify/write cycle on the update of the RESETS.reset register. This is a breaking change. --- rtic-monotonics/src/rp2040.rs | 2 +- rtic-monotonics/src/rp235x.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rtic-monotonics/src/rp2040.rs b/rtic-monotonics/src/rp2040.rs index b04376cc1740..a05dbf1b6fe4 100644 --- a/rtic-monotonics/src/rp2040.rs +++ b/rtic-monotonics/src/rp2040.rs @@ -50,7 +50,7 @@ impl TimerBackend { /// **Do not use this function directly.** /// /// Use the prelude macros instead. - pub fn _start(timer: TIMER, resets: &RESETS) { + pub fn _start(timer: TIMER, resets: &mut 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)); diff --git a/rtic-monotonics/src/rp235x.rs b/rtic-monotonics/src/rp235x.rs index 7624d1d9fcd1..ee8f6063a6b6 100644 --- a/rtic-monotonics/src/rp235x.rs +++ b/rtic-monotonics/src/rp235x.rs @@ -52,7 +52,7 @@ impl TimerBackend { /// **Do not use this function directly.** /// /// Use the prelude macros instead. - pub fn _start(timer: TIMER0, resets: &RESETS) { + pub fn _start(timer: TIMER0, resets: &mut RESETS) { resets.reset().modify(|_, w| w.timer0().clear_bit()); while resets.reset_done().read().timer0().bit_is_clear() {} timer.inte().modify(|_, w| w.alarm_0().bit(true));