Skip to content

Commit

Permalink
Implement MultiwriteNorFlash for nRF52 boards that support it
Browse files Browse the repository at this point in the history
  • Loading branch information
ia0 committed Jan 8, 2022
1 parent bcd5c5d commit 1236797
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions nrf-hal-common/src/nvmc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,21 @@ where
}
}

// Only nRF52 boards have been checked. There are 2 things to note:
//
// 1. The nRF52832 doesn't support 2 writes per word. Instead it supports 181 writes per block,
// where a block is 128 words. So on average it's a bit less than 2 writes per word, and thus we
// can't implement MultiwriteNorFlash.
//
// 2. The nRF52820 supports 2 writes per word but doesn't have an associated feature.
#[cfg(any(
feature = "52810",
feature = "52811",
feature = "52833",
feature = "52840",
))]
impl<T: Instance> embedded_storage::nor_flash::MultiwriteNorFlash for Nvmc<T> {}

pub trait Instance: Deref<Target = nvmc::RegisterBlock> + sealed::Sealed {}

impl Instance for NVMC {}
Expand Down

0 comments on commit 1236797

Please sign in to comment.