Skip to content

Commit 5bf38f6

Browse files
authored
Merge pull request #6 from prcutler/root-group-fix
Update to use fourwire and root_group for CP 9 compatibility
2 parents eb751f2 + 3bf34cc commit 5bf38f6

File tree

4 files changed

+27
-8
lines changed

4 files changed

+27
-8
lines changed

README.rst

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,12 @@ Usage Example
107107
import displayio
108108
import adafruit_acep7in
109109
110+
# For 8.x.x and 9.x.x. When 8.x.x is discontinued as a stable release, change this.
111+
try:
112+
from fourwire import FourWire
113+
except ImportError:
114+
from displayio import FourWire
115+
110116
displayio.release_displays()
111117
112118
# This pinout works on a Feather RP2040 and may need to be altered for other boards.
@@ -116,7 +122,7 @@ Usage Example
116122
epd_reset = board.D11
117123
epd_busy = board.D12
118124
119-
display_bus = displayio.FourWire(
125+
display_bus = FourWire(
120126
spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000
121127
)
122128
@@ -133,7 +139,7 @@ Usage Example
133139
t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
134140
g.append(t)
135141
136-
display.show(g)
142+
display.root_group = g
137143
138144
display.refresh()
139145

adafruit_acep7in.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,13 @@
2121
2222
"""
2323

24-
import displayio
24+
# For 8.x.x and 9.x.x. When 8.x.x is discontinued as a stable release, change this.
25+
try:
26+
from fourwire import FourWire
27+
from epaperdisplay import EPaperDisplay
28+
except ImportError:
29+
from displayio import FourWire
30+
from displayio import EPaperDisplay
2531

2632
__version__ = "0.0.0+auto.0"
2733
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_ACeP7In.git"
@@ -53,7 +59,7 @@
5359

5460

5561
# pylint: disable=too-few-public-methods
56-
class ACeP7In(displayio.EPaperDisplay):
62+
class ACeP7In(EPaperDisplay):
5763
r"""Display driver for 7" ACeP epaper display. Driver IC name is unknown.
5864
5965
:param bus: The data bus the display is on
@@ -69,7 +75,7 @@ class ACeP7In(displayio.EPaperDisplay):
6975
Display rotation
7076
"""
7177

72-
def __init__(self, bus, **kwargs):
78+
def __init__(self, bus: FourWire, **kwargs):
7379
width = kwargs["width"]
7480
height = kwargs["height"]
7581
if "rotation" in kwargs and kwargs["rotation"] % 180 != 0:

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
# Uncomment the below if you use native CircuitPython modules such as
2828
# digitalio, micropython and busio. List the modules you use. Without it, the
2929
# autodoc module docs will fail to generate with a warning.
30-
# autodoc_mock_imports = ["digitalio", "busio"]
30+
autodoc_mock_imports = ["displayio"]
3131

3232
autodoc_preserve_defaults = True
3333

examples/acep7in_simpletest.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@
1313
import displayio
1414
import adafruit_acep7in
1515

16+
# For 8.x.x and 9.x.x. When 8.x.x is discontinued as a stable release, change this.
17+
try:
18+
from fourwire import FourWire
19+
except ImportError:
20+
from displayio import FourWire
21+
22+
1623
displayio.release_displays()
1724

1825
# This pinout works on a Feather RP2040 and may need to be altered for other boards.
@@ -22,7 +29,7 @@
2229
epd_reset = board.D11
2330
epd_busy = board.D12
2431

25-
display_bus = displayio.FourWire(
32+
display_bus = FourWire(
2633
spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000
2734
)
2835

@@ -39,7 +46,7 @@
3946
t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
4047
g.append(t)
4148

42-
display.show(g)
49+
display.root_group = g
4350

4451
display.refresh()
4552

0 commit comments

Comments
 (0)