Class LCD


  • public class LCD
    extends java.lang.Object
    Provide access to the EV3 LCD display
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void asyncRefresh()
      Start the process of updating the display.
      static void asyncRefreshWait()
      Wait for the current refresh cycle to complete.
      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.
      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.
      static void clear()
      Clear the display.
      static void clear​(int y)
      Clear an LCD display row
      static void clear​(int x, int y, int n)
      Clear a contiguous set of characters
      static void clearDisplay()  
      static void drawChar​(char c, int x, int y)
      Draw a single char on the LCD at specified x,y co-ordinate.
      static void drawInt​(int i, int x, int y)
      Display an int on the LCD at specified x,y co-ordinate.
      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.
      static void drawString​(java.lang.String str, int x, int y)
      Display a string on the LCD at specified x,y co-ordinate.
      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.
      static byte[] getDisplay()
      Provide access to the LCD display frame buffer.
      static byte[] getHWDisplay()  
      static int getPixel​(int x, int y)
      Method to get a pixel from the screen.
      static long getRefreshCompleteTime()
      Obtain the system time when the current display refresh operation will be complete.
      static byte[] getSystemFont()
      Provide access to the LCD system font.
      static void refresh()
      Refresh the display.
      static void scroll()
      Scrolls the screen up one text line
      static void setAutoRefresh​(boolean on)
      Turn on/off the automatic refresh of the LCD display.
      static int setAutoRefreshPeriod​(int period)
      Set the period used to perform automatic refreshing of the display.
      static void setContrast​(int contrast)
      Set the LCD contrast.
      static void setPixel​(int x, int y, int color)
      Method to set a pixel on the screen.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 image
        sw - Width of the source image
        sh - Height of the source image
        sx - X position to start the copy from
        sy - Y Position to start the copy from
        dx - X destination
        dy - Y destination
        w - width of the area to copy
        h - height of the area to copy
        rop - 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 display
        x - X location
        y - 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 displayed
        x - 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 displayed
        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 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 display
        places - number of places to use to display the value
        x - 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 coordinate
        y - the y coordinate
        color - 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 coordinate
        y - 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 image
        sw - Width of the source image
        sh - Height of the source image
        sx - X position to start the copy from
        sy - Y Position to start the copy from
        dst - byte array containing the destination image
        dw - Width of the destination image
        dh - Height of the destination image
        dx - X destination
        dy - Y destination
        w - width of the area to copy
        h - height of the area to copy
        rop - 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 coordinate
        y - the y character coordinate
        n - 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()