Skip to content

Add Missing Type Annotations #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 4, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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