fix(swan_r5): 3v3 was enabled but then immediately reset. Moved initialization to `reset_board` which happens after `reset_all_pins`.

This commit is contained in:
Matthew McGowan 2022-06-03 14:19:47 -07:00
parent edfabb66ff
commit 113b070e77
3 changed files with 6 additions and 4 deletions

View File

@ -59,8 +59,6 @@ void board_init(void) {
// Without this, USB does not function. // Without this, USB does not function.
HAL_InitTick((1UL << __NVIC_PRIO_BITS) - 1UL); HAL_InitTick((1UL << __NVIC_PRIO_BITS) - 1UL);
initialize_discharge_pin();
__HAL_RCC_GPIOE_CLK_ENABLE(); __HAL_RCC_GPIOE_CLK_ENABLE();
GPIO_InitTypeDef GPIO_InitStruct; GPIO_InitTypeDef GPIO_InitStruct;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
@ -78,6 +76,7 @@ bool board_requests_safe_mode(void) {
} }
void reset_board(void) { void reset_board(void) {
initialize_discharge_pin();
} }
void board_deinit(void) { void board_deinit(void) {

View File

@ -64,3 +64,6 @@
#define DEFAULT_UART_BUS_RX (&pin_PA10) #define DEFAULT_UART_BUS_RX (&pin_PA10)
#define DEFAULT_UART_BUS_TX (&pin_PA09) #define DEFAULT_UART_BUS_TX (&pin_PA09)
#define SWAN_R5_DISCHARGE_3V3 (&pin_PE06)
#define SWAN_R5_ENABLE_3V3 (&pin_PE04)

View File

@ -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_ext), MP_ROM_PTR(&carrier_type) },
{ MP_ROM_QSTR(MP_QSTR_ENABLE_3V3), MP_ROM_PTR(&pin_PE04) }, { MP_ROM_QSTR(MP_QSTR_ENABLE_3V3), MP_ROM_PTR(SWAN_R5_ENABLE_3V3) },
{ MP_ROM_QSTR(MP_QSTR_DISCHARGE_3V3), MP_ROM_PTR(&pin_PE06) }, { 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_DISABLE_DISCHARGING), MP_ROM_TRUE },
{ MP_ROM_QSTR(MP_QSTR_ENABLE_DISCHARGING), MP_ROM_FALSE }, { MP_ROM_QSTR(MP_QSTR_ENABLE_DISCHARGING), MP_ROM_FALSE },