coffee_8h_source.html 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
  5. <meta http-equiv="X-UA-Compatible" content="IE=9"/>
  6. <meta name="generator" content="Doxygen 1.8.10"/>
  7. <title>CoffeePi: coffee.h Source File</title>
  8. <link href="tabs.css" rel="stylesheet" type="text/css"/>
  9. <script type="text/javascript" src="jquery.js"></script>
  10. <script type="text/javascript" src="dynsections.js"></script>
  11. <link href="search/search.css" rel="stylesheet" type="text/css"/>
  12. <script type="text/javascript" src="search/searchdata.js"></script>
  13. <script type="text/javascript" src="search/search.js"></script>
  14. <script type="text/javascript">
  15. $(document).ready(function() { init_search(); });
  16. </script>
  17. <link href="doxygen.css" rel="stylesheet" type="text/css" />
  18. </head>
  19. <body>
  20. <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
  21. <div id="titlearea">
  22. <table cellspacing="0" cellpadding="0">
  23. <tbody>
  24. <tr style="height: 56px;">
  25. <td id="projectalign" style="padding-left: 0.5em;">
  26. <div id="projectname">CoffeePi
  27. </div>
  28. <div id="projectbrief">Coffee machine control for Raspberry Pi</div>
  29. </td>
  30. </tr>
  31. </tbody>
  32. </table>
  33. </div>
  34. <!-- end header part -->
  35. <!-- Generated by Doxygen 1.8.10 -->
  36. <script type="text/javascript">
  37. var searchBox = new SearchBox("searchBox", "search",false,'Search');
  38. </script>
  39. <div id="navrow1" class="tabs">
  40. <ul class="tablist">
  41. <li><a href="index.html"><span>Main&#160;Page</span></a></li>
  42. <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
  43. <li class="current"><a href="files.html"><span>Files</span></a></li>
  44. <li>
  45. <div id="MSearchBox" class="MSearchBoxInactive">
  46. <span class="left">
  47. <img id="MSearchSelect" src="search/mag_sel.png"
  48. onmouseover="return searchBox.OnSearchSelectShow()"
  49. onmouseout="return searchBox.OnSearchSelectHide()"
  50. alt=""/>
  51. <input type="text" id="MSearchField" value="Search" accesskey="S"
  52. onfocus="searchBox.OnSearchFieldFocus(true)"
  53. onblur="searchBox.OnSearchFieldFocus(false)"
  54. onkeyup="searchBox.OnSearchFieldChange(event)"/>
  55. </span><span class="right">
  56. <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
  57. </span>
  58. </div>
  59. </li>
  60. </ul>
  61. </div>
  62. <div id="navrow2" class="tabs2">
  63. <ul class="tablist">
  64. <li><a href="files.html"><span>File&#160;List</span></a></li>
  65. <li><a href="globals.html"><span>Globals</span></a></li>
  66. </ul>
  67. </div>
  68. </div><!-- top -->
  69. <!-- window showing the filter options -->
  70. <div id="MSearchSelectWindow"
  71. onmouseover="return searchBox.OnSearchSelectShow()"
  72. onmouseout="return searchBox.OnSearchSelectHide()"
  73. onkeydown="return searchBox.OnSearchSelectKey(event)">
  74. </div>
  75. <!-- iframe showing the search results (closed by default) -->
  76. <div id="MSearchResultsWindow">
  77. <iframe src="javascript:void(0)" frameborder="0"
  78. name="MSearchResults" id="MSearchResults">
  79. </iframe>
  80. </div>
  81. <div class="header">
  82. <div class="headertitle">
  83. <div class="title">coffee.h</div> </div>
  84. </div><!--header-->
  85. <div class="contents">
  86. <a href="coffee_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>&#160;<span class="comment">/*</span></div>
  87. <div class="line"><a name="l00002"></a><span class="lineno"> 2</span>&#160;<span class="comment"> * coffee.h</span></div>
  88. <div class="line"><a name="l00003"></a><span class="lineno"> 3</span>&#160;<span class="comment"> *</span></div>
  89. <div class="line"><a name="l00004"></a><span class="lineno"> 4</span>&#160;<span class="comment"> * Created on: Sep 25, 2017</span></div>
  90. <div class="line"><a name="l00005"></a><span class="lineno"> 5</span>&#160;<span class="comment"> * Author: sebastian</span></div>
  91. <div class="line"><a name="l00006"></a><span class="lineno"> 6</span>&#160;<span class="comment"> */</span></div>
  92. <div class="line"><a name="l00007"></a><span class="lineno"> 7</span>&#160;</div>
  93. <div class="line"><a name="l00008"></a><span class="lineno"> 8</span>&#160;<span class="preprocessor">#ifndef COFFEE_H_</span></div>
  94. <div class="line"><a name="l00009"></a><span class="lineno"> 9</span>&#160;<span class="preprocessor">#define COFFEE_H_</span></div>
  95. <div class="line"><a name="l00010"></a><span class="lineno"> 10</span>&#160;<span class="preprocessor">#include &lt;csignal&gt;</span></div>
  96. <div class="line"><a name="l00011"></a><span class="lineno"> 11</span>&#160;</div>
  97. <div class="line"><a name="l00012"></a><span class="lineno"> 12</span>&#160;</div>
  98. <div class="line"><a name="l00013"></a><span class="lineno"> 13</span>&#160;<span class="comment">//define status</span></div>
  99. <div class="line"><a name="l00014"></a><span class="lineno"><a class="line" href="coffee_8h.html#a0cc0d45e13bc83065d45df9d3d1dc887"> 14</a></span>&#160;<span class="preprocessor">#define STATE_OFF 0</span></div>
  100. <div class="line"><a name="l00015"></a><span class="lineno"><a class="line" href="coffee_8h.html#ab87d7787dc7a2c2afc6d7853353d7003"> 15</a></span>&#160;<span class="preprocessor">#define STATE_HEATING 1</span></div>
  101. <div class="line"><a name="l00016"></a><span class="lineno"><a class="line" href="coffee_8h.html#af74b21e82c0f8fbf7f697db071d420a0"> 16</a></span>&#160;<span class="preprocessor">#define STATE_INITALHEATING 2</span></div>
  102. <div class="line"><a name="l00017"></a><span class="lineno"><a class="line" href="coffee_8h.html#aafff27c7165f059a969fe60fee51f683"> 17</a></span>&#160;<span class="preprocessor">#define STATE_IDLE 3</span></div>
  103. <div class="line"><a name="l00018"></a><span class="lineno"><a class="line" href="coffee_8h.html#a7a56332694aec763a9f8028113a07199"> 18</a></span>&#160;<span class="preprocessor">#define STATE_BREW 4</span></div>
  104. <div class="line"><a name="l00019"></a><span class="lineno"><a class="line" href="coffee_8h.html#af696741daae3faab28c27755188fd828"> 19</a></span>&#160;<span class="preprocessor">#define STATE_BREWMANUAL 5</span></div>
  105. <div class="line"><a name="l00020"></a><span class="lineno"><a class="line" href="coffee_8h.html#a3a3e5a95a5ba91345c6a1b6f7e06c737"> 20</a></span>&#160;<span class="preprocessor">#define STATE_CLEANING 6</span></div>
  106. <div class="line"><a name="l00021"></a><span class="lineno"><a class="line" href="coffee_8h.html#a7bf0c086c7c41c12cc63324327932d91"> 21</a></span>&#160;<span class="preprocessor">#define STATE_ERROR 7</span></div>
  107. <div class="line"><a name="l00022"></a><span class="lineno"> 22</span>&#160;</div>
  108. <div class="line"><a name="l00023"></a><span class="lineno"><a class="line" href="coffee_8h.html#ad8bfbae67917bc4a69ae336c65b3aba2"> 23</a></span>&#160;<span class="preprocessor">#define AMOUNT_PREINFUSION 3 //Preinfusion amount in ml</span></div>
  109. <div class="line"><a name="l00024"></a><span class="lineno"><a class="line" href="coffee_8h.html#ad4b00557d847ecf54b790844b3be2eb0"> 24</a></span>&#160;<span class="preprocessor">#define TIME_SOAK 3000//Time between preinfusion and infusion in ms</span></div>
  110. <div class="line"><a name="l00025"></a><span class="lineno"><a class="line" href="coffee_8h.html#acd34aefc536dfe9b45dbed679cf6afaf"> 25</a></span>&#160;<span class="preprocessor">#define TIME_INFUSION 25000 //Infusion time in ms</span></div>
  111. <div class="line"><a name="l00026"></a><span class="lineno"><a class="line" href="coffee_8h.html#a4e3abbeb2301b9265ee297ee63e2f4c8"> 26</a></span>&#160;<span class="preprocessor">#define AMOUNT_DBLESPRESSO 25.0 //Size of a double espresso in ml</span></div>
  112. <div class="line"><a name="l00027"></a><span class="lineno"> 27</span>&#160;</div>
  113. <div class="line"><a name="l00028"></a><span class="lineno"> 28</span>&#160;<span class="keywordtype">void</span> *<a class="code" href="coffee_8h.html#afed8c565650f5808745b6c6c7d45462c">coffeeThread</a>(<span class="keywordtype">void</span> *threadid);</div>
  114. <div class="line"><a name="l00029"></a><span class="lineno"> 29</span>&#160;</div>
  115. <div class="line"><a name="l00030"></a><span class="lineno"> 30</span>&#160;<span class="keywordtype">void</span> <a class="code" href="coffee_8h.html#a44f0ebaec249d2ce6316c1bddff54d79">coffeeHandler</a> (<span class="keywordtype">int</span> signum, siginfo_t *siginfo, <span class="keywordtype">void</span> *context);</div>
  116. <div class="line"><a name="l00031"></a><span class="lineno"> 31</span>&#160;<span class="keywordtype">int</span> <a class="code" href="coffee_8h.html#a3290268b8fcbba9a6b642b68860a8503">getSigValue</a>(<span class="keywordtype">void</span>);</div>
  117. <div class="line"><a name="l00032"></a><span class="lineno"> 32</span>&#160;<span class="keywordtype">bool</span> <a class="code" href="coffee_8h.html#a63f25020d1567a2d5e03a9a59e75a0fc">SigValueEmpty</a>(<span class="keywordtype">void</span>);</div>
  118. <div class="line"><a name="l00033"></a><span class="lineno"> 33</span>&#160;<span class="keywordtype">void</span> <a class="code" href="coffee_8h.html#ae4d9681385a3f678dee40458cf55dca0">changeState</a>(<span class="keywordtype">int</span> newState);</div>
  119. <div class="line"><a name="l00034"></a><span class="lineno"> 34</span>&#160;<span class="keywordtype">int</span> <a class="code" href="coffee_8h.html#afc0b4325b7cabe49f623d5e44aaa37d7">getState</a>(<span class="keywordtype">void</span>);</div>
  120. <div class="line"><a name="l00035"></a><span class="lineno"> 35</span>&#160;<span class="keywordtype">void</span> <a class="code" href="coffee_8h.html#a66d75a676639d0f8e56c0efe76547482">brewTimeHandler</a> (<span class="keywordtype">void</span>);</div>
  121. <div class="line"><a name="l00036"></a><span class="lineno"> 36</span>&#160;<span class="keywordtype">void</span> <a class="code" href="coffee_8h.html#a5c611f1d81caf2f51c8b77b307028e4d">coffeeTerminate</a>(<span class="keywordtype">void</span>);</div>
  122. <div class="line"><a name="l00037"></a><span class="lineno"> 37</span>&#160;<span class="keywordtype">void</span> <a class="code" href="coffee_8h.html#a343324d9863aa6eb3d7e2a183aec4a09">coffeeBrew</a>(<span class="keywordtype">void</span>);</div>
  123. <div class="line"><a name="l00038"></a><span class="lineno"> 38</span>&#160;<span class="keywordtype">void</span> <a class="code" href="coffee_8h.html#a7c29bb32c4f3971f78dd515e568042c3">coffeeIncreaseBrewCounter</a>(<span class="keywordtype">void</span>);</div>
  124. <div class="line"><a name="l00039"></a><span class="lineno"> 39</span>&#160;<span class="keywordtype">void</span> <a class="code" href="coffee_8h.html#a11b81e21f5769fc6b0e55ecbac8d3976">coffeeIncreaseHeatingTime</a>(uint64_t <a class="code" href="coffee_8cpp.html#ac88c1bf95effb2aeddc71b1c2cf9034b">heatingTime</a>);</div>
  125. <div class="line"><a name="l00040"></a><span class="lineno"> 40</span>&#160;</div>
  126. <div class="line"><a name="l00041"></a><span class="lineno"> 41</span>&#160;<span class="preprocessor">#endif </span><span class="comment">/* COFFEE_H_ */</span><span class="preprocessor"></span></div>
  127. <div class="ttc" id="coffee_8h_html_a63f25020d1567a2d5e03a9a59e75a0fc"><div class="ttname"><a href="coffee_8h.html#a63f25020d1567a2d5e03a9a59e75a0fc">SigValueEmpty</a></div><div class="ttdeci">bool SigValueEmpty(void)</div><div class="ttdef"><b>Definition:</b> coffee.cpp:238</div></div>
  128. <div class="ttc" id="coffee_8h_html_a5c611f1d81caf2f51c8b77b307028e4d"><div class="ttname"><a href="coffee_8h.html#a5c611f1d81caf2f51c8b77b307028e4d">coffeeTerminate</a></div><div class="ttdeci">void coffeeTerminate(void)</div><div class="ttdoc">handles program termination </div><div class="ttdef"><b>Definition:</b> coffee.cpp:275</div></div>
  129. <div class="ttc" id="coffee_8h_html_a11b81e21f5769fc6b0e55ecbac8d3976"><div class="ttname"><a href="coffee_8h.html#a11b81e21f5769fc6b0e55ecbac8d3976">coffeeIncreaseHeatingTime</a></div><div class="ttdeci">void coffeeIncreaseHeatingTime(uint64_t heatingTime)</div><div class="ttdef"><b>Definition:</b> coffee.cpp:350</div></div>
  130. <div class="ttc" id="coffee_8h_html_afc0b4325b7cabe49f623d5e44aaa37d7"><div class="ttname"><a href="coffee_8h.html#afc0b4325b7cabe49f623d5e44aaa37d7">getState</a></div><div class="ttdeci">int getState(void)</div><div class="ttdoc">Returns the current state of the FSM. </div><div class="ttdef"><b>Definition:</b> coffee.cpp:260</div></div>
  131. <div class="ttc" id="coffee_8h_html_a3290268b8fcbba9a6b642b68860a8503"><div class="ttname"><a href="coffee_8h.html#a3290268b8fcbba9a6b642b68860a8503">getSigValue</a></div><div class="ttdeci">int getSigValue(void)</div><div class="ttdoc">returns the Signal value from the last received Signal and clears the variable </div><div class="ttdef"><b>Definition:</b> coffee.cpp:232</div></div>
  132. <div class="ttc" id="coffee_8h_html_a7c29bb32c4f3971f78dd515e568042c3"><div class="ttname"><a href="coffee_8h.html#a7c29bb32c4f3971f78dd515e568042c3">coffeeIncreaseBrewCounter</a></div><div class="ttdeci">void coffeeIncreaseBrewCounter(void)</div><div class="ttdef"><b>Definition:</b> coffee.cpp:340</div></div>
  133. <div class="ttc" id="coffee_8h_html_a44f0ebaec249d2ce6316c1bddff54d79"><div class="ttname"><a href="coffee_8h.html#a44f0ebaec249d2ce6316c1bddff54d79">coffeeHandler</a></div><div class="ttdeci">void coffeeHandler(int signum, siginfo_t *siginfo, void *context)</div><div class="ttdoc">Handler for the Signal send to this thread It saves the type of signal received and tracks the time b...</div><div class="ttdef"><b>Definition:</b> coffee.cpp:222</div></div>
  134. <div class="ttc" id="coffee_8h_html_a343324d9863aa6eb3d7e2a183aec4a09"><div class="ttname"><a href="coffee_8h.html#a343324d9863aa6eb3d7e2a183aec4a09">coffeeBrew</a></div><div class="ttdeci">void coffeeBrew(void)</div><div class="ttdoc">Brewing process. </div><div class="ttdef"><b>Definition:</b> coffee.cpp:285</div></div>
  135. <div class="ttc" id="coffee_8cpp_html_ac88c1bf95effb2aeddc71b1c2cf9034b"><div class="ttname"><a href="coffee_8cpp.html#ac88c1bf95effb2aeddc71b1c2cf9034b">heatingTime</a></div><div class="ttdeci">double heatingTime</div><div class="ttdef"><b>Definition:</b> coffee.cpp:33</div></div>
  136. <div class="ttc" id="coffee_8h_html_a66d75a676639d0f8e56c0efe76547482"><div class="ttname"><a href="coffee_8h.html#a66d75a676639d0f8e56c0efe76547482">brewTimeHandler</a></div><div class="ttdeci">void brewTimeHandler(void)</div><div class="ttdoc">Counter for the brew time refresh every 200ms. </div><div class="ttdef"><b>Definition:</b> coffee.cpp:268</div></div>
  137. <div class="ttc" id="coffee_8h_html_ae4d9681385a3f678dee40458cf55dca0"><div class="ttname"><a href="coffee_8h.html#ae4d9681385a3f678dee40458cf55dca0">changeState</a></div><div class="ttdeci">void changeState(int newState)</div><div class="ttdoc">Changes the state of the machine to newState prints the change to the logger. </div><div class="ttdef"><b>Definition:</b> coffee.cpp:250</div></div>
  138. <div class="ttc" id="coffee_8h_html_afed8c565650f5808745b6c6c7d45462c"><div class="ttname"><a href="coffee_8h.html#afed8c565650f5808745b6c6c7d45462c">coffeeThread</a></div><div class="ttdeci">void * coffeeThread(void *threadid)</div><div class="ttdoc">Thread for the finite state machine It represents the current state of the machine and handles signal...</div><div class="ttdef"><b>Definition:</b> coffee.cpp:41</div></div>
  139. </div><!-- fragment --></div><!-- contents -->
  140. <!-- start footer part -->
  141. <hr class="footer"/><address class="footer"><small>
  142. Generated by &#160;<a href="http://www.doxygen.org/index.html">
  143. <img class="footer" src="doxygen.png" alt="doxygen"/>
  144. </a> 1.8.10
  145. </small></address>
  146. </body>
  147. </html>