ERM19264_UC1609
1.8.0
Arduino Eco-system Library for ERM19264 LCD driven by UC1609 controller.
|
Graphics class to hold graphic related functions. More...
#include <ERM19264_graphics.h>
Public Member Functions | |
ERM19264_graphics (int16_t w, int16_t h) | |
init the LCD Graphics class object More... | |
virtual void | drawPixel (int16_t x, int16_t y, uint8_t color)=0 |
void | drawLine (int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint8_t color) |
draws a line from (x0,y0) to (x1,y1). More... | |
void | drawFastVLine (int16_t x, int16_t y, int16_t h, uint8_t color) |
Draws a vertical line starting at (x,y) with height h. More... | |
void | drawFastHLine (int16_t x, int16_t y, int16_t w, uint8_t color) |
Draws a horizontal line starting at (x,y) with width w. More... | |
void | drawRect (int16_t x, int16_t y, int16_t w, int16_t h, uint8_t color) |
draws rectangle at (x,y) where h is height and w is width of the rectangle. More... | |
void | fillRect (int16_t x, int16_t y, int16_t w, int16_t h, uint8_t color) |
fills a rectangle starting from coordinates (x,y) with width of w and height of h. More... | |
void | fillScreen (uint8_t color) |
Fills the whole screen with a given color. More... | |
void | drawCircle (int16_t x0, int16_t y0, int16_t r, uint8_t color) |
draws a circle where (x0,y0) are center coordinates an r is circle radius. More... | |
void | drawCircleHelper (int16_t x0, int16_t y0, int16_t r, uint8_t cornername, uint8_t color) |
Used internally by drawRoundRect. | |
void | fillCircle (int16_t x0, int16_t y0, int16_t r, uint8_t color) |
fills a circle where (x0,y0) are center coordinates an r is circle radius. More... | |
void | fillCircleHelper (int16_t x0, int16_t y0, int16_t r, uint8_t cornername, int16_t delta, uint8_t color) |
Used internally by fill circle fillRoundRect and fillcircle. | |
void | drawTriangle (int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint8_t color) |
draws a triangle of coordinates (x0,y0), (x1,y1) and (x2,y2). More... | |
void | fillTriangle (int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint8_t color) |
Fills a triangle of coordinates (x0,y0), (x1,y1) and (x2,y2). More... | |
void | drawRoundRect (int16_t x0, int16_t y0, int16_t w, int16_t h, int16_t radius, uint8_t color) |
draws a rectangle with rounded edges More... | |
void | fillRoundRect (int16_t x0, int16_t y0, int16_t w, int16_t h, int16_t radius, uint8_t color) |
Fills a rectangle with rounded edges. More... | |
LCD_Return_Codes_e | drawBitmap (int16_t x, int16_t y, const uint8_t *bitmap, int16_t w, int16_t h, uint8_t color, uint8_t bg) |
Draw a 1-bit color bitmap. More... | |
void | setDrawBitmapAddr (boolean mode) |
sets the data addressing mode in drawBitmap function. More... | |
void | setCursor (int16_t x, int16_t y) |
set the cursor position More... | |
void | setTextColor (uint8_t c) |
set the text color More... | |
void | setTextColor (uint8_t c, uint8_t bg) |
set the text color More... | |
void | setTextSize (uint8_t s) |
set the text size , starts at 1 More... | |
void | setTextWrap (boolean w) |
turn on or off screen _textWrap of the text (fonts 1-6) More... | |
void | setFontNum (LCD_Font_Type_e FontNumber) |
Set the font type. More... | |
LCD_Return_Codes_e | drawChar (uint8_t x, uint8_t y, uint8_t c, uint8_t color, uint8_t bg) |
writes a char (c) on the LCD More... | |
LCD_Return_Codes_e | drawText (uint8_t x, uint8_t y, char *pText, uint8_t color, uint8_t bg) |
Writes text string (*ptext) on the LCD. More... | |
LCD_Return_Codes_e | drawChar (int16_t x, int16_t y, unsigned char c, uint8_t color, uint8_t bg, uint8_t s) |
writes a char (c) on the LCD More... | |
LCD_Return_Codes_e | drawText (uint8_t x, uint8_t y, char *pTxt, uint8_t c, uint8_t bg, uint8_t s) |
Writes text string on the LCD. More... | |
virtual void | write (uint8_t) |
: called by the print class after it converts the data to a character More... | |
int16_t | height (void) const |
Gets the height of the display (per current rotation) More... | |
int16_t | width (void) const |
Gets the width of the display (per current rotation) More... | |
void | setRotation (LCD_rotate_e) |
Sets the rotation of the display. More... | |
LCD_rotate_e | getRotation (void) |
Gets the _rotation of the display. More... | |
Protected Attributes | |
const int16_t | WIDTH |
const int16_t | HEIGHT |
int16_t | _width |
int16_t | _height |
int16_t | _cursorX |
int16_t | _cursorY |
LCD_rotate_e | LCD_rotate = LCD_Degrees_0 |
uint8_t | _textColor = 0x00 |
uint8_t | _textBgColor = 0x01 |
uint8_t | _textSize = 1 |
boolean | _textWrap |
boolean | drawBitmapAddr |
Private Types | |
enum | LCD_Font_width_e : uint8_t { UC1609Font_width_3 = 3 , UC1609Font_width_4 = 4 , UC1609Font_width_5 = 5 , UC1609Font_width_6 = 6 , UC1609Font_width_7 = 7 , UC1609Font_width_8 = 8 , UC1609Font_width_16 = 16 } |
enum | LCD_Font_offset_e : uint8_t { UC1609Font_offset_none = 0x00 , UC1609Font_offset_space = 0x20 , UC1609Font_offset_minus = 0x2D , UC1609Font_offset_zero = 0x30 } |
enum | LCD_Font_height_e : uint8_t { UC1609Font_height_8 = 8 , UC1609Font_height_12 = 12 , UC1609Font_height_16 = 16 , UC1609Font_height_24 = 24 , UC1609Font_height_32 = 32 } |
enum | LCD_Font_Length_e : uint8_t { UC1609FontLenNumeric = 14 , UC1609FontLenAlphaNumNoLCase = 59 , UC1609FontLenAlphaNum = 95 , UC1609FontLenHalf = 128 , UC1609FontLenAll = 255 } |
Private Attributes | |
uint8_t | _FontNumber = 1 |
uint8_t | _CurrentFontWidth =5 |
uint8_t | _CurrentFontoffset = 0 |
uint8_t | _CurrentFontheight = 8 |
uint8_t | _CurrentFontLength = 128 |
Graphics class to hold graphic related functions.
|
private |
|
private |
|
private |
|
private |
Width of the font in bits each representing a bytes sized column
ERM19264_graphics::ERM19264_graphics | ( | int16_t | w, |
int16_t | h | ||
) |
init the LCD Graphics class object
w | width defined in sub-class |
h | height defined in sub-class |
LCD_Return_Codes_e ERM19264_graphics::drawBitmap | ( | int16_t | x, |
int16_t | y, | ||
const uint8_t * | bitmap, | ||
int16_t | w, | ||
int16_t | h, | ||
uint8_t | color, | ||
uint8_t | bg | ||
) |
Draw a 1-bit color bitmap.
x | x co-ord position |
y | y co-ord posiiton a |
bitmap | pointer to bitmap data (must be PROGMEM memory) |
w | width of the bitmap |
h | height of the bitmap |
color | foreground colour |
bg | background colour. |
LCD_Return_Codes_e ERM19264_graphics::drawChar | ( | int16_t | x, |
int16_t | y, | ||
unsigned char | character, | ||
uint8_t | color, | ||
uint8_t | bg, | ||
uint8_t | size | ||
) |
writes a char (c) on the LCD
x | X coordinate |
y | Y coordinate |
character | The ASCII character |
color | color |
bg | background color |
size | 1-x |
LCD_Return_Codes_e ERM19264_graphics::drawChar | ( | uint8_t | x, |
uint8_t | y, | ||
uint8_t | character, | ||
uint8_t | color, | ||
uint8_t | bg | ||
) |
writes a char (c) on the LCD
x | X coordinate |
y | Y coordinate |
character | The ASCII character |
color | |
bg | background color |
void ERM19264_graphics::drawCircle | ( | int16_t | x0, |
int16_t | y0, | ||
int16_t | r, | ||
uint8_t | color | ||
) |
draws a circle where (x0,y0) are center coordinates an r is circle radius.
x0 | circle center x position |
y0 | circle center y position |
r | radius of circle |
color | The color of the circle |
void ERM19264_graphics::drawFastHLine | ( | int16_t | x, |
int16_t | y, | ||
int16_t | w, | ||
uint8_t | color | ||
) |
Draws a horizontal line starting at (x,y) with width w.
x | The starting x coordinate |
y | The starting y coordinate |
w | The width of the line |
color | The color of the line |
void ERM19264_graphics::drawFastVLine | ( | int16_t | x, |
int16_t | y, | ||
int16_t | h, | ||
uint8_t | color | ||
) |
Draws a vertical line starting at (x,y) with height h.
x | The starting x coordinate |
y | The starting y coordinate |
h | The height of the line |
color | The color of the line |
void ERM19264_graphics::drawLine | ( | int16_t | x0, |
int16_t | y0, | ||
int16_t | x1, | ||
int16_t | y1, | ||
uint8_t | color | ||
) |
draws a line from (x0,y0) to (x1,y1).
x0 | x start coordinate |
y0 | y start coordinate |
x1 | x end coordinate |
y1 | y end coordinate |
color | color to draw line |
void ERM19264_graphics::drawRect | ( | int16_t | x, |
int16_t | y, | ||
int16_t | w, | ||
int16_t | h, | ||
uint8_t | color | ||
) |
draws rectangle at (x,y) where h is height and w is width of the rectangle.
x | x start coordinate |
y | y start coordinate |
w | width of the rectangle |
h | height of the rectangle |
color | color to draw rect |
void ERM19264_graphics::drawRoundRect | ( | int16_t | x, |
int16_t | y, | ||
int16_t | w, | ||
int16_t | h, | ||
int16_t | r, | ||
uint8_t | color | ||
) |
draws a rectangle with rounded edges
x | x start coordinate |
y | y start coordinate |
w | width of the rectangle |
h | height of the rectangle |
r | radius of the rounded edges |
color | color to draw rounded rectangle |
LCD_Return_Codes_e ERM19264_graphics::drawText | ( | uint8_t | x, |
uint8_t | y, | ||
char * | pText, | ||
uint8_t | color, | ||
uint8_t | bg | ||
) |
Writes text string (*ptext) on the LCD.
x | X coordinate |
y | Y coordinate |
pText | pointer to string of ASCII character's |
color | text color |
bg | background color |
LCD_Return_Codes_e ERM19264_graphics::drawText | ( | uint8_t | x, |
uint8_t | y, | ||
char * | pText, | ||
uint8_t | color, | ||
uint8_t | bg, | ||
uint8_t | size | ||
) |
Writes text string on the LCD.
x | X coordinate |
y | Y coordinate |
pText | pointer to string/array |
color | text color |
bg | background color |
size | 1-x |
void ERM19264_graphics::drawTriangle | ( | int16_t | x0, |
int16_t | y0, | ||
int16_t | x1, | ||
int16_t | y1, | ||
int16_t | x2, | ||
int16_t | y2, | ||
uint8_t | color | ||
) |
draws a triangle of coordinates (x0,y0), (x1,y1) and (x2,y2).
x0 | x start coordinate point 1 |
y0 | y start coordinate point 1 |
x1 | x start coordinate point 2 |
y1 | y start coordinate point 2 |
x2 | x start coordinate point 3 |
y2 | y start coordinate point 3 |
color | color to draw triangle |
void ERM19264_graphics::fillCircle | ( | int16_t | x0, |
int16_t | y0, | ||
int16_t | r, | ||
uint8_t | color | ||
) |
fills a circle where (x0,y0) are center coordinates an r is circle radius.
x0 | circle center x position |
y0 | circle center y position |
r | radius of circle |
color | color of the filled circle |
void ERM19264_graphics::fillRect | ( | int16_t | x, |
int16_t | y, | ||
int16_t | w, | ||
int16_t | h, | ||
uint8_t | color | ||
) |
fills a rectangle starting from coordinates (x,y) with width of w and height of h.
x | x coordinate |
y | y coordinate |
w | width of the rectangle |
h | height of the rectangle |
color | color to fill rectangle |
void ERM19264_graphics::fillRoundRect | ( | int16_t | x, |
int16_t | y, | ||
int16_t | w, | ||
int16_t | h, | ||
int16_t | r, | ||
uint8_t | color | ||
) |
Fills a rectangle with rounded edges.
x | x start coordinate |
y | y start coordinate |
w | width of the rectangle |
h | height of the rectangle |
r | radius of the rounded edges |
color | color to fill round rectangle |
void ERM19264_graphics::fillScreen | ( | uint8_t | color | ) |
Fills the whole screen with a given color.
color | color to fill screen |
void ERM19264_graphics::fillTriangle | ( | int16_t | x0, |
int16_t | y0, | ||
int16_t | x1, | ||
int16_t | y1, | ||
int16_t | x2, | ||
int16_t | y2, | ||
uint8_t | color | ||
) |
Fills a triangle of coordinates (x0,y0), (x1,y1) and (x2,y2).
x0 | x start coordinate point 1 |
y0 | y start coordinate point 1 |
x1 | x start coordinate point 2 |
y1 | y start coordinate point 2 |
x2 | x start coordinate point 3 |
y2 | y start coordinate point 3 |
color | color to fill triangle |
LCD_rotate_e ERM19264_graphics::getRotation | ( | void | ) |
Gets the _rotation of the display.
int16_t ERM19264_graphics::height | ( | void | ) | const |
Gets the height of the display (per current rotation)
void ERM19264_graphics::setCursor | ( | int16_t | x, |
int16_t | y | ||
) |
set the cursor position
x | X co-ord position |
y | Y co-ord position |
void ERM19264_graphics::setDrawBitmapAddr | ( | boolean | mode | ) |
sets the data addressing mode in drawBitmap function.
mode | boolean mode , true default
|
void ERM19264_graphics::setFontNum | ( | LCD_Font_Type_e | FontNumber | ) |
Set the font type.
FontNumber | enum LCD_FONT_TYPE_e |
void ERM19264_graphics::setRotation | ( | LCD_rotate_e | CurrentRotation | ) |
Sets the rotation of the display.
CurrentRotation | rotation enum value 0-3 |
Note this is separate from LCD command method for rotation. This rotates the Software buffer.
void ERM19264_graphics::setTextColor | ( | uint8_t | c | ) |
set the text color
c | Color fo text |
void ERM19264_graphics::setTextColor | ( | uint8_t | c, |
uint8_t | b | ||
) |
set the text color
c | Color of text foreground |
b | color of background of text |
void ERM19264_graphics::setTextSize | ( | uint8_t | s | ) |
set the text size , starts at 1
s | Size of text 1-X |
void ERM19264_graphics::setTextWrap | ( | boolean | w | ) |
turn on or off screen _textWrap of the text (fonts 1-6)
w | TRUE on |
int16_t ERM19264_graphics::width | ( | void | ) | const |
Gets the width of the display (per current rotation)
|
virtual |
: called by the print class after it converts the data to a character
character | The character to write |
|
private |
Store current offset height
|
private |
Store current font number of characters
|
private |
Store current offset width
|
private |
Store current font width
|
protected |
Current X co-ord cursor position
|
protected |
Current Y co-ord cursor position
|
private |
Store current font
|
protected |
Display h as modified by current rotation
|
protected |
Text background color
|
protected |
Text foreground color
|
protected |
Size of text ,fonts 1-6
|
protected |
If set, 'Wrap' text at right edge of display
|
protected |
Display w as modified by current rotation
|
protected |
data addressing mode for method drawBitmap, True-vertical , false-horizontal
|
protected |
This is the 'raw' display h - never changes
|
protected |
Enum to hold rotation
|
protected |
This is the 'raw' display w - never changes