fix(pl18): USB detect pin can be uninitialized in bootloader (#4891)

This commit is contained in:
richardclli
2024-04-22 08:58:04 +10:00
committed by GitHub
parent 4ad9d9b77a
commit 970108846a
2 changed files with 18 additions and 0 deletions
+14
View File
@@ -21,6 +21,7 @@
#include "stm32_adc.h"
#include "stm32_gpio_driver.h"
#include "stm32_ws2812.h"
#include "boards/generic_stm32/rgb_leds.h"
@@ -98,6 +99,19 @@ void ledStripOff()
ws2812_update(&_led_timer);
}
void boardBootloaderInit()
{
// USB charger status pins
stm32_gpio_enable_clock(UCHARGER_GPIO);
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStructure.GPIO_Pin = UCHARGER_GPIO_PIN;
GPIO_Init(UCHARGER_GPIO, &GPIO_InitStructure);
}
void boardInit()
{
#if defined(SEMIHOSTING)