fremoclock  1_3A01
FREMO Clock - Software for UTG
Timer.c File Reference

A timer module. More...

Go to the source code of this file.

Functions

int8_t CheckTimer (uint32_t *pulTimer)
 Check if timer is elapsed, incactive or still busy. More...
 
void SetTimer (uint32_t *pulTimer, uint32_t ulValue)
 Set a timer. More...
 
int8_t AddTimer (uint32_t *pulTimer, uint32_t ulValue)
 Add time period to an already initialized timer. More...
 
void ResetTimer (uint32_t *pulTimer)
 Reset a timer. More...
 
void WaitTimer (uint16_t usValue)
 Wait for usValue milliseconds. More...
 

Variables

static const uint32_t MAX_TIMEDIFF = ((UINT32_MAX / 2) - 1)
 Maximum time difference. More...
 

Detailed Description

A timer module.

Defines a timer module that can handle an unlimited number of (software) timers. Only one hardware timer (HwTimer interface) is used.

For description and examples see Timer.md.

History:

  • 2016-08-17 Pi: use stdint.h, const instead of #define
Version
$Id: Timer.c 159 2016-09-03 06:51:47Z pischky $
Author
Stefan Bormann

Definition in file Timer.c.

Function Documentation

int8_t AddTimer ( uint32_t *  pulTimer,
uint32_t  ulValue 
)

Add time period to an already initialized timer.

Parameters
pulTimerReference to timer
ulValueTimer increment in [ms]
Returns
  • -1 = Error, timer value to long or timer not initialized
  • 0 = Ok

Definition at line 94 of file Timer.c.

int8_t CheckTimer ( uint32_t *  pulTimer)

Check if timer is elapsed, incactive or still busy.

When a timer has elapsed, the state of this timer is set to inactive.

Parameters
pulTimerReference to timer
Returns
  • -1 = Timer inactive
  • 0 = Timer elapsed
  • 1 = Timer busy

Definition at line 28 of file Timer.c.

Here is the call graph for this function:

void ResetTimer ( uint32_t *  pulTimer)

Reset a timer.

Afterwards the timer state is inactive.

Parameters
pulTimerReference to timer

Definition at line 115 of file Timer.c.

void SetTimer ( uint32_t *  pulTimer,
uint32_t  ulValue 
)

Set a timer.

Parameters
pulTimerReference to timer
ulValueTimer value in [ms]

Definition at line 69 of file Timer.c.

Here is the call graph for this function:

void WaitTimer ( uint16_t  usValue)

Wait for usValue milliseconds.

This function doesn't returns before the timer is elapsed.

Deprecated:
do not use anymore
Parameters
usValueTimer value in [ms]

Definition at line 121 of file Timer.c.

Here is the call graph for this function:

Variable Documentation

const uint32_t MAX_TIMEDIFF = ((UINT32_MAX / 2) - 1)
static

Maximum time difference.

Definition at line 25 of file Timer.c.