forked from espressif/esp-idf
esp_lcd: remove lvgl v7 port in test cases
LVGL porting examples are temporarily left in test folder. Now we can remove it, as we have lvgl examples in esp-idf. And lvgl v7 is legacy, we recommend to use lvgl v8
This commit is contained in:
@@ -71,59 +71,3 @@ TEST_CASE("lcd panel with i2c interface (ssd1306)", "[lcd]")
|
||||
TEST_ESP_OK(esp_lcd_panel_io_del(io_handle));
|
||||
TEST_ESP_OK(i2c_driver_delete(TEST_I2C_HOST_ID));
|
||||
}
|
||||
|
||||
// The following test shows a porting example of LVGL GUI library
|
||||
// To run the LVGL tests, you need to clone the LVGL library into components directory firstly
|
||||
#if CONFIG_LV_USE_USER_DATA
|
||||
#include "test_lvgl_port.h"
|
||||
#if CONFIG_LV_COLOR_DEPTH_1
|
||||
static bool notify_lvgl_ready_to_flush(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_io_event_data_t *edata, void *user_ctx)
|
||||
{
|
||||
lv_disp_t *disp = *(lv_disp_t **)user_ctx;
|
||||
lv_disp_flush_ready(&disp->driver);
|
||||
return false;
|
||||
}
|
||||
|
||||
TEST_CASE("lvgl gui with i2c interface (ssd1306)", "[lcd][lvgl][ignore]")
|
||||
{
|
||||
// initialize LVGL graphics library
|
||||
lv_disp_t *disp = NULL;
|
||||
lv_init();
|
||||
|
||||
i2c_config_t conf = {
|
||||
.mode = I2C_MODE_MASTER,
|
||||
.sda_io_num = TEST_I2C_SDA_GPIO,
|
||||
.scl_io_num = TEST_I2C_SCL_GPIO,
|
||||
.sda_pullup_en = GPIO_PULLUP_ENABLE,
|
||||
.scl_pullup_en = GPIO_PULLUP_ENABLE,
|
||||
.master.clk_speed = TEST_LCD_PIXEL_CLOCK_HZ,
|
||||
};
|
||||
TEST_ESP_OK(i2c_param_config(TEST_I2C_HOST_ID, &conf));
|
||||
TEST_ESP_OK(i2c_driver_install(TEST_I2C_HOST_ID, I2C_MODE_MASTER, 0, 0, 0));
|
||||
|
||||
esp_lcd_panel_io_handle_t io_handle = NULL;
|
||||
esp_lcd_panel_io_i2c_config_t io_config = {
|
||||
.dev_addr = TEST_I2C_DEV_ADDR,
|
||||
.control_phase_bytes = 1, // According to SSD1306 datasheet
|
||||
.dc_bit_offset = 6, // According to SSD1306 datasheet
|
||||
.lcd_cmd_bits = 8, // According to SSD1306 datasheet
|
||||
.lcd_param_bits = 8, // According to SSD1306 datasheet
|
||||
.on_color_trans_done = notify_lvgl_ready_to_flush,
|
||||
.user_ctx = &disp,
|
||||
};
|
||||
TEST_ESP_OK(esp_lcd_new_panel_io_i2c((esp_lcd_i2c_bus_handle_t)TEST_I2C_HOST_ID, &io_config, &io_handle));
|
||||
|
||||
esp_lcd_panel_handle_t panel_handle = NULL;
|
||||
esp_lcd_panel_dev_config_t panel_config = {
|
||||
.bits_per_pixel = 1,
|
||||
.color_space = ESP_LCD_COLOR_SPACE_MONOCHROME,
|
||||
.reset_gpio_num = -1,
|
||||
};
|
||||
TEST_ESP_OK(esp_lcd_new_panel_ssd1306(io_handle, &panel_config, &panel_handle));
|
||||
TEST_ESP_OK(esp_lcd_panel_reset(panel_handle));
|
||||
TEST_ESP_OK(esp_lcd_panel_init(panel_handle));
|
||||
|
||||
test_lvgl_task_loop(panel_handle, TEST_LCD_H_RES, TEST_LCD_V_RES, &disp);
|
||||
}
|
||||
#endif // CONFIG_LV_COLOR_DEPTH_1
|
||||
#endif // CONFIG_LV_USE_USER_DATA
|
||||
|
@@ -408,157 +408,6 @@ TEST_CASE("lcd panel with i80 interface (st7789, 8bits)", "[lcd]")
|
||||
#undef TEST_IMG_SIZE
|
||||
}
|
||||
|
||||
// The following test shows a porting example of LVGL GUI library
|
||||
// To run the LVGL tests, you need to clone the LVGL library into components directory firstly
|
||||
#if CONFIG_LV_USE_USER_DATA
|
||||
#include "test_lvgl_port.h"
|
||||
|
||||
static bool notify_lvgl_ready_to_flush(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_io_event_data_t *edata, void *user_ctx)
|
||||
{
|
||||
lv_disp_t *disp = *(lv_disp_t **)user_ctx;
|
||||
lv_disp_flush_ready(&disp->driver);
|
||||
return false;
|
||||
}
|
||||
|
||||
TEST_CASE("lvgl gui with i80 interface (st7789, 8bits)", "[lcd][lvgl][ignore]")
|
||||
{
|
||||
// initialize LVGL graphics library
|
||||
lv_disp_t *disp = NULL;
|
||||
lv_init();
|
||||
|
||||
gpio_config_t bk_gpio_config = {
|
||||
.mode = GPIO_MODE_OUTPUT,
|
||||
.pin_bit_mask = 1ULL << TEST_LCD_BK_LIGHT_GPIO
|
||||
};
|
||||
TEST_ESP_OK(gpio_config(&bk_gpio_config));
|
||||
|
||||
esp_lcd_i80_bus_handle_t i80_bus = NULL;
|
||||
esp_lcd_i80_bus_config_t bus_config = {
|
||||
.dc_gpio_num = TEST_LCD_DC_GPIO,
|
||||
.wr_gpio_num = TEST_LCD_PCLK_GPIO,
|
||||
.data_gpio_nums = {
|
||||
TEST_LCD_DATA0_GPIO,
|
||||
TEST_LCD_DATA1_GPIO,
|
||||
TEST_LCD_DATA2_GPIO,
|
||||
TEST_LCD_DATA3_GPIO,
|
||||
TEST_LCD_DATA4_GPIO,
|
||||
TEST_LCD_DATA5_GPIO,
|
||||
TEST_LCD_DATA6_GPIO,
|
||||
TEST_LCD_DATA7_GPIO,
|
||||
},
|
||||
.bus_width = 8,
|
||||
.max_transfer_bytes = TEST_LCD_H_RES * 40 * sizeof(uint16_t)
|
||||
};
|
||||
TEST_ESP_OK(esp_lcd_new_i80_bus(&bus_config, &i80_bus));
|
||||
esp_lcd_panel_io_handle_t io_handle = NULL;
|
||||
esp_lcd_panel_io_i80_config_t io_config = {
|
||||
.cs_gpio_num = TEST_LCD_CS_GPIO,
|
||||
.pclk_hz = 10000000, // 10MHz
|
||||
.trans_queue_depth = 10,
|
||||
.dc_levels = {
|
||||
.dc_idle_level = 0,
|
||||
.dc_cmd_level = 0,
|
||||
.dc_dummy_level = 0,
|
||||
.dc_data_level = 1,
|
||||
},
|
||||
.flags = {
|
||||
.swap_color_bytes = 1,
|
||||
},
|
||||
.on_color_trans_done = notify_lvgl_ready_to_flush,
|
||||
.user_ctx = &disp,
|
||||
.lcd_cmd_bits = 8,
|
||||
.lcd_param_bits = 8,
|
||||
};
|
||||
TEST_ESP_OK(esp_lcd_new_panel_io_i80(i80_bus, &io_config, &io_handle));
|
||||
|
||||
esp_lcd_panel_handle_t panel_handle = NULL;
|
||||
esp_lcd_panel_dev_config_t panel_config = {
|
||||
.reset_gpio_num = TEST_LCD_RST_GPIO,
|
||||
.color_space = ESP_LCD_COLOR_SPACE_RGB,
|
||||
.bits_per_pixel = 16,
|
||||
};
|
||||
TEST_ESP_OK(esp_lcd_new_panel_st7789(io_handle, &panel_config, &panel_handle));
|
||||
|
||||
// turn off backlight
|
||||
gpio_set_level(TEST_LCD_BK_LIGHT_GPIO, 0);
|
||||
esp_lcd_panel_reset(panel_handle);
|
||||
esp_lcd_panel_init(panel_handle);
|
||||
esp_lcd_panel_invert_color(panel_handle, true);
|
||||
// the gap is LCD panel specific, even panels with the same driver IC, can have different gap value
|
||||
esp_lcd_panel_set_gap(panel_handle, 0, 20);
|
||||
// turn on backlight
|
||||
gpio_set_level(TEST_LCD_BK_LIGHT_GPIO, 1);
|
||||
|
||||
test_lvgl_task_loop(panel_handle, TEST_LCD_H_RES, TEST_LCD_V_RES, &disp);
|
||||
}
|
||||
|
||||
#define TEST_NT35510_DATA_WIDTH (8) // change this to 16 when NT35510 is configured to 16bit in length
|
||||
TEST_CASE("lvgl gui with i80 interface (nt35510, 8/16bits)", "[lcd][lvgl][ignore]")
|
||||
{
|
||||
// initialize LVGL graphics library
|
||||
lv_disp_t *disp = NULL;
|
||||
lv_init();
|
||||
|
||||
esp_lcd_i80_bus_handle_t i80_bus = NULL;
|
||||
esp_lcd_i80_bus_config_t bus_config = {
|
||||
.dc_gpio_num = TEST_LCD_DC_GPIO,
|
||||
.wr_gpio_num = TEST_LCD_PCLK_GPIO,
|
||||
.data_gpio_nums = {
|
||||
TEST_LCD_DATA0_GPIO,
|
||||
TEST_LCD_DATA1_GPIO,
|
||||
TEST_LCD_DATA2_GPIO,
|
||||
TEST_LCD_DATA3_GPIO,
|
||||
TEST_LCD_DATA4_GPIO,
|
||||
TEST_LCD_DATA5_GPIO,
|
||||
TEST_LCD_DATA6_GPIO,
|
||||
TEST_LCD_DATA7_GPIO,
|
||||
TEST_LCD_DATA8_GPIO,
|
||||
TEST_LCD_DATA9_GPIO,
|
||||
TEST_LCD_DATA10_GPIO,
|
||||
TEST_LCD_DATA11_GPIO,
|
||||
TEST_LCD_DATA12_GPIO,
|
||||
TEST_LCD_DATA13_GPIO,
|
||||
TEST_LCD_DATA14_GPIO,
|
||||
TEST_LCD_DATA15_GPIO,
|
||||
},
|
||||
.bus_width = TEST_NT35510_DATA_WIDTH,
|
||||
.max_transfer_bytes = TEST_LCD_H_RES * 40 * sizeof(uint16_t)
|
||||
};
|
||||
TEST_ESP_OK(esp_lcd_new_i80_bus(&bus_config, &i80_bus));
|
||||
esp_lcd_panel_io_handle_t io_handle = NULL;
|
||||
esp_lcd_panel_io_i80_config_t io_config = {
|
||||
.cs_gpio_num = TEST_LCD_CS_GPIO,
|
||||
.pclk_hz = 10000000, // 10MHz
|
||||
.trans_queue_depth = 4,
|
||||
.dc_levels = {
|
||||
.dc_idle_level = 0,
|
||||
.dc_cmd_level = 0,
|
||||
.dc_dummy_level = 0,
|
||||
.dc_data_level = 1,
|
||||
},
|
||||
.on_color_trans_done = notify_lvgl_ready_to_flush,
|
||||
.user_ctx = &disp,
|
||||
.lcd_cmd_bits = 16,
|
||||
.lcd_param_bits = 16,
|
||||
};
|
||||
TEST_ESP_OK(esp_lcd_new_panel_io_i80(i80_bus, &io_config, &io_handle));
|
||||
|
||||
esp_lcd_panel_handle_t panel_handle = NULL;
|
||||
esp_lcd_panel_dev_config_t panel_config = {
|
||||
.reset_gpio_num = -1,
|
||||
.color_space = ESP_LCD_COLOR_SPACE_RGB,
|
||||
.bits_per_pixel = 16,
|
||||
};
|
||||
TEST_ESP_OK(esp_lcd_new_panel_nt35510(io_handle, &panel_config, &panel_handle));
|
||||
|
||||
esp_lcd_panel_reset(panel_handle);
|
||||
esp_lcd_panel_init(panel_handle);
|
||||
esp_lcd_panel_swap_xy(panel_handle, true);
|
||||
esp_lcd_panel_mirror(panel_handle, true, false);
|
||||
|
||||
test_lvgl_task_loop(panel_handle, TEST_LCD_H_RES, TEST_LCD_V_RES, &disp);
|
||||
}
|
||||
#endif // CONFIG_LV_USE_USER_DATA
|
||||
#endif // SOC_LCD_I80_SUPPORTED
|
||||
|
||||
#if SOC_I2S_LCD_I80_VARIANT
|
||||
|
@@ -1,4 +0,0 @@
|
||||
#include "esp_lcd_panel_ops.h"
|
||||
#include "lvgl.h"
|
||||
|
||||
void test_lvgl_task_loop(esp_lcd_panel_handle_t panel_handle, int h_res, int v_res, lv_disp_t **disp);
|
@@ -1,113 +0,0 @@
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "unity.h"
|
||||
#include "test_utils.h"
|
||||
#include "esp_freertos_hooks.h"
|
||||
#include "soc/soc_caps.h"
|
||||
#if CONFIG_LV_USE_USER_DATA
|
||||
#include "test_lvgl_port.h"
|
||||
|
||||
static void my_lvgl_flush(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *color_map)
|
||||
{
|
||||
esp_lcd_panel_handle_t panel_handle = (esp_lcd_panel_handle_t) drv->user_data;
|
||||
|
||||
int offsetx1 = area->x1;
|
||||
int offsetx2 = area->x2;
|
||||
int offsety1 = area->y1;
|
||||
int offsety2 = area->y2;
|
||||
|
||||
esp_lcd_panel_draw_bitmap(panel_handle, offsetx1, offsety1, offsetx2 + 1, offsety2 + 1, color_map);
|
||||
}
|
||||
|
||||
#if CONFIG_LV_COLOR_DEPTH_1
|
||||
static void my_lvgl_set_px_cb(lv_disp_drv_t *disp_drv, uint8_t *buf, lv_coord_t buf_w, lv_coord_t x, lv_coord_t y,
|
||||
lv_color_t color, lv_opa_t opa)
|
||||
{
|
||||
uint16_t byte_index = x + (( y >> 3 ) * buf_w);
|
||||
uint8_t bit_index = y & 0x7;
|
||||
|
||||
if ((color.full == 0) && (LV_OPA_TRANSP != opa)) {
|
||||
buf[byte_index] |= (1 << bit_index);
|
||||
} else {
|
||||
buf[byte_index] &= ~(1 << bit_index);
|
||||
}
|
||||
}
|
||||
|
||||
static void my_lvgl_rounder(lv_disp_drv_t *disp_drv, lv_area_t *area)
|
||||
{
|
||||
area->y1 = (area->y1 & (~0x7));
|
||||
area->y2 = (area->y2 & (~0x7)) + 7;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void increase_lvgl_tick(void)
|
||||
{
|
||||
lv_tick_inc(portTICK_PERIOD_MS);
|
||||
}
|
||||
|
||||
static void create_demo_application(lv_disp_t *disp)
|
||||
{
|
||||
// Get the current screen
|
||||
lv_obj_t *scr = lv_disp_get_scr_act(disp);
|
||||
// Create a Label on the currently active screen
|
||||
lv_obj_t *label = lv_label_create(scr, NULL);
|
||||
// Modify the Label's text
|
||||
lv_label_set_text(label, "Hello World");
|
||||
// Align the Label to the center
|
||||
lv_obj_align(label, NULL, LV_ALIGN_IN_TOP_MID, 0, 0);
|
||||
|
||||
#if !CONFIG_LV_COLOR_DEPTH_1
|
||||
// new screen_spinner
|
||||
lv_obj_t *screen_spinner = lv_spinner_create(scr, NULL);
|
||||
lv_obj_align(screen_spinner, label, LV_ALIGN_OUT_BOTTOM_MID, 15, 20);
|
||||
lv_obj_set_size(screen_spinner, 100, 100);
|
||||
lv_spinner_set_arc_length(screen_spinner, 60);
|
||||
lv_spinner_set_spin_time(screen_spinner, 1000);
|
||||
lv_spinner_set_type(screen_spinner, LV_SPINNER_TYPE_SPINNING_ARC);
|
||||
lv_spinner_set_dir(screen_spinner, LV_SPINNER_DIR_FORWARD);
|
||||
|
||||
lv_obj_t *bar = lv_bar_create(scr, NULL);
|
||||
lv_obj_set_size(bar, 100, 20);
|
||||
lv_obj_align(bar, screen_spinner, LV_ALIGN_OUT_BOTTOM_MID, 0, 0);
|
||||
lv_bar_set_anim_time(bar, 2000);
|
||||
lv_bar_set_value(bar, 100, LV_ANIM_ON);
|
||||
#endif
|
||||
}
|
||||
|
||||
void test_lvgl_task_loop(esp_lcd_panel_handle_t panel_handle, int h_res, int v_res, lv_disp_t **disp)
|
||||
{
|
||||
static lv_disp_buf_t disp_buf;
|
||||
// alloc frame buffer used by LVGL
|
||||
lv_color_t *buf1 = heap_caps_malloc(h_res * 20 * sizeof(lv_color_t), MALLOC_CAP_DMA);
|
||||
TEST_ASSERT_NOT_NULL(buf1);
|
||||
lv_color_t *buf2 = heap_caps_malloc(h_res * 20 * sizeof(lv_color_t), MALLOC_CAP_DMA);
|
||||
TEST_ASSERT_NOT_NULL(buf2);
|
||||
lv_disp_buf_init(&disp_buf, buf1, buf2, h_res * 20);
|
||||
// register display driver
|
||||
lv_disp_drv_t disp_drv;
|
||||
lv_disp_drv_init(&disp_drv);
|
||||
disp_drv.hor_res = h_res;
|
||||
disp_drv.ver_res = v_res;
|
||||
disp_drv.flush_cb = my_lvgl_flush;
|
||||
#if CONFIG_LV_COLOR_DEPTH_1
|
||||
disp_drv.rounder_cb = my_lvgl_rounder;
|
||||
disp_drv.set_px_cb = my_lvgl_set_px_cb;
|
||||
#endif
|
||||
|
||||
disp_drv.buffer = &disp_buf;
|
||||
disp_drv.user_data = panel_handle; // LV_USE_USER_DATA is disabled by default, need to enable it in menuconfig
|
||||
*disp = lv_disp_drv_register(&disp_drv);
|
||||
|
||||
// Tick interface for LVGL
|
||||
esp_register_freertos_tick_hook(increase_lvgl_tick);
|
||||
|
||||
// create a demo UI on that screen
|
||||
create_demo_application(*disp);
|
||||
|
||||
while (1) {
|
||||
vTaskDelay(pdMS_TO_TICKS(10));
|
||||
lv_task_handler(); // The task running lv_task_handler should have lower priority than that running `lv_tick_inc`
|
||||
}
|
||||
}
|
||||
|
||||
#endif // CONFIG_LV_USE_USER_DATA
|
@@ -146,71 +146,5 @@ TEST_CASE("lcd_rgb_panel_one_shot_mode", "[lcd]")
|
||||
free(img);
|
||||
}
|
||||
|
||||
// The following test shows a porting example of LVGL GUI library
|
||||
// To run the LVGL tests, you need to clone the LVGL library into components directory firstly
|
||||
#if CONFIG_LV_USE_USER_DATA
|
||||
#include "test_lvgl_port.h"
|
||||
|
||||
static bool notify_lvgl_ready_to_flush(esp_lcd_panel_handle_t panel, esp_lcd_rgb_panel_event_data_t *edata, void *user_ctx)
|
||||
{
|
||||
lv_disp_t *disp = *(lv_disp_t **)user_ctx;
|
||||
lv_disp_flush_ready(&disp->driver);
|
||||
return false;
|
||||
}
|
||||
|
||||
TEST_CASE("lvgl gui with rgb interface", "[lcd][lvgl][ignore]")
|
||||
{
|
||||
// initialize LVGL graphics library
|
||||
lv_disp_t *disp = NULL;
|
||||
lv_init();
|
||||
|
||||
esp_lcd_panel_handle_t panel_handle = NULL;
|
||||
esp_lcd_rgb_panel_config_t panel_config = {
|
||||
.data_width = 16,
|
||||
.disp_gpio_num = -1,
|
||||
.pclk_gpio_num = TEST_LCD_PCLK_GPIO,
|
||||
.vsync_gpio_num = TEST_LCD_VSYNC_GPIO,
|
||||
.hsync_gpio_num = TEST_LCD_HSYNC_GPIO,
|
||||
.de_gpio_num = TEST_LCD_DE_GPIO,
|
||||
.data_gpio_nums = {
|
||||
TEST_LCD_DATA0_GPIO,
|
||||
TEST_LCD_DATA1_GPIO,
|
||||
TEST_LCD_DATA2_GPIO,
|
||||
TEST_LCD_DATA3_GPIO,
|
||||
TEST_LCD_DATA4_GPIO,
|
||||
TEST_LCD_DATA5_GPIO,
|
||||
TEST_LCD_DATA6_GPIO,
|
||||
TEST_LCD_DATA7_GPIO,
|
||||
TEST_LCD_DATA8_GPIO,
|
||||
TEST_LCD_DATA9_GPIO,
|
||||
TEST_LCD_DATA10_GPIO,
|
||||
TEST_LCD_DATA11_GPIO,
|
||||
TEST_LCD_DATA12_GPIO,
|
||||
TEST_LCD_DATA13_GPIO,
|
||||
TEST_LCD_DATA14_GPIO,
|
||||
TEST_LCD_DATA15_GPIO,
|
||||
},
|
||||
.timings = {
|
||||
.pclk_hz = 6000000,
|
||||
.h_res = TEST_LCD_H_RES,
|
||||
.v_res = TEST_LCD_V_RES,
|
||||
.hsync_back_porch = 43,
|
||||
.hsync_front_porch = 2,
|
||||
.hsync_pulse_width = 1,
|
||||
.vsync_back_porch = 12,
|
||||
.vsync_front_porch = 1,
|
||||
.vsync_pulse_width = 1,
|
||||
},
|
||||
.flags.fb_in_psram = 1,
|
||||
.on_frame_trans_done = notify_lvgl_ready_to_flush,
|
||||
.user_ctx = &disp,
|
||||
};
|
||||
TEST_ESP_OK(esp_lcd_new_rgb_panel(&panel_config, &panel_handle));
|
||||
TEST_ESP_OK(esp_lcd_panel_reset(panel_handle));
|
||||
TEST_ESP_OK(esp_lcd_panel_init(panel_handle));
|
||||
|
||||
test_lvgl_task_loop(panel_handle, TEST_LCD_H_RES, TEST_LCD_V_RES, &disp);
|
||||
}
|
||||
#endif // CONFIG_LV_USE_USER_DATA
|
||||
#endif // CONFIG_SPIRAM_USE_MALLOC
|
||||
#endif // SOC_LCD_RGB_SUPPORTED
|
||||
|
@@ -179,81 +179,3 @@ TEST_CASE("lcd panel with 1-line spi interface (st7789)", "[lcd]")
|
||||
TEST_ESP_OK(esp_lcd_new_panel_st7789(io_handle, &panel_config, &panel_handle));
|
||||
lcd_panel_test(io_handle, panel_handle);
|
||||
}
|
||||
|
||||
// The following test shows a porting example of LVGL GUI library
|
||||
// To run the LVGL tests, you need to clone the LVGL library into components directory firstly
|
||||
#if CONFIG_LV_USE_USER_DATA
|
||||
#include "test_lvgl_port.h"
|
||||
|
||||
static bool notify_lvgl_ready_to_flush(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_io_event_data_t *edata, void *user_ctx)
|
||||
{
|
||||
lv_disp_t *disp = *(lv_disp_t **)user_ctx;
|
||||
lv_disp_flush_ready(&disp->driver);
|
||||
return false;
|
||||
}
|
||||
|
||||
static void lvgl_gui_test(esp_lcd_panel_io_handle_t io_handle, esp_lcd_panel_handle_t panel_handle, lv_disp_t **disp)
|
||||
{
|
||||
// initialize LVGL graphics library
|
||||
lv_init();
|
||||
// turn off backlight
|
||||
gpio_set_level(TEST_LCD_BK_LIGHT_GPIO, 0);
|
||||
esp_lcd_panel_reset(panel_handle);
|
||||
esp_lcd_panel_init(panel_handle);
|
||||
esp_lcd_panel_invert_color(panel_handle, true);
|
||||
// the gap is LCD panel specific, even panels with the same driver IC, can have different gap value
|
||||
esp_lcd_panel_set_gap(panel_handle, 0, 20);
|
||||
// turn on backlight
|
||||
gpio_set_level(TEST_LCD_BK_LIGHT_GPIO, 1);
|
||||
|
||||
test_lvgl_task_loop(panel_handle, TEST_LCD_H_RES, TEST_LCD_V_RES, disp);
|
||||
}
|
||||
|
||||
#if SOC_SPI_SUPPORT_OCT
|
||||
TEST_CASE("lvgl gui with 8-line spi interface (st7789)", "[lcd][lvgl][ignore]")
|
||||
{
|
||||
lv_disp_t *disp = NULL;
|
||||
esp_lcd_panel_io_handle_t io_handle = NULL;
|
||||
esp_lcd_panel_handle_t panel_handle = NULL;
|
||||
lcd_initialize_spi(&io_handle, notify_lvgl_ready_to_flush, &disp, 8, 8, true);
|
||||
esp_lcd_panel_dev_config_t panel_config = {
|
||||
.reset_gpio_num = TEST_LCD_RST_GPIO,
|
||||
.color_space = ESP_LCD_COLOR_SPACE_RGB,
|
||||
.bits_per_pixel = 16,
|
||||
};
|
||||
TEST_ESP_OK(esp_lcd_new_panel_st7789(io_handle, &panel_config, &panel_handle));
|
||||
lvgl_gui_test(io_handle, panel_handle, &disp);
|
||||
}
|
||||
|
||||
TEST_CASE("lvgl gui with 8-line spi interface (nt35510)", "[lcd][lvgl][ignore]")
|
||||
{
|
||||
lv_disp_t *disp = NULL;
|
||||
esp_lcd_panel_io_handle_t io_handle = NULL;
|
||||
esp_lcd_panel_handle_t panel_handle = NULL;
|
||||
lcd_initialize_spi(&io_handle, notify_lvgl_ready_to_flush, &disp, 16, 16, true);
|
||||
esp_lcd_panel_dev_config_t panel_config = {
|
||||
.reset_gpio_num = TEST_LCD_RST_GPIO,
|
||||
.color_space = ESP_LCD_COLOR_SPACE_RGB,
|
||||
.bits_per_pixel = 16,
|
||||
};
|
||||
TEST_ESP_OK(esp_lcd_new_panel_nt35510(io_handle, &panel_config, &panel_handle));
|
||||
lvgl_gui_test(io_handle, panel_handle, &disp);
|
||||
}
|
||||
#endif // SOC_SPI_SUPPORT_OCT
|
||||
|
||||
TEST_CASE("lvgl gui with 1-line spi interface (st7789)", "[lcd][lvgl][ignore]")
|
||||
{
|
||||
lv_disp_t *disp = NULL;
|
||||
esp_lcd_panel_io_handle_t io_handle = NULL;
|
||||
esp_lcd_panel_handle_t panel_handle = NULL;
|
||||
lcd_initialize_spi(&io_handle, notify_lvgl_ready_to_flush, &disp, 8, 8, false);
|
||||
esp_lcd_panel_dev_config_t panel_config = {
|
||||
.reset_gpio_num = TEST_LCD_RST_GPIO,
|
||||
.color_space = ESP_LCD_COLOR_SPACE_RGB,
|
||||
.bits_per_pixel = 16,
|
||||
};
|
||||
TEST_ESP_OK(esp_lcd_new_panel_st7789(io_handle, &panel_config, &panel_handle));
|
||||
lvgl_gui_test(io_handle, panel_handle, &disp);
|
||||
}
|
||||
|
||||
#endif // CONFIG_LV_USE_USER_DATA
|
||||
|
Reference in New Issue
Block a user