Description-
This function returns whether a time period set by a previous call to CdrvSetTime() has expired. Additionally, if the CdrvSetTimeoutFunction() was used to install a time-out function, then that time-out function will be called each time this routine is called. That time-out function can control the status returned by this function.
Syntax-
stat = CdrvCheckTime(timerblk);
On Entry-
unsigned int *timerblk;
Timer controlled block that was previously initialized by CdrvSetTime().
On Exit-
int stat;
If the CdrvSetTimeoutFunction() was not called to install a user time-out function then the return values are as follows.
0 If timer expired.
!=0 If timer not expired.
If the CdrvSetTimeoutFunction() was called to install a user function, this function returns the return value of the user function immediately.
See Also-
CdrvDelay()
CdrvSetTime()
CdrvSetTimeoutFunction()
CdrvSetTimerResolution()
Example-
#include
int stat; int port=0; int time_interval=18; int timerblk[10];
if ((stat = CdrvSetTime(port,time_interval,timerblk)) == -1) { printf("Error setting timer\n");
/* Take remedial action */ }
while(CdrvCheckTime(timerblk) != 0) {
/* Do desired work for "timer not expired yet" */
}