diff options
author | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2021-06-12 00:42:19 +0200 |
---|---|---|
committer | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2021-06-12 00:42:19 +0200 |
commit | 7b6035179821fd7a7553ac3b60f36e84fc1cccd4 (patch) | |
tree | 45b98e634661fa1d9cc7efafacf892b5d5999d0f /lpo/MyLCD.h | |
parent | c2d1ca81d9bcc4b5a1fbf93e61af1db14a7e5158 (diff) | |
download | 2021-arduino-obd-7b6035179821fd7a7553ac3b60f36e84fc1cccd4.tar.gz 2021-arduino-obd-7b6035179821fd7a7553ac3b60f36e84fc1cccd4.tar.bz2 2021-arduino-obd-7b6035179821fd7a7553ac3b60f36e84fc1cccd4.zip |
Import inital sketch lpo pour dumper les DTC et des valeurs live
Diffstat (limited to 'lpo/MyLCD.h')
-rw-r--r-- | lpo/MyLCD.h | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/lpo/MyLCD.h b/lpo/MyLCD.h new file mode 100644 index 0000000..565e110 --- /dev/null +++ b/lpo/MyLCD.h @@ -0,0 +1,51 @@ +#ifndef __MYLCD_H +#define __MYLCD_H +#undef PROGMEM +#define PROGMEM +#include <MultiLCD.h> +class MyLCD : public LCD_ILI9325D { + /* 2.8" ILI9325 based LCD 320x240x16bpp*/ + public: + uint8_t column, line; + MyLCD() { + LCD_ILI9325D::setFontSize(FONT_SIZE_SMALL); + this->clear(); + } + byte getLines() { return 30; } + byte getCols() { return 53; } + 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); + } + void clear() { + LCD_ILI9325D::clear(); + this->setCursor(1, 1); + } + size_t println() { + if ( this->line < this->getLines() ) { + this->setCursor(1, this->line+1); + } else { + this->clear(); + } + } + void moveRight(size_t len) { + if ( this->column+len <= this->getCols() ) { + this->setCursor(this->column+len, this->line); + } else { + this->println(); + } + } + size_t println(const String &s) { + size_t len = LCD_ILI9325D::print(s); + this->println(); + return len; + } + size_t print(const String &s) { + size_t len = LCD_ILI9325D::print(s); + this->moveRight(len); + return len; + } +}; +#endif |