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

FourWire support for 8.x.x and 9.x.x #14

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
12 changes: 9 additions & 3 deletions adafruit_ssd1681.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@

"""

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 epaperdisplay import EPaperDisplay
except ImportError:
from displayio import FourWire
from displayio import EPaperDisplay

__version__ = "0.0.0+auto.0"
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_SSD1681.git"
Expand All @@ -45,7 +51,7 @@


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

:param bus: The data bus the display is on
Expand All @@ -61,7 +67,7 @@ class SSD1681(displayio.EPaperDisplay):
Display rotation
"""

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: 9 additions & 2 deletions examples/ssd1681_four_corners.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,17 @@
import board
import busio
import displayio
import fourwire
import terminalio
import adafruit_ssd1681

# 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


displayio.release_displays()

# This pinout works on a Feather RP2040 EPD and may need to be altered for other
Expand All @@ -28,7 +35,7 @@
epd_reset = board.EPD_RESET
epd_busy = board.EPD_BUSY

display_bus = fourwire.FourWire(
display_bus = FourWire(
spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000
)
display = adafruit_ssd1681.SSD1681(
Expand Down
10 changes: 8 additions & 2 deletions examples/ssd1681_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,15 @@
import time
import board
import displayio
import fourwire
import adafruit_ssd1681

# 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

displayio.release_displays()

# This pinout works on a Feather M4 and may need to be altered for other boards.
Expand All @@ -24,7 +30,7 @@
epd_reset = board.D5
epd_busy = board.D6

display_bus = fourwire.FourWire(
display_bus = FourWire(
spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000
)
time.sleep(1)
Expand Down