nrf/qspi: remove cfg_if hack
This commit is contained in:
		| @@ -525,42 +525,43 @@ impl<'d, T: Instance, const FLASH_SIZE: usize> NorFlash for Qspi<'d, T, FLASH_SI | |||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
| cfg_if::cfg_if! { | #[cfg(feature = "nightly")] | ||||||
|     if #[cfg(feature = "nightly")] | mod _eh1 { | ||||||
|     { |     use core::future::Future; | ||||||
|         use embedded_storage_async::nor_flash::{AsyncNorFlash, AsyncReadNorFlash}; |  | ||||||
|         use core::future::Future; |  | ||||||
|  |  | ||||||
|         impl<'d, T: Instance, const FLASH_SIZE: usize> AsyncNorFlash for Qspi<'d, T, FLASH_SIZE> { |     use embedded_storage_async::nor_flash::{AsyncNorFlash, AsyncReadNorFlash}; | ||||||
|             const WRITE_SIZE: usize = <Self as NorFlash>::WRITE_SIZE; |  | ||||||
|             const ERASE_SIZE: usize = <Self as NorFlash>::ERASE_SIZE; |  | ||||||
|  |  | ||||||
|             type WriteFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; |     use super::*; | ||||||
|             fn write<'a>(&'a mut self, offset: u32, data: &'a [u8]) -> Self::WriteFuture<'a> { |  | ||||||
|                 async move { self.write(offset as usize, data).await } |  | ||||||
|             } |  | ||||||
|  |  | ||||||
|             type EraseFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; |     impl<'d, T: Instance, const FLASH_SIZE: usize> AsyncNorFlash for Qspi<'d, T, FLASH_SIZE> { | ||||||
|             fn erase<'a>(&'a mut self, from: u32, to: u32) -> Self::EraseFuture<'a> { |         const WRITE_SIZE: usize = <Self as NorFlash>::WRITE_SIZE; | ||||||
|                 async move { |         const ERASE_SIZE: usize = <Self as NorFlash>::ERASE_SIZE; | ||||||
|                     for address in (from as usize..to as usize).step_by(<Self as AsyncNorFlash>::ERASE_SIZE) { |  | ||||||
|                         self.erase(address).await? |         type WriteFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; | ||||||
|                     } |         fn write<'a>(&'a mut self, offset: u32, data: &'a [u8]) -> Self::WriteFuture<'a> { | ||||||
|                     Ok(()) |             async move { self.write(offset as usize, data).await } | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         impl<'d, T: Instance, const FLASH_SIZE: usize> AsyncReadNorFlash for Qspi<'d, T, FLASH_SIZE> { |         type EraseFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; | ||||||
|             const READ_SIZE: usize = 4; |         fn erase<'a>(&'a mut self, from: u32, to: u32) -> Self::EraseFuture<'a> { | ||||||
|             type ReadFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; |             async move { | ||||||
|             fn read<'a>(&'a mut self, address: u32, data: &'a mut [u8]) -> Self::ReadFuture<'a> { |                 for address in (from as usize..to as usize).step_by(<Self as AsyncNorFlash>::ERASE_SIZE) { | ||||||
|                 async move { self.read(address as usize, data).await } |                     self.erase(address).await? | ||||||
|  |                 } | ||||||
|  |                 Ok(()) | ||||||
|             } |             } | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |  | ||||||
|             fn capacity(&self) -> usize { |     impl<'d, T: Instance, const FLASH_SIZE: usize> AsyncReadNorFlash for Qspi<'d, T, FLASH_SIZE> { | ||||||
|                 FLASH_SIZE |         const READ_SIZE: usize = 4; | ||||||
|             } |         type ReadFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; | ||||||
|  |         fn read<'a>(&'a mut self, address: u32, data: &'a mut [u8]) -> Self::ReadFuture<'a> { | ||||||
|  |             async move { self.read(address as usize, data).await } | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         fn capacity(&self) -> usize { | ||||||
|  |             FLASH_SIZE | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user