Bug in Ticker.h

10 Aug 2013

In mbed-src revision 17 there is a bug in Ticker.h line 161 in the attach_us() function:

    /** Attach a member function to be called by the Ticker, specifiying the interval in micro-seconds
     *
     *  @param tptr pointer to the object to call the member function on
     *  @param mptr pointer to the member function to be called
     *  @param t the time between calls in micro-seconds
     *
     *  @returns
     *  The function object created for 'tptr' and 'mptr'
     */
    template<typename T>
    pFunctionPointer_t attach_us(T* tptr, void (T::*mptr)(void), unsigned int t) {
        pFunctionPointer_t pf = _chain.add(mptr, tptr);
        setup(t);
        return pf;
    }

The call to _chain.add() has the arguments the wrong way around, should be

_chain.add(tptr, mptr);

This is caught by the compiler when attempting to use that function. No test coverage for this function?

14 Aug 2013

Hello,

thank you for reporting this bug, I corrected it and it should be available in next revision.

Regards,
0xc0170