1111
1212import time
1313from micropython import const
14- from digitalio import Direction , DigitalInOut
1514from adafruit_epd import mcp_sram
1615
1716try :
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+
2223except 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