From 1e18c1c695dc1824ace6dac2ed8d00f182b787ed Mon Sep 17 00:00:00 2001 From: Michael Karcher Date: Sat, 25 Oct 2025 18:06:22 +0200 Subject: [PATCH] Add support for AT32F435 on KC30 rev 1 Assuming the comment is correct that pre-KC30 boards have PF6/PH2 grounded, this allows to use the rotary encoder on KC30 Rev 1 boards that have been "upgraded" to a AT32F435. --- src/gotek/board.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/gotek/board.c b/src/gotek/board.c index 0a2f353cf..464688550 100644 --- a/src/gotek/board.c +++ b/src/gotek/board.c @@ -262,6 +262,18 @@ void board_init(void) has_kc30_header = 1; } gpio_configure_pin(gpiof, 7, GPI_floating); +#else + rcc->ahb1enr |= RCC_AHB1ENR_GPIOHEN; + gpio_configure_pin(gpioh, 2, GPI_pull_up); + delay_us(100); + if (gpio_read_pin(gpioh, 2) == HIGH) { + /* KC30 Rev 1. has "select" on PH2. Old boards + have this pin pulled low. As long as the user + doesn't press select during power-up, this allows + to recognize the board. */ + has_kc30_header = 1; + } + gpio_configure_pin(gpioh, 2, GPI_floating); #endif }