stm32: Automatically disable SWD if PA13/PA14 is used on stm32f103

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2019-08-05 11:33:21 -04:00
parent 664c869f77
commit 3d0f7188df
1 changed files with 4 additions and 0 deletions

View File

@ -85,6 +85,10 @@ gpio_peripheral(uint32_t gpio, uint32_t mode, int pullup)
regs->BSRR = 1 << pos; regs->BSRR = 1 << pos;
else if (pullup < 0) else if (pullup < 0)
regs->BSRR = 1 << (pos + 16); regs->BSRR = 1 << (pos + 16);
if (gpio == GPIO('A', 13) || gpio == GPIO('A', 14))
// Disable SWD to free PA13, PA14
AFIO->MAPR = AFIO_MAPR_SWJ_CFG_DISABLE;
} }
// Main clock setup called at chip startup // Main clock setup called at chip startup