ULTRA mode.

This commit is contained in:
antirez
2024-03-15 00:17:30 +01:00
parent 0aaf4c6bab
commit 6c30f645fa

View File

@@ -147,6 +147,7 @@ class UC8151:
UPDATE_SPEED_MEDIUM=const(1)
UPDATE_SPEED_FAST=const(2)
UPDATE_SPEED_TURBO=const(3)
UPDATE_SPEED_ULTRA=const(4)
def __init__(self,spi,*,cs,dc,rst,busy,speed=UPDATE_SPEED_DEFAULT,mirror_x=False,mirror_y=False,inverted=False):
self.spi = spi
@@ -397,6 +398,35 @@ class UC8151:
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00
])
elif self.speed == UPDATE_SPEED_ULTRA:
VCOM = bytes([
0x00, 0x01, 0x01, 0x02, 0x00, 0x01,
0x00, 0x02, 0x02, 0x03, 0x00, 0x02,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00
])
WHITE = bytes([
0x54, 0x01, 0x01, 0x02, 0x00, 0x01,
0xa8, 0x02, 0x02, 0x03, 0x00, 0x02,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00
])
BLACK = bytes([
0xa8, 0x01, 0x01, 0x02, 0x00, 0x01,
0x54, 0x02, 0x02, 0x03, 0x00, 0x02,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00
])
@@ -437,13 +467,15 @@ if __name__ == "__main__":
import random
spi = SPI(0, baudrate=12000000, phase=0, polarity=0, sck=Pin(18), mosi=Pin(19), miso=Pin(16))
eink = UC8151(spi,cs=17,dc=20,rst=21,busy=26,speed=UPDATE_SPEED_TURBO)
eink = UC8151(spi,cs=17,dc=20,rst=21,busy=26,speed=UPDATE_SPEED_ULTRA)
eink.fb.ellipse(10,10,10,10,1)
eink.fb.ellipse(50,50,10,10,1)
x = random.randrange(100)
y = random.randrange(100)
eink.fb.text("TEST",x,y,1)
start = time.ticks_ms()
eink.update(blocking=True)
print("Update time:",time.ticks_ms() - start)
for _ in range(10):
x = random.randrange(100)
y = random.randrange(100)
eink.fb.text("TEST",x,y,1)
start = time.ticks_ms()
eink.update(blocking=True)
eink.fb.fill(0)
print("Update time:",time.ticks_ms() - start)