mirror of
https://github.com/embassy-rs/embassy.git
synced 2025-10-02 14:44:32 +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();
|
||||
|
||||
// This read also clears the error and idle interrupt flags on v1.
|
||||
unsafe { rdr(r).read_volatile() };
|
||||
#[cfg(any(usart_v3, usart_v4))]
|
||||
{
|
||||
let mut clear_idle = regs::Icr(0);
|
||||
clear_idle.set_idle(true);
|
||||
r.icr().write_value(clear_idle);
|
||||
}
|
||||
r.icr().write(|w| w.set_idle(true));
|
||||
#[cfg(not(any(usart_v3, usart_v4)))]
|
||||
unsafe {
|
||||
// This read also clears the error and idle interrupt flags on v1.
|
||||
rdr(r).read_volatile()
|
||||
};
|
||||
|
||||
r.cr1().modify(|w| w.set_idleie(true));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user