資源簡(jiǎn)介
利用傳感器HMC5883采集地磁信號(hào),Zigbee(CC2530)進(jìn)行數(shù)據(jù)的傳輸,最后可以調(diào)通程序

代碼片段和文件信息
#include?“OSAL.h“
#include?“AF.h“
#include?“ZDApp.h“
#include?“ZDobject.h“
#include?“ZDProfile.h“
#include?
#include?“Coordinator.h“
#include?“DebugTrace.h“
#if?!defined(?WIN32?)
??#include?“OnBoard.h“
#endif
#include?“hal_lcd.h“
#include?“hal_led.h“
#include?“hal_key.h“
#include?“hal_uart.h“
#include?“OSAL_Nv.h“
const?cId_t?GenericApp_ClusterList[GENERICAPP_MAX_CLUSTERS]?=
{
??GENERICAPP_CLUSTERID
};
const?SimpleDescriptionFormat_t?GenericApp_SimpleDesc?=
{
??GENERICAPP_ENDPOINT??????????????//??int?Endpoint;
??GENERICAPP_PROFID????????????????//??uint16?AppProfId[2];
??GENERICAPP_DEVICEID??????????????//??uint16?AppDeviceId[2];
??GENERICAPP_DEVICE_VERSION????????//??int???AppDevVer:4;
??GENERICAPP_FLAGS?????????????????//??int???AppFlags:4;
??GENERICAPP_MAX_CLUSTERS?????????
??(cId_t?*)GenericApp_ClusterList
???0?
???(cId_t?*)NULL
};
endPointDesc_t?GenericApp_epDesc;
byte?GenericApp_TaskID;???
byte?GenericApp_TransID;??//?This?is?the?unique?message?ID?(counter)
devStates_t?GenericApp_NwkState;
RFTX?rftx;
//RFTX?nodeinfo[2];
//uint8?nodenum?=?0;
void?GenericApp_MessageMSGCB(?afIncomingMSGPacket_t?*pckt?);
void?GenericApp_SendTheMessage(?void?);
void?writeuart(void);
//static?void?rxCB(?uint8?portuint8?event?);
void?GenericApp_Init(?byte?task_id?)
{
??halUARTCfg_t?uartConfig;
??GenericApp_TaskID?=?task_id;
??GenericApp_TransID?=?0;
??GenericApp_epDesc.endPoint?=?GENERICAPP_ENDPOINT;
??GenericApp_epDesc.task_id?=?&GenericApp_TaskID;
??GenericApp_epDesc.simpleDesc
????????????=?(SimpleDescriptionFormat_t?*)&GenericApp_SimpleDesc;
??GenericApp_epDesc.latencyReq?=?noLatencyReqs;
??afRegister(?&GenericApp_epDesc?);
??uartConfig.configured?=?true;
??uartConfig.baudRate?=?HAL_UART_BR_115200;
??uartConfig.flowControl?=?FALSE;
??uartConfig.callBackFunc?=?NULL;
??HalUARTOpen(?0&uartConfig?);
}
UINT16?GenericApp_ProcessEvent(?byte?task_id?UINT16?events?)
{
??afIncomingMSGPacket_t?*MSGpkt;
??if?(?events?&?SYS_EVENT_MSG?)
??{
????MSGpkt?=?(afIncomingMSGPacket_t?*)osal_msg_receive(?GenericApp_TaskID?);
????while?(?MSGpkt?)
????{
??????switch?(?MSGpkt->hdr.event?)
??????{
????????case?AF_INCOMING_MSG_CMD:
??????????GenericApp_MessageMSGCB(?MSGpkt?);
??????????break;
??????????/*******************
????????case?ZDO_STATE_CHANGE:
??????????GenericApp_NwkState?=?(devStates_t)(MSGpkt->hdr.status);
??????????if(GenericApp_NwkState?==?DEV_ROUTER)
??????????{
????????????aps_AddGroup(?GENERICAPP_ENDPOINT&GenericApp_Group?);
??????????}
??????????**********************/
??????
????????default:
??????????break;
??????}
??????osal_msg_deallocate(?(uint8?*)MSGpkt?);
??????MSGpkt?=?(afIncomingMSGPacket_t?*)osal_msg_receive(?GenericApp_TaskID?);
????}
????return?(events?^?SYS_EVENT_MSG);
??}
??return?0;
}
void?GenericApp_MessageMSGCB(?afIncomingMSGPacket_t?*pkt?)
{
??//uint8?instruct[]={‘A‘‘T‘‘+‘‘C‘‘I‘‘P‘‘S‘‘T‘‘A‘‘R‘‘T‘‘=‘‘“‘‘
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件????????6271??2013-06-02?20:00??Coordinator.c
?????文件????????3797??2013-05-15?21:43??Coordinator.h
?????文件????????4698??2013-05-15?21:46??EndDevice.c
?????文件??????272295??2013-06-03?19:03??GenericApp.dep
?????文件???????79448??2008-11-01?11:02??GenericApp.ewd
?????文件??????193396??2013-05-14?22:16??GenericApp.ewp
?????文件?????????942??2013-10-20?16:59??GenericApp.eww
?????文件????????5582??2013-10-20?16:59??Sensor.c
?????文件?????????979??2013-05-15?14:02??Sensor.h
評(píng)論
共有 條評(píng)論