当前位置:网站首页>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 25static 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
边栏推荐
- Leetcode brush question: binary tree 14 (sum of left leaves)
- [C language] merge sort
- 【数字IC验证快速入门】1、浅谈数字IC验证,了解专栏内容,明确学习目标
- Bzoj 3747 poi2015 kinoman segment tree
- 19 mongoose modularization
- Informatics Orsay all in one 1339: [example 3-4] find the post order traversal | Valley p1827 [usaco3.4] American Heritage
- Unity editor extended UI control
- [C language] three implementations of quick sorting and optimization details
- c語言oj得pe,ACM入門之OJ~
- 【c语言】归并排序
猜你喜欢

Oracle-表空间管理

A way to calculate LNX

Leetcode: binary tree 15 (find the value in the lower left corner of the tree)

CVPR 2022 | 常见3D损坏和数据增强

Convolution free backbone network: Pyramid transformer to improve the accuracy of target detection / segmentation and other tasks (with source code)

Practical demonstration: how can the production research team efficiently build the requirements workflow?

Rainbow 5.7.1 supports docking with multiple public clouds and clusters for abnormal alarms
![[quick start of Digital IC Verification] 7. Basic knowledge of digital circuits necessary for verification positions (including common interview questions)](/img/90/aad9d7900d686efca10140717a5c5c.png)
[quick start of Digital IC Verification] 7. Basic knowledge of digital circuits necessary for verification positions (including common interview questions)

.Net分布式事务及落地解决方案

A solution to PHP's inability to convert strings into JSON
随机推荐
Go language | 03 array, pointer, slice usage
无卷积骨干网络:金字塔Transformer,提升目标检测/分割等任务精度(附源代码)...
leetcode刷题:二叉树12(二叉树的所有路径)
港股将迎“最牛十元店“,名创优品能借IPO突围?
Summer Challenge harmonyos - realize message notification function
sort和投影
leetcode刷题:二叉树11(平衡二叉树)
[quick start of Digital IC Verification] 9. Finite state machine (FSM) necessary for Verilog RTL design
【数字IC验证快速入门】9、Verilog RTL设计必会的有限状态机(FSM)
零道云新UI设计中
1: Citation;
ICTCLAS word Lucene 4.9 binding
Y57. Chapter III kubernetes from entry to proficiency -- business image version upgrade and rollback (30)
Convolution free backbone network: Pyramid transformer to improve the accuracy of target detection / segmentation and other tasks (with source code)
2022年7月4日-2022年7月10日(ue4视频教程mysql)
A solution to PHP's inability to convert strings into JSON
Leetcode skimming: binary tree 16 (path sum)
Go language | 02 for loop and the use of common functions
CCPC 2021威海 - G. Shinyruo and KFC(组合数,小技巧)
【数字IC验证快速入门】6、Questasim 快速上手使用(以全加器设计与验证为例)