Skip to content

Commit 95758b3

Browse files
committed
Added changes requested by @FoamyGuy.
1 parent 2513226 commit 95758b3

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

adafruit_epd/epd.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,23 @@
1111

1212
import time
1313
from micropython import const
14-
from digitalio import Direction, DigitalInOut
1514
from adafruit_epd import mcp_sram
1615

1716
try:
1817
"""Needed for type annotations"""
19-
from typing import Any, Union, Callable
18+
from typing import Any, Union, Callable, Optional
2019
from busio import SPI
20+
from digitalio import Direction, DigitalInOut
2121
from PIL.Image import Image
22+
2223
except ImportError:
2324
pass
2425

2526
__version__ = "0.0.0+auto.0"
2627
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_EPD.git"
2728

2829

29-
class Adafruit_EPD: # pylint: disable=too-many-instance-attributes, too-many-public-methods
30+
class Adafruit_EPD: # pylint: disable=too-many-instance-attributes, too-many-public-methods, too-many-arguments
3031
"""Base class for EPD displays"""
3132

3233
BLACK = const(0)
@@ -173,7 +174,9 @@ def hardware_reset(self) -> None:
173174
self._rst.value = True
174175
time.sleep(0.1)
175176

176-
def command(self, cmd: Any, data: Any = None, end: bool = True) -> Any:
177+
def command(
178+
self, cmd: int, data: Optional[bytearray] = None, end: bool = True
179+
) -> int:
177180
"""Send command byte to display."""
178181
self._cs.value = True
179182
self._dc.value = False
@@ -192,7 +195,7 @@ def command(self, cmd: Any, data: Any = None, end: bool = True) -> Any:
192195

193196
return ret
194197

195-
def _spi_transfer(self, data: Any) -> Any:
198+
def _spi_transfer(self, data: Union[int, bytearray]) -> int:
196199
"""Transfer one byte or bytearray, toggling the cs pin if required by the EPD chipset"""
197200
if isinstance(data, int): # single byte!
198201
self._spibuf[0] = data

0 commit comments

Comments
 (0)