ESP-LiveControl
1.99.1
HTTP server, AJAX API backend and Vue.js web application implementing self-contained, zero-install WiFi remote control of hardware modules attached to the Espressif ESP32 SoC
|
Same as MultiTimer but allows a pointer to a non-static member function as a callback. More...
#include <multi_timer.hpp>
Public Types | |
using | mem_func_ptr_t = void(TClass::*)() |
using | mem_func_ptr_with_count_t = void(TClass::*)(uint32_t) |
![]() | |
template<class T > | |
using | type_identity_t = typename type_identity< T >::type |
using | callback_with_arg_and_count_t = void(*)(void *, uint32_t) |
Public Member Functions | |
esp_err_t | attach_mem_func_ptr_ms (uint32_t milliseconds, uint32_t total_repeat_count, mem_func_ptr_t mem_func_ptr, TClass *inst, bool first_tick_nodelay=false) |
Same as attach_static_ms() but taking a pointer to a non-static member function as a callback, see class description. More... | |
esp_err_t | attach_mem_func_ptr_ms (uint32_t milliseconds, uint32_t total_repeat_count, mem_func_ptr_with_count_t mem_func_ptr, TClass *inst, bool first_tick_nodelay=false) |
![]() | |
template<typename TArg > | |
esp_err_t | attach_static_ms (uint32_t milliseconds, uint32_t total_repeat_count, void(*callback)(type_identity_t< TArg >, uint32_t), TArg arg, bool first_tick_nodelay=false) |
Attach a free function, static member function or a non-capturing lambda function to the timer. More... | |
template<typename TArg > | |
esp_err_t | attach_static_ms (uint32_t milliseconds, uint32_t total_repeat_count, void(*callback)(type_identity_t< TArg >), TArg arg, bool first_tick_nodelay=false) |
esp_err_t | attach_static_ms (uint32_t milliseconds, uint32_t total_repeat_count, callback_t callback, bool first_tick_nodelay=false) |
void | start () |
void | start (uint32_t interval_ms) |
void | stop () |
esp_err_t | stop_return_errors () |
void | pause () |
esp_err_t | pause_return_errors () |
void | resume () |
esp_err_t | resume_return_errors () |
Protected Attributes | |
mem_func_ptr_t | _mem_func_ptr |
![]() | |
uint32_t | _interval_ms |
uint32_t | _repeat_count_requested {1} |
uint32_t | _repeat_count {0} |
callback_t | _callback |
uint32_t | _orig_arg {0} |
callback_with_arg_t | _cb_lambda {nullptr} |
bool | _first_tick_nodelay {false} |
SemaphoreHandle_t | _reentry_mutex = NULL |
Additional Inherited Members | |
![]() | |
esp_err_t | _attach_ms (uint32_t arg) |
void | _mutex_take () |
void | _mutex_give () |
Same as MultiTimer but allows a pointer to a non-static member function as a callback.
For this to work without the overhead of a std::function object, the MultiTimerNonStatic object must be created with an additional template argument specifying the type of the object from which to call the non-static member function:
|
inline |
Same as attach_static_ms() but taking a pointer to a non-static member function as a callback, see class description.
Like for the static version, the member function can have an additional argument containing the current number of times the callback was called.
milliseconds | Timer interval in milliseconds |
total_repeat_count | Timer is stopped after this many repeats |
mem_func_ptr | Pointer to a bound, non-static member function |
inst | Pointer to the class instance the mem_func_ptr is bound to |
first_tick_nodelay | If set to true, call callback immediately when the start() function is invoked, the first tick counts as a normal repeat and is repeated until total repeat count is reached |