40#ifndef FREERTOSPP_CALLBACK_H
41#define FREERTOSPP_CALLBACK_H
62#if FREERTOSCPP_USE_NAMESPACE
75template<
class Tr =
void,
class Tp1 =
void,
class Tp2 =
void>
87template<
class Tr,
class Tp>
120#if INCLUDE_xTimerPendFunctionCall
121 void pend(uint32_t parm, TickType_t ticks = portMAX_DELAY) {
124#if FREERTOSCPP_USE_CHRONO
125 void pend(uint32_t parm, Time_ms ms) {
130 void pendFromISR(uint32_t parm, BaseType_t* wasWoken) {
142template<
class Tr =
void,
class Tp1 =
void,
class Tp2 =
void>
148 virtual Tr
callback(Tp1 parm1, Tp2 parm2) {
return (*m_fun)(parm1, parm2); }
152 void setFun(Tr (*fun)(Tp1, Tp2)) { m_fun = fun; }
154 Tr (*m_fun)(Tp1, Tp2);
157template<
class Tr,
class Tp>
163 virtual Tr
callback(Tp parm) {
return m_fun(parm); }
164 void setFun(Tr (*fun)(Tp)) { m_fun = fun; }
182template<
class Tc,
class Tr =
void,
class Tp1 =
void,
class Tp2 =
void>
188 virtual Tr
callback(Tp1 parm1, Tp2 parm2) {
return (m_obj->*m_fun)(parm1, parm2); }
195 void setFun(Tr (Tc::*fun)(Tp1, Tp2)) { m_fun = fun; }
198 Tr (Tc::*m_fun)(Tp1, Tp2);
201template<
class Tc,
class Tr,
class Tp>
207 virtual Tr
callback(Tp parm) {
return (m_obj->*m_fun)(parm); }
209 void setFun(Tr (Tc::*fun)(Tp)) { m_fun = fun; }
215template<
class Tc,
class Tr>
221 virtual Tr
callback() {
return (m_obj->*m_fun)(); }
223 void setFun(Tr Tc::*fun()) { m_fun = fun; }
230#if FREERTOSCPP_USE_NAMESPACE
void voidCallbackU32(void *cb, uint32_t parm)
Define a "C" Callback trampline suitable for Timer Callbacks.
Definition CallBack.cpp:42
void voidCallbackU32(void *cb, uint32_t parm)
Define a "C" Callback trampline suitable for Timer Callbacks.
Definition CallBack.cpp:42
CallBack()
Definition CallBack.h:90
virtual ~CallBack()
Definition CallBack.h:91
virtual Tr callback(Tp)=0
CallBack()
Definition CallBack.h:102
virtual ~CallBack()
Definition CallBack.h:103
virtual ~CallBack()
Definition CallBack.h:117
CallBack()
Definition CallBack.h:116
virtual void callback(uint32_t)=0
Base callback with two parameters.
Definition CallBack.h:76
virtual ~CallBack()
Definition CallBack.h:79
virtual Tr callback(Tp1, Tp2)=0
CallBack()
Definition CallBack.h:78
void setFun(Tr(*fun)(Tp))
Definition CallBack.h:164
virtual ~FunctionCallback()
Definition CallBack.h:161
virtual Tr callback(Tp parm)
Definition CallBack.h:163
FunctionCallback(Tr(*fun)(Tp))
Definition CallBack.h:160
virtual Tr callback()
Definition CallBack.h:175
void setFun(Tr *fun())
Definition CallBack.h:176
virtual ~FunctionCallback()
Definition CallBack.h:173
FunctionCallback(Tr(*fun)())
Definition CallBack.h:172
Derived Callback to call to a function.
Definition CallBack.h:143
virtual Tr callback(Tp1 parm1, Tp2 parm2)
Definition CallBack.h:148
virtual ~FunctionCallback()
Definition CallBack.h:146
void setFun(Tr(*fun)(Tp1, Tp2))
Change the Memberfunction for the Callback.
Definition CallBack.h:152
FunctionCallback(Tr(*fun)(Tp1, Tp2))
Definition CallBack.h:145
MemberFunctionCallback(Tc *obj, Tr(Tc::*fun)(Tp))
Definition CallBack.h:204
void setObj(Tc *obj)
Definition CallBack.h:208
virtual ~MemberFunctionCallback()
Definition CallBack.h:205
void setFun(Tr(Tc::*fun)(Tp))
Definition CallBack.h:209
virtual Tr callback(Tp parm)
Definition CallBack.h:207
Tc * m_obj
Definition CallBack.h:211
MemberFunctionCallback(Tc *obj, Tr(Tc::*fun)())
Definition CallBack.h:218
void setObj(Tc *obj)
Definition CallBack.h:222
virtual Tr callback()
Definition CallBack.h:221
void setFun(Tr Tc::*fun())
Definition CallBack.h:223
virtual ~MemberFunctionCallback()
Definition CallBack.h:219
Tc * m_obj
Definition CallBack.h:225
Definition CallBack.h:183
void setObj(Tc *obj)
Change the Object for the Callback.
Definition CallBack.h:192
MemberFunctionCallback(Tc *obj, Tr(Tc::*fun)(Tp1, Tp2))
Definition CallBack.h:185
void setFun(Tr(Tc::*fun)(Tp1, Tp2))
Change the Memberfunction for the Callback.
Definition CallBack.h:195
virtual ~MemberFunctionCallback()
Definition CallBack.h:186
Tc * m_obj
Definition CallBack.h:197
virtual Tr callback(Tp1 parm1, Tp2 parm2)
Definition CallBack.h:188
Definition FreeRTOScpp.h:74