diff options
| author | Rasmus Melchior Jacobsen <[email protected]> | 2023-05-25 13:59:32 +0200 |
|---|---|---|
| committer | Rasmus Melchior Jacobsen <[email protected]> | 2023-05-25 20:07:43 +0200 |
| commit | e764a3d9ca7a4a0ccdf800c61a388dd103de5ac1 (patch) | |
| tree | 12611a50155cf3e99fc8f056bebc7c3925c36a83 | |
| parent | 49a31bd5d8496e8ceb1144e6e02de0e55dd0508b (diff) | |
Fix unused errors
| -rw-r--r-- | embassy-stm32/src/flash/common.rs | 3 | ||||
| -rw-r--r-- | embassy-stm32/src/flash/f4.rs | 8 |
2 files changed, 6 insertions, 5 deletions
diff --git a/embassy-stm32/src/flash/common.rs b/embassy-stm32/src/flash/common.rs index 0a1ee5166..547e30312 100644 --- a/embassy-stm32/src/flash/common.rs +++ b/embassy-stm32/src/flash/common.rs | |||
| @@ -13,6 +13,7 @@ use crate::{interrupt, Peripheral}; | |||
| 13 | 13 | ||
| 14 | pub struct Flash<'d> { | 14 | pub struct Flash<'d> { |
| 15 | pub(crate) inner: PeripheralRef<'d, FLASH>, | 15 | pub(crate) inner: PeripheralRef<'d, FLASH>, |
| 16 | #[cfg(all(feature = "nightly", flash_f4))] | ||
| 16 | pub(crate) blocking_only: bool, | 17 | pub(crate) blocking_only: bool, |
| 17 | } | 18 | } |
| 18 | 19 | ||
| @@ -29,6 +30,7 @@ impl<'d> Flash<'d> { | |||
| 29 | 30 | ||
| 30 | Self { | 31 | Self { |
| 31 | inner: p, | 32 | inner: p, |
| 33 | #[cfg(all(feature = "nightly", flash_f4))] | ||
| 32 | blocking_only: false, | 34 | blocking_only: false, |
| 33 | } | 35 | } |
| 34 | } | 36 | } |
| @@ -38,6 +40,7 @@ impl<'d> Flash<'d> { | |||
| 38 | 40 | ||
| 39 | Self { | 41 | Self { |
| 40 | inner: p, | 42 | inner: p, |
| 43 | #[cfg(all(feature = "nightly", flash_f4))] | ||
| 41 | blocking_only: true, | 44 | blocking_only: true, |
| 42 | } | 45 | } |
| 43 | } | 46 | } |
diff --git a/embassy-stm32/src/flash/f4.rs b/embassy-stm32/src/flash/f4.rs index 53e58835e..aa3433b23 100644 --- a/embassy-stm32/src/flash/f4.rs +++ b/embassy-stm32/src/flash/f4.rs | |||
| @@ -20,9 +20,7 @@ mod alt_regions { | |||
| 20 | use crate::_generated::flash_regions::{OTPRegion, BANK1_REGION1, BANK1_REGION2, BANK1_REGION3, OTP_REGION}; | 20 | use crate::_generated::flash_regions::{OTPRegion, BANK1_REGION1, BANK1_REGION2, BANK1_REGION3, OTP_REGION}; |
| 21 | #[cfg(feature = "nightly")] | 21 | #[cfg(feature = "nightly")] |
| 22 | use crate::flash::asynch; | 22 | use crate::flash::asynch; |
| 23 | use crate::flash::{ | 23 | use crate::flash::{Async, Bank1Region1, Bank1Region2, Blocking, Error, Flash, FlashBank, FlashRegion}; |
| 24 | common, Async, Bank1Region1, Bank1Region2, Blocking, Error, Flash, FlashBank, FlashRegion, READ_SIZE, | ||
| 25 | }; | ||
| 26 | use crate::peripherals::FLASH; | 24 | use crate::peripherals::FLASH; |
| 27 | 25 | ||
| 28 | pub const ALT_BANK1_REGION3: FlashRegion = FlashRegion { | 26 | pub const ALT_BANK1_REGION3: FlashRegion = FlashRegion { |
| @@ -111,7 +109,7 @@ mod alt_regions { | |||
| 111 | #[cfg(feature = "nightly")] | 109 | #[cfg(feature = "nightly")] |
| 112 | impl $type_name<'_, Async> { | 110 | impl $type_name<'_, Async> { |
| 113 | pub async fn read(&mut self, offset: u32, bytes: &mut [u8]) -> Result<(), Error> { | 111 | pub async fn read(&mut self, offset: u32, bytes: &mut [u8]) -> Result<(), Error> { |
| 114 | common::read_blocking(self.0.base, self.0.size, offset, bytes) | 112 | crate::flash::common::read_blocking(self.0.base, self.0.size, offset, bytes) |
| 115 | } | 113 | } |
| 116 | 114 | ||
| 117 | pub async fn write(&mut self, offset: u32, bytes: &[u8]) -> Result<(), Error> { | 115 | pub async fn write(&mut self, offset: u32, bytes: &[u8]) -> Result<(), Error> { |
| @@ -131,7 +129,7 @@ mod alt_regions { | |||
| 131 | 129 | ||
| 132 | #[cfg(feature = "nightly")] | 130 | #[cfg(feature = "nightly")] |
| 133 | impl embedded_storage_async::nor_flash::ReadNorFlash for $type_name<'_, Async> { | 131 | impl embedded_storage_async::nor_flash::ReadNorFlash for $type_name<'_, Async> { |
| 134 | const READ_SIZE: usize = READ_SIZE; | 132 | const READ_SIZE: usize = crate::flash::READ_SIZE; |
| 135 | 133 | ||
| 136 | async fn read(&mut self, offset: u32, bytes: &mut [u8]) -> Result<(), Self::Error> { | 134 | async fn read(&mut self, offset: u32, bytes: &mut [u8]) -> Result<(), Self::Error> { |
| 137 | self.read(offset, bytes).await | 135 | self.read(offset, bytes).await |
