Description
Hi everyone,
I recently bought this device (https://www.waveshare.com/esp32-s3-touch-lcd-2.1.htm).
It works great with the demo files, however the LVGL library in the demo is version 8.3.3.
I’m very new to this and i’m having some trouble updating the library form 8.3.3 to 9.2.2 (latest LVGL Arduino IDE version available)
I’m using AI to give me an hand with all the breaking changes.
I also peeked at the documentation but I not doing much progress and the project fails to compile.
My goal is to get a very simple “hello world” example working after updating the LVGL lib version to 9.2.2 which was what the demo files basically did.
I’m completely lost here. Maybe someone can shine a light.
All my issues are within my initLVGL function:
LVGL_Driver.h
#pragma once
#include "lvgl.h"
#include <esp_heap_caps.h>
#include "Display_ST7701.h"
#include "Touch_CST820.h"
#define LCD_WIDTH ESP_PANEL_LCD_WIDTH
#define LCD_HEIGHT ESP_PANEL_LCD_HEIGHT
#define LVGL_BUF_LEN (ESP_PANEL_LCD_WIDTH * ESP_PANEL_LCD_HEIGHT / 5)
#define LVGL_TICK_PERIOD_MS 5
extern lv_display_t disp_drv;
void debugLVGL(const char * buf);
void Lvgl_Display_LCD(lv_display_t *disp, const lv_area_t *area, lv_color_t *color_p);
void Lvgl_Touchpad_Read(lv_indev_t * indev, lv_indev_data_t * data);
void increase_lvgl_tick(void *arg);
void initLVGL(void);
void loopLVGL(void);
LVGL_Driver.cpp
void initLVGL(void) {
lv_init();
/* Retrieve frame buffers */
void *buf1, *buf2;
esp_lcd_rgb_panel_get_frame_buffer(panel_handle, 2, &buf1, &buf2);
/* Initialize the draw buffer */
static lv_draw_buf_t draw_buf;
lv_draw_buf_init(&draw_buf, buf1, buf2, LV_COLOR_FORMAT_NATIVE, ESP_PANEL_LCD_WIDTH, ESP_PANEL_LCD_HEIGHT);
/* Initialize the display driver */
static lv_display_t disp_drv;
lv_display_init(&disp_drv);
/* Set the display resolution */
lv_display_set_physical_resolution(&disp_drv, LCD_HEIGHT, LCD_WIDTH); // Note: Use physical resolution in 9.2.2
lv_display_set_flush_cb(&disp_drv, Lvgl_Display_LCD);
lv_display_set_full_refresh(&disp_drv, true);
// In LVGL 9.2.2, draw buffers are set with this method
lv_display_set_draw_buffers(&disp_drv, &draw_buf, NULL, 0, LV_DISPLAY_RENDER_MODE_PARTIAL);
/* Add the display driver */
lv_display_t *display = lv_display_add(&disp_drv);
/* Initialize the input device driver */
static lv_indev_t indev_drv;
lv_indev_init(&indev_drv);
indev_drv.type = LV_INDEV_TYPE_POINTER;
indev_drv.read_cb = Lvgl_Touchpad_Read;
/* Add the input device */
lv_indev_t *indev = lv_indev_add(&indev_drv);
/* Create simple label */
lv_obj_t *label = lv_label_create(lv_screen_active());
lv_label_set_text(label, "Hello Arduino and LVGL!");
lv_obj_center(label);
/* Setup LVGL tick timer */
const esp_timer_create_args_t lvgl_tick_timer_args = {
.callback = &increase_lvgl_tick,
.name = "lvgl_tick"
};
esp_timer_handle_t lvgl_tick_timer = NULL;
esp_timer_create(&lvgl_tick_timer_args, &lvgl_tick_timer);
esp_timer_start_periodic(lvgl_tick_timer, LVGL_TICK_PERIOD_MS * 1000);
}
My errors: