From bc0cb43307c2a46330ce253505203dbc607bcc6c Mon Sep 17 00:00:00 2001 From: Mehmet Ali Anil Date: Mon, 6 Mar 2023 22:08:47 +0100 Subject: Bump embedded-storage-async to 0.4 --- embassy-embedded-hal/Cargo.toml | 2 +- embassy-embedded-hal/src/adapter.rs | 19 +++++++------------ 2 files changed, 8 insertions(+), 13 deletions(-) (limited to 'embassy-embedded-hal') diff --git a/embassy-embedded-hal/Cargo.toml b/embassy-embedded-hal/Cargo.toml index fa74be8c4..45eb0d43d 100644 --- a/embassy-embedded-hal/Cargo.toml +++ b/embassy-embedded-hal/Cargo.toml @@ -22,7 +22,7 @@ embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["un embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.9" } embedded-hal-async = { version = "=0.2.0-alpha.0", optional = true } embedded-storage = "0.3.0" -embedded-storage-async = { version = "0.3.0", optional = true } +embedded-storage-async = { version = "0.4.0", optional = true } nb = "1.0.0" defmt = { version = "0.3", optional = true } diff --git a/embassy-embedded-hal/src/adapter.rs b/embassy-embedded-hal/src/adapter.rs index 3680984f1..a49f8df4b 100644 --- a/embassy-embedded-hal/src/adapter.rs +++ b/embassy-embedded-hal/src/adapter.rs @@ -1,7 +1,5 @@ //! Adapters between embedded-hal traits. -use core::future::Future; - use embedded_hal_02::{blocking, serial}; /// Wrapper that implements async traits using blocking implementations. @@ -182,7 +180,7 @@ where /// NOR flash wrapper use embedded_storage::nor_flash::{ErrorType, NorFlash, ReadNorFlash}; -use embedded_storage_async::nor_flash::{AsyncNorFlash, AsyncReadNorFlash}; +use embedded_storage_async::nor_flash::{NorFlash as AsyncNorFlash, ReadNorFlash as AsyncReadNorFlash}; impl ErrorType for BlockingAsync where @@ -198,14 +196,12 @@ where const WRITE_SIZE: usize = ::WRITE_SIZE; const ERASE_SIZE: usize = ::ERASE_SIZE; - type WriteFuture<'a> = impl Future> + 'a where Self: 'a; - fn write<'a>(&'a mut self, offset: u32, data: &'a [u8]) -> Self::WriteFuture<'a> { - async move { self.wrapped.write(offset, data) } + async fn write(&mut self, offset: u32, data: &[u8]) -> Result<(), Self::Error> { + self.wrapped.write(offset, data) } - type EraseFuture<'a> = impl Future> + 'a where Self: 'a; - fn erase<'a>(&'a mut self, from: u32, to: u32) -> Self::EraseFuture<'a> { - async move { self.wrapped.erase(from, to) } + async fn erase(&mut self, from: u32, to: u32) -> Result<(), Self::Error> { + self.wrapped.erase(from, to) } } @@ -214,9 +210,8 @@ where T: ReadNorFlash, { const READ_SIZE: usize = ::READ_SIZE; - type ReadFuture<'a> = impl Future> + 'a where Self: 'a; - fn read<'a>(&'a mut self, address: u32, data: &'a mut [u8]) -> Self::ReadFuture<'a> { - async move { self.wrapped.read(address, data) } + async fn read(&mut self, address: u32, data: &mut [u8]) -> Result<(), Self::Error> { + self.wrapped.read(address, data) } fn capacity(&self) -> usize { -- cgit