Merged in alinjerpelea/nuttx (pull request #1019)

Add the sensor initialization for cxd56xx boards in the common board folder

* boards: cxd56xx: apds9930: typo fix

    fix apds9930 typos

    Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>

* boards: cxd56xx: add cxd56_ak09912 initialization

    We are adding the sensor initialization for cxd56xx boards in the
    common board folder.

    Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>

* boards: cxd56xx: move cxd56_bmi160 initialization

    We are adding the sensor initialization for cxd56xx boards in the
    common board folder.

    Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>

* boards: cxd56xx: add cxd56_apds9930 initialization

    We are adding the sensor initialization for cxd56xx boards in the
    common board folder.

    Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>

* boards: cxd56xx: add cxd56_apds9960 initialization

    We are adding the sensor initialization for cxd56xx boards in the
    common board folder.

    Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>

Approved-by: Gregory Nutt <gnutt@nuttx.org>
This commit is contained in:
Alin Jerpelea
2019-08-22 13:55:35 +00:00
committed by Gregory Nutt
parent a91d86523c
commit d6366c1e82
13 changed files with 648 additions and 8 deletions
+5 -1
View File
@@ -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
****************************************************************************/
@@ -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 <nuttx/config.h>
/****************************************************************************
* 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 */
@@ -1,5 +1,5 @@
/****************************************************************************
* boards/arm/cxd56xx/spresense/src/cxd56_bmi160_i2c.c
* boards/arm/cxd56xx/spresense/include/cxd56_apds9930.h
*
* Copyright 2018 Sony Semiconductor Solutions Corporation
*
@@ -33,54 +33,54 @@
*
****************************************************************************/
#ifndef __BOARDS_ARM_CXD56XX_SPRESENSE_INCLUDE_CXD56_APDS9930_H
#define __BOARDS_ARM_CXD56XX_SPRESENSE_INCLUDE_CXD56_APDS9930_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdio.h>
#include <debug.h>
#include <errno.h>
/****************************************************************************
* Public Types
****************************************************************************/
#include <nuttx/board.h>
#include <nuttx/sensors/bmi160.h>
#ifndef __ASSEMBLY__
#include "cxd56_i2c.h"
/****************************************************************************
* Public Data
****************************************************************************/
#ifdef CONFIG_CXD56_DECI_GYRO
#define GYRO_NR_SEQS 3
#else
#define GYRO_NR_SEQS 1
#endif
#ifdef CONFIG_CXD56_DECI_ACCEL
#define ACCEL_NR_SEQS 3
#else
#define ACCEL_NR_SEQS 1
#endif
int board_bmi160_initialize(int bus)
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
extern "C"
{
int ret;
FAR struct i2c_master_s *i2c;
#else
#define EXTERN extern
#endif
sninfo("Initializing BMI160..\n");
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/* Initialize i2c deivce */
/****************************************************************************
* Name: board_apds9930_initialize
*
* Description:
* Initialize APDS9930 i2c driver and register the APDS9930 device.
*
****************************************************************************/
i2c = cxd56_i2cbus_initialize(bus);
if (!i2c)
{
snerr("ERROR: Failed to initialize i2c%d.\n", bus);
return -ENODEV;
}
#if defined(CONFIG_SENSORS_APDS9930) || defined(CONFIG_SENSORS_APDS9930_SCU)
int board_apds9930_initialize(int bus);
#endif
ret = bmi160_register("/dev/accel0", i2c);
if (ret < 0)
{
snerr("Error registering BMI160\n");
}
return ret;
#undef EXTERN
#if defined(__cplusplus)
}
#endif
#endif /* __ASSEMBLY__ */
#endif /* __BOARDS_ARM_CXD56XX_SPRESENSE_INCLUDE_CXD56_APDS9930_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 <nuttx/config.h>
/****************************************************************************
* 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 */
@@ -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