diff --git a/LiquidCrystal_I2C.cpp b/LiquidCrystal_I2C.cpp index 44b7b05..2d10d5c 100644 --- a/LiquidCrystal_I2C.cpp +++ b/LiquidCrystal_I2C.cpp @@ -52,6 +52,11 @@ LiquidCrystal_I2C::LiquidCrystal_I2C(uint8_t lcd_Addr,uint8_t lcd_cols,uint8_t l _backlightval = LCD_NOBACKLIGHT; } +void LiquidCrystal_I2C::oled_init(){ + _oled = true; + init_priv(); +} + void LiquidCrystal_I2C::init(){ init_priv(); } @@ -77,7 +82,8 @@ void LiquidCrystal_I2C::begin(uint8_t cols, uint8_t lines, uint8_t dotsize) { // SEE PAGE 45/46 FOR INITIALIZATION SPECIFICATION! // according to datasheet, we need at least 40ms after power rises above 2.7V // before sending commands. Arduino can turn on way befer 4.5V so we'll wait 50 - delay(50); + if (_oled) delay(500); + else delay(50); // Now we pull both RS and R/W low to begin commands expanderWrite(_backlightval); // reset expanderand turn backlight off (Bit 8 =1) @@ -127,6 +133,7 @@ void LiquidCrystal_I2C::begin(uint8_t cols, uint8_t lines, uint8_t dotsize) { void LiquidCrystal_I2C::clear(){ command(LCD_CLEARDISPLAY);// clear display, set cursor position to zero delayMicroseconds(2000); // this command takes a long time! + if (_oled) setCursor(0,0); } void LiquidCrystal_I2C::home(){ diff --git a/LiquidCrystal_I2C.h b/LiquidCrystal_I2C.h index c033f7f..f7c7d13 100644 --- a/LiquidCrystal_I2C.h +++ b/LiquidCrystal_I2C.h @@ -88,6 +88,7 @@ public: #endif void command(uint8_t); void init(); + void oled_init(); ////compatibility API function aliases void blink_on(); // alias for blink() @@ -121,6 +122,7 @@ private: uint8_t _displaycontrol; uint8_t _displaymode; uint8_t _numlines; + bool _oled = false; uint8_t _cols; uint8_t _rows; uint8_t _backlightval; diff --git a/LiquidCrystal_I2C.o b/LiquidCrystal_I2C.o deleted file mode 100644 index bca78e0..0000000 Binary files a/LiquidCrystal_I2C.o and /dev/null differ