Package lejos.hardware.lcd
Class LCD
- java.lang.Object
-
- lejos.hardware.lcd.LCD
-
public class LCD extends java.lang.ObjectProvide access to the EV3 LCD display
-
-
Field Summary
Fields Modifier and Type Field Description static intCELL_HEIGHTstatic intCELL_WIDTHstatic intDISPLAY_CHAR_DEPTHstatic intDISPLAY_CHAR_WIDTHstatic intFONT_HEIGHTstatic intFONT_WIDTHprotected static GraphicsLCDgstatic intNOOF_CHARSstatic intROP_ANDstatic intROP_ANDINVERTEDstatic intROP_ANDREVERSEstatic intROP_CLEARCommon raster operations for use with bitBltstatic intROP_COPYstatic intROP_COPYINVERTEDstatic intROP_EQUIVstatic intROP_INVERTstatic intROP_NANDstatic intROP_NOOPstatic intROP_NORstatic intROP_ORstatic intROP_ORINVERTEDstatic intROP_ORREVERSEstatic intROP_SETstatic intROP_XORstatic intSCREEN_HEIGHTstatic intSCREEN_WIDTHprotected static TextLCDt
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidasyncRefresh()Start the process of updating the display.static voidasyncRefreshWait()Wait for the current refresh cycle to complete.static voidbitBlt(byte[] src, int sw, int sh, int sx, int sy, byte[] dst, int dw, int dh, int dx, int dy, int w, int h, int rop)Standard two input BitBlt function.static voidbitBlt(byte[] src, int sw, int sh, int sx, int sy, int dx, int dy, int w, int h, int rop)Standard two input BitBlt function with the LCD display as the destination.static voidclear()Clear the display.static voidclear(int y)Clear an LCD display rowstatic voidclear(int x, int y, int n)Clear a contiguous set of charactersstatic voidclearDisplay()static voiddrawChar(char c, int x, int y)Draw a single char on the LCD at specified x,y co-ordinate.static voiddrawInt(int i, int x, int y)Display an int on the LCD at specified x,y co-ordinate.static voiddrawInt(int i, int places, int x, int y)Display an in on the LCD at x,y with leading spaces to occupy at least the number of characters specified by the places parameter.static voiddrawString(java.lang.String str, int x, int y)Display a string on the LCD at specified x,y co-ordinate.static voiddrawString(java.lang.String str, int x, int y, boolean inverted)Display an optionally inverted string on the LCD at specified x,y co-ordinate.static byte[]getDisplay()Provide access to the LCD display frame buffer.static byte[]getHWDisplay()static intgetPixel(int x, int y)Method to get a pixel from the screen.static longgetRefreshCompleteTime()Obtain the system time when the current display refresh operation will be complete.static byte[]getSystemFont()Provide access to the LCD system font.static voidrefresh()Refresh the display.static voidscroll()Scrolls the screen up one text linestatic voidsetAutoRefresh(boolean on)Turn on/off the automatic refresh of the LCD display.static intsetAutoRefreshPeriod(int period)Set the period used to perform automatic refreshing of the display.static voidsetContrast(int contrast)Set the LCD contrast.static voidsetPixel(int x, int y, int color)Method to set a pixel on the screen.
-
-
-
Field Detail
-
SCREEN_WIDTH
public static final int SCREEN_WIDTH
- See Also:
- Constant Field Values
-
SCREEN_HEIGHT
public static final int SCREEN_HEIGHT
- See Also:
- Constant Field Values
-
NOOF_CHARS
public static final int NOOF_CHARS
- See Also:
- Constant Field Values
-
FONT_WIDTH
public static final int FONT_WIDTH
- See Also:
- Constant Field Values
-
FONT_HEIGHT
public static final int FONT_HEIGHT
- See Also:
- Constant Field Values
-
CELL_WIDTH
public static final int CELL_WIDTH
- See Also:
- Constant Field Values
-
CELL_HEIGHT
public static final int CELL_HEIGHT
- See Also:
- Constant Field Values
-
DISPLAY_CHAR_WIDTH
public static final int DISPLAY_CHAR_WIDTH
- See Also:
- Constant Field Values
-
DISPLAY_CHAR_DEPTH
public static final int DISPLAY_CHAR_DEPTH
- See Also:
- Constant Field Values
-
ROP_CLEAR
public static final int ROP_CLEAR
Common raster operations for use with bitBlt- See Also:
- Constant Field Values
-
ROP_AND
public static final int ROP_AND
- See Also:
- Constant Field Values
-
ROP_ANDREVERSE
public static final int ROP_ANDREVERSE
- See Also:
- Constant Field Values
-
ROP_COPY
public static final int ROP_COPY
- See Also:
- Constant Field Values
-
ROP_ANDINVERTED
public static final int ROP_ANDINVERTED
- See Also:
- Constant Field Values
-
ROP_NOOP
public static final int ROP_NOOP
- See Also:
- Constant Field Values
-
ROP_XOR
public static final int ROP_XOR
- See Also:
- Constant Field Values
-
ROP_OR
public static final int ROP_OR
- See Also:
- Constant Field Values
-
ROP_NOR
public static final int ROP_NOR
- See Also:
- Constant Field Values
-
ROP_EQUIV
public static final int ROP_EQUIV
- See Also:
- Constant Field Values
-
ROP_INVERT
public static final int ROP_INVERT
- See Also:
- Constant Field Values
-
ROP_ORREVERSE
public static final int ROP_ORREVERSE
- See Also:
- Constant Field Values
-
ROP_COPYINVERTED
public static final int ROP_COPYINVERTED
- See Also:
- Constant Field Values
-
ROP_ORINVERTED
public static final int ROP_ORINVERTED
- See Also:
- Constant Field Values
-
ROP_NAND
public static final int ROP_NAND
- See Also:
- Constant Field Values
-
ROP_SET
public static final int ROP_SET
- See Also:
- Constant Field Values
-
t
protected static TextLCD t
-
g
protected static GraphicsLCD g
-
-
Method Detail
-
bitBlt
public static void bitBlt(byte[] src, int sw, int sh, int sx, int sy, int dx, int dy, int w, int h, int rop)Standard two input BitBlt function with the LCD display as the destination. Supports standard raster ops and overlapping images. Images are held in native leJOS/Lego format.- Parameters:
src- byte array containing the source imagesw- Width of the source imagesh- Height of the source imagesx- X position to start the copy fromsy- Y Position to start the copy fromdx- X destinationdy- Y destinationw- width of the area to copyh- height of the area to copyrop- raster operation.
-
drawChar
public static void drawChar(char c, int x, int y)Draw a single char on the LCD at specified x,y co-ordinate.- Parameters:
c- Character to displayx- X locationy- Y location
-
clearDisplay
public static void clearDisplay()
-
drawString
public static void drawString(java.lang.String str, int x, int y, boolean inverted)Display an optionally inverted string on the LCD at specified x,y co-ordinate.- Parameters:
str- The string to be displayedx- The x character co-ordinate to display at.y- The y character co-ordinate to display at.inverted- if true the string is displayed inverted.
-
drawString
public static void drawString(java.lang.String str, int x, int y)Display a string on the LCD at specified x,y co-ordinate.- Parameters:
str- The string to be displayedx- The x character co-ordinate to display at.y- The y character co-ordinate to display at.
-
drawInt
public static void drawInt(int i, int x, int y)Display an int on the LCD at specified x,y co-ordinate.- Parameters:
i- The value to display.x- The x character co-ordinate to display at.y- The y character co-ordinate to display at.
-
drawInt
public static void drawInt(int i, int places, int x, int y)Display an in on the LCD at x,y with leading spaces to occupy at least the number of characters specified by the places parameter.- Parameters:
i- The value to displayplaces- number of places to use to display the valuex- The x character co-ordinate to display at.y- The y character co-ordinate to display at.
-
asyncRefresh
public static void asyncRefresh()
Start the process of updating the display. This will always return immediately after starting the refresh process.
-
getRefreshCompleteTime
public static long getRefreshCompleteTime()
Obtain the system time when the current display refresh operation will be complete. Not that this may be in the past.- Returns:
- the system time in ms when the refresh will be complete.
-
asyncRefreshWait
public static void asyncRefreshWait()
Wait for the current refresh cycle to complete.
-
refresh
public static void refresh()
Refresh the display. If auto refresh is off, this method will wait until the display refresh has completed. If auto refresh is on it will return immediately.
-
clear
public static void clear()
Clear the display.
-
getDisplay
public static byte[] getDisplay()
Provide access to the LCD display frame buffer. Allows both the firmware and Java to make changes.- Returns:
- byte array that is the frame buffer.
-
getSystemFont
public static byte[] getSystemFont()
Provide access to the LCD system font. Allows both the firmware and Java to share the same font bitmaps.- Returns:
- byte array that is the frame buffer.
-
setAutoRefreshPeriod
public static int setAutoRefreshPeriod(int period)
Set the period used to perform automatic refreshing of the display. A period of 0 disables the refresh.- Parameters:
period- time in ms- Returns:
- the previous refresh period.
-
setAutoRefresh
public static void setAutoRefresh(boolean on)
Turn on/off the automatic refresh of the LCD display. At system startup auto refresh is on.- Parameters:
on- true to enable, false to disable
-
setPixel
public static void setPixel(int x, int y, int color)Method to set a pixel on the screen.- Parameters:
x- the x coordinatey- the y coordinatecolor- the pixel color (0 = white, 1 = black)
-
getPixel
public static int getPixel(int x, int y)Method to get a pixel from the screen.- Parameters:
x- the x coordinatey- the y coordinate- Returns:
- the pixel color (0 = white, 1 = black)
-
bitBlt
public static void bitBlt(byte[] src, int sw, int sh, int sx, int sy, byte[] dst, int dw, int dh, int dx, int dy, int w, int h, int rop)Standard two input BitBlt function. Supports standard raster ops and overlapping images. Images are held in native leJOS/Lego format.- Parameters:
src- byte array containing the source imagesw- Width of the source imagesh- Height of the source imagesx- X position to start the copy fromsy- Y Position to start the copy fromdst- byte array containing the destination imagedw- Width of the destination imagedh- Height of the destination imagedx- X destinationdy- Y destinationw- width of the area to copyh- height of the area to copyrop- raster operation.
-
scroll
public static void scroll()
Scrolls the screen up one text line
-
clear
public static void clear(int x, int y, int n)Clear a contiguous set of characters- Parameters:
x- the x character coordinatey- the y character coordinaten- the number of characters
-
clear
public static void clear(int y)
Clear an LCD display row- Parameters:
y- the row to clear
-
setContrast
public static void setContrast(int contrast)
Set the LCD contrast.- Parameters:
contrast- 0 blank 0x60 full on
-
getHWDisplay
public static byte[] getHWDisplay()
-
-