kopia lustrzana https://github.com/peterhinch/micropython-nano-gui
st7789_4bit.py: Prevents a white screen when the first time self.show() is called in __init__().
rodzic
f36920fb36
commit
4b283e3122
|
@ -46,6 +46,8 @@ def _lcopy(dest:ptr16, source:ptr8, lut:ptr16, length:int):
|
||||||
class ST7789(framebuf.FrameBuffer):
|
class ST7789(framebuf.FrameBuffer):
|
||||||
|
|
||||||
lut = bytearray(32)
|
lut = bytearray(32)
|
||||||
|
for i in range(len(lut)):
|
||||||
|
lut[i] = 0xFF # set all colors to BLACK
|
||||||
|
|
||||||
# Convert r, g, b in range 0-255 to a 16 bit colour value rgb565.
|
# Convert r, g, b in range 0-255 to a 16 bit colour value rgb565.
|
||||||
# LS byte goes into LUT offset 0, MS byte into offset 1
|
# LS byte goes into LUT offset 0, MS byte into offset 1
|
||||||
|
@ -79,7 +81,6 @@ class ST7789(framebuf.FrameBuffer):
|
||||||
super().__init__(buf, width, height, mode)
|
super().__init__(buf, width, height, mode)
|
||||||
self._linebuf = bytearray(self.width * 2) # 16 bit color out
|
self._linebuf = bytearray(self.width * 2) # 16 bit color out
|
||||||
self._init(disp_mode, orientation)
|
self._init(disp_mode, orientation)
|
||||||
self.fill(0)
|
|
||||||
self.show()
|
self.show()
|
||||||
|
|
||||||
# Hardware reset
|
# Hardware reset
|
||||||
|
|
Ładowanie…
Reference in New Issue