main_8cpp.html 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  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: main.cpp File Reference</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. <!-- window showing the filter options -->
  69. <div id="MSearchSelectWindow"
  70. onmouseover="return searchBox.OnSearchSelectShow()"
  71. onmouseout="return searchBox.OnSearchSelectHide()"
  72. onkeydown="return searchBox.OnSearchSelectKey(event)">
  73. </div>
  74. <!-- iframe showing the search results (closed by default) -->
  75. <div id="MSearchResultsWindow">
  76. <iframe src="javascript:void(0)" frameborder="0"
  77. name="MSearchResults" id="MSearchResults">
  78. </iframe>
  79. </div>
  80. </div><!-- top -->
  81. <div class="header">
  82. <div class="summary">
  83. <a href="#func-members">Functions</a> &#124;
  84. <a href="#var-members">Variables</a> </div>
  85. <div class="headertitle">
  86. <div class="title">main.cpp File Reference</div> </div>
  87. </div><!--header-->
  88. <div class="contents">
  89. <div class="textblock"><code>#include &lt;stdio.h&gt;</code><br />
  90. <code>#include &lt;stdlib.h&gt;</code><br />
  91. <code>#include &lt;string.h&gt;</code><br />
  92. <code>#include &lt;errno.h&gt;</code><br />
  93. <code>#include &lt;stdint.h&gt;</code><br />
  94. <code>#include &lt;wiringPi.h&gt;</code><br />
  95. <code>#include &lt;pthread.h&gt;</code><br />
  96. <code>#include &lt;unistd.h&gt;</code><br />
  97. <code>#include &lt;iostream&gt;</code><br />
  98. <code>#include &lt;csignal&gt;</code><br />
  99. <code>#include &quot;<a class="el" href="global_8h_source.html">global.h</a>&quot;</code><br />
  100. <code>#include &quot;<a class="el" href="timer_8h_source.html">timer.h</a>&quot;</code><br />
  101. <code>#include &quot;<a class="el" href="database_8h_source.html">database.h</a>&quot;</code><br />
  102. <code>#include &quot;<a class="el" href="logger_8h_source.html">logger.h</a>&quot;</code><br />
  103. <code>#include &quot;<a class="el" href="lcd_8h_source.html">lcd.h</a>&quot;</code><br />
  104. <code>#include &quot;<a class="el" href="hal_8h_source.html">hal.h</a>&quot;</code><br />
  105. <code>#include &quot;<a class="el" href="stripe_8h_source.html">stripe.h</a>&quot;</code><br />
  106. <code>#include &quot;<a class="el" href="coffee_8h_source.html">coffee.h</a>&quot;</code><br />
  107. <code>#include &quot;<a class="el" href="display_8h_source.html">display.h</a>&quot;</code><br />
  108. <code>#include &quot;buildno&quot;</code><br />
  109. </div><table class="memberdecls">
  110. <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
  111. Functions</h2></td></tr>
  112. <tr class="memitem:a9a66b873229b4d46cb9f39dddfc1bddb"><td class="memItemLeft" align="right" valign="top">void *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="main_8cpp.html#a9a66b873229b4d46cb9f39dddfc1bddb">mainLoop</a> (void *threadid)</td></tr>
  113. <tr class="memdesc:a9a66b873229b4d46cb9f39dddfc1bddb"><td class="mdescLeft">&#160;</td><td class="mdescRight">Main Thread, used for some initializations and error detection. <a href="#a9a66b873229b4d46cb9f39dddfc1bddb">More...</a><br /></td></tr>
  114. <tr class="separator:a9a66b873229b4d46cb9f39dddfc1bddb"><td class="memSeparator" colspan="2">&#160;</td></tr>
  115. <tr class="memitem:acd303e48c6d5b8d8bbf55db887f1e7e8"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="main_8cpp.html#acd303e48c6d5b8d8bbf55db887f1e7e8">terminationHandler</a> (int signum)</td></tr>
  116. <tr class="memdesc:acd303e48c6d5b8d8bbf55db887f1e7e8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Handler for program termination caught via signal. <a href="#acd303e48c6d5b8d8bbf55db887f1e7e8">More...</a><br /></td></tr>
  117. <tr class="separator:acd303e48c6d5b8d8bbf55db887f1e7e8"><td class="memSeparator" colspan="2">&#160;</td></tr>
  118. <tr class="memitem:a6b9ec8ce27cbec14222dfd2db55e8bad"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="main_8cpp.html#a6b9ec8ce27cbec14222dfd2db55e8bad">usr1Handler</a> (int signum)</td></tr>
  119. <tr class="memdesc:a6b9ec8ce27cbec14222dfd2db55e8bad"><td class="mdescLeft">&#160;</td><td class="mdescRight">Handles the signal USR2. <a href="#a6b9ec8ce27cbec14222dfd2db55e8bad">More...</a><br /></td></tr>
  120. <tr class="separator:a6b9ec8ce27cbec14222dfd2db55e8bad"><td class="memSeparator" colspan="2">&#160;</td></tr>
  121. <tr class="memitem:aa5f8eab61a77d6d566215bcf12144422"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="main_8cpp.html#aa5f8eab61a77d6d566215bcf12144422">hupHandler</a> (int signum)</td></tr>
  122. <tr class="memdesc:aa5f8eab61a77d6d566215bcf12144422"><td class="mdescLeft">&#160;</td><td class="mdescRight">Handles the signal HUP and starts a speed test. <a href="#aa5f8eab61a77d6d566215bcf12144422">More...</a><br /></td></tr>
  123. <tr class="separator:aa5f8eab61a77d6d566215bcf12144422"><td class="memSeparator" colspan="2">&#160;</td></tr>
  124. <tr class="memitem:a0ddf1224851353fc92bfbff6f499fa97"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="main_8cpp.html#a0ddf1224851353fc92bfbff6f499fa97">main</a> (int argc, char *argv[])</td></tr>
  125. <tr class="separator:a0ddf1224851353fc92bfbff6f499fa97"><td class="memSeparator" colspan="2">&#160;</td></tr>
  126. <tr class="memitem:ab6e46b0071bb3330546b7f2b601d0a6c"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="main_8cpp.html#ab6e46b0071bb3330546b7f2b601d0a6c">killThread</a> (int threadid, int sig)</td></tr>
  127. <tr class="memdesc:ab6e46b0071bb3330546b7f2b601d0a6c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sends a signal to a thread. <a href="#ab6e46b0071bb3330546b7f2b601d0a6c">More...</a><br /></td></tr>
  128. <tr class="separator:ab6e46b0071bb3330546b7f2b601d0a6c"><td class="memSeparator" colspan="2">&#160;</td></tr>
  129. </table><table class="memberdecls">
  130. <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="var-members"></a>
  131. Variables</h2></td></tr>
  132. <tr class="memitem:ac70430026dcf56f46e5426e1d01d7e89"><td class="memItemLeft" align="right" valign="top">const int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="main_8cpp.html#ac70430026dcf56f46e5426e1d01d7e89">buildno</a></td></tr>
  133. <tr class="separator:ac70430026dcf56f46e5426e1d01d7e89"><td class="memSeparator" colspan="2">&#160;</td></tr>
  134. <tr class="memitem:a0b2caeb4b6f130be43e5a2f0267dd453"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="main_8cpp.html#a0b2caeb4b6f130be43e5a2f0267dd453">verbose</a> = 0</td></tr>
  135. <tr class="separator:a0b2caeb4b6f130be43e5a2f0267dd453"><td class="memSeparator" colspan="2">&#160;</td></tr>
  136. <tr class="memitem:ae88c926fe2a10f736eb01b1d1e899a1c"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="main_8cpp.html#ae88c926fe2a10f736eb01b1d1e899a1c">optDate</a> = false</td></tr>
  137. <tr class="separator:ae88c926fe2a10f736eb01b1d1e899a1c"><td class="memSeparator" colspan="2">&#160;</td></tr>
  138. <tr class="memitem:a7bfeade3d2f19e8baecdcddd7f9162fa"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="main_8cpp.html#a7bfeade3d2f19e8baecdcddd7f9162fa">optPower</a> = false</td></tr>
  139. <tr class="separator:a7bfeade3d2f19e8baecdcddd7f9162fa"><td class="memSeparator" colspan="2">&#160;</td></tr>
  140. <tr class="memitem:a2a24ab7c0142e353c9ce9ca1ee1210bb"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="main_8cpp.html#a2a24ab7c0142e353c9ce9ca1ee1210bb">optCold</a> = false</td></tr>
  141. <tr class="separator:a2a24ab7c0142e353c9ce9ca1ee1210bb"><td class="memSeparator" colspan="2">&#160;</td></tr>
  142. <tr class="memitem:ad1c21fd320f05c652f120ad167628c14"><td class="memItemLeft" align="right" valign="top">pthread_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="main_8cpp.html#ad1c21fd320f05c652f120ad167628c14">thread</a> [4]</td></tr>
  143. <tr class="separator:ad1c21fd320f05c652f120ad167628c14"><td class="memSeparator" colspan="2">&#160;</td></tr>
  144. <tr class="memitem:a4acff8232e4aec9cd5c6dc200ac55ef3"><td class="memItemLeft" align="right" valign="top">pthread_mutex_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="main_8cpp.html#a4acff8232e4aec9cd5c6dc200ac55ef3">mutex</a></td></tr>
  145. <tr class="separator:a4acff8232e4aec9cd5c6dc200ac55ef3"><td class="memSeparator" colspan="2">&#160;</td></tr>
  146. </table>
  147. <h2 class="groupheader">Function Documentation</h2>
  148. <a class="anchor" id="aa5f8eab61a77d6d566215bcf12144422"></a>
  149. <div class="memitem">
  150. <div class="memproto">
  151. <table class="memname">
  152. <tr>
  153. <td class="memname">void hupHandler </td>
  154. <td>(</td>
  155. <td class="paramtype">int&#160;</td>
  156. <td class="paramname"><em>signum</em></td><td>)</td>
  157. <td></td>
  158. </tr>
  159. </table>
  160. </div><div class="memdoc">
  161. <p>Handles the signal HUP and starts a speed test. </p>
  162. </div>
  163. </div>
  164. <a class="anchor" id="ab6e46b0071bb3330546b7f2b601d0a6c"></a>
  165. <div class="memitem">
  166. <div class="memproto">
  167. <table class="memname">
  168. <tr>
  169. <td class="memname">void killThread </td>
  170. <td>(</td>
  171. <td class="paramtype">int&#160;</td>
  172. <td class="paramname"><em>threadid</em>, </td>
  173. </tr>
  174. <tr>
  175. <td class="paramkey"></td>
  176. <td></td>
  177. <td class="paramtype">int&#160;</td>
  178. <td class="paramname"><em>sig</em>&#160;</td>
  179. </tr>
  180. <tr>
  181. <td></td>
  182. <td>)</td>
  183. <td></td><td></td>
  184. </tr>
  185. </table>
  186. </div><div class="memdoc">
  187. <p>Sends a signal to a thread. </p>
  188. <dl class="params"><dt>Parameters</dt><dd>
  189. <table class="params">
  190. <tr><td class="paramname">threadid</td><td>ID of the thread </td></tr>
  191. <tr><td class="paramname">sig</td><td>Signal to send </td></tr>
  192. </table>
  193. </dd>
  194. </dl>
  195. </div>
  196. </div>
  197. <a class="anchor" id="a0ddf1224851353fc92bfbff6f499fa97"></a>
  198. <div class="memitem">
  199. <div class="memproto">
  200. <table class="memname">
  201. <tr>
  202. <td class="memname">int main </td>
  203. <td>(</td>
  204. <td class="paramtype">int&#160;</td>
  205. <td class="paramname"><em>argc</em>, </td>
  206. </tr>
  207. <tr>
  208. <td class="paramkey"></td>
  209. <td></td>
  210. <td class="paramtype">char *&#160;</td>
  211. <td class="paramname"><em>argv</em>[]&#160;</td>
  212. </tr>
  213. <tr>
  214. <td></td>
  215. <td>)</td>
  216. <td></td><td></td>
  217. </tr>
  218. </table>
  219. </div><div class="memdoc">
  220. </div>
  221. </div>
  222. <a class="anchor" id="a9a66b873229b4d46cb9f39dddfc1bddb"></a>
  223. <div class="memitem">
  224. <div class="memproto">
  225. <table class="memname">
  226. <tr>
  227. <td class="memname">void * mainLoop </td>
  228. <td>(</td>
  229. <td class="paramtype">void *&#160;</td>
  230. <td class="paramname"><em>threadid</em></td><td>)</td>
  231. <td></td>
  232. </tr>
  233. </table>
  234. </div><div class="memdoc">
  235. <p>Main Thread, used for some initializations and error detection. </p>
  236. <dl class="params"><dt>Parameters</dt><dd>
  237. <table class="params">
  238. <tr><td class="paramname">threadid</td><td>Thread ID </td></tr>
  239. </table>
  240. </dd>
  241. </dl>
  242. </div>
  243. </div>
  244. <a class="anchor" id="acd303e48c6d5b8d8bbf55db887f1e7e8"></a>
  245. <div class="memitem">
  246. <div class="memproto">
  247. <table class="memname">
  248. <tr>
  249. <td class="memname">void terminationHandler </td>
  250. <td>(</td>
  251. <td class="paramtype">int&#160;</td>
  252. <td class="paramname"><em>signum</em></td><td>)</td>
  253. <td></td>
  254. </tr>
  255. </table>
  256. </div><div class="memdoc">
  257. <p>Handler for program termination caught via signal. </p>
  258. </div>
  259. </div>
  260. <a class="anchor" id="a6b9ec8ce27cbec14222dfd2db55e8bad"></a>
  261. <div class="memitem">
  262. <div class="memproto">
  263. <table class="memname">
  264. <tr>
  265. <td class="memname">void usr1Handler </td>
  266. <td>(</td>
  267. <td class="paramtype">int&#160;</td>
  268. <td class="paramname"><em>signum</em></td><td>)</td>
  269. <td></td>
  270. </tr>
  271. </table>
  272. </div><div class="memdoc">
  273. <p>Handles the signal USR2. </p>
  274. </div>
  275. </div>
  276. <h2 class="groupheader">Variable Documentation</h2>
  277. <a class="anchor" id="ac70430026dcf56f46e5426e1d01d7e89"></a>
  278. <div class="memitem">
  279. <div class="memproto">
  280. <table class="memname">
  281. <tr>
  282. <td class="memname">const int buildno</td>
  283. </tr>
  284. </table>
  285. </div><div class="memdoc">
  286. <b>Initial value:</b><div class="fragment"><div class="line">= (1+(int)(</div>
  287. <div class="line"># 29 <span class="stringliteral">&quot;/home/sebastian/CoffeePi/CoffeeCode/main.cpp&quot;</span> 2</div>
  288. <div class="line"> ))</div>
  289. </div><!-- fragment -->
  290. </div>
  291. </div>
  292. <a class="anchor" id="a4acff8232e4aec9cd5c6dc200ac55ef3"></a>
  293. <div class="memitem">
  294. <div class="memproto">
  295. <table class="memname">
  296. <tr>
  297. <td class="memname">pthread_mutex_t mutex</td>
  298. </tr>
  299. </table>
  300. </div><div class="memdoc">
  301. </div>
  302. </div>
  303. <a class="anchor" id="a2a24ab7c0142e353c9ce9ca1ee1210bb"></a>
  304. <div class="memitem">
  305. <div class="memproto">
  306. <table class="memname">
  307. <tr>
  308. <td class="memname">bool optCold = false</td>
  309. </tr>
  310. </table>
  311. </div><div class="memdoc">
  312. </div>
  313. </div>
  314. <a class="anchor" id="ae88c926fe2a10f736eb01b1d1e899a1c"></a>
  315. <div class="memitem">
  316. <div class="memproto">
  317. <table class="memname">
  318. <tr>
  319. <td class="memname">bool optDate = false</td>
  320. </tr>
  321. </table>
  322. </div><div class="memdoc">
  323. </div>
  324. </div>
  325. <a class="anchor" id="a7bfeade3d2f19e8baecdcddd7f9162fa"></a>
  326. <div class="memitem">
  327. <div class="memproto">
  328. <table class="memname">
  329. <tr>
  330. <td class="memname">bool optPower = false</td>
  331. </tr>
  332. </table>
  333. </div><div class="memdoc">
  334. </div>
  335. </div>
  336. <a class="anchor" id="ad1c21fd320f05c652f120ad167628c14"></a>
  337. <div class="memitem">
  338. <div class="memproto">
  339. <table class="memname">
  340. <tr>
  341. <td class="memname">pthread_t thread[4]</td>
  342. </tr>
  343. </table>
  344. </div><div class="memdoc">
  345. </div>
  346. </div>
  347. <a class="anchor" id="a0b2caeb4b6f130be43e5a2f0267dd453"></a>
  348. <div class="memitem">
  349. <div class="memproto">
  350. <table class="memname">
  351. <tr>
  352. <td class="memname">int verbose = 0</td>
  353. </tr>
  354. </table>
  355. </div><div class="memdoc">
  356. </div>
  357. </div>
  358. </div><!-- contents -->
  359. <!-- start footer part -->
  360. <hr class="footer"/><address class="footer"><small>
  361. Generated by &#160;<a href="http://www.doxygen.org/index.html">
  362. <img class="footer" src="doxygen.png" alt="doxygen"/>
  363. </a> 1.8.10
  364. </small></address>
  365. </body>
  366. </html>