atsam: ADC pins need to be in input mode with pullups disabled

The ADC pins (on at least the sam3x8e) need to be configured in input
mode with the internal pullups disabled in order to get accurate ADC
readings.

Reported by @bryanboettcher.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2019-08-28 13:45:01 -04:00
parent 8f5c15d4dc
commit c95209bf7a
1 changed files with 3 additions and 0 deletions

View File

@ -49,6 +49,9 @@ gpio_adc_setup(uint8_t pin)
| ADC_MR_STARTUP_SUT768
| ADC_MR_TRANSFER(1));
}
// Place pin in input floating mode
gpio_in_setup(pin, 0);
return (struct gpio_adc){ .chan = 1 << chan };
}