ZigBee_CC2530_0CH_终端动态切换信道

需要开启NV_RESTORE预编译命令

void Change_Channel( uint8 logicalChannel , uint32 ChanList )
{
  uint32 channel_list = ChanList;
  uint8 logical_channel = logicalChannel;  
  _NIB.nwkLogicalChannel = logical_channel;
  NLME_UpdateNV(0x01);
  zgDefaultChannelList = channel_list;
  if(osal_nv_item_init(ZCD_NV_CHANLIST , sizeof(zgDefaultChannelList), &zgDefaultChannelList) == SUCCESS)
    osal_nv_write(ZCD_NV_CHANLIST, 0, sizeof(zgDefaultChannelList), &zgDefaultChannelList);
  //SystemReset();
  osal_start_timerEx( GenericApp_TaskID , RESET_TIME , 2000);
}

如果一次重启不能连接至协调器,可以调用Change_Channel函数再次设置一次。


另:如果终端在其默认的信道上没能连上Coordinater,终端会自动连接至其他信道的Coordinater上



你可能感兴趣的:(ZigBee_CC2530_0CH_终端动态切换信道)