Skip to content

Commit e674d6e

Browse files
authored
Merge pull request #19 from EAGrahamJr/issue-16
Add I2C bus support
2 parents b8a89e9 + c019258 commit e674d6e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

adafruit_displayio_sh1106.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,18 @@
2424
"""
2525

2626
# Support both 8.x.x and 9.x.x. Change when 8.x.x is discontinued as a stable release.
27+
try:
28+
from typing import Union
29+
except ImportError:
30+
pass
31+
2732
try:
2833
from fourwire import FourWire
2934
from busdisplay import BusDisplay
35+
from i2cdisplaybus import I2CDisplayBus
3036
except ImportError:
3137
from displayio import FourWire
38+
from displayio import I2CDisplay as I2CDisplayBus
3239
from displayio import Display as BusDisplay
3340

3441
__version__ = "0.0.0+auto.0"
@@ -67,7 +74,7 @@ class SH1106(BusDisplay):
6774
:param int rotation: The rotation of the display. 0, 90, 180 or 270.
6875
"""
6976

70-
def __init__(self, bus: FourWire, **kwargs) -> None:
77+
def __init__(self, bus: Union[FourWire, I2CDisplayBus], **kwargs) -> None:
7178
init_sequence = bytearray(_INIT_SEQUENCE)
7279
super().__init__(
7380
bus,

0 commit comments

Comments
 (0)