From b530742603439c87a06d2da9ddd60dd9f82f5082 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Tue, 17 Dec 2013 22:51:57 +0100 Subject: [PATCH] [sam] Fixed regression in analogRead() (fails to read multiple channels) (Mark Tillotson) See #1740 #1634 http://forum.arduino.cc/index.php?topic=203322.msg1509907#msg1509907 --- build/shared/revisions.txt | 2 +- hardware/arduino/sam/cores/arduino/wiring_analog.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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; }