summaryrefslogtreecommitdiffstatshomepage
path: root/extmod/btstack
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2022-11-10 11:02:12 +1100
committerDamien George <damien@micropython.org>2022-11-11 15:14:14 +1100
commit9c9f06ad9dbf49ffd2fe0d336091f4293e403ee7 (patch)
tree329a8e0fde35a9effd2b106ed997ac6a1acfc24e /extmod/btstack
parent5de8d7eb6485a724b439b53fb230d87500d45c83 (diff)
downloadmicropython-9c9f06ad9dbf49ffd2fe0d336091f4293e403ee7.tar.gz
micropython-9c9f06ad9dbf49ffd2fe0d336091f4293e403ee7.zip
extmod/btstack: Allow the BTstack config to be overridden by a board.
If a board defines MICROPY_BLUETOOTH_BTSTACK_CONFIG_FILE as the path to a header file, then that file will be used for the BTstack config. Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'extmod/btstack')
-rw-r--r--extmod/btstack/btstack.mk2
-rw-r--r--extmod/btstack/btstack_config.h44
-rw-r--r--extmod/btstack/btstack_config_common.h48
3 files changed, 51 insertions, 43 deletions
diff --git a/extmod/btstack/btstack.mk b/extmod/btstack/btstack.mk
index ca95931562..ef730d2cf3 100644
--- a/extmod/btstack/btstack.mk
+++ b/extmod/btstack/btstack.mk
@@ -6,6 +6,7 @@ GIT_SUBMODULES += lib/btstack
MICROPY_BLUETOOTH_BTSTACK_USB ?= 0
MICROPY_BLUETOOTH_BTSTACK_H4 ?= 1
+MICROPY_BLUETOOTH_BTSTACK_CONFIG_FILE ?= '"extmod/btstack/btstack_config_common.h"'
BTSTACK_EXTMOD_DIR = extmod/btstack
@@ -14,6 +15,7 @@ SRC_EXTMOD_C += $(BTSTACK_EXTMOD_DIR)/modbluetooth_btstack.c
INC += -I$(TOP)/$(BTSTACK_EXTMOD_DIR)
CFLAGS_EXTMOD += -DMICROPY_BLUETOOTH_BTSTACK=1
+CFLAGS_EXTMOD += -DMICROPY_BLUETOOTH_BTSTACK_CONFIG_FILE=$(MICROPY_BLUETOOTH_BTSTACK_CONFIG_FILE)
CFLAGS_EXTMOD += -DMICROPY_PY_BLUETOOTH_USE_SYNC_EVENTS=1
CFLAGS_EXTMOD += -DMICROPY_PY_BLUETOOTH_ENABLE_PAIRING_BONDING=1
diff --git a/extmod/btstack/btstack_config.h b/extmod/btstack/btstack_config.h
index 7de938cb6f..84f0dab2bd 100644
--- a/extmod/btstack/btstack_config.h
+++ b/extmod/btstack/btstack_config.h
@@ -1,48 +1,6 @@
#ifndef MICROPY_INCLUDED_EXTMOD_BTSTACK_BTSTACK_CONFIG_H
#define MICROPY_INCLUDED_EXTMOD_BTSTACK_BTSTACK_CONFIG_H
-// BTstack features that can be enabled
-#define ENABLE_BLE
-#define ENABLE_LE_PERIPHERAL
-#define ENABLE_LE_CENTRAL
-// #define ENABLE_CLASSIC
-#define ENABLE_L2CAP_LE_CREDIT_BASED_FLOW_CONTROL_MODE
-// #define ENABLE_LOG_INFO
-// #define ENABLE_LOG_DEBUG
-#define ENABLE_LOG_ERROR
-
-// BTstack configuration. buffers, sizes, ...
-#define HCI_ACL_PAYLOAD_SIZE 1021
-#define MAX_NR_GATT_CLIENTS 1
-#define MAX_NR_HCI_CONNECTIONS 1
-#define MAX_NR_L2CAP_SERVICES 3
-#define MAX_NR_L2CAP_CHANNELS 3
-#define MAX_NR_RFCOMM_MULTIPLEXERS 1
-#define MAX_NR_RFCOMM_SERVICES 1
-#define MAX_NR_RFCOMM_CHANNELS 1
-#define MAX_NR_BTSTACK_LINK_KEY_DB_MEMORY_ENTRIES 2
-#define MAX_NR_BNEP_SERVICES 1
-#define MAX_NR_BNEP_CHANNELS 1
-#define MAX_NR_HFP_CONNECTIONS 1
-#define MAX_NR_WHITELIST_ENTRIES 1
-#define MAX_NR_SM_LOOKUP_ENTRIES 3
-#define MAX_NR_SERVICE_RECORD_ITEMS 1
-#define MAX_NR_AVDTP_STREAM_ENDPOINTS 1
-#define MAX_NR_AVDTP_CONNECTIONS 1
-#define MAX_NR_AVRCP_CONNECTIONS 1
-
-#define MAX_NR_LE_DEVICE_DB_ENTRIES 4
-
-// Link Key DB and LE Device DB using TLV on top of Flash Sector interface
-// #define NVM_NUM_DEVICE_DB_ENTRIES 16
-
-// We don't give btstack a malloc, so use a fixed-size ATT DB.
-#define MAX_ATT_DB_SIZE 512
-
-// BTstack HAL configuration
-#define HAVE_EMBEDDED_TIME_MS
-
-// Some USB dongles take longer to respond to HCI reset (e.g. BCM20702A).
-#define HCI_RESET_RESEND_TIMEOUT_MS 1000
+#include MICROPY_BLUETOOTH_BTSTACK_CONFIG_FILE
#endif // MICROPY_INCLUDED_EXTMOD_BTSTACK_BTSTACK_CONFIG_H
diff --git a/extmod/btstack/btstack_config_common.h b/extmod/btstack/btstack_config_common.h
new file mode 100644
index 0000000000..8118c4c1a9
--- /dev/null
+++ b/extmod/btstack/btstack_config_common.h
@@ -0,0 +1,48 @@
+#ifndef MICROPY_INCLUDED_EXTMOD_BTSTACK_BTSTACK_CONFIG_COMMON_H
+#define MICROPY_INCLUDED_EXTMOD_BTSTACK_BTSTACK_CONFIG_COMMON_H
+
+// BTstack features that can be enabled
+#define ENABLE_BLE
+#define ENABLE_LE_PERIPHERAL
+#define ENABLE_LE_CENTRAL
+// #define ENABLE_CLASSIC
+#define ENABLE_L2CAP_LE_CREDIT_BASED_FLOW_CONTROL_MODE
+// #define ENABLE_LOG_INFO
+// #define ENABLE_LOG_DEBUG
+#define ENABLE_LOG_ERROR
+
+// BTstack configuration. buffers, sizes, ...
+#define HCI_ACL_PAYLOAD_SIZE 1021
+#define MAX_NR_GATT_CLIENTS 1
+#define MAX_NR_HCI_CONNECTIONS 1
+#define MAX_NR_L2CAP_SERVICES 3
+#define MAX_NR_L2CAP_CHANNELS 3
+#define MAX_NR_RFCOMM_MULTIPLEXERS 1
+#define MAX_NR_RFCOMM_SERVICES 1
+#define MAX_NR_RFCOMM_CHANNELS 1
+#define MAX_NR_BTSTACK_LINK_KEY_DB_MEMORY_ENTRIES 2
+#define MAX_NR_BNEP_SERVICES 1
+#define MAX_NR_BNEP_CHANNELS 1
+#define MAX_NR_HFP_CONNECTIONS 1
+#define MAX_NR_WHITELIST_ENTRIES 1
+#define MAX_NR_SM_LOOKUP_ENTRIES 3
+#define MAX_NR_SERVICE_RECORD_ITEMS 1
+#define MAX_NR_AVDTP_STREAM_ENDPOINTS 1
+#define MAX_NR_AVDTP_CONNECTIONS 1
+#define MAX_NR_AVRCP_CONNECTIONS 1
+
+#define MAX_NR_LE_DEVICE_DB_ENTRIES 4
+
+// Link Key DB and LE Device DB using TLV on top of Flash Sector interface
+// #define NVM_NUM_DEVICE_DB_ENTRIES 16
+
+// We don't give btstack a malloc, so use a fixed-size ATT DB.
+#define MAX_ATT_DB_SIZE 512
+
+// BTstack HAL configuration
+#define HAVE_EMBEDDED_TIME_MS
+
+// Some USB dongles take longer to respond to HCI reset (e.g. BCM20702A).
+#define HCI_RESET_RESEND_TIMEOUT_MS 1000
+
+#endif // MICROPY_INCLUDED_EXTMOD_BTSTACK_BTSTACK_CONFIG_COMMON_H