Skip to content

STM32 Buffered EEPROM #25

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/StreamUtils/Streams/EepromStream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ class EepromStream : public Stream {
}

void flush() override {
#if ARDUINO_ARCH_STM32
eeprom_buffer_flush();
#endif
#if STREAMUTILS_USE_EEPROM_COMMIT
EEPROM.commit();
#endif
Expand All @@ -50,8 +53,12 @@ class EepromStream : public Stream {
int address = static_cast<int>(_writeAddress++);
#if STREAMUTILS_USE_EEPROM_UPDATE
EEPROM.update(address, buffer[i]);
#else
#if ARDUINO_ARCH_STM32
eeprom_buffered_write_byte(address, buffer[i]);
#else
EEPROM.write(address, buffer[i]);
#endif
#endif
}
return size;
Expand All @@ -64,7 +71,11 @@ class EepromStream : public Stream {
#if STREAMUTILS_USE_EEPROM_UPDATE
EEPROM.update(address, data);
#else
EEPROM.write(address, data);
#if ARDUINO_ARCH_STM32
eeprom_buffered_write_byte(address, data);
#else
EEPROM.write(address, data);
#endif
#endif
return 1;
}
Expand Down