mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 08:36:24 +08:00
Feature: Seneor: Add sx9373 capacitive sensor driver.
N/A Add sx9373 capacitive sensor driver for nuttx. Change-Id: I7179633ac0ea5c9f073ddc13b50b442997e4a2c2 Signed-off-by: xiatian6 <xiatian6@xiaomi.com>
This commit is contained in:
@@ -77,6 +77,21 @@ config SENSORS_AK09919C_BUFFER_NUMBER
|
||||
The number of the circular buffer used. If the value equal to zero,
|
||||
indicates that the circular buffer is disabled.
|
||||
|
||||
config SENSORS_SX9373
|
||||
bool "Semtech SX9373 Capacitive Sensor"
|
||||
default n
|
||||
select I2C
|
||||
---help---
|
||||
Enable driver for SX9373 Capacitive Sensor.
|
||||
|
||||
config SENSORS_SX9373_BUFFER_NUMBER
|
||||
int "The nunmber of circular buffer for sensor SX9373"
|
||||
default 1
|
||||
depends on SENSORS_SX9373
|
||||
---help---
|
||||
The number of the circular buffer used. If the value equal to zero,
|
||||
indicates that the circular buffer is disabled.
|
||||
|
||||
config SENSORS_AS5048B
|
||||
bool "AMS AS5048B Magnetic Rotary Encoder support"
|
||||
default n
|
||||
|
||||
@@ -60,6 +60,10 @@ ifeq ($(CONFIG_SENSORS_AK09919C),y)
|
||||
CSRCS += ak09919c.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_SENSORS_SX9373),y)
|
||||
CSRCS += sx9373.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_SENSORS_AS5048B),y)
|
||||
CSRCS += as5048b.c
|
||||
endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,88 @@
|
||||
/****************************************************************************
|
||||
* include/nuttx/sensors/sx9373.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_SX9373_H
|
||||
#define __INCLUDE_NUTTX_SENSORS_SX9373_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/i2c/i2c_master.h>
|
||||
#include <nuttx/ioexpander/ioexpander.h>
|
||||
|
||||
#if defined(CONFIG_I2C) && defined(CONFIG_SENSORS_SX9373)
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
struct sx9373_config_s
|
||||
{
|
||||
uint8_t addr; /* I2C address. */
|
||||
int freq; /* I2C frequency. */
|
||||
int pin; /* Interrupt pin. */
|
||||
FAR struct i2c_master_s *i2c; /* I2C interface. */
|
||||
FAR struct ioexpander_dev_s *ioe; /* Ioexpander device. */
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sx9373_register
|
||||
*
|
||||
* Description:
|
||||
* Register the SX9373 character device as 'devpath'.
|
||||
*
|
||||
* Input Parameters:
|
||||
* devno - The device number, used to build the device path
|
||||
* as /dev/sensor/proxN
|
||||
* config - configuration for the sx9373 driver. For details see
|
||||
* description above.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) on success; a negated errno value on failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int sx9373_register(int devno, FAR const struct sx9373_config_s *config);
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_I2C && CONFIG_SX9373 */
|
||||
#endif /* __INCLUDE_NUTTX_SENSORS_SX9373_H */
|
||||
Reference in New Issue
Block a user