ERM19264_UC1609
1.8.0
Arduino Eco-system Library for ERM19264 LCD driven by UC1609 controller.
|
class to drive the ERM19264_UC1609 LCD More...
#include <ERM19264_UC1609.h>
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_Screen * | ActiveBuffer = 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 |
class to drive the ERM19264_UC1609 LCD
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
lcdwidth | width of LCD in pixels |
lcdheight | height of LCD in pixels |
cd | GPIO data or command |
rst | GPIO reset |
cs | GPIO Chip select |
sclk | GPIO SPI Clock |
din | GPIO MOSI |
ERM19264_UC1609::ERM19264_UC1609 | ( | int16_t | lcdwidth, |
int16_t | lcdheight, | ||
int8_t | cd, | ||
int8_t | rst, | ||
int8_t | cs | ||
) |
init the LCD class object
lcdwidth | width of LCD in pixels |
lcdheight | height of LCD in pixels |
cd | GPIO data or command |
rst | GPIO reset |
cs | GPIO Chip select |
|
private |
used in software SPI mode to shift out data
bitOrder | LSB or MSB set to MSBFIRST for UC1609C |
value | the byte to go out |
if using high freq MCU the delay define can be changed by LCDHighFreqDelaySet function . Default is at UC1609_HIGHFREQ_DELAY
|
overridevirtual |
Draws a Pixel to the screen , overrides the graphics library.
x | x co-ord of pixel |
y | y co-ord of pixel |
colour | colour of pixel |
Implements ERM19264_graphics.
|
private |
Checks if software SPI is on.
void ERM19264_UC1609::LCDallpixelsOn | ( | uint8_t | bits | ) |
turns on all Pixels
bits | Set DC[1] to force all SEG drivers to output ON signals 1 all on , 0 all off |
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
VbiasPOT | contrast default = 0x49 , range 0x00 to 0xFE |
AddressSet | AC [2:0] registers for RAM addr ctrl. default=2 range 0-7 |
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.
x | offset 0-192 |
y | offset 0-64 |
w | width 0-192 |
h | height 0-64 |
data | pointer to the bitmap must be in PROGMEM |
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.
x | offset 0-192 |
y | offset 0-64 |
w | width 0-192 |
h | height 0-64 |
data | pointer to the data array |
void ERM19264_UC1609::LCDclearBuffer | ( | void | ) |
clears the buffer of the active screen pointed to by ActiveBuffer
void ERM19264_UC1609::LCDEnable | ( | uint8_t | bits | ) |
Turns On Display.
bits | 1 display on , 0 display off |
void ERM19264_UC1609::LCDFillPage | ( | uint8_t | dataPattern = 0 | ) |
Fill the chosen page at cursor with a datapattern.
dataPattern | can be set to 0 to FF (not buffer) |
void ERM19264_UC1609::LCDFillScreen | ( | uint8_t | dataPattern = 0 , |
uint8_t | delay = 0 |
||
) |
Fill the screen NOT the buffer with a datapattern.
dataPattern | can be set to zero to clear screen (not buffer) range 0x00 to 0ff |
delay | optional delay in microseconds can be set to zero normally. |
uint8_t ERM19264_UC1609::LCDGetAddressCtrl | ( | void | ) |
Getter for _AddressCtrl Display RAM address control member.
uint8_t ERM19264_UC1609::LCDGetConstrast | ( | void | ) |
Getter for _VbiasPOT contrast member.
void ERM19264_UC1609::LCDGotoXY | ( | uint8_t | column, |
uint8_t | page | ||
) |
Goes to X Y position.
column | Column 0-192 |
page | 0-7 |
uint16_t ERM19264_UC1609::LCDHighFreqDelayGet | ( | void | ) |
Freq delay used in SW SPI getter, uS delay used in SW SPI method.
void ERM19264_UC1609::LCDHighFreqDelaySet | ( | uint16_t | CommDelay | ) |
Freq delay used in SW SPI setter, uS delay used in SW SPI method.
CommDelay | The GPIO communications delay in uS |
void ERM19264_UC1609::LCDInvertDisplay | ( | uint8_t | bits | ) |
invert the display
bits | 1 invert , 0 normal |
uint16_t ERM19264_UC1609::LCDLibVerNumGet | ( | void | ) |
Library version number getter.
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)
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.
bits | 0-64 line number y-axis |
|
private |
Sends a command to the display.
command | Command to send |
value | the values to change |
|
private |
Send data byte with SPI to UC1609.
byte | the data byte to send |
|
private |
Set AC [2:0] Program registers for RAM address control. 0x00 to 0x07
|
private |
Height of screen in pixels
|
private |
uS GPIO Communications delay, SW SPI ONLY
|
private |
GPIO Data or command line
|
private |
GPIO Chip select line
|
private |
GPIO MOSI Line Software SPI only
|
private |
GPIO Reset line
|
private |
GPIO Clock Line Software SPI only
|
private |
Library version number 180 = 1.8.0
|
private |
Contrast default 0x49 datasheet 00-FE
|
private |
Width of screen in pixels
ERM19264_UC1609_Screen* ERM19264_UC1609::ActiveBuffer = nullptr |
Active buffer pointer , a pointer to which screen object shared buffer will be written to