Skip to content

Commit

Permalink
- Enhanced paged read (thanks to shacker140)
Browse files Browse the repository at this point in the history
  • Loading branch information
Naguissa committed May 6, 2022
1 parent ec419e8 commit ea80964
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=uEEPROMLib
version=1.2.0
version=1.2.1
author=Naguissa <naguissa@foroelectro.net>
maintainer=Naguissa <naguissa@foroelectro.net>
sentence=I2C EEPROM library. Split from uRTCLib https://github.com/Naguissa/uRTCLib - This library controls any I2C EEPROM, independent ones or incorporated on DS1307 or DS3231 RTCs.
Expand Down
13 changes: 8 additions & 5 deletions src/uEEPROMLib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @see <a href="https://www.foroelectro.net/librerias-arduino-ide-f29/ueepromlib-arduino-libreria-simple-y-eficaz-para-e-t225.html">https://www.foroelectro.net/librerias-arduino-ide-f29/ueepromlib-arduino-libreria-simple-y-eficaz-para-e-t225.html</a>
* @see <a href="mailto:naguissa@foroelectro.net">naguissa@foroelectro.net</a>
* @see <a href="https://github.com/Naguissa/uRTCLib">https://github.com/Naguissa/uRTCLib</a>
* @version 1.2.0
* @version 1.2.1
*/
#include <Arduino.h>
#ifndef UEEPROMLIB_WIRE
Expand Down Expand Up @@ -154,15 +154,18 @@ bool uEEPROMLib::_eeprom_read_sub(const unsigned int address, byte *data, uint8_
delay(uEEPROMLIB_WIRE_DELAY); // Little delay to assure EEPROM is able to process data; if missing and inside for look meses some values
if(UEEPROMLIB_WIRE.available()) {
uint8_t i = 0, j;
for (; i < n && UEEPROMLIB_WIRE.available(); i++) {
while (i < n && UEEPROMLIB_WIRE.available()) {
temp = (byte) UEEPROMLIB_WIRE.read();
*(data + i) = temp;
delay(uEEPROMLIB_WIRE_SHORT_DELAY); // Little delay to assure EEPROM is able to process data; if missing and inside for look meses some values
uEEPROMLIB_YIELD
i++;
// Added to wait if needed but cut after a failure (timeout)
for (j = 0; j < 255 && !UEEPROMLIB_WIRE.available(); j++) {
delay(uEEPROMLIB_WIRE_SHORT_DELAY); // Little delay to assure EEPROM is able to process data; if missing and inside for loop meses some values
uEEPROMLIB_YIELD
if (i < n) {
for (j = 0; j < 255 && !UEEPROMLIB_WIRE.available(); j++) {
delay(uEEPROMLIB_WIRE_SHORT_DELAY); // Little delay to assure EEPROM is able to process data; if missing and inside for loop meses some values
uEEPROMLIB_YIELD
}
}
}
ret = (i == n);
Expand Down
2 changes: 1 addition & 1 deletion src/uEEPROMLib.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @see <a href="https://www.foroelectro.net/librerias-arduino-ide-f29/ueepromlib-arduino-libreria-simple-y-eficaz-para-e-t225.html">https://www.foroelectro.net/librerias-arduino-ide-f29/ueepromlib-arduino-libreria-simple-y-eficaz-para-e-t225.html</a>
* @see <a href="mailto:naguissa@foroelectro.net">naguissa@foroelectro.net</a>
* @see <a href="https://github.com/Naguissa/uRTCLib">https://github.com/Naguissa/uRTCLib</a>
* @version 1.2.0
* @version 1.2.1
*/
/** \file uEEPROMLib.h
* \brief uEEPROMLib header file
Expand Down

0 comments on commit ea80964

Please sign in to comment.