void __attribute__((interrupt, auto_psv)) _DMA0Interrupt(void) { if (DmaBuffer == 0) time.process[PROCESS_ADC_SENSOR] = ProcessADCSamples(&BufferA); else time.process[PROCESS_ADC_SENSOR] = ProcessADCSamples(&BufferB); DmaBuffer ^= 1; IFS0bits.DMA0IF = 0; // Clear the DMA0 Interrupt Flag }
void __attribute__((interrupt, auto_psv)) _DMA0Interrupt(void) { if(DmaBuffer == 0) { ProcessADCSamples(BufferA); } else { ProcessADCSamples(BufferB); } DmaBuffer ^= 1; __builtin_btg((unsigned int *)&LATA, 6); // Toggle RA6 IFS0bits.DMA0IF = 0; //Clear the DMA0 Interrupt Flag }
unsigned int adc_get_channel(int i) { //printf("\r\n%u %u %u %u\r\n", BufferA[i][0], BufferB[i][7], BufferA[i][6], BufferB[i][7]); return ProcessADCSamples(&BufferA[i][0]) / 2 + ProcessADCSamples(&BufferB[i][0]) / 2; }