Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Next »

CPU_BOOLEAN  OSTmrDel(OS_TMR    *p_tmr,
                      OS_ERR    *p_err)

File

Called from

Code enabled by

os_tmr.c

Task only

OS_CFG_TMR_EN and OS_CFG_TMR_DEL_EN

OSTmrDel() allows the user to delete a timer. If a timer was running it will be stopped and then deleted. If the timer has already timed out and is therefore stopped, it will simply be deleted.

It is up to the user to delete unused timers. If deleting a timer, you must not reference it again.

Arguments

p_tmr

is a pointer to the timer to be deleted.

p_err

a pointer to an error code and can be any of the following:

OS_ERR_NONE

If the timer was deleted.

OS_ERR_OBJ_TYPE

If OS_CFG_OBJ_TYPE_CHK_EN is set to 1 in os_cfg.h: if the user did not pass a pointer to a timer.

OS_ERR_TMR_INVALID

If OS_CFG_ARG_CHK_EN is set to 1 in os_cfg.h: if p_tmr is a NULL pointer.

OS_ERR_TMR_ISR

If OS_CFG_CALLED_FROM_ISR_CHK_EN set to 1 in os_cfg.h: This function is called from an ISR, which is not allowed.

OS_ERR_TMR_INACTIVE

p_tmr is pointing to an inactive timer. In other words, this error appears when pointing to a timer that has been deleted.

OS_ERR_TMR_INVALID_STATE

the timer is in an invalid state.

Returned Values

DEF_TRUE if the timer was deleted, DEF_FALSE if not.

Notes/Warnings

  • Do not call this function from an ISR.
  • When deleting a timer, do not reference it again unless you re-create the timer by calling OSTmrCreate().

Example

  • No labels