Skip to content
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

9x compatibility #19

Merged
merged 2 commits into from Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 9 additions & 3 deletions adafruit_il91874.py
Expand Up @@ -25,7 +25,13 @@

"""

import displayio
# Compatibility with both CircuitPython 8.x.x and 9.x.x.
# Remove after 8.x.x is no longer a supported release.
try:
from epaperdisplay import EPaperDisplay
from fourwire import FourWire
except ImportError:
from displayio import EPaperDisplay, FourWire

__version__ = "0.0.0+auto.0"
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_IL91874.git"
Expand Down Expand Up @@ -67,10 +73,10 @@


# pylint: disable=too-few-public-methods
class IL91874(displayio.EPaperDisplay):
class IL91874(EPaperDisplay):
"""IL91874 display driver"""

def __init__(self, bus: displayio.FourWire, **kwargs) -> None:
def __init__(self, bus: FourWire, **kwargs) -> None:
start_sequence = bytearray(_START_SEQUENCE)

width = kwargs["width"]
Expand Down
11 changes: 10 additions & 1 deletion examples/il91874_simpletest.py
Expand Up @@ -14,6 +14,15 @@
import time
import board
import displayio

# Compatibility with both CircuitPython 8.x.x and 9.x.x.
# Remove after 8.x.x is no longer a supported release.
try:
from fourwire import FourWire
except ImportError:
# pylint: disable=ungrouped-imports
from displayio import FourWire

import adafruit_il91874

# Used to ensure the display is free in CircuitPython
Expand All @@ -27,7 +36,7 @@
epd_busy = board.D6

# Create the displayio connection to the display pins
display_bus = displayio.FourWire(
display_bus = FourWire(
spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000
)
time.sleep(1) # Wait a bit
Expand Down