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