wifi/bt coexist code sanitization
This commit is contained in:
parent
2725b8770f
commit
2a9469422c
@ -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 <stdbool.h>
|
|
||||||
|
|
||||||
#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__ */
|
|
@ -4,7 +4,6 @@
|
|||||||
#include <esp_spi_flash.h> // needed for reading ESP32 chip attributes
|
#include <esp_spi_flash.h> // needed for reading ESP32 chip attributes
|
||||||
#include <esp_event_loop.h> // needed for Wifi event handler
|
#include <esp_event_loop.h> // needed for Wifi event handler
|
||||||
#include <esp32-hal-timer.h> // needed for timers
|
#include <esp32-hal-timer.h> // needed for timers
|
||||||
#include <esp_coexist.h> // needed for showing coex sw version
|
|
||||||
|
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
#include "reset.h"
|
#include "reset.h"
|
||||||
|
@ -3,8 +3,6 @@
|
|||||||
|
|
||||||
// ESP32 Functions
|
// ESP32 Functions
|
||||||
#include <esp_wifi.h>
|
#include <esp_wifi.h>
|
||||||
#include <esp_coexist.h>
|
|
||||||
#include "coexist_internal.h"
|
|
||||||
|
|
||||||
#include "hash.h" // Hash function for scrambling MAC addresses
|
#include "hash.h" // Hash function for scrambling MAC addresses
|
||||||
#include "antenna.h" // code for switching wifi antennas
|
#include "antenna.h" // code for switching wifi antennas
|
||||||
|
@ -247,10 +247,9 @@ void start_BLEscan(void) {
|
|||||||
#if (BLECOUNTER)
|
#if (BLECOUNTER)
|
||||||
ESP_LOGI(TAG, "Initializing bluetooth scanner ...");
|
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.
|
// Initialize BT controller to allocate task and other resource.
|
||||||
|
ESP_ERROR_CHECK(esp_coex_preference_set(ESP_COEX_PREFER_BT));
|
||||||
|
|
||||||
btStart();
|
btStart();
|
||||||
ESP_ERROR_CHECK(esp_bluedroid_init());
|
ESP_ERROR_CHECK(esp_bluedroid_init());
|
||||||
ESP_ERROR_CHECK(esp_bluedroid_enable());
|
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_disable());
|
||||||
ESP_ERROR_CHECK(esp_bluedroid_deinit());
|
ESP_ERROR_CHECK(esp_bluedroid_deinit());
|
||||||
btStop(); // disable bt_controller
|
btStop(); // disable bt_controller
|
||||||
ESP_ERROR_CHECK(esp_coex_preference_set(
|
ESP_ERROR_CHECK(esp_coex_preference_set(ESP_COEX_PREFER_WIFI));
|
||||||
ESP_COEX_PREFER_WIFI)); // configure Wifi/BT coexist lib
|
|
||||||
ESP_LOGI(TAG, "Bluetooth scanner stopped");
|
ESP_LOGI(TAG, "Bluetooth scanner stopped");
|
||||||
#endif // BLECOUNTER
|
#endif // BLECOUNTER
|
||||||
} // stop_BLEscan
|
} // stop_BLEscan
|
||||||
|
Loading…
Reference in New Issue
Block a user