Skip to content

Commit

Permalink
swd: Reclaim pins PA13 & PA14 for SWD.
Browse files Browse the repository at this point in the history
  • Loading branch information
keirf committed Apr 30, 2024
1 parent 7cc12ec commit 999733f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/gotek/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ uint8_t has_kc30_header;
#define kc30_sel_pin 2
#endif

#define CONFIG_SWD 1

/* Pull up currently unused and possibly-floating pins. */
static void gpio_pull_up_pins(GPIO gpio, uint16_t mask)
{
Expand Down Expand Up @@ -97,10 +99,12 @@ unsigned int board_get_buttons(void)
unsigned int board_get_rotary(void)
{
unsigned int x = 3;
#if !defined(CONFIG_SWD)
if ((mcu_package != MCU_QFN32) && (ff_cfg.chgrst != CHGRST_pa14)) {
/* Alternative location at PA13, PA14. */
x &= gpioa->idr >> 13;
}
#endif
if (mcu_package == MCU_LQFP64) {
/* Original rotary header at PC10, PC11. */
x &= gpioc->idr >> 10;
Expand All @@ -118,12 +122,14 @@ uint32_t board_rotary_exti_mask;
void board_setup_rotary_exti(void)
{
uint32_t m = 0;
#if !defined(CONFIG_SWD)
if ((mcu_package != MCU_QFN32) && (ff_cfg.chgrst != CHGRST_pa14)) {
/* Alternative location at PA13, PA14. */
exti_route_pa(13);
exti_route_pa(14);
m |= m(13) | m(14);
}
#endif
if (mcu_package == MCU_LQFP64) {
/* Original rotary header at PC10, PC11. */
exti_route_pc(10);
Expand Down Expand Up @@ -181,6 +187,11 @@ void board_init(void)
pa_skip |= 0x0600;
#endif

#if defined(CONFIG_SWD)
/* PA13-14 (SWD) */
pa_skip |= 0x6000;
#endif

/* PB0,4,9 (floppy inputs). */
pb_skip = 0x0211;

Expand Down

0 comments on commit 999733f

Please sign in to comment.