-
Notifications
You must be signed in to change notification settings - Fork 1k
Added ability to bind std:function on interrupts #159
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
Conversation
The function attachInterrupt now also accept std:function<void(void)> in order to bind object method to an interrupt.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks interesting, can you provide a usage example in the commit message or in the comment above new attachInterrupt function ?
considering code: please consider removing the // and simply remove the lines ?
@straccio thanks for submitting the PR :-) ! |
Sure!
|
Is backward compatible. I currently use something like this in Arduino Due. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me (1 comment remains ..)
Good! If you remember others sources that use callbacks please tell me, i can do these changes also to them. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still some comment to remove.
Please, when done squash all commit in one.
You could also add your Signed-off-by: in the commit message.
Note:
Build for all variants with success (with c call and C++)
And thanks for this PR ;)
Thank you very much! |
* Added ability to bind std:function on interrupts The function attachInterrupt now also accept std:function<void(void)> in order to bind object method to an interrupt.
The function attachInterrupt now also accept std:function<void(void)> in order to bind object method to an interrupt.