Setup LCD class to use global config instead of local reference

This commit is contained in:
Mike C 2013-04-17 20:07:34 -04:00
parent 7f60a42f9b
commit b8dd067ecb
3 changed files with 6 additions and 6 deletions

View file

@ -22,7 +22,7 @@ UI::UI() {
cancelButton = new UIButton(cancelButtonPin, cancelButtonLed);
pspJoystick = new UIJoystickPSP(pspXPin, pspYPin);
lcd = new UILCD(config);
lcd = new UILCD();
uiTimeout = new Metro(config->getTimeoutMilis());

View file

@ -19,14 +19,12 @@
#include "UILCD.h"
#include "UIJoystickPSP.h"
UILCD::UILCD(Config* config) {
UILCD::UILCD() {
if (DEBUG) {
Serial.println("UILCD::UILCD()");
}
pinMode(LCD_LITE, OUTPUT);
this->config = config;
tft = new Adafruit_ST7735(LCD_CS, LCD_DC, LCD_RST);
tft->initR(INITR_BLACKTAB);
tft->setRotation(3);

View file

@ -25,6 +25,9 @@
// Forward declaration of Config
class Config;
// Use global config and ui objects defined / initialized in main ino file
extern Config* config;
#define BUFFPIXEL 20
enum screen {
@ -39,7 +42,6 @@ enum screen {
class UILCD {
private:
Adafruit_ST7735* tft;
Config* config;
int currentLine;
screen currentScreen;
@ -61,7 +63,7 @@ private:
void mainScreenCancelButton();
public:
UILCD(Config* config);
UILCD();
void bmpDraw(char *filename, uint8_t x, uint8_t y);
void handleJoystickEvent(joyDirection aDirection);
void handleOkButtonEvent();