Skip to content

Commit 11dddce

Browse files
authored
Merge pull request #23 from DJDevon3/main
Update HX8357 driver to 8.x/9.x transitional code
2 parents e0b977a + 6b47e7e commit 11dddce

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

adafruit_hx8357.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,13 @@
2929
"""
3030

3131
# imports
32-
33-
import displayio
32+
# Support both 8.x.x and 9.x.x. Remove 8.x method when discontinued.
33+
try:
34+
from fourwire import FourWire # 9.x method
35+
from busdisplay import BusDisplay
36+
except ImportError:
37+
from displayio import FourWire # 8.x method
38+
from displayio import Display as BusDisplay
3439

3540
__version__ = "0.0.0+auto.0"
3641
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_HX8357.git"
@@ -58,8 +63,8 @@
5863

5964

6065
# pylint: disable=too-few-public-methods
61-
class HX8357(displayio.Display):
66+
class HX8357(BusDisplay):
6267
"""HX8357D driver"""
6368

64-
def __init__(self, bus: displayio.FourWire, **kwargs) -> None:
69+
def __init__(self, bus: FourWire, **kwargs) -> None:
6570
super().__init__(bus, _INIT_SEQUENCE, **kwargs)

0 commit comments

Comments
 (0)