sensors: Move SCU-specific bmp280 sensor into spresense board

Move SCU-specific bmp280 sensor into spresense board layer.
This commit is contained in:
SPRESENSE 2023-08-24 16:15:23 +09:00 committed by Xiang Xiao
parent ffcea1da4f
commit 7d0d6234eb
3 changed files with 65 additions and 26 deletions

View File

@ -31,6 +31,7 @@
#include <nuttx/board.h>
#include <nuttx/sensors/bmp280.h>
#include <arch/board/cxd56_bmp280.h>
#include <arch/chip/scu.h>
#include "cxd56_i2c.h"

View File

@ -26,6 +26,7 @@
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/i2c/i2c_master.h>
/****************************************************************************
* Public Types
@ -62,6 +63,69 @@ extern "C"
int board_bmp280_initialize(int bus);
#endif
#ifdef CONFIG_SENSORS_BMP280_SCU
/****************************************************************************
* Name: bmp280_init
*
* Description:
* Initialize BMP280 pressure device
*
* Input Parameters:
* i2c - An instance of the I2C interface to use to communicate with
* BMP280
* port - I2C port number
*
* Returned Value:
* Zero (OK) on success; a negated errno value on failure.
*
****************************************************************************/
int bmp280_init(struct i2c_master_s *i2c, int port);
/****************************************************************************
* Name: bmp280press_register
*
* Description:
* Register the BMP280 pressure sensor character device as 'devpath'
*
* Input Parameters:
* devpath - The base path to the driver to register. E.g., "/dev/press0"
* minor - The number of sequencer
* i2c - An instance of the I2C interface to use to communicate with
* BMP280
* port - I2C port number
*
* Returned Value:
* Zero (OK) on success; a negated errno value on failure.
*
****************************************************************************/
int bmp280press_register(const char *devpath, int minor,
struct i2c_master_s *i2c, int port);
/****************************************************************************
* Name: bmp280temp_register
*
* Description:
* Register the BMP280 temperature sensor character device as 'devpath'
*
* Input Parameters:
* devpath - The base path to the driver to register. E.g., "/dev/temp"
* minor - The number of sequencer
* i2c - An instance of the I2C interface to use to communicate with
* BMP280
* port - I2C port number
*
* Returned Value:
* Zero (OK) on success; a negated errno value on failure.
*
****************************************************************************/
int bmp280temp_register(const char *devpath, int minor,
struct i2c_master_s *i2c, int port);
#endif
#undef EXTERN
#if defined(__cplusplus)
}

View File

@ -135,25 +135,6 @@ struct bmp280_meas_s
uint8_t xlsb; /* meas value XLSB */
};
#ifdef CONFIG_SENSORS_BMP280_SCU
/****************************************************************************
* Name: bmp280_init
*
* Description:
* Initialize BMP280 pressure device
*
* Input Parameters:
* i2c - An instance of the I2C interface to use to communicate with
* BMP280
*
* Returned Value:
* Zero (OK) on success; a negated errno value on failure.
*
****************************************************************************/
int bmp280_init(FAR struct i2c_master_s *i2c, int port);
#endif
/****************************************************************************
* Name: bmp280_register
*
@ -170,14 +151,7 @@ int bmp280_init(FAR struct i2c_master_s *i2c, int port);
*
****************************************************************************/
#ifdef CONFIG_SENSORS_BMP280_SCU
int bmp280press_register(FAR const char *devpath, int minor,
FAR struct i2c_master_s *i2c, int port);
int bmp280temp_register(FAR const char *devpath, int minor,
FAR struct i2c_master_s *i2c, int port);
#else
int bmp280_register(int devno, FAR struct i2c_master_s *i2c);
#endif
#undef EXTERN
#ifdef __cplusplus