@@ -36,7 +36,7 @@ def __init__(
3636 backlight_on_state = STATE_HIGH ,
3737 offset_x = 0 ,
3838 offset_y = 0 ,
39- color_space = lv .COLOR_FORMAT .RGB888 , # NOQA
39+ color_space = LV .COLOR_FORMAT .I1 , # NOQA
4040 rgb565_byte_swap = False
4141 ):
4242
@@ -126,7 +126,9 @@ def set_power(self, value):
126126 self .set_params (_DISP_OFF )
127127
128128 def _flush_cb (self , _ , area , color_p ):
129-
129+ # display ram is 8192 bits in size. the is evenly divided into 8 pages.
130+ # each page holds
131+ # 8 pages 1024 bits (128 bytes)
130132 x1 = 0
131133 x2 = self .display_width - 1
132134
@@ -146,14 +148,10 @@ def _flush_cb(self, _, area, color_p):
146148 self ._param_buf [1 ] = y2
147149 self .set_params (_SET_PAGE_ADDR , self ._param_mv [:2 ])
148150
149- size = (
150- (area .x2 - area .x1 + 1 ) *
151- (area .y2 - area .y1 + 1 ) *
152- lv .color_format_get_size (self ._color_space )
153- )
151+ size = int ((area .x2 - area .x1 + 1 ) * (area .y2 - area .y1 + 1 ) / 8 )
154152
155153 # we have to use the __dereference__ method because this method is
156154 # what converts from the C_Array object the binding passes into a
157155 # memoryview object that can be passed to the bus drivers
158156 data_view = color_p .__dereference__ (size )
159- self ._data_bus .tx_color (0 , data_view , x1 , y1 , x2 , y2 , self ._rotation , self ._disp_drv .flush_is_last ())
157+ self ._data_bus .tx_color (- 1 , data_view , x1 , y1 , x2 , y2 , self ._rotation , self ._disp_drv .flush_is_last ())
0 commit comments