Commit 6c7a4afe authored by 薛晓虎's avatar 薛晓虎

🐞 fix:停止蓝牙连接后,重启32

parent 07f1cd03
...@@ -6,4 +6,5 @@ cmake_minimum_required(VERSION 3.16) ...@@ -6,4 +6,5 @@ cmake_minimum_required(VERSION 3.16)
set(EXTRA_COMPONENT_DIRS "./source/wifi") set(EXTRA_COMPONENT_DIRS "./source/wifi")
include($ENV{IDF_PATH}/tools/cmake/project.cmake) include($ENV{IDF_PATH}/tools/cmake/project.cmake)
add_compile_options(-fdiagnostics-color=always -w)
project(yedeajiancetai) project(yedeajiancetai)
...@@ -7,4 +7,7 @@ idf_component_register(SRCS "gatts_table_creat_demo.c" ...@@ -7,4 +7,7 @@ idf_component_register(SRCS "gatts_table_creat_demo.c"
"MCU_Core_Protocol.c" "MCU_Core_Protocol.c"
"app_Ble_User.c" "app_Ble_User.c"
"main_user.c" "main_user.c"
"bt_app_hf.c"
"bt_app_core.c"
INCLUDE_DIRS ".") INCLUDE_DIRS ".")
menu "A2DP Example Configuration"
config EXAMPLE_SSP_ENABLED
bool "Secure Simple Pairing"
depends on BT_CLASSIC_ENABLED
default y
help
This enables the Secure Simple Pairing. If disable this option,
Bluedroid will only support Legacy Pairing
endmenu
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#include "esp_log.h" #include "esp_log.h"
#include "nvs_flash.h" #include "nvs_flash.h"
#include "esp_bt.h" #include "esp_bt.h"
#include "main_user.h"
#include "esp_gap_ble_api.h" #include "esp_gap_ble_api.h"
#include "esp_gatts_api.h" #include "esp_gatts_api.h"
#include "esp_bt_main.h" #include "esp_bt_main.h"
...@@ -71,21 +71,29 @@ void Protocol_Init(Protocol_uint8_t *pMemSpace, Protocol_uint32_t MemLen, Protoc ...@@ -71,21 +71,29 @@ void Protocol_Init(Protocol_uint8_t *pMemSpace, Protocol_uint32_t MemLen, Protoc
return; return;
} }
Protocol_uint8_t first = 0; Protocol_uint8_t first = 0;
char btmac[6];
void BleDataGet(void) void BleDataGet(void)
{ {
if(BarCode1[0] == 0x59 && BarCode1[1] == 0x44 && BarCode1[9] == 0x4B && BarCode1[10] == 0x4A) if(BarCode1[0] == 0x59 && BarCode1[1] == 0x44 && BarCode1[15] == 0x4B && BarCode1[16] == 0x4A)
{ {
printf("bleget~~~\n");
memcpy(remote_device_name,&BarCode1[2],6); memcpy(remote_device_name,&BarCode1[2],6);
printf("remote_device_name:"); memcpy(btmac,&BarCode1[9],6);
ESP_LOG_BUFFER_HEX(GATTC_TAG, remote_device_name, 6); // ESP_LOG_BUFFER_HEX(GATTC_TAG, btmac, 6);
printf("remote_device_name[0]:%x\n",remote_device_name[0]); // printf("\n");
// printf("remote_device_name:");
// ESP_LOG_BUFFER_HEX(GATTC_TAG, remote_device_name, 6);
// printf("\n");
// printf("BarCode1[8]:%x\n",BarCode1[8]);
if(BarCode1[8] == 1) if(BarCode1[8] == 1)
{ {
if(first == 0) if(first == 0)
{ {
ESP_LOG_BUFFER_HEX(GATTC_TAG, BarCode1, 16);
bt_app_init();
bsp_Ble_Init(); bsp_Ble_Init();
first = 1; first = 1;
printf("ble bt init\n");
} }
} }
...@@ -93,11 +101,14 @@ void BleDataGet(void) ...@@ -93,11 +101,14 @@ void BleDataGet(void)
{ {
if(first == 1) if(first == 1)
{ {
esp_bluedroid_disable(); // esp_pbac_disconnect(bt_app_a2d_data_cb);
esp_bluedroid_deinit(); // esp_bluedroid_disable();
esp_bt_controller_disable(); // esp_bluedroid_deinit();
esp_bt_controller_deinit(); // esp_bt_controller_disable();
first = 0; // esp_bt_controller_deinit();
// first = 0;
esp_restart();
} }
} }
} }
...@@ -143,8 +154,9 @@ void Protocol_Service(void) ...@@ -143,8 +154,9 @@ void Protocol_Service(void)
{ {
BarCode1[j] = mDataBufPtr[j]; BarCode1[j] = mDataBufPtr[j];
} }
// ESP_LOG_BUFFER_HEX(GATTC_TAG, BarCode1, 20);
break; break;
ESP_LOG_BUFFER_HEX(GATTC_TAG, BarCode1, 20);
} }
} }
......
...@@ -64,4 +64,5 @@ void Protocol_Service(void); ...@@ -64,4 +64,5 @@ void Protocol_Service(void);
Protocol_uint32_t Protocol_Parse(const Protocol_uint8_t *pData, Protocol_uint32_t len); Protocol_uint32_t Protocol_Parse(const Protocol_uint8_t *pData, Protocol_uint32_t len);
Protocol_uint32_t Protocol_Send(const Protocol_uint16_t cmdID, const Protocol_uint8_t *pData, Protocol_uint8_t len); Protocol_uint32_t Protocol_Send(const Protocol_uint16_t cmdID, const Protocol_uint8_t *pData, Protocol_uint8_t len);
extern Protocol_uint8_t first; extern Protocol_uint8_t first;
extern char btmac[6];
#endif #endif
/*
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
#include <stdint.h>
#include <string.h>
#include <stdbool.h>
#include "freertos/FreeRTOSConfig.h"
#include "freertos/FreeRTOS.h"
#include "freertos/queue.h"
#include "freertos/task.h"
#include "esp_log.h"
#include "bt_app_core.h"
/*********************************
* STATIC FUNCTION DECLARATIONS
********************************/
/* application task handler */
static void bt_app_task_handler(void *arg);
/* message sender for Work queue */
static bool bt_app_send_msg(bt_app_msg_t *msg);
/* handler for dispatched message */
static void bt_app_work_dispatched(bt_app_msg_t *msg);
/*********************************
* STATIC VARIABLE DEFINITIONS
********************************/
static QueueHandle_t s_bt_app_task_queue = NULL;
static TaskHandle_t s_bt_app_task_handle = NULL;
/*********************************
* STATIC FUNCTION DEFINITIONS
********************************/
static bool bt_app_send_msg(bt_app_msg_t *msg)
{
if (msg == NULL) {
return false;
}
if (pdTRUE != xQueueSend(s_bt_app_task_queue, msg, 10 / portTICK_PERIOD_MS)) {
ESP_LOGE(BT_APP_CORE_TAG, "%s xQueue send failed", __func__);
return false;
}
return true;
}
static void bt_app_work_dispatched(bt_app_msg_t *msg)
{
if (msg->cb) {
msg->cb(msg->event, msg->param);
}
}
static void bt_app_task_handler(void *arg)
{
bt_app_msg_t msg;
for (;;) {
/* receive message from work queue and handle it */
if (pdTRUE == xQueueReceive(s_bt_app_task_queue, &msg, (TickType_t)portMAX_DELAY)) {
ESP_LOGD(BT_APP_CORE_TAG, "%s, signal: 0x%x, event: 0x%x", __func__, msg.sig, msg.event);
switch (msg.sig) {
case BT_APP_SIG_WORK_DISPATCH:
bt_app_work_dispatched(&msg);
break;
default:
ESP_LOGW(BT_APP_CORE_TAG, "%s, unhandled signal: %d", __func__, msg.sig);
break;
}
if (msg.param) {
free(msg.param);
}
}
}
}
/*********************************
* EXTERN FUNCTION DEFINITIONS
********************************/
bool bt_app_work_dispatch(bt_app_cb_t p_cback, uint16_t event, void *p_params, int param_len, bt_app_copy_cb_t p_copy_cback)
{
ESP_LOGD(BT_APP_CORE_TAG, "%s event: 0x%x, param len: %d", __func__, event, param_len);
bt_app_msg_t msg;
memset(&msg, 0, sizeof(bt_app_msg_t));
msg.sig = BT_APP_SIG_WORK_DISPATCH;
msg.event = event;
msg.cb = p_cback;
if (param_len == 0) {
return bt_app_send_msg(&msg);
} else if (p_params && param_len > 0) {
if ((msg.param = malloc(param_len)) != NULL) {
memcpy(msg.param, p_params, param_len);
/* check if caller has provided a copy callback to do the deep copy */
if (p_copy_cback) {
p_copy_cback(msg.param, p_params, param_len);
}
return bt_app_send_msg(&msg);
}
}
return false;
}
void bt_app_task_start_up(void)
{
s_bt_app_task_queue = xQueueCreate(10, sizeof(bt_app_msg_t));
xTaskCreate(bt_app_task_handler, "BtAppTask", 2048, NULL, 20, &s_bt_app_task_handle);
}
void bt_app_task_shut_down(void)
{
if (s_bt_app_task_handle) {
vTaskDelete(s_bt_app_task_handle);
s_bt_app_task_handle = NULL;
}
if (s_bt_app_task_queue) {
vQueueDelete(s_bt_app_task_queue);
s_bt_app_task_queue = NULL;
}
}
/*
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
#ifndef __BT_APP_CORE_H__
#define __BT_APP_CORE_H__
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
/* log tag */
#define BT_APP_CORE_TAG "BT_APP_CORE"
/* signal for dispatcher */
#define BT_APP_SIG_WORK_DISPATCH (0x01)
/**
* @brief handler for the dispatched work
*
* @param [in] event message event id
* @param [in] param pointer to the parameter
*/
typedef void (* bt_app_cb_t) (uint16_t event, void *param);
/* message to be sent */
typedef struct {
uint16_t sig; /*!< signal to bt_app_task */
uint16_t event; /*!< message event id */
bt_app_cb_t cb; /*!< context switch callback */
void *param; /*!< parameter area needs to be last */
} bt_app_msg_t;
/**
* @brief parameter deep-copy function to be customized
*
* @param [in] p_dest pointer to the destination
* @param [in] p_src pointer to the source
* @param [in] len data length in byte
*/
typedef void (* bt_app_copy_cb_t) (void *p_dest, void *p_src, int len);
/**
* @brief work dispatcher for the application task
*
* @param [in] p_cback handler for the dispatched work (event handler)
* @param [in] event message event id
* @param [in] p_params pointer to the parameter
* @param [in] param_len length of the parameter
* @param [in] p_copy_cback parameter deep-copy function
*
* @return true if work dispatch successfully, false otherwise
*/
bool bt_app_work_dispatch(bt_app_cb_t p_cback, uint16_t event, void *p_params, int param_len, bt_app_copy_cb_t p_copy_cback);
/**
* @brief start up the application task
*/
void bt_app_task_start_up(void);
/**
* @brief shut down the application task
*/
void bt_app_task_shut_down(void);
#endif /* __BT_APP_CORE_H__ */
This diff is collapsed.
/*
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
#ifndef __BT_APP_HF_H__
#define __BT_APP_HF_H__
#include <stdint.h>
#include "esp_hf_ag_api.h"
#include "esp_bt_defs.h"
extern esp_bd_addr_t hf_peer_addr; // Declaration of peer device bdaddr
#define BT_HF_TAG "BT_APP_HF"
/**
* @brief callback function for HF client
*/
void bt_app_hf_cb(esp_hf_cb_event_t event, esp_hf_cb_param_t *param);
#endif /* __BT_APP_HF_H__*/
...@@ -76,7 +76,7 @@ void init_Uart(void) { ...@@ -76,7 +76,7 @@ void init_Uart(void) {
// We won't use a buffer for sending data. // We won't use a buffer for sending data.
uart_driver_install(UART_NUM_1, RX_BUF_SIZE * 2, 200, 0, NULL, 0); uart_driver_install(UART_NUM_1, RX_BUF_SIZE * 2, 200, 0, NULL, 0);
uart_param_config(UART_NUM_1, &uart_config); uart_param_config(UART_NUM_1, &uart_config);
printf("GPIO38\n"); // printf("GPIO38\n");
uart_set_pin(UART_NUM_1, TXD_PIN, RXD_PIN, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE); uart_set_pin(UART_NUM_1, TXD_PIN, RXD_PIN, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE);
} }
...@@ -126,12 +126,15 @@ static void Uart_Rx_Task(void *arg) ...@@ -126,12 +126,15 @@ static void Uart_Rx_Task(void *arg)
while (1) while (1)
{ {
const int rxBytes = uart_read_bytes(UART_NUM_1, data, RX_BUF_SIZE, 20); const int rxBytes = uart_read_bytes(UART_NUM_1, data, RX_BUF_SIZE, 20);
if (rxBytes < 1000) if (rxBytes < 1000 && rxBytes > 0u)
{ {
for (uint16_t i = 0; i < rxBytes; i++) for (uint16_t i = 0; i < rxBytes; i++)
{ {
UART_Put(data[i]); UART_Put(data[i]);
// printf("0x%2x, ", data[i]);
} }
// printf("\n");
} }
} }
free(data); free(data);
...@@ -141,7 +144,7 @@ void bsp_Uart_Init(void ) ...@@ -141,7 +144,7 @@ void bsp_Uart_Init(void )
{ {
init_Uart(); init_Uart();
Protocol_KL30_Wakeup_Init(); Protocol_KL30_Wakeup_Init();
printf("uart init!!\n"); // printf("uart init!!\n");
xTaskCreatePinnedToCore(Uart_Rx_Task, "bsp_Uart", 4096, NULL, 4, NULL, 1); xTaskCreatePinnedToCore(Uart_Rx_Task, "bsp_Uart", 4096, NULL, 4, NULL, 1);
} }
...@@ -207,11 +210,11 @@ static const uint8_t CharNotifyUUID[16] = {0x9F, 0x9F, 0x00, 0xC1, 0x58, ...@@ -207,11 +210,11 @@ static const uint8_t CharNotifyUUID[16] = {0x9F, 0x9F, 0x00, 0xC1, 0x58,
#define PROFILE_A_APP_ID 0 #define PROFILE_A_APP_ID 0
#define INVALID_HANDLE 0 #define INVALID_HANDLE 0
unsigned char write_char_data[] = { unsigned char write_char_data[] = {
0x59, 0x44, 0x3D, 0x3E, 0x09, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x03, 0xE8, 0x27, 0x10, 0x22, 0x59, 0x44, 0x3D, 0x3E, 0x01, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x03, 0xE8, 0x27, 0x10, 0x22,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x17, 0x02, 0x03, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x17, 0x02, 0x03, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0x01, 0x03, 0xE9, 0xBB, 0x91, 0xE9, 0xBE, 0x99, 0xE6, 0xB1, 0x9F, 0xE7, 0x9C, 0x81, 0xFF, 0xFF, 0x09, 0x03, 0xE9, 0xBB, 0x91, 0xE9, 0xBE, 0x99, 0xE6, 0xB1, 0x9F, 0xE7, 0x9C, 0x81,
0xE5, 0xA4, 0xA9, 0xE6, 0x9C, 0x89, 0xE4, 0xB8, 0xBA, 0xE7, 0xA0, 0x94, 0xE7, 0xA9, 0xB6, 0xE9, 0xE5, 0xA4, 0xA9, 0xE6, 0x9C, 0x89, 0xE4, 0xB8, 0xBA, 0xE7, 0xA0, 0x94, 0xE7, 0xA9, 0xB6, 0xE9,
0x99, 0xA2, 0x9c, 0x4B, 0x4A 0x99, 0xA2, 0x9B, 0x4B, 0x4A
}; };
char remote_device_name[] = {0x0A,0x8A,0x0A,0x0A,0x00,0x00}; char remote_device_name[] = {0x0A,0x8A,0x0A,0x0A,0x00,0x00};
...@@ -285,7 +288,7 @@ static void gattc_profile_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_ ...@@ -285,7 +288,7 @@ static void gattc_profile_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_
} }
break; break;
case ESP_GATTC_CONNECT_EVT:{ case ESP_GATTC_CONNECT_EVT:{
printf("join connect ~~~~\n"); // printf("join connect ~~~~\n");
ESP_LOGI(GATTC_TAG, "Connected, conn_id %d, remote "ESP_BD_ADDR_STR"", p_data->connect.conn_id, ESP_LOGI(GATTC_TAG, "Connected, conn_id %d, remote "ESP_BD_ADDR_STR"", p_data->connect.conn_id,
ESP_BD_ADDR_HEX(p_data->connect.remote_bda)); ESP_BD_ADDR_HEX(p_data->connect.remote_bda));
gl_profile_tab[PROFILE_A_APP_ID].conn_id = p_data->connect.conn_id; gl_profile_tab[PROFILE_A_APP_ID].conn_id = p_data->connect.conn_id;
...@@ -356,7 +359,7 @@ static void gattc_profile_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_ ...@@ -356,7 +359,7 @@ static void gattc_profile_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_
ESP_LOGI(GATTC_TAG, "Service search complete"); ESP_LOGI(GATTC_TAG, "Service search complete");
if (get_server){ if (get_server){
// if (1){ // if (1){
printf("get server\n"); // printf("get server\n");
uint16_t count = 0; uint16_t count = 0;
esp_gatt_status_t status = esp_ble_gattc_get_attr_count( gattc_if, esp_gatt_status_t status = esp_ble_gattc_get_attr_count( gattc_if,
p_data->search_cmpl.conn_id, p_data->search_cmpl.conn_id,
...@@ -412,10 +415,8 @@ static void gattc_profile_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_ ...@@ -412,10 +415,8 @@ static void gattc_profile_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_
break; break;
case ESP_GATTC_REG_FOR_NOTIFY_EVT: { case ESP_GATTC_REG_FOR_NOTIFY_EVT: {
if (p_data->reg_for_notify.status != ESP_GATT_OK){ if (p_data->reg_for_notify.status != ESP_GATT_OK){
printf("这里进了么?~~~!=\n");
ESP_LOGE(GATTC_TAG, "Notification register failed, status %d", p_data->reg_for_notify.status); ESP_LOGE(GATTC_TAG, "Notification register failed, status %d", p_data->reg_for_notify.status);
}else{ }else{
printf("这里进了么?ESP_GATTC_REG_FOR_NOTIFY_EVT~~~\n");
ESP_LOGI(GATTC_TAG, "Notification register successfully"); ESP_LOGI(GATTC_TAG, "Notification register successfully");
uint16_t count = 0; uint16_t count = 0;
uint16_t notify_en = 1; uint16_t notify_en = 1;
...@@ -521,7 +522,7 @@ static void gattc_profile_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_ ...@@ -521,7 +522,7 @@ static void gattc_profile_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_
}else{ }else{
ESP_LOGI(GATTC_TAG, "Indication received"); ESP_LOGI(GATTC_TAG, "Indication received");
} }
ESP_LOG_BUFFER_HEX(GATTC_TAG, p_data->notify.value, p_data->notify.value_len); ESP_LOG_BUFFER_HEX("NOTIFY_EVT", p_data->notify.value, p_data->notify.value_len);
break; break;
case ESP_GATTC_WRITE_DESCR_EVT: case ESP_GATTC_WRITE_DESCR_EVT:
if (p_data->write.status != ESP_GATT_OK){ if (p_data->write.status != ESP_GATT_OK){
...@@ -600,7 +601,8 @@ static void esp_gap_cb(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *par ...@@ -600,7 +601,8 @@ static void esp_gap_cb(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *par
// ESP_LOGI(GATTC_TAG, "Scan result, device "ESP_BD_ADDR_STR", name len %u", ESP_BD_ADDR_HEX(scan_result->scan_rst.bda), adv_name_len); // ESP_LOGI(GATTC_TAG, "Scan result, device "ESP_BD_ADDR_STR", name len %u", ESP_BD_ADDR_HEX(scan_result->scan_rst.bda), adv_name_len);
ESP_LOG_BUFFER_CHAR(GATTC_TAG, adv_name, adv_name_len); ESP_LOG_BUFFER_CHAR(GATTC_TAG, adv_name, adv_name_len);
ESP_LOG_BUFFER_HEX(GATTC_TAG, scan_result->scan_rst.bda, 6); ESP_LOG_BUFFER_HEX("SCAN_name", remote_device_name, 6);
ESP_LOG_BUFFER_HEX("SCAN_bda", scan_result->scan_rst.bda, 6);
#if CONFIG_EXAMPLE_DUMP_ADV_DATA_AND_SCAN_RESP #if CONFIG_EXAMPLE_DUMP_ADV_DATA_AND_SCAN_RESP
if (scan_result->scan_rst.adv_data_len > 0) { if (scan_result->scan_rst.adv_data_len > 0) {
ESP_LOGI(GATTC_TAG, "adv data:"); ESP_LOGI(GATTC_TAG, "adv data:");
...@@ -780,32 +782,32 @@ void bsp_Ble_Init(void) ...@@ -780,32 +782,32 @@ void bsp_Ble_Init(void)
memcpy(remote_device_name, esp_bluedroid_get_example_name(), sizeof(remote_device_name)); memcpy(remote_device_name, esp_bluedroid_get_example_name(), sizeof(remote_device_name));
#endif #endif
ESP_ERROR_CHECK(esp_bt_controller_mem_release(ESP_BT_MODE_CLASSIC_BT)); // ESP_ERROR_CHECK(esp_bt_controller_mem_release(ESP_BT_MODE_CLASSIC_BT));
esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT(); // esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT();
ret = esp_bt_controller_init(&bt_cfg); // ret = esp_bt_controller_init(&bt_cfg);
if (ret) { // if (ret) {
ESP_LOGE(GATTC_TAG, "%s initialize controller failed: %s", __func__, esp_err_to_name(ret)); // ESP_LOGE(GATTC_TAG, "%s initialize controller failed: %s", __func__, esp_err_to_name(ret));
return; // return;
} // }
ret = esp_bt_controller_enable(ESP_BT_MODE_BLE); // ret = esp_bt_controller_enable(ESP_BT_MODE_BLE);
if (ret) { // if (ret) {
ESP_LOGE(GATTC_TAG, "%s enable controller failed: %s", __func__, esp_err_to_name(ret)); // ESP_LOGE(GATTC_TAG, "%s enable controller failed: %s", __func__, esp_err_to_name(ret));
return; // return;
} // }
ret = esp_bluedroid_init(); // ret = esp_bluedroid_init();
if (ret) { // if (ret) {
ESP_LOGE(GATTC_TAG, "%s init bluetooth failed: %s", __func__, esp_err_to_name(ret)); // ESP_LOGE(GATTC_TAG, "%s init bluetooth failed: %s", __func__, esp_err_to_name(ret));
return; // return;
} // }
ret = esp_bluedroid_enable(); // ret = esp_bluedroid_enable();
if (ret) { // if (ret) {
ESP_LOGE(GATTC_TAG, "%s enable bluetooth failed: %s", __func__, esp_err_to_name(ret)); // ESP_LOGE(GATTC_TAG, "%s enable bluetooth failed: %s", __func__, esp_err_to_name(ret));
return; // return;
} // }
//register the callback function to the gap module //register the callback function to the gap module
ret = esp_ble_gap_register_callback(esp_gap_cb); ret = esp_ble_gap_register_callback(esp_gap_cb);
......
This diff is collapsed.
#ifndef _MAIN_USER_H_ #ifndef _MAIN_USER_H_
#define _MAIN_USER_H_ #define _MAIN_USER_H_
void bt_app_init(void);
#endif #endif
\ No newline at end of file
This diff is collapsed.
...@@ -384,6 +384,12 @@ CONFIG_PARTITION_TABLE_OFFSET=0xA000 ...@@ -384,6 +384,12 @@ CONFIG_PARTITION_TABLE_OFFSET=0xA000
CONFIG_PARTITION_TABLE_MD5=y CONFIG_PARTITION_TABLE_MD5=y
# end of Partition Table # end of Partition Table
#
# A2DP Example Configuration
#
CONFIG_EXAMPLE_SSP_ENABLED=y
# end of A2DP Example Configuration
# #
# Compiler options # Compiler options
# #
...@@ -454,8 +460,16 @@ CONFIG_BT_CLASSIC_ENABLED=y ...@@ -454,8 +460,16 @@ CONFIG_BT_CLASSIC_ENABLED=y
CONFIG_BT_ENC_KEY_SIZE_CTRL_VSC=y CONFIG_BT_ENC_KEY_SIZE_CTRL_VSC=y
# CONFIG_BT_ENC_KEY_SIZE_CTRL_NONE is not set # CONFIG_BT_ENC_KEY_SIZE_CTRL_NONE is not set
# CONFIG_BT_CLASSIC_BQB_ENABLED is not set # CONFIG_BT_CLASSIC_BQB_ENABLED is not set
# CONFIG_BT_A2DP_ENABLE is not set CONFIG_BT_A2DP_ENABLE=y
# CONFIG_BT_SPP_ENABLED is not set CONFIG_BT_AVRCP_ENABLED=y
#
# AVRCP Features
#
CONFIG_BT_AVRCP_CT_COVER_ART_ENABLED=y
# end of AVRCP Features
CONFIG_BT_SPP_ENABLED=y
# CONFIG_BT_L2CAP_ENABLED is not set # CONFIG_BT_L2CAP_ENABLED is not set
CONFIG_BT_HFP_ENABLE=y CONFIG_BT_HFP_ENABLE=y
CONFIG_BT_HFP_CLIENT_ENABLE=y CONFIG_BT_HFP_CLIENT_ENABLE=y
...@@ -464,6 +478,7 @@ CONFIG_BT_HFP_AUDIO_DATA_PATH_PCM=y ...@@ -464,6 +478,7 @@ CONFIG_BT_HFP_AUDIO_DATA_PATH_PCM=y
# CONFIG_BT_HFP_AUDIO_DATA_PATH_HCI is not set # CONFIG_BT_HFP_AUDIO_DATA_PATH_HCI is not set
# CONFIG_BT_HID_ENABLED is not set # CONFIG_BT_HID_ENABLED is not set
# CONFIG_BT_PBAC_ENABLED is not set # CONFIG_BT_PBAC_ENABLED is not set
CONFIG_BT_GOEPC_ENABLED=y
CONFIG_BT_BLE_ENABLED=y CONFIG_BT_BLE_ENABLED=y
CONFIG_BT_GATTS_ENABLE=y CONFIG_BT_GATTS_ENABLE=y
# CONFIG_BT_GATTS_PPCP_CHAR_GAP is not set # CONFIG_BT_GATTS_PPCP_CHAR_GAP is not set
...@@ -678,15 +693,27 @@ CONFIG_BT_BLE_RPA_TIMEOUT=900 ...@@ -678,15 +693,27 @@ CONFIG_BT_BLE_RPA_TIMEOUT=900
# #
# Controller Options # Controller Options
# #
CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y # CONFIG_BTDM_CTRL_MODE_BLE_ONLY is not set
# CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY is not set # CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY is not set
# CONFIG_BTDM_CTRL_MODE_BTDM is not set CONFIG_BTDM_CTRL_MODE_BTDM=y
CONFIG_BTDM_CTRL_BLE_MAX_CONN=3 CONFIG_BTDM_CTRL_BLE_MAX_CONN=3
CONFIG_BTDM_CTRL_BR_EDR_SCO_DATA_PATH_EFF=0 CONFIG_BTDM_CTRL_BR_EDR_MAX_ACL_CONN=2
CONFIG_BTDM_CTRL_BR_EDR_MAX_SYNC_CONN=0
# CONFIG_BTDM_CTRL_BR_EDR_SCO_DATA_PATH_HCI is not set
CONFIG_BTDM_CTRL_BR_EDR_SCO_DATA_PATH_PCM=y
CONFIG_BTDM_CTRL_BR_EDR_SCO_DATA_PATH_EFF=1
CONFIG_BTDM_CTRL_PCM_ROLE_EDGE_CONFIG=y
CONFIG_BTDM_CTRL_PCM_ROLE_MASTER=y
# CONFIG_BTDM_CTRL_PCM_ROLE_SLAVE is not set
CONFIG_BTDM_CTRL_PCM_POLAR_FALLING_EDGE=y
# CONFIG_BTDM_CTRL_PCM_POLAR_RISING_EDGE is not set
CONFIG_BTDM_CTRL_PCM_ROLE_EFF=0 CONFIG_BTDM_CTRL_PCM_ROLE_EFF=0
CONFIG_BTDM_CTRL_PCM_POLAR_EFF=0 CONFIG_BTDM_CTRL_PCM_POLAR_EFF=0
# CONFIG_BTDM_CTRL_AUTO_LATENCY is not set
CONFIG_BTDM_CTRL_LEGACY_AUTH_VENDOR_EVT=y
CONFIG_BTDM_CTRL_LEGACY_AUTH_VENDOR_EVT_EFF=y
CONFIG_BTDM_CTRL_BLE_MAX_CONN_EFF=3 CONFIG_BTDM_CTRL_BLE_MAX_CONN_EFF=3
CONFIG_BTDM_CTRL_BR_EDR_MAX_ACL_CONN_EFF=0 CONFIG_BTDM_CTRL_BR_EDR_MAX_ACL_CONN_EFF=2
CONFIG_BTDM_CTRL_BR_EDR_MAX_SYNC_CONN_EFF=0 CONFIG_BTDM_CTRL_BR_EDR_MAX_SYNC_CONN_EFF=0
CONFIG_BTDM_CTRL_PINNED_TO_CORE_0=y CONFIG_BTDM_CTRL_PINNED_TO_CORE_0=y
# CONFIG_BTDM_CTRL_PINNED_TO_CORE_1 is not set # CONFIG_BTDM_CTRL_PINNED_TO_CORE_1 is not set
...@@ -2140,7 +2167,7 @@ CONFIG_BLUEDROID_PINNED_TO_CORE=0 ...@@ -2140,7 +2167,7 @@ CONFIG_BLUEDROID_PINNED_TO_CORE=0
CONFIG_BTU_TASK_STACK_SIZE=4352 CONFIG_BTU_TASK_STACK_SIZE=4352
# CONFIG_BLUEDROID_MEM_DEBUG is not set # CONFIG_BLUEDROID_MEM_DEBUG is not set
CONFIG_CLASSIC_BT_ENABLED=y CONFIG_CLASSIC_BT_ENABLED=y
# CONFIG_A2DP_ENABLE is not set CONFIG_A2DP_ENABLE=y
CONFIG_HFP_ENABLE=y CONFIG_HFP_ENABLE=y
CONFIG_HFP_CLIENT_ENABLE=y CONFIG_HFP_CLIENT_ENABLE=y
CONFIG_HFP_AG_ENABLE=y CONFIG_HFP_AG_ENABLE=y
...@@ -2319,12 +2346,14 @@ CONFIG_BLUFI_INITIAL_TRACE_LEVEL=2 ...@@ -2319,12 +2346,14 @@ CONFIG_BLUFI_INITIAL_TRACE_LEVEL=2
CONFIG_SMP_ENABLE=y CONFIG_SMP_ENABLE=y
# CONFIG_BLE_ACTIVE_SCAN_REPORT_ADV_SCAN_RSP_INDIVIDUALLY is not set # CONFIG_BLE_ACTIVE_SCAN_REPORT_ADV_SCAN_RSP_INDIVIDUALLY is not set
CONFIG_BLE_ESTABLISH_LINK_CONNECTION_TIMEOUT=30 CONFIG_BLE_ESTABLISH_LINK_CONNECTION_TIMEOUT=30
CONFIG_BTDM_CONTROLLER_MODE_BLE_ONLY=y # CONFIG_BTDM_CONTROLLER_MODE_BLE_ONLY is not set
# CONFIG_BTDM_CONTROLLER_MODE_BR_EDR_ONLY is not set # CONFIG_BTDM_CONTROLLER_MODE_BR_EDR_ONLY is not set
# CONFIG_BTDM_CONTROLLER_MODE_BTDM is not set CONFIG_BTDM_CONTROLLER_MODE_BTDM=y
CONFIG_BTDM_CONTROLLER_BLE_MAX_CONN=3 CONFIG_BTDM_CONTROLLER_BLE_MAX_CONN=3
CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_ACL_CONN=2
CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_SYNC_CONN=0
CONFIG_BTDM_CONTROLLER_BLE_MAX_CONN_EFF=3 CONFIG_BTDM_CONTROLLER_BLE_MAX_CONN_EFF=3
CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_ACL_CONN_EFF=0 CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_ACL_CONN_EFF=2
CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_SYNC_CONN_EFF=0 CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_SYNC_CONN_EFF=0
CONFIG_BTDM_CONTROLLER_PINNED_TO_CORE=0 CONFIG_BTDM_CONTROLLER_PINNED_TO_CORE=0
CONFIG_BTDM_CONTROLLER_HCI_MODE_VHCI=y CONFIG_BTDM_CONTROLLER_HCI_MODE_VHCI=y
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment