![]() |
Alphanumeric LCD Library for Arduino
1.0.4
LCD Control library for Arduino
|
#include "AlphaLCD.h"
Public Member Functions | |
AlphaLCD () | |
Constructor with no parameters, to create initial class instances. More... | |
AlphaLCD (uint8_t dp, uint8_t cp, uint8_t lp) | |
Constructor with the hardware initialization parameters (pin numbers) More... | |
void | init (uint8_t dp, uint8_t cp, uint8_t lp) |
Hardware initialization. More... | |
void | begin (uint8_t cols, uint8_t rows, uint8_t charsize=0x00) |
Start the LCD modes and initializes the software configuration parameters. More... | |
void | clear () |
Clear the display content and set the cursor to the position (0,0) More... | |
void | home () |
Set the cursor to the position (0,0) More... | |
void | noDisplay () |
Turn off the display. More... | |
void | display () |
Turn on the display. More... | |
void | noBlink () |
Turn off the blinking cursor. More... | |
void | blink () |
Turn off the blinking cursor. More... | |
void | noCursor () |
Turn off the underline cursor. More... | |
void | cursor () |
Turn on the underline cursor. More... | |
void | scrollDisplayLeft () |
Scroll the display to the left by one position. More... | |
void | scrollDisplayRight () |
Scroll the display to the right by one position. More... | |
void | leftToRight () |
Flow the text from left to right. More... | |
void | rightToLeft () |
Flow the text from right to left. More... | |
void | autoscroll () |
Enable the automatic horizontal scrolling of the text. More... | |
void | noAutoscroll () |
Disable the automatic horizontal scrolling of the text. More... | |
void | isDisplay (bool set) |
Helper method to set on/off the display. More... | |
void | isCursor (bool set) |
Helper method to set on/off the cursor visibility. More... | |
void | isBlinking (bool set) |
Helper method to set on/off the blinking cursor. More... | |
void | isRightToLeft (bool set) |
Helper method to set on/off the right-to-left writing direction. More... | |
void | isAutoscroll (bool set) |
Helper method to set on/off autoscroll. More... | |
void | createChar (uint8_t, uint8_t[]) |
Create one of the 8 CGRAM memory locations from 0x00 to 0x07 with a user defined characters. More... | |
void | setCursor (uint8_t, uint8_t) |
Set the cursor to the requested position. More... | |
virtual size_t | write (uint8_t) |
Helper method to send data to the device. More... | |
void | command (uint8_t) |
Helper method to send commands to the device. More... | |
Private Member Functions | |
void | send (uint8_t, uint8_t) |
Write either command or data, with automatic 4/8-bit selection. More... | |
void | write4bits (uint8_t, uint8_t) |
Write the character on the device, 4 bits mode. More... | |
void | write8bits (uint8_t, uint8_t) |
Write the character on the device, 8 bits mode. More... | |
Private Attributes | |
uint8_t | _clock_pin |
uint8_t | _data_pin |
uint8_t | _latch_pin |
uint8_t | _smart_enable |
uint8_t | _displayfunction |
uint8_t | _displaycontrol |
uint8_t | _displaymode |
uint8_t | _backlight |
uint8_t | _initialized |
uint8_t | _numlines |
uint8_t | _currline |
Definition at line 65 of file AlphaLCD.h.
AlphaLCD::AlphaLCD | ( | ) |
Constructor with no parameters, to create initial class instances.
Definition at line 32 of file AlphaLCD.cpp.
AlphaLCD::AlphaLCD | ( | uint8_t | dp, |
uint8_t | cp, | ||
uint8_t | lp | ||
) |
Constructor with the hardware initialization parameters (pin numbers)
parameters depends on the phisycal connection of the LCD-Alpha component.
Definition at line 41 of file AlphaLCD.cpp.
References init().
void AlphaLCD::autoscroll | ( | void | ) |
Enable the automatic horizontal scrolling of the text.
As the scrolling is done on the entire display content, the resulting effect is like the right justification
Definition at line 270 of file AlphaLCD.cpp.
References _displaymode, command(), LCD_ENTRYMODESET, and LCD_ENTRYSHIFTINCREMENT.
Referenced by isAutoscroll().
void AlphaLCD::begin | ( | uint8_t | cols, |
uint8_t | lines, | ||
uint8_t | dotsize = 0x00 |
||
) |
Start the LCD modes and initializes the software configuration parameters.
int Number of columns (hardware settings: 16 characters) int number of lines (hardware settings: 2 lines)
Definition at line 83 of file AlphaLCD.cpp.
References _clock_pin, _currline, _data_pin, _displaycontrol, _displayfunction, _displaymode, _numlines, clear(), command(), display(), LCD_2LINE, LCD_5x10DOTS, LCD_8BITMODE, LCD_BLINKOFF, LCD_CURSOROFF, LCD_DISPLAYON, LCD_ENTRYLEFT, LCD_ENTRYMODESET, LCD_ENTRYSHIFTDECREMENT, LCD_FUNCTIONSET, and write4bits().
Referenced by init().
void AlphaLCD::blink | ( | ) |
Turn off the blinking cursor.
Definition at line 229 of file AlphaLCD.cpp.
References _displaycontrol, command(), LCD_BLINKON, and LCD_DISPLAYCONTROL.
Referenced by isBlinking().
void AlphaLCD::clear | ( | ) |
Clear the display content and set the cursor to the position (0,0)
Definition at line 152 of file AlphaLCD.cpp.
References command(), and LCD_CLEARDISPLAY.
Referenced by begin().
|
inline |
Helper method to send commands to the device.
Definition at line 339 of file AlphaLCD.cpp.
References send().
Referenced by autoscroll(), begin(), blink(), clear(), createChar(), cursor(), display(), home(), leftToRight(), noAutoscroll(), noBlink(), noCursor(), noDisplay(), rightToLeft(), scrollDisplayLeft(), scrollDisplayRight(), and setCursor().
void AlphaLCD::createChar | ( | uint8_t | location, |
uint8_t | charmap[] | ||
) |
Create one of the 8 CGRAM memory locations from 0x00 to 0x07 with a user defined characters.
The characters should be 5x8 dots font patterns, so the definition should be an 8 bytes array with the less 5 bits set accordingly with the pixels values of the character pattern.
int | The character memory location |
int | the character map 8 bytes array |
Definition at line 324 of file AlphaLCD.cpp.
References command(), LCD_SETCGRAMADDR, and write().
void AlphaLCD::cursor | ( | ) |
Turn on the underline cursor.
Definition at line 213 of file AlphaLCD.cpp.
References _displaycontrol, command(), LCD_CURSORON, and LCD_DISPLAYCONTROL.
Referenced by isCursor().
void AlphaLCD::display | ( | ) |
Turn on the display.
Definition at line 197 of file AlphaLCD.cpp.
References _displaycontrol, command(), LCD_DISPLAYCONTROL, and LCD_DISPLAYON.
Referenced by begin(), and isDisplay().
void AlphaLCD::home | ( | ) |
Set the cursor to the position (0,0)
Definition at line 161 of file AlphaLCD.cpp.
References command(), and LCD_RETURNHOME.
void AlphaLCD::init | ( | uint8_t | dp, |
uint8_t | cp, | ||
uint8_t | lp | ||
) |
Hardware initialization.
Initializes the hardware parameters for the LCD connection. The LCD mode is set to 4 bit by default due the hardware circuit settings
int | Data Pin number |
int | Clock Pin number |
int | Latch Pin number |
Definition at line 56 of file AlphaLCD.cpp.
References _backlight, _clock_pin, _data_pin, _displayfunction, _latch_pin, begin(), LCD_1LINE, LCD_4BITMODE, LCD_5x8DOTS, and LCD_BL_PIN.
Referenced by AlphaLCD().
|
inline |
Helper method to set on/off autoscroll.
bool | the flag setting |
Definition at line 309 of file AlphaLCD.cpp.
References autoscroll(), and noAutoscroll().
|
inline |
Helper method to set on/off the blinking cursor.
bool | the flag setting |
Definition at line 297 of file AlphaLCD.cpp.
References blink(), and noBlink().
|
inline |
Helper method to set on/off the cursor visibility.
bool | the flag setting |
Definition at line 291 of file AlphaLCD.cpp.
References cursor(), and noCursor().
|
inline |
Helper method to set on/off the display.
bool | the flag setting |
Definition at line 285 of file AlphaLCD.cpp.
References display(), and noDisplay().
|
inline |
Helper method to set on/off the right-to-left writing direction.
bool | the flag setting |
Definition at line 303 of file AlphaLCD.cpp.
References leftToRight(), and rightToLeft().
void AlphaLCD::leftToRight | ( | void | ) |
Flow the text from left to right.
Definition at line 253 of file AlphaLCD.cpp.
References _displaymode, command(), LCD_ENTRYLEFT, and LCD_ENTRYMODESET.
Referenced by isRightToLeft().
void AlphaLCD::noAutoscroll | ( | void | ) |
Disable the automatic horizontal scrolling of the text.
Definition at line 278 of file AlphaLCD.cpp.
References _displaymode, command(), LCD_ENTRYMODESET, and LCD_ENTRYSHIFTINCREMENT.
Referenced by isAutoscroll().
void AlphaLCD::noBlink | ( | ) |
Turn off the blinking cursor.
Definition at line 221 of file AlphaLCD.cpp.
References _displaycontrol, command(), LCD_BLINKON, and LCD_DISPLAYCONTROL.
Referenced by isBlinking().
void AlphaLCD::noCursor | ( | ) |
Turn off the underline cursor.
Definition at line 205 of file AlphaLCD.cpp.
References _displaycontrol, command(), LCD_CURSORON, and LCD_DISPLAYCONTROL.
Referenced by isCursor().
void AlphaLCD::noDisplay | ( | ) |
Turn off the display.
Definition at line 189 of file AlphaLCD.cpp.
References _displaycontrol, command(), LCD_DISPLAYCONTROL, and LCD_DISPLAYON.
Referenced by isDisplay().
void AlphaLCD::rightToLeft | ( | void | ) |
Flow the text from right to left.
Definition at line 261 of file AlphaLCD.cpp.
References _displaymode, command(), LCD_ENTRYLEFT, and LCD_ENTRYMODESET.
Referenced by isRightToLeft().
void AlphaLCD::scrollDisplayLeft | ( | void | ) |
Scroll the display to the left by one position.
The method does not change the ram content.
Definition at line 238 of file AlphaLCD.cpp.
References command(), LCD_CURSORSHIFT, LCD_DISPLAYMOVE, and LCD_MOVELEFT.
void AlphaLCD::scrollDisplayRight | ( | void | ) |
Scroll the display to the right by one position.
The method does not change the ram content.
Definition at line 246 of file AlphaLCD.cpp.
References command(), LCD_CURSORSHIFT, LCD_DISPLAYMOVE, and LCD_MOVERIGHT.
|
private |
Write either command or data, with automatic 4/8-bit selection.
Definition at line 353 of file AlphaLCD.cpp.
References _displayfunction, LCD_8BITMODE, write4bits(), and write8bits().
Referenced by command(), and write().
void AlphaLCD::setCursor | ( | uint8_t | col, |
uint8_t | row | ||
) |
Set the cursor to the requested position.
The method take care avoiding out of bound row and column values.
int | column |
int | row |
Definition at line 176 of file AlphaLCD.cpp.
References _numlines, command(), and LCD_SETDDRAMADDR.
|
inlinevirtual |
Helper method to send data to the device.
Definition at line 346 of file AlphaLCD.cpp.
References send().
Referenced by createChar().
|
private |
Write the character on the device, 4 bits mode.
int the character data mode the backlight on/off writing mode always on by default
Definition at line 369 of file AlphaLCD.cpp.
References _backlight, _clock_pin, _data_pin, _latch_pin, and LCD_RS_PIN.
Referenced by begin(), and send().
|
private |
Write the character on the device, 8 bits mode.
int the character data mode the backlight on/off writing mode always on by default
Definition at line 406 of file AlphaLCD.cpp.
References _clock_pin, _data_pin, and _latch_pin.
Referenced by send().
|
private |
Definition at line 112 of file AlphaLCD.h.
Referenced by init(), and write4bits().
|
private |
Definition at line 105 of file AlphaLCD.h.
Referenced by begin(), init(), write4bits(), and write8bits().
|
private |
Definition at line 114 of file AlphaLCD.h.
Referenced by begin().
|
private |
Definition at line 106 of file AlphaLCD.h.
Referenced by begin(), init(), write4bits(), and write8bits().
|
private |
Definition at line 110 of file AlphaLCD.h.
Referenced by begin(), blink(), cursor(), display(), noBlink(), noCursor(), and noDisplay().
|
private |
Definition at line 109 of file AlphaLCD.h.
|
private |
Definition at line 111 of file AlphaLCD.h.
Referenced by autoscroll(), begin(), leftToRight(), noAutoscroll(), and rightToLeft().
|
private |
Definition at line 113 of file AlphaLCD.h.
|
private |
Definition at line 107 of file AlphaLCD.h.
Referenced by init(), write4bits(), and write8bits().
|
private |
Definition at line 114 of file AlphaLCD.h.
Referenced by begin(), and setCursor().
|
private |
Definition at line 108 of file AlphaLCD.h.