Skip to content

Commit 30c3329

Browse files
authored
Merge pull request #18 from RetiredWizard/main
Replace depreciated .show() & displayio changes
2 parents c302ae0 + e5b00b3 commit 30c3329

File tree

3 files changed

+27
-9
lines changed

3 files changed

+27
-9
lines changed

README.rst

+8-2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ Usage Example
3737
3838
import board
3939
import displayio
40+
# Starting in CircuitPython 9.x fourwire will be a seperate internal library
41+
# rather than a component of the displayio library
42+
try:
43+
from fourwire import FourWire
44+
except ImportError:
45+
from displayio import FourWire
4046
import terminalio
4147
from adafruit_display_text import label
4248
from adafruit_ssd1331 import SSD1331
@@ -46,13 +52,13 @@ Usage Example
4652
tft_dc = board.D6
4753
4854
displayio.release_displays()
49-
display_bus = displayio.FourWire(spi, command=tft_dc, chip_select=tft_cs, reset=board.D9)
55+
display_bus = FourWire(spi, command=tft_dc, chip_select=tft_cs, reset=board.D9)
5056
5157
display = SSD1331(display_bus, width=96, height=64)
5258
5359
# Make the display context
5460
splash = displayio.Group()
55-
display.show(splash)
61+
display.root_group = splash
5662
5763
color_bitmap = displayio.Bitmap(96, 64, 1)
5864
color_palette = displayio.Palette(1)

adafruit_ssd1331.py

+10-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,14 @@
2626
2727
"""
2828

29-
import displayio
29+
# Starting in CircuitPython 9.x fourwire will be a seperate internal library
30+
# rather than a component of the displayio library
31+
try:
32+
from fourwire import FourWire
33+
from busdisplay import BusDisplay
34+
except ImportError:
35+
from displayio import FourWire
36+
from displayio import Display as BusDisplay
3037

3138
__version__ = "0.0.0+auto.0"
3239
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_SSD1331.git"
@@ -56,10 +63,10 @@
5663

5764

5865
# pylint: disable=too-few-public-methods
59-
class SSD1331(displayio.Display):
66+
class SSD1331(BusDisplay):
6067
"""SSD1331 driver"""
6168

62-
def __init__(self, bus: displayio.FourWire, **kwargs) -> None:
69+
def __init__(self, bus: FourWire, **kwargs) -> None:
6370
super().__init__(
6471
bus,
6572
_INIT_SEQUENCE,

examples/ssd1331_simpletest.py

+9-4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@
99
import board
1010
import terminalio
1111
import displayio
12+
13+
# Starting in CircuitPython 9.x fourwire will be a seperate internal library
14+
# rather than a component of the displayio library
15+
try:
16+
from fourwire import FourWire
17+
except ImportError:
18+
from displayio import FourWire
1219
from adafruit_display_text import label
1320
from adafruit_ssd1331 import SSD1331
1421

@@ -19,15 +26,13 @@
1926
tft_cs = board.D5
2027
tft_dc = board.D6
2128

22-
display_bus = displayio.FourWire(
23-
spi, command=tft_dc, chip_select=tft_cs, reset=board.D9
24-
)
29+
display_bus = FourWire(spi, command=tft_dc, chip_select=tft_cs, reset=board.D9)
2530

2631
display = SSD1331(display_bus, width=96, height=64)
2732

2833
# Make the display context
2934
splash = displayio.Group()
30-
display.show(splash)
35+
display.root_group = splash
3136

3237
color_bitmap = displayio.Bitmap(96, 64, 1)
3338
color_palette = displayio.Palette(1)

0 commit comments

Comments
 (0)