|
- <!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.14"/>
- <meta name="viewport" content="width=device-width, initial-scale=1"/>
- <title>uTL: include/utl/com/spi_bb.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">uTL
- </div>
- <div id="projectbrief">micro Template library</div>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <!-- end header part -->
- <!-- Generated by Doxygen 1.8.14 -->
- <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('spi__bb_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">spi_bb.h</div> </div>
- </div><!--header-->
- <div class="contents">
- <a href="spi__bb_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> </div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span> <span class="preprocessor">#ifndef __utl_com_spi_bb_h__</span></div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span> <span class="preprocessor">#define __utl_com_spi_bb_h__</span></div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span> </div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span> <span class="preprocessor">#include <<a class="code" href="impl_8h.html">utl/core/impl.h</a>></span></div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span> <span class="preprocessor">#include <<a class="code" href="crtp_8h.html">utl/core/crtp.h</a>></span></div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span> <span class="preprocessor">#include <<a class="code" href="spi_8h.html">utl/com/spi.h</a>></span></div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span> <span class="preprocessor">#include <<a class="code" href="meta_8h.html">utl/meta/meta.h</a>></span></div><div class="line"><a name="l00029"></a><span class="lineno"> 29</span> </div><div class="line"><a name="l00030"></a><span class="lineno"> 30</span> </div><div class="line"><a name="l00031"></a><span class="lineno"> 31</span> <span class="keyword">namespace </span><a class="code" href="namespaceutl.html">utl</a> {</div><div class="line"><a name="l00032"></a><span class="lineno"> 32</span> </div><div class="line"><a name="l00039"></a><span class="lineno"> 39</span> </div><div class="line"><a name="l00052"></a><span class="lineno"> 52</span>  <span class="keyword">template</span> <<span class="keyword">typename</span> impl_t,</div><div class="line"><a name="l00053"></a><span class="lineno"> 53</span>  <a class="code" href="namespaceutl_1_1spi.html#a89e3e1af5df0b6c37239f7e336969f8a">spi::cpol</a> CPOL,</div><div class="line"><a name="l00054"></a><span class="lineno"> 54</span>  <a class="code" href="namespaceutl_1_1spi.html#aa49fe33d495226891cef0a870cba59df">spi::cpha</a> CPHA,</div><div class="line"><a name="l00055"></a><span class="lineno"> 55</span>  <a class="code" href="namespaceutl_1_1spi.html#aed6b713381c193c598572ebac0b284cc">spi::bitOrder</a> BitOrder =<a class="code" href="namespaceutl_1_1spi.html#aed6b713381c193c598572ebac0b284cca47bde70fdcc82c8363d16c7137641b79">spi::bitOrder::MSB_First</a>></div><div class="line"><a name="l00056"></a><span class="lineno"><a class="line" href="classutl_1_1spi__bb__i.html"> 56</a></span>  <span class="keyword">class </span><a class="code" href="classutl_1_1spi__bb__i.html">spi_bb_i</a> : <span class="keyword">public</span> <a class="code" href="classutl_1_1spi__i.html">spi_i</a><spi_bb_i<impl_t, CPOL, CPHA, BitOrder>> {</div><div class="line"><a name="l00057"></a><span class="lineno"> 57</span>  <a class="code" href="classutl_1_1spi__bb__i.html#a33b6ef2f4c26b16ee4e28425ab20e852">_CRTP_IMPL</a>(impl_t); </div><div class="line"><a name="l00058"></a><span class="lineno"><a class="line" href="classutl_1_1spi__bb__i.html#aa82efc45adc590f33164edacc1783c20"> 58</a></span>  <span class="keyword">friend</span> <a class="code" href="classutl_1_1spi__i.html">spi_i<spi_bb_i<impl_t, CPOL, CPHA, BitOrder></a>>;</div><div class="line"><a name="l00059"></a><span class="lineno"> 59</span>  <span class="keyword">public</span>:</div><div class="line"><a name="l00060"></a><span class="lineno"><a class="line" href="classutl_1_1spi__bb__i.html#a86ccf004bf5ccc8b7c73bd0f9e8dbaa7"> 60</a></span>  <span class="keyword">using</span> <a class="code" href="classutl_1_1spi__bb__i.html">type</a> = <a class="code" href="classutl_1_1spi__bb__i.html">spi_bb_i<impl_t, CPOL, CPHA, BitOrder></a>; </div><div class="line"><a name="l00061"></a><span class="lineno"> 61</span> </div><div class="line"><a name="l00065"></a><span class="lineno"> 65</span>  <span class="keyword">protected</span>:</div><div class="line"><a name="l00067"></a><span class="lineno"> 67</span>  <a class="code" href="classutl_1_1spi__bb__i.html#aeac57567cb7db5ebb73bdd8e1f00cb82">~spi_bb_i</a> () = <span class="keywordflow">default</span>; </div><div class="line"><a name="l00068"></a><span class="lineno"> 68</span>  <a class="code" href="classutl_1_1spi__bb__i.html#a49a61ba9a8e140e45d73e1f634061c6a">spi_bb_i</a> (uint32_t clk) noexcept</div><div class="line"><a name="l00070"></a><span class="lineno"> 70</span>  : <a class="code" href="classutl_1_1spi__bb__i.html#a863bf592b1df8f74bcc3b8d76f40c173">nsec_</a> {1000000000/(2*clk)} {</div><div class="line"><a name="l00071"></a><span class="lineno"> 71</span>  }</div><div class="line"><a name="l00073"></a><span class="lineno"> 73</span> </div><div class="line"><a name="l00074"></a><span class="lineno"> 74</span>  <span class="keyword">private</span>:</div><div class="line"><a name="l00077"></a><span class="lineno"> 77</span>  <span class="keyword">template</span> <spi::bitOrder B =BitOrder> constexpr</div><div class="line"><a name="l00078"></a><span class="lineno"><a class="line" href="classutl_1_1spi__bb__i.html#a0d017c3bc5c583ad802027914e492b3a"> 78</a></span>  <a class="code" href="namespaceutl_1_1meta.html#a372fe391d9567f66a81091f581e1fa01">meta::enable_if_t <(B == spi::bitOrder::LSB_First), void></a> <a class="code" href="classutl_1_1spi__bb__i.html#a0d017c3bc5c583ad802027914e492b3a">shift</a> (<a class="code" href="namespaceutl.html#a1427cb5a2b13313147a902173b91e3c1">byte_t</a>& b) { b <<=1; }</div><div class="line"><a name="l00079"></a><span class="lineno"> 79</span>  <span class="keyword">template</span> <spi::bitOrder B =BitOrder> constexpr</div><div class="line"><a name="l00080"></a><span class="lineno"><a class="line" href="classutl_1_1spi__bb__i.html#a93d43e3fa8e2112757281e0c20070eb4"> 80</a></span>  <a class="code" href="namespaceutl_1_1meta.html#a372fe391d9567f66a81091f581e1fa01">meta::enable_if_t <(B == spi::bitOrder::MSB_First), void></a> <a class="code" href="classutl_1_1spi__bb__i.html#a93d43e3fa8e2112757281e0c20070eb4">shift</a> (<a class="code" href="namespaceutl.html#a1427cb5a2b13313147a902173b91e3c1">byte_t</a>& b) { b >>=1; }</div><div class="line"><a name="l00081"></a><span class="lineno"><a class="line" href="classutl_1_1spi__bb__i.html#a8fa5b901ced4ce734409ab4c20a1c1d2"> 81</a></span>  <span class="keyword">template</span> <spi::cpol C =CPOL> <span class="keyword">static</span> constexpr <span class="keywordtype">bool</span> <a class="code" href="classutl_1_1spi__bb__i.html#a8fa5b901ced4ce734409ab4c20a1c1d2">clkHigh</a> () {</div><div class="line"><a name="l00082"></a><span class="lineno"> 82</span>  <span class="keywordflow">return</span> !<span class="keyword">static_cast<</span><span class="keywordtype">bool</span><span class="keyword">></span>(C);</div><div class="line"><a name="l00083"></a><span class="lineno"> 83</span>  }</div><div class="line"><a name="l00084"></a><span class="lineno"><a class="line" href="classutl_1_1spi__bb__i.html#ae0a17d5879099f6ac92eee4dee59ab0f"> 84</a></span>  <span class="keyword">template</span> <spi::cpol C =CPOL> <span class="keyword">static</span> constexpr <span class="keywordtype">bool</span> <a class="code" href="classutl_1_1spi__bb__i.html#ae0a17d5879099f6ac92eee4dee59ab0f">clkLow</a> () {</div><div class="line"><a name="l00085"></a><span class="lineno"> 85</span>  <span class="keywordflow">return</span> <span class="keyword">static_cast<</span><span class="keywordtype">bool</span><span class="keyword">></span>(C);</div><div class="line"><a name="l00086"></a><span class="lineno"> 86</span>  }</div><div class="line"><a name="l00087"></a><span class="lineno"><a class="line" href="classutl_1_1spi__bb__i.html#a3a9b68907304114573bc7321006fa539"> 87</a></span>  <span class="keyword">static</span> constexpr <span class="keywordtype">bool</span> <a class="code" href="classutl_1_1spi__bb__i.html#a3a9b68907304114573bc7321006fa539">clkH_</a> {<a class="code" href="classutl_1_1spi__bb__i.html#a8fa5b901ced4ce734409ab4c20a1c1d2">clkHigh</a>()};</div><div class="line"><a name="l00088"></a><span class="lineno"><a class="line" href="classutl_1_1spi__bb__i.html#a509a5828018f62e2627af67e8c6a32d5"> 88</a></span>  <span class="keyword">static</span> constexpr <span class="keywordtype">bool</span> <a class="code" href="classutl_1_1spi__bb__i.html#a509a5828018f62e2627af67e8c6a32d5">clkL_</a> {<a class="code" href="classutl_1_1spi__bb__i.html#ae0a17d5879099f6ac92eee4dee59ab0f">clkLow</a>()};</div><div class="line"><a name="l00090"></a><span class="lineno"> 90</span> </div><div class="line"><a name="l00097"></a><span class="lineno"> 97</span>  <span class="keyword">private</span>:</div><div class="line"><a name="l00099"></a><span class="lineno"><a class="line" href="classutl_1_1spi__bb__i.html#a3051a59aaeb5b176a175b352cf5f578e"> 99</a></span>  <span class="keywordtype">void</span> <a class="code" href="classutl_1_1spi__bb__i.html#a3051a59aaeb5b176a175b352cf5f578e">MOSI</a> (<span class="keywordtype">bool</span> st) { impl().MOSI(st); } </div><div class="line"><a name="l00100"></a><span class="lineno"><a class="line" href="classutl_1_1spi__bb__i.html#a9a7b908a8976f6efed9dd6e2b294415b"> 100</a></span>  <span class="keywordtype">bool</span> <a class="code" href="classutl_1_1spi__bb__i.html#a9a7b908a8976f6efed9dd6e2b294415b">MISO</a> () { <span class="keywordflow">return</span> impl().MISO(); } </div><div class="line"><a name="l00101"></a><span class="lineno"><a class="line" href="classutl_1_1spi__bb__i.html#af7afcca54b5ab9871caccb38794bd9d1"> 101</a></span>  <span class="keywordtype">void</span> <a class="code" href="classutl_1_1spi__bb__i.html#af7afcca54b5ab9871caccb38794bd9d1">SCLK</a> (<span class="keywordtype">bool</span> st) { impl().SCLK (st); } </div><div class="line"><a name="l00102"></a><span class="lineno"><a class="line" href="classutl_1_1spi__bb__i.html#a49c41f82754a6e8fa4209423a33a1762"> 102</a></span>  <span class="keywordtype">void</span> <a class="code" href="classutl_1_1spi__bb__i.html#a49c41f82754a6e8fa4209423a33a1762">delay</a> (uint32_t nsec) { impl().delay (nsec); } </div><div class="line"><a name="l00103"></a><span class="lineno"> 103</span> </div><div class="line"><a name="l00105"></a><span class="lineno"> 105</span> </div><div class="line"><a name="l00109"></a><span class="lineno"> 109</span>  <span class="keyword">private</span>:</div><div class="line"><a name="l00111"></a><span class="lineno"><a class="line" href="classutl_1_1spi__bb__i.html#a4338d3dc65ebe3aff1ec08d0413b3440"> 111</a></span>  uint32_t <a class="code" href="classutl_1_1spi__bb__i.html#a4338d3dc65ebe3aff1ec08d0413b3440">_clock</a> ()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> 1000000000/(2*<a class="code" href="classutl_1_1spi__bb__i.html#a863bf592b1df8f74bcc3b8d76f40c173">nsec_</a>); }</div><div class="line"><a name="l00112"></a><span class="lineno"><a class="line" href="classutl_1_1spi__bb__i.html#a90960d777886658afd42243743b3f61a"> 112</a></span>  <span class="keywordtype">void</span> <a class="code" href="classutl_1_1spi__bb__i.html#a90960d777886658afd42243743b3f61a">_clock</a> (uint32_t c) { <a class="code" href="classutl_1_1spi__bb__i.html#a863bf592b1df8f74bcc3b8d76f40c173">nsec_</a> = 1000000000/(2*c); }</div><div class="line"><a name="l00113"></a><span class="lineno"><a class="line" href="classutl_1_1spi__bb__i.html#a7431ab56033d58e34ee847d825c99658"> 113</a></span>  <a class="code" href="namespaceutl.html#a1427cb5a2b13313147a902173b91e3c1">byte_t</a> <a class="code" href="classutl_1_1spi__bb__i.html#a7431ab56033d58e34ee847d825c99658">_tx_data</a> (<a class="code" href="namespaceutl.html#a1427cb5a2b13313147a902173b91e3c1">byte_t</a> out) { <span class="keywordflow">return</span> <a class="code" href="classutl_1_1spi__bb__i.html#a9010a066edb4cfa4c549174c87eaf368">_tx_data_impl</a> (out); }</div><div class="line"><a name="l00114"></a><span class="lineno"> 114</span> </div><div class="line"><a name="l00115"></a><span class="lineno"> 115</span>  <span class="keyword">template</span> <spi::cpha C =CPHA></div><div class="line"><a name="l00116"></a><span class="lineno"> 116</span>  <a class="code" href="namespaceutl_1_1meta.html#a372fe391d9567f66a81091f581e1fa01">meta::enable_if_t <(C == spi::cpha::LOW), byte_t></a> <a class="code" href="classutl_1_1spi__bb__i.html#a9010a066edb4cfa4c549174c87eaf368">_tx_data_impl</a> (<a class="code" href="namespaceutl.html#a1427cb5a2b13313147a902173b91e3c1">byte_t</a> out);</div><div class="line"><a name="l00117"></a><span class="lineno"> 117</span>  <span class="keyword">template</span> <spi::cpha C =CPHA></div><div class="line"><a name="l00118"></a><span class="lineno"> 118</span>  <a class="code" href="namespaceutl_1_1meta.html#a372fe391d9567f66a81091f581e1fa01">meta::enable_if_t <(C == spi::cpha::HIGH), byte_t></a> <a class="code" href="classutl_1_1spi__bb__i.html#a9010a066edb4cfa4c549174c87eaf368">_tx_data_impl</a> (<a class="code" href="namespaceutl.html#a1427cb5a2b13313147a902173b91e3c1">byte_t</a> out);</div><div class="line"><a name="l00120"></a><span class="lineno"> 120</span> </div><div class="line"><a name="l00123"></a><span class="lineno"> 123</span>  <span class="keyword">private</span>:</div><div class="line"><a name="l00124"></a><span class="lineno"><a class="line" href="classutl_1_1spi__bb__i.html#a863bf592b1df8f74bcc3b8d76f40c173"> 124</a></span>  uint32_t <a class="code" href="classutl_1_1spi__bb__i.html#a863bf592b1df8f74bcc3b8d76f40c173">nsec_</a>; </div><div class="line"><a name="l00125"></a><span class="lineno"> 125</span>  };</div><div class="line"><a name="l00127"></a><span class="lineno"> 127</span> </div><div class="line"><a name="l00135"></a><span class="lineno"> 135</span>  <span class="keyword">template</span> <<span class="keyword">typename</span> impl_t, spi::cpol CPOL, spi::cpha CPHA, spi::bitOrder BitOrder></div><div class="line"><a name="l00136"></a><span class="lineno"> 136</span>  <span class="keyword">template</span> <spi::cpha C></div><div class="line"><a name="l00137"></a><span class="lineno"> 137</span>  <a class="code" href="namespaceutl_1_1meta.html#a372fe391d9567f66a81091f581e1fa01">meta::enable_if_t <(C == spi::cpha::LOW), byte_t></a></div><div class="line"><a name="l00138"></a><span class="lineno"><a class="line" href="classutl_1_1spi__bb__i.html#a9010a066edb4cfa4c549174c87eaf368"> 138</a></span>  <a class="code" href="classutl_1_1spi__bb__i.html#a9010a066edb4cfa4c549174c87eaf368">spi_bb_i<impl_t, CPOL, CPHA, BitOrder>::_tx_data_impl</a> (<a class="code" href="namespaceutl.html#a1427cb5a2b13313147a902173b91e3c1">byte_t</a> out) {</div><div class="line"><a name="l00139"></a><span class="lineno"> 139</span>  <a class="code" href="namespaceutl.html#a1427cb5a2b13313147a902173b91e3c1">byte_t</a> in {};</div><div class="line"><a name="l00140"></a><span class="lineno"> 140</span>  SCLK (clkL_);</div><div class="line"><a name="l00141"></a><span class="lineno"> 141</span>  <span class="keywordflow">for</span> (uint8_t bit {<span class="keyword">static_cast<</span>uint8_t<span class="keyword">></span>(BitOrder)} ; bit ; shift (bit)) {</div><div class="line"><a name="l00142"></a><span class="lineno"> 142</span>  MOSI (out & bit); <span class="comment">// Out at preceding clock trailing edge</span></div><div class="line"><a name="l00143"></a><span class="lineno"> 143</span>  delay (nsec_); <span class="comment">// Half cycle delay</span></div><div class="line"><a name="l00144"></a><span class="lineno"> 144</span>  SCLK (clkH_); <span class="comment">// Leading edge</span></div><div class="line"><a name="l00145"></a><span class="lineno"> 145</span>  in |= (MISO ()) ? bit : 0; <span class="comment">// In at leading clock edge</span></div><div class="line"><a name="l00146"></a><span class="lineno"> 146</span>  delay (nsec_); <span class="comment">// Half cycle delay</span></div><div class="line"><a name="l00147"></a><span class="lineno"> 147</span>  SCLK (clkL_); <span class="comment">// Trailing edge</span></div><div class="line"><a name="l00148"></a><span class="lineno"> 148</span>  }</div><div class="line"><a name="l00149"></a><span class="lineno"> 149</span>  <span class="keywordflow">return</span> in;</div><div class="line"><a name="l00150"></a><span class="lineno"> 150</span>  }</div><div class="line"><a name="l00151"></a><span class="lineno"> 151</span> </div><div class="line"><a name="l00159"></a><span class="lineno"> 159</span>  <span class="keyword">template</span> <<span class="keyword">typename</span> impl_t, spi::cpol CPOL, spi::cpha CPHA, spi::bitOrder BitOrder></div><div class="line"><a name="l00160"></a><span class="lineno"> 160</span>  <span class="keyword">template</span> <spi::cpha C></div><div class="line"><a name="l00161"></a><span class="lineno"> 161</span>  <a class="code" href="namespaceutl_1_1meta.html#a372fe391d9567f66a81091f581e1fa01">meta::enable_if_t <(C == spi::cpha::HIGH), byte_t></a></div><div class="line"><a name="l00162"></a><span class="lineno"><a class="line" href="classutl_1_1spi__bb__i.html#a8e00f788f8ef1a31dfd3b1ca130aa16d"> 162</a></span>  <a class="code" href="classutl_1_1spi__bb__i.html#a9010a066edb4cfa4c549174c87eaf368">spi_bb_i<impl_t, CPOL, CPHA, BitOrder>::_tx_data_impl</a> (<a class="code" href="namespaceutl.html#a1427cb5a2b13313147a902173b91e3c1">byte_t</a> out) {</div><div class="line"><a name="l00163"></a><span class="lineno"> 163</span>  <a class="code" href="namespaceutl.html#a1427cb5a2b13313147a902173b91e3c1">byte_t</a> in {};</div><div class="line"><a name="l00164"></a><span class="lineno"> 164</span>  SCLK (clkL_);</div><div class="line"><a name="l00165"></a><span class="lineno"> 165</span>  <span class="keywordflow">for</span> (uint8_t bit {<span class="keyword">static_cast<</span>uint8_t<span class="keyword">></span>(BitOrder)} ; bit ; shift (bit)) {</div><div class="line"><a name="l00166"></a><span class="lineno"> 166</span>  delay (nsec_); <span class="comment">// Half cycle delay</span></div><div class="line"><a name="l00167"></a><span class="lineno"> 167</span>  SCLK (clkH_); <span class="comment">// Leading edge</span></div><div class="line"><a name="l00168"></a><span class="lineno"> 168</span>  MOSI (out & bit); <span class="comment">// Out at leading clock edge</span></div><div class="line"><a name="l00169"></a><span class="lineno"> 169</span>  delay (nsec_); <span class="comment">// Half cycle delay</span></div><div class="line"><a name="l00170"></a><span class="lineno"> 170</span>  SCLK (clkL_); <span class="comment">// Trailing edge</span></div><div class="line"><a name="l00171"></a><span class="lineno"> 171</span>  in |= (MISO ()) ? bit : 0; <span class="comment">// In at trailing clock edge</span></div><div class="line"><a name="l00172"></a><span class="lineno"> 172</span>  }</div><div class="line"><a name="l00173"></a><span class="lineno"> 173</span>  <span class="keywordflow">return</span> in;</div><div class="line"><a name="l00174"></a><span class="lineno"> 174</span>  }</div><div class="line"><a name="l00175"></a><span class="lineno"> 175</span> </div><div class="line"><a name="l00176"></a><span class="lineno"> 176</span> </div><div class="line"><a name="l00187"></a><span class="lineno"> 187</span>  <span class="keyword">template</span> <<a class="code" href="namespaceutl_1_1spi.html#a89e3e1af5df0b6c37239f7e336969f8a">spi::cpol</a> CPOL,</div><div class="line"><a name="l00188"></a><span class="lineno"> 188</span>  <a class="code" href="namespaceutl_1_1spi.html#aa49fe33d495226891cef0a870cba59df">spi::cpha</a> CPHA,</div><div class="line"><a name="l00189"></a><span class="lineno"> 189</span>  <a class="code" href="namespaceutl_1_1spi.html#aed6b713381c193c598572ebac0b284cc">spi::bitOrder</a> BitOrder></div><div class="line"><a name="l00190"></a><span class="lineno"><a class="line" href="classutl_1_1spi__bb__i_3_01virtual__tag_00_01_c_p_o_l_00_01_c_p_h_a_00_01_bit_order_01_4.html"> 190</a></span>  <span class="keyword">class </span><a class="code" href="classutl_1_1spi__bb__i.html">spi_bb_i</a> <<a class="code" href="structutl_1_1virtual__tag.html">virtual_tag</a>, CPOL, CPHA, BitOrder> : <span class="keyword">public</span> <a class="code" href="classutl_1_1spi__i.html">spi_i</a><virtual_tag> {</div><div class="line"><a name="l00191"></a><span class="lineno"> 191</span>  <span class="keyword">public</span>:</div><div class="line"><a name="l00192"></a><span class="lineno"><a class="line" href="classutl_1_1spi__bb__i_3_01virtual__tag_00_01_c_p_o_l_00_01_c_p_h_a_00_01_bit_order_01_4.html#a8318081f8e7803101bddb893afe8fc6a"> 192</a></span>  <span class="keyword">using</span> <a class="code" href="classutl_1_1spi__i_3_01virtual__tag_01_4.html">type</a> = <a class="code" href="classutl_1_1spi__bb__i_3_01virtual__tag_00_01_c_p_o_l_00_01_c_p_h_a_00_01_bit_order_01_4.html">spi_bb_i<virtual_tag, CPOL, CPHA, BitOrder></a>; </div><div class="line"><a name="l00193"></a><span class="lineno"> 193</span> </div><div class="line"><a name="l00197"></a><span class="lineno"> 197</span>  <span class="keyword">protected</span>:</div><div class="line"><a name="l00199"></a><span class="lineno"> 199</span>  <a class="code" href="classutl_1_1spi__bb__i.html#aeac57567cb7db5ebb73bdd8e1f00cb82">~spi_bb_i</a> () = <span class="keywordflow">default</span>; </div><div class="line"><a name="l00200"></a><span class="lineno"> 200</span>  <a class="code" href="classutl_1_1spi__bb__i.html#a49a61ba9a8e140e45d73e1f634061c6a">spi_bb_i</a> (uint32_t clk) noexcept</div><div class="line"><a name="l00202"></a><span class="lineno"> 202</span>  : <a class="code" href="classutl_1_1spi__bb__i.html#a863bf592b1df8f74bcc3b8d76f40c173">nsec_</a> {1000000000/(2*clk)} {</div><div class="line"><a name="l00203"></a><span class="lineno"> 203</span>  }</div><div class="line"><a name="l00205"></a><span class="lineno"> 205</span> </div><div class="line"><a name="l00206"></a><span class="lineno"> 206</span>  <span class="keyword">private</span>:</div><div class="line"><a name="l00209"></a><span class="lineno"> 209</span>  <span class="keyword">template</span> <spi::bitOrder B =BitOrder> constexpr</div><div class="line"><a name="l00210"></a><span class="lineno"><a class="line" href="classutl_1_1spi__bb__i_3_01virtual__tag_00_01_c_p_o_l_00_01_c_p_h_a_00_01_bit_order_01_4.html#ab7b8568f6383ca83cc3b9c7a4bf14102"> 210</a></span>  <a class="code" href="namespaceutl_1_1meta.html#a372fe391d9567f66a81091f581e1fa01">meta::enable_if_t <(B == spi::bitOrder::LSB_First), void></a> <a class="code" href="classutl_1_1spi__bb__i_3_01virtual__tag_00_01_c_p_o_l_00_01_c_p_h_a_00_01_bit_order_01_4.html#ab7b8568f6383ca83cc3b9c7a4bf14102">shift</a> (<a class="code" href="namespaceutl.html#a1427cb5a2b13313147a902173b91e3c1">byte_t</a>& b) { b <<=1; }</div><div class="line"><a name="l00211"></a><span class="lineno"> 211</span>  <span class="keyword">template</span> <spi::bitOrder B =BitOrder> constexpr</div><div class="line"><a name="l00212"></a><span class="lineno"><a class="line" href="classutl_1_1spi__bb__i_3_01virtual__tag_00_01_c_p_o_l_00_01_c_p_h_a_00_01_bit_order_01_4.html#a4de868a08bed878446e4fa026275cd23"> 212</a></span>  <a class="code" href="namespaceutl_1_1meta.html#a372fe391d9567f66a81091f581e1fa01">meta::enable_if_t <(B == spi::bitOrder::MSB_First), void></a> <a class="code" href="classutl_1_1spi__bb__i_3_01virtual__tag_00_01_c_p_o_l_00_01_c_p_h_a_00_01_bit_order_01_4.html#a4de868a08bed878446e4fa026275cd23">shift</a> (<a class="code" href="namespaceutl.html#a1427cb5a2b13313147a902173b91e3c1">byte_t</a>& b) { b >>=1; }</div><div class="line"><a name="l00213"></a><span class="lineno"><a class="line" href="classutl_1_1spi__bb__i_3_01virtual__tag_00_01_c_p_o_l_00_01_c_p_h_a_00_01_bit_order_01_4.html#a31da01ac9f57390d05da49dc494f8964"> 213</a></span>  <span class="keyword">template</span> <spi::cpol C =CPOL> <span class="keyword">static</span> constexpr <span class="keywordtype">bool</span> <a class="code" href="classutl_1_1spi__bb__i_3_01virtual__tag_00_01_c_p_o_l_00_01_c_p_h_a_00_01_bit_order_01_4.html#a31da01ac9f57390d05da49dc494f8964">clkHigh</a> () {</div><div class="line"><a name="l00214"></a><span class="lineno"> 214</span>  <span class="keywordflow">return</span> !<span class="keyword">static_cast<</span><span class="keywordtype">bool</span><span class="keyword">></span>(C);</div><div class="line"><a name="l00215"></a><span class="lineno"> 215</span>  }</div><div class="line"><a name="l00216"></a><span class="lineno"><a class="line" href="classutl_1_1spi__bb__i_3_01virtual__tag_00_01_c_p_o_l_00_01_c_p_h_a_00_01_bit_order_01_4.html#a71630f7ea657f7b22640eaf3fdeff7ac"> 216</a></span>  <span class="keyword">template</span> <spi::cpol C =CPOL> <span class="keyword">static</span> constexpr <span class="keywordtype">bool</span> <a class="code" href="classutl_1_1spi__bb__i_3_01virtual__tag_00_01_c_p_o_l_00_01_c_p_h_a_00_01_bit_order_01_4.html#a71630f7ea657f7b22640eaf3fdeff7ac">clkLow</a> () {</div><div class="line"><a name="l00217"></a><span class="lineno"> 217</span>  <span class="keywordflow">return</span> <span class="keyword">static_cast<</span><span class="keywordtype">bool</span><span class="keyword">></span>(C);</div><div class="line"><a name="l00218"></a><span class="lineno"> 218</span>  }</div><div class="line"><a name="l00219"></a><span class="lineno"><a class="line" href="classutl_1_1spi__bb__i_3_01virtual__tag_00_01_c_p_o_l_00_01_c_p_h_a_00_01_bit_order_01_4.html#a69ff11ae02a37042fc446ddee6a534b2"> 219</a></span>  <span class="keyword">static</span> constexpr <span class="keywordtype">bool</span> <a class="code" href="classutl_1_1spi__bb__i.html#a3a9b68907304114573bc7321006fa539">clkH_</a> {<a class="code" href="classutl_1_1spi__bb__i.html#a8fa5b901ced4ce734409ab4c20a1c1d2">clkHigh</a>()};</div><div class="line"><a name="l00220"></a><span class="lineno"><a class="line" href="classutl_1_1spi__bb__i_3_01virtual__tag_00_01_c_p_o_l_00_01_c_p_h_a_00_01_bit_order_01_4.html#a652413b2bf4a45c7326faa3fa9b8ef73"> 220</a></span>  <span class="keyword">static</span> constexpr <span class="keywordtype">bool</span> <a class="code" href="classutl_1_1spi__bb__i.html#a509a5828018f62e2627af67e8c6a32d5">clkL_</a> {<a class="code" href="classutl_1_1spi__bb__i.html#ae0a17d5879099f6ac92eee4dee59ab0f">clkLow</a>()};</div><div class="line"><a name="l00222"></a><span class="lineno"> 222</span> </div><div class="line"><a name="l00223"></a><span class="lineno"> 223</span> </div><div class="line"><a name="l00226"></a><span class="lineno"> 226</span>  <span class="keyword">private</span>:</div><div class="line"><a name="l00227"></a><span class="lineno"> 227</span>  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classutl_1_1spi__bb__i.html#a3051a59aaeb5b176a175b352cf5f578e">MOSI</a> (<span class="keywordtype">bool</span>) =0; </div><div class="line"><a name="l00228"></a><span class="lineno"> 228</span>  <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classutl_1_1spi__bb__i.html#a9a7b908a8976f6efed9dd6e2b294415b">MISO</a> () =0; </div><div class="line"><a name="l00229"></a><span class="lineno"> 229</span>  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classutl_1_1spi__bb__i.html#af7afcca54b5ab9871caccb38794bd9d1">SCLK</a> (<span class="keywordtype">bool</span>) =0; </div><div class="line"><a name="l00230"></a><span class="lineno"> 230</span>  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classutl_1_1spi__bb__i.html#a49c41f82754a6e8fa4209423a33a1762">delay</a> (uint32_t) =0; </div><div class="line"><a name="l00231"></a><span class="lineno"> 231</span> </div><div class="line"><a name="l00233"></a><span class="lineno"> 233</span> </div><div class="line"><a name="l00237"></a><span class="lineno"> 237</span>  <span class="keyword">private</span>:</div><div class="line"><a name="l00239"></a><span class="lineno"><a class="line" href="classutl_1_1spi__bb__i_3_01virtual__tag_00_01_c_p_o_l_00_01_c_p_h_a_00_01_bit_order_01_4.html#a255b1bf9e7f74140a20e4a3d8b26c181"> 239</a></span>  uint32_t <a class="code" href="classutl_1_1spi__bb__i_3_01virtual__tag_00_01_c_p_o_l_00_01_c_p_h_a_00_01_bit_order_01_4.html#a255b1bf9e7f74140a20e4a3d8b26c181">_clock</a> () const final { <span class="keywordflow">return</span> 1000000000/(2*<a class="code" href="classutl_1_1spi__bb__i.html#a863bf592b1df8f74bcc3b8d76f40c173">nsec_</a>); }</div><div class="line"><a name="l00240"></a><span class="lineno"><a class="line" href="classutl_1_1spi__bb__i_3_01virtual__tag_00_01_c_p_o_l_00_01_c_p_h_a_00_01_bit_order_01_4.html#ac69aac0298266d8bb8b912f763013433"> 240</a></span>  <span class="keywordtype">void</span> <a class="code" href="classutl_1_1spi__bb__i_3_01virtual__tag_00_01_c_p_o_l_00_01_c_p_h_a_00_01_bit_order_01_4.html#ac69aac0298266d8bb8b912f763013433">_clock</a> (uint32_t c) <span class="keyword">final</span> { <a class="code" href="classutl_1_1spi__bb__i.html#a863bf592b1df8f74bcc3b8d76f40c173">nsec_</a> = 1000000000/(2*c); }</div><div class="line"><a name="l00241"></a><span class="lineno"><a class="line" href="classutl_1_1spi__bb__i_3_01virtual__tag_00_01_c_p_o_l_00_01_c_p_h_a_00_01_bit_order_01_4.html#a2f16bf0d9f6e0eb3045923b416e57e0c"> 241</a></span>  <a class="code" href="namespaceutl.html#a1427cb5a2b13313147a902173b91e3c1">byte_t</a> <a class="code" href="classutl_1_1spi__bb__i_3_01virtual__tag_00_01_c_p_o_l_00_01_c_p_h_a_00_01_bit_order_01_4.html#a2f16bf0d9f6e0eb3045923b416e57e0c">_tx_data</a> (<a class="code" href="namespaceutl.html#a1427cb5a2b13313147a902173b91e3c1">byte_t</a> out) <span class="keyword">final</span> { <span class="keywordflow">return</span> <a class="code" href="classutl_1_1spi__bb__i.html#a9010a066edb4cfa4c549174c87eaf368">_tx_data_impl</a> (out); }</div><div class="line"><a name="l00242"></a><span class="lineno"> 242</span> </div><div class="line"><a name="l00243"></a><span class="lineno"> 243</span>  <span class="keyword">template</span> <spi::cpha C =CPHA></div><div class="line"><a name="l00244"></a><span class="lineno"> 244</span>  <a class="code" href="namespaceutl_1_1meta.html#a372fe391d9567f66a81091f581e1fa01">meta::enable_if_t <(C == spi::cpha::LOW), byte_t></a> <a class="code" href="classutl_1_1spi__bb__i.html#a9010a066edb4cfa4c549174c87eaf368">_tx_data_impl</a> (<a class="code" href="namespaceutl.html#a1427cb5a2b13313147a902173b91e3c1">byte_t</a> out);</div><div class="line"><a name="l00245"></a><span class="lineno"> 245</span>  <span class="keyword">template</span> <spi::cpha C =CPHA></div><div class="line"><a name="l00246"></a><span class="lineno"> 246</span>  <a class="code" href="namespaceutl_1_1meta.html#a372fe391d9567f66a81091f581e1fa01">meta::enable_if_t <(C == spi::cpha::HIGH), byte_t></a> <a class="code" href="classutl_1_1spi__bb__i.html#a9010a066edb4cfa4c549174c87eaf368">_tx_data_impl</a> (<a class="code" href="namespaceutl.html#a1427cb5a2b13313147a902173b91e3c1">byte_t</a> out);</div><div class="line"><a name="l00248"></a><span class="lineno"> 248</span> </div><div class="line"><a name="l00251"></a><span class="lineno"> 251</span>  <span class="keyword">private</span>:</div><div class="line"><a name="l00252"></a><span class="lineno"><a class="line" href="classutl_1_1spi__bb__i_3_01virtual__tag_00_01_c_p_o_l_00_01_c_p_h_a_00_01_bit_order_01_4.html#a0d112cd54d54775eb50febed8f6c18b5"> 252</a></span>  uint32_t <a class="code" href="classutl_1_1spi__bb__i_3_01virtual__tag_00_01_c_p_o_l_00_01_c_p_h_a_00_01_bit_order_01_4.html#a0d112cd54d54775eb50febed8f6c18b5">nsec_</a>; </div><div class="line"><a name="l00253"></a><span class="lineno"> 253</span>  };</div><div class="line"><a name="l00255"></a><span class="lineno"> 255</span> </div><div class="line"><a name="l00263"></a><span class="lineno"> 263</span>  <span class="keyword">template</span> <spi::cpol CPOL, spi::cpha CPHA, spi::bitOrder BitOrder></div><div class="line"><a name="l00264"></a><span class="lineno"> 264</span>  <span class="keyword">template</span> <spi::cpha C></div><div class="line"><a name="l00265"></a><span class="lineno"> 265</span>  <a class="code" href="namespaceutl_1_1meta.html#a372fe391d9567f66a81091f581e1fa01">meta::enable_if_t <(C == spi::cpha::LOW), byte_t></a></div><div class="line"><a name="l00266"></a><span class="lineno"><a class="line" href="classutl_1_1spi__bb__i_3_01virtual__tag_00_01_c_p_o_l_00_01_c_p_h_a_00_01_bit_order_01_4.html#a5875448dd9fdff7f8f59ef84efdb69b1"> 266</a></span>  <a class="code" href="classutl_1_1spi__bb__i.html#a9010a066edb4cfa4c549174c87eaf368">spi_bb_i<virtual_tag, CPOL, CPHA, BitOrder>::_tx_data_impl</a> (<a class="code" href="namespaceutl.html#a1427cb5a2b13313147a902173b91e3c1">byte_t</a> out) {</div><div class="line"><a name="l00267"></a><span class="lineno"> 267</span>  <a class="code" href="namespaceutl.html#a1427cb5a2b13313147a902173b91e3c1">byte_t</a> in {};</div><div class="line"><a name="l00268"></a><span class="lineno"> 268</span>  <a class="code" href="classutl_1_1spi__bb__i.html#af7afcca54b5ab9871caccb38794bd9d1">SCLK</a> (<a class="code" href="classutl_1_1spi__bb__i.html#a509a5828018f62e2627af67e8c6a32d5">clkL_</a>);</div><div class="line"><a name="l00269"></a><span class="lineno"> 269</span>  <span class="keywordflow">for</span> (uint8_t bit {<span class="keyword">static_cast<</span>uint8_t<span class="keyword">></span>(BitOrder)} ; bit ; <a class="code" href="classutl_1_1spi__bb__i.html#a0d017c3bc5c583ad802027914e492b3a">shift</a> (bit)) {</div><div class="line"><a name="l00270"></a><span class="lineno"> 270</span>  <a class="code" href="classutl_1_1spi__bb__i.html#a3051a59aaeb5b176a175b352cf5f578e">MOSI</a> (out & bit); <span class="comment">// Out at preceding clock trailing edge</span></div><div class="line"><a name="l00271"></a><span class="lineno"> 271</span>  <a class="code" href="classutl_1_1spi__bb__i.html#a49c41f82754a6e8fa4209423a33a1762">delay</a> (<a class="code" href="classutl_1_1spi__bb__i.html#a863bf592b1df8f74bcc3b8d76f40c173">nsec_</a>); <span class="comment">// Half cycle delay</span></div><div class="line"><a name="l00272"></a><span class="lineno"> 272</span>  <a class="code" href="classutl_1_1spi__bb__i.html#af7afcca54b5ab9871caccb38794bd9d1">SCLK</a> (<a class="code" href="classutl_1_1spi__bb__i.html#a3a9b68907304114573bc7321006fa539">clkH_</a>); <span class="comment">// Leading edge</span></div><div class="line"><a name="l00273"></a><span class="lineno"> 273</span>  in |= (<a class="code" href="classutl_1_1spi__bb__i.html#a9a7b908a8976f6efed9dd6e2b294415b">MISO</a> ()) ? bit : 0; <span class="comment">// In at leading clock edge</span></div><div class="line"><a name="l00274"></a><span class="lineno"> 274</span>  <a class="code" href="classutl_1_1spi__bb__i.html#a49c41f82754a6e8fa4209423a33a1762">delay</a> (<a class="code" href="classutl_1_1spi__bb__i.html#a863bf592b1df8f74bcc3b8d76f40c173">nsec_</a>); <span class="comment">// Half cycle delay</span></div><div class="line"><a name="l00275"></a><span class="lineno"> 275</span>  <a class="code" href="classutl_1_1spi__bb__i.html#af7afcca54b5ab9871caccb38794bd9d1">SCLK</a> (<a class="code" href="classutl_1_1spi__bb__i.html#a509a5828018f62e2627af67e8c6a32d5">clkL_</a>); <span class="comment">// Trailing edge</span></div><div class="line"><a name="l00276"></a><span class="lineno"> 276</span>  }</div><div class="line"><a name="l00277"></a><span class="lineno"> 277</span>  <span class="keywordflow">return</span> in;</div><div class="line"><a name="l00278"></a><span class="lineno"> 278</span>  }</div><div class="line"><a name="l00279"></a><span class="lineno"> 279</span> </div><div class="line"><a name="l00287"></a><span class="lineno"> 287</span>  <span class="keyword">template</span> <spi::cpol CPOL, spi::cpha CPHA, spi::bitOrder BitOrder></div><div class="line"><a name="l00288"></a><span class="lineno"> 288</span>  <span class="keyword">template</span> <spi::cpha C></div><div class="line"><a name="l00289"></a><span class="lineno"> 289</span>  <a class="code" href="namespaceutl_1_1meta.html#a372fe391d9567f66a81091f581e1fa01">meta::enable_if_t <(C == spi::cpha::HIGH), byte_t></a></div><div class="line"><a name="l00290"></a><span class="lineno"><a class="line" href="classutl_1_1spi__bb__i_3_01virtual__tag_00_01_c_p_o_l_00_01_c_p_h_a_00_01_bit_order_01_4.html#ad11610099072289c1f71dd7aab684905"> 290</a></span>  <a class="code" href="classutl_1_1spi__bb__i.html#a9010a066edb4cfa4c549174c87eaf368">spi_bb_i<virtual_tag, CPOL, CPHA, BitOrder>::_tx_data_impl</a> (<a class="code" href="namespaceutl.html#a1427cb5a2b13313147a902173b91e3c1">byte_t</a> out) {</div><div class="line"><a name="l00291"></a><span class="lineno"> 291</span>  <a class="code" href="namespaceutl.html#a1427cb5a2b13313147a902173b91e3c1">byte_t</a> in {};</div><div class="line"><a name="l00292"></a><span class="lineno"> 292</span>  <a class="code" href="classutl_1_1spi__bb__i.html#af7afcca54b5ab9871caccb38794bd9d1">SCLK</a> (<a class="code" href="classutl_1_1spi__bb__i.html#a509a5828018f62e2627af67e8c6a32d5">clkL_</a>);</div><div class="line"><a name="l00293"></a><span class="lineno"> 293</span>  <span class="keywordflow">for</span> (uint8_t bit {<span class="keyword">static_cast<</span>uint8_t<span class="keyword">></span>(BitOrder)} ; bit ; <a class="code" href="classutl_1_1spi__bb__i.html#a0d017c3bc5c583ad802027914e492b3a">shift</a> (bit)) {</div><div class="line"><a name="l00294"></a><span class="lineno"> 294</span>  <a class="code" href="classutl_1_1spi__bb__i.html#a49c41f82754a6e8fa4209423a33a1762">delay</a> (<a class="code" href="classutl_1_1spi__bb__i.html#a863bf592b1df8f74bcc3b8d76f40c173">nsec_</a>); <span class="comment">// Half cycle delay</span></div><div class="line"><a name="l00295"></a><span class="lineno"> 295</span>  <a class="code" href="classutl_1_1spi__bb__i.html#af7afcca54b5ab9871caccb38794bd9d1">SCLK</a> (<a class="code" href="classutl_1_1spi__bb__i.html#a3a9b68907304114573bc7321006fa539">clkH_</a>); <span class="comment">// Leading edge</span></div><div class="line"><a name="l00296"></a><span class="lineno"> 296</span>  <a class="code" href="classutl_1_1spi__bb__i.html#a3051a59aaeb5b176a175b352cf5f578e">MOSI</a> (out & bit); <span class="comment">// Out at leading clock edge</span></div><div class="line"><a name="l00297"></a><span class="lineno"> 297</span>  <a class="code" href="classutl_1_1spi__bb__i.html#a49c41f82754a6e8fa4209423a33a1762">delay</a> (<a class="code" href="classutl_1_1spi__bb__i.html#a863bf592b1df8f74bcc3b8d76f40c173">nsec_</a>); <span class="comment">// Half cycle delay</span></div><div class="line"><a name="l00298"></a><span class="lineno"> 298</span>  <a class="code" href="classutl_1_1spi__bb__i.html#af7afcca54b5ab9871caccb38794bd9d1">SCLK</a> (<a class="code" href="classutl_1_1spi__bb__i.html#a509a5828018f62e2627af67e8c6a32d5">clkL_</a>); <span class="comment">// Trailing edge</span></div><div class="line"><a name="l00299"></a><span class="lineno"> 299</span>  in |= (<a class="code" href="classutl_1_1spi__bb__i.html#a9a7b908a8976f6efed9dd6e2b294415b">MISO</a> ()) ? bit : 0; <span class="comment">// In at trailing clock edge</span></div><div class="line"><a name="l00300"></a><span class="lineno"> 300</span>  }</div><div class="line"><a name="l00301"></a><span class="lineno"> 301</span>  <span class="keywordflow">return</span> in;</div><div class="line"><a name="l00302"></a><span class="lineno"> 302</span>  }</div><div class="line"><a name="l00303"></a><span class="lineno"> 303</span> </div><div class="line"><a name="l00304"></a><span class="lineno"> 304</span> }</div><div class="line"><a name="l00305"></a><span class="lineno"> 305</span> </div><div class="line"><a name="l00306"></a><span class="lineno"> 306</span> <span class="preprocessor">#endif //#ifndef __spi_bb_h__</span></div><div class="ttc" id="classutl_1_1spi__bb__i_html_a9a7b908a8976f6efed9dd6e2b294415b"><div class="ttname"><a href="classutl_1_1spi__bb__i.html#a9a7b908a8976f6efed9dd6e2b294415b">utl::spi_bb_i::MISO</a></div><div class="ttdeci">bool MISO()</div><div class="ttdoc">Implementers&#39;s MISO pin function. </div><div class="ttdef"><b>Definition:</b> <a href="spi__bb_8h_source.html#l00100">spi_bb.h:100</a></div></div>
- <div class="ttc" id="meta_8h_html"><div class="ttname"><a href="meta_8h.html">meta.h</a></div><div class="ttdoc">Include all meta library. </div></div>
- <div class="ttc" id="namespaceutl_1_1spi_html_a89e3e1af5df0b6c37239f7e336969f8a"><div class="ttname"><a href="namespaceutl_1_1spi.html#a89e3e1af5df0b6c37239f7e336969f8a">utl::spi::cpol</a></div><div class="ttdeci">cpol</div><div class="ttdef"><b>Definition:</b> <a href="spi_8h_source.html#l00047">spi.h:47</a></div></div>
- <div class="ttc" id="namespaceutl_1_1spi_html_aed6b713381c193c598572ebac0b284cca47bde70fdcc82c8363d16c7137641b79"><div class="ttname"><a href="namespaceutl_1_1spi.html#aed6b713381c193c598572ebac0b284cca47bde70fdcc82c8363d16c7137641b79">utl::spi::bitOrder::MSB_First</a></div><div class="ttdoc">Less significant first. </div></div>
- <div class="ttc" id="classutl_1_1spi__bb__i_html_ae0a17d5879099f6ac92eee4dee59ab0f"><div class="ttname"><a href="classutl_1_1spi__bb__i.html#ae0a17d5879099f6ac92eee4dee59ab0f">utl::spi_bb_i::clkLow</a></div><div class="ttdeci">static constexpr bool clkLow()</div><div class="ttdef"><b>Definition:</b> <a href="spi__bb_8h_source.html#l00084">spi_bb.h:84</a></div></div>
- <div class="ttc" id="classutl_1_1spi__bb__i_html_a4338d3dc65ebe3aff1ec08d0413b3440"><div class="ttname"><a href="classutl_1_1spi__bb__i.html#a4338d3dc65ebe3aff1ec08d0413b3440">utl::spi_bb_i::_clock</a></div><div class="ttdeci">uint32_t _clock() const</div><div class="ttdef"><b>Definition:</b> <a href="spi__bb_8h_source.html#l00111">spi_bb.h:111</a></div></div>
- <div class="ttc" id="classutl_1_1spi__bb__i_html_a8fa5b901ced4ce734409ab4c20a1c1d2"><div class="ttname"><a href="classutl_1_1spi__bb__i.html#a8fa5b901ced4ce734409ab4c20a1c1d2">utl::spi_bb_i::clkHigh</a></div><div class="ttdeci">static constexpr bool clkHigh()</div><div class="ttdef"><b>Definition:</b> <a href="spi__bb_8h_source.html#l00081">spi_bb.h:81</a></div></div>
- <div class="ttc" id="classutl_1_1spi__bb__i_html_a9010a066edb4cfa4c549174c87eaf368"><div class="ttname"><a href="classutl_1_1spi__bb__i.html#a9010a066edb4cfa4c549174c87eaf368">utl::spi_bb_i::_tx_data_impl</a></div><div class="ttdeci">meta::enable_if_t<(C==spi::cpha::LOW), byte_t > _tx_data_impl(byte_t out)</div><div class="ttdoc">_tx_data implementation for CPHA == LOW Out at preceding clock trailing edge, In at leading clock edg...</div><div class="ttdef"><b>Definition:</b> <a href="spi__bb_8h_source.html#l00138">spi_bb.h:138</a></div></div>
- <div class="ttc" id="namespaceutl_1_1spi_html_aed6b713381c193c598572ebac0b284cc"><div class="ttname"><a href="namespaceutl_1_1spi.html#aed6b713381c193c598572ebac0b284cc">utl::spi::bitOrder</a></div><div class="ttdeci">bitOrder</div><div class="ttdef"><b>Definition:</b> <a href="spi_8h_source.html#l00040">spi.h:40</a></div></div>
- <div class="ttc" id="crtp_8h_html"><div class="ttname"><a href="crtp_8h.html">crtp.h</a></div></div>
- <div class="ttc" id="classutl_1_1spi__bb__i_html_aeac57567cb7db5ebb73bdd8e1f00cb82"><div class="ttname"><a href="classutl_1_1spi__bb__i.html#aeac57567cb7db5ebb73bdd8e1f00cb82">utl::spi_bb_i::~spi_bb_i</a></div><div class="ttdeci">~spi_bb_i()=default</div></div>
- <div class="ttc" id="classutl_1_1spi__bb__i_3_01virtual__tag_00_01_c_p_o_l_00_01_c_p_h_a_00_01_bit_order_01_4_html_a71630f7ea657f7b22640eaf3fdeff7ac"><div class="ttname"><a href="classutl_1_1spi__bb__i_3_01virtual__tag_00_01_c_p_o_l_00_01_c_p_h_a_00_01_bit_order_01_4.html#a71630f7ea657f7b22640eaf3fdeff7ac">utl::spi_bb_i< virtual_tag, CPOL, CPHA, BitOrder >::clkLow</a></div><div class="ttdeci">static constexpr bool clkLow()</div><div class="ttdef"><b>Definition:</b> <a href="spi__bb_8h_source.html#l00216">spi_bb.h:216</a></div></div>
- <div class="ttc" id="classutl_1_1spi__bb__i_html_a49c41f82754a6e8fa4209423a33a1762"><div class="ttname"><a href="classutl_1_1spi__bb__i.html#a49c41f82754a6e8fa4209423a33a1762">utl::spi_bb_i::delay</a></div><div class="ttdeci">void delay(uint32_t nsec)</div><div class="ttdef"><b>Definition:</b> <a href="spi__bb_8h_source.html#l00102">spi_bb.h:102</a></div></div>
- <div class="ttc" id="spi_8h_html"><div class="ttname"><a href="spi_8h.html">spi.h</a></div><div class="ttdoc">An Abstract base class interface for the spi bus. </div></div>
- <div class="ttc" id="classutl_1_1spi__i_3_01virtual__tag_01_4_html"><div class="ttname"><a href="classutl_1_1spi__i_3_01virtual__tag_01_4.html">utl::spi_i< virtual_tag ></a></div><div class="ttdoc">A virtual base class implementation. </div><div class="ttdef"><b>Definition:</b> <a href="spi_8h_source.html#l00177">spi.h:177</a></div></div>
- <div class="ttc" id="classutl_1_1spi__bb__i_html_a863bf592b1df8f74bcc3b8d76f40c173"><div class="ttname"><a href="classutl_1_1spi__bb__i.html#a863bf592b1df8f74bcc3b8d76f40c173">utl::spi_bb_i::nsec_</a></div><div class="ttdeci">uint32_t nsec_</div><div class="ttdef"><b>Definition:</b> <a href="spi__bb_8h_source.html#l00124">spi_bb.h:124</a></div></div>
- <div class="ttc" id="namespaceutl_1_1spi_html_aa49fe33d495226891cef0a870cba59df"><div class="ttname"><a href="namespaceutl_1_1spi.html#aa49fe33d495226891cef0a870cba59df">utl::spi::cpha</a></div><div class="ttdeci">cpha</div><div class="ttdef"><b>Definition:</b> <a href="spi_8h_source.html#l00054">spi.h:54</a></div></div>
- <div class="ttc" id="classutl_1_1spi__bb__i_3_01virtual__tag_00_01_c_p_o_l_00_01_c_p_h_a_00_01_bit_order_01_4_html_ab7b8568f6383ca83cc3b9c7a4bf14102"><div class="ttname"><a href="classutl_1_1spi__bb__i_3_01virtual__tag_00_01_c_p_o_l_00_01_c_p_h_a_00_01_bit_order_01_4.html#ab7b8568f6383ca83cc3b9c7a4bf14102">utl::spi_bb_i< virtual_tag, CPOL, CPHA, BitOrder >::shift</a></div><div class="ttdeci">constexpr meta::enable_if_t<(B==spi::bitOrder::LSB_First), void > shift(byte_t &b)</div><div class="ttdef"><b>Definition:</b> <a href="spi__bb_8h_source.html#l00210">spi_bb.h:210</a></div></div>
- <div class="ttc" id="classutl_1_1spi__bb__i_html_a509a5828018f62e2627af67e8c6a32d5"><div class="ttname"><a href="classutl_1_1spi__bb__i.html#a509a5828018f62e2627af67e8c6a32d5">utl::spi_bb_i::clkL_</a></div><div class="ttdeci">static constexpr bool clkL_</div><div class="ttdef"><b>Definition:</b> <a href="spi__bb_8h_source.html#l00088">spi_bb.h:88</a></div></div>
- <div class="ttc" id="namespaceutl_html"><div class="ttname"><a href="namespaceutl.html">utl</a></div><div class="ttdoc">STL&#39;s core language concepts. </div><div class="ttdef"><b>Definition:</b> <a href="__1wire_8h_source.html#l00030">_1wire.h:30</a></div></div>
- <div class="ttc" id="classutl_1_1spi__bb__i_html_a93d43e3fa8e2112757281e0c20070eb4"><div class="ttname"><a href="classutl_1_1spi__bb__i.html#a93d43e3fa8e2112757281e0c20070eb4">utl::spi_bb_i::shift</a></div><div class="ttdeci">constexpr meta::enable_if_t<(B==spi::bitOrder::MSB_First), void > shift(byte_t &b)</div><div class="ttdef"><b>Definition:</b> <a href="spi__bb_8h_source.html#l00080">spi_bb.h:80</a></div></div>
- <div class="ttc" id="classutl_1_1spi__bb__i_html_a33b6ef2f4c26b16ee4e28425ab20e852"><div class="ttname"><a href="classutl_1_1spi__bb__i.html#a33b6ef2f4c26b16ee4e28425ab20e852">utl::spi_bb_i::_CRTP_IMPL</a></div><div class="ttdeci">_CRTP_IMPL(impl_t)</div></div>
- <div class="ttc" id="classutl_1_1spi__bb__i_html"><div class="ttname"><a href="classutl_1_1spi__bb__i.html">utl::spi_bb_i</a></div><div class="ttdoc">A bit banking implementation of spi bus inherited from spi_i base class. </div><div class="ttdef"><b>Definition:</b> <a href="spi__bb_8h_source.html#l00056">spi_bb.h:56</a></div></div>
- <div class="ttc" id="classutl_1_1spi__bb__i_html_a49a61ba9a8e140e45d73e1f634061c6a"><div class="ttname"><a href="classutl_1_1spi__bb__i.html#a49a61ba9a8e140e45d73e1f634061c6a">utl::spi_bb_i::spi_bb_i</a></div><div class="ttdeci">spi_bb_i(uint32_t clk) noexcept</div><div class="ttdoc">A default constructor. </div><div class="ttdef"><b>Definition:</b> <a href="spi__bb_8h_source.html#l00069">spi_bb.h:69</a></div></div>
- <div class="ttc" id="namespaceutl_1_1meta_html_a372fe391d9567f66a81091f581e1fa01"><div class="ttname"><a href="namespaceutl_1_1meta.html#a372fe391d9567f66a81091f581e1fa01">utl::meta::enable_if_t</a></div><div class="ttdeci">eval< enable_if< If, _Tp > > enable_if_t</div><div class="ttdoc">alias template for enable_if </div><div class="ttdef"><b>Definition:</b> <a href="sfinae_8h_source.html#l00063">sfinae.h:63</a></div></div>
- <div class="ttc" id="classutl_1_1spi__bb__i_3_01virtual__tag_00_01_c_p_o_l_00_01_c_p_h_a_00_01_bit_order_01_4_html"><div class="ttname"><a href="classutl_1_1spi__bb__i_3_01virtual__tag_00_01_c_p_o_l_00_01_c_p_h_a_00_01_bit_order_01_4.html">utl::spi_bb_i< virtual_tag, CPOL, CPHA, BitOrder ></a></div><div class="ttdoc">A virtual base class interface specialization. Using the private virtual interface we provide the int...</div><div class="ttdef"><b>Definition:</b> <a href="spi__bb_8h_source.html#l00190">spi_bb.h:190</a></div></div>
- <div class="ttc" id="classutl_1_1spi__bb__i_3_01virtual__tag_00_01_c_p_o_l_00_01_c_p_h_a_00_01_bit_order_01_4_html_a31da01ac9f57390d05da49dc494f8964"><div class="ttname"><a href="classutl_1_1spi__bb__i_3_01virtual__tag_00_01_c_p_o_l_00_01_c_p_h_a_00_01_bit_order_01_4.html#a31da01ac9f57390d05da49dc494f8964">utl::spi_bb_i< virtual_tag, CPOL, CPHA, BitOrder >::clkHigh</a></div><div class="ttdeci">static constexpr bool clkHigh()</div><div class="ttdef"><b>Definition:</b> <a href="spi__bb_8h_source.html#l00213">spi_bb.h:213</a></div></div>
- <div class="ttc" id="classutl_1_1spi__bb__i_html_a3a9b68907304114573bc7321006fa539"><div class="ttname"><a href="classutl_1_1spi__bb__i.html#a3a9b68907304114573bc7321006fa539">utl::spi_bb_i::clkH_</a></div><div class="ttdeci">static constexpr bool clkH_</div><div class="ttdef"><b>Definition:</b> <a href="spi__bb_8h_source.html#l00087">spi_bb.h:87</a></div></div>
- <div class="ttc" id="classutl_1_1spi__bb__i_html_af7afcca54b5ab9871caccb38794bd9d1"><div class="ttname"><a href="classutl_1_1spi__bb__i.html#af7afcca54b5ab9871caccb38794bd9d1">utl::spi_bb_i::SCLK</a></div><div class="ttdeci">void SCLK(bool st)</div><div class="ttdoc">Implementers&#39;s SCLK pin function. </div><div class="ttdef"><b>Definition:</b> <a href="spi__bb_8h_source.html#l00101">spi_bb.h:101</a></div></div>
- <div class="ttc" id="classutl_1_1spi__i_html"><div class="ttname"><a href="classutl_1_1spi__i.html">utl::spi_i</a></div><div class="ttdef"><b>Definition:</b> <a href="spi_8h_source.html#l00067">spi.h:67</a></div></div>
- <div class="ttc" id="classutl_1_1spi__bb__i_3_01virtual__tag_00_01_c_p_o_l_00_01_c_p_h_a_00_01_bit_order_01_4_html_a0d112cd54d54775eb50febed8f6c18b5"><div class="ttname"><a href="classutl_1_1spi__bb__i_3_01virtual__tag_00_01_c_p_o_l_00_01_c_p_h_a_00_01_bit_order_01_4.html#a0d112cd54d54775eb50febed8f6c18b5">utl::spi_bb_i< virtual_tag, CPOL, CPHA, BitOrder >::nsec_</a></div><div class="ttdeci">uint32_t nsec_</div><div class="ttdef"><b>Definition:</b> <a href="spi__bb_8h_source.html#l00252">spi_bb.h:252</a></div></div>
- <div class="ttc" id="classutl_1_1spi__bb__i_html_a90960d777886658afd42243743b3f61a"><div class="ttname"><a href="classutl_1_1spi__bb__i.html#a90960d777886658afd42243743b3f61a">utl::spi_bb_i::_clock</a></div><div class="ttdeci">void _clock(uint32_t c)</div><div class="ttdef"><b>Definition:</b> <a href="spi__bb_8h_source.html#l00112">spi_bb.h:112</a></div></div>
- <div class="ttc" id="namespaceutl_html_a1427cb5a2b13313147a902173b91e3c1"><div class="ttname"><a href="namespaceutl.html#a1427cb5a2b13313147a902173b91e3c1">utl::byte_t</a></div><div class="ttdeci">uint8_t byte_t</div><div class="ttdoc">8 bits wide </div><div class="ttdef"><b>Definition:</b> <a href="types_8h_source.html#l00031">types.h:31</a></div></div>
- <div class="ttc" id="structutl_1_1virtual__tag_html"><div class="ttname"><a href="structutl_1_1virtual__tag.html">utl::virtual_tag</a></div><div class="ttdoc">virtual support tag type </div><div class="ttdef"><b>Definition:</b> <a href="crtp_8h_source.html#l00040">crtp.h:40</a></div></div>
- <div class="ttc" id="classutl_1_1spi__bb__i_3_01virtual__tag_00_01_c_p_o_l_00_01_c_p_h_a_00_01_bit_order_01_4_html_a2f16bf0d9f6e0eb3045923b416e57e0c"><div class="ttname"><a href="classutl_1_1spi__bb__i_3_01virtual__tag_00_01_c_p_o_l_00_01_c_p_h_a_00_01_bit_order_01_4.html#a2f16bf0d9f6e0eb3045923b416e57e0c">utl::spi_bb_i< virtual_tag, CPOL, CPHA, BitOrder >::_tx_data</a></div><div class="ttdeci">byte_t _tx_data(byte_t out) final</div><div class="ttdef"><b>Definition:</b> <a href="spi__bb_8h_source.html#l00241">spi_bb.h:241</a></div></div>
- <div class="ttc" id="classutl_1_1spi__bb__i_3_01virtual__tag_00_01_c_p_o_l_00_01_c_p_h_a_00_01_bit_order_01_4_html_ac69aac0298266d8bb8b912f763013433"><div class="ttname"><a href="classutl_1_1spi__bb__i_3_01virtual__tag_00_01_c_p_o_l_00_01_c_p_h_a_00_01_bit_order_01_4.html#ac69aac0298266d8bb8b912f763013433">utl::spi_bb_i< virtual_tag, CPOL, CPHA, BitOrder >::_clock</a></div><div class="ttdeci">void _clock(uint32_t c) final</div><div class="ttdoc">Set the clock frequency of the bus. </div><div class="ttdef"><b>Definition:</b> <a href="spi__bb_8h_source.html#l00240">spi_bb.h:240</a></div></div>
- <div class="ttc" id="classutl_1_1spi__bb__i_html_a3051a59aaeb5b176a175b352cf5f578e"><div class="ttname"><a href="classutl_1_1spi__bb__i.html#a3051a59aaeb5b176a175b352cf5f578e">utl::spi_bb_i::MOSI</a></div><div class="ttdeci">void MOSI(bool st)</div><div class="ttdoc">Implementers&#39;s MOSI pin function. </div><div class="ttdef"><b>Definition:</b> <a href="spi__bb_8h_source.html#l00099">spi_bb.h:99</a></div></div>
- <div class="ttc" id="classutl_1_1spi__bb__i_html_a0d017c3bc5c583ad802027914e492b3a"><div class="ttname"><a href="classutl_1_1spi__bb__i.html#a0d017c3bc5c583ad802027914e492b3a">utl::spi_bb_i::shift</a></div><div class="ttdeci">constexpr meta::enable_if_t<(B==spi::bitOrder::LSB_First), void > shift(byte_t &b)</div><div class="ttdef"><b>Definition:</b> <a href="spi__bb_8h_source.html#l00078">spi_bb.h:78</a></div></div>
- <div class="ttc" id="classutl_1_1spi__bb__i_3_01virtual__tag_00_01_c_p_o_l_00_01_c_p_h_a_00_01_bit_order_01_4_html_a4de868a08bed878446e4fa026275cd23"><div class="ttname"><a href="classutl_1_1spi__bb__i_3_01virtual__tag_00_01_c_p_o_l_00_01_c_p_h_a_00_01_bit_order_01_4.html#a4de868a08bed878446e4fa026275cd23">utl::spi_bb_i< virtual_tag, CPOL, CPHA, BitOrder >::shift</a></div><div class="ttdeci">constexpr meta::enable_if_t<(B==spi::bitOrder::MSB_First), void > shift(byte_t &b)</div><div class="ttdef"><b>Definition:</b> <a href="spi__bb_8h_source.html#l00212">spi_bb.h:212</a></div></div>
- <div class="ttc" id="impl_8h_html"><div class="ttname"><a href="impl_8h.html">impl.h</a></div><div class="ttdoc">Implementation detail main forward header. </div></div>
- <div class="ttc" id="classutl_1_1spi__bb__i_html_a7431ab56033d58e34ee847d825c99658"><div class="ttname"><a href="classutl_1_1spi__bb__i.html#a7431ab56033d58e34ee847d825c99658">utl::spi_bb_i::_tx_data</a></div><div class="ttdeci">byte_t _tx_data(byte_t out)</div><div class="ttdef"><b>Definition:</b> <a href="spi__bb_8h_source.html#l00113">spi_bb.h:113</a></div></div>
- <div class="ttc" id="classutl_1_1spi__bb__i_3_01virtual__tag_00_01_c_p_o_l_00_01_c_p_h_a_00_01_bit_order_01_4_html_a255b1bf9e7f74140a20e4a3d8b26c181"><div class="ttname"><a href="classutl_1_1spi__bb__i_3_01virtual__tag_00_01_c_p_o_l_00_01_c_p_h_a_00_01_bit_order_01_4.html#a255b1bf9e7f74140a20e4a3d8b26c181">utl::spi_bb_i< virtual_tag, CPOL, CPHA, BitOrder >::_clock</a></div><div class="ttdeci">uint32_t _clock() const final</div><div class="ttdoc">Read the clock frequency of the bus. </div><div class="ttdef"><b>Definition:</b> <a href="spi__bb_8h_source.html#l00239">spi_bb.h:239</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_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_82754f54d9380477ef02477185c1f103.html">utl</a></li><li class="navelem"><a class="el" href="dir_b2ad3c1a6521a4924fa9194d98c323e2.html">com</a></li><li class="navelem"><a class="el" href="spi__bb_8h.html">spi_bb.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.14 </li>
- </ul>
- </div>
- </body>
- </html>
|