Hi, I am working on project with esp32, using LVGL 8 and I wanted to port it to LVGL9.
The code attached is a minimum functional example to start with lvgl .
The problem is that it compiles with LVGL8.x , but with LVGL 9.x library versions, I have 45 errors all related to lvgl. I also replaced lv_cong.h with version 9 and enabled it.
#include <Arduino.h>
#include <SPI.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include <lvgl.h>
#include "ui.h"
#include "screens.h"
static const uint16_t screenWidth = 320;
static const uint16_t screenHeight = 240;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[screenWidth * screenHeight / 10];
TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */
void my_disp_flush(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p)
{
uint32_t w = (area->x2 - area->x1 + 1);
uint32_t h = (area->y2 - area->y1 + 1);
tft.startWrite();
tft.setAddrWindow(area->x1, area->y1, w, h);
tft.pushColors((uint16_t *)&color_p->full, w * h, true);
tft.endWrite();
lv_disp_flush_ready(disp);
}
void setup()
{
Serial.begin(115200); /* prepare for possible serial debug */
delay(1000);
lv_init();
tft.begin(); /* TFT init */
tft.initDMA(); /* Init DMA for faster drawing */
tft.setRotation(3); /* Landscape orientation, flipped */
lv_disp_draw_buf_init(&draw_buf, buf, NULL, screenWidth * screenHeight / 10);
/*Initialize the display*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init(&disp_drv);
/*Change the following line to your display resolution*/
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register(&disp_drv);
ui_init();
Serial.println("Creating LVGL input device driver...");
}
void loop()
{
ui_tick(); // Update EEZ-Studio UI
lv_timer_handler(); /* let the GUI do its work */
}
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[env:esp32dev]
platform = espressif32 @ 6.12.0
board = esp32dev
framework = arduino
monitor_speed = 115200
monitor_rts = 0
monitor_dtr = 0
build_flags =
-D LV_CONF_INCLUDE_SIMPLE
-I include
-I lib/ui/
-D USER_SETUP_LOADED
-D ST7789_DRIVER
-D TFT_RGB_ORDER=TFT_BGR
-D TFT_MISO=19
-D TFT_MOSI=23
-D TFT_SCLK=18
-D TFT_CS=15
-D TFT_DC=2
-D TFT_RST=4
-D LOAD_GLCD=1
-D LOAD_GFXFF
-D SMOOTH_FONT
-D SPI_FREQUENCY=50000000
lib_deps =
bodmer/TFT_eSPI@^2.5.43
lvgl/lvgl@^9.3.0