-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsearch.xml
More file actions
89 lines (42 loc) · 8.36 KB
/
search.xml
File metadata and controls
89 lines (42 loc) · 8.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<?xml version="1.0" encoding="utf-8"?>
<search>
<entry>
<title>单片机可复用编程框架-总纲01</title>
<link href="/2019/12/05/dan-pian-ji-ke-fu-yong-bian-cheng-kuang-jia-zong-gang-01/"/>
<url>/2019/12/05/dan-pian-ji-ke-fu-yong-bian-cheng-kuang-jia-zong-gang-01/</url>
<content type="html"><![CDATA[<h2 id="背景"><a href="#背景" class="headerlink" title="背景"></a>背景</h2><p>相信大家都会有这样的体验,自己写过很多代码,但是代码的可重用性不高。 当接触新的项目时,要在之前的工程上做许多改动,关键的问题是还可能因为疏忽,导致程序存在一些隐性的bug,给后期产品的稳定运行埋下了隐患。基于此,我想寻求一种比较合理的软件架构来减少代码的耦合性,提高模块的复用性和可维护性。我将要讨论的软件架构是基于单片机裸机,因为带操作系统的,系统已经帮我们解决了这部分问题。</p><h2 id="理想的目标"><a href="#理想的目标" class="headerlink" title="理想的目标"></a>理想的目标</h2><h3 id="1-系统分层架构"><a href="#1-系统分层架构" class="headerlink" title="1. 系统分层架构"></a>1. 系统分层架构</h3><ul><li>驱动层<ul><li>提供硬件的基本操作,如gpio口电平设置,电平翻转等接口</li></ul></li><li>适配层<ul><li>适配层的作用是根据应用层的通用接口,匹配到底层的驱动代码</li></ul></li><li>抽象接口层<ul><li>抽象接口层提供便于理解的通用接口,用户只需要传入必要的参数,就可以自动完成对底层硬件的控制和访问。</li></ul></li><li>应用层<ul><li>应用层专注于业务逻辑的实现,需要系统实现相关功能时,调用抽象接口层的函数。</li></ul></li></ul><h3 id="2-系统代码组成"><a href="#2-系统代码组成" class="headerlink" title="2. 系统代码组成"></a>2. 系统代码组成</h3><ul><li><p>配置文件</p><ul><li>系统剪裁 </li><li>功能配置 (如系统打印串口选择用哪个串口、系统时钟用内部的还是外部的)</li><li>常量配置 (如系统时钟频率、串口波特率等) </li></ul></li><li><p>驱动文件</p><ul><li>时钟配置<ul><li>gpio驱动</li><li>串口驱动</li><li>看门狗驱动</li><li>定时器驱动</li><li>I2C驱动(软件方式/硬件方式)</li><li>SPI驱动</li><li>FLASH驱动 (sfud 通用驱动)</li><li>EEPROM驱动</li><li>RTC驱动</li><li>低功耗配置</li></ul></li></ul></li><li><p>适配层文件</p></li><li><p>抽象接口层文件</p></li></ul><h3 id="3-系统架构相关"><a href="#3-系统架构相关" class="headerlink" title="3. 系统架构相关"></a>3. 系统架构相关</h3><ul><li><p>系统框架</p><ul><li>时间片轮询</li><li>事件驱动</li><li>状态机</li></ul></li><li><p>应用层常用框架</p><ul><li>消息发送-等待模型 ( 适用于按步骤发送数据 –等待返回结果– 超时重发模型)</li><li>串口数据解析模型 (适用于类似于Modbus通信协议的协议解析)</li></ul></li></ul>]]></content>
<categories>
<category> 单片机 </category>
<category> 软件框架 </category>
</categories>
<tags>
<tag> 单片机 </tag>
<tag> 软件框架 </tag>
</tags>
</entry>
<entry>
<title>test</title>
<link href="/2019/12/05/test/"/>
<url>/2019/12/05/test/</url>
<content type="html"><![CDATA[]]></content>
</entry>
<entry>
<title>Hello World</title>
<link href="/2019/11/30/hello-world/"/>
<url>/2019/11/30/hello-world/</url>
<content type="html"><![CDATA[<p>Welcome to <a href="https://hexo.io/" target="_blank" rel="noopener">Hexo</a>! This is your very first post. Check <a href="https://hexo.io/docs/" target="_blank" rel="noopener">documentation</a> for more info. If you get any problems when using Hexo, you can find the answer in <a href="https://hexo.io/docs/troubleshooting.html" target="_blank" rel="noopener">troubleshooting</a> or you can ask me on <a href="https://github.com/hexojs/hexo/issues" target="_blank" rel="noopener">GitHub</a>.</p><h2 id="Quick-Start"><a href="#Quick-Start" class="headerlink" title="Quick Start"></a>Quick Start</h2><h3 id="Create-a-new-post"><a href="#Create-a-new-post" class="headerlink" title="Create a new post"></a>Create a new post</h3><pre class=" language-bash"><code class="language-bash">$ hexo new <span class="token string">"My New Post"</span></code></pre><p>More info: <a href="https://hexo.io/docs/writing.html" target="_blank" rel="noopener">Writing</a></p><h3 id="Run-server"><a href="#Run-server" class="headerlink" title="Run server"></a>Run server</h3><pre class=" language-bash"><code class="language-bash">$ hexo server</code></pre><p>More info: <a href="https://hexo.io/docs/server.html" target="_blank" rel="noopener">Server</a></p><h3 id="Generate-static-files"><a href="#Generate-static-files" class="headerlink" title="Generate static files"></a>Generate static files</h3><pre class=" language-bash"><code class="language-bash">$ hexo generate</code></pre><p>More info: <a href="https://hexo.io/docs/generating.html" target="_blank" rel="noopener">Generating</a></p><h3 id="Deploy-to-remote-sites"><a href="#Deploy-to-remote-sites" class="headerlink" title="Deploy to remote sites"></a>Deploy to remote sites</h3><pre class=" language-bash"><code class="language-bash">$ hexo deploy</code></pre><p>More info: <a href="https://hexo.io/docs/one-command-deployment.html" target="_blank" rel="noopener">Deployment</a></p>]]></content>
</entry>
<entry>
<title>系统分析</title>
<link href="/2018/09/07/xi-tong-fen-xi/"/>
<url>/2018/09/07/xi-tong-fen-xi/</url>
<content type="html"><![CDATA[<h2 id="系统任务分类"><a href="#系统任务分类" class="headerlink" title="系统任务分类"></a>系统任务分类</h2><h3 id="1-定时任务"><a href="#1-定时任务" class="headerlink" title="1.定时任务"></a>1.定时任务</h3><p>此类任务周期性的执行,</p><ul><li>如周期性的从串口发送命令读取外设传感器数据;</li></ul><h3 id="2-中断任务"><a href="#2-中断任务" class="headerlink" title="2. 中断任务"></a>2. 中断任务</h3><ul><li>此类任务从终端中触发,一般在中断中设置标志位,在主程序中进行处理</li></ul><h3 id="3-同步任务"><a href="#3-同步任务" class="headerlink" title="3. 同步任务"></a>3. 同步任务</h3><ul><li>此类任务需要等待某个事件,当事件标志置位时,执行</li></ul><h3 id="4-看门狗任务"><a href="#4-看门狗任务" class="headerlink" title="4. 看门狗任务"></a>4. 看门狗任务</h3><ul><li>此类任务监视系统是否由于异常卡死</li></ul><h3 id="5-系统管理任务"><a href="#5-系统管理任务" class="headerlink" title="5. 系统管理任务"></a>5. 系统管理任务</h3><ul><li>此类任务负责系统关键信息的收集,方便问题定位分析和系统性能分析</li></ul><h3 id="单个任务的划分"><a href="#单个任务的划分" class="headerlink" title="单个任务的划分"></a>单个任务的划分</h3><p>有些单个任务执行过程中需要延时等待响应,此时应将任务按步骤进行划分,用switch case 实现。</p><h3 id="任务的管理"><a href="#任务的管理" class="headerlink" title="任务的管理"></a>任务的管理</h3><ul><li>每个任务应该有个开关,可以控制任务的启停。</li><li>任务执行时间检测(while执行一次最大循环事件 一般不超过10ms)</li></ul><h3 id="我的演示视频"><a href="#我的演示视频" class="headerlink" title="我的演示视频"></a>我的演示视频</h3><iframe src="//player.bilibili.com/player.html?aid=65762370&cid=114097845&page=1" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true" > </iframe>]]></content>
<categories>
<category> 单片机 </category>
</categories>
<tags>
<tag> 单片机 </tag>
<tag> 多任务 </tag>
</tags>
</entry>
</search>