Alphanumeric LCD Library for Arduino  1.0.4
LCD Control library for Arduino
 All Classes Files Functions Variables Macros Pages
/Volumes/John Doe/Firmware/Arduino LIbraries/AlphaLCD/AlphaLCD.h
Go to the documentation of this file.
1 
22 #ifndef AlphaLCD_h
23 #define AlphaLCD_h
24 
25 #include <inttypes.h>
26 #include "Print.h"
27 
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 #define LCD_ENTRYRIGHT 0x00
38 #define LCD_ENTRYLEFT 0x02
39 #define LCD_ENTRYSHIFTINCREMENT 0x01
40 #define LCD_ENTRYSHIFTDECREMENT 0x00
41 
42 #define LCD_DISPLAYON 0x04
43 #define LCD_DISPLAYOFF 0x00
44 #define LCD_CURSORON 0x02
45 #define LCD_CURSOROFF 0x00
46 #define LCD_BLINKON 0x01
47 #define LCD_BLINKOFF 0x00
48 
49 #define LCD_DISPLAYMOVE 0x08
50 #define LCD_CURSORMOVE 0x00
51 #define LCD_MOVERIGHT 0x04
52 #define LCD_MOVELEFT 0x00
53 
54 #define LCD_8BITMODE 0x10
55 #define LCD_4BITMODE 0x00
56 #define LCD_2LINE 0x08
57 #define LCD_1LINE 0x00
58 #define LCD_5x10DOTS 0x04
59 #define LCD_5x8DOTS 0x00
60 
61 #define LCD_RS_PIN 0x01
62 #define LCD_EN_PIN 0x02
63 #define LCD_BL_PIN 0x04
64 
65 class AlphaLCD: public Print {
66 public:
67 
68  AlphaLCD();
69 
70  AlphaLCD(uint8_t dp, uint8_t cp, uint8_t lp);
71 
72  void init(uint8_t dp, uint8_t cp, uint8_t lp);
73 
74  void begin(uint8_t cols, uint8_t rows, uint8_t charsize = LCD_5x8DOTS);
75 
76  void clear();
77  void home();
78 
79  void noDisplay();
80  void display();
81  void noBlink();
82  void blink();
83  void noCursor();
84  void cursor();
85  void scrollDisplayLeft();
86  void scrollDisplayRight();
87  void leftToRight();
88  void rightToLeft();
89  void autoscroll();
90  void noAutoscroll();
91  void isDisplay(bool set);
92  void isCursor(bool set);
93  void isBlinking(bool set);
94  void isRightToLeft(bool set);
95  void isAutoscroll(bool set);
96  void createChar(uint8_t, uint8_t[]);
97  void setCursor(uint8_t, uint8_t);
98  virtual size_t write(uint8_t);
99  void command(uint8_t);
100 private:
101  void send(uint8_t, uint8_t);
102  void write4bits(uint8_t, uint8_t);
103  void write8bits(uint8_t, uint8_t);
104 
105  uint8_t _clock_pin;
106  uint8_t _data_pin;
107  uint8_t _latch_pin;
108  uint8_t _smart_enable;
111  uint8_t _displaymode;
112  uint8_t _backlight;
113  uint8_t _initialized;
115 };
116 
117 #endif
void noAutoscroll()
Disable the automatic horizontal scrolling of the text.
Definition: AlphaLCD.cpp:278
uint8_t _displaymode
Definition: AlphaLCD.h:111
#define LCD_5x8DOTS
Definition: AlphaLCD.h:59
void noCursor()
Turn off the underline cursor.
Definition: AlphaLCD.cpp:205
uint8_t _clock_pin
Definition: AlphaLCD.h:105
void isDisplay(bool set)
Helper method to set on/off the display.
Definition: AlphaLCD.cpp:285
void createChar(uint8_t, uint8_t[])
Create one of the 8 CGRAM memory locations from 0x00 to 0x07 with a user defined characters.
Definition: AlphaLCD.cpp:324
void leftToRight()
Flow the text from left to right.
Definition: AlphaLCD.cpp:253
void noDisplay()
Turn off the display.
Definition: AlphaLCD.cpp:189
uint8_t _smart_enable
Definition: AlphaLCD.h:108
uint8_t _data_pin
Definition: AlphaLCD.h:106
void cursor()
Turn on the underline cursor.
Definition: AlphaLCD.cpp:213
void command(uint8_t)
Helper method to send commands to the device.
Definition: AlphaLCD.cpp:339
uint8_t _numlines
Definition: AlphaLCD.h:114
void blink()
Turn off the blinking cursor.
Definition: AlphaLCD.cpp:229
void write4bits(uint8_t, uint8_t)
Write the character on the device, 4 bits mode.
Definition: AlphaLCD.cpp:369
void send(uint8_t, uint8_t)
Write either command or data, with automatic 4/8-bit selection.
Definition: AlphaLCD.cpp:353
void isAutoscroll(bool set)
Helper method to set on/off autoscroll.
Definition: AlphaLCD.cpp:309
void begin(uint8_t cols, uint8_t rows, uint8_t charsize=0x00)
Start the LCD modes and initializes the software configuration parameters.
Definition: AlphaLCD.cpp:83
void write8bits(uint8_t, uint8_t)
Write the character on the device, 8 bits mode.
Definition: AlphaLCD.cpp:406
uint8_t _backlight
Definition: AlphaLCD.h:112
void isRightToLeft(bool set)
Helper method to set on/off the right-to-left writing direction.
Definition: AlphaLCD.cpp:303
uint8_t _displayfunction
Definition: AlphaLCD.h:109
void scrollDisplayRight()
Scroll the display to the right by one position.
Definition: AlphaLCD.cpp:246
void scrollDisplayLeft()
Scroll the display to the left by one position.
Definition: AlphaLCD.cpp:238
uint8_t _displaycontrol
Definition: AlphaLCD.h:110
void isCursor(bool set)
Helper method to set on/off the cursor visibility.
Definition: AlphaLCD.cpp:291
uint8_t _latch_pin
Definition: AlphaLCD.h:107
void autoscroll()
Enable the automatic horizontal scrolling of the text.
Definition: AlphaLCD.cpp:270
uint8_t _currline
Definition: AlphaLCD.h:114
void display()
Turn on the display.
Definition: AlphaLCD.cpp:197
void isBlinking(bool set)
Helper method to set on/off the blinking cursor.
Definition: AlphaLCD.cpp:297
void home()
Set the cursor to the position (0,0)
Definition: AlphaLCD.cpp:161
void noBlink()
Turn off the blinking cursor.
Definition: AlphaLCD.cpp:221
void init(uint8_t dp, uint8_t cp, uint8_t lp)
Hardware initialization.
Definition: AlphaLCD.cpp:56
void setCursor(uint8_t, uint8_t)
Set the cursor to the requested position.
Definition: AlphaLCD.cpp:176
virtual size_t write(uint8_t)
Helper method to send data to the device.
Definition: AlphaLCD.cpp:346
void rightToLeft()
Flow the text from right to left.
Definition: AlphaLCD.cpp:261
uint8_t _initialized
Definition: AlphaLCD.h:113
AlphaLCD()
Constructor with no parameters, to create initial class instances.
Definition: AlphaLCD.cpp:32
void clear()
Clear the display content and set the cursor to the position (0,0)
Definition: AlphaLCD.cpp:152