summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authoriabdalkader <i.abdalkader@gmail.com>2025-03-03 17:46:56 +0100
committerDamien George <damien@micropython.org>2025-04-22 12:49:14 +1000
commit3bbed952fdc884d85112a15715152c9c4f558c14 (patch)
tree7e19d50c1c3dbfd8c8d8ddfd9dacb2b0eda569c5
parent399c10dc28eba4ddd163dd0e930529f1b81d514a (diff)
downloadmicropython-3bbed952fdc884d85112a15715152c9c4f558c14.tar.gz
micropython-3bbed952fdc884d85112a15715152c9c4f558c14.zip
mimxrt/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>
-rw-r--r--ports/mimxrt/Makefile1
-rw-r--r--ports/mimxrt/cyw43_configport.h25
2 files changed, 25 insertions, 1 deletions
diff --git a/ports/mimxrt/Makefile b/ports/mimxrt/Makefile
index c0358387f9..7788b54ca5 100644
--- a/ports/mimxrt/Makefile
+++ b/ports/mimxrt/Makefile
@@ -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)
diff --git a/ports/mimxrt/cyw43_configport.h b/ports/mimxrt/cyw43_configport.h
index ab535a4777..cf2f5d4b9f 100644
--- a/ports/mimxrt/cyw43_configport.h
+++ b/ports/mimxrt/cyw43_configport.h
@@ -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)
@@ -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)
@@ -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
@@ -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