improvements for UART API
All checks were successful
Rust/va416xx-rs/pipeline/head This commit looks good

This commit is contained in:
Robin Müller 2024-09-24 12:01:35 +02:00
parent 0f31ee6983
commit 3c3270f722
Signed by: muellerr
GPG Key ID: A649FB78196E3849

View File

@ -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> {
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> {
self.tx.flush()
self.tx.flush().map_err(|e| {
if let nb::Error::Other(_) = e {
unreachable!()
}
nb::Error::WouldBlock
})
}
}