Skip to content

Commit

Permalink
Added RENDER_MODE
Browse files Browse the repository at this point in the history
  • Loading branch information
rzeldent committed Jul 14, 2024
1 parent 7687e9e commit 9afa83e
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 22 deletions.
10 changes: 6 additions & 4 deletions src/lvgl_panel_gc9a01_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
}
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
10 changes: 6 additions & 4 deletions src/lvgl_panel_ili9341_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
}
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/lvgl_panel_st7262_par.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/lvgl_panel_st7701_par.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 = {
Expand Down
6 changes: 4 additions & 2 deletions src/lvgl_panel_st7789_i80.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
}
Expand All @@ -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);
Expand Down
10 changes: 6 additions & 4 deletions src/lvgl_panel_st7789_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
}
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
10 changes: 6 additions & 4 deletions src/lvgl_panel_st7796_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
}
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 9afa83e

Please sign in to comment.