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

support 8.x.x. and 9.x.x FourWire #12

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
13 changes: 10 additions & 3 deletions adafruit_uc8151d.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,14 @@

"""

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"
Expand Down Expand Up @@ -101,7 +108,7 @@


# 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
Expand All @@ -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
Expand Down
9 changes: 7 additions & 2 deletions examples/uc8151d_1.54_grayscale.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@
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
Expand All @@ -26,7 +31,7 @@
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
)

Expand Down
9 changes: 7 additions & 2 deletions examples/uc8151d_2.9_color.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,14 @@
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()

Expand All @@ -25,7 +30,7 @@
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
Expand Down
9 changes: 7 additions & 2 deletions examples/uc8151d_simpletest.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_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.
Expand All @@ -26,7 +31,7 @@
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)
Expand Down