event/timeout.h File Reference

Provides functionality to trigger events after timeout. More...

Detailed Description

Provides functionality to trigger events after timeout.

event_timeout intentionally does't extend event structures in order to support events that are integrated in larger structs intrusively.


event_timeout_t event_timeout;
printf("posting timed callback with timeout 1sec\n");
event_timeout_init(&event_timeout, &queue, (event_t*)&event);
event_timeout_set(&event_timeout, 1000000);

Event Timeout API

Kaspar Schleiser kaspa.nosp@m.r@sc.nosp@m.hleis.nosp@m.er.d.nosp@m.e

Definition in file event/timeout.h.

#include "event.h"
#include "xtimer.h"
+ Include dependency graph for event/timeout.h:

Go to the source code of this file.

Data Structures

struct  event_timeout_t
 Timeout Event structure. More...


void event_timeout_init (event_timeout_t *event_timeout, event_queue_t *queue, event_t *event)
 Initialize timeout event object. More...
void event_timeout_set (event_timeout_t *event_timeout, uint32_t timeout)
 Set a timeout. More...
void event_timeout_clear (event_timeout_t *event_timeout)
 Clear a timeout event. More...

Function Documentation

◆ event_timeout_clear()

void event_timeout_clear ( event_timeout_t event_timeout)

Clear a timeout event.

Calling this function will cancel the timeout by removing its underlying timer. If the timer has already fired before calling this function, the connected event will be put already into the given event queue and this function does not have any effect.

[in]event_timeoutevent_timeout context object to use

◆ event_timeout_init()

void event_timeout_init ( event_timeout_t event_timeout,
event_queue_t queue,
event_t event 

Initialize timeout event object.

[in]event_timeoutevent_timeout object to initialize
[in]queuequeue that the timed-out event will be added to
[in]eventevent to add to queue after timeout

◆ event_timeout_set()

void event_timeout_set ( event_timeout_t event_timeout,
uint32_t  timeout 

Set a timeout.

This will make the event as configured in event_timeout be triggered after timeout microseconds.

: the used event_timeout struct must stay valid until after the timeout event has been processed!
[in]event_timeoutevent_timout context object to use
[in]timeouttimeout in microseconds