3636import digitalio
3737import busio
3838
39+ try :
40+ from typing import Tuple , Sequence , List
41+ except ImportError :
42+ pass
43+
3944__version__ = "0.0.0-auto.0"
4045__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_BoardTest.git"
4146
6469NA = "N/A"
6570
6671# Wait for WIP bit to go low
67- def _eeprom_spi_wait (spi , csel , timeout = 1.0 ):
72+ def _eeprom_spi_wait (
73+ spi : busio .SPI , csel : digitalio .DigitalInOut , timeout : float = 1.0
74+ ) -> bool :
6875
6976 # Continually read from STATUS register
7077 timestamp = time .monotonic ()
@@ -85,7 +92,13 @@ def _eeprom_spi_wait(spi, csel, timeout=1.0):
8592
8693
8794# Write to address. Returns status (True for successful write, False otherwise)
88- def _eeprom_spi_write_byte (spi , csel , address , data , timeout = 1.0 ):
95+ def _eeprom_spi_write_byte (
96+ spi : busio .SPI ,
97+ csel : digitalio .DigitalInOut ,
98+ address : int ,
99+ data : int ,
100+ timeout : float = 1.0 ,
101+ ) -> bool :
89102
90103 # Make sure address is only one byte:
91104 if address > 255 :
@@ -113,7 +126,9 @@ def _eeprom_spi_write_byte(spi, csel, address, data, timeout=1.0):
113126
114127
115128# Read from address. Returns tuple [status, result]
116- def _eeprom_spi_read_byte (spi , csel , address , timeout = 1.0 ):
129+ def _eeprom_spi_read_byte (
130+ spi : busio .SPI , csel : digitalio .DigitalInOut , address : int , timeout : float = 1.0
131+ ) -> Tuple [bool , bytearray ]:
117132
118133 # Make sure address is only one byte:
119134 if address > 255 :
@@ -134,12 +149,12 @@ def _eeprom_spi_read_byte(spi, csel, address, timeout=1.0):
134149
135150
136151def run_test (
137- pins ,
138- mosi_pin = MOSI_PIN_NAME ,
139- miso_pin = MISO_PIN_NAME ,
140- sck_pin = SCK_PIN_NAME ,
141- cs_pin = CS_PIN_NAME ,
142- ):
152+ pins : Sequence [ str ] ,
153+ mosi_pin : str = MOSI_PIN_NAME ,
154+ miso_pin : str = MISO_PIN_NAME ,
155+ sck_pin : str = SCK_PIN_NAME ,
156+ cs_pin : str = CS_PIN_NAME ,
157+ ) -> Tuple [ str , List [ str ]] :
143158
144159 """
145160 Performs random writes and reads to file on attached SD card.
0 commit comments