Command disabled: backlink
 
Available Languages?:

OSA : OS_Ttimer_Get

_OST_TTIMER OS_Ttimer_Get ()

Service uses system timerAllowed only in task and functions called by task

Get task 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.

To use task timers you need to define OS_ENABLE_TTIMERS in OSAcfg.h. Size of current task's timers is set by OS_TTIMER_SIZE constant

Call allowed:

Allowed only in task and functions called by task (any depth)

Parameters:

no

Returns:

_OST_TTIMER integer value of remaining time (in system ticks)

Example:

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

See also

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