Unify Framework Lib 1.6.0

Files

file  ctimer.c
 
file  ctimer.h
 

Classes

struct  ctimer
 

Macros

#define data   _data
 
#define DEBUG   0
 
#define PRINTF(...)
 

Functions

 LIST (ctimer_list)
 
 PROCESS (ctimer_process, "Ctimer process")
 
 PROCESS_THREAD (ctimer_process, ev, data)
 
void ctimer_init (void)
 Initialize the callback timer library. More...
 
void ctimer_set (struct ctimer *c, clock_time_t t, void(*f)(void *), void *ptr)
 Set a callback timer. More...
 
void ctimer_reset (struct ctimer *c)
 Reset a callback timer with the same interval as was previously set. More...
 
void ctimer_restart (struct ctimer *c)
 Restart a callback timer from the current point in time. More...
 
void ctimer_stop (struct ctimer *c)
 Stop a pending callback timer. More...
 
int ctimer_expired (struct ctimer *c)
 Check if a callback timer has expired. More...
 

Variables

static char initialized
 

Detailed Description

The ctimer module provides a timer mechanism that calls a specified C function when a ctimer expires.

Macro Definition Documentation

◆ data

#define data   _data

◆ DEBUG

#define DEBUG   0

◆ PRINTF

#define PRINTF (   ...)

Function Documentation

◆ ctimer_expired()

int ctimer_expired ( struct ctimer c)

Check if a callback timer has expired.

Parameters
cA pointer to the callback timer
Returns
Non-zero if the timer has expired, zero otherwise.
        This function tests if a callback timer has expired and
        returns true or false depending on its status.

◆ ctimer_init()

void ctimer_init ( void  )

Initialize the callback timer library.

        This function initializes the callback timer library and
        should be called from the system boot up code.

◆ ctimer_reset()

void ctimer_reset ( struct ctimer c)

Reset a callback timer with the same interval as was previously set.

Parameters
cA pointer to the callback timer.
        This function resets the callback timer with the same
        interval that was given to the callback timer with the
        ctimer_set() function. The start point of the interval
        is the exact time that the callback timer last
        expired. Therefore, this function will cause the timer
        to be stable over time, unlike the ctimer_restart()
        function.
See also
ctimer_restart()

◆ ctimer_restart()

void ctimer_restart ( struct ctimer c)

Restart a callback timer from the current point in time.

Parameters
cA pointer to the callback timer.
        This function restarts the callback timer with the same
        interval that was given to the ctimer_set()
        function. The callback timer will start at the current
        time.

        \note A periodic timer will drift if this function is
        used to reset it. For periodic timers, use the
        ctimer_reset() function instead.
See also
ctimer_reset()

◆ ctimer_set()

void ctimer_set ( struct ctimer c,
clock_time_t  t,
void(*)(void *)  f,
void *  ptr 
)

Set a callback timer.

Parameters
cA pointer to the callback timer.
tThe interval before the timer expires.
fA function to be called when the timer expires.
ptrAn opaque pointer that will be supplied as an argument to the callback function.
        This function is used to set a callback timer for a time
        sometime in the future. When the callback timer expires,
        the callback function f will be called with ptr as argument.

◆ ctimer_stop()

void ctimer_stop ( struct ctimer c)

Stop a pending callback timer.

Parameters
cA pointer to the pending callback timer.
        This function stops a callback timer that has previously
        been set with ctimer_set(), ctimer_reset(), or ctimer_restart().
        After this function has been called, the callback timer will be
        expired and will not call the callback function.

◆ LIST()

LIST ( ctimer_list  )

◆ PROCESS()

PROCESS ( ctimer_process  ,
"Ctimer process  
)

◆ PROCESS_THREAD()

PROCESS_THREAD ( ctimer_process  ,
ev  ,
data   
)

Variable Documentation

◆ initialized

char initialized
static