diff --git a/ports/stm/boards/swan_r5/board.c b/ports/stm/boards/swan_r5/board.c index 36f3946236..bb424eea0b 100644 --- a/ports/stm/boards/swan_r5/board.c +++ b/ports/stm/boards/swan_r5/board.c @@ -59,8 +59,6 @@ void board_init(void) { // Without this, USB does not function. HAL_InitTick((1UL << __NVIC_PRIO_BITS) - 1UL); - initialize_discharge_pin(); - __HAL_RCC_GPIOE_CLK_ENABLE(); GPIO_InitTypeDef GPIO_InitStruct; GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; @@ -78,6 +76,7 @@ bool board_requests_safe_mode(void) { } void reset_board(void) { + initialize_discharge_pin(); } void board_deinit(void) { diff --git a/ports/stm/boards/swan_r5/mpconfigboard.h b/ports/stm/boards/swan_r5/mpconfigboard.h index da07d6530b..e82b8ab3d2 100644 --- a/ports/stm/boards/swan_r5/mpconfigboard.h +++ b/ports/stm/boards/swan_r5/mpconfigboard.h @@ -64,3 +64,6 @@ #define DEFAULT_UART_BUS_RX (&pin_PA10) #define DEFAULT_UART_BUS_TX (&pin_PA09) + +#define SWAN_R5_DISCHARGE_3V3 (&pin_PE06) +#define SWAN_R5_ENABLE_3V3 (&pin_PE04) \ No newline at end of file diff --git a/ports/stm/boards/swan_r5/pins.c b/ports/stm/boards/swan_r5/pins.c index 6780795dee..7032eae4c4 100644 --- a/ports/stm/boards/swan_r5/pins.c +++ b/ports/stm/boards/swan_r5/pins.c @@ -86,8 +86,8 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_ext), MP_ROM_PTR(&carrier_type) }, - { MP_ROM_QSTR(MP_QSTR_ENABLE_3V3), MP_ROM_PTR(&pin_PE04) }, - { MP_ROM_QSTR(MP_QSTR_DISCHARGE_3V3), MP_ROM_PTR(&pin_PE06) }, + { MP_ROM_QSTR(MP_QSTR_ENABLE_3V3), MP_ROM_PTR(SWAN_R5_ENABLE_3V3) }, + { MP_ROM_QSTR(MP_QSTR_DISCHARGE_3V3), MP_ROM_PTR(SWAN_R5_DISCHARGE_3V3) }, { MP_ROM_QSTR(MP_QSTR_DISABLE_DISCHARGING), MP_ROM_TRUE }, { MP_ROM_QSTR(MP_QSTR_ENABLE_DISCHARGING), MP_ROM_FALSE },