NimBLE-Arduino 2.1.2
Loading...
Searching...
No Matches
nimconfig.h
1 #pragma once
2
3#ifdef ESP_PLATFORM
4#include "sdkconfig.h"
5#else
6#include "ext_nimble_config.h"
7#endif
8
9#include "nimconfig_rename.h"
10
11/***********************************************
12 * Arduino user-config options start here
13 **********************************************/
14
16// #define CONFIG_BT_NIMBLE_MAX_CONNECTIONS 3
17
24// #define CONFIG_NIMBLE_CPP_ATT_VALUE_TIMESTAMP_ENABLED 0
25
32// #define CONFIG_NIMBLE_CPP_ATT_VALUE_INIT_LENGTH 20
33
34
35/****************************************************
36 * Extended advertising settings *
37 * NOT FOR USE WITH ORIGINAL ESP32 *
38 ***************************************************/
39
41// #define CONFIG_BT_NIMBLE_EXT_ADV 1
42
44// #define CONFIG_BT_NIMBLE_MAX_EXT_ADV_INSTANCES 1
45
47// #define CONFIG_BT_NIMBLE_MAX_EXT_ADV_DATA_LEN 251
48
50// #define CONFIG_BT_NIMBLE_ENABLE_PERIODIC_ADV 1
51
53// #define CONFIG_BT_NIMBLE_MAX_PERIODIC_SYNCS 1
54
55/****************************************************
56 * END Extended advertising settings *
57 ***************************************************/
58
59
61// #define CONFIG_BT_NIMBLE_ATT_PREFERRED_MTU 255
62
64// #define CONFIG_BT_NIMBLE_SVC_GAP_DEVICE_NAME "nimble"
65
70 // #define CONFIG_BT_NIMBLE_LOG_LEVEL 5
71
76 // #define CONFIG_NIMBLE_CPP_LOG_LEVEL 0
77
79// #define CONFIG_NIMBLE_CPP_DEBUG_ASSERT_ENABLED 1
80
84// #define CONFIG_NIMBLE_CPP_ENABLE_RETURN_CODE_TEXT
85
89// #define CONFIG_NIMBLE_CPP_ENABLE_GAP_EVENT_CODE_TEXT
90
94// #define CONFIG_NIMBLE_CPP_ENABLE_ADVERTISEMENT_TYPE_TEXT
95
97// #define CONFIG_BT_NIMBLE_SVC_GAP_APPEARANCE 0x0
98
102// #define CONFIG_BT_NIMBLE_ROLE_CENTRAL_DISABLED
103
107// #define CONFIG_BT_NIMBLE_ROLE_OBSERVER_DISABLED
108
112// #define CONFIG_BT_NIMBLE_ROLE_PERIPHERAL_DISABLED
113
117// #define CONFIG_BT_NIMBLE_ROLE_BROADCASTER_DISABLED
118
120// #define CONFIG_BT_NIMBLE_MAX_BONDS 3
121
123// #define CONFIG_BT_NIMBLE_MAX_CCCDS 8
124
126// #define CONFIG_BT_NIMBLE_RPA_TIMEOUT 900
127
134// #define CONFIG_BT_NIMBLE_MSYS1_BLOCK_COUNT 12
135
137// #define CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_EXTERNAL 1
138
140// #define CONFIG_BT_NIMBLE_PINNED_TO_CORE 0
141
143// #define CONFIG_BT_NIMBLE_HOST_TASK_STACK_SIZE 4096
144
149// #define CONFIG_NIMBLE_STACK_USE_MEM_POOLS 1
150
156// #define CONFIG_NIMBLE_CPP_FREERTOS_TASK_BLOCK_BIT 31
157
158/**********************************
159 End Arduino user-config
160**********************************/
161
162/* This section should not be altered */
163#ifndef CONFIG_BT_NIMBLE_ROLE_CENTRAL_DISABLED
164#define CONFIG_BT_NIMBLE_ROLE_CENTRAL
165#endif
166
167#ifndef CONFIG_BT_NIMBLE_ROLE_OBSERVER_DISABLED
168#define CONFIG_BT_NIMBLE_ROLE_OBSERVER
169#endif
170
171#ifndef CONFIG_BT_NIMBLE_ROLE_PERIPHERAL_DISABLED
172#define CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
173#endif
174
175#ifndef CONFIG_BT_NIMBLE_ROLE_BROADCASTER_DISABLED
176#define CONFIG_BT_NIMBLE_ROLE_BROADCASTER
177#endif
178
179#ifndef CONFIG_BT_NIMBLE_PINNED_TO_CORE
180#define CONFIG_BT_NIMBLE_PINNED_TO_CORE 0
181#endif
182
183#ifndef CONFIG_BT_NIMBLE_HOST_TASK_STACK_SIZE
184#define CONFIG_BT_NIMBLE_HOST_TASK_STACK_SIZE 4096
185#endif
186
187#ifndef CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_EXTERNAL
188#define CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_INTERNAL 1
189#endif
190
191#ifndef CONFIG_BT_NIMBLE_MAX_CONNECTIONS
192#define CONFIG_BT_NIMBLE_MAX_CONNECTIONS 3
193#endif
194
195#ifndef CONFIG_BT_NIMBLE_MAX_BONDS
196#define CONFIG_BT_NIMBLE_MAX_BONDS 3
197#endif
198
199#ifndef CONFIG_BT_NIMBLE_MAX_CCCDS
200#define CONFIG_BT_NIMBLE_MAX_CCCDS 8
201#endif
202
203#ifndef CONFIG_BT_NIMBLE_SVC_GAP_DEVICE_NAME
204#define CONFIG_BT_NIMBLE_SVC_GAP_DEVICE_NAME "nimble"
205#endif
206
207#ifndef CONFIG_BT_NIMBLE_ATT_PREFERRED_MTU
208#define CONFIG_BT_NIMBLE_ATT_PREFERRED_MTU 255
209#endif
210
211#ifndef CONFIG_BT_NIMBLE_SVC_GAP_APPEARANCE
212#define CONFIG_BT_NIMBLE_SVC_GAP_APPEARANCE 0x0
213#endif
214
215#ifndef CONFIG_BT_NIMBLE_MSYS1_BLOCK_COUNT
216#define CONFIG_BT_NIMBLE_MSYS1_BLOCK_COUNT 12
217#endif
218
219#ifndef CONFIG_BT_NIMBLE_RPA_TIMEOUT
220#define CONFIG_BT_NIMBLE_RPA_TIMEOUT 900
221#endif
222
223#ifndef CONFIG_BT_NIMBLE_LOG_LEVEL
224#define CONFIG_BT_NIMBLE_LOG_LEVEL 5
225#endif
226
227#ifndef CONFIG_NIMBLE_STACK_USE_MEM_POOLS
228#define CONFIG_NIMBLE_STACK_USE_MEM_POOLS 0
229#endif
230
232#define CONFIG_BT_NIMBLE_NVS_PERSIST 1
233
235#define CONFIG_BT_NIMBLE_SM_LEGACY 1
236
238#define CONFIG_BT_NIMBLE_SM_SC 1
239
241#define CONFIG_BT_NIMBLE_GAP_DEVICE_NAME_MAX_LEN 31
242
244#define CONFIG_BT_NIMBLE_ACL_BUF_COUNT 12
245
247#define CONFIG_BT_NIMBLE_TRANSPORT_ACL_SIZE 255
248
250#if CONFIG_BT_NIMBLE_EXT_ADV || CONFIG_BT_NIMBLE_ENABLE_PERIODIC_ADV
251# define CONFIG_BT_NIMBLE_HCI_EVT_BUF_SIZE 257
252#else
253# define CONFIG_BT_NIMBLE_HCI_EVT_BUF_SIZE 70
254#endif
255
257#define CONFIG_BT_NIMBLE_HCI_EVT_HI_BUF_COUNT 30
258
260#define CONFIG_BT_NIMBLE_HCI_EVT_LO_BUF_COUNT 8
261
263#define CONFIG_BT_NIMBLE_L2CAP_COC_MAX_NUM 0
264
265#define CONFIG_BT_NIMBLE_HS_FLOW_CTRL 1
266#define CONFIG_BT_NIMBLE_HS_FLOW_CTRL_ITVL 1000
267#define CONFIG_BT_NIMBLE_HS_FLOW_CTRL_THRESH 2
268#define CONFIG_BT_NIMBLE_HS_FLOW_CTRL_TX_ON_DISCONNECT 1
269
270#define CONFIG_BT_NIMBLE_HS_STOP_TIMEOUT_MS 2000
271
272#ifndef CONFIG_BT_ENABLED
273#define CONFIG_BT_ENABLED
274#endif
275
276#ifndef CONFIG_BT_NIMBLE_ENABLED
277#define CONFIG_BT_NIMBLE_ENABLED 1
278#endif
279
280#ifndef CONFIG_BT_CONTROLLER_ENABLED
281#define CONFIG_BT_CONTROLLER_ENABLED 1
282#endif
283
284#ifdef ESP_PLATFORM
285#ifndef CONFIG_BTDM_CONTROLLER_MODE_BLE_ONLY
286#define CONFIG_BTDM_CONTROLLER_MODE_BLE_ONLY
287#endif
288
289#ifndef CONFIG_BTDM_SCAN_DUPL_TYPE_DEVICE
290#define CONFIG_BTDM_SCAN_DUPL_TYPE_DEVICE 0
291#endif
292
293#ifndef CONFIG_BTDM_SCAN_DUPL_TYPE_DATA
294#define CONFIG_BTDM_SCAN_DUPL_TYPE_DATA 1
295#endif
296
297#ifndef CONFIG_BTDM_SCAN_DUPL_TYPE_DATA_DEVICE
298#define CONFIG_BTDM_SCAN_DUPL_TYPE_DATA_DEVICE 2
299#endif
300
301#if !defined(CONFIG_IDF_TARGET_ESP32) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3)
302#define CONFIG_IDF_TARGET_ESP32 1
303#endif
304
305#if !defined(CONFIG_BT_NIMBLE_LEGACY_VHCI_ENABLE)
306#define CONFIG_BT_NIMBLE_LEGACY_VHCI_ENABLE 1
307#endif
308
309#if !defined(CONFIG_BT_CONTROLLER_DISABLED)
310#define CONFIG_BT_CONTROLLER_DISABLED 0
311#endif
312
313#if CONFIG_BT_NIMBLE_EXT_ADV || CONFIG_BT_NIMBLE_ENABLE_PERIODIC_ADV
314# if defined(CONFIG_IDF_TARGET_ESP32)
315# error Extended advertising is not supported on ESP32.
316# endif
317#endif
318#endif // ESP_PLATFORM
319
320#if CONFIG_BT_NIMBLE_ENABLE_PERIODIC_ADV && !CONFIG_BT_NIMBLE_EXT_ADV
321# error Extended advertising must be enabled to use periodic advertising.
322#endif
323
324/* Must have max instances and data length set if extended advertising is enabled */
325#if CONFIG_BT_NIMBLE_EXT_ADV
326# if !defined(CONFIG_BT_NIMBLE_MAX_EXT_ADV_INSTANCES)
327# define CONFIG_BT_NIMBLE_MAX_EXT_ADV_INSTANCES 1
328# endif
329# if !defined(CONFIG_BT_NIMBLE_MAX_EXT_ADV_DATA_LEN)
330# define CONFIG_BT_NIMBLE_MAX_EXT_ADV_DATA_LEN 251
331# endif
332#endif
333
334/* Must set max number of syncs if periodic advertising is enabled */
335#if CONFIG_BT_NIMBLE_ENABLE_PERIODIC_ADV && !defined(CONFIG_BT_NIMBLE_MAX_PERIODIC_SYNCS)
336# define CONFIG_BT_NIMBLE_MAX_PERIODIC_SYNCS 1
337#endif
338
339/* Cannot use client without scan */
340#if defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL) && !defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER)
341#define CONFIG_BT_NIMBLE_ROLE_OBSERVER
342#endif
343
344/* Cannot use server without advertise */
345#if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL) && !defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER)
346#define CONFIG_BT_NIMBLE_ROLE_BROADCASTER
347#endif
348
349/* Enables the use of Arduino String class for attribute values */
350#if defined __has_include
351# if __has_include (<Arduino.h>)
352# define NIMBLE_CPP_ARDUINO_STRING_AVAILABLE
353# endif
354#endif
355
356#ifndef CONFIG_NIMBLE_CPP_DEBUG_ASSERT_ENABLED
357#define CONFIG_NIMBLE_CPP_DEBUG_ASSERT_ENABLED 0
358#endif
359
360#ifndef CONFIG_NIMBLE_CPP_FREERTOS_TASK_BLOCK_BIT
361#define CONFIG_NIMBLE_CPP_FREERTOS_TASK_BLOCK_BIT 31
362#endif
363
364#if CONFIG_NIMBLE_CPP_DEBUG_ASSERT_ENABLED && !defined NDEBUG
365void nimble_cpp_assert(const char *file, unsigned line) __attribute((weak, noreturn));
366# define NIMBLE_ATT_VAL_FILE (__builtin_strrchr(__FILE__, '/') ? \
367 __builtin_strrchr (__FILE__, '/') + 1 : __FILE__)
368# define NIMBLE_CPP_DEBUG_ASSERT(cond) \
369 if (!(cond)) { \
370 nimble_cpp_assert(NIMBLE_ATT_VAL_FILE, __LINE__); \
371 }
372#else
373# define NIMBLE_CPP_DEBUG_ASSERT(cond) (void(0))
374#endif