From 76935759d87366264851ea4b7d44797b61af4010 Mon Sep 17 00:00:00 2001 From: DJDevon3 <49322231+DJDevon3@users.noreply.github.com> Date: Sat, 23 Mar 2024 19:53:54 -0400 Subject: [PATCH 1/3] Update HX8357 driver to 8.x/9.x transitional code TFT FEatherwing display driver needs updating for 9.0 --- adafruit_hx8357.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/adafruit_hx8357.py b/adafruit_hx8357.py index 8613eb2..0a657dc 100755 --- a/adafruit_hx8357.py +++ b/adafruit_hx8357.py @@ -30,7 +30,19 @@ # imports -import displayio +try: + # used for typing only + from typing import Any +except ImportError: + pass + +# Support both 8.x.x and 9.x.x. Change when 8.x.x is discontinued as a stable release. +try: + from fourwire import FourWire # 9.x method + from busdisplay import BusDisplay +except ImportError: + from displayio import FourWire # 8.x method + from displayio import Display as BusDisplay __version__ = "0.0.0+auto.0" __repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_HX8357.git" @@ -58,8 +70,8 @@ # pylint: disable=too-few-public-methods -class HX8357(displayio.Display): +class HX8357(BusDisplay): """HX8357D driver""" - def __init__(self, bus: displayio.FourWire, **kwargs) -> None: + def __init__(self, bus: FourWire.FourWire, **kwargs) -> None: super().__init__(bus, _INIT_SEQUENCE, **kwargs) From 57a345e6526671dbe7daa5d225133695d3f86275 Mon Sep 17 00:00:00 2001 From: DJDevon3 <49322231+DJDevon3@users.noreply.github.com> Date: Sat, 23 Mar 2024 20:07:36 -0400 Subject: [PATCH 2/3] remove unused typing import --- adafruit_hx8357.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/adafruit_hx8357.py b/adafruit_hx8357.py index 0a657dc..b80e2f8 100755 --- a/adafruit_hx8357.py +++ b/adafruit_hx8357.py @@ -29,14 +29,7 @@ """ # imports - -try: - # used for typing only - from typing import Any -except ImportError: - pass - -# Support both 8.x.x and 9.x.x. Change when 8.x.x is discontinued as a stable release. +# Support both 8.x.x and 9.x.x. Removed 8.x method when discontinued. try: from fourwire import FourWire # 9.x method from busdisplay import BusDisplay From 6b47e7e4dc1e59a0ce835acccd393aae0aa70908 Mon Sep 17 00:00:00 2001 From: DJDevon3 <49322231+DJDevon3@users.noreply.github.com> Date: Sun, 24 Mar 2024 21:26:34 -0400 Subject: [PATCH 3/3] requested bus typing change --- adafruit_hx8357.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adafruit_hx8357.py b/adafruit_hx8357.py index b80e2f8..30e87e0 100755 --- a/adafruit_hx8357.py +++ b/adafruit_hx8357.py @@ -29,7 +29,7 @@ """ # imports -# Support both 8.x.x and 9.x.x. Removed 8.x method when discontinued. +# Support both 8.x.x and 9.x.x. Remove 8.x method when discontinued. try: from fourwire import FourWire # 9.x method from busdisplay import BusDisplay @@ -66,5 +66,5 @@ class HX8357(BusDisplay): """HX8357D driver""" - def __init__(self, bus: FourWire.FourWire, **kwargs) -> None: + def __init__(self, bus: FourWire, **kwargs) -> None: super().__init__(bus, _INIT_SEQUENCE, **kwargs)