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:
parent
8f5c15d4dc
commit
c95209bf7a
|
@ -49,6 +49,9 @@ gpio_adc_setup(uint8_t pin)
|
||||||
| ADC_MR_STARTUP_SUT768
|
| ADC_MR_STARTUP_SUT768
|
||||||
| ADC_MR_TRANSFER(1));
|
| ADC_MR_TRANSFER(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Place pin in input floating mode
|
||||||
|
gpio_in_setup(pin, 0);
|
||||||
return (struct gpio_adc){ .chan = 1 << chan };
|
return (struct gpio_adc){ .chan = 1 << chan };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue