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