AceTime
0.7
Date and time classes for Arduino that support timezones from the TZ Database, and a system clock that can synchronize from an NTP server or an RTC chip.
|
Thin wrapper around the EEPROM object (from the the built-in EEPROM library) to read and write a given block of data along with its CRC check. More...
#include <CrcEeprom.h>
Public Member Functions | |
void | begin (uint16_t size) |
Call from global setup() function. More... | |
uint16_t | writeWithCrc (int address, const void *const data, const uint16_t dataSize) const |
Write the data with its CRC. More... | |
bool | readWithCrc (int address, void *const data, const uint16_t dataSize) const |
Read the data from EEPROM along with its CRC. More... | |
Thin wrapper around the EEPROM object (from the the built-in EEPROM library) to read and write a given block of data along with its CRC check.
The CRC is written after the data block, instead of at the beginning of the data block to reduce flash write wear of the bytes corresonding to the CRC. Over time, it is expected that the size of the data block will change, as fields are added or deleted. Therefore, the location of the CRC bytes will also change, which helps wear leveling. If the CRC bytes were at the beginning, those CRC byes would experience the highest level of writes, even when the actua data block size changes.
Depends on the FastCRC (https://github.com/FrankBoesing/FastCRC) library.
Currently located in the AceTime library because it's used to store backup time. Might be moved to another library later.
Definition at line 42 of file CrcEeprom.h.
|
inline |
Call from global setup() function.
Needed for ESP8266 and ESP32, does nothing for AVR and others.
Definition at line 50 of file CrcEeprom.h.
|
inline |
Read the data from EEPROM along with its CRC.
Return true if the CRC of the data retrieved matches the CRC of the data when it was written.
Definition at line 88 of file CrcEeprom.h.
|
inline |
Write the data with its CRC.
Returns the number of bytes written.
Definition at line 61 of file CrcEeprom.h.