Loading...
Searching...
No Matches
Millisecond interval event timers

Provides timers for events up to $2^{32}$ milliseconds in the future. More...

Detailed Description

Provides timers for events up to $2^{32}$ milliseconds in the future.

Note
Experimental and likely to replaced with unified timer API

RIOT's main timer subsystem is ztimer but compared to ztimer, evtimer offers:

Files

file  evtimer.h
 evtimer API definitions
 
file  evtimer_mbox.h
 Message box based evtimer event.
 
file  evtimer_msg.h
 IPC-based evtimer definitions.
 

Data Structures

struct  evtimer_event
 Generic event. More...
 
struct  evtimer_t
 Event timer. More...
 
struct  evtimer_mbox_event_t
 Message box event definition. More...
 
struct  evtimer_msg_event_t
 IPC-message event. More...
 

Typedefs

typedef struct evtimer_event evtimer_event_t
 Generic event.
 
typedef void(* evtimer_callback_t) (evtimer_event_t *event)
 Event timer callback type.
 
typedef evtimer_t evtimer_msg_t
 IPC-message event timer.
 

Functions

void evtimer_init (evtimer_t *evtimer, evtimer_callback_t handler)
 Initializes an event timer.
 
void evtimer_add (evtimer_t *evtimer, evtimer_event_t *event)
 Adds event to an event timer.
 
void evtimer_del (evtimer_t *evtimer, evtimer_event_t *event)
 Removes an event from an event timer.
 
void evtimer_print (const evtimer_t *evtimer)
 Print overview of current state of an event timer.
 
static uint32_t evtimer_now_msec (void)
 Return the current system time in msec.
 
static void evtimer_add_mbox (evtimer_t *evtimer, evtimer_mbox_event_t *event, mbox_t *mbox)
 Adds mbox event to an event timer.
 
static void _evtimer_mbox_handler (evtimer_event_t *event)
 Event handler for mbox events.
 
static void evtimer_init_mbox (evtimer_t *evtimer)
 Initializes event timer for mbox events.
 
static void evtimer_add_msg (evtimer_msg_t *evtimer, evtimer_msg_event_t *event, kernel_pid_t target_pid)
 Adds event to an event timer that handles events via IPC.
 
static void _evtimer_msg_handler (evtimer_event_t *event)
 Event handler for IPC messages.
 
static void evtimer_init_msg (evtimer_t *evtimer)
 Initializes event timer to handle events via IPC.
 

Typedef Documentation

◆ evtimer_callback_t

typedef void(* evtimer_callback_t) (evtimer_event_t *event)

Event timer callback type.

Definition at line 64 of file evtimer.h.

◆ evtimer_msg_t

IPC-message event timer.

Definition at line 34 of file evtimer_msg.h.

Function Documentation

◆ _evtimer_mbox_handler()

static void _evtimer_mbox_handler ( evtimer_event_t event)
inlinestatic

Event handler for mbox events.

Precondition
event is not NULL.
Parameters
[in]eventThe event to handle

Definition at line 66 of file evtimer_mbox.h.

◆ _evtimer_msg_handler()

static void _evtimer_msg_handler ( evtimer_event_t event)
inlinestatic

Event handler for IPC messages.

Parameters
[in]eventThe event to handle

Definition at line 67 of file evtimer_msg.h.

◆ evtimer_add()

void evtimer_add ( evtimer_t evtimer,
evtimer_event_t event 
)

Adds event to an event timer.

Parameters
[in]evtimerAn event timer
[in]eventAn event

◆ evtimer_add_mbox()

static void evtimer_add_mbox ( evtimer_t evtimer,
evtimer_mbox_event_t event,
mbox_t mbox 
)
inlinestatic

Adds mbox event to an event timer.

Precondition
evtimer is not NULL.
event is not NULL.
mbox is not NULL.
Parameters
[in]evtimerTimer to add event.
[in]eventEvent to add.
[in]mboxMbox to store event->msg timer expiration.

Definition at line 50 of file evtimer_mbox.h.

◆ evtimer_add_msg()

static void evtimer_add_msg ( evtimer_msg_t evtimer,
evtimer_msg_event_t event,
kernel_pid_t  target_pid 
)
inlinestatic

Adds event to an event timer that handles events via IPC.

Parameters
[in]evtimerAn event timer
[in]eventAn event
[in]target_pidThe PID of the thread that should receive the IPC message

Definition at line 53 of file evtimer_msg.h.

◆ evtimer_del()

void evtimer_del ( evtimer_t evtimer,
evtimer_event_t event 
)

Removes an event from an event timer.

Parameters
[in]evtimerAn event timer
[in]eventAn event

◆ evtimer_init()

void evtimer_init ( evtimer_t evtimer,
evtimer_callback_t  handler 
)

Initializes an event timer.

Warning
BEWARE! Callbacks from evtimer_init() are being executed in interrupt context. DON'T USE THIS FUNCTION unless you know exactly what that means.
Parameters
[in]evtimerAn event timer
[in]handlerAn event handler function

◆ evtimer_init_mbox()

static void evtimer_init_mbox ( evtimer_t evtimer)
inlinestatic

Initializes event timer for mbox events.

Precondition
evtimer is not NULL.
Parameters
[in]evtimerAn event timer

Definition at line 80 of file evtimer_mbox.h.

◆ evtimer_init_msg()

static void evtimer_init_msg ( evtimer_t evtimer)
inlinestatic

Initializes event timer to handle events via IPC.

Parameters
[in]evtimerAn event timer

Definition at line 78 of file evtimer_msg.h.

◆ evtimer_now_msec()

static uint32_t evtimer_now_msec ( void  )
inlinestatic

Return the current system time in msec.

Definition at line 115 of file evtimer.h.

◆ evtimer_print()

void evtimer_print ( const evtimer_t evtimer)

Print overview of current state of an event timer.

Parameters
[in]evtimerAn event timer