diff --git a/build/shared/revisions.txt b/build/shared/revisions.txt index 28022ccbc..24b5a162d 100644 --- a/build/shared/revisions.txt +++ b/build/shared/revisions.txt @@ -10,7 +10,7 @@ ARDUINO 1.5.6 BETA [core] * sam: Fixed wrap-around bug in delay() (Mark Tillotson) -* sam: Fixed regression in analogRead() (fails to read multiple channels) +* sam: Fixed regression in analogRead() (fails to read multiple channels) (Mark Tillotson) ARDUINO 1.5.5 BETA 2013.11.28 diff --git a/hardware/arduino/sam/cores/arduino/wiring_analog.c b/hardware/arduino/sam/cores/arduino/wiring_analog.c index 184220f9e..ffdc4e2f0 100644 --- a/hardware/arduino/sam/cores/arduino/wiring_analog.c +++ b/hardware/arduino/sam/cores/arduino/wiring_analog.c @@ -149,9 +149,9 @@ uint32_t analogRead(uint32_t ulPin) // Enable the corresponding channel if (ulChannel != latestSelectedChannel) { + adc_enable_channel( ADC, ulChannel ); if ( latestSelectedChannel != -1 ) adc_disable_channel( ADC, latestSelectedChannel ); - adc_enable_channel( ADC, ulChannel ); latestSelectedChannel = ulChannel; }