NOKIA5110_TEXT
2.4.0
Arduino Eco-system Library for Nokia 5110 LCD ( PCD8544 controller)
|
Public Member Functions | |
NOKIA5110_TEXT (uint8_t LCD_RST, uint8_t LCD_CE, uint8_t LCD_DC, int8_t LCD_DIN, int8_t LCD_CLK) | |
Software SPI default. More... | |
NOKIA5110_TEXT (uint8_t LCD_RST, uint8_t LCD_CE, uint8_t LCD_DC) | |
Hardware SPI. More... | |
void | LCDInit (bool Inverse=false, uint8_t Contrast=LCD_CONTRAST, uint8_t Bias=LCD_BIAS) |
LCDinit This sends the commands to the PCD8544 to init LCD. More... | |
void | LCDsetContrast (uint8_t contrast) |
LCDSetContrast to set LCD contrast. More... | |
void | LCDenableSleep (void) |
LCDenableSleep Put the LCD to Sleep function. | |
void | LCDdisableSleep (void) |
LCDdisableSleep Wake the LCD up from Sleep. | |
void | LCDSPIWrite (unsigned char DataOrCommand, unsigned char data) |
LCDSPIWrite write to display. More... | |
bool | LCDIsSleeping (void) |
LCDisSleeping. More... | |
void | LCDgotoXY (uint8_t x, uint8_t y) |
LCDgotoXY gotoXY routine to position cursor (x,y) More... | |
void | LCDClear (uint8_t FillData=0x00) |
LCDClear Clears the LCD by writing zeros to the entire screen. More... | |
void | LCDClearBlock (uint8_t RowBlockNum=0) |
LCDClearBlock Clears one of the 6 row blocks(one byte height) on LCD by writing zeros to the line. More efficient than clearing whole screen. More... | |
void | LCDFillBlock (uint8_t FillData=0xFF, uint8_t RowBlockNum=0) |
LCDFillBlock Clears one of the 6 row blocks(one byte height) on LCD. More... | |
void | LCDFont (LCDFontType_e FontNumber) |
LCDFont. More... | |
void | LCDCharacter (char character) |
LCDCharacter print character Calls relevant method for the font set. More... | |
void | LCDString (const char *characters) |
LCDString given a string of characters, one by one is passed to the LCD. More... | |
void | LCDSetPixel (uint8_t col=0, uint8_t row=0) |
LCDSetPixel Method to set a individual pixel. More... | |
void | LCDCustomChar (const unsigned char character[], uint16_t numChars, LCDPaddingType_e, bool ProgMemLocale) |
LCDCustomChar Write a custom character or bitmap to screen X by Y. More... | |
virtual void | write (uint8_t) |
write is used by print super class simply wraps LCDCharacter when called by print More... | |
Private Member Functions | |
void | LCDdraw_fonts_1TO6 (char character) |
Draw font 1-6: 8 bit high fonts. More... | |
void | LCDdraw_fonts_7 (char character) |
used to draw fonts 7 large More... | |
void | LCDdraw_fonts_8TO9 (char character) |
used to draw fonts: huge and mega , 8 and 9 More... | |
bool | isHardwareSPI (void) |
isHardwareSPI More... | |
Private Attributes | |
uint8_t | _LCD_RST |
uint8_t | _LCD_CE |
uint8_t | _LCD_DC |
int8_t | _LCD_DIN |
int8_t | _LCD_CLK |
uint8_t | _contrast = LCD_CONTRAST |
uint8_t | _bias = LCD_BIAS |
bool | _inverse = false |
bool | _sleep = false |
uint8_t | _Block = 0 |
uint8_t | _Col = 0 |
uint8_t | _CurrentFontNumber = LCDFont_Default |
uint8_t | _CurrentFontWidth = 5 |
uint8_t | _CurrentFontOffset = 0x20 |
NOKIA5110_TEXT::NOKIA5110_TEXT | ( | uint8_t | LCD_RST, |
uint8_t | LCD_CE, | ||
uint8_t | LCD_DC, | ||
int8_t | LCD_DIN, | ||
int8_t | LCD_CLK | ||
) |
Software SPI default.
Constructor of the class object from left to right pin 1-5(LCD)
LCD_RST | GPIO reset line |
LCD_CE | GPIO chip enable line |
LCD_DC | GPIO data or command line |
LCD_DIN | GPIO data in , MOSI line |
LCD_CLK | GPIO clock line |
NOKIA5110_TEXT::NOKIA5110_TEXT | ( | uint8_t | LCD_RST, |
uint8_t | LCD_CE, | ||
uint8_t | LCD_DC | ||
) |
Hardware SPI.
Constructor of the class object from left to right pin 1-3(LCD)
LCD_RST | GPIO reset line |
LCD_CE | GPIO chip enable line |
LCD_DC | GPIO data or command line |
|
private |
isHardwareSPI
Checks if software SPI is on
void NOKIA5110_TEXT::LCDCharacter | ( | char | character | ) |
LCDCharacter print character Calls relevant method for the font set.
character | the character to print |
void NOKIA5110_TEXT::LCDClear | ( | uint8_t | FillData = 0x00 | ) |
LCDClear Clears the LCD by writing zeros to the entire screen.
FillData | Default is zero but can be passed a fill pattern eg 0xFF = all pixels on. |
void NOKIA5110_TEXT::LCDClearBlock | ( | uint8_t | RowBlockNum = 0 | ) |
LCDClearBlock Clears one of the 6 row blocks(one byte height) on LCD by writing zeros to the line. More efficient than clearing whole screen.
RowBlockNum | Send the row block number 0-5 |
void NOKIA5110_TEXT::LCDCustomChar | ( | const unsigned char | character[], |
uint16_t | numChars, | ||
LCDPaddingType_e | padding, | ||
bool | ProgMemLocale | ||
) |
LCDCustomChar Write a custom character or bitmap to screen X by Y.
character | Example: 5 by 8 = || || = Char array unsigned char power[5] = {0xFF, 0xFF, 0x00, 0xFF, 0xFF}; |
numChars | Size of array, sizeof(power) / sizeof(unsigned char) |
padding | Blank vertical line padding padding 4 values
|
ProgMemLocale | Is the data of character[] in PROGMEM? true for PROGMEM , false for SRAM/data |
|
private |
Draw font 1-6: 8 bit high fonts.
character | the character to print |
|
private |
used to draw fonts 7 large
character | passed a char |
|
private |
used to draw fonts: huge and mega , 8 and 9
character | passed a char |
9 font | 8 font | data |
---|---|---|
DD | DD | Upper byte |
CC | CC | upper middle byte |
BB | BB | lower middle byte |
AA | – | lower byte , – = n/a for font 8 |
void NOKIA5110_TEXT::LCDFillBlock | ( | uint8_t | FillData = 0xFF , |
uint8_t | RowBlockNum = 0 |
||
) |
LCDFillBlock Clears one of the 6 row blocks(one byte height) on LCD.
FillData | data to write 0-0xFF |
RowBlockNum | row block number 0-5 |
void NOKIA5110_TEXT::LCDFont | ( | LCDFontType_e | FontNumber | ) |
LCDFont.
FontNumber | a enum LCDFontType_e to set between fonts , 1-9 |
Enum to store current font width , Size width of fonts in pixels,
< tiny font
< seven segment font
< Default
< thick + homeSpun
< wide
< large , no lowercase letters
< mega and huge , numbers only
font offset in the ASCII table
< full ASCII
< Starts at Space
< ASCII code for . is 0X2E (. / 0 1 etc)
void NOKIA5110_TEXT::LCDgotoXY | ( | uint8_t | x, |
uint8_t | y | ||
) |
LCDgotoXY gotoXY routine to position cursor (x,y)
x | range: 0 to 83 (0 to 0x53) |
y | range: 0 to 5 (6 blocks one byte each 6*8 = 48) |
void NOKIA5110_TEXT::LCDInit | ( | bool | Inverse = false , |
uint8_t | Contrast = LCD_CONTRAST , |
||
uint8_t | Bias = LCD_BIAS |
||
) |
LCDinit This sends the commands to the PCD8544 to init LCD.
Inverse | inverts the display. |
Contrast | This value allows us to change LCD's contrast Try B0 to BF. |
Bias | Value is for system biasing, try 0x12<->0X14 |
bool NOKIA5110_TEXT::LCDIsSleeping | ( | void | ) |
LCDisSleeping.
void NOKIA5110_TEXT::LCDsetContrast | ( | uint8_t | contrast | ) |
LCDSetContrast to set LCD contrast.
contrast | Set LCD VOP Contrast, range = ((0x00-0x7F) |0x80) 0xB5 = (0x35|0x80) try B1 - BF normally. |
void NOKIA5110_TEXT::LCDSetPixel | ( | uint8_t | col = 0 , |
uint8_t | row = 0 |
||
) |
LCDSetPixel Method to set a individual pixel.
col | column position X = 0-83 |
row | row position Y = 0-47 |
Can be used to create simple graphics.
void NOKIA5110_TEXT::LCDSPIWrite | ( | unsigned char | DataOrCommand, |
unsigned char | data | ||
) |
LCDSPIWrite write to display.
data | the data byte to write |
DataOrCommand | one = data, zero = command |
void NOKIA5110_TEXT::LCDString | ( | const char * | characters | ) |
LCDString given a string of characters, one by one is passed to the LCD.
characters | pointer to string array |
|
virtual |
write is used by print super class simply wraps LCDCharacter when called by print
c | The character to print |
|
private |
LCD Bias
|
private |
LCD block 0-5, screen is heigh of 48 pixels is divided into 6 block's each a byte high
|
private |
LCD Column 0-83
|
private |
LCD Contrast
|
private |
Stores Current font 1-9
|
private |
Stores Current font offset in the ASCII table
|
private |
Stores Current font width
|
private |
LCD Inversion mode , Pixels black or white
|
private |
GPIO for Chip enable line
|
private |
GPIO for SPI clock line, Software SPI only
|
private |
GPIO for Data or command line
|
private |
GPIO for Data line (MOSI) , Software SPI only
|
private |
GPIO for reset line
|
private |
LCD Sleep mode false awake , true LCD sleep