Sorry, laziness on my part. I meant PCintPort::attachInterrupt() and PCintPort::detachInterrupt()
Not intending to be attaching and detaching continually. Just wanted to hide the low level configuration from the end user of a library, so that the attaching is not done in the top sketch. I suppose I could define a preprocessor macro in the library header file, which then gets put in the top sketch, and expanded when the PCintPort methods are in the compiler scope.
Point taken about the $5 chip though...
Thanks for your input.
In the header of the PinChangeInt.h file, I write:
The library has been modified so it can be used in other libraries, such as my AdaEncoder library
). When #include'd by another library you should #define
the LIBCALL_PINCHANGEINT macro. For example:
This is necessary because the IDE compiles both your sketch and the .cpp file of your library, and
the .h file is included in both places. But since the .h file actually contains the code, any variable
or function definitions would occur twice and cause compilation errors- unless #ifdef'ed out.
Hopefully that helps. See http://code.google.com/p/arduino-pinchangeint/wiki/Usage#Use_from_Another_Library