summaryrefslogtreecommitdiff
path: root/nanologger/MicroLCD.h
diff options
context:
space:
mode:
authorStanley Huang <stanleyhuangyc@gmail.com>2014-07-06 21:41:11 +1000
committerStanley Huang <stanleyhuangyc@gmail.com>2014-07-06 21:41:11 +1000
commit6c94f4fcda140f3e95a4a723a222219cc83e7776 (patch)
treea24e9c442080f3f9ce9422c77d2cb8fe2f8a2f6a /nanologger/MicroLCD.h
parentcc29f957a1fdbd21871d0a0183ddd2246827bc00 (diff)
download2021-arduino-obd-6c94f4fcda140f3e95a4a723a222219cc83e7776.tar.gz
2021-arduino-obd-6c94f4fcda140f3e95a4a723a222219cc83e7776.tar.bz2
2021-arduino-obd-6c94f4fcda140f3e95a4a723a222219cc83e7776.zip
Update OBD-II logger for Arduino Nano
Diffstat (limited to 'nanologger/MicroLCD.h')
-rw-r--r--nanologger/MicroLCD.h37
1 files changed, 31 insertions, 6 deletions
diff --git a/nanologger/MicroLCD.h b/nanologger/MicroLCD.h
index e421505..51781ab 100644
--- a/nanologger/MicroLCD.h
+++ b/nanologger/MicroLCD.h
@@ -1,13 +1,14 @@
/*************************************************************************
-* Arduino Text Display Library for Multiple LCDs
+* Arduino Text & Bitmap Display Library for multiple models of monochrome LCD display
* Distributed under GPL v2.0
-* Copyright (c) 2013 Stanley Huang <stanleyhuangyc@live.com>
+* Copyright (c) 2013-2014 Stanley Huang <stanleyhuangyc@gmail.com>
* All rights reserved.
+* For more information, please visit http://arduinodev.com
*************************************************************************/
-#if !defined(__AVR_ATmega2560__) && !defined(__AVR_ATmega1280__) && !defined(__AVR_ATmega644P__)
+#include <Arduino.h>
+
//#define MEMORY_SAVING
-#endif
typedef enum {
FONT_SIZE_SMALL = 0,
@@ -32,10 +33,10 @@ class LCD_Common
{
public:
LCD_Common():m_font(FONT_SIZE_SMALL),m_flags(0) {}
- void setFont(FONT_SIZE size) { m_font = size; }
+ void setFontSize(FONT_SIZE size) { m_font = size; }
void setFlags(byte flags) { m_flags = flags; }
virtual void backlight(bool on) {}
- virtual void draw(const PROGMEM byte* buffer, byte x, byte y, byte width, byte height) {}
+ virtual void draw(const PROGMEM byte* buffer, byte width, byte height) {}
void printInt(uint16_t value, int8_t padding = -1);
void printLong(uint32_t value, int8_t padding = -1);
protected:
@@ -62,6 +63,7 @@ class LCD_SSD1306 : public LCD_Common, public SSD1306, public Print
{
public:
void setCursor(byte column, byte line);
+ void setContrast(byte Contrast);
void draw(const PROGMEM byte* buffer, byte width, byte height);
size_t write(uint8_t c);
void clear(byte x = 0, byte y = 0, byte width = 128, byte height = 64);
@@ -92,3 +94,26 @@ private:
byte m_col;
byte m_row;
};
+
+#include "PCD8544.h"
+
+class LCD_PCD8544 : public LCD_Common, public PCD8544
+{
+public:
+ byte getLines() { return 6; }
+ byte getCols() { return 14; }
+ void backlight(bool on)
+ {
+ pinMode(7, OUTPUT);
+ digitalWrite(7, on ? HIGH : LOW);
+ }
+ void clearLine(byte line)
+ {
+ setCursor(0, line);
+ for (byte i = 14; i > 0; i--) write(' ');
+ }
+ void draw(const PROGMEM byte* buffer, byte width, byte height);
+private:
+ void writeDigit(byte n);
+};
+