Skip to content

FourWire support for both 8.x.x and 9.x.x #35

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions adafruit_ili9341.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,13 @@
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"
Expand Down Expand Up @@ -85,12 +91,12 @@


# 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)
9 changes: 7 additions & 2 deletions examples/ili9341_pitft_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,23 @@
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()

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
Expand Down
9 changes: 7 additions & 2 deletions examples/ili9341_shield_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,15 @@
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()

Expand All @@ -27,7 +32,7 @@
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
Expand Down
9 changes: 7 additions & 2 deletions examples/ili9341_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,23 @@
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()

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
Expand Down