Fix unused errors

This commit is contained in:
Rasmus Melchior Jacobsen 2023-05-25 13:59:32 +02:00
parent 49a31bd5d8
commit e764a3d9ca
2 changed files with 6 additions and 5 deletions

View File

@ -13,6 +13,7 @@ use crate::{interrupt, Peripheral};
pub struct Flash<'d> { pub struct Flash<'d> {
pub(crate) inner: PeripheralRef<'d, FLASH>, pub(crate) inner: PeripheralRef<'d, FLASH>,
#[cfg(all(feature = "nightly", flash_f4))]
pub(crate) blocking_only: bool, pub(crate) blocking_only: bool,
} }
@ -29,6 +30,7 @@ impl<'d> Flash<'d> {
Self { Self {
inner: p, inner: p,
#[cfg(all(feature = "nightly", flash_f4))]
blocking_only: false, blocking_only: false,
} }
} }
@ -38,6 +40,7 @@ impl<'d> Flash<'d> {
Self { Self {
inner: p, inner: p,
#[cfg(all(feature = "nightly", flash_f4))]
blocking_only: true, blocking_only: true,
} }
} }

View File

@ -20,9 +20,7 @@ mod alt_regions {
use crate::_generated::flash_regions::{OTPRegion, BANK1_REGION1, BANK1_REGION2, BANK1_REGION3, OTP_REGION}; use crate::_generated::flash_regions::{OTPRegion, BANK1_REGION1, BANK1_REGION2, BANK1_REGION3, OTP_REGION};
#[cfg(feature = "nightly")] #[cfg(feature = "nightly")]
use crate::flash::asynch; use crate::flash::asynch;
use crate::flash::{ use crate::flash::{Async, Bank1Region1, Bank1Region2, Blocking, Error, Flash, FlashBank, FlashRegion};
common, Async, Bank1Region1, Bank1Region2, Blocking, Error, Flash, FlashBank, FlashRegion, READ_SIZE,
};
use crate::peripherals::FLASH; use crate::peripherals::FLASH;
pub const ALT_BANK1_REGION3: FlashRegion = FlashRegion { pub const ALT_BANK1_REGION3: FlashRegion = FlashRegion {
@ -111,7 +109,7 @@ mod alt_regions {
#[cfg(feature = "nightly")] #[cfg(feature = "nightly")]
impl $type_name<'_, Async> { impl $type_name<'_, Async> {
pub async fn read(&mut self, offset: u32, bytes: &mut [u8]) -> Result<(), Error> { pub async fn read(&mut self, offset: u32, bytes: &mut [u8]) -> Result<(), Error> {
common::read_blocking(self.0.base, self.0.size, offset, bytes) crate::flash::common::read_blocking(self.0.base, self.0.size, offset, bytes)
} }
pub async fn write(&mut self, offset: u32, bytes: &[u8]) -> Result<(), Error> { pub async fn write(&mut self, offset: u32, bytes: &[u8]) -> Result<(), Error> {
@ -131,7 +129,7 @@ mod alt_regions {
#[cfg(feature = "nightly")] #[cfg(feature = "nightly")]
impl embedded_storage_async::nor_flash::ReadNorFlash for $type_name<'_, Async> { impl embedded_storage_async::nor_flash::ReadNorFlash for $type_name<'_, Async> {
const READ_SIZE: usize = READ_SIZE; const READ_SIZE: usize = crate::flash::READ_SIZE;
async fn read(&mut self, offset: u32, bytes: &mut [u8]) -> Result<(), Self::Error> { async fn read(&mut self, offset: u32, bytes: &mut [u8]) -> Result<(), Self::Error> {
self.read(offset, bytes).await self.read(offset, bytes).await