@@ -140,6 +140,16 @@ 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+ /// Requirements:
146+ /// - `offset` must be aligned to a word (4 bytes).
147+ /// - `bytes.len()` must be a multiple of the word size.
148+ /// - The bytes being written to must have been previously erased by [`FlashStorage::erase`].
149+ ///
150+ /// Requirements not being met will lead to an error or incorrect data being written.
151+ ///
152+ /// See [`NorFlash::write`] for more information.
143153 fn write ( & mut self , offset : u32 , bytes : & [ u8 ] ) -> Result < ( ) , Self :: Error > {
144154 const WS : u32 = FlashStorage :: WORD_SIZE ;
145155 self . check_alignment :: < { WS } > ( offset, bytes. len ( ) ) ?;
@@ -174,6 +184,15 @@ impl NorFlash for FlashStorage<'_> {
174184 Ok ( ( ) )
175185 }
176186
187+ /// Erases sectors at bytes `[from..to]`
188+ ///
189+ /// Requirements:
190+ /// - `from` must be aligned to a sector (4096 bytes).
191+ /// - `to - from` must be a multiple of the sector size.
192+ ///
193+ /// Requirements not being met will lead to an error.
194+ ///
195+ /// See [`NorFlash::erase`] for more information.
177196 fn erase ( & mut self , from : u32 , to : u32 ) -> Result < ( ) , Self :: Error > {
178197 let len = ( to - from) as _ ;
179198 const SZ : u32 = FlashStorage :: SECTOR_SIZE ;
0 commit comments