Skip to content

Commit ece7fae

Browse files
committed
clean
1 parent 5714627 commit ece7fae

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

src/timer/monotonics.rs

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +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().write(|w| {
182-
unsafe { w.bits(!0) };
183-
w.uif().clear_bit()
184-
});
181+
self.tim.sr().write(|w| w.uif().clear_bit());
185182

186183
$tq.initialize(MonoTimerBackend::<pac::$timer> { _tim: PhantomData });
187184
$overflow.store(0, Ordering::SeqCst);
@@ -234,10 +231,7 @@ macro_rules! make_timer {
234231
}
235232

236233
fn clear_compare_flag() {
237-
Self::tim().sr().write(|w| {
238-
unsafe { w.bits(!0) };
239-
w.cc2if().clear_bit()
240-
});
234+
Self::tim().sr().write(|w| w.cc2if().clear_bit());
241235
}
242236

243237
fn pend_interrupt() {
@@ -255,19 +249,13 @@ macro_rules! make_timer {
255249
fn on_interrupt() {
256250
// Full period
257251
if Self::tim().sr().read().uif().bit_is_set() {
258-
Self::tim().sr().write(|w| {
259-
unsafe { w.bits(!0) };
260-
w.uif().clear_bit()
261-
});
252+
Self::tim().sr().write(|w| w.uif().clear_bit());
262253
let prev = $overflow.fetch_add(1, Ordering::Relaxed);
263254
assert!(prev % 2 == 1, "Monotonic must have missed an interrupt!");
264255
}
265256
// Half period
266257
if Self::tim().sr().read().cc1if().bit_is_set() {
267-
Self::tim().sr().write(|w| {
268-
unsafe { w.bits(!0) };
269-
w.cc1if().clear_bit()
270-
});
258+
Self::tim().sr().write(|w| w.cc1if().clear_bit());
271259
let prev = $overflow.fetch_add(1, Ordering::Relaxed);
272260
assert!(prev % 2 == 0, "Monotonic must have missed an interrupt!");
273261
}

0 commit comments

Comments
 (0)