Skip to content

Commit 00f211b

Browse files
authored
Merge pull request #27 from adafruit/update-display-modules
Update to CPy 9 display modules
2 parents 84e1345 + fc1717a commit 00f211b

File tree

4 files changed

+21
-8
lines changed

4 files changed

+21
-8
lines changed

adafruit_ssd1327.py

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

29-
import displayio
29+
from busdisplay import BusDisplay
30+
31+
try:
32+
from typing import Union
33+
34+
from fourwire import FourWire
35+
from i2cdisplaybus import I2CDisplayBus
36+
except ImportError:
37+
pass
3038

3139
__version__ = "0.0.0+auto.0"
3240
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_SSD1327.git"
@@ -52,17 +60,17 @@
5260
)
5361

5462

55-
class SSD1327(displayio.Display):
63+
class SSD1327(BusDisplay):
5664
"""SSD1327 driver
5765
58-
:param ~displayio.I2CDisplay bus: The data bus the display is on
66+
:param bus: The data bus the display is on
5967
:param int height: (keyword-only) The height of the screen
6068
:param int width: (keyword-only) The width of the screen
6169
:param int rotation: (keyword-only) The rotation/orientation of the
6270
screen, in degrees
6371
"""
6472

65-
def __init__(self, bus: displayio.I2CDisplay, **kwargs) -> None:
73+
def __init__(self, bus: Union[FourWire, I2CDisplayBus], **kwargs) -> None:
6674
# Patch the init sequence for 32 pixel high displays.
6775
init_sequence = bytearray(_INIT_SEQUENCE)
6876
height = kwargs["height"]

examples/ssd1327_gamma.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
import board
77
import displayio
8+
from fourwire import FourWire
9+
from i2cdisplaybus import I2CDisplayBus
810

911
import adafruit_ssd1327
1012

@@ -13,13 +15,13 @@
1315
# Use for I2C
1416
i2c = board.I2C() # uses board.SCL and board.SDA
1517
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
16-
display_bus = displayio.I2CDisplay(i2c, device_address=0x3D)
18+
display_bus = I2CDisplayBus(i2c, device_address=0x3D)
1719

1820
# Use for SPI
1921
# spi = board.SPI()
2022
# oled_cs = board.D5
2123
# oled_dc = board.D6
22-
# display_bus = displayio.FourWire(
24+
# display_bus = FourWire(
2325
# spi, command=oled_dc, chip_select=oled_cs, baudrate=1000000, reset=board.D9
2426
# )
2527

examples/ssd1327_simpletest.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import displayio
66
import terminalio
77
from adafruit_display_text import label
8+
from fourwire import FourWire
9+
from i2cdisplaybus import I2CDisplayBus
810

911
import adafruit_ssd1327
1012

@@ -13,13 +15,13 @@
1315
# Use for I2C
1416
i2c = board.I2C() # uses board.SCL and board.SDA
1517
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
16-
display_bus = displayio.I2CDisplay(i2c, device_address=0x3D)
18+
display_bus = I2CDisplayBus(i2c, device_address=0x3D)
1719

1820
# Use for SPI
1921
# spi = board.SPI()
2022
# oled_cs = board.D5
2123
# oled_dc = board.D6
22-
# display_bus = displayio.FourWire(
24+
# display_bus = FourWire(
2325
# spi, command=oled_dc, chip_select=oled_cs, baudrate=1000000, reset=board.D9
2426
# )
2527

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
# SPDX-License-Identifier: Unlicense
44

55
Adafruit-Blinka
6+
Adafruit-Blinka-Displayio

0 commit comments

Comments
 (0)