Skip to content

Commit 5119c99

Browse files
committed
chore: add support for customize app_conf_default.h
Signed-off-by: Frederic Pillon <[email protected]>
1 parent 0f32757 commit 5119c99

File tree

1 file changed

+68
-18
lines changed

1 file changed

+68
-18
lines changed

Diff for: src/utility/STM32Cube_FW/app_conf_default.h

+68-18
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@
4848
/**
4949
* Define Tx Power
5050
*/
51-
#define CFG_TX_POWER (0x18) /* -0.15dBm */
51+
#ifndef CFG_TX_POWER
52+
#define CFG_TX_POWER (0x18) /* -0.15dBm */
53+
#endif
5254

5355
#if 0
5456
/**
@@ -132,13 +134,25 @@
132134
* Maximum number of simultaneous connections that the device will support.
133135
* Valid values are from 1 to 8
134136
*/
135-
#define CFG_BLE_NUM_LINK 8
137+
#ifndef CFG_BLE_NUM_LINK
138+
#ifdef STM32WB15xx
139+
#define CFG_BLE_NUM_LINK 3
140+
#else
141+
#define CFG_BLE_NUM_LINK 8
142+
#endif
143+
#endif
136144

137145
/**
138146
* Maximum number of Services that can be stored in the GATT database.
139147
* Note that the GAP and GATT services are automatically added so this parameter should be 2 plus the number of user services
140148
*/
141-
#define CFG_BLE_NUM_GATT_SERVICES 8
149+
#ifndef CFG_BLE_NUM_GATT_SERVICES
150+
#ifdef STM32WB15xx
151+
#define CFG_BLE_NUM_GATT_SERVICES 4
152+
#else
153+
#define CFG_BLE_NUM_GATT_SERVICES 8
154+
#endif
155+
#endif
142156

143157
/**
144158
* Maximum number of Attributes
@@ -147,13 +161,21 @@
147161
* Note that certain characteristics and relative descriptors are added automatically during device initialization
148162
* so this parameters should be 9 plus the number of user Attributes
149163
*/
150-
#define CFG_BLE_NUM_GATT_ATTRIBUTES 68
164+
#ifndef CFG_BLE_NUM_GATT_ATTRIBUTES
165+
#ifdef STM32WB15xx
166+
#define CFG_BLE_NUM_GATT_ATTRIBUTES 30
167+
#else
168+
#define CFG_BLE_NUM_GATT_ATTRIBUTES 68
169+
#endif
170+
#endif
151171

152172
/**
153173
* Maximum supported ATT_MTU size
154174
* This parameter is ignored by the CPU2 when CFG_BLE_OPTIONS has SHCI_C2_BLE_INIT_OPTIONS_LL_ONLY flag set
155175
*/
156-
#define CFG_BLE_MAX_ATT_MTU (156)
176+
#ifndef CFG_BLE_MAX_ATT_MTU
177+
#define CFG_BLE_MAX_ATT_MTU (156)
178+
#endif
157179

158180
/**
159181
* Size of the storage area for Attribute values
@@ -166,14 +188,22 @@
166188
* The total amount of memory needed is the sum of the above quantities for each attribute.
167189
* This parameter is ignored by the CPU2 when CFG_BLE_OPTIONS has SHCI_C2_BLE_INIT_OPTIONS_LL_ONLY flag set
168190
*/
169-
#define CFG_BLE_ATT_VALUE_ARRAY_SIZE (1344)
191+
#ifndef CFG_BLE_ATT_VALUE_ARRAY_SIZE
192+
#ifdef STM32WB15xx
193+
#define CFG_BLE_ATT_VALUE_ARRAY_SIZE (1290)
194+
#else
195+
#define CFG_BLE_ATT_VALUE_ARRAY_SIZE (1344)
196+
#endif
197+
#endif
170198

171199
/**
172200
* Prepare Write List size in terms of number of packet
173201
* This parameter is ignored by the CPU2 when CFG_BLE_OPTIONS has SHCI_C2_BLE_INIT_OPTIONS_LL_ONLY flag set
174202
*/
175203
// #define CFG_BLE_PREPARE_WRITE_LIST_SIZE BLE_PREP_WRITE_X_ATT(CFG_BLE_MAX_ATT_MTU)
176-
#define CFG_BLE_PREPARE_WRITE_LIST_SIZE (0x3A)
204+
#ifndef CFG_BLE_PREPARE_WRITE_LIST_SIZE
205+
#define CFG_BLE_PREPARE_WRITE_LIST_SIZE (0x3A)
206+
#endif
177207

178208
/**
179209
* Number of allocated memory blocks
@@ -185,12 +215,16 @@
185215
/**
186216
* Enable or disable the Extended Packet length feature. Valid values are 0 or 1.
187217
*/
188-
#define CFG_BLE_DATA_LENGTH_EXTENSION 1
218+
#ifndef CFG_BLE_DATA_LENGTH_EXTENSION
219+
#define CFG_BLE_DATA_LENGTH_EXTENSION 1
220+
#endif
189221

190222
/**
191223
* Sleep clock accuracy in Slave mode (ppm value)
192224
*/
193-
#define CFG_BLE_SLAVE_SCA 500
225+
#ifndef CFG_BLE_SLAVE_SCA
226+
#define CFG_BLE_SLAVE_SCA 500
227+
#endif
194228

195229
/**
196230
* Sleep clock accuracy in Master mode
@@ -203,7 +237,9 @@
203237
* 6 : 21 ppm to 30 ppm
204238
* 7 : 0 ppm to 20 ppm
205239
*/
206-
#define CFG_BLE_MASTER_SCA 0
240+
#ifndef CFG_BLE_MASTER_SCA
241+
#define CFG_BLE_MASTER_SCA 0
242+
#endif
207243

208244
/**
209245
* LsSource
@@ -212,21 +248,27 @@
212248
* - bit 1: 1: STM32WB5M Module device 0: Other devices as STM32WBxx SOC, STM32WB1M module
213249
* - bit 2: 1: HSE/1024 Clock config 0: LSE Clock config
214250
*/
215-
#if defined(STM32WB5Mxx)
216-
#define CFG_BLE_LS_SOURCE (SHCI_C2_BLE_INIT_CFG_BLE_LS_NOCALIB | SHCI_C2_BLE_INIT_CFG_BLE_LS_MOD5MM_DEV | SHCI_C2_BLE_INIT_CFG_BLE_LS_CLK_LSE)
217-
#else
218-
#define CFG_BLE_LS_SOURCE (SHCI_C2_BLE_INIT_CFG_BLE_LS_NOCALIB | SHCI_C2_BLE_INIT_CFG_BLE_LS_OTHER_DEV | SHCI_C2_BLE_INIT_CFG_BLE_LS_CLK_LSE)
251+
#ifndef CFG_BLE_LS_SOURCE
252+
#if defined(STM32WB5Mxx)
253+
#define CFG_BLE_LS_SOURCE (SHCI_C2_BLE_INIT_CFG_BLE_LS_NOCALIB | SHCI_C2_BLE_INIT_CFG_BLE_LS_MOD5MM_DEV | SHCI_C2_BLE_INIT_CFG_BLE_LS_CLK_LSE)
254+
#else
255+
#define CFG_BLE_LS_SOURCE (SHCI_C2_BLE_INIT_CFG_BLE_LS_NOCALIB | SHCI_C2_BLE_INIT_CFG_BLE_LS_OTHER_DEV | SHCI_C2_BLE_INIT_CFG_BLE_LS_CLK_LSE)
256+
#endif
219257
#endif
220258

221259
/**
222260
* Start up time of the high speed (16 or 32 MHz) crystal oscillator in units of 625/256 us (~2.44 us)
223261
*/
224-
#define CFG_BLE_HSE_STARTUP_TIME 0x148
262+
#ifndef CFG_BLE_HSE_STARTUP_TIME
263+
#define CFG_BLE_HSE_STARTUP_TIME 0x148
264+
#endif
225265

226266
/**
227267
* Maximum duration of the connection event when the device is in Slave mode in units of 625/256 us (~2.44 us)
228268
*/
229-
#define CFG_BLE_MAX_CONN_EVENT_LENGTH (0xFFFFFFFF)
269+
#ifndef CFG_BLE_MAX_CONN_EVENT_LENGTH
270+
#define CFG_BLE_MAX_CONN_EVENT_LENGTH (0xFFFFFFFF)
271+
#endif
230272

231273
/**
232274
* Viterbi Mode
@@ -314,7 +356,11 @@
314356
* This parameter is considered by the CPU2 when CFG_BLE_OPTIONS has SHCI_C2_BLE_INIT_OPTIONS_EXT_ADV flag set
315357
*/
316358

317-
#define CFG_BLE_MAX_ADV_SET_NBR (8)
359+
#if defined(STM32WB15xx)
360+
#define CFG_BLE_MAX_ADV_SET_NBR (3)
361+
#else
362+
#define CFG_BLE_MAX_ADV_SET_NBR (8)
363+
#endif
318364

319365
/* Maximum advertising data length (in bytes)
320366
* Range: 31 .. 1650 with limitation:
@@ -323,7 +369,11 @@
323369
* This parameter is considered by the CPU2 when CFG_BLE_OPTIONS has SHCI_C2_BLE_INIT_OPTIONS_EXT_ADV flag set
324370
*/
325371

326-
#define CFG_BLE_MAX_ADV_DATA_LEN (207)
372+
#if defined(STM32WB15xx)
373+
#define CFG_BLE_MAX_ADV_DATA_LEN (414)
374+
#else
375+
#define CFG_BLE_MAX_ADV_DATA_LEN (207)
376+
#endif
327377

328378
/* RF TX Path Compensation Value (16-bit signed integer). Units: 0.1 dB.
329379
* Range: -1280 .. 1280

0 commit comments

Comments
 (0)