sync upstream branch and add 'as830' sensor of ch4
This commit is contained in:
@@ -5,6 +5,16 @@ menu "sensor app"
|
||||
default n
|
||||
|
||||
if APPLICATION_SENSOR
|
||||
menuconfig APPLICATION_SENSOR_CH4
|
||||
bool "Using sensor CH4 apps"
|
||||
default n
|
||||
|
||||
if APPLICATION_SENSOR_CH4
|
||||
config APPLICATION_SENSOR_CH4_AS830
|
||||
bool "Using sensor AS830 apps"
|
||||
default n
|
||||
endif
|
||||
|
||||
menuconfig APPLICATION_SENSOR_CO2
|
||||
bool "Using sensor CO2 apps"
|
||||
default n
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
SRC_FILES :=
|
||||
|
||||
ifeq ($(CONFIG_APPLICATION_SENSOR_CH4_AS830), y)
|
||||
SRC_FILES += ch4_as830.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_APPLICATION_SENSOR_CO2_ZG09), y)
|
||||
SRC_FILES += co2_zg09.c
|
||||
endif
|
||||
|
||||
34
APP_Framework/Applications/sensor_app/ch4_as830.c
Normal file
34
APP_Framework/Applications/sensor_app/ch4_as830.c
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* 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 ch4_as830.c
|
||||
* @brief CH4 AS830 example
|
||||
* @version 1.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2021.12.10
|
||||
*/
|
||||
|
||||
#include <user_api.h>
|
||||
#include <sensor.h>
|
||||
|
||||
/**
|
||||
* @description: Read a ch4
|
||||
* @return 0
|
||||
*/
|
||||
void Ch4As830(void)
|
||||
{
|
||||
struct SensorQuantity *ch4 = SensorQuantityFind(SENSOR_QUANTITY_AS830_CH4, SENSOR_QUANTITY_CH4);
|
||||
SensorQuantityOpen(ch4);
|
||||
printf("CH4 : %d %%LTL\n", SensorQuantityRead(ch4));
|
||||
SensorQuantityClose(ch4);
|
||||
}
|
||||
Reference in New Issue
Block a user