workaround for WEH001602 (WS0010 based) display

master
Mateusz Szafraniec 7 years ago
parent 4bb48bd648
commit 6aa5b8b47a
  1. 9
      LiquidCrystal_I2C.cpp
  2. 2
      LiquidCrystal_I2C.h
  3. BIN
      LiquidCrystal_I2C.o

@ -52,6 +52,11 @@ LiquidCrystal_I2C::LiquidCrystal_I2C(uint8_t lcd_Addr,uint8_t lcd_cols,uint8_t l
_backlightval = LCD_NOBACKLIGHT; _backlightval = LCD_NOBACKLIGHT;
} }
void LiquidCrystal_I2C::oled_init(){
_oled = true;
init_priv();
}
void LiquidCrystal_I2C::init(){ void LiquidCrystal_I2C::init(){
init_priv(); 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! // SEE PAGE 45/46 FOR INITIALIZATION SPECIFICATION!
// according to datasheet, we need at least 40ms after power rises above 2.7V // 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 // 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 // Now we pull both RS and R/W low to begin commands
expanderWrite(_backlightval); // reset expanderand turn backlight off (Bit 8 =1) 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(){ void LiquidCrystal_I2C::clear(){
command(LCD_CLEARDISPLAY);// clear display, set cursor position to zero command(LCD_CLEARDISPLAY);// clear display, set cursor position to zero
delayMicroseconds(2000); // this command takes a long time! delayMicroseconds(2000); // this command takes a long time!
if (_oled) setCursor(0,0);
} }
void LiquidCrystal_I2C::home(){ void LiquidCrystal_I2C::home(){

@ -88,6 +88,7 @@ public:
#endif #endif
void command(uint8_t); void command(uint8_t);
void init(); void init();
void oled_init();
////compatibility API function aliases ////compatibility API function aliases
void blink_on(); // alias for blink() void blink_on(); // alias for blink()
@ -121,6 +122,7 @@ private:
uint8_t _displaycontrol; uint8_t _displaycontrol;
uint8_t _displaymode; uint8_t _displaymode;
uint8_t _numlines; uint8_t _numlines;
bool _oled = false;
uint8_t _cols; uint8_t _cols;
uint8_t _rows; uint8_t _rows;
uint8_t _backlightval; uint8_t _backlightval;

Binary file not shown.
Loading…
Cancel
Save