Skip to content

Commit 14c7cb2

Browse files
committed
Add a NOR trait to encode that word clearing is supported
This is to encode MCU flashes that have ECC, where it is common that only a complete clear of the word is allowed. This is a more restrictive version of `MultiwriteNorFlash` as it cannot encode flashes with ECC support.
1 parent 95861f8 commit 14c7cb2

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77

88
## Unreleased
99

10+
- Add `WordclearNorFlash` to encode relaxed `write` requirements similar to `MultiwriteNorFlash` but that allows for flashes with ECC.
1011
- Add `start()` and `end()` method to the `Region` trait.
1112
- Much faster `OverlapIterator`.
1213

src/nor_flash.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,15 @@ impl<T: NorFlash> NorFlash for &mut T {
178178
}
179179
}
180180

181+
/// Marker trait for NorFlash relaxing the restrictions on `write`.
182+
///
183+
/// Writes to the same word twice are now allowed as long as the second write is all 0s.
184+
/// This is common for flashes that have ECC, where after the first write only a complete clear of
185+
/// the word is allowed after initial write.
186+
pub trait WordclearNorFlash: NorFlash {}
187+
188+
impl<T> WordclearNorFlash for T where T: MultiwriteNorFlash {}
189+
181190
/// Marker trait for NorFlash relaxing the restrictions on `write`.
182191
///
183192
/// Writes to the same word twice are now allowed. The result is the logical AND of the

0 commit comments

Comments
 (0)