Skip to content

Commit 024113d

Browse files
authored
make code execution conditional from include esp_bt.h.h
1 parent f3ae2a6 commit 024113d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

cores/esp32/esp32-hal-bt.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
#if SOC_BT_SUPPORTED
1818
#ifdef CONFIG_BT_BLUEDROID_ENABLED
1919

20+
#if __has_include("esp_bt.h")
21+
#include "esp_bt.h"
22+
2023
#if CONFIG_IDF_TARGET_ESP32
2124
bool btInUse() {
2225
return true;
@@ -28,8 +31,6 @@ __attribute__((weak)) bool btInUse() {
2831
}
2932
#endif
3033

31-
#include "esp_bt.h"
32-
3334
#ifdef CONFIG_BTDM_CONTROLLER_MODE_BTDM
3435
#define BT_MODE ESP_BT_MODE_BTDM
3536
#elif defined(CONFIG_BTDM_CONTROLLER_MODE_BR_EDR_ONLY)
@@ -56,7 +57,7 @@ bool btStartMode(bt_mode mode) {
5657
case BT_MODE_BTDM: esp_bt_mode = ESP_BT_MODE_BTDM; break;
5758
default: esp_bt_mode = BT_MODE; break;
5859
}
59-
// esp_bt_controller_enable(MODE) This mode must be equal as the mode in cfg of esp_bt_controller_init().
60+
// esp_bt_controller_enable(MODE) This mode must be equal as the mode in "cfg" of esp_bt_controller_init().
6061
cfg.mode = esp_bt_mode;
6162
if (cfg.mode == ESP_BT_MODE_CLASSIC_BT) {
6263
esp_bt_controller_mem_release(ESP_BT_MODE_BLE);
@@ -116,6 +117,7 @@ bool btStop() {
116117
return false;
117118
}
118119

120+
#endif // __has_include("esp_bt.h")
119121
#else // CONFIG_BT_ENABLED
120122
bool btStarted() {
121123
return false;
@@ -132,3 +134,4 @@ bool btStop() {
132134
#endif /* CONFIG_BT_ENABLED */
133135

134136
#endif /* SOC_BT_SUPPORTED */
137+

0 commit comments

Comments
 (0)