@@ -36,7 +36,7 @@ def __init__(
36
36
backlight_on_state = STATE_HIGH ,
37
37
offset_x = 0 ,
38
38
offset_y = 0 ,
39
- color_space = lv .COLOR_FORMAT .RGB888 , # NOQA
39
+ color_space = LV .COLOR_FORMAT .I1 , # NOQA
40
40
rgb565_byte_swap = False
41
41
):
42
42
@@ -126,7 +126,9 @@ def set_power(self, value):
126
126
self .set_params (_DISP_OFF )
127
127
128
128
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)
130
132
x1 = 0
131
133
x2 = self .display_width - 1
132
134
@@ -146,14 +148,10 @@ def _flush_cb(self, _, area, color_p):
146
148
self ._param_buf [1 ] = y2
147
149
self .set_params (_SET_PAGE_ADDR , self ._param_mv [:2 ])
148
150
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 )
154
152
155
153
# we have to use the __dereference__ method because this method is
156
154
# what converts from the C_Array object the binding passes into a
157
155
# memoryview object that can be passed to the bus drivers
158
156
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