在开发z-wave时候往往经常使用定时器,以下举例使用SDK中提供的API中的TimerStart函数:
/--------------------------- TimerStart ---------------------------------------------
** Register a function that is called when the specified time has elapsed.
** The function is called “repeats” times before the timer is stopped.
**
** BYTE RET Timer handle ( 1 to XX if success, 0xFF if failed)
** TimerStart(
** VOID_CALLBACKFUNC(func)(), IN Timeout function adddress
** BYTE timerTicks, IN Timeout value (value * 10 msec.)
** BYTE repeats); IN Number of function calls (-1: forever)
**--------------------------------------------------------------------------/
BYTE TimerStart(func,ticks,repeats)
在zw_timer_api.h头文件里面有注释参数用途,其实说白就是func参数时回调函数,然后tickis是设定定时超时时间,1-255最大为2.55s,1代表超时10毫秒;reperts参数回调次数
/*led drive function---------------------------------------*/
//串口函数打印没有写出来,可以删掉
//先定义变量和函数
BYTE led0TimerHandle=0;
BYTE goON;
void ZCB_LED0Blinker(void);
void ZCB_StopLED0Blink