|
22 | 22 | import adafruit_framebuf as framebuf |
23 | 23 |
|
24 | 24 | try: |
25 | | - from typing import Any, Optional |
| 25 | + # Used only for typing |
| 26 | + from typing import Optional |
| 27 | + import busio |
| 28 | + import digitalio |
26 | 29 | except ImportError: |
27 | 30 | pass |
28 | 31 |
|
@@ -61,7 +64,7 @@ def __init__( |
61 | 64 | height: int, |
62 | 65 | *, |
63 | 66 | external_vcc: bool, |
64 | | - reset: Any, |
| 67 | + reset: Optional[digitalio.DigitalInOut], |
65 | 68 | page_addressing: bool |
66 | 69 | ): |
67 | 70 | super().__init__(buffer, width, height) |
@@ -175,7 +178,7 @@ def write_framebuf(self) -> None: |
175 | 178 | """Derived class must implement this""" |
176 | 179 | raise NotImplementedError |
177 | 180 |
|
178 | | - def write_cmd(self, cmd: Any) -> None: |
| 181 | + def write_cmd(self, cmd: int) -> None: |
179 | 182 | """Derived class must implement this""" |
180 | 183 | raise NotImplementedError |
181 | 184 |
|
@@ -226,11 +229,11 @@ def __init__( |
226 | 229 | self, |
227 | 230 | width: int, |
228 | 231 | height: int, |
229 | | - i2c: Any, |
| 232 | + i2c: busio.I2C, |
230 | 233 | *, |
231 | 234 | addr: int = 0x3C, |
232 | 235 | external_vcc: bool = False, |
233 | | - reset: Any = None, |
| 236 | + reset: Optional[digitalio.DigitalInOut] = None, |
234 | 237 | page_addressing: bool = False |
235 | 238 | ): |
236 | 239 | self.i2c_device = i2c_device.I2CDevice(i2c, addr) |
@@ -297,10 +300,10 @@ def __init__( |
297 | 300 | self, |
298 | 301 | width: int, |
299 | 302 | height: int, |
300 | | - spi: Any, |
301 | | - dc: Any, |
302 | | - reset: bool, |
303 | | - cs: int, |
| 303 | + spi: busio.SPI, |
| 304 | + dc: digitalio.DigitalInOut, |
| 305 | + reset: Optional[digitalio.DigitalInOut], |
| 306 | + cs: digitalio.DigitalInOut, |
304 | 307 | *, |
305 | 308 | external_vcc: bool = False, |
306 | 309 | baudrate: int = 8000000, |
|
0 commit comments