23
23
#include " interrupts.h"
24
24
#include " coredecls.h"
25
25
26
- typedef std::function< void ( void ) > mSchedFuncT ;
26
+ typedef Delegate< > mSchedFuncT ;
27
27
struct scheduled_fn_t
28
28
{
29
29
scheduled_fn_t * mNext = nullptr ;
@@ -35,13 +35,13 @@ static scheduled_fn_t* sLast = nullptr;
35
35
static scheduled_fn_t * sUnused = nullptr ;
36
36
static int sCount = 0 ;
37
37
38
- typedef std::function <bool ( void ) > mRecFuncT ;
38
+ typedef Delegate <bool > mRecFuncT ;
39
39
struct recurrent_fn_t
40
40
{
41
41
recurrent_fn_t * mNext = nullptr ;
42
42
mRecFuncT mFunc ;
43
43
esp8266::polledTimeout::periodicFastUs callNow;
44
- std::function <bool ( void ) > alarm = nullptr ;
44
+ Delegate <bool > alarm = nullptr ;
45
45
recurrent_fn_t (esp8266::polledTimeout::periodicFastUs interval) : callNow(interval) { }
46
46
};
47
47
@@ -73,13 +73,13 @@ static scheduled_fn_t* get_fn_unsafe()
73
73
74
74
static void recycle_fn_unsafe (scheduled_fn_t * fn)
75
75
{
76
- fn->mFunc = nullptr ; // special overload in c++ std lib
76
+ fn->mFunc = nullptr ; // special overload in Delegate
77
77
fn->mNext = sUnused ;
78
78
sUnused = fn;
79
79
}
80
80
81
81
IRAM_ATTR // (not only) called from ISR
82
- bool schedule_function (const std::function< void ( void ) >& fn)
82
+ bool schedule_function (const Delegate< >& fn)
83
83
{
84
84
if (!fn)
85
85
return false ;
@@ -103,8 +103,8 @@ bool schedule_function(const std::function<void(void)>& fn)
103
103
}
104
104
105
105
IRAM_ATTR // (not only) called from ISR
106
- bool schedule_recurrent_function_us (const std::function <bool ( void ) >& fn,
107
- uint32_t repeat_us, const std::function <bool( void ) >& alarm)
106
+ bool schedule_recurrent_function_us (const Delegate <bool >& fn,
107
+ uint32_t repeat_us, const Delegate <bool >& alarm)
108
108
{
109
109
assert (repeat_us < decltype (recurrent_fn_t ::callNow)::neverExpires); // ~26800000us (26.8s)
110
110
0 commit comments