Skip to content

Commit 034a5e1

Browse files
committed
pbio/platform/prime_hub: Enable two peripherals on F4 hubs.
1 parent c5722ba commit 034a5e1

File tree

5 files changed

+17
-12
lines changed

5 files changed

+17
-12
lines changed

lib/pbio/drv/bluetooth/bluetooth_btstack.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,11 @@ static pbio_error_t att_error_to_pbio_error(uint8_t status) {
132132
return PBIO_ERROR_NO_DEV;
133133
case ATT_ERROR_TIMEOUT:
134134
return PBIO_ERROR_TIMEDOUT;
135+
case BTSTACK_MEMORY_ALLOC_FAILED:
136+
DEBUG_PRINT("BTstack out of memory.\n");
137+
// fallthrough
135138
default:
139+
DEBUG_PRINT("Failed with status.%d\n", status);
136140
return PBIO_ERROR_FAILED;
137141
}
138142
}
@@ -718,6 +722,7 @@ pbio_error_t pbdrv_bluetooth_peripheral_scan_and_connect_func(pbio_os_state_t *s
718722

719723
// We are done if no pairing is requested.
720724
if (!peri->config->options & PBDRV_BLUETOOTH_PERIPHERAL_OPTIONS_PAIR) {
725+
DEBUG_PRINT("Simple connection done.\n");
721726
return PBIO_SUCCESS;
722727
}
723728

lib/pbio/platform/essential_hub/btstack_config.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: MIT
2-
// Copyright (c) 2020-2021 The Pybricks Authors
2+
// Copyright (c) 2020-2026 The Pybricks Authors
33

44
// BlueKitchen BTStack config
55

@@ -21,18 +21,18 @@
2121
#define HCI_ACL_PAYLOAD_SIZE (1691 + 4)
2222
#define MAX_ATT_DB_SIZE 512
2323
#define MAX_NR_BTSTACK_LINK_KEY_DB_MEMORY_ENTRIES 0
24-
#define MAX_NR_GATT_CLIENTS 1
25-
#define MAX_NR_HCI_CONNECTIONS 2 // CC2564C can have up to 10 connections
24+
#define MAX_NR_GATT_CLIENTS 2
25+
#define MAX_NR_HCI_CONNECTIONS 3 // CC2564C can have up to 10 connections
2626
#define MAX_NR_HFP_CONNECTIONS 0
2727
#define MAX_NR_L2CAP_CHANNELS 0
2828
#define MAX_NR_L2CAP_SERVICES 0
2929
#define MAX_NR_RFCOMM_CHANNELS 0
3030
#define MAX_NR_RFCOMM_MULTIPLEXERS 0
3131
#define MAX_NR_RFCOMM_SERVICES 0
3232
#define MAX_NR_SERVICE_RECORD_ITEMS 0
33-
#define MAX_NR_SM_LOOKUP_ENTRIES 0
33+
#define MAX_NR_SM_LOOKUP_ENTRIES 3
3434
#define MAX_NR_WHITELIST_ENTRIES 0
35-
#define MAX_NR_LE_DEVICE_DB_ENTRIES 1
35+
#define MAX_NR_LE_DEVICE_DB_ENTRIES 3
3636

3737
// Link Key DB and LE Device DB using TLV on top of Flash Sector interface
3838
// #define NVM_NUM_DEVICE_DB_ENTRIES 16

lib/pbio/platform/essential_hub/pbdrvconfig.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#define PBDRV_CONFIG_BATTERY_ADC_TEMPERATURE_CH 2
2727

2828
#define PBDRV_CONFIG_BLUETOOTH (1)
29-
#define PBDRV_CONFIG_BLUETOOTH_NUM_PERIPHERALS (1)
29+
#define PBDRV_CONFIG_BLUETOOTH_NUM_PERIPHERALS (2)
3030
#define PBDRV_CONFIG_BLUETOOTH_MAX_MTU_SIZE 515
3131
#define PBDRV_CONFIG_BLUETOOTH_BTSTACK (1)
3232
#define PBDRV_CONFIG_BLUETOOTH_BTSTACK_LE (1)

lib/pbio/platform/prime_hub/btstack_config.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: MIT
2-
// Copyright (c) 2020 The Pybricks Authors
2+
// Copyright (c) 2020-2026 The Pybricks Authors
33

44
// BlueKitchen BTStack config
55

@@ -21,18 +21,18 @@
2121
#define HCI_ACL_PAYLOAD_SIZE (1691 + 4)
2222
#define MAX_ATT_DB_SIZE 512
2323
#define MAX_NR_BTSTACK_LINK_KEY_DB_MEMORY_ENTRIES 0
24-
#define MAX_NR_GATT_CLIENTS 1
25-
#define MAX_NR_HCI_CONNECTIONS 2 // CC2564C can have up to 10 connections
24+
#define MAX_NR_GATT_CLIENTS 2
25+
#define MAX_NR_HCI_CONNECTIONS 3 // CC2564C can have up to 10 connections
2626
#define MAX_NR_HFP_CONNECTIONS 0
2727
#define MAX_NR_L2CAP_CHANNELS 0
2828
#define MAX_NR_L2CAP_SERVICES 0
2929
#define MAX_NR_RFCOMM_CHANNELS 0
3030
#define MAX_NR_RFCOMM_MULTIPLEXERS 0
3131
#define MAX_NR_RFCOMM_SERVICES 0
3232
#define MAX_NR_SERVICE_RECORD_ITEMS 0
33-
#define MAX_NR_SM_LOOKUP_ENTRIES 0
33+
#define MAX_NR_SM_LOOKUP_ENTRIES 3
3434
#define MAX_NR_WHITELIST_ENTRIES 0
35-
#define MAX_NR_LE_DEVICE_DB_ENTRIES 1
35+
#define MAX_NR_LE_DEVICE_DB_ENTRIES 3
3636

3737
// Link Key DB and LE Device DB using TLV on top of Flash Sector interface
3838
// #define NVM_NUM_DEVICE_DB_ENTRIES 16

lib/pbio/platform/prime_hub/pbdrvconfig.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#define PBDRV_CONFIG_BATTERY_ADC_TEMPERATURE_CH 2
2727

2828
#define PBDRV_CONFIG_BLUETOOTH (1)
29-
#define PBDRV_CONFIG_BLUETOOTH_NUM_PERIPHERALS (1)
29+
#define PBDRV_CONFIG_BLUETOOTH_NUM_PERIPHERALS (2)
3030
#define PBDRV_CONFIG_BLUETOOTH_MAX_MTU_SIZE 515
3131
#define PBDRV_CONFIG_BLUETOOTH_BTSTACK (1)
3232
#define PBDRV_CONFIG_BLUETOOTH_BTSTACK_LE (1)

0 commit comments

Comments
 (0)