Fix compile error when wire1 is unavailable

This commit is contained in:
Theo Arends 2024-10-11 12:38:04 +02:00
parent 8ea4c7887f
commit f9ee4198e1
1 changed files with 5 additions and 0 deletions

View File

@ -63,7 +63,12 @@ bool I2cBegin(int sda, int scl, uint32_t bus, uint32_t frequency) {
#endif // USE_I2C_BUS2_ESP8266
#endif // ESP8266
#ifdef ESP32
#ifdef USE_I2C_BUS2
TwoWire& myWire = (0 == bus) ? Wire : Wire1;
#else
if (bus > 0) { return false; }
TwoWire& myWire = Wire;
#endif
static bool reinit = false;
if (reinit) { myWire.end(); }
result = myWire.begin(sda, scl, frequency);