@@ -84,7 +84,7 @@ class EventQueue : private mbed::NonCopyable<EventQueue> {
84
84
85
85
/* * Dispatch events without a timeout
86
86
*
87
- * This is equivalent to EventQueue::dispatch with no arguments, but
87
+ * This is equivalent to EventQueue::dispatch with no arguments, but
88
88
* avoids overload ambiguities when passed as a callback.
89
89
*
90
90
* @see EventQueue::dispatch
@@ -100,7 +100,7 @@ class EventQueue : private mbed::NonCopyable<EventQueue> {
100
100
101
101
/* * Millisecond counter
102
102
*
103
- * Returns the underlying tick of the event queue represented as the
103
+ * Returns the underlying tick of the event queue represented as the
104
104
* number of milliseconds that have passed since an arbitrary point in
105
105
* time. Intentionally overflows to 0 after 2^32-1.
106
106
*
@@ -180,6 +180,181 @@ class EventQueue : private mbed::NonCopyable<EventQueue> {
180
180
*/
181
181
void chain (EventQueue *target);
182
182
183
+
184
+ #if defined(DOXYGEN_ONLY)
185
+ /* * Calls an event on the queue
186
+ *
187
+ * The specified callback will be executed in the context of the event
188
+ * queue's dispatch loop.
189
+ *
190
+ * The call function is irq safe and can act as a mechanism for moving
191
+ * events out of irq contexts.
192
+ *
193
+ * @param f Function to execute in the context of the dispatch loop
194
+ * @param args Arguments to pass to the callback
195
+ * @return A unique id that represents the posted event and can
196
+ * be passed to cancel, or an id of 0 if there is not
197
+ * enough memory to allocate the event.
198
+ * Returned id will remain valid until event has finished
199
+ * executing.
200
+ */
201
+ template <typename F, typename ...Args>
202
+ int call (F f, Args ...args);
203
+
204
+ /* * Calls an event on the queue
205
+ *
206
+ * The specified callback will be executed in the context of the event
207
+ * queue's dispatch loop.
208
+ *
209
+ * The call function is irq safe and can act as a mechanism for moving
210
+ * events out of irq contexts.
211
+ *
212
+ * @param obj Object to call with the member function
213
+ * @param method Member function to execute in the context of the dispatch loop
214
+ * @param args Arguments to pass to the callback
215
+ * @return A unique id that represents the posted event and can
216
+ * be passed to cancel, or an id of 0 if there is not
217
+ * enough memory to allocate the event.
218
+ * Returned id will remain valid until event has finished
219
+ * executing.
220
+ */
221
+ template <typename T, typename R, typename ...Args>
222
+ int call (T *obj, R (T::*method)(Args ...args), Args ...args);
223
+
224
+ /* * Calls an event on the queue after a specified delay
225
+ *
226
+ * The specified callback will be executed in the context of the event
227
+ * queue's dispatch loop.
228
+ *
229
+ * The call_in function is irq safe and can act as a mechanism for moving
230
+ * events out of irq contexts.
231
+ *
232
+ * @param ms Time to delay in milliseconds
233
+ * @param args Arguments to pass to the callback
234
+ * @return A unique id that represents the posted event and can
235
+ * be passed to cancel, or an id of 0 if there is not
236
+ * enough memory to allocate the event.
237
+ */
238
+ template <typename F, typename ...Args>
239
+ int call_in (int ms, Args ...args);
240
+
241
+ /* * Calls an event on the queue after a specified delay
242
+ *
243
+ * The specified callback will be executed in the context of the event
244
+ * queue's dispatch loop.
245
+ *
246
+ * The call_in function is irq safe and can act as a mechanism for moving
247
+ * events out of irq contexts.
248
+ *
249
+ * @param ms Time to delay in milliseconds
250
+ * @param obj Object to call with the member function
251
+ * @param method Member function to execute in the context of the dispatch loop
252
+ * @param args Arguments to pass to the callback
253
+ * @return A unique id that represents the posted event and can
254
+ * be passed to cancel, or an id of 0 if there is not
255
+ * enough memory to allocate the event.
256
+ */
257
+ template <typename T, typename R, typename ...Args>
258
+ int call_in (int ms, T *obj, R (T::*method)(Args ...args), Args ...args);
259
+
260
+ /* * Calls an event on the queue periodically
261
+ *
262
+ * @note The first call_every event occurs after the specified delay.
263
+ * To create a periodic event that fires immediately, @see Event.
264
+ *
265
+ * The specified callback will be executed in the context of the event
266
+ * queue's dispatch loop.
267
+ *
268
+ * The call_every function is irq safe and can act as a mechanism for
269
+ * moving events out of irq contexts.
270
+ *
271
+ * @param ms Period of the event in milliseconds
272
+ * @param f Function to execute in the context of the dispatch loop
273
+ * @param args Arguments to pass to the callback
274
+ * @return A unique id that represents the posted event and can
275
+ * be passed to cancel, or an id of 0 if there is not
276
+ * enough memory to allocate the event.
277
+ */
278
+ template <typename F, typename ...Args>
279
+ int call_every (int ms, F f, Args ...args);
280
+
281
+ /* * Calls an event on the queue periodically
282
+ *
283
+ * @note The first call_every event occurs after the specified delay.
284
+ * To create a periodic event that fires immediately, @see Event.
285
+ *
286
+ * The specified callback will be executed in the context of the event
287
+ * queue's dispatch loop.
288
+ *
289
+ * The call_every function is irq safe and can act as a mechanism for
290
+ * moving events out of irq contexts.
291
+ *
292
+ * @param ms Period of the event in milliseconds
293
+ * @param obj Object to call with the member function
294
+ * @param method Member function to execute in the context of the dispatch loop
295
+ * @param args Arguments to pass to the callback
296
+ */
297
+ template <typename T, typename R, typename ...Args>
298
+ int call_every (int ms, T *obj, R (T::*method)(Args ...args), Args ...args);
299
+
300
+ /* * Creates an event bound to the event queue
301
+ *
302
+ * Constructs an event bound to the specified event queue. The specified
303
+ * callback acts as the target for the event and is executed in the
304
+ * context of the event queue's dispatch loop once posted.
305
+ *
306
+ * @tparam R TODO
307
+ * @tparam Args TODO
308
+ * @tparam BoundArgs TODO
309
+ * @param func Function to execute when the event is dispatched
310
+ * @param args TODO
311
+ * @return Event that will dispatch on the specific queue
312
+ *
313
+ * @code
314
+ * event(...TODO....);
315
+ * @endcode
316
+ */
317
+ template <typename R, typename ...BoundArgs, typename ...Args>
318
+ Event<void (Args...)> event (R (*func)(BoundArgs...), Args ...args);
319
+
320
+ /* * Creates an event bound to the event queue
321
+ *
322
+ * Constructs an event bound to the specified event queue. The specified
323
+ * callback acts as the target for the event and is executed in the
324
+ * context of the event queue's dispatch loop once posted.
325
+ *
326
+ * @tparam T TODO
327
+ * @tparam R TODO
328
+ * @tparam BoundArgs TODO
329
+ * @tparam ContextArg TODO
330
+ * @tparam Args TODO
331
+ * @param obj Object to call with the member function
332
+ * @param method Member function to execute in the context of the dispatch loop
333
+ * @param context_args TODO
334
+ * @return Event that will dispatch on the specific queue
335
+ */
336
+ template <typename T, typename R, typename ...BoundArgs, typename ...ContextArgs, typename ...Args>
337
+ Event<void (Args...)> event (T *obj, R (T::*method)(BoundArgs..., Args...), ContextArgs ...context_args);
338
+
339
+ /* * Creates an event bound to the event queue
340
+ *
341
+ * Constructs an event bound to the specified event queue. The specified
342
+ * callback acts as the target for the event and is executed in the
343
+ * context of the event queue's dispatch loop once posted.
344
+ *
345
+ * @tparam templateArgs TODO
346
+ * @tparam R TODO
347
+ * @param cb TODO
348
+ * @tparam Args TODO
349
+ * @tparam BoundArgs TODO
350
+ * @param context_args TODO
351
+ * @return Event that will dispatch on the specific queue
352
+ */
353
+ template <typename R, typename ...BoundArgs, typename ...ContextArgs, typename ...Args>
354
+ Event<void (Args...)> event (mbed::Callback<R(BoundArgs..., Args...)> cb, ContextArgs ...context_args);
355
+
356
+ #else
357
+
183
358
/* * Calls an event on the queue
184
359
*
185
360
* The specified callback will be executed in the context of the event
@@ -207,6 +382,7 @@ class EventQueue : private mbed::NonCopyable<EventQueue> {
207
382
return equeue_post (&_equeue, &EventQueue::function_call<F>, e);
208
383
}
209
384
385
+
210
386
/* * Calls an event on the queue
211
387
* @see EventQueue::call
212
388
* @param f Function to execute in the context of the dispatch loop
@@ -457,8 +633,8 @@ class EventQueue : private mbed::NonCopyable<EventQueue> {
457
633
* The call_in function is irq safe and can act as a mechanism for moving
458
634
* events out of irq contexts.
459
635
*
460
- * @param f Function to execute in the context of the dispatch loop
461
636
* @param ms Time to delay in milliseconds
637
+ * @param f Function to execute in the context of the dispatch loop
462
638
* @return A unique id that represents the posted event and can
463
639
* be passed to cancel, or an id of 0 if there is not
464
640
* enough memory to allocate the event.
@@ -2302,6 +2478,7 @@ class EventQueue : private mbed::NonCopyable<EventQueue> {
2302
2478
*/
2303
2479
template <typename R, typename B0, typename B1, typename B2, typename B3, typename B4, typename C0, typename C1, typename C2, typename C3, typename C4, typename A0, typename A1, typename A2, typename A3, typename A4>
2304
2480
Event<void (A0, A1, A2, A3, A4)> event (mbed::Callback<R(B0, B1, B2, B3, B4, A0, A1, A2, A3, A4)> cb, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4);
2481
+ #endif
2305
2482
2306
2483
protected:
2307
2484
template <typename F>
0 commit comments