add 'TB600B_WQ_HCHO1OS' sensor of hcho to sensor framework

This commit is contained in:
Wang_Weigen
2021-12-15 16:28:51 +08:00
parent 19edea21d7
commit db225df433
11 changed files with 343 additions and 0 deletions
@@ -5,6 +5,16 @@ menu "sensor app"
default n
if APPLICATION_SENSOR
menuconfig APPLICATION_SENSOR_HCHO
bool "Using sensor HCHO apps"
default n
if APPLICATION_SENSOR_HCHO
config APPLICATION_SENSOR_HCHO_TB600B_WQ_HCHO1OS
bool "Using sensor TB600B_WQ_HCHO1OS apps"
default n
endif
menuconfig APPLICATION_SENSOR_TVOC
bool "Using sensor TVOC apps"
default n
@@ -1,5 +1,9 @@
SRC_FILES :=
ifeq ($(CONFIG_APPLICATION_SENSOR_HCHO_TB600B_WQ_HCHO1OS), y)
SRC_FILES += hcho_tb600b_wq_hcho1os.c
endif
ifeq ($(CONFIG_APPLICATION_SENSOR_TVOC_TB600B_TVOC10), y)
SRC_FILES += tvoc_tb600b_tvoc10.c
endif
@@ -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 hcho_tb600b_wq_hcho1os.c
* @brief hcho example
* @version 1.0
* @author AIIT XUOS Lab
* @date 2021.12.15
*/
#include <user_api.h>
#include <sensor.h>
/**
* @description: Read a hcho
* @return 0
*/
void HchoTb600bHcho1os(void)
{
struct SensorQuantity *hcho = SensorQuantityFind(SENSOR_QUANTITY_TB600B_HCHO, SENSOR_QUANTITY_HCHO);
SensorQuantityOpen(hcho);
int32_t result = 0;
result = SensorQuantityRead(hcho);
printf("tvoc concentration is : %dppb\n", result);
SensorQuantityClose(hcho);
}