1 /*
2  * Copyright (c) 2022 HiSilicon (Shanghai) Technologies CO., LIMITED.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include <stdio.h>
17 #include <unistd.h>
18 #include "ohos_init.h"
19 #include "cmsis_os2.h"
20 #include "iot_watchdog.h"
21 #include "app_demo_multi_sample.h"
22 
23 #define ENVIRONMENT_TASK_STACK  (1024)
EnvironmentDemo(const char *arg)24 void EnvironmentDemo(const char *arg)
25 {
26     (void)arg;
27     AppMultiSampleDemo();
28     printf("environmental monitoring open ok\r\n");
29     EnvironmentFunc();
30 }
31 
StartTask(void)32 static void StartTask(void)
33 {
34     osThreadAttr_t attr = {0};
35     IoTWatchDogDisable();
36 
37     attr.name = "EnvironmentDemo";
38     attr.attr_bits = 0U;
39     attr.cb_mem = NULL;
40     attr.cb_size = 0U;
41     attr.stack_mem = NULL;
42     attr.stack_size = ENVIRONMENT_TASK_STACK;
43     attr.priority = osPriorityNormal;
44 
45     if (osThreadNew((osThreadFunc_t)EnvironmentDemo, NULL, &attr) == NULL) {
46         printf("[EnvironmentDemo] Failed to create EnvironmentDemo!\n");
47     }
48 }
49 
50 SYS_RUN(StartTask);
51