Skip to content

Commit

Permalink
BSP offset
Browse files Browse the repository at this point in the history
  • Loading branch information
adamkaliszan committed Jan 6, 2025
1 parent a9620d5 commit 69133d5
Show file tree
Hide file tree
Showing 11 changed files with 164 additions and 29 deletions.
20 changes: 19 additions & 1 deletion bsp/esp_bsp_generic/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
21 changes: 18 additions & 3 deletions components/esp_lvgl_port/src/lvgl8/esp_lvgl_port_disp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))) {
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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);
}

Expand Down
84 changes: 70 additions & 14 deletions components/lcd/esp_lcd_ssd1681/examples/epaper_demo/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -144,63 +152,95 @@ 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);
ESP_ERROR_CHECK(esp_lcd_panel_mirror(panel_handle, false, true));
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);
ESP_ERROR_CHECK(esp_lcd_panel_mirror(panel_handle, true, false));
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);
ESP_ERROR_CHECK(esp_lcd_panel_mirror(panel_handle, true, true));
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);
ESP_ERROR_CHECK(esp_lcd_panel_mirror(panel_handle, false, false));
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);
ESP_ERROR_CHECK(esp_lcd_panel_mirror(panel_handle, false, true));
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);
ESP_ERROR_CHECK(esp_lcd_panel_mirror(panel_handle, true, false));
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);
ESP_ERROR_CHECK(esp_lcd_panel_mirror(panel_handle, true, true));
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));
Expand All @@ -223,31 +263,47 @@ 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);
ESP_ERROR_CHECK(esp_lcd_panel_mirror(panel_handle, false, true));
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);
ESP_ERROR_CHECK(esp_lcd_panel_mirror(panel_handle, true, false));
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);
ESP_ERROR_CHECK(esp_lcd_panel_mirror(panel_handle, true, true));
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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading

0 comments on commit 69133d5

Please sign in to comment.