Timers


Detailed Description

Timer library, set reset and check expiry of timers.

Init library at CPU reset with Timers_Init.

Use Timer_Set, Timer_Reset, Timer_HasExpired and Timer_MillisecondsLeft in main program loop.

Call Timers_DecreaseAll from timer interrupt. Resolution will be equal to the update value used when updating the timers.

\

\

Files

Typedefs

Functions


Typedef Documentation

typedef unsigned short int Milliseconds_t
 

Timer value is in milliseconds.

typedef unsigned char TimerId_t
 

Id of an timer.

typedef unsigned short int Milliseconds_t
 

Timer value is in milliseconds.

typedef unsigned char TimerId_t
 

Id of an timer.


Function Documentation

void Timers_Init void   ) 
 

Init timer library, reset all timers Must be called before any other timer functions are called

unsigned char Timers_GotoToIdle void   ) 
 

Wait for timers to be updated before going to power save Call this function before going to power save

bool Timer_HasExpired const TimerId_t  TimerId  ) 
 

Returns status of a timer

Parameters:
TimerId Id of timer
Return values:
!0 if timer has expired
0 if timer has not expired

void Timer_Reset const TimerId_t  TimerId  ) 
 

Resets a timer Resets and cancels a timer

Parameters:
TimerId Id of timer

void Timer_Set const TimerId_t  TimerId,
const Milliseconds_t  Timeout
 

Starts timer Starts timer, if timer is already running it will be set with new timeout.

Parameters:
TimerId Id of timer
Timeout Milliseconds before timer expires

Milliseconds_t Timer_MillisecondsLeft const TimerId_t  TimerId  ) 
 

Returns milliseconds before timer expires

Parameters:
TimerId Id of timer
Returns:
Milliseconds left before timer expires, 0 if timer is not running

void Timer_SetExpired const TimerId_t  TimerId,
const Milliseconds_t  Timeout
 

Start a timer. It will expire immediatly but still have a timeout after first expiry.

Parameters:
TimerId Id of timer
Timeout Milliseconds per


Copyright 2002 Jörgen Birkler. For accelR8 Accelerometer on Mon Jan 19 21:43:20 2004 by Doxygen 1.3.5.