Hello, I have been maintaining the PinChangeInt library for some time. Recently I decided to rewrite it and one idea I have is to create an interrupt library that encompasses all of External, Pin Change, and ARM (which are neither External nor Pin Change) interrupt types. My idea is to have a single API so that one could assign an interrupt to any pin capable of supporting them, in the same way on all Arduino chips.
The primary issue, the fly in the ointment, if you will, are the Pin Change Interrupts. These are problematic by their nature. The pin change interrupts on the ATmega chips act only on change of signal (either rising or falling), and they trigger when any pin on a port (== up to 8 pins) is triggered. If you want to determine which pin actually triggered, a library must survey the pins to figure out which one(s) changed, how they had changed, and whether or not we are interested. Tt takes an appreciable amount of time from the moment the triggering event happened to when we enter the interrupt subroutine (ISR) and go through the logic to figure out which pin did the triggering... generally, about 2-3 microseconds.
By presenting Pin Change Interrupts as just another type of interrupt, either
- People are smart enough to figure out what's going on and understand the consequences, or
- This creates a situation where the library presents results that are not in tune with reality, which may be dangerous.
I have been using the Pin Change interrupts and am quite happy with my libraries, but I'm not clear that my plans would be useful to the community. Hence, the survey. Thank you.