forked from ZhuYanzhen1/miniFOC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgd32f1x0__it_8c_source.html
205 lines (203 loc) · 34.6 KB
/
gd32f1x0__it_8c_source.html
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.2"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>miniFOC: system/gd32f1x0_it.c Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="Acme_LOGO.png"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">miniFOC<span id="projectnumber"> 1.0.2</span>
</div>
<div id="projectbrief">This open-source project aims to accomplish a FOC(Field Oriented Control) scheme that is operatable with minimum costs in China.</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.2 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search",'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_262ef3e34820216e073ea116856421e0.html">system</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle"><div class="title">gd32f1x0_it.c</div></div>
</div><!--header-->
<div class="contents">
<a href="gd32f1x0__it_8c.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span><span class="comment">/**************************************************************************/</span></div>
<div class="line"><a id="l00009" name="l00009"></a><span class="lineno"> 9</span><span class="preprocessor">#include "<a class="code" href="gd32f1x0__it_8h.html">gd32f1x0_it.h</a>"</span></div>
<div class="line"><a id="l00010" name="l00010"></a><span class="lineno"> 10</span><span class="preprocessor">#include "<a class="code" href="main_8h.html">main.h</a>"</span></div>
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno"> 11</span> </div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"><a class="line" href="gd32f1x0__it_8c.html#abb5e2753d967e52e57ddb82924eb5cf7"> 16</a></span><span class="keyword">static</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> <a class="code hl_variable" href="gd32f1x0__it_8c.html#abb5e2753d967e52e57ddb82924eb5cf7">systick_counter</a> = 0;</div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"> 17</span> </div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"><a class="line" href="gd32f1x0__it_8c.html#a6ad7a5e3ee69cb6db6a6b9111ba898bc"> 22</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="gd32f1x0__it_8c.html#a6ad7a5e3ee69cb6db6a6b9111ba898bc">NMI_Handler</a>(<span class="keywordtype">void</span>) {</div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span>}</div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span> </div>
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"><a class="line" href="gd32f1x0__it_8c.html#a2bffc10d5bd4106753b7c30e86903bea"> 29</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="gd32f1x0__it_8c.html#a2bffc10d5bd4106753b7c30e86903bea">HardFault_Handler</a>(<span class="keywordtype">void</span>) {</div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span> <span class="comment">/* if Hard Fault exception occurs, go to infinite loop */</span></div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span> <span class="keywordflow">while</span> (1);</div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span>}</div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span> </div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"><a class="line" href="gd32f1x0__it_8c.html#a3150f74512510287a942624aa9b44cc5"> 38</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="gd32f1x0__it_8c.html#a3150f74512510287a942624aa9b44cc5">MemManage_Handler</a>(<span class="keywordtype">void</span>) {</div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span> <span class="comment">/* if Memory Manage exception occurs, go to infinite loop */</span></div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span> <span class="keywordflow">while</span> (1);</div>
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span>}</div>
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span> </div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"><a class="line" href="gd32f1x0__it_8c.html#a850cefb17a977292ae5eb4cafa9976c3"> 47</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="gd32f1x0__it_8c.html#a850cefb17a977292ae5eb4cafa9976c3">BusFault_Handler</a>(<span class="keywordtype">void</span>) {</div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> <span class="comment">/* if Bus Fault exception occurs, go to infinite loop */</span></div>
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> <span class="keywordflow">while</span> (1);</div>
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span>}</div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> </div>
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"><a class="line" href="gd32f1x0__it_8c.html#a1d98923de2ed6b7309b66f9ba2971647"> 56</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="gd32f1x0__it_8c.html#a1d98923de2ed6b7309b66f9ba2971647">UsageFault_Handler</a>(<span class="keywordtype">void</span>) {</div>
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span> <span class="comment">/* if Usage Fault exception occurs, go to infinite loop */</span></div>
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno"> 58</span> <span class="keywordflow">while</span> (1);</div>
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"> 59</span>}</div>
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span> </div>
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"><a class="line" href="gd32f1x0__it_8c.html#a3e5ddb3df0d62f2dc357e64a3f04a6ce"> 65</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="gd32f1x0__it_8c.html#a3e5ddb3df0d62f2dc357e64a3f04a6ce">SVC_Handler</a>(<span class="keywordtype">void</span>) {</div>
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"> 66</span>}</div>
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"> 67</span> </div>
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"><a class="line" href="gd32f1x0__it_8c.html#adbdfb05858cc36fc520974df37ec3cb0"> 72</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="gd32f1x0__it_8c.html#adbdfb05858cc36fc520974df37ec3cb0">DebugMon_Handler</a>(<span class="keywordtype">void</span>) {</div>
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span>}</div>
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"> 74</span> </div>
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"><a class="line" href="gd32f1x0__it_8c.html#a6303e1f258cbdc1f970ce579cc015623"> 79</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="gd32f1x0__it_8c.html#a6303e1f258cbdc1f970ce579cc015623">PendSV_Handler</a>(<span class="keywordtype">void</span>) {</div>
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span>}</div>
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"> 81</span> </div>
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno"><a class="line" href="gd32f1x0__it_8c.html#ab5e09814056d617c521549e542639b7e"> 86</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="gd32f1x0__it_8c.html#ab5e09814056d617c521549e542639b7e">SysTick_Handler</a>(<span class="keywordtype">void</span>) {</div>
<div class="line"><a id="l00087" name="l00087"></a><span class="lineno"> 87</span> <span class="comment">/* update millisecond delay counter */</span></div>
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno"> 88</span> <a class="code hl_function" href="system_8c.html#a713199ab95f480628d6658708ed8de8b">delay_decrement</a>();</div>
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"> 89</span> <a class="code hl_variable" href="gd32f1x0__it_8c.html#abb5e2753d967e52e57ddb82924eb5cf7">systick_counter</a>++;</div>
<div class="line"><a id="l00090" name="l00090"></a><span class="lineno"> 90</span> </div>
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno"> 91</span> <span class="comment">/* reduce the frequency to SPEED_UP_FREQ, update the current rotor speed */</span></div>
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno"> 92</span> <span class="keywordflow">if</span> (<a class="code hl_variable" href="gd32f1x0__it_8c.html#abb5e2753d967e52e57ddb82924eb5cf7">systick_counter</a> == (1000 / <a class="code hl_define" href="config_8h.html#adddd943909a2fac22c5fe8e3949d105f">SPEED_UP_FREQ</a>)) {</div>
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno"> 93</span> <a class="code hl_variable" href="gd32f1x0__it_8c.html#abb5e2753d967e52e57ddb82924eb5cf7">systick_counter</a> = 0;</div>
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno"> 94</span> <a class="code hl_function" href="encoder_8c.html#a82c51d78a1f7bb4a5976974ab8d7ffe5">encoder_update_speed</a>();</div>
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno"> 95</span> }</div>
<div class="line"><a id="l00096" name="l00096"></a><span class="lineno"> 96</span>}</div>
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno"> 97</span> </div>
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno"><a class="line" href="gd32f1x0__it_8c.html#aa521223328872dd7e4cd659fecbdfb84"> 102</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="gd32f1x0__it_8c.html#aa521223328872dd7e4cd659fecbdfb84">USART0_IRQHandler</a>(<span class="keywordtype">void</span>) {</div>
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno"> 103</span> <span class="comment">/* judge whether a reception interrupt is generated */</span></div>
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno"> 104</span> <span class="keywordflow">if</span> (RESET != usart_interrupt_flag_get(USART0, USART_INT_FLAG_RBNE)) {</div>
<div class="line"><a id="l00105" name="l00105"></a><span class="lineno"> 105</span> <span class="comment">/* receive, process and unzip data */</span></div>
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno"> 106</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> rcv_data = usart_data_receive(USART0);</div>
<div class="line"><a id="l00107" name="l00107"></a><span class="lineno"> 107</span> <a class="code hl_function" href="uart_8c.html#a8b1fe807c1672229711abeb195185046">mdtp_receive_handler</a>(rcv_data);</div>
<div class="line"><a id="l00108" name="l00108"></a><span class="lineno"> 108</span> }</div>
<div class="line"><a id="l00109" name="l00109"></a><span class="lineno"> 109</span>}</div>
<div class="line"><a id="l00110" name="l00110"></a><span class="lineno"> 110</span> </div>
<div class="line"><a id="l00115" name="l00115"></a><span class="lineno"><a class="line" href="gd32f1x0__it_8c.html#a12c8b827e5eab9d3f93d56f858e735a3"> 115</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="gd32f1x0__it_8c.html#a12c8b827e5eab9d3f93d56f858e735a3">TIMER2_IRQHandler</a>(<span class="keywordtype">void</span>) {</div>
<div class="line"><a id="l00116" name="l00116"></a><span class="lineno"> 116</span> <span class="comment">/* judge whether a timer update interrupt is generated, clear timer interrupt flag bit */</span></div>
<div class="line"><a id="l00117" name="l00117"></a><span class="lineno"> 117</span> <span class="keywordflow">if</span> (SET == timer_interrupt_flag_get(TIMER2, TIMER_INT_UP)) {</div>
<div class="line"><a id="l00118" name="l00118"></a><span class="lineno"> 118</span> timer_interrupt_flag_clear(TIMER2, TIMER_INT_UP);</div>
<div class="line"><a id="l00119" name="l00119"></a><span class="lineno"> 119</span> </div>
<div class="line"><a id="l00120" name="l00120"></a><span class="lineno"> 120</span> <span class="comment">/* obtain the electric angle at the current time */</span></div>
<div class="line"><a id="l00121" name="l00121"></a><span class="lineno"> 121</span> <span class="keywordtype">float</span> u, v, w, angle = (float) <a class="code hl_function" href="encoder_8c.html#a8fbcb19c2f15c20c1a862e0cf64f6771">encoder_get_electronic_angle</a>();</div>
<div class="line"><a id="l00122" name="l00122"></a><span class="lineno"> 122</span> </div>
<div class="line"><a id="l00123" name="l00123"></a><span class="lineno"> 123</span> <span class="comment">/* Clarke inverse transform and SVPWM modulation */</span></div>
<div class="line"><a id="l00124" name="l00124"></a><span class="lineno"> 124</span> <span class="keywordflow">if</span> (<a class="code hl_variable" href="foc_8c.html#ad335385ea3909d9485703d97735b34ca">phase_sequence</a> == 0)</div>
<div class="line"><a id="l00125" name="l00125"></a><span class="lineno"> 125</span> <a class="code hl_function" href="foc_8c.html#a2ee2669a464e17cfaab4e084e78c4fe1">foc_calculate_dutycycle</a>(angle, 0, <a class="code hl_variable" href="foc_8c.html#a6c9e1e8356380a4129a3a59d52ee1ec4">FOC_Struct</a>.<a class="code hl_variable" href="struct_f_o_c___structure__t.html#a483644b553c2be32ffbaf641f23c6cea">user_expect</a>, &u, &v, &w);</div>
<div class="line"><a id="l00126" name="l00126"></a><span class="lineno"> 126</span> <span class="keywordflow">else</span></div>
<div class="line"><a id="l00127" name="l00127"></a><span class="lineno"> 127</span> <a class="code hl_function" href="foc_8c.html#a2ee2669a464e17cfaab4e084e78c4fe1">foc_calculate_dutycycle</a>(angle, 0, <a class="code hl_variable" href="foc_8c.html#a6c9e1e8356380a4129a3a59d52ee1ec4">FOC_Struct</a>.<a class="code hl_variable" href="struct_f_o_c___structure__t.html#a483644b553c2be32ffbaf641f23c6cea">user_expect</a>, &v, &u, &w);</div>
<div class="line"><a id="l00128" name="l00128"></a><span class="lineno"> 128</span> <a class="code hl_function" href="timer_8c.html#ab3614c1dcfba485b2e299839d9c189e4">update_pwm_dutycycle</a>(u, v, w);</div>
<div class="line"><a id="l00129" name="l00129"></a><span class="lineno"> 129</span> }</div>
<div class="line"><a id="l00130" name="l00130"></a><span class="lineno"> 130</span>}</div>
<div class="line"><a id="l00131" name="l00131"></a><span class="lineno"> 131</span> </div>
<div class="line"><a id="l00136" name="l00136"></a><span class="lineno"><a class="line" href="gd32f1x0__it_8c.html#a94ca44d5889df2048bb8e52f7e2076e4"> 136</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="gd32f1x0__it_8c.html#a94ca44d5889df2048bb8e52f7e2076e4">TIMER13_IRQHandler</a>(<span class="keywordtype">void</span>) {</div>
<div class="line"><a id="l00137" name="l00137"></a><span class="lineno"> 137</span> <span class="comment">/* judge whether a timer update interrupt is generated, clear timer interrupt flag bit */</span></div>
<div class="line"><a id="l00138" name="l00138"></a><span class="lineno"> 138</span> <span class="keywordflow">if</span> (SET == timer_interrupt_flag_get(TIMER13, TIMER_INT_UP)) {</div>
<div class="line"><a id="l00139" name="l00139"></a><span class="lineno"> 139</span> timer_interrupt_flag_clear(TIMER13, TIMER_INT_UP);</div>
<div class="line"><a id="l00140" name="l00140"></a><span class="lineno"> 140</span> </div>
<div class="line"><a id="l00141" name="l00141"></a><span class="lineno"> 141</span> <span class="comment">/* judge whether angle closed-loop control is required */</span></div>
<div class="line"><a id="l00142" name="l00142"></a><span class="lineno"> 142</span> <span class="keywordflow">if</span> (<a class="code hl_variable" href="pid_8c.html#a2c7bcbec66fa40a2347b1cd253a5ae82">pid_control_mode_flag</a> == <a class="code hl_define" href="pid_8h.html#a7dad3a985101eaec7ac078f43747c928">ANGLE_LOOP_CONTROL</a>)</div>
<div class="line"><a id="l00143" name="l00143"></a><span class="lineno"> 143</span> <span class="comment">/* the calculated value of the angle loop is taken as the expected value of the speed loop */</span></div>
<div class="line"><a id="l00144" name="l00144"></a><span class="lineno"> 144</span> <a class="code hl_variable" href="pid_8c.html#ab051c8f4a730b934b146f330514efd95">speed_pid_handler</a>.<a class="code hl_variable" href="struct_p_i_d___structure__t.html#ad0e13a810b1a4602c1ce625f9877cbf5">expect</a> =</div>
<div class="line"><a id="l00145" name="l00145"></a><span class="lineno"> 145</span> <a class="code hl_function" href="pid_8c.html#abe6a9dce63d0eaad5a10d4c8c5ffcd07">pid_calculate_result</a>((<a class="code hl_struct" href="struct_p_i_d___structure__t.html">PID_Structure_t</a> *) &<a class="code hl_variable" href="pid_8c.html#aaa8f5bad87ffc78a20f06863ab6bad5c">angle_pid_handler</a>, <a class="code hl_variable" href="foc_8c.html#a6c9e1e8356380a4129a3a59d52ee1ec4">FOC_Struct</a>.<a class="code hl_variable" href="struct_f_o_c___structure__t.html#af832998676bd09b4198a7a7274072766">mechanical_angle</a>);</div>
<div class="line"><a id="l00146" name="l00146"></a><span class="lineno"> 146</span> </div>
<div class="line"><a id="l00147" name="l00147"></a><span class="lineno"> 147</span> <span class="comment">/* calculate the speed loop PID and obtain the calculated value */</span></div>
<div class="line"><a id="l00148" name="l00148"></a><span class="lineno"> 148</span> <a class="code hl_variable" href="foc_8c.html#a6c9e1e8356380a4129a3a59d52ee1ec4">FOC_Struct</a>.<a class="code hl_variable" href="struct_f_o_c___structure__t.html#a483644b553c2be32ffbaf641f23c6cea">user_expect</a> = <a class="code hl_function" href="pid_8c.html#abe6a9dce63d0eaad5a10d4c8c5ffcd07">pid_calculate_result</a>((<a class="code hl_struct" href="struct_p_i_d___structure__t.html">PID_Structure_t</a> *) &<a class="code hl_variable" href="pid_8c.html#ab051c8f4a730b934b146f330514efd95">speed_pid_handler</a>, <a class="code hl_variable" href="foc_8c.html#a6c9e1e8356380a4129a3a59d52ee1ec4">FOC_Struct</a>.<a class="code hl_variable" href="struct_f_o_c___structure__t.html#af32f899f7a231c9df64a594c7b13bfa4">rotate_speed</a>);</div>
<div class="line"><a id="l00149" name="l00149"></a><span class="lineno"> 149</span> }</div>
<div class="line"><a id="l00150" name="l00150"></a><span class="lineno"> 150</span>}</div>
<div class="ttc" id="aconfig_8h_html_adddd943909a2fac22c5fe8e3949d105f"><div class="ttname"><a href="config_8h.html#adddd943909a2fac22c5fe8e3949d105f">SPEED_UP_FREQ</a></div><div class="ttdeci">#define SPEED_UP_FREQ</div><div class="ttdoc">set speed update frequency to 200Hz</div><div class="ttdef"><b>Definition:</b> <a href="config_8h_source.html#l00030">config.h:30</a></div></div>
<div class="ttc" id="aencoder_8c_html_a82c51d78a1f7bb4a5976974ab8d7ffe5"><div class="ttname"><a href="encoder_8c.html#a82c51d78a1f7bb4a5976974ab8d7ffe5">encoder_update_speed</a></div><div class="ttdeci">void encoder_update_speed(void)</div><div class="ttdoc">called every 2 milliseconds to calculate the speed.</div><div class="ttdef"><b>Definition:</b> <a href="encoder_8c_source.html#l00108">encoder.c:108</a></div></div>
<div class="ttc" id="aencoder_8c_html_a8fbcb19c2f15c20c1a862e0cf64f6771"><div class="ttname"><a href="encoder_8c.html#a8fbcb19c2f15c20c1a862e0cf64f6771">encoder_get_electronic_angle</a></div><div class="ttdeci">float encoder_get_electronic_angle(void)</div><div class="ttdoc">according to the electrical angle calculated from the mechanical angle, this function will call encod...</div><div class="ttdef"><b>Definition:</b> <a href="encoder_8c_source.html#l00094">encoder.c:94</a></div></div>
<div class="ttc" id="afoc_8c_html_a2ee2669a464e17cfaab4e084e78c4fe1"><div class="ttname"><a href="foc_8c.html#a2ee2669a464e17cfaab4e084e78c4fe1">foc_calculate_dutycycle</a></div><div class="ttdeci">void foc_calculate_dutycycle(float elect_angle, float d, float q, float *u, float *v, float *w)</div><div class="ttdoc">calculate the corresponding three-phase PWM duty cycle under the current electrical angle</div><div class="ttdef"><b>Definition:</b> <a href="foc_8c_source.html#l00097">foc.c:97</a></div></div>
<div class="ttc" id="afoc_8c_html_a6c9e1e8356380a4129a3a59d52ee1ec4"><div class="ttname"><a href="foc_8c.html#a6c9e1e8356380a4129a3a59d52ee1ec4">FOC_Struct</a></div><div class="ttdeci">volatile FOC_Structure_t FOC_Struct</div><div class="ttdoc">FOC handler.</div><div class="ttdef"><b>Definition:</b> <a href="foc_8c_source.html#l00020">foc.c:20</a></div></div>
<div class="ttc" id="afoc_8c_html_ad335385ea3909d9485703d97735b34ca"><div class="ttname"><a href="foc_8c.html#ad335385ea3909d9485703d97735b34ca">phase_sequence</a></div><div class="ttdeci">volatile unsigned char phase_sequence</div><div class="ttdoc">motor phase sequence flag variable</div><div class="ttdef"><b>Definition:</b> <a href="foc_8c_source.html#l00024">foc.c:24</a></div></div>
<div class="ttc" id="agd32f1x0__it_8c_html_a12c8b827e5eab9d3f93d56f858e735a3"><div class="ttname"><a href="gd32f1x0__it_8c.html#a12c8b827e5eab9d3f93d56f858e735a3">TIMER2_IRQHandler</a></div><div class="ttdeci">void TIMER2_IRQHandler(void)</div><div class="ttdoc">this function handles TIMER2 TIMER_INT_UP interrupt request</div><div class="ttdef"><b>Definition:</b> <a href="gd32f1x0__it_8c_source.html#l00115">gd32f1x0_it.c:115</a></div></div>
<div class="ttc" id="agd32f1x0__it_8c_html_a1d98923de2ed6b7309b66f9ba2971647"><div class="ttname"><a href="gd32f1x0__it_8c.html#a1d98923de2ed6b7309b66f9ba2971647">UsageFault_Handler</a></div><div class="ttdeci">void UsageFault_Handler(void)</div><div class="ttdoc">this function handles UsageFault exception</div><div class="ttdef"><b>Definition:</b> <a href="gd32f1x0__it_8c_source.html#l00056">gd32f1x0_it.c:56</a></div></div>
<div class="ttc" id="agd32f1x0__it_8c_html_a2bffc10d5bd4106753b7c30e86903bea"><div class="ttname"><a href="gd32f1x0__it_8c.html#a2bffc10d5bd4106753b7c30e86903bea">HardFault_Handler</a></div><div class="ttdeci">void HardFault_Handler(void)</div><div class="ttdoc">this function handles HardFault exception</div><div class="ttdef"><b>Definition:</b> <a href="gd32f1x0__it_8c_source.html#l00029">gd32f1x0_it.c:29</a></div></div>
<div class="ttc" id="agd32f1x0__it_8c_html_a3150f74512510287a942624aa9b44cc5"><div class="ttname"><a href="gd32f1x0__it_8c.html#a3150f74512510287a942624aa9b44cc5">MemManage_Handler</a></div><div class="ttdeci">void MemManage_Handler(void)</div><div class="ttdoc">this function handles MemManage exception</div><div class="ttdef"><b>Definition:</b> <a href="gd32f1x0__it_8c_source.html#l00038">gd32f1x0_it.c:38</a></div></div>
<div class="ttc" id="agd32f1x0__it_8c_html_a3e5ddb3df0d62f2dc357e64a3f04a6ce"><div class="ttname"><a href="gd32f1x0__it_8c.html#a3e5ddb3df0d62f2dc357e64a3f04a6ce">SVC_Handler</a></div><div class="ttdeci">void SVC_Handler(void)</div><div class="ttdoc">this function handles SVC exception</div><div class="ttdef"><b>Definition:</b> <a href="gd32f1x0__it_8c_source.html#l00065">gd32f1x0_it.c:65</a></div></div>
<div class="ttc" id="agd32f1x0__it_8c_html_a6303e1f258cbdc1f970ce579cc015623"><div class="ttname"><a href="gd32f1x0__it_8c.html#a6303e1f258cbdc1f970ce579cc015623">PendSV_Handler</a></div><div class="ttdeci">void PendSV_Handler(void)</div><div class="ttdoc">this function handles PendSV exception</div><div class="ttdef"><b>Definition:</b> <a href="gd32f1x0__it_8c_source.html#l00079">gd32f1x0_it.c:79</a></div></div>
<div class="ttc" id="agd32f1x0__it_8c_html_a6ad7a5e3ee69cb6db6a6b9111ba898bc"><div class="ttname"><a href="gd32f1x0__it_8c.html#a6ad7a5e3ee69cb6db6a6b9111ba898bc">NMI_Handler</a></div><div class="ttdeci">void NMI_Handler(void)</div><div class="ttdoc">this function handles NMI exception</div><div class="ttdef"><b>Definition:</b> <a href="gd32f1x0__it_8c_source.html#l00022">gd32f1x0_it.c:22</a></div></div>
<div class="ttc" id="agd32f1x0__it_8c_html_a850cefb17a977292ae5eb4cafa9976c3"><div class="ttname"><a href="gd32f1x0__it_8c.html#a850cefb17a977292ae5eb4cafa9976c3">BusFault_Handler</a></div><div class="ttdeci">void BusFault_Handler(void)</div><div class="ttdoc">this function handles BusFault exception</div><div class="ttdef"><b>Definition:</b> <a href="gd32f1x0__it_8c_source.html#l00047">gd32f1x0_it.c:47</a></div></div>
<div class="ttc" id="agd32f1x0__it_8c_html_a94ca44d5889df2048bb8e52f7e2076e4"><div class="ttname"><a href="gd32f1x0__it_8c.html#a94ca44d5889df2048bb8e52f7e2076e4">TIMER13_IRQHandler</a></div><div class="ttdeci">void TIMER13_IRQHandler(void)</div><div class="ttdoc">this function handles TIMER13 TIMER_INT_UP interrupt request</div><div class="ttdef"><b>Definition:</b> <a href="gd32f1x0__it_8c_source.html#l00136">gd32f1x0_it.c:136</a></div></div>
<div class="ttc" id="agd32f1x0__it_8c_html_aa521223328872dd7e4cd659fecbdfb84"><div class="ttname"><a href="gd32f1x0__it_8c.html#aa521223328872dd7e4cd659fecbdfb84">USART0_IRQHandler</a></div><div class="ttdeci">void USART0_IRQHandler(void)</div><div class="ttdoc">this function handles USART RBNE interrupt request</div><div class="ttdef"><b>Definition:</b> <a href="gd32f1x0__it_8c_source.html#l00102">gd32f1x0_it.c:102</a></div></div>
<div class="ttc" id="agd32f1x0__it_8c_html_ab5e09814056d617c521549e542639b7e"><div class="ttname"><a href="gd32f1x0__it_8c.html#ab5e09814056d617c521549e542639b7e">SysTick_Handler</a></div><div class="ttdeci">void SysTick_Handler(void)</div><div class="ttdoc">this function handles SysTick exception</div><div class="ttdef"><b>Definition:</b> <a href="gd32f1x0__it_8c_source.html#l00086">gd32f1x0_it.c:86</a></div></div>
<div class="ttc" id="agd32f1x0__it_8c_html_abb5e2753d967e52e57ddb82924eb5cf7"><div class="ttname"><a href="gd32f1x0__it_8c.html#abb5e2753d967e52e57ddb82924eb5cf7">systick_counter</a></div><div class="ttdeci">static unsigned char systick_counter</div><div class="ttdoc">systick interrupt count variable is used to realize the encoder update function.</div><div class="ttdef"><b>Definition:</b> <a href="gd32f1x0__it_8c_source.html#l00016">gd32f1x0_it.c:16</a></div></div>
<div class="ttc" id="agd32f1x0__it_8c_html_adbdfb05858cc36fc520974df37ec3cb0"><div class="ttname"><a href="gd32f1x0__it_8c.html#adbdfb05858cc36fc520974df37ec3cb0">DebugMon_Handler</a></div><div class="ttdeci">void DebugMon_Handler(void)</div><div class="ttdoc">this function handles DebugMon exception</div><div class="ttdef"><b>Definition:</b> <a href="gd32f1x0__it_8c_source.html#l00072">gd32f1x0_it.c:72</a></div></div>
<div class="ttc" id="agd32f1x0__it_8h_html"><div class="ttname"><a href="gd32f1x0__it_8h.html">gd32f1x0_it.h</a></div><div class="ttdoc">gd32f1x0 interrupt handler function header file</div></div>
<div class="ttc" id="amain_8h_html"><div class="ttname"><a href="main_8h.html">main.h</a></div><div class="ttdoc">main function Header File</div></div>
<div class="ttc" id="apid_8c_html_a2c7bcbec66fa40a2347b1cd253a5ae82"><div class="ttname"><a href="pid_8c.html#a2c7bcbec66fa40a2347b1cd253a5ae82">pid_control_mode_flag</a></div><div class="ttdeci">volatile unsigned char pid_control_mode_flag</div><div class="ttdoc">flag variable of PID closed loop mode</div><div class="ttdef"><b>Definition:</b> <a href="pid_8c_source.html#l00020">pid.c:20</a></div></div>
<div class="ttc" id="apid_8c_html_aaa8f5bad87ffc78a20f06863ab6bad5c"><div class="ttname"><a href="pid_8c.html#aaa8f5bad87ffc78a20f06863ab6bad5c">angle_pid_handler</a></div><div class="ttdeci">volatile PID_Structure_t angle_pid_handler</div><div class="ttdoc">algorithm handler of PID angle loop</div><div class="ttdef"><b>Definition:</b> <a href="pid_8c_source.html#l00028">pid.c:28</a></div></div>
<div class="ttc" id="apid_8c_html_ab051c8f4a730b934b146f330514efd95"><div class="ttname"><a href="pid_8c.html#ab051c8f4a730b934b146f330514efd95">speed_pid_handler</a></div><div class="ttdeci">volatile PID_Structure_t speed_pid_handler</div><div class="ttdoc">algorithm handler of PID speed loop</div><div class="ttdef"><b>Definition:</b> <a href="pid_8c_source.html#l00024">pid.c:24</a></div></div>
<div class="ttc" id="apid_8c_html_abe6a9dce63d0eaad5a10d4c8c5ffcd07"><div class="ttname"><a href="pid_8c.html#abe6a9dce63d0eaad5a10d4c8c5ffcd07">pid_calculate_result</a></div><div class="ttdeci">float pid_calculate_result(PID_Structure_t *pid_handler, float collect)</div><div class="ttdoc">calculate result using sampling value</div><div class="ttdef"><b>Definition:</b> <a href="pid_8c_source.html#l00057">pid.c:57</a></div></div>
<div class="ttc" id="apid_8h_html_a7dad3a985101eaec7ac078f43747c928"><div class="ttname"><a href="pid_8h.html#a7dad3a985101eaec7ac078f43747c928">ANGLE_LOOP_CONTROL</a></div><div class="ttdeci">#define ANGLE_LOOP_CONTROL</div><div class="ttdoc">angle loop control mode</div><div class="ttdef"><b>Definition:</b> <a href="pid_8h_source.html#l00018">pid.h:18</a></div></div>
<div class="ttc" id="astruct_f_o_c___structure__t_html_a483644b553c2be32ffbaf641f23c6cea"><div class="ttname"><a href="struct_f_o_c___structure__t.html#a483644b553c2be32ffbaf641f23c6cea">FOC_Structure_t::user_expect</a></div><div class="ttdeci">float user_expect</div><div class="ttdoc">user expect value of miniFOC</div><div class="ttdef"><b>Definition:</b> <a href="foc_8h_source.html#l00020">foc.h:20</a></div></div>
<div class="ttc" id="astruct_f_o_c___structure__t_html_af32f899f7a231c9df64a594c7b13bfa4"><div class="ttname"><a href="struct_f_o_c___structure__t.html#af32f899f7a231c9df64a594c7b13bfa4">FOC_Structure_t::rotate_speed</a></div><div class="ttdeci">float rotate_speed</div><div class="ttdoc">motor rotate speed calculate from timer</div><div class="ttdef"><b>Definition:</b> <a href="foc_8h_source.html#l00019">foc.h:19</a></div></div>
<div class="ttc" id="astruct_f_o_c___structure__t_html_af832998676bd09b4198a7a7274072766"><div class="ttname"><a href="struct_f_o_c___structure__t.html#af832998676bd09b4198a7a7274072766">FOC_Structure_t::mechanical_angle</a></div><div class="ttdeci">float mechanical_angle</div><div class="ttdoc">mechanical angle read form encoder</div><div class="ttdef"><b>Definition:</b> <a href="foc_8h_source.html#l00018">foc.h:18</a></div></div>
<div class="ttc" id="astruct_p_i_d___structure__t_html"><div class="ttname"><a href="struct_p_i_d___structure__t.html">PID_Structure_t</a></div><div class="ttdoc">structure of PID algorithm</div><div class="ttdef"><b>Definition:</b> <a href="pid_8h_source.html#l00024">pid.h:24</a></div></div>
<div class="ttc" id="astruct_p_i_d___structure__t_html_ad0e13a810b1a4602c1ce625f9877cbf5"><div class="ttname"><a href="struct_p_i_d___structure__t.html#ad0e13a810b1a4602c1ce625f9877cbf5">PID_Structure_t::expect</a></div><div class="ttdeci">float expect</div><div class="ttdoc">user expectations in PID</div><div class="ttdef"><b>Definition:</b> <a href="pid_8h_source.html#l00029">pid.h:29</a></div></div>
<div class="ttc" id="asystem_8c_html_a713199ab95f480628d6658708ed8de8b"><div class="ttname"><a href="system_8c.html#a713199ab95f480628d6658708ed8de8b">delay_decrement</a></div><div class="ttdeci">void delay_decrement(void)</div><div class="ttdoc">delay counter decrement function, called by systick handler</div><div class="ttdef"><b>Definition:</b> <a href="system_8c_source.html#l00042">system.c:42</a></div></div>
<div class="ttc" id="atimer_8c_html_ab3614c1dcfba485b2e299839d9c189e4"><div class="ttname"><a href="timer_8c.html#ab3614c1dcfba485b2e299839d9c189e4">update_pwm_dutycycle</a></div><div class="ttdeci">void update_pwm_dutycycle(float ch0, float ch1, float ch2)</div><div class="ttdoc">update timer1 ch0 1 2 duty-cycle</div><div class="ttdef"><b>Definition:</b> <a href="timer_8c_source.html#l00021">timer.c:21</a></div></div>
<div class="ttc" id="auart_8c_html_a8b1fe807c1672229711abeb195185046"><div class="ttname"><a href="uart_8c.html#a8b1fe807c1672229711abeb195185046">mdtp_receive_handler</a></div><div class="ttdeci">void mdtp_receive_handler(unsigned char data)</div><div class="ttdoc">medium capacity data transmission protocol unpacking handler</div><div class="ttdef"><b>Definition:</b> <a href="uart_8c_source.html#l00037">uart.c:37</a></div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.2
</small></address>
</body>
</html>