Skip to content

Commit 5541ae3

Browse files
U-ANALOG\BHurstU-ANALOG\BHurst
authored andcommitted
Manual pre-commit fix for all requisite files.
1 parent 3a73b18 commit 5541ae3

File tree

4 files changed

+43
-33
lines changed

4 files changed

+43
-33
lines changed

ports/analog/boards/max32690evkit/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/max32_port.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,4 @@ extern uint32_t SystemCoreClock;
4242
#define SUBSEC_PER_TICK 4
4343
#endif
4444

45-
#endif //MAX32_PORT_H
45+
#endif // MAX32_PORT_H

ports/analog/supervisor/internal_flash.c

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,9 @@ static uint32_t page_buffer[FLASH_PAGE_SIZE / 4] = {0x0};
7575
static inline int32_t block2addr(uint32_t block) {
7676
if (block >= 0 && block < INTERNAL_FLASH_FILESYSTEM_NUM_BLOCKS) {
7777
return CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_START_ADDR + block * FILESYSTEM_BLOCK_SIZE;
78+
} else {
79+
return -1;
7880
}
79-
else return -1;
8081
}
8182

8283
// Get index, start addr, & size of the flash sector where addr lies
@@ -91,15 +92,13 @@ int flash_get_sector_info(uint32_t addr, uint32_t *start_addr, uint32_t *size) {
9192
}
9293
if (start_addr) {
9394
*start_addr = flash_layout[0].base_addr + (sector_index * flash_layout[0].sector_size);
94-
}
95-
else {
95+
} else {
9696
return -1; // start_addr is NULL
9797
}
9898
if (size) {
9999
*size = flash_layout[0].sector_size;
100-
}
101-
else {
102-
return -1; //size is NULL
100+
} else {
101+
return -1; // size is NULL
103102
}
104103
return sector_index;
105104
}
@@ -176,7 +175,7 @@ mp_uint_t supervisor_flash_read_blocks(uint8_t *dest, uint32_t block, uint32_t n
176175
/** NOTE: The MXC_FLC_Read function executes from SRAM and does some more error checking
177176
* than memcpy does. Will use it for now.
178177
*/
179-
MXC_FLC_Read( src_addr, dest, FILESYSTEM_BLOCK_SIZE * num_blocks );
178+
MXC_FLC_Read(src_addr, dest, FILESYSTEM_BLOCK_SIZE * num_blocks);
180179

181180
return 0; // success
182181
}
@@ -205,12 +204,12 @@ mp_uint_t supervisor_flash_write_blocks(const uint8_t *src, uint32_t block_num,
205204
MXC_ICC_Disable(MXC_ICC0);
206205

207206
// Buffer the page of flash to erase
208-
MXC_FLC_Read(page_start , page_buffer, page_size);
207+
MXC_FLC_Read(page_start, page_buffer, page_size);
209208

210209
// Erase flash page
211210
MXC_CRITICAL(
212211
error = MXC_FLC_PageErase(dest_addr);
213-
);
212+
);
214213
if (error != E_NO_ERROR) {
215214
// lock flash & reset
216215
MXC_FLC0->ctrl = (MXC_FLC0->ctrl & ~MXC_F_FLC_REVA_CTRL_UNLOCK) | MXC_S_FLC_REVA_CTRL_UNLOCK_LOCKED;
@@ -220,12 +219,12 @@ mp_uint_t supervisor_flash_write_blocks(const uint8_t *src, uint32_t block_num,
220219
// Copy new src data into the page buffer
221220
// fill the new data in at the offset dest_addr - page_start
222221
// account for uint32_t page_buffer vs uint8_t src
223-
memcpy( (page_buffer + (dest_addr - page_start) / 4), src, count * FILESYSTEM_BLOCK_SIZE);
222+
memcpy((page_buffer + (dest_addr - page_start) / 4), src, count * FILESYSTEM_BLOCK_SIZE);
224223

225224
// Write new page buffer back into flash
226225
MXC_CRITICAL(
227226
error = MXC_FLC_Write(page_start, page_size, page_buffer);
228-
);
227+
);
229228
if (error != E_NO_ERROR) {
230229
// lock flash & reset
231230
MXC_FLC0->ctrl = (MXC_FLC0->ctrl & ~MXC_F_FLC_REVA_CTRL_UNLOCK) | MXC_S_FLC_REVA_CTRL_UNLOCK_LOCKED;

ports/analog/supervisor/port.c

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@
4646

4747
// msec to RTC subsec ticks (4 kHz)
4848
#define MSEC_TO_SS_ALARM(x) \
49-
(0 - ((x * 4096) / \
50-
1000)) /* Converts a time in milleseconds to the equivalent RSSA register value. */
49+
(0 - ((x * 4096) / \
50+
1000)) /* Converts a time in milleseconds to the equivalent RSSA register value. */
5151

5252
// Externs defined by linker .ld file
5353
extern uint32_t _stack, _heap, _estack, _eheap;
@@ -70,7 +70,7 @@ safe_mode_t port_init(void) {
7070
int err = E_NO_ERROR;
7171

7272
// Enable GPIO (enables clocks + common init for ports)
73-
for (int i = 0; i < MXC_CFG_GPIO_INSTANCES; i++){
73+
for (int i = 0; i < MXC_CFG_GPIO_INSTANCES; i++) {
7474
err = MXC_GPIO_Init(0x1 << i);
7575
if (err) {
7676
return SAFE_MODE_PROGRAMMATIC;
@@ -93,22 +93,28 @@ safe_mode_t port_init(void) {
9393

9494
// Enable clock to RTC peripheral
9595
MXC_GCR->clkctrl |= MXC_F_GCR_CLKCTRL_ERTCO_EN;
96-
while(!(MXC_GCR->clkctrl & MXC_F_GCR_CLKCTRL_ERTCO_RDY));
96+
while (!(MXC_GCR->clkctrl & MXC_F_GCR_CLKCTRL_ERTCO_RDY)) {
97+
;
98+
}
9799

98100
NVIC_EnableIRQ(RTC_IRQn);
99101
NVIC_EnableIRQ(USB_IRQn);
100102

101103
// Init RTC w/ 0sec, 0subsec
102104
// Driven by 32.768 kHz ERTCO, with ssec= 1/4096 s
103-
while( MXC_RTC_Init(0,0) != E_SUCCESS ) {};
105+
while (MXC_RTC_Init(0, 0) != E_SUCCESS) {
106+
}
107+
;
104108

105109
// enable 1 sec RTC SSEC alarm
106110
MXC_RTC_DisableInt(MXC_F_RTC_CTRL_SSEC_ALARM_IE);
107111
MXC_RTC_SetSubsecondAlarm(MSEC_TO_SS_ALARM(1000));
108112
MXC_RTC_EnableInt(MXC_F_RTC_CTRL_SSEC_ALARM_IE);
109113

110114
// Enable RTC
111-
while ( MXC_RTC_Start() != E_SUCCESS ) {};
115+
while (MXC_RTC_Start() != E_SUCCESS) {
116+
}
117+
;
112118

113119
return SAFE_MODE_NONE;
114120
}
@@ -191,9 +197,10 @@ uint64_t port_get_raw_ticks(uint8_t *subticks) {
191197
__disable_irq();
192198
if (MXC_RTC->ctrl & MXC_F_RTC_CTRL_EN) {
193199
// NOTE: RTC_GetTime always returns BUSY if RTC is not running
194-
while( (MXC_RTC_GetTime(&sec, &subsec)) != E_NO_ERROR );
195-
}
196-
else {
200+
while ((MXC_RTC_GetTime(&sec, &subsec)) != E_NO_ERROR) {
201+
;
202+
}
203+
} else {
197204
sec = MXC_RTC->sec;
198205
subsec = MXC_RTC->ssec;
199206
}
@@ -232,15 +239,19 @@ void port_interrupt_after_ticks(uint32_t ticks) {
232239
ticks_msec = 1000 * ticks / TICKS_PER_SEC;
233240

234241
while (MXC_RTC_DisableInt(MXC_F_RTC_CTRL_SSEC_ALARM_IE |
235-
MXC_F_RTC_CTRL_TOD_ALARM_IE) == E_BUSY) {};
242+
MXC_F_RTC_CTRL_TOD_ALARM_IE) == E_BUSY) {
243+
}
244+
;
236245

237246
// Clear the flag to be set by the RTC Handler
238247
tick_flag = 0;
239248

240249
// Subsec alarm is the starting/reload value of the SSEC counter.
241250
// ISR triggered when SSEC rolls over from 0xFFFF_FFFF to 0x0
242-
while ( MXC_RTC_SetSubsecondAlarm(MSEC_TO_SS_ALARM(ticks_msec) ) == E_BUSY) {}
243-
while (MXC_RTC_EnableInt(MXC_F_RTC_CTRL_SSEC_ALARM_IE) == E_BUSY) {}
251+
while (MXC_RTC_SetSubsecondAlarm(MSEC_TO_SS_ALARM(ticks_msec)) == E_BUSY) {
252+
}
253+
while (MXC_RTC_EnableInt(MXC_F_RTC_CTRL_SSEC_ALARM_IE) == E_BUSY) {
254+
}
244255

245256
NVIC_EnableIRQ(RTC_IRQn);
246257

@@ -249,10 +260,10 @@ void port_interrupt_after_ticks(uint32_t ticks) {
249260

250261
void port_idle_until_interrupt(void) {
251262
#if CIRCUITPY_RTC
252-
// Check if alarm triggers before we even got here
253-
if (MXC_RTC_GetFlags() == (MXC_F_RTC_CTRL_TOD_ALARM | MXC_F_RTC_CTRL_SSEC_ALARM)) {
254-
return;
255-
}
263+
// Check if alarm triggers before we even got here
264+
if (MXC_RTC_GetFlags() == (MXC_F_RTC_CTRL_TOD_ALARM | MXC_F_RTC_CTRL_SSEC_ALARM)) {
265+
return;
266+
}
256267
#endif
257268

258269
// Interrupts should be disabled to ensure the ISR queue is flushed

0 commit comments

Comments
 (0)