arch/arm/src/nrf52/nrf52_sdc.c: add option to register UART H4 device

This commit is contained in:
raiden00pl 2021-12-17 15:18:07 +01:00 committed by Xiang Xiao
parent 23ef3ea64c
commit c7f6ac63b0
2 changed files with 25 additions and 0 deletions

View File

@ -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

View File

@ -36,6 +36,10 @@
#include <arch/nrf52/nrf52_irq.h>
#include <nuttx/wqueue.h>
#if defined(CONFIG_UART_BTH4)
# include <nuttx/serial/uart_bth4.h>
#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;
}