1.2.11.4.23 SYS_TIME_TimerPeriodHasExpired Function

C

bool SYS_TIME_TimerPeriodHasExpired ( SYS_TIME_HANDLE handle )

Summary

Reports whether or not the current period of a software timer has expired.

Description

This function reports whether or not the current period of the given software timer has expired and clears the internal flag tracking period expiration so that each period expiration will only be reported once.

Precondition

The SYS_TIME_Initialize and SYS_TIME_TimerCreate or SYS_TIME_CallbackRegisterMS/ SYS_TIME_CallbackRegisterUS functions (with callback type set to SYS_TIME_PERIODIC) must have been called before calling this function.

Parameters

ParamDescription
handleHandle to a software timer instance

Returns

true - If the period has expired.

false - If the period is not expired.

Example

if (SYS_TIME_TimerPeriodHasExpired(timer) == true)
{
    // Timer has expired. Take desired action.
}

Remarks

  • For a periodic timer, a call to SYS_TIME_TimerPeriodHasExpired returns true after the first time period has expired. After calling this function, the expiry flag is internally cleared and is set again once the ongoing period of the periodic timer expires.

  • Unlike the SYS_TIME_DelayIsComplete routine the SYS_TIME_TimerPeriodHasExpired does not delete the timer, it just returns the status of the timer.

  • To poll the status of the delay timers, SYS_TIME_DelayIsComplete must be used instead of the SYS_TIME_TimerPeriodHasExpired routine, as SYS_TIME_DelayIsComplete additionally deletes the delay timer object once the delay has expired.

  • Since single shot timers does not support polling (registration of a callback is mandatory for single shot timers), the SYS_TIME_CallbackRegisterMS routine must not be used to poll the status of the single shot timers.