1 // Copyright 2015-2018 Espressif Systems (Shanghai) PTE LTD 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #ifndef __ESP_COEXIST_H__ 16 #define __ESP_COEXIST_H__ 17 18 #include <stdbool.h> 19 #include "esp_err.h" 20 21 #ifdef __cplusplus 22 extern "C" { 23 #endif 24 25 /** 26 * @brief coex prefer value 27 */ 28 typedef enum { 29 ESP_COEX_PREFER_WIFI = 0, /*!< Prefer to WiFi, WiFi will have more opportunity to use RF */ 30 ESP_COEX_PREFER_BT, /*!< Prefer to bluetooth, bluetooth will have more opportunity to use RF */ 31 ESP_COEX_PREFER_BALANCE, /*!< Do balance of WiFi and bluetooth */ 32 ESP_COEX_PREFER_NUM, /*!< Prefer value numbers */ 33 } esp_coex_prefer_t; 34 35 /** 36 * @brief coex status type 37 */ 38 typedef enum { 39 ESP_COEX_ST_TYPE_WIFI = 0, 40 ESP_COEX_ST_TYPE_BLE, 41 ESP_COEX_ST_TYPE_BT, 42 } esp_coex_status_type_t; 43 44 #define ESP_COEX_BLE_ST_MESH_CONFIG 0x08 45 #define ESP_COEX_BLE_ST_MESH_TRAFFIC 0x10 46 #define ESP_COEX_BLE_ST_MESH_STANDBY 0x20 47 48 #define ESP_COEX_BT_ST_A2DP_STREAMING 0x10 49 #define ESP_COEX_BT_ST_A2DP_PAUSED 0x20 50 51 /** 52 * @brief Get software coexist version string 53 * 54 * @return : version string 55 */ 56 const char *esp_coex_version_get(void); 57 58 /** 59 * @deprecated Use esp_coex_status_bit_set() and esp_coex_status_bit_clear() instead. 60 * Set coexist preference of performance 61 * For example, if prefer to bluetooth, then it will make A2DP(play audio via classic bt) 62 * more smooth while wifi is runnning something. 63 * If prefer to wifi, it will do similar things as prefer to bluetooth. 64 * Default, it prefer to balance. 65 * 66 * @param prefer : the prefer enumeration value 67 * @return : ESP_OK - success, other - failed 68 */ 69 esp_err_t esp_coex_preference_set(esp_coex_prefer_t prefer); 70 71 /** 72 * @brief Set coex schm status 73 * @param type : WIFI/BLE/BT 74 * @param status : WIFI/BLE/BT STATUS 75 * @return : ESP_OK - success, other - failed 76 */ 77 esp_err_t esp_coex_status_bit_set(esp_coex_status_type_t type, uint32_t status); 78 79 /** 80 * @brief Clear coex schm status 81 * @param type : WIFI/BLE/BT 82 * @param status : WIFI/BLE/BT STATUS 83 * @return : ESP_OK - success, other - failed 84 */ 85 esp_err_t esp_coex_status_bit_clear(esp_coex_status_type_t type, uint32_t status); 86 87 88 #ifdef __cplusplus 89 } 90 #endif 91 92 93 #endif /* __ESP_COEXIST_H__ */ 94