/
OSFlagPendGetFlagsRdy
OSFlagPendGetFlagsRdy
Description
Returns the flags that caused the current task to be ready-to-run. This function allows the user to know “Who did it!”
Files
os.h/os_flag.c
Prototype
OS_FLAGS OSFlagPendGetFlagsRdy (OS_ERR *p_err)
Arguments
p_err
is a pointer to an error code and can be:
OS_ERR_NONE
No error.
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_PEND_ISR
If OS_CFG_CALLED_FROM_ISR_CHK_EN
set to DEF_ENABLED
in os_cfg.h
: When attempting to call this function from an ISR.
Returned Value
The value of the flags that caused the current task to become ready-to-run.
Required Configuration
OS_CFG_FLAG_EN
must be enabled in os_cfg.h
. Refer to µC-OS-III Configuration Manual.
Callers
Application.
Notes/Warnings
- The event flag group must be created before it is used.
Example Usage
OSFlagPendGetFlagsRdy() example usage
#define ENGINE_OIL_PRES_OK 0x01 #define ENGINE_OIL_TEMP_OK 0x02 #define ENGINE_START 0x04 OS_FLAG_GRP EngineStatus; void Task (void *p_arg) { OS_ERR err; OS_FLAGS value; OS_FLAGS flags_rdy; (void)&p_arg; while (DEF_ON) { value = OSFlagPend(&EngineStatus, ENGINE_OIL_PRES_OK + ENGINE_OIL_TEMP_OK, OS_FLAG_WAIT_SET_ALL + OS_FLAG_CONSUME, 10, &err); /* Check "err" */ flags_rdy = OSFlagPendGetFlagsRdy(&err); /* Check "err" */ : : } }
Related content
OSFlagPost
OSFlagPost
More like this
OSFlagCreate
OSFlagCreate
More like this
OSFlagPend
OSFlagPend
More like this
OSInit
OSInit
More like this
OSFlagDel
OSFlagDel
More like this
Event Flags API Changes
Event Flags API Changes
More like this