diff --git a/Universal_Serial_Adapter/UI.cpp b/Universal_Serial_Adapter/UI.cpp index afaa651..3b25abb 100644 --- a/Universal_Serial_Adapter/UI.cpp +++ b/Universal_Serial_Adapter/UI.cpp @@ -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()); diff --git a/Universal_Serial_Adapter/UILCD.cpp b/Universal_Serial_Adapter/UILCD.cpp index c2e6607..1fe54b3 100644 --- a/Universal_Serial_Adapter/UILCD.cpp +++ b/Universal_Serial_Adapter/UILCD.cpp @@ -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); diff --git a/Universal_Serial_Adapter/UILCD.h b/Universal_Serial_Adapter/UILCD.h index 0dfc97e..fdc535d 100644 --- a/Universal_Serial_Adapter/UILCD.h +++ b/Universal_Serial_Adapter/UILCD.h @@ -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();