/***************************************************************************** * 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; }
/****************************************************************************** * LED_Init * * Initialize the LED system. *******************************************************************************/ void LED_Init(void) { /* Create and init all LEDs */ InitLed(); /* allocate a timer for use in flashing LEDs */ mLEDTimerID = TMR_AllocateTimer(); TurnOffLeds(); }
/***************************************************************************** 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(); }
/***************************************************************************** * Initialization function for the App Task. This is called during * initialization and should contain any application specific initialization * (ie. hardware initialization/setup, table initialization, power up * notificaiton. * * Interface assumptions: None * * Return value: None * *****************************************************************************/ void MApp_init(void) { /* The initial application state */ gState = stateInit; /* Reset number of pending packets */ mcPendingPackets = 0; /* Allow sending a poll request */ mWaitPollConfirm = FALSE; /* Initialize the poll interval */ mPollInterval = mDefaultValueOfPollIntervalSlow_c; /* Initialize the MAC 802.15.4 extended address */ Init_MacExtendedAddress(); mTimer_c = TMR_AllocateTimer(); /* register keyboard callback function */ KBD_Init(App_HandleKeys); /* initialize LCD Module */ LCD_Init(); /* initialize LED Module */ LED_Init(); //WSNProject /*initialize the usage of power consumption*/ PWR_CheckForAndEnterNewPowerState_Init(); /* Initialize the UART so that we can print out status messages */ UartX_SetBaud(gUartDefaultBaud_c); UartX_SetRxCallBack(UartRxCallBack); /* Prepare input queues.*/ MSG_InitQueue(&mMlmeNwkInputQueue); MSG_InitQueue(&mMcpsNwkInputQueue); /* Enable MCU interrupts */ IntEnableAll(); /*signal app ready*/ Led1Flashing(); Led2Flashing(); Led3Flashing(); Led4Flashing(); UartUtil_Print("\n\rPress any switch on board to start running the application.\n\r", gAllowToBlock_d); LCD_ClearDisplay(); LCD_WriteString(1,"Press any key"); LCD_WriteString(2,"to start."); }
/****************************************************************************** * 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 */ }