Skip to content

Commit 0f36088

Browse files
iabdalkaderdpgeorge
authored andcommitted
stm32/cyw43_configport: Update cyw43 config to use new BTHCI UART.
Update the cyw43 configuration to use the new BTHCI UART backend provided by cyw43-driver. Signed-off-by: iabdalkader <[email protected]>
1 parent 3bbed95 commit 0f36088

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed

ports/stm32/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,6 @@ endif
432432

433433
ifeq ($(MICROPY_PY_BLUETOOTH),1)
434434
SRC_C += mpbthciport.c
435-
DRIVERS_SRC_C += drivers/cyw43/cywbt.c
436435

437436
ifeq ($(MICROPY_BLUETOOTH_NIMBLE),1)
438437
SRC_C += mpnimbleport.c

ports/stm32/boards/PYBD_SF2/f722_qspi.ld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ SECTIONS
5454
*lib/mbedtls/*(.text* .rodata*)
5555
*lib/mynewt-nimble/*(.text* .rodata*)
5656
*lib/cyw43-driver/*(.rodata.w4343*_combined)
57-
*drivers/cyw43/*(.rodata.cyw43_btfw_*)
57+
*lib/cyw43-driver/*(.rodata.cyw43_btfw_*)
5858
. = ALIGN(4);
5959
} >FLASH_EXT
6060
}

ports/stm32/cyw43_configport.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,13 @@
3232
#include "py/mperrno.h"
3333
#include "py/mphal.h"
3434
#include "extmod/modnetwork.h"
35+
#include "extmod/mpbthci.h"
3536
#include "extint.h"
3637
#include "pendsv.h"
3738
#include "sdio.h"
3839

3940
#define CYW43_USE_SPI (0)
41+
#define CYW43_ENABLE_BLUETOOTH_OVER_UART (1)
4042
#define CYW43_LWIP (1)
4143
#define CYW43_USE_STATS (0)
4244

@@ -48,6 +50,18 @@
4850
#define CYW43_WIFI_NVRAM_INCLUDE_FILE "lib/cyw43-driver/firmware/wifi_nvram_1dx.h"
4951
#endif
5052

53+
#ifndef CYW43_BT_FIRMWARE_INCLUDE_FILE
54+
#define CYW43_BT_FIRMWARE_INCLUDE_FILE "lib/cyw43-driver/firmware/cyw43_btfw_4343A1.h"
55+
#endif
56+
57+
#ifdef MICROPY_HW_BLE_UART_BAUDRATE_SECONDARY
58+
#define CYW43_BT_UART_BAUDRATE_ACTIVE_USE MICROPY_HW_BLE_UART_BAUDRATE_SECONDARY
59+
#endif
60+
61+
#ifdef MICROPY_HW_BLE_UART_BAUDRATE_DOWNLOAD_FIRMWARE
62+
#define CYW43_BT_UART_BAUDRATE_DOWNLOAD_FIRMWARE MICROPY_HW_BLE_UART_BAUDRATE_DOWNLOAD_FIRMWARE
63+
#endif
64+
5165
#define CYW43_IOCTL_TIMEOUT_US (1000000)
5266
#define CYW43_SLEEP_MAX (50)
5367
#define CYW43_NETUTILS (1)
@@ -66,6 +80,7 @@
6680

6781
#define CYW43_SDPCM_SEND_COMMON_WAIT __WFI();
6882
#define CYW43_DO_IOCTL_WAIT __WFI();
83+
#define CYW43_HAL_UART_READCHAR_BLOCKING_WAIT __WFI()
6984

7085
#define CYW43_ARRAY_SIZE(a) MP_ARRAY_SIZE(a)
7186

@@ -76,6 +91,7 @@
7691
#define CYW43_HAL_PIN_PULL_DOWN MP_HAL_PIN_PULL_DOWN
7792

7893
#define CYW43_HAL_MAC_WLAN0 MP_HAL_MAC_WLAN0
94+
#define CYW43_HAL_MAC_BDADDR MP_HAL_MAC_BDADDR
7995

8096
#define cyw43_hal_ticks_us mp_hal_ticks_us
8197
#define cyw43_hal_ticks_ms mp_hal_ticks_ms
@@ -90,6 +106,16 @@
90106
#define cyw43_hal_get_mac_ascii mp_hal_get_mac_ascii
91107
#define cyw43_hal_generate_laa_mac mp_hal_generate_laa_mac
92108

109+
#define cyw43_hal_uart_set_baudrate mp_bluetooth_hci_uart_set_baudrate
110+
#define cyw43_hal_uart_write mp_bluetooth_hci_uart_write
111+
#define cyw43_hal_uart_readchar mp_bluetooth_hci_uart_readchar
112+
113+
#define cyw43_bluetooth_controller_init mp_bluetooth_hci_controller_init
114+
#define cyw43_bluetooth_controller_deinit mp_bluetooth_hci_controller_deinit
115+
#define cyw43_bluetooth_controller_woken mp_bluetooth_hci_controller_woken
116+
#define cyw43_bluetooth_controller_wakeup mp_bluetooth_hci_controller_wakeup
117+
#define cyw43_bluetooth_controller_sleep_maybe mp_bluetooth_hci_controller_sleep_maybe
118+
93119
#define CYW43_PIN_WL_REG_ON pyb_pin_WL_REG_ON
94120
#define CYW43_PIN_WL_HOST_WAKE pyb_pin_WL_HOST_WAKE
95121
#define CYW43_PIN_WL_SDIO_1 pyb_pin_WL_SDIO_1
@@ -103,6 +129,7 @@
103129

104130
#if MICROPY_HW_ENABLE_RF_SWITCH
105131
#define CYW43_PIN_RFSW_VDD pyb_pin_WL_RFSW_VDD
132+
#define CYW43_PIN_RFSW_SELECT pyb_pin_WL_GPIO_1
106133
#endif
107134

108135
#define cyw43_schedule_internal_poll_dispatch(func) pendsv_schedule_dispatch(PENDSV_DISPATCH_CYW43, func)

0 commit comments

Comments
 (0)