From 9001ab38c74ac0955003a9308e49ce5c7791c842 Mon Sep 17 00:00:00 2001 From: Rob Tillaart Date: Thu, 4 Aug 2022 13:08:29 +0200 Subject: [PATCH] fix build (#45) --- README.md | 15 +++++++++++++++ .../I2C_eeprom_updateBlock.ino | 6 +++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e8c25a6..8a50d84 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,21 @@ MicroChip 24LC512, 24LC256, 24LC64, 24LC32, 24LC16, 24LC08, 24LC04, 24LC02, 24LC The **I2C_eeprom_cyclic_store** interface is documented [here](README_cyclic_store.md) +## Schematic + +```cpp + +---U---+ + A0 | 1 8 | VCC = +5V + A1 | 2 7 | WP = write protect pin + A2 | 3 6 | SCL = I2C clock + GND | 4 5 | SDA = I2C data + +-------+ + +default address = 0x50 .. 0x57 depending on three address lines + +``` + + ## Interface The interface is kept quite identical to the I2C_24LC1025 library. diff --git a/examples/I2C_eeprom_updateBlock/I2C_eeprom_updateBlock.ino b/examples/I2C_eeprom_updateBlock/I2C_eeprom_updateBlock.ino index 7d64dee..8426b5e 100644 --- a/examples/I2C_eeprom_updateBlock/I2C_eeprom_updateBlock.ino +++ b/examples/I2C_eeprom_updateBlock/I2C_eeprom_updateBlock.ino @@ -129,7 +129,11 @@ void dump(uint32_t from, uint32_t to) { char buffer[24]; Serial.print('\n'); - sprintf(buffer, "%08lX\t", i); +#if defined (ESP8266) || defined(ESP32) + sprintf(buffer, "%08X\t", i); // ESP cast (long unsigned int) +#else + sprintf(buffer, "%08lX\t", i); // AVR needs lX +#endif; Serial.print(buffer); } sprintf(buffer, "%02X\t", ee.readByte(i));