esp_coexist.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. #ifndef __ESP_COEXIST_H__
  15. #define __ESP_COEXIST_H__
  16. #include <stdbool.h>
  17. #include "esp_err.h"
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif
  21. /**
  22. * @brief coex prefer value
  23. */
  24. typedef enum {
  25. ESP_COEX_PREFER_WIFI = 0, /*!< Prefer to WiFi, WiFi will have more opportunity to use RF */
  26. ESP_COEX_PREFER_BT, /*!< Prefer to bluetooth, bluetooth will have more opportunity to use RF */
  27. ESP_COEX_PREFER_BALANCE, /*!< Do balance of WiFi and bluetooth */
  28. ESP_COEX_PREFER_NUM, /*!< Prefer value numbers */
  29. } esp_coex_prefer_t;
  30. /**
  31. * @brief coex status type
  32. */
  33. typedef enum {
  34. ESP_COEX_ST_TYPE_WIFI = 0,
  35. ESP_COEX_ST_TYPE_BLE,
  36. ESP_COEX_ST_TYPE_BT,
  37. } esp_coex_status_type_t;
  38. #define ESP_COEX_BLE_ST_MESH_CONFIG 0x08
  39. #define ESP_COEX_BLE_ST_MESH_TRAFFIC 0x10
  40. #define ESP_COEX_BLE_ST_MESH_STANDBY 0x20
  41. #define ESP_COEX_BT_ST_A2DP_STREAMING 0x10
  42. #define ESP_COEX_BT_ST_A2DP_PAUSED 0x20
  43. /**
  44. * @brief Get software coexist version string
  45. *
  46. * @return : version string
  47. */
  48. const char *esp_coex_version_get(void);
  49. /**
  50. * @deprecated Use esp_coex_status_bit_set() and esp_coex_status_bit_clear() instead.
  51. * Set coexist preference of performance
  52. * For example, if prefer to bluetooth, then it will make A2DP(play audio via classic bt)
  53. * more smooth while wifi is runnning something.
  54. * If prefer to wifi, it will do similar things as prefer to bluetooth.
  55. * Default, it prefer to balance.
  56. *
  57. * @param prefer : the prefer enumeration value
  58. * @return : ESP_OK - success, other - failed
  59. */
  60. esp_err_t esp_coex_preference_set(esp_coex_prefer_t prefer);
  61. /**
  62. * @brief Set coex schm status
  63. * @param type : WIFI/BLE/BT
  64. * @param status : WIFI/BLE/BT STATUS
  65. * @return : ESP_OK - success, other - failed
  66. */
  67. esp_err_t esp_coex_status_bit_set(esp_coex_status_type_t type, uint32_t status);
  68. /**
  69. * @brief Clear coex schm status
  70. * @param type : WIFI/BLE/BT
  71. * @param status : WIFI/BLE/BT STATUS
  72. * @return : ESP_OK - success, other - failed
  73. */
  74. esp_err_t esp_coex_status_bit_clear(esp_coex_status_type_t type, uint32_t status);
  75. #ifdef __cplusplus
  76. }
  77. #endif
  78. #endif /* __ESP_COEXIST_H__ */