Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit fa0a24b

Browse files
committedNov 15, 2021
added support for custom ble app conf
1 parent 1cf1da0 commit fa0a24b

File tree

2 files changed

+192
-153
lines changed

2 files changed

+192
-153
lines changed
 

‎src/utility/STM32Cube_FW/app_conf.h

Lines changed: 4 additions & 153 deletions
Original file line numberDiff line numberDiff line change
@@ -1,158 +1,9 @@
1-
/**
2-
******************************************************************************
3-
* File Name : app_conf.h
4-
* Description : Application configuration file for STM32WPAN Middleware.
5-
******************************************************************************
6-
* @attention
7-
*
8-
* <h2><center>&copy; Copyright (c) 2020 STMicroelectronics.
9-
* All rights reserved.</center></h2>
10-
*
11-
* This software component is licensed by ST under Ultimate Liberty license
12-
* SLA0044, the "License"; You may not use this file except in compliance with
13-
* the License. You may obtain a copy of the License at:
14-
* www.st.com/SLA0044
15-
*
16-
******************************************************************************
17-
*/
18-
19-
/* Define to prevent recursive inclusion -------------------------------------*/
201
#ifndef APP_CONF_H
212
#define APP_CONF_H
223

23-
#include "hw.h"
24-
#include "ble_bufsize.h"
25-
26-
27-
/******************************************************************************
28-
* Application Config
29-
******************************************************************************/
30-
31-
/**< generic parameters ******************************************************/
32-
/* HCI related defines */
33-
34-
#define ACI_HAL_SET_TX_POWER_LEVEL 0xFC0F
35-
#define ACI_WRITE_CONFIG_DATA_OPCODE 0xFC0C
36-
#define ACI_READ_CONFIG_DATA_OPCODE 0xFC0D
37-
#define MAX_HCI_ACL_PACKET_SIZE (sizeof(TL_PacketHeader_t) + 5 + 251)
38-
#define HCI_RESET 0x0C03
39-
40-
#ifndef BLE_SHARED_MEM_BYTE_ORDER
41-
#define BLE_SHARED_MEM_BYTE_ORDER MSBFIRST
4+
#if __has_include("app_conf_custom.h")
5+
#include "app_conf_custom.h"
426
#endif
43-
#define BLE_MODULE_SHARED_MEM_BUFFER_SIZE 128
44-
45-
/**
46-
* Define Tx Power
47-
*/
48-
#define CFG_TX_POWER (0x18) /* -0.15dBm */
49-
50-
/******************************************************************************
51-
* BLE Stack
52-
******************************************************************************/
53-
/**
54-
* Maximum number of simultaneous connections that the device will support.
55-
* Valid values are from 1 to 8
56-
*/
57-
#define CFG_BLE_NUM_LINK 8
58-
59-
/**
60-
* Maximum number of Services that can be stored in the GATT database.
61-
* Note that the GAP and GATT services are automatically added so this parameter should be 2 plus the number of user services
62-
*/
63-
#define CFG_BLE_NUM_GATT_SERVICES 8
64-
65-
/**
66-
* Maximum number of Attributes
67-
* (i.e. the number of characteristic + the number of characteristic values + the number of descriptors, excluding the services)
68-
* that can be stored in the GATT database.
69-
* Note that certain characteristics and relative descriptors are added automatically during device initialization
70-
* so this parameters should be 9 plus the number of user Attributes
71-
*/
72-
#define CFG_BLE_NUM_GATT_ATTRIBUTES 68
73-
74-
/**
75-
* Maximum supported ATT_MTU size
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-
*/
89-
#define CFG_BLE_ATT_VALUE_ARRAY_SIZE (1344)
90-
91-
/**
92-
* Prepare Write List size in terms of number of packet
93-
*/
94-
//#define CFG_BLE_PREPARE_WRITE_LIST_SIZE BLE_PREP_WRITE_X_ATT(CFG_BLE_MAX_ATT_MTU)
95-
#define CFG_BLE_PREPARE_WRITE_LIST_SIZE (0x3A)
96-
97-
/**
98-
* Number of allocated memory blocks
99-
*/
100-
//#define CFG_BLE_MBLOCK_COUNT (BLE_MBLOCKS_CALC(CFG_BLE_PREPARE_WRITE_LIST_SIZE, CFG_BLE_MAX_ATT_MTU, CFG_BLE_NUM_LINK))
101-
#define CFG_BLE_MBLOCK_COUNT (0x79)
102-
/**
103-
* Enable or disable the Extended Packet length feature. Valid values are 0 or 1.
104-
*/
105-
#define CFG_BLE_DATA_LENGTH_EXTENSION 1
106-
107-
/**
108-
* Sleep clock accuracy in Slave mode (ppm value)
109-
*/
110-
#define CFG_BLE_SLAVE_SCA 500
111-
112-
/**
113-
* Sleep clock accuracy in Master mode
114-
* 0 : 251 ppm to 500 ppm
115-
* 1 : 151 ppm to 250 ppm
116-
* 2 : 101 ppm to 150 ppm
117-
* 3 : 76 ppm to 100 ppm
118-
* 4 : 51 ppm to 75 ppm
119-
* 5 : 31 ppm to 50 ppm
120-
* 6 : 21 ppm to 30 ppm
121-
* 7 : 0 ppm to 20 ppm
122-
*/
123-
#define CFG_BLE_MASTER_SCA 0
124-
125-
/**
126-
* Source for the 32 kHz slow speed clock
127-
* 1 : internal RO
128-
* 0 : external crystal ( no calibration )
129-
*/
130-
#define CFG_BLE_LSE_SOURCE 0
131-
132-
/**
133-
* Start up time of the high speed (16 or 32 MHz) crystal oscillator in units of 625/256 us (~2.44 us)
134-
*/
135-
#define CFG_BLE_HSE_STARTUP_TIME 0x148
136-
137-
/**
138-
* Maximum duration of the connection event when the device is in Slave mode in units of 625/256 us (~2.44 us)
139-
*/
140-
#define CFG_BLE_MAX_CONN_EVENT_LENGTH ( 0xFFFFFFFF )
141-
142-
/**
143-
* Viterbi Mode
144-
* 1 : enabled
145-
* 0 : disabled
146-
*/
147-
#define CFG_BLE_VITERBI_MODE 1
148-
149-
/**
150-
* LL Only Mode
151-
* 1 : LL Only
152-
* 0 : LL + Host
153-
*/
154-
#define CFG_BLE_LL_ONLY 1
155-
156-
#endif /* APP_CONF_H */
7+
#include "app_conf_default.h"
1578

158-
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
9+
#endif /* APP_CONF_H */
Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
/**
2+
******************************************************************************
3+
* File Name : app_conf.h
4+
* Description : Application configuration file for STM32WPAN Middleware.
5+
******************************************************************************
6+
* @attention
7+
*
8+
* <h2><center>&copy; Copyright (c) 2020 STMicroelectronics.
9+
* All rights reserved.</center></h2>
10+
*
11+
* This software component is licensed by ST under Ultimate Liberty license
12+
* SLA0044, the "License"; You may not use this file except in compliance with
13+
* the License. You may obtain a copy of the License at:
14+
* www.st.com/SLA0044
15+
*
16+
******************************************************************************
17+
*/
18+
19+
/* Define to prevent recursive inclusion -------------------------------------*/
20+
#ifndef APP_CONF_H
21+
#define APP_CONF_H
22+
23+
#include "ble_bufsize.h"
24+
#include "hw.h"
25+
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
41+
#endif
42+
#define BLE_MODULE_SHARED_MEM_BUFFER_SIZE 128
43+
44+
/**
45+
* Define Tx Power
46+
*/
47+
#ifndef CFG_TX_POWER
48+
#define CFG_TX_POWER (0x18) /* -0.15dBm */
49+
#endif
50+
51+
/******************************************************************************
52+
* BLE Stack
53+
******************************************************************************/
54+
/**
55+
* Maximum number of simultaneous connections that the device will support.
56+
* Valid values are from 1 to 8
57+
*/
58+
#ifndef CFG_BLE_NUM_LINK
59+
#define CFG_BLE_NUM_LINK 8
60+
#endif
61+
62+
/**
63+
* Maximum number of Services that can be stored in the GATT database.
64+
* Note that the GAP and GATT services are automatically added so this parameter should be 2 plus the number of user
65+
* services
66+
*/
67+
#ifndef CFG_BLE_NUM_GATT_SERVICES
68+
#define CFG_BLE_NUM_GATT_SERVICES 8
69+
#endif
70+
71+
/**
72+
* Maximum number of Attributes
73+
* (i.e. the number of characteristic + the number of characteristic values + the number of descriptors, excluding the
74+
* services) that can be stored in the GATT database. Note that certain characteristics and relative descriptors are
75+
* added automatically during device initialization so this parameters should be 9 plus the number of user Attributes
76+
*/
77+
#ifndef CFG_BLE_NUM_GATT_ATTRIBUTES
78+
#define CFG_BLE_NUM_GATT_ATTRIBUTES 68
79+
#endif
80+
81+
/**
82+
* Maximum supported ATT_MTU size
83+
*/
84+
#ifndef CFG_BLE_MAX_ATT_MTU
85+
#define CFG_BLE_MAX_ATT_MTU (156)
86+
#endif
87+
88+
/**
89+
* Size of the storage area for Attribute values
90+
* This value depends on the number of attributes used by application. In particular the sum of the following
91+
* quantities (in octets) should be made for each attribute:
92+
* - attribute value length
93+
* - 5, if UUID is 16 bit; 19, if UUID is 128 bit
94+
* - 2, if server configuration descriptor is used
95+
* - 2*DTM_NUM_LINK, if client configuration descriptor is used
96+
* - 2, if extended properties is used
97+
* The total amount of memory needed is the sum of the above quantities for each attribute.
98+
*/
99+
#ifndef CFG_BLE_ATT_VALUE_ARRAY_SIZE
100+
#define CFG_BLE_ATT_VALUE_ARRAY_SIZE (1344)
101+
#endif
102+
103+
/**
104+
* Prepare Write List size in terms of number of packet
105+
*/
106+
//#define CFG_BLE_PREPARE_WRITE_LIST_SIZE BLE_PREP_WRITE_X_ATT(CFG_BLE_MAX_ATT_MTU)
107+
#ifndef CFG_BLE_PREPARE_WRITE_LIST_SIZE
108+
#define CFG_BLE_PREPARE_WRITE_LIST_SIZE (0x3A)
109+
#endif
110+
111+
/**
112+
* Number of allocated memory blocks
113+
*/
114+
//#define CFG_BLE_MBLOCK_COUNT (BLE_MBLOCKS_CALC(CFG_BLE_PREPARE_WRITE_LIST_SIZE, CFG_BLE_MAX_ATT_MTU,
115+
// CFG_BLE_NUM_LINK))
116+
#ifndef CFG_BLE_MBLOCK_COUNT
117+
#define CFG_BLE_MBLOCK_COUNT (0x79)
118+
#endif
119+
120+
/**
121+
* Enable or disable the Extended Packet length feature. Valid values are 0 or 1.
122+
*/
123+
#ifndef CFG_BLE_DATA_LENGTH_EXTENSION
124+
#define CFG_BLE_DATA_LENGTH_EXTENSION 1
125+
#endif
126+
127+
/**
128+
* Sleep clock accuracy in Slave mode (ppm value)
129+
*/
130+
#ifndef CFG_BLE_SLAVE_SCA
131+
#define CFG_BLE_SLAVE_SCA 500
132+
#endif
133+
134+
/**
135+
* Sleep clock accuracy in Master mode
136+
* 0 : 251 ppm to 500 ppm
137+
* 1 : 151 ppm to 250 ppm
138+
* 2 : 101 ppm to 150 ppm
139+
* 3 : 76 ppm to 100 ppm
140+
* 4 : 51 ppm to 75 ppm
141+
* 5 : 31 ppm to 50 ppm
142+
* 6 : 21 ppm to 30 ppm
143+
* 7 : 0 ppm to 20 ppm
144+
*/
145+
#ifndef CFG_BLE_MASTER_SCA
146+
#define CFG_BLE_MASTER_SCA 0
147+
#endif
148+
149+
/**
150+
* Source for the 32 kHz slow speed clock
151+
* 1 : internal RO
152+
* 0 : external crystal ( no calibration )
153+
*/
154+
#ifndef CFG_BLE_LSE_SOURCE
155+
#define CFG_BLE_LSE_SOURCE 0
156+
#endif
157+
158+
/**
159+
* Start up time of the high speed (16 or 32 MHz) crystal oscillator in units of 625/256 us (~2.44 us)
160+
*/
161+
#ifndef CFG_BLE_HSE_STARTUP_TIME
162+
#define CFG_BLE_HSE_STARTUP_TIME 0x148
163+
#endif
164+
165+
/**
166+
* Maximum duration of the connection event when the device is in Slave mode in units of 625/256 us (~2.44 us)
167+
*/
168+
#ifndef CFG_BLE_MAX_CONN_EVENT_LENGTH
169+
#define CFG_BLE_MAX_CONN_EVENT_LENGTH (0xFFFFFFFF)
170+
#endif
171+
172+
/**
173+
* Viterbi Mode
174+
* 1 : enabled
175+
* 0 : disabled
176+
*/
177+
#define CFG_BLE_VITERBI_MODE 1
178+
179+
/**
180+
* LL Only Mode
181+
* 1 : LL Only
182+
* 0 : LL + Host
183+
*/
184+
#define CFG_BLE_LL_ONLY 1
185+
186+
#endif /* APP_CONF_H */
187+
188+
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

0 commit comments

Comments
 (0)
Please sign in to comment.