How can I add delay of 10 seconds in Home Appliance application of Zigbee?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

How can I add delay of 10 seconds in Home Appliance application of Zigbee?

1,694 次查看
aamirlatif
Contributor I

Hi,

I need suggestion that how can I add delay of 10 seconds in Home Appliance application of Zigbee?

I will be thankful if you can guide me. I know there are timers but I am not able to use them to server my purpose.

Regards

Thanks

标记 (2)
0 项奖励
回复
1 回复

1,495 次查看
EarlOrlando
Senior Contributor II

Hello Aamir,

I think that the software timers are the best solution to generate a delay. Which is the problem with the timers that doesn't serve your purpose?

The software timers needs a callback, this callback is called either periodically or once (depending on the configuration). This callback needs to be defined as listed below:

#include "TMR_Interface.h"

void GenericTimerCallback(tmrTimerID_t timerID);

It is mandatory to allocate the timer before use it:

tmrTimerID_t timerID = TMR_AllocateTimer();

There is a function to start the timer:

int miliseconds = 10000;

TMR_StartTimer(timerID, gTmrSingleShotTimer_c, TmrMilliseconds(miliseconds), GenericTimerCallback);

The parameter gTmrSingleShotTimer_c can be changed to be gTmrIntervalTimer_c (periodical).

Also, there are another function to stop it.

TMR_StopTimer(timerID);

I recommend you to take a look into the file PLM/Interface/TMR_Interface.h to obtain a better description of these functions and macros.

I hope this helps.

Best regards,

Earl.

0 项奖励
回复