Investigate Write with Verify functionality
RobTillaart opened this issue · comments
Rob Tillaart commented
Two different approaches possible
extra functions
int writeByteVerify(const uint16_t memoryAddress, const uint8_t value);
int writeBlockVerify(const uint16_t memoryAddress, const uint8_t* buffer, const uint16_t length);
int setBlockVerify(const uint16_t memoryAddress, const uint8_t value, const uint16_t length);
int updateByteVerify(const uint16_t memoryAddress, const uint8_t value);
int updateBlockVerify(const uint16_t memoryAddress, const uint8_t* buffer, const uint16_t length);
This is clear for the user. The functions can be implemented as wrappers around the existing write / update / read functions.
verify flag functions
void enableVerify();
void disableVerify();
bool verifyEnabled();
The write and update functions would verify depending on the flag.
This would imply a footprint increase even if you never would use verify.
Optimization thoughts
Optimizations could be created on the lowest level e.g. by verifying (partial) blocks on page level.
That could decrease the runtime memory needed, typical a buffer of I2C_BUFFERSIZE only to be allocated if verify == true
Triggered by #39
Rob Tillaart commented
Chosen for the 5 functions as that has the least impact on existing code. See #41