phy更新回调函数在哪? 1、app_task.c里加上{GAPC_LE_PHY_IND, (ke_msg_func_t)gapc_le_phy_ind_handler},参考图上语句 2、添加如下两个函数 static int gapc_le_phy_ind_handler(ke_msg_id_t const msgid, struct gapc_le_phy_ind *param, ke_task_id_t const dest_id, ke_task_id_t const src_id) { LOG_VBS_FUNC(); LOG_INF("PHY: tx %dM, rx %dM", param->tx_phy, param->rx_phy); return (KE_MSG_CONSUMED); } void app_phy_req(void) { struct gapc_set_phy_cmd *cmd = KE_MSG_ALLOC(GAPC_SET_PHY_CMD, TASK_GAPC, TASK_APP, gapc_set_phy_cmd); cmd->operation = GAPC_SET_PHY; cmd->tx_phy = GAP_PHY_LE_2MBPS; cmd->rx_phy = GAP_PHY_LE_2MBPS; cmd->phy_opt = GAPC_PHY_OPT_LE_CODED_ALL_RATES; ke_msg_send(cmd); } 3、在连接成功回调函数gapc_connection_req_ind_handler中调用函数app_phy_req 注意:以上所有操作都是建立在硬件以及软件配置上支持2M phy通信的基础上,才会生效。6621CX系列的芯片软件中需要在app_task.c中做如下配置,才会支持2M phy: /// Preferred LE PHY for data transmission (@see enum gap_phy) cmd->tx_pref_phy = GAP_PHY_LE_2MBPS; /// Preferred LE PHY for data reception (@see enum gap_phy) cmd->rx_pref_phy = GAP_PHY_LE_2MBPS;
|