Skip to content

Commit

Permalink
feat(swan_r5): move initialization to board_init(). Flash the LED bri…
Browse files Browse the repository at this point in the history
…efly to indicate a device reset. Useful with troubleshooting.
  • Loading branch information
m-mcgowan committed Jan 29, 2022
1 parent f09ebec commit e8de824
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion ports/stm/boards/swan_r5/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,26 @@ void board_init(void) {
// Set tick interrupt priority, default HAL value is intentionally invalid
// 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;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
GPIO_InitStruct.Pin = GPIO_PIN_2;
HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
HAL_GPIO_WritePin(GPIOE, GPIO_PIN_2, GPIO_PIN_SET);
HAL_Delay(50);
HAL_GPIO_WritePin(GPIOE, GPIO_PIN_2, GPIO_PIN_RESET);
}

bool board_requests_safe_mode(void) {
return false;
}

void reset_board(void) {
initialize_discharge_pin();
}

void board_deinit(void) {
Expand Down

0 comments on commit e8de824

Please sign in to comment.