KurtE
Senior Member+
Each time I read this thread, I am still wondering what exactly are you trying to accomplish?
Are you trying to completely emulate the current code? If so you should probably just use the current code...
Or are you finding that the current code has more overhead than you want or???
If you are wanting the fastest possible and you can arrange your setup such that you know only your pin will be the only pin on that port that will have in interrupt vector assigned to it,
Then you can simply use the attachInterruptVector call, like:
Then your function is called for any interrupt that happens on PORTC.
Warning your function needs to clear that status, or it will be called again and again...
This is why in the old version of the functions that Paul linked to:
The two lines marked in RED are important. The first line retrieves the bit mask of which interrupt pin actually happened, which is used with the testing of bits to call off to the other functions.
But the 2nd line of function is also important. By writing those bits back to the register clear out that interrupt status.
But again nut sure exactly where you are going with this.
As for CORE_NUM_DIGITAL - Yes this is the total number of digital pins as per model type.
Yes that is the standard definition of a function pointer that the function takes no parameters and returns no value...
Are you trying to completely emulate the current code? If so you should probably just use the current code...
Or are you finding that the current code has more overhead than you want or???
If you are wanting the fastest possible and you can arrange your setup such that you know only your pin will be the only pin on that port that will have in interrupt vector assigned to it,
Then you can simply use the attachInterruptVector call, like:
Code:
attachInterruptVector(IRQ_PORTC, &My_ISR);
Then your function is called for any interrupt that happens on PORTC.
Warning your function needs to clear that status, or it will be called again and again...
This is why in the old version of the functions that Paul linked to:
Code:
void portc_isr(void)
{
// TODO: these are inefficent. Use CLZ somehow....
[COLOR="#FF0000"]uint32_t isfr = PORTC_ISFR;
PORTC_ISFR = isfr;[/COLOR]
if ((isfr & CORE_PIN9_BITMASK) && intFunc[9]) intFunc[9]();
if ((isfr & CORE_PIN10_BITMASK) && intFunc[10]) intFunc[10]();
if ((isfr & CORE_PIN11_BITMASK) && intFunc[11]) intFunc[11]();
if ((isfr & CORE_PIN12_BITMASK) && intFunc[12]) intFunc[12]();
if ((isfr & CORE_PIN13_BITMASK) && intFunc[13]) intFunc[13]();
if ((isfr & CORE_PIN15_BITMASK) && intFunc[15]) intFunc[15]();
if ((isfr & CORE_PIN22_BITMASK) && intFunc[22]) intFunc[22]();
if ((isfr & CORE_PIN23_BITMASK) && intFunc[23]) intFunc[23]();
if ((isfr & CORE_PIN27_BITMASK) && intFunc[27]) intFunc[27]();
if ((isfr & CORE_PIN28_BITMASK) && intFunc[28]) intFunc[28]();
if ((isfr & CORE_PIN29_BITMASK) && intFunc[29]) intFunc[29]();
if ((isfr & CORE_PIN30_BITMASK) && intFunc[30]) intFunc[30]();
}
But the 2nd line of function is also important. By writing those bits back to the register clear out that interrupt status.
But again nut sure exactly where you are going with this.
As for CORE_NUM_DIGITAL - Yes this is the total number of digital pins as per model type.
Yes that is the standard definition of a function pointer that the function takes no parameters and returns no value...