OSTmrStart
Description
OSTmrStart() allows the user to start (or restart) the countdown process of a timer. The timer must have previously been created.
Files
os.h/os_tmr.c
Prototype
CPU_BOOLEAN OSTmrStart (OS_TMR *p_tmr,
OS_ERR *p_err)Arguments
p_tmr
is a pointer to the timer to start (or restart).
p_err
a pointer to an error code and can be any of the following:
OS_ERR_NONE
If the timer was started.
OS_ERR_OBJ_TYPE
If OS_CFG_OBJ_TYPE_CHK_EN is set to DEF_ENABLED in os_cfg.h: ‘p_tmr” is not pointing to a timer.
OS_ERR_OS_NOT_RUNNING
If OS_CFG_INVALID_OS_CALLS_CHK_EN is set to DEF_ENABLED in os_cfg.h: if µC/OS-III is not running yet.
OS_ERR_TMR_INACTIVE
p_tmr is pointing to an inactive timer. In other words, this error occurs if pointing to a timer that has been deleted or was not created.
OS_ERR_TMR_INVALID
If OS_CFG_ARG_CHK_EN is set to DEF_ENABLED in os_cfg.h: if p_tmr is a NULL pointer.
OS_ERR_TMR_INVALID_STATE
If the timer is in an invalid state.
OS_ERR_TMR_ISR
If OS_CFG_CALLED_FROM_ISR_CHK_EN set to DEF_ENABLED in os_cfg.h: This function was called from an ISR, which is not allowed.
Returned Values
DEF_TRUE
If the timer was started.
DEF_FALSE
If an error occurred.
Required Configuration
OS_CFG_TMR_EN must be enabled in os_cfg.h. Refer to µC-OS-III Configuration Manual.
Callers
Application.
Notes/Warnings
Do not call this function from an ISR.
The timer must have previously been created.
Example Usage
OSTmrStart() example usage
OS_TMR CloseDoorTmr;
void Task (void *p_arg)
{
OS_ERR err;
CPU_BOOLEAN status;
(void)&p_arg;
while (DEF_ON) {
status = OSTmrStart(&CloseDoorTmr,
&err);
/* Check "err" */
:
:
}
}