extmod/modbluetooth: Add compile-config flag to enable pairing/bonding.
Enable it on STM32/Unix NimBLE only (pairing/bonding requires synchronous events and full bindings). Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This commit is contained in:
parent
5e20f689ad
commit
ac89267fef
3 changed files with 15 additions and 0 deletions
|
|
@ -47,6 +47,10 @@
|
||||||
#error l2cap channels require synchronous modbluetooth events
|
#error l2cap channels require synchronous modbluetooth events
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if MICROPY_PY_BLUETOOTH_ENABLE_PAIRING_BONDING && !MICROPY_PY_BLUETOOTH_USE_SYNC_EVENTS
|
||||||
|
#error pairing and bonding require synchronous modbluetooth events
|
||||||
|
#endif
|
||||||
|
|
||||||
#define MP_BLUETOOTH_CONNECT_DEFAULT_SCAN_DURATION_MS 2000
|
#define MP_BLUETOOTH_CONNECT_DEFAULT_SCAN_DURATION_MS 2000
|
||||||
|
|
||||||
#define MICROPY_PY_BLUETOOTH_MAX_EVENT_DATA_TUPLE_LEN 5
|
#define MICROPY_PY_BLUETOOTH_MAX_EVENT_DATA_TUPLE_LEN 5
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,12 @@
|
||||||
#define MICROPY_PY_BLUETOOTH_ENABLE_L2CAP_CHANNELS (0)
|
#define MICROPY_PY_BLUETOOTH_ENABLE_L2CAP_CHANNELS (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// A port can optionally enable support for pairing and bonding.
|
||||||
|
// Requires MICROPY_PY_BLUETOOTH_USE_SYNC_EVENTS.
|
||||||
|
#ifndef MICROPY_PY_BLUETOOTH_ENABLE_PAIRING_BONDING
|
||||||
|
#define MICROPY_PY_BLUETOOTH_ENABLE_PAIRING_BONDING (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
// This is used to protect the ringbuffer.
|
// This is used to protect the ringbuffer.
|
||||||
// A port may no-op this if MICROPY_PY_BLUETOOTH_USE_SYNC_EVENTS is enabled.
|
// A port may no-op this if MICROPY_PY_BLUETOOTH_USE_SYNC_EVENTS is enabled.
|
||||||
#ifndef MICROPY_PY_BLUETOOTH_ENTER
|
#ifndef MICROPY_PY_BLUETOOTH_ENTER
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,11 @@ ifeq ($(MICROPY_BLUETOOTH_NIMBLE_BINDINGS_ONLY),0)
|
||||||
# UART is also polled by the RX IRQ.
|
# UART is also polled by the RX IRQ.
|
||||||
CFLAGS_MOD += -DMICROPY_PY_BLUETOOTH_USE_SYNC_EVENTS=1
|
CFLAGS_MOD += -DMICROPY_PY_BLUETOOTH_USE_SYNC_EVENTS=1
|
||||||
|
|
||||||
|
# Without the ringbuffer, and with the full implementation, we can also
|
||||||
|
# enable pairing and bonding. This requires both synchronous events and
|
||||||
|
# some customisation of the key store.
|
||||||
|
CFLAGS_MOD += -DMICROPY_PY_BLUETOOTH_ENABLE_PAIRING_BONDING=1
|
||||||
|
|
||||||
NIMBLE_LIB_DIR = lib/mynewt-nimble
|
NIMBLE_LIB_DIR = lib/mynewt-nimble
|
||||||
|
|
||||||
LIB_SRC_C += $(addprefix $(NIMBLE_LIB_DIR)/, \
|
LIB_SRC_C += $(addprefix $(NIMBLE_LIB_DIR)/, \
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue