summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ports/unix/Makefile9
-rw-r--r--ports/unix/variants/coverage/mpconfigvariant.mk1
-rw-r--r--ports/unix/variants/dev/mpconfigvariant.h2
-rw-r--r--ports/unix/variants/dev/mpconfigvariant.mk2
4 files changed, 13 insertions, 1 deletions
diff --git a/ports/unix/Makefile b/ports/unix/Makefile
index eaaedab15..3e095a8d7 100644
--- a/ports/unix/Makefile
+++ b/ports/unix/Makefile
@@ -132,19 +132,26 @@ CFLAGS_MOD += -DMICROPY_PY_THREAD=1 -DMICROPY_PY_THREAD_GIL=0
LDFLAGS_MOD += $(LIBPTHREAD)
endif
+# If the variant enables it and we have libusb, enable BTStack support for USB adaptors.
ifeq ($(MICROPY_PY_BLUETOOTH),1)
+
+HAVE_LIBUSB := $(shell (which pkg-config > /dev/null && pkg-config --exists libusb-1.0) 2>/dev/null && echo '1')
+ifeq ($(HAVE_LIBUSB),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
+endif
+endif
+
ifeq ($(MICROPY_PY_FFI),1)
ifeq ($(MICROPY_STANDALONE),1)
diff --git a/ports/unix/variants/coverage/mpconfigvariant.mk b/ports/unix/variants/coverage/mpconfigvariant.mk
index b56ffcbbc..ddb5027a9 100644
--- a/ports/unix/variants/coverage/mpconfigvariant.mk
+++ b/ports/unix/variants/coverage/mpconfigvariant.mk
@@ -17,3 +17,4 @@ MICROPY_ROM_TEXT_COMPRESSION = 1
MICROPY_VFS_FAT = 1
MICROPY_VFS_LFS1 = 1
MICROPY_VFS_LFS2 = 1
+MICROPY_PY_BLUETOOTH = 1
diff --git a/ports/unix/variants/dev/mpconfigvariant.h b/ports/unix/variants/dev/mpconfigvariant.h
index 2b3097010..eb6513471 100644
--- a/ports/unix/variants/dev/mpconfigvariant.h
+++ b/ports/unix/variants/dev/mpconfigvariant.h
@@ -26,5 +26,7 @@
#define MICROPY_REPL_EMACS_WORDS_MOVE (1)
#define MICROPY_REPL_EMACS_EXTRA_WORDS_MOVE (1)
+#define MICROPY_ENABLE_SCHEDULER (1)
#define MICROPY_PY_SYS_SETTRACE (1)
+#define MICROPY_PY_URANDOM_EXTRA_FUNCS (1)
diff --git a/ports/unix/variants/dev/mpconfigvariant.mk b/ports/unix/variants/dev/mpconfigvariant.mk
index d7067e99c..bbd30b623 100644
--- a/ports/unix/variants/dev/mpconfigvariant.mk
+++ b/ports/unix/variants/dev/mpconfigvariant.mk
@@ -1,3 +1,5 @@
PROG ?= micropython-dev
MICROPY_ROM_TEXT_COMPRESSION = 1
+
+MICROPY_PY_BLUETOOTH = 1