Romi32U4 library
|
Main class for interfacing with the HD44780 LCDs. More...
#include <PololuHD44780.h>
Public Member Functions | |
PololuHD44780 (uint8_t rs, uint8_t e, uint8_t db4, uint8_t db5, uint8_t db6, uint8_t db7) | |
virtual void | initPins () |
virtual void | send (uint8_t data, bool rsValue, bool only4bits) |
void | init () |
void | reinitialize () |
void | clear () |
void | loadCustomCharacter (const uint8_t *picture, uint8_t number) |
void | loadCustomCharacter (const char *picture, uint8_t number) |
void | loadCustomCharacterFromRam (const uint8_t *picture, uint8_t number) |
void | createChar (uint8_t number, uint8_t picture[]) |
void | gotoXY (uint8_t x, uint8_t y) |
void | setCursor (uint8_t col, uint8_t row) |
void | noDisplay () |
void | display () |
void | noCursor () |
void | cursor () |
void | noBlink () |
void | blink () |
void | cursorSolid () |
void | cursorBlinking () |
void | hideCursor () |
void | scrollDisplayLeft () |
void | scrollDisplayRight () |
void | home () |
void | leftToRight () |
void | rightToLeft () |
void | autoscroll () |
void | noAutoscroll () |
void | command (uint8_t cmd) |
virtual size_t | write (uint8_t c) |
virtual size_t | write (const uint8_t *buffer, size_t size) |
Main class for interfacing with the HD44780 LCDs.
This class is suitable for controlling an HD44780 LCD assuming that the LCD's RS, E, DB4, DB5, DB6, and DB7 pins are each connected to a pin on the microcontroller, each of those six microcontroller pins is supported by the Arduino's pinMode
and digitalWrite
functions, and those pins are not being used for any other purpose that conflicts with the LCD.
This class sets the E pin to be an output driving low the first time you use the LCD, and it assumes that no other code will change that pin. You cannot use E for any other purposes because if the LCD sees a pulse on the E pin then it might consider that to be a command or data, and the LCD state will become corrupted.
For the other pins (RS, DB4, DB5, and DB6), this library reconfigures them each time they are used, so it is OK if you have other code that uses those pins for other purposes. Before writing to the LCD, you just need to disable any peripherals (such as UARTs) that override the output values of those pins.
If you cannot meet these conditions, you might be able to control your LCD using a custom subclass of PololuHD44780Base. You can use this class as a reference for how to do that.
Definition at line 360 of file PololuHD44780.h.
|
inline |
Creates a new instance of PololuHD44780.
rs | The pin number for the microcontroller pin that is connected to the RS pin of the LCD. |
e | The pin number for the microcontroller pin that is connected to the E pin of the LCD. |
db4 | The pin number for the microcontroller pin that is connected to the DB4 pin of the LCD. |
db5 | The pin number for the microcontroller pin that is connected to the DB5 pin of the LCD. |
db6 | The pin number for the microcontroller pin that is connected to the DB6 pin of the LCD. |
db7 | The pin number for the microcontroller pin that is connected to the DB7 pin of the LCD. |
Definition at line 378 of file PololuHD44780.h.
|
inherited |
Turns on auto-scrolling.
When auto-scrolling is enabled, every time a character is written, the screen will automatically scroll by one column in the appropriate direction.
Definition at line 214 of file PololuHD44780.cpp.
|
inherited |
Shows the blinking cursor.
This function sets the LCD's "B" configuration bit without changing the other bits.
The cursor will normally be a blinking rectangle, but there could also be a row of solid black pixels at the bottom if previous commands have enabled the solid cursor. For this reason, it is usually better to call cursorSolid() or cursorBlinking() instead. This function is only provided for compatibilty with the LiquidCrystal library.
Definition at line 177 of file PololuHD44780.cpp.
|
inherited |
Clear the contents of the LCDs, resets the cursor position to the upper left, and resets the scroll position.
Definition at line 78 of file PololuHD44780.cpp.
|
inlineinherited |
Send an arbitrary command to the LCD. This is here for compatibility with the LiquidCrystal library.
Definition at line 294 of file PololuHD44780.h.
|
inlineinherited |
Defines a custom character. This is provided for compatibility with the LiquidCrystal library.
Definition at line 152 of file PololuHD44780.h.
|
inherited |
Shows the solid cursor.
This function sets the LCD's "C" configuration bit without changing the other bits.
The cursor will normally be a solid line in the bottom row, but there could be a blinking rectangle superimposed on it if previous commands have enabled the blinking cursor. For this reason, it is usually better to call cursorSolid() or cursorBlinking() instead. This function is only provided for compatibility with the LiquidCrystal library.
Definition at line 167 of file PololuHD44780.cpp.
|
inherited |
Enables a cursor that appears as a blinking black rectangle.
This sets the LCD's "C" and "B" configuration bits.
Note that the cursor will not be shown if the display is currently off (due to a call to noDisplay()), or if the cursor position is not within the bounds of the screen.
Definition at line 142 of file PololuHD44780.cpp.
|
inherited |
Enables a cursor that appears as a solid line in the bottom row.
This sets the LCD's "C" configuration bit and clears its "B" bit.
Note that the cursor will not be shown if the display is currently off (due to a call to noDisplay()), or if the cursor position is not within the bounds of the screen.
Definition at line 137 of file PololuHD44780.cpp.
|
inherited |
Turns the display on. This should only be needed if noDisplay() was previously called.
Definition at line 157 of file PololuHD44780.cpp.
|
inherited |
Change the location of the cursor. The cursor (whether visible or invisible), is the place where the next character written to the LCD will be displayed.
Note that the scrolling features of the LCD change the correspondence between the x
parameter and the physical column that the data is displayed on. See the "LCD scrolling" section above for more information.
x | The number of the column to go to, with 0 being the leftmost column. |
y | The number of the row to go to, with 0 being the top row. |
Definition at line 88 of file PololuHD44780.cpp.
|
inherited |
Hides the solid and blinking cursors.
This clears the LCD's "C" and "B" configuration bits.
Definition at line 147 of file PololuHD44780.cpp.
|
inherited |
Resets the screen scrolling position back to the default and moves the cursor to the upper left corner of the screen.
This command takes about 1600 microseconds, so it would be faster to instead call scrollDisplayLeft() or scrollDisplayRight() the appropriate number of times and then call gotoXY(0, 0).
Definition at line 192 of file PololuHD44780.cpp.
|
inlineinherited |
Initialize the LCD if it has not already been initialized.
Definition at line 67 of file PololuHD44780.h.
|
inlinevirtual |
Initializes the pins so that the send() function can be called successfully. This is the first step of initializing the LCD.
Implements PololuHD44780Base.
Definition at line 389 of file PololuHD44780.h.
|
inherited |
Puts the LCD into left-to-right mode: the cursor will shift to the right after any character is written. This is the default behavior.
Definition at line 204 of file PololuHD44780.cpp.
|
inherited |
Defines a custom character.
picture | A pointer to the character dot pattern, in program space. |
number | A number between 0 and 7. |
Definition at line 103 of file PololuHD44780.cpp.
|
inlineinherited |
This overload of loadCustomCharacter is only provided for compatibility with OrangutanLCD; a lot of Orangutan code defines an array of chars for custom character pictures.
Definition at line 145 of file PololuHD44780.h.
|
inherited |
Defines a custom character from RAM.
picture | A pointer to the character dot pattern, in RAM. |
number | A number between 0 and 7. |
Definition at line 117 of file PololuHD44780.cpp.
|
inherited |
Turns off auto-scrolling. Auto-scrolling is off by default.
Definition at line 219 of file PololuHD44780.cpp.
|
inherited |
Hides the blinking cursor.
This functions clears the LCD's "B" configuration bit without changing the other bits.
Calling this function does not enable or disable the solid cursor (a solid line in the bottom row) so it is usually better to call hideCursor() or cursorSolid() instead. This function is only provided for compatibilty with the LiquidCrystal library.
Definition at line 172 of file PololuHD44780.cpp.
|
inherited |
Hides the solid cursor.
This function clears the LCD's "C" configuration bit without changing the other bits.
If the "B" bit is set to 1, a blinking cursor will still be displayed even after calling this function. For that reason, it is usually better to call hideCursor() instead. This function is only provided for compatibility with the LiquidCrystal library.
Definition at line 162 of file PololuHD44780.cpp.
|
inherited |
Turns off the display while preserving its state.
You can turn the display on again by calling display().
Definition at line 152 of file PololuHD44780.cpp.
|
inlineinherited |
Reinitialize the LCD. This performs the same initialization that is done automatically the first time any function is called that writes to the LCD. This is useful if you want to get it back to a totally clean state.
Definition at line 80 of file PololuHD44780.h.
|
inherited |
Puts the LCD into right-to-left mode: the cursor will shift to the left after any character is written.
Definition at line 209 of file PololuHD44780.cpp.
|
inherited |
Scrolls everything on the screen one position to the left.
This command takes about 37 microseconds.
Definition at line 182 of file PololuHD44780.cpp.
|
inherited |
Scrolls everything on the screen one position to the right.
This command takes about 37 microseconds.
Definition at line 187 of file PololuHD44780.cpp.
|
inlinevirtual |
Sends data or commands to the LCD.
The initPins() function will always be called before the first time this function is called. This function does not need to worry about the delays necessary to make sure the previous command has finished; that is taken care of by PololuHD44780Base.
This function, along with initPins(), comprise the hardware abstraction layer for the LCD, and must be defined in a subclass of PololuHD44780Base. All other functions use these two functions to communicate with the LCD.
data | The data to send to the LCD. |
rsValue | True to drive the RS pin high, false to drive it low. |
only4bits | If true, and the LCD is using a 4-bit interface, only sends the lower 4 bits of the data. |
Implements PololuHD44780Base.
Definition at line 395 of file PololuHD44780.h.
|
inlineinherited |
Changes the location of the cursor. This is just a wrapper around gotoXY provided for compaitibility with the LiquidCrystal library.
Definition at line 170 of file PololuHD44780.h.
|
virtualinherited |
Writes a single character to the LCD.
Definition at line 62 of file PololuHD44780.cpp.
|
virtualinherited |
Writes multiple characters to the LCD.
buffer | Pointer to a string of characters in RAM, not necessarily null-terminated. |
size | The number of characters to write to the LCD, excluding any null termination character. |
Definition at line 68 of file PololuHD44780.cpp.