Skip to content

Commit 242e961

Browse files
committed
added EEPROM.update(address, val) method
EEPROM.update(address, val) is part of the official Arduino API. See https://wiki-content.arduino.cc/en/Tutorial/LibraryExamples/EEPROMUpdate for more information.
1 parent 86b3163 commit 242e961

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

libraries/EEPROM/src/EEPROM.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ class EEPROMClass {
4545
uint16_t length();
4646
bool commit();
4747
void end();
48-
48+
void update(int address, uint8_t val) {
49+
if (read(address) != val) write(address, val);
50+
}
4951
uint8_t *getDataPtr();
5052
uint16_t convert(bool clear, const char *EEPROMname = "eeprom", const char *nvsname = "eeprom");
5153

0 commit comments

Comments
 (0)