zigbee学习:示例程序SampleApp中通讯流程
本文博客链接:http://blog.csdn.net/jdh99,作者:jdh,转载请注明.
参考链接:
http://wjf88223.blog.163.com/blog/static/3516800120104711268760/
http://www.cnblogs.com/yqh2007/archive/2011/04/27/2030062.html
环境:
主机:WIN7
开发环境:IAR8.10.3
MCU:CC2530
示例程序:SampleApp
说明:
在此示例程序中,有两种通讯方式:
1.每个设备每隔5s,会发送广播信息
2.按下向上键,设备会向组1发送信息
如果按下向右键,可以加入或退出组1
代码分析:
1.在main()->osal_init_system()->osalInitTasks()中增加示例程序任务SampleApp_Init( taskID )
此函数代码:
void SampleApp_Init( uint8 task_id ){ SampleApp_TaskID = task_id; SampleApp_NwkState = DEV_INIT; SampleApp_TransID = 0; // 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;#