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

class to drive the ERM19264_UC1609 LCD More...

#include <ERM19264_UC1609.h>

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

Public Member Functions

 ERM19264_UC1609 (int16_t lcdwidth, int16_t lcdheight, int8_t cd, int8_t rst, int8_t cs, int8_t sclk, int8_t din)
 init the LCD class object More...
 
 ERM19264_UC1609 (int16_t lcdwidth, int16_t lcdheight, int8_t cd, int8_t rst, int8_t cs)
 init the LCD class object More...
 
virtual void drawPixel (int16_t x, int16_t y, uint8_t colour) override
 Draws a Pixel to the screen , overrides the graphics library. More...
 
void LCDupdate (void)
 updates the LCD i.e. writes the shared buffer to the active screen pointed to by ActiveBuffer
 
void LCDclearBuffer (void)
 clears the buffer of the active screen pointed to by ActiveBuffer More...
 
void LCDBuffer (int16_t x, int16_t y, uint8_t w, uint8_t h, uint8_t *data)
 Draw a data array to the screen. More...
 
void LCDbegin (uint8_t VbiasPot=UC1609_DEFAULT_GN_PM, uint8_t AddressSet=UC1609_ADDRESS_SET)
 begin Method initialise LCD Sets pinmodes and SPI setup More...
 
void LCDinit (void)
 Called from LCDbegin carries out Power on sequence and register init Can be used to reset LCD to default values.
 
void LCDEnable (uint8_t on)
 Turns On Display. More...
 
void LCDFillScreen (uint8_t pixel, uint8_t mircodelay)
 Fill the screen NOT the buffer with a datapattern. More...
 
void LCDFillPage (uint8_t pixels)
 Fill the chosen page at cursor with a datapattern. More...
 
void LCDGotoXY (uint8_t column, uint8_t page)
 Goes to X Y position. More...
 
void LCDrotate (uint8_t rotatevalue)
 Rotates the display. More...
 
void LCDInvertDisplay (uint8_t on)
 invert the display More...
 
void LCDallpixelsOn (uint8_t bits)
 turns on all Pixels More...
 
void LCDscroll (uint8_t bits)
 Scroll the displayed image up by SL rows. More...
 
void LCDReset (void)
 Resets LCD in a four wire setup called at start and should also be called in a controlled power down setting.
 
LCD_Return_Codes_e LCDBitmap (int16_t x, int16_t y, uint8_t w, uint8_t h, const uint8_t *data)
 Draw a bitmap in PROGMEM to the screen. More...
 
void LCDPowerDown (void)
 Powerdown procedure for LCD see datasheet P40.
 
uint16_t LCDLibVerNumGet (void)
 Library version number getter. More...
 
uint16_t LCDHighFreqDelayGet (void)
 Freq delay used in SW SPI getter, uS delay used in SW SPI method. More...
 
void LCDHighFreqDelaySet (uint16_t)
 Freq delay used in SW SPI setter, uS delay used in SW SPI method. More...
 
uint8_t LCDGetConstrast (void)
 Getter for _VbiasPOT contrast member. More...
 
uint8_t LCDGetAddressCtrl (void)
 Getter for _AddressCtrl Display RAM address control member. More...
 
- Public Member Functions inherited from ERM19264_graphics
 ERM19264_graphics (int16_t w, int16_t h)
 init the LCD Graphics class object More...
 
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...
 

Public Attributes

ERM19264_UC1609_ScreenActiveBuffer = nullptr
 

Private Member Functions

void send_data (uint8_t data)
 Send data byte with SPI to UC1609. More...
 
void send_command (uint8_t command, uint8_t value)
 Sends a command to the display. More...
 
bool isHardwareSPI (void)
 Checks if software SPI is on. More...
 
void CustomshiftOut (uint8_t bitOrder, uint8_t val)
 used in software SPI mode to shift out data More...
 

Private Attributes

int8_t _LCD_CS
 
int8_t _LCD_CD
 
int8_t _LCD_RST
 
int8_t _LCD_SCLK
 
int8_t _LCD_DIN
 
uint8_t _VbiasPOT = 0x49
 
uint8_t _AddressCtrl = 0x02
 
uint16_t _HighFreqDelay = UC1609_HIGHFREQ_DELAY
 
const uint16_t _LibVersionNum = 180
 
uint8_t _widthScreen = 192
 
uint8_t _heightScreen = 64
 

Additional Inherited Members

- Protected Attributes inherited from ERM19264_graphics
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
 

Detailed Description

class to drive the ERM19264_UC1609 LCD

Constructor & Destructor Documentation

◆ ERM19264_UC1609() [1/2]

ERM19264_UC1609::ERM19264_UC1609 ( int16_t  lcdwidth,
int16_t  lcdheight,
int8_t  cd,
int8_t  rst,
int8_t  cs,
int8_t  sclk,
int8_t  din 
)

init the LCD class object

Parameters
lcdwidthwidth of LCD in pixels
lcdheightheight of LCD in pixels
cdGPIO data or command
rstGPIO reset
csGPIO Chip select
sclkGPIO SPI Clock
dinGPIO MOSI
Note
Software SPI version , sub class of ERM19264_graphics

◆ ERM19264_UC1609() [2/2]

ERM19264_UC1609::ERM19264_UC1609 ( int16_t  lcdwidth,
int16_t  lcdheight,
int8_t  cd,
int8_t  rst,
int8_t  cs 
)

init the LCD class object

Parameters
lcdwidthwidth of LCD in pixels
lcdheightheight of LCD in pixels
cdGPIO data or command
rstGPIO reset
csGPIO Chip select
Note
Hardware SPI version , sub class of ERM19264_graphics

Member Function Documentation

◆ CustomshiftOut()

void ERM19264_UC1609::CustomshiftOut ( uint8_t  bitOrder,
uint8_t  value 
)
private

used in software SPI mode to shift out data

Parameters
bitOrderLSB or MSB set to MSBFIRST for UC1609C
valuethe byte to go out

if using high freq MCU the delay define can be changed by LCDHighFreqDelaySet function . Default is at UC1609_HIGHFREQ_DELAY

◆ drawPixel()

void ERM19264_UC1609::drawPixel ( int16_t  x,
int16_t  y,
uint8_t  colour 
)
overridevirtual

Draws a Pixel to the screen , overrides the graphics library.

Parameters
xx co-ord of pixel
yy co-ord of pixel
colourcolour of pixel

Implements ERM19264_graphics.

◆ isHardwareSPI()

bool ERM19264_UC1609::isHardwareSPI ( void  )
private

Checks if software SPI is on.

Returns
true 1 if hardware SPi on , false 0 for software spi

◆ LCDallpixelsOn()

void ERM19264_UC1609::LCDallpixelsOn ( uint8_t  bits)

turns on all Pixels

Parameters
bitsSet DC[1] to force all SEG drivers to output ON signals 1 all on , 0 all off

◆ LCDbegin()

void ERM19264_UC1609::LCDbegin ( uint8_t  VbiasPOT = UC1609_DEFAULT_GN_PM,
uint8_t  AddressSet = UC1609_ADDRESS_SET 
)

begin Method initialise LCD Sets pinmodes and SPI setup

Parameters
VbiasPOTcontrast default = 0x49 , range 0x00 to 0xFE
AddressSetAC [2:0] registers for RAM addr ctrl. default=2 range 0-7

◆ LCDBitmap()

LCD_Return_Codes_e ERM19264_UC1609::LCDBitmap ( int16_t  x,
int16_t  y,
uint8_t  w,
uint8_t  h,
const uint8_t *  data 
)

Draw a bitmap in PROGMEM to the screen.

Parameters
xoffset 0-192
yoffset 0-64
wwidth 0-192
hheight 0-64
datapointer to the bitmap must be in PROGMEM
Returns
LCD_Return_Codes_e enum.

◆ LCDBuffer()

void ERM19264_UC1609::LCDBuffer ( int16_t  x,
int16_t  y,
uint8_t  w,
uint8_t  h,
uint8_t *  data 
)

Draw a data array to the screen.

Parameters
xoffset 0-192
yoffset 0-64
wwidth 0-192
hheight 0-64
datapointer to the data array
Note
Called by LCDupdate internally to write buffer to screen , can be called standalone as well

◆ LCDclearBuffer()

void ERM19264_UC1609::LCDclearBuffer ( void  )

clears the buffer of the active screen pointed to by ActiveBuffer

Note
Does NOT write to the screen

◆ LCDEnable()

void ERM19264_UC1609::LCDEnable ( uint8_t  bits)

Turns On Display.

Parameters
bits1 display on , 0 display off

◆ LCDFillPage()

void ERM19264_UC1609::LCDFillPage ( uint8_t  dataPattern = 0)

Fill the chosen page at cursor with a datapattern.

Parameters
dataPatterncan be set to 0 to FF (not buffer)

◆ LCDFillScreen()

void ERM19264_UC1609::LCDFillScreen ( uint8_t  dataPattern = 0,
uint8_t  delay = 0 
)

Fill the screen NOT the buffer with a datapattern.

Parameters
dataPatterncan be set to zero to clear screen (not buffer) range 0x00 to 0ff
delayoptional delay in microseconds can be set to zero normally.

◆ LCDGetAddressCtrl()

uint8_t ERM19264_UC1609::LCDGetAddressCtrl ( void  )

Getter for _AddressCtrl Display RAM address control member.

Returns
value of _AddressCtrl

◆ LCDGetConstrast()

uint8_t ERM19264_UC1609::LCDGetConstrast ( void  )

Getter for _VbiasPOT contrast member.

Returns
value of_VbiasPOT

◆ LCDGotoXY()

void ERM19264_UC1609::LCDGotoXY ( uint8_t  column,
uint8_t  page 
)

Goes to X Y position.

Parameters
columnColumn 0-192
page0-7

◆ LCDHighFreqDelayGet()

uint16_t ERM19264_UC1609::LCDHighFreqDelayGet ( void  )

Freq delay used in SW SPI getter, uS delay used in SW SPI method.

Returns
The GPIO communications delay in uS

◆ LCDHighFreqDelaySet()

void ERM19264_UC1609::LCDHighFreqDelaySet ( uint16_t  CommDelay)

Freq delay used in SW SPI setter, uS delay used in SW SPI method.

Parameters
CommDelayThe GPIO communications delay in uS

◆ LCDInvertDisplay()

void ERM19264_UC1609::LCDInvertDisplay ( uint8_t  bits)

invert the display

Parameters
bits1 invert , 0 normal

◆ LCDLibVerNumGet()

uint16_t ERM19264_UC1609::LCDLibVerNumGet ( void  )

Library version number getter.

Returns
The lib version number eg 180 = 1.8.0

◆ LCDrotate()

void ERM19264_UC1609::LCDrotate ( uint8_t  rotatevalue)

Rotates the display.

Set LC[2:1] for COM (row) mirror (MY), SEG (column) mirror (MX). Param1: 4 possible values 000 010 100 110 (defined)

Note
If Mx is changed the buffer must BE updated see examples.

◆ LCDscroll()

void ERM19264_UC1609::LCDscroll ( uint8_t  bits)

Scroll the displayed image up by SL rows.

The valid SL value is between 0 (for no scrolling) and (64). Setting SL outside of this range causes undefined effect on the displayed image.

Parameters
bits0-64 line number y-axis

◆ send_command()

void ERM19264_UC1609::send_command ( uint8_t  command,
uint8_t  value 
)
private

Sends a command to the display.

Parameters
commandCommand to send
valuethe values to change
Note
command and value will be combined with OR

◆ send_data()

void ERM19264_UC1609::send_data ( uint8_t  byte)
private

Send data byte with SPI to UC1609.

Parameters
bytethe data byte to send

Member Data Documentation

◆ _AddressCtrl

uint8_t ERM19264_UC1609::_AddressCtrl = 0x02
private

Set AC [2:0] Program registers for RAM address control. 0x00 to 0x07

◆ _heightScreen

uint8_t ERM19264_UC1609::_heightScreen = 64
private

Height of screen in pixels

◆ _HighFreqDelay

uint16_t ERM19264_UC1609::_HighFreqDelay = UC1609_HIGHFREQ_DELAY
private

uS GPIO Communications delay, SW SPI ONLY

◆ _LCD_CD

int8_t ERM19264_UC1609::_LCD_CD
private

GPIO Data or command line

◆ _LCD_CS

int8_t ERM19264_UC1609::_LCD_CS
private

GPIO Chip select line

◆ _LCD_DIN

int8_t ERM19264_UC1609::_LCD_DIN
private

GPIO MOSI Line Software SPI only

◆ _LCD_RST

int8_t ERM19264_UC1609::_LCD_RST
private

GPIO Reset line

◆ _LCD_SCLK

int8_t ERM19264_UC1609::_LCD_SCLK
private

GPIO Clock Line Software SPI only

◆ _LibVersionNum

const uint16_t ERM19264_UC1609::_LibVersionNum = 180
private

Library version number 180 = 1.8.0

◆ _VbiasPOT

uint8_t ERM19264_UC1609::_VbiasPOT = 0x49
private

Contrast default 0x49 datasheet 00-FE

◆ _widthScreen

uint8_t ERM19264_UC1609::_widthScreen = 192
private

Width of screen in pixels

◆ ActiveBuffer

ERM19264_UC1609_Screen* ERM19264_UC1609::ActiveBuffer = nullptr

Active buffer pointer , a pointer to which screen object shared buffer will be written to


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