Skip to content

Commit f4c3273

Browse files
author
Owen
authored
Updates to ap3_adc_initialized (#122)
Updates to ap3_adc_initialized
2 parents 5b00320 + a811966 commit f4c3273

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cores/arduino/ard_sup/analog/ap3_analog.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,10 @@ static const uint8_t outcfg_tbl[32][4] =
122122
uint16_t _analogBits = 10; //10-bit by default
123123
uint8_t _analogWriteBits = 8; // 8-bit by default for writes
124124
uint8_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

126127
uint16_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
}

0 commit comments

Comments
 (0)