new Arduino ESP8266 timer library to call class methods / std functions

130 views
Skip to first unread message

phil bowles

unread,
Oct 19, 2017, 7:28:35 AM10/19/17
to devel...@arduino.cc
Dear all,

I'm not sure if this is the right place to post this (I have already put it on the Arduino forum) but it might be useful / interesting to some of you...I'm sure you will let me know if I'm wrong...

Allow me to introduce "H4" a new library for calling class methods, std::functions and "normal" functions on timer events.

It extends the Ticker library and adds functionality to call functions on random events and / or a fixed number of times. It also allows "chaining" of functions so that a second function can be called on completion of the first (which can then initiate another timer event...and so on).

Most importantly it serialises all asynchronous events into a queue which is protected by a mutex and thus it reduces, minimises and even removes many common realtime programming problems (WDT resets etc). If used carefully, it completely removes the need to call delay() - which is the cause of many "newbie" nightmares.

It includes four worked examples showing the great flexibility that can be achieved and the ease and robustness with which "background" tasks can be run.

https://github.com/philbowles/h4

feedback welcome, of course!

Phil

Virus-free. www.avast.com
Reply all
Reply to author
Forward
0 new messages