/**************************************************************************************************
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"
#include "MT_APP.h"
#include "MT.h"
#include "DHT11.h" //添加温度传感器头文件
#include "12864.h"
unsigned char suc;
#define FMQ P1_1
#define T_Hthreshold 27
#define T_Lthreshold 19
#define R_Hthreshold 50
#define R_Lthreshold 20
/*********************************************************************
* 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;
afAddrType_t Point_To_Point_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_SendPointToPointMessage(void); //网蜂点对点通讯定义
void SampleApp_SendFlashMessage( uint16 flashTime );
void SampleApp_SerialCMD(mtOSALSerialData_t *cmdMsg);
/*********************************************************************
* 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;
/***********串口初始化************/
CLKCONCMD &= ~0x40; //设置系统时钟源为32MHZ晶振
while(CLKCONSTA & 0x40); //等待晶振稳定为32M
CLKCONCMD &= ~0x47; //设置系统主时钟频率为32MHZ
MT_UartInit();//初始化
MT_UartRegisterTaskID(task_id);//登记任务号
HalUARTWrite(0,"Intelligent Detection\n",22);
P0SEL&=0x0c;
P1DIR|=0x02;
P0DIR|=0xf2;
PSB=0;
// UART0_Init();
initial_12864();
// Device hardware initialization can be added here or in main() (Zmain.c).
// If the hardware is application specific - add it here.
// If
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
温室农作物温湿度测控系统 (608个子文件)
SampleApp.cspy.bat 3KB
SampleApp.c 20KB
OSAL_SampleApp.c 5KB
SampleAppHw.c 5KB
12864.c 3KB
ds18b20.c 2KB
DHT11.C 1KB
SampleApp.d51 2.46MB
SampleApp.d51 2.41MB
SampleApp.d51 1.92MB
SampleApp.dbgdt 4KB
SampleApp.dep 310KB
SampleApp.dni 573B
SampleApp.ewd 134KB
Backup of SampleApp.ewd 103KB
SampleApp.ewp 254KB
Backup of SampleApp.ewp 245KB
SampleApp.eww 163B
SampleApp.h 4KB
SampleAppHw.h 3KB
12864.h 648B
DHT11.H 180B
ZDObject.lst 598KB
ZDObject.lst 598KB
ZDObject.lst 598KB
ZDSecMgr.lst 506KB
ZDSecMgr.lst 490KB
ZDSecMgr.lst 486KB
ZDProfile.lst 357KB
ZDProfile.lst 357KB
ZDProfile.lst 343KB
ZDApp.lst 323KB
ZDApp.lst 316KB
ZDApp.lst 316KB
OSAL_Nv.lst 214KB
OSAL_Nv.lst 214KB
OSAL_Nv.lst 214KB
OSAL.lst 167KB
OSAL.lst 167KB
OSAL.lst 167KB
mac_rx.lst 162KB
mac_rx.lst 162KB
mac_rx.lst 162KB
AF.lst 158KB
AF.lst 158KB
AF.lst 158KB
ZDNwkMgr.lst 146KB
ZDNwkMgr.lst 146KB
ZDNwkMgr.lst 145KB
hal_lcd.lst 140KB
hal_lcd.lst 140KB
hal_lcd.lst 140KB
hal_timer.lst 122KB
hal_timer.lst 122KB
hal_timer.lst 122KB
mac_mcu.lst 110KB
mac_mcu.lst 110KB
mac_mcu.lst 110KB
MT_SYS.lst 107KB
SampleApp.lst 104KB
SampleApp.lst 104KB
SampleApp.lst 104KB
zmac.lst 102KB
zmac.lst 102KB
zmac.lst 101KB
MT_AF.lst 96KB
MT_AF.lst 96KB
MT_AF.lst 95KB
mac_csp_tx.lst 95KB
mac_csp_tx.lst 95KB
mac_csp_tx.lst 95KB
MT_ZDO.lst 93KB
MT_ZDO.lst 93KB
MT_ZDO.lst 93KB
mac_tx.lst 92KB
mac_tx.lst 92KB
mac_tx.lst 92KB
hal_uart.lst 87KB
hal_uart.lst 87KB
hal_uart.lst 86KB
ZGlobals.lst 86KB
MT.lst 86KB
ZGlobals.lst 86KB
ZGlobals.lst 85KB
MT.lst 85KB
MT.lst 85KB
mac_autopend.lst 85KB
mac_autopend.lst 85KB
mac_autopend.lst 85KB
mac_backoff_timer.lst 78KB
mac_backoff_timer.lst 78KB
mac_backoff_timer.lst 78KB
OSAL_Timers.lst 77KB
OSAL_Timers.lst 77KB
OSAL_Timers.lst 77KB
hal_led.lst 75KB
hal_led.lst 75KB
hal_led.lst 75KB
mac_radio.lst 75KB
mac_radio.lst 75KB
共 608 条
- 1
- 2
- 3
- 4
- 5
- 6
- 7
资源评论
- 丁丁20122013-07-06只有资料,没有源代码
junwugui
- 粉丝: 0
- 资源: 6
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功