31 uint32_t next{}, time{}, dt{};
35 if (now < next)
return false;
40 void reset() { next = 0; }
45 using Call = void (*)(uint32_t, uint32_t);
48 void call()
override {
return func(time, dt); }
55 using Call = void (T::*)(uint32_t, uint32_t);
61 return (base->*method)(time, dt);
69 if (dt_ms) list.append(
new Func{func, dt_ms});
73 void every(uint32_t dt_ms, T& base,
75 if (dt_ms) list.append(
new Method<T>{&base, method, dt_ms});
namespace wrapping all functionality to do with scheduling
Definition evented.h:7
recurringly callable function wrapper
Definition timed.h:43
void call() override
this method is called to run the Schedulable
Definition timed.h:48
void(*)(uint32_t, uint32_t) Call
signature of recurringly callable function
Definition timed.h:45
recurringly callable method wrapper
Definition timed.h:53
void(T::*)(uint32_t, uint32_t) Call
signature of recurringly callable method
Definition timed.h:55
void call() override
this method is called to run the Schedulable
Definition timed.h:60
registry of recurring calls
Definition timed.h:65
void reset()
reset calling times of all registered functions
Definition timed.h:83
void every(uint32_t dt_ms, typename Func::Call func)
register a function to be called every dt_ms
Definition timed.h:68
void every(uint32_t dt_ms, T &base, typename Method< T >::Call method)
register a method to be called every dt_ms
Definition timed.h:73
recurring Schedulable keeps track of time in order to make recurring scheduling work
Definition timed.h:30
bool schedule(uint32_t now) override
only schedule if dt ms passed since last run
Definition timed.h:34
a registry of Schedulable which can be given to the Scheduler for actual scheduling of calls
Definition schedule.h:36
represents an object that can be scheduled for later calling
Definition schedule.h:20