Package com.diozero.devices
Class HD44780Lcd
java.lang.Object
com.diozero.devices.HD44780Lcd
- All Implemented Interfaces:
DeviceInterface
,AutoCloseable
public class HD44780Lcd extends Object implements DeviceInterface
LCD with HD44780 controller.
Code based on
this Raspberry-Pi Spy article, Python code.
Another source of information: https://gist.github.com/DenisFromHR/cc863375a6e19dce359d.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
HD44780Lcd.Characters
static interface
HD44780Lcd.LcdConnection
static class
HD44780Lcd.PCF8574LcdConnection
static class
HD44780Lcd.PiFaceCadLcdConnection
-
Constructor Summary
Constructors Constructor Description HD44780Lcd(HD44780Lcd.LcdConnection lcdConnection, int columns, int rows)
-
Method Summary
Modifier and Type Method Description HD44780Lcd
addText(char character)
HD44780Lcd
addText(int code)
HD44780Lcd
addText(String text)
HD44780Lcd
autoscrollOff()
HD44780Lcd
autoscrollOn()
HD44780Lcd
blinkOff()
HD44780Lcd
blinkOn()
HD44780Lcd
clear()
Clear the displayvoid
close()
Close this deviceHD44780Lcd
createChar(int location, byte[] charMap)
HD44780Lcd
cursorOff()
HD44780Lcd
cursorOn()
HD44780Lcd
cursorOrDisplayShift(boolean displayShift, boolean shiftRight)
Cursor or display shift shifts the cursor position or display to the right or left without writing or reading display data.HD44780Lcd
displayControl(boolean displayOn, boolean cursorEnabled, boolean blinkEnabled)
HD44780Lcd
displayOff()
HD44780Lcd
displayOn()
HD44780Lcd
entryModeControl(boolean increment, boolean shiftDisplay)
Control text entry mode.int
getColumnCount()
int
getRowCount()
boolean
isBacklightEnabled()
boolean
isBlinkEnabled()
boolean
isCursorEnabled()
boolean
isIncrementOn()
boolean
isShiftDisplayOn()
HD44780Lcd
moveCursorLeft()
HD44780Lcd
moveCursorRight()
HD44780Lcd
returnHome()
Return the cursor to the home positionHD44780Lcd
setBacklightEnabled(boolean backlightEnabled)
HD44780Lcd
setCharacter(int column, int row, char character)
HD44780Lcd
setCursorPosition(int column, int row)
HD44780Lcd
setText(int row, String text)
Send string to displayHD44780Lcd
shiftDisplayLeft()
HD44780Lcd
shiftDisplayRight()
-
Constructor Details
-
HD44780Lcd
-
-
Method Details
-
getColumnCount
public int getColumnCount() -
getRowCount
public int getRowCount() -
isBacklightEnabled
public boolean isBacklightEnabled() -
setBacklightEnabled
-
setCursorPosition
-
setCharacter
-
setText
Send string to display- Parameters:
row
- Row number (starts at 0)text
- Text to display- Returns:
- This object instance
-
addText
-
addText
-
addText
-
clear
Clear the display- Returns:
- This object instance
-
returnHome
Return the cursor to the home position- Returns:
- This object instance
-
entryModeControl
Control text entry mode.- Parameters:
increment
- The cursor or blinking moves to the right when incremented by 1 and to the left when decremented by 1.shiftDisplay
- Shifts the entire display either to the right (I/D = 0) or to the left (I/D = 1) when true. The display does not shift if false. If true, it will seem as if the cursor does not move but the display does.- Returns:
- This object instance
-
autoscrollOn
-
autoscrollOff
-
isIncrementOn
public boolean isIncrementOn() -
isShiftDisplayOn
public boolean isShiftDisplayOn() -
displayControl
-
displayOn
-
displayOff
-
cursorOn
-
cursorOff
-
blinkOn
-
blinkOff
-
isCursorEnabled
public boolean isCursorEnabled() -
isBlinkEnabled
public boolean isBlinkEnabled() -
cursorOrDisplayShift
Cursor or display shift shifts the cursor position or display to the right or left without writing or reading display data. This function is used to correct or search the display. In a 2-line display, the cursor moves to the second line when it passes the 40th digit of the first line. Note that the first and second line displays will shift at the same time. When the displayed data is shifted repeatedly each line moves only horizontally. The second line display does not shift into the first line position.- Parameters:
displayShift
- Shift the display if true, the cursor if false.shiftRight
- Shift to the right if true, to the left if false.- Returns:
- This object instance
-
shiftDisplayRight
-
shiftDisplayLeft
-
moveCursorRight
-
moveCursorLeft
-
createChar
-
close
Description copied from interface:DeviceInterface
Close this device- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceDeviceInterface
- Throws:
RuntimeIOException
-