mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-01 19:54:32 +02:00
Merge branch 'bugfix/fix_c3_some_bugs_06_15_v4.3' into 'release/v4.3'
Bugfix/fix c3 some bugs 06 15 v4.3 See merge request espressif/esp-idf!14017
This commit is contained in:
@@ -383,3 +383,16 @@ config BT_CTRL_HCI_TL_EFF
|
|||||||
default 0 if BT_CTRL_HCI_MODE_UART_H4
|
default 0 if BT_CTRL_HCI_MODE_UART_H4
|
||||||
default 1 if BT_CTRL_HCI_M0DE_VHCI
|
default 1 if BT_CTRL_HCI_M0DE_VHCI
|
||||||
default 1
|
default 1
|
||||||
|
|
||||||
|
config BT_CTRL_AGC_RECORRECT_EN
|
||||||
|
bool "Enable HW AGC recorrect"
|
||||||
|
default n
|
||||||
|
help
|
||||||
|
Enable uncoded phy AGC recorrect
|
||||||
|
|
||||||
|
config BT_CTRL_CODED_AGC_RECORRECT_EN
|
||||||
|
bool "Enable coded phy AGC recorrect"
|
||||||
|
depends on BT_CTRL_AGC_RECORRECT_EN
|
||||||
|
default n
|
||||||
|
help
|
||||||
|
Enable coded phy AGC recorrect
|
||||||
|
Submodule components/bt/controller/lib_esp32c3_family updated: 1b8dfd6acd...12f00c45ce
@@ -5354,19 +5354,39 @@ void bta_dm_ble_set_scan_rsp_raw (tBTA_DM_MSG *p_data)
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
void bta_dm_ble_set_data_length(tBTA_DM_MSG *p_data)
|
void bta_dm_ble_set_data_length(tBTA_DM_MSG *p_data)
|
||||||
{
|
{
|
||||||
|
UINT8 status = BTM_SUCCESS;
|
||||||
tACL_CONN *p_acl_cb = btm_bda_to_acl(p_data->ble_set_data_length.remote_bda, BT_TRANSPORT_LE);
|
tACL_CONN *p_acl_cb = btm_bda_to_acl(p_data->ble_set_data_length.remote_bda, BT_TRANSPORT_LE);
|
||||||
if (p_acl_cb == NULL) {
|
if (p_acl_cb == NULL) {
|
||||||
APPL_TRACE_ERROR("%s error: Invalid connection remote_bda.", __func__);
|
APPL_TRACE_ERROR("%s error: Invalid connection remote_bda.", __func__);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
if(p_acl_cb->data_len_updating) {
|
||||||
|
// aleady have one cmd
|
||||||
|
if(p_acl_cb->data_len_waiting) {
|
||||||
|
status = BTM_ILLEGAL_ACTION;
|
||||||
|
} else {
|
||||||
|
// save the command
|
||||||
|
p_acl_cb->p_set_data_len_cback_waiting = p_data->ble_set_data_length.p_set_pkt_data_cback;
|
||||||
|
p_acl_cb->tx_len_waiting = p_data->ble_set_data_length.tx_data_length;
|
||||||
|
p_acl_cb->data_len_waiting = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
p_acl_cb->p_set_pkt_data_cback = p_data->ble_set_data_length.p_set_pkt_data_cback;
|
p_acl_cb->p_set_pkt_data_cback = p_data->ble_set_data_length.p_set_pkt_data_cback;
|
||||||
|
// if the value of the data length is same, triger callback directly
|
||||||
|
if(p_data->ble_set_data_length.tx_data_length == p_acl_cb->data_length_params.tx_len) {
|
||||||
|
if(p_data->ble_set_data_length.p_set_pkt_data_cback) {
|
||||||
|
(*p_data->ble_set_data_length.p_set_pkt_data_cback)(status, &p_acl_cb->data_length_params);
|
||||||
}
|
}
|
||||||
UINT8 status = BTM_SetBleDataLength(p_data->ble_set_data_length.remote_bda,
|
return;
|
||||||
|
}
|
||||||
|
status = BTM_SetBleDataLength(p_data->ble_set_data_length.remote_bda,
|
||||||
p_data->ble_set_data_length.tx_data_length);
|
p_data->ble_set_data_length.tx_data_length);
|
||||||
|
}
|
||||||
if (status != BTM_SUCCESS) {
|
if (status != BTM_SUCCESS) {
|
||||||
APPL_TRACE_ERROR("%s failed\n", __FUNCTION__);
|
APPL_TRACE_ERROR("%s failed\n", __FUNCTION__);
|
||||||
}
|
}
|
||||||
if (p_data->ble_set_data_length.p_set_pkt_data_cback) {
|
if (p_data->ble_set_data_length.p_set_pkt_data_cback && status != BTM_SUCCESS) {
|
||||||
if (p_acl_cb->data_length_params.tx_len == 0){
|
if (p_acl_cb->data_length_params.tx_len == 0){
|
||||||
uint16_t length = controller_get_interface()->get_acl_data_size_ble();
|
uint16_t length = controller_get_interface()->get_acl_data_size_ble();
|
||||||
p_acl_cb->data_length_params.rx_len = length;
|
p_acl_cb->data_length_params.rx_len = length;
|
||||||
|
@@ -954,6 +954,7 @@ void btm_read_remote_version_complete (UINT8 *p)
|
|||||||
if (HCI_LE_DATA_LEN_EXT_SUPPORTED(p_acl_cb->peer_le_features)) {
|
if (HCI_LE_DATA_LEN_EXT_SUPPORTED(p_acl_cb->peer_le_features)) {
|
||||||
uint16_t data_length = controller_get_interface()->get_ble_default_data_packet_length();
|
uint16_t data_length = controller_get_interface()->get_ble_default_data_packet_length();
|
||||||
uint16_t data_txtime = controller_get_interface()->get_ble_default_data_packet_txtime();
|
uint16_t data_txtime = controller_get_interface()->get_ble_default_data_packet_txtime();
|
||||||
|
p_acl_cb->data_len_updating = true;
|
||||||
btsnd_hcic_ble_set_data_length(p_acl_cb->hci_handle, data_length, data_txtime);
|
btsnd_hcic_ble_set_data_length(p_acl_cb->hci_handle, data_length, data_txtime);
|
||||||
}
|
}
|
||||||
l2cble_notify_le_connection (p_acl_cb->remote_addr);
|
l2cble_notify_le_connection (p_acl_cb->remote_addr);
|
||||||
|
@@ -4199,6 +4199,7 @@ void btm_ble_read_remote_features_complete(UINT8 *p)
|
|||||||
if (HCI_LE_DATA_LEN_EXT_SUPPORTED(p_acl_cb->peer_le_features)) {
|
if (HCI_LE_DATA_LEN_EXT_SUPPORTED(p_acl_cb->peer_le_features)) {
|
||||||
uint16_t data_length = controller_get_interface()->get_ble_default_data_packet_length();
|
uint16_t data_length = controller_get_interface()->get_ble_default_data_packet_length();
|
||||||
uint16_t data_txtime = controller_get_interface()->get_ble_default_data_packet_txtime();
|
uint16_t data_txtime = controller_get_interface()->get_ble_default_data_packet_txtime();
|
||||||
|
p_acl_cb->data_len_updating = true;
|
||||||
btsnd_hcic_ble_set_data_length(p_acl_cb->hci_handle, data_length, data_txtime);
|
btsnd_hcic_ble_set_data_length(p_acl_cb->hci_handle, data_length, data_txtime);
|
||||||
}
|
}
|
||||||
l2cble_notify_le_connection (p_acl_cb->remote_addr);
|
l2cble_notify_le_connection (p_acl_cb->remote_addr);
|
||||||
|
@@ -158,6 +158,11 @@ UINT8 active_remote_addr_type; /* local device address type fo
|
|||||||
BD_FEATURES peer_le_features; /* Peer LE Used features mask for the device */
|
BD_FEATURES peer_le_features; /* Peer LE Used features mask for the device */
|
||||||
tBTM_SET_PKT_DATA_LENGTH_CBACK *p_set_pkt_data_cback;
|
tBTM_SET_PKT_DATA_LENGTH_CBACK *p_set_pkt_data_cback;
|
||||||
tBTM_LE_SET_PKT_DATA_LENGTH_PARAMS data_length_params;
|
tBTM_LE_SET_PKT_DATA_LENGTH_PARAMS data_length_params;
|
||||||
|
BOOLEAN data_len_updating;
|
||||||
|
// data len update cmd cache
|
||||||
|
BOOLEAN data_len_waiting;
|
||||||
|
tBTM_SET_PKT_DATA_LENGTH_CBACK *p_set_data_len_cback_waiting;
|
||||||
|
UINT16 tx_len_waiting;
|
||||||
#endif
|
#endif
|
||||||
tBTM_PM_MCB *p_pm_mode_db; /* Pointer to PM mode control block per ACL link */
|
tBTM_PM_MCB *p_pm_mode_db; /* Pointer to PM mode control block per ACL link */
|
||||||
|
|
||||||
|
@@ -1217,13 +1217,33 @@ void l2cble_process_data_length_change_event(UINT16 handle, UINT16 tx_data_len,
|
|||||||
}
|
}
|
||||||
|
|
||||||
tACL_CONN *p_acl = btm_handle_to_acl(handle);
|
tACL_CONN *p_acl = btm_handle_to_acl(handle);
|
||||||
if (p_acl != NULL && p_acl->p_set_pkt_data_cback){
|
|
||||||
tBTM_LE_SET_PKT_DATA_LENGTH_PARAMS data_length_params;
|
tBTM_LE_SET_PKT_DATA_LENGTH_PARAMS data_length_params;
|
||||||
data_length_params.rx_len = tx_data_len;
|
data_length_params.rx_len = rx_data_len;
|
||||||
data_length_params.tx_len = rx_data_len;
|
data_length_params.tx_len = tx_data_len;
|
||||||
p_acl->data_length_params = data_length_params;
|
p_acl->data_length_params = data_length_params;
|
||||||
|
if (p_acl != NULL && p_acl->p_set_pkt_data_cback){
|
||||||
(*p_acl->p_set_pkt_data_cback)(BTM_SUCCESS, &data_length_params);
|
(*p_acl->p_set_pkt_data_cback)(BTM_SUCCESS, &data_length_params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(p_acl) {
|
||||||
|
p_acl->data_len_updating = false;
|
||||||
|
if(p_acl->data_len_waiting) {
|
||||||
|
p_acl->data_len_waiting = false;
|
||||||
|
p_acl->p_set_pkt_data_cback = p_acl->p_set_data_len_cback_waiting;
|
||||||
|
p_acl->p_set_data_len_cback_waiting = NULL;
|
||||||
|
// if value is same, triger callback directly
|
||||||
|
if(p_acl->tx_len_waiting == p_acl->data_length_params.tx_len) {
|
||||||
|
if(p_acl->p_set_pkt_data_cback) {
|
||||||
|
(*p_acl->p_set_pkt_data_cback)(BTM_SUCCESS, &p_acl->data_length_params);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
p_acl->data_len_updating = true;
|
||||||
|
/* always set the TxTime to be max, as controller does not care for now */
|
||||||
|
btsnd_hcic_ble_set_data_length(handle, p_acl->tx_len_waiting,
|
||||||
|
BTM_BLE_DATA_TX_TIME_MAX);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
@@ -26,7 +26,7 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ESP_BT_CTRL_CONFIG_MAGIC_VAL 0x5A5AA5A5
|
#define ESP_BT_CTRL_CONFIG_MAGIC_VAL 0x5A5AA5A5
|
||||||
#define ESP_BT_CTRL_CONFIG_VERSION 0x02103310
|
#define ESP_BT_CTRL_CONFIG_VERSION 0x02104270
|
||||||
|
|
||||||
#define ESP_BT_HCI_TL_MAGIC_VALUE 0xfadebead
|
#define ESP_BT_HCI_TL_MAGIC_VALUE 0xfadebead
|
||||||
#define ESP_BT_HCI_TL_VERSION 0x00010000
|
#define ESP_BT_HCI_TL_VERSION 0x00010000
|
||||||
@@ -130,6 +130,21 @@ enum {
|
|||||||
#define MESH_DUPLICATE_SCAN_CACHE_SIZE 0
|
#define MESH_DUPLICATE_SCAN_CACHE_SIZE 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_BT_CTRL_AGC_RECORRECT_EN
|
||||||
|
#define BT_CTRL_AGC_RECORRECT_EN CONFIG_BT_CTRL_AGC_RECORRECT_EN
|
||||||
|
#else
|
||||||
|
#define BT_CTRL_AGC_RECORRECT_EN 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_BT_CTRL_CODED_AGC_RECORRECT_EN
|
||||||
|
#define BT_CTRL_CODED_AGC_RECORRECT CONFIG_BT_CTRL_CODED_AGC_RECORRECT_EN
|
||||||
|
#else
|
||||||
|
#define BT_CTRL_CODED_AGC_RECORRECT 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define AGC_RECORRECT_EN ((BT_CTRL_AGC_RECORRECT_EN << 0) | (BT_CTRL_CODED_AGC_RECORRECT <<1))
|
||||||
|
|
||||||
|
|
||||||
#define CFG_MASK_BIT_SCAN_DUPLICATE_OPTION (1<<0)
|
#define CFG_MASK_BIT_SCAN_DUPLICATE_OPTION (1<<0)
|
||||||
|
|
||||||
#define CFG_NASK CFG_MASK_BIT_SCAN_DUPLICATE_OPTION
|
#define CFG_NASK CFG_MASK_BIT_SCAN_DUPLICATE_OPTION
|
||||||
@@ -163,6 +178,7 @@ enum {
|
|||||||
.coex_phy_coded_tx_rx_time_limit = CONFIG_BT_CTRL_COEX_PHY_CODED_TX_RX_TLIM_EFF, \
|
.coex_phy_coded_tx_rx_time_limit = CONFIG_BT_CTRL_COEX_PHY_CODED_TX_RX_TLIM_EFF, \
|
||||||
.hw_target_code = BLE_HW_TARGET_CODE_ESP32C3_CHIP_ECO0, \
|
.hw_target_code = BLE_HW_TARGET_CODE_ESP32C3_CHIP_ECO0, \
|
||||||
.slave_ce_len_min = SLAVE_CE_LEN_MIN_DEFAULT, \
|
.slave_ce_len_min = SLAVE_CE_LEN_MIN_DEFAULT, \
|
||||||
|
.hw_recorrect_en = AGC_RECORRECT_EN, \
|
||||||
};
|
};
|
||||||
|
|
||||||
#else
|
#else
|
||||||
@@ -228,6 +244,7 @@ typedef struct {
|
|||||||
uint8_t coex_phy_coded_tx_rx_time_limit; /*!< limit on max tx/rx time in case of connection using CODED-PHY with Wi-Fi coexistence */
|
uint8_t coex_phy_coded_tx_rx_time_limit; /*!< limit on max tx/rx time in case of connection using CODED-PHY with Wi-Fi coexistence */
|
||||||
uint32_t hw_target_code; /*!< hardware target */
|
uint32_t hw_target_code; /*!< hardware target */
|
||||||
uint8_t slave_ce_len_min;
|
uint8_t slave_ce_len_min;
|
||||||
|
uint8_t hw_recorrect_en;
|
||||||
} esp_bt_controller_config_t;
|
} esp_bt_controller_config_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -368,7 +368,12 @@ void app_main(void)
|
|||||||
}
|
}
|
||||||
ESP_ERROR_CHECK( ret );
|
ESP_ERROR_CHECK( ret );
|
||||||
|
|
||||||
|
#if CONFIG_BT_CLASSIC_ENABLED
|
||||||
ret = esp_hid_gap_init(ESP_BT_MODE_BTDM);
|
ret = esp_hid_gap_init(ESP_BT_MODE_BTDM);
|
||||||
|
#else
|
||||||
|
ret = esp_hid_gap_init(ESP_BT_MODE_BLE);
|
||||||
|
#endif
|
||||||
|
|
||||||
ESP_ERROR_CHECK( ret );
|
ESP_ERROR_CHECK( ret );
|
||||||
|
|
||||||
ret = esp_hid_ble_gap_adv_init(ESP_HID_APPEARANCE_GENERIC, hid_config.device_name);
|
ret = esp_hid_ble_gap_adv_init(ESP_HID_APPEARANCE_GENERIC, hid_config.device_name);
|
||||||
|
@@ -135,6 +135,7 @@ static esp_hid_scan_result_t *find_scan_result(esp_bd_addr_t bda, esp_hid_scan_r
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if CONFIG_BT_CLASSIC_ENABLED
|
||||||
static void add_bt_scan_result(esp_bd_addr_t bda, esp_bt_cod_t *cod, esp_bt_uuid_t *uuid, uint8_t *name, uint8_t name_len, int rssi)
|
static void add_bt_scan_result(esp_bd_addr_t bda, esp_bt_cod_t *cod, esp_bt_uuid_t *uuid, uint8_t *name, uint8_t name_len, int rssi)
|
||||||
{
|
{
|
||||||
esp_hid_scan_result_t *r = find_scan_result(bda, bt_scan_results);
|
esp_hid_scan_result_t *r = find_scan_result(bda, bt_scan_results);
|
||||||
@@ -186,6 +187,7 @@ static void add_bt_scan_result(esp_bd_addr_t bda, esp_bt_cod_t *cod, esp_bt_uuid
|
|||||||
bt_scan_results = r;
|
bt_scan_results = r;
|
||||||
num_bt_scan_results++;
|
num_bt_scan_results++;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void add_ble_scan_result(esp_bd_addr_t bda, esp_ble_addr_type_t addr_type, uint16_t appearance, uint8_t *name, uint8_t name_len, int rssi)
|
static void add_ble_scan_result(esp_bd_addr_t bda, esp_ble_addr_type_t addr_type, uint16_t appearance, uint8_t *name, uint8_t name_len, int rssi)
|
||||||
{
|
{
|
||||||
@@ -237,6 +239,7 @@ void print_uuid(esp_bt_uuid_t *uuid)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if CONFIG_BT_CLASSIC_ENABLED
|
||||||
static void handle_bt_device_result(struct disc_res_param *disc_res)
|
static void handle_bt_device_result(struct disc_res_param *disc_res)
|
||||||
{
|
{
|
||||||
GAP_DBG_PRINTF("BT : " ESP_BD_ADDR_STR, ESP_BD_ADDR_HEX(disc_res->bda));
|
GAP_DBG_PRINTF("BT : " ESP_BD_ADDR_STR, ESP_BD_ADDR_HEX(disc_res->bda));
|
||||||
@@ -325,6 +328,7 @@ static void handle_bt_device_result(struct disc_res_param *disc_res)
|
|||||||
add_bt_scan_result(disc_res->bda, cod, &uuid, name, name_len, rssi);
|
add_bt_scan_result(disc_res->bda, cod, &uuid, name, name_len, rssi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void handle_ble_device_result(struct ble_scan_result_evt_param *scan_rst)
|
static void handle_ble_device_result(struct ble_scan_result_evt_param *scan_rst)
|
||||||
{
|
{
|
||||||
@@ -372,7 +376,7 @@ static void handle_ble_device_result(struct ble_scan_result_evt_param *scan_rst)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if CONFIG_BT_CLASSIC_ENABLED
|
||||||
/*
|
/*
|
||||||
* BT GAP
|
* BT GAP
|
||||||
* */
|
* */
|
||||||
@@ -440,6 +444,7 @@ static esp_err_t start_bt_scan(uint32_t seconds)
|
|||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* BLE GAP
|
* BLE GAP
|
||||||
@@ -671,11 +676,15 @@ static esp_err_t init_low_level(uint8_t mode)
|
|||||||
{
|
{
|
||||||
esp_err_t ret;
|
esp_err_t ret;
|
||||||
esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT();
|
esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT();
|
||||||
|
#if CONFIG_BT_CLASSIC_ENABLED
|
||||||
if (mode & ESP_BT_MODE_CLASSIC_BT) {
|
if (mode & ESP_BT_MODE_CLASSIC_BT) {
|
||||||
bt_cfg.mode = mode;
|
bt_cfg.mode = mode;
|
||||||
bt_cfg.bt_max_acl_conn = 3;
|
bt_cfg.bt_max_acl_conn = 3;
|
||||||
bt_cfg.bt_max_sync_conn = 3;
|
bt_cfg.bt_max_sync_conn = 3;
|
||||||
} else {
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
|
||||||
ret = esp_bt_controller_mem_release(ESP_BT_MODE_CLASSIC_BT);
|
ret = esp_bt_controller_mem_release(ESP_BT_MODE_CLASSIC_BT);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
ESP_LOGE(TAG, "esp_bt_controller_mem_release failed: %d", ret);
|
ESP_LOGE(TAG, "esp_bt_controller_mem_release failed: %d", ret);
|
||||||
@@ -705,13 +714,14 @@ static esp_err_t init_low_level(uint8_t mode)
|
|||||||
ESP_LOGE(TAG, "esp_bluedroid_enable failed: %d", ret);
|
ESP_LOGE(TAG, "esp_bluedroid_enable failed: %d", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
#if CONFIG_BT_CLASSIC_ENABLED
|
||||||
if (mode & ESP_BT_MODE_CLASSIC_BT) {
|
if (mode & ESP_BT_MODE_CLASSIC_BT) {
|
||||||
ret = init_bt_gap();
|
ret = init_bt_gap();
|
||||||
if (ret) {
|
if (ret) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (mode & ESP_BT_MODE_BLE) {
|
if (mode & ESP_BT_MODE_BLE) {
|
||||||
ret = init_ble_gap();
|
ret = init_ble_gap();
|
||||||
@@ -772,9 +782,11 @@ esp_err_t esp_hid_scan(uint32_t seconds, size_t *num_results, esp_hid_scan_resul
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (start_ble_scan(seconds) == ESP_OK) {
|
if (start_ble_scan(seconds) == ESP_OK) {
|
||||||
|
#if CONFIG_BT_CLASSIC_ENABLED
|
||||||
if (start_bt_scan(seconds) == ESP_OK) {
|
if (start_bt_scan(seconds) == ESP_OK) {
|
||||||
WAIT_BT_CB();
|
WAIT_BT_CB();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
WAIT_BLE_CB();
|
WAIT_BLE_CB();
|
||||||
} else {
|
} else {
|
||||||
return ESP_FAIL;
|
return ESP_FAIL;
|
||||||
|
14
examples/bluetooth/esp_hid_device/sdkconfig.defaults.esp32c3
Normal file
14
examples/bluetooth/esp_hid_device/sdkconfig.defaults.esp32c3
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#
|
||||||
|
# Automatically generated file. DO NOT EDIT.
|
||||||
|
# Espressif IoT Development Framework (ESP-IDF) Project Configuration
|
||||||
|
#
|
||||||
|
CONFIG_IDF_CMAKE=y
|
||||||
|
CONFIG_IDF_TARGET_ARCH_RISCV=y
|
||||||
|
CONFIG_IDF_TARGET="esp32c3"
|
||||||
|
CONFIG_IDF_TARGET_ESP32C3=y
|
||||||
|
CONFIG_IDF_FIRMWARE_CHIP_ID=0x0005
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bluetooth
|
||||||
|
#
|
||||||
|
CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y
|
14
examples/bluetooth/esp_hid_device/sdkconfig.defaults.esp32s3
Normal file
14
examples/bluetooth/esp_hid_device/sdkconfig.defaults.esp32s3
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#
|
||||||
|
# Automatically generated file. DO NOT EDIT.
|
||||||
|
# Espressif IoT Development Framework (ESP-IDF) Project Configuration
|
||||||
|
#
|
||||||
|
CONFIG_IDF_CMAKE=y
|
||||||
|
CONFIG_IDF_TARGET_ARCH_RISCV=y
|
||||||
|
CONFIG_IDF_TARGET="esp32c3"
|
||||||
|
CONFIG_IDF_TARGET_ESP32C3=y
|
||||||
|
CONFIG_IDF_FIRMWARE_CHIP_ID=0x0005
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bluetooth
|
||||||
|
#
|
||||||
|
CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y
|
@@ -135,6 +135,7 @@ static esp_hid_scan_result_t *find_scan_result(esp_bd_addr_t bda, esp_hid_scan_r
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if CONFIG_BT_CLASSIC_ENABLED
|
||||||
static void add_bt_scan_result(esp_bd_addr_t bda, esp_bt_cod_t *cod, esp_bt_uuid_t *uuid, uint8_t *name, uint8_t name_len, int rssi)
|
static void add_bt_scan_result(esp_bd_addr_t bda, esp_bt_cod_t *cod, esp_bt_uuid_t *uuid, uint8_t *name, uint8_t name_len, int rssi)
|
||||||
{
|
{
|
||||||
esp_hid_scan_result_t *r = find_scan_result(bda, bt_scan_results);
|
esp_hid_scan_result_t *r = find_scan_result(bda, bt_scan_results);
|
||||||
@@ -186,6 +187,7 @@ static void add_bt_scan_result(esp_bd_addr_t bda, esp_bt_cod_t *cod, esp_bt_uuid
|
|||||||
bt_scan_results = r;
|
bt_scan_results = r;
|
||||||
num_bt_scan_results++;
|
num_bt_scan_results++;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void add_ble_scan_result(esp_bd_addr_t bda, esp_ble_addr_type_t addr_type, uint16_t appearance, uint8_t *name, uint8_t name_len, int rssi)
|
static void add_ble_scan_result(esp_bd_addr_t bda, esp_ble_addr_type_t addr_type, uint16_t appearance, uint8_t *name, uint8_t name_len, int rssi)
|
||||||
{
|
{
|
||||||
@@ -237,6 +239,7 @@ void print_uuid(esp_bt_uuid_t *uuid)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if CONFIG_BT_CLASSIC_ENABLED
|
||||||
static void handle_bt_device_result(struct disc_res_param *disc_res)
|
static void handle_bt_device_result(struct disc_res_param *disc_res)
|
||||||
{
|
{
|
||||||
GAP_DBG_PRINTF("BT : " ESP_BD_ADDR_STR, ESP_BD_ADDR_HEX(disc_res->bda));
|
GAP_DBG_PRINTF("BT : " ESP_BD_ADDR_STR, ESP_BD_ADDR_HEX(disc_res->bda));
|
||||||
@@ -325,6 +328,7 @@ static void handle_bt_device_result(struct disc_res_param *disc_res)
|
|||||||
add_bt_scan_result(disc_res->bda, cod, &uuid, name, name_len, rssi);
|
add_bt_scan_result(disc_res->bda, cod, &uuid, name, name_len, rssi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void handle_ble_device_result(struct ble_scan_result_evt_param *scan_rst)
|
static void handle_ble_device_result(struct ble_scan_result_evt_param *scan_rst)
|
||||||
{
|
{
|
||||||
@@ -372,7 +376,7 @@ static void handle_ble_device_result(struct ble_scan_result_evt_param *scan_rst)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if CONFIG_BT_CLASSIC_ENABLED
|
||||||
/*
|
/*
|
||||||
* BT GAP
|
* BT GAP
|
||||||
* */
|
* */
|
||||||
@@ -440,6 +444,7 @@ static esp_err_t start_bt_scan(uint32_t seconds)
|
|||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* BLE GAP
|
* BLE GAP
|
||||||
@@ -671,11 +676,14 @@ static esp_err_t init_low_level(uint8_t mode)
|
|||||||
{
|
{
|
||||||
esp_err_t ret;
|
esp_err_t ret;
|
||||||
esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT();
|
esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT();
|
||||||
|
#if CONFIG_BT_CLASSIC_ENABLED
|
||||||
if (mode & ESP_BT_MODE_CLASSIC_BT) {
|
if (mode & ESP_BT_MODE_CLASSIC_BT) {
|
||||||
bt_cfg.mode = mode;
|
bt_cfg.mode = mode;
|
||||||
bt_cfg.bt_max_acl_conn = 3;
|
bt_cfg.bt_max_acl_conn = 3;
|
||||||
bt_cfg.bt_max_sync_conn = 3;
|
bt_cfg.bt_max_sync_conn = 3;
|
||||||
} else {
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
ret = esp_bt_controller_mem_release(ESP_BT_MODE_CLASSIC_BT);
|
ret = esp_bt_controller_mem_release(ESP_BT_MODE_CLASSIC_BT);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
ESP_LOGE(TAG, "esp_bt_controller_mem_release failed: %d", ret);
|
ESP_LOGE(TAG, "esp_bt_controller_mem_release failed: %d", ret);
|
||||||
@@ -705,14 +713,14 @@ static esp_err_t init_low_level(uint8_t mode)
|
|||||||
ESP_LOGE(TAG, "esp_bluedroid_enable failed: %d", ret);
|
ESP_LOGE(TAG, "esp_bluedroid_enable failed: %d", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
#if CONFIG_BT_CLASSIC_ENABLED
|
||||||
if (mode & ESP_BT_MODE_CLASSIC_BT) {
|
if (mode & ESP_BT_MODE_CLASSIC_BT) {
|
||||||
ret = init_bt_gap();
|
ret = init_bt_gap();
|
||||||
if (ret) {
|
if (ret) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (mode & ESP_BT_MODE_BLE) {
|
if (mode & ESP_BT_MODE_BLE) {
|
||||||
ret = init_ble_gap();
|
ret = init_ble_gap();
|
||||||
if (ret) {
|
if (ret) {
|
||||||
@@ -772,9 +780,11 @@ esp_err_t esp_hid_scan(uint32_t seconds, size_t *num_results, esp_hid_scan_resul
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (start_ble_scan(seconds) == ESP_OK) {
|
if (start_ble_scan(seconds) == ESP_OK) {
|
||||||
|
#if CONFIG_BT_CLASSIC_ENABLED
|
||||||
if (start_bt_scan(seconds) == ESP_OK) {
|
if (start_bt_scan(seconds) == ESP_OK) {
|
||||||
WAIT_BT_CB();
|
WAIT_BT_CB();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
WAIT_BLE_CB();
|
WAIT_BLE_CB();
|
||||||
} else {
|
} else {
|
||||||
return ESP_FAIL;
|
return ESP_FAIL;
|
||||||
|
@@ -123,7 +123,11 @@ void app_main(void)
|
|||||||
ret = nvs_flash_init();
|
ret = nvs_flash_init();
|
||||||
}
|
}
|
||||||
ESP_ERROR_CHECK( ret );
|
ESP_ERROR_CHECK( ret );
|
||||||
|
#if CONFIG_BT_CLASSIC_ENABLED
|
||||||
ESP_ERROR_CHECK( esp_hid_gap_init(ESP_BT_MODE_BTDM) );
|
ESP_ERROR_CHECK( esp_hid_gap_init(ESP_BT_MODE_BTDM) );
|
||||||
|
#else
|
||||||
|
ESP_ERROR_CHECK( esp_hid_gap_init(ESP_BT_MODE_BLE) );
|
||||||
|
#endif
|
||||||
ESP_ERROR_CHECK( esp_ble_gattc_register_callback(esp_hidh_gattc_event_handler) );
|
ESP_ERROR_CHECK( esp_ble_gattc_register_callback(esp_hidh_gattc_event_handler) );
|
||||||
esp_hidh_config_t config = {
|
esp_hidh_config_t config = {
|
||||||
.callback = hidh_callback,
|
.callback = hidh_callback,
|
||||||
|
14
examples/bluetooth/esp_hid_host/sdkconfig.defaults.esp32c3
Normal file
14
examples/bluetooth/esp_hid_host/sdkconfig.defaults.esp32c3
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#
|
||||||
|
# Automatically generated file. DO NOT EDIT.
|
||||||
|
# Espressif IoT Development Framework (ESP-IDF) Project Configuration
|
||||||
|
#
|
||||||
|
CONFIG_IDF_CMAKE=y
|
||||||
|
CONFIG_IDF_TARGET_ARCH_RISCV=y
|
||||||
|
CONFIG_IDF_TARGET="esp32c3"
|
||||||
|
CONFIG_IDF_TARGET_ESP32C3=y
|
||||||
|
CONFIG_IDF_FIRMWARE_CHIP_ID=0x0005
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bluetooth
|
||||||
|
#
|
||||||
|
CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y
|
14
examples/bluetooth/esp_hid_host/sdkconfig.defaults.esp32s3
Normal file
14
examples/bluetooth/esp_hid_host/sdkconfig.defaults.esp32s3
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#
|
||||||
|
# Automatically generated file. DO NOT EDIT.
|
||||||
|
# Espressif IoT Development Framework (ESP-IDF) Project Configuration
|
||||||
|
#
|
||||||
|
CONFIG_IDF_CMAKE=y
|
||||||
|
CONFIG_IDF_TARGET_ARCH_RISCV=y
|
||||||
|
CONFIG_IDF_TARGET="esp32c3"
|
||||||
|
CONFIG_IDF_TARGET_ESP32C3=y
|
||||||
|
CONFIG_IDF_FIRMWARE_CHIP_ID=0x0005
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bluetooth
|
||||||
|
#
|
||||||
|
CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y
|
Reference in New Issue
Block a user