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