add iaq10 sensor support Nuttx

This commit is contained in:
wgzAIIT
2022-01-05 15:40:01 +08:00
parent 711bd5bd15
commit 1f252e418f
10 changed files with 68 additions and 3 deletions

View File

@@ -18,7 +18,9 @@
* @date 2021.12.14
*/
#include <user_api.h>
#ifdef ADD_XIUOS_FETURES
# include <user_api.h>
#endif
#include <sensor.h>
// struct iaq_data {

View File

@@ -34,6 +34,11 @@ config SENSOR_TB600B_IAQ10
endif
if ADD_NUTTX_FETURES
config SENSOR_DEVICE_TB600B_IAQ10_DEV
string "tb600b iaq10 device uart path"
default "/dev/ttyS1"
---help---
If USART1 is selected, then fill in /dev/ttyS1 here.
endif

View File

@@ -0,0 +1,4 @@
############################################################################
# APP_Framework/Framework/sensor/iaq/Make.defs
############################################################################
include $(wildcard $(APPDIR)/../../../APP_Framework/Framework/sensor/iaq/*/Make.defs)

View File

@@ -0,0 +1,6 @@
############################################################################
# APP_Framework/Framework/sensor/iaq/tb600b_iaq10/Make.defs
############################################################################
ifneq ($(CONFIG_SENSOR_TB600B_IAQ10),)
CONFIGURED_APPS += $(APPDIR)/../../../APP_Framework/Framework/sensor/iaq/tb600b_iaq10
endif

View File

@@ -1,3 +1,12 @@
SRC_FILES := tb600b_iaq10.c
include $(KERNEL_ROOT)/.config
ifeq ($(CONFIG_ADD_NUTTX_FETURES),y)
include $(APPDIR)/Make.defs
CSRCS += tb600b_iaq10.c
include $(APPDIR)/Application.mk
endif
include $(KERNEL_ROOT)/compiler.mk
ifeq ($(CONFIG_ADD_XIUOS_FETURES),y)
SRC_FILES := tb600b_iaq10.c
include $(KERNEL_ROOT)/compiler.mk
endif

View File

@@ -43,6 +43,17 @@ static struct SensorProductInfo info =
* @param sdev - sensor device pointer
* @return success: 1 , failure: other
*/
#ifdef ADD_NUTTX_FETURES
static int SensorDeviceOpen(struct SensorDevice *sdev)
{
sdev->fd = PrivOpen(SENSOR_DEVICE_TB600B_IAQ10_DEV, O_RDWR);
if (sdev->fd < 0) {
printf("open %s error\n", SENSOR_DEVICE_TB600B_IAQ10_DEV);
}
return sdev->fd;
}
#else
static int SensorDeviceOpen(struct SensorDevice *sdev)
{
int result = 0;
@@ -73,6 +84,7 @@ static int SensorDeviceOpen(struct SensorDevice *sdev)
return result;
}
#endif
/**
* @description: Read sensor device