Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
"gcc",
"MICROPY_MODULE_FROZEN_MPY",
"MICROPY_ROM_TEXT_COMPRESSION",
"HAVE_UMM_MALLOC=1"
],
"compilerArgs": [
"-Wall",
Expand Down Expand Up @@ -286,7 +287,8 @@
],
"defines": [
"MICROPY_MODULE_FROZEN_MPY",
"MICROPY_ROM_TEXT_COMPRESSION"
"MICROPY_ROM_TEXT_COMPRESSION",
"HAVE_UMM_MALLOC=1"
],
"compilerArgs": [
"-mthumb",
Expand Down Expand Up @@ -404,7 +406,8 @@
],
"defines": [
"MICROPY_MODULE_FROZEN_MPY",
"MICROPY_USE_READLINE=1"
"MICROPY_USE_READLINE=1",
"HAVE_UMM_MALLOC=1",
],
"compilerPath": "/usr/bin/gcc",
"cStandard": "c11",
Expand Down
13 changes: 12 additions & 1 deletion bricks/_common/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,16 @@ BTSTACK_BLE_SRC_C += $(addprefix lib/btstack/src/ble/,\
sm.c \
)

BTSTACK_CLASSIC_SRC_C = $(addprefix lib/btstack/src/classic/,\
btstack_link_key_db_memory.c \
rfcomm.c \
sdp_client.c \
sdp_client_rfcomm.c \
sdp_server.c \
sdp_util.c \
spp_server.c \
)

BTSTACK_SRC_C += $(addprefix lib/btstack/chipset/cc256x/,\
btstack_chipset_cc256x.c \
)
Expand Down Expand Up @@ -519,7 +529,7 @@ SRC_STM32_USB_DEV += $(addprefix lib/pbio/drv/usb/stm32_usbd/,\
SRC_UMM_MALLOC = lib/umm_malloc/src/umm_malloc.c

ifeq ($(PB_LIB_UMM_MALLOC),1)
CFLAGS += -I$(PBTOP)/lib/umm_malloc/src
CFLAGS += -I$(PBTOP)/lib/umm_malloc/src -DHAVE_UMM_MALLOC=1
endif

# NXT OS
Expand Down Expand Up @@ -579,6 +589,7 @@ ifeq ($(PB_LIB_BTSTACK),1)
ifneq ($(CI_MODE),1)
OBJ += $(addprefix $(BUILD)/, $(BTSTACK_SRC_C:.c=.o))
OBJ += $(addprefix $(BUILD)/, $(BTSTACK_BLE_SRC_C:.c=.o))
OBJ += $(addprefix $(BUILD)/, $(BTSTACK_CLASSIC_SRC_C:.c=.o))
$(BUILD)/lib/btstack/%.o: CFLAGS += -Wno-error
endif
endif
Expand Down
4 changes: 4 additions & 0 deletions lib/pbio/drv/bluetooth/bluetooth.c
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,10 @@ pbio_error_t pbdrv_bluetooth_close_user_tasks(pbio_os_state_t *state, pbio_os_ti

PBIO_OS_ASYNC_BEGIN(state);

#if PBDRV_CONFIG_BLUETOOTH_NUM_CLASSIC_CONNECTIONS
pbdrv_bluetooth_rfcomm_disconnect_all();
#endif // PBDRV_CONFIG_BLUETOOTH_NUM_CLASSIC_CONNECTIONS

for (peri_index = 0; peri_index < PBDRV_CONFIG_BLUETOOTH_NUM_PERIPHERALS; peri_index++) {
peri = pbdrv_bluetooth_peripheral_get_by_index(peri_index);
// Await ongoing peripheral user task, requesting cancellation to
Expand Down
11 changes: 11 additions & 0 deletions lib/pbio/drv/bluetooth/bluetooth.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,17 @@ typedef struct {

pbio_error_t pbdrv_bluetooth_inquiry_scan_func(pbio_os_state_t *state, void *context);

// The following functions are defined in each Bluetooth implementation that
// supports RFCOMM sockets.

// Cancels all pending connection attempts. Called e.g. when the user interrupts
// execution to drop into the debug REPL.
void pbdrv_bluetooth_rfcomm_cancel_connection();

// Disconnects all active RFCOMM connections and cleans up all sockets. Called
// during user program termination.
void pbdrv_bluetooth_rfcomm_disconnect_all();

#endif // PBDRV_CONFIG_BLUETOOTH

#endif // _INTERNAL_PBDRV_BLUETOOTH_H_
Loading
Loading