当前位置: 首页 > news >正文

提卡的网站怎么做学习软件的网站

提卡的网站怎么做,学习软件的网站,自建网站平台,四川政务服务网本篇实现对gpio的控制,通过控制输出进行gpio的点灯操作。 硬件 我们来操作IO2,控制绿色的灯。 软件 GPIO API API名称 说明 hi_u32 hi_gpio_deinit(hi_void); GPIO模块初始化 hi_u32 hi_io_set_pull(hi_io_name id, hi_io_pull val); 设置某个IO…

本篇实现对gpio的控制,通过控制输出进行gpio的点灯操作。

硬件

我们来操作IO2,控制绿色的灯。

软件

GPIO API

API名称

说明

hi_u32 hi_gpio_deinit(hi_void);

GPIO模块初始化

hi_u32 hi_io_set_pull(hi_io_name id, hi_io_pull val);

设置某个IO上下拉功能。

hi_u32 hi_gpio_set_dir(hi_gpio_idx id, hi_gpio_dir dir);

设置GPIO引脚方向,id参数用于指定引脚,dir参数用于指定输入或输出

hi_u32 hi_gpio_set_ouput_val(hi_gpio_idx id, hi_gpio_value val);

设置GPIO引脚的输出状态,id参数用于指定引脚,val参数用于指定高电平或低电平

hi_u32 hi_io_set_func(hi_io_name id, hi_u8 val);

设置引脚功能,id参数用于指定引脚,val用于指定引脚功能

hi_u32 hi_gpio_deinit(hi_void);

解除GPIO模块初始化

修改D:\DevEcoProjects\test\src\vendor\rtplay\rt_hi3861\demo\BUILD.gn文件,让工程编译led代码

# Copyright (c) 2023 Beijing HuaQing YuanJian Education Technology 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. import("//build/lite/config/component/lite_component.gni")lite_component("demo") {features = ["base_01_led:base_led_example",]
}

创建D:\DevEcoProjects\test\src\vendor\rtplay\rt_hi3861\demo\base_01_led文件夹

文件夹中创建D:\DevEcoProjects\test\src\vendor\rtplay\rt_hi3861\demo\base_01_led\base_led_example.c文件D:\DevEcoProjects\test\src\vendor\rtplay\rt_hi3861\demo\base_01_led\BUILD.gn文件

# Copyright (c) 2023 Beijing HuaQing YuanJian Education Technology 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("base_led_example") {sources = ["base_led_example.c",]include_dirs = ["//utils/native/lite/include","//kernel/liteos_m/kal/cmsis","//base/iot_hardware/peripheral/interfaces/kits","//vendor/hqyj/fs_hi3861/common/bsp/include"]
}
/** Copyright (c) 2023 Beijing HuaQing YuanJian Education Technology 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.*/#include <stdio.h>
#include <unistd.h>#include "cmsis_os2.h"
#include "hi_gpio.h"
#include "hi_io.h"
#include "ohos_init.h"#define LED HI_IO_NAME_GPIO_2  // 开发板三色灯其中一个引脚osThreadId_t Task1_ID = 0;    //  任务1 ID
hi_gpio_value val, val_last;  // GPIO的状态值
#define TASK_STACK_SIZE 1024
#define TASK_DELAY_TIME (1000 * 1000)/*** @description: 任务1* @param {*}* @return {*}*/
void Task1(void)
{printf("enter Task 1.......\r\n");hi_gpio_init();                               // GPIO初始化hi_io_set_pull(LED, HI_IO_PULL_DOWN);         // 设置GPIO下拉,保证上电时为灭灯状态hi_io_set_func(LED, HI_IO_FUNC_GPIO_2_GPIO);  // 设置IO2为GPIO功能hi_gpio_set_dir(LED, HI_GPIO_DIR_OUT);        // 设置GPIO为输入模式while (1) {hi_gpio_set_ouput_val(LED, HI_GPIO_VALUE0);  // 设置GPIO引脚为低电平usleep(TASK_DELAY_TIME);                      // 1s sleephi_gpio_set_ouput_val(LED, HI_GPIO_VALUE1);  // 设置GPIO引脚为高电平usleep(TASK_DELAY_TIME);                      // 1s sleep}
}/*** @description: 初始化并创建任务* @param {*}* @return {*}*/
static void base_led_demo(void)
{printf("[demo] Enter base_led_demo()!\r\n");osThreadAttr_t taskOptions;taskOptions.name = "Task1";                // 任务的名字taskOptions.attr_bits = 0;                 // 属性位taskOptions.cb_mem = NULL;                 // 堆空间地址taskOptions.cb_size = 0;                   // 堆空间大小taskOptions.stack_mem = NULL;              // 栈空间地址taskOptions.stack_size = TASK_STACK_SIZE;  // 栈空间大小 单位:字节taskOptions.priority = osPriorityNormal;   // 任务的优先级:wqTask1_ID = osThreadNew((osThreadFunc_t)Task1, NULL, &taskOptions);  // 创建任务1if (Task1_ID != NULL) {printf("ID = %d, Create Task1_ID is OK!\r\n", Task1_ID);}
}
SYS_RUN(base_led_demo);

目录结构

│  config.json
│
├─common
│  └─bsp
│      ├─include
│      └─src
├─demo
│  │  BUILD.gn
│  │
│  ├─base_00_helloworld
│  │      base_helloworld_example.c
│  │      BUILD.gn
│  │
│  └─base_01_led
│          base_led_example.c
│          BUILD.gn
│
└─doc│  HarmonyOS开发板实验指导书 v2.1.pdf│  华清远见 FS_Hi3861开发指导.md│  华清远见 FS_Hi3861新手入门手册.md│├─board│      FS-Hi3861-V4.2.pdf│      FS-Hi3861QDB-V3.2.pdf│      hi-12f_kit_v1.1.0A7E6BCB9%A6-20211025.pdf│      hi-12f_v1.1.2-A7E6BCB9%A6-20211202.pdf│      nodemcu-hi-07s_12f-kit_v1.1-20210913.pdf│      RTplay2.01_2024-06-14.pdf│└─figures

使用build

效果就是LED间隔1秒闪烁。

http://www.mmbaike.com/news/31570.html

相关文章:

  • dw怎么做网站相册seo外链工具
  • 做优化的网站电话简单的网页设计
  • 燕郊做网站找谁关键词林俊杰歌词
  • 海洋承德网站建设公司广告发布平台app
  • 北京网站建设在线接app推广接单平台
  • 中英文外贸网站模板企业营销管理
  • 电子商务网站建设pdf最新军事报道
  • 深圳网站设计 建设元seo收索引擎优化
  • 西部数据网站管理助手如何免费注册网站
  • 湛江网站建设工作爱链接购买链接
  • 品牌推广的三个阶段网站seo网络优化
  • 北京商城网站开发衡阳seo外包
  • 网站设计怎么做深圳华强北新闻最新消息今天
  • 做淘客网站备案优化设计官网
  • 京津新城建设管委会网站优化推广seo
  • 又拍网站怎么做的最新的全国疫情数据
  • 上海网商电子商务有限公司网站推广seo教程
  • 建电子商务网站注意事项江苏网站建设推广
  • 北京网站制作的最新新闻事件
  • 泰安中文网站建设电话sem和seo
  • 网站设计摘要 优帮云seo优化对网店的推广的作用为
  • 网站开发是自己开发还是外包的seo搜索引擎优化包邮
  • 微信公众号开发者中心在哪里seo关键词排名价格
  • 房产机构网站建设目标定位网站制作公司有哪些
  • wix做网站的建议盐城网站优化
  • 企业网站建设排名推荐国外网站如何搭建网页
  • 外贸网站建设公司咨询seo服务的内容
  • 金华市网站建设最低价国外电商平台有哪些
  • 成都网站营销seo电话百度的网址怎么写
  • 上海互联网网站建设广告投放网站平台