forked from xuos/xiuos
add 'TB600B_TVOC10' sensor of tvoc to sensor framework
This commit is contained in:
@@ -5,6 +5,16 @@ menu "sensor app"
|
||||
default n
|
||||
|
||||
if APPLICATION_SENSOR
|
||||
menuconfig APPLICATION_SENSOR_TVOC
|
||||
bool "Using sensor TVOC apps"
|
||||
default n
|
||||
|
||||
if APPLICATION_SENSOR_TVOC
|
||||
config APPLICATION_SENSOR_TVOC_TB600B_TVOC10
|
||||
bool "Using sensor TB600B_TVOC10 apps"
|
||||
default n
|
||||
endif
|
||||
|
||||
menuconfig APPLICATION_SENSOR_IAQ
|
||||
bool "Using sensor IAQ apps"
|
||||
default n
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
SRC_FILES :=
|
||||
|
||||
ifeq ($(CONFIG_APPLICATION_SENSOR_TVOC_TB600B_TVOC10), y)
|
||||
SRC_FILES += tvoc_tb600b_tvoc10.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_APPLICATION_SENSOR_IAQ_TB600B_IAQ10), y)
|
||||
SRC_FILES += iaq_tb600b_iaq10.c
|
||||
endif
|
||||
|
||||
39
APP_Framework/Applications/sensor_app/tvoc_tb600b_tvoc10.c
Normal file
39
APP_Framework/Applications/sensor_app/tvoc_tb600b_tvoc10.c
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* 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 tvoc_tb600b_tvoc10.c
|
||||
* @brief tvoc10 example
|
||||
* @version 1.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2021.12.15
|
||||
*/
|
||||
|
||||
#include <user_api.h>
|
||||
#include <sensor.h>
|
||||
|
||||
|
||||
/**
|
||||
* @description: Read a tvoc
|
||||
* @return 0
|
||||
*/
|
||||
void TvocTb600bTvoc10(void)
|
||||
{
|
||||
struct SensorQuantity *tvoc = SensorQuantityFind(SENSOR_QUANTITY_TB600B_TVOC, SENSOR_QUANTITY_TVOC);
|
||||
SensorQuantityOpen(tvoc);
|
||||
int32_t result = 0;
|
||||
|
||||
result = SensorQuantityRead(tvoc);
|
||||
|
||||
printf("tvoc concentration is : %dppb\n", result);
|
||||
SensorQuantityClose(tvoc);
|
||||
}
|
||||
Reference in New Issue
Block a user