File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -74,12 +74,16 @@ class Ticker : public TimerEvent, private NonCopyable<Ticker> {
7474 Ticker (const ticker_data_t *data);
7575
7676 /* * Attach a function to be called by the Ticker, specifying the interval in seconds
77- * The method must be inlined to convert to not use floating-point operations
78- * given attach_us() expects an integer value for the callback interval.
77+ *
78+ * The method forwards its arguments to attach_us() rather than copying them which
79+ * may not be trivial depending on the callback copied.
80+ * The function is forcibly inlined to not use floating-point operations. This is
81+ * possible given attach_us() expects an integer value for the callback interval.
7982 * @param func pointer to the function to be called
8083 * @param t the time between calls in seconds
8184 */
82- MBED_FORCEINLINE void attach (Callback<void ()> func, float t)
85+ template <typename F, typename T>
86+ MBED_FORCEINLINE void attach (F&& func, T&& t)
8387 {
8488 attach_us (func, t * 1000000 .0f );
8589 }
You can’t perform that action at this time.
0 commit comments