@@ -178,7 +178,10 @@ 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| {
182+ unsafe { w. bits( !0 ) } ;
183+ w. uif( ) . clear_bit( )
184+ } ) ;
182185
183186 $tq. initialize( MonoTimerBackend :: <pac:: $timer> { _tim: PhantomData } ) ;
184187 $overflow. store( 0 , Ordering :: SeqCst ) ;
@@ -231,7 +234,10 @@ macro_rules! make_timer {
231234 }
232235
233236 fn clear_compare_flag( ) {
234- Self :: tim( ) . sr( ) . modify( |_, w| w. cc2if( ) . clear_bit( ) ) ;
237+ Self :: tim( ) . sr( ) . write( |w| {
238+ unsafe { w. bits( !0 ) } ;
239+ w. cc2if( ) . clear_bit( )
240+ } ) ;
235241 }
236242
237243 fn pend_interrupt( ) {
@@ -249,13 +255,19 @@ macro_rules! make_timer {
249255 fn on_interrupt( ) {
250256 // Full period
251257 if Self :: tim( ) . sr( ) . read( ) . uif( ) . bit_is_set( ) {
252- Self :: tim( ) . sr( ) . modify( |_, w| w. uif( ) . clear_bit( ) ) ;
258+ Self :: tim( ) . sr( ) . write( |w| {
259+ unsafe { w. bits( !0 ) } ;
260+ w. uif( ) . clear_bit( )
261+ } ) ;
253262 let prev = $overflow. fetch_add( 1 , Ordering :: Relaxed ) ;
254263 assert!( prev % 2 == 1 , "Monotonic must have missed an interrupt!" ) ;
255264 }
256265 // Half period
257266 if Self :: tim( ) . sr( ) . read( ) . cc1if( ) . bit_is_set( ) {
258- Self :: tim( ) . sr( ) . modify( |_, w| w. cc1if( ) . clear_bit( ) ) ;
267+ Self :: tim( ) . sr( ) . write( |w| {
268+ unsafe { w. bits( !0 ) } ;
269+ w. cc1if( ) . clear_bit( )
270+ } ) ;
259271 let prev = $overflow. fetch_add( 1 , Ordering :: Relaxed ) ;
260272 assert!( prev % 2 == 0 , "Monotonic must have missed an interrupt!" ) ;
261273 }
0 commit comments