Ruff format

This commit is contained in:
Scott Shawcroft 2025-07-30 11:24:24 -07:00
parent 68c5000126
commit ddd3f0f9c0
No known key found for this signature in database
3 changed files with 27 additions and 32 deletions

View file

@ -53,9 +53,7 @@ _START_SEQUENCE = (
b"\x01\x00\x03\x00\x00\x00" # set display size b"\x01\x00\x03\x00\x00\x00" # set display size
) )
_DISPLAY_UPDATE_MODE = ( _DISPLAY_UPDATE_MODE = b"\x22\x00\x01\xf4" # display update mode
b"\x22\x00\x01\xf4" # display update mode
)
_STOP_SEQUENCE = b"\x10\x80\x01\x01\x64" # Deep Sleep _STOP_SEQUENCE = b"\x10\x80\x01\x01\x64" # Deep Sleep
@ -83,7 +81,9 @@ class SSD1680(EPaperDisplay):
Custom look-up table settings Custom look-up table settings
""" """
def __init__(self, bus: FourWire, vcom:int = 0x36, vsh2:int = 0x00, custom_lut: bytes = b"", **kwargs) -> None: def __init__(
self, bus: FourWire, vcom: int = 0x36, vsh2: int = 0x00, custom_lut: bytes = b"", **kwargs
) -> None:
if "colstart" not in kwargs: if "colstart" not in kwargs:
kwargs["colstart"] = 8 kwargs["colstart"] = 8
stop_sequence = bytearray(_STOP_SEQUENCE) stop_sequence = bytearray(_STOP_SEQUENCE)
@ -96,7 +96,7 @@ class SSD1680(EPaperDisplay):
display_update_mode = bytearray(_DISPLAY_UPDATE_MODE) display_update_mode = bytearray(_DISPLAY_UPDATE_MODE)
if custom_lut: if custom_lut:
load_lut = b"\x32" + len(custom_lut).to_bytes(2) + custom_lut load_lut = b"\x32" + len(custom_lut).to_bytes(2) + custom_lut
display_update_mode[-1] = 0xc7 display_update_mode[-1] = 0xC7
start_sequence = bytearray(_START_SEQUENCE + load_lut + display_update_mode) start_sequence = bytearray(_START_SEQUENCE + load_lut + display_update_mode)
start_sequence[15] = vcom start_sequence[15] = vcom
@ -127,5 +127,5 @@ class SSD1680(EPaperDisplay):
refresh_display_command=0x20, refresh_display_command=0x20,
always_toggle_chip_select=False, always_toggle_chip_select=False,
address_little_endian=True, address_little_endian=True,
two_byte_sequence_length=True two_byte_sequence_length=True,
) )

View file

@ -27,24 +27,24 @@ display_bus = FourWire(spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset,
time.sleep(1) time.sleep(1)
ti_290mfgn_gray4_lut_code = ( ti_290mfgn_gray4_lut_code = (
b"\x2A\x60\x15\x00\x00\x00\x00\x00\x00\x00\x00\x00" # VS L0 b"\x2a\x60\x15\x00\x00\x00\x00\x00\x00\x00\x00\x00" # VS L0
b"\x20\x60\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00" # VS L1 b"\x20\x60\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00" # VS L1
b"\x28\x60\x14\x00\x00\x00\x00\x00\x00\x00\x00\x00" # VS L2 b"\x28\x60\x14\x00\x00\x00\x00\x00\x00\x00\x00\x00" # VS L2
b"\x00\x60\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" # VS L3 b"\x00\x60\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" # VS L3
b"\x00\x90\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" # VS L4 b"\x00\x90\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" # VS L4
b"\x00\x02\x00\x05\x14\x00\x00" # TP, SR, RP of Group0 b"\x00\x02\x00\x05\x14\x00\x00" # TP, SR, RP of Group0
b"\x1E\x1E\x00\x00\x00\x00\x01" # TP, SR, RP of Group1 b"\x1e\x1e\x00\x00\x00\x00\x01" # TP, SR, RP of Group1
b"\x00\x02\x00\x05\x14\x00\x00" # TP, SR, RP of Group2 b"\x00\x02\x00\x05\x14\x00\x00" # TP, SR, RP of Group2
b"\x00\x00\x00\x00\x00\x00\x00" # TP, SR, RP of Group3 b"\x00\x00\x00\x00\x00\x00\x00" # TP, SR, RP of Group3
b"\x00\x00\x00\x00\x00\x00\x00" # TP, SR, RP of Group4 b"\x00\x00\x00\x00\x00\x00\x00" # TP, SR, RP of Group4
b"\x00\x00\x00\x00\x00\x00\x00" # TP, SR, RP of Group5 b"\x00\x00\x00\x00\x00\x00\x00" # TP, SR, RP of Group5
b"\x00\x00\x00\x00\x00\x00\x00" # TP, SR, RP of Group6 b"\x00\x00\x00\x00\x00\x00\x00" # TP, SR, RP of Group6
b"\x00\x00\x00\x00\x00\x00\x00" # TP, SR, RP of Group7 b"\x00\x00\x00\x00\x00\x00\x00" # TP, SR, RP of Group7
b"\x00\x00\x00\x00\x00\x00\x00" # TP, SR, RP of Group8 b"\x00\x00\x00\x00\x00\x00\x00" # TP, SR, RP of Group8
b"\x00\x00\x00\x00\x00\x00\x00" # TP, SR, RP of Group9 b"\x00\x00\x00\x00\x00\x00\x00" # TP, SR, RP of Group9
b"\x00\x00\x00\x00\x00\x00\x00" # TP, SR, RP of Group10 b"\x00\x00\x00\x00\x00\x00\x00" # TP, SR, RP of Group10
b"\x00\x00\x00\x00\x00\x00\x00" # TP, SR, RP of Group11 b"\x00\x00\x00\x00\x00\x00\x00" # TP, SR, RP of Group11
b"\x24\x22\x22\x22\x23\x32\x00\x00\x00" # FR, XON b"\x24\x22\x22\x22\x23\x32\x00\x00\x00" # FR, XON
) )
if len(ti_290mfgn_gray4_lut_code) != 153: if len(ti_290mfgn_gray4_lut_code) != 153:
@ -59,9 +59,9 @@ display = adafruit_ssd1680.SSD1680(
rotation=270, rotation=270,
colstart=0, colstart=0,
vcom=0x28, vcom=0x28,
vsh2=0xae, vsh2=0xAE,
custom_lut=ti_290mfgn_gray4_lut_code, custom_lut=ti_290mfgn_gray4_lut_code,
grayscale=True grayscale=True,
) )
g = displayio.Group() g = displayio.Group()

View file

@ -28,12 +28,7 @@ time.sleep(1)
# For issues with display not updating top/bottom rows correctly set colstart to 8, 0, or -8 # For issues with display not updating top/bottom rows correctly set colstart to 8, 0, or -8
display = adafruit_ssd1680.SSD1680( display = adafruit_ssd1680.SSD1680(
display_bus, display_bus, width=296, height=128, busy_pin=epd_busy, rotation=270, colstart=0
width=296,
height=128,
busy_pin=epd_busy,
rotation=270,
colstart=0
) )
g = displayio.Group() g = displayio.Group()