summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ports/stm32/main.c60
1 files changed, 29 insertions, 31 deletions
diff --git a/ports/stm32/main.c b/ports/stm32/main.c
index 44f5b05c4..5c7535542 100644
--- a/ports/stm32/main.c
+++ b/ports/stm32/main.c
@@ -343,12 +343,12 @@ STATIC bool init_sdcard_fs(void) {
#if !MICROPY_HW_USES_BOOTLOADER
STATIC uint update_reset_mode(uint reset_mode) {
-#if MICROPY_HW_HAS_SWITCH
+ #if MICROPY_HW_HAS_SWITCH
if (switch_get()) {
// The original method used on the pyboard is appropriate if you have 2
// or more LEDs.
-#if defined(MICROPY_HW_LED2)
+ #if defined(MICROPY_HW_LED2)
for (uint i = 0; i < 3000; i++) {
if (!switch_get()) {
break;
@@ -376,7 +376,7 @@ STATIC uint update_reset_mode(uint reset_mode) {
}
mp_hal_delay_ms(400);
-#elif defined(MICROPY_HW_LED1)
+ #elif defined(MICROPY_HW_LED1)
// For boards with only a single LED, we'll flash that LED the
// appropriate number of times, with a pause between each one
@@ -409,11 +409,11 @@ STATIC uint update_reset_mode(uint reset_mode) {
}
mp_hal_delay_ms(400);
}
-#else
-#error Need a reset mode update method
-#endif
+ #else
+ #error Need a reset mode update method
+ #endif
}
-#endif
+ #endif
return reset_mode;
}
#endif
@@ -522,13 +522,13 @@ void stm32_main(uint32_t reset_mode) {
soft_reset:
-#if defined(MICROPY_HW_LED2)
+ #if defined(MICROPY_HW_LED2)
led_state(1, 0);
led_state(2, 1);
-#else
+ #else
led_state(1, 1);
led_state(2, 0);
-#endif
+ #endif
led_state(3, 0);
led_state(4, 0);
@@ -576,7 +576,7 @@ soft_reset:
// Define MICROPY_HW_UART_REPL to be PYB_UART_6 and define
// MICROPY_HW_UART_REPL_BAUD in your mpconfigboard.h file if you want a
// REPL on a hardware UART as well as on USB VCP
-#if defined(MICROPY_HW_UART_REPL)
+ #if defined(MICROPY_HW_UART_REPL)
{
mp_obj_t args[2] = {
MP_OBJ_NEW_SMALL_INT(MICROPY_HW_UART_REPL),
@@ -585,13 +585,13 @@ soft_reset:
MP_STATE_PORT(pyb_stdio_uart) = pyb_uart_type.make_new((mp_obj_t)&pyb_uart_type, MP_ARRAY_SIZE(args), 0, args);
uart_attach_to_repl(MP_STATE_PORT(pyb_stdio_uart), true);
}
-#else
+ #else
MP_STATE_PORT(pyb_stdio_uart) = NULL;
-#endif
+ #endif
-#if MICROPY_HW_ENABLE_CAN
+ #if MICROPY_HW_ENABLE_CAN
can_init0();
-#endif
+ #endif
#if MICROPY_HW_ENABLE_USB
pyb_usb_init0();
@@ -602,7 +602,7 @@ soft_reset:
bool mounted_flash = init_flash_fs(reset_mode);
bool mounted_sdcard = false;
-#if MICROPY_HW_HAS_SDCARD
+ #if MICROPY_HW_HAS_SDCARD
// if an SD card is present then mount it on /sd/
if (sdcard_is_present()) {
// if there is a file in the flash called "SKIPSD", then we don't mount the SD card
@@ -610,7 +610,7 @@ soft_reset:
mounted_sdcard = init_sdcard_fs();
}
}
-#endif
+ #endif
#if MICROPY_HW_ENABLE_USB
// if the SD card isn't used as the USB MSC medium then use the internal flash
@@ -649,12 +649,12 @@ soft_reset:
}
// turn boot-up LEDs off
-#if !defined(MICROPY_HW_LED2)
+ #if !defined(MICROPY_HW_LED2)
// If there is only one LED on the board then it's used to signal boot-up
// and so we turn it off here. Otherwise LED(1) is used to indicate dirty
// flash cache and so we shouldn't change its state.
led_state(1, 0);
-#endif
+ #endif
led_state(2, 0);
led_state(3, 0);
led_state(4, 0);
@@ -670,24 +670,22 @@ soft_reset:
}
#endif
-#if MICROPY_HW_HAS_MMA7660
+ #if MICROPY_HW_HAS_MMA7660
// MMA accel: init and reset
accel_init();
-#endif
+ #endif
-#if MICROPY_HW_ENABLE_SERVO
- // servo
+ #if MICROPY_HW_ENABLE_SERVO
servo_init();
-#endif
+ #endif
-#if MICROPY_HW_ENABLE_DAC
- // DAC
+ #if MICROPY_HW_ENABLE_DAC
dac_init();
-#endif
+ #endif
-#if MICROPY_PY_NETWORK
+ #if MICROPY_PY_NETWORK
mod_network_init();
-#endif
+ #endif
// At this point everything is fully configured and initialised.
@@ -738,9 +736,9 @@ soft_reset_exit:
#endif
timer_deinit();
uart_deinit();
-#if MICROPY_HW_ENABLE_CAN
+ #if MICROPY_HW_ENABLE_CAN
can_deinit();
-#endif
+ #endif
machine_deinit();
#if MICROPY_PY_THREAD