OSA : OS_Stimer_Get

_OST_STIMER OS_Stimer_Get (stimer_id)

Get static timer's remaining time. Before calling this service you should to do one of these things:

Otherwise the timer's value can be changed in interrupt while reading.

Number of static timers OS_STIMERS (1..32) must be specified in OSAcfg.h. Size of static timers is set by OS_STIMER_SIZE constant

Call allowed:

Everywhere

Parameters:

stimer_id Static timer identifier. Number and size of static timers are set in OSAcfg.h with OS_STIMERS and OS_STIMER_SIZE constants

Returns:

_OST_STIMER integer value of remaining time (in system ticks)

Example:

void Task (void)
{
    for (;;) {
        /*...*/
        OS_DI();
        if (OS_Stimer_Get (3) < 10)  // Flash red led if
            RED_LED = 1;             // less than 10 ticks remains
        OS_EI();
        /*...*/
    }
}

Old style name

OS_GetSTimer

See also