Available Languages?:

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:

  • disable interrupts
  • enter critical section

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

 
en/osa/ref/allservices/os_stimer_get.txt · Last modified: 07.10.2010 13:57 (external edit)
 
Creative Commons License Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki