-
Notifications
You must be signed in to change notification settings - Fork 13.3k
ISR in C++ class? #2941
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
it can not be used in C if done so. |
Not strictly true. Overloading the function and having one that takes a handler with the correct signature of a class method is very possible! |
#2745 comes pretty close to what you are probably looking for. It needs a bit if rework to avoid having to include an extra header file from the sketch. Also, I would like this more if such generic enhancements would be taken up to arduino/Arduino repo (or at least to the official arm and wifi101 cores). Introducing these features here will not help with compatibility, if same features are not present in the official arduino cores. |
can be included in CPP only if it's not going to clash with other code possibly running in C. |
The idea was to include above header under ifdef cplusplus block inside arduino.h. |
exactly what I meant by my first sentence :) |
I tried to put in Arduino.h but did not succeed in that. If you give me a hint/link on how to solve I will try again. |
Yep, including STL headers from Arduino.h is a pain, in part due to the fact that Arduino.h defines min and max as macros. It's probably time to figure out how to replace these macros with definitions from the STL (for the ifdef cplusplus case). |
Functional interrups has been merged. For Tickers, there is something equivalent, if not as pretty. |
@hreintke by the way, I think your FunctionalInterrupt code has a small and non-critical mem leak when you detach. This results from the call to new, which has no delete. |
A real pity it is not possible to create fully encapsulated functionality, as apparently Interrupt handlers cannot be class methods. Wouldn't this be a nice improvement to the platform?
----------------------------- Remove above -----------------------------
Basic Infos
Hardware
Hardware: ?ESP-12?
Core Version: ?2.1.0-rc2?
Description
Problem description
Settings in IDE
Module: ?Generic ESP8266 Module?
Flash Size: ?4MB/1MB?
CPU Frequency: ?80Mhz?
Flash Mode: ?qio?
Flash Frequency: ?40Mhz?
Upload Using: ?OTA / SERIAL?
Reset Method: ?ck / nodemcu?
Sketch
Debug Messages
The text was updated successfully, but these errors were encountered: