Skip to content

Commit ea45d28

Browse files
SSD1306: Disambiguate Wire.begin for [email protected]
With [email protected] we can't pass the first argument to TwoWire::begin as an unsigned int; it will resolve the four-parameter overload and initialize the bus in slave mode. We resolve the three-parameter overload for bus master mode by explicitly typing the first and third arguments, the third replacing the call to TwoWire::setClock. Setting the frequency in TwoWire::begin has the same effect as ::setClock: arduino-esp32@<2.0.1: i2cInit (esp32-hal-i2c.c) and setClock (Wire.cpp) both call i2cSetFrequency (esp32-hal-i2c.c) [email protected]: esp-idf does the same clock selection in i2c_param_config and i2c_get_clk_src (driver/i2c.c) that arduino-esp32 does in i2cSetClock (esp32-hal-i2c.c).
1 parent 494d6b9 commit ea45d28

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/oled/SSD1306Wire.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,16 @@ class SSD1306Wire : public OLEDDisplay {
5555

5656

5757
bool connect() {
58-
pinMode(_rst,OUTPUT);
59-
digitalWrite(_rst, LOW);
60-
delay(50);
61-
digitalWrite(_rst, HIGH);
62-
63-
Wire.begin(this->_sda, this->_scl);
64-
// Let's use ~700khz if ESP8266 is in 160Mhz mode
65-
// this will be limited to ~400khz if the ESP8266 in 80Mhz mode.
66-
Wire.setClock(700000);
67-
return true;
58+
pinMode(_rst,OUTPUT);
59+
digitalWrite(_rst, LOW);
60+
delay(50);
61+
digitalWrite(_rst, HIGH);
62+
63+
// Let's use ~700khz if ESP8266 is in 160Mhz mode
64+
// this will be limited to ~400khz if the ESP8266 in 80Mhz mode.
65+
Wire.begin(int(this->_sda), this->_scl, 700000U);
66+
67+
return true;
6868
}
6969

7070
void display(void) {

0 commit comments

Comments
 (0)