Skip to content

Commit 0c042fd

Browse files
committed
Added support for custom app_conf.h (stm32duino#35)
1 parent 619acbc commit 0c042fd

File tree

1 file changed

+49
-26
lines changed

1 file changed

+49
-26
lines changed

src/utility/STM32Cube_FW/app_conf_default.h

+49-26
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/**
22
******************************************************************************
3-
* @file app_conf.h
3+
* @file app_conf_default.h
44
* @author MCD Application Team
5-
* @brief Application configuration file for STM32WPAN Middleware.
5+
* @brief Default application configuration file for STM32WPAN Middleware.
66
******************************************************************************
77
* @attention
88
*
@@ -17,11 +17,8 @@
1717
*/
1818

1919
/* Define to prevent recursive inclusion -------------------------------------*/
20-
#ifndef APP_CONF_H
21-
#define APP_CONF_H
22-
23-
#include "hw.h"
24-
#include "ble_bufsize.h"
20+
#ifndef APP_CONF_DEFAULT_H
21+
#define APP_CONF_DEFAULT_H
2522

2623
/******************************************************************************
2724
* Application Config
@@ -44,7 +41,9 @@
4441
/**
4542
* Define Tx Power
4643
*/
47-
#define CFG_TX_POWER (0x18) /* -0.15dBm */
44+
#ifndef CFG_TX_POWER
45+
#define CFG_TX_POWER (0x18) /* -0.15dBm */
46+
#endif
4847

4948
/******************************************************************************
5049
* BLE Stack
@@ -53,32 +52,41 @@
5352
* Maximum number of simultaneous connections that the device will support.
5453
* Valid values are from 1 to 8
5554
*/
56-
#define CFG_BLE_NUM_LINK 2
55+
#ifndef CFG_BLE_NUM_LINK
56+
#define CFG_BLE_NUM_LINK 2
57+
#endif
5758

5859
/**
5960
* Maximum number of Services that can be stored in the GATT database.
60-
* Note that the GAP and GATT services are automatically added so this parameter should be 2 plus the number of user services
61+
* Note that the GAP and GATT services are automatically added so this parameter should be 2 plus the number of user
62+
* services
6163
*/
64+
#ifndef CFG_BLE_NUM_GATT_SERVICES
6265
#define CFG_BLE_NUM_GATT_SERVICES 8
66+
#endif
6367

6468
/**
6569
* Maximum number of Attributes
66-
* (i.e. the number of characteristic + the number of characteristic values + the number of descriptors, excluding the services)
67-
* that can be stored in the GATT database.
68-
* Note that certain characteristics and relative descriptors are added automatically during device initialization
69-
* so this parameters should be 9 plus the number of user Attributes
70+
* (i.e. the number of characteristic + the number of characteristic values + the number of descriptors, excluding the
71+
* services) that can be stored in the GATT database. Note that certain characteristics and relative descriptors are
72+
* added automatically during device initialization so this parameters should be 9 plus the number of user Attributes
7073
*/
71-
#define CFG_BLE_NUM_GATT_ATTRIBUTES 68
74+
#ifndef CFG_BLE_NUM_GATT_ATTRIBUTES
75+
#define CFG_BLE_NUM_GATT_ATTRIBUTES 68
76+
#endif
7277

7378
/**
7479
* Maximum supported ATT_MTU size
7580
* This parameter is ignored by the CPU2 when CFG_BLE_OPTIONS is set to 1"
7681
*/
77-
#define CFG_BLE_MAX_ATT_MTU (156)
82+
#ifndef CFG_BLE_MAX_ATT_MTU
83+
#define CFG_BLE_MAX_ATT_MTU (156)
84+
#endif
7885

7986
/**
8087
* Size of the storage area for Attribute values
81-
* This value depends on the number of attributes used by application. In particular the sum of the following quantities (in octets) should be made for each attribute:
88+
* This value depends on the number of attributes used by application. In particular the sum of the following
89+
* quantities (in octets) should be made for each attribute:
8290
* - attribute value length
8391
* - 5, if UUID is 16 bit; 19, if UUID is 128 bit
8492
* - 2, if server configuration descriptor is used
@@ -87,14 +95,18 @@
8795
* The total amount of memory needed is the sum of the above quantities for each attribute.
8896
* This parameter is ignored by the CPU2 when CFG_BLE_OPTIONS is set to 1"
8997
*/
98+
#ifndef CFG_BLE_ATT_VALUE_ARRAY_SIZE
9099
#define CFG_BLE_ATT_VALUE_ARRAY_SIZE (1344)
100+
#endif
91101

92102
/**
93103
* Prepare Write List size in terms of number of packet
94104
* This parameter is ignored by the CPU2 when CFG_BLE_OPTIONS is set to 1"
95105
*/
96106
// #define CFG_BLE_PREPARE_WRITE_LIST_SIZE BLE_PREP_WRITE_X_ATT(CFG_BLE_MAX_ATT_MTU)
97-
#define CFG_BLE_PREPARE_WRITE_LIST_SIZE (0x3A)
107+
#ifndef CFG_BLE_PREPARE_WRITE_LIST_SIZE
108+
#define CFG_BLE_PREPARE_WRITE_LIST_SIZE (0x3A)
109+
#endif
98110

99111
/**
100112
* Number of allocated memory blocks
@@ -106,12 +118,16 @@
106118
/**
107119
* Enable or disable the Extended Packet length feature. Valid values are 0 or 1.
108120
*/
109-
#define CFG_BLE_DATA_LENGTH_EXTENSION 1
121+
#ifndef CFG_BLE_DATA_LENGTH_EXTENSION
122+
#define CFG_BLE_DATA_LENGTH_EXTENSION 1
123+
#endif
110124

111125
/**
112126
* Sleep clock accuracy in Slave mode (ppm value)
113127
*/
114-
#define CFG_BLE_SLAVE_SCA 500
128+
#ifndef CFG_BLE_SLAVE_SCA
129+
#define CFG_BLE_SLAVE_SCA 500
130+
#endif
115131

116132
/**
117133
* Sleep clock accuracy in Master mode
@@ -124,24 +140,32 @@
124140
* 6 : 21 ppm to 30 ppm
125141
* 7 : 0 ppm to 20 ppm
126142
*/
127-
#define CFG_BLE_MASTER_SCA 0
143+
#ifndef CFG_BLE_MASTER_SCA
144+
#define CFG_BLE_MASTER_SCA 0
145+
#endif
128146

129147
/**
130148
* Source for the low speed clock for RF wake-up
131149
* 1 : external high speed crystal HSE/32/32
132150
* 0 : external low speed crystal ( no calibration )
133151
*/
134-
#define CFG_BLE_LSE_SOURCE 0
152+
#ifndef CFG_BLE_LSE_SOURCE
153+
#define CFG_BLE_LSE_SOURCE 0
154+
#endif
135155

136156
/**
137157
* Start up time of the high speed (16 or 32 MHz) crystal oscillator in units of 625/256 us (~2.44 us)
138158
*/
139-
#define CFG_BLE_HSE_STARTUP_TIME 0x148
159+
#ifndef CFG_BLE_HSE_STARTUP_TIME
160+
#define CFG_BLE_HSE_STARTUP_TIME 0x148
161+
#endif
140162

141163
/**
142164
* Maximum duration of the connection event when the device is in Slave mode in units of 625/256 us (~2.44 us)
143165
*/
144-
#define CFG_BLE_MAX_CONN_EVENT_LENGTH (0xFFFFFFFF)
166+
#ifndef CFG_BLE_MAX_CONN_EVENT_LENGTH
167+
#define CFG_BLE_MAX_CONN_EVENT_LENGTH (0xFFFFFFFF)
168+
#endif
145169

146170
/**
147171
* Viterbi Mode
@@ -199,5 +223,4 @@
199223

200224
#define CFG_BLE_RX_MODEL_CONFIG SHCI_C2_BLE_INIT_RX_MODEL_AGC_RSSI_LEGACY
201225

202-
203-
#endif /*APP_CONF_H */
226+
#endif /* APP_CONF_DEFAULT_H */

0 commit comments

Comments
 (0)