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 #define NVM_NUM_LINK_KEYS 16 51 52 #endif 53 54 // LE configuration 55 #ifdef ENABLE_BLE 56 57 #define ENABLE_L2CAP_LE_CREDIT_BASED_FLOW_CONTROL_MODE 58 #define ENABLE_LE_CENTRAL 59 #define ENABLE_LE_DATA_LENGTH_EXTENSION 60 #define ENABLE_LE_PERIPHERAL 61 #define ENABLE_LE_SECURE_CONNECTIONS 62 // ESP32 supports ECDH HCI Commands, but micro-ecc lib is already provided anyway 63 #define ENABLE_MICRO_ECC_FOR_LE_SECURE_CONNECTIONS 64 65 #define NVM_NUM_DEVICE_DB_ENTRIES 16 66 67 // Mesh Configuration 68 #define ENABLE_MESH 69 #define ENABLE_MESH_ADV_BEARER 70 #define ENABLE_MESH_GATT_BEARER 71 #define ENABLE_MESH_PB_ADV 72 #define ENABLE_MESH_PB_GATT 73 #define ENABLE_MESH_PROVISIONER 74 #define ENABLE_MESH_PROXY_SERVER 75 76 #define MAX_NR_MESH_SUBNETS 2 77 #define MAX_NR_MESH_TRANSPORT_KEYS 16 78 #define MAX_NR_MESH_VIRTUAL_ADDRESSES 16 79 80 // allow for one NetKey update 81 #define MAX_NR_MESH_NETWORK_KEYS (MAX_NR_MESH_SUBNETS+1) 82 83 #endif 84 85 // BTstack configuration. buffers, sizes, ... 86 87 #ifdef ENABLE_CLASSIC 88 89 // ACL buffer large enough for Ethernet frame in BNEP/PAN 90 #define HCI_ACL_PAYLOAD_SIZE (1691 + 4) 91 92 #define HCI_HOST_ACL_PACKET_LEN 1024 93 #define HCI_HOST_ACL_PACKET_NUM 20 94 #define HCI_HOST_SCO_PACKET_LEN 60 95 #define HCI_HOST_SCO_PACKET_NUM 10 96 97 #else 98 99 // ACL buffer large enough to allow for 512 byte Characteristic 100 #define HCI_ACL_PAYLOAD_SIZE (512 + 4 + 3) 101 102 #define HCI_HOST_ACL_PACKET_LEN HCI_ACL_PAYLOAD_SIZE 103 #define HCI_HOST_ACL_PACKET_NUM 20 104 #define HCI_HOST_SCO_PACKET_LEN 0 105 #define HCI_HOST_SCO_PACKET_NUM 0 106 107 #endif 108 109 110 #endif 111