Skip to content

Commit 6225950

Browse files
committed
fix monotonics
1 parent 704aa09 commit 6225950

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
88
## [Unreleased]
99

1010
- Fix pac `defmt` feature
11+
- Fix timer interrupt status clear
1112

1213
## [v0.22.0] - 2024-10-04
1314

src/timer/monotonics.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ macro_rules! make_timer {
178178

179179
// The above line raises an update event which will indicate that the timer is already finished.
180180
// Since this is not the case, it should be cleared.
181-
self.tim.sr().modify(|_, w| w.uif().clear_bit());
181+
self.tim.sr().write(|_, w| w.uif().clear_bit());
182182

183183
$tq.initialize(MonoTimerBackend::<pac::$timer> { _tim: PhantomData });
184184
$overflow.store(0, Ordering::SeqCst);
@@ -231,7 +231,7 @@ macro_rules! make_timer {
231231
}
232232

233233
fn clear_compare_flag() {
234-
Self::tim().sr().modify(|_, w| w.cc2if().clear_bit());
234+
Self::tim().sr().write(|_, w| w.cc2if().clear_bit());
235235
}
236236

237237
fn pend_interrupt() {
@@ -249,13 +249,13 @@ macro_rules! make_timer {
249249
fn on_interrupt() {
250250
// Full period
251251
if Self::tim().sr().read().uif().bit_is_set() {
252-
Self::tim().sr().modify(|_, w| w.uif().clear_bit());
252+
Self::tim().sr().write(|_, w| w.uif().clear_bit());
253253
let prev = $overflow.fetch_add(1, Ordering::Relaxed);
254254
assert!(prev % 2 == 1, "Monotonic must have missed an interrupt!");
255255
}
256256
// Half period
257257
if Self::tim().sr().read().cc1if().bit_is_set() {
258-
Self::tim().sr().modify(|_, w| w.cc1if().clear_bit());
258+
Self::tim().sr().write(|_, w| w.cc1if().clear_bit());
259259
let prev = $overflow.fetch_add(1, Ordering::Relaxed);
260260
assert!(prev % 2 == 0, "Monotonic must have missed an interrupt!");
261261
}

0 commit comments

Comments
 (0)