Skip to content

Commit af7e03c

Browse files
authored
Merge pull request #1 from FoamyGuy/root_group_update
9.x Compatibility changes
2 parents 1dc1289 + 8926f4f commit af7e03c

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

adafruit_ek79686.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,14 @@
2626
"""
2727

2828
import math
29-
import displayio
29+
30+
# Compatibility with both CircuitPython 8.x.x and 9.x.x.
31+
# Remove after 8.x.x is no longer a supported release.
32+
try:
33+
from epaperdisplay import EPaperDisplay
34+
from fourwire import FourWire
35+
except ImportError:
36+
from displayio import EPaperDisplay, FourWire
3037

3138
__version__ = "0.0.0+auto.0"
3239
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_EK79686.git"
@@ -54,10 +61,10 @@
5461

5562

5663
# pylint: disable=too-few-public-methods
57-
class EK79686(displayio.EPaperDisplay):
64+
class EK79686(EPaperDisplay):
5865
"""EK79686 display driver"""
5966

60-
def __init__(self, bus: displayio.FourWire, **kwargs) -> None:
67+
def __init__(self, bus: FourWire, **kwargs) -> None:
6168
start_sequence = bytearray(_START_SEQUENCE)
6269

6370
width = 8 * math.ceil(kwargs["width"] / 8)

examples/ek79686_simpletest.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@
1515
import time
1616
import board
1717
import displayio
18+
19+
# Compatibility with both CircuitPython 8.x.x and 9.x.x.
20+
# Remove after 8.x.x is no longer a supported release.
21+
try:
22+
from fourwire import FourWire
23+
except ImportError:
24+
from displayio import FourWire
25+
1826
import adafruit_ek79686
1927

2028
# Used to ensure the display is free in CircuitPython
@@ -28,7 +36,7 @@
2836
epd_busy = board.D6
2937

3038
# Create the displayio connection to the display pins
31-
display_bus = displayio.FourWire(
39+
display_bus = FourWire(
3240
spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000
3341
)
3442
time.sleep(1) # Wait a bit
@@ -60,7 +68,7 @@
6068
g.append(t)
6169

6270
# Place the display group on the screen (does not refresh)
63-
display.show(g)
71+
display.root_group = g
6472

6573
# Show the image on the display
6674
display.refresh()

0 commit comments

Comments
 (0)