OSA : OS_Wait_TO

OS_Wait_TO (condition, timeout)

Allowed only in taskSwitches contextUses timer

Wait until condition is true. If timeout expires before this event occurs, then stop waiting with Timeout flag set (see OS_IsTimeout)

Call allowed:

Only in task

Parameters:

condition Any boolean expression
timeout Time of waiting in system ticks - calling OS_Timer periods

Returns:

timeout If timeout expired then system service OS_IsTimeout will return true

Example:

void Task (void)
{
    for (;;) {
        /*...*/
        OS_Wait_TO(RB1 == 1, 50);  // Wait 50 ticks for RB1 == 1
        if (!OS_IsTimeout()) {
            //
            /*...*/
        }
        /*...*/
    }
}

Old style name

OS_WaitConditionTimeout

OS_Cond_Wait_TO

See also