+ I2C_EEPROM 1.2.5 refactor

This commit is contained in:
RobTillaart 2017-04-20 09:15:28 +02:00
parent ab1d7d8617
commit ba067ff91d
3 changed files with 9 additions and 8 deletions

View File

@ -1,7 +1,7 @@
//
// FILE: I2C_eeprom.cpp
// AUTHOR: Rob Tillaart
// VERSION: 1.2.4
// VERSION: 1.2.5
// PURPOSE: I2C_eeprom library for Arduino with EEPROM 24LC256 et al.
//
// HISTORY:
@ -25,6 +25,7 @@
// 1.2.02 - 2015-03-06 stricter interface
// 1.2.03 - 2015-05-15 bugfix in _pageBlock & example (thanks ifreislich )
// 1.2.4 - 2017-04-19 remove timeout - https://github.com/RobTillaart/Arduino/issues/63
// 1.2.5 - 2017-04-20 refactor the removed timeout (Thanks to Koepel)
//
// Released to the public domain
//
@ -240,14 +241,14 @@ uint8_t I2C_eeprom::_ReadBlock(const uint16_t memoryAddress, uint8_t* buffer, co
int rv = Wire.endTransmission();
if (rv != 0) return 0; // error
Wire.requestFrom(_deviceAddress, length);
// readbytes will always be equal or smaller to length
uint8_t readBytes = Wire.requestFrom(_deviceAddress, length);
uint8_t cnt = 0;
uint8_t n = Wire.available();
while ((cnt < n) && (cnt < length))
while (cnt < readBytes)
{
buffer[cnt++] = WIRE_READ();
}
return cnt;
return readBytes;
}
void I2C_eeprom::waitEEReady()

View File

@ -4,7 +4,7 @@
// FILE: I2C_eeprom.h
// AUTHOR: Rob Tillaart
// PURPOSE: I2C_eeprom library for Arduino with EEPROM 24LC256 et al.
// VERSION: 1.2.4
// VERSION: 1.2.5
// HISTORY: See I2C_eeprom.cpp
// URL: http://arduino.cc/playground/Main/LibraryForI2CEEPROM
//
@ -21,7 +21,7 @@
#include "Wiring.h"
#endif
#define I2C_EEPROM_VERSION "1.2.4"
#define I2C_EEPROM_VERSION "1.2.5"
// The DEFAULT page size. This is overriden if you use the second constructor.
// I2C_EEPROM_PAGESIZE must be multiple of 2 e.g. 16, 32 or 64

View File

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