Skip to content

Commit 5dbb4a9

Browse files
committed
Fix OLED display not working with other sensors. This change reverts 851d426 but provides a way to select software I2C manually. #21 #24
1 parent f3db7a4 commit 5dbb4a9

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/Arduino_SensorKit.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
#endif
1212

1313
//Declare component's classes
14-
U8X8_SSD1306_128X64_NONAME_SW_I2C Oled(/* clock=*/ _PIN_SCL, /* data=*/ _PIN_SDA, /* reset=*/ U8X8_PIN_NONE);
14+
U8X8_SSD1306_128X64_NONAME_SW_I2C Oled_SW(_PIN_SCL, _PIN_SDA, U8X8_PIN_NONE);
15+
U8X8_SSD1306_128X64_NONAME_HW_I2C Oled_HW(U8X8_PIN_NONE, _PIN_SCL, _PIN_SDA);
1516
SensorKit_DHT Environment(3,DHT11);
1617
DHT Environment_I2C(DHT20);
1718
SensorKit_LIS3DHTR Accelerometer;

src/Arduino_SensorKit.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,13 @@
1919
class SensorKit_DHT;
2020

2121
//Make the declared components from the .cpp to the sketch available
22-
extern U8X8_SSD1306_128X64_NONAME_SW_I2C Oled;
22+
extern U8X8_SSD1306_128X64_NONAME_SW_I2C Oled_SW;
23+
extern U8X8_SSD1306_128X64_NONAME_HW_I2C Oled_HW;
24+
#ifdef SENSORKIT_USE_SW_I2C
25+
#define Oled Oled_SW
26+
#else
27+
#define Oled Oled_HW
28+
#endif
2329
extern SensorKit_LIS3DHTR Accelerometer;
2430
extern SensorKit_BMP280 Pressure;
2531
extern SensorKit_DHT Environment;

0 commit comments

Comments
 (0)