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: 6 additions & 1 deletion .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,10 @@
"${workspaceFolder}/bricks/virtualhub",
"${workspaceFolder}/bricks/virtualhub/build",
"${workspaceFolder}/bricks/virtualhub/build-debug",
"${workspaceFolder}/lib/btstack/chipset/realtek",
"${workspaceFolder}/lib/btstack/platform/libusb",
"${workspaceFolder}/lib/btstack/platform/posix",
"${workspaceFolder}/lib/btstack/src",
"${workspaceFolder}/lib/lego",
"${workspaceFolder}/lib/lwrb/src/include",
"${workspaceFolder}/lib/pbio",
Expand All @@ -394,7 +398,8 @@
"${workspaceFolder}/micropython",
"${workspaceFolder}",
"${workspaceFolder}/lib/umm_malloc/src",
"/usr/include/python3.10"
"/usr/include/python3.10",
"/usr/include/libusb-1.0"
],
"defines": [
"MICROPY_MODULE_FROZEN_MPY",
Expand Down
4 changes: 4 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@
"name": "PBIO_TEST_CONNECT_SOCKET",
"value": "true"
},
{
"name": "UB500_INDEX",
"value": "0"
}
],
"externalConsole": false,
"MIMode": "gdb",
Expand Down
36 changes: 36 additions & 0 deletions bricks/_common/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,18 @@ endif
ifneq ($(strip $(PB_LIB_BTSTACK)),)
INC += -I$(PBTOP)/lib/btstack/chipset/cc256x
INC += -I$(PBTOP)/lib/btstack/src
ifeq ($(PBIO_PLATFORM),virtual_hub)
INC += -I$(PBTOP)/lib/btstack/platform/posix
INC += -I$(PBTOP)/lib/btstack/platform/embedded
INC += -I$(PBTOP)/lib/btstack/3rd-party/tinydir
INC += -I$(PBTOP)/lib/btstack/3rd-party/rijndael
INC += -I$(PBTOP)/lib/btstack/3rd-party/micro-ecc
INC += -I$(PBTOP)/lib/btstack/chipset/bcm
INC += -I$(PBTOP)/lib/btstack/chipset/intel
INC += -I$(PBTOP)/lib/btstack/chipset/realtek
INC += -I$(PBTOP)/lib/btstack/chipset/zephyr
INC += $(shell pkg-config libusb-1.0 --cflags)
endif
endif
ifeq ($(PB_LIB_LSM6DS3TR_C),1)
INC += -I$(PBTOP)/lib/lsm6ds3tr_c_STdC/driver
Expand Down Expand Up @@ -162,6 +174,9 @@ else ifeq ($(UNAME_S),Darwin)
LDFLAGS += -Wl,-map,$@.map -Wl,-dead_strip
endif
LIBS = -lm
ifeq ($(PB_LIB_BTSTACK),lowenergy)
LIBS += $(shell pkg-config libusb-1.0 --libs)
endif
else # end native, begin embedded
CROSS_COMPILE ?= arm-none-eabi-
ifeq ($(PB_MCU_FAMILY),STM32)
Expand Down Expand Up @@ -395,6 +410,25 @@ BTSTACK_SRC_C += $(addprefix lib/btstack/chipset/cc256x/,\
btstack_chipset_cc256x.c \
)

# libusb-specific BTStack sources for virtual_hub
ifeq ($(PBIO_PLATFORM),virtual_hub)
BTSTACK_SRC_C += $(addprefix lib/btstack/,\
platform/libusb/hci_transport_h2_libusb.c \
platform/posix/hci_dump_posix_stdout.c \
platform/posix/btstack_tlv_posix.c \
src/classic/btstack_link_key_db_tlv.c \
src/ble/le_device_db_tlv.c \
chipset/zephyr/btstack_chipset_zephyr.c \
chipset/realtek/btstack_chipset_realtek.c \
chipset/bcm/btstack_chipset_bcm.c \
chipset/intel/btstack_chipset_intel_firmware.c \
3rd-party/rijndael/rijndael.c \
3rd-party/micro-ecc/uECC.c \
)
# Suppress unused variable warning for this file
$(BUILD)/lib/btstack/platform/libusb/hci_transport_h2_libusb.o: CFLAGS += -Wno-unused-variable
endif

# STM32 HAL

COPT += -DUSE_FULL_LL_DRIVER
Expand Down Expand Up @@ -529,11 +563,13 @@ endif

ifeq ($(PB_LIB_BTSTACK),classic)
OBJ += $(addprefix $(BUILD)/, $(BTSTACK_SRC_C:.c=.o))
$(BUILD)/lib/btstack/%.o: CFLAGS += -Wno-error
endif

ifeq ($(PB_LIB_BTSTACK),lowenergy)
OBJ += $(addprefix $(BUILD)/, $(BTSTACK_SRC_C:.c=.o))
OBJ += $(addprefix $(BUILD)/, $(BTSTACK_BLE_SRC_C:.c=.o))
$(BUILD)/lib/btstack/%.o: CFLAGS += -Wno-error
endif

ifeq ($(PB_LIB_STM32_HAL),1)
Expand Down
3 changes: 2 additions & 1 deletion bricks/_common/sources.mk
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,10 @@ PBIO_SRC_C = $(addprefix lib/pbio/,\
drv/block_device/block_device_test.c \
drv/block_device/block_device_w25qxx_stm32.c \
drv/bluetooth/bluetooth.c \
drv/bluetooth/bluetooth_btstack_stm32_hal.c \
drv/bluetooth/bluetooth_btstack.c \
drv/bluetooth/bluetooth_btstack_ev3.c \
drv/bluetooth/bluetooth_btstack_posix.c \
drv/bluetooth/bluetooth_btstack_stm32_hal.c \
drv/bluetooth/bluetooth_simulation.c \
drv/bluetooth/bluetooth_stm32_bluenrg.c \
drv/bluetooth/bluetooth_stm32_cc2640.c \
Expand Down
1 change: 1 addition & 0 deletions bricks/virtualhub/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ PB_MCU_FAMILY = native
PB_FROZEN_MODULES = 1
MICROPY_ROM_TEXT_COMPRESSION = 1
PB_LIB_UMM_MALLOC = 1
PB_LIB_BTSTACK = lowenergy

include ../_common/common.mk
Loading
Loading