Skip to content

Commit

Permalink
Merge pull request #14 from tcfranks/main
Browse files Browse the repository at this point in the history
Add Missing Type Annotations
  • Loading branch information
tekktrik authored Sep 4, 2022
2 parents ef3c5e5 + 785a0a2 commit c64cf89
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions adafruit_displayio_sh1107.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
import displayio
from micropython import const

try:
from typing import Union
except ImportError:
pass

__version__ = "0.0.0+auto.0"
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_DisplayIO_SH1107.git"

Expand Down Expand Up @@ -141,11 +146,11 @@ class SH1107(displayio.Display):

def __init__(
self,
bus,
display_offset=DISPLAY_OFFSET_ADAFRUIT_FEATHERWING_OLED_4650,
rotation=0,
bus: Union[displayio.I2CDisplay, displayio.FourWire],
display_offset: int = DISPLAY_OFFSET_ADAFRUIT_FEATHERWING_OLED_4650,
rotation: int = 0,
**kwargs
):
) -> None:
rotation = (rotation + _ROTATION_OFFSET) % 360
if rotation in (0, 180):
multiplex = kwargs["width"] - 1
Expand Down Expand Up @@ -174,7 +179,7 @@ def __init__(
self._is_awake = True # Display starts in active state (_INIT_SEQUENCE)

@property
def is_awake(self):
def is_awake(self) -> bool:
"""
The power state of the display. (read-only)
Expand All @@ -184,7 +189,7 @@ def is_awake(self):
"""
return self._is_awake

def sleep(self):
def sleep(self) -> None:
"""
Put display into sleep mode. The display uses < 5uA in sleep mode
Expand All @@ -199,7 +204,7 @@ def sleep(self):
self.bus.send(0xAE, b"") # 0xAE = display off, sleep mode
self._is_awake = False

def wake(self):
def wake(self) -> None:
"""
Wake display from sleep mode
"""
Expand Down

0 comments on commit c64cf89

Please sign in to comment.