mirror of
https://github.com/arduino/Arduino.git
synced 2024-11-29 10:24:12 +01:00
[sam] Fixed regression in analogRead() (fails to read multiple channels)
Fixes #1740
This commit is contained in:
parent
2e7b645571
commit
a1c4809105
@ -10,6 +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)
|
||||
|
||||
ARDUINO 1.5.5 BETA 2013.11.28
|
||||
|
||||
|
@ -149,8 +149,10 @@ uint32_t analogRead(uint32_t ulPin)
|
||||
|
||||
// Enable the corresponding channel
|
||||
if (ulChannel != latestSelectedChannel) {
|
||||
adc_enable_channel( ADC, ulChannel );
|
||||
latestSelectedChannel = ulChannel;
|
||||
if ( latestSelectedChannel != -1 )
|
||||
adc_disable_channel( ADC, latestSelectedChannel );
|
||||
adc_enable_channel( ADC, ulChannel );
|
||||
latestSelectedChannel = ulChannel;
|
||||
}
|
||||
|
||||
// Start the ADC
|
||||
@ -164,9 +166,6 @@ uint32_t analogRead(uint32_t ulPin)
|
||||
ulValue = adc_get_latest_value(ADC);
|
||||
ulValue = mapResolution(ulValue, ADC_RESOLUTION, _readResolution);
|
||||
|
||||
// Disable the corresponding channel
|
||||
//adc_disable_channel(ADC, ulChannel);
|
||||
|
||||
break;
|
||||
|
||||
// Compiler could yell because we don't handle DAC pins
|
||||
|
Loading…
Reference in New Issue
Block a user