mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #139 from geky/callback-fixes
Small fixes for issues with Callback class
commit
08ecdb296b
|
@ -218,8 +218,20 @@ public:
|
|||
* @param method pointer to the member function to be called
|
||||
* @param event Which CAN interrupt to attach the member function to (CAN::RxIrq for message received, TxIrq for transmitted or aborted, EwIrq for error warning, DoIrq for data overrun, WuIrq for wake-up, EpIrq for error passive, AlIrq for arbitration lost, BeIrq for bus error)
|
||||
*/
|
||||
template<typename T>
|
||||
void attach(T* obj, void (T::*method)(void), IrqType type=RxIrq) {
|
||||
template<typename T>
|
||||
void attach(T* obj, void (T::*method)(), IrqType type=RxIrq) {
|
||||
attach(Callback<void()>(obj, method), type);
|
||||
}
|
||||
|
||||
/** Attach a member function to call whenever a CAN frame received interrupt
|
||||
* is generated.
|
||||
*
|
||||
* @param obj pointer to the object to call the member function on
|
||||
* @param method pointer to the member function to be called
|
||||
* @param event Which CAN interrupt to attach the member function to (CAN::RxIrq for message received, TxIrq for transmitted or aborted, EwIrq for error warning, DoIrq for data overrun, WuIrq for wake-up, EpIrq for error passive, AlIrq for arbitration lost, BeIrq for bus error)
|
||||
*/
|
||||
template<typename T>
|
||||
void attach(T* obj, void (*method)(T*), IrqType type=RxIrq) {
|
||||
attach(Callback<void()>(obj, method), type);
|
||||
}
|
||||
|
||||
|
|
|
@ -106,6 +106,9 @@ public:
|
|||
/** Call the attached function
|
||||
*/
|
||||
R call(A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) {
|
||||
if (!_thunk) {
|
||||
return (R)0;
|
||||
}
|
||||
return _thunk(_obj, &_func, a0, a1, a2, a3, a4);
|
||||
}
|
||||
|
||||
|
@ -244,6 +247,9 @@ public:
|
|||
/** Call the attached function
|
||||
*/
|
||||
R call(A0 a0, A1 a1, A2 a2, A3 a3) {
|
||||
if (!_thunk) {
|
||||
return (R)0;
|
||||
}
|
||||
return _thunk(_obj, &_func, a0, a1, a2, a3);
|
||||
}
|
||||
|
||||
|
@ -382,6 +388,9 @@ public:
|
|||
/** Call the attached function
|
||||
*/
|
||||
R call(A0 a0, A1 a1, A2 a2) {
|
||||
if (!_thunk) {
|
||||
return (R)0;
|
||||
}
|
||||
return _thunk(_obj, &_func, a0, a1, a2);
|
||||
}
|
||||
|
||||
|
@ -520,6 +529,9 @@ public:
|
|||
/** Call the attached function
|
||||
*/
|
||||
R call(A0 a0, A1 a1) {
|
||||
if (!_thunk) {
|
||||
return (R)0;
|
||||
}
|
||||
return _thunk(_obj, &_func, a0, a1);
|
||||
}
|
||||
|
||||
|
@ -658,6 +670,9 @@ public:
|
|||
/** Call the attached function
|
||||
*/
|
||||
R call(A0 a0) {
|
||||
if (!_thunk) {
|
||||
return (R)0;
|
||||
}
|
||||
return _thunk(_obj, &_func, a0);
|
||||
}
|
||||
|
||||
|
@ -796,7 +811,7 @@ public:
|
|||
/** Call the attached function
|
||||
*/
|
||||
R call() {
|
||||
if (NULL == _thunk) {
|
||||
if (!_thunk) {
|
||||
return (R)0;
|
||||
}
|
||||
return _thunk(_obj, &_func);
|
||||
|
|
|
@ -100,8 +100,19 @@ public:
|
|||
* @param method pointer to the member function to be called
|
||||
* @param type Which serial interrupt to attach the member function to (Seriall::RxIrq for receive, TxIrq for transmit buffer empty)
|
||||
*/
|
||||
template<typename T, typename M>
|
||||
void attach(T *obj, M method, IrqType type=RxIrq) {
|
||||
template<typename T>
|
||||
void attach(T *obj, void (T::*method)(), IrqType type=RxIrq) {
|
||||
attach(Callback<void()>(obj, method), type);
|
||||
}
|
||||
|
||||
/** Attach a member function to call whenever a serial interrupt is generated
|
||||
*
|
||||
* @param obj pointer to the object to call the member function on
|
||||
* @param method pointer to the member function to be called
|
||||
* @param type Which serial interrupt to attach the member function to (Seriall::RxIrq for receive, TxIrq for transmit buffer empty)
|
||||
*/
|
||||
template<typename T>
|
||||
void attach(T *obj, void (*method)(T*), IrqType type=RxIrq) {
|
||||
attach(Callback<void()>(obj, method), type);
|
||||
}
|
||||
|
||||
|
|
|
@ -149,8 +149,18 @@ public:
|
|||
* @param method pointer to the member function to call
|
||||
* @param type Which serial interrupt to attach the member function to (Serial::RxIrq for receive, TxIrq for transmit buffer empty)
|
||||
*/
|
||||
template <typename T, typename M>
|
||||
void attach(T *obj, M method, IrqType type=RxIrq) {
|
||||
template <typename T>
|
||||
void attach(T *obj, void (T::*method)(), IrqType type=RxIrq) {
|
||||
attach(Callback<void()>(obj, method), type);
|
||||
}
|
||||
|
||||
/** Attach a member function to call whenever a serial interrupt is generated
|
||||
* @param obj pointer to the object to call the member function on
|
||||
* @param method pointer to the member function to call
|
||||
* @param type Which serial interrupt to attach the member function to (Serial::RxIrq for receive, TxIrq for transmit buffer empty)
|
||||
*/
|
||||
template <typename T>
|
||||
void attach(T *obj, void (*method)(T*), IrqType type=RxIrq) {
|
||||
attach(Callback<void()>(obj, method), type);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue