EEPROM: Don't erase if we don't have to. Adding eeprom_driver_format abstraction. (#18332)

This commit is contained in:
Purdea Andrei
2024-05-28 14:49:55 +03:00
committed by GitHub
parent 6921c8a7dd
commit 267dffda15
10 changed files with 63 additions and 4 deletions

View File

@@ -36,6 +36,7 @@
#include "wait.h"
#include "i2c_master.h"
#include "eeprom.h"
#include "eeprom_driver.h"
#include "eeprom_i2c.h"
// #define DEBUG_EEPROM_OUTPUT
@@ -62,6 +63,13 @@ void eeprom_driver_init(void) {
#endif
}
void eeprom_driver_format(bool erase) {
/* i2c eeproms do not need to be formatted before use */
if (erase) {
eeprom_driver_erase();
}
}
void eeprom_driver_erase(void) {
#if defined(CONSOLE_ENABLE) && defined(DEBUG_EEPROM_OUTPUT)
uint32_t start = timer_read32();