Implement embedded_io::Write for Uart<'d, T: Instance, Blocking> (#3483)

* Implement `embedded_io::{Read,Write}` for `Uart<'d, T: Instance, Blocking>`

* Unimplement `embedded_io::Read` for `Uart<'d, T: Instance, Blocking>`

* Revert "Unimplement `embedded_io::Read` for `Uart<'d, T: Instance, Blocking>`"

* Unimplement `embedded_io::Read` for `Uart<'d, T: Instance, Blocking>` (take 2)
This commit is contained in:
flippette 2024-10-31 22:14:11 +02:00 committed by GitHub
parent b0c7fa07b2
commit 93dd21042c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1264,6 +1264,20 @@ impl<'d, T: Instance, M: Mode> embedded_hal_nb::serial::Write for Uart<'d, T, M>
}
}
impl<'d, T: Instance> embedded_io::ErrorType for Uart<'d, T, Blocking> {
type Error = Error;
}
impl<'d, T: Instance> embedded_io::Write for Uart<'d, T, Blocking> {
fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Error> {
self.blocking_write(buf).map(|_| buf.len())
}
fn flush(&mut self) -> Result<(), Self::Error> {
self.blocking_flush()
}
}
trait SealedMode {}
trait SealedInstance {