-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CHANGE option for attachInterrupt() is not implemented #463
Comments
I could be mistaken but it appears that every GPIO pin of the PIC32MX has individually selectable change notice interrupt capability. My only lack of clarity is if this is truly implemented on every GPIO pin of every processor but I suspect that it is. To use it though requires some pooling the interrupt flags in the interrupt to see which pin triggered it. |
Older MX chips ('795 and the like) have change notification on some pins, but not all. The newer ones have it on all pins. But CN is awkward to use as there is one ISR per port, not per pin, which adds overhead in working out what pin actually caused the interrupt. And on the older chips there's no direct relationship between CN number and pin number, so that has to be looked up in a table. Not always desirable when you want interrupts to respond quickly. |
So I was able to turn an edge triggered interrupt into a change interrupt by adding the following function to WInterrupts.c
Adding a prototype to wiring.h
The using the interrupt like this:
EDIT: Example code snip tested on a Fubarino Mini 2.0 |
This would be a nice addition to the core Jacob. Would you be willing to prepare a PR? |
If not, then maybe just edit the Fubarino Wiki with this example so that others can easily follow in your footsteps? |
So my issue has always been setting up a clean ways to commit changes to the core from Windows. Tonight I got the IDE setup on one of my Linux servers and I'm going to take a crack at it. Ultimately it would be nice to implement the CHANGE mode in the core and hide the details from the users. |
Theoretically you can also emulate CHANGE mode interrupts on ICx pins... |
chipKIT currently has no ability to trigger interrupts on CHANGE, only on RISING or FALLING (since that's all that the hardware supports). It might be possible to add support for CHANGE through software.
The text was updated successfully, but these errors were encountered: