How to handle class function and interruption

Hi!

This is my first post, I found a "similar" question in this forum but it´s read-only now. Because of this, I´m opening the question again.
I´m a bit confused how to deal with interrupt and classes. I would like to do this for instance:
A class that deals with LED. In the constructor function, I would like to setup a timer and attach a callback function. My callback function needs to be static, right?
So, if I create 10 objects of this class to deal with 10 differents LEDs...I don´t know how to handle in the interrupt because I can´t access a class member.
In this case, I could try this approach: don´t setup an interruption in my class, create a generic interrupt callback function (outside the class) to do a tick and inside this function call the method for each object.
Am I in the right way??

Best regards

Am I in the right way?

I would say not. I don't think you can do what you want with a class. Just code what you want to do.

tpicon:
I would like to setup a timer and attach a callback function.

On an UNO there are only 3 timer interrupts you can get. So you might as well just copy the code three times or write out 3 copies of the same static class that each use different timer. It's not like you're ever going to have a whole bunch of these things.

tpicon:
In this case, I could try this approach: don´t setup an interruption in my class, create a generic interrupt callback function (outside the class) to do a tick and inside this function call the method for each object.
Am I in the right way??

Best regards

Yes, and you'll need static/global varaibles to hold the instances in question so they can be referenced from
a global context.