mirror of
https://github.com/h2zero/esp-nimble-cpp.git
synced 2024-11-23 13:40:55 +01:00
Remove deprecated API in case of ESP-IDF V5. (#102)
* Remove deprecated API in case of ESP-IDF V5.
0a93ee1337/docs/en/migration-guides/release-5.x/bluetooth-low-energy.rst (id17)
* Fix initialization in case of ESP-IDF V5
This commit is contained in:
parent
dab9f8b559
commit
648fd0ebfd
1 changed files with 4 additions and 0 deletions
|
@ -866,6 +866,7 @@ void NimBLEDevice::init(const std::string &deviceName) {
|
|||
|
||||
esp_bt_controller_mem_release(ESP_BT_MODE_CLASSIC_BT);
|
||||
|
||||
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0)
|
||||
esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT();
|
||||
#if defined (CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32S3)
|
||||
bt_cfg.bluetooth_mode = ESP_BT_MODE_BLE;
|
||||
|
@ -879,6 +880,7 @@ void NimBLEDevice::init(const std::string &deviceName) {
|
|||
ESP_ERROR_CHECK(esp_bt_controller_init(&bt_cfg));
|
||||
ESP_ERROR_CHECK(esp_bt_controller_enable(ESP_BT_MODE_BLE));
|
||||
ESP_ERROR_CHECK(esp_nimble_hci_init());
|
||||
#endif
|
||||
#endif
|
||||
nimble_port_init();
|
||||
|
||||
|
@ -925,10 +927,12 @@ void NimBLEDevice::deinit(bool clearAll) {
|
|||
if (ret == 0) {
|
||||
nimble_port_deinit();
|
||||
#ifdef ESP_PLATFORM
|
||||
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0)
|
||||
ret = esp_nimble_hci_and_controller_deinit();
|
||||
if (ret != ESP_OK) {
|
||||
NIMBLE_LOGE(LOG_TAG, "esp_nimble_hci_and_controller_deinit() failed with error: %d", ret);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
initialized = false;
|
||||
m_synced = false;
|
||||
|
|
Loading…
Reference in a new issue