mbed library sources
Fork of mbed-src by
Diff: api/Ticker.h
- Revision:
- 19:398f4c622e1b
- Parent:
- 15:4892fe388435
--- a/api/Ticker.h Mon Aug 12 13:49:01 2013 +0300 +++ b/api/Ticker.h Mon Aug 19 18:17:02 2013 +0300 @@ -104,7 +104,7 @@ */ template<typename T> pFunctionPointer_t attach(T* tptr, void (T::*mptr)(void), float t) { - return attach_us(tptr, mptr, t * 1000000.0f); + return attach_us(tptr, mptr, t * 1000000.0f); } /** Add a function to be called by the Ticker at the end of the call chain @@ -142,6 +142,7 @@ * The function object created for 'fptr' */ pFunctionPointer_t attach_us(void (*fptr)(void), unsigned int t) { + _chain.clear(); pFunctionPointer_t pf = _chain.add(fptr); setup(t); return pf; @@ -158,7 +159,8 @@ */ template<typename T> pFunctionPointer_t attach_us(T* tptr, void (T::*mptr)(void), unsigned int t) { - pFunctionPointer_t pf = _chain.add(mptr, tptr); + _chain.clear(); + pFunctionPointer_t pf = _chain.add(tptr, mptr); setup(t); return pf; }