diff --git a/boards/arm/cxd56xx/common/src/Make.defs b/boards/arm/cxd56xx/common/src/Make.defs index a8da168209c..19a888aa355 100644 --- a/boards/arm/cxd56xx/common/src/Make.defs +++ b/boards/arm/cxd56xx/common/src/Make.defs @@ -32,6 +32,26 @@ # ############################################################################ +ifeq ($(CONFIG_SENSORS_AK09912),y) +CSRCS += cxd56_ak09912_i2c.c +endif + +ifeq ($(CONFIG_SENSORS_AK09912_SCU),y) +CSRCS += cxd56_ak09912_scu.c +endif + +ifeq ($(CONFIG_SENSORS_APDS9930_SCU),y) +CSRCS += cxd56_apds9930_scu.c +endif + +ifeq ($(CONFIG_SENSORS_APDS9960),y) +CSRCS += cxd56_apds9960_i2c.c +endif + +ifeq ($(CONFIG_SENSORS_BMI160_I2C),y) +CSRCS += cxd56_bmi160_i2c.c +endif + DEPPATH += --dep-path src VPATH += :src CFLAGS += $(shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)src) diff --git a/boards/arm/cxd56xx/common/src/cxd56_ak09912_i2c.c b/boards/arm/cxd56xx/common/src/cxd56_ak09912_i2c.c new file mode 100644 index 00000000000..7c72d0950eb --- /dev/null +++ b/boards/arm/cxd56xx/common/src/cxd56_ak09912_i2c.c @@ -0,0 +1,79 @@ +/**************************************************************************** + * boards/arm/cxd56xx/spresense/src/cxd56_ak09912.c + * + * Copyright 2018 Sony Semiconductor Solutions Corporation + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of Sony Semiconductor Solutions Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include + +#include + +#include + +#include "cxd56_i2c.h" + +#if defined(CONFIG_I2C) && defined(CONFIG_SENSORS_AK09912) + +int board_ak09912_initialize(FAR const char *devpath, int bus) +{ + int ret; + FAR struct i2c_master_s *i2c; + + sninfo("Initializing AK09912...\n"); + + /* Initialize i2c deivce */ + + i2c = cxd56_i2cbus_initialize(bus); + if (!i2c) + { + snerr("ERROR: Failed to initialize i2c%d.\n", bus); + return -ENODEV; + } + + ret = ak09912_register(devpath, i2c); + if (ret < 0) + { + snerr("Error registering AK09912.\n"); + } + + return ret; +} + +#endif diff --git a/boards/arm/cxd56xx/common/src/cxd56_ak09912_scu.c b/boards/arm/cxd56xx/common/src/cxd56_ak09912_scu.c new file mode 100644 index 00000000000..bb1b5977efa --- /dev/null +++ b/boards/arm/cxd56xx/common/src/cxd56_ak09912_scu.c @@ -0,0 +1,99 @@ +/**************************************************************************** + * boards/arm/cxd56xx/spresense/src/cxd56_ak09912.c + * + * Copyright 2018 Sony Semiconductor Solutions Corporation + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of Sony Semiconductor Solutions Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include + +#include + +#include +#include "cxd56_i2c.h" + +#include + +#ifdef CONFIG_CXD56_DECI_AK09912 +# define MAG_NR_SEQS 3 +#else +# define MAG_NR_SEQS 1 +#endif + +#ifdef CONFIG_SENSORS_AK09912_SCU + +int board_ak09912_initialize(FAR const char *devpath, int bus) +{ + int i; + int ret; + FAR struct i2c_master_s *i2c; + + sninfo("Initializing AK09912...\n"); + + /* Initialize i2c deivce */ + + i2c = cxd56_i2cbus_initialize(bus); + if (!i2c) + { + snerr("ERROR: Failed to initialize i2c%d.\n", bus); + return -ENODEV; + } + + ret = ak09912_init(i2c, bus); + if (ret < 0) + { + snerr("Error initialize AK09912.\n"); + return ret; + } + + for (i = 0; i < MAG_NR_SEQS; i++) + { + /* register deivce at I2C bus */ + + ret = ak09912_register(devpath, i, i2c, bus); + if (ret < 0) + { + snerr("Error registering AK09912.\n"); + return ret; + } + } + + return ret; +} +#endif diff --git a/boards/arm/cxd56xx/common/src/cxd56_apds9930_scu.c b/boards/arm/cxd56xx/common/src/cxd56_apds9930_scu.c new file mode 100644 index 00000000000..24a36b3ef12 --- /dev/null +++ b/boards/arm/cxd56xx/common/src/cxd56_apds9930_scu.c @@ -0,0 +1,95 @@ +/**************************************************************************** + * boards/arm/cxd56xx/common/src/cxd56_apds9930_scu.c + * + * Copyright 2018 Sony Semiconductor Solutions Corporation + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of Sony Semiconductor Solutions Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include + +#include + +#include +#include + +#include "cxd56_i2c.h" + +#ifdef CONFIG_SENSORS_APDS9930_SCU +int board_apds9930_initialize(int bus) +{ + int ret; + FAR struct i2c_master_s *i2c; + + sninfo("Initializing APDS9930...\n"); + + /* Initialize i2c deivce */ + + i2c = cxd56_i2cbus_initialize(bus); + if (!i2c) + { + snerr("ERROR: Failed to initialize i2c%d.\n", bus); + return -ENODEV; + } + + ret = apds9930_init(i2c, bus); + if (ret < 0) + { + snerr("Error initialize APDS9930.\n"); + return ret; + } + + /* Register devices for each FIFOs at I2C bus */ + + ret = apds9930als_register("/dev/light", 0, i2c, bus); + if (ret < 0) + { + snerr("Error registering APDS9930[ALS].\n"); + return ret; + } + + ret = apds9930ps_register("/dev/proximity", 0, i2c, bus); + if (ret < 0) + { + snerr("Error registering APDS9930[PS].\n"); + return ret; + } + + return ret; +} +#endif /* CONFIG_SENSORS_APDS9930_SCU */ diff --git a/boards/arm/cxd56xx/common/src/cxd56_apds9960_i2c.c b/boards/arm/cxd56xx/common/src/cxd56_apds9960_i2c.c new file mode 100644 index 00000000000..43d619d5362 --- /dev/null +++ b/boards/arm/cxd56xx/common/src/cxd56_apds9960_i2c.c @@ -0,0 +1,89 @@ +/**************************************************************************** + * boards/arm/cxd56xx/common/src/cxd56_apds9960_i2c.c + * + * Copyright 2018 Sony Semiconductor Solutions Corporation + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of Sony Semiconductor Solutions Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include + +#include + +#include + +#include "cxd56_i2c.h" + +#if defined(CONFIG_CXD56_I2C) && defined(CONFIG_APDS9960) + +int board_apds9960_initialize(FAR const char *devpath, int bus) +{ + int ret; + FAR struct i2c_master_s *i2c; + + sninfo("Initializing APDS9960...\n"); + + /* Initialize i2c deivce */ + + i2c = cxd56_i2cbus_initialize(bus); + if (!i2c) + { + snerr("ERROR: Failed to initialize i2c%d.\n", bus); + return -ENODEV; + } + + ret = apds9960_init(i2c, bus); + if (ret < 0) + { + snerr("Error initialize APDS9960.\n"); + return ret; + } + + /* Register devices for each FIFOs at I2C bus */ + + ret = apds9960_register(devpath, i2c, bus); + if (ret < 0) + { + snerr("Error registering APDS9960.\n"); + return ret; + } + + return ret; +} + +#endif /* CONFIG_CXD56_I2C && CONFIG_APDS9960 */ diff --git a/boards/arm/cxd56xx/spresense/src/cxd56_bmi160_i2c.c b/boards/arm/cxd56xx/common/src/cxd56_bmi160_i2c.c similarity index 98% rename from boards/arm/cxd56xx/spresense/src/cxd56_bmi160_i2c.c rename to boards/arm/cxd56xx/common/src/cxd56_bmi160_i2c.c index b4625e0cdac..009aa3e5858 100644 --- a/boards/arm/cxd56xx/spresense/src/cxd56_bmi160_i2c.c +++ b/boards/arm/cxd56xx/common/src/cxd56_bmi160_i2c.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/arm/cxd56xx/spresense/src/cxd56_bmi160_i2c.c + * boards/arm/cxd56xx/common/src/cxd56_bmi160_i2c.c * * Copyright 2018 Sony Semiconductor Solutions Corporation * diff --git a/boards/arm/cxd56xx/drivers/sensors/apds9930_scu.c b/boards/arm/cxd56xx/drivers/sensors/apds9930_scu.c index 912bb852090..a8cbea5aeb8 100644 --- a/boards/arm/cxd56xx/drivers/sensors/apds9930_scu.c +++ b/boards/arm/cxd56xx/drivers/sensors/apds9930_scu.c @@ -53,7 +53,7 @@ #include #include -#if defined(CONFIG_I2C) && defined(CONFIG_SENSORS_APDS9930_SKU) +#if defined(CONFIG_I2C) && defined(CONFIG_SENSORS_APDS9930_SCU) /**************************************************************************** * Pre-processor Definitions diff --git a/boards/arm/cxd56xx/spresense/include/board.h b/boards/arm/cxd56xx/spresense/include/board.h index 27ed2c5bfe9..761197c1382 100644 --- a/boards/arm/cxd56xx/spresense/include/board.h +++ b/boards/arm/cxd56xx/spresense/include/board.h @@ -52,11 +52,15 @@ #include "cxd56_charger.h" #include "cxd56_gs2200m.h" #include "cxd56_i2cdev.h" -#include "cxd56_bmi160.h" #include "cxd56_sdcard.h" #include "cxd56_wdt.h" #include "cxd56_gpioif.h" +#include "cxd56_ak09912.h" +#include "cxd56_apds9930.h" +#include "cxd56_apds9960.h" +#include "cxd56_bmi160.h" + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ diff --git a/boards/arm/cxd56xx/spresense/include/cxd56_ak09912.h b/boards/arm/cxd56xx/spresense/include/cxd56_ak09912.h new file mode 100644 index 00000000000..a989a676689 --- /dev/null +++ b/boards/arm/cxd56xx/spresense/include/cxd56_ak09912.h @@ -0,0 +1,86 @@ +/**************************************************************************** + * boards/arm/cxd56xx/spresense/include/cxd56_ak09912.h + * + * Copyright 2018 Sony Semiconductor Solutions Corporation + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of Sony Semiconductor Solutions Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __BOARDS_ARM_CXD56XX_SPRESENSE_INCLUDE_CXD56_AK09912_H +#define __BOARDS_ARM_CXD56XX_SPRESENSE_INCLUDE_CXD56_AK09912_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +#ifndef __ASSEMBLY__ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Name: board_ak09912_initialize + * + * Description: + * Initialize AK09912 i2c driver and register the AK09912 device. + * + ****************************************************************************/ + +#if defined (CONFIG_SENSORS_AK09912) || defined (CONFIG_SENSORS_AK09912_SCU) +int board_ak09912_initialize(FAR const char *devpath, int bus); +#endif + +#undef EXTERN +#if defined(__cplusplus) +} +#endif + +#endif /* __ASSEMBLY__ */ +#endif /* __BOARDS_ARM_CXD56XX_SPRESENSE_INCLUDE_CXD56_AK09912_H */ diff --git a/boards/arm/cxd56xx/spresense/include/cxd56_apds9930.h b/boards/arm/cxd56xx/spresense/include/cxd56_apds9930.h new file mode 100644 index 00000000000..29709c05d11 --- /dev/null +++ b/boards/arm/cxd56xx/spresense/include/cxd56_apds9930.h @@ -0,0 +1,86 @@ +/**************************************************************************** + * boards/arm/cxd56xx/spresense/include/cxd56_apds9930.h + * + * Copyright 2018 Sony Semiconductor Solutions Corporation + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of Sony Semiconductor Solutions Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __BOARDS_ARM_CXD56XX_SPRESENSE_INCLUDE_CXD56_APDS9930_H +#define __BOARDS_ARM_CXD56XX_SPRESENSE_INCLUDE_CXD56_APDS9930_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +#ifndef __ASSEMBLY__ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Name: board_apds9930_initialize + * + * Description: + * Initialize APDS9930 i2c driver and register the APDS9930 device. + * + ****************************************************************************/ + +#if defined(CONFIG_SENSORS_APDS9930) || defined(CONFIG_SENSORS_APDS9930_SCU) +int board_apds9930_initialize(int bus); +#endif + +#undef EXTERN +#if defined(__cplusplus) +} +#endif + +#endif /* __ASSEMBLY__ */ +#endif /* __BOARDS_ARM_CXD56XX_SPRESENSE_INCLUDE_CXD56_APDS9930_H */ diff --git a/boards/arm/cxd56xx/spresense/include/cxd56_apds9960.h b/boards/arm/cxd56xx/spresense/include/cxd56_apds9960.h new file mode 100644 index 00000000000..9f6969cbed9 --- /dev/null +++ b/boards/arm/cxd56xx/spresense/include/cxd56_apds9960.h @@ -0,0 +1,86 @@ +/**************************************************************************** + * boards/arm/cxd56xx/spresense/include/cxd56_apds9960.h + * + * Copyright 2018 Sony Semiconductor Solutions Corporation + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of Sony Semiconductor Solutions Corporation nor + * the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __BOARDS_ARM_CXD56XX_SPRESENSE_INCLUDE_CXD56_APDS9960_H +#define __BOARDS_ARM_CXD56XX_SPRESENSE_INCLUDE_CXD56_APDS9960_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +#ifndef __ASSEMBLY__ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Name: board_apds9960_initialize + * + * Description: + * Initialize APDS9960 i2c driver and register the APDS9960 device. + * + ****************************************************************************/ + +#if defined(CONFIG_SENSORS_APDS9960) || defined(CONFIG_SENSORS_APDS9960_SCU) +int board_apds9960_initialize(FAR const char *devpath, int bus); +#endif + +#undef EXTERN +#if defined(__cplusplus) +} +#endif + +#endif /* __ASSEMBLY__ */ +#endif /* __BOARDS_ARM_CXD56XX_SPRESENSE_INCLUDE_CXD56_APDS9960_H */ diff --git a/boards/arm/cxd56xx/spresense/src/Make.defs b/boards/arm/cxd56xx/spresense/src/Make.defs index 2837927e3b4..83960ee52d2 100644 --- a/boards/arm/cxd56xx/spresense/src/Make.defs +++ b/boards/arm/cxd56xx/spresense/src/Make.defs @@ -110,10 +110,6 @@ ifeq ($(CONFIG_WL_GS2200M),y) CSRCS += cxd56_gs2200m.c endif -ifeq ($(CONFIG_SENSORS_BMI160_I2C),y) -CSRCS += cxd56_bmi160_i2c.c -endif - ifeq ($(CONFIG_CXD56_I2C_DRIVER),y) CSRCS += cxd56_i2cdev.c endif diff --git a/include/nuttx/sensors/apds9930.h b/include/nuttx/sensors/apds9930.h index aed648f62ea..2feaa48acd8 100644 --- a/include/nuttx/sensors/apds9930.h +++ b/include/nuttx/sensors/apds9930.h @@ -38,7 +38,7 @@ #include -#if defined(CONFIG_I2C) && (defined(SENSORS_CONFIG_APDS9930) || defined(SENSORS_CONFIG_APDS9930_SCU)) +#if defined(CONFIG_I2C) && (defined(CONFIG_SENSORS_APDS9930) || defined(CONFIG_SENSORS_APDS9930_SCU)) /**************************************************************************** * Pre-processor Definitions