-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path5110_GUI_LIB.ino
73 lines (60 loc) · 1.7 KB
/
5110_GUI_LIB.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
* _5110_GUI_LIB.ino
*
* Created: 5/11/2016 11:26:35 AM
* Author: Andre Eberhard
*/
#include "DisplayGUI.h"
#include <SPI/SPI.h>
#include "PCD8544_SPI.h"
#include "MenuClasses.h"
#include "MemoryFree.h"
// Use Pins
// PIN_DC D8
// PIN_RESET D9
// PIN_SCE D10
// PIN_SDIN D11
// PIN_SCLK D13
// for now
DisplayGUI *gui;
Menu *root, *settings;
void setup()
{
generateMenus();
gui = new DisplayGUI();
gui->setRootMenu(root);
Serial.begin(9600);
pinMode(pinA, INPUT_PULLUP); // set pinA as an input, pulled HIGH to the logic voltage (5V or 3.3V for most cases)
pinMode(pinB, INPUT_PULLUP); // set pinB as an input, pulled HIGH to the logic voltage (5V or 3.3V for most cases)
attachInterrupt(0,pinAHandler,RISING); // set an interrupt on PinA, looking for a rising edge signal and executing the "PinA" Interrupt Service Routine (below)
attachInterrupt(1,pinBHandler,RISING); // set an interrupt on PinB, looking for a rising edge signal and executing the "PinB" Interrupt Service Routine (below)
gui->drawMenu();
}
void generateMenus(){
root = new Menu();
root->title = "Hauptmenue";
settings = root->addSubMenu("Einstell.");
settings->addSubMenu("Rofl");
settings->addSubMenu("Di");
settings->addSubMenu("Copter");
root->addSubMenu("Auschaltm.");
root->addSubMenu("Einschaltm.");
root->addSubMenu("Hey Dome");
root->addSubMenu("was");
root->addSubMenu("geht");
}
void loop()
{
Serial.println(freeMemory());
delay(100);
/* add main program code here, this code starts again each time it ends */
}
//TODO: Please! Find another solution for this! It's just bad
void pinAHandler(){
if(gui) gui->PinA();
gui->handleInput();
}
void pinBHandler(){
if(gui) gui->PinB();
gui->handleInput();
}