Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions boards/sim/sim/sim/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
13 changes: 13 additions & 0 deletions boards/sim/sim/sim/src/sim_appinit.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@

#include <nuttx/config.h>
#include <nuttx/board.h>
#include <nuttx/sensors/wtgahrs2.h>

#include "sim.h"
#include "up_internal.h"
Expand Down Expand Up @@ -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 */
8 changes: 8 additions & 0 deletions drivers/sensors/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ menuconfig SENSORS

if SENSORS

config SENSORS_WTGAHRS2
bool "Wtgahrs2 Sensor Support"
default n
---help---
We can read sensor data by serial interface. It need the hardware sensor
wtgashrs2(JY901) as data source. This sensor can generate accelerometer,
gyroscope, magnetic, barometer and gps data.

config SENSORS_APDS9960
bool "Avago APDS-9960 Gesture Sensor support"
default n
Expand Down
6 changes: 6 additions & 0 deletions drivers/sensors/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@

ifeq ($(CONFIG_SENSORS),y)

CSRCS += sensor.c

ifeq ($(CONFIG_SENSORS_WTGAHRS2),y)
CSRCS += wtgahrs2.c
endif

ifeq ($(CONFIG_SENSORS_HCSR04),y)
CSRCS += hc_sr04.c
endif
Expand Down
Loading