add sensor 'TB600B_IAQ10' to sensor framework

This commit is contained in:
Wang_Weigen
2021-12-15 11:10:56 +08:00
parent 4a8ac7c02b
commit 856edb7ec6
11 changed files with 363 additions and 0 deletions

View File

@@ -5,6 +5,16 @@ menu "sensor app"
default n
if APPLICATION_SENSOR
menuconfig APPLICATION_SENSOR_IAQ
bool "Using sensor IAQ apps"
default n
if APPLICATION_SENSOR_IAQ
config APPLICATION_SENSOR_IAQ_TB600B_IAQ10
bool "Using sensor TB600B_IAQ10 apps"
default n
endif
menuconfig APPLICATION_SENSOR_CH4
bool "Using sensor CH4 apps"
default n

View File

@@ -1,5 +1,9 @@
SRC_FILES :=
ifeq ($(CONFIG_APPLICATION_SENSOR_IAQ_TB600B_IAQ10), y)
SRC_FILES += iaq_tb600b_iaq10.c
endif
ifeq ($(CONFIG_APPLICATION_SENSOR_CH4_AS830), y)
SRC_FILES += ch4_as830.c
endif

View File

@@ -0,0 +1,45 @@
/*
* Copyright (c) 2020 AIIT XUOS Lab
* XiUOS is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
*/
/**
* @file iaq_tb600b_iaq10.c
* @brief iaq10 example
* @version 1.0
* @author AIIT XUOS Lab
* @date 2021.12.14
*/
#include <user_api.h>
#include <sensor.h>
// struct iaq_data {
// uint16_t gas;
// uint8_t TH;
// uint8_t TL;
// uint8_t RhH;
// uint8_t RhL;
// };
/**
* @description: Read a iaq
* @return 0
*/
void IaqTb600bIaq10(void)
{
struct SensorQuantity *iaq = SensorQuantityFind(SENSOR_QUANTITY_TB600B_IAQ, SENSOR_QUANTITY_IAQ);
SensorQuantityOpen(iaq);
int32_t result = 0;
result = SensorQuantityRead(iaq);
printf("Gas concentration is : %dppb\n", result);
SensorQuantityClose(iaq);
}