diff --git a/src/display.h b/src/display.h index 9bc6dd0..98f5ca5 100644 --- a/src/display.h +++ b/src/display.h @@ -5,8 +5,17 @@ #include #include -TFT_eSPI tft; -TFT_eSprite sprite(&tft); +namespace { + TFT_eSPI tft; + TFT_eSprite sprite(&tft); +} + +void setup_display() { + tft.init(); + tft.fillScreen(TFT_BLACK); + tft.setRotation(1); + sprite.createSprite(tft.width(), tft.height()); +} void clear_sprite(int bg = TFT_BLACK) { sprite.fillSprite(bg); diff --git a/src/main.cpp b/src/main.cpp index bb3414a..216a217 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -156,10 +156,7 @@ void setup() { Serial.println("Operame start"); digitalWrite(pin_backlight, HIGH); - tft.init(); - tft.fillScreen(TFT_BLACK); - tft.setRotation(1); - sprite.createSprite(tft.width(), tft.height()); + setup_display(); OperameLanguage::select(T, LANGUAGE);