diff options
-rw-r--r-- | libraries/MyLCD/MyLCD.h (renamed from lpo/MyLCD.h) | 41 |
1 files changed, 36 insertions, 5 deletions
diff --git a/lpo/MyLCD.h b/libraries/MyLCD/MyLCD.h index 565e110..b56af9b 100644 --- a/lpo/MyLCD.h +++ b/libraries/MyLCD/MyLCD.h @@ -1,7 +1,5 @@ #ifndef __MYLCD_H #define __MYLCD_H -#undef PROGMEM -#define PROGMEM #include <MultiLCD.h> class MyLCD : public LCD_ILI9325D { /* 2.8" ILI9325 based LCD 320x240x16bpp*/ @@ -11,13 +9,26 @@ class MyLCD : public LCD_ILI9325D { LCD_ILI9325D::setFontSize(FONT_SIZE_SMALL); this->clear(); } - byte getLines() { return 30; } - byte getCols() { return 53; } + void begin() { + LCD_ILI9325D::begin(); + }; + /* Stub to be compatible with Serial interface. Can't find an abstract Class defined properly in Arduino core stuff */ + void begin(long speed) { + this->begin(); + }; + /* Simulate more lines with 2 columns */ + byte getLines() { return 30*2; } + byte getCols() { return 53/2; } void setCursor(uint8_t column, uint8_t line) { /* column and line as in a terminal, start at line 1, col 1. each column is one character wide*/ this->column = (column==0)?1:column; this->line = (column==0)?1:line; - LCD_ILI9325D::setCursor((column-1)*6, line-1); + /* Simulate more lines with 2 columns */ + if ( this->line <= this->getLines()/2 ) { + LCD_ILI9325D::setCursor((column-1)*6, line-1); + } else { + LCD_ILI9325D::setCursor((this->getCols()+column-1)*6, line-1-this->getLines()/2); + } } void clear() { LCD_ILI9325D::clear(); @@ -42,10 +53,30 @@ class MyLCD : public LCD_ILI9325D { this->println(); return len; } + size_t println(const char *s) { + size_t len = LCD_ILI9325D::print(s); + this->println(); + return len; + } + size_t println(const char c) { + size_t len = LCD_ILI9325D::print(c); + this->println(); + return len; + } size_t print(const String &s) { size_t len = LCD_ILI9325D::print(s); this->moveRight(len); return len; } + size_t print(const char *s) { + size_t len = LCD_ILI9325D::print(s); + this->moveRight(len); + return len; + } + size_t print(const char c) { + size_t len = LCD_ILI9325D::print(c); + this->moveRight(len); + return len; + } }; #endif |