Hi Simon,
OK, I've come back to this after some delay and I'm sorry to say that no, it hasn't cleared it up for me. The basic problem is that you have described how to call a .attach() function as a user. That I understand, always have. What I don't understand is how to store and use them.
To put it another way, I am writing a library. Other users will call my .attach method. How do I then store these two values in my class and, more importantly, how do I make a call to these methods from an extern "C" ISR? How does the C portion of an ISR resolve those two pieces of information into a callable address at runtime?
I've managed to do al of this using straight C function pointers without any problems. It's the class::method that I'm struggling with. All I've found from Google is that trying to resolve a "function address" of a class/method that a C function can call at runtime, well, not really an option.
Everyone knows that C++ can call C libraries using the extern "C" declaration, it's the opposite of this I'm trying to do and still can't see it.
I know you guys are not about to publish the source code for your Mbed libraries (I'm not even going to go down that road) but what would be useful is you publish, say, a cut down version of Ticker that shows (a) how you store the args passed to .attach() and then (b) how the ISR invokes that class/method when the interrupt occurs.
Help us "stand on the shoulders of giants" by publishing a "giant example" please :) (yes, I read Elektor too)
How does one attach a class method instead of a void (*fptr2)(void) static function? Like to the Ticker
Thanks Jason