Toshik / TickerScheduler

Simple scheduler for ESP8266 Arduino based on Ticker
127 stars 42 forks source link

Is it possible to call a function with arguments? #4

Open pfabri opened 7 years ago

pfabri commented 7 years ago

In other words, must the callback function f be of the form f(void) or can it have arguments?

Many thanks for your help, neat library!

Toshik commented 7 years ago

For now there is no support for callback parameters. But it is in my TODO list :)

gmag11 commented 7 years ago

If std library can be used it would be possible. Bind() function is your friend. I do not know it it is possible with Arduino, with esp8266 it is. Look at this code https://gist.github.com/gmag11/bd3f845c3eba2543df04d6de93f0474f It is not exactly what you need but maybe you get what I mean.

janmir commented 7 years ago

Thanks for this really neat & useful library, one thing though I noticed it has a little typo that causes a compile time error. typedef std::function<void(void)> tscallback_t; should be typedef std::function<void(void*)> tscallback_t;

missing * on the param part.

Toshik commented 7 years ago

@janmir thanks for notice e945e55190e3aee905cb1e8484687d1092877301 fix