From e721465ce2d9cc89a2f1202f78003129b6e9b713 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Thu, 19 Jan 2023 14:46:49 +0800 Subject: [PATCH] lotus: Enable internal pull-up on ADC input Signed-off-by: Daniel Schaefer --- keyboards/lotus/matrix.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/keyboards/lotus/matrix.c b/keyboards/lotus/matrix.c index b71beddb5c..6b58c43ed5 100644 --- a/keyboards/lotus/matrix.c +++ b/keyboards/lotus/matrix.c @@ -169,7 +169,11 @@ void factory_trigger_adc(void) { */ void adc_gpio_init(int gpio) { assert(gpio >= GP26 && gpio <= GP28); - palSetLineMode(gpio, PAL_MODE_INPUT_ANALOG); + // Enable pull-up on GPIO input so that we always have high input + // Even on the rows that don't have the external pull-up. + // Otherwise they would be floating. + #define PAL_MODE_ADC_PULLUP (PAL_MODE_INPUT_ANALOG | PAL_RP_PAD_PUE) + palSetLineMode(gpio, PAL_MODE_ADC_PULLUP); } /**