From c7f6ac63b01eee2a1beed57d4a8b519eb6fc2401 Mon Sep 17 00:00:00 2001 From: raiden00pl Date: Fri, 17 Dec 2021 15:18:07 +0100 Subject: [PATCH] arch/arm/src/nrf52/nrf52_sdc.c: add option to register UART H4 device --- arch/arm/src/nrf52/Kconfig | 5 +++++ arch/arm/src/nrf52/nrf52_sdc.c | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/arch/arm/src/nrf52/Kconfig b/arch/arm/src/nrf52/Kconfig index a3a6a127d9e..feb16a8dc1c 100644 --- a/arch/arm/src/nrf52/Kconfig +++ b/arch/arm/src/nrf52/Kconfig @@ -725,5 +725,10 @@ config NRF52_SDC_VERSION to use. See official Nordic documentation on which chips are supported in each version. +config NRF52_BLE_TTY_NAME + string "BLE TTY device name" + default "/dev/ttyHCI0" + depends on UART_BTH4 + endif diff --git a/arch/arm/src/nrf52/nrf52_sdc.c b/arch/arm/src/nrf52/nrf52_sdc.c index 05fd8b2304d..310daea565b 100644 --- a/arch/arm/src/nrf52/nrf52_sdc.c +++ b/arch/arm/src/nrf52/nrf52_sdc.c @@ -36,6 +36,10 @@ #include #include +#if defined(CONFIG_UART_BTH4) +# include +#endif + #include "arm_internal.h" #include "ram_vectors.h" #include "arm_arch.h" @@ -557,9 +561,25 @@ int nrf52_sdc_initialize(void) return ret; } +#ifdef CONFIG_UART_BTH4 + /* Register UART BT H4 device */ + + ret = uart_bth4_register(CONFIG_NRF52_BLE_TTY_NAME, &g_bt_driver); + if (ret < 0) + { + wlerr("bt_bth4_register error: %d\n", ret); + return ret; + } +#else /* Register network device */ ret = bt_netdev_register(&g_bt_driver); + if (ret < 0) + { + wlerr("bt_netdev_register error: %d\n", ret); + return ret; + } +#endif return ret; }