File tree 2 files changed +18
-7
lines changed
2 files changed +18
-7
lines changed Original file line number Diff line number Diff line change 23
23
24
24
"""
25
25
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
28
33
29
34
__version__ = "0.0.0+auto.0"
30
35
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_DisplayIO_SH1106.git"
52
57
)
53
58
54
59
55
- class SH1106 (displayio . Display ):
60
+ class SH1106 (BusDisplay ):
56
61
"""
57
- SH1106 driver for use with DisplayIO
62
+ SH1106 driver for use with displayio
58
63
59
64
:param bus: The bus that the display is connected to.
60
65
:param int width: The width of the display. Maximum of 132
61
66
:param int height: The height of the display. Maximum of 64
62
67
:param int rotation: The rotation of the display. 0, 90, 180 or 270.
63
68
"""
64
69
65
- def __init__ (self , bus : displayio . FourWire , ** kwargs ) -> None :
70
+ def __init__ (self , bus : FourWire , ** kwargs ) -> None :
66
71
init_sequence = bytearray (_INIT_SEQUENCE )
67
72
super ().__init__ (
68
73
bus ,
Original file line number Diff line number Diff line change 6
6
import board
7
7
import busio
8
8
import displayio
9
- import fourwire
10
9
import terminalio
11
10
from adafruit_display_text import label
12
11
import adafruit_displayio_sh1106
13
12
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
+
14
20
displayio .release_displays ()
15
21
16
22
spi = busio .SPI (board .SCK , board .MOSI )
17
- display_bus = fourwire . FourWire (
23
+ display_bus = FourWire (
18
24
spi ,
19
25
command = board .OLED_DC ,
20
26
chip_select = board .OLED_CS ,
You can’t perform that action at this time.
0 commit comments