Skip to content

Commit e8de824

Browse files
committed
feat(swan_r5): move initialization to board_init(). Flash the LED briefly to indicate a device reset. Useful with troubleshooting.
1 parent f09ebec commit e8de824

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

ports/stm/boards/swan_r5/board.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,26 @@ void board_init(void) {
5353
// Set tick interrupt priority, default HAL value is intentionally invalid
5454
// Without this, USB does not function.
5555
HAL_InitTick((1UL << __NVIC_PRIO_BITS) - 1UL);
56+
57+
initialize_discharge_pin();
58+
59+
__HAL_RCC_GPIOE_CLK_ENABLE();
60+
GPIO_InitTypeDef GPIO_InitStruct;
61+
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
62+
GPIO_InitStruct.Pull = GPIO_NOPULL;
63+
GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
64+
GPIO_InitStruct.Pin = GPIO_PIN_2;
65+
HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
66+
HAL_GPIO_WritePin(GPIOE, GPIO_PIN_2, GPIO_PIN_SET);
67+
HAL_Delay(50);
68+
HAL_GPIO_WritePin(GPIOE, GPIO_PIN_2, GPIO_PIN_RESET);
5669
}
5770

5871
bool board_requests_safe_mode(void) {
5972
return false;
6073
}
6174

6275
void reset_board(void) {
63-
initialize_discharge_pin();
6476
}
6577

6678
void board_deinit(void) {

0 commit comments

Comments
 (0)