Merge pull request #35 from dhalbert/fourwire

FourWire support for both 8.x.x and 9.x.x
This commit is contained in:
foamyguy 2023-12-18 11:06:34 -06:00 committed by GitHub
commit b1063ed2e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 31 additions and 10 deletions

View file

@ -52,7 +52,13 @@ try:
except ImportError:
pass
import displayio
# 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
from busdisplay import BusDisplay
except ImportError:
from displayio import FourWire
from displayio import Display as BusDisplay
__version__ = "0.0.0+auto.0"
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_ILI9341.git"
@ -85,12 +91,12 @@ _INIT_SEQUENCE = (
# pylint: disable=too-few-public-methods
class ILI9341(displayio.Display):
class ILI9341(BusDisplay):
"""
ILI9341 display driver
:param displayio.FourWire bus: bus that the display is connected to
:param FourWire bus: bus that the display is connected to
"""
def __init__(self, bus: displayio.FourWire, **kwargs: Any):
def __init__(self, bus: FourWire, **kwargs: Any):
super().__init__(bus, _INIT_SEQUENCE, **kwargs)

View file

@ -11,10 +11,15 @@ Pinouts are for the PiTFT and should be run in CPython.
import board
import terminalio
import displayio
import fourwire
from adafruit_display_text import label
import adafruit_ili9341
# 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
except ImportError:
from displayio import FourWire
# Release any resources currently in use for the displays
displayio.release_displays()
@ -22,7 +27,7 @@ spi = board.SPI()
tft_cs = board.CE0
tft_dc = board.D25
display_bus = fourwire.FourWire(spi, command=tft_dc, chip_select=tft_cs)
display_bus = FourWire(spi, command=tft_dc, chip_select=tft_cs)
display = adafruit_ili9341.ILI9341(display_bus, width=320, height=240)
# Make the display context

View file

@ -10,10 +10,15 @@ Pinouts are for the 2.8" TFT Shield
import board
import terminalio
import displayio
import fourwire
from adafruit_display_text import label
import adafruit_ili9341
# 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
except ImportError:
from displayio import FourWire
# Release any resources currently in use for the displays
displayio.release_displays()
@ -27,7 +32,7 @@ spi = board.SPI()
tft_cs = board.D10
tft_dc = board.D9
display_bus = fourwire.FourWire(spi, command=tft_dc, chip_select=tft_cs)
display_bus = FourWire(spi, command=tft_dc, chip_select=tft_cs)
display = adafruit_ili9341.ILI9341(display_bus, width=320, height=240)
# Make the display context

View file

@ -11,10 +11,15 @@ Pinouts are for the 2.4" TFT FeatherWing or Breakout with a Feather M4 or M0.
import board
import terminalio
import displayio
import fourwire
from adafruit_display_text import label
import adafruit_ili9341
# 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
except ImportError:
from displayio import FourWire
# Release any resources currently in use for the displays
displayio.release_displays()
@ -22,7 +27,7 @@ spi = board.SPI()
tft_cs = board.D9
tft_dc = board.D10
display_bus = fourwire.FourWire(spi, command=tft_dc, chip_select=tft_cs, reset=board.D6)
display_bus = FourWire(spi, command=tft_dc, chip_select=tft_cs, reset=board.D6)
display = adafruit_ili9341.ILI9341(display_bus, width=320, height=240)
# Make the display context