Mindstorms 3rd Party ROBOTC Drivers RobotC
[Home] [Download] [Submit a bug/suggestion] [ROBOTC Forums] [Blog] [Support this project]
Data Structures | Files | Defines | Functions | Variables

Timer Library
[Other]

Data Structures

struct  typeTMR

Files

file  timer.h
 

Additional _timers for ROBOTC.


Defines

#define MAX_TIMERS   10

Functions

int TMRnewTimer ()
bool TMRisExpired (int timerIdx)
void TMRreset (int timerIdx)
void TMRreset (int timerIdx, long duration)
void TMRsetup (int timerIdx, long duration)
void TMRexpire (int timerIdx)

Variables

typeTMR _timers [MAX_TIMERS]

Detailed Description

Timer Library


Define Documentation

#define MAX_TIMERS   10

Maximum number of _timers Struct for timer data

Definition at line 42 of file timer.h.


Function Documentation

void TMRexpire ( int  timerIdx )

Cause the timer to expire.

Parameters:
timerIdxthe timer to be expired.

Definition at line 122 of file timer.h.

bool TMRisExpired ( int  timerIdx )

Check if the timer has expired.

Parameters:
timerIdxthe timer to be checked.
Returns:
true if the timer has expired, false if it hasn't.
Examples:
timer-test1.c.

Definition at line 81 of file timer.h.

int TMRnewTimer (  )

Create a new timer. It's an index to the next available timer in the array of timer structs.

Returns:
the first available slot in the timer object array or -1 if all slots have been used. Increase the MAX_TIMERS variable in this case.
Examples:
timer-test1.c.

Definition at line 67 of file timer.h.

void TMRreset ( int  timerIdx,
long  duration 
)

Reset the timer, will also mark "expired" flag as false.

Parameters:
timerIdxthe timer to be checked.
durationthe amount of time the timer should run for before expiring.

Definition at line 110 of file timer.h.

void TMRreset ( int  timerIdx )

Reset the timer, will also mark "expired" flag as false.
This function will also check if the TMRtask is running and start it up if this isn't the case.

Parameters:
timerIdxthe timer to be checked.
Examples:
timer-test1.c.

Definition at line 98 of file timer.h.

void TMRsetup ( int  timerIdx,
long  duration 
)

Configure the duration of the timer.

Parameters:
timerIdxthe timer to be checked.
durationthe amount of time the timer should run for before expiring.
Examples:
timer-test1.c.

Definition at line 134 of file timer.h.


Variable Documentation

typeTMR _timers[MAX_TIMERS]

Array to hold timer data

Definition at line 52 of file timer.h.