improvements for UART API
All checks were successful
Rust/va416xx-rs/pipeline/head This commit looks good
All checks were successful
Rust/va416xx-rs/pipeline/head This commit looks good
This commit is contained in:
parent
0f31ee6983
commit
3c3270f722
@ -1201,10 +1201,20 @@ impl<Uart: Instance> embedded_hal_nb::serial::Read<u8> for UartBase<Uart> {
|
|||||||
|
|
||||||
impl<Uart: Instance> embedded_hal_nb::serial::Write<u8> for UartBase<Uart> {
|
impl<Uart: Instance> embedded_hal_nb::serial::Write<u8> for UartBase<Uart> {
|
||||||
fn write(&mut self, word: u8) -> nb::Result<(), Self::Error> {
|
fn write(&mut self, word: u8) -> nb::Result<(), Self::Error> {
|
||||||
self.tx.write(word)
|
self.tx.write(word).map_err(|e| {
|
||||||
|
if let nb::Error::Other(_) = e {
|
||||||
|
unreachable!()
|
||||||
|
}
|
||||||
|
nb::Error::WouldBlock
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn flush(&mut self) -> nb::Result<(), Self::Error> {
|
fn flush(&mut self) -> nb::Result<(), Self::Error> {
|
||||||
self.tx.flush()
|
self.tx.flush().map_err(|e| {
|
||||||
|
if let nb::Error::Other(_) = e {
|
||||||
|
unreachable!()
|
||||||
|
}
|
||||||
|
nb::Error::WouldBlock
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user