
/**********************************************************************
 * INCLUDES
 */
#include "ikk-debug.h"
#include "ikk-tick-handler.h"
#include "tl_common.h"



static ev_timer_event_t *Tick_timerEvt = NULL;

extern void kBtnModuleActionDetectCallback(void );
//extern bool kBtnModuleActionIsGoing(void );
extern void kLedModuleActionDetectCallback(void );
//extern bool kLedModuleActionIsGoing(void );
extern void kNwkModuleActionDetectCallback(void );
//attribute change check callback
extern void kRelayModuleActionDetectCallback(uint8_t poll_time);
//attribute change check callback
extern void AttributeValueCheckCallback(void);

static s32 kTickEventHandler(void *arg)
{
	kLedModuleActionDetectCallback();
	kBtnModuleActionDetectCallback();
	kNwkModuleActionDetectCallback();
	kRelayModuleActionDetectCallback(TICK_LOOP_NMS);
	AttributeValueCheckCallback();
	return 0;
}




void Tick_Time_Init(void)
{
	if(Tick_timerEvt){
		TL_ZB_TIMER_CANCEL(&Tick_timerEvt);
	}
	Tick_timerEvt = TL_ZB_TIMER_SCHEDULE(kTickEventHandler, NULL, TICK_LOOP_NMS);
}


/* DESP: tick handler continue running trigger interface.
 * Auth: dingmz_frc.20191107.
 * */
void kTickRunnningTrigger(void )
{
	if(!ev_timer_exist(Tick_timerEvt)) {
		Tick_timerEvt = TL_ZB_TIMER_SCHEDULE(kTickEventHandler, NULL, TICK_LOOP_NMS);
	}
}




