From 443c62593dc6cb4dc0c70c35b900a1f0ca0e3b10 Mon Sep 17 00:00:00 2001 From: Erick Ahmed Date: Sat, 4 Oct 2025 14:37:38 +0200 Subject: [PATCH] Add EEPROM flush function to clear address contents --- firmware/atmega/source/eeprom.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/firmware/atmega/source/eeprom.c b/firmware/atmega/source/eeprom.c index cbbcffe..6053e9a 100644 --- a/firmware/atmega/source/eeprom.c +++ b/firmware/atmega/source/eeprom.c @@ -23,3 +23,13 @@ void eepromWrite(uint8_t address, uint8_t data) { EECR |= (1 << EEPE); } } + +void eepromFlush(uint8_t address) { + if (eepromRead(address) != 0) { + EEAR = address; + EEDR = 0; + + EECR |= (1 << EEMPE); + EECR |= (1 << EEPE); + } +}