@@ -319,24 +319,20 @@ macro_rules! hal {
319
319
// NOTE(unsafe) atomic read with no side effects
320
320
let isr = unsafe { ( * $USARTX:: ptr( ) ) . isr. read( ) } ;
321
321
322
- // NOTE(unsafe) write accessor for atomic writes with no side effects
322
+ // NOTE(unsafe, write ) write accessor for atomic writes with no side effects
323
323
let icr = unsafe { & ( * $USARTX:: ptr( ) ) . icr } ;
324
324
325
325
Err ( if isr. pe( ) . bit_is_set( ) {
326
- // Clear the bit by writing 1 to the clear register
327
- icr. write( |w| { w. pecf( ) . set_bit( ) } ) ;
326
+ icr. write( |w| w. pecf( ) . clear( ) ) ;
328
327
nb:: Error :: Other ( Error :: Parity )
329
328
} else if isr. fe( ) . bit_is_set( ) {
330
- // Clear the bit by writing 1 to the clear register
331
- icr. write( |w| { w. fecf( ) . set_bit( ) } ) ;
329
+ icr. write( |w| w. fecf( ) . clear( ) ) ;
332
330
nb:: Error :: Other ( Error :: Framing )
333
331
} else if isr. nf( ) . bit_is_set( ) {
334
- // Clear the bit by writing 1 to the clear register
335
- icr. write( |w| { w. ncf( ) . set_bit( ) } ) ;
332
+ icr. write( |w| w. ncf( ) . clear( ) ) ;
336
333
nb:: Error :: Other ( Error :: Noise )
337
334
} else if isr. ore( ) . bit_is_set( ) {
338
- // Clear the bit by writing 1 to the clear register
339
- icr. write( |w| { w. orecf( ) . set_bit( ) } ) ;
335
+ icr. write( |w| w. orecf( ) . clear( ) ) ;
340
336
nb:: Error :: Other ( Error :: Overrun )
341
337
} else if isr. rxne( ) . bit_is_set( ) {
342
338
// NOTE(read_volatile) see `write_volatile` below
0 commit comments