USB_Host_Shield_2.0/adk_8h_source.html

250 lines
32 KiB
HTML
Raw Normal View History

2013-01-30 22:00:18 +01:00
<!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.3.1"/>
<title>USB Host Shield 2.0: adk.h Source File</title>
2013-01-30 22:00:18 +01:00
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="imageStyle.css" rel="stylesheet" type="text/css"/>
2013-01-30 22:00:18 +01:00
</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 style="padding-left: 0.5em;">
<div id="projectname">USB Host Shield 2.0
2013-01-30 22:00:18 +01:00
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.3.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File&#160;List</span></a></li>
<li><a href="globals.html"><span>File&#160;Members</span></a></li>
</ul>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Macros</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Pages</a></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 id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_e5fbe6d2783ccd4c93c7856d92d7be6e.html">GitHub</a></li><li class="navelem"><a class="el" href="dir_397a095372f04465e811d0ee219bbf8f.html">USB_Host_Shield_2.0</a></li> </ul>
2013-01-30 22:00:18 +01:00
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">adk.h</div> </div>
</div><!--header-->
<div class="contents">
<a href="adk_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">/* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved.</span></div>
<div class="line"><a name="l00002"></a><span class="lineno"> 2</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00003"></a><span class="lineno"> 3</span>&#160;<span class="comment">This software may be distributed and modified under the terms of the GNU</span></div>
<div class="line"><a name="l00004"></a><span class="lineno"> 4</span>&#160;<span class="comment">General Public License version 2 (GPL2) as published by the Free Software</span></div>
<div class="line"><a name="l00005"></a><span class="lineno"> 5</span>&#160;<span class="comment">Foundation and appearing in the file GPL2.TXT included in the packaging of</span></div>
<div class="line"><a name="l00006"></a><span class="lineno"> 6</span>&#160;<span class="comment">this file. Please note that GPL2 Section 2[b] requires that all works based</span></div>
<div class="line"><a name="l00007"></a><span class="lineno"> 7</span>&#160;<span class="comment">on this software must also be made publicly available under the terms of</span></div>
<div class="line"><a name="l00008"></a><span class="lineno"> 8</span>&#160;<span class="comment">the GPL2 (&quot;Copyleft&quot;).</span></div>
<div class="line"><a name="l00009"></a><span class="lineno"> 9</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00010"></a><span class="lineno"> 10</span>&#160;<span class="comment">Contact information</span></div>
<div class="line"><a name="l00011"></a><span class="lineno"> 11</span>&#160;<span class="comment">-------------------</span></div>
<div class="line"><a name="l00012"></a><span class="lineno"> 12</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00013"></a><span class="lineno"> 13</span>&#160;<span class="comment">Circuits At Home, LTD</span></div>
<div class="line"><a name="l00014"></a><span class="lineno"> 14</span>&#160;<span class="comment">Web : http://www.circuitsathome.com</span></div>
<div class="line"><a name="l00015"></a><span class="lineno"> 15</span>&#160;<span class="comment">e-mail : support@circuitsathome.com</span></div>
2013-04-01 22:52:24 +02:00
<div class="line"><a name="l00016"></a><span class="lineno"> 16</span>&#160;<span class="comment"> */</span></div>
2013-01-30 22:00:18 +01:00
<div class="line"><a name="l00017"></a><span class="lineno"> 17</span>&#160;</div>
<div class="line"><a name="l00018"></a><span class="lineno"> 18</span>&#160;<span class="comment">/* Google ADK interface support header */</span></div>
<div class="line"><a name="l00019"></a><span class="lineno"> 19</span>&#160;</div>
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span>&#160;<span class="preprocessor">#if !defined(_ADK_H_)</span></div>
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define _ADK_H_</span></div>
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00023"></a><span class="lineno"> 23</span>&#160;<span class="preprocessor">#include &lt;inttypes.h&gt;</span></div>
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span>&#160;<span class="preprocessor">#include &lt;avr/pgmspace.h&gt;</span></div>
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="avrpins_8h.html">avrpins.h</a>&quot;</span></div>
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="max3421e_8h.html">max3421e.h</a>&quot;</span></div>
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="usbhost_8h.html">usbhost.h</a>&quot;</span></div>
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="usb__ch9_8h.html">usb_ch9.h</a>&quot;</span></div>
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="_usb_8h.html">Usb.h</a>&quot;</span></div>
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span>&#160;</div>
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span>&#160;<span class="preprocessor">#if defined(ARDUINO) &amp;&amp; ARDUINO &gt;=100</span></div>
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#include &quot;Arduino.h&quot;</span></div>
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span>&#160;<span class="preprocessor">#else</span></div>
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#include &lt;WProgram.h&gt;</span></div>
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="printhex_8h.html">printhex.h</a>&quot;</span></div>
<div class="line"><a name="l00038"></a><span class="lineno"> 38</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="hexdump_8h.html">hexdump.h</a>&quot;</span></div>
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="message_8h.html">message.h</a>&quot;</span></div>
<div class="line"><a name="l00040"></a><span class="lineno"> 40</span>&#160;</div>
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="confdescparser_8h.html">confdescparser.h</a>&quot;</span></div>
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span>&#160;</div>
<div class="line"><a name="l00043"></a><span class="lineno"><a class="code" href="adk_8h.html#a37223416b6c1bba6b86ab17211bc9af2"> 43</a></span>&#160;<span class="preprocessor">#define ADK_VID 0x18D1</span></div>
<div class="line"><a name="l00044"></a><span class="lineno"><a class="code" href="adk_8h.html#a32e861258886323d4dbcf066641597a4"> 44</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define ADK_PID 0x2D00</span></div>
<div class="line"><a name="l00045"></a><span class="lineno"><a class="code" href="adk_8h.html#a355cd5e5557b754645d4e1bfffabbf99"> 45</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define ADB_PID 0x2D01</span></div>
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span>&#160;<span class="preprocessor"></span></div>
2013-04-01 22:52:24 +02:00
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span>&#160;<span class="comment">/* requests */</span></div>
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span>&#160;</div>
<div class="line"><a name="l00049"></a><span class="lineno"><a class="code" href="adk_8h.html#a4c3e43d4d2955f93260f3e5ffe207e41"> 49</a></span>&#160;<span class="preprocessor">#define ADK_GETPROTO 51 //check USB accessory protocol version</span></div>
<div class="line"><a name="l00050"></a><span class="lineno"><a class="code" href="adk_8h.html#a4ab0e7e3adbc8bfc1bcdf29887c9a455"> 50</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define ADK_SENDSTR 52 //send identifying string</span></div>
<div class="line"><a name="l00051"></a><span class="lineno"><a class="code" href="adk_8h.html#a6ebdba027fb7072f681e6445a385e8f2"> 51</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define ADK_ACCSTART 53 //start device in accessory mode</span></div>
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00053"></a><span class="lineno"><a class="code" href="adk_8h.html#a67b2829fb8d9f0e52eebef518ec6ebb0"> 53</a></span>&#160;<span class="preprocessor">#define bmREQ_ADK_GET USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_VENDOR|USB_SETUP_RECIPIENT_DEVICE</span></div>
<div class="line"><a name="l00054"></a><span class="lineno"><a class="code" href="adk_8h.html#a7da9c6adbc669b65ca3e4bd3f90c4c7b"> 54</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define bmREQ_ADK_SEND USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_VENDOR|USB_SETUP_RECIPIENT_DEVICE</span></div>
<div class="line"><a name="l00055"></a><span class="lineno"> 55</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00056"></a><span class="lineno"><a class="code" href="adk_8h.html#a12e00d6841cbb8fd9ae7c97402efa062"> 56</a></span>&#160;<span class="preprocessor">#define ACCESSORY_STRING_MANUFACTURER 0</span></div>
<div class="line"><a name="l00057"></a><span class="lineno"><a class="code" href="adk_8h.html#a962954d4b489994aa347721c582fe242"> 57</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define ACCESSORY_STRING_MODEL 1</span></div>
<div class="line"><a name="l00058"></a><span class="lineno"><a class="code" href="adk_8h.html#aa376dd887b57d0628df287dd1fce7f3b"> 58</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define ACCESSORY_STRING_DESCRIPTION 2</span></div>
<div class="line"><a name="l00059"></a><span class="lineno"><a class="code" href="adk_8h.html#aab852db9aa38642ad7be827ae95351c5"> 59</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define ACCESSORY_STRING_VERSION 3</span></div>
<div class="line"><a name="l00060"></a><span class="lineno"><a class="code" href="adk_8h.html#a0485b5be230520d0acde7ef32fb8210e"> 60</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define ACCESSORY_STRING_URI 4</span></div>
<div class="line"><a name="l00061"></a><span class="lineno"><a class="code" href="adk_8h.html#a31b2b6ec818e90cd9fe47bd4f7f86c16"> 61</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define ACCESSORY_STRING_SERIAL 5</span></div>
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00063"></a><span class="lineno"><a class="code" href="adk_8h.html#ac39da606ffc273bd855152107297d6a1"> 63</a></span>&#160;<span class="preprocessor">#define ADK_MAX_ENDPOINTS 3 //endpoint 0, bulk_IN, bulk_OUT</span></div>
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>&#160;<span class="keyword">class </span><a class="code" href="class_a_d_k.html">ADK</a>;</div>
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>&#160;</div>
<div class="line"><a name="l00067"></a><span class="lineno"><a class="code" href="class_a_d_k.html"> 67</a></span>&#160;<span class="keyword">class </span><a class="code" href="class_a_d_k.html">ADK</a> : <span class="keyword">public</span> <a class="code" href="class_u_s_b_device_config.html">USBDeviceConfig</a>, <span class="keyword">public</span> <a class="code" href="class_usb_config_xtracter.html">UsbConfigXtracter</a> {</div>
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>&#160; <span class="comment">/* ID strings */</span></div>
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>&#160; <span class="keyword">const</span> <span class="keywordtype">char</span>* manufacturer;</div>
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>&#160; <span class="keyword">const</span> <span class="keywordtype">char</span>* model;</div>
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>&#160; <span class="keyword">const</span> <span class="keywordtype">char</span>* description;</div>
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span>&#160; <span class="keyword">const</span> <span class="keywordtype">char</span>* version;</div>
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span>&#160; <span class="keyword">const</span> <span class="keywordtype">char</span>* uri;</div>
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span>&#160; <span class="keyword">const</span> <span class="keywordtype">char</span>* serial;</div>
<div class="line"><a name="l00076"></a><span class="lineno"> 76</span>&#160;</div>
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span>&#160; <span class="comment">/* ADK proprietary requests */</span></div>
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span>&#160; uint8_t getProto(uint8_t* adkproto);</div>
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>&#160; uint8_t sendStr(uint8_t index, <span class="keyword">const</span> <span class="keywordtype">char</span>* str);</div>
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>&#160; uint8_t switchAcc(<span class="keywordtype">void</span>);</div>
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span>&#160;</div>
<div class="line"><a name="l00082"></a><span class="lineno"> 82</span>&#160;<span class="keyword">protected</span>:</div>
<div class="line"><a name="l00083"></a><span class="lineno"><a class="code" href="class_a_d_k.html#a964ec80ac133bf8d65cf0274e37b29da"> 83</a></span>&#160; <span class="keyword">static</span> <span class="keyword">const</span> uint8_t <a class="code" href="class_a_d_k.html#a964ec80ac133bf8d65cf0274e37b29da">epDataInIndex</a>; <span class="comment">// DataIn endpoint index</span></div>
<div class="line"><a name="l00084"></a><span class="lineno"><a class="code" href="class_a_d_k.html#acfc5a7e45f15bba7ff8cd42552796624"> 84</a></span>&#160; <span class="keyword">static</span> <span class="keyword">const</span> uint8_t <a class="code" href="class_a_d_k.html#acfc5a7e45f15bba7ff8cd42552796624">epDataOutIndex</a>; <span class="comment">// DataOUT endpoint index</span></div>
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span>&#160;</div>
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span>&#160; <span class="comment">/* mandatory members */</span></div>
<div class="line"><a name="l00087"></a><span class="lineno"><a class="code" href="class_a_d_k.html#ab28e3a19569c27f3ed5362e9800065c1"> 87</a></span>&#160; <a class="code" href="class_u_s_b.html">USB</a> *<a class="code" href="class_a_d_k.html#ab28e3a19569c27f3ed5362e9800065c1">pUsb</a>;</div>
<div class="line"><a name="l00088"></a><span class="lineno"><a class="code" href="class_a_d_k.html#ab22a7c60cec56823727d4ff2cf2c4edf"> 88</a></span>&#160; uint8_t <a class="code" href="class_a_d_k.html#ab22a7c60cec56823727d4ff2cf2c4edf">bAddress</a>;</div>
<div class="line"><a name="l00089"></a><span class="lineno"><a class="code" href="class_a_d_k.html#ae8fcc6a6fccab61116cea10dd1f17738"> 89</a></span>&#160; uint8_t <a class="code" href="class_a_d_k.html#ae8fcc6a6fccab61116cea10dd1f17738">bConfNum</a>; <span class="comment">// configuration number</span></div>
2013-01-30 22:00:18 +01:00
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span>&#160;</div>
2013-04-01 22:52:24 +02:00
<div class="line"><a name="l00091"></a><span class="lineno"><a class="code" href="class_a_d_k.html#adf969d306da15baecd5c59bbb568053e"> 91</a></span>&#160; uint8_t <a class="code" href="class_a_d_k.html#adf969d306da15baecd5c59bbb568053e">bNumEP</a>; <span class="comment">// total number of EP in the configuration</span></div>
<div class="line"><a name="l00092"></a><span class="lineno"><a class="code" href="class_a_d_k.html#a135db75b9e8cdd59b89f46c44dd83dd4"> 92</a></span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_a_d_k.html#a135db75b9e8cdd59b89f46c44dd83dd4">ready</a>;</div>
<div class="line"><a name="l00093"></a><span class="lineno"> 93</span>&#160;</div>
<div class="line"><a name="l00094"></a><span class="lineno"> 94</span>&#160; <span class="comment">/* Endpoint data structure */</span></div>
<div class="line"><a name="l00095"></a><span class="lineno"><a class="code" href="class_a_d_k.html#a6ffc693d731ddeb9499c11e893fc467d"> 95</a></span>&#160; <a class="code" href="struct_ep_info.html">EpInfo</a> <a class="code" href="class_a_d_k.html#a6ffc693d731ddeb9499c11e893fc467d">epInfo</a>[<a class="code" href="adk_8h.html#ac39da606ffc273bd855152107297d6a1">ADK_MAX_ENDPOINTS</a>];</div>
<div class="line"><a name="l00096"></a><span class="lineno"> 96</span>&#160;</div>
<div class="line"><a name="l00097"></a><span class="lineno"> 97</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_a_d_k.html#ac4bd3303b99921289c3f59e2df219e50">PrintEndpointDescriptor</a>(<span class="keyword">const</span> <a class="code" href="struct_u_s_b___e_n_d_p_o_i_n_t___d_e_s_c_r_i_p_t_o_r.html">USB_ENDPOINT_DESCRIPTOR</a>* ep_ptr);</div>
<div class="line"><a name="l00098"></a><span class="lineno"> 98</span>&#160;</div>
<div class="line"><a name="l00099"></a><span class="lineno"> 99</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00100"></a><span class="lineno"> 100</span>&#160; <a class="code" href="class_a_d_k.html#a29492dcd9b7f6023b7866cd05188d61c">ADK</a>(<a class="code" href="class_u_s_b.html">USB</a> *<a class="code" href="class_a_d_k.html#ab28e3a19569c27f3ed5362e9800065c1">pUsb</a>, <span class="keyword">const</span> <span class="keywordtype">char</span>* manufacturer,</div>
<div class="line"><a name="l00101"></a><span class="lineno"> 101</span>&#160; <span class="keyword">const</span> <span class="keywordtype">char</span>* model,</div>
<div class="line"><a name="l00102"></a><span class="lineno"> 102</span>&#160; <span class="keyword">const</span> <span class="keywordtype">char</span>* description,</div>
<div class="line"><a name="l00103"></a><span class="lineno"> 103</span>&#160; <span class="keyword">const</span> <span class="keywordtype">char</span>* version,</div>
<div class="line"><a name="l00104"></a><span class="lineno"> 104</span>&#160; <span class="keyword">const</span> <span class="keywordtype">char</span>* uri,</div>
<div class="line"><a name="l00105"></a><span class="lineno"> 105</span>&#160; <span class="keyword">const</span> <span class="keywordtype">char</span>* serial);</div>
<div class="line"><a name="l00106"></a><span class="lineno"> 106</span>&#160;</div>
<div class="line"><a name="l00107"></a><span class="lineno"> 107</span>&#160; <span class="comment">// Methods for receiving and sending data</span></div>
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span>&#160; uint8_t <a class="code" href="class_a_d_k.html#a66b9943dfa89f783a8cdeb655e6fe9b1">RcvData</a>(uint16_t *nbytesptr, uint8_t *dataptr);</div>
<div class="line"><a name="l00109"></a><span class="lineno"> 109</span>&#160; uint8_t <a class="code" href="class_a_d_k.html#ac37bde02b6ed1436712d3619afb07c84">SndData</a>(uint16_t nbytes, uint8_t *dataptr);</div>
<div class="line"><a name="l00110"></a><span class="lineno"> 110</span>&#160;</div>
2013-01-30 22:00:18 +01:00
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span>&#160;</div>
2013-04-01 22:52:24 +02:00
<div class="line"><a name="l00112"></a><span class="lineno"> 112</span>&#160; <span class="comment">// USBDeviceConfig implementation</span></div>
<div class="line"><a name="l00113"></a><span class="lineno"> 113</span>&#160; <span class="keyword">virtual</span> uint8_t <a class="code" href="class_a_d_k.html#a8c5c2e212c748966ccd863499d202063">Init</a>(uint8_t parent, uint8_t port, <span class="keywordtype">bool</span> lowspeed);</div>
<div class="line"><a name="l00114"></a><span class="lineno"> 114</span>&#160; <span class="keyword">virtual</span> uint8_t <a class="code" href="class_a_d_k.html#a7f64af34d7890f87ceab5d144f6c26ef">Release</a>();</div>
2013-01-30 22:00:18 +01:00
<div class="line"><a name="l00115"></a><span class="lineno"> 115</span>&#160;</div>
2013-04-01 22:52:24 +02:00
<div class="line"><a name="l00116"></a><span class="lineno"><a class="code" href="class_a_d_k.html#af3784434ee6a1c6f3dc5b591f467e703"> 116</a></span>&#160; <span class="keyword">virtual</span> uint8_t <a class="code" href="class_a_d_k.html#af3784434ee6a1c6f3dc5b591f467e703">Poll</a>() {</div>
<div class="line"><a name="l00117"></a><span class="lineno"> 117</span>&#160; <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00118"></a><span class="lineno"> 118</span>&#160; };</div>
<div class="line"><a name="l00119"></a><span class="lineno"> 119</span>&#160;</div>
<div class="line"><a name="l00120"></a><span class="lineno"><a class="code" href="class_a_d_k.html#a1a972e8dc98b60ab27528db3af2618c3"> 120</a></span>&#160; <span class="keyword">virtual</span> uint8_t <a class="code" href="class_a_d_k.html#a1a972e8dc98b60ab27528db3af2618c3">GetAddress</a>() {</div>
<div class="line"><a name="l00121"></a><span class="lineno"> 121</span>&#160; <span class="keywordflow">return</span> <a class="code" href="class_a_d_k.html#ab22a7c60cec56823727d4ff2cf2c4edf">bAddress</a>;</div>
<div class="line"><a name="l00122"></a><span class="lineno"> 122</span>&#160; };</div>
2013-01-30 22:00:18 +01:00
<div class="line"><a name="l00123"></a><span class="lineno"> 123</span>&#160;</div>
2013-04-01 22:52:24 +02:00
<div class="line"><a name="l00124"></a><span class="lineno"><a class="code" href="class_a_d_k.html#a1dee02856625dfcac4b0cdd4e8672cef"> 124</a></span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="class_a_d_k.html#a1dee02856625dfcac4b0cdd4e8672cef">isReady</a>() {</div>
<div class="line"><a name="l00125"></a><span class="lineno"> 125</span>&#160; <span class="keywordflow">return</span> <a class="code" href="class_a_d_k.html#a135db75b9e8cdd59b89f46c44dd83dd4">ready</a>;</div>
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span>&#160; };</div>
2013-01-30 22:00:18 +01:00
<div class="line"><a name="l00127"></a><span class="lineno"> 127</span>&#160;</div>
2013-04-01 22:52:24 +02:00
<div class="line"><a name="l00128"></a><span class="lineno"> 128</span>&#160; <span class="comment">//UsbConfigXtracter implementation</span></div>
<div class="line"><a name="l00129"></a><span class="lineno"> 129</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_a_d_k.html#aac2fac5410faea0e439b4f7e688b3d75">EndpointXtract</a>(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, <span class="keyword">const</span> <a class="code" href="struct_u_s_b___e_n_d_p_o_i_n_t___d_e_s_c_r_i_p_t_o_r.html">USB_ENDPOINT_DESCRIPTOR</a> *ep);</div>
<div class="line"><a name="l00130"></a><span class="lineno"> 130</span>&#160;}; <span class="comment">//class ADK : public USBDeviceConfig ...</span></div>
<div class="line"><a name="l00131"></a><span class="lineno"> 131</span>&#160;</div>
<div class="line"><a name="l00132"></a><span class="lineno"> 132</span>&#160;<span class="comment">/* get ADK protocol version */</span></div>
<div class="line"><a name="l00133"></a><span class="lineno"> 133</span>&#160;</div>
<div class="line"><a name="l00134"></a><span class="lineno"> 134</span>&#160;<span class="comment">/* returns 2 bytes in *adkproto */</span></div>
<div class="line"><a name="l00135"></a><span class="lineno"> 135</span>&#160;<span class="keyword">inline</span> uint8_t ADK::getProto(uint8_t* adkproto) {</div>
<div class="line"><a name="l00136"></a><span class="lineno"> 136</span>&#160; <span class="keywordflow">return</span>( <a class="code" href="class_a_d_k.html#ab28e3a19569c27f3ed5362e9800065c1">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a636695a5c3d35cd6b9e31c54edfacd7c">ctrlReq</a>(<a class="code" href="class_a_d_k.html#ab22a7c60cec56823727d4ff2cf2c4edf">bAddress</a>, 0, <a class="code" href="adk_8h.html#a67b2829fb8d9f0e52eebef518ec6ebb0">bmREQ_ADK_GET</a>, <a class="code" href="adk_8h.html#a4c3e43d4d2955f93260f3e5ffe207e41">ADK_GETPROTO</a>, 0, 0, 0, 2, 2, adkproto, NULL));</div>
<div class="line"><a name="l00137"></a><span class="lineno"> 137</span>&#160;}</div>
<div class="line"><a name="l00138"></a><span class="lineno"> 138</span>&#160;</div>
<div class="line"><a name="l00139"></a><span class="lineno"> 139</span>&#160;<span class="comment">/* send ADK string */</span></div>
<div class="line"><a name="l00140"></a><span class="lineno"> 140</span>&#160;<span class="keyword">inline</span> uint8_t ADK::sendStr(uint8_t index, <span class="keyword">const</span> <span class="keywordtype">char</span>* str) {</div>
<div class="line"><a name="l00141"></a><span class="lineno"> 141</span>&#160; <span class="keywordflow">return</span>( <a class="code" href="class_a_d_k.html#ab28e3a19569c27f3ed5362e9800065c1">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a636695a5c3d35cd6b9e31c54edfacd7c">ctrlReq</a>(<a class="code" href="class_a_d_k.html#ab22a7c60cec56823727d4ff2cf2c4edf">bAddress</a>, 0, <a class="code" href="adk_8h.html#a7da9c6adbc669b65ca3e4bd3f90c4c7b">bmREQ_ADK_SEND</a>, <a class="code" href="adk_8h.html#a4ab0e7e3adbc8bfc1bcdf29887c9a455">ADK_SENDSTR</a>, 0, 0, index, strlen(str) + 1, strlen(str) + 1, (uint8_t*) str, NULL));</div>
<div class="line"><a name="l00142"></a><span class="lineno"> 142</span>&#160;}</div>
<div class="line"><a name="l00143"></a><span class="lineno"> 143</span>&#160;</div>
<div class="line"><a name="l00144"></a><span class="lineno"> 144</span>&#160;<span class="comment">/* switch to accessory mode */</span></div>
<div class="line"><a name="l00145"></a><span class="lineno"> 145</span>&#160;<span class="keyword">inline</span> uint8_t ADK::switchAcc(<span class="keywordtype">void</span>) {</div>
<div class="line"><a name="l00146"></a><span class="lineno"> 146</span>&#160; <span class="keywordflow">return</span>( <a class="code" href="class_a_d_k.html#ab28e3a19569c27f3ed5362e9800065c1">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a636695a5c3d35cd6b9e31c54edfacd7c">ctrlReq</a>(<a class="code" href="class_a_d_k.html#ab22a7c60cec56823727d4ff2cf2c4edf">bAddress</a>, 0, <a class="code" href="adk_8h.html#a7da9c6adbc669b65ca3e4bd3f90c4c7b">bmREQ_ADK_SEND</a>, <a class="code" href="adk_8h.html#a6ebdba027fb7072f681e6445a385e8f2">ADK_ACCSTART</a>, 0, 0, 0, 0, 0, NULL, NULL));</div>
<div class="line"><a name="l00147"></a><span class="lineno"> 147</span>&#160;}</div>
<div class="line"><a name="l00148"></a><span class="lineno"> 148</span>&#160;</div>
<div class="line"><a name="l00149"></a><span class="lineno"> 149</span>&#160;<span class="preprocessor">#endif // _ADK_H_</span></div>
2013-01-30 22:00:18 +01:00
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
2013-01-30 22:00:18 +01:00
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.3.1
</small></address>
</body>
</html>