Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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.

...

  1. Event flag groups must be created before they are used.
  2. 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.
  3. Although the example below shows that we are posting from a task, OSFlagPost() can also be called from an ISR.

Example Usage

 

...

Code Block
titleOSFlagPost() example usage
          #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" */
                  :
                  :
              }
          }