From b5fb2372fbc6fa17544585885fab37a42d135fb4 Mon Sep 17 00:00:00 2001 From: Puck Meerburg Date: Fri, 6 Feb 2026 17:53:52 +0000 Subject: [PATCH] input: wire up third and fourth buttons --- src/input.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/input.c b/src/input.c index 163ef25..35743a9 100644 --- a/src/input.c +++ b/src/input.c @@ -32,6 +32,13 @@ void TMR3_IRQHandler(void) { ADC_ChannelCfg(1); last_battery_value[last_battery_index++] = ADC_ExcutSingleConver(); if (last_battery_index >= 24) last_battery_index = 0; + + #if BUTTON_COUNT == 4 + ADC_ChannelCfg(3); + uint16_t aux_button_value = ADC_ExcutSingleConver(); + handle_button(3, (aux_button_value < 0xf00) && (aux_button_value > 0x400)); + handle_button(2, aux_button_value < 0x100); + #endif } void button_init(void) @@ -54,6 +61,10 @@ void button_init(void) ADC_ChannelCfg(1); GPIOA_ModeCfg(GPIO_Pin_0, GPIO_ModeIN_PU); GPIOA_ModeCfg(GPIO_Pin_2, GPIO_ModeIN_PD); + + #if BUTTON_COUNT == 4 + GPIOA_ModeCfg(GPIO_Pin_13, GPIO_ModeIN_Floating); + #endif } int get_battery_percentage(void) {