...
Files
os.h/os_flag.c
Prototype
Code Block |
---|
OS_FLAGS OSFlagPost (OS_FLAG_GRP *p_grp,
OS_FLAGS flags,
OS_OPT opt,
OS_ERR *p_err) |
Arguments
p_grp
is a pointer to the event flag group.
...
OS_ERR_NONE
the call is successful.
OS_ERR_INT_Q_FULL
If OS_CFG_ISR_POST_DEFERRED_EN
is to DEF_ENABLED
in os_cfg.h
: If the deferred interrupt post queue is full.
OS_ERR_OBJ_PTR_NULL
If OS_CFG_ARG_CHK_EN
is set to DEF_ENABLED
in os_cfg.h
: if the caller passed a NULL
pointer.
...
- Event flag groups must be created before they are used.
- The execution time of this function depends on the number of tasks waiting on the event flag group. However, the execution time is still deterministic.
- Although the example below shows that we are posting from a task,
OSFlagPost()
can also be called from an ISR.
Example Usage
...
Code Block | ||
---|---|---|
| ||
#define ENGINE_OIL_PRES_OK 0x01
#define ENGINE_OIL_TEMP_OK 0x02
#define ENGINE_START 0x04
OS_FLAG_GRP EngineStatusFlags;
void TaskX (void *p_arg)
{
OS_ERR err;
OS_FLAGS flags;
(void)&p_arg;
while (DEF_ON) {
:
:
flags = OSFlagPost(&EngineStatusFlags,
ENGINE_START,
OS_OPT_POST_FLAG_SET,
&err);
/* Check 'err" */
:
:
}
} |