Skip to content

Commit a4a711f

Browse files
committed
Add descriptions to nimconfig options.
1 parent e74d036 commit a4a711f

File tree

1 file changed

+116
-25
lines changed

1 file changed

+116
-25
lines changed

src/nimconfig.h

Lines changed: 116 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
1+
/** @file
2+
*
3+
* IGNORE THIS FILE IF USING ESP-IDF, USE MENUCONFIG TO SET NIMBLE OPTIONS.
4+
*
5+
* The config options here are for Arduino use only.
6+
*/
7+
18
#pragma once
29

310
#include "sdkconfig.h"
4-
/** For ESP-IDF compatibility
5-
*
6-
* Some versions of ESP-IDF used the config name format "CONFIG_NIMBLE_".
7-
* This converts them to "CONFIG_BT_NIMBLE_" format used in the latest IDF.
11+
12+
/*
13+
* For ESP-IDF compatibility
14+
* Some versions of ESP-IDF used the config name format "CONFIG_NIMBLE_".
15+
* This converts them to "CONFIG_BT_NIMBLE_" format used in the latest IDF.
816
*/
9-
/* Detect if using ESP-IDF or Arduino (Arduino won't have these defines in sdkconfig)*/
17+
18+
/* Detect if using ESP-IDF or Arduino (Arduino won't have these defines in sdkconfig) */
1019
#if defined(CONFIG_BT_NIMBLE_TASK_STACK_SIZE) || defined(CONFIG_NIMBLE_TASK_STACK_SIZE)
1120

1221
#if defined(CONFIG_NIMBLE_ENABLED) && !defined(CONFIG_BT_NIMBLE_ENABLED)
@@ -36,99 +45,181 @@
3645
#else // Using Arduino
3746

3847
/***********************************************
39-
* Arduino config options
48+
* Arduino config options start here
4049
**********************************************/
4150

42-
/** Comment out if not using NimBLE Client functions
51+
/** @brief Comment out if not using NimBLE Client functions \n
4352
* Reduces flash size by approx. 7kB.
4453
*/
4554
#define CONFIG_BT_NIMBLE_ROLE_CENTRAL
4655

47-
/** Comment out if not using NimBLE Scan functions
56+
/** @brief Comment out if not using NimBLE Scan functions \n
4857
* Reduces flash size by approx. 26kB.
4958
*/
5059
#define CONFIG_BT_NIMBLE_ROLE_OBSERVER
5160

52-
/** Comment out if not using NimBLE Server functions
61+
/** @brief Comment out if not using NimBLE Server functions \n
5362
* Reduces flash size by approx. 16kB.
5463
*/
5564
#define CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
5665

57-
/** Comment out if not using NimBLE Advertising functions
66+
/** @brief Comment out if not using NimBLE Advertising functions \n
5867
* Reduces flash size by approx. 5kB.
5968
*/
6069
#define CONFIG_BT_NIMBLE_ROLE_BROADCASTER
6170

62-
/** Uncomment to see debug log messages from the NimBLE host
71+
/* Uncomment to see debug log messages from the NimBLE host
6372
* Uses approx. 32kB of flash memory.
6473
*/
6574
// #define CONFIG_BT_NIMBLE_DEBUG
6675

67-
/** Uncomment to see NimBLE host return codes as text debug log messages.
76+
/* Uncomment to see NimBLE host return codes as text debug log messages.
6877
* Uses approx. 7kB of flash memory.
6978
*/
7079
// #define CONFIG_NIMBLE_CPP_ENABLE_RETURN_CODE_TEXT
7180

72-
/** Uncomment to see GAP event codes as text in debug log messages.
81+
/* Uncomment to see GAP event codes as text in debug log messages.
7382
* Uses approx. 1kB of flash memory.
7483
*/
7584
// #define CONFIG_NIMBLE_CPP_ENABLE_GAP_EVENT_CODE_TEXT
7685

77-
/** Uncomment to see advertisment types as text while scanning in debug log messages.
86+
/* Uncomment to see advertisment types as text while scanning in debug log messages.
7887
* Uses approx. 250 bytes of flash memory.
7988
*/
8089
// #define CONFIG_NIMBLE_CPP_ENABLE_ADVERTISMENT_TYPE_TEXT
8190

82-
/** Sets the core NimBLE host runs on */
91+
/** @brief Sets the core NimBLE host runs on */
8392
#define CONFIG_BT_NIMBLE_PINNED_TO_CORE 0
8493

85-
/** Sets the stack size for the NimBLE host task */
94+
/** @brief Sets the stack size for the NimBLE host task */
8695
#define CONFIG_BT_NIMBLE_TASK_STACK_SIZE 4096
8796

88-
/** Sets the number of simultaneous connections (esp controller max is 9) */
97+
/**
98+
* @brief Sets the memory pool where NimBLE will be loaded
99+
* @details By default NimBLE is loaded in internal ram.\n
100+
* To use external PSRAM you must change this to `#define CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_EXTERNAL 1`
101+
*/
102+
#define CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_INTERNAL 1
103+
104+
/**
105+
* @brief Sets the number of simultaneous connections (esp controller max is 9)
106+
* @details To increase max connections in Arduino it is also required to change the
107+
* controller max connections defined in sdkconfig.h.\n
108+
*
109+
* This is located in your Arduino/hardware/espressif/esp32/tools/sdk/include/config folder.\n\n
110+
*
111+
* The values in sdkconfig.h you will need to change are:\n\n
112+
* `CONFIG_BTDM_CONTROLLER_BLE_MAX_CONN 3`\n
113+
* `CONFIG_BTDM_CONTROLLER_BLE_MAX_CONN_EFF 3`
114+
*/
89115
#define CONFIG_BT_NIMBLE_MAX_CONNECTIONS 3
90116

91-
/** Sets the number of devices allowed to store/bond with */
117+
/** @brief Sets the number of devices allowed to store/bond with */
92118
#define CONFIG_BT_NIMBLE_MAX_BONDS 3
93119

94-
/** Sets the number of CCCD's to store per bonded device */
120+
/** @brief Sets the maximum number of CCCD subscriptions to store */
95121
#define CONFIG_BT_NIMBLE_MAX_CCCDS 8
96122

123+
/** @brief Set if CCCD's and bond data should be stored in NVS */
97124
#define CONFIG_BT_NIMBLE_NVS_PERSIST 1
125+
126+
/** @brief Allow legacy paring */
98127
#define CONFIG_BT_NIMBLE_SM_LEGACY 1
128+
129+
/** @brief Allow BLE secure connections */
99130
#define CONFIG_BT_NIMBLE_SM_SC 1
131+
132+
/** @brief Default device name */
100133
#define CONFIG_BT_NIMBLE_SVC_GAP_DEVICE_NAME "nimble"
134+
135+
/** @brief Max device name length (bytes) */
101136
#define CONFIG_BT_NIMBLE_GAP_DEVICE_NAME_MAX_LEN 31
137+
138+
/** @brief Default MTU size */
102139
#define CONFIG_BT_NIMBLE_ATT_PREFERRED_MTU 256
140+
141+
/** @brief Default GAP appearance */
103142
#define CONFIG_BT_NIMBLE_SVC_GAP_APPEARANCE 0x0
143+
144+
/** @brief ACL Buffer count */
104145
#define CONFIG_BT_NIMBLE_ACL_BUF_COUNT 12
146+
147+
/** @brief ACL Buffer size */
105148
#define CONFIG_BT_NIMBLE_ACL_BUF_SIZE 255
149+
150+
/** @brief HCI Event Buffer size */
106151
#define CONFIG_BT_NIMBLE_HCI_EVT_BUF_SIZE 70
152+
153+
/** @brief Number of high priority HCI event buffers */
107154
#define CONFIG_BT_NIMBLE_HCI_EVT_HI_BUF_COUNT 30
155+
156+
/** @brief Number of low priority HCI event buffers */
108157
#define CONFIG_BT_NIMBLE_HCI_EVT_LO_BUF_COUNT 8
158+
159+
/**
160+
* @brief Sets the number of MSYS buffers available.
161+
* @details MSYS is a system level mbuf registry. For prepare write & prepare \n
162+
* responses MBUFs are allocated out of msys_1 pool. This may need to be increased if\n
163+
* you are sending large blocks of data with a low MTU. E.g: 512 bytes with 23 MTU will fail.
164+
*/
109165
#define CONFIG_BT_NIMBLE_MSYS1_BLOCK_COUNT 12
166+
167+
168+
/** @brief Random address refresh time in seconds */
169+
#define CONFIG_BT_NIMBLE_RPA_TIMEOUT 900
170+
171+
/** @brief Maximum number of connection oriented channels */
172+
#define CONFIG_BT_NIMBLE_L2CAP_COC_MAX_NUM 0
173+
174+
/* These should not be altered */
110175
#define CONFIG_BT_NIMBLE_HS_FLOW_CTRL 1
111176
#define CONFIG_BT_NIMBLE_HS_FLOW_CTRL_ITVL 1000
112177
#define CONFIG_BT_NIMBLE_HS_FLOW_CTRL_THRESH 2
113178
#define CONFIG_BT_NIMBLE_HS_FLOW_CTRL_TX_ON_DISCONNECT 1
114-
#define CONFIG_BT_NIMBLE_RPA_TIMEOUT 900
115-
#define CONFIG_BT_NIMBLE_L2CAP_COC_MAX_NUM 0
116179

117-
/** Do not comment out */
118180
#ifndef CONFIG_BT_ENABLED
119181
#define CONFIG_BT_ENABLED
120182
#endif
183+
121184
#define CONFIG_BTDM_CONTROLLER_MODE_BLE_ONLY
122-
#define CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_INTERNAL
123185

124186
#endif // #if defined(CONFIG_BT_NIMBLE_TASK_STACK_SIZE) || defined(CONFIG_NIMBLE_TASK_STACK_SIZE)
125187

126-
/** Cannot use client without scan */
188+
/**********************************
189+
End Arduino config
190+
**********************************/
191+
192+
193+
/* Cannot use client without scan */
127194
#if defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL) && !defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER)
128195
#define CONFIG_BT_NIMBLE_ROLE_OBSERVER
129196
#endif
130197

131-
/** Cannot use server without advertise */
198+
/* Cannot use server without advertise */
132199
#if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL) && !defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER)
133200
#define CONFIG_BT_NIMBLE_ROLE_BROADCASTER
134201
#endif
202+
203+
204+
205+
#ifdef _DOXYGEN_
206+
/** @brief Uncomment to see debug log messages from the NimBLE host \n
207+
* Uses approx. 32kB of flash memory.
208+
*/
209+
#define CONFIG_BT_NIMBLE_DEBUG
210+
211+
/** @brief Uncomment to see NimBLE host return codes as text debug log messages. \n
212+
* Uses approx. 7kB of flash memory.
213+
*/
214+
#define CONFIG_NIMBLE_CPP_ENABLE_RETURN_CODE_TEXT
215+
216+
/** @brief Uncomment to see GAP event codes as text in debug log messages. \n
217+
* Uses approx. 1kB of flash memory.
218+
*/
219+
#define CONFIG_NIMBLE_CPP_ENABLE_GAP_EVENT_CODE_TEXT
220+
221+
/** @brief Uncomment to see advertisment types as text while scanning in debug log messages. \n
222+
* Uses approx. 250 bytes of flash memory.
223+
*/
224+
#define CONFIG_NIMBLE_CPP_ENABLE_ADVERTISMENT_TYPE_TEXT
225+
#endif // _DOXYGEN_

0 commit comments

Comments
 (0)