ERM19264_UC1609  1.8.0
Arduino Eco-system Library for ERM19264 LCD driven by UC1609 controller.
Public Member Functions | Protected Attributes | Private Types | Private Attributes | List of all members
ERM19264_graphics Class Referenceabstract

Graphics class to hold graphic related functions. More...

#include <ERM19264_graphics.h>

Inheritance diagram for ERM19264_graphics:
Inheritance graph
[legend]
Collaboration diagram for ERM19264_graphics:
Collaboration graph
[legend]

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
 

Detailed Description

Graphics class to hold graphic related functions.

Member Enumeration Documentation

◆ LCD_Font_height_e

enum ERM19264_graphics::LCD_Font_height_e : uint8_t
private

Height of the font in bits

Enumerator
UC1609Font_height_8 

8 bit font 1-6 at size 1

UC1609Font_height_12 

12 bit font 12

UC1609Font_height_16 

16 bit font 8, 10 11

UC1609Font_height_24 

24 bit font 9

UC1609Font_height_32 

32 bit font 7

◆ LCD_Font_Length_e

enum ERM19264_graphics::LCD_Font_Length_e : uint8_t
private

Number of ASCII characters in Font

Enumerator
UC1609FontLenNumeric 

extended Numeric 0x2D - 0x3A

UC1609FontLenAlphaNumNoLCase 

reduced Alphanumeric 0x20-0x5A

UC1609FontLenAlphaNum 

Full Alphanumeric 0x20-0x7E

UC1609FontLenHalf 

Full Range 0-127

UC1609FontLenAll 

Full Range 0-0xFF

◆ LCD_Font_offset_e

enum ERM19264_graphics::LCD_Font_offset_e : uint8_t
private

font offset in the ASCII table

Enumerator
UC1609Font_offset_none 

Full extended ASCII

UC1609Font_offset_space 

Starts at Space, alphanumeric

UC1609Font_offset_minus 

Starts at Minus, extended numeric

UC1609Font_offset_zero 

Starts at zero, numeric

◆ LCD_Font_width_e

enum ERM19264_graphics::LCD_Font_width_e : uint8_t
private

Width of the font in bits each representing a bytes sized column

Enumerator
UC1609Font_width_3 

3 tiny font

UC1609Font_width_4 

4 seven segment font

UC1609Font_width_5 

5 default font

UC1609Font_width_6 

12 dedica font

UC1609Font_width_7 

6 homespun & 2 thick font

UC1609Font_width_8 

8 wide & mia font

UC1609Font_width_16 

16 font 7-10

Constructor & Destructor Documentation

◆ ERM19264_graphics()

ERM19264_graphics::ERM19264_graphics ( int16_t  w,
int16_t  h 
)

init the LCD Graphics class object

Parameters
wwidth defined in sub-class
hheight defined in sub-class

Member Function Documentation

◆ drawBitmap()

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.

Parameters
xx co-ord position
yy co-ord posiiton a
bitmappointer to bitmap data (must be PROGMEM memory)
wwidth of the bitmap
hheight of the bitmap
colorforeground colour
bgbackground colour.
Returns
LCD_Return_Codes_e enum.
Note
Variable drawBitmapAddr controls data addressing
  1. drawBitmapAddr = true Vertical data addressing
  2. drawBitmapAddr = false Horizontal data addressing
  3. A vertical Bitmap's h must be divisible by 8.for a bitmap with h=128 & h=64.
  4. Bitmap excepted size = 128 * (64/8) = 1024 bytes.
  5. A horizontal Bitmap's w must be divisible by 8. For a bitmap with w=88 & h=48.
  6. Bitmap excepted size = (88/8) * 48 = 528 bytes.

◆ drawChar() [1/2]

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

Parameters
xX coordinate
yY coordinate
characterThe ASCII character
colorcolor
bgbackground color
size1-x
Returns
LCD_Return_Codes_e enum.
Note
for font #1-6 only

◆ drawChar() [2/2]

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

Parameters
xX coordinate
yY coordinate
characterThe ASCII character
color
bgbackground color
Returns
LCD_Return_Codes_e enum.
Note
for font 7-12 only

◆ drawCircle()

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.

Parameters
x0circle center x position
y0circle center y position
rradius of circle
colorThe color of the circle

◆ drawFastHLine()

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.

Parameters
xThe starting x coordinate
yThe starting y coordinate
wThe width of the line
colorThe color of the line

◆ drawFastVLine()

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.

Parameters
xThe starting x coordinate
yThe starting y coordinate
hThe height of the line
colorThe color of the line

◆ drawLine()

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).

Parameters
x0x start coordinate
y0y start coordinate
x1x end coordinate
y1y end coordinate
colorcolor to draw line

◆ drawRect()

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.

Parameters
xx start coordinate
yy start coordinate
wwidth of the rectangle
hheight of the rectangle
colorcolor to draw rect

◆ drawRoundRect()

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

Parameters
xx start coordinate
yy start coordinate
wwidth of the rectangle
hheight of the rectangle
rradius of the rounded edges
colorcolor to draw rounded rectangle

◆ drawText() [1/2]

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.

Parameters
xX coordinate
yY coordinate
pTextpointer to string of ASCII character's
colortext color
bgbackground color
Returns
LCD_Return_Codes_e enum.
Note
for font 7-12 only

◆ drawText() [2/2]

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.

Parameters
xX coordinate
yY coordinate
pTextpointer to string/array
colortext color
bgbackground color
size1-x
Returns
LCD_Return_Codes_e enum.
Note
for font #1-6 only

◆ drawTriangle()

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).

Parameters
x0x start coordinate point 1
y0y start coordinate point 1
x1x start coordinate point 2
y1y start coordinate point 2
x2x start coordinate point 3
y2y start coordinate point 3
colorcolor to draw triangle

◆ fillCircle()

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.

Parameters
x0circle center x position
y0circle center y position
rradius of circle
colorcolor of the filled circle

◆ fillRect()

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.

Parameters
xx coordinate
yy coordinate
wwidth of the rectangle
hheight of the rectangle
colorcolor to fill rectangle

◆ fillRoundRect()

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.

Parameters
xx start coordinate
yy start coordinate
wwidth of the rectangle
hheight of the rectangle
rradius of the rounded edges
colorcolor to fill round rectangle

◆ fillScreen()

void ERM19264_graphics::fillScreen ( uint8_t  color)

Fills the whole screen with a given color.

Parameters
colorcolor to fill screen

◆ fillTriangle()

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).

Parameters
x0x start coordinate point 1
y0y start coordinate point 1
x1x start coordinate point 2
y1y start coordinate point 2
x2x start coordinate point 3
y2y start coordinate point 3
colorcolor to fill triangle

◆ getRotation()

LCD_rotate_e ERM19264_graphics::getRotation ( void  )

Gets the _rotation of the display.

Returns
rotation enum value 0-3

◆ height()

int16_t ERM19264_graphics::height ( void  ) const

Gets the height of the display (per current rotation)

Returns
height member of display in pixels

◆ setCursor()

void ERM19264_graphics::setCursor ( int16_t  x,
int16_t  y 
)

set the cursor position

Parameters
xX co-ord position
yY co-ord position

◆ setDrawBitmapAddr()

void ERM19264_graphics::setDrawBitmapAddr ( boolean  mode)

sets the data addressing mode in drawBitmap function.

Parameters
modeboolean mode , true default
  1. True = bitmap data vertically addressed
  2. False = bitmap data horizontally addressed

◆ setFontNum()

void ERM19264_graphics::setFontNum ( LCD_Font_Type_e  FontNumber)

Set the font type.

Parameters
FontNumberenum LCD_FONT_TYPE_e

◆ setRotation()

void ERM19264_graphics::setRotation ( LCD_rotate_e  CurrentRotation)

Sets the rotation of the display.

Parameters
CurrentRotationrotation enum value 0-3

Note this is separate from LCD command method for rotation. This rotates the Software buffer.

◆ setTextColor() [1/2]

void ERM19264_graphics::setTextColor ( uint8_t  c)

set the text color

Parameters
cColor fo text

◆ setTextColor() [2/2]

void ERM19264_graphics::setTextColor ( uint8_t  c,
uint8_t  b 
)

set the text color

Parameters
cColor of text foreground
bcolor of background of text

◆ setTextSize()

void ERM19264_graphics::setTextSize ( uint8_t  s)

set the text size , starts at 1

Parameters
sSize of text 1-X

◆ setTextWrap()

void ERM19264_graphics::setTextWrap ( boolean  w)

turn on or off screen _textWrap of the text (fonts 1-6)

Parameters
wTRUE on

◆ width()

int16_t ERM19264_graphics::width ( void  ) const

Gets the width of the display (per current rotation)

Returns
width member of display in pixels

◆ write()

void ERM19264_graphics::write ( uint8_t  character)
virtual

: called by the print class after it converts the data to a character

Parameters
characterThe character to write

Member Data Documentation

◆ _CurrentFontheight

uint8_t ERM19264_graphics::_CurrentFontheight = 8
private

Store current offset height

◆ _CurrentFontLength

uint8_t ERM19264_graphics::_CurrentFontLength = 128
private

Store current font number of characters

◆ _CurrentFontoffset

uint8_t ERM19264_graphics::_CurrentFontoffset = 0
private

Store current offset width

◆ _CurrentFontWidth

uint8_t ERM19264_graphics::_CurrentFontWidth =5
private

Store current font width

◆ _cursorX

int16_t ERM19264_graphics::_cursorX
protected

Current X co-ord cursor position

◆ _cursorY

int16_t ERM19264_graphics::_cursorY
protected

Current Y co-ord cursor position

◆ _FontNumber

uint8_t ERM19264_graphics::_FontNumber = 1
private

Store current font

◆ _height

int16_t ERM19264_graphics::_height
protected

Display h as modified by current rotation

◆ _textBgColor

uint8_t ERM19264_graphics::_textBgColor = 0x01
protected

Text background color

◆ _textColor

uint8_t ERM19264_graphics::_textColor = 0x00
protected

Text foreground color

◆ _textSize

uint8_t ERM19264_graphics::_textSize = 1
protected

Size of text ,fonts 1-6

◆ _textWrap

boolean ERM19264_graphics::_textWrap
protected

If set, 'Wrap' text at right edge of display

◆ _width

int16_t ERM19264_graphics::_width
protected

Display w as modified by current rotation

◆ drawBitmapAddr

boolean ERM19264_graphics::drawBitmapAddr
protected

data addressing mode for method drawBitmap, True-vertical , false-horizontal

◆ HEIGHT

const int16_t ERM19264_graphics::HEIGHT
protected

This is the 'raw' display h - never changes

◆ LCD_rotate

LCD_rotate_e ERM19264_graphics::LCD_rotate = LCD_Degrees_0
protected

Enum to hold rotation

◆ WIDTH

const int16_t ERM19264_graphics::WIDTH
protected

This is the 'raw' display w - never changes


The documentation for this class was generated from the following files: