28
28
import digitalio
29
29
import adafruit_bus_device .spi_device as spi_device
30
30
31
+ try :
32
+ import typing
33
+ from _typing import ReadableBuffer
34
+ from microcontroller import Pin
35
+ import busio
36
+ except ImportError :
37
+ pass
31
38
32
39
__version__ = "0.0.0-auto.0"
33
40
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_74HC595.git"
@@ -42,7 +49,7 @@ class DigitalInOut:
42
49
43
50
def __init__ (
44
51
self ,
45
- pin_number : "microcontroller. Pin" ,
52
+ pin_number : Pin ,
46
53
shift_register_74hc595 : "ShiftRegister74HC595" ,
47
54
):
48
55
"""Specify the pin number of the shift register (0...7) and
@@ -120,7 +127,7 @@ class ShiftRegister74HC595:
120
127
121
128
def __init__ (
122
129
self ,
123
- spi : " busio.I2C" ,
130
+ spi : busio .I2C ,
124
131
latch : digitalio .DigitalInOut ,
125
132
number_of_shift_registers : int = 1 ,
126
133
):
@@ -141,14 +148,14 @@ def gpio(self):
141
148
return self ._gpio
142
149
143
150
@gpio .setter
144
- def gpio (self , val : "_typing. ReadableBuffer" ):
151
+ def gpio (self , val : ReadableBuffer ):
145
152
self ._gpio = val
146
153
147
154
with self ._device as spi :
148
155
# pylint: disable=no-member
149
156
spi .write (self ._gpio )
150
157
151
- def get_pin (self , pin : int ) -> "microcontroller. Pin" :
158
+ def get_pin (self , pin : int ) -> Pin :
152
159
"""Convenience function to create an instance of the DigitalInOut class
153
160
pointing at the specified pin of this 74HC595 device .
154
161
"""
0 commit comments