@@ -435,18 +435,24 @@ class St77xx_lvgl(object):
435
435
* sets the driver callback to the disp_drv_flush_cb method.
436
436
437
437
'''
438
- def disp_drv_flush_cb (self ,disp_drv ,area ,color ):
438
+ def disp_drv_flush_cb (self ,disp_drv ,area ,color_p ):
439
439
# print(f"({area.x1},{area.y1}..{area.x2},{area.y2})")
440
440
self .rp2_wait_dma () # wait if not yet done and DMA is being used
441
441
# blit in background
442
- 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 )
442
+ size = w * h
443
+ data_view = color_p .__dereference__ (size * self .pixel_size )
444
+ if self .rgb565_swap_func :
445
+ self .rgb565_swap_func (data_view , size )
446
+ self .blit (area .x1 ,area .y1 ,w := (area .x2 - area .x1 + 1 ),h := (area .y2 - area .y1 + 1 ),data_view ,is_blocking = False )
443
447
self .disp_drv .flush_ready ()
444
448
445
449
def __init__ (self ,doublebuffer = True ,factor = 4 ):
446
450
import lvgl as lv
447
451
import lv_utils
448
452
449
453
color_format = lv .COLOR_FORMAT .RGB565
454
+ self .pixel_size = lv .color_format_get_size (color_format )
455
+ self .rgb565_swap_func = None if self .bgr else lv .draw_sw_rgb565_swap
450
456
451
457
if not lv .is_initialized (): lv .init ()
452
458
0 commit comments