Skip to content

Commit 15ed7ea

Browse files
committed
Fix bug in Ticker code
The bug was introduced by the interrupt chaining code.
1 parent 10c7a71 commit 15ed7ea

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

libraries/mbed/api/Ticker.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ class Ticker : public TimerEvent {
142142
* The function object created for 'fptr'
143143
*/
144144
pFunctionPointer_t attach_us(void (*fptr)(void), unsigned int t) {
145+
_chain.clear();
145146
pFunctionPointer_t pf = _chain.add(fptr);
146147
setup(t);
147148
return pf;
@@ -158,6 +159,7 @@ class Ticker : public TimerEvent {
158159
*/
159160
template<typename T>
160161
pFunctionPointer_t attach_us(T* tptr, void (T::*mptr)(void), unsigned int t) {
162+
_chain.clear();
161163
pFunctionPointer_t pf = _chain.add(tptr, mptr);
162164
setup(t);
163165
return pf;

0 commit comments

Comments
 (0)