Skip to content

Enabling std::function support for SAMD#113

Merged
thelsing merged 1 commit intothelsing:masterfrom
rueckix:patch-2020-samd-stdfunction
Dec 9, 2020
Merged

Enabling std::function support for SAMD#113
thelsing merged 1 commit intothelsing:masterfrom
rueckix:patch-2020-samd-stdfunction

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