Hello
I have an arduino DUE, and I want to activate interrupt on several pins, but use same function as the ISR. How can I detect which pin cause the interrupt form inside the ISR once is activated?
Thank you
Hello
I have an arduino DUE, and I want to activate interrupt on several pins, but use same function as the ISR. How can I detect which pin cause the interrupt form inside the ISR once is activated?
Thank you
Each PIO has an interrupt handler. For example, implementing
void PIOA_Handler(void) {}
in your sketch causes this function to be called when any (interrupt enabled) pin associated to PIOA fires.
So within this handler to determine which pin fired, you read the ISR register of the PIO. Example:
uint32_t isr = PIOA->PIO_ISR;
In fact you must read this register to clear the interrupt. You can tell which pin caused the interrupt by checking the corresponding bit in PIO_ISR.
Doug