Skip to content

Commit 4a8e3a8

Browse files
authored
Merge pull request #18 from RetiredWizard/main
Replace depreciated .show() & displayio changes
2 parents 3c2bf1e + 8c38e82 commit 4a8e3a8

5 files changed

+47
-11
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: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@
1313
import displayio
1414
import adafruit_ssd1675
1515

16+
# Starting in CircuitPython 9.x fourwire will be a seperate internal library
17+
# rather than a component of the displayio library
18+
try:
19+
from fourwire import FourWire
20+
except ImportError:
21+
from displayio import FourWire
22+
23+
1624
displayio.release_displays()
1725

1826
# This pinout works on a Feather M4 and may need to be altered for other boards.
@@ -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,7 +51,7 @@
4351
# t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
4452
g.append(t)
4553

46-
display.show(g)
54+
display.root_group = g
4755

4856
display.refresh()
4957

examples/ssd1675_four_corners.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@
1616
import terminalio
1717
import adafruit_ssd1675
1818

19+
# Starting in CircuitPython 9.x fourwire will be a seperate internal library
20+
# rather than a component of the displayio library
21+
try:
22+
from fourwire import FourWire
23+
except ImportError:
24+
from displayio import FourWire
25+
1926
displayio.release_displays()
2027

2128
# This pinout works on a Feather RP2040 EPD and may need to be altered for other
@@ -27,7 +34,7 @@
2734
epd_reset = board.EPD_RESET
2835
epd_busy = board.EPD_BUSY
2936

30-
display_bus = displayio.FourWire(
37+
display_bus = FourWire(
3138
spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000
3239
)
3340
display = adafruit_ssd1675.SSD1675(
@@ -41,7 +48,7 @@
4148

4249
# Make the display context
4350
main_group = displayio.Group()
44-
display.show(main_group)
51+
display.root_group = main_group
4552

4653
palette = displayio.Palette(2)
4754
palette[0] = 0x000000

examples/ssd1675_simpletest.py

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

16+
# Starting in CircuitPython 9.x fourwire will be a seperate internal library
17+
# rather than a component of the displayio library
18+
try:
19+
from fourwire import FourWire
20+
except ImportError:
21+
from displayio import FourWire
22+
1623
displayio.release_displays()
1724

1825
epd_cs = board.D9
1926
epd_dc = board.D10
2027

21-
display_bus = displayio.FourWire(
28+
display_bus = FourWire(
2229
board.SPI(), command=epd_dc, chip_select=epd_cs, baudrate=1000000
2330
)
2431
time.sleep(1)
@@ -37,7 +44,7 @@
3744
# t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
3845
g.append(t)
3946

40-
display.show(g)
47+
display.root_group = g
4148

4249
display.refresh()
4350

0 commit comments

Comments
 (0)