de.wagner_ibw.iow.lcd
Class LCDImpl

java.lang.Object
  |
  +--de.wagner_ibw.iow.lcd.LCDImpl
All Implemented Interfaces:
LCD, SpecialModeFunction
Direct Known Subclasses:
DoubleLCDImpl, LCD1x24, LCD2x16, LCD2x20, LCD2x24, LCD2x40, LCD4x16, LCD4x20

public class LCDImpl
extends java.lang.Object
implements SpecialModeFunction, LCD

This is the implementation of the LCD special mode function. It supports only single controler LCD display.

Author:
Thomas Wagner

Field Summary
 
Fields inherited from interface de.wagner_ibw.iow.SpecialModeFunction
SMF_CPS_ID, SMF_I2C_ID, SMF_LCD_ID, SMF_LED_ID, SMF_RC5_ID, SMF_SMX_ID, SMF_SPI_ID
 
Constructor Summary
LCDImpl()
           
 
Method Summary
 void check()
          Prüft die korrekte Anzeige.
 java.lang.String checkCompatibility(int id, int rev, int specialModes)
          Checks if it is possible to activate this special mode function.
 long clearLCD()
          OK Clears entire dislplay and sets DDRAM address 0 in address counter.
 int getCols()
           
 int[] getDisableReport()
          Returns the report that disables the special mode function.
 int[] getEnableReport()
          Returns the report that enables the special mode function.
 int[] getIowSpecialBits(int deviceIdentifier)
          Returns an array of bitmask(s) for port 0...1 or 0...3 if this special mode function runs on this iow device.
 java.lang.String getName()
          Returns the name of the special mode function.
 int[] getReportIds()
          Returns the report id(s) which the implementation is interested in.
 int getRows()
           
 int getSpecialModeFuncionId()
          Returns the special mode function id for this implementation.
 boolean matchReportId(int reportId)
          Checks if this implementation is interested in this report.
 void moveSprite(int row, java.lang.String[] sprites, int wait)
           
 void reportReceived(int[] readBuffer)
          Callback method is called when a matching report was received.
 long setCGRAMAddr(int address)
          Set DDRAM address Parameters: Address - DDRAM address
 long setCursor(int row, int col)
          OK Moves cursor to new Position.
 long setCursorDispOn()
          OK Convenient method: Turn LCD display on.
 long setCursorHome()
          OK Sets DDRAM address 0 in address counter.
 long setCursorleft()
          Move LCD cursor to the left
 long setCursorOff()
          OK Convenient method: Turn LCD cursor off.
 long setCursorOn()
          OK Convenient method: Turn LCD cursor on.
 long setCursorRight()
          Move LCD cursor to the right
 long setDDRAMAddr(int address)
          Set DDRAM address Parameters: Address - DDRAM address
 long setDisplayControl(boolean dispOn, boolean cursorOn, boolean charBlinking)
          OK Sets ON/OFF of all display (dispOn), cursor ON/OFF (cursorOn), and blink of cursor position character (cursorBlink).
 long setDispOff()
          OK Convenient method: Turn LCD display off.
 long setEntryMode(boolean moveForward, boolean shiftDisp)
          OK Sets cursor move direction and specifies display shift.
 void setIowDevice(AbstractIowDevice iow)
          Sets the reference to the underlying iow device for write report operations.
 long setShiftControl(boolean shiftDisp, boolean shiftDir)
          OK Moves cursor and shifts display whitout changing DDRAM contents.
 void setSpecialChar(int code, int[] pattern)
           
 void writeLine(int row, boolean clear, java.lang.String str)
          Write the given String in row specified by parm row.
 void writeLine(int row, int col, boolean clear, java.lang.String str)
          Write the given String in the specified row and column.
 void writeString(java.lang.String str)
          OK Write the given string to LCD.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LCDImpl

public LCDImpl()
Method Detail

getRows

public int getRows()
Specified by:
getRows in interface LCD

getCols

public int getCols()
Specified by:
getCols in interface LCD

clearLCD

public long clearLCD()
Description copied from interface: LCD
OK Clears entire dislplay and sets DDRAM address 0 in address counter.

Specified by:
clearLCD in interface LCD
Returns:
Number of written bytes (8 expected for a successful operation).

setCursorHome

public long setCursorHome()
Description copied from interface: LCD
OK Sets DDRAM address 0 in address counter. Also returns display from being shiftet to original position. DDRAM contents remain unchanged.

Specified by:
setCursorHome in interface LCD
Returns:
Number of written bytes (8 expected for a successful operation).

setEntryMode

public long setEntryMode(boolean moveForward,
                         boolean shiftDisp)
Description copied from interface: LCD
OK Sets cursor move direction and specifies display shift. These operations are performed during data write and read.

Specified by:
setEntryMode in interface LCD
Parameters:
moveForward - true: increment, false: decrement
shiftDisp - true: display is shifted, false: display is not shifted
Returns:
Number of written bytes (8 expected for a successful operation).

setDisplayControl

public long setDisplayControl(boolean dispOn,
                              boolean cursorOn,
                              boolean charBlinking)
Description copied from interface: LCD
OK Sets ON/OFF of all display (dispOn), cursor ON/OFF (cursorOn), and blink of cursor position character (cursorBlink).

Specified by:
setDisplayControl in interface LCD
Parameters:
dispOn - true: the display is on, false: display is off
cursorOn - true: cursor is displayed, false: cursor is not displayed
charBlinking - true: the character indicated by the cursor blinks, false: blinks not
Returns:
Number of written bytes (8 expected for a successful operation).

setShiftControl

public long setShiftControl(boolean shiftDisp,
                            boolean shiftDir)
Description copied from interface: LCD
OK Moves cursor and shifts display whitout changing DDRAM contents.

Specified by:
setShiftControl in interface LCD
Parameters:
shiftDisp - true: display shift, false: cursor move;
shiftDir - true: shift to the right, false: shift to the left
Returns:
Number of written bytes (8 expected for a successful operation).

writeLine

public void writeLine(int row,
                      boolean clear,
                      java.lang.String str)
               throws java.lang.IllegalArgumentException
Description copied from interface: LCD
Write the given String in row specified by parm row. If parm clear is true the row will be cleared before output. All characters exceeding the cols will be truncated.

Specified by:
writeLine in interface LCD
Parameters:
row -
clear -
str -
java.lang.IllegalArgumentException

writeLine

public void writeLine(int row,
                      int col,
                      boolean clear,
                      java.lang.String str)
               throws java.lang.IllegalArgumentException
Description copied from interface: LCD
Write the given String in the specified row and column. If parm clear is true the row will be cleared before output. All characters exceeding the cols will be truncated.

Specified by:
writeLine in interface LCD
Parameters:
row -
clear -
str -
java.lang.IllegalArgumentException

writeString

public void writeString(java.lang.String str)
Description copied from interface: LCD
OK Write the given string to LCD.

Specified by:
writeString in interface LCD
Parameters:
str - String to write

setDDRAMAddr

public long setDDRAMAddr(int address)
Set DDRAM address Parameters: Address - DDRAM address

Specified by:
setDDRAMAddr in interface LCD

setCGRAMAddr

public long setCGRAMAddr(int address)
Set DDRAM address Parameters: Address - DDRAM address

Specified by:
setCGRAMAddr in interface LCD

setCursor

public long setCursor(int row,
                      int col)
               throws java.lang.IllegalArgumentException
OK Moves cursor to new Position.

Specified by:
setCursor in interface LCD
Parameters:
row - display line (1...4)
col - column in row (1...40)
java.lang.IllegalArgumentException

setCursorDispOn

public long setCursorDispOn()
OK Convenient method: Turn LCD display on.

Specified by:
setCursorDispOn in interface LCD
Returns:
Number of written bytes (8 expected for a successful operation).

setDispOff

public long setDispOff()
OK Convenient method: Turn LCD display off.

Specified by:
setDispOff in interface LCD
Returns:
Number of written bytes (8 expected for a successful operation).

setCursorOn

public long setCursorOn()
OK Convenient method: Turn LCD cursor on.

Specified by:
setCursorOn in interface LCD
Returns:
Number of written bytes (8 expected for a successful operation).

setCursorOff

public long setCursorOff()
OK Convenient method: Turn LCD cursor off.

Specified by:
setCursorOff in interface LCD
Returns:
Number of written bytes (8 expected for a successful operation).

setCursorleft

public long setCursorleft()
Move LCD cursor to the left

Specified by:
setCursorleft in interface LCD
Returns:
Number of written bytes (8 expected for a successful operation).

setCursorRight

public long setCursorRight()
Move LCD cursor to the right

Specified by:
setCursorRight in interface LCD
Returns:
Number of written bytes (8 expected for a successful operation).

check

public void check()
Description copied from interface: LCD
Prüft die korrekte Anzeige.

Specified by:
check in interface LCD

setSpecialChar

public void setSpecialChar(int code,
                           int[] pattern)
                    throws java.lang.IllegalArgumentException
Specified by:
setSpecialChar in interface LCD
java.lang.IllegalArgumentException

moveSprite

public void moveSprite(int row,
                       java.lang.String[] sprites,
                       int wait)
                throws java.lang.IllegalArgumentException
Specified by:
moveSprite in interface LCD
java.lang.IllegalArgumentException

getDisableReport

public int[] getDisableReport()
Description copied from interface: SpecialModeFunction
Returns the report that disables the special mode function.

Specified by:
getDisableReport in interface SpecialModeFunction
Returns:
Special mode function disable report.

getEnableReport

public int[] getEnableReport()
Description copied from interface: SpecialModeFunction
Returns the report that enables the special mode function.

Specified by:
getEnableReport in interface SpecialModeFunction
Returns:
Special mode function enable report.

getIowSpecialBits

public int[] getIowSpecialBits(int deviceIdentifier)
Description copied from interface: SpecialModeFunction
Returns an array of bitmask(s) for port 0...1 or 0...3 if this special mode function runs on this iow device. Returns a array of lenght zero if no bits used by this special mode function. 1 means this bit is dedicated by special mode function. 0 means this bit is free for normal pin io operations.

Specified by:
getIowSpecialBits in interface SpecialModeFunction
Parameters:
deviceIdentifier - Iow device identifier (AbstractIowDevice.IOW24ID or AbstractIowDevice.IOW40ID).
Returns:
Array of int that contains bitmask(s) for special mode function bits.

getReportIds

public int[] getReportIds()
Description copied from interface: SpecialModeFunction
Returns the report id(s) which the implementation is interested in.

Specified by:
getReportIds in interface SpecialModeFunction
Returns:
Int array of special mode function id(s).

getSpecialModeFuncionId

public int getSpecialModeFuncionId()
Description copied from interface: SpecialModeFunction
Returns the special mode function id for this implementation.

Specified by:
getSpecialModeFuncionId in interface SpecialModeFunction
Returns:
Special mode function id (SMF_LCD_ID,SMF_RC5_ID,SMF_I2C_ID,SMF_CPS_ID,SMF_SPI_ID).

matchReportId

public boolean matchReportId(int reportId)
Description copied from interface: SpecialModeFunction
Checks if this implementation is interested in this report.

Specified by:
matchReportId in interface SpecialModeFunction
Parameters:
reportId - Report id of the received report.
Returns:
True if it fits or false if not.

reportReceived

public void reportReceived(int[] readBuffer)
Description copied from interface: SpecialModeFunction
Callback method is called when a matching report was received.

Specified by:
reportReceived in interface SpecialModeFunction
Parameters:
readBuffer - Read buffer from a received report.

setIowDevice

public void setIowDevice(AbstractIowDevice iow)
Description copied from interface: SpecialModeFunction
Sets the reference to the underlying iow device for write report operations.

Specified by:
setIowDevice in interface SpecialModeFunction
Parameters:
iow - Instance of an iow device.

checkCompatibility

public java.lang.String checkCompatibility(int id,
                                           int rev,
                                           int specialModes)
Description copied from interface: SpecialModeFunction
Checks if it is possible to activate this special mode function. This depends on id and/or rev of the iow device and/or already activated special mode functions.

Specified by:
checkCompatibility in interface SpecialModeFunction
Parameters:
id - Id of the current iow device.
rev - Rev of the current iow device.
specialModes - Special modes from the current iow device.
Returns:
Error string if special mode function is not available. Returns null if special mode function is available.

getName

public java.lang.String getName()
Description copied from interface: SpecialModeFunction
Returns the name of the special mode function.

Specified by:
getName in interface SpecialModeFunction
Returns:
Name of the special mode function.