1.8.4 I2C_EEPROM

This commit is contained in:
Rob Tillaart 2024-04-21 11:00:27 +02:00
parent cbbffdb59f
commit 4bfffcf63f
18 changed files with 153 additions and 119 deletions

View File

@ -6,6 +6,14 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## [1.8.4] - 2024-04-20
- Fix #70, increase length internal buffer.
- add compile time flag **EN_AUTO_WRITE_PROTECT** (thanks to microfoundry)
- improve readability: cnt => count addr => address
- add URL to examples
- minor edits.
## [1.8.3] - 2024-03-28
- Fix #64, compiler warning.
- add **verifyBlock(memoryAddress, buffer, length)**
@ -15,7 +23,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- update examples
- update readme.md
## [1.8.2] - 2024-01-02
- updated **uint32_t determineSizeNoWrite()**, kudos to roelandkluit
- minor edits

View File

@ -1,9 +1,9 @@
//
// FILE: I2C_eeprom.cpp
// AUTHOR: Rob Tillaart
// VERSION: 1.8.3
// VERSION: 1.8.4
// PURPOSE: Arduino Library for external I2C EEPROM 24LC256 et al.
// URL: https://github.com/RobTillaart/I2C_EEPROM.git
// URL: https://github.com/RobTillaart/I2C_EEPROM
#include "I2C_eeprom.h"
@ -60,6 +60,7 @@ bool I2C_eeprom::begin(int8_t writeProtectPin)
_writeProtectPin = writeProtectPin;
if (_writeProtectPin >= 0)
{
_autoWriteProtect = EN_AUTO_WRITE_PROTECT;
pinMode(_writeProtectPin, OUTPUT);
preventWrite();
}
@ -131,38 +132,38 @@ uint8_t I2C_eeprom::readByte(const uint16_t memoryAddress)
// returns bytes read.
uint16_t I2C_eeprom::readBlock(const uint16_t memoryAddress, uint8_t * buffer, const uint16_t length)
{
uint16_t addr = memoryAddress;
uint16_t address = memoryAddress;
uint16_t len = length;
uint16_t rv = 0;
uint16_t bytes = 0;
while (len > 0)
{
uint8_t cnt = I2C_BUFFERSIZE;
if (cnt > len) cnt = len;
rv += _ReadBlock(addr, buffer, cnt);
addr += cnt;
buffer += cnt;
len -= cnt;
uint8_t count = I2C_BUFFERSIZE;
if (count > len) count = len;
bytes += _ReadBlock(address, buffer, count);
address += count;
buffer += count;
len -= count;
}
return rv;
return bytes;
}
// returns true or false.
bool I2C_eeprom::verifyBlock(const uint16_t memoryAddress, const uint8_t * buffer, const uint16_t length)
{
uint16_t addr = memoryAddress;
uint16_t address = memoryAddress;
uint16_t len = length;
while (len > 0)
{
uint8_t cnt = I2C_BUFFERSIZE;
if (cnt > len) cnt = len;
if (_verifyBlock(addr, buffer, cnt) == false)
uint8_t count = I2C_BUFFERSIZE;
if (count > len) count = len;
if (_verifyBlock(address, buffer, count) == false)
{
return false;
}
addr += cnt;
buffer += cnt;
len -= cnt;
address += count;
buffer += count;
len -= count;
}
return true;
}
@ -184,25 +185,25 @@ int I2C_eeprom::updateByte(const uint16_t memoryAddress, const uint8_t data)
// returns bytes written.
uint16_t I2C_eeprom::updateBlock(const uint16_t memoryAddress, const uint8_t * buffer, const uint16_t length)
{
uint16_t addr = memoryAddress;
uint16_t address = memoryAddress;
uint16_t len = length;
uint16_t rv = 0;
uint16_t bytes = 0;
while (len > 0)
{
uint8_t buf[I2C_BUFFERSIZE];
uint8_t cnt = I2C_BUFFERSIZE;
uint8_t count = I2C_BUFFERSIZE;
if (cnt > len) cnt = len;
rv += _ReadBlock(addr, buf, cnt);
if (memcmp(buffer, buf, cnt) != 0)
if (count > len) count = len;
bytes += _ReadBlock(address, buf, count);
if (memcmp(buffer, buf, count) != 0)
{
_pageBlock(addr, buffer, cnt, true);
_pageBlock(address, buffer, count, true);
}
addr += cnt;
buffer += cnt;
len -= cnt;
address += count;
buffer += count;
len -= count;
}
return rv;
return bytes;
}
@ -305,12 +306,12 @@ uint32_t I2C_eeprom::determineSize(const bool debug)
uint8_t buf = readByte(size);
// test folding
uint8_t cnt = 0;
uint8_t count = 0;
writeByte(size, pat55);
if (readByte(0) == pat55) cnt++;
if (readByte(0) == pat55) count++;
writeByte(size, patAA);
if (readByte(0) == patAA) cnt++;
folded = (cnt == 2);
if (readByte(0) == patAA) count++;
folded = (count == 2);
if (debug)
{
SPRNH(size, HEX);
@ -327,6 +328,7 @@ uint32_t I2C_eeprom::determineSize(const bool debug)
return 0;
}
// new 1.8.1 #61
// updated 1.8.2 #63
//
@ -344,7 +346,7 @@ uint32_t I2C_eeprom::determineSizeNoWrite()
if (!isConnected()) return 0;
bool addressSize = _isAddressSizeTwoWords;
_isAddressSizeTwoWords = true; //Otherwise reading large EEPROMS fails
_isAddressSizeTwoWords = true; // Otherwise reading large EEPROMS fails
bool isModifiedFirstSector = false;
bool dataIsDifferent = false;
@ -356,8 +358,8 @@ uint32_t I2C_eeprom::determineSizeNoWrite()
{
if (dataIsDifferent || pos == 0)
{
//ignore futher comparison if dataFirstBytes is not the same in buffer
//Ignore first byte
// ignore further comparison if dataFirstBytes is not the same in buffer
// Ignore first byte
}
else if (dataFirstBytes[pos - 1] != dataFirstBytes[pos])
{
@ -366,7 +368,7 @@ uint32_t I2C_eeprom::determineSizeNoWrite()
if (dataFirstBytes[pos] != 0xFF && dataFirstBytes[pos] != 0x00)
{
//Default dataFirstBytes value is 0xFF or 0x00
// Default dataFirstBytes value is 0xFF or 0x00
isModifiedFirstSector = true;
}
@ -376,31 +378,34 @@ uint32_t I2C_eeprom::determineSizeNoWrite()
if (!isModifiedFirstSector)
{
//Cannot determine diff, at least one of the first bytes within 0 - len [BUFSIZE] needs to be changed.
//to something other than 0x00 and 0xFF
// Cannot determine diff, at least one of the first bytes within 0 - len [BUFSIZE] needs to be changed
// to something other than 0x00 and 0xFF
_isAddressSizeTwoWords = addressSize;
return 1;
}
if (!dataIsDifferent)
{
//Data in first bytes within 0 - len [BUFSIZE] are all the same.
// Data in first bytes within 0 - len [BUFSIZE] are all the same.
_isAddressSizeTwoWords = addressSize;
return 2;
}
//Read from larges to smallest size
// Read from largest to smallest size
for (uint32_t size = 32768; size >= 64; size /= 2)
{
_isAddressSizeTwoWords = (size >= I2C_DEVICESIZE_24LC16); // == 2048
// Try to read last byte of the block, should return length of 0 when fails for single byte devices
// Will return the same dataFirstBytes as initialy read on other devices as the datapointer could not be moved to the requested position
// Try to read last byte of the block, should return length of 0 when fails for single byte devices
// Will return the same dataFirstBytes as initially read on other devices
// as the data pointer could not be moved to the requested position
delay(2);
uint16_t bSize = readBlock(size, dataMatch, BUFSIZE);
if (bSize == BUFSIZE && memcmp(dataFirstBytes, dataMatch, BUFSIZE) != 0)
{
//Read is perfomed just over size (size + BUFSIZE), this will only work for devices with mem > size; therefore return size * 2
// Read is performed just over size (size + BUFSIZE),
// this will only work for devices with mem > size;
// therefore return size * 2
_isAddressSizeTwoWords = addressSize;
return size * 2;
}
@ -542,22 +547,22 @@ bool I2C_eeprom::getAutoWriteProtect()
// returns 0 = OK otherwise error
int I2C_eeprom::_pageBlock(const uint16_t memoryAddress, const uint8_t * buffer, const uint16_t length, const bool incrBuffer)
{
uint16_t addr = memoryAddress;
uint16_t address = memoryAddress;
uint16_t len = length;
while (len > 0)
{
uint8_t bytesUntilPageBoundary = this->_pageSize - addr % this->_pageSize;
uint8_t bytesUntilPageBoundary = this->_pageSize - address % this->_pageSize;
uint8_t cnt = I2C_BUFFERSIZE;
if (cnt > len) cnt = len;
if (cnt > bytesUntilPageBoundary) cnt = bytesUntilPageBoundary;
uint8_t count = I2C_BUFFERSIZE;
if (count > len) count = len;
if (count > bytesUntilPageBoundary) count = bytesUntilPageBoundary;
int rv = _WriteBlock(addr, buffer, cnt);
int rv = _WriteBlock(address, buffer, count);
if (rv != 0) return rv;
addr += cnt;
if (incrBuffer) buffer += cnt;
len -= cnt;
address += count;
if (incrBuffer) buffer += count;
len -= count;
}
return 0;
}
@ -574,8 +579,8 @@ void I2C_eeprom::_beginTransmission(const uint16_t memoryAddress)
}
else
{
uint8_t addr = _deviceAddress | ((memoryAddress >> 8) & 0x07);
_wire->beginTransmission(addr);
uint8_t address = _deviceAddress | ((memoryAddress >> 8) & 0x07);
_wire->beginTransmission(address);
}
// Address Low Byte
@ -586,7 +591,7 @@ void I2C_eeprom::_beginTransmission(const uint16_t memoryAddress)
// pre: length <= this->_pageSize && length <= I2C_BUFFERSIZE;
// returns 0 = OK otherwise error
int I2C_eeprom::_WriteBlock(const uint16_t memoryAddress, const uint8_t * buffer, const uint8_t length)
int I2C_eeprom::_WriteBlock(const uint16_t memoryAddress, const uint8_t * buffer, const uint16_t length)
{
_waitEEReady();
if (_autoWriteProtect)
@ -624,7 +629,7 @@ int I2C_eeprom::_WriteBlock(const uint16_t memoryAddress, const uint8_t * buffer
// pre: buffer is large enough to hold length bytes
// returns bytes read
uint8_t I2C_eeprom::_ReadBlock(const uint16_t memoryAddress, uint8_t * buffer, const uint8_t length)
uint8_t I2C_eeprom::_ReadBlock(const uint16_t memoryAddress, uint8_t * buffer, const uint16_t length)
{
_waitEEReady();
@ -650,14 +655,14 @@ uint8_t I2C_eeprom::_ReadBlock(const uint16_t memoryAddress, uint8_t * buffer, c
}
else
{
uint8_t addr = _deviceAddress | ((memoryAddress >> 8) & 0x07);
readBytes = _wire->requestFrom(addr, length);
uint8_t address = _deviceAddress | ((memoryAddress >> 8) & 0x07);
readBytes = _wire->requestFrom(address, length);
}
yield(); // For OS scheduling
uint8_t cnt = 0;
while (cnt < readBytes)
uint8_t count = 0;
while (count < readBytes)
{
buffer[cnt++] = _wire->read();
buffer[count++] = _wire->read();
}
return readBytes;
}
@ -665,7 +670,7 @@ uint8_t I2C_eeprom::_ReadBlock(const uint16_t memoryAddress, uint8_t * buffer, c
// compares content of EEPROM with buffer.
// returns true if equal.
bool I2C_eeprom::_verifyBlock(const uint16_t memoryAddress, const uint8_t * buffer, const uint8_t length)
bool I2C_eeprom::_verifyBlock(const uint16_t memoryAddress, const uint8_t * buffer, const uint16_t length)
{
_waitEEReady();
@ -691,14 +696,14 @@ bool I2C_eeprom::_verifyBlock(const uint16_t memoryAddress, const uint8_t * buff
}
else
{
uint8_t addr = _deviceAddress | ((memoryAddress >> 8) & 0x07);
readBytes = _wire->requestFrom(addr, length);
uint8_t address = _deviceAddress | ((memoryAddress >> 8) & 0x07);
readBytes = _wire->requestFrom(address, length);
}
yield(); // For OS scheduling
uint8_t cnt = 0;
while (cnt < readBytes)
uint8_t count = 0;
while (count < readBytes)
{
if (buffer[cnt++] != _wire->read())
if (buffer[count++] != _wire->read())
{
return false;
}

View File

@ -2,16 +2,16 @@
//
// FILE: I2C_eeprom.h
// AUTHOR: Rob Tillaart
// VERSION: 1.8.3
// VERSION: 1.8.4
// PURPOSE: Arduino Library for external I2C EEPROM 24LC256 et al.
// URL: https://github.com/RobTillaart/I2C_EEPROM.git
// URL: https://github.com/RobTillaart/I2C_EEPROM
#include "Arduino.h"
#include "Wire.h"
#define I2C_EEPROM_VERSION (F("1.8.3"))
#define I2C_EEPROM_VERSION (F("1.8.4"))
#define I2C_DEVICESIZE_24LC512 65536
#define I2C_DEVICESIZE_24LC256 32768
@ -33,6 +33,15 @@
#define I2C_WRITEDELAY 5000
#endif
// set the flag EN_AUTO_WRITE_PROTECT to 1 to enable the Write Control at compile time
// used if the write_protect pin is explicitly set in the begin() function.
// the flag can be set as command line option.
#ifndef EN_AUTO_WRITE_PROTECT
#define EN_AUTO_WRITE_PROTECT 0
#endif
#ifndef UNIT_TEST_FRIEND
#define UNIT_TEST_FRIEND
#endif
@ -162,11 +171,11 @@ private:
// TODO incrBuffer is an implementation name, not a functional name.
int _pageBlock(const uint16_t memoryAddress, const uint8_t * buffer, const uint16_t length, const bool incrBuffer);
// returns I2C status, 0 = OK
int _WriteBlock(const uint16_t memoryAddress, const uint8_t * buffer, const uint8_t length);
int _WriteBlock(const uint16_t memoryAddress, const uint8_t * buffer, const uint16_t length);
// returns bytes read.
uint8_t _ReadBlock(const uint16_t memoryAddress, uint8_t * buffer, const uint8_t length);
uint8_t _ReadBlock(const uint16_t memoryAddress, uint8_t * buffer, const uint16_t length);
// compare bytes in EEPROM.
bool _verifyBlock(const uint16_t memoryAddress, const uint8_t * buffer, const uint8_t length);
bool _verifyBlock(const uint16_t memoryAddress, const uint8_t * buffer, const uint16_t length);
// to optimize the write latency of the EEPROM
void _waitEEReady();
@ -176,7 +185,7 @@ private:
bool _debug = false;
int8_t _writeProtectPin = -1;
bool _autoWriteProtect = false;
bool _autoWriteProtect = EN_AUTO_WRITE_PROTECT;
UNIT_TEST_FRIEND;
};

View File

@ -3,20 +3,20 @@
// AUTHOR: Tomas Hübner
// VERSION: 1.0.0
// PURPOSE: Simple example of how to use cyclic storage.
//
// URL: https://github.com/RobTillaart/I2C_EEPROM
#include <I2C_eeprom.h>
#include <I2C_eeprom_cyclic_store.h>
#define MEMORY_SIZE 0x2000 // Total capacity of the EEPROM
#define PAGE_SIZE 64 // Size of write page of device, use datasheet to find!
#define MEMORY_SIZE 8192 // Total capacity of the EEPROM (8K == 8192 == 0x2000)
#define PAGE_SIZE 64 // Size of write page of device, use datasheet to find!
struct SampleData {
public:
uint32_t counter;
// Must use fixed length string, avoid using the String class.
// Must use fixed length string, avoid using the String class.
char message[32];
};

View File

@ -2,6 +2,7 @@
// FILE: I2C_eeprom_determineSize.ino
// AUTHOR: Rob Tillaart
// PURPOSE: test determinSize() function
// URL: https://github.com/RobTillaart/I2C_EEPROM
#include "Wire.h"
@ -34,7 +35,7 @@ void setup()
delay(10);
start = micros();
uint32_t size = ee.determineSize(false); // debug param
uint32_t size = ee.determineSize(false); // debug parameter
diff = micros() - start;
Serial.print("TIME: ");
Serial.print(diff);
@ -70,5 +71,5 @@ void loop()
}
// -- END OF FILE --
// -- END OF FILE --

View File

@ -2,6 +2,7 @@
// FILE: I2C_eeprom_determineSizeNoWrite.ino
// AUTHOR: Rob Tillaart
// PURPOSE: test determineSizeNoWrite() function
// URL: https://github.com/RobTillaart/I2C_EEPROM
#include "Wire.h"

View File

@ -2,6 +2,7 @@
// FILE: I2C_eeprom_format.ino
// AUTHOR: Rob Tillaart
// PURPOSE: demo format EEPROM
// URL: https://github.com/RobTillaart/I2C_EEPROM
#include "Wire.h"
@ -32,7 +33,7 @@ void setup()
Serial.println();
uint32_t size = ee.determineSize(false); // debug param
uint32_t size = ee.determineSize(false); // debug parameter
if (size == 0)
{
Serial.println("SIZE: could not determine size");
@ -85,4 +86,4 @@ void loop()
}
// -- END OF FILE --
// -- END OF FILE --

View File

@ -2,9 +2,10 @@
// FILE: I2C_eeprom_struct.ino
// AUTHOR: Rob Tillaart
// PURPOSE: demo I2C_EEPROM library store /retrieve struct
// URL: https://github.com/RobTillaart/I2C_EEPROM
//
// uses a 24LC256 (32KB) EEPROM
// as this test writes a lot it might wear out EEPROMs eventually.
// uses a 24LC256 (32KB) EEPROM
// as this test writes a lot it might wear out EEPROMs eventually.
//
@ -44,15 +45,15 @@ void setup()
Serial.print("size: \t");
Serial.println(sizeof(measurement));
// clear EEPROM part
// clear EEPROM part
ee.setBlock(0, 0, sizeof(measurement));
// make measurement here
// make measurement here
measurement.temperature = 22.5;
measurement.humidity = 53.1;
measurement.pressure = 1000.9;
// store it in EEPROM
// store it in EEPROM
start = micros();
ee.writeBlock(0, (uint8_t *) &measurement, sizeof(measurement));
duration = micros() - start;
@ -60,12 +61,12 @@ void setup()
Serial.println(duration);
delay(10);
// clear measurement struct
// clear measurement struct
measurement.temperature = 0;
measurement.humidity = 0;
measurement.pressure = 0;
// retrieve old measurement
// retrieve old measurement
start = micros();
ee.readBlock(0, (uint8_t *) &measurement, sizeof(measurement));
duration = micros() - start;
@ -89,5 +90,5 @@ void loop()
}
// -- END OF FILE
// -- END OF FILE

View File

@ -2,18 +2,19 @@
// FILE: I2C_eeprom_test.ino
// AUTHOR: Rob Tillaart
// PURPOSE: show/test I2C_EEPROM library
// URL: https://github.com/RobTillaart/I2C_EEPROM
//
// uses a 24LC256 (32KB) EEPROM
// might need adaptions for other EEPROMS (page size etc)
// uses a 24LC256 (32KB) EEPROM
// might need adaptions for other EEPROMS (page size etc)
#include "Wire.h"
#include "I2C_eeprom.h"
// UNO
// UNO
#define SERIAL_OUT Serial
// Due
// Due
// #define SERIAL_OUT SerialUSB
@ -247,5 +248,5 @@ void dumpEEPROM(uint16_t memoryAddress, uint16_t length)
}
// -- END OF FILE --
// -- END OF FILE --

View File

@ -2,6 +2,7 @@
// FILE: I2C_eeprom_test_performance.ino
// AUTHOR: Rob Tillaart
// PURPOSE: test I2C_EEPROM library
// URL: https://github.com/RobTillaart/I2C_EEPROM
#include "Wire.h"
@ -94,7 +95,7 @@ void test()
Serial.println(totals);
totals = 0;
// same tests but now with a 5 millisec delay in between.
// same tests but now with a 5 milliseconds delay in between.
delay(5);
Serial.print("\nTEST: timing writeByte()\t");
@ -180,5 +181,5 @@ void dumpEEPROM(uint16_t memoryAddress, uint16_t length)
}
// -- END OF FILE --
// -- END OF FILE --

View File

@ -2,8 +2,9 @@
// FILE: I2C_eeprom_update.ino
// AUTHOR: Rob Tillaart
// PURPOSE: demo I2C_EEPROM library - updateByte
// URL: https://github.com/RobTillaart/I2C_EEPROM
//
// uses a 24LC256 (32KB) EEPROM
// uses a 24LC256 (32KB) EEPROM
#include "Wire.h"
@ -52,7 +53,7 @@ void setup()
Serial.println("\nTEST: 100x writebyte()");
delay(10);
ee.setBlock(0, 0, 100); // clear first 100 bytes
ee.setBlock(0, 0, 100); // clear first 100 bytes
start = micros();
for (int i = 0; i < 100; i++)
{
@ -64,7 +65,7 @@ void setup()
delay(10);
Serial.println("\nTEST: 100x updateByte()");
ee.setBlock(0, 0, 100); // clear first 100 bytes
ee.setBlock(0, 0, 100); // clear first 100 bytes
start = micros();
for (int i = 0; i < 100; i++)
{
@ -84,5 +85,5 @@ void loop()
}
// -- END OF FILE --
// -- END OF FILE --

View File

@ -2,6 +2,7 @@
// FILE: I2C_eeprom_updateBlock.ino
// AUTHOR: Rob Tillaart
// PURPOSE: demo I2C_EEPROM library - performance gain updateBlock
// URL: https://github.com/RobTillaart/I2C_EEPROM
//
// uses a 24LC256 (32KB) EEPROM
// as this test writes a lot it might wear out EEPROMs eventually.
@ -58,7 +59,7 @@ void test_1(int n)
Serial.println(n);
Serial.print("TEST:\twriteBlock()");
delay(10);
ee.setBlock(0, 0, 100); // clear first 100 bytes
ee.setBlock(0, 0, 100); // clear first 100 bytes
start = micros();
for (int i = 0; i < n; i++) ee.writeBlock(0, ar, 100);
dur1 = micros() - start;
@ -77,7 +78,7 @@ void test_1(int n)
Serial.print("TEST:\tupdateBlock()");
delay(10);
ee.setBlock(0, 0, 100); // clear first 100 bytes
ee.setBlock(0, 0, 100); // clear first 100 bytes
start = micros();
for (int i = 0; i < n; i++) ee.updateBlock(0, ar, 100);
dur1 = micros() - start;
@ -92,7 +93,7 @@ void test_2()
{
Serial.println("\nTEST: 100x writeBlock()");
delay(10);
ee.setBlock(0, 0, 100); // clear first 100 bytes
ee.setBlock(0, 0, 100); // clear first 100 bytes
start = micros();
for (int i = 0; i < 100; i++)
{
@ -106,7 +107,7 @@ void test_2()
Serial.println("\nTEST: 100x updateBlock()");
ee.setBlock(0, 0, 100); // clear first 100 bytes
ee.setBlock(0, 0, 100); // clear first 100 bytes
start = micros();
for (int i = 0; i < 100; i++)
{
@ -122,7 +123,7 @@ void test_2()
void dump(uint32_t from, uint32_t to)
{
for (uint32_t i = from; i < to; i++) // I2C_DEVICESIZE_24LC512
for (uint32_t i = from; i < to; i++) // I2C_DEVICESIZE_24LC512
{
char buffer[24];
if (i % 16 == 0)
@ -143,5 +144,5 @@ void dump(uint32_t from, uint32_t to)
}
// -- END OF FILE --
// -- END OF FILE --

View File

@ -2,6 +2,7 @@
// FILE: I2C_eeprom_verify.ino
// AUTHOR: Rob Tillaart
// PURPOSE: demo I2C_EEPROM library - updateByte
// URL: https://github.com/RobTillaart/I2C_EEPROM
//
// uses a 24LC256 (32KB) EEPROM
@ -38,7 +39,7 @@ void setup()
Serial.println("\n");
Serial.println("\nTEST: NN x writeByte()");
delay(10);
ee.setBlock(0, 0, 100); // clear first 100 bytes
ee.setBlock(0, 0, 100); // clear first 100 bytes
start = micros();
for (int i = 0; i < NN; i++)
{
@ -51,7 +52,7 @@ void setup()
Serial.println("\nTEST: NN x writeByteVerify()");
delay(10);
ee.setBlock(0, 0, 100); // clear first 100 bytes
ee.setBlock(0, 0, 100); // clear first 100 bytes
start = micros();
for (int i = 0; i < NN; i++)
{
@ -96,7 +97,7 @@ void setup()
Serial.println("\nTEST: NN x updateByteVerify() not same data");
delay(10);
ee.setBlock(0, 0, 100); // clear first 100 bytes
ee.setBlock(0, 0, 100); // clear first 100 bytes
start = micros();
for (int i = 0; i < NN; i++)
{
@ -129,7 +130,7 @@ void setup()
Serial.println("\nTEST: NN x writeBlockVerify()");
delay(10);
ee.setBlock(0, 0, 100); // clear first 100 bytes
ee.setBlock(0, 0, 100); // clear first 100 bytes
start = micros();
for (int i = 0; i < NN; i++)
{
@ -176,7 +177,7 @@ void setup()
strcpy(buffer, "98765432109876543210987654321098765432109876543210"); // 50 bytes
Serial.println("\nTEST: NN x updateBlockVerify() not same data");
delay(10);
ee.setBlock(0, 0, 100); // clear first 100 bytes
ee.setBlock(0, 0, 100); // clear first 100 bytes
start = micros();
for (int i = 0; i < NN; i++)
{
@ -194,7 +195,7 @@ void setup()
Serial.println("\nTEST: NN x setBlock() same data");
delay(10);
ee.setBlock(0, 0, 100); // clear first 100 bytes
ee.setBlock(0, 0, 100); // clear first 100 bytes
start = micros();
for (int i = 0; i < NN; i++)
{
@ -207,7 +208,7 @@ void setup()
Serial.println("\nTEST: NN x setBlockVerify() same data");
delay(10);
ee.setBlock(0, 0, 100); // clear first 100 bytes
ee.setBlock(0, 0, 100); // clear first 100 bytes
start = micros();
for (int i = 0; i < NN; i++)
{
@ -245,4 +246,4 @@ void loop()
}
// -- END OF FILE --
// -- END OF FILE --

View File

@ -2,6 +2,7 @@
// FILE: I2C_eeprom_verifyBlock.ino
// AUTHOR: Rob Tillaart
// PURPOSE: demo I2C_EEPROM library
// URL: https://github.com/RobTillaart/I2C_EEPROM
//
// uses a 24LC256 (32KB) EEPROM

View File

@ -3,6 +3,7 @@
// AUTHOR: Tyler Freeman
// VERSION: 0.1.1
// PURPOSE: show/test I2C_EEPROM library with small EEPROMS
// URL: https://github.com/RobTillaart/I2C_EEPROM
// HISTORY
// 0.1.0 2014-05-xx initial version
// 0.1.1 2020-07-14 fix #1 compile for ESP; fix author

View File

@ -15,7 +15,7 @@
"type": "git",
"url": "https://github.com/RobTillaart/I2C_EEPROM.git"
},
"version": "1.8.3",
"version": "1.8.4",
"license": "MIT",
"frameworks": "*",
"platforms": "*",

View File

@ -1,5 +1,5 @@
name=I2C_EEPROM
version=1.8.3
version=1.8.4
author=Rob Tillaart <rob.tillaart@gmail.com>
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
sentence=Library for I2C EEPROMS

View File

@ -20,6 +20,8 @@ Arduino Library for external I2C EEPROM - 24LC512, 24LC256, 24LC64/32/16/08/04/0
This library is to access external I2C EEPROM up to 64KB (= 512 Kbit) in size.
MicroChip 24LC512, 24LC256, 24LC64, 24LC32, 24LC16, 24LC08, 24LC04, 24LC02, 24LC01 and equivalents.
Also confirmed working M24512-W, M24512-R, M24512-DF (See #68).
Not supported is the identification page functions.
The **I2C_eeprom_cyclic_store** interface is documented [here](README_cyclic_store.md)