lotus: Enable internal pull-up on ADC input

Signed-off-by: Daniel Schaefer <dhs@frame.work>
This commit is contained in:
Daniel Schaefer 2023-01-19 14:46:49 +08:00
parent 738be6b515
commit e721465ce2

View File

@ -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);
}
/**