Merge pull request #35 from dhalbert/fourwire
FourWire support for both 8.x.x and 9.x.x
This commit is contained in:
commit
b1063ed2e7
4 changed files with 31 additions and 10 deletions
|
|
@ -52,7 +52,13 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
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"
|
__version__ = "0.0.0+auto.0"
|
||||||
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_ILI9341.git"
|
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_ILI9341.git"
|
||||||
|
|
@ -85,12 +91,12 @@ _INIT_SEQUENCE = (
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-few-public-methods
|
# pylint: disable=too-few-public-methods
|
||||||
class ILI9341(displayio.Display):
|
class ILI9341(BusDisplay):
|
||||||
"""
|
"""
|
||||||
ILI9341 display driver
|
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)
|
super().__init__(bus, _INIT_SEQUENCE, **kwargs)
|
||||||
|
|
|
||||||
|
|
@ -11,10 +11,15 @@ Pinouts are for the PiTFT and should be run in CPython.
|
||||||
import board
|
import board
|
||||||
import terminalio
|
import terminalio
|
||||||
import displayio
|
import displayio
|
||||||
import fourwire
|
|
||||||
from adafruit_display_text import label
|
from adafruit_display_text import label
|
||||||
import adafruit_ili9341
|
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
|
# Release any resources currently in use for the displays
|
||||||
displayio.release_displays()
|
displayio.release_displays()
|
||||||
|
|
||||||
|
|
@ -22,7 +27,7 @@ spi = board.SPI()
|
||||||
tft_cs = board.CE0
|
tft_cs = board.CE0
|
||||||
tft_dc = board.D25
|
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)
|
display = adafruit_ili9341.ILI9341(display_bus, width=320, height=240)
|
||||||
|
|
||||||
# Make the display context
|
# Make the display context
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,15 @@ Pinouts are for the 2.8" TFT Shield
|
||||||
import board
|
import board
|
||||||
import terminalio
|
import terminalio
|
||||||
import displayio
|
import displayio
|
||||||
import fourwire
|
|
||||||
from adafruit_display_text import label
|
from adafruit_display_text import label
|
||||||
import adafruit_ili9341
|
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
|
# Release any resources currently in use for the displays
|
||||||
displayio.release_displays()
|
displayio.release_displays()
|
||||||
|
|
||||||
|
|
@ -27,7 +32,7 @@ spi = board.SPI()
|
||||||
tft_cs = board.D10
|
tft_cs = board.D10
|
||||||
tft_dc = board.D9
|
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)
|
display = adafruit_ili9341.ILI9341(display_bus, width=320, height=240)
|
||||||
|
|
||||||
# Make the display context
|
# Make the display context
|
||||||
|
|
|
||||||
|
|
@ -11,10 +11,15 @@ Pinouts are for the 2.4" TFT FeatherWing or Breakout with a Feather M4 or M0.
|
||||||
import board
|
import board
|
||||||
import terminalio
|
import terminalio
|
||||||
import displayio
|
import displayio
|
||||||
import fourwire
|
|
||||||
from adafruit_display_text import label
|
from adafruit_display_text import label
|
||||||
import adafruit_ili9341
|
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
|
# Release any resources currently in use for the displays
|
||||||
displayio.release_displays()
|
displayio.release_displays()
|
||||||
|
|
||||||
|
|
@ -22,7 +27,7 @@ spi = board.SPI()
|
||||||
tft_cs = board.D9
|
tft_cs = board.D9
|
||||||
tft_dc = board.D10
|
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)
|
display = adafruit_ili9341.ILI9341(display_bus, width=320, height=240)
|
||||||
|
|
||||||
# Make the display context
|
# Make the display context
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue