Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5d873c0

Browse filesBrowse files
authored
Add conditional compilation for second I2C interface based on SOC_I2C_NUM (#10408)
The ESP32, ESP32-S and ESP32-H series have two I2C interfaces, while the ESP32-C series has only one.
1 parent 733373a commit 5d873c0
Copy full SHA for 5d873c0

File tree

2 files changed

+4
-0
lines changed
Filter options

2 files changed

+4
-0
lines changed

‎libraries/Wire/src/Wire.cpp

Copy file name to clipboardExpand all lines: libraries/Wire/src/Wire.cpp
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,8 @@ void TwoWire::onRequestService(uint8_t num, void *arg) {
646646
#endif /* SOC_I2C_SUPPORT_SLAVE */
647647

648648
TwoWire Wire = TwoWire(0);
649+
#if SOC_I2C_NUM > 1
649650
TwoWire Wire1 = TwoWire(1);
651+
#endif /* SOC_I2C_NUM */
650652

651653
#endif /* SOC_I2C_SUPPORTED */

‎libraries/Wire/src/Wire.h

Copy file name to clipboardExpand all lines: libraries/Wire/src/Wire.h
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,9 @@ class TwoWire : public HardwareI2C {
144144
};
145145

146146
extern TwoWire Wire;
147+
#if SOC_I2C_NUM > 1
147148
extern TwoWire Wire1;
149+
#endif /* SOC_I2C_NUM */
148150

149151
#endif /* SOC_I2C_SUPPORTED */
150152
#endif /* TwoWire_h */

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.