@@ -88,7 +88,7 @@ TEST_CASE("MIPI DSI Pattern Generator (EK79007)", "[mipi_dsi]")
8888
8989#define TEST_IMG_SIZE (100 * 100 * sizeof(uint16_t))
9090
91- TEST_CASE ("MIPI DSI draw bitmap (EK79007)" , "[mipi_dsi]" )
91+ TEST_CASE ("MIPI DSI draw RGB bitmap (EK79007)" , "[mipi_dsi]" )
9292{
9393 esp_lcd_dsi_bus_handle_t mipi_dsi_bus ;
9494 esp_lcd_panel_io_handle_t mipi_dbi_io ;
@@ -162,7 +162,7 @@ TEST_CASE("MIPI DSI draw bitmap (EK79007)", "[mipi_dsi]")
162162 test_bsp_disable_dsi_phy_power ();
163163}
164164
165- TEST_CASE ("MIPI DSI with multiple frame buffers (EK79007)" , "[mipi_dsi]" )
165+ TEST_CASE ("MIPI DSI use multiple frame buffers (EK79007)" , "[mipi_dsi]" )
166166{
167167 esp_lcd_dsi_bus_handle_t mipi_dsi_bus ;
168168 esp_lcd_panel_io_handle_t mipi_dbi_io ;
@@ -241,17 +241,14 @@ TEST_CASE("MIPI DSI with multiple frame buffers (EK79007)", "[mipi_dsi]")
241241 test_bsp_disable_dsi_phy_power ();
242242}
243243
244- TEST_CASE ("MIPI DSI draw YUV422 (EK79007)" , "[mipi_dsi]" )
244+ TEST_CASE ("MIPI DSI draw YUV422 image (EK79007)" , "[mipi_dsi]" )
245245{
246246 esp_lcd_dsi_bus_handle_t mipi_dsi_bus ;
247247 esp_lcd_panel_io_handle_t mipi_dbi_io ;
248248 esp_lcd_panel_handle_t mipi_dpi_panel ;
249249
250250 test_bsp_enable_dsi_phy_power ();
251251
252- uint8_t * img = malloc (TEST_IMG_SIZE );
253- TEST_ASSERT_NOT_NULL (img );
254-
255252 esp_lcd_dsi_bus_config_t bus_config = {
256253 .bus_id = 0 ,
257254 .num_data_lanes = 2 ,
@@ -285,10 +282,6 @@ TEST_CASE("MIPI DSI draw YUV422 (EK79007)", "[mipi_dsi]")
285282 .vsync_pulse_width = MIPI_DSI_LCD_VSYNC ,
286283 .vsync_front_porch = MIPI_DSI_LCD_VFP ,
287284 },
288-
289- .flags = {
290- .use_dma2d = true,
291- }
292285 };
293286 ek79007_vendor_config_t vendor_config = {
294287 .mipi_config = {
@@ -333,7 +326,84 @@ TEST_CASE("MIPI DSI draw YUV422 (EK79007)", "[mipi_dsi]")
333326 TEST_ESP_OK (esp_lcd_panel_del (mipi_dpi_panel ));
334327 TEST_ESP_OK (esp_lcd_panel_io_del (mipi_dbi_io ));
335328 TEST_ESP_OK (esp_lcd_del_dsi_bus (mipi_dsi_bus ));
336- free (img );
329+
330+ test_bsp_disable_dsi_phy_power ();
331+ }
332+
333+ TEST_CASE ("MIPI DSI draw Gray8 image (EK79007)" , "[mipi_dsi]" )
334+ {
335+ esp_lcd_dsi_bus_handle_t mipi_dsi_bus ;
336+ esp_lcd_panel_io_handle_t mipi_dbi_io ;
337+ esp_lcd_panel_handle_t mipi_dpi_panel ;
338+
339+ test_bsp_enable_dsi_phy_power ();
340+
341+ esp_lcd_dsi_bus_config_t bus_config = {
342+ .bus_id = 0 ,
343+ .num_data_lanes = 2 ,
344+ .lane_bit_rate_mbps = 1000 , // 1000 Mbps
345+ };
346+ TEST_ESP_OK (esp_lcd_new_dsi_bus (& bus_config , & mipi_dsi_bus ));
347+
348+ esp_lcd_dbi_io_config_t dbi_config = {
349+ .virtual_channel = 0 ,
350+ .lcd_cmd_bits = 8 ,
351+ .lcd_param_bits = 8 ,
352+ };
353+ TEST_ESP_OK (esp_lcd_new_panel_io_dbi (mipi_dsi_bus , & dbi_config , & mipi_dbi_io ));
354+
355+ esp_lcd_dpi_panel_config_t dpi_config = {
356+ .dpi_clk_src = MIPI_DSI_DPI_CLK_SRC_DEFAULT ,
357+ .dpi_clock_freq_mhz = MIPI_DSI_DPI_CLK_MHZ ,
358+ .virtual_channel = 0 ,
359+
360+ // Gray8 -> RGB888
361+ .in_color_format = LCD_COLOR_FMT_GRAY8 ,
362+ .out_color_format = LCD_COLOR_FMT_RGB888 ,
363+
364+ .video_timing = {
365+ .h_size = MIPI_DSI_LCD_H_RES ,
366+ .v_size = MIPI_DSI_LCD_V_RES ,
367+ .hsync_back_porch = MIPI_DSI_LCD_HBP ,
368+ .hsync_pulse_width = MIPI_DSI_LCD_HSYNC ,
369+ .hsync_front_porch = MIPI_DSI_LCD_HFP ,
370+ .vsync_back_porch = MIPI_DSI_LCD_VBP ,
371+ .vsync_pulse_width = MIPI_DSI_LCD_VSYNC ,
372+ .vsync_front_porch = MIPI_DSI_LCD_VFP ,
373+ },
374+ };
375+ ek79007_vendor_config_t vendor_config = {
376+ .mipi_config = {
377+ .dsi_bus = mipi_dsi_bus ,
378+ .dpi_config = & dpi_config ,
379+ },
380+ };
381+ esp_lcd_panel_dev_config_t lcd_dev_config = {
382+ .reset_gpio_num = -1 ,
383+ .rgb_ele_order = LCD_RGB_ELEMENT_ORDER_RGB ,
384+ .bits_per_pixel = 24 ,
385+ .vendor_config = & vendor_config ,
386+ };
387+ TEST_ESP_OK (esp_lcd_new_panel_ek79007 (mipi_dbi_io , & lcd_dev_config , & mipi_dpi_panel ));
388+
389+ TEST_ESP_OK (esp_lcd_panel_reset (mipi_dpi_panel ));
390+ TEST_ESP_OK (esp_lcd_panel_init (mipi_dpi_panel ));
391+
392+ // YUV images are embedded in the firmware binary
393+ extern const uint8_t image_hello_gray_start [] asm("_binary_hello_gray_start" );
394+ extern const uint8_t image_world_gray_start [] asm("_binary_world_gray_start" );
395+
396+ printf ("Draw Gray8 images\r\n" );
397+ for (int i = 0 ; i < 4 ; i ++ ) {
398+ TEST_ESP_OK (esp_lcd_panel_draw_bitmap (mipi_dpi_panel , 0 , 0 , 320 , 320 , image_hello_gray_start ));
399+ vTaskDelay (pdMS_TO_TICKS (1000 ));
400+ TEST_ESP_OK (esp_lcd_panel_draw_bitmap (mipi_dpi_panel , 0 , 0 , 320 , 320 , image_world_gray_start ));
401+ vTaskDelay (pdMS_TO_TICKS (1000 ));
402+ }
403+
404+ TEST_ESP_OK (esp_lcd_panel_del (mipi_dpi_panel ));
405+ TEST_ESP_OK (esp_lcd_panel_io_del (mipi_dbi_io ));
406+ TEST_ESP_OK (esp_lcd_del_dsi_bus (mipi_dsi_bus ));
337407
338408 test_bsp_disable_dsi_phy_power ();
339409}
0 commit comments