Skip to content

Commit

Permalink
fix(display): fix RGB565 wrong color issue in st77xx.py (#323)
Browse files Browse the repository at this point in the history
  • Loading branch information
PGNetHun authored Jan 27, 2024
1 parent 5e80637 commit b0561b8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions driver/generic/st77xx.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,18 +435,24 @@ class St77xx_lvgl(object):
* sets the driver callback to the disp_drv_flush_cb method.
'''
def disp_drv_flush_cb(self,disp_drv,area,color):
def disp_drv_flush_cb(self,disp_drv,area,color_p):
# print(f"({area.x1},{area.y1}..{area.x2},{area.y2})")
self.rp2_wait_dma() # wait if not yet done and DMA is being used
# blit in background
self.blit(area.x1,area.y1,w:=(area.x2-area.x1+1),h:=(area.y2-area.y1+1),color.__dereference__(2*w*h),is_blocking=False)
size = w * h
data_view = color_p.__dereference__(size * self.pixel_size)
if self.rgb565_swap_func:
self.rgb565_swap_func(data_view, size)
self.blit(area.x1,area.y1,w:=(area.x2-area.x1+1),h:=(area.y2-area.y1+1),data_view,is_blocking=False)
self.disp_drv.flush_ready()

def __init__(self,doublebuffer=True,factor=4):
import lvgl as lv
import lv_utils

color_format = lv.COLOR_FORMAT.RGB565
self.pixel_size = lv.color_format_get_size(color_format)
self.rgb565_swap_func = None if self.bgr else lv.draw_sw_rgb565_swap

if not lv.is_initialized(): lv.init()

Expand Down

0 comments on commit b0561b8

Please sign in to comment.