@@ -140,6 +140,20 @@ impl NorFlash for FlashStorage<'_> {
140140 const WRITE_SIZE : usize = Self :: WORD_SIZE as _ ;
141141 const ERASE_SIZE : usize = Self :: SECTOR_SIZE as _ ;
142142
143+ /// Writes `bytes` to the flash storage at `offset`.
144+ ///
145+ /// Note that NOR flash is only able to flip bits from 1 to 0. Attempting to
146+ /// flip a bit from 0 to 1 will silently fail. It may be necessary to call
147+ /// [`FlashStorage::erase`] before writing to ensure all bits being written
148+ /// to are 1.
149+ ///
150+ /// Requirements:
151+ /// - `offset` must be aligned to a word (4 bytes).
152+ /// - `bytes.len()` must be a multiple of the word size.
153+ ///
154+ /// Requirements not being met will lead to an error.
155+ ///
156+ /// See [`NorFlash::write`] for more information.
143157 fn write ( & mut self , offset : u32 , bytes : & [ u8 ] ) -> Result < ( ) , Self :: Error > {
144158 const WS : u32 = FlashStorage :: WORD_SIZE ;
145159 self . check_alignment :: < { WS } > ( offset, bytes. len ( ) ) ?;
@@ -174,6 +188,15 @@ impl NorFlash for FlashStorage<'_> {
174188 Ok ( ( ) )
175189 }
176190
191+ /// Erases sectors at bytes `[from..to]`
192+ ///
193+ /// Requirements:
194+ /// - `from` must be aligned to a sector (4096 bytes).
195+ /// - `to - from` must be a multiple of the sector size.
196+ ///
197+ /// Requirements not being met will lead to an error.
198+ ///
199+ /// See [`NorFlash::erase`] for more information.
177200 fn erase ( & mut self , from : u32 , to : u32 ) -> Result < ( ) , Self :: Error > {
178201 let len = ( to - from) as _ ;
179202 const SZ : u32 = FlashStorage :: SECTOR_SIZE ;
0 commit comments