Skip to content

Commit be22f9f

Browse files
committed
Added functions to erase all the user code pages at once.
1 parent 6a40b5b commit be22f9f

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/flash.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,3 +165,10 @@ void flash_reset() {
165165
erased_page_flags = 0;
166166
}
167167

168+
void flash_erase_all_user() {
169+
// Erase all user flash pages
170+
uint8_t i;
171+
for (i=USER_FIRST_PAGE; i<FLASH_PAGES; i++)
172+
flash_erase_page(i);
173+
}
174+

src/flash.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,7 @@ void flash_check_and_erase(uint8_t page);
3939
void flash_check_erase_and_write(uint16_t buff[], uint16_t len, uint16_t flash_addr);
4040
// Reset record of which pages have been erased
4141
void flash_reset();
42+
// Erase all user flash pages
43+
void flash_erase_all_user();
4244

4345
#endif // _FLASH_H_

0 commit comments

Comments
 (0)