主题中讨论的其他器件:SysConfig
工具与软件:
大家好!
我将在 cc2745 Launchpad 上使用 simplelink_lowpower_f3_sdk_8_40_00_61测试基本 BLE 项目。
我正在尝试使用此 HCI_EXT_SetTxPowerDbmCmd() 函数在运行时修改 TX 功率。
我已更新 SysConfig 中的 TX 功率设置、如下所示:

此外、我将使用 Basic BLE 项目中 Simple GATT 服务的特征1发送命令、以在运行时更改 TX 功率值。 以下是我的代码片段:
/********* changes in app_simple_gatt.c file*******************/
static void SimpleGatt_changeCB( uint8_t paramId )
{
int8_t newValue = 0;
switch( paramId )
{
case SIMPLEGATTPROFILE_CHAR1:
{
SimpleGattProfile_getParameter( SIMPLEGATTPROFILE_CHAR1, &newValue );
// Print the new value of char 1
MenuModule_printf(APP_MENU_PROFILE_STATUS_LINE, 0, "Profile status: Simple profile - "
"Char 1 value = " MENU_MODULE_COLOR_YELLOW "%d " MENU_MODULE_COLOR_RESET,
newValue);
if((newValue<=10) & (newValue>=-10))
{
set_txpower=1;
txpower_value=newValue;
}
}
break;
//.................//
}
/*************** app_simple_gatt.c*************/
/*************** custom task created to change tx power value*************/
void *SystemThread(void *arg0)
{
/* 1 second delay */
uint32_t time = 1;
// so that the application can send and receive messages.
ICall_registerApp(&selfEntityloc_sys, &syncEventloc_sys);
/* Call driver init functions */
GPIO_init();
// I2C_init();
// SPI_init();
// Watchdog_init();
while (1)
{
sleep(time);
GPIO_toggle(CONFIG_GPIO_LED_RED);
if(set_txpower)
{
set_txpower=0;//clear tx power flag
GAP_TerminateLinkReq(0, HCI_DISCONNECT_REMOTE_USER_TERM); //terminate connection
usleep(100000);
stop_adv(); //stop adv
usleep(100000);
HCI_EXT_SetTxPowerDbmCmd(txpower_value,0); //change tx power
MenuModule_printf(9, 0,"tx power changed to %d",txpower_value);
start_adv(); //start adv
}
}
}
但我不能使用上述代码更改 TX 功率。
请向我提供解决此问题的解决方案。
此致、
Aslam

