File tree 1 file changed +4
-5
lines changed
1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -149,8 +149,10 @@ uint32_t analogRead(uint32_t ulPin)
149
149
150
150
// Enable the corresponding channel
151
151
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 ;
154
156
}
155
157
156
158
// Start the ADC
@@ -164,9 +166,6 @@ uint32_t analogRead(uint32_t ulPin)
164
166
ulValue = adc_get_latest_value (ADC );
165
167
ulValue = mapResolution (ulValue , ADC_RESOLUTION , _readResolution );
166
168
167
- // Disable the corresponding channel
168
- //adc_disable_channel(ADC, ulChannel);
169
-
170
169
break ;
171
170
172
171
// Compiler could yell because we don't handle DAC pins
You can’t perform that action at this time.
0 commit comments