File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
src/components/i2c/drivers Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -68,8 +68,14 @@ class WipperSnapper_I2C_Driver_Out_SH1107
68
68
@returns True if initialized successfully, False otherwise.
69
69
*/
70
70
bool begin () {
71
- // Attempt to create and allocate a SH1107 obj, backwards w/h
72
- _display = new Adafruit_SH1107 (_height, _width, _i2c);
71
+ uint8_t rotation = 0 ; // Default rotation
72
+ // Attempt to create and allocate a SH1107 obj
73
+ if (_width == 128 && _height == 64 ) { // featherwing
74
+ _display = new Adafruit_SH1107 (_height, _width, _i2c);
75
+ rotation = 1 ; // Set rotation to 1 for 128x64 OLED featherwing
76
+ } else {
77
+ _display = new Adafruit_SH1107 (_width, _height, _i2c);
78
+ }
73
79
if (!_display->begin (_sensorAddress, true ))
74
80
return false ;
75
81
@@ -82,7 +88,7 @@ class WipperSnapper_I2C_Driver_Out_SH1107
82
88
// Clear the buffer.
83
89
_display->clearDisplay ();
84
90
_display->display ();
85
- _display->setRotation (1 );
91
+ _display->setRotation (rotation );
86
92
87
93
// Configure the text size and color
88
94
_display->setTextSize (_text_sz);
You can’t perform that action at this time.
0 commit comments