Skip to content

Commit a2d18bd

Browse files
committed
Add I2C bus support
Fixes adafruit#16 by adding the same constructs as found in SSD1306.
1 parent b8a89e9 commit a2d18bd

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

adafruit_displayio_sh1106.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,13 @@
2525

2626
# Support both 8.x.x and 9.x.x. Change when 8.x.x is discontinued as a stable release.
2727
try:
28-
from fourwire import FourWire
28+
from typing import Union
2929
from busdisplay import BusDisplay
30+
from fourwire import FourWire
31+
from i2cdisplaybus import I2CDisplayBus
3032
except ImportError:
3133
from displayio import FourWire
34+
from displayio import I2CDisplay as I2CDisplayBus
3235
from displayio import Display as BusDisplay
3336

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

70-
def __init__(self, bus: FourWire, **kwargs) -> None:
73+
def __init__(self, bus: Union[FourWire, I2CDisplayBus], **kwargs) -> None:
7174
init_sequence = bytearray(_INIT_SEQUENCE)
7275
super().__init__(
7376
bus,

0 commit comments

Comments
 (0)