From 9378b507ae459b2b74e9212196ff782a7889a49e Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 18 Dec 2023 09:48:47 -0500 Subject: [PATCH] FourWire support for 8.x.x and 9.x.x --- examples/ssd1681_four_corners.py | 11 +++++++++-- examples/ssd1681_simpletest.py | 10 ++++++++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/examples/ssd1681_four_corners.py b/examples/ssd1681_four_corners.py index e27be6e..d5f7c1f 100644 --- a/examples/ssd1681_four_corners.py +++ b/examples/ssd1681_four_corners.py @@ -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 @@ -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( diff --git a/examples/ssd1681_simpletest.py b/examples/ssd1681_simpletest.py index b531e3d..49b0391 100644 --- a/examples/ssd1681_simpletest.py +++ b/examples/ssd1681_simpletest.py @@ -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. @@ -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)