sensor: add wtgahrs2 init and enable config

Change-Id: I0521098d6157c59d4e0d463e43a2d202797577b6
Signed-off-by: dongjiuzhu <dongjiuzhu1@xiaomi.com>
This commit is contained in:
dongjiuzhu 2020-09-26 18:25:43 +08:00 committed by Matias N
parent a3f978da02
commit 8bd163325b
2 changed files with 21 additions and 0 deletions

View File

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

View File

@ -39,6 +39,7 @@
#include <nuttx/config.h>
#include <nuttx/board.h>
#include <nuttx/sensors/wtgahrs2.h>
#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 */