mirror of
https://github.com/embassy-rs/embassy.git
synced 2025-10-04 07:34:39 +00:00
Use write closure to clear idle flag, only read rdr on usart versions which need it
This commit is contained in:
parent
1e6192ffa5
commit
ac7c44c1d1
@ -261,14 +261,13 @@ fn clear_idle_flag(r: Regs) -> Sr {
|
|||||||
|
|
||||||
let sr = sr(r).read();
|
let sr = sr(r).read();
|
||||||
|
|
||||||
// This read also clears the error and idle interrupt flags on v1.
|
|
||||||
unsafe { rdr(r).read_volatile() };
|
|
||||||
#[cfg(any(usart_v3, usart_v4))]
|
#[cfg(any(usart_v3, usart_v4))]
|
||||||
{
|
r.icr().write(|w| w.set_idle(true));
|
||||||
let mut clear_idle = regs::Icr(0);
|
#[cfg(not(any(usart_v3, usart_v4)))]
|
||||||
clear_idle.set_idle(true);
|
unsafe {
|
||||||
r.icr().write_value(clear_idle);
|
// This read also clears the error and idle interrupt flags on v1.
|
||||||
}
|
rdr(r).read_volatile()
|
||||||
|
};
|
||||||
|
|
||||||
r.cr1().modify(|w| w.set_idleie(true));
|
r.cr1().modify(|w| w.set_idleie(true));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user