From 7bb92d94b1e3ddbade95e30ebcd2774c4339c719 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Sun, 24 Mar 2024 16:48:07 -0500 Subject: [PATCH 1/2] update root_group instead of show --- examples/ek79686_simpletest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/ek79686_simpletest.py b/examples/ek79686_simpletest.py index 13ae762..861a8d6 100644 --- a/examples/ek79686_simpletest.py +++ b/examples/ek79686_simpletest.py @@ -60,7 +60,7 @@ g.append(t) # Place the display group on the screen (does not refresh) - display.show(g) + display.root_group = g # Show the image on the display display.refresh() From 8926f4f3a6cf1bb8128c20c8aeaa7651ccf20c2c Mon Sep 17 00:00:00 2001 From: foamyguy Date: Mon, 25 Mar 2024 15:38:13 -0500 Subject: [PATCH 2/2] other 9.x compatibility changes --- adafruit_ek79686.py | 13 ++++++++++--- examples/ek79686_simpletest.py | 10 +++++++++- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/adafruit_ek79686.py b/adafruit_ek79686.py index 8ed9a07..940b3d5 100755 --- a/adafruit_ek79686.py +++ b/adafruit_ek79686.py @@ -26,7 +26,14 @@ """ import math -import displayio + +# Compatibility with both CircuitPython 8.x.x and 9.x.x. +# Remove after 8.x.x is no longer a supported release. +try: + from epaperdisplay import EPaperDisplay + from fourwire import FourWire +except ImportError: + from displayio import EPaperDisplay, FourWire __version__ = "0.0.0+auto.0" __repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_EK79686.git" @@ -54,10 +61,10 @@ # pylint: disable=too-few-public-methods -class EK79686(displayio.EPaperDisplay): +class EK79686(EPaperDisplay): """EK79686 display driver""" - def __init__(self, bus: displayio.FourWire, **kwargs) -> None: + def __init__(self, bus: FourWire, **kwargs) -> None: start_sequence = bytearray(_START_SEQUENCE) width = 8 * math.ceil(kwargs["width"] / 8) diff --git a/examples/ek79686_simpletest.py b/examples/ek79686_simpletest.py index 861a8d6..0bba1ac 100644 --- a/examples/ek79686_simpletest.py +++ b/examples/ek79686_simpletest.py @@ -15,6 +15,14 @@ import time import board import displayio + +# Compatibility with both CircuitPython 8.x.x and 9.x.x. +# Remove after 8.x.x is no longer a supported release. +try: + from fourwire import FourWire +except ImportError: + from displayio import FourWire + import adafruit_ek79686 # Used to ensure the display is free in CircuitPython @@ -28,7 +36,7 @@ epd_busy = board.D6 # Create the displayio connection to the display pins -display_bus = displayio.FourWire( +display_bus = FourWire( spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000 ) time.sleep(1) # Wait a bit