123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://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.10"/>
- <title>CoffeePi: timer.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="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>
- <script type="text/javascript">
- $(document).ready(function() { init_search(); });
- </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">CoffeePi
- </div>
- <div id="projectbrief">Coffee machine control for Raspberry Pi</div>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <!-- end header part -->
- <!-- Generated by Doxygen 1.8.10 -->
- <script type="text/javascript">
- var searchBox = new SearchBox("searchBox", "search",false,'Search');
- </script>
- <div id="navrow1" class="tabs">
- <ul class="tablist">
- <li><a href="index.html"><span>Main Page</span></a></li>
- <li><a href="annotated.html"><span>Data Structures</span></a></li>
- <li class="current"><a href="files.html"><span>Files</span></a></li>
- <li>
- <div id="MSearchBox" class="MSearchBoxInactive">
- <span class="left">
- <img id="MSearchSelect" src="search/mag_sel.png"
- onmouseover="return searchBox.OnSearchSelectShow()"
- onmouseout="return searchBox.OnSearchSelectHide()"
- alt=""/>
- <input type="text" id="MSearchField" value="Search" accesskey="S"
- onfocus="searchBox.OnSearchFieldFocus(true)"
- onblur="searchBox.OnSearchFieldFocus(false)"
- onkeyup="searchBox.OnSearchFieldChange(event)"/>
- </span><span class="right">
- <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
- </span>
- </div>
- </li>
- </ul>
- </div>
- <div id="navrow2" class="tabs2">
- <ul class="tablist">
- <li><a href="files.html"><span>File List</span></a></li>
- <li><a href="globals.html"><span>Globals</span></a></li>
- </ul>
- </div>
- </div><!-- top -->
- <!-- 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">timer.h</div> </div>
- </div><!--header-->
- <div class="contents">
- <a href="timer_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="comment">/*</span></div>
- <div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment"> * timer.h</span></div>
- <div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment"> *</span></div>
- <div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment"> * Created on: Nov 9, 2015</span></div>
- <div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment"> * Author: Philipp Hinz</span></div>
- <div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment"> */</span></div>
- <div class="line"><a name="l00007"></a><span class="lineno"> 7</span> </div>
- <div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="preprocessor">#ifndef TIMER_H_</span></div>
- <div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="preprocessor">#define TIMER_H_</span></div>
- <div class="line"><a name="l00010"></a><span class="lineno"> 10</span> </div>
- <div class="line"><a name="l00017"></a><span class="lineno"><a class="line" href="classtimer.html"> 17</a></span> <span class="keyword">class </span><a class="code" href="classtimer.html">timer</a> {</div>
- <div class="line"><a name="l00018"></a><span class="lineno"> 18</span> <span class="keyword">public</span>:</div>
- <div class="line"><a name="l00019"></a><span class="lineno"> 19</span>  <a class="code" href="classtimer.html#a863dd9a194499a5ebbaf6937969916f2">timer</a>(<span class="keywordtype">void</span> (*handler)(<span class="keywordtype">void</span>));</div>
- <div class="line"><a name="l00020"></a><span class="lineno"> 20</span>  <a class="code" href="classtimer.html#a863dd9a194499a5ebbaf6937969916f2">timer</a>(<span class="keywordtype">void</span> *(*handler)(<span class="keywordtype">void</span> *));</div>
- <div class="line"><a name="l00021"></a><span class="lineno"> 21</span>  <span class="keywordtype">void</span> <a class="code" href="classtimer.html#a0a4b48605728320ce7a5a825e34e16f2">setDivider</a>(<span class="keywordtype">int</span> divider);</div>
- <div class="line"><a name="l00022"></a><span class="lineno"> 22</span>  <span class="keywordtype">int</span> <a class="code" href="classtimer.html#a3d5386a682a23df5c6a841ce8fc55bd4">getDivider</a>();</div>
- <div class="line"><a name="l00023"></a><span class="lineno"> 23</span>  <span class="keywordtype">void</span> <a class="code" href="classtimer.html#a7d9f6d9f98d51534be127d57f497b345">call</a>();</div>
- <div class="line"><a name="l00024"></a><span class="lineno"> 24</span>  <span class="keywordtype">void</span> <a class="code" href="classtimer.html#a9aa894a57748b2bdf3adce46f5736794">start</a>();</div>
- <div class="line"><a name="l00025"></a><span class="lineno"> 25</span>  <span class="keywordtype">void</span> <a class="code" href="classtimer.html#a3218d61649e284071544b17c8c915ecc">stop</a>();</div>
- <div class="line"><a name="l00026"></a><span class="lineno"> 26</span>  <span class="keywordtype">bool</span> <a class="code" href="classtimer.html#abbb117c0ae32aa48df5df60328e224f9">isActive</a>();</div>
- <div class="line"><a name="l00027"></a><span class="lineno"><a class="line" href="classtimer.html#a296c5e65582e19eaf61ae0bffa4071dc"> 27</a></span>  <a class="code" href="classtimer.html">timer</a> *<a class="code" href="classtimer.html#a296c5e65582e19eaf61ae0bffa4071dc">next</a>; </div>
- <div class="line"><a name="l00028"></a><span class="lineno"> 28</span> <span class="keyword">private</span>:</div>
- <div class="line"><a name="l00029"></a><span class="lineno"> 29</span>  void (*handler)(void);</div>
- <div class="line"><a name="l00030"></a><span class="lineno"> 30</span>  <span class="keywordtype">void</span> *(*thandler)(<span class="keywordtype">void</span> *);</div>
- <div class="line"><a name="l00031"></a><span class="lineno"> 31</span>  <span class="keywordtype">int</span> divider;</div>
- <div class="line"><a name="l00032"></a><span class="lineno"> 32</span>  <span class="keywordtype">int</span> <span class="keywordtype">id</span> = 0; </div>
- <div class="line"><a name="l00033"></a><span class="lineno"> 33</span>  <span class="keywordtype">bool</span> active;</div>
- <div class="line"><a name="l00034"></a><span class="lineno"> 34</span>  <span class="keywordtype">bool</span> asThread; </div>
- <div class="line"><a name="l00035"></a><span class="lineno"> 35</span>  pthread_t thread;</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> </div>
- <div class="line"><a name="l00038"></a><span class="lineno"> 38</span> <span class="keywordtype">void</span> <a class="code" href="timer_8h.html#a9e737e3249388fb2e50d868bad69c688">initTimers</a>(<span class="keywordtype">void</span>);</div>
- <div class="line"><a name="l00039"></a><span class="lineno"> 39</span> <span class="keywordtype">void</span> <a class="code" href="timer_8h.html#a43ed436d8c1803ced3029a909320a841">stopTimers</a>(<span class="keywordtype">void</span>);</div>
- <div class="line"><a name="l00040"></a><span class="lineno"> 40</span> <span class="keywordtype">void</span> *<a class="code" href="timer_8h.html#ae9859727c0e51a70b4ff5f47d2527a77">nullThread</a>(<span class="keywordtype">void</span> *threadid);</div>
- <div class="line"><a name="l00041"></a><span class="lineno"> 41</span> </div>
- <div class="line"><a name="l00042"></a><span class="lineno"><a class="line" href="timer_8h.html#ad6f1d374549d22100d676d5fcac0a7e5"> 42</a></span> <span class="preprocessor">#define SIG SIGRTMIN</span></div>
- <div class="line"><a name="l00043"></a><span class="lineno"><a class="line" href="timer_8h.html#af3ec03c16ee82e8578cfd8fd133d7a6f"> 43</a></span> <span class="preprocessor">#define errExit(msg) do { perror(msg); exit(EXIT_FAILURE); } while (0)</span></div>
- <div class="line"><a name="l00044"></a><span class="lineno"><a class="line" href="timer_8h.html#a2694a39dfd1fa087ca6f9f391c91dae7"> 44</a></span> <span class="preprocessor">#define CLOCKID CLOCK_REALTIME</span></div>
- <div class="line"><a name="l00045"></a><span class="lineno"> 45</span> </div>
- <div class="line"><a name="l00046"></a><span class="lineno"> 46</span> <span class="preprocessor">#endif </span><span class="comment">/* TIMER_H_ */</span><span class="preprocessor"></span></div>
- <div class="ttc" id="classtimer_html_a863dd9a194499a5ebbaf6937969916f2"><div class="ttname"><a href="classtimer.html#a863dd9a194499a5ebbaf6937969916f2">timer::timer</a></div><div class="ttdeci">timer(void(*handler)(void))</div><div class="ttdoc">Timer constructor Depending on the call of the constructor the handler will be called as thread or no...</div><div class="ttdef"><b>Definition:</b> timer.cpp:34</div></div>
- <div class="ttc" id="timer_8h_html_a9e737e3249388fb2e50d868bad69c688"><div class="ttname"><a href="timer_8h.html#a9e737e3249388fb2e50d868bad69c688">initTimers</a></div><div class="ttdeci">void initTimers(void)</div><div class="ttdoc">inits the system timer based on signals </div><div class="ttdef"><b>Definition:</b> timer.cpp:153</div></div>
- <div class="ttc" id="classtimer_html_a7d9f6d9f98d51534be127d57f497b345"><div class="ttname"><a href="classtimer.html#a7d9f6d9f98d51534be127d57f497b345">timer::call</a></div><div class="ttdeci">void call()</div><div class="ttdoc">Calls the timer handler if enabled. </div><div class="ttdef"><b>Definition:</b> timer.cpp:69</div></div>
- <div class="ttc" id="timer_8h_html_ae9859727c0e51a70b4ff5f47d2527a77"><div class="ttname"><a href="timer_8h.html#ae9859727c0e51a70b4ff5f47d2527a77">nullThread</a></div><div class="ttdeci">void * nullThread(void *threadid)</div><div class="ttdoc">This is a dummy thread. </div><div class="ttdef"><b>Definition:</b> timer.cpp:229</div></div>
- <div class="ttc" id="classtimer_html_a296c5e65582e19eaf61ae0bffa4071dc"><div class="ttname"><a href="classtimer.html#a296c5e65582e19eaf61ae0bffa4071dc">timer::next</a></div><div class="ttdeci">timer * next</div><div class="ttdoc">contains the pointer on the next timer element of the list </div><div class="ttdef"><b>Definition:</b> timer.h:27</div></div>
- <div class="ttc" id="classtimer_html_a9aa894a57748b2bdf3adce46f5736794"><div class="ttname"><a href="classtimer.html#a9aa894a57748b2bdf3adce46f5736794">timer::start</a></div><div class="ttdeci">void start()</div><div class="ttdoc">enables the timer </div><div class="ttdef"><b>Definition:</b> timer.cpp:93</div></div>
- <div class="ttc" id="timer_8h_html_a43ed436d8c1803ced3029a909320a841"><div class="ttname"><a href="timer_8h.html#a43ed436d8c1803ced3029a909320a841">stopTimers</a></div><div class="ttdeci">void stopTimers(void)</div><div class="ttdoc">Stops all existing timers. </div><div class="ttdef"><b>Definition:</b> timer.cpp:214</div></div>
- <div class="ttc" id="classtimer_html_abbb117c0ae32aa48df5df60328e224f9"><div class="ttname"><a href="classtimer.html#abbb117c0ae32aa48df5df60328e224f9">timer::isActive</a></div><div class="ttdeci">bool isActive()</div><div class="ttdoc">Returns the timers active state. </div><div class="ttdef"><b>Definition:</b> timer.cpp:128</div></div>
- <div class="ttc" id="classtimer_html_a0a4b48605728320ce7a5a825e34e16f2"><div class="ttname"><a href="classtimer.html#a0a4b48605728320ce7a5a825e34e16f2">timer::setDivider</a></div><div class="ttdeci">void setDivider(int divider)</div><div class="ttdoc">sets the divider for this timer (based on system timer) </div><div class="ttdef"><b>Definition:</b> timer.cpp:110</div></div>
- <div class="ttc" id="classtimer_html_a3d5386a682a23df5c6a841ce8fc55bd4"><div class="ttname"><a href="classtimer.html#a3d5386a682a23df5c6a841ce8fc55bd4">timer::getDivider</a></div><div class="ttdeci">int getDivider()</div><div class="ttdoc">reads the timer divider </div><div class="ttdef"><b>Definition:</b> timer.cpp:119</div></div>
- <div class="ttc" id="classtimer_html"><div class="ttname"><a href="classtimer.html">timer</a></div><div class="ttdoc">Timer Class This class allows the creation of multiple timers that are based by a divider on a single...</div><div class="ttdef"><b>Definition:</b> timer.h:17</div></div>
- <div class="ttc" id="classtimer_html_a3218d61649e284071544b17c8c915ecc"><div class="ttname"><a href="classtimer.html#a3218d61649e284071544b17c8c915ecc">timer::stop</a></div><div class="ttdeci">void stop()</div><div class="ttdoc">disables the timer </div><div class="ttdef"><b>Definition:</b> timer.cpp:101</div></div>
- </div><!-- fragment --></div><!-- contents -->
- <!-- start footer part -->
- <hr class="footer"/><address class="footer"><small>
- Generated by  <a href="http://www.doxygen.org/index.html">
- <img class="footer" src="doxygen.png" alt="doxygen"/>
- </a> 1.8.10
- </small></address>
- </body>
- </html>
|