創建好的軟件定時器需要調用OSTmrStart()函數來啓動軟件定時器
函數原型:CPU_BOOLEAN OSTmrStart (OS_TMR *p_tmr,
OS_ERR *p_err)
功能:This function is called by your application code to start a timer. 啓動一個軟件定時器。
參數:p_tmr:Is a pointer to an OS_TMR 定時器控制塊指針
p_err: Is a pointer to an error code. '*p_err' will contain one of the following: 返回錯誤類型
OS_ERR_NONE
OS_ERR_OBJ_TYPE if 'p_tmr' is not pointing to a timer
OS_ERR_TMR_INVALID
OS_ERR_TMR_INACTIVE if the timer was not created
OS_ERR_TMR_INVALID_STATE the timer is in an invalid state
OS_ERR_TMR_ISR if the call was made from an ISR
返回值:DEF_TRUE,執行成功 is the timer was started
DEF_FALSE,執行失敗。 if not or upon an error
注意事項:
1、創建前必須先申明一個定時器對象
2、一次性定時dly不能爲0
3、週期定時period不能爲0
4、不可以在中斷中調用該函數
在中斷函數中開啓定時器,一直開啓不成功!!!!!!!!!!!!!!!!!!!!