-
Notifications
You must be signed in to change notification settings - Fork 7.6k
attachInterrupt() callback methods with C++ class for ESP32? #965
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi, I am looking for the same information. @huming2207 Did you find something? |
I couldn't find a way to do this without static. I opted for a struct with methods instead and templates on the methods for instance specific params. It works pretty well for my usage. |
@atanisoft I do not know how to do what you mention, can you pass me some link that is explained with that? |
@ferchinas Here is how I am doing it today... This function: gets used for two ISRs by using the template parameter to pass in an index which points back to a struct which holds parameters for the ISR routine. The call to attach the ISR is here: https://github.com/atanisoft/DCCppESP32/blob/master/src/SignalGenerator.cpp#L225 The timers are used to generate a square wave with specific durations based on the data being fed into the dcc signal generator. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions. |
I would like to reopen this issue. |
Hi all,
I was very confused about this issue for a few hours. I've searched this issue but for AVR micro controllers, the callback method must be static, or some other tricky workarounds are needed. So I would like to ask that is there any better solutions for implementing non-static method as callback?
Regards,
Jackson
The text was updated successfully, but these errors were encountered: