1 /* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved.
3 This software may be distributed and modified under the terms of the GNU
4 General Public License version 2 (GPL2) as published by the Free Software
5 Foundation and appearing in the file GPL2.TXT included in the packaging of
6 this file. Please note that GPL2 Section 2[b] requires that all works based
7 on this software must also be made publicly available under the terms of
14 Web : http://www.circuitsathome.com
15 e-mail : support@circuitsathome.com
17 //HD44780 compatible LCD display via MAX3421E GPOUT support header
18 //pinout: D[4-7] -> GPOUT[4-7], RS-> GPOUT[2], E ->GPOUT[3]
28 #define LCD_CLEARDISPLAY 0x01
29 #define LCD_RETURNHOME 0x02
30 #define LCD_ENTRYMODESET 0x04
31 #define LCD_DISPLAYCONTROL 0x08
32 #define LCD_CURSORSHIFT 0x10
33 #define LCD_FUNCTIONSET 0x20
34 #define LCD_SETCGRAMADDR 0x40
35 #define LCD_SETDDRAMADDR 0x80
37 // flags for display entry mode
38 #define LCD_ENTRYRIGHT 0x00
39 #define LCD_ENTRYLEFT 0x02
40 #define LCD_ENTRYSHIFTINCREMENT 0x01
41 #define LCD_ENTRYSHIFTDECREMENT 0x00
43 // flags for display on/off control
44 #define LCD_DISPLAYON 0x04
45 #define LCD_DISPLAYOFF 0x00
46 #define LCD_CURSORON 0x02
47 #define LCD_CURSOROFF 0x00
48 #define LCD_BLINKON 0x01
49 #define LCD_BLINKOFF 0x00
51 // flags for display/cursor shift
52 #define LCD_DISPLAYMOVE 0x08
53 #define LCD_CURSORMOVE 0x00
54 #define LCD_MOVERIGHT 0x04
55 #define LCD_MOVELEFT 0x00
57 // flags for function set
58 #define LCD_8BITMODE 0x10
59 #define LCD_4BITMODE 0x00
60 #define LCD_2LINE 0x08
61 #define LCD_1LINE 0x00
62 #define LCD_5x10DOTS 0x04
63 #define LCD_5x8DOTS 0x00
65 class Max_LCD : public Print {
71 void begin(uint8_t cols, uint8_t rows, uint8_t charsize = LCD_5x8DOTS);
80 void scrollDisplayLeft();
81 void scrollDisplayRight();
86 void createChar(uint8_t, uint8_t[]);
87 void setCursor(uint8_t, uint8_t);
88 void command(uint8_t);
90 #if defined(ARDUINO) && ARDUINO >=100
91 size_t write(uint8_t);
98 void sendbyte(uint8_t val);
99 uint8_t _displayfunction; //tokill
100 uint8_t _displaycontrol;
101 uint8_t _displaymode;
102 uint8_t _initialized;
103 uint8_t _numlines, _currline;