Skip to content

Commit

Permalink
Added warning and handling for LV_COLOR_16_SWAP
Browse files Browse the repository at this point in the history
  • Loading branch information
rzeldent committed Dec 9, 2023
1 parent b196771 commit 9b16a0f
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/smartdisplay_gc9a01.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ bool gc9a01_color_trans_done(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_i
void gc9a01_lv_flush(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *color_map)
{
esp_lcd_panel_handle_t panel_handle = drv->user_data;
#if LV_COLOR_16_SWAP != 1
#warning "LV_COLOR_16_SWAP should be 1 for max performance"
ushort pixels = lv_area_get_size(area);
lv_color16_t* p = color_map;
while (pixels--)
p++->full = (uint16_t)((p->full >> 8) | (p->full << 8));
#endif
ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap(panel_handle, area->x1, area->y1, area->x2 + 1, area->y2 + 1, color_map));
};

Expand Down
9 changes: 8 additions & 1 deletion src/smartdisplay_ili9341.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,16 @@ static bool ili9341_color_trans_done(esp_lcd_panel_io_handle_t panel_io, esp_lcd
return false;
}

static void ili9341_lv_flush(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *color_map)
static void ili9341_lv_flush(lv_disp_drv_t *drv, const lv_area_t *area, lv_color16_t *color_map)
{
esp_lcd_panel_handle_t panel_handle = drv->user_data;
#if LV_COLOR_16_SWAP != 1
#warning "LV_COLOR_16_SWAP should be 1 for max performance"
ushort pixels = lv_area_get_size(area);
lv_color16_t* p = color_map;
while (pixels--)
p++->full = (uint16_t)((p->full >> 8) | (p->full << 8));
#endif
ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap(panel_handle, area->x1, area->y1, area->x2 + 1, area->y2 + 1, color_map));
};

Expand Down
7 changes: 7 additions & 0 deletions src/smartdisplay_st7789.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ static bool st7789_color_trans_done(esp_lcd_panel_io_handle_t panel_io, esp_lcd_
static void st7789_lv_flush(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *color_map)
{
esp_lcd_panel_handle_t panel_handle = drv->user_data;
#if LV_COLOR_16_SWAP != 1
#warning "LV_COLOR_16_SWAP should be 1 for max performance"
ushort pixels = lv_area_get_size(area);
lv_color16_t* p = color_map;
while (pixels--)
p++->full = (uint16_t)((p->full >> 8) | (p->full << 8));
#endif
ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap(panel_handle, area->x1, area->y1, area->x2 + 1, area->y2 + 1, color_map));
};

Expand Down
7 changes: 7 additions & 0 deletions src/smartdisplay_st7796.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ static bool st7796_color_trans_done(esp_lcd_panel_io_handle_t panel_io, esp_lcd_
static void st7796_lv_flush(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *color_map)
{
esp_lcd_panel_handle_t panel_handle = drv->user_data;
#if LV_COLOR_16_SWAP != 1
#warning "LV_COLOR_16_SWAP should be 1 for max performance"
ushort pixels = lv_area_get_size(area);
lv_color16_t* p = color_map;
while (pixels--)
p++->full = (uint16_t)((p->full >> 8) | (p->full << 8));
#endif
ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap(panel_handle, area->x1, area->y1, area->x2 + 1, area->y2 + 1, color_map));
};

Expand Down

0 comments on commit 9b16a0f

Please sign in to comment.