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

Dev callable2 #14

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

skimpax
Copy link

@skimpax skimpax commented Mar 5, 2021

Goal of this change is to be able to to plug a more evolved callback than the plain old function pointer.
It extends current usage by allowing using a lambda expression or a callable function object also.
This is very useful when using CronAlarms when the callback parameters are not know at compile time but at runtime only.

eg. to set several relays state, we need the relay pinId and the pinState. They can be read dynamically from a configuration file to set the alarm accordingly.

NOTE:
Your version is 0.1.0 is 2 years old and it lacks the fix regarding the constness (36c5e5b).
It would be appreciated that you deliver your current HEAD in a new version.

@ilhamikivrak
Copy link

There is no improvement of performance or feature. What if compiler does not support cpp11?

@skimpax
Copy link
Author

skimpax commented Apr 10, 2021

Indeed, there is no performance nor feature improvement, it just opens the uses cases of CronAlarms.
This relies on C++11, which is natively available on my dev environment (platform io).
Unfortunately, I am a new comer in Arduino and I do not use constrained AVR chips : I cannot pretend C++11 is available on all platforms targeted by Arduino.
To offer plain old function pointer (legacy) or callable, code must use #define depending on compiler version detected.

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