void OSTimeSet (OS_TICK ticks,
OS_ERR *p_err)
File | Called from | Code enabled by |
| Task or ISR | N/A |
...
Description
Sets the system clock. The system clock (OSTickCtr
) is a counter, which has a data type of OS_TICK
, and it counts the number of clock ticks since power was applied, or since the system clock was last set.
Files
os.h/os_time.c
Prototype
Code Block |
---|
void OSTimeSet (OS_TICK ticks,
OS_ERR *p_err) |
Arguments
ticks
is the desired value for the system clock, in ticks.
...
is a pointer to a variable that will contain an error code returned by this function.
OS_ERR_NONE
if
If the call was successful.
Returned Value
None
Required Configuration
None
Callers
Application and ISRs.
Notes/Warnings
- You should be careful when using this function because other tasks may depend on the current value of the tick counter (
OSTickCtr
). Specifically, a task may delay itself (seeOSTimeDly()
and specify to wake up whenOSTickCtr
reaches a specific value.
Example Usage
Code Block | ||
---|---|---|
| ||
void TaskX (void *p_arg)
{
OS_ERR err;
while (DEF_ON) {
:
:
OSTimeSet(0,
&err); /* Reset the system clock */
/* Check "err" */
:
:
}
} |