mirror of
https://github.com/antirez/uc8151_micropython.git
synced 2025-12-06 06:12:49 +08:00
Better handmade LUT.
This commit is contained in:
38
uc8151.py
38
uc8151.py
@@ -274,18 +274,9 @@ class UC8151:
|
|||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00
|
0x00, 0x00
|
||||||
])
|
])
|
||||||
WW = bytes([
|
|
||||||
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,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
||||||
])
|
|
||||||
BW = bytes([
|
BW = bytes([
|
||||||
0x54, 0x01, 0x01, 0x02, 0x00, 0x01,
|
0x99, 0x02, 0x02, 0x00, 0x00, 0x01,
|
||||||
0xa8, 0x02, 0x02, 0x03, 0x00, 0x02,
|
0xaa, 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, 0x00, 0x00, 0x00, 0x00,
|
||||||
@@ -293,8 +284,17 @@ class UC8151:
|
|||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||||
])
|
])
|
||||||
WB = bytes([
|
WB = bytes([
|
||||||
0xa8, 0x01, 0x01, 0x02, 0x00, 0x01,
|
0x66, 0x02, 0x02, 0x00, 0x00, 0x01,
|
||||||
0x54, 0x02, 0x02, 0x03, 0x00, 0x02,
|
0x55, 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
|
||||||
|
])
|
||||||
|
WW = bytes([
|
||||||
|
0xaa, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||||
|
0xaa, 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, 0x00, 0x00, 0x00, 0x00,
|
||||||
@@ -302,8 +302,8 @@ class UC8151:
|
|||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||||
])
|
])
|
||||||
BB = bytes([
|
BB = bytes([
|
||||||
0x54, 0x02, 0x02, 0x03, 0x00, 0x02,
|
0x55, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x55, 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, 0x00, 0x00, 0x00, 0x00,
|
||||||
@@ -375,7 +375,7 @@ class UC8151:
|
|||||||
# However they are set to 0 in all the LUTs I saw, so they are generally
|
# However they are set to 0 in all the LUTs I saw, so they are generally
|
||||||
# not used and we don't use it either.
|
# not used and we don't use it either.
|
||||||
def set_waveform_lut(self):
|
def set_waveform_lut(self):
|
||||||
if self.speed == 0:
|
if self.speed < 1:
|
||||||
# For the default speed, we don't set any LUT, but resort
|
# For the default speed, we don't set any LUT, but resort
|
||||||
# to the one inside the device. __init__() will take care
|
# to the one inside the device. __init__() will take care
|
||||||
# to tell the chip to use internal LUTs by setting the right
|
# to tell the chip to use internal LUTs by setting the right
|
||||||
@@ -388,6 +388,8 @@ class UC8151:
|
|||||||
# In this driver we try to do things a bit differently and compute
|
# In this driver we try to do things a bit differently and compute
|
||||||
# LUTs on the fly depending on the 'speed' requested by the user.
|
# LUTs on the fly depending on the 'speed' requested by the user.
|
||||||
# Each successive speed value cuts the display update time in half.
|
# Each successive speed value cuts the display update time in half.
|
||||||
|
# Floating point speeds are possible, so 2.5 will be between
|
||||||
|
# 2 and 3 from the POV of speed and quality.
|
||||||
#
|
#
|
||||||
# Moreover, we check if no_flickering was set to True. In this case
|
# Moreover, we check if no_flickering was set to True. In this case
|
||||||
# we change the LUTs in two ways, with the goal to prevent the
|
# we change the LUTs in two ways, with the goal to prevent the
|
||||||
@@ -530,11 +532,11 @@ if __name__ == "__main__":
|
|||||||
import random
|
import random
|
||||||
|
|
||||||
spi = SPI(0, baudrate=12000000, phase=0, polarity=0, sck=Pin(18), mosi=Pin(19), miso=Pin(16))
|
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=4,no_flickering=True)
|
eink = UC8151(spi,cs=17,dc=20,rst=21,busy=26,speed=4.3,no_flickering=True)
|
||||||
eink.fb.ellipse(10,10,10,10,1)
|
eink.fb.ellipse(10,10,10,10,1)
|
||||||
eink.fb.ellipse(50,50,10,10,1)
|
eink.fb.ellipse(50,50,10,10,1)
|
||||||
|
|
||||||
#eink.set_handmade_lut()
|
eink.set_handmade_lut()
|
||||||
|
|
||||||
random.seed(123)
|
random.seed(123)
|
||||||
for _ in range(10):
|
for _ in range(10):
|
||||||
|
|||||||
Reference in New Issue
Block a user