From 2a9469422c7f22ff7aee91fbef71347020b08cdd Mon Sep 17 00:00:00 2001 From: Klaus K Wilting Date: Sat, 12 Sep 2020 13:58:18 +0200 Subject: [PATCH] wifi/bt coexist code sanitization --- include/coexist_internal.h | 77 -------------------------------------- include/main.h | 1 - include/wifiscan.h | 2 - src/blecsan.cpp | 8 ++-- 4 files changed, 3 insertions(+), 85 deletions(-) delete mode 100644 include/coexist_internal.h diff --git a/include/coexist_internal.h b/include/coexist_internal.h deleted file mode 100644 index 6b4c47cc..00000000 --- a/include/coexist_internal.h +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2018-2018 Espressif Systems (Shanghai) PTE LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef __COEXIST_INTERNAL_H__ -#define __COEXIST_INTERNAL_H__ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum { - COEX_PREFER_WIFI = 0, - COEX_PREFER_BT, - COEX_PREFER_BALANCE, - COEX_PREFER_NUM, -} coex_prefer_t; - -/** - * @brief Init software coexist - * extern function for internal use. - * - * @return Init ok or failed. - */ -esp_err_t coex_init(void); - -/** - * @brief De-init software coexist - * extern function for internal use. - */ -void coex_deinit(void); - -/** - * @brief Pause software coexist - * extern function for internal use. - */ -void coex_pause(void); - -/** - * @brief Resume software coexist - * extern function for internal use. - */ -void coex_resume(void); - -/** - * @brief Get software coexist version string - * extern function for internal use. - * @return : version string - */ -const char *coex_version_get(void); - -/** - * @brief Coexist performance preference set from libbt.a - * extern function for internal use. - * - * @param prefer : the prefer enumeration value - * @return : ESP_OK - success, other - failed - */ -esp_err_t coex_preference_set(coex_prefer_t prefer); - -#ifdef __cplusplus -} -#endif - -#endif /* __COEXIST_INTERNAL_H__ */ \ No newline at end of file diff --git a/include/main.h b/include/main.h index 3e346af7..acb64e95 100644 --- a/include/main.h +++ b/include/main.h @@ -4,7 +4,6 @@ #include // needed for reading ESP32 chip attributes #include // needed for Wifi event handler #include // needed for timers -#include // needed for showing coex sw version #include "globals.h" #include "reset.h" diff --git a/include/wifiscan.h b/include/wifiscan.h index 88de6d26..0b212a9d 100644 --- a/include/wifiscan.h +++ b/include/wifiscan.h @@ -3,8 +3,6 @@ // ESP32 Functions #include -#include -#include "coexist_internal.h" #include "hash.h" // Hash function for scrambling MAC addresses #include "antenna.h" // code for switching wifi antennas diff --git a/src/blecsan.cpp b/src/blecsan.cpp index 73110fdd..6bed9cbb 100644 --- a/src/blecsan.cpp +++ b/src/blecsan.cpp @@ -247,10 +247,9 @@ void start_BLEscan(void) { #if (BLECOUNTER) ESP_LOGI(TAG, "Initializing bluetooth scanner ..."); - ESP_ERROR_CHECK(esp_coex_preference_set( - ESP_COEX_PREFER_BALANCE)); // configure Wifi/BT coexist lib - // Initialize BT controller to allocate task and other resource. + ESP_ERROR_CHECK(esp_coex_preference_set(ESP_COEX_PREFER_BT)); + btStart(); ESP_ERROR_CHECK(esp_bluedroid_init()); ESP_ERROR_CHECK(esp_bluedroid_enable()); @@ -269,8 +268,7 @@ void stop_BLEscan(void) { ESP_ERROR_CHECK(esp_bluedroid_disable()); ESP_ERROR_CHECK(esp_bluedroid_deinit()); btStop(); // disable bt_controller - ESP_ERROR_CHECK(esp_coex_preference_set( - ESP_COEX_PREFER_WIFI)); // configure Wifi/BT coexist lib + ESP_ERROR_CHECK(esp_coex_preference_set(ESP_COEX_PREFER_WIFI)); ESP_LOGI(TAG, "Bluetooth scanner stopped"); #endif // BLECOUNTER } // stop_BLEscan