Skip to content

Commit 28d3bba

Browse files
bors[bot]ia0
andauthored
Merge #373
373: Implement MultiwriteNorFlash for nRF52 boards that support it r=jonas-schievink a=ia0 This PR implements `MultiwriteNorFlash` as suggested [here](#336 (comment)). I only listed nRF52 boards that support writing twice to the same word, because I'm not familiar with the other boards or crate features. Co-authored-by: ia0 <[email protected]>
2 parents bcd5c5d + c2b0b29 commit 28d3bba

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

nrf-hal-common/src/nvmc.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,21 @@ where
183183
}
184184
}
185185

186+
// Only nRF52 boards have been checked. There are 2 things to note:
187+
//
188+
// 1. The nRF52832 doesn't support 2 writes per word. Instead it supports 181 writes per block,
189+
// where a block is 128 words. So on average it's a bit less than 2 writes per word, and thus we
190+
// can't implement MultiwriteNorFlash.
191+
//
192+
// 2. The nRF52820 supports 2 writes per word but doesn't have an associated feature.
193+
#[cfg(any(
194+
feature = "52810",
195+
feature = "52811",
196+
feature = "52833",
197+
feature = "52840",
198+
))]
199+
impl<T: Instance> embedded_storage::nor_flash::MultiwriteNorFlash for Nvmc<T> {}
200+
186201
pub trait Instance: Deref<Target = nvmc::RegisterBlock> + sealed::Sealed {}
187202

188203
impl Instance for NVMC {}

0 commit comments

Comments
 (0)