Skip to content

Commit 8ee4bfb

Browse files
committed
Formatting fixes missed by local pre-commit runner
1 parent ff87a70 commit 8ee4bfb

10 files changed

Lines changed: 53 additions & 65 deletions

File tree

ports/analog/background.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ extern const mxc_gpio_cfg_t led_pin[];
1919
extern const int num_leds;
2020

2121
/** NOTE: ALL "ticks" refer to a 1/1024 s period */
22-
static int status_led_ticks=0;
22+
static int status_led_ticks = 0;
2323

2424
// This function is where port-specific background
2525
// tasks should be performed
@@ -28,8 +28,7 @@ void port_background_tick(void) {
2828
status_led_ticks++;
2929

3030
// Set an LED approx. 1/s
31-
if (status_led_ticks > 1024)
32-
{
31+
if (status_led_ticks > 1024) {
3332
MXC_GPIO_OutToggle(led_pin[2].port, led_pin[2].mask);
3433
status_led_ticks = 0;
3534
}

ports/analog/boards/apard32690/board.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
#include "max32_port.h"
1111

1212
// Board-level setup for MAX32690
13-
mxc_gpio_regs_t* gpio_ports[NUM_GPIO_PORTS] =
14-
{MXC_GPIO0, MXC_GPIO1, MXC_GPIO2, MXC_GPIO3, MXC_GPIO4};
13+
mxc_gpio_regs_t *gpio_ports[NUM_GPIO_PORTS] =
14+
{MXC_GPIO0, MXC_GPIO1, MXC_GPIO2, MXC_GPIO3, MXC_GPIO4};
1515

1616
// clang-format off
1717
const mxc_gpio_cfg_t pb_pin[] = {
@@ -38,20 +38,20 @@ const int num_leds = (sizeof(led_pin) / sizeof(mxc_gpio_cfg_t));
3838
volatile uint32_t system_ticks = 0;
3939

4040
void SysTick_Handler(void) {
41-
system_ticks++;
41+
system_ticks++;
4242
}
4343

4444
uint32_t board_millis(void) {
45-
return system_ticks;
45+
return system_ticks;
4646
}
4747

4848
// Initializes board related state once on start up.
4949
void board_init(void) {
5050
// 1ms tick timer
51-
SysTick_Config(SystemCoreClock / 1000);\
51+
SysTick_Config(SystemCoreClock / 1000); \
5252

5353
// Enable GPIO (enables clocks + common init for ports)
54-
for (int i = 0; i < MXC_CFG_GPIO_INSTANCES; i++){
54+
for (int i = 0; i < MXC_CFG_GPIO_INSTANCES; i++) {
5555
MXC_GPIO_Init(0x1 << i);
5656
}
5757

ports/analog/boards/apard32690/pins.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
static const mp_rom_map_elem_t board_module_globals_table[] = {
1111
CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS
12-
//P0
12+
// P0
1313
{ MP_ROM_QSTR(MP_QSTR_P0_00), MP_ROM_PTR(&pin_P0_00) },
1414
{ MP_ROM_QSTR(MP_QSTR_P0_01), MP_ROM_PTR(&pin_P0_01) },
1515
{ MP_ROM_QSTR(MP_QSTR_P0_02), MP_ROM_PTR(&pin_P0_02) },
@@ -42,7 +42,7 @@ static const mp_rom_map_elem_t board_module_globals_table[] = {
4242
{ MP_ROM_QSTR(MP_QSTR_P0_29), MP_ROM_PTR(&pin_P0_29) },
4343
{ MP_ROM_QSTR(MP_QSTR_P0_30), MP_ROM_PTR(&pin_P0_30) },
4444
{ MP_ROM_QSTR(MP_QSTR_P0_31), MP_ROM_PTR(&pin_P0_31) },
45-
//P1
45+
// P1
4646
{ MP_ROM_QSTR(MP_QSTR_P1_00), MP_ROM_PTR(&pin_P1_00) },
4747
{ MP_ROM_QSTR(MP_QSTR_P1_01), MP_ROM_PTR(&pin_P1_01) },
4848
{ MP_ROM_QSTR(MP_QSTR_P1_02), MP_ROM_PTR(&pin_P1_02) },
@@ -75,7 +75,7 @@ static const mp_rom_map_elem_t board_module_globals_table[] = {
7575
{ MP_ROM_QSTR(MP_QSTR_P1_29), MP_ROM_PTR(&pin_P1_29) },
7676
{ MP_ROM_QSTR(MP_QSTR_P1_30), MP_ROM_PTR(&pin_P1_30) },
7777
{ MP_ROM_QSTR(MP_QSTR_P1_31), MP_ROM_PTR(&pin_P1_31) },
78-
//P2
78+
// P2
7979
{ MP_ROM_QSTR(MP_QSTR_P2_00), MP_ROM_PTR(&pin_P2_00) },
8080
{ MP_ROM_QSTR(MP_QSTR_P2_01), MP_ROM_PTR(&pin_P2_01) },
8181
{ MP_ROM_QSTR(MP_QSTR_P2_02), MP_ROM_PTR(&pin_P2_02) },
@@ -108,7 +108,7 @@ static const mp_rom_map_elem_t board_module_globals_table[] = {
108108
{ MP_ROM_QSTR(MP_QSTR_P2_29), MP_ROM_PTR(&pin_P2_29) },
109109
{ MP_ROM_QSTR(MP_QSTR_P2_30), MP_ROM_PTR(&pin_P2_30) },
110110
{ MP_ROM_QSTR(MP_QSTR_P2_31), MP_ROM_PTR(&pin_P2_31) },
111-
//P3
111+
// P3
112112
{ MP_ROM_QSTR(MP_QSTR_P3_00), MP_ROM_PTR(&pin_P3_00) },
113113
{ MP_ROM_QSTR(MP_QSTR_P3_01), MP_ROM_PTR(&pin_P3_01) },
114114
{ MP_ROM_QSTR(MP_QSTR_P3_02), MP_ROM_PTR(&pin_P3_02) },
@@ -119,7 +119,7 @@ static const mp_rom_map_elem_t board_module_globals_table[] = {
119119
{ MP_ROM_QSTR(MP_QSTR_P3_07), MP_ROM_PTR(&pin_P3_07) },
120120
{ MP_ROM_QSTR(MP_QSTR_P3_08), MP_ROM_PTR(&pin_P3_08) },
121121
{ MP_ROM_QSTR(MP_QSTR_P3_09), MP_ROM_PTR(&pin_P3_09) },
122-
//P4
122+
// P4
123123
{ MP_ROM_QSTR(MP_QSTR_P4_00), MP_ROM_PTR(&pin_P4_00) },
124124
{ MP_ROM_QSTR(MP_QSTR_P4_01), MP_ROM_PTR(&pin_P4_01) },
125125
};

ports/analog/boards/max32690evkit/board.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
#include "max32_port.h"
1111

1212
// Board-level setup for MAX32690
13-
mxc_gpio_regs_t* gpio_ports[NUM_GPIO_PORTS] =
14-
{MXC_GPIO0, MXC_GPIO1, MXC_GPIO2, MXC_GPIO3, MXC_GPIO4};
13+
mxc_gpio_regs_t *gpio_ports[NUM_GPIO_PORTS] =
14+
{MXC_GPIO0, MXC_GPIO1, MXC_GPIO2, MXC_GPIO3, MXC_GPIO4};
1515

1616
// clang-format off
1717
const mxc_gpio_cfg_t pb_pin[] = {
@@ -47,10 +47,10 @@ uint32_t board_millis(void) {
4747
// Initializes board related state once on start up.
4848
void board_init(void) {
4949
// 1ms tick timer
50-
SysTick_Config(SystemCoreClock / 1000);\
50+
SysTick_Config(SystemCoreClock / 1000); \
5151

5252
// Enable GPIO (enables clocks + common init for ports)
53-
for (int i = 0; i < MXC_CFG_GPIO_INSTANCES; i++){
53+
for (int i = 0; i < MXC_CFG_GPIO_INSTANCES; i++) {
5454
MXC_GPIO_Init(0x1 << i);
5555
}
5656

ports/analog/common-hal/digitalio/DigitalInOut.c

Lines changed: 25 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
#include "gpio_reva.h"
1212

13-
extern mxc_gpio_regs_t* gpio_ports[NUM_GPIO_PORTS];
13+
extern mxc_gpio_regs_t *gpio_ports[NUM_GPIO_PORTS];
1414

1515
void common_hal_digitalio_digitalinout_never_reset(
1616
digitalio_digitalinout_obj_t *self) {
@@ -50,9 +50,8 @@ void common_hal_digitalio_digitalinout_deinit(digitalio_digitalinout_obj_t *self
5050
}
5151

5252
digitalinout_result_t common_hal_digitalio_digitalinout_switch_to_input(
53-
digitalio_digitalinout_obj_t *self, digitalio_pull_t pull)
54-
{
55-
mxc_gpio_regs_t* port = gpio_ports[self->pin->port];
53+
digitalio_digitalinout_obj_t *self, digitalio_pull_t pull) {
54+
mxc_gpio_regs_t *port = gpio_ports[self->pin->port];
5655
uint32_t mask = self->pin->mask;
5756

5857
MXC_GPIO_RevA_SetAF((mxc_gpio_reva_regs_t *)port, MXC_GPIO_FUNC_IN, mask);
@@ -61,9 +60,8 @@ digitalinout_result_t common_hal_digitalio_digitalinout_switch_to_input(
6160

6261
digitalinout_result_t common_hal_digitalio_digitalinout_switch_to_output(
6362
digitalio_digitalinout_obj_t *self, bool value,
64-
digitalio_drive_mode_t drive_mode)
65-
{
66-
mxc_gpio_regs_t* port = gpio_ports[self->pin->port];
63+
digitalio_drive_mode_t drive_mode) {
64+
mxc_gpio_regs_t *port = gpio_ports[self->pin->port];
6765
uint32_t mask = self->pin->mask;
6866

6967
MXC_GPIO_RevA_SetAF((mxc_gpio_reva_regs_t *)port, MXC_GPIO_FUNC_OUT, mask);
@@ -85,24 +83,21 @@ digitalio_direction_t common_hal_digitalio_digitalinout_get_direction(
8583
uint32_t mask = self->pin->mask;
8684

8785
// Check that I/O mode is enabled and we don't have in AND out on at the same time
88-
MP_STATIC_ASSERT(!( (port->en0 & mask) && (port->inen & mask) && (port->outen & mask) ));
86+
MP_STATIC_ASSERT(!((port->en0 & mask) && (port->inen & mask) && (port->outen & mask)));
8987

90-
if ( (port->en0 & mask) && (port->outen & mask) )
91-
{
88+
if ((port->en0 & mask) && (port->outen & mask)) {
9289
return DIRECTION_OUTPUT;
93-
}
94-
else if ( (port->en0 & mask) && (port->inen & mask) )
95-
{
90+
} else if ((port->en0 & mask) && (port->inen & mask)) {
9691
return DIRECTION_INPUT;
9792
}
98-
9993
// do not try to drive a pin which has an odd configuration here
100-
else return DIRECTION_INPUT;
94+
else {
95+
return DIRECTION_INPUT;
96+
}
10197
}
10298

10399
void common_hal_digitalio_digitalinout_set_value(
104-
digitalio_digitalinout_obj_t *self, bool value)
105-
{
100+
digitalio_digitalinout_obj_t *self, bool value) {
106101
digitalio_direction_t dir =
107102
common_hal_digitalio_digitalinout_get_direction(self);
108103

@@ -112,26 +107,23 @@ void common_hal_digitalio_digitalinout_set_value(
112107
if (dir == DIRECTION_OUTPUT) {
113108
if (value == true) {
114109
MXC_GPIO_OutSet(port, mask);
115-
}
116-
else {
110+
} else {
117111
MXC_GPIO_OutClr(port, mask);
118112
}
119113
}
120114
}
121115

122-
bool common_hal_digitalio_digitalinout_get_value(digitalio_digitalinout_obj_t *self)
123-
{
116+
bool common_hal_digitalio_digitalinout_get_value(digitalio_digitalinout_obj_t *self) {
124117
digitalio_direction_t dir =
125118
common_hal_digitalio_digitalinout_get_direction(self);
126119

127120
mxc_gpio_regs_t *port = gpio_ports[self->pin->port];
128121
uint32_t mask = self->pin->mask;
129122

130123
if (dir == DIRECTION_INPUT) {
131-
return (MXC_GPIO_InGet(port, mask));
132-
}
133-
else {
134-
return ( (port->out & mask) == true);
124+
return MXC_GPIO_InGet(port, mask);
125+
} else {
126+
return (port->out & mask) == true;
135127
}
136128
}
137129

@@ -154,15 +146,15 @@ digitalinout_result_t common_hal_digitalio_digitalinout_set_pull(
154146
mxc_gpio_regs_t *port = gpio_ports[self->pin->port];
155147
uint32_t mask = self->pin->mask;
156148

157-
if ( (port->en0 & mask) && (port->inen & mask) ) {
149+
if ((port->en0 & mask) && (port->inen & mask)) {
158150
// PULL_NONE, PULL_UP, or PULL_DOWN
159151
switch (pull) {
160152
case PULL_NONE:
161153
port->padctrl0 &= ~(mask);
162154
port->padctrl1 &= ~(mask);
163155
break;
164156
case PULL_UP:
165-
port->padctrl0 |= mask;
157+
port->padctrl0 |= mask;
166158
port->padctrl1 &= ~(mask);
167159
break;
168160
case PULL_DOWN:
@@ -173,28 +165,24 @@ digitalinout_result_t common_hal_digitalio_digitalinout_set_pull(
173165
break;
174166
}
175167
return DIGITALINOUT_OK;
176-
}
177-
else {
168+
} else {
178169
return DIGITALINOUT_PIN_BUSY;
179170
}
180171
}
181172

182173
digitalio_pull_t common_hal_digitalio_digitalinout_get_pull(
183174
digitalio_digitalinout_obj_t *self) {
184175

185-
bool pin_padctrl0 = (gpio_ports[self->pin->port]->padctrl0) & ( self->pin->mask);
186-
bool pin_padctrl1 = (gpio_ports[self->pin->port]->padctrl1) & ( self->pin->mask);
176+
bool pin_padctrl0 = (gpio_ports[self->pin->port]->padctrl0) & (self->pin->mask);
177+
bool pin_padctrl1 = (gpio_ports[self->pin->port]->padctrl1) & (self->pin->mask);
187178

188-
if ( (pin_padctrl0) && !(pin_padctrl1) ) {
179+
if ((pin_padctrl0) && !(pin_padctrl1)) {
189180
return PULL_UP;
190-
}
191-
else if ( !(pin_padctrl0) && pin_padctrl1 ) {
181+
} else if (!(pin_padctrl0) && pin_padctrl1) {
192182
return PULL_DOWN;
193-
}
194-
else if ( !(pin_padctrl0) && !(pin_padctrl1) ) {
183+
} else if (!(pin_padctrl0) && !(pin_padctrl1)) {
195184
return PULL_NONE;
196185
}
197-
198186
// Shouldn't happen, (value 0b11 is reserved)
199187
else {
200188
return PULL_NONE;

ports/analog/common-hal/microcontroller/Pin.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
static uint32_t claimed_pins[NUM_GPIO_PORTS];
1818

1919
// defined in board.c
20-
extern mxc_gpio_regs_t* gpio_ports[NUM_GPIO_PORTS];
20+
extern mxc_gpio_regs_t *gpio_ports[NUM_GPIO_PORTS];
2121

2222
static uint32_t never_reset_pins[NUM_GPIO_PORTS];
2323

@@ -31,8 +31,8 @@ void reset_all_pins(void) {
3131
reset_pin_number(i, j);
3232
}
3333
}
34-
// set claimed pins to never_reset pins
35-
claimed_pins[i] = never_reset_pins[i];
34+
// set claimed pins to never_reset pins
35+
claimed_pins[i] = never_reset_pins[i];
3636
}
3737
}
3838

ports/analog/common-hal/microcontroller/Processor.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ void common_hal_mcu_processor_get_uid(uint8_t raw_id[]) {
4040

4141
mcu_reset_reason_t common_hal_mcu_processor_get_reset_reason(void) {
4242
#if CIRCUITPY_ALARM
43-
// TODO: (low prior.) add reset reason in alarm / deepsleep cases (should require alarm peripheral API in "peripherals")
43+
// TODO: (low prior.) add reset reason in alarm / deepsleep cases (should require alarm peripheral API in "peripherals")
4444
#endif
4545
return RESET_REASON_UNKNOWN;
4646
}

ports/analog/common-hal/os/__init__.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ mp_obj_t common_hal_os_uname(void) {
4343

4444
bool common_hal_os_urandom(uint8_t *buffer, uint32_t length) {
4545
#if (HAS_TRNG)
46-
//todo (low prior): implement
46+
// todo (low prior): implement
4747
#else
4848
#endif
49-
return false;
49+
return false;
5050
}

ports/analog/supervisor/serial.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@
2626
void port_serial_init(void) {
2727
#if MAX32_SERIAL
2828
MXC_GCR->clkctrl |= MXC_F_GCR_CLKCTRL_IBRO_EN;
29-
while( !(MXC_GCR->clkctrl & MXC_F_GCR_CLKCTRL_IBRO_RDY) );
29+
while (!(MXC_GCR->clkctrl & MXC_F_GCR_CLKCTRL_IBRO_RDY)) {
30+
;
31+
}
3032
MXC_UART_Init(CONSOLE_UART, 115200, MXC_UART_IBRO_CLK);
3133
#endif
3234
}
@@ -76,7 +78,7 @@ void port_serial_write_substring(const char *text, uint32_t len) {
7678
.rxData = NULL,
7779
.txLen = len,
7880
.rxLen = 0
79-
};
81+
};
8082
MXC_UART_Transaction(&uart_req);
8183
#endif
8284
}

ports/analog/supervisor/usb.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ void init_usb_hardware(void) {
3636
// Interrupt enables are left to TUSB depending on the device class
3737
}
3838

39-
void USB_IRQHandler(void)
40-
{
39+
void USB_IRQHandler(void) {
4140
// Schedules USB background callback
4241
// appropriate to a given device class via TinyUSB lib
4342
usb_irq_handler(0);

0 commit comments

Comments
 (0)