zigbee 代码 段

来源:互联网 发布:mac地址泛洪攻击工具 编辑:程序博客网 时间:2024/06/16 07:52
void RefNode_Init( byte task_id ){ refNode_Config_t config; grpAddr.addrMode = (afAddrMode_t)afAddrGroup; grpAddr.endPoint = LOCATION_REFNODE_ENDPOINT; grpAddr.addr.shortAddr = LOCATION_GROUPS_ADDR; RefNode_TaskID = task_id; config.x = LOC_DEFAULT_X_Y; config.y = LOC_DEFAULT_X_Y; if ( ZSUCCESS == osal_nv_item_init( LOC_NV_REFNODE_CONFIG, sizeof(refNode_Config_t), &config ) ) { osal_nv_read( LOC_NV_REFNODE_CONFIG, 0, sizeof( refNode_Config_t ), &config ); } else { osal_nv_write( LOC_NV_REFNODE_CONFIG, 0, sizeof( refNode_Config_t ), &config ); } TXCTRLL=PowerTX;//设置功率寄存器 osal_nv_write( LOC_NV_POWERTX_CONFIG, 0, 1, &PowerTX ); //功率设置,写入flash rspMsg[REFNODE_CONFIG_X_LO_IDX] = LO_UINT16( config.x ); rspMsg[REFNODE_CONFIG_X_HI_IDX] = HI_UINT16( config.x ); rspMsg[REFNODE_CONFIG_Y_LO_IDX] = LO_UINT16( config.y ); rspMsg[REFNODE_CONFIG_Y_HI_IDX] = HI_UINT16( config.y ); cfgAddr.addrMode = afAddrNotPresent; rspAddr.addrMode = afAddrNotPresent; // Register the endpoint/interface description with the AF. afRegister( (endPointDesc_t *)&epDesc ); // Register for all key events - This app will handle all key events. // RegisterForKeys( RefNode_TaskID ); macAdd=NLME_GetExtAddr();//获得mac地址 location_group.ID = LOCATION_GROUPSID; osal_memcpy( location_group.name, "Group 1", 7 );//添加一个分组 aps_AddGroup(LOCATION_REFNODE_ENDPOINT,&location_group); #if defined ( LCD_SUPPORTED ) HalLcdWriteString( "Location-RefNode", HAL_LCD_LINE_2 );#endif HalLedSet( HAL_LED_1, HAL_LED_MODE_OFF );//P1.1关,高电平,控制CC2591 RX高增益接收模式 osal_start_timerEx( RefNode_TaskID, TURN_OFF_AF, 6000 );//定时开关RF}