-
Notifications
You must be signed in to change notification settings - Fork 0
/
_encoder_8h_source.html
121 lines (119 loc) · 16.4 KB
/
_encoder_8h_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
<!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=9"/>
<meta name="generator" content="Doxygen 1.8.15"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>myWRIO: C:/Users/jackb/OneDrive - etu.univ-lyon1.fr/TERi/Eclipse/workspace/APIForRIO/src/Encoder.h 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="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(document).ready(initResizable);
/* @license-end */</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="projectalign" style="padding-left: 0.5em;">
<div id="projectname">myWRIO
</div>
<div id="projectbrief">C++ framework for NationalInstruments myRIO</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.15 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @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:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('_encoder_8h_source.html','');});
/* @license-end */
</script>
<div id="doc-content">
<!-- 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 class="header">
<div class="headertitle">
<div class="title">Encoder.h</div> </div>
</div><!--header-->
<div class="contents">
<a href="_encoder_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="preprocessor">#ifndef ENCODER_H_</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="preprocessor">#define ENCODER_H_</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> </div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="preprocessor">#include "<a class="code" href="_my_r_i_o_8h.html">MyRio.h</a>"</span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="preprocessor">#include <thread></span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> </div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="keyword">namespace </span><a class="code" href="namespacemy_r_i_o.html">myRIO</a> {</div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span> </div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="keyword">enum</span> {</div><div class="line"><a name="l00013"></a><span class="lineno"><a class="line" href="namespacemy_r_i_o.html#aa41085b2c18c86978a525721246c431aab580f47ab426e89671f1bc25b0dbf200"> 13</a></span>  <a class="code" href="namespacemy_r_i_o.html#aa41085b2c18c86978a525721246c431aab580f47ab426e89671f1bc25b0dbf200">ENCA</a>,</div><div class="line"><a name="l00014"></a><span class="lineno"><a class="line" href="namespacemy_r_i_o.html#aa41085b2c18c86978a525721246c431aa13af33ab4c0cc4ddab6980fe97e04b3d"> 14</a></span>  <a class="code" href="namespacemy_r_i_o.html#aa41085b2c18c86978a525721246c431aa13af33ab4c0cc4ddab6980fe97e04b3d">ENCB</a></div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span> };</div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span> </div><div class="line"><a name="l00020"></a><span class="lineno"><a class="line" href="classmy_r_i_o_1_1_encoder.html"> 20</a></span> <span class="keyword">class </span><a class="code" href="classmy_r_i_o_1_1_encoder.html">Encoder</a> {</div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span> <span class="keyword">public</span>:</div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span>  <a class="code" href="classmy_r_i_o_1_1_encoder.html#a8d89d75841eb5e23536487eaeb999d3f">Encoder</a>(uint8_t channel);</div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span>  <span class="keywordtype">void</span> <a class="code" href="classmy_r_i_o_1_1_encoder.html#a3b24cb376dc2c4147808b9964e4605cd">read</a>(uint32_t &enc);</div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span>  <span class="keywordtype">void</span> <a class="code" href="classmy_r_i_o_1_1_encoder.html#a1513661fcb211391714e8cd95ae6d720">direction</a>(<span class="keywordtype">bool</span> &dir);</div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span>  <span class="keywordtype">void</span> <a class="code" href="classmy_r_i_o_1_1_encoder.html#aa474701b361c7139230d41ce4b8f5959">startThread</a>(std::function<<span class="keywordtype">void</span>(<span class="keywordtype">long</span> enc, <span class="keywordtype">bool</span> dir)> func, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> threshold);</div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span>  <span class="keywordtype">void</span> <a class="code" href="classmy_r_i_o_1_1_encoder.html#afccd1e7bca091b7019b9c463eba43083">stopThread</a>();</div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span> </div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span>  <a class="code" href="classmy_r_i_o_1_1_encoder.html#a87cc8067c98c0ab2134dee3822e3b250">~Encoder</a>();</div><div class="line"><a name="l00029"></a><span class="lineno"> 29</span> <span class="keyword">private</span>:</div><div class="line"><a name="l00030"></a><span class="lineno"><a class="line" href="classmy_r_i_o_1_1_encoder.html#a21ef531ee5b502c4dbea4c805a6a4486"> 30</a></span>  std::thread* <a class="code" href="classmy_r_i_o_1_1_encoder.html#a21ef531ee5b502c4dbea4c805a6a4486">th</a>;</div><div class="line"><a name="l00031"></a><span class="lineno"><a class="line" href="classmy_r_i_o_1_1_encoder.html#a8219b58d123678458b367bfcb35ee159"> 31</a></span>  <span class="keywordtype">bool</span>* <a class="code" href="classmy_r_i_o_1_1_encoder.html#a8219b58d123678458b367bfcb35ee159">run</a>;</div><div class="line"><a name="l00032"></a><span class="lineno"><a class="line" href="classmy_r_i_o_1_1_encoder.html#ab54e00d10d95c85f860e8ba93a2ab4c1"> 32</a></span>  uint32_t <a class="code" href="classmy_r_i_o_1_1_encoder.html#ab54e00d10d95c85f860e8ba93a2ab4c1">regCnfg</a>;</div><div class="line"><a name="l00033"></a><span class="lineno"><a class="line" href="classmy_r_i_o_1_1_encoder.html#abe20d6a40bbdb02e7d246390f1a7df16"> 33</a></span>  uint32_t <a class="code" href="classmy_r_i_o_1_1_encoder.html#abe20d6a40bbdb02e7d246390f1a7df16">regCntr</a>;</div><div class="line"><a name="l00034"></a><span class="lineno"><a class="line" href="classmy_r_i_o_1_1_encoder.html#a2a8e3731a9f503bd9e4f0ad4b392ba4c"> 34</a></span>  uint32_t <a class="code" href="classmy_r_i_o_1_1_encoder.html#a2a8e3731a9f503bd9e4f0ad4b392ba4c">regStat</a>;</div><div class="line"><a name="l00035"></a><span class="lineno"> 35</span> };</div><div class="line"><a name="l00036"></a><span class="lineno"> 36</span> </div><div class="line"><a name="l00037"></a><span class="lineno"> 37</span> } <span class="comment">/* namespace myRIO */</span></div><div class="line"><a name="l00038"></a><span class="lineno"> 38</span> </div><div class="line"><a name="l00039"></a><span class="lineno"> 39</span> <span class="preprocessor">#endif </span><span class="comment">/* ENCODER_H_ */</span><span class="preprocessor"></span></div><div class="ttc" id="classmy_r_i_o_1_1_encoder_html_a1513661fcb211391714e8cd95ae6d720"><div class="ttname"><a href="classmy_r_i_o_1_1_encoder.html#a1513661fcb211391714e8cd95ae6d720">myRIO::Encoder::direction</a></div><div class="ttdeci">void direction(bool &dir)</div><div class="ttdoc">Return the direction of the motor (CCW -> 0, CW -> 1)</div><div class="ttdef"><b>Definition:</b> <a href="_encoder_8cpp_source.html#l00051">Encoder.cpp:51</a></div></div>
<div class="ttc" id="classmy_r_i_o_1_1_encoder_html_a87cc8067c98c0ab2134dee3822e3b250"><div class="ttname"><a href="classmy_r_i_o_1_1_encoder.html#a87cc8067c98c0ab2134dee3822e3b250">myRIO::Encoder::~Encoder</a></div><div class="ttdeci">~Encoder()</div><div class="ttdoc">Destructeur Stop the encoder and disable it.</div><div class="ttdef"><b>Definition:</b> <a href="_encoder_8cpp_source.html#l00092">Encoder.cpp:92</a></div></div>
<div class="ttc" id="classmy_r_i_o_1_1_encoder_html_a21ef531ee5b502c4dbea4c805a6a4486"><div class="ttname"><a href="classmy_r_i_o_1_1_encoder.html#a21ef531ee5b502c4dbea4c805a6a4486">myRIO::Encoder::th</a></div><div class="ttdeci">std::thread * th</div><div class="ttdef"><b>Definition:</b> <a href="_encoder_8h_source.html#l00030">Encoder.h:30</a></div></div>
<div class="ttc" id="namespacemy_r_i_o_html_aa41085b2c18c86978a525721246c431aab580f47ab426e89671f1bc25b0dbf200"><div class="ttname"><a href="namespacemy_r_i_o.html#aa41085b2c18c86978a525721246c431aab580f47ab426e89671f1bc25b0dbf200">myRIO::ENCA</a></div><div class="ttdef"><b>Definition:</b> <a href="_encoder_8h_source.html#l00013">Encoder.h:13</a></div></div>
<div class="ttc" id="classmy_r_i_o_1_1_encoder_html_a3b24cb376dc2c4147808b9964e4605cd"><div class="ttname"><a href="classmy_r_i_o_1_1_encoder.html#a3b24cb376dc2c4147808b9964e4605cd">myRIO::Encoder::read</a></div><div class="ttdeci">void read(uint32_t &enc)</div><div class="ttdoc">Read encoder Reads the value of the encoder.</div><div class="ttdef"><b>Definition:</b> <a href="_encoder_8cpp_source.html#l00044">Encoder.cpp:44</a></div></div>
<div class="ttc" id="_my_r_i_o_8h_html"><div class="ttname"><a href="_my_r_i_o_8h.html">MyRIO.h</a></div></div>
<div class="ttc" id="classmy_r_i_o_1_1_encoder_html_aa474701b361c7139230d41ce4b8f5959"><div class="ttname"><a href="classmy_r_i_o_1_1_encoder.html#aa474701b361c7139230d41ce4b8f5959">myRIO::Encoder::startThread</a></div><div class="ttdeci">void startThread(std::function< void(long enc, bool dir)> func, unsigned int threshold)</div><div class="ttdoc">Start a thread that will monitor the encoder register.</div><div class="ttdef"><b>Definition:</b> <a href="_encoder_8cpp_source.html#l00065">Encoder.cpp:65</a></div></div>
<div class="ttc" id="classmy_r_i_o_1_1_encoder_html_a8d89d75841eb5e23536487eaeb999d3f"><div class="ttname"><a href="classmy_r_i_o_1_1_encoder.html#a8d89d75841eb5e23536487eaeb999d3f">myRIO::Encoder::Encoder</a></div><div class="ttdeci">Encoder(uint8_t channel)</div><div class="ttdoc">Create an Encoder Enable channel A or B encoder.</div><div class="ttdef"><b>Definition:</b> <a href="_encoder_8cpp_source.html#l00012">Encoder.cpp:12</a></div></div>
<div class="ttc" id="classmy_r_i_o_1_1_encoder_html_ab54e00d10d95c85f860e8ba93a2ab4c1"><div class="ttname"><a href="classmy_r_i_o_1_1_encoder.html#ab54e00d10d95c85f860e8ba93a2ab4c1">myRIO::Encoder::regCnfg</a></div><div class="ttdeci">uint32_t regCnfg</div><div class="ttdef"><b>Definition:</b> <a href="_encoder_8h_source.html#l00032">Encoder.h:32</a></div></div>
<div class="ttc" id="classmy_r_i_o_1_1_encoder_html_a2a8e3731a9f503bd9e4f0ad4b392ba4c"><div class="ttname"><a href="classmy_r_i_o_1_1_encoder.html#a2a8e3731a9f503bd9e4f0ad4b392ba4c">myRIO::Encoder::regStat</a></div><div class="ttdeci">uint32_t regStat</div><div class="ttdef"><b>Definition:</b> <a href="_encoder_8h_source.html#l00034">Encoder.h:34</a></div></div>
<div class="ttc" id="classmy_r_i_o_1_1_encoder_html_abe20d6a40bbdb02e7d246390f1a7df16"><div class="ttname"><a href="classmy_r_i_o_1_1_encoder.html#abe20d6a40bbdb02e7d246390f1a7df16">myRIO::Encoder::regCntr</a></div><div class="ttdeci">uint32_t regCntr</div><div class="ttdef"><b>Definition:</b> <a href="_encoder_8h_source.html#l00033">Encoder.h:33</a></div></div>
<div class="ttc" id="classmy_r_i_o_1_1_encoder_html_a8219b58d123678458b367bfcb35ee159"><div class="ttname"><a href="classmy_r_i_o_1_1_encoder.html#a8219b58d123678458b367bfcb35ee159">myRIO::Encoder::run</a></div><div class="ttdeci">bool * run</div><div class="ttdef"><b>Definition:</b> <a href="_encoder_8h_source.html#l00031">Encoder.h:31</a></div></div>
<div class="ttc" id="namespacemy_r_i_o_html"><div class="ttname"><a href="namespacemy_r_i_o.html">myRIO</a></div><div class="ttdef"><b>Definition:</b> <a href="_acc_8h_source.html#l00008">Acc.h:8</a></div></div>
<div class="ttc" id="namespacemy_r_i_o_html_aa41085b2c18c86978a525721246c431aa13af33ab4c0cc4ddab6980fe97e04b3d"><div class="ttname"><a href="namespacemy_r_i_o.html#aa41085b2c18c86978a525721246c431aa13af33ab4c0cc4ddab6980fe97e04b3d">myRIO::ENCB</a></div><div class="ttdef"><b>Definition:</b> <a href="_encoder_8h_source.html#l00014">Encoder.h:14</a></div></div>
<div class="ttc" id="classmy_r_i_o_1_1_encoder_html_afccd1e7bca091b7019b9c463eba43083"><div class="ttname"><a href="classmy_r_i_o_1_1_encoder.html#afccd1e7bca091b7019b9c463eba43083">myRIO::Encoder::stopThread</a></div><div class="ttdeci">void stopThread()</div><div class="ttdoc">Stop the encoder thread.</div><div class="ttdef"><b>Definition:</b> <a href="_encoder_8cpp_source.html#l00085">Encoder.cpp:85</a></div></div>
<div class="ttc" id="classmy_r_i_o_1_1_encoder_html"><div class="ttname"><a href="classmy_r_i_o_1_1_encoder.html">myRIO::Encoder</a></div><div class="ttdoc">Embedded encoder.</div><div class="ttdef"><b>Definition:</b> <a href="_encoder_8h_source.html#l00020">Encoder.h:20</a></div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="dir_98fb12f9c07806436144af22cad486e4.html">Eclipse</a></li><li class="navelem"><a class="el" href="dir_e17da8bc7b823c1f82c904fefd57a078.html">workspace</a></li><li class="navelem"><a class="el" href="dir_814e4b17f8683e03c2431c0e57f58eb6.html">APIForRIO</a></li><li class="navelem"><a class="el" href="dir_c047dd42b8eba02cf6377cb404ab9432.html">src</a></li><li class="navelem"><a class="el" href="_encoder_8h.html">Encoder.h</a></li>
<li class="footer">Generated by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.15 </li>
</ul>
</div>
</body>
</html>