Skip to content

9.x Compatibility changes #1

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 2 commits into from
Mar 25, 2024
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
13 changes: 10 additions & 3 deletions adafruit_ek79686.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,14 @@
"""

import math
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_EK79686.git"
Expand Down Expand Up @@ -54,10 +61,10 @@


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

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

width = 8 * math.ceil(kwargs["width"] / 8)
Expand Down
12 changes: 10 additions & 2 deletions examples/ek79686_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@
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:
from displayio import FourWire

import adafruit_ek79686

# Used to ensure the display is free in CircuitPython
Expand All @@ -28,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 Expand Up @@ -60,7 +68,7 @@
g.append(t)

# Place the display group on the screen (does not refresh)
display.show(g)
display.root_group = g

# Show the image on the display
display.refresh()
Expand Down