- Main Page
- Modules
- Data Structures
- Files

# Flag Functions
[Abstracted Functions]

## Typedefs
typedef POSFLAG_t | NOSFLAG_t
## Functions
NANOEXT NOSFLAG_t | nosFlagCreate (const char *name)
NANOEXT void | nosFlagDestroy (NOSFLAG_t flg)
NANOEXT VAR_t | nosFlagSet (NOSFLAG_t flg, UVAR_t flgnum)
NANOEXT VAR_t | nosFlagGet (NOSFLAG_t flg, UVAR_t mode)
NANOEXT VAR_t | nosFlagWait (NOSFLAG_t flg, UINT_t timeoutticks)

## Detailed Description

For detailed information about using flags please see detailed description of flags

## Typedef Documentation

typedef POSFLAG_t NOSFLAG_t

| Handle to a nano layer flag object.

## Function Documentation

NANOEXT NOSFLAG_t nosFlagCreate | ( | const char * | name | ) |

  | Flag function. Allocates a flag object. A flag object behaves like an array of one bit semaphores. The object can hold up to MVAR_BITS - 1 flags. The flags can be used to simulate events, so a single thread can wait for several events simultaneously. Parameters:
  | name | Name of the new flag object to create. If the last character in the name is an asteriks (*), the operating system automatically assigns the flag an unique name. name (the registry feature must be enabled for this automatism). This parameter can be NULL if the nano layer registry feature is not used and will not be used in future.
Returns: handle to the new flag object. NULL is returned on error. Note: NOSCFG_FEATURE_FLAGS must be defined to 1 to have flag support compiled in. You must use nosFlagDestroy to destroy the flag object again. Even if the function posFlagDestroy would work also, it is required to call nosFlagDestroy. Only this function removes the flag object from the registry. Dependent of your configuration, this function can be defined as macro to decrease code size. See also: nosFlagGet, nosFlagSet, nosFlagDestroy

NANOEXT void nosFlagDestroy | ( | NOSFLAG_t | flg | ) |

  | Flag function. Frees an unused flag object again. Parameters:
  | flg | handle to the flag object.
Note: NOSCFG_FEATURE_FLAGS must be defined to 1 to have flag support compiled in. POSCFG_FEATURE_FLAGDESTROY must be defined to 1 to have this function compiled in. Dependent of your configuration, this function can be defined as macro to decrease code size. See also: nosFlagCreate

NANOEXT VAR_t nosFlagGet | ( | NOSFLAG_t | flg,
|  | UVAR_t | mode
| ) |

  | Flag function. Pends on a flag object and waits until one of the flags in the flag object is set. Parameters:
  | flg | Handle to the flag object.
  | mode | can be NOSFLAG_MODE_GETSINGLE or NOSFLAG_MODE_GETMASK.
Returns: the number of the next flag that is set when mode is set to NOSFLAG_MODE_GETSINGLE. When mode is set to NOSFLAG_MODE_GETMASK, a bit mask with all set flags is returned. A negative value is returned on error. Note: NOSCFG_FEATURE_FLAGS must be defined to 1 to have flag support compiled in. Dependent of your configuration, this function can be defined as macro to decrease code size. See also: nosFlagCreate, nosFlagSet, nosFlagWait

NANOEXT VAR_t nosFlagSet | ( | NOSFLAG_t | flg,
|  | UVAR_t | flgnum
| ) |

  | Flag function. Sets a flag bit in the flag object and sets the task that pends on the flag object to running state. Parameters:
  | flg | Handle to the flag object.
  | flgnum | Number of the flag to set. The flag number must be in the range of 0 .. MVAR_BITS - 2.
Returns: zero on success. Note: NOSCFG_FEATURE_FLAGS must be defined to 1 to have flag support compiled in. Dependent of your configuration, this function can be defined as macro to decrease code size. See also: nosFlagCreate, nosFlagGet, nosFlagWait

NANOEXT VAR_t nosFlagWait | ( | NOSFLAG_t | flg,
|  | UINT_t | timeoutticks
| ) |

  | Flag function. Pends on a flag object and waits until one of the flags in the flag object is set or a timeout has happened. Parameters:
  | flg | handle to the flag object.
  | timeoutticks | timeout in timer ticks (see HZ define and MS macro). If this parameter is set to zero, the function immediately returns. If this parameter is set to INFINITE, the function will never time out.
Returns: a mask of all set flags (positive value). If zero is returned, the timeout was reached. A negative value denotes an error. Note: NOSCFG_FEATURE_FLAGS must be defined to 1 to have flag support compiled in. POSCFG_FEATURE_FLAGWAIT must be defined to 1 to have this function compiled in. Dependent of your configuration, this function can be defined as macro to decrease code size. See also: nosFlagCreate, nosFlagSet, nosFlagGet, HZ, MS