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 <i.abdalkader@gmail.com>
This commit is contained in:
iabdalkader
2025-03-30 09:29:57 +02:00
committed by Damien George
parent 3bbed952fd
commit 0f360880aa
3 changed files with 28 additions and 2 deletions

View File

@@ -432,7 +432,6 @@ endif
ifeq ($(MICROPY_PY_BLUETOOTH),1)
SRC_C += mpbthciport.c
DRIVERS_SRC_C += drivers/cyw43/cywbt.c
ifeq ($(MICROPY_BLUETOOTH_NIMBLE),1)
SRC_C += mpnimbleport.c

View File

@@ -54,7 +54,7 @@ SECTIONS
*lib/mbedtls/*(.text* .rodata*)
*lib/mynewt-nimble/*(.text* .rodata*)
*lib/cyw43-driver/*(.rodata.w4343*_combined)
*drivers/cyw43/*(.rodata.cyw43_btfw_*)
*lib/cyw43-driver/*(.rodata.cyw43_btfw_*)
. = ALIGN(4);
} >FLASH_EXT
}

View File

@@ -32,11 +32,13 @@
#include "py/mperrno.h"
#include "py/mphal.h"
#include "extmod/modnetwork.h"
#include "extmod/mpbthci.h"
#include "extint.h"
#include "pendsv.h"
#include "sdio.h"
#define CYW43_USE_SPI (0)
#define CYW43_ENABLE_BLUETOOTH_OVER_UART (1)
#define CYW43_LWIP (1)
#define CYW43_USE_STATS (0)
@@ -48,6 +50,18 @@
#define CYW43_WIFI_NVRAM_INCLUDE_FILE "lib/cyw43-driver/firmware/wifi_nvram_1dx.h"
#endif
#ifndef CYW43_BT_FIRMWARE_INCLUDE_FILE
#define CYW43_BT_FIRMWARE_INCLUDE_FILE "lib/cyw43-driver/firmware/cyw43_btfw_4343A1.h"
#endif
#ifdef MICROPY_HW_BLE_UART_BAUDRATE_SECONDARY
#define CYW43_BT_UART_BAUDRATE_ACTIVE_USE MICROPY_HW_BLE_UART_BAUDRATE_SECONDARY
#endif
#ifdef MICROPY_HW_BLE_UART_BAUDRATE_DOWNLOAD_FIRMWARE
#define CYW43_BT_UART_BAUDRATE_DOWNLOAD_FIRMWARE MICROPY_HW_BLE_UART_BAUDRATE_DOWNLOAD_FIRMWARE
#endif
#define CYW43_IOCTL_TIMEOUT_US (1000000)
#define CYW43_SLEEP_MAX (50)
#define CYW43_NETUTILS (1)
@@ -66,6 +80,7 @@
#define CYW43_SDPCM_SEND_COMMON_WAIT __WFI();
#define CYW43_DO_IOCTL_WAIT __WFI();
#define CYW43_HAL_UART_READCHAR_BLOCKING_WAIT __WFI()
#define CYW43_ARRAY_SIZE(a) MP_ARRAY_SIZE(a)
@@ -76,6 +91,7 @@
#define CYW43_HAL_PIN_PULL_DOWN MP_HAL_PIN_PULL_DOWN
#define CYW43_HAL_MAC_WLAN0 MP_HAL_MAC_WLAN0
#define CYW43_HAL_MAC_BDADDR MP_HAL_MAC_BDADDR
#define cyw43_hal_ticks_us mp_hal_ticks_us
#define cyw43_hal_ticks_ms mp_hal_ticks_ms
@@ -90,6 +106,16 @@
#define cyw43_hal_get_mac_ascii mp_hal_get_mac_ascii
#define cyw43_hal_generate_laa_mac mp_hal_generate_laa_mac
#define cyw43_hal_uart_set_baudrate mp_bluetooth_hci_uart_set_baudrate
#define cyw43_hal_uart_write mp_bluetooth_hci_uart_write
#define cyw43_hal_uart_readchar mp_bluetooth_hci_uart_readchar
#define cyw43_bluetooth_controller_init mp_bluetooth_hci_controller_init
#define cyw43_bluetooth_controller_deinit mp_bluetooth_hci_controller_deinit
#define cyw43_bluetooth_controller_woken mp_bluetooth_hci_controller_woken
#define cyw43_bluetooth_controller_wakeup mp_bluetooth_hci_controller_wakeup
#define cyw43_bluetooth_controller_sleep_maybe mp_bluetooth_hci_controller_sleep_maybe
#define CYW43_PIN_WL_REG_ON pyb_pin_WL_REG_ON
#define CYW43_PIN_WL_HOST_WAKE pyb_pin_WL_HOST_WAKE
#define CYW43_PIN_WL_SDIO_1 pyb_pin_WL_SDIO_1
@@ -103,6 +129,7 @@
#if MICROPY_HW_ENABLE_RF_SWITCH
#define CYW43_PIN_RFSW_VDD pyb_pin_WL_RFSW_VDD
#define CYW43_PIN_RFSW_SELECT pyb_pin_WL_GPIO_1
#endif
#define cyw43_schedule_internal_poll_dispatch(func) pendsv_schedule_dispatch(PENDSV_DISPATCH_CYW43, func)