C语言:在3861简单输出情话
虾丿扯淡
发布于 2022-2-14 23:18
浏览
1收藏
C语言:在3861简单输出情话
在applications/sample/wifi-iot/app 新建love文件夹。
新建love.c:
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include "ohos_init.h"
#include "cmsis_os2.h"
#include "wifi_device.h"
#include "iot_gpio.h"
#include "iot_errno.h"
#include "hi_io.h"
#define LED_INTERVAL_TIME_US 300000
void *ConnectDemo(void *arg)
{
(void)arg;
printf("start love mode \n");
printf("I like you. Like the wind walk eight miles, don't ask, don't return \n");
while(1)
{
usleep(LED_INTERVAL_TIME_US);
}
}
void MainFunction(void)
{
osThreadAttr_t attr;
attr.name="ConnectDemo";
attr.attr_bits = 0U;
attr.cb_mem = NULL;
attr.cb_size = 0U;
attr.stack_mem = NULL;
attr.stack_size = 4096;
attr.priority = 36;
if(osThreadNew((osThreadFunc_t)ConnectDemo,NULL,&attr)==NULL){
printf("[ConnectDemo] Failed Falied to create\n");
}
//while(1);
}
SYS_RUN(MainFunction);
# Copyright (c) 2020 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
static_library("lovestart") {
sources = [
"love.c",
]
include_dirs = [
"//utils/native/lite/include",
"//kernel/liteos_m/kal/cmsis",
"//base/iot_hardware/peripheral/interfaces/kits",
"//foundation/communication/wifi/interfaces/innerkits/native_c/",
"//device/hisilicon/hispark_pegasus/sdk_liteos/include",
"//third_party/cJSON/",
"//device/hisilicon/hispark_pegasus/sdk_liteos/third_party/lwip_sack/include/lwip",
]
}
app目录下BUILD.gn中添加编译:“love:lovestart”,
编译后烧录,打开串口工具,复位后收到串口打印。
“我爱你。向风吹了8千里,不问归期”
水平不佳,请嘴下留情。
#【情人节】代码SHOW出你的爱#
已于2022-2-14 23:19:13修改
赞
6
收藏 1
回复
相关推荐
来了来了
eight miles = 八千里?
姑娘可能会觉得你这人喜欢吹牛,不靠谱。
厉害了,参与的活动在这里#【情人节】代码SHOW出你的爱#
突然发现少了个千。