mirror of
https://github.com/apache/nuttx.git
synced 2026-05-16 05:27:45 +08:00
drivers/sensors: Add support for Telair T6713 carbon dioxide sensor
This commit is contained in:
committed by
Gregory Nutt
parent
ba1f8e5474
commit
5b899b76c4
@@ -477,6 +477,14 @@ config SHT21_DEBUG
|
||||
|
||||
endif # SENSORS_SHT21
|
||||
|
||||
config SENSORS_T67XX
|
||||
bool "Telair T6713 carbon dioxide sensor"
|
||||
default n
|
||||
select I2C
|
||||
---help---
|
||||
Enable driver support for the Telair T6713 and T6703 carbon
|
||||
dioxide sensors.
|
||||
|
||||
config SENSORS_QENCODER
|
||||
bool "Qencoder"
|
||||
default n
|
||||
|
||||
@@ -141,6 +141,10 @@ ifeq ($(CONFIG_SENSORS_SHT21),y)
|
||||
CSRCS += sht21.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_SENSORS_T67XX),y)
|
||||
CSRCS += t67xx.c
|
||||
endif
|
||||
|
||||
endif # CONFIG_I2C
|
||||
|
||||
# These drivers depend on SPI support
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* include/nuttx/sensors/ioctl.h
|
||||
*
|
||||
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2016-2018 Gregory Nutt. All rights reserved.
|
||||
* Author: Alan Carvalho de Assis <acassis@gmail.com>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -155,4 +155,9 @@
|
||||
#define SNIOC_SET_DATA_RATE _SNIOC(0x003e) /* Arg: LIS3DH_ODR_xxx */
|
||||
#define SNIOC_SET_DATA_FORMAT _SNIOC(0x003f) /* Arg: LIS3DH_FORMAT_xxx */
|
||||
|
||||
/* IOCTL commands unique to T67XX */
|
||||
|
||||
#define SNIOC_SPCALIB _SNIOC(0x0040) /* Arg: uint8_t value */
|
||||
#define SNIOC_ABCLOGIC _SNIOC(0x0041) /* Arg: uint8_t value */
|
||||
|
||||
#endif /* __INCLUDE_NUTTX_SENSORS_IOCTL_H */
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
/****************************************************************************
|
||||
* include/nuttx/sensors/t67xx.h
|
||||
*
|
||||
* Copyright (C) 2018 Haltian Ltd. All rights reserved.
|
||||
* Author: Juha Niskanen <juha.niskanen@haltian.com>
|
||||
*
|
||||
* 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 NuttX 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 __INCLUDE_NUTTX_SENSORS_T67XX_H
|
||||
#define __INCLUDE_NUTTX_SENSORS_T67XX_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/sensors/ioctl.h>
|
||||
|
||||
#if defined(CONFIG_I2C) && defined(CONFIG_SENSORS_T67XX)
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define T67XX_I2C_ADDR 0x15
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
struct i2c_master_s;
|
||||
|
||||
struct t67xx_value_s
|
||||
{
|
||||
uint16_t gas_ppm; /* CO2 level, parts per million */
|
||||
bool warming_up; /* Warm-up mode, gas_ppm might be imprecise */
|
||||
bool calibrating; /* Calibration in progress, gas_ppm might be imprecise */
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: t67xx_register
|
||||
*
|
||||
* Description:
|
||||
* Register the T67XX character device as 'devpath'
|
||||
*
|
||||
* Input Parameters:
|
||||
* devpath - The full path to the driver to register. E.g., "/dev/co2_0"
|
||||
* i2c - An instance of the I2C interface to use to communicate with T67XX
|
||||
* addr - The I2C address of the T67XX. For T6713 this is initially 0x15
|
||||
* but it can be changed by the SLAVE ADDRESS command.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) on success; a negated errno value on failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int t67xx_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
|
||||
uint8_t addr);
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_I2C && CONFIG_SENSORS_T67XX */
|
||||
#endif /* __INCLUDE_NUTTX_SENSORS_T67XX_H */
|
||||
Reference in New Issue
Block a user