spi_8cpp.html 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  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: spi.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> </div>
  84. <div class="headertitle">
  85. <div class="title">spi.cpp File Reference</div> </div>
  86. </div><!--header-->
  87. <div class="contents">
  88. <div class="textblock"><code>#include &lt;wiringPi.h&gt;</code><br />
  89. <code>#include &lt;wiringPiSPI.h&gt;</code><br />
  90. <code>#include &lt;stdio.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 &quot;<a class="el" href="global_8h_source.html">global.h</a>&quot;</code><br />
  94. <code>#include &quot;<a class="el" href="logger_8h_source.html">logger.h</a>&quot;</code><br />
  95. <code>#include &lt;inttypes.h&gt;</code><br />
  96. <code>#include &lt;unistd.h&gt;</code><br />
  97. <code>#include &quot;<a class="el" href="spi_8h_source.html">spi.h</a>&quot;</code><br />
  98. </div><table class="memberdecls">
  99. <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
  100. Functions</h2></td></tr>
  101. <tr class="memitem:a7402e4a56146a9e3df480b206a3f7e7e"><td class="memItemLeft" align="right" valign="top">uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="spi_8cpp.html#a7402e4a56146a9e3df480b206a3f7e7e">spi_readwrite</a> (uint8_t data)</td></tr>
  102. <tr class="memdesc:a7402e4a56146a9e3df480b206a3f7e7e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Writes the data on the SPI bus and returns the reply. <a href="#a7402e4a56146a9e3df480b206a3f7e7e">More...</a><br /></td></tr>
  103. <tr class="separator:a7402e4a56146a9e3df480b206a3f7e7e"><td class="memSeparator" colspan="2">&#160;</td></tr>
  104. <tr class="memitem:ae909944aa85ae98323073c628be541aa"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="spi_8cpp.html#ae909944aa85ae98323073c628be541aa">spi_init</a> (void)</td></tr>
  105. <tr class="memdesc:ae909944aa85ae98323073c628be541aa"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initializes the SPI bus. <a href="#ae909944aa85ae98323073c628be541aa">More...</a><br /></td></tr>
  106. <tr class="separator:ae909944aa85ae98323073c628be541aa"><td class="memSeparator" colspan="2">&#160;</td></tr>
  107. <tr class="memitem:ac7600504b8cf1ac90ce331a5ed23c3db"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="spi_8cpp.html#ac7600504b8cf1ac90ce331a5ed23c3db">shift_init</a> (void)</td></tr>
  108. <tr class="memdesc:ac7600504b8cf1ac90ce331a5ed23c3db"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initializes the shift register. <a href="#ac7600504b8cf1ac90ce331a5ed23c3db">More...</a><br /></td></tr>
  109. <tr class="separator:ac7600504b8cf1ac90ce331a5ed23c3db"><td class="memSeparator" colspan="2">&#160;</td></tr>
  110. <tr class="memitem:aec7140cda479ce5f88361739e86ccecd"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="spi_8cpp.html#aec7140cda479ce5f88361739e86ccecd">shift_data</a> (uint8_t data)</td></tr>
  111. <tr class="memdesc:aec7140cda479ce5f88361739e86ccecd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sends a byte to the shift register. <a href="#aec7140cda479ce5f88361739e86ccecd">More...</a><br /></td></tr>
  112. <tr class="separator:aec7140cda479ce5f88361739e86ccecd"><td class="memSeparator" colspan="2">&#160;</td></tr>
  113. </table>
  114. <h2 class="groupheader">Function Documentation</h2>
  115. <a class="anchor" id="aec7140cda479ce5f88361739e86ccecd"></a>
  116. <div class="memitem">
  117. <div class="memproto">
  118. <table class="memname">
  119. <tr>
  120. <td class="memname">void shift_data </td>
  121. <td>(</td>
  122. <td class="paramtype">uint8_t&#160;</td>
  123. <td class="paramname"><em>data</em></td><td>)</td>
  124. <td></td>
  125. </tr>
  126. </table>
  127. </div><div class="memdoc">
  128. <p>Sends a byte to the shift register. </p>
  129. <dl class="params"><dt>Parameters</dt><dd>
  130. <table class="params">
  131. <tr><td class="paramname">data</td><td>Data byte </td></tr>
  132. </table>
  133. </dd>
  134. </dl>
  135. </div>
  136. </div>
  137. <a class="anchor" id="ac7600504b8cf1ac90ce331a5ed23c3db"></a>
  138. <div class="memitem">
  139. <div class="memproto">
  140. <table class="memname">
  141. <tr>
  142. <td class="memname">void shift_init </td>
  143. <td>(</td>
  144. <td class="paramtype">void&#160;</td>
  145. <td class="paramname"></td><td>)</td>
  146. <td></td>
  147. </tr>
  148. </table>
  149. </div><div class="memdoc">
  150. <p>Initializes the shift register. </p>
  151. </div>
  152. </div>
  153. <a class="anchor" id="ae909944aa85ae98323073c628be541aa"></a>
  154. <div class="memitem">
  155. <div class="memproto">
  156. <table class="memname">
  157. <tr>
  158. <td class="memname">void spi_init </td>
  159. <td>(</td>
  160. <td class="paramtype">void&#160;</td>
  161. <td class="paramname"></td><td>)</td>
  162. <td></td>
  163. </tr>
  164. </table>
  165. </div><div class="memdoc">
  166. <p>Initializes the SPI bus. </p>
  167. </div>
  168. </div>
  169. <a class="anchor" id="a7402e4a56146a9e3df480b206a3f7e7e"></a>
  170. <div class="memitem">
  171. <div class="memproto">
  172. <table class="memname">
  173. <tr>
  174. <td class="memname">uint8_t spi_readwrite </td>
  175. <td>(</td>
  176. <td class="paramtype">uint8_t&#160;</td>
  177. <td class="paramname"><em>data</em></td><td>)</td>
  178. <td></td>
  179. </tr>
  180. </table>
  181. </div><div class="memdoc">
  182. <p>Writes the data on the SPI bus and returns the reply. </p>
  183. <dl class="params"><dt>Parameters</dt><dd>
  184. <table class="params">
  185. <tr><td class="paramname">data</td><td>byte to write to the bus </td></tr>
  186. </table>
  187. </dd>
  188. </dl>
  189. <dl class="section return"><dt>Returns</dt><dd>byte read from the bus </dd></dl>
  190. </div>
  191. </div>
  192. </div><!-- contents -->
  193. <!-- start footer part -->
  194. <hr class="footer"/><address class="footer"><small>
  195. Generated by &#160;<a href="http://www.doxygen.org/index.html">
  196. <img class="footer" src="doxygen.png" alt="doxygen"/>
  197. </a> 1.8.10
  198. </small></address>
  199. </body>
  200. </html>