Skip to content

Commit c64cf89

Browse files
authored
Merge pull request #14 from tcfranks/main
Add Missing Type Annotations
2 parents ef3c5e5 + 785a0a2 commit c64cf89

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

adafruit_displayio_sh1107.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@
3030
import displayio
3131
from micropython import const
3232

33+
try:
34+
from typing import Union
35+
except ImportError:
36+
pass
37+
3338
__version__ = "0.0.0+auto.0"
3439
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_DisplayIO_SH1107.git"
3540

@@ -141,11 +146,11 @@ class SH1107(displayio.Display):
141146

142147
def __init__(
143148
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,
147152
**kwargs
148-
):
153+
) -> None:
149154
rotation = (rotation + _ROTATION_OFFSET) % 360
150155
if rotation in (0, 180):
151156
multiplex = kwargs["width"] - 1
@@ -174,7 +179,7 @@ def __init__(
174179
self._is_awake = True # Display starts in active state (_INIT_SEQUENCE)
175180

176181
@property
177-
def is_awake(self):
182+
def is_awake(self) -> bool:
178183
"""
179184
The power state of the display. (read-only)
180185
@@ -184,7 +189,7 @@ def is_awake(self):
184189
"""
185190
return self._is_awake
186191

187-
def sleep(self):
192+
def sleep(self) -> None:
188193
"""
189194
Put display into sleep mode. The display uses < 5uA in sleep mode
190195
@@ -199,7 +204,7 @@ def sleep(self):
199204
self.bus.send(0xAE, b"") # 0xAE = display off, sleep mode
200205
self._is_awake = False
201206

202-
def wake(self):
207+
def wake(self) -> None:
203208
"""
204209
Wake display from sleep mode
205210
"""

0 commit comments

Comments
 (0)