input: wire up third and fourth buttons
This commit is contained in:
11
src/input.c
11
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) {
|
||||
|
||||
Reference in New Issue
Block a user