Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
f039d01
pbdrv/uart: Use uint32_t for read/write length.
jaguilar Oct 21, 2025
a6fcf10
pbdrv/bluetooth: UART block for EV3.
jaguilar Oct 22, 2025
db6e51c
pbio/platform/ev3: Pins for ev3 bluetooth module.
jaguilar Oct 22, 2025
f0565c5
pbio/platform/ev3: Bluetooth platform_data defs.
jaguilar Oct 22, 2025
dfd7676
PR fixes.
jaguilar Oct 25, 2025
899bf13
pbio/platform/ev3: Add more Bluetooth pins.
jaguilar Oct 26, 2025
24695d8
pbdrv/platform/ev3: Format&comment fixup.
jaguilar Oct 26, 2025
670fe21
pbdrv/bluetooth: Rename fns in ev3 uart block.
jaguilar Oct 26, 2025
671033e
pbdrv/bluetooth: EV3 comment fixup for PR.
jaguilar Oct 26, 2025
5360a0d
pbdrv/bluetooth: Format fixup.
jaguilar Oct 26, 2025
28d9654
bricks: PB_LIB_BTSTACK as string variable
jaguilar Oct 26, 2025
b704379
pbdrv/uart_debug_first_port: fix bugs/va_list func
jaguilar Oct 29, 2025
580f3de
platform/ev3: Finish bluetooth configuration.
jaguilar Oct 30, 2025
6e2c634
pbdrv/bluetooth: UART block fixes for EV3.
jaguilar Oct 29, 2025
bb384be
pbdrv/bluetooth: Init scripts for cc2560x.
jaguilar Oct 30, 2025
98c13bf
pbdrv/bluetooth: Add classic runloop.
jaguilar Oct 29, 2025
cccb6ef
compile fix for le hubs
jaguilar Oct 30, 2025
66b55df
pbdrv/bluetooth: Add forgotten pbdrvconfig include.
jaguilar Nov 4, 2025
f68fc89
bricks: Restore accidentally removed cc2564C_1.4.c.
jaguilar Nov 4, 2025
0d83746
pbdrv/bluetooth: EV3 UART block return errors.
jaguilar Nov 5, 2025
0853e88
pbdrv/bluetooth: Refactor classic, add scan API.
jaguilar Nov 5, 2025
33cfa70
bricks/ev3: Add Bluetooth classic object.
jaguilar Nov 5, 2025
940d87f
pbdrv/bluetooth: Classic scan now reports name.
jaguilar Nov 5, 2025
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
17 changes: 11 additions & 6 deletions bricks/_common/arm_none_eabi.mk
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ $(error failed)
endif
endif
endif
ifeq ($(PB_LIB_BTSTACK),1)
ifneq ($(strip $(PB_LIB_BTSTACK)),)
ifeq ("$(wildcard $(PBTOP)/lib/btstack/README.md)","")
$(info GIT cloning btstack submodule)
$(info $(shell cd $(PBTOP) && git submodule update --checkout --init lib/btstack))
Expand Down Expand Up @@ -124,7 +124,7 @@ endif
ifeq ($(PB_LIB_BLE5STACK),1)
INC += -I$(PBTOP)/lib/ble5stack/central
endif
ifeq ($(PB_LIB_BTSTACK),1)
ifneq ($(strip $(PB_LIB_BTSTACK)),)
INC += -I$(PBTOP)/lib/btstack/chipset/cc256x
INC += -I$(PBTOP)/lib/btstack/src
endif
Expand Down Expand Up @@ -359,7 +359,7 @@ BTSTACK_SRC_C = $(addprefix lib/btstack/src/,\
l2cap.c \
)

BTSTACK_SRC_C += $(addprefix lib/btstack/src/ble/,\
BTSTACK_BLE_SRC_C += $(addprefix lib/btstack/src/ble/,\
att_db_util.c \
att_db.c \
att_dispatch.c \
Expand Down Expand Up @@ -509,10 +509,15 @@ ifeq ($(PB_LIB_BLE5STACK),1)
OBJ += $(addprefix $(BUILD)/, $(BLE5STACK_SRC_C:.c=.o))
endif

ifeq ($(PB_LIB_BTSTACK),1)
ifeq ($(PB_LIB_BTSTACK),classic)
OBJ += $(addprefix $(BUILD)/, $(BTSTACK_SRC_C:.c=.o))
endif

ifeq ($(PB_LIB_BTSTACK),lowenergy)
OBJ += $(addprefix $(BUILD)/, $(BTSTACK_SRC_C:.c=.o))
OBJ += $(addprefix $(BUILD)/, $(BTSTACK_BLE_SRC_C:.c=.o))
endif

ifeq ($(PB_LIB_STM32_HAL),1)
OBJ += $(addprefix $(BUILD)/, $(STM32_HAL_SRC_C:.c=.o))
$(BUILD)/lib/stm32lib/%.o: CFLAGS += -Wno-sign-compare
Expand Down Expand Up @@ -566,9 +571,9 @@ TARGETS := $(BUILD)/firmware.zip

all: $(TARGETS)

# handle BTStack .gatt files
# handle BTStack .gatt files (only for BLE / lowenergy)

ifeq ($(PB_LIB_BTSTACK),1)
ifeq ($(PB_LIB_BTSTACK),lowenergy)

GATT_FILES := $(addprefix lib/pbio/drv/bluetooth/,\
pybricks_service.gatt \
Expand Down
4 changes: 4 additions & 0 deletions bricks/_common/sources.mk
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ CONTIKI_SRC_C = $(addprefix lib/contiki-core/,\
PYBRICKS_PYBRICKS_SRC_C = $(addprefix pybricks/,\
common/pb_type_battery.c \
common/pb_type_ble.c \
common/pb_type_btc.c \
common/pb_type_charger.c \
common/pb_type_colorlight_external.c \
common/pb_type_colorlight_internal.c \
Expand Down Expand Up @@ -124,8 +125,11 @@ PBIO_SRC_C = $(addprefix lib/pbio/,\
drv/block_device/block_device_w25qxx_stm32.c \
drv/bluetooth/bluetooth.c \
drv/bluetooth/bluetooth_btstack_control_gpio.c \
drv/bluetooth/bluetooth_btstack_uart_block_ev3.c \
drv/bluetooth/bluetooth_btstack_uart_block_stm32_hal.c \
drv/bluetooth/bluetooth_btstack.c \
drv/bluetooth/bluetooth_btstack_classic.c \
drv/bluetooth/bluetooth_init_cc2560x.c \
drv/bluetooth/bluetooth_init_cc2564C_1.4.c \
drv/bluetooth/bluetooth_simulation.c \
drv/bluetooth/bluetooth_stm32_bluenrg.c \
Expand Down
2 changes: 1 addition & 1 deletion bricks/essentialhub/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ PB_MCU_EXT_OSC_HZ = 16000000
PB_LIB_STM32_HAL = 1
PB_LIB_LSM6DS3TR_C = 1
PB_LIB_BLUENRG = 0
PB_LIB_BTSTACK = 1
PB_LIB_BTSTACK = lowenergy
PB_LIB_STM32_USB_DEVICE = 1
TEXT0_ADDR = 0x8008000
DFU_VID = 0x0694
Expand Down
1 change: 1 addition & 0 deletions bricks/ev3/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ PBIO_PLATFORM = ev3
PB_MCU_FAMILY = TIAM1808

PB_LIB_UMM_MALLOC = 1
PB_LIB_BTSTACK = classic

include ../_common/arm_none_eabi.mk
33 changes: 33 additions & 0 deletions bricks/ev3/btstack_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// SPDX-License-Identifier: MIT
// Copyright (c) 2020 The Pybricks Authors

// BlueKitchen BTStack config

#ifndef _PLATFORM_EV3_BTSTACK_CONFIG_H_
#define _PLATFORM_EV3_BTSTACK_CONFIG_H_

// BTstack features that can be enabled
#define ENABLE_CLASSIC
// #define ENABLE_CC256X_BAUDRATE_CHANGE_FLOWCONTROL_BUG_WORKAROUND
#define ENABLE_PRINTF_HEXDUMP

// Temporary, until I'm sure it's working.
#define ENABLE_LOG_DEBUG
#define ENABLE_LOG_ERROR
#define ENABLE_LOG_INFO

// BTstack configuration. buffers, sizes, ...
#define HCI_ACL_PAYLOAD_SIZE (1691 + 4)
#define MAX_ATT_DB_SIZE 512
#define MAX_NR_BTSTACK_LINK_KEY_DB_MEMORY_ENTRIES 0
#define MAX_NR_HCI_CONNECTIONS 2 // CC2564C can have up to 10 connections
#define MAX_NR_HFP_CONNECTIONS 0
#define MAX_NR_L2CAP_CHANNELS 0
#define MAX_NR_L2CAP_SERVICES 0
#define MAX_NR_RFCOMM_CHANNELS 4
#define MAX_NR_RFCOMM_MULTIPLEXERS 0
#define MAX_NR_RFCOMM_SERVICES 0
#define MAX_NR_SERVICE_RECORD_ITEMS 0
#define MAX_NR_WHITELIST_ENTRIES 0

#endif // _PLATFORM_EV3_BTSTACK_CONFIG_H_
1 change: 1 addition & 0 deletions bricks/ev3/mpconfigport.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
// Pybricks modules
#define PYBRICKS_PY_COMMON (1)
#define PYBRICKS_PY_COMMON_BLE (0)
#define PYBRICKS_PY_COMMON_BTC (1)
#define PYBRICKS_PY_COMMON_CHARGER (0)
#define PYBRICKS_PY_COMMON_COLOR_LIGHT (1)
#define PYBRICKS_PY_COMMON_CONTROL (1)
Expand Down
2 changes: 1 addition & 1 deletion bricks/primehub/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ PB_MCU_EXT_OSC_HZ = 16000000
PB_LIB_STM32_HAL = 1
PB_LIB_LSM6DS3TR_C = 1
PB_LIB_BLUENRG = 0
PB_LIB_BTSTACK = 1
PB_LIB_BTSTACK = lowenergy
PB_LIB_STM32_USB_DEVICE = 1
TEXT0_ADDR = 0x8008000
DFU_VID = 0x0694
Expand Down
4 changes: 4 additions & 0 deletions lib/pbio/drv/bluetooth/bluetooth_btstack.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#ifndef _INTERNAL_PBDRV_BLUETOOTH_BTSTACK_H_
#define _INTERNAL_PBDRV_BLUETOOTH_BTSTACK_H_

#ifdef PBDRV_CONFIG_BLUETOOTH_BTSTACK

#include <btstack_chipset.h>
#include <btstack_control.h>
#include <btstack_uart_block.h>
Expand All @@ -23,4 +25,6 @@ typedef struct {
// defined in platform.c
extern const pbdrv_bluetooth_btstack_platform_data_t pbdrv_bluetooth_btstack_platform_data;

#endif // PBDRV_CONFIG_BLUETOOTH_BTSTACK

#endif // _INTERNAL_PBDRV_BLUETOOTH_BTSTACK_H_
Loading