RobTillaart / I2C_EEPROM

Library for I2C EEPROM - 24LC512, 24LC256, 24LC64/32/16/08/04/02/01.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Investigate Write with Verify functionality

RobTillaart opened this issue · comments

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

Chosen for the 5 functions as that has the least impact on existing code. See #41