I have quite a few libraries for motion control that require callbacks for things like PID updates, encoder interrupts, etc. It appears there is no really "clean" way to hook these to the interrupts, other than having the sketch do it, as it appears not possible to get a pointer to a non-static member function. I currently get around this by providing a SetCallback(int interval, void(*handler)()) method in the library that the sketch must invoke to create a timer callback, passing a pointer to the sketch-level interrupt handler that does nothing more than call the update handler in the library. This works fine, but seems a bit "klunky". Is there a way to have the library setup its own interrupt handler?
Regards, Ray L.