Class HD44780DisplayDriver
java.lang.Object
com.ibasco.ucgdisplay.drivers.clcd.HD44780DisplayDriver
- All Implemented Interfaces:
DisplayDriver
,CharDisplayDriver
Native implementation for HD44780 Character Display Driver. Compatible with the Pi4J
LCD
interface.
Note: This class is NOT thread-safe- Author:
- Rafael Ibasco
-
Constructor Summary
ConstructorDescriptionHD44780DisplayDriver(LcdGpioAdapter lcdGpioAdapter, int cols, int rows)
LCD Constructor.HD44780DisplayDriver(LcdGpioAdapter lcdGpioAdapter, int cols, int rows, LcdOperationMode operationMode)
LCD Constructor.HD44780DisplayDriver(LcdGpioAdapter lcdGpioAdapter, int cols, int rows, LcdOperationMode operationMode, LcdCharSize charSize)
LCD ConstructorHD44780DisplayDriver(LcdPinMapConfig lcdPinMap, int cols, int rows)
LCD Default Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
autoscroll(boolean state)
This mode moves all the text one space to the left each time a letter is added.void
blink(boolean state)
Equivalent to blink/noBlinkvoid
clear()
Clears the data on the lcd screen and resets the cursor back to 0void
createChar(int num, byte[] charData)
Create custom lcd charactersvoid
cursor(boolean state)
Equivalent to cursor/noCursorvoid
display(boolean state)
Sets the display state to either on or off.int
int
getWidth()
void
home()
Resets the cursor position back to 0void
scrollDisplay(ScrollDirection direction)
Scroll the display either left or right.void
setCursor(int column, int row)
Sets the current cursor positionvoid
textDirection(TextDirection textDirection)
Sets the text flow direction.void
write(byte... data)
Send Data (Set RS to HIGH)void
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.ibasco.ucgdisplay.drivers.clcd.CharDisplayDriver
getId
-
Constructor Details
-
HD44780DisplayDriver
LCD Default Constructor. Uses RPI GPIO as the default adapter interface for data transmission.- Parameters:
lcdPinMap
- The Pin mapping configuration- Throws:
IOException
-
HD44780DisplayDriver
LCD Constructor. 4-bit communication is used by default.- Parameters:
lcdGpioAdapter
- The adapter interface to use for communicating with the LCD device- Throws:
IOException
-
HD44780DisplayDriver
public HD44780DisplayDriver(LcdGpioAdapter lcdGpioAdapter, int cols, int rows, LcdOperationMode operationMode) throws IOExceptionLCD Constructor. 5x8 Character Size is used by default.- Parameters:
lcdGpioAdapter
- The adapter interface to use for communicating with the LCD devicecols
- The maximum number of supported columns on the LCD devicerows
- The maximum number of supported rows on the LCD deviceoperationMode
- The operation mode (4-bit or 8-bit)- Throws:
IOException
-
HD44780DisplayDriver
public HD44780DisplayDriver(LcdGpioAdapter lcdGpioAdapter, int cols, int rows, LcdOperationMode operationMode, LcdCharSize charSize) throws IOExceptionLCD Constructor- Parameters:
lcdGpioAdapter
- The adapter interface to use for communicating with the LCD devicecols
- The maximum number of supported columns on the LCD devicerows
- The maximum number of supported rows on the LCD deviceoperationMode
- The mode of operation to use for data transfer.charSize
- The supported character size of the LCD device (5x8 or 5x10)- Throws:
IOException
-
-
Method Details
-
getHeight
public int getHeight()- Returns:
- The maximum number of rows supported
-
getWidth
public int getWidth()- Returns:
- The maximum number of columns supported
-
clear
public void clear()Clears the data on the lcd screen and resets the cursor back to 0 -
home
public void home()Resets the cursor position back to 0 -
display
public void display(boolean state)Sets the display state to either on or off. Note that the data will still be preserved when the state is OFF.- Parameters:
state
-true
to turn on the display otherwisefalse
to turn off.
-
blink
public void blink(boolean state)Equivalent to blink/noBlink- Parameters:
state
- Set toTrue
to set cursor blink state
-
cursor
public void cursor(boolean state)Equivalent to cursor/noCursor- Parameters:
state
- Set toTrue
to display the cursorFalse
to disable it.
-
autoscroll
public void autoscroll(boolean state)This mode moves all the text one space to the left each time a letter is added. Right/Left justifification from the cursor position.- Parameters:
state
- Iftrue
text will be moved one space to the leftfalse
to disable autoscrolling
-
scrollDisplay
Scroll the display either left or right. This scroll the display without changing the RAM- Parameters:
direction
- TheScrollDirection
enum
-
textDirection
Sets the text flow direction. (Left to Right OR Right to Left). Ex: If you specify 'left to right', succeeding characters written will flow from left to right.- Parameters:
textDirection
- The flow of text direction.
-
createChar
public void createChar(int num, byte[] charData)Create custom lcd characters- Parameters:
num
- The number representing the character (0 to 7 range)charData
- The custom character data
-
setCursor
public void setCursor(int column, int row)Sets the current cursor position- Parameters:
row
- Number representing a row on the lcd where 0 indicates the first row.column
- Number representing a column on the lcd where 0 indicates the first column.
-
write
public void write(byte... data)Send Data (Set RS to HIGH)- Parameters:
data
- The byte data to be sent to the lcd
-
write
-