-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Add support for function objects in attachInterrupt #1925
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
Like to use this functionality within my application and willing to give it a try creating a PR for this. |
i've working on something like this, pin change interrupts with an optional cargo, https://github.com/neu-rah/PCINT |
See #2745 |
Wow. Did this ever get into the core? This is a very cool idea. |
Hi: NodeMCU V1.0 GwiModules.h
GwiModules.cpp
|
Did you #include "FunctionalInterrupts.h"?
…On Aug 31, 2017 3:08 PM, "ferchinas" ***@***.***> wrote:
Hi:
I am trying to attach a method of my class to attend a Gpio interrupt. But
I get the following error:
GwiModules.cpp: 283:122: error: cannot convert 'std::_Bind_helper<false,
void (GwiManual::*)(char), GwiManual* const, int>::type {aka
std::_Bind<std::_Mem_fn<void (GwiManual::*)(char)>(GwiManual*, int)>}' to
'void (*)()' for argument '2' to 'void attachInterrupt(uint8_t, void (*)(),
int)
NodeMCU V1.0
Arduino IDE V1.8.3
Arduino/Esp8266 V2.3
GwiModules.h
class GwiManual : public Controls
{
protected:
void event(void);
public:
GwiManual();
void enable(void);
};
GwiModules.cpp
GwiManual::GwiManual() {
...
}
void GwiManual::event(void) {
...
}
void GwiManual::enable(void) {
...
attachInterrupt(13, std::bind(&GwiManual::event,this), CHANGE
}
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1925 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AQC6BgL_I0PvX2yoXxl0bhdEUd4vV2V_ks5sdvaCgaJpZM4IJHxf>
.
|
I did not include it, but thanks to your message I discovered that this information is for the development version. |
Read using git version on readthedocs. You have to delete the stable core
dir to make sure the git is picked up.
…On Sep 1, 2017 1:13 PM, "ferchinas" ***@***.***> wrote:
I did not include it, but thanks to your message I discovered that this
information is for the development version.
I can not find how to install it in the IDE, only found for stable version.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1925 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AQC6BqeAmGAn1g2v7q73n3iuyqt7DicFks5seC0qgaJpZM4IJHxf>
.
|
Finally get it installed and tested, it works very well, thank you very much for the help. |
@igrr the relevant PR is already merged. Should this be closed, or left open with label staged-for-release, or something else? |
shouldnt you also show the state change not just the pin itself? some people might want to check rising and falling edges, not just changes, if a state was returned the user wouldnt need to call digitalRead when the interrupt fires to know whether the pin changed high or low as well |
This is already implemented via #2745 . |
Allow something like
and
without breaking usage of attachInterrupt from C code.
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: