forked from xuos/xiuos
delete original app contents of xiuos
This commit is contained in:
23
APP_Framework/Applications/sensor_app/Makefile
Normal file
23
APP_Framework/Applications/sensor_app/Makefile
Normal file
@@ -0,0 +1,23 @@
|
||||
SRC_FILES :=
|
||||
|
||||
ifeq ($(CONFIG_APPLICATION_SENSOR_CO2_ZG09), y)
|
||||
SRC_FILES += co2_zg09.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_APPLICATION_SENSOR_PM1_0_PS5308), y)
|
||||
SRC_FILES += pm1_0_ps5308.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_APPLICATION_SENSOR_VOICE_D124), y)
|
||||
SRC_FILES += voice_d124.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_APPLICATION_SENSOR_HUMIDITY_HS300X), y)
|
||||
SRC_FILES += humidity_hs300x.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_APPLICATION_SENSOR_TEMPERATURE_HS300X), y)
|
||||
SRC_FILES += temperature_hs300x.c
|
||||
endif
|
||||
|
||||
include $(KERNEL_ROOT)/compiler.mk
|
||||
34
APP_Framework/Applications/sensor_app/co2_zg09.c
Normal file
34
APP_Framework/Applications/sensor_app/co2_zg09.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 co2_zg09.c
|
||||
* @brief ZG09 CO2 example
|
||||
* @version 1.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2021.04.23
|
||||
*/
|
||||
|
||||
#include <user_api.h>
|
||||
#include <sensor.h>
|
||||
|
||||
/**
|
||||
* @description: Read a CO2
|
||||
* @return 0
|
||||
*/
|
||||
void Co2Zg09(void)
|
||||
{
|
||||
struct SensorQuantity *co2 = SensorQuantityFind(SENSOR_QUANTITY_ZG09_CO2, SENSOR_QUANTITY_CO2);
|
||||
SensorQuantityOpen(co2);
|
||||
printf("CO2 : %d ppm\n", SensorQuantityRead(co2));
|
||||
SensorQuantityClose(co2);
|
||||
}
|
||||
35
APP_Framework/Applications/sensor_app/humidity_hs300x.c
Normal file
35
APP_Framework/Applications/sensor_app/humidity_hs300x.c
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* 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 humidity_hs300x.c
|
||||
* @brief HS300x humidity example
|
||||
* @version 1.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2021.04.23
|
||||
*/
|
||||
|
||||
#include <user_api.h>
|
||||
#include <sensor.h>
|
||||
|
||||
/**
|
||||
* @description: Read a himidity
|
||||
* @return 0
|
||||
*/
|
||||
void HumiHs300x(void)
|
||||
{
|
||||
struct SensorQuantity *humi = SensorQuantityFind(SENSOR_QUANTITY_HS300X_HUMIDITY, SENSOR_QUANTITY_HUMI);
|
||||
SensorQuantityOpen(humi);
|
||||
int32 humidity = SensorQuantityRead(humi);
|
||||
printf("Humidity : %d.%d %%RH\n", humidity/10, humidity%10);
|
||||
SensorQuantityClose(humi);
|
||||
}
|
||||
35
APP_Framework/Applications/sensor_app/pm1_0_ps5308.c
Normal file
35
APP_Framework/Applications/sensor_app/pm1_0_ps5308.c
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (c) 2020 AIIT XUOS Lab
|
||||
* XiOS 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 pm1_0_ps5308.c
|
||||
* @brief PS5308 PM1.0 example
|
||||
* @version 1.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2021.04.23
|
||||
*/
|
||||
|
||||
#include <user_api.h>
|
||||
#include <sensor.h>
|
||||
|
||||
/**
|
||||
* @description: Read a PM1.0
|
||||
* @return 0
|
||||
*/
|
||||
void Pm10Ps5308(void)
|
||||
{
|
||||
struct SensorQuantity *pm1_0 = SensorQuantityFind(SENSOR_QUANTITY_PS5308_PM1_0, SENSOR_QUANTITY_PM);
|
||||
SensorQuantityOpen(pm1_0);
|
||||
UserTaskDelay(2000);
|
||||
printf("PM1.0 : %d ug/m³\n", SensorQuantityRead(pm1_0));
|
||||
SensorQuantityClose(pm1_0);
|
||||
}
|
||||
38
APP_Framework/Applications/sensor_app/temperature_hs300x.c
Normal file
38
APP_Framework/Applications/sensor_app/temperature_hs300x.c
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* 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 temperature_hs300x.c
|
||||
* @brief HS300x temperature example
|
||||
* @version 1.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2021.04.23
|
||||
*/
|
||||
|
||||
#include <user_api.h>
|
||||
#include <sensor.h>
|
||||
|
||||
/**
|
||||
* @description: Read a temperature
|
||||
* @return 0
|
||||
*/
|
||||
void TempHs300x(void)
|
||||
{
|
||||
struct SensorQuantity *temp = SensorQuantityFind(SENSOR_QUANTITY_HS300X_TEMPERATURE, SENSOR_QUANTITY_TEMP);
|
||||
SensorQuantityOpen(temp);
|
||||
int32 temperature = SensorQuantityRead(temp);
|
||||
if (temperature > 0)
|
||||
printf("Temperature : %d.%d ℃\n", temperature/10, temperature%10);
|
||||
else
|
||||
printf("Temperature : %d.%d ℃\n", temperature/10, -temperature%10);
|
||||
SensorQuantityClose(temp);
|
||||
}
|
||||
36
APP_Framework/Applications/sensor_app/voice_d124.c
Normal file
36
APP_Framework/Applications/sensor_app/voice_d124.c
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (c) 2020 AIIT XUOS Lab
|
||||
* XiOS 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 voice_d124.c
|
||||
* @brief D124 voice example
|
||||
* @version 1.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2021.04.23
|
||||
*/
|
||||
|
||||
#include <user_api.h>
|
||||
#include <sensor.h>
|
||||
|
||||
/**
|
||||
* @description: Read a voice
|
||||
* @return 0
|
||||
*/
|
||||
void VoiceD124(void)
|
||||
{
|
||||
struct SensorQuantity *voice = SensorQuantityFind(SENSOR_QUANTITY_D124_VOICE, SENSOR_QUANTITY_VOICE);
|
||||
SensorQuantityOpen(voice);
|
||||
UserTaskDelay(2000);
|
||||
uint16 result = SensorQuantityRead(voice);
|
||||
printf("voice : %d.%d dB\n", result/(10*voice->value.decimal_places), result%(10*voice->value.decimal_places));
|
||||
SensorQuantityClose(voice);
|
||||
}
|
||||
Reference in New Issue
Block a user