/***************************************************************************** * ZCL_Init * * Initialize each endpoint which is a ZCL endpoint. ******************************************************************************/ void ZCL_Init ( void ) { /* allocate a timer for identify */ gZclIdentifyTimerID = TMR_AllocateTimer(); /* Initializa the timer for the Level Control Cluster */ gZclLevel_TransitionTimerID = TMR_AllocateTimer(); /* initialize ZTC if enabled */ InitZtcForZcl(); /* reset each cluster to defaults */ ZCL_Reset(); gZclTaskId = TS_CreateTask(gTsZclTaskPriority_c, TS_ZclTask); #if gZclEnableReporting_c /* initialize the ZCL task */ gZclReportingTimerID = TMR_AllocateTimer(); #endif gZclCommonAttr.basicDeviceEnabled = gZclBasicAttr_DeviceEnabled; }
/***************************************************************************** OepAgentInit Initialize the IEEE 11073 Oep layer *****************************************************************************/ void OepAgentInit(zbEndPoint_t ep) { mAgentAddrInfo.srcEndPoint = ep; /* Create the 11073 task */ gOepAgentTaskID = TS_CreateTask(mTsOem11073TaskPriority_c, OepAgentTask); /* Initialize queues */ List_ClearAnchor(&gOepAgentQueue); mTimer = TMR_AllocateTimer(); }
/* Initialize the timer module. */ void TMR_Init(void) { TmrInit(); TmrEnable(gTmrNumber_d); /*enable timer*/ TMR_SetReg(gTmrNumber_d); /*Create the timer task */ mTimerTaskID = TS_CreateTask(gTsTimerTaskPriority_c, TMR_Task); /* Count to maximum (0xffff - 2*4ms(in ticks)), to be sure that the currentTimeInTicks will never roll over previousTimeInTicks in the TMR_Task() */ mMaxToCountDown_c = 0xFFFF - TmrTicksFromMilliseconds(8); /* The TMR_Task()event will not be issued faster than 4ms*/ mTicksFor4ms = TmrTicksFromMilliseconds(4); }
void Main(void) { InterruptInit(); IntDisableAll(); Platform_Init(); TS_Init(); /* Init the kernel. */ TMR_Init(); /* Init the TMR module */ NvModuleInit(); Uart_ModuleInit(); /* This only creates the MAC TS thread. */ MacInit(); /* Use TS for MAC - the MAC TS ID must be known at this step. */ Init_802_15_4(TRUE); #if gZtcIncluded_d Ztc_TaskInit(); #endif /* gZtcIncluded_d */ /*initialize the application*/ gAppTaskID_c = TS_CreateTask(gTsAppTaskPriority_c, AppTask); MApp_init(); #if (gLpmIncluded_d == 1) /*do not allow the device to enter sleep mode*/ PWR_DisallowDeviceToSleep(); #endif /* gLpmIncluded_d == 1 */ /*All LED's are switched OFF*/ Led1Off(); Led2Off(); Led3Off(); Led4Off(); /* Start the task scheduler. Does not return. */ TS_Scheduler(); }
/****************************************************************************** * Initialize the keyboard handling. Works on on Freescale demo boards. *******************************************************************************/ void KBD_Init ( KBDFunction_t pfCallBackAdr /* IN: Pointer to callback function */ ) { /* timer is used to determine short or long key press */ mKeyScanTimerID = TMR_AllocateTimer(); /* where to send the data */ mpfKeyFunction = pfCallBackAdr; /* Init all the Gpio pins for keyboard*/ KbGpioInit(); /*Init the CRM module for external interrupt capability*/ KbCrmInit(); /* Create a task for switches */ mSwTaskID = TS_CreateTask(gTsSwitchTaskPriority_c, KBD_Task); /*Start the timer to detect the center key for joystick*/ #if gJoystickSupported_d TMR_StartIntervalTimer(mKeyScanTimerID, gKeyScanInterval_c, KeyScan); #endif /* gJoystickSupported_d */ }