From 8bd163325b9865e95ea9423228542c0a901980b5 Mon Sep 17 00:00:00 2001 From: dongjiuzhu Date: Sat, 26 Sep 2020 18:25:43 +0800 Subject: [PATCH] sensor: add wtgahrs2 init and enable config Change-Id: I0521098d6157c59d4e0d463e43a2d202797577b6 Signed-off-by: dongjiuzhu --- boards/sim/sim/sim/Kconfig | 8 ++++++++ boards/sim/sim/sim/src/sim_appinit.c | 13 +++++++++++++ 2 files changed, 21 insertions(+) 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 */