From 4915b9a570d968d9bb0c0ab15db03a90e50556b2 Mon Sep 17 00:00:00 2001 From: Hutch67 Date: Sat, 26 Dec 2020 19:40:07 +0100 Subject: [PATCH 1/3] Update SparkFun_External_EEPROM.cpp --- src/SparkFun_External_EEPROM.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SparkFun_External_EEPROM.cpp b/src/SparkFun_External_EEPROM.cpp index 2409f37..74df9c5 100644 --- a/src/SparkFun_External_EEPROM.cpp +++ b/src/SparkFun_External_EEPROM.cpp @@ -221,7 +221,7 @@ void ExternalEEPROM::write(uint32_t eepromLocation, const uint8_t *dataToWrite, } //See if EEPROM is available or still writing a previous request - while (isBusy(i2cAddress) == true) //Poll device + while (settings.pollForWriteComplete && isBusy(i2cAddress) == true) //Poll device delayMicroseconds(100); //This shortens the amount of time waiting between writes but hammers the I2C bus settings.i2cPort->beginTransmission(i2cAddress); From 8dd4637c0a2bf1cc2a0afe6a54b6eb3952417287 Mon Sep 17 00:00:00 2001 From: Hutch67 Date: Sat, 26 Dec 2020 20:55:49 +0100 Subject: [PATCH 2/3] only pollForWriteComplete if requested by settings --- src/SparkFun_External_EEPROM.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SparkFun_External_EEPROM.cpp b/src/SparkFun_External_EEPROM.cpp index 74df9c5..27567fc 100644 --- a/src/SparkFun_External_EEPROM.cpp +++ b/src/SparkFun_External_EEPROM.cpp @@ -157,7 +157,7 @@ void ExternalEEPROM::read(uint32_t eepromLocation, uint8_t *buff, uint16_t buffe } //See if EEPROM is available or still writing a previous request - while (isBusy(i2cAddress) == true) //Poll device + while (settings.pollForWriteComplete && isBusy(i2cAddress) == true) //Poll device delayMicroseconds(100); //This shortens the amount of time waiting between writes but hammers the I2C bus settings.i2cPort->beginTransmission(i2cAddress); From bc20019a86e681796eabd28a979762871aedb5a1 Mon Sep 17 00:00:00 2001 From: Hutch67 Date: Sat, 26 Dec 2020 21:17:19 +0100 Subject: [PATCH 3/3] define I2C buffer size for ESP32 --- src/SparkFun_External_EEPROM.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/SparkFun_External_EEPROM.h b/src/SparkFun_External_EEPROM.h index 7f80ad5..52ef67b 100644 --- a/src/SparkFun_External_EEPROM.h +++ b/src/SparkFun_External_EEPROM.h @@ -49,6 +49,11 @@ #define I2C_BUFFER_LENGTH_RX BUFFER_LENGTH //Teensy #define I2C_BUFFER_LENGTH_TX BUFFER_LENGTH +#elif defined(ESP32) + +#define I2C_BUFFER_LENGTH_RX I2C_BUFFER_LENGTH +#define I2C_BUFFER_LENGTH_TX I2C_BUFFER_LENGTH + #else #pragma GCC error "This platform doesn't have a wire buffer size defined. Please contribute to this library!"