From 6c94f4fcda140f3e95a4a723a222219cc83e7776 Mon Sep 17 00:00:00 2001 From: Stanley Huang Date: Sun, 6 Jul 2014 21:41:11 +1000 Subject: Update OBD-II logger for Arduino Nano --- nanologger/MicroLCD.h | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) (limited to 'nanologger/MicroLCD.h') 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 +* Copyright (c) 2013-2014 Stanley Huang * All rights reserved. +* For more information, please visit http://arduinodev.com *************************************************************************/ -#if !defined(__AVR_ATmega2560__) && !defined(__AVR_ATmega1280__) && !defined(__AVR_ATmega644P__) +#include + //#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); +}; + -- cgit v1.2.3