To the TimerOne developers

Is it possible to implement a member pointer in the TimerOne library?
Something similar to

WIGANDTIMER.attachInterrupt(this, &Wiegand::Wiegand2D1Read);

instead of

WIGANDTIMER.attachInterrupt(&OnTWiegand);

I'm not the developer, but everything is possible, you have the source code.

would help possibly if you were explaining what you would get from this feature request.

I need to use the TimerOne library in a class and I need to pass as pointer a member of my class. Now I can pass as pointer only a function outside a class.

But to what should that this point?

I don't get it, the attachInterrupt() method just accepts one parameter, the function to call. What do you want to do with the second parameter?

septillion:
I don't get it, the attachInterrupt() method just accepts one parameter, the function to call.

What am I missing? The signature from the reference library is:

attachInterrupt(digitalPinToInterrupt(pin), ISR, mode);

You are missing we are talking about a method of the TimerOne library :wink: Not plain attachInterrupt()

Now I can pass as pointer only a function outside a class.

Not true. You can pass a pointer to a member of your class, IF the member is static.

Given that there is only one timer 1, it is unlikely that there will be multiple instances of the class, but the fact that there can be multiple instances of a class is why callback functions can not be non-static member functions. How would the function that is calling the callback know which instance of the class to call the method for?

But I don't want to make it static. Is it possible to add this features?

Is it possible to add this features?

You have the source code. Go right ahead and try.

septillion:
You are missing we are talking about a method of the TimerOne library :wink: Not plain attachInterrupt()

I'm still dense on this. The signature in the TimerOne header file is:

void attachInterrupt(void (*isr)(), long microseconds=-1);

Yeah, I see. I only looked at the summary page and that didn't mention the two-parameter version. The two-paramter version is nothing more then a attachInterrupt() and a setPeriod() in one.

But I still don't get what the TS wants to do with the extra parameter.

Ow, and long life the tons of different versions of the library :smiley: