Skip to content

Commit 1bae65c

Browse files
committed
Replace depreciated .show() & displayio changes
1 parent 3c2bf1e commit 1bae65c

5 files changed

+46
-12
lines changed

README.rst

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,20 @@ Usage Example
7171
import board
7272
import busio
7373
import displayio
74+
# Starting in CircuitPython 9.x, fourwire will be a seperate internal library
75+
# rather than a component of the displayio library
76+
try:
77+
from fourwire import FourWire
78+
except ImportError:
79+
from displayio import FourWire
7480
import adafruit_ssd1675
7581
7682
displayio.release_displays()
7783
7884
epd_cs = board.D9
7985
epd_dc = board.D10
8086
81-
display_bus = displayio.FourWire(board.SPI(), command=epd_dc, chip_select=epd_cs, baudrate=1000000)
87+
display_bus = FourWire(board.SPI(), command=epd_dc, chip_select=epd_cs, baudrate=1000000)
8288
time.sleep(1)
8389
8490
display = adafruit_ssd1675.SSD1675(display_bus, width=250, height=122, rotation=90)
@@ -96,7 +102,7 @@ Usage Example
96102
# t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
97103
g.append(t)
98104
99-
display.show(g)
105+
display.root_group = g
100106
101107
display.refresh()
102108

adafruit_ssd1675.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,15 @@
2626
2727
"""
2828

29-
import displayio
29+
# Starting in CircuitPython 9.x fourwire & EPaperDisplay will be seperate internal
30+
# libraries rather than components of the displayio library
31+
try:
32+
from fourwire import FourWire
33+
from epaperdisplay import EPaperDisplay
34+
except ImportError:
35+
from displayio import FourWire
36+
from displayio import EPaperDisplay
37+
3038

3139
__version__ = "0.0.0+auto.0"
3240
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_SSD1675.git"
@@ -53,10 +61,10 @@
5361

5462

5563
# pylint: disable=too-few-public-methods
56-
class SSD1675(displayio.EPaperDisplay):
64+
class SSD1675(EPaperDisplay):
5765
"""SSD1675 driver"""
5866

59-
def __init__(self, bus: displayio.FourWire, **kwargs) -> None:
67+
def __init__(self, bus: FourWire, **kwargs) -> None:
6068
stop_sequence = _STOP_SEQUENCE
6169
try:
6270
bus.reset()

examples/ssd1675_2.13_monochrome.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@
1212
import board
1313
import displayio
1414
import adafruit_ssd1675
15+
# Starting in CircuitPython 9.x fourwire will be a seperate internal library
16+
# rather than a component of the displayio library
17+
try:
18+
from fourwire import FourWire
19+
except ImportError:
20+
from displayio import FourWire
21+
22+
1523

1624
displayio.release_displays()
1725

@@ -22,7 +30,7 @@
2230
epd_reset = board.D5
2331
epd_busy = board.D6
2432

25-
display_bus = displayio.FourWire(
33+
display_bus = FourWire(
2634
spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000
2735
)
2836
time.sleep(1)
@@ -43,8 +51,8 @@
4351
# t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
4452
g.append(t)
4553

46-
display.show(g)
47-
54+
display.root_group = g
55+
4856
display.refresh()
4957

5058
print("refreshed")

examples/ssd1675_four_corners.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@
1515
import displayio
1616
import terminalio
1717
import adafruit_ssd1675
18+
# Starting in CircuitPython 9.x fourwire will be a seperate internal library
19+
# rather than a component of the displayio library
20+
try:
21+
from fourwire import FourWire
22+
except ImportError:
23+
from displayio import FourWire
1824

1925
displayio.release_displays()
2026

@@ -27,7 +33,7 @@
2733
epd_reset = board.EPD_RESET
2834
epd_busy = board.EPD_BUSY
2935

30-
display_bus = displayio.FourWire(
36+
display_bus = FourWire(
3137
spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000
3238
)
3339
display = adafruit_ssd1675.SSD1675(
@@ -41,7 +47,7 @@
4147

4248
# Make the display context
4349
main_group = displayio.Group()
44-
display.show(main_group)
50+
display.root_group = main_group
4551

4652
palette = displayio.Palette(2)
4753
palette[0] = 0x000000

examples/ssd1675_simpletest.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,19 @@
1212
import board
1313
import displayio
1414
import adafruit_ssd1675
15+
# Starting in CircuitPython 9.x fourwire will be a seperate internal library
16+
# rather than a component of the displayio library
17+
try:
18+
from fourwire import FourWire
19+
except ImportError:
20+
from displayio import FourWire
1521

1622
displayio.release_displays()
1723

1824
epd_cs = board.D9
1925
epd_dc = board.D10
2026

21-
display_bus = displayio.FourWire(
27+
display_bus = FourWire(
2228
board.SPI(), command=epd_dc, chip_select=epd_cs, baudrate=1000000
2329
)
2430
time.sleep(1)
@@ -37,7 +43,7 @@
3743
# t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
3844
g.append(t)
3945

40-
display.show(g)
46+
display.root_group = g
4147

4248
display.refresh()
4349

0 commit comments

Comments
 (0)