mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 00:14:22 +08:00
feature: sensor: add lps27hhw baro sensor driver.
CHAMPION-96 Add lps27hhw baro sensor driver to sensor drivers. Change-Id: I0b1c9809eef13b564166621961c1679ed8de415b Signed-off-by: songnannan <songnannan@xiaomi.com>
This commit is contained in:
@@ -556,6 +556,13 @@ config DEBUG_LPS25H
|
||||
|
||||
endif # SENSORS_LPS25H
|
||||
|
||||
config SENSORS_LPS27HHW
|
||||
bool "STMicro LPS27HHW barometer sensor"
|
||||
default n
|
||||
select I2C
|
||||
---help---
|
||||
Enable driver support for the STMicro LPS27HHW barometer sensor.
|
||||
|
||||
config SENSORS_LTC4151
|
||||
bool "LTC4151 current and voltage monitor"
|
||||
default n
|
||||
|
||||
@@ -112,6 +112,10 @@ ifeq ($(CONFIG_SENSORS_LPS25H),y)
|
||||
CSRCS += lps25h.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_SENSORS_LPS27HHW),y)
|
||||
CSRCS += lps27hhw.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ADXL345_I2C),y)
|
||||
CSRCS += adxl345_i2c.c
|
||||
endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,99 @@
|
||||
/****************************************************************************
|
||||
* include/nuttx/sensors/lps27hhw.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __INCLUDE_NUTTX_SENSORS_LPS27HHW_H
|
||||
#define __INCLUDE_NUTTX_SENSORS_LPS27HHW_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/i2c/i2c_master.h>
|
||||
#include <nuttx/ioexpander/ioexpander.h>
|
||||
|
||||
#ifdef CONFIG_SENSORS_LPS27HHW
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
struct lps27hhw_config_s
|
||||
{
|
||||
uint8_t addr; /* I2C address */
|
||||
int pin; /* Interrupt pin */
|
||||
int freq; /* I2C frequency */
|
||||
FAR struct i2c_master_s *i2c; /* I2C interface */
|
||||
FAR struct ioexpander_dev_s *ioedev; /* Ioexpander device */
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Inline Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: lps27hhw_register
|
||||
*
|
||||
* Description:
|
||||
* Register the LPS27HHW character device as 'devno'
|
||||
*
|
||||
* Input Parameters:
|
||||
* devno - The device number, used to build the device path
|
||||
* as /dev/sensor/baroN
|
||||
* config - The board config function for the device.
|
||||
*
|
||||
* Returned Value:
|
||||
* Return 0 if the driver succeeded; A negated errno
|
||||
* value is returned on any failure.
|
||||
*
|
||||
* Assumptions/Limitations:
|
||||
* None.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int lps27hhw_register(int devno, FAR const struct lps27hhw_config_s *config);
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_SENSORS_LPS27HHW */
|
||||
#endif /* __INCLUDE_NUTTX_SENSORS_LPS27HHW_H */
|
||||
Reference in New Issue
Block a user