Skip to content

Commit 8d9b6fb

Browse files
KMeldgaardABOSTM
authored andcommitted
Added support for custom app_conf.h (stm32duino#35)
Signed-off-by: Alexandre Bourdiol <[email protected]>
1 parent ac67cc2 commit 8d9b6fb

File tree

1 file changed

+11
-194
lines changed

1 file changed

+11
-194
lines changed

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

+11-194
Original file line numberDiff line numberDiff line change
@@ -1,203 +1,20 @@
1-
/**
2-
******************************************************************************
3-
* @file app_conf.h
4-
* @author MCD Application Team
5-
* @brief Application configuration file for STM32WPAN Middleware.
6-
******************************************************************************
7-
* @attention
8-
*
9-
* Copyright (c) 2020-2021 STMicroelectronics.
10-
* All rights reserved.
11-
*
12-
* This software is licensed under terms that can be found in the LICENSE file
13-
* in the root directory of this software component.
14-
* If no LICENSE file comes with this software, it is provided AS-IS.
15-
*
16-
******************************************************************************
17-
*/
1+
//-----------------------------
2+
// @file app_conf.h
3+
// @author Kasper Meldgaard
4+
// @brief Wrapper for BLE app configuration based on comment by fpistm
5+
// (https://github.com/stm32duino/STM32duinoBLE/issues/34).
6+
// @date 15-11-2021
7+
// @copyright Copyright (c) 2021
188

19-
/* Define to prevent recursive inclusion -------------------------------------*/
209
#ifndef APP_CONF_H
2110
#define APP_CONF_H
2211

2312
#include "hw.h"
2413
#include "ble_bufsize.h"
2514

26-
/******************************************************************************
27-
* Application Config
28-
******************************************************************************/
29-
30-
/**< generic parameters ******************************************************/
31-
/* HCI related defines */
32-
33-
#define ACI_HAL_SET_TX_POWER_LEVEL 0xFC0F
34-
#define ACI_WRITE_CONFIG_DATA_OPCODE 0xFC0C
35-
#define ACI_READ_CONFIG_DATA_OPCODE 0xFC0D
36-
#define MAX_HCI_ACL_PACKET_SIZE (sizeof(TL_PacketHeader_t) + 5 + 251)
37-
#define HCI_RESET 0x0C03
38-
39-
#ifndef BLE_SHARED_MEM_BYTE_ORDER
40-
#define BLE_SHARED_MEM_BYTE_ORDER MSBFIRST
15+
#if __has_include("app_conf_custom.h")
16+
#include "app_conf_custom.h"
4117
#endif
42-
#define BLE_MODULE_SHARED_MEM_BUFFER_SIZE 128
43-
44-
/**
45-
* Define Tx Power
46-
*/
47-
#define CFG_TX_POWER (0x18) /* -0.15dBm */
48-
49-
/******************************************************************************
50-
* BLE Stack
51-
******************************************************************************/
52-
/**
53-
* Maximum number of simultaneous connections that the device will support.
54-
* Valid values are from 1 to 8
55-
*/
56-
#define CFG_BLE_NUM_LINK 2
57-
58-
/**
59-
* 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-
*/
62-
#define CFG_BLE_NUM_GATT_SERVICES 8
63-
64-
/**
65-
* 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-
*/
71-
#define CFG_BLE_NUM_GATT_ATTRIBUTES 68
72-
73-
/**
74-
* Maximum supported ATT_MTU size
75-
* This parameter is ignored by the CPU2 when CFG_BLE_OPTIONS is set to 1"
76-
*/
77-
#define CFG_BLE_MAX_ATT_MTU (156)
78-
79-
/**
80-
* 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:
82-
* - attribute value length
83-
* - 5, if UUID is 16 bit; 19, if UUID is 128 bit
84-
* - 2, if server configuration descriptor is used
85-
* - 2*DTM_NUM_LINK, if client configuration descriptor is used
86-
* - 2, if extended properties is used
87-
* The total amount of memory needed is the sum of the above quantities for each attribute.
88-
* This parameter is ignored by the CPU2 when CFG_BLE_OPTIONS is set to 1"
89-
*/
90-
#define CFG_BLE_ATT_VALUE_ARRAY_SIZE (1344)
91-
92-
/**
93-
* Prepare Write List size in terms of number of packet
94-
* This parameter is ignored by the CPU2 when CFG_BLE_OPTIONS is set to 1"
95-
*/
96-
// #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)
98-
99-
/**
100-
* Number of allocated memory blocks
101-
* This parameter is overwritten by the CPU2 with an hardcoded optimal value when the parameter when CFG_BLE_OPTIONS is set to 1
102-
*/
103-
// #define CFG_BLE_MBLOCK_COUNT (BLE_MBLOCKS_CALC(CFG_BLE_PREPARE_WRITE_LIST_SIZE, CFG_BLE_MAX_ATT_MTU, CFG_BLE_NUM_LINK))
104-
#define CFG_BLE_MBLOCK_COUNT (0x79)
105-
106-
/**
107-
* Enable or disable the Extended Packet length feature. Valid values are 0 or 1.
108-
*/
109-
#define CFG_BLE_DATA_LENGTH_EXTENSION 1
110-
111-
/**
112-
* Sleep clock accuracy in Slave mode (ppm value)
113-
*/
114-
#define CFG_BLE_SLAVE_SCA 500
115-
116-
/**
117-
* Sleep clock accuracy in Master mode
118-
* 0 : 251 ppm to 500 ppm
119-
* 1 : 151 ppm to 250 ppm
120-
* 2 : 101 ppm to 150 ppm
121-
* 3 : 76 ppm to 100 ppm
122-
* 4 : 51 ppm to 75 ppm
123-
* 5 : 31 ppm to 50 ppm
124-
* 6 : 21 ppm to 30 ppm
125-
* 7 : 0 ppm to 20 ppm
126-
*/
127-
#define CFG_BLE_MASTER_SCA 0
128-
129-
/**
130-
* Source for the low speed clock for RF wake-up
131-
* 1 : external high speed crystal HSE/32/32
132-
* 0 : external low speed crystal ( no calibration )
133-
*/
134-
#define CFG_BLE_LSE_SOURCE 0
135-
136-
/**
137-
* Start up time of the high speed (16 or 32 MHz) crystal oscillator in units of 625/256 us (~2.44 us)
138-
*/
139-
#define CFG_BLE_HSE_STARTUP_TIME 0x148
140-
141-
/**
142-
* Maximum duration of the connection event when the device is in Slave mode in units of 625/256 us (~2.44 us)
143-
*/
144-
#define CFG_BLE_MAX_CONN_EVENT_LENGTH (0xFFFFFFFF)
145-
146-
/**
147-
* Viterbi Mode
148-
* 1 : enabled
149-
* 0 : disabled
150-
*/
151-
#define CFG_BLE_VITERBI_MODE 1
152-
153-
/**
154-
* BLE stack Options flags to be configured with:
155-
* - SHCI_C2_BLE_INIT_OPTIONS_LL_ONLY
156-
* - SHCI_C2_BLE_INIT_OPTIONS_LL_HOST
157-
* - SHCI_C2_BLE_INIT_OPTIONS_NO_SVC_CHANGE_DESC
158-
* - SHCI_C2_BLE_INIT_OPTIONS_WITH_SVC_CHANGE_DESC
159-
* - SHCI_C2_BLE_INIT_OPTIONS_DEVICE_NAME_RO
160-
* - SHCI_C2_BLE_INIT_OPTIONS_DEVICE_NAME_RW
161-
* - SHCI_C2_BLE_INIT_OPTIONS_EXT_ADV
162-
* - SHCI_C2_BLE_INIT_OPTIONS_NO_EXT_ADV
163-
* - SHCI_C2_BLE_INIT_OPTIONS_CS_ALGO2
164-
* - SHCI_C2_BLE_INIT_OPTIONS_NO_CS_ALGO2
165-
* - SHCI_C2_BLE_INIT_OPTIONS_POWER_CLASS_1
166-
* - SHCI_C2_BLE_INIT_OPTIONS_POWER_CLASS_2_3
167-
* which are used to set following configuration bits:
168-
* (bit 0): 1: LL only
169-
* 0: LL + host
170-
* (bit 1): 1: no service change desc.
171-
* 0: with service change desc.
172-
* (bit 2): 1: device name Read-Only
173-
* 0: device name R/W
174-
* (bit 3): 1: extended advertizing supported [NOT SUPPORTED]
175-
* 0: extended advertizing not supported [NOT SUPPORTED]
176-
* (bit 4): 1: CS Algo #2 supported
177-
* 0: CS Algo #2 not supported
178-
* (bit 7): 1: LE Power Class 1
179-
* 0: LE Power Class 2-3
180-
* other bits: reserved (shall be set to 0)
181-
*/
182-
#define CFG_BLE_OPTIONS (_BLE_INIT_OPTIONS_LL_ONLY)
183-
184-
#define CFG_BLE_MAX_COC_INITIATOR_NBR (32)
185-
186-
#define CFG_BLE_MIN_TX_POWER (0)
187-
188-
#define CFG_BLE_MAX_TX_POWER (0)
189-
190-
/**
191-
* BLE Rx model configuration flags to be configured with:
192-
* - SHCI_C2_BLE_INIT_RX_MODEL_AGC_RSSI_LEGACY
193-
* - SHCI_C2_BLE_INIT_RX_MODEL_AGC_RSSI_BLOCKER
194-
* which are used to set following configuration bits:
195-
* (bit 0): 1: agc_rssi model improved vs RF blockers
196-
* 0: Legacy agc_rssi model
197-
* other bits: reserved (shall be set to 0)
198-
*/
199-
200-
#define CFG_BLE_RX_MODEL_CONFIG SHCI_C2_BLE_INIT_RX_MODEL_AGC_RSSI_LEGACY
201-
18+
#include "app_conf_default.h"
20219

203-
#endif /*APP_CONF_H */
20+
#endif /* APP_CONF_H */

0 commit comments

Comments
 (0)