File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -150,12 +150,12 @@ uint32_t analogRead(uint32_t ulPin)
150150 case ADC11 :
151151
152152 // Enable the corresponding channel
153- if (ulChannel != latestSelectedChannel ) {
154- adc_enable_channel ( ADC , ulChannel );
155- if ( latestSelectedChannel != (uint32_t )-1 )
156- adc_disable_channel ( ADC , latestSelectedChannel );
157- latestSelectedChannel = ulChannel ;
153+ // Enable the corresponding channel
154+ adc_enable_channel ( ADC , ulChannel );
155+ if (ulChannel != latestSelectedChannel && latestSelectedChannel != (uint32_t )-1 ) {
156+ adc_disable_channel ( ADC , latestSelectedChannel );
158157 }
158+ latestSelectedChannel = ulChannel ;
159159
160160 // Start the ADC
161161 adc_start ( ADC );
@@ -167,7 +167,6 @@ uint32_t analogRead(uint32_t ulPin)
167167 // Read the value
168168 ulValue = adc_get_latest_value (ADC );
169169 ulValue = mapResolution (ulValue , ADC_RESOLUTION , _readResolution );
170-
171170 break ;
172171
173172 // Compiler could yell because we don't handle DAC pins
You can’t perform that action at this time.
0 commit comments