Skip to content

Commit

Permalink
Merge pull request #6 from prcutler/root-group-fix
Browse files Browse the repository at this point in the history
Update to use fourwire and root_group for CP 9 compatibility
  • Loading branch information
FoamyGuy authored Dec 18, 2023
2 parents eb751f2 + 3bf34cc commit 5bf38f6
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 8 deletions.
10 changes: 8 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ Usage Example
import displayio
import adafruit_acep7in
# 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 and may need to be altered for other boards.
Expand All @@ -116,7 +122,7 @@ Usage Example
epd_reset = board.D11
epd_busy = board.D12
display_bus = displayio.FourWire(
display_bus = FourWire(
spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000
)
Expand All @@ -133,7 +139,7 @@ Usage Example
t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
g.append(t)
display.show(g)
display.root_group = g
display.refresh()
Expand Down
12 changes: 9 additions & 3 deletions adafruit_acep7in.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,13 @@
"""

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_ACeP7In.git"
Expand Down Expand Up @@ -53,7 +59,7 @@


# pylint: disable=too-few-public-methods
class ACeP7In(displayio.EPaperDisplay):
class ACeP7In(EPaperDisplay):
r"""Display driver for 7" ACeP epaper display. Driver IC name is unknown.
:param bus: The data bus the display is on
Expand All @@ -69,7 +75,7 @@ class ACeP7In(displayio.EPaperDisplay):
Display rotation
"""

def __init__(self, bus, **kwargs):
def __init__(self, bus: FourWire, **kwargs):
width = kwargs["width"]
height = kwargs["height"]
if "rotation" in kwargs and kwargs["rotation"] % 180 != 0:
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
# Uncomment the below if you use native CircuitPython modules such as
# digitalio, micropython and busio. List the modules you use. Without it, the
# autodoc module docs will fail to generate with a warning.
# autodoc_mock_imports = ["digitalio", "busio"]
autodoc_mock_imports = ["displayio"]

autodoc_preserve_defaults = True

Expand Down
11 changes: 9 additions & 2 deletions examples/acep7in_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@
import displayio
import adafruit_acep7in

# 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 and may need to be altered for other boards.
Expand All @@ -22,7 +29,7 @@
epd_reset = board.D11
epd_busy = board.D12

display_bus = displayio.FourWire(
display_bus = FourWire(
spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000
)

Expand All @@ -39,7 +46,7 @@
t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
g.append(t)

display.show(g)
display.root_group = g

display.refresh()

Expand Down

0 comments on commit 5bf38f6

Please sign in to comment.