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.

Example:

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

Author
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...
 

Functions

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...
 

Function Documentation

◆ event_timeout_init()

void event_timeout_init ( event_timeout_t event_timeout,
event_queue_t queue,
event_t event 
)

Initialize timeout event object.

Parameters
[in]event_timeoutevent_timeout object to initilalize
[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 miliseconds.

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