ESP32-S3 with ST7796U esp32IDF 5.2

Hi, I have make project use LVGL8.3 and esp32 IDF v5.2 (I need change some gpio API to run with this verion IDF) that use TCT LCD with driver ST7796U


I have make successfull with TFT usedriver ILI9341 but when I tried with another TFT with driver ST7796U I got wrong color

i had same problem like you, do you resolve it?

Hi @OWlchanMagican unfortunately not yet, but I have changed the code build with platform IO use Arduino GFX:

#include <Arduino_GFX_Library.h>
#include "touch.h"

#define GFX_BL DF_GFX_BL // default backlight pin, you may replace DF_GFX_BL to actual backlight pin

/* More dev device declaration: https://github.com/moononournation/Arduino_GFX/wiki/Dev-Device-Declaration */
#if defined(DISPLAY_DEV_KIT)
Arduino_GFX *gfx = create_default_Arduino_GFX();
#else /* !defined(DISPLAY_DEV_KIT) */

/* More data bus class: https://github.com/moononournation/Arduino_GFX/wiki/Data-Bus-Class */
Arduino_DataBus *bus = create_default_Arduino_DataBus();

/* More display class: https://github.com/moononournation/Arduino_GFX/wiki/Display-Class */
Arduino_GFX *gfx = new Arduino_ST7796(bus, DF_GFX_RST, 2 /* rotation */, true /* IPS */);

#endif /* !defined(DISPLAY_DEV_KIT) */

hope you can change use this one too :)))

1 Like

Try this code of mine, my screen is swapping between black and white and red and blue so I use a loop to swap the color bytes before sending them to the screen and set the LV_LCD_FLAG_BGR flag for that loop.

static void invert_colors(uint16_t * buf, size_t size)
{
    for(size_t i = 0; i < size; i++) {
        buf[i] = ~buf[i]; // Đảo ngược tất cả các bit của giá trị màu
    }
}

static void my_lcd_send_color(lv_display_t *disp, const uint8_t *cmd, size_t cmd_size, uint8_t *param, size_t param_size)
{
     //...

      invert_colors((uint16_t *)param, param_size / 2);

     //send data

}
    lcd_disp = lv_st7796_create(MY_DISP_HOR_RES, MY_DISP_VER_RES, LV_LCD_FLAG_BGR, lcd_send_cmd, lcd_send_color);