Skip to content

Instantly share code, notes, and snippets.

@HorlogeSkynet
Last active January 9, 2018 09:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HorlogeSkynet/1df491c2ded935be178c9c6b2a026201 to your computer and use it in GitHub Desktop.
Save HorlogeSkynet/1df491c2ded935be178c9c6b2a026201 to your computer and use it in GitHub Desktop.
A library for the LCD4884 Arduino shield

LCD4884

A library for the LCD4884 Arduino shield

How to use it

Please first set your information in the header like in the example.
Now, complete the body of functions declared at the bottom, with the content you acutally want.
When you'll choose the entry in the menu, this content will be executed.

To initialize the instance :

lcd.initClass(projectName, NUM_MENU_ITEM);

To show the menu on the screen :

lcd.showMenu(menuList);

To browse menu with the buttons :

lcd.browseMenu(menuList, menuFunction);

Access methods

You can use also these methods:

turnBacklightOn(true / false);
writeString(posX, posY, const char*, MENU_NORMAL / MENU_HIGHLIGHT);
writeStringBig(posX, posY, const char*, MENU_NORMAL / MENU_HIGHLIGHT);
writeChar(posX, posY, char, MENU_NORMAL / MENU_HIGHLIGHT);
writeCharBig(posX, posY, char, MENU_NORMAL / MENU_HIGHLIGHT);
clear(void);
init(void); // Initializes the screen without menu or buttons operation

Notes

  • With this configuration, you have the name of your project written centered at the top of the screen, and you can access 4 submenus.
  • Wanna use a long press on the CENTER_KEY ? Use the return value of isLongPress() to reach the status of last pression.
  • Wanna use the status of joystick's buttons in your own code ? Compare the return value int(analogRead(0)) with LEFT_K_A, CENTER_K_A, DOWN_K_A, RIGHT_K_A, UP_K_A, K_RELEAS_A, the analogic values returned by the joystick. But careful ! The analogic value read for a position can be a bit different than the one expected...
#include "LCD4884.h"
/////////////////////////////////////////////////////////////////////////////////////////////////////
#define NUM_MENU_ITEM 4
LCD4884 lcd;
const char menuList[NUM_MENU_ITEM][NBCHAR_X] = {
"fct1",
"fct2",
"fct3",
"fct4"
};
void fct1(void);
void fct2(void);
void fct3(void);
void fct4(void);
FONCTION menuFunction[NUM_MENU_ITEM] = {
fct1,
fct2,
fct3,
fct4
};
const char *projectName = "Project";
/////////////////////////////////////////////////////////////////////////////////////////////////////
void setup()
{
lcd.initClass(projectName, NUM_MENU_ITEM);
lcd.showMenu(menuList);
}
void loop()
{
lcd.browseMenu(menuList, menuFunction);
}
void fct1(void)
{
/* */
}
void fct2(void)
{
/* */
}
void fct3(void)
{
/* */
}
void fct4(void)
{
/* */
}
#ifndef FONTS_H
#define FONTS_H
#include <avr/pgmspace.h>
const unsigned char font6_8[][6] PROGMEM =
{
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // space
{0x00, 0x00, 0x00, 0x2f, 0x00, 0x00}, // !
{0x00, 0x00, 0x07, 0x00, 0x07, 0x00}, // "
{0x00, 0x14, 0x7f, 0x14, 0x7f, 0x14}, // #
{0x00, 0x24, 0x2a, 0x7f, 0x2a, 0x12}, // $
{0x00, 0x62, 0x64, 0x08, 0x13, 0x23}, // %
{0x00, 0x36, 0x49, 0x55, 0x22, 0x50}, // &
{0x00, 0x00, 0x05, 0x03, 0x00, 0x00}, // '
{0x00, 0x00, 0x1c, 0x22, 0x41, 0x00}, // (
{0x00, 0x00, 0x41, 0x22, 0x1c, 0x00}, // )
{0x00, 0x14, 0x08, 0x3E, 0x08, 0x14}, // *
{0x00, 0x08, 0x08, 0x3E, 0x08, 0x08}, // +
{0x00, 0x00, 0x00, 0xA0, 0x60, 0x00}, // ,
{0x00, 0x08, 0x08, 0x08, 0x08, 0x08}, // -
{0x00, 0x00, 0x60, 0x60, 0x00, 0x00}, // .
{0x00, 0x20, 0x10, 0x08, 0x04, 0x02}, // /
{0x00, 0x3E, 0x51, 0x49, 0x45, 0x3E}, // 0
{0x00, 0x00, 0x42, 0x7F, 0x40, 0x00}, // 1
{0x00, 0x42, 0x61, 0x51, 0x49, 0x46}, // 2
{0x00, 0x21, 0x41, 0x45, 0x4B, 0x31}, // 3
{0x00, 0x18, 0x14, 0x12, 0x7F, 0x10}, // 4
{0x00, 0x27, 0x45, 0x45, 0x45, 0x39}, // 5
{0x00, 0x3C, 0x4A, 0x49, 0x49, 0x30}, // 6
{0x00, 0x01, 0x71, 0x09, 0x05, 0x03}, // 7
{0x00, 0x36, 0x49, 0x49, 0x49, 0x36}, // 8
{0x00, 0x06, 0x49, 0x49, 0x29, 0x1E}, // 9
{0x00, 0x00, 0x36, 0x36, 0x00, 0x00}, // :
{0x00, 0x00, 0x56, 0x36, 0x00, 0x00}, // ;
{0x00, 0x08, 0x14, 0x22, 0x41, 0x00}, // <
{0x00, 0x14, 0x14, 0x14, 0x14, 0x14}, // =
{0x00, 0x00, 0x41, 0x22, 0x14, 0x08}, // >
{0x00, 0x02, 0x01, 0x51, 0x09, 0x06}, // ?
{0x00, 0x32, 0x49, 0x59, 0x51, 0x3E}, // @
{0x00, 0x7C, 0x12, 0x11, 0x12, 0x7C}, // A
{0x00, 0x7F, 0x49, 0x49, 0x49, 0x36}, // B
{0x00, 0x3E, 0x41, 0x41, 0x41, 0x22}, // C
{0x00, 0x7F, 0x41, 0x41, 0x22, 0x1C}, // D
{0x00, 0x7F, 0x49, 0x49, 0x49, 0x41}, // E
{0x00, 0x7F, 0x09, 0x09, 0x09, 0x01}, // F
{0x00, 0x3E, 0x41, 0x49, 0x49, 0x7A}, // G
{0x00, 0x7F, 0x08, 0x08, 0x08, 0x7F}, // H
{0x00, 0x00, 0x41, 0x7F, 0x41, 0x00}, // I
{0x00, 0x20, 0x40, 0x41, 0x3F, 0x01}, // J
{0x00, 0x7F, 0x08, 0x14, 0x22, 0x41}, // K
{0x00, 0x7F, 0x40, 0x40, 0x40, 0x40}, // L
{0x00, 0x7F, 0x02, 0x0C, 0x02, 0x7F}, // M
{0x00, 0x7F, 0x04, 0x08, 0x10, 0x7F}, // N
{0x00, 0x3E, 0x41, 0x41, 0x41, 0x3E}, // O
{0x00, 0x7F, 0x09, 0x09, 0x09, 0x06}, // P
{0x00, 0x3E, 0x41, 0x51, 0x21, 0x5E}, // Q
{0x00, 0x7F, 0x09, 0x19, 0x29, 0x46}, // R
{0x00, 0x46, 0x49, 0x49, 0x49, 0x31}, // S
{0x00, 0x01, 0x01, 0x7F, 0x01, 0x01}, // T
{0x00, 0x3F, 0x40, 0x40, 0x40, 0x3F}, // U
{0x00, 0x1F, 0x20, 0x40, 0x20, 0x1F}, // V
{0x00, 0x3F, 0x40, 0x38, 0x40, 0x3F}, // W
{0x00, 0x63, 0x14, 0x08, 0x14, 0x63}, // X
{0x00, 0x07, 0x08, 0x70, 0x08, 0x07}, // Y
{0x00, 0x61, 0x51, 0x49, 0x45, 0x43}, // Z
{0x00, 0x00, 0x7F, 0x41, 0x41, 0x00}, // [
{0x00, 0x55, 0x2A, 0x55, 0x2A, 0x55}, // 55
{0x00, 0x00, 0x41, 0x41, 0x7F, 0x00}, // ]
{0x00, 0x04, 0x02, 0x01, 0x02, 0x04}, // ^
{0x00, 0x40, 0x40, 0x40, 0x40, 0x40}, // _
{0x00, 0x00, 0x01, 0x02, 0x04, 0x00}, // '
{0x00, 0x20, 0x54, 0x54, 0x54, 0x78}, // a
{0x00, 0x7F, 0x48, 0x44, 0x44, 0x38}, // b
{0x00, 0x38, 0x44, 0x44, 0x44, 0x20}, // c
{0x00, 0x38, 0x44, 0x44, 0x48, 0x7F}, // d
{0x00, 0x38, 0x54, 0x54, 0x54, 0x18}, // e
{0x00, 0x08, 0x7E, 0x09, 0x01, 0x02}, // f
{0x00, 0x18, 0xA4, 0xA4, 0xA4, 0x7C}, // g
{0x00, 0x7F, 0x08, 0x04, 0x04, 0x78}, // h
{0x00, 0x00, 0x44, 0x7D, 0x40, 0x00}, // i
{0x00, 0x40, 0x80, 0x84, 0x7D, 0x00}, // j
{0x00, 0x7F, 0x10, 0x28, 0x44, 0x00}, // k
{0x00, 0x00, 0x41, 0x7F, 0x40, 0x00}, // l
{0x00, 0x7C, 0x04, 0x18, 0x04, 0x78}, // m
{0x00, 0x7C, 0x08, 0x04, 0x04, 0x78}, // n
{0x00, 0x38, 0x44, 0x44, 0x44, 0x38}, // o
{0x00, 0xFC, 0x24, 0x24, 0x24, 0x18}, // p
{0x00, 0x18, 0x24, 0x24, 0x18, 0xFC}, // q
{0x00, 0x7C, 0x08, 0x04, 0x04, 0x08}, // r
{0x00, 0x48, 0x54, 0x54, 0x54, 0x20}, // s
{0x00, 0x04, 0x3F, 0x44, 0x40, 0x20}, // t
{0x00, 0x3C, 0x40, 0x40, 0x20, 0x7C}, // u
{0x00, 0x1C, 0x20, 0x40, 0x20, 0x1C}, // v
{0x00, 0x3C, 0x40, 0x30, 0x40, 0x3C}, // w
{0x00, 0x44, 0x28, 0x10, 0x28, 0x44}, // x
{0x00, 0x1C, 0xA0, 0xA0, 0xA0, 0x7C}, // y
{0x00, 0x44, 0x64, 0x54, 0x4C, 0x44}, // z
{0x00, 0x00, 0x06, 0x09, 0x09, 0x06} // horiz lines
};
const unsigned char big_number[13][3][16] PROGMEM =
{
0,128,192,224,224,96,224,224, // '0'
192,128,0,0,0,0,0,0
,
112,255,255,1,0,0,0,0,
255,255,254,0,0,0,0,0
,
0,15,31,60,56,48,56,56,
31,15,3,0,0,0,0,0
,
0,0,0,0,128,224,224,0, // '1'
0,0,0,0,0,0,0,0
,
0,0,3,3,3,255,255,0,
0,0,0,0,0,0,0,0
,
0,0,56,56,56,63,63,56,
56,56,0,0,0,0,0,0
,
0,192,192,224,96,96,224,224, // '2'
192,128,0,0,0,0,0,0
,
0,1,0,0,128,192,224,249,
63,31,0,0,0,0,0,0
,
0,60,62,63,63,59,57,56,
56,56,56,0,0,0,0,0
,
0,192,224,224,96,96,224,224, // '3'
192,192,0,0,0,0,0,0
,
0,1,0,0,48,48,56,125,
239,207,0,0,0,0,0,0
,
0,28,56,56,48,48,56,60,
31,15,1,0,0,0,0,0
,
0,0,0,0,0,128,192,224, // '4'
224,0,0,0,0,0,0,0
,
224,240,248,222,207,199,193,255,
255,192,192,0,0,0,0,0
,
0,0,0,0,0,0,0,63,
63,0,0,0,0,0,0,0
,
0,224,224,224,224,224,224,224, // '5'
224,224,224,0,0,0,0,0
,
0,63,63,63,56,56,48,112,
240,224,0,0,0,0,0,0
,
0,28,56,56,48,48,56,60,
31,15,1,0,0,0,0,0
,
0,0,128,192,192,224,96,96, // '6'
224,224,0,0,0,0,0,0
,
224,254,255,55,57,24,24,56,
240,240,192,0,0,0,0,0
,
0,15,31,28,56,48,48,56,
31,15,7,0,0,0,0,0
,
0,224,224,224,224,224,224,224, // '7'
224,224,224,0,0,0,0,0
,
0,0,0,0,128,224,248,126,
31,7,1,0,0,0,0,0
,
0,0,56,62,31,7,1,0,
0,0,0,0,0,0,0,0
,
0,128,192,224,224,96,96,224, // '8'
192,192,0,0,0,0,0,0
,
0,207,255,127,56,48,112,112,
255,239,199,0,0,0,0,0
,
3,15,31,60,56,48,48,56,
31,31,15,0,0,0,0,0
,
0,128,192,224,224,96,224,224, // '9'
192,128,0,0,0,0,0,0
,
12,63,127,241,224,192,192,225,
255,255,254,0,0,0,0,0
,
0,0,56,48,48,56,56,30,
15,7,0,0,0,0,0,0
,
0,0,0,0,0,0,0,0, // '.'
0,0,0,0,0,0,0,0
,
0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0
,
60,60,60,0,0,0,0,0,
0,0,0,0,0,0,0,0
,
0,0,0,0,0,0,0,0, // '+'
0,0,0,0,0,0,0,0
,
0,0,64,64,64,64,64,254,
254,64,64,64,64,64,0,0
,
0,0,0,0,0,0,0,15,
15,0,0,0,0,0,0,0
,
0,0,0,0,0,0,0,0, // '-'
0,0,0,0,0,0,0,0
,
0,64,64,64,64,64,64,0,
0,0,0,0,0,0,0,0
,
0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0
};
#endif
#include "LCD4884.h"
LCD4884::LCD4884()
{
for(short int i = 0; i < NUM_KEYS; i++)
{
button_count[i] = 0;
button_status[i] = 0;
button_flag[i] = 0;
}
longPress = false;
}
void LCD4884::turnBacklightOn(bool switchOn)
{
if(switchOn)
{
digitalWrite(LCD_BACKLIGHT, HIGH);
}
else
{
digitalWrite(LCD_BACKLIGHT, LOW);
}
}
void LCD4884::init(void)
{
unsigned int pins[6] = {2, 3, 4, 5, 6, 7};
for(short int i = 0; i < 6; i++)
{
pinMode(pins[i], OUTPUT);
digitalWrite(pins[i], LOW);
}
digitalWrite(LCD_RST, LOW);
delayMicroseconds(1);
digitalWrite(LCD_RST, HIGH);
digitalWrite(SPI_CS, LOW);
delayMicroseconds(1);
digitalWrite(SPI_CS, HIGH);
delayMicroseconds(1);
digitalWrite(LCD_BACKLIGHT, HIGH);
writeByte(0x21, 0);
writeByte(0xc0, 0);
writeByte(0x06, 0);
writeByte(0x13, 0);
writeByte(0x20, 0);
clear();
writeByte(0x0c, 0);
digitalWrite(SPI_CS, LOW);
}
void LCD4884::writeByte(unsigned char data, unsigned char dataType)
{
digitalWrite(SPI_CS, LOW);
if(dataType == 0)
{
digitalWrite(LCD_DC, LOW);
}
else
{
digitalWrite(LCD_DC, HIGH);
}
for(short int i = 0; i < 8; i++)
{
if(data & 0x80)
{
digitalWrite(SPI_MOSI, HIGH);
}
else
{
digitalWrite(SPI_MOSI, LOW);
}
digitalWrite(SPI_SCK, LOW);
data = data << 1;
digitalWrite(SPI_SCK, HIGH);
}
digitalWrite(SPI_CS, HIGH);
}
void LCD4884::writeCharBig(unsigned char x, unsigned char y, unsigned char ch, char mode)
{
unsigned char i, j;
unsigned char *pFont;
unsigned char ch_dat;
pFont = (unsigned char*)big_number;
if(ch == '.')
{
ch = 10;
}
else if(ch == '+')
{
ch = 11;
}
else if(ch == '-')
{
ch = 12;
}
else
{
ch = ch & 0x0F;
}
for(i = 0; i < 3; i++)
{
setCursorPosition(x, y + i);
for(j = 0; j < 16; j++)
{
ch_dat = pgm_read_byte(pFont + ch * 48 + i * 16 + j);
writeByte((mode == MENU_NORMAL) ? ch_dat : (ch_dat ^ 0xFF), 1);
}
}
}
void LCD4884::writeChar(unsigned char c, char mode)
{
unsigned char line;
unsigned char *pFont;
byte ch;
pFont = (unsigned char*)font6_8;
c -= 32;
for(line = 0; line < 6; line++)
{
ch = pgm_read_byte(pFont + c * 6 + line);
writeByte((mode == MENU_NORMAL) ? ch : (ch ^ 0xff), 1);
}
}
void LCD4884::setCursorPosition(unsigned char x, unsigned char y)
{
writeByte(0x40 | y, 0);
writeByte(0x80 | x, 0);
}
void LCD4884::clear(void)
{
writeByte(0x0C, 0);
writeByte(0x80, 0);
for(short int i = 0; i < 504; i++)
{
writeByte(0, 1);
}
}
void LCD4884::writeString(unsigned char x, unsigned char y, const char *string, char mode)
{
setCursorPosition(x, y);
while(*string)
{
writeChar(*string++, mode);
}
}
void LCD4884::writeStringBig(unsigned char x, unsigned char y, const char *string, char mode)
{
while(*string)
{
writeCharBig(x, y, *string, mode);
if(*string++ == '.')
{
x += 5;
}
else
{
x += 12;
}
}
}
void LCD4884::waitOKkey(void)
{
short int key = 0xFF, i;
updateButtonStatus();
while(key != CENTER_KEY)
{
for(i = 0; i < NUM_KEYS; i++)
{
if(button_flag[i] != 0)
{
button_flag[i] = 0;
if(i == CENTER_KEY)
{
key = CENTER_KEY;
}
}
updateButtonStatus();
}
}
}
char LCD4884::getKey(unsigned int input)
{
short int k;
static short int adc_key_val[NUM_KEYS] = {50, 200, 400, 600, 800};
for(k = 0; k < NUM_KEYS; k++)
{
if(input < adc_key_val[k])
{
return k;
}
}
return -1;
}
void LCD4884::updateButtonStatus(void)
{
char key_in = getKey(analogRead(0));
for(short int i = 0; i < NUM_KEYS; i++)
{
if(key_in == i)
{
if(button_count[i] < DEBOUNCE_MAX)
{
button_count[i]++;
if(button_count[i] > DEBOUNCE_ON)
{
if(button_status[i] == 0)
{
button_flag[i] = 1;
button_status[i] = 1;
}
}
}
}
else
{
if(button_count[i] > 0)
{
button_flag[i] = 0;
button_count[i]--;
if(button_count[i] < DEBOUNCE_OFF)
{
button_status[i] = 0;
}
}
}
}
}
bool LCD4884::isLongPress(void)
{
return longPress;
}
void LCD4884::initClass(const char *name, int maxElements, int minElements)
{
init();
clear();
turnBacklightOn(false);
max_menu_item = maxElements - 1;
min_menu_item = minElements;
current_menu_item = 0;
nameSize = strlen(name);
strcpy(menuName, name);
}
void LCD4884::showMenu(const char menuList[][NBCHAR_X])
{
clear();
writeString(CENTER(menuName), 0, menuName, MENU_NORMAL);
for(short int i = 0; i <= max_menu_item - min_menu_item ; i++)
{
writeString(CENTER(menuList[i]), OFFSET_Y + i, menuList[i], MENU_NORMAL);
}
writeString(CENTER(menuList[current_menu_item]), OFFSET_Y + current_menu_item, menuList[current_menu_item], MENU_HIGHLIGHT);
}
void LCD4884::browseMenu(const char menuList[][NBCHAR_X], FONCTION *menuFunction)
{
static unsigned long int timer = 0;
longPress = false;
updateButtonStatus();
if(millis() - timer > TIMEBACKLIGHT)
{
turnBacklightOn(false);
timer = 0;
}
for(short int i = 0; i < NUM_KEYS; i++)
{
if(button_flag[i] != 0)
{
button_flag[i] = 0;
turnBacklightOn(true);
timer = millis();
switch(i)
{
case UP_KEY:
writeString(CENTER(menuList[current_menu_item]), OFFSET_Y + current_menu_item, menuList[current_menu_item], MENU_NORMAL);
current_menu_item--;
if(current_menu_item < min_menu_item)
{
current_menu_item = max_menu_item;
}
writeString(CENTER(menuList[current_menu_item]), OFFSET_Y + current_menu_item, menuList[current_menu_item], MENU_HIGHLIGHT);
break;
case LEFT_KEY:
writeString(CENTER(menuList[current_menu_item]), OFFSET_Y + current_menu_item, menuList[current_menu_item], MENU_NORMAL);
current_menu_item = min_menu_item;
writeString(CENTER(menuList[current_menu_item]), OFFSET_Y + current_menu_item, menuList[current_menu_item], MENU_HIGHLIGHT);
break;
case RIGHT_KEY:
writeString(CENTER(menuList[current_menu_item]), OFFSET_Y + current_menu_item, menuList[current_menu_item], MENU_NORMAL);
current_menu_item = max_menu_item;
writeString(CENTER(menuList[current_menu_item]), OFFSET_Y + current_menu_item, menuList[current_menu_item], MENU_HIGHLIGHT);
break;
case DOWN_KEY:
writeString(CENTER(menuList[current_menu_item]), OFFSET_Y + current_menu_item, menuList[current_menu_item], MENU_NORMAL);
current_menu_item++;
if(current_menu_item > max_menu_item)
{
current_menu_item = min_menu_item;
}
writeString(CENTER(menuList[current_menu_item]), OFFSET_Y + current_menu_item, menuList[current_menu_item], MENU_HIGHLIGHT);
break;
case CENTER_KEY:
do
{
updateButtonStatus();
} while(button_status[CENTER_KEY] != 0 && millis() - timer < TIMELONGPRESS);
if(millis() - timer < TIMELONGPRESS)
{
clear();
writeString(CENTER("OK"), 5, "OK", MENU_HIGHLIGHT);
(*menuFunction[current_menu_item])();
timer = millis();
button_status[CENTER_KEY] = 0;
do
{
updateButtonStatus();
} while(button_status[CENTER_KEY] == 0 && millis() - timer < TIMEINFCT);
if(button_status[CENTER_KEY] != 0)
{
timer = millis();
}
showMenu(menuList);
i = NUM_KEYS;
}
else
{
longPress = true;
timer = millis();
}
break;
default:
break;
}
}
}
}
#ifndef LCD4884_H
#define LCD4884_H
#include <Arduino.h>
#include "Fonts.h"
#define SPI_SCK 2
#define SPI_MOSI 3
#define LCD_DC 4
#define SPI_CS 5
#define LCD_RST 6
#define LCD_BACKLIGHT 7
#define MENU_NORMAL 0
#define MENU_HIGHLIGHT 1
#define OFF 0
#define ON 1
#define DEBOUNCE_MAX 15
#define DEBOUNCE_ON 10
#define DEBOUNCE_OFF 3
#define NUM_KEYS 5
#define LEFT_KEY 0
#define CENTER_KEY 1
#define DOWN_KEY 2
#define RIGHT_KEY 3
#define UP_KEY 4
#define LEFT_K_A 741
#define CENTER_K_A 143
#define DOWN_K_A 0
#define RIGHT_K_A 328
#define UP_K_A 502
#define K_RELEAS_A 1022
#define NBCHAR_X 14
#define OFFSET_Y 2
#define NB_PIX_X 6
#define TIMEBACKLIGHT 5000
#define TIMELONGPRESS 2500
#define TIMEINFCT 8000
#define CENTER(ELEMENT) ((NBCHAR_X - strlen(ELEMENT)) / 2) * NB_PIX_X
typedef void (*FONCTION)();
class LCD4884
{
public:
LCD4884();
void init(void);
void turnBacklightOn(bool switchOn);
void writeByte(unsigned char data, unsigned char dataType);
void drawBmpPixel(unsigned char x, unsigned char y, unsigned char *map, unsigned char pixelX, unsigned char pixelY);
void writeString(unsigned char x, unsigned char y, const char *s, char mode);
void writeStringBig(unsigned char x, unsigned char y, const char *string, char mode);
void writeCharBig(unsigned char x, unsigned char y, unsigned char ch, char mode);
void writeChar(unsigned char c, char mode);
void setCursorPosition(unsigned char x, unsigned char y);
void clear(void);
void waitOKkey(void);
void updateButtonStatus(void);
char getKey(unsigned int input);
bool isLongPress(void);
void initClass(const char *name, int maxElements, int minElements = 0);
void showMenu(const char menuList[][NBCHAR_X]);
void browseMenu(const char menuList[][NBCHAR_X], FONCTION *menuFunction);
private:
bool longPress;
short int button_count[NUM_KEYS];
short int button_status[NUM_KEYS];
short int button_flag[NUM_KEYS];
int nameSize;
char menuName[NBCHAR_X];
short int current_menu_item;
short int max_menu_item;
short int min_menu_item;
};
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment