Class HD44780DisplayDriver

java.lang.Object
com.ibasco.ucgdisplay.drivers.clcd.HD44780DisplayDriver
All Implemented Interfaces:
DisplayDriver, CharDisplayDriver

public class HD44780DisplayDriver extends Object
Native implementation for HD44780 Character Display Driver. Compatible with the Pi4J LCD interface. Note: This class is NOT thread-safe
Author:
Rafael Ibasco
  • Constructor Details

    • HD44780DisplayDriver

      public HD44780DisplayDriver(LcdPinMapConfig lcdPinMap, int cols, int rows) throws IOException
      LCD Default Constructor. Uses RPI GPIO as the default adapter interface for data transmission.
      Parameters:
      lcdPinMap - The Pin mapping configuration
      Throws:
      IOException
    • HD44780DisplayDriver

      public HD44780DisplayDriver(LcdGpioAdapter lcdGpioAdapter, int cols, int rows) throws IOException
      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 IOException
      LCD Constructor. 5x8 Character Size is used by default.
      Parameters:
      lcdGpioAdapter - The adapter interface to use for communicating with the LCD device
      cols - The maximum number of supported columns on the LCD device
      rows - The maximum number of supported rows on the LCD device
      operationMode - The operation mode (4-bit or 8-bit)
      Throws:
      IOException
    • HD44780DisplayDriver

      public HD44780DisplayDriver(LcdGpioAdapter lcdGpioAdapter, int cols, int rows, LcdOperationMode operationMode, LcdCharSize charSize) throws IOException
      LCD Constructor
      Parameters:
      lcdGpioAdapter - The adapter interface to use for communicating with the LCD device
      cols - The maximum number of supported columns on the LCD device
      rows - The maximum number of supported rows on the LCD device
      operationMode - 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 otherwise false to turn off.
    • blink

      public void blink(boolean state)
      Equivalent to blink/noBlink
      Parameters:
      state - Set to True to set cursor blink state
    • cursor

      public void cursor(boolean state)
      Equivalent to cursor/noCursor
      Parameters:
      state - Set to True to display the cursor False 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 - If true text will be moved one space to the left false to disable autoscrolling
    • scrollDisplay

      public void scrollDisplay(ScrollDirection direction)
      Scroll the display either left or right. This scroll the display without changing the RAM
      Parameters:
      direction - The ScrollDirection enum
    • textDirection

      public void textDirection(TextDirection 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

      public void write(String data)