Skip to content

Commit 077f7ab

Browse files
authored
Merge pull request #19 from FoamyGuy/9x_compatibility
9x compatibility
2 parents c707c98 + 31d64a8 commit 077f7ab

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

adafruit_il91874.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,13 @@
2525
2626
"""
2727

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

3036
__version__ = "0.0.0+auto.0"
3137
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_IL91874.git"
@@ -67,10 +73,10 @@
6773

6874

6975
# pylint: disable=too-few-public-methods
70-
class IL91874(displayio.EPaperDisplay):
76+
class IL91874(EPaperDisplay):
7177
"""IL91874 display driver"""
7278

73-
def __init__(self, bus: displayio.FourWire, **kwargs) -> None:
79+
def __init__(self, bus: FourWire, **kwargs) -> None:
7480
start_sequence = bytearray(_START_SEQUENCE)
7581

7682
width = kwargs["width"]

examples/il91874_simpletest.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@
1414
import time
1515
import board
1616
import displayio
17+
18+
# Compatibility with both CircuitPython 8.x.x and 9.x.x.
19+
# Remove after 8.x.x is no longer a supported release.
20+
try:
21+
from fourwire import FourWire
22+
except ImportError:
23+
# pylint: disable=ungrouped-imports
24+
from displayio import FourWire
25+
1726
import adafruit_il91874
1827

1928
# Used to ensure the display is free in CircuitPython
@@ -27,7 +36,7 @@
2736
epd_busy = board.D6
2837

2938
# Create the displayio connection to the display pins
30-
display_bus = displayio.FourWire(
39+
display_bus = FourWire(
3140
spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000
3241
)
3342
time.sleep(1) # Wait a bit

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
# SPDX-License-Identifier: Unlicense
44

55
Adafruit-Blinka
6+
Adafruit-Blinka-Displayio

0 commit comments

Comments
 (0)