Skip to content

Commit e1b23d9

Browse files
committed
Use more descriptive methods
1 parent 7b7d54d commit e1b23d9

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/serial.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -319,24 +319,20 @@ macro_rules! hal {
319319
// NOTE(unsafe) atomic read with no side effects
320320
let isr = unsafe { (*$USARTX::ptr()).isr.read() };
321321

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
323323
let icr = unsafe { &(*$USARTX::ptr()).icr };
324324

325325
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());
328327
nb::Error::Other(Error::Parity)
329328
} 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());
332330
nb::Error::Other(Error::Framing)
333331
} 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());
336333
nb::Error::Other(Error::Noise)
337334
} 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());
340336
nb::Error::Other(Error::Overrun)
341337
} else if isr.rxne().bit_is_set() {
342338
// NOTE(read_volatile) see `write_volatile` below

0 commit comments

Comments
 (0)