forked from xuos/xiuos
add sensor 'TB600B_IAQ10' to sensor framework
This commit is contained in:
@@ -30,6 +30,7 @@ extern int Hs300xHumidityInit(void);
|
||||
extern int Ps5308Pm1_0Init(void);
|
||||
extern int Zg09Co2Init(void);
|
||||
extern int As830Ch4Init(void);
|
||||
extern int Tb600bIaq10IaqInit(void);
|
||||
|
||||
typedef int (*InitFunc)(void);
|
||||
struct InitDesc
|
||||
@@ -94,6 +95,10 @@ static struct InitDesc sensor_desc[] =
|
||||
{ "ch4_as830", As830Ch4Init },
|
||||
#endif
|
||||
|
||||
#ifdef SENSOR_TB600B_IAQ10
|
||||
{ "iaq_tb600b_iaq10", Tb600bIaq10IaqInit },
|
||||
#endif
|
||||
|
||||
{ "NULL", NULL },
|
||||
};
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
45
APP_Framework/Applications/sensor_app/iaq_tb600b_iaq10.c
Normal file
45
APP_Framework/Applications/sensor_app/iaq_tb600b_iaq10.c
Normal 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);
|
||||
}
|
||||
Reference in New Issue
Block a user