From d595719766b011f7afa284832aa5c27d60e2643d Mon Sep 17 00:00:00 2001 From: gamerdonkey Date: Sat, 14 Sep 2024 23:08:10 -0500 Subject: Adding a backBuffer to avoid flickering. Color improvements. --- main/main.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'main/main.cpp') diff --git a/main/main.cpp b/main/main.cpp index 1d64d95..7555410 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -10,9 +10,10 @@ #define CHAR_HEIGHT 8 #define CHAR_WIDTH 8 -#define RED 1 -#define GREEN 2 -#define ORANGE 3 +#define BLACK 0x0000 +#define RED 0xF800 +#define GREEN 0x07E0 +#define ORANGE 0xFFE0 #define PIN_NUM_MISO 12 #define PIN_NUM_MOSI 13 @@ -55,19 +56,19 @@ extern "C" void runDisplayTask(void* taskParams) { extern "C" void app_main(void) { InovaLedDisplay display = InovaLedDisplay(PIN_NUM_MISO, PIN_NUM_MOSI, PIN_NUM_CLK, PIN_NUM_CS, PIN_NUM_R_LATCH, PIN_NUM_R_CLK, PIN_NUM_R_ADDR_0, PIN_NUM_R_ADDR_1, PIN_NUM_R_ADDR_2); - + display.fillScreen(0); display.setCursor(0, 0); - display.setTextColor(2); + display.setTextColor(RED); display.setTextWrap(false); display.print("Adafruit GFX 0123456789"); TaskHandle_t taskHandle; xTaskCreate(runDisplayTask, "updateDisplay", STACK_SIZE, &display, tskIDLE_PRIORITY, &taskHandle); - + //runDisplayTask(&display); - + //while(true) { // vTaskDelay(100 / portTICK_PERIOD_MS); //} @@ -80,6 +81,7 @@ extern "C" void app_main(void) display.fillScreen(0); display.setCursor(j, 0); display.print(hello); + display.swapBuffer(); if(--j == min_x) { j = display.width(); -- cgit v1.2.3