Skip to content

Update to CPy 9 display modules #27

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions adafruit_ssd1327.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,15 @@

"""

import displayio
from busdisplay import BusDisplay

try:
from typing import Union

from fourwire import FourWire
from i2cdisplaybus import I2CDisplayBus
except ImportError:
pass

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


class SSD1327(displayio.Display):
class SSD1327(BusDisplay):
"""SSD1327 driver

:param ~displayio.I2CDisplay bus: The data bus the display is on
:param bus: The data bus the display is on
:param int height: (keyword-only) The height of the screen
:param int width: (keyword-only) The width of the screen
:param int rotation: (keyword-only) The rotation/orientation of the
screen, in degrees
"""

def __init__(self, bus: displayio.I2CDisplay, **kwargs) -> None:
def __init__(self, bus: Union[FourWire, I2CDisplayBus], **kwargs) -> None:
# Patch the init sequence for 32 pixel high displays.
init_sequence = bytearray(_INIT_SEQUENCE)
height = kwargs["height"]
Expand Down
6 changes: 4 additions & 2 deletions examples/ssd1327_gamma.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

import board
import displayio
from fourwire import FourWire
from i2cdisplaybus import I2CDisplayBus

import adafruit_ssd1327

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

# Use for SPI
# spi = board.SPI()
# oled_cs = board.D5
# oled_dc = board.D6
# display_bus = displayio.FourWire(
# display_bus = FourWire(
# spi, command=oled_dc, chip_select=oled_cs, baudrate=1000000, reset=board.D9
# )

Expand Down
6 changes: 4 additions & 2 deletions examples/ssd1327_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import displayio
import terminalio
from adafruit_display_text import label
from fourwire import FourWire
from i2cdisplaybus import I2CDisplayBus

import adafruit_ssd1327

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

# Use for SPI
# spi = board.SPI()
# oled_cs = board.D5
# oled_dc = board.D6
# display_bus = displayio.FourWire(
# display_bus = FourWire(
# spi, command=oled_dc, chip_select=oled_cs, baudrate=1000000, reset=board.D9
# )

Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
# SPDX-License-Identifier: Unlicense

Adafruit-Blinka
Adafruit-Blinka-Displayio