File tree Expand file tree Collapse file tree 1 file changed +2
-1
lines changed
cores/arduino/ard_sup/analog Expand file tree Collapse file tree 1 file changed +2
-1
lines changed Original file line number Diff line number Diff line change @@ -122,10 +122,10 @@ static const uint8_t outcfg_tbl[32][4] =
122122uint16_t _analogBits = 10 ; // 10-bit by default
123123uint8_t _analogWriteBits = 8 ; // 8-bit by default for writes
124124uint8_t _servoWriteBits = 8 ; // 8-bit by default for writes
125+ static bool ap3_adc_initialized = false ; // flag to show if the ADC has been initialized
125126
126127uint16_t analogRead (uint8_t pinNumber)
127128{
128- static bool ap3_adc_initialized = false ;
129129 if (!ap3_adc_initialized){
130130 ap3_adc_setup ();
131131 ap3_adc_initialized = true ;
@@ -242,6 +242,7 @@ bool power_adc_disable()
242242 return (false );
243243 }
244244
245+ ap3_adc_initialized = false ; // The adc will be reinitialized by the next analogRead
245246 g_ADCHandle = NULL ;
246247 return (true );
247248}
You can’t perform that action at this time.
0 commit comments