mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-17 22:23:10 +03:00
[sam] Fixed regression in analogRead() (fails to read multiple channels)
Fixes #1740
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user