Skip to content

Commit

Permalink
Merge pull request #19 from EAGrahamJr/issue-16
Browse files Browse the repository at this point in the history
Add I2C bus support
  • Loading branch information
tannewt authored Jul 24, 2024
2 parents b8a89e9 + c019258 commit e674d6e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion adafruit_displayio_sh1106.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,18 @@
"""

# Support both 8.x.x and 9.x.x. Change when 8.x.x is discontinued as a stable release.
try:
from typing import Union
except ImportError:
pass

try:
from fourwire import FourWire
from busdisplay import BusDisplay
from i2cdisplaybus import I2CDisplayBus
except ImportError:
from displayio import FourWire
from displayio import I2CDisplay as I2CDisplayBus
from displayio import Display as BusDisplay

__version__ = "0.0.0+auto.0"
Expand Down Expand Up @@ -67,7 +74,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

0 comments on commit e674d6e

Please sign in to comment.