Skip to content

Commit

Permalink
support 8.x.x. and 9.x.x FourWire
Browse files Browse the repository at this point in the history
  • Loading branch information
dhalbert committed Dec 18, 2023
1 parent 8efd9f7 commit 2aa8c34
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 17 deletions.
12 changes: 9 additions & 3 deletions adafruit_ssd1680.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,13 @@
"""

import displayio
try:
from epaperdisplay import EPaperDisplay
from fourwire import FourWire
except ImportError:
from displayio import EPaperDisplay
from displayio import FourWire


__version__ = "0.0.0+auto.0"
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_SSD1680.git"
Expand All @@ -50,7 +56,7 @@


# pylint: disable=too-few-public-methods
class SSD1680(displayio.EPaperDisplay):
class SSD1680(EPaperDisplay):
r"""SSD1680 driver
:param bus: The data bus the display is on
Expand All @@ -66,7 +72,7 @@ class SSD1680(displayio.EPaperDisplay):
Display rotation
"""

def __init__(self, bus: displayio.FourWire, **kwargs) -> None:
def __init__(self, bus: FourWire, **kwargs) -> None:
if "colstart" not in kwargs:
kwargs["colstart"] = 8
stop_sequence = bytearray(_STOP_SEQUENCE)
Expand Down
11 changes: 7 additions & 4 deletions examples/ssd1680_2.13_featherwing.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,22 @@
import time
import board
import displayio
import fourwire
import adafruit_ssd1680

# For 8.x.x and 9.x.x. When 8.x.x is discontinued as a stable release, change this.
try:
from fourwire import FourWire
except ImportError:
from displayio import FourWire

displayio.release_displays()

# This pinout works on a Metro M4 and may need to be altered for other boards.
spi = board.SPI() # Uses SCK and MOSI
epd_cs = board.D9
epd_dc = board.D10

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

display = adafruit_ssd1680.SSD1680(
Expand Down
9 changes: 7 additions & 2 deletions examples/ssd1680_2.13_mono_eink_bonnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,14 @@
import time
import board
import displayio
import fourwire
import adafruit_ssd1680

# For 8.x.x and 9.x.x. When 8.x.x is discontinued as a stable release, change this.
try:
from fourwire import FourWire
except ImportError:
from displayio import FourWire

displayio.release_displays()

# This pinout works on a Metro M4 and may need to be altered for other boards.
Expand All @@ -30,7 +35,7 @@
epd_reset = board.D27 # Set to None for FeatherWing
epd_busy = board.D17 # Set to None for FeatherWing

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
11 changes: 7 additions & 4 deletions examples/ssd1680_2.13_tricolor_breakout.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,14 @@
import time
import board
import displayio
import fourwire
import adafruit_ssd1680

# For 8.x.x and 9.x.x. When 8.x.x is discontinued as a stable release, change this.
try:
from fourwire import FourWire
except ImportError:
from displayio import FourWire

displayio.release_displays()

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

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

display = adafruit_ssd1680.SSD1680(
Expand Down
9 changes: 7 additions & 2 deletions examples/ssd1680_four_corners.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,15 @@
import board
import busio
import displayio
import fourwire
import terminalio
import adafruit_ssd1680

# For 8.x.x and 9.x.x. When 8.x.x is discontinued as a stable release, change this.
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 +33,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_ssd1680.SSD1680(
Expand Down
9 changes: 7 additions & 2 deletions examples/ssd1680_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,14 @@
import time
import board
import displayio
import fourwire
import adafruit_ssd1680

# For 8.x.x and 9.x.x. When 8.x.x is discontinued as a stable release, change this.
try:
from fourwire import FourWire
except ImportError:
from displayio import FourWire

displayio.release_displays()

# This pinout works on a Metro M4 and may need to be altered for other boards.
Expand All @@ -30,7 +35,7 @@
epd_reset = board.D8 # Set to None for FeatherWing
epd_busy = board.D7 # Set to None for FeatherWing

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

0 comments on commit 2aa8c34

Please sign in to comment.