diff --git a/include/display.h b/include/display.h index 2f753e5b..b30ec372 100644 --- a/include/display.h +++ b/include/display.h @@ -25,17 +25,20 @@ #define MY_DISPLAY_FIRSTLINE 30 +#ifndef MY_DISPLAY_RST +#define MY_DISPLAY_RST NOT_A_PIN +#endif + #ifdef MY_DISPLAY_ADDR #define OLED_ADDR MY_DISPLAY_ADDR #else #define OLED_ADDR -1 #endif -#ifndef USE_HW_I2C -#define USE_HW_I2C 1 -#endif + #ifndef OLED_FREQUENCY #define OLED_FREQUENCY 400000L #endif + #ifndef MY_DISPLAY_FGCOLOR #define MY_DISPLAY_FGCOLOR OLED_WHITE #endif diff --git a/src/display.cpp b/src/display.cpp index b7a284eb..6cb029f4 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -43,13 +43,13 @@ static const char TAG[] = __FILE__; static uint8_t plotbuf[PLOTBUFFERSIZE] = {0}; uint8_t DisplayIsOn = 0; hw_timer_t *displayIRQ = NULL; -QRCode qrcode; +static QRCode qrcode; #ifdef HAS_DISPLAY #if (HAS_DISPLAY) == 1 -ONE_BIT_DISPLAY oled; +static ONE_BIT_DISPLAY oled; #elif (HAS_DISPLAY) == 2 -TFT_eSPI tft = TFT_eSPI(MY_DISPLAY_WIDTH, MY_DISPLAY_HEIGHT); +static TFT_eSPI tft = TFT_eSPI(MY_DISPLAY_WIDTH, MY_DISPLAY_HEIGHT); #else #error Unknown display type specified in hal file #endif @@ -58,9 +58,10 @@ TFT_eSPI tft = TFT_eSPI(MY_DISPLAY_WIDTH, MY_DISPLAY_HEIGHT); void dp_setup(int contrast) { #if (HAS_DISPLAY) == 1 // I2C OLED - + oled.setI2CPins(MY_DISPLAY_SDA, MY_DISPLAY_SCL, MY_DISPLAY_RST); + oled.setBitBang(false); oled.I2Cbegin(OLED_TYPE, OLED_ADDR, OLED_FREQUENCY); - assert(oled.allocBuffer()); // render all outputs to lib internal backbuffer + oled.allocBuffer(); // render all outputs to lib internal backbuffer oled.setTextWrap(false); oled.setRotation( MY_DISPLAY_FLIP ? 2 : 0); // 0 = no rotation, 1 = 90°, 2 = 180°, 3 = 280°