mirror of
https://github.com/h2zero/esp-nimble-cpp.git
synced 2024-11-22 05:00:55 +01:00
Use more stable arduino detection methods (#38)
* Use a more stable arduino detection macro. * Detection method for both IDF config phases. Newer IDF API and targets.
This commit is contained in:
parent
ef049ddf19
commit
cf3227503b
2 changed files with 31 additions and 29 deletions
|
@ -2,9 +2,32 @@
|
||||||
# CMakeLists in this exact order for cmake to work correctly
|
# CMakeLists in this exact order for cmake to work correctly
|
||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.5)
|
||||||
|
|
||||||
set(SUPPORTED_TARGETS esp32)
|
idf_build_get_property(__hack_component_targets __COMPONENT_TARGETS)
|
||||||
|
|
||||||
set(COMPONENT_SRCS
|
if("esp-nimble-component" IN_LIST BUILD_COMPONENTS OR "__esp-nimble-component" IN_LIST __hack_component_targets)
|
||||||
|
list(APPEND ESP_NIMBLE_PRIV_REQUIRES
|
||||||
|
esp-nimble-component
|
||||||
|
)
|
||||||
|
elseif("nimble" IN_LIST BUILD_COMPONENTS OR "__nimble" IN_LIST __hack_component_targets)
|
||||||
|
list(APPEND ESP_NIMBLE_PRIV_REQUIRES
|
||||||
|
nimble
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if("arduino" IN_LIST BUILD_COMPONENTS OR __hack_component_targets MATCHES "__idf_arduino")
|
||||||
|
list(APPEND ESP_NIMBLE_PRIV_REQUIRES
|
||||||
|
arduino
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
idf_component_register(
|
||||||
|
REQUIRED_IDF_TARGETS
|
||||||
|
"esp32"
|
||||||
|
"esp32s3"
|
||||||
|
"esp32c3"
|
||||||
|
INCLUDE_DIRS
|
||||||
|
"src"
|
||||||
|
SRCS
|
||||||
"src/FreeRTOS.cpp"
|
"src/FreeRTOS.cpp"
|
||||||
"src/NimBLE2904.cpp"
|
"src/NimBLE2904.cpp"
|
||||||
"src/NimBLEAddress.cpp"
|
"src/NimBLEAddress.cpp"
|
||||||
|
@ -27,31 +50,10 @@ set(COMPONENT_SRCS
|
||||||
"src/NimBLEService.cpp"
|
"src/NimBLEService.cpp"
|
||||||
"src/NimBLEUtils.cpp"
|
"src/NimBLEUtils.cpp"
|
||||||
"src/NimBLEUUID.cpp"
|
"src/NimBLEUUID.cpp"
|
||||||
)
|
REQUIRES
|
||||||
|
|
||||||
set(COMPONENT_ADD_INCLUDEDIRS
|
|
||||||
src
|
|
||||||
)
|
|
||||||
|
|
||||||
set(COMPONENT_PRIV_REQUIRES
|
|
||||||
nvs_flash
|
|
||||||
bt
|
bt
|
||||||
|
nvs_flash
|
||||||
|
PRIV_REQUIRES
|
||||||
|
${ESP_NIMBLE_PRIV_REQUIRES}
|
||||||
)
|
)
|
||||||
|
|
||||||
if(COMPONENTS MATCHES "esp-nimble-component")
|
|
||||||
list(APPEND COMPONENT_PRIV_REQUIRES
|
|
||||||
esp-nimble-component
|
|
||||||
)
|
|
||||||
elseif(COMPONENTS MATCHES "nimble")
|
|
||||||
list(APPEND COMPONENT_PRIV_REQUIRES
|
|
||||||
nimble
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(COMPONENTS MATCHES "arduino")
|
|
||||||
list(APPEND COMPONENT_PRIV_REQUIRES
|
|
||||||
arduino
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
register_component()
|
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
#include "services/gap/ble_svc_gap.h"
|
#include "services/gap/ble_svc_gap.h"
|
||||||
#include "services/gatt/ble_svc_gatt.h"
|
#include "services/gatt/ble_svc_gatt.h"
|
||||||
|
|
||||||
#ifdef ARDUINO_ARCH_ESP32
|
#ifdef CONFIG_ENABLE_ARDUINO_DEPENDS
|
||||||
#include "esp32-hal-bt.h"
|
#include "esp32-hal-bt.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -534,7 +534,7 @@ void NimBLEDevice::setScanFilterMode(uint8_t mode) {
|
||||||
int rc=0;
|
int rc=0;
|
||||||
esp_err_t errRc = ESP_OK;
|
esp_err_t errRc = ESP_OK;
|
||||||
|
|
||||||
#ifdef ARDUINO_ARCH_ESP32
|
#ifdef CONFIG_ENABLE_ARDUINO_DEPENDS
|
||||||
// make sure the linker includes esp32-hal-bt.c so ardruino init doesn't release BLE memory.
|
// make sure the linker includes esp32-hal-bt.c so ardruino init doesn't release BLE memory.
|
||||||
btStarted();
|
btStarted();
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue