Skip to content
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

Add I2C bus support #19

Merged
merged 2 commits into from
Jul 24, 2024
Merged
Changes from 1 commit
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
7 changes: 5 additions & 2 deletions adafruit_displayio_sh1106.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,13 @@

# Support both 8.x.x and 9.x.x. Change when 8.x.x is discontinued as a stable release.
try:
from fourwire import FourWire
from typing import Union
from busdisplay import BusDisplay
from fourwire import FourWire
from i2cdisplaybus import I2CDisplayBus
except ImportError:
from displayio import FourWire
from displayio import I2CDisplay as I2CDisplayBus
from displayio import Display as BusDisplay
tannewt marked this conversation as resolved.
Show resolved Hide resolved

__version__ = "0.0.0+auto.0"
Expand Down Expand Up @@ -67,7 +70,7 @@ class SH1106(BusDisplay):
:param int rotation: The rotation of the display. 0, 90, 180 or 270.
"""

def __init__(self, bus: FourWire, **kwargs) -> None:
def __init__(self, bus: Union[FourWire, I2CDisplayBus], **kwargs) -> None:
init_sequence = bytearray(_INIT_SEQUENCE)
super().__init__(
bus,
Expand Down
Loading