⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mapp_init.c

📁 freescale的基于802.15.4的无线通讯例程
💻 C
字号:
/*****************************************************************************
* Applications' initialization module
*
* (c) Copyright 2006, Freescale, Inc. All rights reserved.
*
*
* No part of this document must be reproduced in any form - including copied,
* transcribed, printed or by any electronic means - without specific written
* permission from Freescale Semiconductor Romania A/S.
*
*****************************************************************************/

#include "Mapp_init.h"

/************************************************************************************
*************************************************************************************
* Private macros
*************************************************************************************
************************************************************************************/


/************************************************************************************
*************************************************************************************
* Private prototypes
*************************************************************************************
************************************************************************************/

void TS_IdleTask(event_t event);

/************************************************************************************
*************************************************************************************
* Private type definitions
*************************************************************************************
************************************************************************************/

/************************************************************************************
*************************************************************************************
* Private memory declarations
*************************************************************************************
************************************************************************************/

extern uint8_t aExtendedAddress[8];

/************************************************************************************
*************************************************************************************
* Public functions
*************************************************************************************
************************************************************************************/

/*****************************************************************************
* main function
*
* Interface assumptions:
* 
* Return value:
* None
*****************************************************************************/

 #if gBootloaderLiteEnabled_c == 1
   void _Startup(void)
 #else
   void main(void)
 #endif  
 {
 #ifdef BOOTLOADER_ENABLED	
   NVM_FindNVRAM();
 #endif	
  /*All LED's are switched OFF*/
 Led1Off
 Led2Off
 Led3Off
 Led4Off
 /* if the board is mc13213 SRB or NCB turn on LED5 */
 #if (gTargetMC13213SRB_d == 1) || (gTargetMC13213NCB_d == 1)
   Led5On
 #endif
 /*do not allow the device to enter sleep mode*/
 PWR_DisallowDeviceToSleep();
 /*initialize the application*/
 MApp_init();
 /*Task scheduler init and scheduling tasks starts here*/  
 TS_Init();
}

/*****************************************************************************
* Entry point to the idle task
*
* Interface assumptions:
* Cannot use any call by which this task has to be suspended.This task should
* always be ready to run if there are no other tasks in the system
* 
* Return value:
* None
*****************************************************************************/

void TS_IdleTask(event_t events)
{
  /* Just to avoid the compiler warning */
  events++;
  #if (gLpmIncluded_d == 1)
    /*Low power management*/
    if(PWR_CheckIfDeviceCanGoToSleep())
      {
      PWR_EnterLowPower();
      }
  #endif /*gLpmIncluded_d*/ 
}


/*****************************************************************************
* Initialize the MAC 64 bit address
*
* Interface assumptions:
* None
* 
* Return value:
* None
*****************************************************************************/
void Init_MacExtendedAddress( void ) 
{

  uint8_t tempExtAddress[8]= {mDefaultValueOfExtendedAddress_c};
  /*Check if Extended address is already generated(if the Extended Address 
  is All "0xFF", it means that no extended address is genereted);If not set
  it to the value chosen by application layer*/
  if((aExtendedAddress[0] & aExtendedAddress[1]
    & aExtendedAddress[2] & aExtendedAddress[3]
    & aExtendedAddress[4] & aExtendedAddress[5]
    & aExtendedAddress[6] & aExtendedAddress[7]) 
    == 0xFF) 
    {
    /*Set the Extended Address From the App*/
    FLib_MemCpy(aExtendedAddress, tempExtAddress, 8);
    }
}











⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -