Select one of the symbols to view example projects that use it.
 
Outline
#define __ESP_COEXIST_H__
#include <stdbool.h>
#include "esp_err.h"
#include "hal/gpio_types.h"
#define EXTERNAL_COEXIST_WIRE_1
#define EXTERNAL_COEXIST_WIRE_2
#define EXTERNAL_COEXIST_WIRE_3
#define EXTERNAL_COEXIST_WIRE_4
esp_coex_prefer_t
external_coex_wire_t
esp_coex_status_type_t
#define ESP_COEX_BLE_ST_MESH_CONFIG
#define ESP_COEX_BLE_ST_MESH_TRAFFIC
#define ESP_COEX_BLE_ST_MESH_STANDBY
#define ESP_COEX_BT_ST_A2DP_STREAMING
#define ESP_COEX_BT_ST_A2DP_PAUSED
esp_coex_version_get();
esp_coex_preference_set(esp_coex_prefer_t);
esp_coex_status_bit_set(esp_coex_status_type_t, uint32_t);
esp_coex_status_bit_clear(esp_coex_status_type_t, uint32_t);
Files
loading...
SourceVuESP-IDF Framework and ExamplesESP-IDFcomponents/esp_coex/include/esp_coexist.h
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/* * SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 *//* ... */ #ifndef __ESP_COEXIST_H__ #define __ESP_COEXIST_H__ #include <stdbool.h> #include "esp_err.h" #include "hal/gpio_types.h" #ifdef __cplusplus extern "C" { #endif #define EXTERNAL_COEXIST_WIRE_1 0 #define EXTERNAL_COEXIST_WIRE_2 1 #define EXTERNAL_COEXIST_WIRE_3 2 #define EXTERNAL_COEXIST_WIRE_4 3 /** * @brief coex prefer value *//* ... */ typedef enum { ESP_COEX_PREFER_WIFI = 0, /*!< Prefer to WiFi, WiFi will have more opportunity to use RF */ ESP_COEX_PREFER_BT, /*!< Prefer to bluetooth, bluetooth will have more opportunity to use RF */ ESP_COEX_PREFER_BALANCE, /*!< Do balance of WiFi and bluetooth */ ESP_COEX_PREFER_NUM, /*!< Prefer value numbers */ }{ ... } esp_coex_prefer_t; typedef enum { EXTERN_COEX_WIRE_1 = EXTERNAL_COEXIST_WIRE_1, EXTERN_COEX_WIRE_2 = EXTERNAL_COEXIST_WIRE_2, EXTERN_COEX_WIRE_3 = EXTERNAL_COEXIST_WIRE_3, EXTERN_COEX_WIRE_4 = EXTERNAL_COEXIST_WIRE_4, EXTERN_COEX_WIRE_NUM, }{ ... } external_coex_wire_t; /** * @brief coex status type *//* ... */ typedef enum { ESP_COEX_ST_TYPE_WIFI = 0, ESP_COEX_ST_TYPE_BLE, ESP_COEX_ST_TYPE_BT, }{ ... } esp_coex_status_type_t; #if CONFIG_EXTERNAL_COEX_ENABLE /** * @brief external coex gpio pti *//* ... */ typedef struct { union { uint32_t in_pin0 __attribute__((deprecated("Use 'request' instead"))); gpio_num_t request; /**< request gpio signal from follower to leader */ }{...}; union { uint32_t in_pin1 __attribute__((deprecated("Use 'priority' instead"))); gpio_num_t priority; /**< request gpio signal priority from follower to leader */ }{...}; union { uint32_t out_pin0 __attribute__((deprecated("Use 'grant' instead"))); gpio_num_t grant; /**< grant gpio signal from leader to follower */ }{...}; union { uint32_t out_pin1 __attribute__((deprecated("Use 'tx_line' instead"))); gpio_num_t tx_line; /**< tx_line gpio signal from leader to follower, indicates whether the leader's WiFi is transmitting or not*/ }{...}; }{...} esp_external_coex_gpio_set_t; /** * @brief external coex pti level *//* ... */ typedef enum { EXTERN_COEX_PTI_MID = 0, EXTERN_COEX_PTI_HIGH, EXTERN_COEX_PTI_NUM, }{...} esp_coex_pti_level_t; /** * @brief external coex role *//* ... */ typedef enum { EXTERNAL_COEX_LEADER_ROLE = 0, EXTERNAL_COEX_FOLLOWER_ROLE = 2, EXTERNAL_COEX_UNKNOWN_ROLE, }{...} esp_extern_coex_work_mode_t; /** * @brief external coex advance setup *//* ... */ typedef struct { esp_extern_coex_work_mode_t work_mode; uint8_t delay_us; bool is_high_valid; }{...} esp_external_coex_advance_t;/* ... */ #endif #define ESP_COEX_BLE_ST_MESH_CONFIG 0x08 #define ESP_COEX_BLE_ST_MESH_TRAFFIC 0x10 #define ESP_COEX_BLE_ST_MESH_STANDBY 0x20 #define ESP_COEX_BT_ST_A2DP_STREAMING 0x10 #define ESP_COEX_BT_ST_A2DP_PAUSED 0x205 defines /** * @brief Get software coexist version string * * @return : version string *//* ... */ const char *esp_coex_version_get(void); /** * @deprecated Use esp_coex_status_bit_set() and esp_coex_status_bit_clear() instead. * Set coexist preference of performance * For example, if prefer to bluetooth, then it will make A2DP(play audio via classic bt) * more smooth while wifi is running something. * If prefer to wifi, it will do similar things as prefer to bluetooth. * Default, it prefer to balance. * * @param prefer : the prefer enumeration value * @return : ESP_OK - success, other - failed *//* ... */ esp_err_t esp_coex_preference_set(esp_coex_prefer_t prefer); /** * @brief Set coex schm status * @param type : WIFI/BLE/BT * @param status : WIFI/BLE/BT STATUS * @return : ESP_OK - success, other - failed *//* ... */ esp_err_t esp_coex_status_bit_set(esp_coex_status_type_t type, uint32_t status); /** * @brief Clear coex schm status * @param type : WIFI/BLE/BT * @param status : WIFI/BLE/BT STATUS * @return : ESP_OK - success, other - failed *//* ... */ esp_err_t esp_coex_status_bit_clear(esp_coex_status_type_t type, uint32_t status); #if CONFIG_EXTERNAL_COEX_ENABLE /** * @brief Configure work mode, the default work mode is leader role. * @param work_mode : work mode. * @return : ESP_OK - success, other - failed *//* ... */ esp_err_t esp_external_coex_set_work_mode(esp_extern_coex_work_mode_t work_mode); /** * @brief Setup gpio pin and corresponding pti level, start external coex, * the default work mode is leader role, the default output grant validate pin is high, * and the default delay output grant value is zero. * @param wire_type : to select the whole external coex gpio number. * @param gpio_pin : gpio pin number to choose. * @return : ESP_OK - success, other - failed *//* ... */ esp_err_t esp_enable_extern_coex_gpio_pin(external_coex_wire_t wire_type, esp_external_coex_gpio_set_t gpio_pin); /** * @brief Disable external coex. * @return : ESP_OK - success, other - failed *//* ... */ esp_err_t esp_disable_extern_coex_gpio_pin(void); #if SOC_EXTERNAL_COEX_ADVANCE /** * @brief Configure leader work mode, gpio pin correspondly and finally enable external coex, * demand not to call the legacy function of `esp_enable_extern_coex_gpio_pin` any more. * @param wire_type : to select the whole external coex gpio number. * @param request : request gpio pin number to select. * @param priority : priority gpio pin number to select. * @param grant : grant gpio pin number to select. * @return : ESP_OK - success, other - failed *//* ... */ esp_err_t esp_external_coex_leader_role_set_gpio_pin(external_coex_wire_t wire_type, uint32_t request, uint32_t priority, uint32_t grant) __attribute__((deprecated("Please use esp_external_coex_set_work_mode and esp_enable_extern_coex_gpio_pin instead"))); /** * @brief Configure follower work mode, gpio pin correspondly and finally enable external coex, * demand not to call the legacy function of `esp_enable_extern_coex_gpio_pin` any more. * @param wire_type : to select the whole external coex gpio number. * @param request : request gpio pin number to select. * @param priority : priority gpio pin number to select. * @param grant : grant gpio pin number to select. * @return : ESP_OK - success, other - failed *//* ... */ esp_err_t esp_external_coex_follower_role_set_gpio_pin(external_coex_wire_t wire_type, uint32_t request, uint32_t priority, uint32_t grant) __attribute__((deprecated("Please use esp_external_coex_set_work_mode and esp_enable_extern_coex_gpio_pin instead"))); /** * @brief Configure output grant signal latency in delay microseconds only for leader role of external coex, * demand to call this function before `esp_external_coex_leader_role_set_gpio_pin`, * if users want to setup output delay value. * @param delay_us : to setup how many microseconds the output signal performs latency. * @return : ESP_OK - success, other - failed *//* ... */ esp_err_t esp_external_coex_set_grant_delay(uint8_t delay_us); /** * @brief Configure output grant signal is high validate or not only for leader role of external coex, * demand to call this function before `esp_external_coex_leader_role_set_gpio_pin`, * if users want to setup output grant validate pin value. * @param is_high_valid : to select true means the output grant signal validate is high, other - validate is low. * @return : ESP_OK - success, other - failed *//* ... */ esp_err_t esp_external_coex_set_validate_high(bool is_high_valid);/* ... */ #endif /* SOC_EXTERNAL_COEX_ADVANCE *//* ... */ #endif /* CONFIG_EXTERNAL_COEX_ENABLE */ #if CONFIG_ESP_COEX_SW_COEXIST_ENABLE && CONFIG_SOC_IEEE802154_SUPPORTED /** * @brief Enable Wi-Fi and 802.15.4 coexistence. * @return : ESP_OK - success, other - failed *//* ... */ esp_err_t esp_coex_wifi_i154_enable(void);/* ... */ #endif #if CONFIG_ESP_COEX_GPIO_DEBUG /** * @brief Enable coexist GPIO debug. * To fully enable this feature, make sure functions in rom_funcs are out of ROM. * @return : ESP_OK - success, other - failed *//* ... */ esp_err_t esp_coexist_debug_init(void);/* ... */ #endif #ifdef __cplusplus }{...} #endif /* ... */ #endif /* __ESP_COEXIST_H__ */
Details