osSetTimer function
Declaration:
HANDLE osSetTimer(
HANDLE Handle,
TIME Interval,
INDEX PassCount
);
Parameters:
Handle

The handle to the timer object to be configured and started.

Interval

The duration of a single timer cycle, specified in system time units.

PassCount

The maximum number of cycles the timer should execute. If set to zero, the timer operates periodically with an infinite number of repetitions.

Return value:

Returns TRUE on success or FALSE on failure. To retrieve extended error information, call the osGetLastError function.

Description:

This function configures the operational parameters and starts the specified timer.

Upon creation, a timer is unconfigured and resides in the signaled state. Invoking osSetTimer defines the cycle interval and initiates timing. During each cycle, the timer transitions to the non-signaled state. Once the interval expires, the timer returns to the signaled state, allowing waiting tasks to be synchronized.

The PassCount parameter specifies how many cycles the timer will perform before stopping. After each completed cycle, the internal pass counter increments. If a finite PassCount is specified, the timer automatically stops and remains in the signaled state once that limit is reached. It will not restart until osSetTimer is called again. If PassCount is set to 0, the timer functions as a continuous periodic source, initiating a new cycle each time it is reset without reaching a termination limit.

For additional details regarding timer behavior and reset modes, please refer to the Timer Objects section.

This function is available only when the OS_USE_TIMER configuration constant is set to 1.

Version:1.0
Header file:OS_Timer.h (include OS_API.h)
See also: BOOL, FALSE, HANDLE, INDEX, osCancelTimer, osCreateTimer, osGetLastError, osResetTimer, timers, TIME, TRUE
SpaceShadow documentation