You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/08/14 16:32:48 UTC

[incubator-nuttx] 01/05: stm32f4discovery: Add support to APDS9960

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 9a08b04d3f04d68a62e59edcc9593f605ca63d19
Author: Alan Carvalho de Assis <ac...@gmail.com>
AuthorDate: Sun Jul 24 16:30:19 2022 -0300

    stm32f4discovery: Add support to APDS9960
---
 boards/arm/stm32/stm32f4discovery/include/board.h     |  7 +++++++
 boards/arm/stm32/stm32f4discovery/src/stm32_bringup.c | 15 +++++++++++++++
 2 files changed, 22 insertions(+)

diff --git a/boards/arm/stm32/stm32f4discovery/include/board.h b/boards/arm/stm32/stm32f4discovery/include/board.h
index 6f2698a1f2..c9af4896a0 100644
--- a/boards/arm/stm32/stm32f4discovery/include/board.h
+++ b/boards/arm/stm32/stm32f4discovery/include/board.h
@@ -439,6 +439,13 @@
 #define BOARD_ZEROCROSS_GPIO \
   (GPIO_INPUT|GPIO_FLOAT|GPIO_EXTI|GPIO_PORTD|GPIO_PIN0)
 
+/* Pin for APDS-9960 sensor */
+
+#define GPIO_APDS9960_INT \
+  (GPIO_INPUT|GPIO_FLOAT|GPIO_EXTI|GPIO_PORTE|GPIO_PIN0)
+
+#define BOARD_APDS9960_GPIO_INT GPIO_APDS9960_INT
+
 /* LIS3DSH */
 
 #define GPIO_LIS3DSH_EXT0 \
diff --git a/boards/arm/stm32/stm32f4discovery/src/stm32_bringup.c b/boards/arm/stm32/stm32f4discovery/src/stm32_bringup.c
index 9a4340b421..99678d5c23 100644
--- a/boards/arm/stm32/stm32f4discovery/src/stm32_bringup.c
+++ b/boards/arm/stm32/stm32f4discovery/src/stm32_bringup.c
@@ -54,6 +54,10 @@
 #  include <nuttx/usb/rndis.h>
 #endif
 
+#ifdef CONFIG_SENSORS_APDS9960
+#include "stm32_apds9960.h"
+#endif
+
 #include "stm32f4discovery.h"
 
 /* Conditional logic in stm32f4discovery.h will determine if certain features
@@ -420,6 +424,17 @@ int stm32_bringup(void)
     }
 #endif
 
+#ifdef CONFIG_SENSORS_APDS9960
+  /* Register the APDS-9960 gesture sensor */
+
+  ret = board_apds9960_initialize(0, 1);
+  if (ret < 0)
+    {
+      syslog(LOG_ERR, "ERROR: board_apds9960_initialize() failed: %d\n",
+             ret);
+    }
+#endif
+
 #ifdef CONFIG_RTC_DS1307
   ret = stm32_ds1307_init();
   if (ret < 0)