Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Apr 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions radio/src/targets/pl18/board.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#include "stm32_adc.h"

#include "stm32_gpio_driver.h"
#include "stm32_ws2812.h"
#include "boards/generic_stm32/rgb_leds.h"

Expand Down Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions radio/src/targets/pl18/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ extern uint16_t sessionTimer;

#define SLAVE_MODE() (g_model.trainerData.mode == TRAINER_MODE_SLAVE)

// Initilizes the board for the bootloader
#define HAVE_BOARD_BOOTLOADER_INIT 1
void boardBootloaderInit();

// Board driver
void boardInit();
void boardOff();
Expand Down