i'm looking for a way to stop the ADC continuous mode as soon as the conversion ends, in my situation is, when the ADC_complete() ISR function is called.
this is my code:
Code: Select all
// functions
void ARDUINO_ISR_ATTR vAdc_continous_complete_isr_fn(){
// stop ADC continous until the next cycle
analogContinuousStop();
bAdcResultReady_flag = true;
}
void setup() {
// Serial port config
Serial.begin(115200);
// ADC configuration
analogContinuousSetWidth(12);
analogContinuousSetAtten(ADC_11db);
uint8_t pu8AdcPins[] = {34};
size_t xNbrAdcPins = sizeof(pu8AdcPins)/sizeof(uint8_t);
analogContinuous(pu8AdcPins, xNbrAdcPins, 10, 20000, &vAdc_continous_complete_isr_fn);
// Start ADC Continuous conversions
delay(2000);
analogContinuousStart();
}
void loop() {
if(bAdcResultReady_flag){
bAdcResultReady_flag = false;
Serial.println("ADC completed");
// start it again for new cycle
analogContinuousStart();
delay(10000);
}
}
assert failed: xQueueGiveFromISR queue.c:1311 (!( ( pxQueue->pcHead == ((void *)0) ) && ( pxQueue->u.xSemaphore.xMutexHolder != ((void *)0) ) ))
Backtrace: 0x4008207d:0x3ffbf06c |<-CORRUPTED
wheni i remove "analogContinuousStop();" from ISR function, it works fine.
Can someone tell me, why the function can't be called from ISR and what is the alternative solution to stop the ADC continuous from ISR function?
Thank you.