From 69133d5d71a28194da3bf9b635eeba03e8c5db7c Mon Sep 17 00:00:00 2001 From: Adam Kaliszan Date: Mon, 6 Jan 2025 17:43:14 +0100 Subject: [PATCH] BSP offset --- bsp/esp_bsp_generic/Kconfig | 20 ++++- .../src/lvgl8/esp_lvgl_port_disp.c | 21 ++++- .../test_apps/main/test_esp_lcd_gc9503.c | 6 +- .../test_apps/main/test_esp_lcd_gc9a01.c | 6 +- .../test_apps/main/test_esp_lcd_ili9341.c | 6 +- .../test_apps/main/test_esp_lcd_ili9881c.c | 12 ++- .../examples/epaper_demo/main/main.c | 84 +++++++++++++++---- .../examples/epaper_lvgl_demo/main/main.c | 13 ++- .../main/test_esp_lcd_st7796_general.c | 6 +- .../test_apps/main/test_esp_lcd_st7796_mipi.c | 12 ++- test_apps/noglib/main/noglib_main.c | 7 +- 11 files changed, 164 insertions(+), 29 deletions(-) diff --git a/bsp/esp_bsp_generic/Kconfig b/bsp/esp_bsp_generic/Kconfig index 16146a84..c1d4f5db 100644 --- a/bsp/esp_bsp_generic/Kconfig +++ b/bsp/esp_bsp_generic/Kconfig @@ -700,7 +700,25 @@ menu "Board Support Package (generic)" default 240 help The height in pixels of the display. - + + config BSP_DISPLAY_HORIZONTAL_OFFSET + depends on BSP_DISPLAY_ENABLED + int + prompt "Display horizontal offset" + default 0 + help + Some displays has offset. First columns and wors are not visible on screen + (specific connection layout between screen and controler). E.g. Lilygo TTGO + + config BSP_DISPLAY_VERTICAL_OFFSET + depends on BSP_DISPLAY_ENABLED + int + prompt "Display vertical offset" + default 0 + help + Some displays has offset. First columns and wors are not visible on screen + (specific connection layout between screen and controler). E.g. Lilygo TTGO + config BSP_DISPLAY_BRIGHTNESS_LEDC_CH depends on BSP_DISPLAY_ENABLED && BSP_DISPLAY_BACKLIGHT_GPIO != -1 int "LEDC channel index for brightness control" diff --git a/components/esp_lvgl_port/src/lvgl8/esp_lvgl_port_disp.c b/components/esp_lvgl_port/src/lvgl8/esp_lvgl_port_disp.c index d311f147..0b7c58e6 100644 --- a/components/esp_lvgl_port/src/lvgl8/esp_lvgl_port_disp.c +++ b/components/esp_lvgl_port/src/lvgl8/esp_lvgl_port_disp.c @@ -457,13 +457,23 @@ static void lvgl_port_flush_callback(lv_disp_drv_t *drv, const lv_area_t *area, if ((disp_ctx->disp_type == LVGL_PORT_DISP_TYPE_RGB || disp_ctx->disp_type == LVGL_PORT_DISP_TYPE_DSI) && (drv->direct_mode || drv->full_refresh)) { if (lv_disp_flush_is_last(drv)) { /* If the interface is I80 or SPI, this step cannot be used for drawing. */ - esp_lcd_panel_draw_bitmap(disp_ctx->panel_handle, x_start, y_start, x_end + 1, y_end + 1, color_map); + esp_lcd_panel_draw_bitmap( + disp_ctx->panel_handle, + x_start + CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + y_start + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, + x_end + 1 + CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + y_end + 1 + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, color_map); /* Waiting for the last frame buffer to complete transmission */ xSemaphoreTake(disp_ctx->trans_sem, 0); xSemaphoreTake(disp_ctx->trans_sem, portMAX_DELAY); } } else { - esp_lcd_panel_draw_bitmap(disp_ctx->panel_handle, x_start, y_start, x_end + 1, y_end + 1, color_map); + esp_lcd_panel_draw_bitmap( + disp_ctx->panel_handle, + x_start + CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + y_start + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, + x_end + 1 + CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + y_end + 1 + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, color_map); } if (disp_ctx->disp_type == LVGL_PORT_DISP_TYPE_RGB || (disp_ctx->disp_type == LVGL_PORT_DISP_TYPE_DSI && (drv->direct_mode || drv->full_refresh))) { @@ -488,7 +498,12 @@ static void lvgl_port_flush_callback(lv_disp_drv_t *drv, const lv_area_t *area, x_draw_end = x_end; y_draw_start = y_start_tmp; y_draw_end = y_end_tmp; - esp_lcd_panel_draw_bitmap(disp_ctx->panel_handle, x_draw_start, y_draw_start, x_draw_end + 1, y_draw_end + 1, to); + esp_lcd_panel_draw_bitmap( + disp_ctx->panel_handle, + x_draw_start + CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + y_draw_start + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, + x_draw_end + 1 + CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + y_draw_end + 1 + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, to); from += max_line * width; y_start_tmp += max_line; diff --git a/components/lcd/esp_lcd_gc9503/test_apps/main/test_esp_lcd_gc9503.c b/components/lcd/esp_lcd_gc9503/test_apps/main/test_esp_lcd_gc9503.c index 90151e10..94e99de4 100644 --- a/components/lcd/esp_lcd_gc9503/test_apps/main/test_esp_lcd_gc9503.c +++ b/components/lcd/esp_lcd_gc9503/test_apps/main/test_esp_lcd_gc9503.c @@ -80,7 +80,11 @@ static void test_draw_bitmap(esp_lcd_panel_handle_t panel_handle) color[i * byte_per_pixel + k] = (BIT(j) >> (k * 8)) & 0xff; } } - TEST_ESP_OK(esp_lcd_panel_draw_bitmap(panel_handle, 0, j * row_line, TEST_LCD_H_RES, (j + 1) * row_line, color)); + TEST_ESP_OK(esp_lcd_panel_draw_bitmap( + panel_handle, CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + j * row_line + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, + TEST_LCD_H_RES + CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + (j + 1) * row_line + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, color)); } free(color); } diff --git a/components/lcd/esp_lcd_gc9a01/test_apps/main/test_esp_lcd_gc9a01.c b/components/lcd/esp_lcd_gc9a01/test_apps/main/test_esp_lcd_gc9a01.c index 723a3667..747049f7 100644 --- a/components/lcd/esp_lcd_gc9a01/test_apps/main/test_esp_lcd_gc9a01.c +++ b/components/lcd/esp_lcd_gc9a01/test_apps/main/test_esp_lcd_gc9a01.c @@ -61,7 +61,11 @@ static void test_draw_bitmap(esp_lcd_panel_handle_t panel_handle) color[i * byte_per_pixel + k] = (SPI_SWAP_DATA_TX(BIT(j), TEST_LCD_BIT_PER_PIXEL) >> (k * 8)) & 0xff; } } - TEST_ESP_OK(esp_lcd_panel_draw_bitmap(panel_handle, 0, j * row_line, TEST_LCD_H_RES, (j + 1) * row_line, color)); + TEST_ESP_OK(esp_lcd_panel_draw_bitmap( + panel_handle, CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + j * row_line + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, + TEST_LCD_H_RES + CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + (j + 1) * row_line + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, color)); xSemaphoreTake(refresh_finish, portMAX_DELAY); } free(color); diff --git a/components/lcd/esp_lcd_ili9341/test_apps/main/test_esp_lcd_ili9341.c b/components/lcd/esp_lcd_ili9341/test_apps/main/test_esp_lcd_ili9341.c index 26c0f48f..3136f9a3 100644 --- a/components/lcd/esp_lcd_ili9341/test_apps/main/test_esp_lcd_ili9341.c +++ b/components/lcd/esp_lcd_ili9341/test_apps/main/test_esp_lcd_ili9341.c @@ -70,7 +70,11 @@ static void test_draw_bitmap(esp_lcd_panel_handle_t panel_handle) color[i * byte_per_pixel + k] = (SPI_SWAP_DATA_TX(BIT(j), TEST_LCD_BIT_PER_PIXEL) >> (k * 8)) & 0xff; } } - TEST_ESP_OK(esp_lcd_panel_draw_bitmap(panel_handle, 0, j * row_line, TEST_LCD_H_RES, (j + 1) * row_line, color)); + TEST_ESP_OK(esp_lcd_panel_draw_bitmap( + panel_handle, CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + j * row_line + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, + TEST_LCD_H_RES + CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + (j + 1) * row_line + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, color)); xSemaphoreTake(refresh_finish, portMAX_DELAY); } free(color); diff --git a/components/lcd/esp_lcd_ili9881c/test_apps/main/test_esp_lcd_ili9881c.c b/components/lcd/esp_lcd_ili9881c/test_apps/main/test_esp_lcd_ili9881c.c index 4ae60112..0d5b633e 100644 --- a/components/lcd/esp_lcd_ili9881c/test_apps/main/test_esp_lcd_ili9881c.c +++ b/components/lcd/esp_lcd_ili9881c/test_apps/main/test_esp_lcd_ili9881c.c @@ -158,7 +158,11 @@ static void test_draw_color_bar(esp_lcd_panel_handle_t panel_handle, uint16_t h_ color[i * byte_per_pixel + k] = (BIT(j) >> (k * 8)) & 0xff; } } - TEST_ESP_OK(esp_lcd_panel_draw_bitmap(panel_handle, 0, j * row_line, h_res, (j + 1) * row_line, color)); + TEST_ESP_OK(esp_lcd_panel_draw_bitmap( + panel_handle, CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + j * row_line + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, + h_res + CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + (j + 1) * row_line + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, color)); xSemaphoreTake(refresh_finish, portMAX_DELAY); } @@ -170,7 +174,11 @@ static void test_draw_color_bar(esp_lcd_panel_handle_t panel_handle, uint16_t h_ color[i * byte_per_pixel + k] = 0xff; } } - TEST_ESP_OK(esp_lcd_panel_draw_bitmap(panel_handle, 0, color_line, h_res, v_res, color)); + TEST_ESP_OK(esp_lcd_panel_draw_bitmap( + panel_handle, CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + color_line + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, + h_res + CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + v_res + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, color)); xSemaphoreTake(refresh_finish, portMAX_DELAY); } diff --git a/components/lcd/esp_lcd_ssd1681/examples/epaper_demo/main/main.c b/components/lcd/esp_lcd_ssd1681/examples/epaper_demo/main/main.c index c2b42fe6..0fce0a26 100644 --- a/components/lcd/esp_lcd_ssd1681/examples/epaper_demo/main/main.c +++ b/components/lcd/esp_lcd_ssd1681/examples/epaper_demo/main/main.c @@ -124,9 +124,17 @@ void app_main(void) uint8_t *empty_bitmap = heap_caps_malloc(200 * 200 / 8, MALLOC_CAP_DMA); memset(empty_bitmap, 0, 200 * 200 / 8); epaper_panel_set_bitmap_color(panel_handle, SSD1681_EPAPER_BITMAP_RED); - esp_lcd_panel_draw_bitmap(panel_handle, 0, 0, 200, 200, empty_bitmap); + esp_lcd_panel_draw_bitmap(panel_handle, CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, + 200 + CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + 200 + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, + empty_bitmap); epaper_panel_set_bitmap_color(panel_handle, SSD1681_EPAPER_BITMAP_BLACK); - esp_lcd_panel_draw_bitmap(panel_handle, 0, 0, 200, 200, empty_bitmap); + esp_lcd_panel_draw_bitmap(panel_handle, CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, + 200 + CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + 200 + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, + empty_bitmap); // --- Register the e-Paper refresh done callback // cbs does not have to be static for ssd1681 driver, for the callback ptr is copied, not pointed @@ -144,7 +152,11 @@ void app_main(void) ESP_ERROR_CHECK(esp_lcd_panel_invert_color(panel_handle, false)); ESP_ERROR_CHECK(esp_lcd_panel_swap_xy(panel_handle, false)); ESP_LOGI(TAG, "Drawing bitmap..."); - ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap(panel_handle, 0, 0, 200, 200, BITMAP_200_200)); + ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap( + panel_handle, CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, + 200 + CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + 200 + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, BITMAP_200_200)); ESP_ERROR_CHECK(epaper_panel_refresh_screen(panel_handle)); xSemaphoreTake(epaper_panel_semaphore, portMAX_DELAY); @@ -152,7 +164,11 @@ void app_main(void) ESP_ERROR_CHECK(esp_lcd_panel_invert_color(panel_handle, false)); ESP_ERROR_CHECK(esp_lcd_panel_swap_xy(panel_handle, false)); ESP_LOGI(TAG, "Drawing bitmap..."); - ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap(panel_handle, 0, 0, 200, 200, BITMAP_200_200)); + ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap( + panel_handle, CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, + 200 + CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + 200 + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, BITMAP_200_200)); ESP_ERROR_CHECK(epaper_panel_refresh_screen(panel_handle)); xSemaphoreTake(epaper_panel_semaphore, portMAX_DELAY); @@ -160,7 +176,11 @@ void app_main(void) ESP_ERROR_CHECK(esp_lcd_panel_invert_color(panel_handle, false)); ESP_ERROR_CHECK(esp_lcd_panel_swap_xy(panel_handle, false)); ESP_LOGI(TAG, "Drawing bitmap..."); - ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap(panel_handle, 0, 0, 200, 200, BITMAP_200_200)); + ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap( + panel_handle, CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, + 200 + CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + 200 + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, BITMAP_200_200)); ESP_ERROR_CHECK(epaper_panel_refresh_screen(panel_handle)); xSemaphoreTake(epaper_panel_semaphore, portMAX_DELAY); @@ -168,7 +188,11 @@ void app_main(void) ESP_ERROR_CHECK(esp_lcd_panel_invert_color(panel_handle, false)); ESP_ERROR_CHECK(esp_lcd_panel_swap_xy(panel_handle, false)); ESP_LOGI(TAG, "Drawing bitmap..."); - ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap(panel_handle, 0, 0, 200, 200, BITMAP_200_200)); + ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap( + panel_handle, CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, + 200 + CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + 200 + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, BITMAP_200_200)); ESP_ERROR_CHECK(epaper_panel_refresh_screen(panel_handle)); xSemaphoreTake(epaper_panel_semaphore, portMAX_DELAY); @@ -176,7 +200,11 @@ void app_main(void) ESP_ERROR_CHECK(esp_lcd_panel_invert_color(panel_handle, false)); ESP_ERROR_CHECK(esp_lcd_panel_swap_xy(panel_handle, true)); ESP_LOGI(TAG, "Drawing bitmap..."); - ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap(panel_handle, 0, 0, 200, 200, BITMAP_200_200)); + ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap( + panel_handle, CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, + 200 + CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + 200 + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, BITMAP_200_200)); ESP_ERROR_CHECK(epaper_panel_refresh_screen(panel_handle)); xSemaphoreTake(epaper_panel_semaphore, portMAX_DELAY); @@ -184,7 +212,11 @@ void app_main(void) ESP_ERROR_CHECK(esp_lcd_panel_invert_color(panel_handle, false)); ESP_ERROR_CHECK(esp_lcd_panel_swap_xy(panel_handle, true)); ESP_LOGI(TAG, "Drawing bitmap..."); - ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap(panel_handle, 0, 0, 200, 200, BITMAP_200_200)); + ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap( + panel_handle, CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, + 200 + CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + 200 + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, BITMAP_200_200)); ESP_ERROR_CHECK(epaper_panel_refresh_screen(panel_handle)); xSemaphoreTake(epaper_panel_semaphore, portMAX_DELAY); @@ -192,7 +224,11 @@ void app_main(void) ESP_ERROR_CHECK(esp_lcd_panel_invert_color(panel_handle, false)); ESP_ERROR_CHECK(esp_lcd_panel_swap_xy(panel_handle, true)); ESP_LOGI(TAG, "Drawing bitmap..."); - ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap(panel_handle, 0, 0, 200, 200, BITMAP_200_200)); + ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap( + panel_handle, CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, + 200 + CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + 200 + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, BITMAP_200_200)); ESP_ERROR_CHECK(epaper_panel_refresh_screen(panel_handle)); xSemaphoreTake(epaper_panel_semaphore, portMAX_DELAY); @@ -200,7 +236,11 @@ void app_main(void) ESP_ERROR_CHECK(esp_lcd_panel_invert_color(panel_handle, false)); ESP_ERROR_CHECK(esp_lcd_panel_swap_xy(panel_handle, true)); ESP_LOGI(TAG, "Drawing bitmap..."); - ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap(panel_handle, 0, 0, 200, 200, BITMAP_200_200)); + ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap( + panel_handle, CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, + 200 + CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + 200 + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, BITMAP_200_200)); ESP_ERROR_CHECK(epaper_panel_refresh_screen(panel_handle)); vTaskDelay(pdMS_TO_TICKS(5000)); @@ -223,7 +263,11 @@ void app_main(void) ESP_ERROR_CHECK(esp_lcd_panel_invert_color(panel_handle, false)); ESP_ERROR_CHECK(esp_lcd_panel_swap_xy(panel_handle, false)); ESP_LOGI(TAG, "Drawing bitmap..."); - ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap(panel_handle, 16, 0, 80, 128, BITMAP_64_128)); + ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap( + panel_handle, 16 + CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, + 80 + CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + 128 + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, BITMAP_64_128)); ESP_ERROR_CHECK(epaper_panel_refresh_screen(panel_handle)); xSemaphoreTake(epaper_panel_semaphore, portMAX_DELAY); @@ -231,7 +275,11 @@ void app_main(void) ESP_ERROR_CHECK(esp_lcd_panel_invert_color(panel_handle, false)); ESP_ERROR_CHECK(esp_lcd_panel_swap_xy(panel_handle, false)); ESP_LOGI(TAG, "Drawing bitmap..."); - ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap(panel_handle, 16, 64, 144, 128, BITMAP_128_64)); + ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap( + panel_handle, 16 + CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + 64 + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, + 144 + CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + 128 + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, BITMAP_128_64)); ESP_ERROR_CHECK(epaper_panel_refresh_screen(panel_handle)); xSemaphoreTake(epaper_panel_semaphore, portMAX_DELAY); @@ -239,7 +287,11 @@ void app_main(void) ESP_ERROR_CHECK(esp_lcd_panel_invert_color(panel_handle, false)); ESP_ERROR_CHECK(esp_lcd_panel_swap_xy(panel_handle, false)); ESP_LOGI(TAG, "Drawing bitmap..."); - ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap(panel_handle, 16, 64, 144, 128, BITMAP_128_64)); + ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap( + panel_handle, 16 + CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + 64 + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, + 144 + CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + 128 + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, BITMAP_128_64)); ESP_ERROR_CHECK(epaper_panel_refresh_screen(panel_handle)); xSemaphoreTake(epaper_panel_semaphore, portMAX_DELAY); @@ -247,7 +299,11 @@ void app_main(void) ESP_ERROR_CHECK(esp_lcd_panel_invert_color(panel_handle, false)); ESP_ERROR_CHECK(esp_lcd_panel_swap_xy(panel_handle, false)); ESP_LOGI(TAG, "Drawing bitmap..."); - ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap(panel_handle, 16, 0, 144, 64, BITMAP_128_64)); + ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap( + panel_handle, 16 + CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, + 144 + CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + 64 + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, BITMAP_128_64)); ESP_ERROR_CHECK(epaper_panel_refresh_screen(panel_handle)); vTaskDelay(pdMS_TO_TICKS(5000)); diff --git a/components/lcd/esp_lcd_ssd1681/examples/epaper_lvgl_demo/main/main.c b/components/lcd/esp_lcd_ssd1681/examples/epaper_lvgl_demo/main/main.c index 1d850d4a..ab0f06ab 100644 --- a/components/lcd/esp_lcd_ssd1681/examples/epaper_lvgl_demo/main/main.c +++ b/components/lcd/esp_lcd_ssd1681/examples/epaper_lvgl_demo/main/main.c @@ -95,9 +95,18 @@ static void example_lvgl_flush_cb(lv_disp_drv_t *drv, const lv_area_t *area, lv_ // --- Draw bitmap ESP_ERROR_CHECK(epaper_panel_set_bitmap_color(panel_handle, SSD1681_EPAPER_BITMAP_BLACK)); - ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap(panel_handle, offsetx1, offsety1, offsetx2 + 1, offsety2 + 1, converted_buffer_black)); + ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap( + panel_handle, offsetx1 + CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + offsety1 + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, + offsetx2 + 1 + CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + offsety2 + 1 + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, + converted_buffer_black)); ESP_ERROR_CHECK(epaper_panel_set_bitmap_color(panel_handle, SSD1681_EPAPER_BITMAP_RED)); - ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap(panel_handle, offsetx1, offsety1, offsetx2 + 1, offsety2 + 1, converted_buffer_red)); + ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap( + panel_handle, offsetx1 + CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + offsety1 + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, + offsetx2 + 1 + CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + offsety2 + 1 + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, converted_buffer_red)); ESP_ERROR_CHECK(epaper_panel_refresh_screen(panel_handle)); } diff --git a/components/lcd/esp_lcd_st7796/test_apps/main/test_esp_lcd_st7796_general.c b/components/lcd/esp_lcd_st7796/test_apps/main/test_esp_lcd_st7796_general.c index dd879c12..9f0cb479 100644 --- a/components/lcd/esp_lcd_st7796/test_apps/main/test_esp_lcd_st7796_general.c +++ b/components/lcd/esp_lcd_st7796/test_apps/main/test_esp_lcd_st7796_general.c @@ -81,7 +81,11 @@ static void test_draw_bitmap(esp_lcd_panel_handle_t panel_handle) color[i * byte_per_pixel + k] = (BIT(j) >> (k * 8)) & 0xff; } } - TEST_ESP_OK(esp_lcd_panel_draw_bitmap(panel_handle, 0, j * row_line, TEST_LCD_H_RES, (j + 1) * row_line, color)); + TEST_ESP_OK(esp_lcd_panel_draw_bitmap( + panel_handle, CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + j * row_line + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, + TEST_LCD_H_RES + CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + (j + 1) * row_line + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, color)); xSemaphoreTake(refresh_finish, portMAX_DELAY); } free(color); diff --git a/components/lcd/esp_lcd_st7796/test_apps/main/test_esp_lcd_st7796_mipi.c b/components/lcd/esp_lcd_st7796/test_apps/main/test_esp_lcd_st7796_mipi.c index 8ca84bd3..19220666 100644 --- a/components/lcd/esp_lcd_st7796/test_apps/main/test_esp_lcd_st7796_mipi.c +++ b/components/lcd/esp_lcd_st7796/test_apps/main/test_esp_lcd_st7796_mipi.c @@ -156,7 +156,11 @@ static void test_draw_color_bar(esp_lcd_panel_handle_t panel_handle, uint16_t h_ color[i * byte_per_pixel + k] = (BIT(j) >> (k * 8)) & 0xff; } } - TEST_ESP_OK(esp_lcd_panel_draw_bitmap(panel_handle, 0, j * row_line, h_res, (j + 1) * row_line, color)); + TEST_ESP_OK(esp_lcd_panel_draw_bitmap( + panel_handle, CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + j * row_line + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, + h_res + CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + (j + 1) * row_line + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, color)); xSemaphoreTake(refresh_finish, portMAX_DELAY); } @@ -168,7 +172,11 @@ static void test_draw_color_bar(esp_lcd_panel_handle_t panel_handle, uint16_t h_ color[i * byte_per_pixel + k] = 0xff; } } - TEST_ESP_OK(esp_lcd_panel_draw_bitmap(panel_handle, 0, color_line, h_res, v_res, color)); + TEST_ESP_OK(esp_lcd_panel_draw_bitmap( + panel_handle, CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + color_line + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, + h_res + CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + v_res + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, color)); xSemaphoreTake(refresh_finish, portMAX_DELAY); } diff --git a/test_apps/noglib/main/noglib_main.c b/test_apps/noglib/main/noglib_main.c index 026c90a6..43e076ba 100644 --- a/test_apps/noglib/main/noglib_main.c +++ b/test_apps/noglib/main/noglib_main.c @@ -43,7 +43,12 @@ static void display_pretty_colors(esp_lcd_panel_handle_t panel_handle) sending_line = calc_line; calc_line = !calc_line; // Send the calculated data - esp_lcd_panel_draw_bitmap(panel_handle, 0, y, 0 + 320, y + PARALLEL_LINES, s_lines[sending_line]); + esp_lcd_panel_draw_bitmap( + panel_handle, CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + y + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, + 320 + CONFIG_BSP_DISPLAY_HORIZONTAL_OFFSET, + y + PARALLEL_LINES + CONFIG_BSP_DISPLAY_VERTICAL_OFFSET, + s_lines[sending_line]); } } }