30
30
import displayio
31
31
from micropython import const
32
32
33
+ try :
34
+ from typing import Union
35
+ except ImportError :
36
+ pass
37
+
33
38
__version__ = "0.0.0+auto.0"
34
39
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_DisplayIO_SH1107.git"
35
40
@@ -141,11 +146,11 @@ class SH1107(displayio.Display):
141
146
142
147
def __init__ (
143
148
self ,
144
- bus ,
145
- display_offset = DISPLAY_OFFSET_ADAFRUIT_FEATHERWING_OLED_4650 ,
146
- rotation = 0 ,
149
+ bus : Union [ displayio . I2CDisplay , displayio . FourWire ] ,
150
+ display_offset : int = DISPLAY_OFFSET_ADAFRUIT_FEATHERWING_OLED_4650 ,
151
+ rotation : int = 0 ,
147
152
** kwargs
148
- ):
153
+ ) -> None :
149
154
rotation = (rotation + _ROTATION_OFFSET ) % 360
150
155
if rotation in (0 , 180 ):
151
156
multiplex = kwargs ["width" ] - 1
@@ -174,7 +179,7 @@ def __init__(
174
179
self ._is_awake = True # Display starts in active state (_INIT_SEQUENCE)
175
180
176
181
@property
177
- def is_awake (self ):
182
+ def is_awake (self ) -> bool :
178
183
"""
179
184
The power state of the display. (read-only)
180
185
@@ -184,7 +189,7 @@ def is_awake(self):
184
189
"""
185
190
return self ._is_awake
186
191
187
- def sleep (self ):
192
+ def sleep (self ) -> None :
188
193
"""
189
194
Put display into sleep mode. The display uses < 5uA in sleep mode
190
195
@@ -199,7 +204,7 @@ def sleep(self):
199
204
self .bus .send (0xAE , b"" ) # 0xAE = display off, sleep mode
200
205
self ._is_awake = False
201
206
202
- def wake (self ):
207
+ def wake (self ) -> None :
203
208
"""
204
209
Wake display from sleep mode
205
210
"""
0 commit comments