11
11
12
12
import time
13
13
from micropython import const
14
- from digitalio import Direction , DigitalInOut
15
14
from adafruit_epd import mcp_sram
16
15
17
16
try :
18
17
"""Needed for type annotations"""
19
- from typing import Any , Union , Callable
18
+ from typing import Any , Union , Callable , Optional
20
19
from busio import SPI
20
+ from digitalio import Direction , DigitalInOut
21
21
from PIL .Image import Image
22
+
22
23
except ImportError :
23
24
pass
24
25
25
26
__version__ = "0.0.0+auto.0"
26
27
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_EPD.git"
27
28
28
29
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
30
31
"""Base class for EPD displays"""
31
32
32
33
BLACK = const (0 )
@@ -173,7 +174,9 @@ def hardware_reset(self) -> None:
173
174
self ._rst .value = True
174
175
time .sleep (0.1 )
175
176
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 :
177
180
"""Send command byte to display."""
178
181
self ._cs .value = True
179
182
self ._dc .value = False
@@ -192,7 +195,7 @@ def command(self, cmd: Any, data: Any = None, end: bool = True) -> Any:
192
195
193
196
return ret
194
197
195
- def _spi_transfer (self , data : Any ) -> Any :
198
+ def _spi_transfer (self , data : Union [ int , bytearray ] ) -> int :
196
199
"""Transfer one byte or bytearray, toggling the cs pin if required by the EPD chipset"""
197
200
if isinstance (data , int ): # single byte!
198
201
self ._spibuf [0 ] = data
0 commit comments