OS_Stimer_Alloc (var_stimer_id)
Allocate static timer for use. There should be at least one free static timer (check with OS_Stimer_Found service)
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
Constant OS_STIMERS_ENABLE_ALLOCATION should be defined in OSAcfg.h.
Not in interrupt
var_stimer_id |
Variable of type unsigned char to store ID of allocated timer. When 0xFF - timer is not allocated |
OS_IsError() |
return true when no free timer to allocate |
void Task (void) { static unsigned char stimer_id; for (;;) { /*...*/ OS_Wait(OS_Stimer_Found()); // Wait for free static timer OS_Stimer_Alloc(stimer_id); // Allocate it for use OS_Stimer_Run(stimer_id, 100); // Now we use static timer through variable do { // ... } while (!OS_Stimer_Check(stimer_id)); OS_Stimer_Free(stimer_id); // Make timer free /*...*/ } }