Skip to content

Commit c1fa10e

Browse files
authored
Fix one HW I2C for non-ESP32 (ThingPulse#298)
1 parent 65615be commit c1fa10e

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/SH1106Wire.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,11 @@ class SH1106Wire : public OLEDDisplay {
7171
this->_address = _address;
7272
this->_sda = _sda;
7373
this->_scl = _scl;
74-
this->_wire = (_i2cBus==I2C_ONE)?&Wire:&Wire1;
74+
#if !defined(ARDUINO_ARCH_ESP32)
75+
this->_wire = &Wire;
76+
#else
77+
this->_wire = (_i2cBus==I2C_ONE) ? &Wire : &Wire1;
78+
#endif
7579
this->_frequency = _frequency;
7680
}
7781

src/SSD1306Wire.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,11 @@ class SSD1306Wire : public OLEDDisplay {
7373
this->_address = _address;
7474
this->_sda = _sda;
7575
this->_scl = _scl;
76-
this->_wire = (_i2cBus==I2C_ONE)?&Wire:&Wire1;
76+
#if !defined(ARDUINO_ARCH_ESP32)
77+
this->_wire = &Wire;
78+
#else
79+
this->_wire = (_i2cBus==I2C_ONE) ? &Wire : &Wire1;
80+
#endif
7781
this->_frequency = _frequency;
7882
}
7983

0 commit comments

Comments
 (0)