diff options
| author | Dario Nieuwenhuis <[email protected]> | 2023-04-14 22:39:53 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2023-04-15 00:58:58 +0200 |
| commit | f681b9d4e5fc142ee0bb847e0e00260c932a1401 (patch) | |
| tree | db8ac2d862b497acdb96bc9b79804e75b707d67c /embassy-embedded-hal/src/adapter.rs | |
| parent | a3ecf5caf614e17b2e1cb3d1f79d8313f2e71a63 (diff) | |
Remove the _todo_embedded_hal_serial impls. EH will probably not have these serial traits.
Diffstat (limited to 'embassy-embedded-hal/src/adapter.rs')
| -rw-r--r-- | embassy-embedded-hal/src/adapter.rs | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/embassy-embedded-hal/src/adapter.rs b/embassy-embedded-hal/src/adapter.rs index ee919bd84..171ff6c9f 100644 --- a/embassy-embedded-hal/src/adapter.rs +++ b/embassy-embedded-hal/src/adapter.rs | |||
| @@ -131,48 +131,6 @@ where | |||
| 131 | type Error = E; | 131 | type Error = E; |
| 132 | } | 132 | } |
| 133 | 133 | ||
| 134 | #[cfg(feature = "_todo_embedded_hal_serial")] | ||
| 135 | impl<T, E> embedded_hal_async::serial::Read for BlockingAsync<T> | ||
| 136 | where | ||
| 137 | T: serial::Read<u8, Error = E>, | ||
| 138 | E: embedded_hal_1::serial::Error + 'static, | ||
| 139 | { | ||
| 140 | type ReadFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where T: 'a; | ||
| 141 | fn read<'a>(&'a mut self, buf: &'a mut [u8]) -> Self::ReadFuture<'a> { | ||
| 142 | async move { | ||
| 143 | let mut pos = 0; | ||
| 144 | while pos < buf.len() { | ||
| 145 | match self.wrapped.read() { | ||
| 146 | Err(nb::Error::WouldBlock) => {} | ||
| 147 | Err(nb::Error::Other(e)) => return Err(e), | ||
| 148 | Ok(b) => { | ||
| 149 | buf[pos] = b; | ||
| 150 | pos += 1; | ||
| 151 | } | ||
| 152 | } | ||
| 153 | } | ||
| 154 | Ok(()) | ||
| 155 | } | ||
| 156 | } | ||
| 157 | } | ||
| 158 | |||
| 159 | #[cfg(feature = "_todo_embedded_hal_serial")] | ||
| 160 | impl<T, E> embedded_hal_async::serial::Write for BlockingAsync<T> | ||
| 161 | where | ||
| 162 | T: blocking::serial::Write<u8, Error = E> + serial::Read<u8, Error = E>, | ||
| 163 | E: embedded_hal_1::serial::Error + 'static, | ||
| 164 | { | ||
| 165 | type WriteFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where T: 'a; | ||
| 166 | fn write<'a>(&'a mut self, buf: &'a [u8]) -> Self::WriteFuture<'a> { | ||
| 167 | async move { self.wrapped.bwrite_all(buf) } | ||
| 168 | } | ||
| 169 | |||
| 170 | type FlushFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where T: 'a; | ||
| 171 | fn flush(&mut self) -> Result<(), Self::Error> { | ||
| 172 | async move { self.wrapped.bflush() } | ||
| 173 | } | ||
| 174 | } | ||
| 175 | |||
| 176 | /// NOR flash wrapper | 134 | /// NOR flash wrapper |
| 177 | use embedded_storage::nor_flash::{ErrorType, NorFlash, ReadNorFlash}; | 135 | use embedded_storage::nor_flash::{ErrorType, NorFlash, ReadNorFlash}; |
| 178 | use embedded_storage_async::nor_flash::{NorFlash as AsyncNorFlash, ReadNorFlash as AsyncReadNorFlash}; | 136 | use embedded_storage_async::nor_flash::{NorFlash as AsyncNorFlash, ReadNorFlash as AsyncReadNorFlash}; |
