Functions for GLCD. More...
Public Member Functions | |
CONTROL FUNCTIONS | |
The following control functions are available | |
int | Init (uint8_t invert=NON_INVERTED) |
void | SetDisplayMode (uint8_t mode) |
DRAWING FUNCTIONS | |
The following graphic functions are available | |
void | ClearScreen (uint8_t color=WHITE) |
void | DrawVLine (uint8_t x, uint8_t y, uint8_t height, uint8_t color=BLACK) |
void | DrawHLine (uint8_t x, uint8_t y, uint8_t width, uint8_t color=BLACK) |
void | DrawLine (uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2, uint8_t color=BLACK) |
void | DrawRect (uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint8_t color=BLACK) |
void | DrawRoundRect (uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint8_t radius, uint8_t color=BLACK) |
void | FillRect (uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint8_t color=BLACK) |
void | InvertRect (uint8_t x, uint8_t y, uint8_t width, uint8_t height) |
void | DrawCircle (uint8_t xCenter, uint8_t yCenter, uint8_t radius, uint8_t color=BLACK) |
void | FillCircle (uint8_t xCenter, uint8_t yCenter, uint8_t radius, uint8_t color=BLACK) |
void | DrawBitmap (Image_t bitmap, uint8_t x, uint8_t y, uint8_t color=BLACK) |
void | SetDot (uint8_t x, uint8_t y, uint8_t color) |
void | SetPixels (uint8_t x, uint8_t y, uint8_t x1, uint8_t y1, uint8_t color) |
uint8_t | ReadData (void) |
void | WriteData (uint8_t data) |
void | GotoXY (uint8_t x, uint8_t y) |
TEXT FUNCTIONS | |
The following text functions are available | |
uint8_t | DefineArea (uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2, textMode mode=DEFAULT_SCROLLDIR) |
uint8_t | DefineArea (uint8_t x1, uint8_t y1, uint8_t columns, uint8_t rows, Font_t font, textMode mode=DEFAULT_SCROLLDIR) |
uint8_t | DefineArea (predefinedArea selection, textMode mode=DEFAULT_SCROLLDIR) |
void | SetTextMode (textMode mode) |
void | ClearArea (void) |
void | SelectFont (Font_t font, uint8_t color=BLACK, FontCallback callback=ReadPgmData) |
void | SetFontColor (uint8_t color) |
int | PutChar (uint8_t c) |
void | Puts (char *str) |
void | Puts (const String &str) |
void | Puts_P (PGM_P str) |
void | DrawString (char *str, uint8_t x, uint8_t y) |
void | DrawString (String &str, uint8_t x, uint8_t y) |
void | DrawString_P (PGM_P str, uint8_t x, uint8_t y) |
void | write (uint8_t c) |
void | CursorTo (uint8_t column, uint8_t row) |
void | CursorTo (int8_t column) |
void | CursorToXY (uint8_t x, uint8_t y) |
uint8_t | CharWidth (uint8_t c) |
uint16_t | StringWidth (const char *str) |
uint16_t | StringWidth_P (PGM_P str) |
uint16_t | StringWidth_P (String &str) |
void | EraseTextLine (eraseLine_t type=eraseTO_EOL) |
void | EraseTextLine (uint8_t row) |
void | PrintNumber (long n) |
void | printFlash (FLASHSTRING str) |
void | printFlashln (FLASHSTRING str) |
void | Printf (const char *format,...) |
void | Printf_P (const char *format,...) |
Static Public Attributes | |
static const uint8_t | Bottom |
static const uint8_t | CenterX |
static const uint8_t | CenterY |
static const uint8_t | Height |
static const uint8_t | Right |
static const uint8_t | Width |
Static Protected Attributes | |
static lcdCoord | Coord |
static uint8_t | Inverted |
Functions for GLCD.
uint8_t CharWidth | ( | uint8_t | c | ) | [inherited] |
Returns the pixel width of a character
c | character to be sized |
void ClearArea | ( | void | ) | [inherited] |
Clear text area with the current font background color and home the cursor to upper left corner of the text area.
void ClearScreen | ( | uint8_t | color = WHITE | ) |
Clear the lcd display
color | BLACK or WHITE |
Sets all the pixels on the display from 0,0 to GLCD.Width-1,GLCD.Height-1 to the specified color.
Color is optional and defaults to WHITE.
void CursorTo | ( | int8_t | column | ) | [inherited] |
Positions cursor to a character based column on the current row.
column | specifies the horizontal position |
Column is a 0 based character position based on the size of the currently selected font.
If column is negative then the column position is relative to the current cursor position.
void CursorTo | ( | uint8_t | column, |
uint8_t | row | ||
) | [inherited] |
Positions cursor to a character based column and row.
column | specifies the horizontal position |
row | specifies the vertical position |
Column and Row are zero based character positions and are relative the the upper left corner of the text area base on the size of the currently selected font.
While intended for fixed width fonts, positioning will work for variable width fonts.
When variable width fonts are used, the column is based on assuming a width of the widest character.
void CursorToXY | ( | uint8_t | x, |
uint8_t | y | ||
) | [inherited] |
Positions cursor to a X,Y position
x | specifies the horizontal location |
y | specifies the vertical location |
X & Y are zero based pixel coordinates and are relative to the upper left corner of the text area.
uint8_t DefineArea | ( | uint8_t | x1, |
uint8_t | y1, | ||
uint8_t | x2, | ||
uint8_t | y2, | ||
textMode | mode = DEFAULT_SCROLLDIR |
||
) | [inherited] |
Define a text area by absolute coordinates
x1 | X coordinate of upper left corner |
y1 | Y coordinate of upper left corner |
x2 | X coordinate of lower right corner |
y2 | Y coordinate of lower right corner |
mode | constants SCROLL_DOWN and SCROLL_UP control scroll direction |
Defines a text area based on absolute coordinates. The pixel coordinates for the text area are inclusive so x2,y2 is the lower right pixel of the text area.
x1,y1 and x2,y2 are an absolute coordinates and are relateive to the 0,0 origin of the display.
The area within the newly defined text area is intentionally not cleared.
mode is an optional parameter and defaults to normal/up scrolling
uint8_t DefineArea | ( | predefinedArea | selection, |
textMode | mode = DEFAULT_SCROLLDIR |
||
) | [inherited] |
Define a predefined generic text area
selection | a value from predefinedArea |
mode | constants SCROLL_DOWN and SCROLL_UP control scroll direction |
Defines a text area using a selection form a set of predefined areas.
The area within the newly defined text area is intentionally not cleared.
mode is an optional parameter and defaults to normal/up scrolling
uint8_t DefineArea | ( | uint8_t | x, |
uint8_t | y, | ||
uint8_t | columns, | ||
uint8_t | rows, | ||
Font_t | font, | ||
textMode | mode = DEFAULT_SCROLLDIR |
||
) | [inherited] |
Define a Text area by columns and rows
x | X coordinate of upper left corner |
y | Y coordinate of upper left corner |
columns | number of text columns |
rows | number of text rows |
font | a font definition |
mode | constants SCROLL_DOWN and SCROLL_UP control scroll direction |
Defines a text area sized to hold columns characters across and rows characters tall. It is properly sized for the specified font.
The area within the newly defined text area is intentionally not cleared.
While intended for fixed width fonts, sizing will work for variable width fonts.
When variable width fonts are used, the column is based on assuming a width of the widest character.
x,y is an absolute coordinate and is relateive to the 0,0 origin of the display.
mode is an optional parameter and defaults to normal/up scrolling
void DrawBitmap | ( | Image_t | bitmap, |
uint8_t | x, | ||
uint8_t | y, | ||
uint8_t | color = BLACK |
||
) |
Draw a glcd bitmap image
bitmap | a ponter to the bitmap data |
x | the x coordinate of the upper left corner of the bitmap |
y | the y coordinate of the upper left corner of the bitmap |
color | BLACK or WHITE |
Draws a bitmap image with the upper left corner at location x,y The bitmap data is assumed to be in program memory.
Color is optional and defaults to BLACK.
#ifdef NOTYET
void DrawCircle | ( | uint8_t | xCenter, |
uint8_t | yCenter, | ||
uint8_t | radius, | ||
uint8_t | color = BLACK |
||
) |
Draw a Circle
xCenter | X coordinate of the center of the circle |
yCenter | Y coordinate of the center of the circle |
radius | radius of circle |
color | BLACK or WHITE |
Draws a circle of the given radius extending out from the center pixel. The circle will fit inside a rectanglular area bounded by x-radius,y-radius and x+radius,y+radius
Because the circle is drawn from the center pixel out, the diameter will be 2 * radius +1 pixels.
Color is optional and defaults to BLACK.
void DrawHLine | ( | uint8_t | x, |
uint8_t | y, | ||
uint8_t | width, | ||
uint8_t | color = BLACK |
||
) |
Draw a Horizontal Line
x | a value from 0 to GLCD.Width-1 |
y | a value from 0 to GLCD.Height-1 |
width | a value from 1 to GLCD.Width-x-1 |
color | BLACK or WHITE |
The line drawn will be width+1 pixels.
color is an optional parameter indicating pixel color and defaults to BLACK
void DrawLine | ( | uint8_t | x1, |
uint8_t | y1, | ||
uint8_t | x2, | ||
uint8_t | y2, | ||
uint8_t | color = BLACK |
||
) |
Draw a line
x1 | a value from 0 to GLCD.Width-1 indicating start x coordinate |
y1 | a value fron 0 to GLCD.Height-1 indicating start y coordinate |
x2 | a value from 0 to GLCD.Width-1 indicating end x coordinate |
y2 | a value fron 0 to GLCD.Height-1 indicating end y coordinate |
color | BLACK or WHITE |
Draws a line starting at x1,y2 and ending at x2,y2.
Color is optional and defaults to BLACK.
void DrawRect | ( | uint8_t | x, |
uint8_t | y, | ||
uint8_t | width, | ||
uint8_t | height, | ||
uint8_t | color = BLACK |
||
) |
Draw a rectangle of given width and height
x | the x coordinate of the upper left corner of the rectangle |
y | the y coordinate of the upper left corner of the rectangle |
width | width of the rectangle |
height | height of the rectangle |
color | BLACK or WHITE |
Draws a rectangle with the specified width and height. The upper left corner at x,y and the lower right corner at x+width,y+width.
The length of the horizontal sides will be width+1 pixels The length of the vertical sides will be height+1 pixels
Color is optional and defaults to BLACK.
void DrawRoundRect | ( | uint8_t | x, |
uint8_t | y, | ||
uint8_t | width, | ||
uint8_t | height, | ||
uint8_t | radius, | ||
uint8_t | color = BLACK |
||
) |
Draw a rectangle with rounder corners
x | the x coordinate of the upper left corner of the rectangle |
y | the y coordinate of the upper left corner of the rectangle |
width | width of the rectangle |
height | height of the rectangle |
radius | ???? |
color | BLACK or WHITE |
Draws a rectangle the same as DrawRect() but with rounded corners. Radius is a value from 1 to half the height or width of the rectangle. (what does that really mean?????) Which is it, or is it a the smaller of the two? FIXME FIXME need more description here.
void DrawString | ( | char * | str, |
uint8_t | x, | ||
uint8_t | y | ||
) | [inherited] |
output a character string at x,y coordinate
str | String class string |
x | specifies the horizontal location |
y | specifies the vertical location |
Outputs all the characters in the string to the text area. X & Y are zero based pixel coordinates and are relative to the upper left corner of the text area.
See PutChar() for a full description of how characters are written to the text area.
void DrawString | ( | String & | str, |
uint8_t | x, | ||
uint8_t | y | ||
) | [inherited] |
output a String class string at x,y coordinate
str | pointer to a null terminated character string |
x | specifies the horizontal location |
y | specifies the vertical location |
Outputs all the characters in the string to the text area. X & Y are zero based pixel coordinates and are relative to the upper left corner of the text area.
See PutChar() for a full description of how characters are written to the text area.
void DrawString_P | ( | PGM_P | str, |
uint8_t | x, | ||
uint8_t | y | ||
) | [inherited] |
output a program memory character string at x,y coordinate
str | pointer to a null terminated character string stored in program memory |
x | specifies the horizontal location |
y | specifies the vertical location |
Outputs all the characters in the string to the text area. X & Y are zero based pixel coordinates and are relative to the upper left corner of the text area.
See PutChar() for a full description of how characters are written to the text area.
void DrawVLine | ( | uint8_t | x, |
uint8_t | y, | ||
uint8_t | height, | ||
uint8_t | color = BLACK |
||
) |
Draw a Vertical Line
x | a value from 0 to GLCD.Width-1 |
y | a value from 0 to GLCD.Height-1 |
height | a value from 1 to GLCD.Height-y-1 |
color | color of line |
color of BLACK or WHITE is an optional parameter indicating pixel color, default is BLACK
The line drawn will be height+1 pixels.
void EraseTextLine | ( | eraseLine_t | type = eraseTO_EOL | ) | [inherited] |
Erase in Line
type | type of line erase |
Erases all or part of a line of text depending on the type of erase specified.
If type is not specified it is assumed to be eraseTO_EOL
The cursor position does not change.
void EraseTextLine | ( | uint8_t | row | ) | [inherited] |
Erase Text Line
row | row # of text to earase |
Erases a line of text and moves the cursor to the begining of the line. Rows are zero based so the top line/row of a text area is 0.
void FillCircle | ( | uint8_t | xCenter, |
uint8_t | yCenter, | ||
uint8_t | radius, | ||
uint8_t | color = BLACK |
||
) |
Draw a Filled in a Circle
xCenter | X coordinate of the center of the circle |
yCenter | Y coordinate of the center of the circle |
radius | radius of circle |
color | WHITE or BLACK |
Draws a filled in circle of the given radius extending out from the center pixel.
See DrawCircle() for the full details on sizing.
Color is optional and defaults to BLACK.
void FillRect | ( | uint8_t | x, |
uint8_t | y, | ||
uint8_t | width, | ||
uint8_t | height, | ||
uint8_t | color = BLACK |
||
) |
Fill a Rectangle
x | the x coordinate of the upper left corner of the rectangle |
y | the y coordinate of the upper left corner of the rectangle |
width | width of the rectangle |
height | height of the rectangle |
color | BLACK or WHITE |
Fills a rectanglular area of the specified width and height.
The resulting rectangle covers an area width pixels wide by height pixels tall starting from the pixel at x,y.
The upper left corner at x,y and the lower right corner at x+width-1,y+width-1.
The length of the horizontal sides will be width pixels The length of the vertical sides will be height pixels
Color is optional and defaults to BLACK.
void GotoXY | ( | uint8_t | x, |
uint8_t | y | ||
) |
set current x,y coordinate on display device
x | X coordinate |
y | Y coordinate |
Sets the current pixel location to x,y. x and y are relative to the 0,0 origin of the display which is the upper left most pixel on the display.
Reimplemented from glcd_Device.
int Init | ( | uint8_t | invert = NON_INVERTED | ) |
Initilize the GLCD library and hardware
invert | specifices whether display is in normal mode or inverted mode. |
This should be called prior to any other graphic library function. It does all the needed initializations including taking care of the low level hardware initalization of the display device.
The optional invert parameter specifies if the display should be run in a normal mode, dark pixels on light background or inverted, light pixels on a dark background.
To specify dark pixels use the define NON-INVERTED and to use light pixels use the define INVERTED
Upon completion of the initialization, then entire display will be cleared.
Reimplemented from glcd_Device.
void InvertRect | ( | uint8_t | x, |
uint8_t | y, | ||
uint8_t | width, | ||
uint8_t | height | ||
) |
Invert a Rectangular area
x | the x coordinate of the upper left corner of the rectangle |
y | the y coordinate of the upper left corner of the rectangle |
width | width of the rectangle |
height | height of the rectangle |
Inverts the pixels in the rectanglular area of the specified width and height. BLACK pixels becom WHITE and WHITE pixels become BLACK.
See FillRect() for full the full details of the rectangular area.
void Printf | ( | const char * | format, |
... | |||
) | [inherited] |
print formatted data
format | string that contains text or optional embedded format tags |
... | Depending on the format string, the function may expect a sequence of additional arguments. |
Writes a sequence of data formatted as the format argument specifies. After the format parameter, the function expects at least as many additional arguments as specified in format. The format string supports all standard printf() formating % tags.
void Printf_P | ( | const char * | format, |
... | |||
) | [inherited] |
print formatted data
format | string in AVR progmem that contains text or optional embedded format tags |
... | Depending on the format string, the function may expect a sequence of additional arguments. |
See gText::Printf() for full details.
void printFlash | ( | FLASHSTRING | str | ) | [inherited] |
print a flash based string
str | pointer to a null terminated character string stored in program memory |
void printFlashln | ( | FLASHSTRING | str | ) | [inherited] |
print a flash based string
str | pointer to a null terminated character string stored in program memory |
The string is output followed by a newline.
void PrintNumber | ( | long | n | ) | [inherited] |
Legacy function to print a number
n | is the number to print |
int PutChar | ( | uint8_t | c | ) | [inherited] |
output a character
c | the character to output |
If the character will not fit on the current text line inside the text area, the text position is wrapped to the next line. This might be the next lower or the next higher line depending on the scroll direction.
If there is not enough room to fit a full line of new text after wrapping, the entire text area will be scrolled to make room for a new line of text. The scroll direction will be up or down depending on the scroll direction for the text area.
void Puts | ( | char * | str | ) | [inherited] |
output a character string
str | pointer to a null terminated character string. |
Outputs all the characters in the string to the text area. See PutChar() for a full description of how characters are written to the text area.
void Puts | ( | const String & | str | ) | [inherited] |
output a String class string
str | String class string |
Outputs all the characters in the string to the text area. See PutChar() for a full description of how characters are written to the text area.
void Puts_P | ( | PGM_P | str | ) | [inherited] |
output a program memory character string
str | pointer to a null terminated character string stored in program memory |
Outputs all the characters in the string to the text area. See PutChar() for a full description of how characters are written to the text area.
uint8_t ReadData | ( | void | ) |
read a data byte from display device memory
Reimplemented from glcd_Device.
void SelectFont | ( | Font_t | font, |
uint8_t | color = BLACK , |
||
FontCallback | callback = ReadPgmData |
||
) | [inherited] |
Select a Font and font color
font | a font definition |
color | can be WHITE or BLACK and defaults to black |
callback | optional font read routine |
Selects the font definition as the current font for the text area.
All subsequent printing functions will use this font.
Font definitions from included font definition files are stored in program memory You can have as many fonts defines as will fit in program memory up to 64k and can switch between them with this function.
If the optional callback argument is ommitted, a default routine is selected that assumes that the font is in program memory (flash).
void SetDisplayMode | ( | uint8_t | invert | ) |
Set LCD Display mode
invert | Inverted mode |
Sets the graphical state mode for the entire LCD display to NON_INVERTED (BLACK colorerd pixeld are dark) or INVERTED (WHITE colored pixels are dark)
void SetDot | ( | uint8_t | x, |
uint8_t | y, | ||
uint8_t | color | ||
) |
set pixel at x,y to the given color
x | X coordinate, a value from 0 to GLCD.Width-1 |
y | Y coordinate, a value from 0 to GLCD.Heigh-1 |
color | WHITE or BLACK |
Sets the pixel at location x,y to the specified color. x and y are relative to the 0,0 origin of the display which is the upper left corner. Requests to set pixels outside the range of the display will be ignored.
Reimplemented from glcd_Device.
void SetFontColor | ( | uint8_t | color | ) | [inherited] |
void SetPixels | ( | uint8_t | x, |
uint8_t | y, | ||
uint8_t | x2, | ||
uint8_t | y2, | ||
uint8_t | color | ||
) |
set an area of pixels
x | X coordinate of upper left corner |
y | Y coordinate of upper left corner |
x2 | X coordinate of lower right corner |
y2 | Y coordinate of lower right corner |
color | sets the pixels an area bounded by x,y to x2,y2 inclusive to the specified color. |
The width of the area is x2-x + 1. The height of the area is y2-y+1
Reimplemented from glcd_Device.
void SetTextMode | ( | textMode | mode | ) | [inherited] |
Set TextArea mode
mode | text area mode |
Currently mode is a scroll direction
uint16_t StringWidth | ( | const char * | str | ) | [inherited] |
Returns the pixel width of a string
str | pointer to string stored in RAM |
uint16_t StringWidth_P | ( | String & | str | ) | [inherited] |
Returns the pixel width of a character
str | String class string |
uint16_t StringWidth_P | ( | PGM_P | str | ) | [inherited] |
Returns the pixel width of a character
str | pointer to string stored in program memory |
void write | ( | uint8_t | c | ) | [inherited] |
output a character to the text area
c | the character to output |
This method is needed for the Print base class
Reimplemented from glcd_Device.
void WriteData | ( | uint8_t | data | ) |
Write a byte to display device memory
data | date byte to write to memory |
The data specified is written to glcd memory at the current x,y position. If the y location is not on a byte boundary, the write is fragemented up into multiple writes.
Reimplemented from glcd_Device.
const uint8_t Bottom [static] |
Bottom most pixel on Display (equals Height -1)
const uint8_t CenterX [static] |
Horizontal center pixel on Display (equals Width/2)
const uint8_t CenterY [static] |
Vertical center pixel on Display (equals Height/2)
const uint8_t Height [static] |
Display height in pixels
const uint8_t Right [static] |
Right most pixel on Display (equals Width -1)
const uint8_t Width [static] |
Display width in pixels