I’m trying to get the obtain samples from the ADC from all channels (I am using 2 in this scenario), save them and then trigger an interrupt.
Here are my configurations for the ADC:
I then have HET1 PWM 0 enabled using pin 8, with duty cycle 50% and period 50us (I want to sample at this period) and enabled output direction for bit 8.
In my main:
adcInit();
adcResetFiFo(adcREG1, adcGROUP1);
adcEnableNotification(adcREG1, adcGROUP1);
adcStartConversion(adcREG1, adcGROUP1);
while(1) {}
I have the below functions defined, which I want to be called whenever all the samples are ready.
void saveADCSamples(adcData_t* self)
{
int i;
for(i = 0; i< NUM_ADC_CHANNELS; ++i){
// copy the samples into our buffer
self->value = (uint16) (adcREG1->GxBUF[adcGROUP1].BUF0 & 0xFFFU);
}
}
void adcNotification(adcBASE_t *adc, unsigned group)
{
adcREG1->GxINTFLG[1U] = 9U; // clear the interrupt flag
saveADCSamples(adc_data); // save the data
return ;
}
Currently, the adcNotification function is not being called. What could I be doing wrong?
Thanks!