/**************************************************************************************************
Filename: SampleApp.c
Revised: $Date: 2009-03-18 15:56:27 -0700 (Wed, 18 Mar 2009) $
Revision: $Revision: 19453 $
Description: Sample Application (no Profile).
Copyright 2007 Texas Instruments Incorporated. All rights reserved.
IMPORTANT: Your use of this Software is limited to those specific rights
granted under the terms of a software license agreement between the user
who downloaded the software, his/her employer (which must be your employer)
and Texas Instruments Incorporated (the "License"). You may not use this
Software unless you agree to abide by the terms of the License. The License
limits your use, and you acknowledge, that the Software may not be modified,
copied or distributed unless embedded on a Texas Instruments microcontroller
or used solely and exclusively in conjunction with a Texas Instruments radio
frequency transceiver, which is integrated into your product. Other than for
the foregoing purpose, you may not use, reproduce, copy, prepare derivative
works of, modify, distribute, perform, display or sell this Software and/or
its documentation for any purpose.
YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
PROVIDED 揂S IS?WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,
NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
Should you have any questions regarding your right to use this Software,
contact Texas Instruments Incorporated at www.TI.com.
**************************************************************************************************/
/*********************************************************************
This application isn't intended to do anything useful, it is
intended to be a simple example of an application's structure.
This application sends it's messages either as broadcast or
broadcast filtered group messages. The other (more normal)
message addressing is unicast. Most of the other sample
applications are written to support the unicast message model.
Key control:
SW1: Sends a flash command to all devices in Group 1.
SW2: Adds/Removes (toggles) this device in and out
of Group 1. This will enable and disable the
reception of the flash command.
*********************************************************************/
/*********************************************************************
* INCLUDES
*/
#include "OSAL.h"
#include "ZGlobals.h"
#include "AF.h"
#include "aps_groups.h"
#include "ZDApp.h"
#include "SampleApp.h"
#include "SampleAppHw.h"
#include "OnBoard.h"
/* HAL */
#include "hal_lcd.h"
#include "hal_led.h"
#include "hal_key.h"
#include "MT_UART.h"
/*********************************************************************
* MACROS
*/
/*********************************************************************
* CONSTANTS
*/
/*********************************************************************
* TYPEDEFS
*/
/*********************************************************************
* GLOBAL VARIABLES
*/
// This list should be filled with Application specific Cluster IDs.
const cId_t SampleApp_ClusterList[SAMPLEAPP_MAX_CLUSTERS] =
{
SAMPLEAPP_PERIODIC_CLUSTERID,
SAMPLEAPP_FLASH_CLUSTERID
};
const SimpleDescriptionFormat_t SampleApp_SimpleDesc =
{
SAMPLEAPP_ENDPOINT, // int Endpoint;
SAMPLEAPP_PROFID, // uint16 AppProfId[2];
SAMPLEAPP_DEVICEID, // uint16 AppDeviceId[2];
SAMPLEAPP_DEVICE_VERSION, // int AppDevVer:4;
SAMPLEAPP_FLAGS, // int AppFlags:4;
SAMPLEAPP_MAX_CLUSTERS, // uint8 AppNumInClusters;
(cId_t *)SampleApp_ClusterList, // uint8 *pAppInClusterList;
SAMPLEAPP_MAX_CLUSTERS, // uint8 AppNumInClusters;
(cId_t *)SampleApp_ClusterList // uint8 *pAppInClusterList;
};
// This is the Endpoint/Interface description. It is defined here, but
// filled-in in SampleApp_Init(). Another way to go would be to fill
// in the structure here and make it a "const" (in code space). The
// way it's defined in this sample app it is define in RAM.
endPointDesc_t SampleApp_epDesc;
/*********************************************************************
* EXTERNAL VARIABLES
*/
/*********************************************************************
* EXTERNAL FUNCTIONS
*/
/*********************************************************************
* LOCAL VARIABLES
*/
uint8 SampleApp_TaskID; // Task ID for internal task/event processing
// This variable will be received when
// SampleApp_Init() is called.
devStates_t SampleApp_NwkState;
uint8 SampleApp_TransID; // This is the unique message ID (counter)
afAddrType_t SampleApp_Periodic_DstAddr;
afAddrType_t SampleApp_Flash_DstAddr;
aps_Group_t SampleApp_Group;
uint8 SampleAppPeriodicCounter = 0;
uint8 SampleAppFlashCounter = 0;
/*********************************************************************
* LOCAL FUNCTIONS
*/
void SampleApp_HandleKeys( uint8 shift, uint8 keys );
void SampleApp_MessageMSGCB( afIncomingMSGPacket_t *pckt );
void SampleApp_SendPeriodicMessage( void );
void SampleApp_SendFlashMessage( uint16 flashTime );
/*********************************************************************
* NETWORK LAYER CALLBACKS
*/
/*********************************************************************
* PUBLIC FUNCTIONS
*/
/*********************************************************************
* @fn SampleApp_Init
*
* @brief Initialization function for the Generic App Task.
* This is called during initialization and should contain
* any application specific initialization (ie. hardware
* initialization/setup, table initialization, power up
* notificaiton ... ).
*
* @param task_id - the ID assigned by OSAL. This ID should be
* used to send messages and set timers.
*
* @return none
*/
void SampleApp_Init( uint8 task_id )
{
SampleApp_TaskID = task_id;
SampleApp_NwkState = DEV_INIT;
SampleApp_TransID = 0;
MT_UartInit();
MT_UartRegisterTaskID(task_id);//注册串口
HalUARTWrite(0,"Reset",sizeof("Reset"));//提示复位 协调器复位一下 就打印一次也是证明串口配置好得标志
// Device hardware initialization can be added here or in main() (Zmain.c).
// If the hardware is application specific - add it here.
// If the hardware is other parts of the device add it in main().
#if defined ( BUILD_ALL_DEVICES )
// The "Demo" target is setup to have BUILD_ALL_DEVICES and HOLD_AUTO_START
// We are looking at a jumper (defined in SampleAppHw.c) to be jumpered
// together - if they are - we will start up a coordinator. Otherwise,
// the device will start as a router.
if ( readCoordinatorJumper() )
zgDeviceLogicalType = ZG_DEVICETYPE_COORDINATOR;
else
zgDeviceLogicalType = ZG_DEVICETYPE_ROUTER;
#endif // BUILD_ALL_DEVICES
#if defined ( HOLD_AUTO_START )
// HOLD_AUTO_START is a compile option that will surpress ZDApp
// from starting the dev
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
ZigBee 组网传数据 串口打印 (395个子文件)
SampleApp.cspy.bat 1KB
SampleApp.c 17KB
OSAL_SampleApp.c 5KB
SampleAppHw.c 5KB
SampleApp.d51 2.15MB
SampleApp.d51 1.92MB
SampleApp.dbgdt 5KB
SampleApp.dep 151KB
SampleApp.dni 549B
SampleApp.ewd 134KB
Backup of SampleApp.ewd 103KB
SampleApp.ewp 256KB
Backup of SampleApp.ewp 245KB
SampleApp.eww 1KB
SampleApp.h 4KB
SampleAppHw.h 3KB
ZDObject.lst 585KB
ZDObject.lst 575KB
ZDSecMgr.lst 487KB
ZDSecMgr.lst 483KB
ZDProfile.lst 353KB
ZDProfile.lst 340KB
ZDApp.lst 311KB
ZDApp.lst 310KB
OSAL_Nv.lst 211KB
OSAL_Nv.lst 210KB
MT_ZDO.lst 207KB
OSAL.lst 161KB
OSAL.lst 161KB
mac_rx.lst 161KB
mac_rx.lst 161KB
AF.lst 146KB
AF.lst 146KB
ZDNwkMgr.lst 142KB
ZDNwkMgr.lst 139KB
hal_timer.lst 119KB
hal_timer.lst 119KB
hal_lcd.lst 108KB
hal_lcd.lst 108KB
mac_mcu.lst 107KB
mac_mcu.lst 107KB
MT_SYS.lst 106KB
zmac.lst 99KB
zmac.lst 99KB
mac_csp_tx.lst 93KB
mac_csp_tx.lst 93KB
MT_ZDO.lst 92KB
mac_tx.lst 90KB
mac_tx.lst 90KB
hal_uart.lst 85KB
hal_uart.lst 85KB
MT.lst 85KB
ZGlobals.lst 84KB
ZGlobals.lst 84KB
MT.lst 84KB
mac_autopend.lst 82KB
mac_autopend.lst 82KB
MT_AF.lst 80KB
MT_AF.lst 80KB
mac_backoff_timer.lst 74KB
mac_backoff_timer.lst 74KB
OSAL_Timers.lst 73KB
OSAL_Timers.lst 73KB
mac_radio.lst 73KB
mac_radio.lst 72KB
hal_led.lst 72KB
hal_led.lst 72KB
SampleApp.lst 70KB
SampleApp.lst 70KB
hal_sleep.lst 69KB
hal_sleep.lst 69KB
zmac_cb.lst 66KB
nwk_globals.lst 66KB
zmac_cb.lst 66KB
hal_key.lst 64KB
hal_key.lst 64KB
MT_UART.lst 59KB
MT_UART.lst 59KB
MT_NWK.lst 58KB
MT_NWK.lst 58KB
MT_UTIL.lst 58KB
nwk_globals.lst 58KB
MT_UTIL.lst 58KB
ZMain.lst 57KB
OSAL_Memory.lst 57KB
OSAL_Memory.lst 56KB
OSAL_Clock.lst 56KB
OSAL_Clock.lst 56KB
OnBoard.lst 55KB
OnBoard.lst 55KB
MT_SYS.lst 51KB
ZMain.lst 50KB
hal_adc.lst 46KB
hal_adc.lst 45KB
MT_TASK.lst 45KB
mac_rx_onoff.lst 43KB
mac_rx_onoff.lst 43KB
hal_assert.lst 42KB
hal_assert.lst 42KB
MT_SAPI.lst 40KB
共 395 条
- 1
- 2
- 3
- 4
资源评论
田瞩
- 粉丝: 32
- 资源: 48
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功