Skip to content

Commit 604e459

Browse files
author
Owen L - SFE
committed
change method of clearing ADC interrupt
first get any active interrupts into the interrupt mask
1 parent efb0bda commit 604e459

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
@@ -131,7 +131,7 @@ uint16_t analogRead(uint8_t pinNumber)
131131
ap3_adc_initialized = true;
132132
}
133133

134-
uint32_t ui32IntMask = 0xff;
134+
uint32_t ui32IntMask;
135135
am_hal_adc_sample_t Sample;
136136
uint32_t ui32NumSamples = 1;
137137

@@ -174,6 +174,7 @@ uint16_t analogRead(uint8_t pinNumber)
174174
ap3_change_channel(padNumber); //Point ADC channel at this pad
175175

176176
// Clear the ADC interrupt.
177+
am_hal_adc_interrupt_status(g_ADCHandle, &ui32IntMask, false);
177178
if (AM_HAL_STATUS_SUCCESS != am_hal_adc_interrupt_clear(g_ADCHandle, ui32IntMask))
178179
{
179180
//Serial.println("Error clearing ADC interrupt status");

0 commit comments

Comments
 (0)