xref: /btstack/port/esp32/components/btstack/include/btstack_config.h (revision c26f2c7ba71221a2122afaf0cfbfa38f1ce5c589)
1 //
2 // btstack_config.h for esp32 port
3 //
4 // Documentation: https://bluekitchen-gmbh.com/btstack/#how_to/
5 //
6 
7 #ifndef BTSTACK_CONFIG_H
8 #define BTSTACK_CONFIG_H
9 
10 // Port related features
11 #define HAVE_ASSERT
12 #define HAVE_BTSTACK_STDIN
13 #define HAVE_EMBEDDED_TIME_MS
14 #define HAVE_FREERTOS_INCLUDE_PREFIX
15 #define HAVE_FREERTOS_TASK_NOTIFICATIONS
16 #define HAVE_MALLOC
17 
18 #define HAVE_BTSTACK_AUDIO_EFFECTIVE_SAMPLERATE
19 
20 // HCI Controller to Host Flow Control
21 #define ENABLE_HCI_CONTROLLER_TO_HOST_FLOW_CONTROL
22 
23 // BTstack features that can be enabled
24 #define ENABLE_PRINTF_HEXDUMP
25 #define ENABLE_LOG_ERROR
26 #define ENABLE_LOG_INFO
27 
28 // Enable Classic/LE based on esp-idf sdkconfig
29 #include "sdkconfig.h"
30 #ifdef CONFIG_IDF_TARGET_ESP32
31 // ESP32 as dual-mode Controller
32 #define ENABLE_CLASSIC
33 #define ENABLE_BLE
34 #else /* CONFIG_IDF_TARGET_ESP32 */
35 // ESP32-C3 and ESP32-S3 with LE-only Controller
36 #define ENABLE_BLE
37 #endif
38 
39 // Classic configuration
40 #ifdef ENABLE_CLASSIC
41 
42 #define ENABLE_HFP_WIDE_BAND_SPEECH
43 
44 #define ENABLE_SCO_OVER_HCI
45 
46 // mainly needed for AVRCP Browsing, can be removed otherwise to reduce code size
47 #define ENABLE_L2CAP_ENHANCED_RETRANSMISSION_MODE
48 
49 // work around to link layer issues in ESP32
50 // https://github.com/espressif/esp-idf/issues/5494
51 #define ENABLE_CLASSIC_LEGACY_CONNECTIONS_FOR_SCO_DEMOS
52 
53 // support CTKD if LE is available, too
54 #ifdef ENABLE_BLE
55 #define ENABLE_CROSS_TRANSPORT_KEY_DERIVATION
56 #endif
57 
58 #define NVM_NUM_LINK_KEYS 16
59 
60 #endif
61 
62 // LE configuration
63 #ifdef ENABLE_BLE
64 
65 #define ENABLE_L2CAP_LE_CREDIT_BASED_FLOW_CONTROL_MODE
66 #define ENABLE_LE_CENTRAL
67 #define ENABLE_LE_DATA_LENGTH_EXTENSION
68 #define ENABLE_LE_PERIPHERAL
69 #define ENABLE_LE_SECURE_CONNECTIONS
70 // ESP32 supports ECDH HCI Commands, but micro-ecc lib is already provided anyway
71 #define ENABLE_MICRO_ECC_FOR_LE_SECURE_CONNECTIONS
72 
73 #define NVM_NUM_DEVICE_DB_ENTRIES 16
74 
75 // Mesh Configuration
76 #define ENABLE_MESH
77 #define ENABLE_MESH_ADV_BEARER
78 #define ENABLE_MESH_GATT_BEARER
79 #define ENABLE_MESH_PB_ADV
80 #define ENABLE_MESH_PB_GATT
81 #define ENABLE_MESH_PROVISIONER
82 #define ENABLE_MESH_PROXY_SERVER
83 
84 #define MAX_NR_MESH_SUBNETS            2
85 #define MAX_NR_MESH_TRANSPORT_KEYS    16
86 #define MAX_NR_MESH_VIRTUAL_ADDRESSES 16
87 
88 // allow for one NetKey update
89 #define MAX_NR_MESH_NETWORK_KEYS      (MAX_NR_MESH_SUBNETS+1)
90 
91 #endif
92 
93 // BTstack configuration. buffers, sizes, ...
94 
95 #ifdef ENABLE_CLASSIC
96 
97 // ACL buffer large enough for Ethernet frame in BNEP/PAN
98 #define HCI_ACL_PAYLOAD_SIZE (1691 + 4)
99 
100 #define HCI_HOST_ACL_PACKET_LEN 1024
101 #define HCI_HOST_ACL_PACKET_NUM 20
102 #define HCI_HOST_SCO_PACKET_LEN 60
103 #define HCI_HOST_SCO_PACKET_NUM 10
104 
105 #else
106 
107 // ACL buffer large enough to allow for 512 byte Characteristic
108 #define HCI_ACL_PAYLOAD_SIZE (512 + 4 + 3)
109 
110 #define HCI_HOST_ACL_PACKET_LEN HCI_ACL_PAYLOAD_SIZE
111 #define HCI_HOST_ACL_PACKET_NUM 20
112 #define HCI_HOST_SCO_PACKET_LEN 0
113 #define HCI_HOST_SCO_PACKET_NUM 0
114 
115 #endif
116 
117 
118 #endif
119