Fix nb on rp uart
This commit is contained in:
parent
88e77c733c
commit
2b497c1e57
@ -820,6 +820,10 @@ impl<'d, T: Instance, M: Mode> embedded_hal_nb::serial::ErrorType for Uart<'d, T
|
|||||||
impl<'d, T: Instance, M: Mode> embedded_hal_nb::serial::Read for UartRx<'d, T, M> {
|
impl<'d, T: Instance, M: Mode> embedded_hal_nb::serial::Read for UartRx<'d, T, M> {
|
||||||
fn read(&mut self) -> nb::Result<u8, Self::Error> {
|
fn read(&mut self) -> nb::Result<u8, Self::Error> {
|
||||||
let r = T::regs();
|
let r = T::regs();
|
||||||
|
if r.uartfr().read().rxfe() {
|
||||||
|
return Err(nb::Error::WouldBlock);
|
||||||
|
}
|
||||||
|
|
||||||
let dr = r.uartdr().read();
|
let dr = r.uartdr().read();
|
||||||
|
|
||||||
if dr.oe() {
|
if dr.oe() {
|
||||||
@ -830,10 +834,8 @@ impl<'d, T: Instance, M: Mode> embedded_hal_nb::serial::Read for UartRx<'d, T, M
|
|||||||
Err(nb::Error::Other(Error::Parity))
|
Err(nb::Error::Other(Error::Parity))
|
||||||
} else if dr.fe() {
|
} else if dr.fe() {
|
||||||
Err(nb::Error::Other(Error::Framing))
|
Err(nb::Error::Other(Error::Framing))
|
||||||
} else if dr.fe() {
|
|
||||||
Ok(dr.data())
|
|
||||||
} else {
|
} else {
|
||||||
Err(nb::Error::WouldBlock)
|
Ok(dr.data())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user