Merge pull request #12 from dhalbert/fourwire

support 8.x.x. and 9.x.x FourWire
This commit is contained in:
foamyguy 2023-12-18 14:17:49 -06:00 committed by GitHub
commit b9c8eedd7b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 31 additions and 9 deletions

View file

@ -26,7 +26,14 @@ Implementation Notes
"""
import displayio
# 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
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_UC8151D.git"
@ -101,7 +108,7 @@ _STOP_SEQUENCE = b"\x50\x01\xf7" b"\x07\x01\xA5" # CDI setting # Deep Sleep
# pylint: disable=too-few-public-methods
class UC8151D(displayio.EPaperDisplay):
class UC8151D(EPaperDisplay):
r"""UC8151D driver
:param bus: The data bus the display is on
@ -117,7 +124,7 @@ class UC8151D(displayio.EPaperDisplay):
Display rotation
"""
def __init__(self, bus: displayio.FourWire, **kwargs) -> None:
def __init__(self, bus: FourWire, **kwargs) -> None:
color_bits_inverted = kwargs.pop("color_bits_inverted", False)
write_color_ram_command = 0x10
write_black_ram_command = 0x13

View file

@ -13,9 +13,14 @@ import time
import board
import displayio
import busio
import fourwire
import adafruit_uc8151d
# 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()
# Pinout intended for use with a Raspberry Pi Pico
@ -26,7 +31,7 @@ cs = board.GP9
rst = board.GP12
busy = board.GP13
display_bus = fourwire.FourWire(
display_bus = FourWire(
busio.SPI(clk, si), command=dc, chip_select=cs, reset=rst, baudrate=1000000
)

View file

@ -10,9 +10,14 @@ Supported products:
import time
import board
import displayio
import fourwire
import adafruit_uc8151d
# 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
# Used to ensure the display is free in CircuitPython
displayio.release_displays()
@ -25,7 +30,7 @@ epd_reset = board.D5
epd_busy = board.D6
# Create the displayio connection to the display pins
display_bus = fourwire.FourWire(
display_bus = FourWire(
spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000
)
time.sleep(1) # Wait a bit

View file

@ -14,9 +14,14 @@ Supported products:
import time
import board
import displayio
import fourwire
import adafruit_uc8151d
# 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 M4 and may need to be altered for other boards.
@ -26,7 +31,7 @@ epd_dc = board.D10
epd_reset = board.D5
epd_busy = None
display_bus = fourwire.FourWire(
display_bus = FourWire(
spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000
)
time.sleep(1)