public class I2CLcd extends Object implements Closeable
Generic I2C LCD support, code based on this Raspberry-Pi Spy article, Python code: https://bitbucket.org/MattHawkinsUK/rpispy-misc/raw/master/python/lcd_i2c.py
Another source of information: https://gist.github.com/DenisFromHR/cc863375a6e19dce359d.
Datasheet for HD44780: https://www.sparkfun.com/datasheets/LCD/HD44780.pdf.
Constructor and Description |
---|
I2CLcd(int columns,
int rows) |
I2CLcd(int controller,
int deviceAddress,
ByteOrder order,
int columns,
int rows) |
Modifier and Type | Method and Description |
---|---|
void |
addText(byte code) |
void |
addText(char character) |
void |
addText(String text) |
void |
clear()
Clear the display
|
void |
close() |
void |
createChar(int location,
byte[] charMap) |
void |
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.
|
void |
displayControl(boolean displayOn,
boolean cursorEnabled,
boolean blinkEnabled) |
void |
entryModeControl(boolean increment,
boolean shiftDisplay)
Control text entry mode.
|
int |
getColumnCount() |
int |
getRowCount() |
boolean |
isBacklightOn() |
boolean |
isBlinkEnabled() |
boolean |
isCursorEnabled() |
boolean |
isIncrementOn() |
boolean |
isShiftDisplayOn() |
void |
moveCursorLeft() |
void |
moveCursorRight() |
void |
returnHome()
Return the cursor to the home position
|
void |
setBacklightOn(boolean backlight) |
void |
setCharacter(int column,
int row,
char character) |
void |
setCursorPosition(int column,
int row) |
void |
setText(int row,
String text)
Send string to display
|
void |
shiftDisplayLeft() |
void |
shiftDisplayRight() |
public I2CLcd(int columns, int rows)
public I2CLcd(int controller, int deviceAddress, ByteOrder order, int columns, int rows)
public int getColumnCount()
public int getRowCount()
public boolean isBacklightOn()
public void setBacklightOn(boolean backlight)
public void setCursorPosition(int column, int row)
public void setCharacter(int column, int row, char character)
public void setText(int row, String text)
row
- Row number (starts at 0)text
- Text to displaypublic void addText(String text)
public void addText(char character)
public void addText(byte code)
public void clear()
public void returnHome()
public void entryModeControl(boolean increment, boolean shiftDisplay)
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.public boolean isIncrementOn()
public boolean isShiftDisplayOn()
public void displayControl(boolean displayOn, boolean cursorEnabled, boolean blinkEnabled)
public boolean isCursorEnabled()
public boolean isBlinkEnabled()
public void cursorOrDisplayShift(boolean displayShift, boolean shiftRight)
displayShift
- Shift the display if true, the cursor if false.shiftRight
- Shift to the right if true, to the left if false.public void shiftDisplayRight()
public void shiftDisplayLeft()
public void moveCursorRight()
public void moveCursorLeft()
public void createChar(int location, byte[] charMap)
public void close() throws RuntimeIOException
close
in interface Closeable
close
in interface AutoCloseable
RuntimeIOException
Copyright © 2016 mattjlewis. All rights reserved.