Skip to content
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

Enabling std::function support for SAMD #113

Merged
merged 1 commit into from
Dec 9, 2020

Conversation

rueckix
Copy link
Contributor

@rueckix rueckix commented Dec 6, 2020

Addressing: #109

This is quite useful when using callbacks on group objects. When modelling a device as a class, the callback is typically a non-static member function that cannot be passed as a regular function pointer.
An elegant solution is to combined std::bind with std::function to register a member function of a specific class object.

Implications
The change is simple but including STL headers conflicts with the definition of max and min macros in the arduino framework for SAMD. This should be fixed in arduino/ArduinoCore-samd#399 but not released.

Per interim, bits.h is changed to do a conditional

#undef max
#undef min

@thelsing thelsing merged commit 8405d1f into thelsing:master Dec 9, 2020
@thelsing
Copy link
Owner

thelsing commented Dec 9, 2020

Merged thanks.

@rueckix rueckix deleted the patch-2020-samd-stdfunction branch January 7, 2021 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants