Skip to content

Commit 295cc18

Browse files
committed
style(swan_r5): pre-commit whitespace style changes
1 parent 8a3fb7b commit 295cc18

File tree

28 files changed

+223
-193
lines changed

28 files changed

+223
-193
lines changed

ports/stm/boards/swan_r5/board.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
void initialize_discharge_pin(void) {
3434
/* Initialize the 3V3 discharge to be OFF and the output power to be ON */
3535
__HAL_RCC_GPIOE_CLK_ENABLE();
36-
GPIO_InitTypeDef GPIO_InitStruct;
36+
GPIO_InitTypeDef GPIO_InitStruct;
3737
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_OD;
3838
GPIO_InitStruct.Pull = GPIO_NOPULL;
3939
GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
@@ -48,7 +48,7 @@ void initialize_discharge_pin(void) {
4848

4949
void board_init(void) {
5050
// enable the debugger while sleeping. Todo move somewhere more central (kind of generally useful in a debug build)
51-
SET_BIT (DBGMCU-> CR, DBGMCU_CR_DBG_SLEEP);
51+
SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_SLEEP);
5252

5353
// Set tick interrupt priority, default HAL value is intentionally invalid
5454
// Without this, USB does not function.

ports/stm/boards/swan_r5/mpconfigboard.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535

3636
#define STM32L4R5XX
37-
#define BOARD_SWAN_R5
37+
#define BOARD_SWAN_R5
3838

3939

4040
// The flash size is defined in the STM32L4xx HAL (but not for the F4)

ports/stm/boards/swan_r5/mpconfigboard.mk

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ CIRCUITPY_NEOPIXEL_WRITE = 0
3939
CIRCUITPY_PULSEIO = 1
4040
CIRCUITPY_PWMIO = 1
4141
CIRCUITPY_AUDIOPWMIO = 1
42-
CIRCUITPY_CANIO = 0
42+
CIRCUITPY_CANIO = 0
4343
CIRCUITPY_AUDIOBUSIO = 0
4444
CIRCUITPY_I2CPERIPHERAL = 0
4545
# Requires SPI, PulseIO (stub ok):
@@ -71,4 +71,3 @@ CIRCUITPY_BLEIO = 0
7171
CIRCUITPY_BUSDEVICE = 0
7272
CIRCUITPY_KEYPAD = 1
7373
CIRCUITPY_RGBMATRIX = 0
74-

ports/stm/boards/swan_r5/tests/analog_output.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ def test_dac_analog(p_in, p_out):
1515
pin_in.deinit()
1616
pin_out.deinit()
1717

18+
1819
def test_dac_digital(p_in, p_out):
1920
print(f"Running dac digital test with pin {p_in} as input and {p_out} as output")
2021
pin_in = digitalio.DigitalInOut(p_in)
@@ -27,6 +28,7 @@ def test_dac_digital(p_in, p_out):
2728
pin_in.deinit()
2829
pin_out.deinit()
2930

31+
3032
def test_dual(pair1, pair2):
3133
# verifies that the DACs can be set independently
3234
print(f"Running pair test\n")
@@ -36,7 +38,7 @@ def test_dual(pair1, pair2):
3638
pin2_out = analogio.AnalogOut(pair2[1])
3739

3840
for v in range(0, 65536, 4096):
39-
v2 = 65535-v
41+
v2 = 65535 - v
4042
pin1_out.value = v
4143
pin2_out.value = v2
4244
print(f"Pair1: Value {v} read as {pin1_in.value}")
@@ -47,6 +49,7 @@ def test_dual(pair1, pair2):
4749
pin2_in.deinit()
4850
pin2_out.deinit()
4951

52+
5053
def test_analog_hilo(p_in, p_out):
5154
print(f"Running analog hilo test with pin {p_in} as input and {p_out} as output")
5255
pin_in = analogio.AnalogIn(p_in)
@@ -60,12 +63,14 @@ def test_analog_hilo(p_in, p_out):
6063
pin_in.deinit()
6164
pin_out.deinit()
6265

66+
6367
def test_pair(pair):
6468
# FIXME: test_analog_hilo works fine alone, but fails when the other dac functions are executed
6569
test_analog_hilo(*pair)
6670
test_dac_analog(*pair)
6771
test_dac_digital(*pair)
68-
72+
73+
6974
def main():
7075
pair1 = (board.A3, board.DAC1)
7176
pair2 = (board.A2, board.DAC2)
@@ -75,7 +80,6 @@ def main():
7580
test_pair(pair2)
7681
print("running dual DAC tests")
7782
test_dual(pair1, pair2)
78-
7983

80-
main()
8184

85+
main()

ports/stm/boards/swan_r5/tests/board_voltage.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,21 +78,23 @@ def _toggle_wait(pin_gpios):
7878
if time.monotonic() > timestamp + LED_OFF_DELAY_TIME:
7979
led_state = True
8080
timestamp = time.monotonic()
81-
81+
8282
gpio.value = led_state
8383
if supervisor.runtime.serial_bytes_available:
8484
answer = input()
8585
if bool(answer == "y"):
8686
done = True
87-
elif (bool(answer == "n")):
87+
elif bool(answer == "n"):
8888
failed += pin
8989
done = True
9090
return failed
9191

92+
9293
def buildPin(pin):
9394
gpio = digitalio.DigitalInOut(pin)
9495
return gpio
9596

97+
9698
def run_test(pins):
9799

98100
"""
@@ -103,7 +105,7 @@ def run_test(pins):
103105
"""
104106

105107
# Create a list of analog GPIO pins
106-
analog_pins = [p for p in pins if p[0] == "A" and _is_number(p[1])]
108+
analog_pins = [p for p in pins if p[0] == "A" and _is_number(p[1])]
107109

108110
# Create a list of digital GPIO
109111
digital_pins = [p for p in pins if p[0] == "D" and _is_number(p[1])]
@@ -142,4 +144,5 @@ def run_test(pins):
142144
print("No GPIO pins found")
143145
return NA, []
144146

145-
run_test([p for p in dir(board)])
147+
148+
run_test([p for p in dir(board)])

ports/stm/boards/swan_r5/tests/button.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,21 @@
22
import digitalio
33
import time
44

5+
56
def monitor_button(pin, callback):
67
with digitalio.DigitalInOut(pin) as button:
7-
newstate = not button.value # state is inverted
8-
state = not newstate # ensure change reported to start with
9-
while callback(newstate, newstate!=state):
8+
newstate = not button.value # state is inverted
9+
state = not newstate # ensure change reported to start with
10+
while callback(newstate, newstate != state):
1011
state = newstate
1112
newstate = button.value
1213
time.sleep(0.01)
1314

15+
1416
def print_changes(state, changed):
1517
if changed:
1618
print(f"button pressed {state}")
1719
return True
1820

19-
monitor_button(board.BUTTON_USR, print_changes)
20-
2121

22+
monitor_button(board.BUTTON_USR, print_changes)

ports/stm/boards/swan_r5/tests/i2c_scan.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@
1717
print("%d device(s) found on I2C bus" % count)
1818

1919
# Release the I2C bus
20-
i2c.unlock()
20+
i2c.unlock()

ports/stm/boards/swan_r5/tests/pwnio.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,3 @@ def fade(pin):
1515
else:
1616
led.duty_cycle = 65535 - int((i - 50) * 2 * 65535 / 100) # Down
1717
time.sleep(0.01)
18-

ports/stm/boards/swan_r5/tests/spi_bme680_smoke_test.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
import board
32
import busio
43
import digitalio
@@ -14,13 +13,14 @@
1413

1514
spi = busio.SPI(board.SCK, MISO=board.MISO, MOSI=board.MOSI)
1615

16+
1717
def readByte(addr):
1818
value = -1
1919
while not spi.try_lock():
2020
pass
2121
try:
2222
spi.configure(baudrate=500000, phase=0, polarity=0)
23-
23+
2424
cs.value = False
2525
result = bytearray(1)
2626
result[0] = addr | 0x80
@@ -32,12 +32,13 @@ def readByte(addr):
3232
spi.unlock()
3333
cs.value = True
3434

35+
3536
def writeByte(addr, value):
3637
while not spi.try_lock():
3738
pass
3839
try:
3940
spi.configure(baudrate=500000, phase=0, polarity=0)
40-
41+
4142
cs.value = False
4243
result = bytearray(2)
4344
result[0] = addr & ~0x80
@@ -46,11 +47,12 @@ def writeByte(addr, value):
4647
finally:
4748
spi.unlock()
4849

50+
4951
# put the device in the correct mode to read the ID
5052
reg = readByte(BME680_SPI_REGISTER)
51-
if (reg & 16)!=0:
53+
if (reg & 16) != 0:
5254
writeByte(BME680_SPI_REGISTER, reg & ~16)
53-
55+
5456
id = readByte(BME680_CHIPID_REGISTER)
5557

5658
print(f"id is {id}, expected {BME680_CHIPID}")

ports/stm/boards/swan_r5/tests/uart.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@
2525
led.value = True
2626

2727
# convert bytearray to string
28-
data_string = '*'.join([chr(b) for b in data])
28+
data_string = "*".join([chr(b) for b in data])
2929
print(data_string, end="")
3030

3131
led.value = False
3232

3333
if usb_cdc.console.in_waiting:
3434
data = usb_cdc.console.read()
35-
data_string = '*'.join([chr(b) for b in data])
36-
print("writing "+data_string)
35+
data_string = "*".join([chr(b) for b in data])
36+
print("writing " + data_string)
3737
uart.write(data)

0 commit comments

Comments
 (0)