mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 08:36:24 +08:00
L61: Sensor: Add sensor driver for LSM6DSO.
N/A Add driver for the STMicro LSM6DSO. Change-Id: I462a2912cf8c7f141f285e482c8222bdb854b5ee Signed-off-by: yangjiukui <yangjiukui@xiaomi.com>
This commit is contained in:
@@ -126,6 +126,29 @@ config SENSORS_BMG160
|
||||
---help---
|
||||
Enable driver support for the Bosch BMG160 gyroscope sensor.
|
||||
|
||||
config SENSORS_LSM6DSO
|
||||
bool "STMicro LSM6DSO support"
|
||||
default n
|
||||
select SPI
|
||||
select IOEXPANDER
|
||||
---help---
|
||||
Enable driver support for the STMicro LSM6DSO sensor.
|
||||
|
||||
config SENSORS_LSM6DSO_BUFFER_NUMBER
|
||||
int "The nunmber of circular buffer for sensor LSM6DSO"
|
||||
default 1
|
||||
depends on SENSORS_LSM6DSO
|
||||
---help---
|
||||
The size of the circular buffer used. If the value equal to zero,
|
||||
indicates that the circular buffer is disabled.
|
||||
|
||||
config SENSORS_LSM6DSO_FIFO_SLOTS_NUMBER
|
||||
int "The nunmber of fifo slots for sensor LSM6DSO"
|
||||
default 10
|
||||
depends on SENSORS_LSM6DSO
|
||||
---help---
|
||||
The nunmber of fifo slots for sensor LSM6DSO.
|
||||
|
||||
config SENSORS_OPT3006
|
||||
bool "TI OPT3006 Ambient Light Sensor support"
|
||||
default n
|
||||
|
||||
@@ -124,6 +124,10 @@ ifeq ($(CONFIG_SENSORS_OPT3007),y)
|
||||
CSRCS += opt3007.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_SENSORS_LSM6DSO),y)
|
||||
CSRCS += lsm6dso.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_SENSORS_BMG160),y)
|
||||
CSRCS += bmg160.c
|
||||
endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,95 @@
|
||||
/****************************************************************************
|
||||
* include/nuttx/sensors/lsm6dso.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_LSM6DSO_H
|
||||
#define __INCLUDE_NUTTX_SENSORS_LSM6DSO_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/spi/spi.h>
|
||||
#include <nuttx/spi/spi_transfer.h>
|
||||
#include <nuttx/ioexpander/ioexpander.h>
|
||||
|
||||
#if defined CONFIG_SENSORS_LSM6DSO
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
struct lsm6dso_config_s
|
||||
{
|
||||
int pin; /* Interrupt pin */
|
||||
int freq; /* SPI frequency */
|
||||
uint32_t cs; /* SPI cs pin */
|
||||
FAR struct spi_dev_s *spi; /* SPI 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: lsm6dso_register
|
||||
*
|
||||
* Description:
|
||||
* Register the LSM6DSO character device as 'devpath'
|
||||
*
|
||||
* Input Parameters:
|
||||
* devpath - The full path to the driver to register. E.g., "/dev/accel0"
|
||||
* config - Board config.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) on success; a negated errno value on failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int lsm6dso_register(int devno, FAR const struct lsm6dso_config_s *config);
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_SENSORS_LSM6DSO */
|
||||
#endif /* __INCLUDE_NUTTX_SENSORS_LSM6DSO_H */
|
||||
Reference in New Issue
Block a user