@@ -178,10 +178,7 @@ macro_rules! make_timer {
178
178
179
179
// The above line raises an update event which will indicate that the timer is already finished.
180
180
// 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( ) ) ;
185
182
186
183
$tq. initialize( MonoTimerBackend :: <pac:: $timer> { _tim: PhantomData } ) ;
187
184
$overflow. store( 0 , Ordering :: SeqCst ) ;
@@ -234,10 +231,7 @@ macro_rules! make_timer {
234
231
}
235
232
236
233
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( ) ) ;
241
235
}
242
236
243
237
fn pend_interrupt( ) {
@@ -255,19 +249,13 @@ macro_rules! make_timer {
255
249
fn on_interrupt( ) {
256
250
// Full period
257
251
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( ) ) ;
262
253
let prev = $overflow. fetch_add( 1 , Ordering :: Relaxed ) ;
263
254
assert!( prev % 2 == 1 , "Monotonic must have missed an interrupt!" ) ;
264
255
}
265
256
// Half period
266
257
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( ) ) ;
271
259
let prev = $overflow. fetch_add( 1 , Ordering :: Relaxed ) ;
272
260
assert!( prev % 2 == 0 , "Monotonic must have missed an interrupt!" ) ;
273
261
}
0 commit comments