summaryrefslogtreecommitdiff
path: root/common/button.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/button.c')
-rw-r--r--common/button.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/common/button.c b/common/button.c
index 1dcebae3bd..42d08c9baf 100644
--- a/common/button.c
+++ b/common/button.c
@@ -73,8 +73,14 @@ static int raw_button_pressed(const struct button_config *button)
int physical_value = 0;
int simulated_value = 0;
if (!(button->flags & BUTTON_FLAG_DISABLED)) {
- physical_value = (!!gpio_get_level(button->gpio) ==
+ if (IS_ENABLED(CONFIG_ADC_BUTTONS) &&
+ button_is_adc_detected(button->gpio)) {
+ physical_value =
+ adc_to_physical_value(button->gpio);
+ } else {
+ physical_value = (!!gpio_get_level(button->gpio) ==
!!(button->flags & BUTTON_FLAG_ACTIVE_HIGH));
+ }
#ifdef CONFIG_SIMULATED_BUTTON
simulated_value = simulated_button_pressed(button);
#endif