Skip to content

Commit fb7cb37

Browse files
authored
Merge pull request #5235 from tonhuisman/feature/I2C-multiple-interfaces-support
[I2C] Add support for multiple I2C buses
2 parents 60a0ce3 + 2d6c0ed commit fb7cb37

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+1519
-452
lines changed

Diff for: docs/source/Hardware/Device_I2CBusSelection.png

12.6 KB
Loading

Diff for: docs/source/Hardware/Device_I2CBusSelection3.png

17.7 KB
Loading
12.9 KB
Loading

Diff for: docs/source/Hardware/Hardware.rst

+69-7
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,27 @@ This feature can be useful in a development/laboratory environment, for when the
3434

3535

3636
-------------
37-
I2C Interface
37+
I2C Bus
3838
-------------
3939

4040
When using devices that use the I2C bus (Inter-integrated circuit, also known as IIC, and mostly compatible with SM Bus) (`Wikipedia: I2C <https://en.wikipedia.org/wiki/I%C2%B2C>`_) some pins have to be configured, and initialized during boot, for the SDA and SCL connections. This can be any unused pair of pins on the ESP board.
4141

42-
The pins can be configured here, and will have default values initially (ESP8266: SDA: GPIO-4 (D2), SCL: GPIO-5 (D3), ESP32: SDA: GPIO-22, SCL: GPIO-23). When I2C is not used, these can be set to `- None -`, so the pins are available for other purposes.
42+
The pins can be configured here, and will have default values initially (ESP8266: SDA: GPIO-4 (D2), SCL: GPIO-5 (D3), ESP32: No defaults). When I2C is not used, these can be set to `- None -`, so the pins are available for other purposes.
4343

44-
When having an I2C Priority task configured, the I2C GPIO pins can no longer be changed, as that could disable the hardware, thus blocking the device. The configured GPIO pins will be display-only.
44+
When having an I2C Priority task configured, the I2C GPIO pins (for that bus, when multiple buses are available) can no longer be changed, as that could disable the hardware, thus blocking the device. The configured GPIO pins will be display-only.
4545

46-
The default bus clock speed can also be set here. If only devices supporting 100 kHz are connected (Old/Slow devices), then the value can be set to 100 kHz, by default 400 kHz is configured, that is supported by newer devices, though there are many devices supporting higher frequencies. ESP8266 is able to achieve ca. 400 kHz, while ESP32 allows much higher speeds.
46+
The default bus clock speed can also be set here. If only devices supporting 100 kHz are connected (Old/Slow devices), then the value can be set to 100 kHz, by default 400 kHz is configured, that is supported by newer devices, though there are many devices supporting higher frequencies. ESP8266 is able to achieve ca. 400 kHz, while ESP32 allows higher speeds.
4747

48-
ESPEasy has a separate setting for Slow I2C devices, and per I2C device this slow clock speed can be selected in the Device edit page. This value is by default set to 100 kHz, but can be set lower or higher if desired.
48+
ESPEasy has a separate setting for Slow I2C devices, and per I2C device this slow clock speed can be selected in the Device configuration page. This value is by default set to 100 kHz, but can be set lower or higher if desired.
4949

50-
.. image:: Hardware_I2CInterface.png
50+
*I2C ClockStretchLimit*
51+
52+
- `I2C-bus.org - Clock Stretching <https://www.i2c-bus.org/clock-stretching/>`_
53+
- `ESPeasy wiki - Basics: The I2C Bus <https://www.letscontrolit.com/wiki/index.php/Basics:_The_I%C2%B2C_Bus>`_
54+
55+
This setting is only available for the first I2C Bus, as not many devices (should) need this set, and the devices that do need this should then be connected to I2C Bus 1.
56+
57+
.. image:: Hardware_I2CBus.png
5158

5259
*Device specific Force Slow I2C speed selection:*
5360

@@ -57,6 +64,36 @@ Added: 2023-11-23
5764

5865
A device flag has been added for specific devices to have **Force Slow I2C speed** set by default. After adding the device this option will be checked, but can still be unchecked to use (try) Fast I2C speed (400 kHz).
5966

67+
Added: 2025-02-02
68+
69+
Multiple I2C Buses can be configured on ESP32 builds. This aids in connecting all on-board sensors and devices when multiple GPIO pin-pairs are used for I2C devices. By default, 2 I2C Buses are made available, but via compile-time options, a 3rd I2C Bus can be enabled, if required.
70+
71+
.. image:: Hardware_I2CBus2.png
72+
73+
The available options are the same as for the first I2C Bus.
74+
75+
If a second (or third) I2C Bus are not needed, then leave the GPIO settings on ``- None -``, and the interface won't be initialized, and not shown in the configuration options.
76+
77+
NB: The I2C Buses should of course not be configured for the same GPIO pins as any other I2C Bus.
78+
79+
NB2: Some boards require that in the Serial Console Settings (Tools/Advanced), the ``Fall-back to Serial 0`` option is disabled, to free the GPIO pins for I2C use.
80+
81+
When multiple I2C Buses are configured (so, ``SDA`` and ``SCL`` GPIO-pins configured), each task configured with an I2C device will show a selection for the I2C Bus to use. As expected, the first I2C Bus is selected by default, and another interface can be selected as required.
82+
83+
*Device specific I2C Bus selection:*
84+
85+
.. image:: Device_I2CBusSelection.png
86+
87+
NB: If a multiplexer is configured for 1 of the I2C Buses (but *not* for all interfaces), the I2C Bus selector will save & reload the page to show/hide the multiplexer options, below.
88+
89+
.. image:: Device_I2CBusSelectionReload.png
90+
91+
This screenshot shows the reload icon, to indicate that changing the selection will reload the page.
92+
93+
.. image:: Device_I2CBusSelection3.png
94+
95+
And an example for when 3 I2C Buses are available (compile-time option!) and configured.
96+
6097
---------------
6198
I2C Multiplexer
6299
---------------
@@ -106,10 +143,18 @@ All these chips/boards can be found at Adafruit, Aliexpress, Banggood, EBay, etc
106143
.. image:: Hardware_I2CMultiplexer_Address.png
107144

108145

146+
Added: 2025-02-02
147+
148+
With the introduction of multiple I2C Buses, it is also plausible to configure an I2C Multiplexer on the second (or third, when included in the build) I2C Bus.
149+
150+
.. image:: Hardware_I2CMultiplexer2.png
151+
152+
This allows the same configuration options as shown above for the first I2C Bus, as all I2C Buses are completely independent from each other.
153+
109154
Device configuration
110155
^^^^^^^^^^^^^^^^^^^^
111156

112-
If an I2C multiplexer is configured, every Device edit page for I2C devices will show extra options to select the channel the device is connected on.
157+
If an I2C multiplexer is configured for the selected I2C Bus, the Device edit page for I2C devices will show extra options to select the multiplexer channel the device is connected on.
113158

114159
There is the default option of Single channel, or, when a TCA9548a, TCA9546a or TCA9543a is configured, Multiple channels.
115160

@@ -136,6 +181,23 @@ Above configuration results in channels 0, 4, 5, 6 and 7 being connected to the
136181
NB: Only acceptable channel checkboxes (0-7/0-3/0-1) will be shown, depending on the Multiplexer type configured.
137182

138183

184+
--------------------
185+
PCF & MCP Direct I/O
186+
--------------------
187+
188+
Added: 2025-02-02
189+
190+
For interacting with the PCF8574 or MCP23017 GPIO Extenders no Device Task is required, so no I2C Bus configuration is available.
191+
192+
When multiple I2C Buses are configured (ESP32 only), we need some configuration to overcome that situation, to avoid having to connect these I/O extenders on the first I2C Bus.
193+
194+
.. image:: Hardware_PCFMCP_I2CSelector.png
195+
196+
When using multiple PCF and/or MCP GPIO extenders, they must all be connected to this I2C Bus, and any Device Tasks should also use the same I2C Bus.
197+
198+
NB: If only 1 I2C Bus is configured, this section isn't shown.
199+
200+
139201
-------------
140202
SPI Interface
141203
-------------

Diff for: docs/source/Hardware/Hardware_I2CBus.png

12.7 KB
Loading

Diff for: docs/source/Hardware/Hardware_I2CBus2.png

10.6 KB
Loading

Diff for: docs/source/Hardware/Hardware_I2CInterface.png

-10.3 KB
Binary file not shown.

Diff for: docs/source/Hardware/Hardware_I2CMultiplexer2.png

10.3 KB
Loading

Diff for: docs/source/Hardware/Hardware_PCFMCP_I2CSelector.png

2.8 KB
Loading

Diff for: docs/source/Tools/Tools.rst

+29-7
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,15 @@ This allows ESPEasy to know the correct date and time after been powered off for
273273

274274
N.B. these modules all use I2C, so they need to be connected to the configured I2C pins and those pins should be set.
275275

276+
Added: 2025-02-02
277+
278+
When multiple I2C Buses are configured (ESP32 only), we need to configure on which I2C Bus the RTC chip is connected:
279+
280+
.. image:: images/Tools_RTC_I2CSelector.png
281+
282+
NB: If only 1 I2C Bus is configured, this configuration option isn't shown.
283+
284+
276285
Procedure to configure a real time clock (RTC) chip:
277286
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
278287

@@ -397,18 +406,21 @@ like subnet mask / gateway / DNS, it may still be useful.
397406
This allows a somewhat static IP in your network (N.B. use it with an 'octet' outside the range of the DHCP IPs) while still having set to DHCP.
398407
So if you take the node to another network which does use 192.168.52.x then you will know it will be on 192.168.52.10 (when setting this value to "10")
399408

400-
I2C ClockStretchLimit
401-
^^^^^^^^^^^^^^^^^^^^^
402-
403-
- `I2C-bus.org - Clock Stretching <https://www.i2c-bus.org/clock-stretching/>`_
404-
- `ESPeasy wiki - Basics: The I2C Bus <https://www.letscontrolit.com/wiki/index.php/Basics:_The_I%C2%B2C_Bus>`_
405-
406409
WD I2C Address
407410
^^^^^^^^^^^^^^
408411

409412
The Watchdog timer can be accessed via I2C.
410413
What can be read/set/changed must still be documented.
411414

415+
Added: 2025-02-02
416+
417+
When multiple I2C Buses are configured (ESP32 only), we need to configure on which I2C Bus the Watchdog chip is connected:
418+
419+
.. image:: images/Tools_WD_I2CSelector.png
420+
421+
NB: If only 1 I2C Bus is configured, this configuration option isn't shown.
422+
423+
412424
JSON bool output without quotes
413425
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
414426

@@ -936,7 +948,7 @@ Interfaces
936948
I2C Scan
937949
========
938950

939-
To verify if any connected I2C devices are properly detected by the ESP, the I2C Scan is available. This will scan the I2C bus, and, when configured, the additional busses provided via an I2C multiplexer, for available devices.
951+
To verify if any connected I2C devices are properly detected by the ESP, the I2C Scan is available. This will scan the I2C bus, and, when configured, the additional buses/channels provided via an I2C multiplexer, for available devices.
940952

941953
The scan is performed if the I2C ``SDA`` and ``SCL`` GPIO pins are configured on the Hardware page, and will use the configured ``Slow device Clock Speed`` setting (default: 100 kHz) during the scan, as that should be supported by any I2C device available.
942954

@@ -950,9 +962,19 @@ Example scan using an I2C multiplexer, showing multiple devices across multiple
950962

951963
.. image:: images/Tools_I2Cscan_multiplexer.png
952964

965+
Added: 2025-02-02
966+
967+
When having multiple I2C Buses configured, for each configured interface an I2C Scan is performed, including the multiplexer if that's configured.
968+
969+
An example: (No actual multiplexer connected...)
970+
971+
.. image:: images/Tools_I2Cscan_multipleBuses.png
972+
973+
|
953974
954975
.. note:: On builds that have ``LIMIT_BUILD_SIZE`` set, like the ESP8266 Collection and Display builds, the names of the supported devices and plugins are **not** included in the output, only the address(es) are listed.
955976

977+
|
956978
957979
Settings
958980
********
68.8 KB
Loading

Diff for: docs/source/Tools/images/Tools_RTC_I2CSelector.png

3.96 KB
Loading

Diff for: docs/source/Tools/images/Tools_WD_I2CSelector.png

3.74 KB
Loading

Diff for: lib/RN2483-Arduino-Library/examples/SodaqOne-TTN-Mapper-ascii/Sodaq_UBlox_GPS.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ void Sodaq_UBlox_GPS::resetValues()
8282
void Sodaq_UBlox_GPS::init(int8_t enable_pin)
8383
{
8484
_enablePin = enable_pin;
85-
Wire.begin();
85+
// Wire.begin(); ESPEasy has already taken care of this
8686
digitalWrite(_enablePin, GPS_ENABLE_OFF);
8787
pinMode(_enablePin, OUTPUT);
8888
}

Diff for: lib/RN2483-Arduino-Library/examples/SodaqOne-TTN-Mapper-binary/Sodaq_UBlox_GPS.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ void Sodaq_UBlox_GPS::resetValues()
8282
void Sodaq_UBlox_GPS::init(int8_t enable_pin)
8383
{
8484
_enablePin = enable_pin;
85-
Wire.begin();
85+
// Wire.begin(); ESPEasy has already taken care of this
8686
digitalWrite(_enablePin, GPS_ENABLE_OFF);
8787
pinMode(_enablePin, OUTPUT);
8888
}

Diff for: lib/SparkFun_ADXL345_Arduino_Library/src/SparkFun_ADXL345.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ ADXL345::ADXL345(int CS) {
5555
}
5656

5757
void ADXL345::powerOn() {
58-
if (I2C) {
59-
Wire.begin(); // If in I2C Mode Only
60-
}
58+
// if (I2C) {
59+
// Wire.begin(); // If in I2C Mode Only ESPEasy has already taken care of this
60+
// }
6161

6262
// ADXL345 TURN ON
6363
writeTo(ADXL345_POWER_CTL, 0); // Wakeup

Diff for: lib/esp8266-oled-ssd1306/SH1106Wire.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
_scl(scl) {}
99

1010
bool SH1106Wire::connect() {
11-
Wire.begin(this->_sda, this->_scl);
11+
// Wire.begin(this->_sda, this->_scl); // ESPEasy already has Wire initialized properly
1212
return true;
1313
}
1414

Diff for: lib/esp8266-oled-ssd1306/SSD1306Wire.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
}
99

1010
bool SSD1306Wire::connect() {
11-
Wire.begin(this->_sda, this->_scl);
11+
// Wire.begin(this->_sda, this->_scl); // ESPEasy already has Wire initialized properly
1212
return true;
1313
}
1414

Diff for: src/Custom-sample.h

+4
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@
120120
#ifdef ESP32
121121
#define DEFAULT_PIN_I2C_SCL -1 // Undefined
122122
#endif
123+
#define DEFAULT_PIN_I2C2_SDA -1 // Undefined
124+
#define DEFAULT_PIN_I2C3_SDA -1 // Undefined
125+
#define DEFAULT_PIN_I2C2_SCL -1 // Undefined
126+
#define DEFAULT_PIN_I2C3_SCL -1 // Undefined
123127
#define DEFAULT_I2C_CLOCK_SPEED 400000 // Use 100 kHz if working with old I2C chips
124128
#define FEATURE_I2C_DEVICE_SCAN 1
125129

Diff for: src/_P017_PN532.ino

+7-2
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,13 @@ bool P017_handle_timer_in(struct EventStruct *event)
242242
# endif // ifdef P017_DEBUG_LOGIC_ANALYZER_PIN
243243

244244
// TODO: Clock stretching issue https://github.com/esp8266/Arduino/issues/1541
245-
if (Settings.isI2CEnabled()
246-
&& ((DIRECT_pinRead(Settings.Pin_i2c_sda) == 0) || (DIRECT_pinRead(Settings.Pin_i2c_scl) == 0)))
245+
#if FEATURE_I2C_MULTIPLE
246+
const uint8_t i2cBus = Settings.getI2CInterface(event->TaskIndex);
247+
#else
248+
const uint8_t i2cBus = 0;
249+
#endif // if FEATURE_I2C_MULTIPLE
250+
if (Settings.isI2CEnabled(i2cBus)
251+
&& ((DIRECT_pinRead(Settings.getI2CSdaPin(i2cBus)) == 0) || (DIRECT_pinRead(Settings.getI2CSclPin(i2cBus)) == 0)))
247252
{
248253
addLog(LOG_LEVEL_ERROR, F("PN532: BUS error"));
249254
Plugin_017_Init(CONFIG_PIN3);

Diff for: src/_P036_FrameOLED.ino

+7-2
Original file line numberDiff line numberDiff line change
@@ -750,12 +750,17 @@ boolean Plugin_036(uint8_t function, struct EventStruct *event, String& string)
750750
P036_CheckHeap(F("_INIT: Before P036_data->init()"));
751751
# endif // P036_CHECK_HEAP
752752

753+
#if FEATURE_I2C_MULTIPLE
754+
const uint8_t i2cBus = Settings.getI2CInterface(event->TaskIndex);
755+
#else
756+
const uint8_t i2cBus = 0;
757+
#endif // if FEATURE_I2C_MULTIPLE
753758
if (!(P036_data->init(event->TaskIndex,
754759
get4BitFromUL(P036_FLAGS_0, P036_FLAG_SETTINGS_VERSION), // Bit23-20 Version CustomTaskSettings
755760
P036_CONTROLLER, // Type
756761
P036_ADR, // I2C address
757-
Settings.Pin_i2c_sda,
758-
Settings.Pin_i2c_scl,
762+
Settings.getI2CSdaPin(i2cBus),
763+
Settings.getI2CSclPin(i2cBus),
759764
static_cast<p036_resolution>(P036_RESOLUTION), // OLED index
760765
(P036_ROTATE == 2), // 1 = Normal, 2 = Rotated
761766
P036_CONTRAST,

Diff for: src/_P139_AXP2101.ino

+13-16
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
/**
1111
* Changelog:
12+
* 2025-03-15 tonhuisman: Removed unneeded I2C Enabled check.
1213
* 2025-01-18 tonhuisman: Enable writing values to chip.
1314
* 2024-02-25 tonhuisman: Add I2C-enabled check on plugin startup, implement FsP macro
1415
* 2024-02-21 tonhuisman: Add support for ChipID and ChargingDetail data supplied by AXP2101
@@ -257,23 +258,19 @@ boolean Plugin_139(uint8_t function, struct EventStruct *event, String& string)
257258

258259
case PLUGIN_INIT:
259260
{
260-
if (Settings.isI2CEnabled()) {
261-
P139_data_struct *P139_init = static_cast<P139_data_struct *>(getPluginTaskData(event->TaskIndex));
262-
263-
if (nullptr != P139_init) {
264-
# ifndef BUILD_NO_DEBUG
265-
addLogMove(LOG_LEVEL_INFO, F("P139: Already initialized, skipped."));
266-
# endif // ifndef BUILD_NO_DEBUG
267-
// has been initialized so nothing to do here
268-
success = true; // Still was successful (to keep plugin enabled!)
269-
} else {
270-
# ifndef BUILD_NO_DEBUG
271-
addLogMove(LOG_LEVEL_DEBUG, F("P139: PLUGIN_INIT"));
272-
# endif // ifndef BUILD_NO_DEBUG
273-
success = initPluginTaskData(event->TaskIndex, new (std::nothrow) P139_data_struct(event));
274-
}
261+
P139_data_struct *P139_init = static_cast<P139_data_struct *>(getPluginTaskData(event->TaskIndex));
262+
263+
if (nullptr != P139_init) {
264+
# ifndef BUILD_NO_DEBUG
265+
addLogMove(LOG_LEVEL_INFO, F("P139: Already initialized, skipped."));
266+
# endif // ifndef BUILD_NO_DEBUG
267+
// has been initialized so nothing to do here
268+
success = true; // Still was successful (to keep plugin enabled!)
275269
} else {
276-
addLog(LOG_LEVEL_ERROR, F("AXP2101: I2C not enabled, initialization failed!"));
270+
# ifndef BUILD_NO_DEBUG
271+
addLogMove(LOG_LEVEL_DEBUG, F("P139: PLUGIN_INIT"));
272+
# endif // ifndef BUILD_NO_DEBUG
273+
success = initPluginTaskData(event->TaskIndex, new (std::nothrow) P139_data_struct(event));
277274
}
278275

279276
break;

Diff for: src/_P166_GP8403.ino

+6-9
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
// #######################################################################################################
77

88
/** Changelog:
9+
* 2025-03-15 tonhuisman: Removed unneeded I2C Enabled check.
910
* 2024-01-29 tonhuisman: Fix bug that changed Initial output values are not applied until a reset/power cycle.
1011
* Disable development-log at Settings Save
1112
* 2024-01-28 tonhuisman: Add option to restore output values on warm boot (default enabled, using unused 4th value for state)
@@ -214,16 +215,12 @@ boolean Plugin_166(uint8_t function, struct EventStruct *event, String& string)
214215

215216
case PLUGIN_INIT:
216217
{
217-
if (Settings.isI2CEnabled()) {
218-
initPluginTaskData(event->TaskIndex,
219-
new (std::nothrow) P166_data_struct(P166_I2C_ADDRESS,
220-
static_cast<DFRobot_GP8403::eOutPutRange_t>(P166_MAX_VOLTAGE)));
221-
P166_data_struct *P166_data = static_cast<P166_data_struct *>(getPluginTaskData(event->TaskIndex));
218+
initPluginTaskData(event->TaskIndex,
219+
new (std::nothrow) P166_data_struct(P166_I2C_ADDRESS,
220+
static_cast<DFRobot_GP8403::eOutPutRange_t>(P166_MAX_VOLTAGE)));
221+
P166_data_struct *P166_data = static_cast<P166_data_struct *>(getPluginTaskData(event->TaskIndex));
222222

223-
success = (nullptr != P166_data) && P166_data->init(event);
224-
} else {
225-
addLog(LOG_LEVEL_ERROR, F("GP8403: I2C not enabled, init cancelled."));
226-
}
223+
success = (nullptr != P166_data) && P166_data->init(event);
227224

228225
break;
229226
}

Diff for: src/src/Commands/GPIO.cpp

+16
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@
1818
#include "../Helpers/PortStatus.h"
1919
#include "../Helpers/Numerical.h"
2020

21+
#if FEATURE_I2C_MULTIPLE
22+
#include "../Globals/Settings.h"
23+
#include "../Helpers/Hardware_device_info.h"
24+
#include "../Helpers/I2C_access.h"
25+
#endif // if FEATURE_I2C_MULTIPLE
26+
2127
#if FEATURE_GPIO_USE_ESP8266_WAVEFORM
2228
# include <core_esp8266_waveform.h>
2329
#endif
@@ -1216,6 +1222,11 @@ bool getGPIOPinStateValues(String& str) {
12161222
#if FEATURE_PINSTATE_EXTENDED
12171223
pluginID = PLUGIN_MCP;
12181224
#endif // if FEATURE_PINSTATE_EXTENDED
1225+
#if FEATURE_I2C_MULTIPLE
1226+
if (getI2CBusCount() > 1) {
1227+
I2CSelectHighClockSpeed(Settings.getI2CInterfacePCFMCP());
1228+
}
1229+
#endif // if FEATURE_I2C_MULTIPLE
12191230
str = GPIO_MCP_Read(par1);
12201231
#ifndef BUILD_NO_DEBUG
12211232
logPrefix = F("MCP");
@@ -1229,6 +1240,11 @@ bool getGPIOPinStateValues(String& str) {
12291240
#if FEATURE_PINSTATE_EXTENDED
12301241
pluginID = PLUGIN_PCF;
12311242
#endif // if FEATURE_PINSTATE_EXTENDED
1243+
#if FEATURE_I2C_MULTIPLE
1244+
if (getI2CBusCount() > 1) {
1245+
I2CSelectHighClockSpeed(Settings.getI2CInterfacePCFMCP());
1246+
}
1247+
#endif // if FEATURE_I2C_MULTIPLE
12321248
str = GPIO_PCF_Read(par1);
12331249
#ifndef BUILD_NO_DEBUG
12341250
logPrefix = F("PCF");

0 commit comments

Comments
 (0)