Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bluetooth_service] Added BLE And BTDM Support (AUD-1505) #374

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions components/bluetooth_service/bluetooth_service.c
Original file line number Diff line number Diff line change
Expand Up @@ -434,19 +434,35 @@ esp_err_t bluetooth_service_start(bluetooth_service_cfg_t *config)

g_bt_service = calloc(1, sizeof(bluetooth_service_t));
AUDIO_MEM_CHECK(TAG, g_bt_service, return ESP_ERR_NO_MEM);


#if defined(CONFIG_BTDM_CONTROLLER_MODE_BR_EDR_ONLY)
ESP_ERROR_CHECK(esp_bt_controller_mem_release(ESP_BT_MODE_BLE));
#endif


esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT();
if (esp_bt_controller_init(&bt_cfg) != ESP_OK) {
AUDIO_ERROR(TAG, "initialize controller failed");
return ESP_FAIL;
}

#if defined(CONFIG_BTDM_CONTROLLER_MODE_BTDM)
if (esp_bt_controller_enable(ESP_BT_MODE_BTDM) != ESP_OK) {
AUDIO_ERROR(TAG, "enable controller (BTDM Mode) failed");
return ESP_FAIL;
}
#endif
#if defined(CONFIG_BTDM_CONTROLLER_MODE_BLE_ONLY)
if (esp_bt_controller_enable(ESP_BT_MODE_BLE) != ESP_OK) {
AUDIO_ERROR(TAG, "enable controller (BLE Only) failed");
return ESP_FAIL;
}
#endif
#if defined(CONFIG_BTDM_CONTROLLER_MODE_BR_EDR_ONLY)
if (esp_bt_controller_enable(ESP_BT_MODE_CLASSIC_BT) != ESP_OK) {
AUDIO_ERROR(TAG, "enable controller failed");
AUDIO_ERROR(TAG, "enable controller (BR_EDR Mode) failed");
return ESP_FAIL;
}
#endif

if (esp_bluedroid_init() != ESP_OK) {
AUDIO_ERROR(TAG, "initialize bluedroid failed");
Expand Down