rust-embedded-community / embedded-storage

An Embedded Storage Abstraction Layer
Apache License 2.0
63 stars 21 forks source link

Add a NOR trait to encode that word clearing is supported #57

Open korken89 opened 1 month ago

korken89 commented 1 month ago

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.

Example use-case of this trait: https://github.com/tweedegolf/sequential-storage/pull/63

diondokter commented 1 month ago

While obvious to add the trait like this, I'm not sure this is the best way to do it...

In Sequential-Storage I'd like to be able to switch behaviour depending on whether a true multiwrite can be done, or only a clear to 0. I'm not sure on how to do this.

However, say we change the MultiWriteNorFlash trait to have an associated const bool that declares the ability, then we could make a meaningful selection so it can use the pessimistic algo for clear-only. But I'm still not sure that's the best API