Skip to content

Commit 809b5dd

Browse files
committed
Run pre-commit
1 parent 612957e commit 809b5dd

File tree

8 files changed

+4
-27
lines changed

8 files changed

+4
-27
lines changed

adafruit_boardtest/boardtest_gpio.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
FAIL = "FAIL"
4848
NA = "N/A"
4949

50+
5051
# Determine if given value is a number
5152
def _is_number(val: Any) -> bool:
5253
try:
@@ -64,7 +65,6 @@ def _deinit_pins(gpios: Sequence[digitalio.DigitalInOut]) -> None:
6465

6566
# Toggle IO pins while waiting for answer
6667
def _toggle_wait(gpios: Sequence[digitalio.DigitalInOut]) -> bool:
67-
6868
timestamp = time.monotonic()
6969
led_state = False
7070
print("Are the pins listed above toggling? [y/n]")
@@ -85,7 +85,6 @@ def _toggle_wait(gpios: Sequence[digitalio.DigitalInOut]) -> bool:
8585

8686

8787
def run_test(pins: Sequence[str]) -> Tuple[str, List[str]]:
88-
8988
"""
9089
Toggles all available GPIO on and off repeatedly.
9190
@@ -102,7 +101,6 @@ def run_test(pins: Sequence[str]) -> Tuple[str, List[str]]:
102101
# Toggle LEDs if we find any
103102
gpio_pins = analog_pins + digital_pins
104103
if gpio_pins:
105-
106104
# Create a list of IO objects for us to toggle
107105
gpios = [digitalio.DigitalInOut(getattr(board, p)) for p in gpio_pins]
108106

adafruit_boardtest/boardtest_i2c.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@
5555
FAIL = "FAIL"
5656
NA = "N/A"
5757

58+
5859
# Open comms to I2C EEPROM by trying a write to memory address
5960
def _eeprom_i2c_wait(
6061
i2c: busio.I2C, i2c_addr: int, mem_addr: int, timeout: float = 1.0
6162
) -> bool:
62-
6363
# Try to access the I2C EEPROM (it becomes unresonsive during a write)
6464
timestamp = time.monotonic()
6565
while time.monotonic() < timestamp + timeout:
@@ -76,7 +76,6 @@ def _eeprom_i2c_wait(
7676
def _eeprom_i2c_write_byte(
7777
i2c: busio.I2C, i2c_addr: int, mem_addr: int, mem_data: int
7878
) -> bool:
79-
8079
# Make sure address is only one byte:
8180
if mem_addr > 255:
8281
return False
@@ -98,7 +97,6 @@ def _eeprom_i2c_write_byte(
9897
def _eeprom_i2c_read_byte(
9998
i2c: busio.I2C, i2c_addr: int, mem_addr: int, timeout: float = 1.0
10099
) -> Tuple[bool, bytearray]:
101-
102100
# Make sure address is only one byte:
103101
if mem_addr > 255:
104102
return False, bytearray()
@@ -117,7 +115,6 @@ def _eeprom_i2c_read_byte(
117115
def run_test(
118116
pins: Sequence[str], sda_pin: str = SDA_PIN_NAME, scl_pin: str = SCL_PIN_NAME
119117
) -> Tuple[str, List[str]]:
120-
121118
"""
122119
Performs random writes and reads to I2C EEPROM.
123120
@@ -129,7 +126,6 @@ def run_test(
129126

130127
# Write values to I2C EEPROM and verify the values match
131128
if list(set(pins).intersection(set([sda_pin, scl_pin]))):
132-
133129
# Tell user to connect EEPROM chip
134130
print(
135131
"Connect a Microchip AT24HC04B EEPROM I2C chip. "
@@ -147,7 +143,6 @@ def run_test(
147143
# Pick a random address, write to it, read from it, and see if they match
148144
pass_test = True
149145
for _ in range(NUM_I2C_TESTS):
150-
151146
# Randomly pick an address and a data value (one byte)
152147
mem_addr = random.randint(0, EEPROM_I2C_MAX_ADDR)
153148
mem_data = random.randint(0, 255)

adafruit_boardtest/boardtest_led.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@
4646
FAIL = "FAIL"
4747
NA = "N/A"
4848

49+
4950
# Toggle IO pins while waiting for answer
5051
def _toggle_wait(led_pins: Sequence[str]) -> bool:
5152
timestamp = time.monotonic()
5253
led_state = False
5354
print("Are the pins listed above toggling? [y/n]")
5455
while True:
55-
5656
# Cycle through each pin in the list
5757
for pin in led_pins:
5858
led = digitalio.DigitalInOut(getattr(board, pin))
@@ -83,7 +83,6 @@ def _toggle_wait(led_pins: Sequence[str]) -> bool:
8383

8484

8585
def run_test(pins: Sequence[str]) -> Tuple[str, List[str]]:
86-
8786
"""
8887
Toggles the onboard LED(s) on and off.
8988
@@ -96,7 +95,6 @@ def run_test(pins: Sequence[str]) -> Tuple[str, List[str]]:
9695

9796
# Toggle LEDs if we find any
9897
if led_pins:
99-
10098
# Print out the LEDs found
10199
print("LEDs found:", end=" ")
102100
for pin in led_pins:

adafruit_boardtest/boardtest_sd.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ def run_test( # pylint: disable=too-many-arguments,too-many-locals
7070
cs_pin: str = CS_PIN_NAME,
7171
filename: str = FILENAME,
7272
) -> Tuple[str, List[str]]:
73-
7473
"""
7574
Performs random writes and reads to file on attached SD card.
7675
@@ -85,7 +84,6 @@ def run_test( # pylint: disable=too-many-arguments,too-many-locals
8584

8685
# Write characters to file on SD card and verify they were written
8786
if list(set(pins).intersection(set([mosi_pin, miso_pin, sck_pin]))):
88-
8987
# Tell user to connect SD card
9088
print("Insert SD card into holder and connect SPI lines to holder.")
9189
print("Connect " + cs_pin + " to the CS (DAT3) pin on the SD " + "card holder.")

adafruit_boardtest/boardtest_sd_cd.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
def run_test(
5050
pins: Sequence[str], cd_pin: str = SD_CD_PIN_NAME
5151
) -> Tuple[str, List[str]]:
52-
5352
"""
5453
Checks status of CD pin as user inserts and removes SD card.
5554
@@ -60,7 +59,6 @@ def run_test(
6059

6160
# Ask user to insert and remove SD card
6261
if list(set(pins).intersection(set([cd_pin]))):
63-
6462
# Configure CD pin as input with pullup
6563
cdt = digitalio.DigitalInOut(getattr(board, cd_pin))
6664
cdt.direction = digitalio.Direction.INPUT

adafruit_boardtest/boardtest_spi.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,14 @@
6868
FAIL = "FAIL"
6969
NA = "N/A"
7070

71+
7172
# Wait for WIP bit to go low
7273
def _eeprom_spi_wait(
7374
spi: busio.SPI, csel: digitalio.DigitalInOut, timeout: float = 1.0
7475
) -> bool:
75-
7676
# Continually read from STATUS register
7777
timestamp = time.monotonic()
7878
while time.monotonic() < timestamp + timeout:
79-
8079
# Perfrom RDSR operation
8180
csel.value = False
8281
result = bytearray(1)
@@ -99,7 +98,6 @@ def _eeprom_spi_write_byte(
9998
data: int,
10099
timeout: float = 1.0,
101100
) -> bool:
102-
103101
# Make sure address is only one byte:
104102
if address > 255:
105103
return False
@@ -129,7 +127,6 @@ def _eeprom_spi_write_byte(
129127
def _eeprom_spi_read_byte(
130128
spi: busio.SPI, csel: digitalio.DigitalInOut, address: int, timeout: float = 1.0
131129
) -> Tuple[bool, bytearray]:
132-
133130
# Make sure address is only one byte:
134131
if address > 255:
135132
return False, bytearray()
@@ -155,7 +152,6 @@ def run_test(
155152
sck_pin: str = SCK_PIN_NAME,
156153
cs_pin: str = CS_PIN_NAME,
157154
) -> Tuple[str, List[str]]:
158-
159155
"""
160156
Performs random writes and reads to file on attached SD card.
161157
@@ -169,7 +165,6 @@ def run_test(
169165

170166
# Write values to SPI EEPROM and verify the values match
171167
if list(set(pins).intersection(set([mosi_pin, miso_pin, sck_pin]))):
172-
173168
# Tell user to connect EEPROM chip
174169
print("Connect a Microchip 25AA040A EEPROM SPI chip.")
175170
print("Connect " + cs_pin + " to the CS pin on the 25AA040.")
@@ -196,7 +191,6 @@ def run_test(
196191
# Pick a random address, write to it, read from it, and see if they match
197192
pass_test = True
198193
for _ in range(NUM_SPI_TESTS):
199-
200194
# Randomly pick an address and a data value (one byte)
201195
mem_addr = random.randint(0, EEPROM_SPI_MAX_ADDR)
202196
mem_data = random.randint(0, 255)

adafruit_boardtest/boardtest_uart.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ def run_test(
5757
rx_pin: str = RX_PIN_NAME,
5858
baud_rate: int = BAUD_RATE,
5959
) -> Tuple[str, List[str]]:
60-
6160
"""
6261
Performs random writes out of TX pin and reads on RX.
6362
@@ -70,7 +69,6 @@ def run_test(
7069

7170
# Echo some values over the UART
7271
if list(set(pins).intersection(set([tx_pin, rx_pin]))):
73-
7472
# Tell user to create loopback connection
7573
print("Connect a wire from TX to RX. Press enter to continue.")
7674
input()

adafruit_boardtest/boardtest_voltage_monitor.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151

5252

5353
def run_test(pins: Sequence[str]) -> Tuple[str, List[str]]:
54-
5554
"""
5655
Prints out voltage on the battery monitor or voltage monitor pin.
5756
@@ -64,7 +63,6 @@ def run_test(pins: Sequence[str]) -> Tuple[str, List[str]]:
6463

6564
# Print out voltage found on these pins
6665
if monitor_pins:
67-
6866
# Print out the monitor pins found
6967
print("Voltage monitor pins found:", end=" ")
7068
for pin in monitor_pins:

0 commit comments

Comments
 (0)