File tree Expand file tree Collapse file tree 2 files changed +18
-7
lines changed Expand file tree Collapse file tree 2 files changed +18
-7
lines changed Original file line number Diff line number Diff line change 2323
2424"""
2525
26- # imports
27- import displayio
26+ # Support both 8.x.x and 9.x.x. Change when 8.x.x is discontinued as a stable release.
27+ try :
28+ from fourwire import FourWire
29+ from busdisplay import BusDisplay
30+ except ImportError :
31+ from displayio import FourWire
32+ from displayio import Display as BusDisplay
2833
2934__version__ = "0.0.0+auto.0"
3035__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_DisplayIO_SH1106.git"
5257)
5358
5459
55- class SH1106 (displayio . Display ):
60+ class SH1106 (BusDisplay ):
5661 """
57- SH1106 driver for use with DisplayIO
62+ SH1106 driver for use with displayio
5863
5964 :param bus: The bus that the display is connected to.
6065 :param int width: The width of the display. Maximum of 132
6166 :param int height: The height of the display. Maximum of 64
6267 :param int rotation: The rotation of the display. 0, 90, 180 or 270.
6368 """
6469
65- def __init__ (self , bus : displayio . FourWire , ** kwargs ) -> None :
70+ def __init__ (self , bus : FourWire , ** kwargs ) -> None :
6671 init_sequence = bytearray (_INIT_SEQUENCE )
6772 super ().__init__ (
6873 bus ,
Original file line number Diff line number Diff line change 66import board
77import busio
88import displayio
9- import fourwire
109import terminalio
1110from adafruit_display_text import label
1211import adafruit_displayio_sh1106
1312
13+ # Compatibility with both CircuitPython 8.x.x and 9.x.x.
14+ # Remove after 8.x.x is no longer a supported release.
15+ try :
16+ from fourwire import FourWire
17+ except ImportError :
18+ from displayio import FourWire
19+
1420displayio .release_displays ()
1521
1622spi = busio .SPI (board .SCK , board .MOSI )
17- display_bus = fourwire . FourWire (
23+ display_bus = FourWire (
1824 spi ,
1925 command = board .OLED_DC ,
2026 chip_select = board .OLED_CS ,
You can’t perform that action at this time.
0 commit comments