31static_assert(
sizeof(gatt_client_t) == 140 &&
sizeof(hci_connection_t) == 3740,
"BTstack layout changed");
33static_assert(
sizeof(gatt_client_t) == 128 &&
sizeof(hci_connection_t) == 3688,
"BTstack layout changed");
41constexpr int HCI_CONNECTION_POOL_SIZE = ESPHOME_BLE_GATT_CLIENT_COUNT + 1;
44gatt_client_t gatt_client_storage[ESPHOME_BLE_GATT_CLIENT_COUNT];
45btstack_memory_pool_t gatt_client_pool;
46hci_connection_t hci_connection_storage[HCI_CONNECTION_POOL_SIZE];
47btstack_memory_pool_t hci_connection_pool;
53 btstack_memory_pool_create(&gatt_client_pool, gatt_client_storage, ESPHOME_BLE_GATT_CLIENT_COUNT,
54 sizeof(gatt_client_t));
55 btstack_memory_pool_create(&hci_connection_pool, hci_connection_storage, HCI_CONNECTION_POOL_SIZE,
56 sizeof(hci_connection_t));
80template<
typename T>
void anchor_wrap(T *symbol) {
asm volatile(
"" ::
"r"(symbol)); }
87 void *buffer = btstack_memory_pool_get(&gatt_client_pool);
88 if (buffer !=
nullptr) {
89 memset(buffer, 0,
sizeof(gatt_client_t));
91 return static_cast<gatt_client_t *
>(buffer);
96 btstack_memory_pool_free(&gatt_client_pool, gatt_client);
101 void *buffer = btstack_memory_pool_get(&hci_connection_pool);
102 if (buffer !=
nullptr) {
103 memset(buffer, 0,
sizeof(hci_connection_t));
105 return static_cast<hci_connection_t *
>(buffer);
110 btstack_memory_pool_free(&hci_connection_pool, hci_connection);