From 301fe805caaa4ff6a566fb4ef494ef18553dfbfe Mon Sep 17 00:00:00 2001 From: Damien George Date: Wed, 17 Feb 2021 15:45:54 +1100 Subject: [PATCH] stm32/mpbtstackport: Allow chipset and secondary baudrate to be set. Signed-off-by: Damien George --- ports/stm32/boards/PYBD_SF2/mpconfigboard.h | 1 + ports/stm32/mpbtstackport.c | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ports/stm32/boards/PYBD_SF2/mpconfigboard.h b/ports/stm32/boards/PYBD_SF2/mpconfigboard.h index 45d968f353..dc42751fff 100644 --- a/ports/stm32/boards/PYBD_SF2/mpconfigboard.h +++ b/ports/stm32/boards/PYBD_SF2/mpconfigboard.h @@ -185,6 +185,7 @@ extern struct _spi_bdev_t spi_bdev2; // Bluetooth config #define MICROPY_HW_BLE_UART_ID (PYB_UART_6) #define MICROPY_HW_BLE_UART_BAUDRATE (115200) +#define MICROPY_HW_BLE_UART_BAUDRATE_SECONDARY (3000000) /******************************************************************************/ // Bootloader configuration diff --git a/ports/stm32/mpbtstackport.c b/ports/stm32/mpbtstackport.c index a031a6a151..3dfd8cb3c4 100644 --- a/ports/stm32/mpbtstackport.c +++ b/ports/stm32/mpbtstackport.c @@ -58,7 +58,7 @@ uint32_t hal_time_ms(void) { STATIC const hci_transport_config_uart_t hci_transport_config_uart = { HCI_TRANSPORT_CONFIG_UART, MICROPY_HW_BLE_UART_BAUDRATE, - 3000000, + MICROPY_HW_BLE_UART_BAUDRATE_SECONDARY, 0, NULL, }; @@ -90,9 +90,9 @@ void mp_bluetooth_btstack_port_init(void) { const hci_transport_t *transport = hci_transport_h4_instance(&mp_bluetooth_btstack_hci_uart_block); hci_init(transport, &hci_transport_config_uart); - // TODO: Probably not necessary for BCM (we have our own firmware loader in the cyw43 driver), - // but might be worth investigating for other controllers in the future. - // hci_set_chipset(btstack_chipset_bcm_instance()); + #ifdef MICROPY_HW_BLE_BTSTACK_CHIPSET_INSTANCE + hci_set_chipset(MICROPY_HW_BLE_BTSTACK_CHIPSET_INSTANCE); + #endif } void mp_bluetooth_btstack_port_deinit(void) {