diff --git a/boards/sim/sim/sim/Kconfig b/boards/sim/sim/sim/Kconfig index a2aeb684c8..8063ef5058 100644 --- a/boards/sim/sim/sim/Kconfig +++ b/boards/sim/sim/sim/Kconfig @@ -45,4 +45,12 @@ config SIM_NOTIFYSIGNO The signal number to use with nx_eventnotify(). Default: 4 endif + +config SIM_WTGAHRS2_UARTN + int "Wtgahrs2 sensor serial interface number" + default -1 + depends on SENSORS_WTGAHRS2 && SIM_UART_NUMBER > 0 + ---help--- + We can select the number accoding to which SIM_UARTX_NAME is uesd to sensor. + This range is 0-4. endif diff --git a/boards/sim/sim/sim/src/sim_appinit.c b/boards/sim/sim/sim/src/sim_appinit.c index 06c57d4edc..cc8d312dcc 100644 --- a/boards/sim/sim/sim/src/sim_appinit.c +++ b/boards/sim/sim/sim/src/sim_appinit.c @@ -39,6 +39,7 @@ #include #include +#include #include "sim.h" #include "up_internal.h" @@ -83,6 +84,18 @@ int board_app_initialize(uintptr_t arg) up_rptun_init(); #endif +#ifdef CONFIG_SIM_WTGAHRS2_UARTN +#if CONFIG_SIM_WTGAHRS2_UARTN == 0 + wtgahrs2_initialize(CONFIG_SIM_UART0_NAME); +#elif CONFIG_SIM_WTGAHRS2_UARTN == 1 + wtgahrs2_initialize(CONFIG_SIM_UART1_NAME); +#elif CONFIG_SIM_WTGAHRS2_UARTN == 2 + wtgahrs2_initialize(CONFIG_SIM_UART2_NAME); +#elif CONFIG_SIM_WTGAHRS2_UARTN == 3 + wtgahrs2_initialize(CONFIG_SIM_UART3_NAME); +#endif +#endif + return 0; } #endif /* CONFIG_LIB_BOARDCTL */