Commit e9207f05 authored by Erik Strand's avatar Erik Strand

Call initADC in setup instead of analogRead

parent a24c874a
......@@ -29,11 +29,6 @@ uint32_t bm_analogRead( uint32_t pin )
{
uint32_t valueRead = 0;
// Uses a variable outside this translation unit
//if (!ADCinitialized) {
// initADC();
//}
// pinPeripheral now handles disabling the DAC (if active)
if ( pinPeripheral(pin, PIO_ANALOG_ADC) == RET_STATUS_OK )
{
......@@ -54,8 +49,9 @@ void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(LED_GREEN, OUTPUT);
// Calling the regular method once ensures that the ADC does get initialized.
analogRead(SENSE_LINE_0);
// Initialize the ADC
initADC();
// Selection for the positive ADC input
ADC->INPUTCTRL.bit.MUXPOS = GetADC(SENSE_LINE_0);
......@@ -64,7 +60,6 @@ void setup() {
// Enable ADC
ADC->CTRLA.bit.ENABLE = 0x01;
syncADC();
}
void loop() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment