Skip to content
Merged
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
27 changes: 19 additions & 8 deletions src/stm32f103/target_stm32f103.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,26 @@ void target_clock_setup(void) {

void target_gpio_setup(void) {
/* Enable GPIO clocks */
if (USES_GPIOA) {
rcc_periph_clock_enable(RCC_GPIOA);
}
if (USES_GPIOB) {
rcc_periph_clock_enable(RCC_GPIOB);
}
if (USES_GPIOC) {
rcc_periph_clock_enable(RCC_GPIOC);
#if USES_GPIOA
rcc_periph_clock_enable(RCC_GPIOA);
#endif
#if USES_GPIOB
rcc_periph_clock_enable(RCC_GPIOB);
#endif
#if USES_GPIOC
rcc_periph_clock_enable(RCC_GPIOC);
#endif

/* Disable SWD if PA13 and/or PA14 are used for another purpose */
#if ((HAVE_LED && LED_GPIO_PORT == GPIOA && (LED_GPIO_PORT == GPIO13 || LED_GPIO_PORT == GPIO14)) || \
(HAVE_BUTTON && BUTTON_GPIO_PORT == GPIOA && (BUTTON_GPIO_PIN == GPIO13 || BUTTON_GPIO_PIN == GPIO14)) || \
(HAVE_USB_PULLUP_CONTROL && USB_PULLUP_GPIO_PORT == GPIOA && \
(USB_PULLUP_GPIO_PIN == GPIO13 || USB_PULLUP_GPIO_PIN == GPIO14)))
{
rcc_periph_clock_enable(RCC_AFIO);
gpio_primary_remap(AFIO_MAPR_SWJ_CFG_JTAG_OFF_SW_OFF, 0);
}
#endif

/* Setup LEDs */
#if HAVE_LED
Expand Down