- fix #55 ==> redo fix #53
  - add test to detect **MBED** and **RP2040**
- adjust **I2C_BUFFERSIZE** for RP2040 to 128.
- update readme.md
This commit is contained in:
Rob Tillaart
2023-05-11 12:26:57 +02:00
committed by GitHub
parent c4400ea101
commit a13ec203ef
6 changed files with 37 additions and 16 deletions
+9 -1
View File
@@ -6,13 +6,19 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## [1.7.3] - 2023-05-10
- fix #55 ==> redo fix #53
- add test to detect **MBED** and **RP2040**
- adjust **I2C_BUFFERSIZE** for RP2040 to 128.
- update readme.md
## [1.7.2] - 2023-05-02
- fix #53 support RP2040 (kudos to jotamachuca)
- move code from .h to .cpp
- make I2C_WRITEDELAY overridable
- minor edits
## [1.7.1] - 2023-01-12
- add setDeviceSize()
- add setPageSize()
@@ -26,6 +32,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
## [1.7.0] - 2022-12-02
- fix #48 rewrote constructor.
----
## [1.6.2] - 2022-10-30
- Add RP2040 support to build-CI.
- Add CHANGELOG.md
+11 -10
View File
@@ -1,7 +1,7 @@
//
// FILE: I2C_eeprom.cpp
// AUTHOR: Rob Tillaart
// VERSION: 1.7.2
// VERSION: 1.7.3
// PURPOSE: Arduino Library for external I2C EEPROM 24LC256 et al.
// URL: https://github.com/RobTillaart/I2C_EEPROM.git
@@ -24,7 +24,7 @@
// I2C buffer needs max 2 bytes for EEPROM address
// 1 byte for EEPROM register address is available in transmit buffer
#if defined(ESP32) || defined(ESP8266)
#if defined(ESP32) || defined(ESP8266) || defined(PICO_RP2040)
#define I2C_BUFFERSIZE 128
#else
#define I2C_BUFFERSIZE 30 // AVR, STM
@@ -43,17 +43,18 @@ I2C_eeprom::I2C_eeprom(const uint8_t deviceAddress, TwoWire * wire) :
I2C_eeprom::I2C_eeprom(const uint8_t deviceAddress, const uint32_t deviceSize, TwoWire * wire)
{
_deviceAddress = deviceAddress;
_deviceSize = setDeviceSize(deviceSize);
_pageSize = getPageSize(_deviceSize);
_wire = wire;
_deviceAddress = deviceAddress;
_deviceSize = setDeviceSize(deviceSize);
_pageSize = getPageSize(_deviceSize);
_wire = wire;
// Chips 16 Kbit (2048 Bytes) or smaller only have one-word addresses.
this->_isAddressSizeTwoWords = deviceSize > I2C_DEVICESIZE_24LC16;
// Chips 16 Kbit (2048 Bytes) or smaller only have one-word addresses.
this->_isAddressSizeTwoWords = deviceSize > I2C_DEVICESIZE_24LC16;
}
#if defined(ESP8266) || defined(ESP32)
bool I2C_eeprom::begin(uint8_t sda, uint8_t scl)
{
// if (_wire == 0) Serial.println("zero"); // test #48
@@ -68,10 +69,9 @@ bool I2C_eeprom::begin(uint8_t sda, uint8_t scl)
_lastWrite = 0;
return isConnected();
}
#endif
#elif defined(ARDUINO_ARCH_RP2040) && !defined(__MBED__)
#if defined(PICO_RP2040)
bool I2C_eeprom::begin(uint8_t sda, uint8_t scl)
{
if ((sda < 255) && (scl < 255))
@@ -83,6 +83,7 @@ bool I2C_eeprom::begin(uint8_t sda, uint8_t scl)
_lastWrite = 0;
return isConnected();
}
#endif
+5 -3
View File
@@ -2,7 +2,7 @@
//
// FILE: I2C_eeprom.h
// AUTHOR: Rob Tillaart
// VERSION: 1.7.2
// VERSION: 1.7.3
// PURPOSE: Arduino Library for external I2C EEPROM 24LC256 et al.
// URL: https://github.com/RobTillaart/I2C_EEPROM.git
@@ -11,7 +11,7 @@
#include "Wire.h"
#define I2C_EEPROM_VERSION (F("1.7.2"))
#define I2C_EEPROM_VERSION (F("1.7.3"))
#define I2C_DEVICESIZE_24LC512 65536
@@ -59,7 +59,9 @@ public:
*/
I2C_eeprom(const uint8_t deviceAddress, const uint32_t deviceSize, TwoWire *wire = &Wire);
#if defined(ESP8266) || defined(ESP32) || defined(PICO_RP2040)
// MBED test ==> see #55, #53
#if defined(ESP8266) || defined(ESP32) || (defined(ARDUINO_ARCH_RP2040) && !defined(__MBED__))
// set the I2C pins explicitly (overrule)
bool begin(uint8_t sda, uint8_t scl);
#endif
+10
View File
@@ -20,6 +20,16 @@ MicroChip 24LC512, 24LC256, 24LC64, 24LC32, 24LC16, 24LC08, 24LC04, 24LC02, 24LC
The **I2C_eeprom_cyclic_store** interface is documented [here](README_cyclic_store.md)
#### RP2040
There are at least two boards modules for the RP2040 that use a different Wire libraries.
One from "Earle F. Philhower" and an "MBED" one. See issues #53 and #55 for details.
In 1.7.3 defines are checked to select between these two and as far as tested this seems
to solve the issue #53 while being backwards compatible.
If a better solution is found, it will be implemented.
#### Links
- https://github.com/RobTillaart/I2C_24LC1025
+1 -1
View File
@@ -15,7 +15,7 @@
"type": "git",
"url": "https://github.com/RobTillaart/I2C_EEPROM.git"
},
"version": "1.7.2",
"version": "1.7.3",
"license": "MIT",
"frameworks": "arduino",
"platforms": "*",
+1 -1
View File
@@ -1,5 +1,5 @@
name=I2C_EEPROM
version=1.7.2
version=1.7.3
author=Rob Tillaart <rob.tillaart@gmail.com>
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
sentence=Library for I2C EEPROMS