File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
hardware/arduino/sam/cores/arduino Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ ARDUINO 1.5.6 BETA
1010
1111[core]
1212* sam: Fixed wrap-around bug in delay() (Mark Tillotson)
13+ * sam: Fixed regression in analogRead() (fails to read multiple channels)
1314
1415ARDUINO 1.5.5 BETA 2013.11.28
1516
Original file line number Diff line number Diff line change @@ -149,8 +149,10 @@ uint32_t analogRead(uint32_t ulPin)
149149
150150 // Enable the corresponding channel
151151 if (ulChannel != latestSelectedChannel ) {
152- adc_enable_channel ( ADC , ulChannel );
153- latestSelectedChannel = ulChannel ;
152+ if ( latestSelectedChannel != -1 )
153+ adc_disable_channel ( ADC , latestSelectedChannel );
154+ adc_enable_channel ( ADC , ulChannel );
155+ latestSelectedChannel = ulChannel ;
154156 }
155157
156158 // Start the ADC
@@ -164,9 +166,6 @@ uint32_t analogRead(uint32_t ulPin)
164166 ulValue = adc_get_latest_value (ADC );
165167 ulValue = mapResolution (ulValue , ADC_RESOLUTION , _readResolution );
166168
167- // Disable the corresponding channel
168- //adc_disable_channel(ADC, ulChannel);
169-
170169 break ;
171170
172171 // Compiler could yell because we don't handle DAC pins
You can’t perform that action at this time.
0 commit comments