@@ -459,8 +459,7 @@ impl<I2C: Instance> I2c<I2C> {
459
459
/// Reset the peripheral
460
460
pub fn reset ( & mut self ) {
461
461
self . i2c . cr1 ( ) . modify ( |_, w| w. pe ( ) . disabled ( ) ) ;
462
- let _ = self . i2c . cr1 ( ) . read ( ) ;
463
- let _ = self . i2c . cr1 ( ) . read ( ) ; // Delay 2 peripheral clocks
462
+ interrupt_clear_clock_sync_delay ! ( self . i2c. cr1( ) ) ;
464
463
while self . i2c . cr1 ( ) . read ( ) . pe ( ) . is_enabled ( ) { }
465
464
self . i2c . cr1 ( ) . modify ( |_, w| w. pe ( ) . enabled ( ) ) ;
466
465
}
@@ -477,8 +476,6 @@ impl<I2C: Instance> I2c<I2C> {
477
476
Event :: NotAcknowledge => w. nackie ( ) . enabled ( ) ,
478
477
Event :: AddressMatch => w. addrie ( ) . enabled ( ) ,
479
478
} ) ;
480
- let _ = self . i2c . cr1 ( ) . read ( ) ;
481
- let _ = self . i2c . cr1 ( ) . read ( ) ; // Delay 2 peripheral clocks
482
479
}
483
480
484
481
/// Stop listening for interrupt `event`
@@ -493,8 +490,7 @@ impl<I2C: Instance> I2c<I2C> {
493
490
Event :: NotAcknowledge => w. nackie ( ) . disabled ( ) ,
494
491
Event :: AddressMatch => w. addrie ( ) . disabled ( ) ,
495
492
} ) ;
496
- let _ = self . i2c . cr1 ( ) . read ( ) ;
497
- let _ = self . i2c . cr1 ( ) . read ( ) ; // Delay 2 peripheral clocks
493
+ interrupt_clear_clock_sync_delay ! ( self . i2c. cr1( ) ) ;
498
494
}
499
495
500
496
/// Clears interrupt flag for `event`
@@ -506,8 +502,7 @@ impl<I2C: Instance> I2c<I2C> {
506
502
Event :: NotAcknowledge => w. nackcf ( ) . clear ( ) ,
507
503
_ => w,
508
504
} ) ;
509
- let _ = self . i2c . isr ( ) . read ( ) ;
510
- let _ = self . i2c . isr ( ) . read ( ) ; // Delay 2 peripheral clocks
505
+ interrupt_clear_clock_sync_delay ! ( self . i2c. cr1( ) ) ;
511
506
}
512
507
513
508
/// Check if the specified `event`` occurred. If an error occurred, this
0 commit comments