AStar32U4 library
Public Member Functions | List of all members
AStar32U4LCD Class Reference

Main class for interfacing with the A-Star 32U4 LCD. More...

#include <AStar32U4LCD.h>

Inheritance diagram for AStar32U4LCD:
PololuHD44780Base

Public Member Functions

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)
 

Detailed Description

Main class for interfacing with the A-Star 32U4 LCD.

This class interfaces with an HD44780-compatible LCD connected to the LCD connector on the A-Star 32U4 Prime.

This library is similar to the Arduino LiquidCrystal library, but it has some extra features needed on the A-Star 32U4 Prime:

This class assumes that you are using the default pin mapping that you would get by simply connecting an LCD to the 2x7 LCD connector on the A-Star 32U4 Prime:

If you want to control your LCD with different pins, you can edit the line labeled "Pin assignments" in AStar32U4PrimeLCD.h or you can make your own new LCD class in your sketch by copying the code for the AStar32U4PrimeLCD class, which is not very long.

This class inherits from the Arduino Print class, so you can call the print() function on it with a variety of arguments. See the Arduino print() documentation for more information.

For detailed information about HD44780 LCD interface, including what characters can be displayed, see the HD44780 datasheet.

Definition at line 55 of file AStar32U4LCD.h.

Member Function Documentation

◆ autoscroll()

void PololuHD44780Base::autoscroll ( )
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.

◆ blink()

void PololuHD44780Base::blink ( )
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.

◆ clear()

void PololuHD44780Base::clear ( )
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.

◆ command()

void PololuHD44780Base::command ( uint8_t  cmd)
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.

◆ createChar()

void PololuHD44780Base::createChar ( uint8_t  number,
uint8_t  picture[] 
)
inlineinherited

Defines a custom character. This is provided for compatibility with the LiquidCrystal library.

Definition at line 152 of file PololuHD44780.h.

◆ cursor()

void PololuHD44780Base::cursor ( )
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.

◆ cursorBlinking()

void PololuHD44780Base::cursorBlinking ( )
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.

◆ cursorSolid()

void PololuHD44780Base::cursorSolid ( )
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.

◆ display()

void PololuHD44780Base::display ( )
inherited

Turns the display on. This should only be needed if noDisplay() was previously called.

Definition at line 157 of file PololuHD44780.cpp.

◆ gotoXY()

void PololuHD44780Base::gotoXY ( uint8_t  x,
uint8_t  y 
)
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.

Parameters
xThe number of the column to go to, with 0 being the leftmost column.
yThe number of the row to go to, with 0 being the top row.

Definition at line 88 of file PololuHD44780.cpp.

◆ hideCursor()

void PololuHD44780Base::hideCursor ( )
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.

◆ home()

void PololuHD44780Base::home ( )
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.

◆ init()

void PololuHD44780Base::init ( )
inlineinherited

Initialize the LCD if it has not already been initialized.

Definition at line 67 of file PololuHD44780.h.

◆ initPins()

virtual void AStar32U4LCD::initPins ( )
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 62 of file AStar32U4LCD.h.

◆ leftToRight()

void PololuHD44780Base::leftToRight ( )
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.

◆ loadCustomCharacter() [1/2]

void PololuHD44780Base::loadCustomCharacter ( const uint8_t *  picture,
uint8_t  number 
)
inherited

Defines a custom character.

Parameters
pictureA pointer to the character dot pattern, in program space.
numberA number between 0 and 7.

Definition at line 103 of file PololuHD44780.cpp.

◆ loadCustomCharacter() [2/2]

void PololuHD44780Base::loadCustomCharacter ( const char *  picture,
uint8_t  number 
)
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.

◆ loadCustomCharacterFromRam()

void PololuHD44780Base::loadCustomCharacterFromRam ( const uint8_t *  picture,
uint8_t  number 
)
inherited

Defines a custom character from RAM.

Parameters
pictureA pointer to the character dot pattern, in RAM.
numberA number between 0 and 7.

Definition at line 117 of file PololuHD44780.cpp.

◆ noAutoscroll()

void PololuHD44780Base::noAutoscroll ( )
inherited

Turns off auto-scrolling. Auto-scrolling is off by default.

Definition at line 219 of file PololuHD44780.cpp.

◆ noBlink()

void PololuHD44780Base::noBlink ( )
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.

◆ noCursor()

void PololuHD44780Base::noCursor ( )
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.

◆ noDisplay()

void PololuHD44780Base::noDisplay ( )
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.

◆ reinitialize()

void PololuHD44780Base::reinitialize ( )
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.

◆ rightToLeft()

void PololuHD44780Base::rightToLeft ( )
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.

◆ scrollDisplayLeft()

void PololuHD44780Base::scrollDisplayLeft ( )
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.

◆ scrollDisplayRight()

void PololuHD44780Base::scrollDisplayRight ( )
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.

◆ send()

virtual void AStar32U4LCD::send ( uint8_t  data,
bool  rsValue,
bool  only4bits 
)
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.

Parameters
dataThe data to send to the LCD.
rsValueTrue to drive the RS pin high, false to drive it low.
only4bitsIf true, and the LCD is using a 4-bit interface, only sends the lower 4 bits of the data.

Implements PololuHD44780Base.

Definition at line 67 of file AStar32U4LCD.h.

◆ setCursor()

void PololuHD44780Base::setCursor ( uint8_t  col,
uint8_t  row 
)
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.

◆ write() [1/2]

size_t PololuHD44780Base::write ( uint8_t  c)
virtualinherited

Writes a single character to the LCD.

Definition at line 62 of file PololuHD44780.cpp.

◆ write() [2/2]

size_t PololuHD44780Base::write ( const uint8_t *  buffer,
size_t  size 
)
virtualinherited

Writes multiple characters to the LCD.

Parameters
bufferPointer to a string of characters in RAM, not necessarily null-terminated.
sizeThe number of characters to write to the LCD, excluding any null termination character.

Definition at line 68 of file PololuHD44780.cpp.


The documentation for this class was generated from the following file: