USB Host Shield 2.0
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
max_LCD.h
Go to the documentation of this file.
1 /* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved.
2 
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
8 the GPL2 ("Copyleft").
9 
10 Contact information
11 -------------------
12 
13 Circuits At Home, LTD
14 Web : http://www.circuitsathome.com
15 e-mail : support@circuitsathome.com
16  */
17 //HD44780 compatible LCD display via MAX3421E GPOUT support header
18 //pinout: D[4-7] -> GPOUT[4-7], RS-> GPOUT[2], E ->GPOUT[3]
19 //
20 
21 #ifndef _Max_LCD_h_
22 #define _Max_LCD_h_
23 
24 #include "Usb.h"
25 #include "Print.h"
26 
27 // commands
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
36 
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
42 
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
50 
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
56 
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
64 
65 class Max_LCD //: public Print
66 {
67  USB *pUsb;
68 
69 public:
70  Max_LCD(USB *pusb);
71  void init();
72  void begin(uint8_t cols, uint8_t rows, uint8_t charsize = LCD_5x8DOTS);
73  void clear();
74  void home();
75  void noDisplay();
76  void display();
77  void noBlink();
78  void blink();
79  void noCursor();
80  void cursor();
81  void scrollDisplayLeft();
82  void scrollDisplayRight();
83  void leftToRight();
84  void rightToLeft();
85  void autoscroll();
86  void noAutoscroll();
87  void createChar(uint8_t, uint8_t[]);
88  void setCursor(uint8_t, uint8_t);
89  virtual void write(uint8_t);
90  void command(uint8_t);
91 
92 private:
93  void sendbyte(uint8_t val);
94  uint8_t _displayfunction; //tokill
95  uint8_t _displaycontrol;
96  uint8_t _displaymode;
97  uint8_t _initialized;
98  uint8_t _numlines, _currline;
99 };
100 
101 #endif
#define LCD_5x8DOTS
Definition: max_LCD.h:63
void scrollDisplayRight()
Definition: max_LCD.cpp:176
void blink()
Definition: max_LCD.cpp:165
void rightToLeft()
Definition: max_LCD.cpp:189
void clear()
Definition: max_LCD.cpp:114
void begin(uint8_t cols, uint8_t rows, uint8_t charsize=LCD_5x8DOTS)
Definition: max_LCD.cpp:54
void noAutoscroll()
Definition: max_LCD.cpp:203
void cursor()
Definition: max_LCD.cpp:152
void noDisplay()
Definition: max_LCD.cpp:135
void setCursor(uint8_t, uint8_t)
Definition: max_LCD.cpp:124
virtual void write(uint8_t)
Definition: max_LCD.cpp:226
void leftToRight()
Definition: max_LCD.cpp:182
void autoscroll()
Definition: max_LCD.cpp:196
void noCursor()
Definition: max_LCD.cpp:147
void home()
Definition: max_LCD.cpp:119
void command(uint8_t)
Definition: max_LCD.cpp:221
void noBlink()
Definition: max_LCD.cpp:160
void display()
Definition: max_LCD.cpp:140
void scrollDisplayLeft()
Definition: max_LCD.cpp:172
Definition: UsbCore.h:152
void createChar(uint8_t, uint8_t[])
Definition: max_LCD.cpp:211
Max_LCD(USB *pusb)
Definition: max_LCD.cpp:42
void init()
Definition: max_LCD.cpp:46