-
- All Superinterfaces:
com.ibasco.ucgdisplay.common.drivers.DisplayDriver
- All Known Subinterfaces:
GlcdDriverAdapter
- All Known Implementing Classes:
GlcdBaseDriver
,GlcdDriver
,U8g2DriverAdapter
public interface GlcdDisplayDriver extends com.ibasco.ucgdisplay.common.drivers.DisplayDriver
Graphics Display Driver interface based on the U8G2 Interface.- Author:
- Rafael Ibasco
- See Also:
- U8G2 Reference
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
begin()
Simplified setup procedure of the display for the Arduino enviornment.void
clear()
Clears all pixel on the display and the buffer.void
clearBuffer()
Clears all pixel in the memory frame buffer.void
clearDisplay()
Clears all pixel on the connected display.void
drawBox(int width, int height)
Draw a box (filled frame), starting at x/y position (upper left edge).void
drawBox(int x, int y, int width, int height)
Draw a box (filled frame), starting at x/y position (upper left edge).void
drawCircle(int radius, int options)
Draw a circle with radus rad at position (x0, y0).void
drawCircle(int x, int y, int radius, int options)
Draw a circle with radus rad at position (x0, y0).void
drawDisc(int radius, int options)
Draw a filled circle with radus rad at position (x0, y0).void
drawDisc(int x, int y, int radius, int options)
Draw a filled circle with radus rad at position (x0, y0).void
drawEllipse(int rx, int ry, int options)
Draw ellipse with radus rx and 'ry' at position (x0, y0).void
drawEllipse(int x, int y, int rx, int ry, int options)
Draw ellipse with radus rx and 'ry' at position (x0, y0).void
drawFilledEllipse(int rx, int ry, int options)
Draw a filled ellipse with radus rx and 'ry' at position (x0, y0).void
drawFilledEllipse(int x, int y, int rx, int ry, int options)
Draw a filled ellipse with radus rx and 'ry' at position (x0, y0).void
drawFrame(int width, int height)
Draw a frame (empty box), starting at x/y position (upper left edge).void
drawFrame(int x, int y, int width, int height)
Draw a frame (empty box), starting at x/y position (upper left edge).void
drawGlyph(int x, int y, short encoding)
Draw a single character.void
drawGlyph(short encoding)
Draw a single character.void
drawHLine(int width)
Draw a horizontal line, starting at x/y position (left edge).void
drawHLine(int x, int y, int width)
Draw a horizontal line, starting at x/y position (left edge).void
drawLine(int x1, int y1)
Draw a line between two points.void
drawLine(int x, int y, int x1, int y1)
Draw a line between two points.void
drawPixel()
Draw a pixel at the specified x/y position.void
drawPixel(int x, int y)
Draw a pixel at the specified x/y position.void
drawPixels(int x, int y, int width, int height, byte[] buffer)
Draws pixels on the screen based on the provided pixel buffer.void
drawPixelsBgra(int x, int y, int width, int height, byte[] buffer)
Draws pixels on the screen based on the provided pixel buffer.void
drawRoundedBox(int width, int height, int radius)
Draw a box with round edges, starting at x/y position (upper left edge).void
drawRoundedBox(int x, int y, int width, int height, int radius)
Draw a box with round edges, starting at x/y position (upper left edge).void
drawRoundedFrame(int width, int height, int radius)
Draw a frame with round edges, starting at x/y position (upper left edge).void
drawRoundedFrame(int x, int y, int width, int height, int radius)
Draw a frame with round edges, starting at x/y position (upper left edge).void
drawString(int x, int y, java.lang.String value)
Draw a string.void
drawString(java.lang.String value)
Draw a string.void
drawTriangle(int x1, int y1, int x2, int y2)
Draw a triangle (filled polygon).void
drawTriangle(int x0, int y0, int x1, int y1, int x2, int y2)
Draw a triangle (filled polygon).int
drawUTF8(int x, int y, java.lang.String value)
Draw a string which is encoded as UTF-8.int
drawUTF8(java.lang.String value)
Draw a string which is encoded as UTF-8.void
drawVLine(int length)
Draw a vertical line, starting at x/y position (upper end).void
drawVLine(int x, int y, int length)
Draw a vertical line, starting at x/y position (upper end).void
drawXBM(int width, int height, byte[] data)
Draw a XBM Bitmap.void
drawXBM(int x, int y, int width, int height, byte[] data)
Draw a XBM Bitmap.void
drawXBM(int x, int y, int width, int height, java.io.File data)
Draw a XBM Bitmap.void
drawXBM(int width, int height, java.io.File file)
Draw a XBM Bitmap.java.lang.String
exportToPBM()
Exports a PBM formatted ASCII string representation of the current display bufferjava.lang.String
exportToPBM2()
Exports a PBM formatted ASCII string representation of the current display bufferjava.lang.String
exportToXBM()
Exports an XBM formatted ASCII string representati0on of the current display bufferjava.lang.String
exportToXBM2()
Exports an XBM formatted ASCII string representati0on of the current display buffer.void
firstPage()
This command is part of the (picture) loop which renders the content of the display.int
getAscent()
Returns the reference height of the glyphs above the baseline (ascent).byte[]
getBuffer()
Return the contents of the display buffer.int
getBufferCurrTileRow()
Return the intended position for the content of the pixel buffer (page) on the target display.default int
getBufferSize()
Returns the total size of the internal display bufferint
getBufferTileHeight()
Return the height of the page buffer in tiles.int
getBufferTileWidth()
Return the width of the page buffer in tiles (One tile has a width of 8 pixel).int
getDescent()
Returns the reference height of the glyphs below the baseline (descent).int
getMaxCharHeight()
Each glyph is stored as a bitmap.int
getMaxCharWidth()
Each glyph is stored as a bitmap.java.nio.ByteBuffer
getNativeBgraBuffer()
Similar togetNativeBuffer()
but this returns a buffer in bgra pixel format.java.nio.ByteBuffer
getNativeBuffer()
Returns the pixel buffer that is shared with the native libraryint
getStrWidth(java.lang.String text)
Return the pixel width of string.int
getUTF8Width(java.lang.String text)
Return the pixel width of an UTF-8 encoded string.void
initDisplay()
Reset and configure the display.int
nextPage()
This command is part of the (picture) loop which renders the content of the display.void
sendBuffer()
Send the content of the memory frame buffer to the display.void
sendCommand(java.lang.String format, byte... args)
Send special commands to the display controller.int
setAutoPageClear(boolean clear)
Enables (mode=1) or disables (mode=0) automatic clearing of the pixel buffer by thefirstPage()
andnextPage()
procedures.void
setBitmapMode(GlcdBitmapMode mode)
Defines, whether the bitmap functions will write the background color to solid or transparent.void
setBufferCurrTileRow(int row)
Set the position of the pixel buffer for the sendBuffer command.void
setClipWindow(int x0, int y0, int x1, int y1)
Restricts all graphics output to the specified range.void
setContrast(int value)
Set the contrast or brightness for the display (if supported).void
setDisplayRotation(int rotation)
Changes the display rotation.void
setDisplayRotation(GlcdRotation rotation)
Changes the display rotation.void
setDrawColor(GlcdDrawColor color)
Defines the bit value (color index) for all drawing functions.void
setFlipMode(boolean enable)
Some displays support a 180 degree rotation of the internal frame buffer.void
setFont(byte[] data)
Define a u8g2 font for the glyph and string drawing functions.void
setFont(GlcdFont font)
Define a u8g2 font for the glyph and string drawing functions.void
setFontDirection(GlcdFontDirection direction)
The arguments defines the drawing direction of all strings or glyphs.void
setFontMode(GlcdFontMode mode)
Defines, whether the glyph and string drawing functions will write the background color (mode 0/solid, mode = 0) or not (mode 1/transparent, mode = 1).void
setFontPosBaseline()
Change the reference position for the glyph and string draw functions.void
setFontPosBottom()
Change the reference position for the glyph and string draw functions.void
setFontPosCenter()
Change the reference position for the glyph and string draw functions.void
setFontPosTop()
Change the reference position for the glyph and string draw functions.void
setFontRefHeightAll()
A call to this procedure will define the calculation method for the ascent and descent of the current font.void
setFontRefHeightExtendedText()
A call to this procedure will define the calculation method for the ascent and descent of the current font.void
setFontRefHeightText()
A call to this procedure will define the calculation method for the ascent and descent of the current font.void
setMaxClipWindow()
Removes the effect ofsetClipWindow(int, int, int, int)
.void
setPowerSave(boolean enable)
Activates (enable = true) or disables (enable = false) the power save mode of the display.void
setPrimaryColor(int color)
Set the primary color (set bit) for the pixel data on the BGRA buffer.void
setSecondaryColor(int color)
Set the secondary color (unset bit) for the pixel data on the BGRA buffer.void
updateDisplay()
Updates all area of the display.void
updateDisplay(int x, int y, int width, int height)
Updates the specified rectangle areaof the display.
-
-
-
Method Detail
-
drawBox
void drawBox(int width, int height)
Draw a box (filled frame), starting at x/y position (upper left edge). The box has width w and height h. Parts of the box can be outside of the display boundaries. This procedure will use the current color (setDrawColor) to draw the box. For a monochrome display, the color index 0 will clear a pixel and the color index 1 will set a pixel.
- Parameters:
width
- Width of the box.height
- Height of the box.- See Also:
setDrawColor(GlcdDrawColor)
-
drawBox
void drawBox(int x, int y, int width, int height)
Draw a box (filled frame), starting at x/y position (upper left edge). The box has width w and height h. Parts of the box can be outside of the display boundaries. This procedure will use the current color (setDrawColor) to draw the box. For a monochrome display, the color index 0 will clear a pixel and the color index 1 will set a pixel.
- Parameters:
x
- X-position of upper left edge.y
- Y-position of upper left edge.width
- Width of the box.height
- Height of the box.
-
drawCircle
void drawCircle(int radius, int options)
Draw a circle with radus rad at position (x0, y0). The diameter of the circle is 2*rad+1. Depending on opt, it is possible to draw only some sections of the circle.
Possible values for opt are:
- U8G2_DRAW_UPPER_RIGHT
- U8G2_DRAW_UPPER_LEFT
- U8G2_DRAW_LOWER_LEFT
- U8G2_DRAW_LOWER_RIGHT
- U8G2_DRAW_ALL
These values can be combined with the | operator. This procedure will use the current color (setDrawColor) for drawing.
- Parameters:
radius
- Defines the size of the circle: Radus = radoptions
- Selects some or all sections of the circle.- See Also:
drawCircle(int, int, int, int)
-
drawCircle
void drawCircle(int x, int y, int radius, int options)
Draw a circle with radus rad at position (x0, y0). The diameter of the circle is 2*rad+1. Depending on opt, it is possible to draw only some sections of the circle.
Possible values for opt are:
- U8G2_DRAW_UPPER_RIGHT
- U8G2_DRAW_UPPER_LEFT
- U8G2_DRAW_LOWER_LEFT
- U8G2_DRAW_LOWER_RIGHT
- U8G2_DRAW_ALL
These values can be combined with the | operator. This procedure will use the current color (setDrawColor) for drawing.
- Parameters:
x
- X-Position of the center of the circle.y
- Y-Position of the center of the circle.radius
- Defines the size of the circle: Radus = radoptions
- Selects some or all sections of the circle.
-
drawDisc
void drawDisc(int radius, int options)
Draw a filled circle with radus rad at position (x0, y0). The diameter of the circle is 2*rad+1. Depending on opt, it is possible to draw only some sections of the disc.
Possible values for options are:
- U8G2_DRAW_UPPER_RIGHT
- U8G2_DRAW_UPPER_LEFT
- U8G2_DRAW_LOWER_LEFT
- U8G2_DRAW_LOWER_RIGHT
- U8G2_DRAW_ALL
These values can be combined with the | operator. This procedure will use the current color (
setDrawColor(GlcdDrawColor)
) for drawing.- Parameters:
radius
- Defines the size of the circle: Radus = rad.options
- Selects some or all sections of the disc.
-
drawDisc
void drawDisc(int x, int y, int radius, int options)
Draw a filled circle with radus rad at position (x0, y0). The diameter of the circle is 2*rad+1. Depending on opt, it is possible to draw only some sections of the disc.
Possible values for options are:
- U8G2_DRAW_UPPER_RIGHT
- U8G2_DRAW_UPPER_LEFT
- U8G2_DRAW_LOWER_LEFT
- U8G2_DRAW_LOWER_RIGHT
- U8G2_DRAW_ALL
These values can be combined with the | operator. This procedure will use the current color (
setDrawColor(GlcdDrawColor)
) for drawing.- Parameters:
x
- X-Position of the center of the disc.y
- Y-Position of the center of the disc.radius
- Defines the size of the circle: Radus = rad.options
- Selects some or all sections of the disc.
-
drawEllipse
void drawEllipse(int rx, int ry, int options)
Draw ellipse with radus rx and 'ry' at position (x0, y0). rx*ry must be lower than 512 in 8 Bit mode of u8g2.
Possible values for options are:
- U8G2_DRAW_UPPER_RIGHT
- U8G2_DRAW_UPPER_LEFT
- U8G2_DRAW_LOWER_LEFT
- U8G2_DRAW_LOWER_RIGHT
- U8G2_DRAW_ALL
The diameter is twice the radius plus one.
- Parameters:
rx
- Defines the size of the ellipse.ry
- Defines the size of the ellipse.options
- Selects some or all sections of the ellipse.
-
drawEllipse
void drawEllipse(int x, int y, int rx, int ry, int options)
Draw ellipse with radus rx and 'ry' at position (x0, y0). rx*ry must be lower than 512 in 8 Bit mode of u8g2.
Possible values for options are:
- U8G2_DRAW_UPPER_RIGHT
- U8G2_DRAW_UPPER_LEFT
- U8G2_DRAW_LOWER_LEFT
- U8G2_DRAW_LOWER_RIGHT
- U8G2_DRAW_ALL
The diameter is twice the radius plus one.
- Parameters:
x
- X-Position of the center of the filled circle.y
- Y-Position of the center of the filled circle.rx
- Defines the size of the ellipse.ry
- Defines the size of the ellipse.options
- Selects some or all sections of the ellipse.
-
drawFilledEllipse
void drawFilledEllipse(int rx, int ry, int options)
Draw a filled ellipse with radus rx and 'ry' at position (x0, y0). rx*ry must be lower than 512 in 8 Bit mode of u8g2.Depending on opt, it is possible to draw only some sections of the disc.
Possible values for options are:
- U8G2_DRAW_UPPER_RIGHT
- U8G2_DRAW_UPPER_LEFT
- U8G2_DRAW_LOWER_LEFT
- U8G2_DRAW_LOWER_RIGHT
- U8G2_DRAW_ALL
These values can be combined with the | operator.
- Parameters:
rx
- X-the size of the ellipse.ry
- Y- the size of the ellipse.options
- Selects some or all sections of the ellipse.
-
drawFilledEllipse
void drawFilledEllipse(int x, int y, int rx, int ry, int options)
Draw a filled ellipse with radus rx and 'ry' at position (x0, y0). rx*ry must be lower than 512 in 8 Bit mode of u8g2.Depending on opt, it is possible to draw only some sections of the disc.
Possible values for options are:
- U8G2_DRAW_UPPER_RIGHT
- U8G2_DRAW_UPPER_LEFT
- U8G2_DRAW_LOWER_LEFT
- U8G2_DRAW_LOWER_RIGHT
- U8G2_DRAW_ALL
These values can be combined with the | operator.
- Parameters:
x
- X-Position of the center of the filled circle.y
- Y-Position of the center of the filled circle.rx
- X-the size of the ellipse.ry
- Y- the size of the ellipse.options
- Selects some or all sections of the ellipse.
-
drawFrame
void drawFrame(int width, int height)
Draw a frame (empty box), starting at x/y position (upper left edge). The box has width w and height h. Parts of the frame can be outside of the display boundaries. This procedure will use the current color (setDrawColor) to draw the box. For a monochrome display, the color index 0 will clear a pixel and the color index 1 will set a pixel.
- Parameters:
width
- Width of the frame.height
- Height of the frame.
-
drawFrame
void drawFrame(int x, int y, int width, int height)
Draw a frame (empty box), starting at x/y position (upper left edge). The box has width w and height h. Parts of the frame can be outside of the display boundaries. This procedure will use the current color (setDrawColor) to draw the box. For a monochrome display, the color index 0 will clear a pixel and the color index 1 will set a pixel.
- Parameters:
x
- X-position of upper left edge.y
- Y-position of upper left edge.width
- Width of the frame.height
- Height of the frame.
-
drawGlyph
void drawGlyph(short encoding)
Draw a single character. The character is placed at the specified pixel posion x and y. U8g2 supports the lower 16 bit of the unicode character range (plane 0/Basic Multilingual Plane): The encoding can be any value from 0 to 65535. The glyph can be drawn only, if the encoding exists in the active font.
- Parameters:
encoding
- Unicode value of the character.- See Also:
setFont(byte[])
-
drawGlyph
void drawGlyph(int x, int y, short encoding)
Draw a single character. The character is placed at the specified pixel posion x and y. U8g2 supports the lower 16 bit of the unicode character range (plane 0/Basic Multilingual Plane): The encoding can be any value from 0 to 65535. The glyph can be drawn only, if the encoding exists in the active font.
- Parameters:
x
- X-Position of the character on the display.y
- Y-Position of the character on the display.encoding
- Unicode value of the character.- See Also:
setFont(byte[])
-
drawHLine
void drawHLine(int width)
Draw a horizontal line, starting at x/y position (left edge). The width (length) of the line is w pixel. Parts of the line can be outside of the display boundaries. This procedure uses the current color index to draw the line. Color index 0 will clear a pixel and the color index 1 will set a pixel.
- Parameters:
width
- Length of the horizontal line
-
drawHLine
void drawHLine(int x, int y, int width)
Draw a horizontal line, starting at x/y position (left edge). The width (length) of the line is w pixel. Parts of the line can be outside of the display boundaries. This procedure uses the current color index to draw the line. Color index 0 will clear a pixel and the color index 1 will set a pixel.
- Parameters:
x
- X-Positiony
- Y-Positionwidth
- Length of the horizontal line
-
drawVLine
void drawVLine(int length)
Draw a vertical line, starting at x/y position (upper end). The height (length) of the line is h pixel. Parts of the line can be outside of the display boundaries. This procedure uses the current color index to draw the line. Color index 0 will clear a pixel and the color index 1 will set a pixel.
- Parameters:
length
- Length of the vertical line.
-
drawVLine
void drawVLine(int x, int y, int length)
Draw a vertical line, starting at x/y position (upper end). The height (length) of the line is h pixel. Parts of the line can be outside of the display boundaries. This procedure uses the current color index to draw the line. Color index 0 will clear a pixel and the color index 1 will set a pixel.
- Parameters:
x
- X-position.y
- Y-position.length
- Length of the vertical line.
-
drawLine
void drawLine(int x1, int y1)
Draw a line between two points. This procedure will use the current color (setDrawColor).- Parameters:
x1
- X-position of the second point.y1
- Y-position of the second point.
-
drawLine
void drawLine(int x, int y, int x1, int y1)
Draw a line between two points. This procedure will use the current color (setDrawColor).- Parameters:
x
- X-position of the first point.y
- Y-position of the first point.x1
- X-position of the second point.y1
- Y-position of the second point.
-
drawPixel
void drawPixel()
Draw a pixel at the specified x/y position. Position (0,0) is at the upper left corner of the display. The position may be outside the display boundaries.This procedure uses the current color index to draw the pixel. The color index 0 will clear a pixel and the color index 1 will set a pixel.
-
drawPixel
void drawPixel(int x, int y)
Draw a pixel at the specified x/y position. Position (0,0) is at the upper left corner of the display. The position may be outside the display boundaries.This procedure uses the current color index to draw the pixel. The color index 0 will clear a pixel and the color index 1 will set a pixel.
- Parameters:
x
- X-position.y
- Y-position.
-
drawPixels
void drawPixels(int x, int y, int width, int height, byte[] buffer)
Draws pixels on the screen based on the provided pixel buffer. The size of the buffer can be determined by the following formula width * height
- Parameters:
buffer
- The pixel buffer
-
drawPixelsBgra
void drawPixelsBgra(int x, int y, int width, int height, byte[] buffer)
Draws pixels on the screen based on the provided pixel buffer. This buffer is using the BGRA format. The size of the buffer is determined by the following formulat: width * height * 4
- Parameters:
x
- The x-coordinatey
- The y-coordinatewidth
- The width of the pixels to be drawnheight
- The height of the pixels to be drawnbuffer
- The bgra pixel buffer
-
drawRoundedBox
void drawRoundedBox(int width, int height, int radius)
Draw a box with round edges, starting at x/y position (upper left edge). The box/frame has width w and height h. Parts of the box can be outside of the display boundaries. Edges have radius r. It is required that w >= 2*(r+1) and h >= 2*(r+1). This condition is not checked. Behavior is undefined if w or h is smaller than 2*(r+1). This procedure uses the current color index to draw the box. For a monochrome display, the color index 0 will clear a pixel and the color index 1 will set a pixel.
- Parameters:
width
- Width of the box.height
- Height of the box.radius
- Radius for the four edges.
-
drawRoundedBox
void drawRoundedBox(int x, int y, int width, int height, int radius)
Draw a box with round edges, starting at x/y position (upper left edge). The box/frame has width w and height h. Parts of the box can be outside of the display boundaries. Edges have radius r. It is required that w >= 2*(r+1) and h >= 2*(r+1). This condition is not checked. Behavior is undefined if w or h is smaller than 2*(r+1). This procedure uses the current color index to draw the box. For a monochrome display, the color index 0 will clear a pixel and the color index 1 will set a pixel.
- Parameters:
x
- X-position of upper left edge.y
- Y-position of upper left edge.width
- Width of the box.height
- Height of the box.radius
- Radius for the four edges.
-
drawRoundedFrame
void drawRoundedFrame(int width, int height, int radius)
Draw a frame with round edges, starting at x/y position (upper left edge). The box/frame has width w and height h. Parts of the box can be outside of the display boundaries. Edges have radius r. It is required that w >= 2*(r+1) and h >= 2*(r+1). This condition is not checked. Behavior is undefined if w or h is smaller than 2*(r+1). This procedure uses the current color index to draw the box. For a monochrome display, the color index 0 will clear a pixel and the color index 1 will set a pixel.
- Parameters:
width
- Width of the box.height
- Height of the box.radius
- Radius for the four edges.
-
drawRoundedFrame
void drawRoundedFrame(int x, int y, int width, int height, int radius)
Draw a frame with round edges, starting at x/y position (upper left edge). The box/frame has width w and height h. Parts of the box can be outside of the display boundaries. Edges have radius r. It is required that w >= 2*(r+1) and h >= 2*(r+1). This condition is not checked. Behavior is undefined if w or h is smaller than 2*(r+1). This procedure uses the current color index to draw the box. For a monochrome display, the color index 0 will clear a pixel and the color index 1 will set a pixel.
- Parameters:
x
- X-position of upper left edge.y
- Y-position of upper left edge.width
- Width of the box.height
- Height of the box.radius
- Radius for the four edges.
-
drawString
void drawString(java.lang.String value)
Draw a string. The first character is placed at position x andy. Use setFont to assign a font before drawing a string on the display. To draw a character with encoding 127 to 255, use the C/C++/Arduino escape sequence "\xab" (hex value ab) or "\xyz" (octal value xyz). This function can not draw any glyph with encoding greater or equal to 256. Use drawUTF8 or drawGlyph to access glyphs with encoding greater or equal to 256.
- Parameters:
value
- The text to draw on the display
-
drawString
void drawString(int x, int y, java.lang.String value)
Draw a string. The first character is placed at position x andy. Use setFont to assign a font before drawing a string on the display. To draw a character with encoding 127 to 255, use the C/C++/Arduino escape sequence "\xab" (hex value ab) or "\xyz" (octal value xyz). This function can not draw any glyph with encoding greater or equal to 256. Use drawUTF8 or drawGlyph to access glyphs with encoding greater or equal to 256.
- Parameters:
x
- X-Position of the first character on the display.y
- Y-Position of the first character on the display.value
- The text to draw on the display
-
drawTriangle
void drawTriangle(int x1, int y1, int x2, int y2)
Draw a triangle (filled polygon). Arguments are 16 bit and the polygon is clipped to the size of the display. Multiple polygons are drawn so that they exactly match without overlap:The left side of a polygon is drawn, the right side is not draw. The upper side is only draw if it is flat.
- Parameters:
x1
- X-position point 1.y1
- Y-position point 1.x2
- X-position point 2.y2
- Y-position point 2.
-
drawTriangle
void drawTriangle(int x0, int y0, int x1, int y1, int x2, int y2)
Draw a triangle (filled polygon). Arguments are 16 bit and the polygon is clipped to the size of the display. Multiple polygons are drawn so that they exactly match without overlap:The left side of a polygon is drawn, the right side is not draw. The upper side is only draw if it is flat.
- Parameters:
x0
- X-position point 0.y0
- Y-position point 0.x1
- X-position point 1.y1
- Y-position point 1.x2
- X-position point 2.y2
- Y-position point 2.
-
drawXBM
void drawXBM(int width, int height, java.io.File file)
Draw a XBM Bitmap. Position (x,y) is the upper left corner of the bitmap. XBM contains monochrome, 1-bit bitmaps.
The current color index is used for drawing
(see setColorIndex)pixel values 1. By default, drawXBM will draw solid bitmaps, usesetBitmapMode(GlcdBitmapMode)
to switch between modes (solid or transparent). The XBMP version of this procedure expects the bitmap to be in PROGMEM area (AVR only). Many tools (including GIMP) can save a bitmap as XBM. A nice step by step instruction is here (external link). The result will look like this:- Parameters:
width
- Width of the bitmap.height
- Height of the bitmap.file
- File containing bitmap data- See Also:
setBitmapMode(com.ibasco.ucgdisplay.drivers.glcd.enums.GlcdBitmapMode)
-
drawXBM
void drawXBM(int x, int y, int width, int height, java.io.File data)
Draw a XBM Bitmap. Position (x,y) is the upper left corner of the bitmap. XBM contains monochrome, 1-bit bitmaps.
The current color index is used for drawing
(see setColorIndex)pixel values 1. By default, drawXBM will draw solid bitmaps, usesetBitmapMode(GlcdBitmapMode)
to switch between modes (solid or transparent). The XBMP version of this procedure expects the bitmap to be in PROGMEM area (AVR only). Many tools (including GIMP) can save a bitmap as XBM. A nice step by step instruction is here (external link). The result will look like this:- Parameters:
x
- X-position.y
- Y-position.width
- Width of the bitmap.height
- Height of the bitmap.data
- File containing bitmap data- See Also:
setBitmapMode(com.ibasco.ucgdisplay.drivers.glcd.enums.GlcdBitmapMode)
-
drawXBM
void drawXBM(int width, int height, byte[] data)
Draw a XBM Bitmap. Position (x,y) is the upper left corner of the bitmap. XBM contains monochrome, 1-bit bitmaps.
The current color index is used for drawing
(see setColorIndex)pixel values 1. By default, drawXBM will draw solid bitmaps, usesetBitmapMode(GlcdBitmapMode)
to switch between modes (solid or transparent). The XBMP version of this procedure expects the bitmap to be in PROGMEM area (AVR only). Many tools (including GIMP) can save a bitmap as XBM. A nice step by step instruction is here (external link). The result will look like this:- Parameters:
width
- Width of the bitmap.height
- Height of the bitmap.data
- Byte array containing bitmap data- See Also:
setBitmapMode(com.ibasco.ucgdisplay.drivers.glcd.enums.GlcdBitmapMode)
-
drawXBM
void drawXBM(int x, int y, int width, int height, byte[] data)
Draw a XBM Bitmap. Position (x,y) is the upper left corner of the bitmap. XBM contains monochrome, 1-bit bitmaps.
The current color index is used for drawing
(see setColorIndex)pixel values 1. By default, drawXBM will draw solid bitmaps, usesetBitmapMode(GlcdBitmapMode)
to switch between modes (solid or transparent). The XBMP version of this procedure expects the bitmap to be in PROGMEM area (AVR only). Many tools (including GIMP) can save a bitmap as XBM. A nice step by step instruction is here (external link). The result will look like this:- Parameters:
x
- X-position.y
- Y-position.width
- Width of the bitmap.height
- Height of the bitmap.data
- Bitmap data- See Also:
setBitmapMode(com.ibasco.ucgdisplay.drivers.glcd.enums.GlcdBitmapMode)
-
drawUTF8
int drawUTF8(java.lang.String value)
Draw a string which is encoded as UTF-8. There are two preconditions for the use of this function: (A)
the C/C++/Arduino compiler must support UTF-8 encoding (this is default for the gnu compiler, which is also used for most Arduino boards)and (B) the code editor/IDE must support and store the C/C++/Arduino code as UTF-8 (true for the Arduino IDE). If these conditions are met, you can use the character with code value greater than 127 directly in the string (of course the character must exist in the font file, see also setFont). Advantage: No escape codes are required and the source code is more readable. The glyph can be copied and paste into the editor from a "char set" tool. Disadvantage: The code is less portable and the strlen function will not return the number of visible characters.- Parameters:
value
- UTF-8 encoded text- Returns:
- Width of the string.
- See Also:
getUTF8Width(String)
,setFont(byte[])
,drawString(int, int, String)
-
drawUTF8
int drawUTF8(int x, int y, java.lang.String value)
Draw a string which is encoded as UTF-8. There are two preconditions for the use of this function: (A)
the C/C++/Arduino compiler must support UTF-8 encoding (this is default for the gnu compiler, which is also used for most Arduino boards)and (B) the code editor/IDE must support and store the C/C++/Arduino code as UTF-8 (true for the Arduino IDE). If these conditions are met, you can use the character with code value greater than 127 directly in the string (of course the character must exist in the font file, see also setFont). Advantage: No escape codes are required and the source code is more readable. The glyph can be copied and paste into the editor from a "char set" tool. Disadvantage: The code is less portable and the strlen function will not return the number of visible characters.- Parameters:
x
- X-Position of the first character on the display.y
- Y-Position of the first character on the display.value
- UTF-8 encoded text- Returns:
- Width of the string.
- See Also:
getUTF8Width(String)
,setFont(byte[])
,drawString(int, int, String)
-
getUTF8Width
int getUTF8Width(java.lang.String text)
Return the pixel width of an UTF-8 encoded string.
- Parameters:
text
- UTF-8 encoded text.- Returns:
- Width of the string if drawn with the current font
-
setFont
void setFont(byte[] data)
Define a u8g2 font for the glyph and string drawing functions. Note: u8x8 font can NOT be used. Available fonts are listed here here. The last two characters of the font name define the type and character set for the font:
- Parameters:
data
- Font data- See Also:
- List of available fonts
-
setFont
void setFont(GlcdFont font)
Define a u8g2 font for the glyph and string drawing functions. Note: u8x8 font can NOT be used. Available fonts are listed here here. The last two characters of the font name define the type and character set for the font:
- Parameters:
font
- AGlcdFont
instance- See Also:
- List of available fonts
-
setFontMode
void setFontMode(GlcdFontMode mode)
Defines, whether the glyph and string drawing functions will write the background color (mode 0/solid, mode = 0) or not (mode 1/transparent, mode = 1). Default mode is 1 (background color of the characters is not changed).
Note: Always choose a suitable font, depending on the font mode:
Font Name Font Type Suitable for... FONT_xxx_TX Transparent gylphs with variable width mode = 1
, XOR ModeFONT_xxx_MX Monospace/fixed width glyphs mode = 0
FONT_xxx_HX Glyphs with variable width and common height mode = 0
FONT_xxx_8X Monospace/fixed width glyphs in a 8x8 box mode = 0
- Parameters:
mode
- Enable (1) or disable (0) transparent mode.- See Also:
setDrawColor(com.ibasco.ucgdisplay.drivers.glcd.enums.GlcdDrawColor)
,setFont(byte[])
-
setFontDirection
void setFontDirection(GlcdFontDirection direction)
The arguments defines the drawing direction of all strings or glyphs.
Argument String Rotation Description 0 0 degree Left to right 1 90 degree Top to down 2 180 degree Right to left 3 270 degree Down to top - Parameters:
direction
- Writing direction/string rotation.- See Also:
drawString(int, int, String)
-
setFontPosBaseline
void setFontPosBaseline()
Change the reference position for the glyph and string draw functions. By default the reference position is "Baseline".
-
setFontPosBottom
void setFontPosBottom()
Change the reference position for the glyph and string draw functions. By default the reference position is "Baseline".
-
setFontPosTop
void setFontPosTop()
Change the reference position for the glyph and string draw functions. By default the reference position is "Baseline".
-
setFontPosCenter
void setFontPosCenter()
Change the reference position for the glyph and string draw functions. By default the reference position is "Baseline".
-
setFontRefHeightAll
void setFontRefHeightAll()
A call to this procedure will define the calculation method for the ascent and descent of the current font. This method will be used for the current and all other fonts, which will be set with
setFont(byte[])
. Changing this calculation method has an effect ongetAscent()
andgetDescent()
. Default issetFontRefHeightText()
.Ascent will be the highest ascent of all glyphs of the current font. Descent will be the highest descent of all glyphs of the current font.
- See Also:
getAscent()
,getDescent()
-
setFontRefHeightExtendedText
void setFontRefHeightExtendedText()
A call to this procedure will define the calculation method for the ascent and descent of the current font. This method will be used for the current and all other fonts, which will be set with
setFont(byte[])
. Changing this calculation method has an effect ongetAscent()
andgetDescent()
.Ascent will be the largest ascent of "A", "1" or "(" of the current font. Descent will be the descent of "g" or "(" of the current font.
- See Also:
getAscent()
,getDescent()
-
setFontRefHeightText
void setFontRefHeightText()
A call to this procedure will define the calculation method for the ascent and descent of the current font. This method will be used for the current and all other fonts, which will be set with
setFont(byte[])
. Changing this calculation method has an effect ongetAscent()
andgetDescent()
.Ascent will be the ascent of "A" or "1" of the current font. Descent will be the descent "g" of the current font (this is the default after startup).
- See Also:
getAscent()
,getDescent()
-
setFlipMode
void setFlipMode(boolean enable)
Some displays support a 180 degree rotation of the internal frame buffer. This hardware feature can be controlled with this procedure. Important: Redraw the complete display after changing the flip mode. Best is to clear the display first, then change the flip mode and finally redraw the content. Results will be undefined for any existing content on the screen.
- Parameters:
enable
- Enable (true) or disable (false) 180 degree rotation of the display content
-
setPowerSave
void setPowerSave(boolean enable)
Activates (enable = true) or disables (enable = false) the power save mode of the display. With activated power save mode, nothing will be visible on the display. The content of the RAM of the display is not changed. This procedure is also called from begin.
- Parameters:
enable
- Enable (true) or disable (false) power save mode for the display.- See Also:
begin()
-
setDrawColor
void setDrawColor(GlcdDrawColor color)
Defines the bit value (color index) for all drawing functions. All drawing function will change the display memory to this bit value. Default value is 1. For example the
drawBox(int, int, int, int)
procedure will set all pixels for the defined area to the bit value, provided here. The color value 2 will activate the XOR mode. Exceptions:Both functions will always set the buffer to the pixel value 0. The color argument of setDrawColor is ignored.
Note: Not all graphics procedures will support XOR mode. Especially XOR mode is not supported by drawCircle, drawDisc, drawEllipse and drawFilledEllipse.
Exceptions:clear()
,clearBuffer()
: Both functions will always set the buffer to the pixel value 0. The color argument of setDrawColor is ignored.- drawGlyph: All font drawing procedures will use this color argument as foreground color. In none-transparent (solid) mode (setFontMode) the complement of the color value will be the background color and is set to 0 for color value 2 (However, suggestion is not to use solid and XOR mode together):
Font Mode Draw Color Glyph Foreground Color Glyph Background Color 0: solid 0 0 1 0: solid 1 1 0 0: solid 2 XOR 0 1: transparent 0 0 - 1: transparent 1 1 - 1: transparent 2 XOR - - Parameters:
color
- TheGlcdDrawColor
value- See Also:
drawBox(int, int, int, int)
,drawGlyph(int, int, short)
,setFontMode(GlcdFontMode)
-
initDisplay
void initDisplay()
Reset and configure the display. This procedure must be called before any other procedures draw something on the display. This procedure leaves the display in a power save mode. In order to see something on the screen, disable power save mode first (setPowerSave). This procedure is called by the begin procedure. Either begin or initDisplay must be called initially.
-
firstPage
void firstPage()
This command is part of the (picture) loop which renders the content of the display. This command must be used together with nextPage. There are some restrictions: Do not change the content when executing this loop. Always redraw everything. It is not possible to redraw only parts of the content. The advantage is lesser RAM consumption compared to a full frame buffer in RAM, see sendBuffer.
- See Also:
nextPage()
-
nextPage
int nextPage()
This command is part of the (picture) loop which renders the content of the display. This command must be used together with firstPage. There are some restrictions: Do not change the content when executing this loop. Always redraw everything. It is not possible to redraw only parts oft the content. The advantage is lesser RAM consumption compared to a full frame buffer in RAM, see sendBuffer. This procedure will send a refresh message (refreshDisplay) to an e-Paper/e-Ink device after completion of the loop (just before returning 0).
- Returns:
- 0, once the loop is completed (all data transfered to the display).
- See Also:
firstPage()
-
getAscent
int getAscent()
Returns the reference height of the glyphs above the baseline (ascent). This value depends on the current reference height (see setFontRefHeightAll).
- Returns:
- The ascent of the current font.
- See Also:
setFont(byte[])
,getDescent()
,setFontRefHeightAll()
-
getDescent
int getDescent()
Returns the reference height of the glyphs below the baseline (descent). For most fonts, this value will be negative. This value depends on the current reference height (see
setFontRefHeightAll()
).- Returns:
- The descent of the current font.
- See Also:
setFont(byte[])
,getDescent()
,setFontRefHeightAll()
-
getMaxCharWidth
int getMaxCharWidth()
Each glyph is stored as a bitmap. This returns the width of the largest bitmap in the font.
- Returns:
- The largest width of any glyph in the font.
- See Also:
getMaxCharHeight()
-
getMaxCharHeight
int getMaxCharHeight()
Each glyph is stored as a bitmap. This returns the height of the largest bitmap in the font.
- Returns:
- The largest height of any glyph in the font.
- See Also:
getMaxCharWidth()
-
sendBuffer
void sendBuffer()
Send the content of the memory frame buffer to the display. Use
clearBuffer()
to clear the buffer and the draw functions to draw something into the frame buffer. This procedure is useful only with a full frame buffer in the RAM of the microcontroller (Constructor with buffer option "f", see here). This procedure will also send a refresh message (refreshDisplay) to an e-Paper/e-Ink device.- See Also:
clearBuffer()
-
clearBuffer
void clearBuffer()
Clears all pixel in the memory frame buffer. Use sendBuffer to transfer the cleared frame buffer to the display. In most cases, this procedure is useful only with a full frame buffer in the RAM of the microcontroller (Constructor with buffer option "f", see here). This procedure will also send a refresh message (refreshDisplay) to an e-Paper/e-Ink device.
- See Also:
sendBuffer()
-
clearDisplay
void clearDisplay()
Clears all pixel on the connected display. This procedure is also called from begin. Usually there is no need to call this function except for the init procedure. Other procedures like
sendBuffer()
andnextPage()
will also overwrite (and clear) the display.
-
begin
void begin()
Simplified setup procedure of the display for the Arduino enviornment. See the setup guide for the selection of a suitable U8g2 constructor. This function will reset, configure, clear and disable power save mode of the display. U8g2 can also detect key press events. Up to six buttons can be observed. The Arduino pin number can be assigned here. Use U8X8_PIN_NONE if there is no switch connected to the pin. The switch has to connect the GPIO pin with GND (low active button). Use getMenuEvent to check for any key press event. Select, next and prev pins are also required for the user interface procedures (for example userInterfaceMessage ).
begin will call:
- See Also:
initDisplay()
,setPowerSave(boolean)
,clearDisplay()
-
clear
void clear()
Clears all pixel on the display and the buffer. Puts the cursor for the print function into the upper left corner.
clear will call:
home()clearDisplay()
clearBuffer()
- Specified by:
clear
in interfacecom.ibasco.ucgdisplay.common.drivers.DisplayDriver
- See Also:
clearBuffer()
-
setAutoPageClear
int setAutoPageClear(boolean clear)
Enables (mode=1) or disables (mode=0) automatic clearing of the pixel buffer by the
firstPage()
andnextPage()
procedures. By default this is enabled and in most situation it is not required to disable this. If disabled, the user is responsible to set ALL pixel of the current pixel buffer to some suitable state. The buffer can be erased manually with the clearBuffer procedure. One application for using this function are situation where the background is rendered manually through a direct manipulation of the pixel buffer (see DirectAccess.ino example).- Parameters:
clear
- Set tofalse
to turn off automatic clearing of the internal pixel buffer. Default value istrue
.- Returns:
- The width of the buffer in tiles.
- See Also:
getBuffer()
-
setBitmapMode
void setBitmapMode(GlcdBitmapMode mode)
Defines, whether the bitmap functions will write the background color to solid or transparent. Default mode is
GlcdBitmapMode.SOLID
.- Parameters:
mode
- UseGlcdBitmapMode.SOLID
for a solid bitmap background orGlcdBitmapMode.TRANSPARENT
for transparent.- See Also:
drawXBM(int, int, java.io.File)
, U8g2 - setBitmapMode
-
setContrast
void setContrast(int value)
Set the contrast or brightness for the display (if supported). Range for 'value': 0 (no contrast) to 255 (maximum contrast or brightness).
- Parameters:
value
- Contrast or brightness from 0 to 255.
-
setDisplayRotation
void setDisplayRotation(int rotation)
Changes the display rotation. Usually the rotation is defined as part of the constructor. The argment can be one of the following values:
Constant
Description ROTATION_R0
No rotation, landscape ROTATION_R1
90 degree clockwise rotation ROTATION_R2
180 degree clockwise rotation ROTATION_R3
270 degree clockwise rotation ROTATION_MIRROR
No rotation, landscape, display content is mirrored - Parameters:
rotation
- Display rotation argument.
-
setDisplayRotation
void setDisplayRotation(GlcdRotation rotation)
Changes the display rotation. Usually the rotation is defined as part of the constructor. The argment can be one of the following values:
Constant
Description GlcdRotation.ROTATION_NONE
No rotation, landscape GlcdRotation.ROTATION_90
90 degree clockwise rotation GlcdRotation.ROTATION_180
180 degree clockwise rotation GlcdRotation.ROTATION_270
270 degree clockwise rotation GlcdRotation.ROTATION_MIRROR
No rotation, landscape, display content is mirrored - Parameters:
rotation
- Display rotation argument.
-
getBuffer
byte[] getBuffer()
Return the contents of the display buffer. The total memory size of the buffer is 8 * (
getBufferTileHeight()
*getBufferTileWidth()
). The buffer can be erased withclearBuffer()
.- Returns:
- The contents of th
- See Also:
getBufferTileHeight()
,getBufferTileWidth()
,clearBuffer()
-
getNativeBuffer
java.nio.ByteBuffer getNativeBuffer()
Returns the pixel buffer that is shared with the native library- Returns:
- A direct
ByteBuffer
-
getNativeBgraBuffer
java.nio.ByteBuffer getNativeBgraBuffer()
Similar togetNativeBuffer()
but this returns a buffer in bgra pixel format.- Returns:
- A direct
ByteBuffer
. Null if virtual mode is false.
-
getBufferSize
default int getBufferSize()
Returns the total size of the internal display buffer- Returns:
- The buffer size in bytes
-
getBufferTileWidth
int getBufferTileWidth()
Return the width of the page buffer in tiles (One tile has a width of 8 pixel).
- Returns:
- The width of the buffer in tiles.
- See Also:
getBuffer()
,getBufferTileHeight()
-
getBufferTileHeight
int getBufferTileHeight()
Return the height of the page buffer in tiles. The height of one tile is 8 pixel.
- Returns:
- The height of the buffer in tiles.
- See Also:
getBuffer()
,getBufferTileWidth()
-
getBufferCurrTileRow
int getBufferCurrTileRow()
Return the intended position for the content of the pixel buffer (page) on the target display. If it is assumed, that the buffer will be placed at the top of the display, then this value is zero. This value is modified by
firstPage()
/nextPage()
and used bysendBuffer()
to place the content of the pixel buffer at the target position.- Returns:
- The current page position in tiles (one tile has a height of 8 pixel)
- See Also:
getBuffer()
-
setBufferCurrTileRow
void setBufferCurrTileRow(int row)
Set the position of the pixel buffer for the sendBuffer command.
- Parameters:
row
- Location for the pixel buffer on the display. row is the "tile" position and must be multiplied with 8 to get the pixel position.- See Also:
getBuffer()
,sendBuffer()
-
getStrWidth
int getStrWidth(java.lang.String text)
Return the pixel width of string.
- Parameters:
text
- Text string to be measured- Returns:
- Width of the string if drawn with the current font (setFont).
- See Also:
setFont(GlcdFont)
,setFont(byte[])
,drawString(int, int, String)
-
setClipWindow
void setClipWindow(int x0, int y0, int x1, int y1)
Restricts all graphics output to the specified range. The range is defined from x0 (included) to x1 (excluded) and y0 (included) to y1 (excluded). Use setMaxClipWindow to restore writing to the complete window.
- Parameters:
x0
- Left edge of the visible area.y0
- Upper edge of the visible area.x1
- Right edge +1 of the visible area.y1
- Lower edge +1 of the visible area.- See Also:
setMaxClipWindow()
-
setMaxClipWindow
void setMaxClipWindow()
Removes the effect of
setClipWindow(int, int, int, int)
. Graphics is written to the complete display.- See Also:
setClipWindow(int, int, int, int)
-
updateDisplay
void updateDisplay()
Updates all area of the display. This is almost identical to
sendBuffer()
. The area has to be specified in tiles. One tile is a 8x8 pixel area. To get the pixel value, multiply the tile value with 8 (for ROTATION_R0).The tile coordinates are independent from the applied rotation in the U8g2 constructor but have the same orientation as ROTATION_R0. For other rotations the calculation between pixel value tile position is more complicated. The three member functions
sendBuffer()
,updateDisplay()
andupdateDisplay(int, int, int, int)
are designed for the full buffer mode (constructor with _F_ in the name). HoweversendBuffer()
andupdateDisplay()
can be used in page mode also. If updateDisplay is used together with ePaper displays, ensure that a proper refresh sequence is send to the display.Differences between
sendBuffer()
,updateDisplay()
andupdateDisplay(int, int, int, int)
Behavior/Feature sendBuffer
updateDisplay
updateDisplayArea
Sends a refreshDisplay message yes no no Works in full buffer mode yes yes yes Works in page buffer mode yes yes no
-
updateDisplay
void updateDisplay(int x, int y, int width, int height)
Updates the specified rectangle areaof the display. This is almost identical to
sendBuffer()
. The area has to be specified in tiles. One tile is a 8x8 pixel area. To get the pixel value, multiply the tile value with 8 (for ROTATION_R0).The tile coordinates are independent from the applied rotation in the U8g2 constructor but have the same orientation as ROTATION_R0. For other rotations the calculation between pixel value tile position is more complicated. The three member functions
sendBuffer()
,updateDisplay()
andupdateDisplay(int, int, int, int)
are designed for the full buffer mode (constructor with _F_ in the name). HoweversendBuffer()
andupdateDisplay()
can be used in page mode also. If updateDisplay is used together with ePaper displays, ensure that a proper refresh sequence is send to the display.Differences between sendBuffer, updateDisplay and updateDisplayArea
Behavior/Feature sendBuffer
updateDisplay
updateDisplayArea
Sends a refreshDisplay message yes no no Works in full buffer mode yes yes yes Works in page buffer mode yes yes no - Parameters:
x
- The starting x-coordinate of the rectangular regiony
- The starting y-coordinate of the rectangular regionwidth
- The width of the rectangular regionheight
- The height of the rectangular region
-
exportToXBM
java.lang.String exportToXBM()
Exports an XBM formatted ASCII string representati0on of the current display buffer- Returns:
- The XBM formatted ASCII representation of the display buffer
-
exportToPBM
java.lang.String exportToPBM()
Exports a PBM formatted ASCII string representation of the current display buffer- Returns:
- The PBM formatted ASCII representation of the display buffer
-
exportToXBM2
java.lang.String exportToXBM2()
Exports an XBM formatted ASCII string representati0on of the current display buffer.
Display controllers: SH1122, LD7032, ST7920, ST7986, LC7981, T6963, SED1330, RA8835, MAX7219, LS0xx
- Returns:
- The XBM formatted ASCII representation of the display buffer
-
exportToPBM2
java.lang.String exportToPBM2()
Exports a PBM formatted ASCII string representation of the current display buffer
Display controllers: SH1122, LD7032, ST7920, ST7986, LC7981, T6963, SED1330, RA8835, MAX7219, LS0xx
- Returns:
- The PBM formatted ASCII representation of the display buffer
-
sendCommand
void sendCommand(java.lang.String format, byte... args)
Send special commands to the display controller. These commands are specified in the datasheet of the display controller. U8g2 just provides an interface (There is no support on the functionality for these commands). The information is transfered as a sequence of bytes. Each byte has a special meaning:
- Command byte (c): Commands for the controller. Usually this byte will activate or deactivate a feature in the display controller.
- Argument (a): Some commands require extra information. A command byte then requires a certain number or arguments.
- Pixel data (d): Instructs the display controller to interpret the byte as pixel data, which has to be written to the display memory. In some cases, pixel data require a special command also.
Example
Send multiple commands with arguments: Activate hardware scroll to the left on a SSD1306 display
sendCommand("caaaaaac", 0x027, 0, 3, 0, 7, 0, 255, 0x2f);
- Parameters:
format
- A sequence (string) of c, a or dargs
- A sequence of bytes, separated by comma, one byte per char in the fmt string. The byte will be interpreted accordingly to the char at the same position of the fmt string.
-
setPrimaryColor
void setPrimaryColor(int color)
Set the primary color (set bit) for the pixel data on the BGRA buffer.- Parameters:
color
- A 32-bit color value in BGRA format
-
setSecondaryColor
void setSecondaryColor(int color)
Set the secondary color (unset bit) for the pixel data on the BGRA buffer.- Parameters:
color
- A 32-bit color value in BGRA format
-
-