当前位置:网站首页>Classic implementation method of Hongmeng system controlling LED
Classic implementation method of Hongmeng system controlling LED
2022-07-05 20:21:00 【St Xiaozhi】
Today I would like to talk with you , How to use the domestic Hongmeng operating system to control led Hardware .
First of all : Introduction to domestic Hongmeng system
Hongmeng system is a new distributed operating system based on micro kernel , Provide a new user experience for all devices and scenarios , And more fluent in scene experience , Support seamless collaboration of devices . It's a whole scene , Future oriented operating systems , It can be installed on mobile phones 、 watch 、 Unmanned aerial vehicles and other equipment .
The development of Hongmeng is divided into two directions , South and North . Northbound mainly refers to application development , Application development has special IDE Tools ; The mainstream development languages used are :java ,js etc. . South direction mainly refers to equipment development , It's based on LiteOS Developed by Microkernel , Lightweight 、 Low power consumption , It can be applied to intelligent devices , And can use soft bus connection .
second : Domestic Hongmeng hardware analysis
Since this is to talk about the control of Hongmeng system lamp , First, let's get to know the corresponding GPIO. Used in this experiment Hi3861 The chip contains GPIO modular . The module can mainly realize the digital input or output function on the chip pin . We know that because machines can only recognize 0 and 1 Digital quantity of , So what we usually say GPIO The input / output state of the port refers to 0 or 1 state , That's what they say 0 For low level ,1 For high level .
How do you feel after reading the schematic diagram above , One word absolutely , Is it very clear
. The analysis is as follows :
J3 It's two rows of needles , By default, it is connected by jumping cap , It is in the on state , Can be regarded as directly connected .LEDI Is the core board programmable LED The lamp , One end of it passes through a row of needles J3 And the master chip GPIO09 Pin connection , The other end passes through a resistor R6 Connect to 3V3 Power Supply .
because LED1 And the master chip GPI009 Pin to pin , So the master chip GPIO09 Pin output different levels can be controlled LED1 The state of . According to the analysis of schematic diagram , Master chip GPI009 Pin status and LED1 The corresponding relationship of the state is low-level lighting , High level off .
Third : Code implementation method
Hongmeng IOT The hardware provides an application programming interface for controlling peripherals , Popular is also legendary API,GPIO Relevant API Function to realize control , The master code is as follows :
#include <stdio.h>
#include <unistd.h>
#include "cmsis_os2.h"
#include "ohos_init.h"
#include "wifiiot_gpio.h"
#include "wifiiot_gpio_ex.h"
#define LED_TASK_STACK_SIZE 1024
#define LED_TASK_PRIO 25
static void* GpioTask(const char* arg)
{
(void)arg;
GpioInit();
IoSetFunc(WIFI_IOT_IO_NAME_GPIO_9, WIFI_IOT_IO_FUNC_GPIO_9_GPIO);
GpioSetDir(WIFI_IOT_IO_NAME_GPIO_9, WIFI_IOT_GPIO_DIR_OUT);
while (1) {
printf(" LED_SPARK! \n");
GpioSetOutputVal(WIFI_IOT_IO_NAME_GPIO_9, WIFI_IOT_GPIO_VALUE0);
osDelay(50);
GpioSetOutputVal(WIFI_IOT_IO_NAME_GPIO_9, WIFI_IOT_GPIO_VALUE1);
osDelay(50);
}
return NULL;
}
static void GpioExampleEntry(void)
{
osThreadAttr_t attr;
attr.name = "GpioTask";
attr.attr_bits = 0U;
attr.cb_mem = NULL;
attr.cb_size = 0U;
attr.stack_mem = NULL;
attr.stack_size = LED_TASK_STACK_SIZE;
attr.priority = LED_TASK_PRIO;
if (osThreadNew((osThreadFunc_t)GpioTask, NULL, &attr) == NULL) {
printf("[GpioExample] Falied to create GpioTask!\n");
}
}
SYS_RUN(GpioExampleEntry);
Write here , I thought it was over , In fact, the long march has just begun
. To make the code work , You also need to configure and compile the system, as shown in the video .
Fourth : Effect demonstration
Hongmeng system
边栏推荐
- Codeforces Round #804 (Div. 2) - A, B, C
- ROS2专题【01】:win10上安装ROS2
- Cocos2d-x项目总结中的一些遇到的问题
- 死信队列入门(两个消费者,一个生产者)
- CCPC 2021威海 - G. Shinyruo and KFC(组合数,小技巧)
- 微信小程序正则表达式提取链接
- 1:引文;
- Leetcode skimming: binary tree 17 (construct binary tree from middle order and post order traversal sequence)
- Practical demonstration: how can the production research team efficiently build the requirements workflow?
- Hong Kong stocks will welcome the "best ten yuan store". Can famous creative products break through through the IPO?
猜你喜欢
A solution to PHP's inability to convert strings into JSON
Rainbow 5.7.1 supports docking with multiple public clouds and clusters for abnormal alarms
【数字IC验证快速入门】3、数字IC设计全流程介绍
B站UP搭建世界首个纯红石神经网络、基于深度学习动作识别的色情检测、陈天奇《机器学编译MLC》课程进展、AI前沿论文 | ShowMeAI资讯日报 #07.05
Leetcode (695) - the largest area of an island
Oracle-表空间管理
物联网智能家居基本方法实现之经典
Leetcode: binary tree 15 (find the value in the lower left corner of the tree)
.Net分布式事務及落地解决方案
【数字IC验证快速入门】9、Verilog RTL设计必会的有限状态机(FSM)
随机推荐
2020 CCPC 威海 - A. Golden Spirit(思维),D. ABC Conjecture(大数分解 / 思维)
leetcode刷题:二叉树12(二叉树的所有路径)
. Net distributed transaction and landing solution
Introduction to dead letter queue (two consumers, one producer)
mongodb/文档操作
【数字IC验证快速入门】1、浅谈数字IC验证,了解专栏内容,明确学习目标
2022年7月4日-2022年7月10日(ue4视频教程mysql)
BZOJ 3747 POI2015 Kinoman 段树
Informatics Olympiad 1338: [example 3-3] hospital setting | Luogu p1364 hospital setting
nprogress插件 进度条
实操演示:产研团队如何高效构建需求工作流?
Wechat applet regular expression extraction link
Zero cloud new UI design
DP: tree DP
mongodb基操的练习
Leetcode skimming: binary tree 10 (number of nodes of a complete binary tree)
Go language learning tutorial (16)
基金网上开户安全吗?去哪里开,可以拿到低佣金?
解决Thinkphp框架应用目录下数据库配置信息修改后依然按默认方式连接
Leetcode(347)——前 K 个高频元素