forked from ZhuYanzhen1/miniFOC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathencoder_8c.html
424 lines (365 loc) · 25.3 KB
/
encoder_8c.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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
<!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.4"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>miniFOC: algorithm/encoder.c File Reference</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 id="projectrow">
<td id="projectlogo"><img alt="Logo" src="Acme_LOGO.png"/></td>
<td id="projectalign">
<div id="projectname">miniFOC<span id="projectnumber"> 1.0.3</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.4 -->
<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_99d3723365464dd656f512988bb8dbbd.html">algorithm</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#func-members">Functions</a> |
<a href="#var-members">Variables</a> </div>
<div class="headertitle"><div class="title">encoder.c File Reference</div></div>
</div><!--header-->
<div class="contents">
<p>this file contains the code implementation of angle acquisition and initialization functions of sc60228 and sc60224.
<a href="#details">More...</a></p>
<div class="textblock"><code>#include "<a class="el" href="encoder_8h_source.html">encoder.h</a>"</code><br />
<code>#include "<a class="el" href="spi_8h_source.html">spi.h</a>"</code><br />
<code>#include "gd32f1x0.h"</code><br />
<code>#include "<a class="el" href="foc_8h_source.html">foc.h</a>"</code><br />
<code>#include "<a class="el" href="timer_8h_source.html">timer.h</a>"</code><br />
<code>#include "<a class="el" href="system_8h_source.html">system.h</a>"</code><br />
<code>#include "<a class="el" href="config_8h_source.html">config.h</a>"</code><br />
<code>#include "<a class="el" href="filter_8h_source.html">filter.h</a>"</code><br />
</div>
<p><a href="encoder_8c_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a496fbd2820274bbbc7352c91415e2d3e"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="encoder_8c.html#a496fbd2820274bbbc7352c91415e2d3e">encoder_delay</a> (void)</td></tr>
<tr class="memdesc:a496fbd2820274bbbc7352c91415e2d3e"><td class="mdescLeft"> </td><td class="mdescRight">delay function for magnetic encoder <a href="encoder_8c.html#a496fbd2820274bbbc7352c91415e2d3e">More...</a><br /></td></tr>
<tr class="separator:a496fbd2820274bbbc7352c91415e2d3e"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aa5d6a09bb36a38d53242d3b2401a0d1a"><td class="memItemLeft" align="right" valign="top">unsigned short </td><td class="memItemRight" valign="bottom"><a class="el" href="encoder_8c.html#aa5d6a09bb36a38d53242d3b2401a0d1a">encoder_read_data</a> (unsigned short TxData)</td></tr>
<tr class="memdesc:aa5d6a09bb36a38d53242d3b2401a0d1a"><td class="mdescLeft"> </td><td class="mdescRight">read data from the register of the magnetic encoder <a href="encoder_8c.html#aa5d6a09bb36a38d53242d3b2401a0d1a">More...</a><br /></td></tr>
<tr class="separator:aa5d6a09bb36a38d53242d3b2401a0d1a"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a28beb7b571ff9e6d39118c8d1324e154"><td class="memItemLeft" align="right" valign="top">unsigned short </td><td class="memItemRight" valign="bottom"><a class="el" href="encoder_8c.html#a28beb7b571ff9e6d39118c8d1324e154">encoder_get_mechanical_angle</a> (void)</td></tr>
<tr class="memdesc:a28beb7b571ff9e6d39118c8d1324e154"><td class="mdescLeft"> </td><td class="mdescRight">read mechanical angle directly from encoder <a href="encoder_8c.html#a28beb7b571ff9e6d39118c8d1324e154">More...</a><br /></td></tr>
<tr class="separator:a28beb7b571ff9e6d39118c8d1324e154"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a8fbcb19c2f15c20c1a862e0cf64f6771"><td class="memItemLeft" align="right" valign="top">float </td><td class="memItemRight" valign="bottom"><a class="el" href="encoder_8c.html#a8fbcb19c2f15c20c1a862e0cf64f6771">encoder_get_electronic_angle</a> (void)</td></tr>
<tr class="memdesc:a8fbcb19c2f15c20c1a862e0cf64f6771"><td class="mdescLeft"> </td><td class="mdescRight">according to the electrical angle calculated from the mechanical angle, this function will call <a class="el" href="encoder_8c.html#a28beb7b571ff9e6d39118c8d1324e154" title="read mechanical angle directly from encoder">encoder_get_mechanical_angle()</a> function. <a href="encoder_8c.html#a8fbcb19c2f15c20c1a862e0cf64f6771">More...</a><br /></td></tr>
<tr class="separator:a8fbcb19c2f15c20c1a862e0cf64f6771"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a82c51d78a1f7bb4a5976974ab8d7ffe5"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="encoder_8c.html#a82c51d78a1f7bb4a5976974ab8d7ffe5">encoder_update_speed</a> (void)</td></tr>
<tr class="memdesc:a82c51d78a1f7bb4a5976974ab8d7ffe5"><td class="mdescLeft"> </td><td class="mdescRight">called every 2 milliseconds to calculate the speed. <a href="encoder_8c.html#a82c51d78a1f7bb4a5976974ab8d7ffe5">More...</a><br /></td></tr>
<tr class="separator:a82c51d78a1f7bb4a5976974ab8d7ffe5"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ad28e37c20d065e5014ea3a5f2de91e82"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="encoder_8c.html#ad28e37c20d065e5014ea3a5f2de91e82">encoder_zeroing</a> (void)</td></tr>
<tr class="memdesc:ad28e37c20d065e5014ea3a5f2de91e82"><td class="mdescLeft"> </td><td class="mdescRight">correct the mechanical angle zero deviation between the magnetic encoder and FOC. <a href="encoder_8c.html#ad28e37c20d065e5014ea3a5f2de91e82">More...</a><br /></td></tr>
<tr class="separator:ad28e37c20d065e5014ea3a5f2de91e82"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="var-members" name="var-members"></a>
Variables</h2></td></tr>
<tr class="memitem:a562eacc7259f25574b1ab8ce9d7c6a3e"><td class="memItemLeft" align="right" valign="top">volatile unsigned short </td><td class="memItemRight" valign="bottom"><a class="el" href="encoder_8c.html#a562eacc7259f25574b1ab8ce9d7c6a3e">machine_angle_offset</a> = 0</td></tr>
<tr class="memdesc:a562eacc7259f25574b1ab8ce9d7c6a3e"><td class="mdescLeft"> </td><td class="mdescRight">mechanical angle offset, which is used to align the mechanical angle with the zero point of the electrical angle. <a href="encoder_8c.html#a562eacc7259f25574b1ab8ce9d7c6a3e">More...</a><br /></td></tr>
<tr class="separator:a562eacc7259f25574b1ab8ce9d7c6a3e"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:af58d29dfca2d46874e2da41b45b48482"><td class="memItemLeft" align="right" valign="top">static volatile unsigned short </td><td class="memItemRight" valign="bottom"><a class="el" href="encoder_8c.html#af58d29dfca2d46874e2da41b45b48482">last_mechanical_angle</a> = 0</td></tr>
<tr class="memdesc:af58d29dfca2d46874e2da41b45b48482"><td class="mdescLeft"> </td><td class="mdescRight">the mechanical angle at the last moment is used to calculate the angle differential value and realize the angle measurement function. <a href="encoder_8c.html#af58d29dfca2d46874e2da41b45b48482">More...</a><br /></td></tr>
<tr class="separator:af58d29dfca2d46874e2da41b45b48482"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a97999bca302a3ae095acd9977fee272a"><td class="memItemLeft" align="right" valign="top">static volatile long long </td><td class="memItemRight" valign="bottom"><a class="el" href="encoder_8c.html#a97999bca302a3ae095acd9977fee272a">total_machine_angle</a> = 0</td></tr>
<tr class="memdesc:a97999bca302a3ae095acd9977fee272a"><td class="mdescLeft"> </td><td class="mdescRight">the total mechanical angle since power on is used to calculate the angle integral value and realize the angle measurement function. <a href="encoder_8c.html#a97999bca302a3ae095acd9977fee272a">More...</a><br /></td></tr>
<tr class="separator:a97999bca302a3ae095acd9977fee272a"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aeb44dbae80bf7edaf6189fb8e2278f99"><td class="memItemLeft" align="right" valign="top">static volatile long long </td><td class="memItemRight" valign="bottom"><a class="el" href="encoder_8c.html#aeb44dbae80bf7edaf6189fb8e2278f99">systick_mechanical_angle_last</a> = 0</td></tr>
<tr class="memdesc:aeb44dbae80bf7edaf6189fb8e2278f99"><td class="mdescLeft"> </td><td class="mdescRight">the mechanical angle at the last moment is used to calculate the rotation speed of the motor rotor. <a href="encoder_8c.html#aeb44dbae80bf7edaf6189fb8e2278f99">More...</a><br /></td></tr>
<tr class="separator:aeb44dbae80bf7edaf6189fb8e2278f99"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p >this file contains the code implementation of angle acquisition and initialization functions of sc60228 and sc60224. </p>
<dl class="section author"><dt>Author</dt><dd>Lao·Zhu </dd></dl>
<dl class="section version"><dt>Version</dt><dd>V1.0.2 </dd></dl>
<dl class="section date"><dt>Date</dt><dd>29. October 2021 </dd></dl>
<p class="definition">Definition in file <a class="el" href="encoder_8c_source.html">encoder.c</a>.</p>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="a496fbd2820274bbbc7352c91415e2d3e" name="a496fbd2820274bbbc7352c91415e2d3e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a496fbd2820274bbbc7352c91415e2d3e">◆ </a></span>encoder_delay()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void encoder_delay </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>delay function for magnetic encoder </p>
<p class="definition">Definition at line <a class="el" href="encoder_8c_source.html#l00044">44</a> of file <a class="el" href="encoder_8c_source.html">encoder.c</a>.</p>
<p class="reference">Referenced by <a class="el" href="encoder_8c_source.html#l00056">encoder_read_data()</a>.</p>
</div>
</div>
<a id="a8fbcb19c2f15c20c1a862e0cf64f6771" name="a8fbcb19c2f15c20c1a862e0cf64f6771"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8fbcb19c2f15c20c1a862e0cf64f6771">◆ </a></span>encoder_get_electronic_angle()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">float encoder_get_electronic_angle </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>according to the electrical angle calculated from the mechanical angle, this function will call <a class="el" href="encoder_8c.html#a28beb7b571ff9e6d39118c8d1324e154" title="read mechanical angle directly from encoder">encoder_get_mechanical_angle()</a> function. </p>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
<tr><td class="paramname">register</td><td>raw data reading back </td></tr>
</table>
</dd>
</dl>
<p class="definition">Definition at line <a class="el" href="encoder_8c_source.html#l00093">93</a> of file <a class="el" href="encoder_8c_source.html">encoder.c</a>.</p>
<p class="reference">References <a class="el" href="foc_8h_source.html#l00026">ELECANGLE_COEFFICIENT</a>, <a class="el" href="encoder_8c_source.html#l00076">encoder_get_mechanical_angle()</a>, <a class="el" href="config_8h_source.html#l00017">ENCODER_RESO</a>, <a class="el" href="foc_8c_source.html#l00020">FOC_Struct</a>, <a class="el" href="foc_8h_source.html#l00024">MECHANGLE_COEFFICIENT</a>, <a class="el" href="foc_8h_source.html#l00018">FOC_Structure_t::mechanical_angle</a>, and <a class="el" href="config_8h_source.html#l00015">POLAR_PAIRS</a>.</p>
<p class="reference">Referenced by <a class="el" href="gd32f1x0__it_8c_source.html#l00104">TIMER2_IRQHandler()</a>.</p>
</div>
</div>
<a id="a28beb7b571ff9e6d39118c8d1324e154" name="a28beb7b571ff9e6d39118c8d1324e154"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a28beb7b571ff9e6d39118c8d1324e154">◆ </a></span>encoder_get_mechanical_angle()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">unsigned short encoder_get_mechanical_angle </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>read mechanical angle directly from encoder </p>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
<tr><td class="paramname">register</td><td>raw data reading back </td></tr>
</table>
</dd>
</dl>
<p class="definition">Definition at line <a class="el" href="encoder_8c_source.html#l00076">76</a> of file <a class="el" href="encoder_8c_source.html">encoder.c</a>.</p>
<p class="reference">References <a class="el" href="encoder_8c_source.html#l00056">encoder_read_data()</a>, <a class="el" href="config_8h_source.html#l00017">ENCODER_RESO</a>, <a class="el" href="encoder_8c_source.html#l00029">last_mechanical_angle</a>, <a class="el" href="encoder_8c_source.html#l00023">machine_angle_offset</a>, and <a class="el" href="encoder_8c_source.html#l00034">total_machine_angle</a>.</p>
<p class="reference">Referenced by <a class="el" href="encoder_8c_source.html#l00093">encoder_get_electronic_angle()</a>, and <a class="el" href="foc_8c_source.html#l00033">foc_calibrate_phase()</a>.</p>
</div>
</div>
<a id="aa5d6a09bb36a38d53242d3b2401a0d1a" name="aa5d6a09bb36a38d53242d3b2401a0d1a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa5d6a09bb36a38d53242d3b2401a0d1a">◆ </a></span>encoder_read_data()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">unsigned short encoder_read_data </td>
<td>(</td>
<td class="paramtype">unsigned short </td>
<td class="paramname"><em>TxData</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>read data from the register of the magnetic encoder </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">TxData</td><td>data to be sent to magnetic encoder </td></tr>
</table>
</dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
<tr><td class="paramname">data</td><td>read from magnetic encoder </td></tr>
</table>
</dd>
</dl>
<p class="definition">Definition at line <a class="el" href="encoder_8c_source.html#l00056">56</a> of file <a class="el" href="encoder_8c_source.html">encoder.c</a>.</p>
<p class="reference">References <a class="el" href="encoder_8c_source.html#l00044">encoder_delay()</a>, and <a class="el" href="spi_8c_source.html#l00019">spi_readwrite_halfworld()</a>.</p>
<p class="reference">Referenced by <a class="el" href="encoder_8c_source.html#l00076">encoder_get_mechanical_angle()</a>, and <a class="el" href="encoder_8c_source.html#l00119">encoder_zeroing()</a>.</p>
</div>
</div>
<a id="a82c51d78a1f7bb4a5976974ab8d7ffe5" name="a82c51d78a1f7bb4a5976974ab8d7ffe5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a82c51d78a1f7bb4a5976974ab8d7ffe5">◆ </a></span>encoder_update_speed()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void encoder_update_speed </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>called every 2 milliseconds to calculate the speed. </p>
<p class="definition">Definition at line <a class="el" href="encoder_8c_source.html#l00106">106</a> of file <a class="el" href="encoder_8c_source.html">encoder.c</a>.</p>
<p class="reference">References <a class="el" href="filter_8c_source.html#l00056">filter_update_value()</a>, <a class="el" href="foc_8c_source.html#l00020">FOC_Struct</a>, <a class="el" href="foc_8h_source.html#l00019">FOC_Structure_t::rotate_speed</a>, <a class="el" href="encoder_8c_source.html#l00039">systick_mechanical_angle_last</a>, <a class="el" href="encoder_8c_source.html#l00034">total_machine_angle</a>, and <a class="el" href="filter_8c_source.html#l00019">velocity_filter</a>.</p>
<p class="reference">Referenced by <a class="el" href="gd32f1x0__it_8c_source.html#l00077">SysTick_Handler()</a>.</p>
</div>
</div>
<a id="ad28e37c20d065e5014ea3a5f2de91e82" name="ad28e37c20d065e5014ea3a5f2de91e82"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad28e37c20d065e5014ea3a5f2de91e82">◆ </a></span>encoder_zeroing()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void encoder_zeroing </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>correct the mechanical angle zero deviation between the magnetic encoder and FOC. </p>
<p class="definition">Definition at line <a class="el" href="encoder_8c_source.html#l00119">119</a> of file <a class="el" href="encoder_8c_source.html">encoder.c</a>.</p>
<p class="reference">References <a class="el" href="config_8h_source.html#l00019">CALI_TORQUE</a>, <a class="el" href="system_8c_source.html#l00030">delayms()</a>, <a class="el" href="encoder_8c_source.html#l00056">encoder_read_data()</a>, <a class="el" href="foc_8c_source.html#l00099">foc_calculate_dutycycle()</a>, <a class="el" href="encoder_8c_source.html#l00023">machine_angle_offset</a>, <a class="el" href="encoder_8c_source.html#l00034">total_machine_angle</a>, and <a class="el" href="timer_8c_source.html#l00020">update_pwm_dutycycle()</a>.</p>
<p class="reference">Referenced by <a class="el" href="main_8c_source.html#l00139">main()</a>.</p>
</div>
</div>
<h2 class="groupheader">Variable Documentation</h2>
<a id="af58d29dfca2d46874e2da41b45b48482" name="af58d29dfca2d46874e2da41b45b48482"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af58d29dfca2d46874e2da41b45b48482">◆ </a></span>last_mechanical_angle</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">volatile unsigned short last_mechanical_angle = 0</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>the mechanical angle at the last moment is used to calculate the angle differential value and realize the angle measurement function. </p>
<p class="definition">Definition at line <a class="el" href="encoder_8c_source.html#l00029">29</a> of file <a class="el" href="encoder_8c_source.html">encoder.c</a>.</p>
<p class="reference">Referenced by <a class="el" href="encoder_8c_source.html#l00076">encoder_get_mechanical_angle()</a>.</p>
</div>
</div>
<a id="a562eacc7259f25574b1ab8ce9d7c6a3e" name="a562eacc7259f25574b1ab8ce9d7c6a3e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a562eacc7259f25574b1ab8ce9d7c6a3e">◆ </a></span>machine_angle_offset</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">volatile unsigned short machine_angle_offset = 0</td>
</tr>
</table>
</div><div class="memdoc">
<p>mechanical angle offset, which is used to align the mechanical angle with the zero point of the electrical angle. </p>
<p class="definition">Definition at line <a class="el" href="encoder_8c_source.html#l00023">23</a> of file <a class="el" href="encoder_8c_source.html">encoder.c</a>.</p>
<p class="reference">Referenced by <a class="el" href="encoder_8c_source.html#l00076">encoder_get_mechanical_angle()</a>, <a class="el" href="encoder_8c_source.html#l00119">encoder_zeroing()</a>, <a class="el" href="flash_8c_source.html#l00046">flash_read_parameters()</a>, <a class="el" href="flash_8c_source.html#l00026">flash_write_parameters()</a>, and <a class="el" href="report_8c_source.html#l00015">report_local_variable()</a>.</p>
</div>
</div>
<a id="aeb44dbae80bf7edaf6189fb8e2278f99" name="aeb44dbae80bf7edaf6189fb8e2278f99"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aeb44dbae80bf7edaf6189fb8e2278f99">◆ </a></span>systick_mechanical_angle_last</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">volatile long long systick_mechanical_angle_last = 0</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>the mechanical angle at the last moment is used to calculate the rotation speed of the motor rotor. </p>
<p class="definition">Definition at line <a class="el" href="encoder_8c_source.html#l00039">39</a> of file <a class="el" href="encoder_8c_source.html">encoder.c</a>.</p>
<p class="reference">Referenced by <a class="el" href="encoder_8c_source.html#l00106">encoder_update_speed()</a>.</p>
</div>
</div>
<a id="a97999bca302a3ae095acd9977fee272a" name="a97999bca302a3ae095acd9977fee272a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a97999bca302a3ae095acd9977fee272a">◆ </a></span>total_machine_angle</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">volatile long long total_machine_angle = 0</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>the total mechanical angle since power on is used to calculate the angle integral value and realize the angle measurement function. </p>
<p class="definition">Definition at line <a class="el" href="encoder_8c_source.html#l00034">34</a> of file <a class="el" href="encoder_8c_source.html">encoder.c</a>.</p>
<p class="reference">Referenced by <a class="el" href="encoder_8c_source.html#l00076">encoder_get_mechanical_angle()</a>, <a class="el" href="encoder_8c_source.html#l00106">encoder_update_speed()</a>, and <a class="el" href="encoder_8c_source.html#l00119">encoder_zeroing()</a>.</p>
</div>
</div>
</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.4
</small></address>
</body>
</html>