当前位置:网站首页>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
边栏推荐
- Mysql频繁操作出现锁表问题
- PyTorch 1.12发布,正式支持苹果M1芯片GPU加速,修复众多Bug
- Station B up builds the world's first pure red stone neural network, pornographic detection based on deep learning action recognition, Chen Tianqi's course progress of machine science compilation MLC,
- Leetcode skimming: binary tree 17 (construct binary tree from middle order and post order traversal sequence)
- Y57. Chapter III kubernetes from entry to proficiency -- business image version upgrade and rollback (30)
- How to select the Block Editor? Impression notes verse, notation, flowus
- Informatics Olympiad 1337: [example 3-2] word search tree | Luogu p5755 [noi2000] word search tree
- mongodb/文档操作
- Leetcode(347)——前 K 个高频元素
- [quick start of Digital IC Verification] 7. Basic knowledge of digital circuits necessary for verification positions (including common interview questions)
猜你喜欢
[quick start of Digital IC Verification] 3. Introduction to the whole process of Digital IC Design
1、强化学习基础知识点
CVPR 2022 | 常见3D损坏和数据增强
618 "low key" curtain call, how can baiqiushangmei join hands with the brand to cross the "uncertain era"?
ROS2专题【01】:win10上安装ROS2
[quick start of Digital IC Verification] 6. Quick start of questasim (taking the design and verification of full adder as an example)
[quick start of Digital IC Verification] 7. Basic knowledge of digital circuits necessary for verification positions (including common interview questions)
How to select the Block Editor? Impression notes verse, notation, flowus
信息学奥赛一本通 1339:【例3-4】求后序遍历 | 洛谷 P1827 [USACO3.4] 美国血统 American Heritage
微信小程序正则表达式提取链接
随机推荐
IC科普文:ECO的那些事儿
Go language learning tutorial (16)
关于BRAM IP复位的优先级
document方法
无卷积骨干网络:金字塔Transformer,提升目标检测/分割等任务精度(附源代码)...
Y57. Chapter III kubernetes from entry to proficiency -- business image version upgrade and rollback (30)
信息学奥赛一本通 1339:【例3-4】求后序遍历 | 洛谷 P1827 [USACO3.4] 美国血统 American Heritage
Leetcode (347) - top k high frequency elements
【数字IC验证快速入门】8、数字IC中的典型电路及其对应的Verilog描述方法
js实现禁止网页缩放(Ctrl+鼠标、+、-缩放有效亲测)
Schema and model
Oracle-表空间管理
1: Citation;
Convolution free backbone network: Pyramid transformer to improve the accuracy of target detection / segmentation and other tasks (with source code)
[quick start of Digital IC Verification] 6. Quick start of questasim (taking the design and verification of full adder as an example)
Wechat applet regular expression extraction link
Leetcode brush questions: binary tree 18 (largest binary tree)
Go language | 03 array, pointer, slice usage
618 "low key" curtain call, how can baiqiushangmei join hands with the brand to cross the "uncertain era"?
y57.第三章 Kubernetes从入门到精通 -- 业务镜像版本升级及回滚(三十)