UINT32 LOS_SwtmrCreate ( UINT32  uwInterval,
UINT8  ucMode,
SWTMR_PROC_FUNC  pfnHandler,
UINT16 pusSwTmrID,
UINT32  uwArg,
UINT8  ucRouses,
UINT8  ucSensitive  
)

Create a software timer.

Description:
This API is used to create a software timer that has specified timing duration, timeout handling function, and trigger mode, and to return a handle by which the software timer can be referenced.
注意:
  • Do not use the delay interface in the callback function that handles software timer timeout.
  • Threre are LOSCFG_BASE_CORE_SWTMR_LIMIT timers available, change it's value when necessory.
参数:
参数名称 描述
uwInterval  [IN] Timing duration of the software timer to be created (unit: ms).
ucMode  [IN] Software timer mode. Pass in one of the modes specified by enSwTmrType. There are three types of modes, one-off, periodic, and continuously periodic after one-off, of which the third mode is not supported temporarily.
pfnHandler  [IN] Callback function that handles software timer timeout.
pusSwTmrID  [OUT] Software timer ID created by LOS_SwtmrCreate.
uwArg  [IN] Parameter passed in when the callback function that handles software timer timeout is called.
返回值:
返回值 描述
LOS_ERRNO_SWTMR_INTERVAL_NOT_SUITED  The software timer timeout interval is 0.
LOS_ERRNO_SWTMR_MODE_INVALID  Invalid software timer mode.
LOS_ERRNO_SWTMR_PTR_NULL  The callback function that handles software timer timeout is NULL.
LOS_ERRNO_SWTMR_RET_PTR_NULL  The passed-in software timer ID is NULL.
LOS_ERRNO_SWTMR_MAXSIZE  The number of software timers exceeds the configured permitted maximum number.
LOS_OK  The software timer is successfully created.
Dependency:
  • los_swtmr.h: the header file that contains the API declaration.
参见:
LOS_SwtmrDelete
自从:
Huawei LiteOS V100R001C00