Skip to content

Commit 8e52bb1

Browse files
helmut64marcelstoer
authored andcommitted
Added AVR support
1 parent 7886a63 commit 8e52bb1

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/SSD1306Wire.h

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@
3434
#include "OLEDDisplay.h"
3535
#include <Wire.h>
3636

37+
#ifdef ARDUINO_ARCH_AVR
38+
#define _min min
39+
#define _max max
40+
#endif
41+
3742
class SSD1306Wire : public OLEDDisplay {
3843
private:
3944
uint8_t _address;
@@ -51,7 +56,11 @@ class SSD1306Wire : public OLEDDisplay {
5156
}
5257

5358
bool connect() {
59+
#ifdef ARDUINO_ARCH_AVR
60+
Wire.begin();
61+
#else
5462
Wire.begin(this->_sda, this->_scl);
63+
#endif
5564
// Let's use ~700khz if ESP8266 is in 160Mhz mode
5665
// this will be limited to ~400khz if the ESP8266 in 80Mhz mode.
5766
Wire.setClock(700000);
@@ -166,7 +175,11 @@ class SSD1306Wire : public OLEDDisplay {
166175

167176
void initI2cIfNeccesary() {
168177
if (_doI2cAutoInit) {
169-
Wire.begin(this->_sda, this->_scl);
178+
#ifdef ARDUINO_ARCH_AVR
179+
Wire.begin();
180+
#else
181+
Wire.begin(this->_sda, this->_scl);
182+
#endif
170183
}
171184
}
172185

0 commit comments

Comments
 (0)