+ I2C_eeprom 1.2.4

+ remove timeout - github issue #63
This commit is contained in:
RobTillaart 2017-04-19 12:45:38 +02:00
parent d862556833
commit ab1d7d8617
3 changed files with 9 additions and 11 deletions

View File

@ -1,7 +1,7 @@
//
// FILE: I2C_eeprom.cpp
// AUTHOR: Rob Tillaart
// VERSION: 1.2.03
// VERSION: 1.2.4
// PURPOSE: I2C_eeprom library for Arduino with EEPROM 24LC256 et al.
//
// HISTORY:
@ -24,6 +24,7 @@
// 1.2.01 - 2014-05-21 Refactoring
// 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
//
// Released to the public domain
//
@ -241,10 +242,10 @@ uint8_t I2C_eeprom::_ReadBlock(const uint16_t memoryAddress, uint8_t* buffer, co
Wire.requestFrom(_deviceAddress, length);
uint8_t cnt = 0;
uint32_t before = millis();
while ((cnt < length) && ((millis() - before) < I2C_EEPROM_TIMEOUT))
uint8_t n = Wire.available();
while ((cnt < n) && (cnt < length))
{
if (Wire.available()) buffer[cnt++] = WIRE_READ();
buffer[cnt++] = WIRE_READ();
}
return cnt;
}

View File

@ -4,14 +4,14 @@
// FILE: I2C_eeprom.h
// AUTHOR: Rob Tillaart
// PURPOSE: I2C_eeprom library for Arduino with EEPROM 24LC256 et al.
// VERSION: 1.2.03
// VERSION: 1.2.4
// HISTORY: See I2C_eeprom.cpp
// URL: http://arduino.cc/playground/Main/LibraryForI2CEEPROM
//
// Released to the public domain
//
#include <Wire.h>
#include "Wire.h"
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
@ -21,7 +21,7 @@
#include "Wiring.h"
#endif
#define I2C_EEPROM_VERSION "1.2.03"
#define I2C_EEPROM_VERSION "1.2.4"
// 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
@ -32,9 +32,6 @@
// 1 byte for eeprom register address is available in txbuffer
#define I2C_TWIBUFFERSIZE 30
// to break blocking read/write after n millis()
#define I2C_EEPROM_TIMEOUT 1000
// comment next line to keep lib small (idea a read only lib?)
#define I2C_EEPROM_EXTENDED

View File

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