From 21cdca4a16818fbb4e427744e820e9ed02ffbf05 Mon Sep 17 00:00:00 2001 From: Rene Zeldenthuis Date: Sun, 16 Jun 2024 13:38:32 +0200 Subject: [PATCH 01/21] Initial commit for LVGL v9.1 --- boards | 2 +- include/esp32_smartdisplay.h | 2 + library.json | 6 +- platformio.ini | 2 +- src/esp32_smartdisplay.c | 74 +-- src/lvgl_panel_gc9a01_spi.c | 43 +- src/lvgl_panel_ili9341_spi.c | 43 +- src/lvgl_panel_st7262_par.c | 29 +- src/lvgl_panel_st7701_par.c | 29 +- src/lvgl_panel_st7789_i80.c | 41 +- src/lvgl_panel_st7789_spi.c | 45 +- src/lvgl_panel_st7796_spi.c | 41 +- src/lvgl_touch_cst816s_i2c.c | 19 +- src/lvgl_touch_gt911_i2c.c | 19 +- src/lvgl_touch_xpt2046_spi.c | 19 +- test/lv_conf.h | 842 +++++++++++++++++++++-------------- 16 files changed, 744 insertions(+), 512 deletions(-) diff --git a/boards b/boards index 281d5e4..8ce9484 160000 --- a/boards +++ b/boards @@ -1 +1 @@ -Subproject commit 281d5e4278ae31ad133074328ec1d291a4d62673 +Subproject commit 8ce948494e59e55634c6c0142d435100e9e0bc8e diff --git a/include/esp32_smartdisplay.h b/include/esp32_smartdisplay.h index 8a767ef..b95b3d7 100644 --- a/include/esp32_smartdisplay.h +++ b/include/esp32_smartdisplay.h @@ -3,6 +3,8 @@ #include #include +#include +#include // Use last PWM_CHANNEL for backlight #define PWM_CHANNEL_BCKL (SOC_LEDC_CHANNEL_NUM - 1) diff --git a/library.json b/library.json index fbd8e96..945b7b8 100644 --- a/library.json +++ b/library.json @@ -1,8 +1,8 @@ { "$schema": "https://raw.githubusercontent.com/platformio/platformio-core/develop/platformio/assets/schema/library.json", "name": "esp32_smartdisplay", - "version": "2.0.9", - "description": "LVGL driver for Sunton ESP32 Cheap Yellow Display display boards", + "version": "3.0.0", + "description": "LVGL v9.1 driver for Sunton ESP32 Cheap Yellow Display display boards", "keywords": "LVGL Sunton CYD LCD TFT Touch", "repository": { "type": "git", @@ -35,6 +35,6 @@ "frameworks": "arduino", "platforms": "espressif32", "dependencies": { - "lvgl/lvgl": "^8.3.9" + "lvgl/lvgl": "^9.1.0" } } \ No newline at end of file diff --git a/platformio.ini b/platformio.ini index b2e4a2d..8458c02 100644 --- a/platformio.ini +++ b/platformio.ini @@ -56,7 +56,7 @@ build_flags = '-D ESP_LCD_PANEL_IO_ADDITIONS_VER_PATCH=1' lib_deps = - lvgl/lvgl@^8.3.9 + lvgl/lvgl@^9.1.0 # The platformio.test_dir contains the test_main.cpp just to have an setup() and loop() function # so it will compile ${platformio.test_dir} diff --git a/src/esp32_smartdisplay.c b/src/esp32_smartdisplay.c index bc4d968..d05e57a 100644 --- a/src/esp32_smartdisplay.c +++ b/src/esp32_smartdisplay.c @@ -10,22 +10,39 @@ #define BRIGHTNESS_DARK_ZONE 250 // Functions to be defined in the tft/touch driver -extern void lvgl_lcd_init(lv_disp_drv_t *disp_drv); -extern void lvgl_touch_init(lv_indev_drv_t *disp_drv); +extern lv_display_t *lvgl_lcd_init(uint32_t hor_res, uint32_t ver_res); +extern lv_indev_t *lvgl_touch_init(); -lv_disp_drv_t disp_drv; -lv_timer_t *update_brightness_timer; +lv_display_t *display; #ifdef BOARD_HAS_TOUCH -lv_indev_drv_t indev_drv; +lv_indev_t *indev; touch_calibration_data_t touch_calibration_data; -void (*driver_touch_read_cb)(struct _lv_indev_drv_t *indev_drv, lv_indev_data_t *data); +void (*driver_touch_read_cb)(lv_indev_t *indev, lv_indev_data_t *data); #endif +lv_timer_t *update_brightness_timer; + #ifdef LV_USE_LOG -void lvgl_log(const char *buf) +void lvgl_log(lv_log_level_t level, const char *buf) { - log_printf("%s", buf); + switch (level) + { + case LV_LOG_LEVEL_TRACE: + log_printf("%s", buf); + break; + case LV_LOG_LEVEL_INFO: + log_i("%s", buf); + break; + case LV_LOG_LEVEL_WARN: + log_w("%s", buf); + break; + case LV_LOG_LEVEL_ERROR: + log_e("%s", buf); + break; + case LV_LOG_LEVEL_USER: + break; + } } #endif @@ -100,12 +117,12 @@ void smartdisplay_led_set_rgb(bool r, bool g, bool b) #ifdef BOARD_HAS_TOUCH // See: https://www.maximintegrated.com/en/design/technical-documents/app-notes/5/5296.html -void lvgl_touch_calibration_transform(lv_indev_drv_t *disp_drv, lv_indev_data_t *data) +void lvgl_touch_calibration_transform(lv_indev_t *indev, lv_indev_data_t *data) { - log_v("disp_drv:0x%08x, data:0x%08x", disp_drv, data); + log_v("indev:0x%08x, data:0x%08x", indev, data); // Call low level read from the driver - driver_touch_read_cb(disp_drv, data); + driver_touch_read_cb(indev, data); // Check if transformation is required if (touch_calibration_data.valid && data->state == LV_INDEV_STATE_PRESSED) { @@ -137,6 +154,7 @@ touch_calibration_data_t smartdisplay_compute_touch_calibration(const lv_point_t }; #endif +/* // Called when driver parameters are updated (rotation) // Top of the display is top left when connector is at the bottom // The rotation values are relative to how you would rotate the physical display in the clockwise direction. @@ -167,6 +185,7 @@ void lvgl_update_callback(lv_disp_drv_t *drv) } } } +*/ void smartdisplay_init() { @@ -206,19 +225,15 @@ void smartdisplay_init() ledcAttachPin(GPIO_BCKL, PWM_CHANNEL_BCKL); #endif // Setup TFT display - lv_disp_drv_init(&disp_drv); - disp_drv.hor_res = DISPLAY_WIDTH; - disp_drv.ver_res = DISPLAY_HEIGHT; - // Create drawBuffer - disp_drv.draw_buf = (lv_disp_draw_buf_t *)malloc(sizeof(lv_disp_draw_buf_t)); - void *drawBuffer = heap_caps_malloc(sizeof(lv_color_t) * LVGL_BUFFER_PIXELS, LVGL_BUFFER_MALLOC_FLAGS); - lv_disp_draw_buf_init(disp_drv.draw_buf, drawBuffer, NULL, LVGL_BUFFER_PIXELS); - // Register callback for changes to the driver parameters (rotation!) - disp_drv.drv_update_cb = lvgl_update_callback; - // Initialize specific driver - lvgl_lcd_init(&disp_drv); - __attribute__((unused)) lv_disp_t *display = lv_disp_drv_register(&disp_drv); - // Clear screen + display = lvgl_lcd_init(DISPLAY_WIDTH, DISPLAY_HEIGHT); + // Create drawBuffer + uint32_t dreawBufferSize = sizeof(lv_color_t) * LVGL_BUFFER_PIXELS; + void *drawBuffer = heap_caps_malloc(dreawBufferSize, LVGL_BUFFER_MALLOC_FLAGS); + lv_display_set_buffers(display, drawBuffer, NULL, dreawBufferSize, LV_DISPLAY_RENDER_MODE_PARTIAL); + // Register callback for changes to the driver parameters (rotation!) + // display->drv_update_cb = lvgl_update_callback; + // Initialize specific driver + // Clear screen lv_obj_clean(lv_scr_act()); // Turn backlight on (50%) smartdisplay_lcd_set_backlight(0.5f); @@ -226,11 +241,10 @@ void smartdisplay_init() // If there is a touch controller defined #ifdef BOARD_HAS_TOUCH // Setup touch - lv_indev_drv_init(&indev_drv); - indev_drv.disp = display; - lvgl_touch_init(&indev_drv); - driver_touch_read_cb = indev_drv.read_cb; - indev_drv.read_cb = lvgl_touch_calibration_transform; - lv_indev_drv_register(&indev_drv); + indev = lvgl_touch_init(); + indev->disp = display; + // Intercept callback + driver_touch_read_cb = indev->read_cb; + indev->read_cb = lvgl_touch_calibration_transform; #endif } \ No newline at end of file diff --git a/src/lvgl_panel_gc9a01_spi.c b/src/lvgl_panel_gc9a01_spi.c index f316231..4a4e8be 100644 --- a/src/lvgl_panel_gc9a01_spi.c +++ b/src/lvgl_panel_gc9a01_spi.c @@ -10,33 +10,34 @@ bool gc9a01_color_trans_done(esp_lcd_panel_io_handle_t panel_io_handle, esp_lcd_ { log_v("panel_io_handle:0x%08x, panel_io_event_data:%0x%08x, user_ctx:0x%08x", panel_io_handle, panel_io_event_data, user_ctx); - lv_disp_drv_t *disp_driver = user_ctx; - lv_disp_flush_ready(disp_driver); + lv_display_t *display = user_ctx; + lv_disp_flush_ready(display); return false; } -void gc9a01_lv_flush(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *color_map) +void gc9a01_lv_flush(lv_display_t *display, const lv_area_t *area, uint8_t *px_map) { - log_v("drv:0x%08x, area:%0x%08x, color_map:0x%08x", drv, area, color_map); + log_v("display:0x%08x, area:%0x%08x, color_map:0x%08x", display, area, px_map); - esp_lcd_panel_handle_t panel_handle = drv->user_data; -#if LV_COLOR_16_SWAP != 1 -#warning "LV_COLOR_16_SWAP should be 1 for max performance" - ushort pixels = lv_area_get_size(area); - lv_color16_t *p = color_map; - while (pixels--) - p++->full = (uint16_t)((p->full >> 8) | (p->full << 8)); -#endif - ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap(panel_handle, area->x1, area->y1, area->x2 + 1, area->y2 + 1, color_map)); + esp_lcd_panel_handle_t panel_handle = display->user_data; + uint32_t pixels = lv_area_get_size(area); + uint16_t *p = (uint16_t*)px_map; + while (pixels--) { + *p = (uint16_t)((*p >> 8) | (*p << 8)); + p++; + } + + ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap(panel_handle, area->x1, area->y1, area->x2 + 1, area->y2 + 1, px_map)); }; -void lvgl_lcd_init(lv_disp_drv_t *drv) +lv_display_t *lvgl_lcd_init(uint32_t hor_res, uint32_t ver_res) { - log_v("disp_drv:0x%08x", drv); + lv_display_t *display = lv_display_create(hor_res, ver_res); + log_v("display:0x%08x", display); // Hardware rotation is supported - drv->sw_rotate = 0; - drv->rotated = LV_DISP_ROT_NONE; + display->sw_rotate = 0; + display->rotation = LV_DISPLAY_ROTATION_0; // Create SPI bus const spi_bus_config_t spi_bus_config = { @@ -58,7 +59,7 @@ void lvgl_lcd_init(lv_disp_drv_t *drv) .spi_mode = GC9A01_SPI_CONFIG_SPI_MODE, .pclk_hz = GC9A01_SPI_CONFIG_PCLK_HZ, .trans_queue_depth = GC9A01_SPI_CONFIG_TRANS_QUEUE_DEPTH, - .user_ctx = drv, + .user_ctx = display, .on_color_trans_done = gc9a01_color_trans_done, .lcd_cmd_bits = GC9A01_SPI_CONFIG_LCD_CMD_BITS, .lcd_param_bits = GC9A01_SPI_CONFIG_LCD_PARAM_BITS, @@ -100,8 +101,10 @@ void lvgl_lcd_init(lv_disp_drv_t *drv) // Turn display on ESP_ERROR_CHECK(esp_lcd_panel_disp_on_off(panel_handle, true)); - drv->user_data = panel_handle; - drv->flush_cb = gc9a01_lv_flush; + display->user_data = panel_handle; + display->flush_cb = gc9a01_lv_flush; + + return display; } #endif \ No newline at end of file diff --git a/src/lvgl_panel_ili9341_spi.c b/src/lvgl_panel_ili9341_spi.c index 1f1eb22..5a14f43 100644 --- a/src/lvgl_panel_ili9341_spi.c +++ b/src/lvgl_panel_ili9341_spi.c @@ -6,33 +6,34 @@ #include #include -static bool ili9341_color_trans_done(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_io_event_data_t *edata, void *user_ctx) +bool ili9341_color_trans_done(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_io_event_data_t *edata, void *user_ctx) { - lv_disp_drv_t *disp_driver = user_ctx; - lv_disp_flush_ready(disp_driver); + lv_display_t *display = user_ctx; + lv_disp_flush_ready(display); return false; } -static void ili9341_lv_flush(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *color_map) +void ili9341_lv_flush(lv_display_t *display, const lv_area_t *area, uint8_t *px_map) { - esp_lcd_panel_handle_t panel_handle = drv->user_data; -#if LV_COLOR_16_SWAP != 1 -#warning "LV_COLOR_16_SWAP should be 1 for max performance" - ushort pixels = lv_area_get_size(area); - lv_color16_t *p = color_map; - while (pixels--) - p++->full = (uint16_t)((p->full >> 8) | (p->full << 8)); -#endif - ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap(panel_handle, area->x1, area->y1, area->x2 + 1, area->y2 + 1, color_map)); + esp_lcd_panel_handle_t panel_handle = display->user_data; + uint32_t pixels = lv_area_get_size(area); + uint16_t *p = (uint16_t*)px_map; + while (pixels--) { + *p = (uint16_t)((*p >> 8) | (*p << 8)); + p++; + } + + ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap(panel_handle, area->x1, area->y1, area->x2 + 1, area->y2 + 1, px_map)); }; -void lvgl_lcd_init(lv_disp_drv_t *drv) +lv_display_t *lvgl_lcd_init(uint32_t hor_res, uint32_t ver_res) { - log_v("drv:0x%08x"); + lv_display_t *display = lv_display_create(hor_res, ver_res); + log_v("display:0x%08x", display); // Hardware rotation is supported - drv->sw_rotate = 0; - drv->rotated = LV_DISP_ROT_NONE; + display->sw_rotate = 0; + display->rotation = LV_DISPLAY_ROTATION_0; // Create SPI bus const spi_bus_config_t spi_bus_config = { @@ -55,7 +56,7 @@ void lvgl_lcd_init(lv_disp_drv_t *drv) .pclk_hz = ILI9341_SPI_CONFIG_PCLK_HZ, .trans_queue_depth = ILI9341_SPI_CONFIG_TRANS_QUEUE_DEPTH, .on_color_trans_done = ili9341_color_trans_done, - .user_ctx = drv, + .user_ctx = display, .lcd_cmd_bits = ILI9341_SPI_CONFIG_LCD_CMD_BITS, .lcd_param_bits = ILI9341_SPI_CONFIG_LCD_PARAM_BITS, .flags = { @@ -96,8 +97,10 @@ void lvgl_lcd_init(lv_disp_drv_t *drv) // Turn display on ESP_ERROR_CHECK(esp_lcd_panel_disp_on_off(panel_handle, true)); - drv->user_data = panel_handle; - drv->flush_cb = ili9341_lv_flush; + display->user_data = panel_handle; + display->flush_cb = ili9341_lv_flush; + + return display; } #endif \ No newline at end of file diff --git a/src/lvgl_panel_st7262_par.c b/src/lvgl_panel_st7262_par.c index ffa13c0..ac31517 100644 --- a/src/lvgl_panel_st7262_par.c +++ b/src/lvgl_panel_st7262_par.c @@ -6,25 +6,26 @@ bool direct_io_frame_trans_done(esp_lcd_panel_handle_t panel, esp_lcd_rgb_panel_event_data_t *edata, void *user_ctx) { - lv_disp_drv_t *disp_driver = user_ctx; - lv_disp_flush_ready(disp_driver); + lv_display_t *display = user_ctx; + lv_disp_flush_ready(display); return false; } -void direct_io_lv_flush(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *color_map) +void direct_io_lv_flush(lv_display_t *display, const lv_area_t *area, uint8_t *px_map) { - const esp_lcd_panel_handle_t panel_handle = drv->user_data; + const esp_lcd_panel_handle_t panel_handle = display->user_data; // LV_COLOR_16_SWAP is handled by mapping of the data - ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap(panel_handle, area->x1, area->y1, area->x2 + 1, area->y2 + 1, color_map)); + ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap(panel_handle, area->x1, area->y1, area->x2 + 1, area->y2 + 1, px_map)); }; -void lvgl_lcd_init(lv_disp_drv_t *drv) +lv_display_t *lvgl_lcd_init(uint32_t hor_res, uint32_t ver_res) { - log_v("drv:0x%08x"); + lv_display_t *display = lv_display_create(hor_res, ver_res); + log_v("display:0x%08x", display); - // Hardware rotation is NOT supported - drv->sw_rotate = 1; - drv->rotated = LV_DISP_ROT_NONE; + // Hardware rotation is supported + display->sw_rotate = 1; + display->rotation = LV_DISPLAY_ROTATION_0; // Create direct_io panel handle const esp_lcd_rgb_panel_config_t rgb_panel_config = { @@ -59,7 +60,7 @@ void lvgl_lcd_init(lv_disp_drv_t *drv) #endif .disp_gpio_num = ST7262_PANEL_CONFIG_DISP_GPIO_NUM, .on_frame_trans_done = direct_io_frame_trans_done, - .user_ctx = drv, + .user_ctx = display, .flags = {.disp_active_low = ST7262_PANEL_CONFIG_FLAGS_DISP_ACTIVE_LOW, .relax_on_idle = ST7262_PANEL_CONFIG_FLAGS_RELAX_ON_IDLE, .fb_in_psram = ST7262_PANEL_CONFIG_FLAGS_FB_IN_PSRAM} }; log_d("rgb_panel_config: clk_src:%d, timings:{pclk_hz:%d, h_res:%d, v_res:%d, hsync_pulse_width:%d, hsync_back_porch:%d, hsync_front_porch:%d, vsync_pulse_width:%d, vsync_back_porch:%d, vsync_front_porch:%d, flags:{hsync_idle_low:%d, vsync_idle_low:%d, de_idle_high:%d, pclk_active_neg:%d, pclk_idle_high:%d}}, data_width:%d, sram_trans_align:%d, psram_trans_align:%d, hsync_gpio_num:%d, vsync_gpio_num:%d, de_gpio_num:%d, pclk_gpio_num:%d, data_gpio_nums:[%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,], disp_gpio_num:%d, on_frame_trans_done:0x%08x, user_ctx:0x%08x, flags:{disp_active_low:%d, relax_on_idle:%d, fb_in_psram:%d}", rgb_panel_config.clk_src, rgb_panel_config.timings.pclk_hz, rgb_panel_config.timings.h_res, rgb_panel_config.timings.v_res, rgb_panel_config.timings.hsync_pulse_width, rgb_panel_config.timings.hsync_back_porch, rgb_panel_config.timings.hsync_front_porch, rgb_panel_config.timings.vsync_pulse_width, rgb_panel_config.timings.vsync_back_porch, rgb_panel_config.timings.vsync_front_porch, rgb_panel_config.timings.flags.hsync_idle_low, rgb_panel_config.timings.flags.vsync_idle_low, rgb_panel_config.timings.flags.de_idle_high, rgb_panel_config.timings.flags.pclk_active_neg, rgb_panel_config.timings.flags.pclk_idle_high, rgb_panel_config.data_width, rgb_panel_config.sram_trans_align, rgb_panel_config.psram_trans_align, rgb_panel_config.hsync_gpio_num, rgb_panel_config.vsync_gpio_num, rgb_panel_config.de_gpio_num, rgb_panel_config.pclk_gpio_num, rgb_panel_config.data_gpio_nums[0], rgb_panel_config.data_gpio_nums[1], rgb_panel_config.data_gpio_nums[2], rgb_panel_config.data_gpio_nums[3], rgb_panel_config.data_gpio_nums[4], rgb_panel_config.data_gpio_nums[5], rgb_panel_config.data_gpio_nums[6], rgb_panel_config.data_gpio_nums[7], rgb_panel_config.data_gpio_nums[8], rgb_panel_config.data_gpio_nums[9], rgb_panel_config.data_gpio_nums[10], rgb_panel_config.data_gpio_nums[11], rgb_panel_config.data_gpio_nums[12], rgb_panel_config.data_gpio_nums[13], rgb_panel_config.data_gpio_nums[14], rgb_panel_config.data_gpio_nums[15], rgb_panel_config.disp_gpio_num, rgb_panel_config.on_frame_trans_done, rgb_panel_config.user_ctx, rgb_panel_config.flags.disp_active_low, rgb_panel_config.flags.relax_on_idle, rgb_panel_config.flags.fb_in_psram); @@ -75,8 +76,10 @@ void lvgl_lcd_init(lv_disp_drv_t *drv) #if defined(DISPLAY_GAP_X) || defined(DISPLAY_GAP_Y) ESP_ERROR_CHECK(esp_lcd_panel_set_gap(panel_handle, DISPLAY_GAP_X, DISPLAY_GAP_Y)); #endif - drv->user_data = panel_handle; - drv->flush_cb = direct_io_lv_flush; + display->user_data = panel_handle; + display->flush_cb = direct_io_lv_flush; + + return display; } #endif \ No newline at end of file diff --git a/src/lvgl_panel_st7701_par.c b/src/lvgl_panel_st7701_par.c index c581951..1aea3b0 100644 --- a/src/lvgl_panel_st7701_par.c +++ b/src/lvgl_panel_st7701_par.c @@ -8,25 +8,26 @@ bool direct_io_frame_trans_done(esp_lcd_panel_handle_t panel, esp_lcd_rgb_panel_event_data_t *edata, void *user_ctx) { - lv_disp_drv_t *disp_driver = user_ctx; - lv_disp_flush_ready(disp_driver); + lv_display_t *display = user_ctx; + lv_disp_flush_ready(display); return false; } -void direct_io_lv_flush(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *color_map) +void direct_io_lv_flush(lv_display_t *display, const lv_area_t *area, uint8_t *px_map) { - const esp_lcd_panel_handle_t panel_handle = drv->user_data; + const esp_lcd_panel_handle_t panel_handle = display->user_data; // LV_COLOR_16_SWAP is handled by mapping of the data - ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap(panel_handle, area->x1, area->y1, area->x2 + 1, area->y2 + 1, color_map)); + ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap(panel_handle, area->x1, area->y1, area->x2 + 1, area->y2 + 1, px_map)); }; -void lvgl_lcd_init(lv_disp_drv_t *drv) +lv_display_t *lvgl_lcd_init(uint32_t hor_res, uint32_t ver_res) { - log_v("drv:0x%08x"); + lv_display_t *display = lv_display_create(hor_res, ver_res); + log_v("display:0x%08x", display); - // Hardware rotation is NOT supported - drv->sw_rotate = 1; - drv->rotated = LV_DISP_ROT_NONE; + // Hardware rotation is supported + display->sw_rotate = 1; + display->rotation = LV_DISPLAY_ROTATION_0; // Install 3-wire SPI panel IO esp_lcd_panel_io_3wire_spi_config_t io_3wire_spi_config = { @@ -79,7 +80,7 @@ void lvgl_lcd_init(lv_disp_drv_t *drv) #endif .disp_gpio_num = ST7701_PANEL_CONFIG_DISP_GPIO_NUM, .on_frame_trans_done = direct_io_frame_trans_done, - .user_ctx = drv, + .user_ctx = display, .flags = {.disp_active_low = ST7701_PANEL_CONFIG_FLAGS_DISP_ACTIVE_LOW, .relax_on_idle = ST7701_PANEL_CONFIG_FLAGS_RELAX_ON_IDLE, .fb_in_psram = ST7701_PANEL_CONFIG_FLAGS_FB_IN_PSRAM} }; log_d("rgb_panel_config: clk_src:%d, timings:{pclk_hz:%d, h_res:%d, v_res:%d, hsync_pulse_width:%d, hsync_back_porch:%d, hsync_front_porch:%d, vsync_pulse_width:%d, vsync_back_porch:%d, vsync_front_porch:%d, flags:{hsync_idle_low:%d, vsync_idle_low:%d, de_idle_high:%d, pclk_active_neg:%d, pclk_idle_high:%d}}, data_width:%d, sram_trans_align:%d, psram_trans_align:%d, hsync_gpio_num:%d, vsync_gpio_num:%d, de_gpio_num:%d, pclk_gpio_num:%d, data_gpio_nums:[%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d], disp_gpio_num:%d, on_frame_trans_done:0x%08x, user_ctx:0x%08x, flags:{disp_active_low:%d, relax_on_idle:%d, fb_in_psram:%d}", rgb_panel_config.clk_src, rgb_panel_config.timings.pclk_hz, rgb_panel_config.timings.h_res, rgb_panel_config.timings.v_res, rgb_panel_config.timings.hsync_pulse_width, rgb_panel_config.timings.hsync_back_porch, rgb_panel_config.timings.hsync_front_porch, rgb_panel_config.timings.vsync_pulse_width, rgb_panel_config.timings.vsync_back_porch, rgb_panel_config.timings.vsync_front_porch, rgb_panel_config.timings.flags.hsync_idle_low, rgb_panel_config.timings.flags.vsync_idle_low, rgb_panel_config.timings.flags.de_idle_high, rgb_panel_config.timings.flags.pclk_active_neg, rgb_panel_config.timings.flags.pclk_idle_high, rgb_panel_config.data_width, rgb_panel_config.sram_trans_align, rgb_panel_config.psram_trans_align, rgb_panel_config.hsync_gpio_num, rgb_panel_config.vsync_gpio_num, rgb_panel_config.de_gpio_num, rgb_panel_config.pclk_gpio_num, rgb_panel_config.data_gpio_nums[0], rgb_panel_config.data_gpio_nums[1], rgb_panel_config.data_gpio_nums[2], rgb_panel_config.data_gpio_nums[3], rgb_panel_config.data_gpio_nums[4], rgb_panel_config.data_gpio_nums[5], rgb_panel_config.data_gpio_nums[6], rgb_panel_config.data_gpio_nums[7], rgb_panel_config.data_gpio_nums[8], rgb_panel_config.data_gpio_nums[9], rgb_panel_config.data_gpio_nums[10], rgb_panel_config.data_gpio_nums[11], rgb_panel_config.data_gpio_nums[12], rgb_panel_config.data_gpio_nums[13], rgb_panel_config.data_gpio_nums[14], rgb_panel_config.data_gpio_nums[15], rgb_panel_config.disp_gpio_num, rgb_panel_config.on_frame_trans_done, rgb_panel_config.user_ctx, rgb_panel_config.flags.disp_active_low, rgb_panel_config.flags.relax_on_idle, rgb_panel_config.flags.fb_in_psram); @@ -103,8 +104,10 @@ void lvgl_lcd_init(lv_disp_drv_t *drv) #if defined(DISPLAY_GAP_X) || defined(DISPLAY_GAP_Y) ESP_ERROR_CHECK(esp_lcd_panel_set_gap(panel_handle, DISPLAY_GAP_X, DISPLAY_GAP_Y)); #endif - drv->user_data = panel_handle; - drv->flush_cb = direct_io_lv_flush; + display->user_data = panel_handle; + display->flush_cb = direct_io_lv_flush; + + return display; } #endif \ No newline at end of file diff --git a/src/lvgl_panel_st7789_i80.c b/src/lvgl_panel_st7789_i80.c index a857f1e..f4e2fa5 100644 --- a/src/lvgl_panel_st7789_i80.c +++ b/src/lvgl_panel_st7789_i80.c @@ -7,31 +7,32 @@ bool st7789_color_trans_done(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_io_event_data_t *edata, void *user_ctx) { - lv_disp_drv_t *disp_driver = user_ctx; - lv_disp_flush_ready(disp_driver); + lv_display_t *display = user_ctx; + lv_disp_flush_ready(display); return false; } -void st7789_lv_flush(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *color_map) +void st7789_lv_flush(lv_display_t *drv, const lv_area_t *area, uint8_t *px_map) { const esp_lcd_panel_handle_t panel_handle = drv->user_data; -#if LV_COLOR_16_SWAP != 1 -#warning "LV_COLOR_16_SWAP should be 1 for max performance" - ushort pixels = lv_area_get_size(area); - lv_color16_t *p = color_map; - while (pixels--) - p++->full = (uint16_t)((p->full >> 8) | (p->full << 8)); -#endif - ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap(panel_handle, area->x1, area->y1, area->x2 + 1, area->y2 + 1, color_map)); + uint32_t pixels = lv_area_get_size(area); + uint16_t *p = (uint16_t*)px_map; + while (pixels--) { + *p = (uint16_t)((*p >> 8) | (*p << 8)); + p++; + } + + ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap(panel_handle, area->x1, area->y1, area->x2 + 1, area->y2 + 1, px_map)); }; -void lvgl_lcd_init(lv_disp_drv_t *drv) +lv_display_t *lvgl_lcd_init(uint32_t hor_res, uint32_t ver_res) { - log_v("drv:0x%08x"); + lv_display_t *display = lv_display_create(hor_res, ver_res); + log_v("display:0x%08x", display); - // Hardware rotation is NOT supported - drv->sw_rotate = 1; - drv->rotated = LV_DISP_ROT_NONE; + // Hardware rotation is supported + display->sw_rotate = 1; + display->rotation = LV_DISPLAY_ROTATION_0; pinMode(ST7789_RD_GPIO, OUTPUT); digitalWrite(ST7789_RD_GPIO, HIGH); @@ -63,7 +64,7 @@ void lvgl_lcd_init(lv_disp_drv_t *drv) .cs_gpio_num = ST7789_IO_I80_CONFIG_CS_GPIO_NUM, .pclk_hz = ST7789_IO_I80_CONFIG_PCLK_HZ, .on_color_trans_done = st7789_color_trans_done, - .user_ctx = drv, + .user_ctx = display, .trans_queue_depth = ST7789_IO_I80_CONFIG_TRANS_QUEUE_DEPTH, .lcd_cmd_bits = ST7789_IO_I80_CONFIG_LCD_CMD_BITS, .lcd_param_bits = ST7789_IO_I80_CONFIG_LCD_PARAM_BITS, @@ -97,8 +98,10 @@ void lvgl_lcd_init(lv_disp_drv_t *drv) #if defined(DISPLAY_GAP_X) || defined(DISPLAY_GAP_Y) ESP_ERROR_CHECK(esp_lcd_panel_set_gap(panel_handle, DISPLAY_GAP_X, DISPLAY_GAP_Y)); #endif - drv->user_data = panel_handle; - drv->flush_cb = st7789_lv_flush; + display->user_data = panel_handle; + display->flush_cb = st7789_lv_flush; + + return display; } #endif \ No newline at end of file diff --git a/src/lvgl_panel_st7789_spi.c b/src/lvgl_panel_st7789_spi.c index 07952d5..89e3992 100644 --- a/src/lvgl_panel_st7789_spi.c +++ b/src/lvgl_panel_st7789_spi.c @@ -8,31 +8,32 @@ bool st7789_color_trans_done(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_io_event_data_t *edata, void *user_ctx) { - lv_disp_drv_t *disp_driver = user_ctx; - lv_disp_flush_ready(disp_driver); + lv_display_t *display = user_ctx; + lv_display_flush_ready(display); return false; } -void st7789_lv_flush(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *color_map) +void st7789_lv_flush(lv_display_t *display, const lv_area_t *area, uint8_t *px_map) { - esp_lcd_panel_handle_t panel_handle = drv->user_data; -#if LV_COLOR_16_SWAP != 1 -#warning "LV_COLOR_16_SWAP should be 1 for max performance" - ushort pixels = lv_area_get_size(area); - lv_color16_t *p = color_map; - while (pixels--) - p++->full = (uint16_t)((p->full >> 8) | (p->full << 8)); -#endif - ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap(panel_handle, area->x1, area->y1, area->x2 + 1, area->y2 + 1, color_map)); + esp_lcd_panel_handle_t panel_handle = display->user_data; + uint32_t pixels = lv_area_get_size(area); + uint16_t *p = (uint16_t*)px_map; + while (pixels--) { + *p = (uint16_t)((*p >> 8) | (*p << 8)); + p++; + } + + ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap(panel_handle, area->x1, area->y1, area->x2 + 1, area->y2 + 1, px_map)); }; -void lvgl_lcd_init(lv_disp_drv_t *drv) +lv_display_t *lvgl_lcd_init(uint32_t hor_res, uint32_t ver_res) { - log_v("drv:0x%08x"); + lv_display_t *display = lv_display_create(hor_res, ver_res); + log_v("display:0x%08x", display); // Hardware rotation is supported - drv->sw_rotate = 0; - drv->rotated = LV_DISP_ROT_NONE; + display->sw_rotate = 0; + display->rotation = LV_DISPLAY_ROTATION_0; // Create SPI bus const spi_bus_config_t spi_bus_config = { @@ -54,7 +55,7 @@ void lvgl_lcd_init(lv_disp_drv_t *drv) .spi_mode = ST7789_SPI_CONFIG_SPI_MODE, .pclk_hz = ST7789_SPI_CONFIG_PCLK_HZ, .on_color_trans_done = st7789_color_trans_done, - .user_ctx = drv, + .user_ctx = display, .trans_queue_depth = ST7789_SPI_CONFIG_TRANS_QUEUE_DEPTH, .lcd_cmd_bits = ST7789_SPI_CONFIG_LCD_CMD_BITS, .lcd_param_bits = ST7789_SPI_CONFIG_LCD_PARAM_BITS, @@ -87,17 +88,19 @@ void lvgl_lcd_init(lv_disp_drv_t *drv) #ifdef DISPLAY_SWAP_XY ESP_ERROR_CHECK(esp_lcd_panel_swap_xy(panel_handle, DISPLAY_SWAP_XY)); #endif -#if defined(DISPLAY_MIRROR_X) || defined(DISPLAY_MIRROR_Y) +#if defined(DISPLAY_MIRROR_X) || defined(DISPLAY_MIRROR_Y) ESP_ERROR_CHECK(esp_lcd_panel_mirror(panel_handle, DISPLAY_MIRROR_X, DISPLAY_MIRROR_Y)); -#endif +#endif #if defined(DISPLAY_GAP_X) || defined(DISPLAY_GAP_Y) ESP_ERROR_CHECK(esp_lcd_panel_set_gap(panel_handle, DISPLAY_GAP_X, DISPLAY_GAP_Y)); #endif // Turn display on ESP_ERROR_CHECK(esp_lcd_panel_disp_on_off(panel_handle, true)); - drv->user_data = panel_handle; - drv->flush_cb = st7789_lv_flush; + display->user_data = panel_handle; + display->flush_cb = st7789_lv_flush; + + return display; } #endif \ No newline at end of file diff --git a/src/lvgl_panel_st7796_spi.c b/src/lvgl_panel_st7796_spi.c index 3fd43b0..104993a 100644 --- a/src/lvgl_panel_st7796_spi.c +++ b/src/lvgl_panel_st7796_spi.c @@ -9,31 +9,32 @@ bool st7796_color_trans_done(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_io_event_data_t *edata, void *user_ctx) { - lv_disp_drv_t *disp_driver = user_ctx; - lv_disp_flush_ready(disp_driver); + lv_display_t *display = user_ctx; + lv_disp_flush_ready(display); return false; } -void st7796_lv_flush(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *color_map) +void st7796_lv_flush(lv_display_t *display, const lv_area_t *area, uint8_t *px_map) { - esp_lcd_panel_handle_t panel_handle = drv->user_data; -#if LV_COLOR_16_SWAP != 1 -#warning "LV_COLOR_16_SWAP should be 1 for max performance" - ushort pixels = lv_area_get_size(area); - lv_color16_t *p = color_map; - while (pixels--) - p++->full = (uint16_t)((p->full >> 8) | (p->full << 8)); -#endif - ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap(panel_handle, area->x1, area->y1, area->x2 + 1, area->y2 + 1, color_map)); + esp_lcd_panel_handle_t panel_handle = display->user_data; + uint32_t pixels = lv_area_get_size(area); + uint16_t *p = (uint16_t*)px_map; + while (pixels--) { + *p = (uint16_t)((*p >> 8) | (*p << 8)); + p++; + } + + ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap(panel_handle, area->x1, area->y1, area->x2 + 1, area->y2 + 1, px_map)); }; -void lvgl_lcd_init(lv_disp_drv_t *drv) +lv_display_t *lvgl_lcd_init(uint32_t hor_res, uint32_t ver_res) { - log_v("drv:0x%08x"); + lv_display_t *display = lv_display_create(hor_res, ver_res); + log_v("display:0x%08x", display); // Hardware rotation is supported - drv->sw_rotate = 0; - drv->rotated = LV_DISP_ROT_NONE; + display->sw_rotate = 0; + display->rotation = LV_DISPLAY_ROTATION_0; // Create SPI bus const spi_bus_config_t spi_bus_config = { @@ -55,7 +56,7 @@ void lvgl_lcd_init(lv_disp_drv_t *drv) .spi_mode = ST7796_SPI_CONFIG_SPI_MODE, .pclk_hz = ST7796_SPI_CONFIG_PCLK_HZ, .on_color_trans_done = st7796_color_trans_done, - .user_ctx = drv, + .user_ctx = display, .trans_queue_depth = ST7796_SPI_CONFIG_TRANS_QUEUE_DEPTH, .lcd_cmd_bits = ST7796_SPI_CONFIG_LCD_CMD_BITS, .lcd_param_bits = ST7796_SPI_CONFIG_LCD_PARAM_BITS, @@ -97,8 +98,10 @@ void lvgl_lcd_init(lv_disp_drv_t *drv) // Turn display on ESP_ERROR_CHECK(esp_lcd_panel_disp_on_off(panel_handle, true)); - drv->user_data = panel_handle; - drv->flush_cb = st7796_lv_flush; + display->user_data = panel_handle; + display->flush_cb = st7796_lv_flush; + + return display; } #endif \ No newline at end of file diff --git a/src/lvgl_touch_cst816s_i2c.c b/src/lvgl_touch_cst816s_i2c.c index 5d615e0..efb83cd 100644 --- a/src/lvgl_touch_cst816s_i2c.c +++ b/src/lvgl_touch_cst816s_i2c.c @@ -4,9 +4,9 @@ #include #include "driver/i2c.h" -void cst816s_lvgl_touch_cb(lv_indev_drv_t *drv, lv_indev_data_t *data) +void cst816s_lvgl_touch_cb(lv_indev_t *indev, lv_indev_data_t *data) { - esp_lcd_touch_handle_t touch_handle = drv->user_data; + esp_lcd_touch_handle_t touch_handle = indev->user_data; uint16_t x[1]; uint16_t y[1]; @@ -27,9 +27,10 @@ void cst816s_lvgl_touch_cb(lv_indev_drv_t *drv, lv_indev_data_t *data) data->state = LV_INDEV_STATE_RELEASED; } -void lvgl_touch_init(lv_indev_drv_t *drv) +lv_indev_t *lvgl_touch_init() { - log_v("drv:0x%08x"); + lv_indev_t *indev = lv_indev_create(); + log_v("indev:0x%08x", indev); // Create I2C bus const i2c_config_t i2c_config = { @@ -49,7 +50,7 @@ void lvgl_touch_init(lv_indev_drv_t *drv) const esp_lcd_panel_io_i2c_config_t io_i2c_config = { .dev_addr = CST816S_IO_I2C_CONFIG_DEV_ADDRESS, .control_phase_bytes = CST816S_IO_I2C_CONFIG_CONTROL_PHASE_BYTES, - .user_ctx = drv, + .user_ctx = indev, .dc_bit_offset = CST816S_IO_I2C_CONFIG_DC_BIT_OFFSET, .lcd_cmd_bits = CST816S_IO_I2C_CONFIG_LCD_CMD_BITS, .lcd_param_bits = CST816S_IO_I2C_CONFIG_LCD_PARAM_BITS, @@ -75,9 +76,11 @@ void lvgl_touch_init(lv_indev_drv_t *drv) esp_lcd_touch_handle_t touch_handle; ESP_ERROR_CHECK(esp_lcd_touch_new_i2c_cst816s(io_handle, &touch_config, &touch_handle)); - drv->type = LV_INDEV_TYPE_POINTER; - drv->user_data = touch_handle; - drv->read_cb = cst816s_lvgl_touch_cb; + indev->type = LV_INDEV_TYPE_POINTER; + indev->user_data = touch_handle; + indev->read_cb = cst816s_lvgl_touch_cb; + + return indev; } #endif \ No newline at end of file diff --git a/src/lvgl_touch_gt911_i2c.c b/src/lvgl_touch_gt911_i2c.c index 2b09a26..41778b4 100644 --- a/src/lvgl_touch_gt911_i2c.c +++ b/src/lvgl_touch_gt911_i2c.c @@ -5,9 +5,9 @@ #include #include -void gt911_lvgl_touch_cb(lv_indev_drv_t *drv, lv_indev_data_t *data) +void gt911_lvgl_touch_cb(lv_indev_t *indev, lv_indev_data_t *data) { - esp_lcd_touch_handle_t touch_handle = drv->user_data; + esp_lcd_touch_handle_t touch_handle = indev->user_data; uint16_t x[1]; uint16_t y[1]; @@ -28,9 +28,10 @@ void gt911_lvgl_touch_cb(lv_indev_drv_t *drv, lv_indev_data_t *data) data->state = LV_INDEV_STATE_RELEASED; } -void lvgl_touch_init(lv_indev_drv_t *drv) +lv_indev_t* lvgl_touch_init() { - log_v("drv:0x%08x"); + lv_indev_t* indev = lv_indev_create(); + log_v("indev:0x%08x", indev); // Create I2C bus const i2c_config_t i2c_config = { @@ -50,7 +51,7 @@ void lvgl_touch_init(lv_indev_drv_t *drv) const esp_lcd_panel_io_i2c_config_t io_i2c_config = { .dev_addr = GT911_IO_I2C_CONFIG_DEV_ADDR, .control_phase_bytes = GT911_IO_I2C_CONFIG_CONTROL_PHASE_BYTES, - .user_ctx = drv, + .user_ctx = indev, .dc_bit_offset = GT911_IO_I2C_CONFIG_DC_BIT_OFFSET, .lcd_cmd_bits = GT911_IO_I2C_CONFIG_LCD_CMD_BITS, .lcd_param_bits = GT911_IO_I2C_CONFIG_LCD_PARAM_BITS, @@ -76,9 +77,11 @@ void lvgl_touch_init(lv_indev_drv_t *drv) esp_lcd_touch_handle_t touch_handle; ESP_ERROR_CHECK(esp_lcd_touch_new_i2c_gt911(io_handle, &touch_config, &touch_handle)); - drv->type = LV_INDEV_TYPE_POINTER; - drv->user_data = touch_handle; - drv->read_cb = gt911_lvgl_touch_cb; + indev->type = LV_INDEV_TYPE_POINTER; + indev->user_data = touch_handle; + indev->read_cb = gt911_lvgl_touch_cb; + + return indev; } #endif \ No newline at end of file diff --git a/src/lvgl_touch_xpt2046_spi.c b/src/lvgl_touch_xpt2046_spi.c index 2147dc4..196181c 100644 --- a/src/lvgl_touch_xpt2046_spi.c +++ b/src/lvgl_touch_xpt2046_spi.c @@ -4,9 +4,9 @@ #include #include -void xpt2046_lvgl_touch_cb(lv_indev_drv_t *drv, lv_indev_data_t *data) +void xpt2046_lvgl_touch_cb(lv_indev_t *indev, lv_indev_data_t *data) { - esp_lcd_touch_handle_t touch_handle = drv->user_data; + esp_lcd_touch_handle_t touch_handle = indev->user_data; uint16_t x[1]; uint16_t y[1]; @@ -27,9 +27,10 @@ void xpt2046_lvgl_touch_cb(lv_indev_drv_t *drv, lv_indev_data_t *data) data->state = LV_INDEV_STATE_RELEASED; } -void lvgl_touch_init(lv_indev_drv_t *drv) +lv_indev_t *lvgl_touch_init() { - log_v("drv:0x%08x"); + lv_indev_t *indev = lv_indev_create(); + log_v("indev:0x%08x", indev); // Create SPI bus only if not already initialized (S035R shares the SPI bus) const spi_bus_config_t spi_bus_config = { @@ -47,7 +48,7 @@ void lvgl_touch_init(lv_indev_drv_t *drv) .dc_gpio_num = XPT2046_SPI_CONFIG_DC_GPIO_NUM, .spi_mode = XPT2046_SPI_CONFIG_SPI_MODE, .pclk_hz = XPT2046_SPI_CONFIG_PCLK_HZ, - .user_ctx = drv, + .user_ctx = indev, .trans_queue_depth = XPT2046_SPI_CONFIG_TRANS_QUEUE_DEPTH, .lcd_cmd_bits = XPT2046_SPI_CONFIG_LCD_CMD_BITS, .lcd_param_bits = XPT2046_SPI_CONFIG_LCD_PARAM_BITS, @@ -75,9 +76,11 @@ void lvgl_touch_init(lv_indev_drv_t *drv) esp_lcd_touch_handle_t touch_handle; ESP_ERROR_CHECK(esp_lcd_touch_new_spi_xpt2046(io_handle, &touch_config, &touch_handle)); - drv->type = LV_INDEV_TYPE_POINTER; - drv->user_data = touch_handle; - drv->read_cb = xpt2046_lvgl_touch_cb; + indev->type = LV_INDEV_TYPE_POINTER; + indev->user_data = touch_handle; + indev->read_cb = xpt2046_lvgl_touch_cb; + + return indev; } #endif \ No newline at end of file diff --git a/test/lv_conf.h b/test/lv_conf.h index 82391b4..3603725 100644 --- a/test/lv_conf.h +++ b/test/lv_conf.h @@ -1,6 +1,6 @@ /** * @file lv_conf.h - * Configuration file for v8.3.2 + * Configuration file for v9.0.0-dev */ /* @@ -17,39 +17,35 @@ #ifndef LV_CONF_H #define LV_CONF_H -#include - /*==================== COLOR SETTINGS *====================*/ -/*Color depth: 1 (1 byte per pixel), 8 (RGB332), 16 (RGB565), 32 (ARGB8888)*/ +/*Color depth: 8 (A8), 16 (RGB565), 24 (RGB888), 32 (XRGB8888)*/ #define LV_COLOR_DEPTH 16 -/*Swap the 2 bytes of RGB565 color. Useful if the display has an 8-bit interface (e.g. SPI)*/ -#define LV_COLOR_16_SWAP 1 - -/*Enable features to draw on transparent background. - *It's required if opa, and transform_* style properties are used. - *Can be also used if the UI is above another layer, e.g. an OSD menu or video player.*/ -#define LV_COLOR_SCREEN_TRANSP 0 +/*========================= + STDLIB WRAPPER SETTINGS + *=========================*/ -/* Adjust color mix functions rounding. GPUs might calculate color mix (blending) differently. - * 0: round down, 64: round up from x.75, 128: round up from half, 192: round up from x.25, 254: round up */ -#define LV_COLOR_MIX_ROUND_OFS 0 +/* Possible values + * - LV_STDLIB_BUILTIN: LVGL's built in implementation + * - LV_STDLIB_CLIB: Standard C functions, like malloc, strlen, etc + * - LV_STDLIB_MICROPYTHON: MicroPython implementation + * - LV_STDLIB_RTTHREAD: RT-Thread implementation + * - LV_STDLIB_CUSTOM: Implement the functions externally + */ +#define LV_USE_STDLIB_MALLOC LV_STDLIB_BUILTIN +#define LV_USE_STDLIB_STRING LV_STDLIB_BUILTIN +#define LV_USE_STDLIB_SPRINTF LV_STDLIB_BUILTIN -/*Images pixels with this color will not be drawn if they are chroma keyed)*/ -#define LV_COLOR_CHROMA_KEY lv_color_hex(0x00ff00) /*pure green*/ -/*========================= - MEMORY SETTINGS - *=========================*/ +#if LV_USE_STDLIB_MALLOC == LV_STDLIB_BUILTIN + /*Size of the memory available for `lv_malloc()` in bytes (>= 2kB)*/ + #define LV_MEM_SIZE (256 * 1024U) /*[bytes]*/ -/*1: use custom malloc/free, 0: use the built-in `lv_mem_alloc()` and `lv_mem_free()`*/ -#define LV_MEM_CUSTOM 0 -#if LV_MEM_CUSTOM == 0 - /*Size of the memory available for `lv_mem_alloc()` in bytes (>= 2kB)*/ - #define LV_MEM_SIZE (48U * 1024U) /*[bytes]*/ + /*Size of the memory expand for `lv_malloc()` in bytes*/ + #define LV_MEM_POOL_EXPAND_SIZE 0 /*Set an address for the memory pool instead of allocating it as a normal array. Can be in external SRAM too.*/ #define LV_MEM_ADR 0 /*0: unused*/ @@ -58,162 +54,134 @@ #undef LV_MEM_POOL_INCLUDE #undef LV_MEM_POOL_ALLOC #endif - -#else /*LV_MEM_CUSTOM*/ - #define LV_MEM_CUSTOM_INCLUDE /*Header for the dynamic memory function*/ - #define LV_MEM_CUSTOM_ALLOC malloc - #define LV_MEM_CUSTOM_FREE free - #define LV_MEM_CUSTOM_REALLOC realloc -#endif /*LV_MEM_CUSTOM*/ - -/*Number of the intermediate memory buffer used during rendering and other internal processing mechanisms. - *You will see an error log message if there wasn't enough buffers. */ -#define LV_MEM_BUF_MAX_NUM 16 - -/*Use the standard `memcpy` and `memset` instead of LVGL's own functions. (Might or might not be faster).*/ -#define LV_MEMCPY_MEMSET_STD 0 +#endif /*LV_USE_MALLOC == LV_STDLIB_BUILTIN*/ /*==================== HAL SETTINGS *====================*/ -/*Default display refresh period. LVG will redraw changed areas with this period time*/ -#define LV_DISP_DEF_REFR_PERIOD 30 /*[ms]*/ - -/*Input device read period in milliseconds*/ -#define LV_INDEV_DEF_READ_PERIOD 30 /*[ms]*/ - -/*Use a custom tick source that tells the elapsed time in milliseconds. - *It removes the need to manually update the tick with `lv_tick_inc()`)*/ -#define LV_TICK_CUSTOM 1 -#if LV_TICK_CUSTOM - #define LV_TICK_CUSTOM_INCLUDE "Arduino.h" /*Header for the system time function*/ - #define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current system time in ms*/ -#endif /*LV_TICK_CUSTOM*/ +/*Default display refresh, input device read and animation step period.*/ +#define LV_DEF_REFR_PERIOD 33 /*[ms]*/ /*Default Dot Per Inch. Used to initialize default sizes such as widgets sized, style paddings. *(Not so important, you can adjust it to modify default sizes and spaces)*/ #define LV_DPI_DEF 130 /*[px/inch]*/ -/*======================= - * FEATURE CONFIGURATION - *=======================*/ +/*================= + * OPERATING SYSTEM + *=================*/ +/*Select an operating system to use. Possible options: + * - LV_OS_NONE + * - LV_OS_PTHREAD + * - LV_OS_FREERTOS + * - LV_OS_CMSIS_RTOS2 + * - LV_OS_RTTHREAD + * - LV_OS_WINDOWS + * - LV_OS_CUSTOM */ +#define LV_USE_OS LV_OS_NONE + +#if LV_USE_OS == LV_OS_CUSTOM + #define LV_OS_CUSTOM_INCLUDE +#endif -/*------------- - * Drawing - *-----------*/ +/*======================== + * RENDERING CONFIGURATION + *========================*/ + +/*Align the stride of all layers and images to this bytes*/ +#define LV_DRAW_BUF_STRIDE_ALIGN 1 + +/*Align the start address of draw_buf addresses to this bytes*/ +#define LV_DRAW_BUF_ALIGN 4 + +#define LV_USE_DRAW_SW 1 +#if LV_USE_DRAW_SW == 1 + /* Set the number of draw unit. + * > 1 requires an operating system enabled in `LV_USE_OS` + * > 1 means multiply threads will render the screen in parallel */ + #define LV_DRAW_SW_DRAW_UNIT_CNT 1 + + /* If a widget has `style_opa < 255` (not `bg_opa`, `text_opa` etc) or not NORMAL blend mode + * it is buffered into a "simple" layer before rendering. The widget can be buffered in smaller chunks. + * "Transformed layers" (if `transform_angle/zoom` are set) use larger buffers + * and can't be drawn in chunks. */ + + /*The target buffer size for simple layer chunks.*/ + #define LV_DRAW_SW_LAYER_SIMPLE_BUF_SIZE (24 * 1024) /*[bytes]*/ + + /* 0: use a simple renderer capable of drawing only simple rectangles with gradient, images, texts, and straight lines only + * 1: use a complex renderer capable of drawing rounded corners, shadow, skew lines, and arcs too */ + #define LV_DRAW_SW_COMPLEX 1 + + #if LV_DRAW_SW_COMPLEX == 1 + /*Allow buffering some shadow calculation. + *LV_DRAW_SW_SHADOW_CACHE_SIZE is the max. shadow size to buffer, where shadow size is `shadow_width + radius` + *Caching has LV_DRAW_SW_SHADOW_CACHE_SIZE^2 RAM cost*/ + #define LV_DRAW_SW_SHADOW_CACHE_SIZE 0 + + /* Set number of maximally cached circle data. + * The circumference of 1/4 circle are saved for anti-aliasing + * radius * 4 bytes are used per circle (the most often used radiuses are saved) + * 0: to disable caching */ + #define LV_DRAW_SW_CIRCLE_CACHE_SIZE 4 + #endif -/*Enable complex draw engine. - *Required to draw shadow, gradient, rounded corners, circles, arc, skew lines, image transformations or any masks*/ -#define LV_DRAW_COMPLEX 1 -#if LV_DRAW_COMPLEX != 0 + #define LV_USE_DRAW_SW_ASM LV_DRAW_SW_ASM_NONE - /*Allow buffering some shadow calculation. - *LV_SHADOW_CACHE_SIZE is the max. shadow size to buffer, where shadow size is `shadow_width + radius` - *Caching has LV_SHADOW_CACHE_SIZE^2 RAM cost*/ - #define LV_SHADOW_CACHE_SIZE 0 + #if LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_CUSTOM + #define LV_DRAW_SW_ASM_CUSTOM_INCLUDE "" + #endif +#endif - /* Set number of maximally cached circle data. - * The circumference of 1/4 circle are saved for anti-aliasing - * radius * 4 bytes are used per circle (the most often used radiuses are saved) - * 0: to disable caching */ - #define LV_CIRCLE_CACHE_SIZE 4 -#endif /*LV_DRAW_COMPLEX*/ +/* Use Arm-2D on Cortex-M based devices. Please only enable it for Helium Powered devices for now */ +#define LV_USE_DRAW_ARM2D 0 -/** - * "Simple layers" are used when a widget has `style_opa < 255` to buffer the widget into a layer - * and blend it as an image with the given opacity. - * Note that `bg_opa`, `text_opa` etc don't require buffering into layer) - * The widget can be buffered in smaller chunks to avoid using large buffers. - * - * - LV_LAYER_SIMPLE_BUF_SIZE: [bytes] the optimal target buffer size. LVGL will try to allocate it - * - LV_LAYER_SIMPLE_FALLBACK_BUF_SIZE: [bytes] used if `LV_LAYER_SIMPLE_BUF_SIZE` couldn't be allocated. - * - * Both buffer sizes are in bytes. - * "Transformed layers" (where transform_angle/zoom properties are used) use larger buffers - * and can't be drawn in chunks. So these settings affects only widgets with opacity. - */ -#define LV_LAYER_SIMPLE_BUF_SIZE (24 * 1024) -#define LV_LAYER_SIMPLE_FALLBACK_BUF_SIZE (3 * 1024) +/* Use NXP's VG-Lite GPU on iMX RTxxx platforms. */ +#define LV_USE_DRAW_VGLITE 0 -/*Default image cache size. Image caching keeps the images opened. - *If only the built-in image formats are used there is no real advantage of caching. (I.e. if no new image decoder is added) - *With complex image decoders (e.g. PNG or JPG) caching can save the continuous open/decode of images. - *However the opened images might consume additional RAM. - *0: to disable caching*/ -#define LV_IMG_CACHE_DEF_SIZE 0 +#if LV_USE_DRAW_VGLITE + /* Enable blit quality degradation workaround recommended for screen's dimension > 352 pixels. */ + #define LV_USE_VGLITE_BLIT_SPLIT 0 -/*Number of stops allowed per gradient. Increase this to allow more stops. - *This adds (sizeof(lv_color_t) + 1) bytes per additional stop*/ -#define LV_GRADIENT_MAX_STOPS 2 - -/*Default gradient buffer size. - *When LVGL calculates the gradient "maps" it can save them into a cache to avoid calculating them again. - *LV_GRAD_CACHE_DEF_SIZE sets the size of this cache in bytes. - *If the cache is too small the map will be allocated only while it's required for the drawing. - *0 mean no caching.*/ -#define LV_GRAD_CACHE_DEF_SIZE 0 - -/*Allow dithering the gradients (to achieve visual smooth color gradients on limited color depth display) - *LV_DITHER_GRADIENT implies allocating one or two more lines of the object's rendering surface - *The increase in memory consumption is (32 bits * object width) plus 24 bits * object width if using error diffusion */ -#define LV_DITHER_GRADIENT 0 -#if LV_DITHER_GRADIENT - /*Add support for error diffusion dithering. - *Error diffusion dithering gets a much better visual result, but implies more CPU consumption and memory when drawing. - *The increase in memory consumption is (24 bits * object's width)*/ - #define LV_DITHER_ERROR_DIFFUSION 0 + #if LV_USE_OS + /* Enable VGLite draw async. Queue multiple tasks and flash them once to the GPU. */ + #define LV_USE_VGLITE_DRAW_ASYNC 1 + #endif + + /* Enable VGLite asserts. */ + #define LV_USE_VGLITE_ASSERT 0 #endif -/*Maximum buffer size to allocate for rotation. - *Only used if software rotation is enabled in the display driver.*/ -#define LV_DISP_ROT_MAX_BUF (10*1024) +/* Use NXP's PXP on iMX RTxxx platforms. */ +#define LV_USE_DRAW_PXP 0 -/*------------- - * GPU - *-----------*/ +#if LV_USE_DRAW_PXP + /* Enable PXP asserts. */ + #define LV_USE_PXP_ASSERT 0 +#endif -/*Use Arm's 2D acceleration library Arm-2D */ -#define LV_USE_GPU_ARM2D 0 +/* Use Renesas Dave2D on RA platforms. */ +#define LV_USE_DRAW_DAVE2D 0 -/*Use STM32's DMA2D (aka Chrom Art) GPU*/ -#define LV_USE_GPU_STM32_DMA2D 0 -#if LV_USE_GPU_STM32_DMA2D - /*Must be defined to include path of CMSIS header of target processor - e.g. "stm32f769xx.h" or "stm32f429xx.h"*/ - #define LV_GPU_DMA2D_CMSIS_INCLUDE -#endif +/* Draw using cached SDL textures*/ +#define LV_USE_DRAW_SDL 0 -/*Use SWM341's DMA2D GPU*/ -#define LV_USE_GPU_SWM341_DMA2D 0 -#if LV_USE_GPU_SWM341_DMA2D - #define LV_GPU_SWM341_DMA2D_INCLUDE "SWM341.h" -#endif +/* Use VG-Lite GPU. */ +#define LV_USE_DRAW_VG_LITE 0 -/*Use NXP's PXP GPU iMX RTxxx platforms*/ -#define LV_USE_GPU_NXP_PXP 0 -#if LV_USE_GPU_NXP_PXP - /*1: Add default bare metal and FreeRTOS interrupt handling routines for PXP (lv_gpu_nxp_pxp_osa.c) - * and call lv_gpu_nxp_pxp_init() automatically during lv_init(). Note that symbol SDK_OS_FREE_RTOS - * has to be defined in order to use FreeRTOS OSA, otherwise bare-metal implementation is selected. - *0: lv_gpu_nxp_pxp_init() has to be called manually before lv_init() - */ - #define LV_USE_GPU_NXP_PXP_AUTO_INIT 0 -#endif +#if LV_USE_DRAW_VG_LITE +/* Enable VG-Lite custom external 'gpu_init()' function */ +#define LV_VG_LITE_USE_GPU_INIT 0 + +/* Enable VG-Lite assert. */ +#define LV_VG_LITE_USE_ASSERT 0 -/*Use NXP's VG-Lite GPU iMX RTxxx platforms*/ -#define LV_USE_GPU_NXP_VG_LITE 0 - -/*Use SDL renderer API*/ -#define LV_USE_GPU_SDL 0 -#if LV_USE_GPU_SDL - #define LV_GPU_SDL_INCLUDE_PATH - /*Texture cache size, 8MB by default*/ - #define LV_GPU_SDL_LRU_SIZE (1024 * 1024 * 8) - /*Custom blend mode for mask drawing, disable if you need to link with older SDL2 lib*/ - #define LV_GPU_SDL_CUSTOM_BLEND_MODE (SDL_VERSION_ATLEAST(2, 0, 6)) #endif +/*======================= + * FEATURE CONFIGURATION + *=======================*/ + /*------------- * Logging *-----------*/ @@ -235,6 +203,14 @@ *0: User need to register a callback with `lv_log_register_print_cb()`*/ #define LV_LOG_PRINTF 0 + /*1: Enable print timestamp; + *0: Disable print timestamp*/ + #define LV_LOG_USE_TIMESTAMP 1 + + /*1: Print file and line number of the log; + *0: Do not print file and line number of the log*/ + #define LV_LOG_USE_FILE_LINE 1 + /*Enable/disable LV_LOG_TRACE in modules that produces a huge number of logs*/ #define LV_LOG_TRACE_MEM 1 #define LV_LOG_TRACE_TIMER 1 @@ -244,6 +220,7 @@ #define LV_LOG_TRACE_OBJ_CREATE 1 #define LV_LOG_TRACE_LAYOUT 1 #define LV_LOG_TRACE_ANIM 1 + #define LV_LOG_TRACE_CACHE 1 #endif /*LV_USE_LOG*/ @@ -263,44 +240,80 @@ #define LV_ASSERT_HANDLER_INCLUDE #define LV_ASSERT_HANDLER while(1); /*Halt by default*/ +/*------------- + * Debug + *-----------*/ + +/*1: Draw random colored rectangles over the redrawn areas*/ +#define LV_USE_REFR_DEBUG 0 + +/*1: Draw a red overlay for ARGB layers and a green overlay for RGB layers*/ +#define LV_USE_LAYER_DEBUG 0 + +/*1: Draw overlays with different colors for each draw_unit's tasks. + *Also add the index number of the draw unit on white background. + *For layers add the index number of the draw unit on black background.*/ +#define LV_USE_PARALLEL_DRAW_DEBUG 0 + /*------------- * Others *-----------*/ -/*1: Show CPU usage and FPS count*/ -#define LV_USE_PERF_MONITOR 1 -#if LV_USE_PERF_MONITOR - #define LV_USE_PERF_MONITOR_POS LV_ALIGN_BOTTOM_RIGHT +#define LV_ENABLE_GLOBAL_CUSTOM 0 +#if LV_ENABLE_GLOBAL_CUSTOM + /*Header to include for the custom 'lv_global' function"*/ + #define LV_GLOBAL_CUSTOM_INCLUDE #endif -/*1: Show the used memory and the memory fragmentation - * Requires LV_MEM_CUSTOM = 0*/ -#define LV_USE_MEM_MONITOR 1 -#if LV_USE_MEM_MONITOR - #define LV_USE_MEM_MONITOR_POS LV_ALIGN_BOTTOM_LEFT -#endif +/*Default cache size in bytes. + *Used by image decoders such as `lv_lodepng` to keep the decoded image in the memory. + *If size is not set to 0, the decoder will fail to decode when the cache is full. + *If size is 0, the cache function is not enabled and the decoded mem will be released immediately after use.*/ +#define LV_CACHE_DEF_SIZE 0 -/*1: Draw random colored rectangles over the redrawn areas*/ -#define LV_USE_REFR_DEBUG 0 +/*Default number of image header cache entries. The cache is used to store the headers of images + *The main logic is like `LV_CACHE_DEF_SIZE` but for image headers.*/ +#define LV_IMAGE_HEADER_CACHE_DEF_CNT 0 -/*Change the built in (v)snprintf functions*/ -#define LV_SPRINTF_CUSTOM 0 -#if LV_SPRINTF_CUSTOM - #define LV_SPRINTF_INCLUDE - #define lv_snprintf snprintf - #define lv_vsnprintf vsnprintf -#else /*LV_SPRINTF_CUSTOM*/ - #define LV_SPRINTF_USE_FLOAT 0 -#endif /*LV_SPRINTF_CUSTOM*/ - -#define LV_USE_USER_DATA 1 - -/*Garbage Collector settings - *Used if lvgl is bound to higher level language and the memory is managed by that language*/ -#define LV_ENABLE_GC 0 -#if LV_ENABLE_GC != 0 - #define LV_GC_INCLUDE "gc.h" /*Include Garbage Collector related things*/ -#endif /*LV_ENABLE_GC*/ +/*Number of stops allowed per gradient. Increase this to allow more stops. + *This adds (sizeof(lv_color_t) + 1) bytes per additional stop*/ +#define LV_GRADIENT_MAX_STOPS 2 + +/* Adjust color mix functions rounding. GPUs might calculate color mix (blending) differently. + * 0: round down, 64: round up from x.75, 128: round up from half, 192: round up from x.25, 254: round up */ +#define LV_COLOR_MIX_ROUND_OFS 0 + +/* Add 2 x 32 bit variables to each lv_obj_t to speed up getting style properties */ +#define LV_OBJ_STYLE_CACHE 1 + +/* Add `id` field to `lv_obj_t` */ +#define LV_USE_OBJ_ID 0 + +/* Use lvgl builtin method for obj ID */ +#define LV_USE_OBJ_ID_BUILTIN 0 + +/*Use obj property set/get API*/ +#define LV_USE_OBJ_PROPERTY 0 + +/* VG-Lite Simulator */ +/*Requires: LV_USE_THORVG_INTERNAL or LV_USE_THORVG_EXTERNAL */ +#define LV_USE_VG_LITE_THORVG 0 + +#if LV_USE_VG_LITE_THORVG + + /*Enable LVGL's blend mode support*/ + #define LV_VG_LITE_THORVG_LVGL_BLEND_SUPPORT 0 + + /*Enable YUV color format support*/ + #define LV_VG_LITE_THORVG_YUV_SUPPORT 0 + + /*Enable 16 pixels alignment*/ + #define LV_VG_LITE_THORVG_16PIXELS_ALIGN 1 + + /*Enable multi-thread render*/ + #define LV_VG_LITE_THORVG_THREAD_RENDER 0 + +#endif /*===================== * COMPILER SETTINGS @@ -315,7 +328,7 @@ /*Define a custom attribute to `lv_timer_handler` function*/ #define LV_ATTRIBUTE_TIMER_HANDLER -/*Define a custom attribute to `lv_disp_flush_ready` function*/ +/*Define a custom attribute to `lv_display_flush_ready` function*/ #define LV_ATTRIBUTE_FLUSH_READY /*Required alignment size for buffers*/ @@ -334,15 +347,15 @@ /*Place performance critical functions into a faster memory (e.g RAM)*/ #define LV_ATTRIBUTE_FAST_MEM -/*Prefix variables that are used in GPU accelerated operations, often these need to be placed in RAM sections that are DMA accessible*/ -#define LV_ATTRIBUTE_DMA - /*Export integer constant to binding. This macro is used with constants in the form of LV_ that *should also appear on LVGL binding API such as Micropython.*/ #define LV_EXPORT_CONST_INT(int_value) struct _silence_gcc_warning /*The default value just prevents GCC warning*/ -/*Extend the default -32k..32k coordinate range to -4M..4M by using int32_t for coordinates instead of int16_t*/ -#define LV_USE_LARGE_COORD 0 +/*Prefix all global extern data with this*/ +#define LV_ATTRIBUTE_EXTERN_DATA + +/* Use `float` as `lv_value_precise_t` */ +#define LV_USE_FLOAT 0 /*================== * FONT USAGE @@ -350,37 +363,36 @@ /*Montserrat fonts with ASCII range and some symbols using bpp = 4 *https://fonts.google.com/specimen/Montserrat*/ -#define LV_FONT_MONTSERRAT_8 0 -#define LV_FONT_MONTSERRAT_10 0 -#define LV_FONT_MONTSERRAT_12 0 +#define LV_FONT_MONTSERRAT_8 1 +#define LV_FONT_MONTSERRAT_10 1 +#define LV_FONT_MONTSERRAT_12 1 #define LV_FONT_MONTSERRAT_14 1 -#define LV_FONT_MONTSERRAT_16 0 -#define LV_FONT_MONTSERRAT_18 0 -#define LV_FONT_MONTSERRAT_20 0 +#define LV_FONT_MONTSERRAT_16 1 +#define LV_FONT_MONTSERRAT_18 1 +#define LV_FONT_MONTSERRAT_20 1 #define LV_FONT_MONTSERRAT_22 1 -#define LV_FONT_MONTSERRAT_24 0 -#define LV_FONT_MONTSERRAT_26 0 -#define LV_FONT_MONTSERRAT_28 0 -#define LV_FONT_MONTSERRAT_30 0 -#define LV_FONT_MONTSERRAT_32 0 -#define LV_FONT_MONTSERRAT_34 0 -#define LV_FONT_MONTSERRAT_36 0 -#define LV_FONT_MONTSERRAT_38 0 -#define LV_FONT_MONTSERRAT_40 0 -#define LV_FONT_MONTSERRAT_42 0 -#define LV_FONT_MONTSERRAT_44 0 -#define LV_FONT_MONTSERRAT_46 0 -#define LV_FONT_MONTSERRAT_48 0 +#define LV_FONT_MONTSERRAT_24 1 +#define LV_FONT_MONTSERRAT_26 1 +#define LV_FONT_MONTSERRAT_28 1 +#define LV_FONT_MONTSERRAT_30 1 +#define LV_FONT_MONTSERRAT_32 1 +#define LV_FONT_MONTSERRAT_34 1 +#define LV_FONT_MONTSERRAT_36 1 +#define LV_FONT_MONTSERRAT_38 1 +#define LV_FONT_MONTSERRAT_40 1 +#define LV_FONT_MONTSERRAT_42 1 +#define LV_FONT_MONTSERRAT_44 1 +#define LV_FONT_MONTSERRAT_46 1 +#define LV_FONT_MONTSERRAT_48 1 /*Demonstrate special features*/ -#define LV_FONT_MONTSERRAT_12_SUBPX 0 -#define LV_FONT_MONTSERRAT_28_COMPRESSED 0 /*bpp = 3*/ -#define LV_FONT_DEJAVU_16_PERSIAN_HEBREW 0 /*Hebrew, Arabic, Persian letters and all their forms*/ -#define LV_FONT_SIMSUN_16_CJK 0 /*1000 most common CJK radicals*/ +#define LV_FONT_MONTSERRAT_28_COMPRESSED 1 /*bpp = 3*/ +#define LV_FONT_DEJAVU_16_PERSIAN_HEBREW 1 /*Hebrew, Arabic, Persian letters and all their forms*/ +#define LV_FONT_SIMSUN_16_CJK 1 /*1000 most common CJK radicals*/ /*Pixel perfect monospace fonts*/ -#define LV_FONT_UNSCII_8 0 -#define LV_FONT_UNSCII_16 0 +#define LV_FONT_UNSCII_8 1 +#define LV_FONT_UNSCII_16 1 /*Optionally declare custom fonts here. *You can use these fonts as default font too and they will be available globally. @@ -393,17 +405,10 @@ /*Enable handling large font and/or fonts with a lot of characters. *The limit depends on the font size, font face and bpp. *Compiler error will be triggered if a font needs it.*/ -#define LV_FONT_FMT_TXT_LARGE 0 +#define LV_FONT_FMT_TXT_LARGE 1 /*Enables/disables support for compressed fonts.*/ -#define LV_USE_FONT_COMPRESSED 0 - -/*Enable subpixel rendering*/ -#define LV_USE_FONT_SUBPX 0 -#if LV_USE_FONT_SUBPX - /*Set the pixel order of the display. Physical order of RGB channels. Doesn't matter with "normal" fonts.*/ - #define LV_FONT_SUBPX_BGR 0 /*0: RGB; 1:BGR order*/ -#endif +#define LV_USE_FONT_COMPRESSED 1 /*Enable drawing placeholders when glyph dsc is not found*/ #define LV_USE_FONT_PLACEHOLDER 1 @@ -421,7 +426,7 @@ #define LV_TXT_ENC LV_TXT_ENC_UTF8 /*Can break (wrap) texts on these chars*/ -#define LV_TXT_BREAK_CHARS " ,.;:-_" +#define LV_TXT_BREAK_CHARS " ,.;:-_)]}" /*If a word is at least this long, will break wherever "prettiest" *To disable, set to a value <= 0*/ @@ -435,9 +440,6 @@ *Depends on LV_TXT_LINE_BREAK_LONG_LEN.*/ #define LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN 3 -/*The control character to use for signalling text recoloring.*/ -#define LV_TXT_COLOR_CMD "#" - /*Support bidirectional texts. Allows mixing Left-to-Right and Right-to-Left texts. *The direction will be processed according to the Unicode Bidirectional Algorithm: *https://www.w3.org/International/articles/inline-bidi-markup/uba-basics*/ @@ -455,59 +457,22 @@ #define LV_USE_ARABIC_PERSIAN_CHARS 0 /*================== - * WIDGET USAGE + * WIDGETS *================*/ /*Documentation of the widgets: https://docs.lvgl.io/latest/en/html/widgets/index.html*/ -#define LV_USE_ARC 1 - -#define LV_USE_BAR 1 +#define LV_WIDGETS_HAS_DEFAULT_VALUE 1 -#define LV_USE_BTN 1 - -#define LV_USE_BTNMATRIX 1 - -#define LV_USE_CANVAS 1 - -#define LV_USE_CHECKBOX 1 - -#define LV_USE_DROPDOWN 1 /*Requires: lv_label*/ - -#define LV_USE_IMG 1 /*Requires: lv_label*/ - -#define LV_USE_LABEL 1 -#if LV_USE_LABEL - #define LV_LABEL_TEXT_SELECTION 1 /*Enable selecting text of the label*/ - #define LV_LABEL_LONG_TXT_HINT 1 /*Store some extra info in labels to speed up drawing of very long texts*/ -#endif - -#define LV_USE_LINE 1 - -#define LV_USE_ROLLER 1 /*Requires: lv_label*/ -#if LV_USE_ROLLER - #define LV_ROLLER_INF_PAGES 7 /*Number of extra "pages" when the roller is infinite*/ -#endif - -#define LV_USE_SLIDER 1 /*Requires: lv_bar*/ - -#define LV_USE_SWITCH 1 +#define LV_USE_ANIMIMG 1 -#define LV_USE_TEXTAREA 1 /*Requires: lv_label*/ -#if LV_USE_TEXTAREA != 0 - #define LV_TEXTAREA_DEF_PWD_SHOW_TIME 1500 /*ms*/ -#endif +#define LV_USE_ARC 1 -#define LV_USE_TABLE 1 +#define LV_USE_BAR 1 -/*================== - * EXTRA COMPONENTS - *==================*/ +#define LV_USE_BUTTON 1 -/*----------- - * Widgets - *----------*/ -#define LV_USE_ANIMIMG 1 +#define LV_USE_BUTTONMATRIX 1 #define LV_USE_CALENDAR 1 #if LV_USE_CALENDAR @@ -523,24 +488,43 @@ #define LV_USE_CALENDAR_HEADER_DROPDOWN 1 #endif /*LV_USE_CALENDAR*/ +#define LV_USE_CANVAS 1 + #define LV_USE_CHART 1 -#define LV_USE_COLORWHEEL 1 +#define LV_USE_CHECKBOX 1 + +#define LV_USE_DROPDOWN 1 /*Requires: lv_label*/ + +#define LV_USE_IMAGE 1 /*Requires: lv_label*/ -#define LV_USE_IMGBTN 1 +#define LV_USE_IMAGEBUTTON 1 #define LV_USE_KEYBOARD 1 +#define LV_USE_LABEL 1 +#if LV_USE_LABEL + #define LV_LABEL_TEXT_SELECTION 1 /*Enable selecting text of the label*/ + #define LV_LABEL_LONG_TXT_HINT 1 /*Store some extra info in labels to speed up drawing of very long texts*/ + #define LV_LABEL_WAIT_CHAR_COUNT 3 /*The count of wait chart*/ +#endif + #define LV_USE_LED 1 +#define LV_USE_LINE 1 + #define LV_USE_LIST 1 #define LV_USE_MENU 1 -#define LV_USE_METER 1 - #define LV_USE_MSGBOX 1 +#define LV_USE_ROLLER 1 /*Requires: lv_label*/ + +#define LV_USE_SCALE 1 + +#define LV_USE_SLIDER 1 /*Requires: lv_bar*/ + #define LV_USE_SPAN 1 #if LV_USE_SPAN /*A line text can contain maximum num of span descriptor */ @@ -551,15 +535,24 @@ #define LV_USE_SPINNER 1 +#define LV_USE_SWITCH 1 + +#define LV_USE_TEXTAREA 1 /*Requires: lv_label*/ +#if LV_USE_TEXTAREA != 0 + #define LV_TEXTAREA_DEF_PWD_SHOW_TIME 1500 /*ms*/ +#endif + +#define LV_USE_TABLE 1 + #define LV_USE_TABVIEW 1 #define LV_USE_TILEVIEW 1 #define LV_USE_WIN 1 -/*----------- - * Themes - *----------*/ +/*================== + * THEMES + *==================*/ /*A simple, impressive and very complete theme*/ #define LV_USE_THEME_DEFAULT 1 @@ -569,21 +562,21 @@ #define LV_THEME_DEFAULT_DARK 0 /*1: Enable grow on press*/ - #define LV_THEME_DEFAULT_GROW 0 + #define LV_THEME_DEFAULT_GROW 1 /*Default transition time in [ms]*/ #define LV_THEME_DEFAULT_TRANSITION_TIME 80 #endif /*LV_USE_THEME_DEFAULT*/ /*A very simple theme that is a good starting point for a custom theme*/ -#define LV_USE_THEME_BASIC 1 +#define LV_USE_THEME_SIMPLE 1 /*A theme designed for monochrome displays*/ #define LV_USE_THEME_MONO 1 -/*----------- - * Layouts - *----------*/ +/*================== + * LAYOUTS + *==================*/ /*A layout similar to Flexbox in CSS.*/ #define LV_USE_FLEX 1 @@ -591,16 +584,16 @@ /*A layout similar to Grid in CSS.*/ #define LV_USE_GRID 1 -/*--------------------- - * 3rd party libraries - *--------------------*/ +/*==================== + * 3RD PARTS LIBRARIES + *====================*/ /*File system interfaces for common APIs */ /*API for fopen, fread, etc*/ -#define LV_USE_FS_STDIO 0 +#define LV_USE_FS_STDIO 1 #if LV_USE_FS_STDIO - #define LV_FS_STDIO_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ + #define LV_FS_STDIO_LETTER 'A' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ #define LV_FS_STDIO_PATH "" /*Set the working directory. File/directory paths will be appended to it.*/ #define LV_FS_STDIO_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/ #endif @@ -628,42 +621,88 @@ #define LV_FS_FATFS_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/ #endif -/*PNG decoder library*/ -#define LV_USE_PNG 0 +/*API for memory-mapped file access. */ +#define LV_USE_FS_MEMFS 1 +#if LV_USE_FS_MEMFS + #define LV_FS_MEMFS_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ +#endif + +/*LODEPNG decoder library*/ +#define LV_USE_LODEPNG 1 + +/*PNG decoder(libpng) library*/ +#define LV_USE_LIBPNG 0 /*BMP decoder library*/ #define LV_USE_BMP 0 /* JPG + split JPG decoder library. * Split JPG is a custom format optimized for embedded systems. */ -#define LV_USE_SJPG 0 +#define LV_USE_TJPGD 1 + +/* libjpeg-turbo decoder library. + * Supports complete JPEG specifications and high-performance JPEG decoding. */ +#define LV_USE_LIBJPEG_TURBO 0 /*GIF decoder library*/ -#define LV_USE_GIF 0 +#define LV_USE_GIF 1 +#if LV_USE_GIF +/*GIF decoder accelerate*/ +#define LV_GIF_CACHE_DECODE_DATA 0 +#endif + + +/*Decode bin images to RAM*/ +#define LV_BIN_DECODER_RAM_LOAD 0 + +/*RLE decompress library*/ +#define LV_USE_RLE 1 /*QR code library*/ -#define LV_USE_QRCODE 0 +#define LV_USE_QRCODE 1 + +/*Barcode code library*/ +#define LV_USE_BARCODE 1 /*FreeType library*/ #define LV_USE_FREETYPE 0 #if LV_USE_FREETYPE - /*Memory used by FreeType to cache characters [bytes] (-1: no caching)*/ - #define LV_FREETYPE_CACHE_SIZE (16 * 1024) - #if LV_FREETYPE_CACHE_SIZE >= 0 - /* 1: bitmap cache use the sbit cache, 0:bitmap cache use the image cache. */ - /* sbit cache:it is much more memory efficient for small bitmaps(font size < 256) */ - /* if font size >= 256, must be configured as image cache */ - #define LV_FREETYPE_SBIT_CACHE 0 - /* Maximum number of opened FT_Face/FT_Size objects managed by this cache instance. */ - /* (0:use system defaults) */ - #define LV_FREETYPE_CACHE_FT_FACES 0 - #define LV_FREETYPE_CACHE_FT_SIZES 0 - #endif + /*Let FreeType to use LVGL memory and file porting*/ + #define LV_FREETYPE_USE_LVGL_PORT 0 + + /*Cache count of the glyphs in FreeType. It means the number of glyphs that can be cached. + *The higher the value, the more memory will be used.*/ + #define LV_FREETYPE_CACHE_FT_GLYPH_CNT 256 +#endif + +/* Built-in TTF decoder */ +#define LV_USE_TINY_TTF 1 +#if LV_USE_TINY_TTF + /* Enable loading TTF data from files */ + #define LV_TINY_TTF_FILE_SUPPORT 0 #endif /*Rlottie library*/ #define LV_USE_RLOTTIE 0 +/*Enable Vector Graphic APIs*/ +#define LV_USE_VECTOR_GRAPHIC 0 + +/* Enable ThorVG (vector graphics library) from the src/libs folder */ +#define LV_USE_THORVG_INTERNAL 0 + +/* Enable ThorVG by assuming that its installed and linked to the project */ +#define LV_USE_THORVG_EXTERNAL 0 + +/*Enable LZ4 compress/decompress lib*/ +#define LV_USE_LZ4 0 + +/*Use lvgl built-in LZ4 lib*/ +#define LV_USE_LZ4_INTERNAL 0 + +/*Use external LZ4 library*/ +#define LV_USE_LZ4_EXTERNAL 0 + /*FFmpeg library for image decoding and playing videos *Supports all major image formats so do not enable other image decoder with it*/ #define LV_USE_FFMPEG 0 @@ -672,31 +711,82 @@ #define LV_FFMPEG_DUMP_FORMAT 0 #endif -/*----------- - * Others - *----------*/ +/*================== + * OTHERS + *==================*/ /*1: Enable API to take snapshot for object*/ -#define LV_USE_SNAPSHOT 0 +#define LV_USE_SNAPSHOT 1 + +/*1: Enable system monitor component*/ +#define LV_USE_SYSMON 1 + +#if LV_USE_SYSMON + + /*1: Show CPU usage and FPS count + * Requires `LV_USE_SYSMON = 1`*/ + #define LV_USE_PERF_MONITOR 1 + #if LV_USE_PERF_MONITOR + #define LV_USE_PERF_MONITOR_POS LV_ALIGN_BOTTOM_RIGHT + + /*0: Displays performance data on the screen, 1: Prints performance data using log.*/ + #define LV_USE_PERF_MONITOR_LOG_MODE 0 + #endif + + /*1: Show the used memory and the memory fragmentation + * Requires `LV_USE_BUILTIN_MALLOC = 1` + * Requires `LV_USE_SYSMON = 1`*/ + #define LV_USE_MEM_MONITOR 1 + #if LV_USE_MEM_MONITOR + #define LV_USE_MEM_MONITOR_POS LV_ALIGN_BOTTOM_LEFT + #endif + +#endif /*LV_USE_SYSMON*/ + +/*1: Enable the runtime performance profiler*/ +#define LV_USE_PROFILER 0 +#if LV_USE_PROFILER + /*1: Enable the built-in profiler*/ + #define LV_USE_PROFILER_BUILTIN 1 + #if LV_USE_PROFILER_BUILTIN + /*Default profiler trace buffer size*/ + #define LV_PROFILER_BUILTIN_BUF_SIZE (16 * 1024) /*[bytes]*/ + #endif + + /*Header to include for the profiler*/ + #define LV_PROFILER_INCLUDE "lvgl/src/misc/lv_profiler_builtin.h" + + /*Profiler start point function*/ + #define LV_PROFILER_BEGIN LV_PROFILER_BUILTIN_BEGIN + + /*Profiler end point function*/ + #define LV_PROFILER_END LV_PROFILER_BUILTIN_END + + /*Profiler start point function with custom tag*/ + #define LV_PROFILER_BEGIN_TAG LV_PROFILER_BUILTIN_BEGIN_TAG + + /*Profiler end point function with custom tag*/ + #define LV_PROFILER_END_TAG LV_PROFILER_BUILTIN_END_TAG +#endif /*1: Enable Monkey test*/ -#define LV_USE_MONKEY 0 +#define LV_USE_MONKEY 1 /*1: Enable grid navigation*/ -#define LV_USE_GRIDNAV 0 +#define LV_USE_GRIDNAV 1 /*1: Enable lv_obj fragment*/ -#define LV_USE_FRAGMENT 0 +#define LV_USE_FRAGMENT 1 /*1: Support using images as font in label or span widgets */ -#define LV_USE_IMGFONT 0 +#define LV_USE_IMGFONT 1 -/*1: Enable a published subscriber based messaging system */ -#define LV_USE_MSG 0 +/*1: Enable an observer pattern implementation*/ +#define LV_USE_OBSERVER 1 /*1: Enable Pinyin input method*/ /*Requires: lv_keyboard*/ -#define LV_USE_IME_PINYIN 0 +#define LV_USE_IME_PINYIN 1 #if LV_USE_IME_PINYIN /*1: Use default thesaurus*/ /*If you do not use the default thesaurus, be sure to use `lv_ime_pinyin` after setting the thesauruss*/ @@ -709,9 +799,95 @@ #define LV_IME_PINYIN_USE_K9_MODE 1 #if LV_IME_PINYIN_USE_K9_MODE == 1 #define LV_IME_PINYIN_K9_CAND_TEXT_NUM 3 - #endif // LV_IME_PINYIN_USE_K9_MODE + #endif /*LV_IME_PINYIN_USE_K9_MODE*/ +#endif + +/*1: Enable file explorer*/ +/*Requires: lv_table*/ +#define LV_USE_FILE_EXPLORER 1 +#if LV_USE_FILE_EXPLORER + /*Maximum length of path*/ + #define LV_FILE_EXPLORER_PATH_MAX_LEN (128) + /*Quick access bar, 1:use, 0:not use*/ + /*Requires: lv_list*/ + #define LV_FILE_EXPLORER_QUICK_ACCESS 1 +#endif + +/*================== + * DEVICES + *==================*/ + +/*Use SDL to open window on PC and handle mouse and keyboard*/ +#define LV_USE_SDL 0 +#if LV_USE_SDL + #define LV_SDL_INCLUDE_PATH + #define LV_SDL_RENDER_MODE LV_DISPLAY_RENDER_MODE_DIRECT /*LV_DISPLAY_RENDER_MODE_DIRECT is recommended for best performance*/ + #define LV_SDL_BUF_COUNT 1 /*1 or 2*/ + #define LV_SDL_FULLSCREEN 0 /*1: Make the window full screen by default*/ + #define LV_SDL_DIRECT_EXIT 1 /*1: Exit the application when all SDL windows are closed*/ +#endif + +/*Use X11 to open window on Linux desktop and handle mouse and keyboard*/ +#define LV_USE_X11 0 +#if LV_USE_X11 + #define LV_X11_DIRECT_EXIT 1 /*Exit the application when all X11 windows have been closed*/ + #define LV_X11_DOUBLE_BUFFER 1 /*Use double buffers for endering*/ + /*select only 1 of the following render modes (LV_X11_RENDER_MODE_PARTIAL preferred!)*/ + #define LV_X11_RENDER_MODE_PARTIAL 1 /*Partial render mode (preferred)*/ + #define LV_X11_RENDER_MODE_DIRECT 0 /*direct render mode*/ + #define LV_X11_RENDER_MODE_FULL 0 /*Full render mode*/ +#endif + +/*Driver for /dev/fb*/ +#define LV_USE_LINUX_FBDEV 0 +#if LV_USE_LINUX_FBDEV + #define LV_LINUX_FBDEV_BSD 0 + #define LV_LINUX_FBDEV_RENDER_MODE LV_DISPLAY_RENDER_MODE_PARTIAL + #define LV_LINUX_FBDEV_BUFFER_COUNT 0 + #define LV_LINUX_FBDEV_BUFFER_SIZE 60 +#endif + +/*Use Nuttx to open window and handle touchscreen*/ +#define LV_USE_NUTTX 0 + +#if LV_USE_NUTTX + #define LV_USE_NUTTX_LIBUV 0 + + /*Use Nuttx custom init API to open window and handle touchscreen*/ + #define LV_USE_NUTTX_CUSTOM_INIT 0 + + /*Driver for /dev/lcd*/ + #define LV_USE_NUTTX_LCD 0 + #if LV_USE_NUTTX_LCD + #define LV_NUTTX_LCD_BUFFER_COUNT 0 + #define LV_NUTTX_LCD_BUFFER_SIZE 60 + #endif + + /*Driver for /dev/input*/ + #define LV_USE_NUTTX_TOUCHSCREEN 0 + #endif +/*Driver for /dev/dri/card*/ +#define LV_USE_LINUX_DRM 0 + +/*Interface for TFT_eSPI*/ +#define LV_USE_TFT_ESPI 0 + +/*Driver for evdev input devices*/ +#define LV_USE_EVDEV 0 + +/*Drivers for LCD devices connected via SPI/parallel port*/ +#define LV_USE_ST7735 0 +#define LV_USE_ST7789 0 +#define LV_USE_ST7796 0 +#define LV_USE_ILI9341 0 + +#define LV_USE_GENERIC_MIPI (LV_USE_ST7735 | LV_USE_ST7789 | LV_USE_ST7796 | LV_USE_ILI9341) + +/* LVGL Windows backend */ +#define LV_USE_WINDOWS 0 + /*================== * EXAMPLES *==================*/ @@ -724,23 +900,19 @@ ====================*/ /*Show some widget. It might be required to increase `LV_MEM_SIZE` */ -#define LV_USE_DEMO_WIDGETS 0 -#if LV_USE_DEMO_WIDGETS -#define LV_DEMO_WIDGETS_SLIDESHOW 0 -#endif +#define LV_USE_DEMO_WIDGETS 1 /*Demonstrate the usage of encoder and keyboard*/ -#define LV_USE_DEMO_KEYPAD_AND_ENCODER 0 +#define LV_USE_DEMO_KEYPAD_AND_ENCODER 1 /*Benchmark your system*/ -#define LV_USE_DEMO_BENCHMARK 0 -#if LV_USE_DEMO_BENCHMARK -/*Use RGB565A8 images with 16 bit color depth instead of ARGB8565*/ -#define LV_DEMO_BENCHMARK_RGB565A8 0 -#endif +#define LV_USE_DEMO_BENCHMARK 1 + +/*Render test for each primitives. Requires at least 480x272 display*/ +#define LV_USE_DEMO_RENDER 1 /*Stress test for LVGL*/ -#define LV_USE_DEMO_STRESS 0 +#define LV_USE_DEMO_STRESS 1 /*Music player demo*/ #define LV_USE_DEMO_MUSIC 0 @@ -752,6 +924,20 @@ #define LV_DEMO_MUSIC_AUTO_PLAY 0 #endif +/*Flex layout demo*/ +#define LV_USE_DEMO_FLEX_LAYOUT 1 + +/*Smart-phone like multi-language demo*/ +#define LV_USE_DEMO_MULTILANG 1 + +/*Widget transformation demo*/ +#define LV_USE_DEMO_TRANSFORM 1 + +/*Demonstrate scroll settings*/ +#define LV_USE_DEMO_SCROLL 1 + +/*Vector graphic demo*/ +#define LV_USE_DEMO_VECTOR_GRAPHIC 0 /*--END OF LV_CONF_H--*/ #endif /*LV_CONF_H*/ From 06f0f359b5c604dcaaa50ca1f63e0ca0f842d38e Mon Sep 17 00:00:00 2001 From: Rene Date: Mon, 17 Jun 2024 14:20:46 +0000 Subject: [PATCH 02/21] Minor refactoring --- src/esp32_smartdisplay.c | 50 +++++------------------------------- src/lvgl_panel_gc9a01_spi.c | 2 +- src/lvgl_panel_ili9341_spi.c | 2 +- src/lvgl_panel_st7262_par.c | 2 +- src/lvgl_panel_st7701_par.c | 2 +- src/lvgl_panel_st7789_i80.c | 4 +-- src/lvgl_panel_st7796_spi.c | 2 +- 7 files changed, 13 insertions(+), 51 deletions(-) diff --git a/src/esp32_smartdisplay.c b/src/esp32_smartdisplay.c index d05e57a..67c701a 100644 --- a/src/esp32_smartdisplay.c +++ b/src/esp32_smartdisplay.c @@ -40,8 +40,6 @@ void lvgl_log(lv_log_level_t level, const char *buf) case LV_LOG_LEVEL_ERROR: log_e("%s", buf); break; - case LV_LOG_LEVEL_USER: - break; } } #endif @@ -51,9 +49,9 @@ void smartdisplay_lcd_set_backlight(float duty) { log_v("duty:%2f", duty); - if (duty > 1.0) + if (duty > 1.0f) duty = 1.0f; - if (duty < 0.0) + if (duty < 0.0f) duty = 0.0f; #if ESP_ARDUINO_VERSION_MAJOR >= 3 ledcWrite(GPIO_BCKL, duty * PWM_MAX_BCKL); @@ -91,7 +89,7 @@ void adaptive_brightness(lv_timer_t *timer) void smartdisplay_lcd_set_brightness_cb(smartdisplay_lcd_adaptive_brightness_cb_t cb, uint interval) { - log_v("adaptive_brightness_cb:0x%08x, interval:%d", cb, interval); + log_v("adaptive_brightness_cb:0x%08x, interval:%u", cb, interval); // Delete current timer if any if (update_brightness_timer) @@ -154,39 +152,6 @@ touch_calibration_data_t smartdisplay_compute_touch_calibration(const lv_point_t }; #endif -/* -// Called when driver parameters are updated (rotation) -// Top of the display is top left when connector is at the bottom -// The rotation values are relative to how you would rotate the physical display in the clockwise direction. -// Thus, LV_DISP_ROT_90 means you rotate the hardware 90 degrees clockwise, and the display rotates 90 degrees counterclockwise to compensate. -void lvgl_update_callback(lv_disp_drv_t *drv) -{ - if (drv->sw_rotate == false) - { - const esp_lcd_panel_handle_t panel_handle = disp_drv.user_data; - switch (drv->rotated) - { - case LV_DISP_ROT_NONE: - ESP_ERROR_CHECK(esp_lcd_panel_swap_xy(panel_handle, DISPLAY_SWAP_XY)); - ESP_ERROR_CHECK(esp_lcd_panel_mirror(panel_handle, DISPLAY_MIRROR_X, DISPLAY_MIRROR_Y)); - break; - case LV_DISP_ROT_90: - ESP_ERROR_CHECK(esp_lcd_panel_swap_xy(panel_handle, !DISPLAY_SWAP_XY)); - ESP_ERROR_CHECK(esp_lcd_panel_mirror(panel_handle, DISPLAY_MIRROR_X, !DISPLAY_MIRROR_Y)); - break; - case LV_DISP_ROT_180: - ESP_ERROR_CHECK(esp_lcd_panel_swap_xy(panel_handle, DISPLAY_SWAP_XY)); - ESP_ERROR_CHECK(esp_lcd_panel_mirror(panel_handle, !DISPLAY_MIRROR_X, !DISPLAY_MIRROR_Y)); - break; - case LV_DISP_ROT_270: - ESP_ERROR_CHECK(esp_lcd_panel_swap_xy(panel_handle, !DISPLAY_SWAP_XY)); - ESP_ERROR_CHECK(esp_lcd_panel_mirror(panel_handle, !DISPLAY_MIRROR_X, DISPLAY_MIRROR_Y)); - break; - } - } -} -*/ - void smartdisplay_init() { log_d("smartdisplay_init"); @@ -227,12 +192,9 @@ void smartdisplay_init() // Setup TFT display display = lvgl_lcd_init(DISPLAY_WIDTH, DISPLAY_HEIGHT); // Create drawBuffer - uint32_t dreawBufferSize = sizeof(lv_color_t) * LVGL_BUFFER_PIXELS; - void *drawBuffer = heap_caps_malloc(dreawBufferSize, LVGL_BUFFER_MALLOC_FLAGS); - lv_display_set_buffers(display, drawBuffer, NULL, dreawBufferSize, LV_DISPLAY_RENDER_MODE_PARTIAL); - // Register callback for changes to the driver parameters (rotation!) - // display->drv_update_cb = lvgl_update_callback; - // Initialize specific driver + uint32_t drawBufferSize = sizeof(lv_color_t) * LVGL_BUFFER_PIXELS; + void *drawBuffer = heap_caps_malloc(drawBufferSize, LVGL_BUFFER_MALLOC_FLAGS); + lv_display_set_buffers(display, drawBuffer, NULL, drawBufferSize, LV_DISPLAY_RENDER_MODE_PARTIAL); // Clear screen lv_obj_clean(lv_scr_act()); // Turn backlight on (50%) diff --git a/src/lvgl_panel_gc9a01_spi.c b/src/lvgl_panel_gc9a01_spi.c index 4a4e8be..400089b 100644 --- a/src/lvgl_panel_gc9a01_spi.c +++ b/src/lvgl_panel_gc9a01_spi.c @@ -11,7 +11,7 @@ bool gc9a01_color_trans_done(esp_lcd_panel_io_handle_t panel_io_handle, esp_lcd_ log_v("panel_io_handle:0x%08x, panel_io_event_data:%0x%08x, user_ctx:0x%08x", panel_io_handle, panel_io_event_data, user_ctx); lv_display_t *display = user_ctx; - lv_disp_flush_ready(display); + lv_display_flush_ready(display); return false; } diff --git a/src/lvgl_panel_ili9341_spi.c b/src/lvgl_panel_ili9341_spi.c index 5a14f43..5643d23 100644 --- a/src/lvgl_panel_ili9341_spi.c +++ b/src/lvgl_panel_ili9341_spi.c @@ -9,7 +9,7 @@ bool ili9341_color_trans_done(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_io_event_data_t *edata, void *user_ctx) { lv_display_t *display = user_ctx; - lv_disp_flush_ready(display); + lv_display_flush_ready(display); return false; } diff --git a/src/lvgl_panel_st7262_par.c b/src/lvgl_panel_st7262_par.c index ac31517..563c63f 100644 --- a/src/lvgl_panel_st7262_par.c +++ b/src/lvgl_panel_st7262_par.c @@ -7,7 +7,7 @@ bool direct_io_frame_trans_done(esp_lcd_panel_handle_t panel, esp_lcd_rgb_panel_event_data_t *edata, void *user_ctx) { lv_display_t *display = user_ctx; - lv_disp_flush_ready(display); + lv_display_flush_ready(display); return false; } diff --git a/src/lvgl_panel_st7701_par.c b/src/lvgl_panel_st7701_par.c index 1aea3b0..f4057e0 100644 --- a/src/lvgl_panel_st7701_par.c +++ b/src/lvgl_panel_st7701_par.c @@ -9,7 +9,7 @@ bool direct_io_frame_trans_done(esp_lcd_panel_handle_t panel, esp_lcd_rgb_panel_event_data_t *edata, void *user_ctx) { lv_display_t *display = user_ctx; - lv_disp_flush_ready(display); + lv_display_flush_ready(display); return false; } diff --git a/src/lvgl_panel_st7789_i80.c b/src/lvgl_panel_st7789_i80.c index f4e2fa5..5ed4352 100644 --- a/src/lvgl_panel_st7789_i80.c +++ b/src/lvgl_panel_st7789_i80.c @@ -7,8 +7,8 @@ bool st7789_color_trans_done(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_io_event_data_t *edata, void *user_ctx) { - lv_display_t *display = user_ctx; - lv_disp_flush_ready(display); + lv_display_t *display = user_ctx; + lv_display_flush_ready(display); return false; } diff --git a/src/lvgl_panel_st7796_spi.c b/src/lvgl_panel_st7796_spi.c index 104993a..e0fdda1 100644 --- a/src/lvgl_panel_st7796_spi.c +++ b/src/lvgl_panel_st7796_spi.c @@ -10,7 +10,7 @@ bool st7796_color_trans_done(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_io_event_data_t *edata, void *user_ctx) { lv_display_t *display = user_ctx; - lv_disp_flush_ready(display); + lv_display_flush_ready(display); return false; } From ad3cceaf097afa7353105c6e40350ee9f5fd40eb Mon Sep 17 00:00:00 2001 From: Rene Date: Thu, 20 Jun 2024 12:02:40 +0200 Subject: [PATCH 03/21] Update esp32_smartdisplay.c --- src/esp32_smartdisplay.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/esp32_smartdisplay.c b/src/esp32_smartdisplay.c index 67c701a..40e457c 100644 --- a/src/esp32_smartdisplay.c +++ b/src/esp32_smartdisplay.c @@ -208,5 +208,6 @@ void smartdisplay_init() // Intercept callback driver_touch_read_cb = indev->read_cb; indev->read_cb = lvgl_touch_calibration_transform; + lv_indev_enable(indev, true); #endif -} \ No newline at end of file +} From a82e3e56ab0811a12029ca4f52c957dcd5f0e80e Mon Sep 17 00:00:00 2001 From: Rene Zeldenthuis Date: Thu, 20 Jun 2024 23:44:33 +0200 Subject: [PATCH 04/21] Added callback for rotation --- README.md | 16 +++++++++------- src/esp32_smartdisplay.c | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 01cfe75..4a41ace 100644 --- a/README.md +++ b/README.md @@ -223,10 +223,10 @@ void setup() { smartdisplay_init(); - auto disp = lv_disp_get_default(); - // lv_disp_set_rotation(disp, LV_DISP_ROT_90); - // lv_disp_set_rotation(disp, LV_DISP_ROT_180); - // lv_disp_set_rotation(disp, LV_DISP_ROT_270); + auto disp = lv_display_get_default(); + // lv_display_set_rotation(disp, LV_DISP_ROT_90); + // lv_display_set_rotation(disp, LV_DISP_ROT_180); + // lv_display_set_rotation(disp, LV_DISP_ROT_270); } ``` @@ -372,11 +372,11 @@ From the LVGL documentation: *The rotation values are relative to how you would rotate the physical display in the clockwise direction. Thus, LV_DISP_ROT_90 means you rotate the hardware 90 degrees clockwise, and the display rotates 90 degrees counterclockwise to compensate.* -Rotating is done calling the ```lv_disp_set_rotation``` function in the LVGL library with the rotation: +Rotating is done calling the ```lv_display_set_rotation``` function in the LVGL library with the rotation: ```c++ - auto disp = lv_disp_get_default(); - lv_disp_set_rotation(disp, LV_DISP_ROT_90); + auto disp = lv_display_get_default(); + lv_display_set_rotation(disp, LV_DISPLAY_ROTATION_90); ``` Some boards are around that have flipped screens, this is probably due to differences during tha manufacturing or using different TFTs. It is possible to correct these boards overriding the default defines. @@ -562,6 +562,8 @@ The following libraries are used from the [Espressif component registry](https:/ ## Version history +- June 2024 + - LVGL 9.1 - March 2024 - Rewrote drivers for devices and made them cleaner - More parametrization diff --git a/src/esp32_smartdisplay.c b/src/esp32_smartdisplay.c index 40e457c..75f7fcc 100644 --- a/src/esp32_smartdisplay.c +++ b/src/esp32_smartdisplay.c @@ -21,6 +21,8 @@ touch_calibration_data_t touch_calibration_data; void (*driver_touch_read_cb)(lv_indev_t *indev, lv_indev_data_t *data); #endif +void lvgl_display_resolution_changed_callback(lv_event_t *drv); + lv_timer_t *update_brightness_timer; #ifdef LV_USE_LOG @@ -195,6 +197,8 @@ void smartdisplay_init() uint32_t drawBufferSize = sizeof(lv_color_t) * LVGL_BUFFER_PIXELS; void *drawBuffer = heap_caps_malloc(drawBufferSize, LVGL_BUFFER_MALLOC_FLAGS); lv_display_set_buffers(display, drawBuffer, NULL, drawBufferSize, LV_DISPLAY_RENDER_MODE_PARTIAL); + // Register callback for hardware rotation + lv_display_add_event_cb(display, lvgl_display_resolution_changed_callback, LV_EVENT_RESOLUTION_CHANGED, NULL); // Clear screen lv_obj_clean(lv_scr_act()); // Turn backlight on (50%) @@ -211,3 +215,34 @@ void smartdisplay_init() lv_indev_enable(indev, true); #endif } + +// Called when driver resolution is updated (including rotation) +// Top of the display is top left when connector is at the bottom +// The rotation values are relative to how you would rotate the physical display in the clockwise direction. +// Thus, LV_DISPLAY_ROTATION_90 means you rotate the hardware 90 degrees clockwise, and the display rotates 90 degrees counterclockwise to compensate. +void lvgl_display_resolution_changed_callback(lv_event_t *event) +{ + if (!display->sw_rotate) + { + const esp_lcd_panel_handle_t panel_handle = display->user_data; + switch (display->rotation) + { + case LV_DISPLAY_ROTATION_0: + ESP_ERROR_CHECK(esp_lcd_panel_swap_xy(panel_handle, DISPLAY_SWAP_XY)); + ESP_ERROR_CHECK(esp_lcd_panel_mirror(panel_handle, DISPLAY_MIRROR_X, DISPLAY_MIRROR_Y)); + break; + case LV_DISPLAY_ROTATION_90: + ESP_ERROR_CHECK(esp_lcd_panel_swap_xy(panel_handle, !DISPLAY_SWAP_XY)); + ESP_ERROR_CHECK(esp_lcd_panel_mirror(panel_handle, DISPLAY_MIRROR_X, !DISPLAY_MIRROR_Y)); + break; + case LV_DISPLAY_ROTATION_180: + ESP_ERROR_CHECK(esp_lcd_panel_swap_xy(panel_handle, DISPLAY_SWAP_XY)); + ESP_ERROR_CHECK(esp_lcd_panel_mirror(panel_handle, !DISPLAY_MIRROR_X, !DISPLAY_MIRROR_Y)); + break; + case LV_DISPLAY_ROTATION_270: + ESP_ERROR_CHECK(esp_lcd_panel_swap_xy(panel_handle, !DISPLAY_SWAP_XY)); + ESP_ERROR_CHECK(esp_lcd_panel_mirror(panel_handle, !DISPLAY_MIRROR_X, DISPLAY_MIRROR_Y)); + break; + } + } +} \ No newline at end of file From 1ba849332cdecd27316de519db2baa6fa057bf3f Mon Sep 17 00:00:00 2001 From: Rene Zeldenthuis Date: Thu, 20 Jun 2024 23:45:08 +0200 Subject: [PATCH 05/21] UPdated documentation --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 4a41ace..f17d759 100644 --- a/README.md +++ b/README.md @@ -383,14 +383,14 @@ Some boards are around that have flipped screens, this is probably due to differ To adjust the display and touch to the default (LV_DISP_ROT_NONE) there are 6 defines in the boards definition: -| Name | Description | -|--- |--- | -| DISPLAY_SWAP_XY | Swaps the X and Y coordinates for the display | -| DISPLAY_MIRROR_X | Mirrors the X coordinate for the display | -| DISPLAY_MIRROR_Y | Mirrors the Y coordinate for the display | -| TOUCH_SWAP_XY | Swaps the X and Y coordinates for the touch | -| TOUCH_MIRROR_X | Mirrors the X coordinate for the touch | -| TOUCH_MIRROR_Y | Mirrors the Y coordinate for the touch | +| Name | Description | +|--- |--- | +| DISPLAY_SWAP_XY | Swaps the X and Y coordinates for the display | +| DISPLAY_MIRROR_X | Mirrors the X coordinate for the display | +| DISPLAY_MIRROR_Y | Mirrors the Y coordinate for the display | +| TOUCH_SWAP_XY | Swaps the X and Y coordinates for the touch | +| TOUCH_MIRROR_X | Mirrors the X coordinate for the touch | +| TOUCH_MIRROR_Y | Mirrors the Y coordinate for the touch | ## Appendix: Template to support ALL the boards From 31798f23264ab1004cc3360e1263798518f9406f Mon Sep 17 00:00:00 2001 From: Rene Zeldenthuis Date: Fri, 21 Jun 2024 00:12:25 +0200 Subject: [PATCH 06/21] Update h/v res after rotation --- src/esp32_smartdisplay.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/esp32_smartdisplay.c b/src/esp32_smartdisplay.c index 75f7fcc..3a78dda 100644 --- a/src/esp32_smartdisplay.c +++ b/src/esp32_smartdisplay.c @@ -230,18 +230,26 @@ void lvgl_display_resolution_changed_callback(lv_event_t *event) case LV_DISPLAY_ROTATION_0: ESP_ERROR_CHECK(esp_lcd_panel_swap_xy(panel_handle, DISPLAY_SWAP_XY)); ESP_ERROR_CHECK(esp_lcd_panel_mirror(panel_handle, DISPLAY_MIRROR_X, DISPLAY_MIRROR_Y)); + display->hor_res = DISPLAY_WIDTH; + display->ver_res = DISPLAY_HEIGHT; break; case LV_DISPLAY_ROTATION_90: ESP_ERROR_CHECK(esp_lcd_panel_swap_xy(panel_handle, !DISPLAY_SWAP_XY)); ESP_ERROR_CHECK(esp_lcd_panel_mirror(panel_handle, DISPLAY_MIRROR_X, !DISPLAY_MIRROR_Y)); + display->hor_res = DISPLAY_HEIGHT; + display->ver_res = DISPLAY_WIDTH; break; case LV_DISPLAY_ROTATION_180: ESP_ERROR_CHECK(esp_lcd_panel_swap_xy(panel_handle, DISPLAY_SWAP_XY)); ESP_ERROR_CHECK(esp_lcd_panel_mirror(panel_handle, !DISPLAY_MIRROR_X, !DISPLAY_MIRROR_Y)); + display->hor_res = DISPLAY_WIDTH; + display->ver_res = DISPLAY_HEIGHT; break; case LV_DISPLAY_ROTATION_270: ESP_ERROR_CHECK(esp_lcd_panel_swap_xy(panel_handle, !DISPLAY_SWAP_XY)); ESP_ERROR_CHECK(esp_lcd_panel_mirror(panel_handle, !DISPLAY_MIRROR_X, DISPLAY_MIRROR_Y)); + display->hor_res = DISPLAY_HEIGHT; + display->ver_res = DISPLAY_WIDTH; break; } } From e05d69d9081bbb12f9676b28083477e880f075af Mon Sep 17 00:00:00 2001 From: Rene Zeldenthuis Date: Fri, 21 Jun 2024 00:16:16 +0200 Subject: [PATCH 07/21] Undo update of resolution --- src/esp32_smartdisplay.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/esp32_smartdisplay.c b/src/esp32_smartdisplay.c index 3a78dda..75f7fcc 100644 --- a/src/esp32_smartdisplay.c +++ b/src/esp32_smartdisplay.c @@ -230,26 +230,18 @@ void lvgl_display_resolution_changed_callback(lv_event_t *event) case LV_DISPLAY_ROTATION_0: ESP_ERROR_CHECK(esp_lcd_panel_swap_xy(panel_handle, DISPLAY_SWAP_XY)); ESP_ERROR_CHECK(esp_lcd_panel_mirror(panel_handle, DISPLAY_MIRROR_X, DISPLAY_MIRROR_Y)); - display->hor_res = DISPLAY_WIDTH; - display->ver_res = DISPLAY_HEIGHT; break; case LV_DISPLAY_ROTATION_90: ESP_ERROR_CHECK(esp_lcd_panel_swap_xy(panel_handle, !DISPLAY_SWAP_XY)); ESP_ERROR_CHECK(esp_lcd_panel_mirror(panel_handle, DISPLAY_MIRROR_X, !DISPLAY_MIRROR_Y)); - display->hor_res = DISPLAY_HEIGHT; - display->ver_res = DISPLAY_WIDTH; break; case LV_DISPLAY_ROTATION_180: ESP_ERROR_CHECK(esp_lcd_panel_swap_xy(panel_handle, DISPLAY_SWAP_XY)); ESP_ERROR_CHECK(esp_lcd_panel_mirror(panel_handle, !DISPLAY_MIRROR_X, !DISPLAY_MIRROR_Y)); - display->hor_res = DISPLAY_WIDTH; - display->ver_res = DISPLAY_HEIGHT; break; case LV_DISPLAY_ROTATION_270: ESP_ERROR_CHECK(esp_lcd_panel_swap_xy(panel_handle, !DISPLAY_SWAP_XY)); ESP_ERROR_CHECK(esp_lcd_panel_mirror(panel_handle, !DISPLAY_MIRROR_X, DISPLAY_MIRROR_Y)); - display->hor_res = DISPLAY_HEIGHT; - display->ver_res = DISPLAY_WIDTH; break; } } From ba66bb10d39fe0946c47d52af521f48aeb272a25 Mon Sep 17 00:00:00 2001 From: Rene Zeldenthuis Date: Fri, 21 Jun 2024 00:44:40 +0200 Subject: [PATCH 08/21] UPdated documentation --- README.md | 196 +++++++++++++++++++++++++++--------------------------- 1 file changed, 98 insertions(+), 98 deletions(-) diff --git a/README.md b/README.md index f17d759..7ac9924 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Currently this library supports the following boards: - ESP32-2432S032 N/R/C - ESP32-3248S035 R/C - ESP32-4827S043 R/C -- ESP32-4848S040C _I_Y_1/3 +- ESP32-4848S040C \_I_Y_1/3 - ESP32-8048S050 N/C/R - ESP32-8048S070 N/C/R @@ -50,8 +50,8 @@ This library depends on: - [LVGL](https://registry.platformio.org/libraries/lvgl/lvgl), currently version 8.3.9 - [platformio-espressif32-sunton](https://github.com/rzeldent/platformio-espressif32-sunton) ->[!NOTE] ->This library uses the "official" drivers from Espressif's component service. These drivers use the newly introduced esp_lcd_panel interfaces. This should provide some support in the future for updates and new boards. These drivers have already been copied and included to this library. +> [!NOTE] +> This library uses the "official" drivers from Espressif's component service. These drivers use the newly introduced esp_lcd_panel interfaces. This should provide some support in the future for updates and new boards. These drivers have already been copied and included to this library. ## How to use @@ -82,22 +82,22 @@ Make sure you have PlatformIO installed and functional. Follow the documentation ### Step 2: Boards definitions -The board definitions required for this library are defined in the boards library [platformio-espressif32-sunton](https://github.com/rzeldent/platformio-espressif32-sunton). This library must reside in the ```/boards``` directory so PlatformIo will automatically recognize these boards. +The board definitions required for this library are defined in the boards library [platformio-espressif32-sunton](https://github.com/rzeldent/platformio-espressif32-sunton). This library must reside in the `/boards` directory so PlatformIo will automatically recognize these boards. -**It is recommended to use ```git submodule``` to include these board definitions automatically.** +**It is recommended to use `git submodule` to include these board definitions automatically.** ->[!TIP] ->If you already have a project, clone it with the ```git clone --recurse-submodules```. If creating a new project, use ```git submodule add https://github.com/rzeldent/platformio-espressif32-sunton.git boards``` to add them to your project as a submodule. +> [!TIP] +> If you already have a project, clone it with the `git clone --recurse-submodules`. If creating a new project, use `git submodule add https://github.com/rzeldent/platformio-espressif32-sunton.git boards` to add them to your project as a submodule. ### Step 3: Create a new project Use the standard PlatformIO create project to start a new project. When using a new PlatformIO installation these boards, defined in [platformio-espressif32-sunton](https://github.com/rzeldent/platformio-espressif32-sunton), are not present. Just use a known ESP32 board and correct this later in the platformIO file. -Optionally, you can copy the boards definition to the ```/.platformio\platforms\espressif32\boards``` directory to have them always available but it is probably easier to create the project, add the boards as a git submodule and change the board afterwards. For each supported board there is a board definition. +Optionally, you can copy the boards definition to the `/.platformio\platforms\espressif32\boards` directory to have them always available but it is probably easier to create the project, add the boards as a git submodule and change the board afterwards. For each supported board there is a board definition. ### Step 4: Add this library to your project -To add this library (and its dependency on LVGL) add the following line to the ```platformio.ini``` file: +To add this library (and its dependency on LVGL) add the following line to the `platformio.ini` file: From the platformIO registry (version 2.0.x): @@ -115,15 +115,15 @@ This will automatically download the library, the LVGL library (as a dependency) ### Step 5: Create a settings file for LVGL -LVGL needs a configuration file; ```lv_conf.h```. This file contains information about the fonts, color depths, default background, styles, etc... -The default LVGL template can be found in the LVGL library at the location: ```lvgl/lv_conf_template.h```. -This file must be copied to the include directory and renamed to ```lvgl_conf.h```. Also the ``#if 0`` must be removed to enable the file to be included. +LVGL needs a configuration file; `lv_conf.h`. This file contains information about the fonts, color depths, default background, styles, etc... +The default LVGL template can be found in the LVGL library at the location: `lvgl/lv_conf_template.h`. +This file must be copied to the include directory and renamed to `lvgl_conf.h`. Also the `#if 0` must be removed to enable the file to be included. More information about setting up a project with LVGL can be obtained at [LVGL get-started/quick-overview](https://docs.lvgl.io/master/get-started/quick-overview.html#add-lvgl-into-your-project). -I suggest to put the ```lv_conf.h``` file in the include directory and set the build flags to specify the location of the file, see below. +I suggest to put the `lv_conf.h` file in the include directory and set the build flags to specify the location of the file, see below. ->[!TIP] ->LVGL can also be downloaded manually from: [https://github.com/lvgl/lvgl/archive/master.zip](https://github.com/lvgl/lvgl/archive/master.zip) to extract the template. ->The template can also be copied from the demo application. +> [!TIP] +> LVGL can also be downloaded manually from: [https://github.com/lvgl/lvgl/archive/master.zip](https://github.com/lvgl/lvgl/archive/master.zip) to extract the template. +> The template can also be copied from the demo application. Important settings are: @@ -134,22 +134,6 @@ Important settings are: #define LV_COLOR_DEPTH 16 ``` -- Because of the SPI interface, the bytes are sent in big endian format so this must be corrected. - The RGB panel interface takes care of this by swapping the GPIO lines but for the SPI controllers this is not optimal. More information about this can be found [below](#lv_color_16_swap). - - ```h - /*Swap the 2 bytes of RGB565 color. Useful if the display has an 8-bit interface (e.g. SPI)*/ - #define LV_COLOR_16_SWAP 1 - ``` - -- To have a time reference use the milliseconds reference for the Arduino - - ```h - /*Use a custom tick source that tells the elapsed time in milliseconds and enables this code.*/ - /*It removes the need to manually update the tick with `lv_tick_inc()`)*/ - #define LV_TICK_CUSTOM 1 - ``` - - For debugging, enable CPU usage, FPS (Frames per Second) and memory defragmentation ```h @@ -159,23 +143,52 @@ Important settings are: - (Optionally) Include additional fonts. + The font Montserrat 14pt is required. Other fonts can be included. + ```h - ... #define LV_FONT_MONTSERRAT_22 1 ... + ``` - Optionally, only enable widgets that are used to save on code - ```h - #define LV_USE_ARC 1 - #define LV_USE_BAR 1 - #define LV_USE_BTN 1 - #define LV_USE_BTNMATRIX 1 - ... - ``` +```h + #define LV_USE_ANIMIMG 1 + #define LV_USE_ARC 1 + #define LV_USE_ARC 1 + #define LV_USE_BAR 1 + #define LV_USE_BUTTON 1 + #define LV_USE_BUTTONMATRIX 1 + #define LV_USE_CALENDAR 1 + #define LV_USE_CANVAS 1 + #define LV_USE_CHART 1 + #define LV_USE_CHECKBOX 1 + #define LV_USE_DROPDOWN 1 /*Requires: lv_label*/ + #define LV_USE_IMAGE 1 /*Requires: lv_label*/ + #define LV_USE_IMAGEBUTTON 1 + #define LV_USE_KEYBOARD 1 + #define LV_USE_LABEL 1 + #define LV_USE_LED 1 + #define LV_USE_LINE 1 + #define LV_USE_LIST 1 + #define LV_USE_MENU 1 + #define LV_USE_MSGBOX 1 + #define LV_USE_ROLLER 1 /*Requires: lv_label*/ + #define LV_USE_SCALE 1 + #define LV_USE_SLIDER 1 /*Requires: lv_bar*/ + #define LV_USE_SPAN 1 + #define LV_USE_SPINBOX 1 + #define LV_USE_SPINNER 1 + #define LV_USE_SWITCH 1 + #define LV_USE_TEXTAREA 1 /*Requires: lv_label*/ + #define LV_USE_TABLE 1 + #define LV_USE_TABVIEW 1 + #define LV_USE_TILEVIEW 1 + #define LV_USE_WIN 1 +``` -For debugging it is possible to enable logging from LVGL. The library will output to the debugging output (using ```lv_log_register_print_cb```). +For debugging it is possible to enable logging from LVGL. The library will output to the debugging output (using `lv_log_register_print_cb`). To enable logging, set the define: ```h @@ -183,17 +196,17 @@ To enable logging, set the define: #define LV_USE_LOG 1 ``` -By default the logging is only ```LV_LOG_LEVEL_WARN``` but can be adjusted in the ```lv_conf.h```. +By default the logging is only `LV_LOG_LEVEL_WARN` but can be adjusted in the `lv_conf.h`. More information about the LVGL configuration can be found in the excellent [LVGL documentation](https://docs.lvgl.io/8.3/index.html). ->[!WARNING] ->After the library has been build, changes in the lv_conf.h are no longer applied because libraries are cached. ->To apply these settings, delete the ```.pio``` directory so the libraries will be rebuild. +> [!WARNING] +> After the library has been build, changes in the lv_conf.h are no longer applied because libraries are cached. +> To apply these settings, delete the `.pio` directory so the libraries will be rebuild. ### Step 6: Copy the build flags below in your project -Especially the definition of the LV_CONF_PATH is critical, this must point to an **absolute path** where the ```lv_conf.h``` file is located. More about this in the [section below](#more-on-lv_confh). +Especially the definition of the LV_CONF_PATH is critical, this must point to an **absolute path** where the `lv_conf.h` file is located. More about this in the [section below](#more-on-lv_confh). ```ini build_flags = @@ -216,26 +229,32 @@ The -Wall flag can also be removed but outputs all the warnings. ### Step 7: Initialize the display (and touch) in your project -To enable to display in your project call the void ```smartdisplay_init()``` function at startup and optionally set the orientation: +To enable to display in your project call the void `smartdisplay_init()` function at startup and optionally set the orientation: ```cpp void setup() { smartdisplay_init(); - auto disp = lv_display_get_default(); - // lv_display_set_rotation(disp, LV_DISP_ROT_90); - // lv_display_set_rotation(disp, LV_DISP_ROT_180); - // lv_display_set_rotation(disp, LV_DISP_ROT_270); + auto display = lv_display_get_default(); + // lv_display_set_rotation(display, LV_DISPLAY_ROTATION_90); + // lv_display_set_rotation(display, LV_DISPLAY_ROTATION_180); + // lv_display_set_rotation(display, LV_DISPLAY_ROTATION_270); } ``` -and update the timer (and drawing) in the loop: +and update tick update and drawing in the loop: ```cpp +auto lv_last_tick = millis(); + void loop() { - lv_timer_handler(); + // Update the ticker + lv_tick_inc(now - lv_last_tick); + lv_last_tick = now; + // Update the UI + lv_timer_handler(); } ``` @@ -248,7 +267,7 @@ There is a good UI designer available for LVGL and free (but some limitations) f This tool makes it easy to create transitions, insert images, attach events, work with round screens etc.. A big advantage is that the UI C-code is generated! SquareLine als provides drivers but only export the ui files! -In the project settings change the include ```lvgl/lvgl.h``` to ```lvgl.h```. +In the project settings change the include `lvgl/lvgl.h` to `lvgl.h`. ## Step 9: Compile, upload and enjoy @@ -275,26 +294,8 @@ To include it globally, the define must be (for the include directory): -D LV_CONF_PATH=${PROJECT_INCLUDE_DIR}/lv_conf.h ``` ->[!TIP] ->The template for the `lv_conf.h` file can be found in the LVGL library at `.pio/libdeps//lvgl/lv_conf_template.h`. - -## LV_COLOR_16_SWAP - -The LVGL library has a define called **LV_COLOR_16_SWAP** in the ```lvgl_conf.h```. The value can be 1 or 0. -This variable will swap the byte order of the lv_color16_t. This is required because the SPI is by default LSB first. - -Setting this variable to true is recommended for the SPI interfaces (GC9A01A, ST7789, ILI9341 and ST7796). If not, a warning will be issued but the code should work. The parallel 16 bits panels without interface are not affected by this; the GPIO pin layout will change accordingly. - -This makes it easier to have only one definition for lv_conf.h and SquareLine. - ->[!IMPORTANT] ->If this is not done, the code will run but swapping will be done runtime (degrading a bit the performance). ->So it is preferable to always set the LV_COLOR_16_SWAP to 1 when using SPI. - -Additionally, when using the [SquareLine Studio](https://squareline.io/) for designing the user interface, the display properties (under the project settings) must match this variable. -It needs to be set both in `lv_conf.h` configuration file and the corresponding display properties (16 bit swap) in [SquareLine Studio](https://squareline.io/). - -![SquareLine display properties](assets/images/Squareline-display-properties.png) +> [!TIP] +> The template for the `lv_conf.h` file can be found in the LVGL library at `.pio/libdeps//lvgl/lv_conf_template.h`. ## LVGL initialization Functions @@ -312,7 +313,7 @@ The range is from [0, 1] so 0 is off, 0.5 is half and 1 is full brightness. ### void smartdisplay_lcd_set_brightness_cb(smartdisplay_lcd_adaptive_brightness_cb_t cb, uint interval) -This function can be called to periodically call a user defined function to set the brightness of the display. If a NULL value is passed for the parameter ```cb``` the functionality is disabled and the display is set to 50% brightness. +This function can be called to periodically call a user defined function to set the brightness of the display. If a NULL value is passed for the parameter `cb` the functionality is disabled and the display is set to 50% brightness. The callback function must have the following format: @@ -324,7 +325,7 @@ float smartdisplay_lcd_adaptive_brightness_function)() } ``` -If the board has a CdS sensor, a callback is automatically provided. The callback can be set to the internal function ```smartdisplay_lcd_set_brightness_cb```. +If the board has a CdS sensor, a callback is automatically provided. The callback can be set to the internal function `smartdisplay_lcd_set_brightness_cb`. This function will adjust the brightness to the value read from the CdS sensor on the front of the display. So, to enable adaptive brightness using the CdS sensor, call @@ -343,7 +344,7 @@ A true value means: ON (LED is lit), false turns off the led. This function allows only 8 LED colors: | R | G | B | Color | -|--- |--- |--- |--- | +| --- | --- | --- | ------- | | 0 | 0 | 0 | Black | | 1 | 0 | 0 | Red | | 0 | 1 | 0 | Green | @@ -362,43 +363,42 @@ This data structure holds the calibration data for the touch display. If the val ### touch_calibration_data_t smartdisplay_compute_touch_calibration(const lv_point_t screen[3], const lv_point_t touch[3]) This function returns the calibration data based on 3 points. The screen array contains the (selected) calibration points on the screen and the touch array the actual measured position. -The data returned can set in to the ```touch_calibration_data``` +The data returned can set in to the `touch_calibration_data` ## Rotation of the display and touch The library supports rotating for most of the controllers using hardware. Support for the direct 16bits parallel connection is done using software emulation (in LVGL). Rotating the touch is done by LVGL when rotating. From the LVGL documentation: -*The rotation values are relative to how you would rotate the physical display in the clockwise direction. -Thus, LV_DISP_ROT_90 means you rotate the hardware 90 degrees clockwise, and the display rotates 90 degrees counterclockwise to compensate.* +_The rotation values are relative to how you would rotate the physical display in the clockwise direction. +Thus, LV_DISP_ROT_90 means you rotate the hardware 90 degrees clockwise, and the display rotates 90 degrees counterclockwise to compensate._ -Rotating is done calling the ```lv_display_set_rotation``` function in the LVGL library with the rotation: +Rotating is done calling the `lv_display_set_rotation` function in the LVGL library with the rotation: ```c++ - auto disp = lv_display_get_default(); - lv_display_set_rotation(disp, LV_DISPLAY_ROTATION_90); + auto display = lv_display_get_default(); + lv_display_set_rotation(display, LV_DISPLAY_ROTATION_90); ``` Some boards are around that have flipped screens, this is probably due to differences during tha manufacturing or using different TFTs. It is possible to correct these boards overriding the default defines. To adjust the display and touch to the default (LV_DISP_ROT_NONE) there are 6 defines in the boards definition: -| Name | Description | -|--- |--- | -| DISPLAY_SWAP_XY | Swaps the X and Y coordinates for the display | -| DISPLAY_MIRROR_X | Mirrors the X coordinate for the display | -| DISPLAY_MIRROR_Y | Mirrors the Y coordinate for the display | -| TOUCH_SWAP_XY | Swaps the X and Y coordinates for the touch | -| TOUCH_MIRROR_X | Mirrors the X coordinate for the touch | -| TOUCH_MIRROR_Y | Mirrors the Y coordinate for the touch | - +| Name | Description | +| ---------------- | --------------------------------------------- | +| DISPLAY_SWAP_XY | Swaps the X and Y coordinates for the display | +| DISPLAY_MIRROR_X | Mirrors the X coordinate for the display | +| DISPLAY_MIRROR_Y | Mirrors the Y coordinate for the display | +| TOUCH_SWAP_XY | Swaps the X and Y coordinates for the touch | +| TOUCH_MIRROR_X | Mirrors the X coordinate for the touch | +| TOUCH_MIRROR_Y | Mirrors the Y coordinate for the touch | ## Appendix: Template to support ALL the boards -The platformio.ini file below supports all the boards. This is useful when running your application on multiple boards. If using one board only, uncomment the ```default_envs``` for that board in the ```[platformio]``` section. +The platformio.ini file below supports all the boards. This is useful when running your application on multiple boards. If using one board only, uncomment the `default_envs` for that board in the `[platformio]` section. ->[!TIP] ->When building using a pipeline (github action), the ini below, with all the boards, can be used automatically create builds for all the boards. +> [!TIP] +> When building using a pipeline (github action), the ini below, with all the boards, can be used automatically create builds for all the boards. ```ini [platformio] @@ -452,7 +452,7 @@ build_flags = -D CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_VERBOSE # LVGL settings #-DLV_CONF_PATH=${PROJECT_INCLUDE_DIR}/lv_conf.h - + lib_deps = https://github.com/rzeldent/esp32-smartdisplay.git @@ -554,8 +554,8 @@ board = esp32-8048S070R The following libraries are used from the [Espressif component registry](https://components.espressif.com/): -| Name | Version | -|--- |--- | +| Name | Version | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | | [ESP_LCD_PANEL_IO_ADDITIONS](https://components.espressif.com/api/download/?object_type=component&object_id=fc4eba6f-2091-4b28-8703-df58c6c975c7) | v1.0.0 | | [ESP IO Expander Component](https://components.espressif.com/api/download/?object_type=component&object_id=44022a0f-c4b2-40c0-b2a2-40d7b648cb52) | v1.0.0 | | [ESP LCD Touch](https://components.espressif.com/api/download/?object_type=component&object_id=bb4a4d94-2827-4695-84d1-1b53383b8001) | v1.1.1 | From 54b79d86139def55dfb39f716d2456e80459dc0b Mon Sep 17 00:00:00 2001 From: Rene Date: Fri, 21 Jun 2024 16:23:28 +0200 Subject: [PATCH 09/21] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7ac9924..c453824 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ However, when working with these libraries, I found out that these libraries had This library depends on: -- [LVGL](https://registry.platformio.org/libraries/lvgl/lvgl), currently version 8.3.9 +- [LVGL](https://registry.platformio.org/libraries/lvgl/lvgl), currently version 9.1.0 - [platformio-espressif32-sunton](https://github.com/rzeldent/platformio-espressif32-sunton) > [!NOTE] @@ -64,7 +64,7 @@ This demo provides: - User Interface created using the SquareLine Studio GUI generator. - Read the CdS (light sensor) - Control of the LEDs -- Works for all known boards +- Works for all known Sunton boards (and more): see [Sunton Boards information](https://github.com/rzeldent/platformio-espressif32-sunton) - Full source code The next sections will guide you though the process of creating an application. However, some knowledge of PlatformIO, C/C++ and LVGL is required! From 27cdf0ee9f4b7f3197cb1e1a6f61c9268c85392c Mon Sep 17 00:00:00 2001 From: Rene Zeldenthuis Date: Mon, 24 Jun 2024 22:17:23 +0200 Subject: [PATCH 10/21] Updated lv_conf.h and documentation --- README.md | 139 +++++++++++++++++++------------- test/lv_conf.h | 215 +++++++++++++++++++++++++++++-------------------- 2 files changed, 213 insertions(+), 141 deletions(-) diff --git a/README.md b/README.md index c453824..c2a24e7 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Currently this library supports the following boards: - ESP32-2432S032 N/R/C - ESP32-3248S035 R/C - ESP32-4827S043 R/C -- ESP32-4848S040C \_I_Y_1/3 +- ESP32-4848S040C_I_Y_1/3 - ESP32-8048S050 N/C/R - ESP32-8048S070 N/C/R @@ -51,7 +51,7 @@ This library depends on: - [platformio-espressif32-sunton](https://github.com/rzeldent/platformio-espressif32-sunton) > [!NOTE] -> This library uses the "official" drivers from Espressif's component service. These drivers use the newly introduced esp_lcd_panel interfaces. This should provide some support in the future for updates and new boards. These drivers have already been copied and included to this library. +> This library uses the newly introduced esp_lcd_panel interfaces. This should provide some support in the future for updates and new boards. These drivers are provided by Espressid and have already been copied and included to this library. ## How to use @@ -67,7 +67,7 @@ This demo provides: - Works for all known Sunton boards (and more): see [Sunton Boards information](https://github.com/rzeldent/platformio-espressif32-sunton) - Full source code -The next sections will guide you though the process of creating an application. However, some knowledge of PlatformIO, C/C++ and LVGL is required! +The next sections will guide you though the process of creating an application. However, knowledge of PlatformIO, C/C++ and LVGL is required! If you run into problems, first try to open a discussion on the [github esp32-smartdisplay discussion board](https://github.com/rzeldent/esp32-smartdisplay/discussions). @@ -118,13 +118,12 @@ This will automatically download the library, the LVGL library (as a dependency) LVGL needs a configuration file; `lv_conf.h`. This file contains information about the fonts, color depths, default background, styles, etc... The default LVGL template can be found in the LVGL library at the location: `lvgl/lv_conf_template.h`. This file must be copied to the include directory and renamed to `lvgl_conf.h`. Also the `#if 0` must be removed to enable the file to be included. + +This file can immediately be used and is valid. Some modifications might be required fore additional features. + More information about setting up a project with LVGL can be obtained at [LVGL get-started/quick-overview](https://docs.lvgl.io/master/get-started/quick-overview.html#add-lvgl-into-your-project). I suggest to put the `lv_conf.h` file in the include directory and set the build flags to specify the location of the file, see below. -> [!TIP] -> LVGL can also be downloaded manually from: [https://github.com/lvgl/lvgl/archive/master.zip](https://github.com/lvgl/lvgl/archive/master.zip) to extract the template. -> The template can also be copied from the demo application. - Important settings are: - Only the R5G6B5 format is supported on these panels. @@ -141,53 +140,6 @@ Important settings are: #define LV_USE_MEM_MONITOR 1 ``` -- (Optionally) Include additional fonts. - - The font Montserrat 14pt is required. Other fonts can be included. - - ```h - #define LV_FONT_MONTSERRAT_22 1 - ... - - ``` - -- Optionally, only enable widgets that are used to save on code - -```h - #define LV_USE_ANIMIMG 1 - #define LV_USE_ARC 1 - #define LV_USE_ARC 1 - #define LV_USE_BAR 1 - #define LV_USE_BUTTON 1 - #define LV_USE_BUTTONMATRIX 1 - #define LV_USE_CALENDAR 1 - #define LV_USE_CANVAS 1 - #define LV_USE_CHART 1 - #define LV_USE_CHECKBOX 1 - #define LV_USE_DROPDOWN 1 /*Requires: lv_label*/ - #define LV_USE_IMAGE 1 /*Requires: lv_label*/ - #define LV_USE_IMAGEBUTTON 1 - #define LV_USE_KEYBOARD 1 - #define LV_USE_LABEL 1 - #define LV_USE_LED 1 - #define LV_USE_LINE 1 - #define LV_USE_LIST 1 - #define LV_USE_MENU 1 - #define LV_USE_MSGBOX 1 - #define LV_USE_ROLLER 1 /*Requires: lv_label*/ - #define LV_USE_SCALE 1 - #define LV_USE_SLIDER 1 /*Requires: lv_bar*/ - #define LV_USE_SPAN 1 - #define LV_USE_SPINBOX 1 - #define LV_USE_SPINNER 1 - #define LV_USE_SWITCH 1 - #define LV_USE_TEXTAREA 1 /*Requires: lv_label*/ - #define LV_USE_TABLE 1 - #define LV_USE_TABVIEW 1 - #define LV_USE_TILEVIEW 1 - #define LV_USE_WIN 1 -``` - For debugging it is possible to enable logging from LVGL. The library will output to the debugging output (using `lv_log_register_print_cb`). To enable logging, set the define: @@ -198,7 +150,52 @@ To enable logging, set the define: By default the logging is only `LV_LOG_LEVEL_WARN` but can be adjusted in the `lv_conf.h`. -More information about the LVGL configuration can be found in the excellent [LVGL documentation](https://docs.lvgl.io/8.3/index.html). +To enable additional decoding options, libraries or widgets, enable them in the lv_conf.ini file by setting a LV_USE_xxxx to 1. +These are disabled by default. + +```cpp +//API for LittleFs. +#define LV_USE_FS_LITTLEFS 0 +//LODEPNG decoder library +#define LV_USE_LODEPNG 0 +//PNG decoder(libpng) library +#define LV_USE_LIBPNG 0 +//BMP decoder library +#define LV_USE_BMP 0 +// JPG + split JPG decoder library. +#define LV_USE_TJPGD 0 +// libjpeg-turbo decoder library. +#define LV_USE_LIBJPEG_TURBO 0 +//GIF decoder library +#define LV_USE_GIF 0 +//Decode bin images to RAM +#define LV_BIN_DECODER_RAM_LOAD 0 +//RLE decompress library +#define LV_USE_RLE 0 +//QR code library +#define LV_USE_QRCODE 0 +//Barcode code library +#define LV_USE_BARCODE 0 +//FreeType library +#define LV_USE_FREETYPE 0 +// Built-in TTF decoder +#define LV_USE_TINY_TTF 0 +//Rlottie library +#define LV_USE_RLOTTIE 0 +//Enable Vector Graphic APIs +#define LV_USE_VECTOR_GRAPHIC 0 +//Enable ThorVG (vector graphics library) from the src/libs folder +#define LV_USE_THORVG_INTERNAL 0 +//Use lvgl built-in LZ4 lib +#define LV_USE_LZ4_INTERNAL 0 +//Use external LZ4 library +#define LV_USE_LZ4_EXTERNAL 0 +//FFmpeg library for image decoding and playing videos +#define LV_USE_FFMPEG 0 +``` + +More information about the LVGL configuration can be found in the excellent [LVGL documentation](https://docs.lvgl.io). + > [!WARNING] > After the library has been build, changes in the lv_conf.h are no longer applied because libraries are cached. @@ -282,6 +279,38 @@ If there are problems: - Refer to the [discussions](https://github.com/rzeldent/esp32-smartdisplay/discussions), - If all fails, submit an [issue](https://github.com/rzeldent/esp32-smartdisplay/issues), no SLA as this is done in my spare time. +## Porting from LVGL 8.3.9 + +There are breaking changes in LVGL. Please refer to the documentation and forums provided by LVGL to port your application. + +### lv_conf.h + +The lv_conf.h template has been changed quite extensively. +The best way to start is to do a fresh start using the template from ```lvgl\lv_conf_template.h```. +Copy this to your include directory and and rename this to ```lv_conf.h```. +Next, update the ```#if 0``` on top to ```#if 1``` so the wil will be included: + +```c++ +/* clang-format off */ +#if 1 /*Set it to "1" to enable content*/ +``` + +### Ticker + +The ticker needs to be updated to keep track of time. In LVGL 8.3.8 this was done by setting: ```#define LV_TICK_CUSTOM 1```. +Now it has to be updated by your application. A solution is to put this in the loop() and combine this with the ```lv_timer_handler()``` + +```c++ + // Update the ticker + static auto lv_last_tick = millis(); + + auto const now = millis(); + lv_tick_inc(now - lv_last_tick); + lv_last_tick = now; + // Update the UI + lv_timer_handler(); +``` + ## More on lv_conf.h To use the LVGL library, a `lv_conf.h` file is required to define the settings for LVGL. diff --git a/test/lv_conf.h b/test/lv_conf.h index 3603725..77205e7 100644 --- a/test/lv_conf.h +++ b/test/lv_conf.h @@ -1,6 +1,6 @@ /** * @file lv_conf.h - * Configuration file for v9.0.0-dev + * Configuration file for v9.1.0 */ /* @@ -17,6 +17,11 @@ #ifndef LV_CONF_H #define LV_CONF_H +/*If you need to include anything here, do it inside the `__ASSEMBLY__` guard */ +#if 0 && defined(__ASSEMBLY__) +#include "my_include.h" +#endif + /*==================== COLOR SETTINGS *====================*/ @@ -42,7 +47,7 @@ #if LV_USE_STDLIB_MALLOC == LV_STDLIB_BUILTIN /*Size of the memory available for `lv_malloc()` in bytes (>= 2kB)*/ - #define LV_MEM_SIZE (256 * 1024U) /*[bytes]*/ + #define LV_MEM_SIZE (64 * 1024U) /*[bytes]*/ /*Size of the memory expand for `lv_malloc()` in bytes*/ #define LV_MEM_POOL_EXPAND_SIZE 0 @@ -54,7 +59,7 @@ #undef LV_MEM_POOL_INCLUDE #undef LV_MEM_POOL_ALLOC #endif -#endif /*LV_USE_MALLOC == LV_STDLIB_BUILTIN*/ +#endif /*LV_USE_STDLIB_MALLOC == LV_STDLIB_BUILTIN*/ /*==================== HAL SETTINGS @@ -94,6 +99,14 @@ /*Align the start address of draw_buf addresses to this bytes*/ #define LV_DRAW_BUF_ALIGN 4 +/* If a widget has `style_opa < 255` (not `bg_opa`, `text_opa` etc) or not NORMAL blend mode + * it is buffered into a "simple" layer before rendering. The widget can be buffered in smaller chunks. + * "Transformed layers" (if `transform_angle/zoom` are set) use larger buffers + * and can't be drawn in chunks. */ + +/*The target buffer size for simple layer chunks.*/ +#define LV_DRAW_LAYER_SIMPLE_BUF_SIZE (24 * 1024) /*[bytes]*/ + #define LV_USE_DRAW_SW 1 #if LV_USE_DRAW_SW == 1 /* Set the number of draw unit. @@ -101,14 +114,12 @@ * > 1 means multiply threads will render the screen in parallel */ #define LV_DRAW_SW_DRAW_UNIT_CNT 1 - /* If a widget has `style_opa < 255` (not `bg_opa`, `text_opa` etc) or not NORMAL blend mode - * it is buffered into a "simple" layer before rendering. The widget can be buffered in smaller chunks. - * "Transformed layers" (if `transform_angle/zoom` are set) use larger buffers - * and can't be drawn in chunks. */ - - /*The target buffer size for simple layer chunks.*/ - #define LV_DRAW_SW_LAYER_SIMPLE_BUF_SIZE (24 * 1024) /*[bytes]*/ + /* Use Arm-2D to accelerate the sw render */ + #define LV_USE_DRAW_ARM2D_SYNC 0 + /* Enable native helium assembly to be compiled */ + #define LV_USE_NATIVE_HELIUM_ASM 0 + /* 0: use a simple renderer capable of drawing only simple rectangles with gradient, images, texts, and straight lines only * 1: use a complex renderer capable of drawing rounded corners, shadow, skew lines, and arcs too */ #define LV_DRAW_SW_COMPLEX 1 @@ -133,9 +144,6 @@ #endif #endif -/* Use Arm-2D on Cortex-M based devices. Please only enable it for Helium Powered devices for now */ -#define LV_USE_DRAW_ARM2D 0 - /* Use NXP's VG-Lite GPU on iMX RTxxx platforms. */ #define LV_USE_DRAW_VGLITE 0 @@ -176,6 +184,19 @@ /* Enable VG-Lite assert. */ #define LV_VG_LITE_USE_ASSERT 0 +/* VG-Lite flush commit trigger threshold. GPU will try to batch these many draw tasks. */ +#define LV_VG_LITE_FLUSH_MAX_COUNT 8 + +/* Enable border to simulate shadow + * NOTE: which usually improves performance, + * but does not guarantee the same rendering quality as the software. */ +#define LV_VG_LITE_USE_BOX_SHADOW 0 + +/* VG-Lite gradient image maximum cache number. + * NOTE: The memory usage of a single gradient image is 4K bytes. + */ +#define LV_VG_LITE_GRAD_CACHE_SIZE 32 + #endif /*======================= @@ -187,7 +208,7 @@ *-----------*/ /*Enable the log module*/ -#define LV_USE_LOG 1 +#define LV_USE_LOG 0 #if LV_USE_LOG /*How important log should be added: @@ -284,7 +305,7 @@ #define LV_COLOR_MIX_ROUND_OFS 0 /* Add 2 x 32 bit variables to each lv_obj_t to speed up getting style properties */ -#define LV_OBJ_STYLE_CACHE 1 +#define LV_OBJ_STYLE_CACHE 0 /* Add `id` field to `lv_obj_t` */ #define LV_USE_OBJ_ID 0 @@ -310,6 +331,9 @@ /*Enable 16 pixels alignment*/ #define LV_VG_LITE_THORVG_16PIXELS_ALIGN 1 + /*Buffer address alignment*/ + #define LV_VG_LITE_THORVG_BUF_ADDR_ALIGN 64 + /*Enable multi-thread render*/ #define LV_VG_LITE_THORVG_THREAD_RENDER 0 @@ -363,36 +387,36 @@ /*Montserrat fonts with ASCII range and some symbols using bpp = 4 *https://fonts.google.com/specimen/Montserrat*/ -#define LV_FONT_MONTSERRAT_8 1 -#define LV_FONT_MONTSERRAT_10 1 -#define LV_FONT_MONTSERRAT_12 1 +#define LV_FONT_MONTSERRAT_8 0 +#define LV_FONT_MONTSERRAT_10 0 +#define LV_FONT_MONTSERRAT_12 0 #define LV_FONT_MONTSERRAT_14 1 -#define LV_FONT_MONTSERRAT_16 1 -#define LV_FONT_MONTSERRAT_18 1 -#define LV_FONT_MONTSERRAT_20 1 -#define LV_FONT_MONTSERRAT_22 1 -#define LV_FONT_MONTSERRAT_24 1 -#define LV_FONT_MONTSERRAT_26 1 -#define LV_FONT_MONTSERRAT_28 1 -#define LV_FONT_MONTSERRAT_30 1 -#define LV_FONT_MONTSERRAT_32 1 -#define LV_FONT_MONTSERRAT_34 1 -#define LV_FONT_MONTSERRAT_36 1 -#define LV_FONT_MONTSERRAT_38 1 -#define LV_FONT_MONTSERRAT_40 1 -#define LV_FONT_MONTSERRAT_42 1 -#define LV_FONT_MONTSERRAT_44 1 -#define LV_FONT_MONTSERRAT_46 1 -#define LV_FONT_MONTSERRAT_48 1 +#define LV_FONT_MONTSERRAT_16 0 +#define LV_FONT_MONTSERRAT_18 0 +#define LV_FONT_MONTSERRAT_20 0 +#define LV_FONT_MONTSERRAT_22 0 +#define LV_FONT_MONTSERRAT_24 0 +#define LV_FONT_MONTSERRAT_26 0 +#define LV_FONT_MONTSERRAT_28 0 +#define LV_FONT_MONTSERRAT_30 0 +#define LV_FONT_MONTSERRAT_32 0 +#define LV_FONT_MONTSERRAT_34 0 +#define LV_FONT_MONTSERRAT_36 0 +#define LV_FONT_MONTSERRAT_38 0 +#define LV_FONT_MONTSERRAT_40 0 +#define LV_FONT_MONTSERRAT_42 0 +#define LV_FONT_MONTSERRAT_44 0 +#define LV_FONT_MONTSERRAT_46 0 +#define LV_FONT_MONTSERRAT_48 0 /*Demonstrate special features*/ -#define LV_FONT_MONTSERRAT_28_COMPRESSED 1 /*bpp = 3*/ -#define LV_FONT_DEJAVU_16_PERSIAN_HEBREW 1 /*Hebrew, Arabic, Persian letters and all their forms*/ -#define LV_FONT_SIMSUN_16_CJK 1 /*1000 most common CJK radicals*/ +#define LV_FONT_MONTSERRAT_28_COMPRESSED 0 /*bpp = 3*/ +#define LV_FONT_DEJAVU_16_PERSIAN_HEBREW 0 /*Hebrew, Arabic, Persian letters and all their forms*/ +#define LV_FONT_SIMSUN_16_CJK 0 /*1000 most common CJK radicals*/ /*Pixel perfect monospace fonts*/ -#define LV_FONT_UNSCII_8 1 -#define LV_FONT_UNSCII_16 1 +#define LV_FONT_UNSCII_8 0 +#define LV_FONT_UNSCII_16 0 /*Optionally declare custom fonts here. *You can use these fonts as default font too and they will be available globally. @@ -405,10 +429,10 @@ /*Enable handling large font and/or fonts with a lot of characters. *The limit depends on the font size, font face and bpp. *Compiler error will be triggered if a font needs it.*/ -#define LV_FONT_FMT_TXT_LARGE 1 +#define LV_FONT_FMT_TXT_LARGE 0 /*Enables/disables support for compressed fonts.*/ -#define LV_USE_FONT_COMPRESSED 1 +#define LV_USE_FONT_COMPRESSED 0 /*Enable drawing placeholders when glyph dsc is not found*/ #define LV_USE_FONT_PLACEHOLDER 1 @@ -591,9 +615,9 @@ /*File system interfaces for common APIs */ /*API for fopen, fread, etc*/ -#define LV_USE_FS_STDIO 1 +#define LV_USE_FS_STDIO 0 #if LV_USE_FS_STDIO - #define LV_FS_STDIO_LETTER 'A' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ + #define LV_FS_STDIO_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ #define LV_FS_STDIO_PATH "" /*Set the working directory. File/directory paths will be appended to it.*/ #define LV_FS_STDIO_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/ #endif @@ -622,13 +646,19 @@ #endif /*API for memory-mapped file access. */ -#define LV_USE_FS_MEMFS 1 +#define LV_USE_FS_MEMFS 0 #if LV_USE_FS_MEMFS #define LV_FS_MEMFS_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ #endif +/*API for LittleFs. */ +#define LV_USE_FS_LITTLEFS 0 +#if LV_USE_FS_LITTLEFS + #define LV_FS_LITTLEFS_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ +#endif + /*LODEPNG decoder library*/ -#define LV_USE_LODEPNG 1 +#define LV_USE_LODEPNG 0 /*PNG decoder(libpng) library*/ #define LV_USE_LIBPNG 0 @@ -638,14 +668,14 @@ /* JPG + split JPG decoder library. * Split JPG is a custom format optimized for embedded systems. */ -#define LV_USE_TJPGD 1 +#define LV_USE_TJPGD 0 /* libjpeg-turbo decoder library. * Supports complete JPEG specifications and high-performance JPEG decoding. */ #define LV_USE_LIBJPEG_TURBO 0 /*GIF decoder library*/ -#define LV_USE_GIF 1 +#define LV_USE_GIF 0 #if LV_USE_GIF /*GIF decoder accelerate*/ #define LV_GIF_CACHE_DECODE_DATA 0 @@ -656,13 +686,13 @@ #define LV_BIN_DECODER_RAM_LOAD 0 /*RLE decompress library*/ -#define LV_USE_RLE 1 +#define LV_USE_RLE 0 /*QR code library*/ -#define LV_USE_QRCODE 1 +#define LV_USE_QRCODE 0 /*Barcode code library*/ -#define LV_USE_BARCODE 1 +#define LV_USE_BARCODE 0 /*FreeType library*/ #define LV_USE_FREETYPE 0 @@ -676,7 +706,7 @@ #endif /* Built-in TTF decoder */ -#define LV_USE_TINY_TTF 1 +#define LV_USE_TINY_TTF 0 #if LV_USE_TINY_TTF /* Enable loading TTF data from files */ #define LV_TINY_TTF_FILE_SUPPORT 0 @@ -694,9 +724,6 @@ /* Enable ThorVG by assuming that its installed and linked to the project */ #define LV_USE_THORVG_EXTERNAL 0 -/*Enable LZ4 compress/decompress lib*/ -#define LV_USE_LZ4 0 - /*Use lvgl built-in LZ4 lib*/ #define LV_USE_LZ4_INTERNAL 0 @@ -716,16 +743,17 @@ *==================*/ /*1: Enable API to take snapshot for object*/ -#define LV_USE_SNAPSHOT 1 +#define LV_USE_SNAPSHOT 0 /*1: Enable system monitor component*/ -#define LV_USE_SYSMON 1 - +#define LV_USE_SYSMON 0 #if LV_USE_SYSMON + /*Get the idle percentage. E.g. uint32_t my_get_idle(void);*/ + #define LV_SYSMON_GET_IDLE lv_timer_get_idle /*1: Show CPU usage and FPS count * Requires `LV_USE_SYSMON = 1`*/ - #define LV_USE_PERF_MONITOR 1 + #define LV_USE_PERF_MONITOR 0 #if LV_USE_PERF_MONITOR #define LV_USE_PERF_MONITOR_POS LV_ALIGN_BOTTOM_RIGHT @@ -734,9 +762,9 @@ #endif /*1: Show the used memory and the memory fragmentation - * Requires `LV_USE_BUILTIN_MALLOC = 1` + * Requires `LV_USE_STDLIB_MALLOC = LV_STDLIB_BUILTIN` * Requires `LV_USE_SYSMON = 1`*/ - #define LV_USE_MEM_MONITOR 1 + #define LV_USE_MEM_MONITOR 0 #if LV_USE_MEM_MONITOR #define LV_USE_MEM_MONITOR_POS LV_ALIGN_BOTTOM_LEFT #endif @@ -770,23 +798,23 @@ #endif /*1: Enable Monkey test*/ -#define LV_USE_MONKEY 1 +#define LV_USE_MONKEY 0 /*1: Enable grid navigation*/ -#define LV_USE_GRIDNAV 1 +#define LV_USE_GRIDNAV 0 /*1: Enable lv_obj fragment*/ -#define LV_USE_FRAGMENT 1 +#define LV_USE_FRAGMENT 0 /*1: Support using images as font in label or span widgets */ -#define LV_USE_IMGFONT 1 +#define LV_USE_IMGFONT 0 /*1: Enable an observer pattern implementation*/ #define LV_USE_OBSERVER 1 /*1: Enable Pinyin input method*/ /*Requires: lv_keyboard*/ -#define LV_USE_IME_PINYIN 1 +#define LV_USE_IME_PINYIN 0 #if LV_USE_IME_PINYIN /*1: Use default thesaurus*/ /*If you do not use the default thesaurus, be sure to use `lv_ime_pinyin` after setting the thesauruss*/ @@ -804,7 +832,7 @@ /*1: Enable file explorer*/ /*Requires: lv_table*/ -#define LV_USE_FILE_EXPLORER 1 +#define LV_USE_FILE_EXPLORER 0 #if LV_USE_FILE_EXPLORER /*Maximum length of path*/ #define LV_FILE_EXPLORER_PATH_MAX_LEN (128) @@ -820,11 +848,12 @@ /*Use SDL to open window on PC and handle mouse and keyboard*/ #define LV_USE_SDL 0 #if LV_USE_SDL - #define LV_SDL_INCLUDE_PATH - #define LV_SDL_RENDER_MODE LV_DISPLAY_RENDER_MODE_DIRECT /*LV_DISPLAY_RENDER_MODE_DIRECT is recommended for best performance*/ - #define LV_SDL_BUF_COUNT 1 /*1 or 2*/ - #define LV_SDL_FULLSCREEN 0 /*1: Make the window full screen by default*/ - #define LV_SDL_DIRECT_EXIT 1 /*1: Exit the application when all SDL windows are closed*/ + #define LV_SDL_INCLUDE_PATH + #define LV_SDL_RENDER_MODE LV_DISPLAY_RENDER_MODE_DIRECT /*LV_DISPLAY_RENDER_MODE_DIRECT is recommended for best performance*/ + #define LV_SDL_BUF_COUNT 1 /*1 or 2*/ + #define LV_SDL_FULLSCREEN 0 /*1: Make the window full screen by default*/ + #define LV_SDL_DIRECT_EXIT 1 /*1: Exit the application when all SDL windows are closed*/ + #define LV_SDL_MOUSEWHEEL_MODE LV_SDL_MOUSEWHEEL_MODE_ENCODER /*LV_SDL_MOUSEWHEEL_MODE_ENCODER/CROWN*/ #endif /*Use X11 to open window on Linux desktop and handle mouse and keyboard*/ @@ -877,16 +906,30 @@ /*Driver for evdev input devices*/ #define LV_USE_EVDEV 0 +/*Driver for libinput input devices*/ +#define LV_USE_LIBINPUT 0 + +#if LV_USE_LIBINPUT + #define LV_LIBINPUT_BSD 0 + + /*Full keyboard support*/ + #define LV_LIBINPUT_XKB 0 + #if LV_LIBINPUT_XKB + /*"setxkbmap -query" can help find the right values for your keyboard*/ + #define LV_LIBINPUT_XKB_KEY_MAP { .rules = NULL, .model = "pc101", .layout = "us", .variant = NULL, .options = NULL } + #endif +#endif + /*Drivers for LCD devices connected via SPI/parallel port*/ -#define LV_USE_ST7735 0 -#define LV_USE_ST7789 0 -#define LV_USE_ST7796 0 -#define LV_USE_ILI9341 0 +#define LV_USE_ST7735 0 +#define LV_USE_ST7789 0 +#define LV_USE_ST7796 0 +#define LV_USE_ILI9341 0 #define LV_USE_GENERIC_MIPI (LV_USE_ST7735 | LV_USE_ST7789 | LV_USE_ST7796 | LV_USE_ILI9341) /* LVGL Windows backend */ -#define LV_USE_WINDOWS 0 +#define LV_USE_WINDOWS 0 /*================== * EXAMPLES @@ -900,19 +943,19 @@ ====================*/ /*Show some widget. It might be required to increase `LV_MEM_SIZE` */ -#define LV_USE_DEMO_WIDGETS 1 +#define LV_USE_DEMO_WIDGETS 0 /*Demonstrate the usage of encoder and keyboard*/ -#define LV_USE_DEMO_KEYPAD_AND_ENCODER 1 +#define LV_USE_DEMO_KEYPAD_AND_ENCODER 0 /*Benchmark your system*/ -#define LV_USE_DEMO_BENCHMARK 1 +#define LV_USE_DEMO_BENCHMARK 0 /*Render test for each primitives. Requires at least 480x272 display*/ -#define LV_USE_DEMO_RENDER 1 +#define LV_USE_DEMO_RENDER 0 /*Stress test for LVGL*/ -#define LV_USE_DEMO_STRESS 1 +#define LV_USE_DEMO_STRESS 0 /*Music player demo*/ #define LV_USE_DEMO_MUSIC 0 @@ -925,16 +968,16 @@ #endif /*Flex layout demo*/ -#define LV_USE_DEMO_FLEX_LAYOUT 1 +#define LV_USE_DEMO_FLEX_LAYOUT 0 /*Smart-phone like multi-language demo*/ -#define LV_USE_DEMO_MULTILANG 1 +#define LV_USE_DEMO_MULTILANG 0 /*Widget transformation demo*/ -#define LV_USE_DEMO_TRANSFORM 1 +#define LV_USE_DEMO_TRANSFORM 0 /*Demonstrate scroll settings*/ -#define LV_USE_DEMO_SCROLL 1 +#define LV_USE_DEMO_SCROLL 0 /*Vector graphic demo*/ #define LV_USE_DEMO_VECTOR_GRAPHIC 0 From 230bdd589d0bd860240119768023c25fe42604dc Mon Sep 17 00:00:00 2001 From: Rene Zeldenthuis Date: Sun, 14 Jul 2024 14:20:55 +0200 Subject: [PATCH 11/21] Boards to develop --- boards | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boards b/boards index 22ebaad..1b69451 160000 --- a/boards +++ b/boards @@ -1 +1 @@ -Subproject commit 22ebaad01481acc00919862e2cd2f45214d7dcc9 +Subproject commit 1b69451083fbc84bed7bc61b126154d0d0906b89 From 7687e9e227cbb944dcc633914e999da1662ec056 Mon Sep 17 00:00:00 2001 From: Rene Zeldenthuis Date: Sun, 14 Jul 2024 15:57:56 +0200 Subject: [PATCH 12/21] Updated comment for software rotation and st7789_i80 also supports hw rotate --- src/lvgl_panel_st7262_par.c | 2 +- src/lvgl_panel_st7701_par.c | 2 +- src/lvgl_panel_st7789_i80.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lvgl_panel_st7262_par.c b/src/lvgl_panel_st7262_par.c index 563c63f..dfacf37 100644 --- a/src/lvgl_panel_st7262_par.c +++ b/src/lvgl_panel_st7262_par.c @@ -23,7 +23,7 @@ lv_display_t *lvgl_lcd_init(uint32_t hor_res, uint32_t ver_res) lv_display_t *display = lv_display_create(hor_res, ver_res); log_v("display:0x%08x", display); - // Hardware rotation is supported + // Hardware rotation is not supported display->sw_rotate = 1; display->rotation = LV_DISPLAY_ROTATION_0; diff --git a/src/lvgl_panel_st7701_par.c b/src/lvgl_panel_st7701_par.c index f4057e0..2ca5039 100644 --- a/src/lvgl_panel_st7701_par.c +++ b/src/lvgl_panel_st7701_par.c @@ -25,7 +25,7 @@ lv_display_t *lvgl_lcd_init(uint32_t hor_res, uint32_t ver_res) lv_display_t *display = lv_display_create(hor_res, ver_res); log_v("display:0x%08x", display); - // Hardware rotation is supported + // Hardware rotation is not supported display->sw_rotate = 1; display->rotation = LV_DISPLAY_ROTATION_0; diff --git a/src/lvgl_panel_st7789_i80.c b/src/lvgl_panel_st7789_i80.c index 5ed4352..bc1e2d2 100644 --- a/src/lvgl_panel_st7789_i80.c +++ b/src/lvgl_panel_st7789_i80.c @@ -31,7 +31,7 @@ lv_display_t *lvgl_lcd_init(uint32_t hor_res, uint32_t ver_res) log_v("display:0x%08x", display); // Hardware rotation is supported - display->sw_rotate = 1; + display->sw_rotate = 0; display->rotation = LV_DISPLAY_ROTATION_0; pinMode(ST7789_RD_GPIO, OUTPUT); From 9afa83e9d247768c556f7bf725334963e3bb0a0f Mon Sep 17 00:00:00 2001 From: Rene Zeldenthuis Date: Sun, 14 Jul 2024 17:16:04 +0200 Subject: [PATCH 13/21] Added RENDER_MODE --- src/lvgl_panel_gc9a01_spi.c | 10 ++++++---- src/lvgl_panel_ili9341_spi.c | 10 ++++++---- src/lvgl_panel_st7262_par.c | 4 ++-- src/lvgl_panel_st7701_par.c | 4 ++-- src/lvgl_panel_st7789_i80.c | 6 ++++-- src/lvgl_panel_st7789_spi.c | 10 ++++++---- src/lvgl_panel_st7796_spi.c | 10 ++++++---- 7 files changed, 32 insertions(+), 22 deletions(-) diff --git a/src/lvgl_panel_gc9a01_spi.c b/src/lvgl_panel_gc9a01_spi.c index 8272795..9db1b2f 100644 --- a/src/lvgl_panel_gc9a01_spi.c +++ b/src/lvgl_panel_gc9a01_spi.c @@ -21,8 +21,9 @@ void gc9a01_lv_flush(lv_display_t *display, const lv_area_t *area, uint8_t *px_m esp_lcd_panel_handle_t panel_handle = display->user_data; uint32_t pixels = lv_area_get_size(area); - uint16_t *p = (uint16_t*)px_map; - while (pixels--) { + uint16_t *p = (uint16_t *)px_map; + while (pixels--) + { *p = (uint16_t)((*p >> 8) | (*p << 8)); p++; } @@ -37,6 +38,7 @@ lv_display_t *lvgl_lcd_init(uint32_t hor_res, uint32_t ver_res) // Hardware rotation is supported display->sw_rotate = 0; + display->render_mode = LV_DISPLAY_RENDER_MODE_PARTIAL; display->rotation = LV_DISPLAY_ROTATION_0; // Create SPI bus @@ -92,9 +94,9 @@ lv_display_t *lvgl_lcd_init(uint32_t hor_res, uint32_t ver_res) #if (DISPLAY_SWAP_XY) ESP_ERROR_CHECK(esp_lcd_panel_swap_xy(panel_handle, DISPLAY_SWAP_XY)); #endif -#if (DISPLAY_MIRROR_X || DISPLAY_MIRROR_Y) +#if (DISPLAY_MIRROR_X || DISPLAY_MIRROR_Y) ESP_ERROR_CHECK(esp_lcd_panel_mirror(panel_handle, DISPLAY_MIRROR_X, DISPLAY_MIRROR_Y)); -#endif +#endif #if (DISPLAY_GAP_X || DISPLAY_GAP_Y) ESP_ERROR_CHECK(esp_lcd_panel_set_gap(panel_handle, DISPLAY_GAP_X, DISPLAY_GAP_Y)); #endif diff --git a/src/lvgl_panel_ili9341_spi.c b/src/lvgl_panel_ili9341_spi.c index bb43dad..d750300 100644 --- a/src/lvgl_panel_ili9341_spi.c +++ b/src/lvgl_panel_ili9341_spi.c @@ -17,8 +17,9 @@ void ili9341_lv_flush(lv_display_t *display, const lv_area_t *area, uint8_t *px_ { esp_lcd_panel_handle_t panel_handle = display->user_data; uint32_t pixels = lv_area_get_size(area); - uint16_t *p = (uint16_t*)px_map; - while (pixels--) { + uint16_t *p = (uint16_t *)px_map; + while (pixels--) + { *p = (uint16_t)((*p >> 8) | (*p << 8)); p++; } @@ -33,6 +34,7 @@ lv_display_t *lvgl_lcd_init(uint32_t hor_res, uint32_t ver_res) // Hardware rotation is supported display->sw_rotate = 0; + display->render_mode = LV_DISPLAY_RENDER_MODE_PARTIAL; display->rotation = LV_DISPLAY_ROTATION_0; // Create SPI bus @@ -88,9 +90,9 @@ lv_display_t *lvgl_lcd_init(uint32_t hor_res, uint32_t ver_res) #if (DISPLAY_SWAP_XY) ESP_ERROR_CHECK(esp_lcd_panel_swap_xy(panel_handle, DISPLAY_SWAP_XY)); #endif -#if (DISPLAY_MIRROR_X || DISPLAY_MIRROR_Y) +#if (DISPLAY_MIRROR_X || DISPLAY_MIRROR_Y) ESP_ERROR_CHECK(esp_lcd_panel_mirror(panel_handle, DISPLAY_MIRROR_X, DISPLAY_MIRROR_Y)); -#endif +#endif #if (DISPLAY_GAP_X || DISPLAY_GAP_Y) ESP_ERROR_CHECK(esp_lcd_panel_set_gap(panel_handle, DISPLAY_GAP_X, DISPLAY_GAP_Y)); #endif diff --git a/src/lvgl_panel_st7262_par.c b/src/lvgl_panel_st7262_par.c index dfacf37..62a5bbe 100644 --- a/src/lvgl_panel_st7262_par.c +++ b/src/lvgl_panel_st7262_par.c @@ -25,6 +25,7 @@ lv_display_t *lvgl_lcd_init(uint32_t hor_res, uint32_t ver_res) // Hardware rotation is not supported display->sw_rotate = 1; + display->render_mode = LV_DISPLAY_RENDER_MODE_DIRECT; display->rotation = LV_DISPLAY_ROTATION_0; // Create direct_io panel handle @@ -61,8 +62,7 @@ lv_display_t *lvgl_lcd_init(uint32_t hor_res, uint32_t ver_res) .disp_gpio_num = ST7262_PANEL_CONFIG_DISP_GPIO_NUM, .on_frame_trans_done = direct_io_frame_trans_done, .user_ctx = display, - .flags = {.disp_active_low = ST7262_PANEL_CONFIG_FLAGS_DISP_ACTIVE_LOW, .relax_on_idle = ST7262_PANEL_CONFIG_FLAGS_RELAX_ON_IDLE, .fb_in_psram = ST7262_PANEL_CONFIG_FLAGS_FB_IN_PSRAM} - }; + .flags = {.disp_active_low = ST7262_PANEL_CONFIG_FLAGS_DISP_ACTIVE_LOW, .relax_on_idle = ST7262_PANEL_CONFIG_FLAGS_RELAX_ON_IDLE, .fb_in_psram = ST7262_PANEL_CONFIG_FLAGS_FB_IN_PSRAM}}; log_d("rgb_panel_config: clk_src:%d, timings:{pclk_hz:%d, h_res:%d, v_res:%d, hsync_pulse_width:%d, hsync_back_porch:%d, hsync_front_porch:%d, vsync_pulse_width:%d, vsync_back_porch:%d, vsync_front_porch:%d, flags:{hsync_idle_low:%d, vsync_idle_low:%d, de_idle_high:%d, pclk_active_neg:%d, pclk_idle_high:%d}}, data_width:%d, sram_trans_align:%d, psram_trans_align:%d, hsync_gpio_num:%d, vsync_gpio_num:%d, de_gpio_num:%d, pclk_gpio_num:%d, data_gpio_nums:[%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,], disp_gpio_num:%d, on_frame_trans_done:0x%08x, user_ctx:0x%08x, flags:{disp_active_low:%d, relax_on_idle:%d, fb_in_psram:%d}", rgb_panel_config.clk_src, rgb_panel_config.timings.pclk_hz, rgb_panel_config.timings.h_res, rgb_panel_config.timings.v_res, rgb_panel_config.timings.hsync_pulse_width, rgb_panel_config.timings.hsync_back_porch, rgb_panel_config.timings.hsync_front_porch, rgb_panel_config.timings.vsync_pulse_width, rgb_panel_config.timings.vsync_back_porch, rgb_panel_config.timings.vsync_front_porch, rgb_panel_config.timings.flags.hsync_idle_low, rgb_panel_config.timings.flags.vsync_idle_low, rgb_panel_config.timings.flags.de_idle_high, rgb_panel_config.timings.flags.pclk_active_neg, rgb_panel_config.timings.flags.pclk_idle_high, rgb_panel_config.data_width, rgb_panel_config.sram_trans_align, rgb_panel_config.psram_trans_align, rgb_panel_config.hsync_gpio_num, rgb_panel_config.vsync_gpio_num, rgb_panel_config.de_gpio_num, rgb_panel_config.pclk_gpio_num, rgb_panel_config.data_gpio_nums[0], rgb_panel_config.data_gpio_nums[1], rgb_panel_config.data_gpio_nums[2], rgb_panel_config.data_gpio_nums[3], rgb_panel_config.data_gpio_nums[4], rgb_panel_config.data_gpio_nums[5], rgb_panel_config.data_gpio_nums[6], rgb_panel_config.data_gpio_nums[7], rgb_panel_config.data_gpio_nums[8], rgb_panel_config.data_gpio_nums[9], rgb_panel_config.data_gpio_nums[10], rgb_panel_config.data_gpio_nums[11], rgb_panel_config.data_gpio_nums[12], rgb_panel_config.data_gpio_nums[13], rgb_panel_config.data_gpio_nums[14], rgb_panel_config.data_gpio_nums[15], rgb_panel_config.disp_gpio_num, rgb_panel_config.on_frame_trans_done, rgb_panel_config.user_ctx, rgb_panel_config.flags.disp_active_low, rgb_panel_config.flags.relax_on_idle, rgb_panel_config.flags.fb_in_psram); log_d("refresh rate: %d Hz", (ST7262_PANEL_CONFIG_TIMINGS_PCLK_HZ * ST7262_PANEL_CONFIG_DATA_WIDTH) / (ST7262_PANEL_CONFIG_TIMINGS_H_RES + ST7262_PANEL_CONFIG_TIMINGS_HSYNC_PULSE_WIDTH + ST7262_PANEL_CONFIG_TIMINGS_HSYNC_BACK_PORCH + ST7262_PANEL_CONFIG_TIMINGS_HSYNC_FRONT_PORCH) / (ST7262_PANEL_CONFIG_TIMINGS_V_RES + ST7262_PANEL_CONFIG_TIMINGS_VSYNC_PULSE_WIDTH + ST7262_PANEL_CONFIG_TIMINGS_VSYNC_BACK_PORCH + ST7262_PANEL_CONFIG_TIMINGS_VSYNC_FRONT_PORCH) / SOC_LCD_RGB_DATA_WIDTH); esp_lcd_panel_handle_t panel_handle; diff --git a/src/lvgl_panel_st7701_par.c b/src/lvgl_panel_st7701_par.c index 2ca5039..35bbe79 100644 --- a/src/lvgl_panel_st7701_par.c +++ b/src/lvgl_panel_st7701_par.c @@ -27,6 +27,7 @@ lv_display_t *lvgl_lcd_init(uint32_t hor_res, uint32_t ver_res) // Hardware rotation is not supported display->sw_rotate = 1; + display->render_mode = LV_DISPLAY_RENDER_MODE_DIRECT; display->rotation = LV_DISPLAY_ROTATION_0; // Install 3-wire SPI panel IO @@ -81,8 +82,7 @@ lv_display_t *lvgl_lcd_init(uint32_t hor_res, uint32_t ver_res) .disp_gpio_num = ST7701_PANEL_CONFIG_DISP_GPIO_NUM, .on_frame_trans_done = direct_io_frame_trans_done, .user_ctx = display, - .flags = {.disp_active_low = ST7701_PANEL_CONFIG_FLAGS_DISP_ACTIVE_LOW, .relax_on_idle = ST7701_PANEL_CONFIG_FLAGS_RELAX_ON_IDLE, .fb_in_psram = ST7701_PANEL_CONFIG_FLAGS_FB_IN_PSRAM} - }; + .flags = {.disp_active_low = ST7701_PANEL_CONFIG_FLAGS_DISP_ACTIVE_LOW, .relax_on_idle = ST7701_PANEL_CONFIG_FLAGS_RELAX_ON_IDLE, .fb_in_psram = ST7701_PANEL_CONFIG_FLAGS_FB_IN_PSRAM}}; log_d("rgb_panel_config: clk_src:%d, timings:{pclk_hz:%d, h_res:%d, v_res:%d, hsync_pulse_width:%d, hsync_back_porch:%d, hsync_front_porch:%d, vsync_pulse_width:%d, vsync_back_porch:%d, vsync_front_porch:%d, flags:{hsync_idle_low:%d, vsync_idle_low:%d, de_idle_high:%d, pclk_active_neg:%d, pclk_idle_high:%d}}, data_width:%d, sram_trans_align:%d, psram_trans_align:%d, hsync_gpio_num:%d, vsync_gpio_num:%d, de_gpio_num:%d, pclk_gpio_num:%d, data_gpio_nums:[%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d], disp_gpio_num:%d, on_frame_trans_done:0x%08x, user_ctx:0x%08x, flags:{disp_active_low:%d, relax_on_idle:%d, fb_in_psram:%d}", rgb_panel_config.clk_src, rgb_panel_config.timings.pclk_hz, rgb_panel_config.timings.h_res, rgb_panel_config.timings.v_res, rgb_panel_config.timings.hsync_pulse_width, rgb_panel_config.timings.hsync_back_porch, rgb_panel_config.timings.hsync_front_porch, rgb_panel_config.timings.vsync_pulse_width, rgb_panel_config.timings.vsync_back_porch, rgb_panel_config.timings.vsync_front_porch, rgb_panel_config.timings.flags.hsync_idle_low, rgb_panel_config.timings.flags.vsync_idle_low, rgb_panel_config.timings.flags.de_idle_high, rgb_panel_config.timings.flags.pclk_active_neg, rgb_panel_config.timings.flags.pclk_idle_high, rgb_panel_config.data_width, rgb_panel_config.sram_trans_align, rgb_panel_config.psram_trans_align, rgb_panel_config.hsync_gpio_num, rgb_panel_config.vsync_gpio_num, rgb_panel_config.de_gpio_num, rgb_panel_config.pclk_gpio_num, rgb_panel_config.data_gpio_nums[0], rgb_panel_config.data_gpio_nums[1], rgb_panel_config.data_gpio_nums[2], rgb_panel_config.data_gpio_nums[3], rgb_panel_config.data_gpio_nums[4], rgb_panel_config.data_gpio_nums[5], rgb_panel_config.data_gpio_nums[6], rgb_panel_config.data_gpio_nums[7], rgb_panel_config.data_gpio_nums[8], rgb_panel_config.data_gpio_nums[9], rgb_panel_config.data_gpio_nums[10], rgb_panel_config.data_gpio_nums[11], rgb_panel_config.data_gpio_nums[12], rgb_panel_config.data_gpio_nums[13], rgb_panel_config.data_gpio_nums[14], rgb_panel_config.data_gpio_nums[15], rgb_panel_config.disp_gpio_num, rgb_panel_config.on_frame_trans_done, rgb_panel_config.user_ctx, rgb_panel_config.flags.disp_active_low, rgb_panel_config.flags.relax_on_idle, rgb_panel_config.flags.fb_in_psram); log_d("refresh rate: %d Hz", (ST7701_PANEL_CONFIG_TIMINGS_PCLK_HZ * ST7701_PANEL_CONFIG_DATA_WIDTH) / (ST7701_PANEL_CONFIG_TIMINGS_H_RES + ST7701_PANEL_CONFIG_TIMINGS_HSYNC_PULSE_WIDTH + ST7701_PANEL_CONFIG_TIMINGS_HSYNC_BACK_PORCH + ST7701_PANEL_CONFIG_TIMINGS_HSYNC_FRONT_PORCH) / (ST7701_PANEL_CONFIG_TIMINGS_V_RES + ST7701_PANEL_CONFIG_TIMINGS_VSYNC_PULSE_WIDTH + ST7701_PANEL_CONFIG_TIMINGS_VSYNC_BACK_PORCH + ST7701_PANEL_CONFIG_TIMINGS_VSYNC_FRONT_PORCH) / SOC_LCD_RGB_DATA_WIDTH); const esp_lcd_panel_dev_config_t panel_dev_config = { diff --git a/src/lvgl_panel_st7789_i80.c b/src/lvgl_panel_st7789_i80.c index bc1e2d2..bd1b5cc 100644 --- a/src/lvgl_panel_st7789_i80.c +++ b/src/lvgl_panel_st7789_i80.c @@ -16,8 +16,9 @@ void st7789_lv_flush(lv_display_t *drv, const lv_area_t *area, uint8_t *px_map) { const esp_lcd_panel_handle_t panel_handle = drv->user_data; uint32_t pixels = lv_area_get_size(area); - uint16_t *p = (uint16_t*)px_map; - while (pixels--) { + uint16_t *p = (uint16_t *)px_map; + while (pixels--) + { *p = (uint16_t)((*p >> 8) | (*p << 8)); p++; } @@ -32,6 +33,7 @@ lv_display_t *lvgl_lcd_init(uint32_t hor_res, uint32_t ver_res) // Hardware rotation is supported display->sw_rotate = 0; + display->render_mode = LV_DISPLAY_RENDER_MODE_PARTIAL; display->rotation = LV_DISPLAY_ROTATION_0; pinMode(ST7789_RD_GPIO, OUTPUT); diff --git a/src/lvgl_panel_st7789_spi.c b/src/lvgl_panel_st7789_spi.c index 297080a..1ea14ca 100644 --- a/src/lvgl_panel_st7789_spi.c +++ b/src/lvgl_panel_st7789_spi.c @@ -17,8 +17,9 @@ void st7789_lv_flush(lv_display_t *display, const lv_area_t *area, uint8_t *px_m { esp_lcd_panel_handle_t panel_handle = display->user_data; uint32_t pixels = lv_area_get_size(area); - uint16_t *p = (uint16_t*)px_map; - while (pixels--) { + uint16_t *p = (uint16_t *)px_map; + while (pixels--) + { *p = (uint16_t)((*p >> 8) | (*p << 8)); p++; } @@ -33,6 +34,7 @@ lv_display_t *lvgl_lcd_init(uint32_t hor_res, uint32_t ver_res) // Hardware rotation is supported display->sw_rotate = 0; + display->render_mode = LV_DISPLAY_RENDER_MODE_PARTIAL; display->rotation = LV_DISPLAY_ROTATION_0; // Create SPI bus @@ -88,9 +90,9 @@ lv_display_t *lvgl_lcd_init(uint32_t hor_res, uint32_t ver_res) #if (DISPLAY_SWAP_XY) ESP_ERROR_CHECK(esp_lcd_panel_swap_xy(panel_handle, DISPLAY_SWAP_XY)); #endif -#if (DISPLAY_MIRROR_X || DISPLAY_MIRROR_Y) +#if (DISPLAY_MIRROR_X || DISPLAY_MIRROR_Y) ESP_ERROR_CHECK(esp_lcd_panel_mirror(panel_handle, DISPLAY_MIRROR_X, DISPLAY_MIRROR_Y)); -#endif +#endif #if (DISPLAY_GAP_X || DISPLAY_GAP_Y) ESP_ERROR_CHECK(esp_lcd_panel_set_gap(panel_handle, DISPLAY_GAP_X, DISPLAY_GAP_Y)); #endif diff --git a/src/lvgl_panel_st7796_spi.c b/src/lvgl_panel_st7796_spi.c index 7d594dc..49980bd 100644 --- a/src/lvgl_panel_st7796_spi.c +++ b/src/lvgl_panel_st7796_spi.c @@ -18,8 +18,9 @@ void st7796_lv_flush(lv_display_t *display, const lv_area_t *area, uint8_t *px_m { esp_lcd_panel_handle_t panel_handle = display->user_data; uint32_t pixels = lv_area_get_size(area); - uint16_t *p = (uint16_t*)px_map; - while (pixels--) { + uint16_t *p = (uint16_t *)px_map; + while (pixels--) + { *p = (uint16_t)((*p >> 8) | (*p << 8)); p++; } @@ -34,6 +35,7 @@ lv_display_t *lvgl_lcd_init(uint32_t hor_res, uint32_t ver_res) // Hardware rotation is supported display->sw_rotate = 0; + display->render_mode = LV_DISPLAY_RENDER_MODE_PARTIAL; display->rotation = LV_DISPLAY_ROTATION_0; // Create SPI bus @@ -89,9 +91,9 @@ lv_display_t *lvgl_lcd_init(uint32_t hor_res, uint32_t ver_res) #if (DISPLAY_SWAP_XY) ESP_ERROR_CHECK(esp_lcd_panel_swap_xy(panel_handle, DISPLAY_SWAP_XY)); #endif -#if (DISPLAY_MIRROR_X || DISPLAY_MIRROR_Y) +#if (DISPLAY_MIRROR_X || DISPLAY_MIRROR_Y) ESP_ERROR_CHECK(esp_lcd_panel_mirror(panel_handle, DISPLAY_MIRROR_X, DISPLAY_MIRROR_Y)); -#endif +#endif #if (DISPLAY_GAP_X || DISPLAY_GAP_Y) ESP_ERROR_CHECK(esp_lcd_panel_set_gap(panel_handle, DISPLAY_GAP_X, DISPLAY_GAP_Y)); #endif From 34de26f4aa39fb4209c6cb7eba35192357b52db4 Mon Sep 17 00:00:00 2001 From: Rene Zeldenthuis Date: Sun, 14 Jul 2024 18:10:17 +0200 Subject: [PATCH 14/21] Removed render mode setting --- src/lvgl_panel_gc9a01_spi.c | 1 - src/lvgl_panel_ili9341_spi.c | 1 - src/lvgl_panel_st7262_par.c | 1 - src/lvgl_panel_st7701_par.c | 1 - src/lvgl_panel_st7789_i80.c | 1 - src/lvgl_panel_st7789_spi.c | 1 - src/lvgl_panel_st7796_spi.c | 1 - 7 files changed, 7 deletions(-) diff --git a/src/lvgl_panel_gc9a01_spi.c b/src/lvgl_panel_gc9a01_spi.c index 9db1b2f..fa7bcce 100644 --- a/src/lvgl_panel_gc9a01_spi.c +++ b/src/lvgl_panel_gc9a01_spi.c @@ -38,7 +38,6 @@ lv_display_t *lvgl_lcd_init(uint32_t hor_res, uint32_t ver_res) // Hardware rotation is supported display->sw_rotate = 0; - display->render_mode = LV_DISPLAY_RENDER_MODE_PARTIAL; display->rotation = LV_DISPLAY_ROTATION_0; // Create SPI bus diff --git a/src/lvgl_panel_ili9341_spi.c b/src/lvgl_panel_ili9341_spi.c index d750300..5da41ed 100644 --- a/src/lvgl_panel_ili9341_spi.c +++ b/src/lvgl_panel_ili9341_spi.c @@ -34,7 +34,6 @@ lv_display_t *lvgl_lcd_init(uint32_t hor_res, uint32_t ver_res) // Hardware rotation is supported display->sw_rotate = 0; - display->render_mode = LV_DISPLAY_RENDER_MODE_PARTIAL; display->rotation = LV_DISPLAY_ROTATION_0; // Create SPI bus diff --git a/src/lvgl_panel_st7262_par.c b/src/lvgl_panel_st7262_par.c index 62a5bbe..6ca8c39 100644 --- a/src/lvgl_panel_st7262_par.c +++ b/src/lvgl_panel_st7262_par.c @@ -25,7 +25,6 @@ lv_display_t *lvgl_lcd_init(uint32_t hor_res, uint32_t ver_res) // Hardware rotation is not supported display->sw_rotate = 1; - display->render_mode = LV_DISPLAY_RENDER_MODE_DIRECT; display->rotation = LV_DISPLAY_ROTATION_0; // Create direct_io panel handle diff --git a/src/lvgl_panel_st7701_par.c b/src/lvgl_panel_st7701_par.c index 35bbe79..17bf849 100644 --- a/src/lvgl_panel_st7701_par.c +++ b/src/lvgl_panel_st7701_par.c @@ -27,7 +27,6 @@ lv_display_t *lvgl_lcd_init(uint32_t hor_res, uint32_t ver_res) // Hardware rotation is not supported display->sw_rotate = 1; - display->render_mode = LV_DISPLAY_RENDER_MODE_DIRECT; display->rotation = LV_DISPLAY_ROTATION_0; // Install 3-wire SPI panel IO diff --git a/src/lvgl_panel_st7789_i80.c b/src/lvgl_panel_st7789_i80.c index bd1b5cc..f67c989 100644 --- a/src/lvgl_panel_st7789_i80.c +++ b/src/lvgl_panel_st7789_i80.c @@ -33,7 +33,6 @@ lv_display_t *lvgl_lcd_init(uint32_t hor_res, uint32_t ver_res) // Hardware rotation is supported display->sw_rotate = 0; - display->render_mode = LV_DISPLAY_RENDER_MODE_PARTIAL; display->rotation = LV_DISPLAY_ROTATION_0; pinMode(ST7789_RD_GPIO, OUTPUT); diff --git a/src/lvgl_panel_st7789_spi.c b/src/lvgl_panel_st7789_spi.c index 1ea14ca..af568e6 100644 --- a/src/lvgl_panel_st7789_spi.c +++ b/src/lvgl_panel_st7789_spi.c @@ -34,7 +34,6 @@ lv_display_t *lvgl_lcd_init(uint32_t hor_res, uint32_t ver_res) // Hardware rotation is supported display->sw_rotate = 0; - display->render_mode = LV_DISPLAY_RENDER_MODE_PARTIAL; display->rotation = LV_DISPLAY_ROTATION_0; // Create SPI bus diff --git a/src/lvgl_panel_st7796_spi.c b/src/lvgl_panel_st7796_spi.c index 49980bd..b4d50c4 100644 --- a/src/lvgl_panel_st7796_spi.c +++ b/src/lvgl_panel_st7796_spi.c @@ -35,7 +35,6 @@ lv_display_t *lvgl_lcd_init(uint32_t hor_res, uint32_t ver_res) // Hardware rotation is supported display->sw_rotate = 0; - display->render_mode = LV_DISPLAY_RENDER_MODE_PARTIAL; display->rotation = LV_DISPLAY_ROTATION_0; // Create SPI bus From 4355015d2550540e91cf0b563b624bfeba19bf9c Mon Sep 17 00:00:00 2001 From: Rene Zeldenthuis Date: Sun, 14 Jul 2024 23:46:11 +0200 Subject: [PATCH 15/21] Work in progress sw rotation --- src/esp32_smartdisplay.c | 51 ++++++++++++++----------------- src/lvgl_panel_gc9a01_spi.c | 8 +++-- src/lvgl_panel_ili9341_spi.c | 8 +++-- src/lvgl_panel_st7262_par.c | 58 +++++++++++++++++++++++++++++++----- src/lvgl_panel_st7701_par.c | 12 ++++---- src/lvgl_panel_st7789_i80.c | 6 +++- src/lvgl_panel_st7789_spi.c | 6 +++- src/lvgl_panel_st7796_spi.c | 6 +++- 8 files changed, 106 insertions(+), 49 deletions(-) diff --git a/src/esp32_smartdisplay.c b/src/esp32_smartdisplay.c index 75f7fcc..ccf1809 100644 --- a/src/esp32_smartdisplay.c +++ b/src/esp32_smartdisplay.c @@ -10,7 +10,7 @@ #define BRIGHTNESS_DARK_ZONE 250 // Functions to be defined in the tft/touch driver -extern lv_display_t *lvgl_lcd_init(uint32_t hor_res, uint32_t ver_res); +extern lv_display_t *lvgl_lcd_init(); extern lv_indev_t *lvgl_touch_init(); lv_display_t *display; @@ -192,13 +192,11 @@ void smartdisplay_init() ledcAttachPin(GPIO_BCKL, PWM_CHANNEL_BCKL); #endif // Setup TFT display - display = lvgl_lcd_init(DISPLAY_WIDTH, DISPLAY_HEIGHT); - // Create drawBuffer - uint32_t drawBufferSize = sizeof(lv_color_t) * LVGL_BUFFER_PIXELS; - void *drawBuffer = heap_caps_malloc(drawBufferSize, LVGL_BUFFER_MALLOC_FLAGS); - lv_display_set_buffers(display, drawBuffer, NULL, drawBufferSize, LV_DISPLAY_RENDER_MODE_PARTIAL); + display = lvgl_lcd_init(); // Register callback for hardware rotation - lv_display_add_event_cb(display, lvgl_display_resolution_changed_callback, LV_EVENT_RESOLUTION_CHANGED, NULL); + if (!display->sw_rotate) + lv_display_add_event_cb(display, lvgl_display_resolution_changed_callback, LV_EVENT_RESOLUTION_CHANGED, NULL); + // Clear screen lv_obj_clean(lv_scr_act()); // Turn backlight on (50%) @@ -222,27 +220,24 @@ void smartdisplay_init() // Thus, LV_DISPLAY_ROTATION_90 means you rotate the hardware 90 degrees clockwise, and the display rotates 90 degrees counterclockwise to compensate. void lvgl_display_resolution_changed_callback(lv_event_t *event) { - if (!display->sw_rotate) + const esp_lcd_panel_handle_t panel_handle = display->user_data; + switch (display->rotation) { - const esp_lcd_panel_handle_t panel_handle = display->user_data; - switch (display->rotation) - { - case LV_DISPLAY_ROTATION_0: - ESP_ERROR_CHECK(esp_lcd_panel_swap_xy(panel_handle, DISPLAY_SWAP_XY)); - ESP_ERROR_CHECK(esp_lcd_panel_mirror(panel_handle, DISPLAY_MIRROR_X, DISPLAY_MIRROR_Y)); - break; - case LV_DISPLAY_ROTATION_90: - ESP_ERROR_CHECK(esp_lcd_panel_swap_xy(panel_handle, !DISPLAY_SWAP_XY)); - ESP_ERROR_CHECK(esp_lcd_panel_mirror(panel_handle, DISPLAY_MIRROR_X, !DISPLAY_MIRROR_Y)); - break; - case LV_DISPLAY_ROTATION_180: - ESP_ERROR_CHECK(esp_lcd_panel_swap_xy(panel_handle, DISPLAY_SWAP_XY)); - ESP_ERROR_CHECK(esp_lcd_panel_mirror(panel_handle, !DISPLAY_MIRROR_X, !DISPLAY_MIRROR_Y)); - break; - case LV_DISPLAY_ROTATION_270: - ESP_ERROR_CHECK(esp_lcd_panel_swap_xy(panel_handle, !DISPLAY_SWAP_XY)); - ESP_ERROR_CHECK(esp_lcd_panel_mirror(panel_handle, !DISPLAY_MIRROR_X, DISPLAY_MIRROR_Y)); - break; - } + case LV_DISPLAY_ROTATION_0: + ESP_ERROR_CHECK(esp_lcd_panel_swap_xy(panel_handle, DISPLAY_SWAP_XY)); + ESP_ERROR_CHECK(esp_lcd_panel_mirror(panel_handle, DISPLAY_MIRROR_X, DISPLAY_MIRROR_Y)); + break; + case LV_DISPLAY_ROTATION_90: + ESP_ERROR_CHECK(esp_lcd_panel_swap_xy(panel_handle, !DISPLAY_SWAP_XY)); + ESP_ERROR_CHECK(esp_lcd_panel_mirror(panel_handle, DISPLAY_MIRROR_X, !DISPLAY_MIRROR_Y)); + break; + case LV_DISPLAY_ROTATION_180: + ESP_ERROR_CHECK(esp_lcd_panel_swap_xy(panel_handle, DISPLAY_SWAP_XY)); + ESP_ERROR_CHECK(esp_lcd_panel_mirror(panel_handle, !DISPLAY_MIRROR_X, !DISPLAY_MIRROR_Y)); + break; + case LV_DISPLAY_ROTATION_270: + ESP_ERROR_CHECK(esp_lcd_panel_swap_xy(panel_handle, !DISPLAY_SWAP_XY)); + ESP_ERROR_CHECK(esp_lcd_panel_mirror(panel_handle, !DISPLAY_MIRROR_X, DISPLAY_MIRROR_Y)); + break; } } \ No newline at end of file diff --git a/src/lvgl_panel_gc9a01_spi.c b/src/lvgl_panel_gc9a01_spi.c index fa7bcce..7360336 100644 --- a/src/lvgl_panel_gc9a01_spi.c +++ b/src/lvgl_panel_gc9a01_spi.c @@ -31,10 +31,14 @@ void gc9a01_lv_flush(lv_display_t *display, const lv_area_t *area, uint8_t *px_m ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap(panel_handle, area->x1, area->y1, area->x2 + 1, area->y2 + 1, px_map)); }; -lv_display_t *lvgl_lcd_init(uint32_t hor_res, uint32_t ver_res) +lv_display_t *lvgl_lcd_init() { - lv_display_t *display = lv_display_create(hor_res, ver_res); + lv_display_t *display = lv_display_create(DISPLAY_WIDTH, DISPLAY_HEIGHT); log_v("display:0x%08x", display); + // Create drawBuffer + uint32_t drawBufferSize = sizeof(lv_color_t) * LVGL_BUFFER_PIXELS; + void *drawBuffer = heap_caps_malloc(drawBufferSize, LVGL_BUFFER_MALLOC_FLAGS); + lv_display_set_buffers(display, drawBuffer, NULL, drawBufferSize, LV_DISPLAY_RENDER_MODE_PARTIAL); // Hardware rotation is supported display->sw_rotate = 0; diff --git a/src/lvgl_panel_ili9341_spi.c b/src/lvgl_panel_ili9341_spi.c index 5da41ed..62f20f7 100644 --- a/src/lvgl_panel_ili9341_spi.c +++ b/src/lvgl_panel_ili9341_spi.c @@ -27,10 +27,14 @@ void ili9341_lv_flush(lv_display_t *display, const lv_area_t *area, uint8_t *px_ ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap(panel_handle, area->x1, area->y1, area->x2 + 1, area->y2 + 1, px_map)); }; -lv_display_t *lvgl_lcd_init(uint32_t hor_res, uint32_t ver_res) +lv_display_t *lvgl_lcd_init() { - lv_display_t *display = lv_display_create(hor_res, ver_res); + lv_display_t *display = lv_display_create(DISPLAY_WIDTH, DISPLAY_HEIGHT); log_v("display:0x%08x", display); + // Create drawBuffer + uint32_t drawBufferSize = sizeof(lv_color_t) * LVGL_BUFFER_PIXELS; + void *drawBuffer = heap_caps_malloc(drawBufferSize, LVGL_BUFFER_MALLOC_FLAGS); + lv_display_set_buffers(display, drawBuffer, NULL, drawBufferSize, LV_DISPLAY_RENDER_MODE_PARTIAL); // Hardware rotation is supported display->sw_rotate = 0; diff --git a/src/lvgl_panel_st7262_par.c b/src/lvgl_panel_st7262_par.c index 6ca8c39..a34adaa 100644 --- a/src/lvgl_panel_st7262_par.c +++ b/src/lvgl_panel_st7262_par.c @@ -14,14 +14,59 @@ bool direct_io_frame_trans_done(esp_lcd_panel_handle_t panel, esp_lcd_rgb_panel_ void direct_io_lv_flush(lv_display_t *display, const lv_area_t *area, uint8_t *px_map) { const esp_lcd_panel_handle_t panel_handle = display->user_data; - // LV_COLOR_16_SWAP is handled by mapping of the data - ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap(panel_handle, area->x1, area->y1, area->x2 + 1, area->y2 + 1, px_map)); + + lv_display_rotation_t rotation = lv_display_get_rotation(display); + if (rotation == LV_DISPLAY_ROTATION_0) + { + ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap(panel_handle, area->x1, area->y1, area->x2 + 1, area->y2 + 1, px_map)); + return; + } + + // Rotated + int32_t w = lv_area_get_width(area); + int32_t h = lv_area_get_height(area); + lv_color_format_t cf = lv_display_get_color_format(display); + uint32_t px_size = lv_color_format_get_size(cf); + size_t buf_size = w * h * px_size; + log_v("alloc rotation buffer to: %u bytes", buf_size); + void *rotation_buffer = heap_caps_malloc(buf_size, LVGL_BUFFER_MALLOC_FLAGS); + assert(rotation_buffer != NULL); + + uint32_t w_stride = lv_draw_buf_width_to_stride(w, cf); + uint32_t h_stride = lv_draw_buf_width_to_stride(h, cf); + + switch (rotation) + { + case LV_DISPLAY_ROTATION_90: + lv_draw_sw_rotate(px_map, rotation_buffer, w, h, w_stride, h_stride, rotation, cf); + ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap(panel_handle, area->y1, display->ver_res - area->x1 - w, area->y1 + h, display->ver_res - area->x1, rotation_buffer)); + break; + case LV_DISPLAY_ROTATION_180: + lv_draw_sw_rotate(px_map, rotation_buffer, w, h, w_stride, w_stride, rotation, cf); + ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap(panel_handle, display->hor_res - area->x1 - w, display->ver_res - area->y1 - h, display->hor_res - area->x1, display->ver_res - area->y1, rotation_buffer)); + break; + case LV_DISPLAY_ROTATION_270: + lv_draw_sw_rotate(px_map, rotation_buffer, w, h, w_stride, h_stride, rotation, cf); + ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap(panel_handle, display->hor_res - area->y2 - 1, area->x2 - w + 1, display->hor_res - area->y2 - 1 + h, area->x2 + 1, rotation_buffer)); + break; + default: + assert(false); + break; + } + + free(rotation_buffer); }; -lv_display_t *lvgl_lcd_init(uint32_t hor_res, uint32_t ver_res) +lv_display_t *lvgl_lcd_init() { - lv_display_t *display = lv_display_create(hor_res, ver_res); + lv_display_t *display = lv_display_create(DISPLAY_WIDTH, DISPLAY_HEIGHT); log_v("display:0x%08x", display); + // Create drawBuffer + lv_color_format_t cf = lv_display_get_color_format(display); + uint32_t px_size = lv_color_format_get_size(cf); + uint32_t drawBufferSize = px_size * LVGL_BUFFER_PIXELS; + void *drawBuffer = heap_caps_malloc(drawBufferSize, LVGL_BUFFER_MALLOC_FLAGS); + lv_display_set_buffers(display, drawBuffer, NULL, drawBufferSize, LV_DISPLAY_RENDER_MODE_PARTIAL); // Hardware rotation is not supported display->sw_rotate = 1; @@ -53,11 +98,8 @@ lv_display_t *lvgl_lcd_init(uint32_t hor_res, uint32_t ver_res) .vsync_gpio_num = ST7262_PANEL_CONFIG_VSYNC_GPIO_NUM, .de_gpio_num = ST7262_PANEL_CONFIG_DE_GPIO_NUM, .pclk_gpio_num = ST7262_PANEL_CONFIG_PCLK_GPIO_NUM, -#if LV_COLOR_16_SWAP == 0 + // LV_COLOR_16_SWAP is handled by mapping of the data .data_gpio_nums = {ST7262_PANEL_CONFIG_DATA_GPIO_R0, ST7262_PANEL_CONFIG_DATA_GPIO_R1, ST7262_PANEL_CONFIG_DATA_GPIO_R2, ST7262_PANEL_CONFIG_DATA_GPIO_R3, ST7262_PANEL_CONFIG_DATA_GPIO_R4, ST7262_PANEL_CONFIG_DATA_GPIO_G0, ST7262_PANEL_CONFIG_DATA_GPIO_G1, ST7262_PANEL_CONFIG_DATA_GPIO_G2, ST7262_PANEL_CONFIG_DATA_GPIO_G3, ST7262_PANEL_CONFIG_DATA_GPIO_G4, ST7262_PANEL_CONFIG_DATA_GPIO_G5, ST7262_PANEL_CONFIG_DATA_GPIO_B0, ST7262_PANEL_CONFIG_DATA_GPIO_B1, ST7262_PANEL_CONFIG_DATA_GPIO_B2, ST7262_PANEL_CONFIG_DATA_GPIO_B3, ST7262_PANEL_CONFIG_DATA_GPIO_B4}, -#else - .data_gpio_nums = {ST7262_PANEL_CONFIG_DATA_GPIO_G3, ST7262_PANEL_CONFIG_DATA_GPIO_G4, ST7262_PANEL_CONFIG_DATA_GPIO_G5, ST7262_PANEL_CONFIG_DATA_GPIO_B0, ST7262_PANEL_CONFIG_DATA_GPIO_B1, ST7262_PANEL_CONFIG_DATA_GPIO_B2, ST7262_PANEL_CONFIG_DATA_GPIO_B3, ST7262_PANEL_CONFIG_DATA_GPIO_B4, ST7262_PANEL_CONFIG_DATA_GPIO_R0, ST7262_PANEL_CONFIG_DATA_GPIO_R1, ST7262_PANEL_CONFIG_DATA_GPIO_R2, ST7262_PANEL_CONFIG_DATA_GPIO_R3, ST7262_PANEL_CONFIG_DATA_GPIO_R4, ST7262_PANEL_CONFIG_DATA_GPIO_G0, ST7262_PANEL_CONFIG_DATA_GPIO_G1, ST7262_PANEL_CONFIG_DATA_GPIO_G2}, -#endif .disp_gpio_num = ST7262_PANEL_CONFIG_DISP_GPIO_NUM, .on_frame_trans_done = direct_io_frame_trans_done, .user_ctx = display, diff --git a/src/lvgl_panel_st7701_par.c b/src/lvgl_panel_st7701_par.c index 17bf849..95a2078 100644 --- a/src/lvgl_panel_st7701_par.c +++ b/src/lvgl_panel_st7701_par.c @@ -20,10 +20,14 @@ void direct_io_lv_flush(lv_display_t *display, const lv_area_t *area, uint8_t *p ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap(panel_handle, area->x1, area->y1, area->x2 + 1, area->y2 + 1, px_map)); }; -lv_display_t *lvgl_lcd_init(uint32_t hor_res, uint32_t ver_res) +lv_display_t *lvgl_lcd_init() { - lv_display_t *display = lv_display_create(hor_res, ver_res); + lv_display_t *display = lv_display_create(DISPLAY_WIDTH, DISPLAY_HEIGHT); log_v("display:0x%08x", display); + // Create drawBuffer + uint32_t drawBufferSize = sizeof(lv_color_t) * LVGL_BUFFER_PIXELS; + void *drawBuffer = heap_caps_malloc(drawBufferSize, LVGL_BUFFER_MALLOC_FLAGS); + lv_display_set_buffers(display, drawBuffer, NULL, drawBufferSize, LV_DISPLAY_RENDER_MODE_PARTIAL); // Hardware rotation is not supported display->sw_rotate = 1; @@ -73,11 +77,7 @@ lv_display_t *lvgl_lcd_init(uint32_t hor_res, uint32_t ver_res) .vsync_gpio_num = ST7701_PANEL_CONFIG_VSYNC_GPIO_NUM, .de_gpio_num = ST7701_PANEL_CONFIG_DE_GPIO_NUM, .pclk_gpio_num = ST7701_PANEL_CONFIG_PCLK_GPIO_NUM, -#if LV_COLOR_16_SWAP == 0 .data_gpio_nums = {ST7701_PANEL_CONFIG_DATA_GPIO_R0, ST7701_PANEL_CONFIG_DATA_GPIO_R1, ST7701_PANEL_CONFIG_DATA_GPIO_R2, ST7701_PANEL_CONFIG_DATA_GPIO_R3, ST7701_PANEL_CONFIG_DATA_GPIO_R4, ST7701_PANEL_CONFIG_DATA_GPIO_G0, ST7701_PANEL_CONFIG_DATA_GPIO_G1, ST7701_PANEL_CONFIG_DATA_GPIO_G2, ST7701_PANEL_CONFIG_DATA_GPIO_G3, ST7701_PANEL_CONFIG_DATA_GPIO_G4, ST7701_PANEL_CONFIG_DATA_GPIO_G5, ST7701_PANEL_CONFIG_DATA_GPIO_B0, ST7701_PANEL_CONFIG_DATA_GPIO_B1, ST7701_PANEL_CONFIG_DATA_GPIO_B2, ST7701_PANEL_CONFIG_DATA_GPIO_B3, ST7701_PANEL_CONFIG_DATA_GPIO_B4}, -#else - .data_gpio_nums = {ST7701_PANEL_CONFIG_DATA_GPIO_G3, ST7701_PANEL_CONFIG_DATA_GPIO_G4, ST7701_PANEL_CONFIG_DATA_GPIO_G5, ST7701_PANEL_CONFIG_DATA_GPIO_B0, ST7701_PANEL_CONFIG_DATA_GPIO_B1, ST7701_PANEL_CONFIG_DATA_GPIO_B2, ST7701_PANEL_CONFIG_DATA_GPIO_B3, ST7701_PANEL_CONFIG_DATA_GPIO_B4, ST7701_PANEL_CONFIG_DATA_GPIO_R0, ST7701_PANEL_CONFIG_DATA_GPIO_R1, ST7701_PANEL_CONFIG_DATA_GPIO_R2, ST7701_PANEL_CONFIG_DATA_GPIO_R3, ST7701_PANEL_CONFIG_DATA_GPIO_R4, ST7701_PANEL_CONFIG_DATA_GPIO_G0, ST7701_PANEL_CONFIG_DATA_GPIO_G1, ST7701_PANEL_CONFIG_DATA_GPIO_G2}, -#endif .disp_gpio_num = ST7701_PANEL_CONFIG_DISP_GPIO_NUM, .on_frame_trans_done = direct_io_frame_trans_done, .user_ctx = display, diff --git a/src/lvgl_panel_st7789_i80.c b/src/lvgl_panel_st7789_i80.c index f67c989..5ef0558 100644 --- a/src/lvgl_panel_st7789_i80.c +++ b/src/lvgl_panel_st7789_i80.c @@ -28,8 +28,12 @@ void st7789_lv_flush(lv_display_t *drv, const lv_area_t *area, uint8_t *px_map) lv_display_t *lvgl_lcd_init(uint32_t hor_res, uint32_t ver_res) { - lv_display_t *display = lv_display_create(hor_res, ver_res); + lv_display_t *display = lv_display_create(DISPLAY_WIDTH, DISPLAY_HEIGHT); log_v("display:0x%08x", display); + // Create drawBuffer + uint32_t drawBufferSize = sizeof(lv_color_t) * LVGL_BUFFER_PIXELS; + void *drawBuffer = heap_caps_malloc(drawBufferSize, LVGL_BUFFER_MALLOC_FLAGS); + lv_display_set_buffers(display, drawBuffer, NULL, drawBufferSize, LV_DISPLAY_RENDER_MODE_PARTIAL); // Hardware rotation is supported display->sw_rotate = 0; diff --git a/src/lvgl_panel_st7789_spi.c b/src/lvgl_panel_st7789_spi.c index af568e6..cfdfa9a 100644 --- a/src/lvgl_panel_st7789_spi.c +++ b/src/lvgl_panel_st7789_spi.c @@ -29,8 +29,12 @@ void st7789_lv_flush(lv_display_t *display, const lv_area_t *area, uint8_t *px_m lv_display_t *lvgl_lcd_init(uint32_t hor_res, uint32_t ver_res) { - lv_display_t *display = lv_display_create(hor_res, ver_res); + lv_display_t *display = lv_display_create(DISPLAY_WIDTH, DISPLAY_HEIGHT); log_v("display:0x%08x", display); + // Create drawBuffer + uint32_t drawBufferSize = sizeof(lv_color_t) * LVGL_BUFFER_PIXELS; + void *drawBuffer = heap_caps_malloc(drawBufferSize, LVGL_BUFFER_MALLOC_FLAGS); + lv_display_set_buffers(display, drawBuffer, NULL, drawBufferSize, LV_DISPLAY_RENDER_MODE_PARTIAL); // Hardware rotation is supported display->sw_rotate = 0; diff --git a/src/lvgl_panel_st7796_spi.c b/src/lvgl_panel_st7796_spi.c index b4d50c4..08c9807 100644 --- a/src/lvgl_panel_st7796_spi.c +++ b/src/lvgl_panel_st7796_spi.c @@ -30,8 +30,12 @@ void st7796_lv_flush(lv_display_t *display, const lv_area_t *area, uint8_t *px_m lv_display_t *lvgl_lcd_init(uint32_t hor_res, uint32_t ver_res) { - lv_display_t *display = lv_display_create(hor_res, ver_res); + lv_display_t *display = lv_display_create(DISPLAY_WIDTH, DISPLAY_HEIGHT); log_v("display:0x%08x", display); + // Create drawBuffer + uint32_t drawBufferSize = sizeof(lv_color_t) * LVGL_BUFFER_PIXELS; + void *drawBuffer = heap_caps_malloc(drawBufferSize, LVGL_BUFFER_MALLOC_FLAGS); + lv_display_set_buffers(display, drawBuffer, NULL, drawBufferSize, LV_DISPLAY_RENDER_MODE_PARTIAL); // Hardware rotation is supported display->sw_rotate = 0; From da60a84ffdf077c6773f7f5ea787968eeced8283 Mon Sep 17 00:00:00 2001 From: Rene Zeldenthuis Date: Sun, 25 Aug 2024 17:24:10 +0200 Subject: [PATCH 16/21] Use direct url to lvgl9 git --- boards | 2 +- library.json | 2 +- platformio.ini | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/boards b/boards index 1b69451..ae8d611 160000 --- a/boards +++ b/boards @@ -1 +1 @@ -Subproject commit 1b69451083fbc84bed7bc61b126154d0d0906b89 +Subproject commit ae8d611a0ed8dacc744246bcaabd6711ccf793e9 diff --git a/library.json b/library.json index 945b7b8..c0c2003 100644 --- a/library.json +++ b/library.json @@ -35,6 +35,6 @@ "frameworks": "arduino", "platforms": "espressif32", "dependencies": { - "lvgl/lvgl": "^9.1.0" + "lvgl/lvgl": "https://github.com/lvgl/lvgl.git" } } \ No newline at end of file diff --git a/platformio.ini b/platformio.ini index 4854c01..c707d6d 100644 --- a/platformio.ini +++ b/platformio.ini @@ -57,7 +57,9 @@ build_flags = '-D ESP_LCD_PANEL_IO_ADDITIONS_VER_PATCH=1' lib_deps = - lvgl/lvgl@^9.1.0 + # Use direct git because rotation commit is after 9.1 + https://github.com/lvgl/lvgl.git + #lvgl/lvgl@^9.1.0 # The platformio.test_dir contains the test_main.cpp just to have an setup() and loop() function # so it will compile ${platformio.test_dir} From 58483aa2228e8ef1a15bad9e8b03c893e147ece2 Mon Sep 17 00:00:00 2001 From: Rene Zeldenthuis Date: Sun, 25 Aug 2024 17:39:50 +0200 Subject: [PATCH 17/21] misc/lv_timer_private.h --- include/esp32_smartdisplay.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/esp32_smartdisplay.h b/include/esp32_smartdisplay.h index b95b3d7..87b5aa3 100644 --- a/include/esp32_smartdisplay.h +++ b/include/esp32_smartdisplay.h @@ -4,6 +4,7 @@ #include #include #include +#include #include // Use last PWM_CHANNEL for backlight From a77032bb057f2bf9da8b798972e92ee50f4b34af Mon Sep 17 00:00:00 2001 From: Rene Zeldenthuis Date: Sun, 25 Aug 2024 17:54:52 +0200 Subject: [PATCH 18/21] Use lvgl ^9.1.0 --- library.json | 2 +- platformio.ini | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/library.json b/library.json index c0c2003..945b7b8 100644 --- a/library.json +++ b/library.json @@ -35,6 +35,6 @@ "frameworks": "arduino", "platforms": "espressif32", "dependencies": { - "lvgl/lvgl": "https://github.com/lvgl/lvgl.git" + "lvgl/lvgl": "^9.1.0" } } \ No newline at end of file diff --git a/platformio.ini b/platformio.ini index c707d6d..4854c01 100644 --- a/platformio.ini +++ b/platformio.ini @@ -57,9 +57,7 @@ build_flags = '-D ESP_LCD_PANEL_IO_ADDITIONS_VER_PATCH=1' lib_deps = - # Use direct git because rotation commit is after 9.1 - https://github.com/lvgl/lvgl.git - #lvgl/lvgl@^9.1.0 + lvgl/lvgl@^9.1.0 # The platformio.test_dir contains the test_main.cpp just to have an setup() and loop() function # so it will compile ${platformio.test_dir} From c37776186041fa2dcef6eaed3d81d71c4bc76bbc Mon Sep 17 00:00:00 2001 From: Rene Zeldenthuis Date: Sun, 25 Aug 2024 18:07:58 +0200 Subject: [PATCH 19/21] Disable line include . Is for LVLG 9.1.0+ --- include/esp32_smartdisplay.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/esp32_smartdisplay.h b/include/esp32_smartdisplay.h index 87b5aa3..91ec1f8 100644 --- a/include/esp32_smartdisplay.h +++ b/include/esp32_smartdisplay.h @@ -4,7 +4,7 @@ #include #include #include -#include +//#include #include // Use last PWM_CHANNEL for backlight From 9a8e37f9b63d8a399faf58d0c080423a16e7059f Mon Sep 17 00:00:00 2001 From: Rene Zeldenthuis Date: Sun, 25 Aug 2024 18:20:47 +0200 Subject: [PATCH 20/21] Use latest lvgl --- include/esp32_smartdisplay.h | 2 +- library.json | 2 +- platformio.ini | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/esp32_smartdisplay.h b/include/esp32_smartdisplay.h index 91ec1f8..87b5aa3 100644 --- a/include/esp32_smartdisplay.h +++ b/include/esp32_smartdisplay.h @@ -4,7 +4,7 @@ #include #include #include -//#include +#include #include // Use last PWM_CHANNEL for backlight diff --git a/library.json b/library.json index 945b7b8..c0c2003 100644 --- a/library.json +++ b/library.json @@ -35,6 +35,6 @@ "frameworks": "arduino", "platforms": "espressif32", "dependencies": { - "lvgl/lvgl": "^9.1.0" + "lvgl/lvgl": "https://github.com/lvgl/lvgl.git" } } \ No newline at end of file diff --git a/platformio.ini b/platformio.ini index 4854c01..c707d6d 100644 --- a/platformio.ini +++ b/platformio.ini @@ -57,7 +57,9 @@ build_flags = '-D ESP_LCD_PANEL_IO_ADDITIONS_VER_PATCH=1' lib_deps = - lvgl/lvgl@^9.1.0 + # Use direct git because rotation commit is after 9.1 + https://github.com/lvgl/lvgl.git + #lvgl/lvgl@^9.1.0 # The platformio.test_dir contains the test_main.cpp just to have an setup() and loop() function # so it will compile ${platformio.test_dir} From c465c7e53893925164caf5cbb2f725c57ed4de5a Mon Sep 17 00:00:00 2001 From: Rene Zeldenthuis Date: Mon, 26 Aug 2024 22:38:16 +0200 Subject: [PATCH 21/21] Pin library to v9.2 --- library.json | 2 +- platformio.ini | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/library.json b/library.json index c0c2003..a9a0fa5 100644 --- a/library.json +++ b/library.json @@ -35,6 +35,6 @@ "frameworks": "arduino", "platforms": "espressif32", "dependencies": { - "lvgl/lvgl": "https://github.com/lvgl/lvgl.git" + "lvgl/lvgl": "https://github.com/lvgl/lvgl.git#d39fc17" } } \ No newline at end of file diff --git a/platformio.ini b/platformio.ini index c707d6d..75c7b88 100644 --- a/platformio.ini +++ b/platformio.ini @@ -57,8 +57,8 @@ build_flags = '-D ESP_LCD_PANEL_IO_ADDITIONS_VER_PATCH=1' lib_deps = - # Use direct git because rotation commit is after 9.1 - https://github.com/lvgl/lvgl.git + # Use direct git because rotation commit is after 9.1. So pin the build to v9.2 + https://github.com/lvgl/lvgl.git#d39fc17 #lvgl/lvgl@^9.1.0 # The platformio.test_dir contains the test_main.cpp just to have an setup() and loop() function # so it will compile