你好,当前开发环境:
1,目前的开发环境SDK是simplelink_cc2640r2_sdk_1_40_00_45
2,编译器是IAR 8.11
3,例程目的是实现cc2640r2f long rang模式下广播数据,在官方例程simple_broadcaster基础上修改,使其工作在long range模式
我这边遇到的问题就是不知道具体怎么做才能使CC2640R2F工作在long range模式125kbps,请帮忙解答,谢谢。
Alvin Chen:
请直接参考peripheral里面的设置。
// Setup and start Advertising// For more information, see the GAP section in the User's Guide:// software-dl.ti.com/.../// Temporary memory for advertising parameters for set #1. These will be copied// by the GapAdv moduleGapAdv_params_t advParamLegacy = GAPADV_PARAMS_LEGACY_SCANN_CONN;// Create Advertisement set #1 and assign handlestatus = GapAdv_create(&SimplePeripheral_advCallback, &advParamLegacy,&advHandleLegacy);SIMPLEPERIPHERAL_ASSERT(status == SUCCESS);// Load advertising data for set #1 that is statically allocated by the appstatus = GapAdv_loadByHandle(advHandleLegacy, GAP_ADV_DATA_TYPE_ADV,sizeof(advertData), advertData);SIMPLEPERIPHERAL_ASSERT(status == SUCCESS);// Load scan response data for set #1 that is statically allocated by the appstatus = GapAdv_loadByHandle(advHandleLegacy, GAP_ADV_DATA_TYPE_SCAN_RSP,sizeof(scanRspData), scanRspData);SIMPLEPERIPHERAL_ASSERT(status == SUCCESS);// Set event mask for set #1status = GapAdv_setEventMask(advHandleLegacy,GAP_ADV_EVT_MASK_START_AFTER_ENABLE |GAP_ADV_EVT_MASK_END_AFTER_DISABLE |GAP_ADV_EVT_MASK_SET_TERMINATED);// Enable legacy advertising for set #1status = GapAdv_enable(advHandleLegacy, GAP_ADV_ENABLE_OPTIONS_USE_MAX , 0);SIMPLEPERIPHERAL_ASSERT(status == SUCCESS);// Use long range params to create long range set #2GapAdv_params_t advParamLongRange = GAPADV_PARAMS_AE_LONG_RANGE_CONN;// Create Advertisement set #2 and assign handlestatus = GapAdv_create(&SimplePeripheral_advCallback, &advParamLongRange,&advHandleLongRange);SIMPLEPERIPHERAL_ASSERT(status == SUCCESS);// Load advertising data for set #2 that is statically allocated by the appstatus = GapAdv_loadByHandle(advHandleLongRange, GAP_ADV_DATA_TYPE_ADV,sizeof(advertData), advertData);SIMPLEPERIPHERAL_ASSERT(status == SUCCESS);// Load scan response data for set #2 that is statically allocated by the appstatus = GapAdv_loadByHandle(advHandleLongRange, GAP_ADV_DATA_TYPE_SCAN_RSP,sizeof(scanRspData), scanRspData);SIMPLEPERIPHERAL_ASSERT(status == SUCCESS);// Set event mask for set #2status = GapAdv_setEventMask(advHandleLongRange,GAP_ADV_EVT_MASK_START_AFTER_ENABLE |GAP_ADV_EVT_MASK_END_AFTER_DISABLE |GAP_ADV_EVT_MASK_SET_TERMINATED);// Enable long range advertising for set #2status = GapAdv_enable(advHandleLongRange, GAP_ADV_ENABLE_OPTIONS_USE_MAX , 0);SIMPLEPERIPHERAL_ASSERT(status == SUCCESS);// Display device addressDisplay_printf(dispHandle, SP_ROW_IDA, 0, "%s Addr: %s",(addrMode <= ADDRMODE_RANDOM) ? "Dev" : "ID",Util_convertBdAddr2Str(pPkt->devAddr));通常手机是无法测试的,需要两个板子。