mirror of
https://github.com/h2zero/esp-nimble-cpp.git
synced 2024-11-22 05:00:55 +01:00
Fix compilation for ESP32C3. (#53)
This commit is contained in:
parent
2decc0682a
commit
7d01fa595d
3 changed files with 25 additions and 5 deletions
|
@ -757,8 +757,12 @@ NimBLEAddress NimBLEDevice::getWhiteListAddress(size_t index) {
|
||||||
esp_bt_controller_mem_release(ESP_BT_MODE_CLASSIC_BT);
|
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();
|
||||||
|
#ifdef CONFIG_IDF_TARGET_ESP32C3
|
||||||
|
bt_cfg.bluetooth_mode = ESP_BT_MODE_BLE;
|
||||||
|
#else
|
||||||
bt_cfg.mode = ESP_BT_MODE_BLE;
|
bt_cfg.mode = ESP_BT_MODE_BLE;
|
||||||
bt_cfg.ble_max_conn = CONFIG_BT_NIMBLE_MAX_CONNECTIONS;
|
bt_cfg.ble_max_conn = CONFIG_BT_NIMBLE_MAX_CONNECTIONS;
|
||||||
|
#endif
|
||||||
bt_cfg.normal_adv_size = m_scanDuplicateSize;
|
bt_cfg.normal_adv_size = m_scanDuplicateSize;
|
||||||
bt_cfg.scan_duplicate_type = m_scanFilterMode;
|
bt_cfg.scan_duplicate_type = m_scanFilterMode;
|
||||||
|
|
||||||
|
@ -977,17 +981,23 @@ void NimBLEDevice::setSecurityCallbacks(NimBLESecurityCallbacks* callbacks) {
|
||||||
void NimBLEDevice::setOwnAddrType(uint8_t own_addr_type, bool useNRPA) {
|
void NimBLEDevice::setOwnAddrType(uint8_t own_addr_type, bool useNRPA) {
|
||||||
m_own_addr_type = own_addr_type;
|
m_own_addr_type = own_addr_type;
|
||||||
switch (own_addr_type) {
|
switch (own_addr_type) {
|
||||||
|
#ifdef CONFIG_IDF_TARGET_ESP32
|
||||||
case BLE_OWN_ADDR_PUBLIC:
|
case BLE_OWN_ADDR_PUBLIC:
|
||||||
ble_hs_pvcy_rpa_config(NIMBLE_HOST_DISABLE_PRIVACY);
|
ble_hs_pvcy_rpa_config(NIMBLE_HOST_DISABLE_PRIVACY);
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
case BLE_OWN_ADDR_RANDOM:
|
case BLE_OWN_ADDR_RANDOM:
|
||||||
setSecurityInitKey(BLE_SM_PAIR_KEY_DIST_ENC | BLE_SM_PAIR_KEY_DIST_ID);
|
setSecurityInitKey(BLE_SM_PAIR_KEY_DIST_ENC | BLE_SM_PAIR_KEY_DIST_ID);
|
||||||
|
#ifdef CONFIG_IDF_TARGET_ESP32
|
||||||
ble_hs_pvcy_rpa_config(useNRPA ? NIMBLE_HOST_ENABLE_NRPA : NIMBLE_HOST_ENABLE_RPA);
|
ble_hs_pvcy_rpa_config(useNRPA ? NIMBLE_HOST_ENABLE_NRPA : NIMBLE_HOST_ENABLE_RPA);
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case BLE_OWN_ADDR_RPA_PUBLIC_DEFAULT:
|
case BLE_OWN_ADDR_RPA_PUBLIC_DEFAULT:
|
||||||
case BLE_OWN_ADDR_RPA_RANDOM_DEFAULT:
|
case BLE_OWN_ADDR_RPA_RANDOM_DEFAULT:
|
||||||
setSecurityInitKey(BLE_SM_PAIR_KEY_DIST_ENC | BLE_SM_PAIR_KEY_DIST_ID);
|
setSecurityInitKey(BLE_SM_PAIR_KEY_DIST_ENC | BLE_SM_PAIR_KEY_DIST_ID);
|
||||||
|
#ifdef CONFIG_IDF_TARGET_ESP32
|
||||||
ble_hs_pvcy_rpa_config(NIMBLE_HOST_ENABLE_RPA);
|
ble_hs_pvcy_rpa_config(NIMBLE_HOST_ENABLE_RPA);
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} // setOwnAddrType
|
} // setOwnAddrType
|
||||||
|
|
|
@ -404,7 +404,9 @@ bool NimBLEScan::stop() {
|
||||||
* @brief Clears the duplicate scan filter cache.
|
* @brief Clears the duplicate scan filter cache.
|
||||||
*/
|
*/
|
||||||
void NimBLEScan::clearDuplicateCache() {
|
void NimBLEScan::clearDuplicateCache() {
|
||||||
|
#ifdef CONFIG_IDF_TARGET_ESP32 // Not available for ESP32C3
|
||||||
esp_ble_scan_dupilcate_list_flush();
|
esp_ble_scan_dupilcate_list_flush();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -44,10 +44,18 @@
|
||||||
#define CONFIG_BTDM_SCAN_DUPL_TYPE CONFIG_SCAN_DUPLICATE_TYPE
|
#define CONFIG_BTDM_SCAN_DUPL_TYPE CONFIG_SCAN_DUPLICATE_TYPE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(CONFIG_BT_CTRL_SCAN_DUPL_TYPE) && !defined(CONFIG_BTDM_SCAN_DUPL_TYPE)
|
||||||
|
#define CONFIG_BTDM_SCAN_DUPL_TYPE CONFIG_BT_CTRL_SCAN_DUPL_TYPE
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_DUPLICATE_SCAN_CACHE_SIZE) && !defined(CONFIG_BTDM_SCAN_DUPL_CACHE_SIZE)
|
#if defined(CONFIG_DUPLICATE_SCAN_CACHE_SIZE) && !defined(CONFIG_BTDM_SCAN_DUPL_CACHE_SIZE)
|
||||||
#define CONFIG_BTDM_SCAN_DUPL_CACHE_SIZE CONFIG_DUPLICATE_SCAN_CACHE_SIZE
|
#define CONFIG_BTDM_SCAN_DUPL_CACHE_SIZE CONFIG_DUPLICATE_SCAN_CACHE_SIZE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(CONFIG_BT_CTRL_SCAN_DUPL_CACHE_SIZE) && !defined(CONFIG_BTDM_SCAN_DUPL_CACHE_SIZE)
|
||||||
|
#define CONFIG_BTDM_SCAN_DUPL_CACHE_SIZE CONFIG_BT_CTRL_SCAN_DUPL_CACHE_SIZE
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_NIMBLE_MAX_CONNECTIONS ) && !defined(CONFIG_BT_NIMBLE_MAX_CONNECTIONS)
|
#if defined(CONFIG_NIMBLE_MAX_CONNECTIONS ) && !defined(CONFIG_BT_NIMBLE_MAX_CONNECTIONS)
|
||||||
#define CONFIG_BT_NIMBLE_MAX_CONNECTIONS CONFIG_NIMBLE_MAX_CONNECTIONS
|
#define CONFIG_BT_NIMBLE_MAX_CONNECTIONS CONFIG_NIMBLE_MAX_CONNECTIONS
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue