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> {
74
74
Ticker (const ticker_data_t *data);
75
75
76
76
/* * 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.
79
82
* @param func pointer to the function to be called
80
83
* @param t the time between calls in seconds
81
84
*/
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)
83
87
{
84
88
attach_us (func, t * 1000000 .0f );
85
89
}
You can’t perform that action at this time.
0 commit comments