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.
This commit is contained in:
sivar2311 2024-10-04 12:49:55 +02:00 committed by GitHub
parent 733373a049
commit 5d873c0787
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 0 deletions

View file

@ -646,6 +646,8 @@ void TwoWire::onRequestService(uint8_t num, void *arg) {
#endif /* SOC_I2C_SUPPORT_SLAVE */ #endif /* SOC_I2C_SUPPORT_SLAVE */
TwoWire Wire = TwoWire(0); TwoWire Wire = TwoWire(0);
#if SOC_I2C_NUM > 1
TwoWire Wire1 = TwoWire(1); TwoWire Wire1 = TwoWire(1);
#endif /* SOC_I2C_NUM */
#endif /* SOC_I2C_SUPPORTED */ #endif /* SOC_I2C_SUPPORTED */

View file

@ -144,7 +144,9 @@ public:
}; };
extern TwoWire Wire; extern TwoWire Wire;
#if SOC_I2C_NUM > 1
extern TwoWire Wire1; extern TwoWire Wire1;
#endif /* SOC_I2C_NUM */
#endif /* SOC_I2C_SUPPORTED */ #endif /* SOC_I2C_SUPPORTED */
#endif /* TwoWire_h */ #endif /* TwoWire_h */