Skip to content

drivers/cywbt: Switch to new CYW43 BTHCI UART backend. #16848

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 22, 2025
Merged
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
17 changes: 0 additions & 17 deletions drivers/cyw43/README.md

This file was deleted.

304 changes: 0 additions & 304 deletions drivers/cyw43/cywbt.c

This file was deleted.

1 change: 0 additions & 1 deletion ports/mimxrt/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,6 @@ endif

ifeq ($(MICROPY_PY_BLUETOOTH),1)
SRC_C += mpbthciport.c
DRIVERS_SRC_C += drivers/cyw43/cywbt.c
endif # MICROPY_PY_BLUETOOTH

ifeq ($(MICROPY_BLUETOOTH_NIMBLE),1)
Expand Down
25 changes: 25 additions & 0 deletions ports/mimxrt/cyw43_configport.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@
#include "py/mperrno.h"
#include "py/mphal.h"
#include "extmod/modnetwork.h"
#include "extmod/mpbthci.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)

Expand All @@ -47,6 +49,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)
Expand Down Expand Up @@ -75,6 +89,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
Expand All @@ -88,9 +103,19 @@
#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_delay_us mp_hal_delay_us
#define cyw43_delay_ms mp_hal_delay_ms

#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 MICROPY_HW_WL_REG_ON
#define CYW43_PIN_WL_HOST_WAKE MICROPY_HW_WL_HOST_WAKE
#define CYW43_PIN_WL_SDIO_1 MICROPY_HW_SDIO_D1
Expand Down
2 changes: 1 addition & 1 deletion ports/mimxrt/machine_uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ bool lpuart_set_iomux_cts(int8_t uart) {
int index = (uart - 1) * 2;

if (CTS.muxRegister != 0) {
IOMUXC_SetPinMux(CTS.muxRegister, CTS.muxMode, CTS.inputRegister, CTS.inputDaisy, CTS.configRegister, 0U);
IOMUXC_SetPinMux(CTS.muxRegister, CTS.muxMode, CTS.inputRegister, CTS.inputDaisy, CTS.configRegister, 1U);
IOMUXC_SetPinConfig(CTS.muxRegister, CTS.muxMode, CTS.inputRegister, CTS.inputDaisy, CTS.configRegister,
pin_generate_config(PIN_PULL_UP_100K, PIN_MODE_IN, PIN_DRIVE_6, CTS.configRegister));
return true;
Expand Down
Loading
Loading