diff options
| author | flippette <[email protected]> | 2024-10-31 22:14:11 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-10-31 21:14:11 +0100 |
| commit | 93dd21042ceadea114b01c40a250d33402672569 (patch) | |
| tree | 7b1279bbe8ad19fea07cbc6e32618c51905bc6ce | |
| parent | b0c7fa07b27be9025c5e986e339899cdfc9a01e2 (diff) | |
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)
| -rw-r--r-- | embassy-rp/src/uart/mod.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/embassy-rp/src/uart/mod.rs b/embassy-rp/src/uart/mod.rs index c94e5e185..ad98a46c7 100644 --- a/embassy-rp/src/uart/mod.rs +++ b/embassy-rp/src/uart/mod.rs | |||
| @@ -1264,6 +1264,20 @@ impl<'d, T: Instance, M: Mode> embedded_hal_nb::serial::Write for Uart<'d, T, M> | |||
| 1264 | } | 1264 | } |
| 1265 | } | 1265 | } |
| 1266 | 1266 | ||
| 1267 | impl<'d, T: Instance> embedded_io::ErrorType for Uart<'d, T, Blocking> { | ||
| 1268 | type Error = Error; | ||
| 1269 | } | ||
| 1270 | |||
| 1271 | impl<'d, T: Instance> embedded_io::Write for Uart<'d, T, Blocking> { | ||
| 1272 | fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Error> { | ||
| 1273 | self.blocking_write(buf).map(|_| buf.len()) | ||
| 1274 | } | ||
| 1275 | |||
| 1276 | fn flush(&mut self) -> Result<(), Self::Error> { | ||
| 1277 | self.blocking_flush() | ||
| 1278 | } | ||
| 1279 | } | ||
| 1280 | |||
| 1267 | trait SealedMode {} | 1281 | trait SealedMode {} |
| 1268 | 1282 | ||
| 1269 | trait SealedInstance { | 1283 | trait SealedInstance { |
