NimBLE-Arduino 2.2.0
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
161// #define CONFIG_NIMBLE_CPP_ADDR_FMT_EXCLUDE_DELIMITER 1
162
166// #define CONFIG_NIMBLE_CPP_ADDR_FMT_UPPERCASE 1
167
172// #define CONFIG_BT_NIMBLE_CRYPTO_STACK_MBEDTLS 1
173
174/**********************************
175 End Arduino user-config
176**********************************/
177
178/* This section should not be altered */
179#ifndef CONFIG_BT_NIMBLE_ROLE_CENTRAL_DISABLED
180#define CONFIG_BT_NIMBLE_ROLE_CENTRAL
181#endif
182
183#ifndef CONFIG_BT_NIMBLE_ROLE_OBSERVER_DISABLED
184#define CONFIG_BT_NIMBLE_ROLE_OBSERVER
185#endif
186
187#ifndef CONFIG_BT_NIMBLE_ROLE_PERIPHERAL_DISABLED
188#define CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
189#endif
190
191#ifndef CONFIG_BT_NIMBLE_ROLE_BROADCASTER_DISABLED
192#define CONFIG_BT_NIMBLE_ROLE_BROADCASTER
193#endif
194
195#ifndef CONFIG_BT_NIMBLE_PINNED_TO_CORE
196#define CONFIG_BT_NIMBLE_PINNED_TO_CORE 0
197#endif
198
199#ifndef CONFIG_BT_NIMBLE_HOST_TASK_STACK_SIZE
200#define CONFIG_BT_NIMBLE_HOST_TASK_STACK_SIZE 4096
201#endif
202
203#ifndef CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_EXTERNAL
204#define CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_INTERNAL 1
205#endif
206
207#ifndef CONFIG_BT_NIMBLE_MAX_CONNECTIONS
208#define CONFIG_BT_NIMBLE_MAX_CONNECTIONS 3
209#endif
210
211#ifndef CONFIG_BT_NIMBLE_MAX_BONDS
212#define CONFIG_BT_NIMBLE_MAX_BONDS 3
213#endif
214
215#ifndef CONFIG_BT_NIMBLE_MAX_CCCDS
216#define CONFIG_BT_NIMBLE_MAX_CCCDS 8
217#endif
218
219#ifndef CONFIG_BT_NIMBLE_SVC_GAP_DEVICE_NAME
220#define CONFIG_BT_NIMBLE_SVC_GAP_DEVICE_NAME "nimble"
221#endif
222
223#ifndef CONFIG_BT_NIMBLE_ATT_PREFERRED_MTU
224#define CONFIG_BT_NIMBLE_ATT_PREFERRED_MTU 255
225#endif
226
227#ifndef CONFIG_BT_NIMBLE_SVC_GAP_APPEARANCE
228#define CONFIG_BT_NIMBLE_SVC_GAP_APPEARANCE 0x0
229#endif
230
231#ifndef CONFIG_BT_NIMBLE_MSYS1_BLOCK_COUNT
232#define CONFIG_BT_NIMBLE_MSYS1_BLOCK_COUNT 12
233#endif
234
235#ifndef CONFIG_BT_NIMBLE_RPA_TIMEOUT
236#define CONFIG_BT_NIMBLE_RPA_TIMEOUT 900
237#endif
238
239#ifndef CONFIG_BT_NIMBLE_LOG_LEVEL
240#define CONFIG_BT_NIMBLE_LOG_LEVEL 5
241#endif
242
243#ifndef CONFIG_NIMBLE_STACK_USE_MEM_POOLS
244#define CONFIG_NIMBLE_STACK_USE_MEM_POOLS 0
245#endif
246
248#define CONFIG_BT_NIMBLE_NVS_PERSIST 1
249
251#define CONFIG_BT_NIMBLE_SM_LEGACY 1
252
254#define CONFIG_BT_NIMBLE_SM_SC 1
255
257#define CONFIG_BT_NIMBLE_GAP_DEVICE_NAME_MAX_LEN 31
258
260#define CONFIG_BT_NIMBLE_ACL_BUF_COUNT 12
261
263#define CONFIG_BT_NIMBLE_TRANSPORT_ACL_SIZE 255
264
266#if CONFIG_BT_NIMBLE_EXT_ADV || CONFIG_BT_NIMBLE_ENABLE_PERIODIC_ADV
267# define CONFIG_BT_NIMBLE_HCI_EVT_BUF_SIZE 257
268#else
269# define CONFIG_BT_NIMBLE_HCI_EVT_BUF_SIZE 70
270#endif
271
273#define CONFIG_BT_NIMBLE_HCI_EVT_HI_BUF_COUNT 30
274
276#define CONFIG_BT_NIMBLE_HCI_EVT_LO_BUF_COUNT 8
277
279#define CONFIG_BT_NIMBLE_L2CAP_COC_MAX_NUM 0
280
281#define CONFIG_BT_NIMBLE_HS_FLOW_CTRL 1
282#define CONFIG_BT_NIMBLE_HS_FLOW_CTRL_ITVL 1000
283#define CONFIG_BT_NIMBLE_HS_FLOW_CTRL_THRESH 2
284#define CONFIG_BT_NIMBLE_HS_FLOW_CTRL_TX_ON_DISCONNECT 1
285
286#define CONFIG_BT_NIMBLE_HS_STOP_TIMEOUT_MS 2000
287
288#ifndef CONFIG_BT_ENABLED
289#define CONFIG_BT_ENABLED
290#endif
291
292#ifndef CONFIG_BT_NIMBLE_ENABLED
293#define CONFIG_BT_NIMBLE_ENABLED 1
294#endif
295
296#ifndef CONFIG_BT_CONTROLLER_ENABLED
297#define CONFIG_BT_CONTROLLER_ENABLED 1
298#endif
299
300#ifndef CONFIG_BT_NIMBLE_CRYPTO_STACK_MBEDTLS
301#define CONFIG_BT_NIMBLE_CRYPTO_STACK_MBEDTLS 0
302#endif
303
304#ifndef MYNEWT_VAL_BLE_CRYPTO_STACK_MBEDTLS
305#define MYNEWT_VAL_BLE_CRYPTO_STACK_MBEDTLS (CONFIG_BT_NIMBLE_CRYPTO_STACK_MBEDTLS)
306#endif
307
308#ifdef ESP_PLATFORM
309#ifndef CONFIG_BTDM_CONTROLLER_MODE_BLE_ONLY
310#define CONFIG_BTDM_CONTROLLER_MODE_BLE_ONLY
311#endif
312
313#ifndef CONFIG_BTDM_SCAN_DUPL_TYPE_DEVICE
314#define CONFIG_BTDM_SCAN_DUPL_TYPE_DEVICE 0
315#endif
316
317#ifndef CONFIG_BTDM_SCAN_DUPL_TYPE_DATA
318#define CONFIG_BTDM_SCAN_DUPL_TYPE_DATA 1
319#endif
320
321#ifndef CONFIG_BTDM_SCAN_DUPL_TYPE_DATA_DEVICE
322#define CONFIG_BTDM_SCAN_DUPL_TYPE_DATA_DEVICE 2
323#endif
324
325#if !defined(CONFIG_IDF_TARGET_ESP32) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3)
326#define CONFIG_IDF_TARGET_ESP32 1
327#endif
328
329#if !defined(CONFIG_BT_NIMBLE_LEGACY_VHCI_ENABLE)
330#define CONFIG_BT_NIMBLE_LEGACY_VHCI_ENABLE 1
331#endif
332
333#if !defined(CONFIG_BT_CONTROLLER_DISABLED)
334#define CONFIG_BT_CONTROLLER_DISABLED 0
335#endif
336
337#if CONFIG_BT_NIMBLE_EXT_ADV || CONFIG_BT_NIMBLE_ENABLE_PERIODIC_ADV
338# if defined(CONFIG_IDF_TARGET_ESP32)
339# error Extended advertising is not supported on ESP32.
340# endif
341#endif
342
343#ifndef CONFIG_BT_NIMBLE_USE_ESP_TIMER
344#define CONFIG_BT_NIMBLE_USE_ESP_TIMER 1
345#endif
346
347#endif // ESP_PLATFORM
348
349#if CONFIG_BT_NIMBLE_ENABLE_PERIODIC_ADV && !CONFIG_BT_NIMBLE_EXT_ADV
350# error Extended advertising must be enabled to use periodic advertising.
351#endif
352
353/* Must have max instances and data length set if extended advertising is enabled */
354#if CONFIG_BT_NIMBLE_EXT_ADV
355# if !defined(CONFIG_BT_NIMBLE_MAX_EXT_ADV_INSTANCES)
356# define CONFIG_BT_NIMBLE_MAX_EXT_ADV_INSTANCES 1
357# endif
358# if !defined(CONFIG_BT_NIMBLE_MAX_EXT_ADV_DATA_LEN)
359# define CONFIG_BT_NIMBLE_MAX_EXT_ADV_DATA_LEN 251
360# endif
361#endif
362
363/* Must set max number of syncs if periodic advertising is enabled */
364#if CONFIG_BT_NIMBLE_ENABLE_PERIODIC_ADV && !defined(CONFIG_BT_NIMBLE_MAX_PERIODIC_SYNCS)
365# define CONFIG_BT_NIMBLE_MAX_PERIODIC_SYNCS 1
366#endif
367
368/* Cannot use client without scan */
369#if defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL) && !defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER)
370#define CONFIG_BT_NIMBLE_ROLE_OBSERVER
371#endif
372
373/* Cannot use server without advertise */
374#if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL) && !defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER)
375#define CONFIG_BT_NIMBLE_ROLE_BROADCASTER
376#endif
377
378/* Enables the use of Arduino String class for attribute values */
379#if defined __has_include
380# if __has_include (<Arduino.h>)
381# define NIMBLE_CPP_ARDUINO_STRING_AVAILABLE
382# endif
383#endif
384
385#ifndef CONFIG_NIMBLE_CPP_DEBUG_ASSERT_ENABLED
386#define CONFIG_NIMBLE_CPP_DEBUG_ASSERT_ENABLED 0
387#endif
388
389#ifndef CONFIG_NIMBLE_CPP_FREERTOS_TASK_BLOCK_BIT
390#define CONFIG_NIMBLE_CPP_FREERTOS_TASK_BLOCK_BIT 31
391#endif
392
393#if CONFIG_NIMBLE_CPP_DEBUG_ASSERT_ENABLED && !defined NDEBUG
394void nimble_cpp_assert(const char *file, unsigned line) __attribute((weak, noreturn));
395# define NIMBLE_ATT_VAL_FILE (__builtin_strrchr(__FILE__, '/') ? \
396 __builtin_strrchr (__FILE__, '/') + 1 : __FILE__)
397# define NIMBLE_CPP_DEBUG_ASSERT(cond) \
398 if (!(cond)) { \
399 nimble_cpp_assert(NIMBLE_ATT_VAL_FILE, __LINE__); \
400 }
401#else
402# define NIMBLE_CPP_DEBUG_ASSERT(cond) (void(0))
403#endif