aboutsummaryrefslogtreecommitdiff
path: root/ports/unix/Makefile
diff options
context:
space:
mode:
authorJim Mussared2020-04-07 15:02:52 +1000
committerDamien George2020-04-29 16:45:46 +1000
commit7563d582100d7947eb61960c9116c8fc10f1e996 (patch)
treef7f3884fa8f98b012c8ffa8814d8ea5c46ae9511 /ports/unix/Makefile
parentc987adb9e938dbcb1a50e7b0947913c4e37e0943 (diff)
unix: Add support for modbluetooth and BLE using btstack.
This commit adds full support to the unix port for Bluetooth using the common extmod/modbluetooth Python bindings. This uses the libusb HCI transport, which supports many common USB BT adaptors.
Diffstat (limited to 'ports/unix/Makefile')
-rw-r--r--ports/unix/Makefile19
1 files changed, 17 insertions, 2 deletions
diff --git a/ports/unix/Makefile b/ports/unix/Makefile
index 8cb95d08f..eaaedab15 100644
--- a/ports/unix/Makefile
+++ b/ports/unix/Makefile
@@ -132,6 +132,19 @@ CFLAGS_MOD += -DMICROPY_PY_THREAD=1 -DMICROPY_PY_THREAD_GIL=0
LDFLAGS_MOD += $(LIBPTHREAD)
endif
+ifeq ($(MICROPY_PY_BLUETOOTH),1)
+CFLAGS_MOD += -DMICROPY_PY_BLUETOOTH=1
+CFLAGS_MOD += -DMICROPY_PY_BLUETOOTH_ENABLE_CENTRAL_MODE=1
+CFLAGS_MOD += -DMICROPY_PY_BLUETOOTH_GATTS_ON_READ_CALLBACK=1
+
+MICROPY_BLUETOOTH_BTSTACK ?= 1
+MICROPY_BLUETOOTH_BTSTACK_USB ?= 1
+endif
+
+ifeq ($(MICROPY_BLUETOOTH_BTSTACK),1)
+include $(TOP)/extmod/btstack/btstack.mk
+endif
+
ifeq ($(MICROPY_PY_FFI),1)
ifeq ($(MICROPY_STANDALONE),1)
@@ -176,10 +189,11 @@ SRC_C = \
alloc.c \
coverage.c \
fatfs_port.c \
+ btstack_usb.c \
$(SRC_MOD) \
$(wildcard $(VARIANT_DIR)/*.c)
-LIB_SRC_C = $(addprefix lib/,\
+LIB_SRC_C += $(addprefix lib/,\
$(LIB_SRC_C_EXTRA) \
timeutils/timeutils.c \
)
@@ -187,9 +201,10 @@ LIB_SRC_C = $(addprefix lib/,\
OBJ = $(PY_O)
OBJ += $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
OBJ += $(addprefix $(BUILD)/, $(LIB_SRC_C:.c=.o))
+OBJ += $(addprefix $(BUILD)/, $(EXTMOD_SRC_C:.c=.o))
# List of sources for qstr extraction
-SRC_QSTR += $(SRC_C) $(LIB_SRC_C)
+SRC_QSTR += $(SRC_C) $(LIB_SRC_C) $(EXTMOD_SRC_C)
# Append any auto-generated sources that are needed by sources listed in
# SRC_QSTR
SRC_QSTR_AUTO_DEPS +=