Update after formatting

This commit is contained in:
Kristian Sloth Lauszus 2013-04-01 22:52:24 +02:00
parent 851b621598
commit 32e9b6197f
605 changed files with 44662 additions and 20428 deletions

View file

@ -1587,13 +1587,13 @@ ENABLE_PREPROCESSING = YES
# compilation will be performed. Macro expansion can be done in a controlled
# way by setting EXPAND_ONLY_PREDEF to YES.
MACRO_EXPANSION = NO
MACRO_EXPANSION = YES
# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
# then the macro expansion is limited to the macros specified with the
# PREDEFINED and EXPAND_AS_DEFINED tags.
EXPAND_ONLY_PREDEF = NO
EXPAND_ONLY_PREDEF = YES
# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
# pointed to by INCLUDE_PATH will be searched when a #include is found.
@ -1622,7 +1622,9 @@ INCLUDE_FILE_PATTERNS =
# instead of the = operator.
PREDEFINED = WIICAMERA \
ARDUINO=100
ARDUINO=100 \
__attribute__(x)= \
PROGMEM
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
# this tag can be used to specify a list of macro names that should be expanded.

View file

@ -97,7 +97,7 @@ Include dependency graph for BTD.cpp:</div>
<div class="dyncontent">
<div class="center"><img src="_b_t_d_8cpp__incl.png" border="0" usemap="#_b_t_d_8cpp" alt=""/></div>
<map name="_b_t_d_8cpp" id="_b_t_d_8cpp">
<area shape="rect" id="node2" href="_b_t_d_8h.html" title="BTD.h" alt="" coords="549,75,594,96"/><area shape="rect" id="node3" href="_usb_8h.html" title="Usb.h" alt="" coords="342,144,385,165"/><area shape="rect" id="node18" href="confdescparser_8h.html" title="confdescparser.h" alt="" coords="708,144,791,165"/><area shape="rect" id="node6" href="avrpins_8h.html" title="avrpins.h" alt="" coords="251,283,305,304"/><area shape="rect" id="node8" href="max3421e_8h.html" title="max3421e.h" alt="" coords="159,283,226,304"/><area shape="rect" id="node9" href="usbhost_8h.html" title="usbhost.h" alt="" coords="175,213,231,235"/><area shape="rect" id="node10" href="usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="349,283,407,304"/><area shape="rect" id="node11" href="address_8h.html" title="address.h" alt="" coords="41,213,98,235"/><area shape="rect" id="node14" href="printhex_8h.html" title="printhex.h" alt="" coords="721,352,778,373"/><area shape="rect" id="node15" href="hexdump_8h.html" title="hexdump.h" alt="" coords="634,283,695,304"/><area shape="rect" id="node17" href="message_8h.html" title="message.h" alt="" coords="719,283,781,304"/><area shape="rect" id="node19" href="parsetools_8h.html" title="parsetools.h" alt="" coords="788,213,853,235"/></map>
<area shape="rect" id="node2" href="_b_t_d_8h.html" title="BTD.h" alt="" coords="551,75,596,96"/><area shape="rect" id="node3" href="_usb_8h.html" title="Usb.h" alt="" coords="288,213,331,235"/><area shape="rect" id="node18" href="confdescparser_8h.html" title="confdescparser.h" alt="" coords="635,144,719,165"/><area shape="rect" id="node6" href="avrpins_8h.html" title="avrpins.h" alt="" coords="5,352,59,373"/><area shape="rect" id="node8" href="max3421e_8h.html" title="max3421e.h" alt="" coords="180,352,247,373"/><area shape="rect" id="node9" href="usbhost_8h.html" title="usbhost.h" alt="" coords="181,283,237,304"/><area shape="rect" id="node10" href="usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="97,352,156,373"/><area shape="rect" id="node11" href="address_8h.html" title="address.h" alt="" coords="314,283,371,304"/><area shape="rect" id="node14" href="message_8h.html" title="message.h" alt="" coords="648,283,709,304"/><area shape="rect" id="node16" href="printhex_8h.html" title="printhex.h" alt="" coords="650,352,707,373"/><area shape="rect" id="node17" href="hexdump_8h.html" title="hexdump.h" alt="" coords="783,352,844,373"/><area shape="rect" id="node19" href="parsetools_8h.html" title="parsetools.h" alt="" coords="715,213,780,235"/></map>
</div>
</div>
<p><a href="_b_t_d_8cpp_source.html">Go to the source code of this file.</a></p>

View file

@ -1,14 +1,14 @@
<map id="BTD.cpp" name="BTD.cpp">
<area shape="rect" id="node2" href="$_b_t_d_8h.html" title="BTD.h" alt="" coords="549,75,594,96"/>
<area shape="rect" id="node3" href="$_usb_8h.html" title="Usb.h" alt="" coords="342,144,385,165"/>
<area shape="rect" id="node18" href="$confdescparser_8h.html" title="confdescparser.h" alt="" coords="708,144,791,165"/>
<area shape="rect" id="node6" href="$avrpins_8h.html" title="avrpins.h" alt="" coords="251,283,305,304"/>
<area shape="rect" id="node8" href="$max3421e_8h.html" title="max3421e.h" alt="" coords="159,283,226,304"/>
<area shape="rect" id="node9" href="$usbhost_8h.html" title="usbhost.h" alt="" coords="175,213,231,235"/>
<area shape="rect" id="node10" href="$usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="349,283,407,304"/>
<area shape="rect" id="node11" href="$address_8h.html" title="address.h" alt="" coords="41,213,98,235"/>
<area shape="rect" id="node14" href="$printhex_8h.html" title="printhex.h" alt="" coords="721,352,778,373"/>
<area shape="rect" id="node15" href="$hexdump_8h.html" title="hexdump.h" alt="" coords="634,283,695,304"/>
<area shape="rect" id="node17" href="$message_8h.html" title="message.h" alt="" coords="719,283,781,304"/>
<area shape="rect" id="node19" href="$parsetools_8h.html" title="parsetools.h" alt="" coords="788,213,853,235"/>
<area shape="rect" id="node2" href="$_b_t_d_8h.html" title="BTD.h" alt="" coords="551,75,596,96"/>
<area shape="rect" id="node3" href="$_usb_8h.html" title="Usb.h" alt="" coords="288,213,331,235"/>
<area shape="rect" id="node18" href="$confdescparser_8h.html" title="confdescparser.h" alt="" coords="635,144,719,165"/>
<area shape="rect" id="node6" href="$avrpins_8h.html" title="avrpins.h" alt="" coords="5,352,59,373"/>
<area shape="rect" id="node8" href="$max3421e_8h.html" title="max3421e.h" alt="" coords="180,352,247,373"/>
<area shape="rect" id="node9" href="$usbhost_8h.html" title="usbhost.h" alt="" coords="181,283,237,304"/>
<area shape="rect" id="node10" href="$usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="97,352,156,373"/>
<area shape="rect" id="node11" href="$address_8h.html" title="address.h" alt="" coords="314,283,371,304"/>
<area shape="rect" id="node14" href="$message_8h.html" title="message.h" alt="" coords="648,283,709,304"/>
<area shape="rect" id="node16" href="$printhex_8h.html" title="printhex.h" alt="" coords="650,352,707,373"/>
<area shape="rect" id="node17" href="$hexdump_8h.html" title="hexdump.h" alt="" coords="783,352,844,373"/>
<area shape="rect" id="node19" href="$parsetools_8h.html" title="parsetools.h" alt="" coords="715,213,780,235"/>
</map>

View file

@ -1 +1 @@
e7a1e58b2211e982ba972dcc2479da23
944056a1501ac9eff0011e11046b8aea

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

After

Width:  |  Height:  |  Size: 74 KiB

File diff suppressed because it is too large Load diff

View file

@ -99,7 +99,7 @@ Include dependency graph for BTD.h:</div>
<div class="dyncontent">
<div class="center"><img src="_b_t_d_8h__incl.png" border="0" usemap="#_b_t_d_8h" alt=""/></div>
<map name="_b_t_d_8h" id="_b_t_d_8h">
<area shape="rect" id="node2" href="_usb_8h.html" title="Usb.h" alt="" coords="342,75,385,96"/><area shape="rect" id="node17" href="confdescparser_8h.html" title="confdescparser.h" alt="" coords="708,75,791,96"/><area shape="rect" id="node5" href="avrpins_8h.html" title="avrpins.h" alt="" coords="251,213,305,235"/><area shape="rect" id="node7" href="max3421e_8h.html" title="max3421e.h" alt="" coords="159,213,226,235"/><area shape="rect" id="node8" href="usbhost_8h.html" title="usbhost.h" alt="" coords="175,144,231,165"/><area shape="rect" id="node9" href="usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="349,213,407,235"/><area shape="rect" id="node10" href="address_8h.html" title="address.h" alt="" coords="41,144,98,165"/><area shape="rect" id="node13" href="printhex_8h.html" title="printhex.h" alt="" coords="721,283,778,304"/><area shape="rect" id="node14" href="hexdump_8h.html" title="hexdump.h" alt="" coords="634,213,695,235"/><area shape="rect" id="node16" href="message_8h.html" title="message.h" alt="" coords="719,213,781,235"/><area shape="rect" id="node18" href="parsetools_8h.html" title="parsetools.h" alt="" coords="788,144,853,165"/></map>
<area shape="rect" id="node2" href="_usb_8h.html" title="Usb.h" alt="" coords="288,144,331,165"/><area shape="rect" id="node17" href="confdescparser_8h.html" title="confdescparser.h" alt="" coords="635,75,719,96"/><area shape="rect" id="node5" href="avrpins_8h.html" title="avrpins.h" alt="" coords="5,283,59,304"/><area shape="rect" id="node7" href="max3421e_8h.html" title="max3421e.h" alt="" coords="180,283,247,304"/><area shape="rect" id="node8" href="usbhost_8h.html" title="usbhost.h" alt="" coords="181,213,237,235"/><area shape="rect" id="node9" href="usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="97,283,156,304"/><area shape="rect" id="node10" href="address_8h.html" title="address.h" alt="" coords="314,213,371,235"/><area shape="rect" id="node13" href="message_8h.html" title="message.h" alt="" coords="648,213,709,235"/><area shape="rect" id="node15" href="printhex_8h.html" title="printhex.h" alt="" coords="650,283,707,304"/><area shape="rect" id="node16" href="hexdump_8h.html" title="hexdump.h" alt="" coords="783,283,844,304"/><area shape="rect" id="node18" href="parsetools_8h.html" title="parsetools.h" alt="" coords="715,144,780,165"/></map>
</div>
</div><div class="textblock"><div class="dynheader">
This graph shows which files directly or indirectly include this file:</div>
@ -140,33 +140,35 @@ Macros</h2></td></tr>
<tr class="separator:ac2b910cd6cc87c7bac09617815a1ee9a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af3a7567dba1a0a7ed4272324d7684440"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_b_t_d_8h.html#af3a7567dba1a0a7ed4272324d7684440">HCI_RESET_STATE</a>&#160;&#160;&#160;1</td></tr>
<tr class="separator:af3a7567dba1a0a7ed4272324d7684440"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a86fd72d2518d27c02c15af635b55fc8f"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_b_t_d_8h.html#a86fd72d2518d27c02c15af635b55fc8f">HCI_BDADDR_STATE</a>&#160;&#160;&#160;2</td></tr>
<tr class="memitem:aa4e852587db5ad51c6c5cfb8e9d4f002"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_b_t_d_8h.html#aa4e852587db5ad51c6c5cfb8e9d4f002">HCI_CLASS_STATE</a>&#160;&#160;&#160;2</td></tr>
<tr class="separator:aa4e852587db5ad51c6c5cfb8e9d4f002"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a86fd72d2518d27c02c15af635b55fc8f"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_b_t_d_8h.html#a86fd72d2518d27c02c15af635b55fc8f">HCI_BDADDR_STATE</a>&#160;&#160;&#160;3</td></tr>
<tr class="separator:a86fd72d2518d27c02c15af635b55fc8f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8f1d666addd0c2bba7602fbd7a692228"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_b_t_d_8h.html#a8f1d666addd0c2bba7602fbd7a692228">HCI_LOCAL_VERSION_STATE</a>&#160;&#160;&#160;3</td></tr>
<tr class="memitem:a8f1d666addd0c2bba7602fbd7a692228"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_b_t_d_8h.html#a8f1d666addd0c2bba7602fbd7a692228">HCI_LOCAL_VERSION_STATE</a>&#160;&#160;&#160;4</td></tr>
<tr class="separator:a8f1d666addd0c2bba7602fbd7a692228"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1939cc2e06b3185be07a93c1ac7a10e1"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_b_t_d_8h.html#a1939cc2e06b3185be07a93c1ac7a10e1">HCI_SET_NAME_STATE</a>&#160;&#160;&#160;4</td></tr>
<tr class="memitem:a1939cc2e06b3185be07a93c1ac7a10e1"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_b_t_d_8h.html#a1939cc2e06b3185be07a93c1ac7a10e1">HCI_SET_NAME_STATE</a>&#160;&#160;&#160;5</td></tr>
<tr class="separator:a1939cc2e06b3185be07a93c1ac7a10e1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a36daee23c5d0f4276e6eb32f3fd79124"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_b_t_d_8h.html#a36daee23c5d0f4276e6eb32f3fd79124">HCI_CHECK_WII_SERVICE</a>&#160;&#160;&#160;5</td></tr>
<tr class="memitem:a36daee23c5d0f4276e6eb32f3fd79124"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_b_t_d_8h.html#a36daee23c5d0f4276e6eb32f3fd79124">HCI_CHECK_WII_SERVICE</a>&#160;&#160;&#160;6</td></tr>
<tr class="separator:a36daee23c5d0f4276e6eb32f3fd79124"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a09fa39bcefd3255f8ef762034e45679e"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_b_t_d_8h.html#a09fa39bcefd3255f8ef762034e45679e">HCI_INQUIRY_STATE</a>&#160;&#160;&#160;6</td></tr>
<tr class="memitem:a09fa39bcefd3255f8ef762034e45679e"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_b_t_d_8h.html#a09fa39bcefd3255f8ef762034e45679e">HCI_INQUIRY_STATE</a>&#160;&#160;&#160;7</td></tr>
<tr class="separator:a09fa39bcefd3255f8ef762034e45679e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2733141c8dae8cd14f78b11b21d58ebb"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_b_t_d_8h.html#a2733141c8dae8cd14f78b11b21d58ebb">HCI_CONNECT_WII_STATE</a>&#160;&#160;&#160;7</td></tr>
<tr class="memitem:a2733141c8dae8cd14f78b11b21d58ebb"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_b_t_d_8h.html#a2733141c8dae8cd14f78b11b21d58ebb">HCI_CONNECT_WII_STATE</a>&#160;&#160;&#160;8</td></tr>
<tr class="separator:a2733141c8dae8cd14f78b11b21d58ebb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad497b58476b921e620f05791fa864f04"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_b_t_d_8h.html#ad497b58476b921e620f05791fa864f04">HCI_CONNECTED_WII_STATE</a>&#160;&#160;&#160;8</td></tr>
<tr class="memitem:ad497b58476b921e620f05791fa864f04"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_b_t_d_8h.html#ad497b58476b921e620f05791fa864f04">HCI_CONNECTED_WII_STATE</a>&#160;&#160;&#160;9</td></tr>
<tr class="separator:ad497b58476b921e620f05791fa864f04"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acc9b6954b4bb6c19a9d25242869d5ddf"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_b_t_d_8h.html#acc9b6954b4bb6c19a9d25242869d5ddf">HCI_SCANNING_STATE</a>&#160;&#160;&#160;9</td></tr>
<tr class="memitem:acc9b6954b4bb6c19a9d25242869d5ddf"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_b_t_d_8h.html#acc9b6954b4bb6c19a9d25242869d5ddf">HCI_SCANNING_STATE</a>&#160;&#160;&#160;10</td></tr>
<tr class="separator:acc9b6954b4bb6c19a9d25242869d5ddf"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8bfcf6e1a0a044aba26d728fb0c6a17a"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_b_t_d_8h.html#a8bfcf6e1a0a044aba26d728fb0c6a17a">HCI_CONNECT_IN_STATE</a>&#160;&#160;&#160;10</td></tr>
<tr class="memitem:a8bfcf6e1a0a044aba26d728fb0c6a17a"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_b_t_d_8h.html#a8bfcf6e1a0a044aba26d728fb0c6a17a">HCI_CONNECT_IN_STATE</a>&#160;&#160;&#160;11</td></tr>
<tr class="separator:a8bfcf6e1a0a044aba26d728fb0c6a17a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4bad48092981dffe97edb052f5ae08bd"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_b_t_d_8h.html#a4bad48092981dffe97edb052f5ae08bd">HCI_REMOTE_NAME_STATE</a>&#160;&#160;&#160;11</td></tr>
<tr class="memitem:a4bad48092981dffe97edb052f5ae08bd"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_b_t_d_8h.html#a4bad48092981dffe97edb052f5ae08bd">HCI_REMOTE_NAME_STATE</a>&#160;&#160;&#160;12</td></tr>
<tr class="separator:a4bad48092981dffe97edb052f5ae08bd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae0a16d1cc0142186a20379b5c68bd1e0"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_b_t_d_8h.html#ae0a16d1cc0142186a20379b5c68bd1e0">HCI_CONNECTED_STATE</a>&#160;&#160;&#160;12</td></tr>
<tr class="memitem:ae0a16d1cc0142186a20379b5c68bd1e0"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_b_t_d_8h.html#ae0a16d1cc0142186a20379b5c68bd1e0">HCI_CONNECTED_STATE</a>&#160;&#160;&#160;13</td></tr>
<tr class="separator:ae0a16d1cc0142186a20379b5c68bd1e0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad3500c7116f1bb564011dac09a387a5c"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_b_t_d_8h.html#ad3500c7116f1bb564011dac09a387a5c">HCI_DISABLE_SCAN_STATE</a>&#160;&#160;&#160;13</td></tr>
<tr class="memitem:ad3500c7116f1bb564011dac09a387a5c"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_b_t_d_8h.html#ad3500c7116f1bb564011dac09a387a5c">HCI_DISABLE_SCAN_STATE</a>&#160;&#160;&#160;14</td></tr>
<tr class="separator:ad3500c7116f1bb564011dac09a387a5c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a20fc1ebfc3da8e048f6afe53330e6b8f"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_b_t_d_8h.html#a20fc1ebfc3da8e048f6afe53330e6b8f">HCI_DONE_STATE</a>&#160;&#160;&#160;14</td></tr>
<tr class="memitem:a20fc1ebfc3da8e048f6afe53330e6b8f"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_b_t_d_8h.html#a20fc1ebfc3da8e048f6afe53330e6b8f">HCI_DONE_STATE</a>&#160;&#160;&#160;15</td></tr>
<tr class="separator:a20fc1ebfc3da8e048f6afe53330e6b8f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a31398eae2e433d1b7b39ea3d6d07cdd0"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_b_t_d_8h.html#a31398eae2e433d1b7b39ea3d6d07cdd0">HCI_DISCONNECT_STATE</a>&#160;&#160;&#160;15</td></tr>
<tr class="memitem:a31398eae2e433d1b7b39ea3d6d07cdd0"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_b_t_d_8h.html#a31398eae2e433d1b7b39ea3d6d07cdd0">HCI_DISCONNECT_STATE</a>&#160;&#160;&#160;16</td></tr>
<tr class="separator:a31398eae2e433d1b7b39ea3d6d07cdd0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a14087b750ea2da7f0cef4daaa7683d01"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_b_t_d_8h.html#a14087b750ea2da7f0cef4daaa7683d01">HCI_FLAG_CMD_COMPLETE</a>&#160;&#160;&#160;0x01</td></tr>
<tr class="separator:a14087b750ea2da7f0cef4daaa7683d01"><td class="memSeparator" colspan="2">&#160;</td></tr>
@ -428,12 +430,12 @@ Macros</h2></td></tr>
</div>
</div>
<a class="anchor" id="a86fd72d2518d27c02c15af635b55fc8f"></a>
<a class="anchor" id="aa4e852587db5ad51c6c5cfb8e9d4f002"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define HCI_BDADDR_STATE&#160;&#160;&#160;2</td>
<td class="memname">#define HCI_CLASS_STATE&#160;&#160;&#160;2</td>
</tr>
</table>
</div><div class="memdoc">
@ -442,12 +444,12 @@ Macros</h2></td></tr>
</div>
</div>
<a class="anchor" id="a8f1d666addd0c2bba7602fbd7a692228"></a>
<a class="anchor" id="a86fd72d2518d27c02c15af635b55fc8f"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define HCI_LOCAL_VERSION_STATE&#160;&#160;&#160;3</td>
<td class="memname">#define HCI_BDADDR_STATE&#160;&#160;&#160;3</td>
</tr>
</table>
</div><div class="memdoc">
@ -456,12 +458,12 @@ Macros</h2></td></tr>
</div>
</div>
<a class="anchor" id="a1939cc2e06b3185be07a93c1ac7a10e1"></a>
<a class="anchor" id="a8f1d666addd0c2bba7602fbd7a692228"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define HCI_SET_NAME_STATE&#160;&#160;&#160;4</td>
<td class="memname">#define HCI_LOCAL_VERSION_STATE&#160;&#160;&#160;4</td>
</tr>
</table>
</div><div class="memdoc">
@ -470,18 +472,32 @@ Macros</h2></td></tr>
</div>
</div>
<a class="anchor" id="a36daee23c5d0f4276e6eb32f3fd79124"></a>
<a class="anchor" id="a1939cc2e06b3185be07a93c1ac7a10e1"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define HCI_CHECK_WII_SERVICE&#160;&#160;&#160;5</td>
<td class="memname">#define HCI_SET_NAME_STATE&#160;&#160;&#160;5</td>
</tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00045">45</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
<a class="anchor" id="a36daee23c5d0f4276e6eb32f3fd79124"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define HCI_CHECK_WII_SERVICE&#160;&#160;&#160;6</td>
</tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00046">46</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
<a class="anchor" id="a09fa39bcefd3255f8ef762034e45679e"></a>
@ -489,21 +505,7 @@ Macros</h2></td></tr>
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define HCI_INQUIRY_STATE&#160;&#160;&#160;6</td>
</tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00047">47</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
<a class="anchor" id="a2733141c8dae8cd14f78b11b21d58ebb"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define HCI_CONNECT_WII_STATE&#160;&#160;&#160;7</td>
<td class="memname">#define HCI_INQUIRY_STATE&#160;&#160;&#160;7</td>
</tr>
</table>
</div><div class="memdoc">
@ -512,18 +514,32 @@ Macros</h2></td></tr>
</div>
</div>
<a class="anchor" id="ad497b58476b921e620f05791fa864f04"></a>
<a class="anchor" id="a2733141c8dae8cd14f78b11b21d58ebb"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define HCI_CONNECTED_WII_STATE&#160;&#160;&#160;8</td>
<td class="memname">#define HCI_CONNECT_WII_STATE&#160;&#160;&#160;8</td>
</tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00049">49</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
<a class="anchor" id="ad497b58476b921e620f05791fa864f04"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define HCI_CONNECTED_WII_STATE&#160;&#160;&#160;9</td>
</tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00050">50</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
<a class="anchor" id="acc9b6954b4bb6c19a9d25242869d5ddf"></a>
@ -531,21 +547,7 @@ Macros</h2></td></tr>
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define HCI_SCANNING_STATE&#160;&#160;&#160;9</td>
</tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00051">51</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
<a class="anchor" id="a8bfcf6e1a0a044aba26d728fb0c6a17a"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define HCI_CONNECT_IN_STATE&#160;&#160;&#160;10</td>
<td class="memname">#define HCI_SCANNING_STATE&#160;&#160;&#160;10</td>
</tr>
</table>
</div><div class="memdoc">
@ -554,12 +556,12 @@ Macros</h2></td></tr>
</div>
</div>
<a class="anchor" id="a4bad48092981dffe97edb052f5ae08bd"></a>
<a class="anchor" id="a8bfcf6e1a0a044aba26d728fb0c6a17a"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define HCI_REMOTE_NAME_STATE&#160;&#160;&#160;11</td>
<td class="memname">#define HCI_CONNECT_IN_STATE&#160;&#160;&#160;11</td>
</tr>
</table>
</div><div class="memdoc">
@ -568,12 +570,12 @@ Macros</h2></td></tr>
</div>
</div>
<a class="anchor" id="ae0a16d1cc0142186a20379b5c68bd1e0"></a>
<a class="anchor" id="a4bad48092981dffe97edb052f5ae08bd"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define HCI_CONNECTED_STATE&#160;&#160;&#160;12</td>
<td class="memname">#define HCI_REMOTE_NAME_STATE&#160;&#160;&#160;12</td>
</tr>
</table>
</div><div class="memdoc">
@ -582,12 +584,12 @@ Macros</h2></td></tr>
</div>
</div>
<a class="anchor" id="ad3500c7116f1bb564011dac09a387a5c"></a>
<a class="anchor" id="ae0a16d1cc0142186a20379b5c68bd1e0"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define HCI_DISABLE_SCAN_STATE&#160;&#160;&#160;13</td>
<td class="memname">#define HCI_CONNECTED_STATE&#160;&#160;&#160;13</td>
</tr>
</table>
</div><div class="memdoc">
@ -596,12 +598,12 @@ Macros</h2></td></tr>
</div>
</div>
<a class="anchor" id="a20fc1ebfc3da8e048f6afe53330e6b8f"></a>
<a class="anchor" id="ad3500c7116f1bb564011dac09a387a5c"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define HCI_DONE_STATE&#160;&#160;&#160;14</td>
<td class="memname">#define HCI_DISABLE_SCAN_STATE&#160;&#160;&#160;14</td>
</tr>
</table>
</div><div class="memdoc">
@ -610,18 +612,32 @@ Macros</h2></td></tr>
</div>
</div>
<a class="anchor" id="a31398eae2e433d1b7b39ea3d6d07cdd0"></a>
<a class="anchor" id="a20fc1ebfc3da8e048f6afe53330e6b8f"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define HCI_DISCONNECT_STATE&#160;&#160;&#160;15</td>
<td class="memname">#define HCI_DONE_STATE&#160;&#160;&#160;15</td>
</tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00057">57</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
<a class="anchor" id="a31398eae2e433d1b7b39ea3d6d07cdd0"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define HCI_DISCONNECT_STATE&#160;&#160;&#160;16</td>
</tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00058">58</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
<a class="anchor" id="a14087b750ea2da7f0cef4daaa7683d01"></a>
@ -634,7 +650,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00060">60</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00061">61</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -648,7 +664,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00061">61</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00062">62</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -662,7 +678,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00062">62</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00063">63</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -676,7 +692,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00063">63</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00064">64</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -690,7 +706,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00064">64</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00065">65</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -704,7 +720,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00065">65</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00066">66</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -718,7 +734,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00066">66</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00067">67</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -732,7 +748,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00067">67</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00068">68</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -746,7 +762,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00068">68</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00069">69</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -760,7 +776,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00071">71</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00072">72</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -774,7 +790,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00072">72</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00073">73</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -788,7 +804,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00073">73</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00074">74</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -802,7 +818,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00074">74</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00075">75</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -816,7 +832,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00075">75</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00076">76</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -830,7 +846,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00076">76</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00077">77</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -844,7 +860,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00077">77</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00078">78</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -858,7 +874,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00078">78</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00079">79</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -872,7 +888,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00079">79</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00080">80</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -886,7 +902,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00082">82</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00083">83</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -900,7 +916,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00083">83</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00084">84</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -914,7 +930,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00084">84</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00085">85</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -928,7 +944,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00085">85</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00086">86</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -942,7 +958,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00086">86</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00087">87</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -956,7 +972,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00087">87</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00088">88</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -970,7 +986,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00088">88</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00089">89</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -984,7 +1000,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00089">89</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00090">90</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -998,7 +1014,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00090">90</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00091">91</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -1012,7 +1028,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00091">91</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00092">92</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -1026,7 +1042,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00092">92</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00093">93</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -1040,7 +1056,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00093">93</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00094">94</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -1054,7 +1070,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00094">94</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00095">95</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -1068,7 +1084,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00095">95</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00096">96</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -1082,7 +1098,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00096">96</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00097">97</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -1096,7 +1112,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00097">97</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00098">98</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -1110,7 +1126,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00098">98</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00099">99</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -1124,7 +1140,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00099">99</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00100">100</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -1138,7 +1154,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00100">100</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00101">101</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -1152,7 +1168,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00101">101</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00102">102</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -1166,7 +1182,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00102">102</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00103">103</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -1180,7 +1196,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00103">103</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00104">104</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -1194,7 +1210,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00106">106</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00107">107</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -1208,7 +1224,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00107">107</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00108">108</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -1222,7 +1238,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00108">108</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00109">109</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -1236,7 +1252,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00109">109</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00110">110</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -1250,7 +1266,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00110">110</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00111">111</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -1264,7 +1280,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00111">111</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00112">112</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -1278,7 +1294,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00112">112</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00113">113</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -1292,7 +1308,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00113">113</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00114">114</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -1306,7 +1322,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00114">114</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00115">115</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -1320,7 +1336,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00117">117</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00118">118</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -1334,7 +1350,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00118">118</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00119">119</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -1348,7 +1364,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00121">121</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00122">122</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -1362,7 +1378,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00122">122</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00123">123</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -1376,7 +1392,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00123">123</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00124">124</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -1390,7 +1406,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00124">124</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00125">125</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -1404,7 +1420,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00127">127</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00128">128</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -1418,7 +1434,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00128">128</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00129">129</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -1432,7 +1448,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00130">130</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00131">131</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>
@ -1446,7 +1462,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00131">131</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
<p>Definition at line <a class="el" href="_b_t_d_8h_source.html#l00132">132</a> of file <a class="el" href="_b_t_d_8h_source.html">BTD.h</a>.</p>
</div>
</div>

View file

@ -1,13 +1,13 @@
<map id="BTD.h" name="BTD.h">
<area shape="rect" id="node2" href="$_usb_8h.html" title="Usb.h" alt="" coords="342,75,385,96"/>
<area shape="rect" id="node17" href="$confdescparser_8h.html" title="confdescparser.h" alt="" coords="708,75,791,96"/>
<area shape="rect" id="node5" href="$avrpins_8h.html" title="avrpins.h" alt="" coords="251,213,305,235"/>
<area shape="rect" id="node7" href="$max3421e_8h.html" title="max3421e.h" alt="" coords="159,213,226,235"/>
<area shape="rect" id="node8" href="$usbhost_8h.html" title="usbhost.h" alt="" coords="175,144,231,165"/>
<area shape="rect" id="node9" href="$usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="349,213,407,235"/>
<area shape="rect" id="node10" href="$address_8h.html" title="address.h" alt="" coords="41,144,98,165"/>
<area shape="rect" id="node13" href="$printhex_8h.html" title="printhex.h" alt="" coords="721,283,778,304"/>
<area shape="rect" id="node14" href="$hexdump_8h.html" title="hexdump.h" alt="" coords="634,213,695,235"/>
<area shape="rect" id="node16" href="$message_8h.html" title="message.h" alt="" coords="719,213,781,235"/>
<area shape="rect" id="node18" href="$parsetools_8h.html" title="parsetools.h" alt="" coords="788,144,853,165"/>
<area shape="rect" id="node2" href="$_usb_8h.html" title="Usb.h" alt="" coords="288,144,331,165"/>
<area shape="rect" id="node17" href="$confdescparser_8h.html" title="confdescparser.h" alt="" coords="635,75,719,96"/>
<area shape="rect" id="node5" href="$avrpins_8h.html" title="avrpins.h" alt="" coords="5,283,59,304"/>
<area shape="rect" id="node7" href="$max3421e_8h.html" title="max3421e.h" alt="" coords="180,283,247,304"/>
<area shape="rect" id="node8" href="$usbhost_8h.html" title="usbhost.h" alt="" coords="181,213,237,235"/>
<area shape="rect" id="node9" href="$usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="97,283,156,304"/>
<area shape="rect" id="node10" href="$address_8h.html" title="address.h" alt="" coords="314,213,371,235"/>
<area shape="rect" id="node13" href="$message_8h.html" title="message.h" alt="" coords="648,213,709,235"/>
<area shape="rect" id="node15" href="$printhex_8h.html" title="printhex.h" alt="" coords="650,283,707,304"/>
<area shape="rect" id="node16" href="$hexdump_8h.html" title="hexdump.h" alt="" coords="783,283,844,304"/>
<area shape="rect" id="node18" href="$parsetools_8h.html" title="parsetools.h" alt="" coords="715,144,780,165"/>
</map>

View file

@ -1 +1 @@
d5246ce0a8a4e939f1aa896a4906769a
5127aae891f6acd678ae45f8beb12100

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 73 KiB

View file

@ -130,219 +130,235 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span>&#160;<span class="comment">/* Bluetooth HCI states for hci_task() */</span></div>
<div class="line"><a name="l00040"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#ac2b910cd6cc87c7bac09617815a1ee9a"> 40</a></span>&#160;<span class="preprocessor">#define HCI_INIT_STATE 0</span></div>
<div class="line"><a name="l00041"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#af3a7567dba1a0a7ed4272324d7684440"> 41</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define HCI_RESET_STATE 1</span></div>
<div class="line"><a name="l00042"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a86fd72d2518d27c02c15af635b55fc8f"> 42</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define HCI_BDADDR_STATE 2</span></div>
<div class="line"><a name="l00043"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a8f1d666addd0c2bba7602fbd7a692228"> 43</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define HCI_LOCAL_VERSION_STATE 3</span></div>
<div class="line"><a name="l00044"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a1939cc2e06b3185be07a93c1ac7a10e1"> 44</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define HCI_SET_NAME_STATE 4</span></div>
<div class="line"><a name="l00045"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a36daee23c5d0f4276e6eb32f3fd79124"> 45</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define HCI_CHECK_WII_SERVICE 5</span></div>
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00047"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a09fa39bcefd3255f8ef762034e45679e"> 47</a></span>&#160;<span class="preprocessor">#define HCI_INQUIRY_STATE 6 // These three states are only used if it should pair and connect to a Wii controller</span></div>
<div class="line"><a name="l00048"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a2733141c8dae8cd14f78b11b21d58ebb"> 48</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define HCI_CONNECT_WII_STATE 7</span></div>
<div class="line"><a name="l00049"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#ad497b58476b921e620f05791fa864f04"> 49</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define HCI_CONNECTED_WII_STATE 8</span></div>
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00051"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#acc9b6954b4bb6c19a9d25242869d5ddf"> 51</a></span>&#160;<span class="preprocessor">#define HCI_SCANNING_STATE 9</span></div>
<div class="line"><a name="l00052"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a8bfcf6e1a0a044aba26d728fb0c6a17a"> 52</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define HCI_CONNECT_IN_STATE 10</span></div>
<div class="line"><a name="l00053"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a4bad48092981dffe97edb052f5ae08bd"> 53</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define HCI_REMOTE_NAME_STATE 11</span></div>
<div class="line"><a name="l00054"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#ae0a16d1cc0142186a20379b5c68bd1e0"> 54</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define HCI_CONNECTED_STATE 12</span></div>
<div class="line"><a name="l00055"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#ad3500c7116f1bb564011dac09a387a5c"> 55</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define HCI_DISABLE_SCAN_STATE 13</span></div>
<div class="line"><a name="l00056"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a20fc1ebfc3da8e048f6afe53330e6b8f"> 56</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define HCI_DONE_STATE 14</span></div>
<div class="line"><a name="l00057"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a31398eae2e433d1b7b39ea3d6d07cdd0"> 57</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define HCI_DISCONNECT_STATE 15</span></div>
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span>&#160;<span class="comment">/* HCI event flags*/</span></div>
<div class="line"><a name="l00060"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a14087b750ea2da7f0cef4daaa7683d01"> 60</a></span>&#160;<span class="preprocessor">#define HCI_FLAG_CMD_COMPLETE 0x01</span></div>
<div class="line"><a name="l00061"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#aa05458d2a47122cd62cd0748c7e1e313"> 61</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define HCI_FLAG_CONN_COMPLETE 0x02</span></div>
<div class="line"><a name="l00062"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#aec17e7d699b1023a0b6f675feddd7d58"> 62</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define HCI_FLAG_DISCONN_COMPLETE 0x04</span></div>
<div class="line"><a name="l00063"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a400af4b61f6e94ab821fa368d8bf2b07"> 63</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define HCI_FLAG_REMOTE_NAME_COMPLETE 0x08</span></div>
<div class="line"><a name="l00064"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a0e8a8ce5838e265c1732795bf8822043"> 64</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define HCI_FLAG_INCOMING_REQUEST 0x10</span></div>
<div class="line"><a name="l00065"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#aabbf8a2ed694a2dc4d4e60fd389c44dd"> 65</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define HCI_FLAG_READ_BDADDR 0x20</span></div>
<div class="line"><a name="l00066"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#ab3b1f616c1e885e697806f0167b73e8e"> 66</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define HCI_FLAG_READ_VERSION 0x40</span></div>
<div class="line"><a name="l00067"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#aa991873698787cf45d26efaa370f34e2"> 67</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define HCI_FLAG_WII_FOUND 0x80</span></div>
<div class="line"><a name="l00068"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#ad14762241e9195fc9a3b0a69ef1ab7f3"> 68</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define HCI_FLAG_CONNECT_EVENT 0x100</span></div>
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>&#160;<span class="comment">/*Macros for HCI event flag tests */</span></div>
<div class="line"><a name="l00071"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a9cc765dd92016efe6eaeff535a5193c1"> 71</a></span>&#160;<span class="preprocessor">#define hci_cmd_complete (hci_event_flag &amp; HCI_FLAG_CMD_COMPLETE)</span></div>
<div class="line"><a name="l00072"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#ae43eba7b19fa5c92de5344819b99ec61"> 72</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define hci_connect_complete (hci_event_flag &amp; HCI_FLAG_CONN_COMPLETE)</span></div>
<div class="line"><a name="l00073"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#ae67c9cc739a52a8f4a3c28871a07bf1b"> 73</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define hci_disconnect_complete (hci_event_flag &amp; HCI_FLAG_DISCONN_COMPLETE)</span></div>
<div class="line"><a name="l00074"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a8f97f22fe3bc827916b8adb724b64a7f"> 74</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define hci_remote_name_complete (hci_event_flag &amp; HCI_FLAG_REMOTE_NAME_COMPLETE)</span></div>
<div class="line"><a name="l00075"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#aeb3a24db49f8158f85b928385e28d83a"> 75</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define hci_incoming_connect_request (hci_event_flag &amp; HCI_FLAG_INCOMING_REQUEST)</span></div>
<div class="line"><a name="l00076"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#afc5a7e103eb1301c12aa35af25cc8293"> 76</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define hci_read_bdaddr_complete (hci_event_flag &amp; HCI_FLAG_READ_BDADDR)</span></div>
<div class="line"><a name="l00077"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#ad205c180970335a666dfe5081b55ade4"> 77</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define hci_read_version_complete (hci_event_flag &amp; HCI_FLAG_READ_VERSION)</span></div>
<div class="line"><a name="l00078"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#aa12b77df715652f4735cb6620cd595a4"> 78</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define hci_wii_found (hci_event_flag &amp; HCI_FLAG_WII_FOUND)</span></div>
<div class="line"><a name="l00079"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a11ae66a6caad9105b8e7658189dcfa7b"> 79</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define hci_connect_event (hci_event_flag &amp; HCI_FLAG_CONNECT_EVENT)</span></div>
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span>&#160;<span class="comment">/* HCI Events managed */</span></div>
<div class="line"><a name="l00082"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a4c6ca5696adeab36258b3b0c58d804e0"> 82</a></span>&#160;<span class="preprocessor">#define EV_INQUIRY_COMPLETE 0x01</span></div>
<div class="line"><a name="l00083"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a335df6d48c8cac828d62196eeaff360b"> 83</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define EV_INQUIRY_RESULT 0x02</span></div>
<div class="line"><a name="l00084"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#ad4bce42e1ef20447655f8916f23d07a7"> 84</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define EV_CONNECT_COMPLETE 0x03</span></div>
<div class="line"><a name="l00085"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#af6c5584636f8958689f5cd67290254e1"> 85</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define EV_INCOMING_CONNECT 0x04</span></div>
<div class="line"><a name="l00086"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a1cf7e4d4426dcabed8976b65beee0d99"> 86</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define EV_DISCONNECT_COMPLETE 0x05</span></div>
<div class="line"><a name="l00087"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a68b8f78a0e0da80434afb1e6d40eacf4"> 87</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define EV_AUTHENTICATION_COMPLETE 0x06</span></div>
<div class="line"><a name="l00088"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a29c1744f72f3cd85865c8173eace5a36"> 88</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define EV_REMOTE_NAME_COMPLETE 0x07</span></div>
<div class="line"><a name="l00089"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#aa0bf5ac66c412d3415dbb753630d0e58"> 89</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define EV_ENCRYPTION_CHANGE 0x08</span></div>
<div class="line"><a name="l00090"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a3e107e9d07793ca5cfaeea8b2181d4a4"> 90</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define EV_CHANGE_CONNECTION_LINK 0x09</span></div>
<div class="line"><a name="l00091"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#ac61db50de3007a22e19e660bd7e68e69"> 91</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define EV_ROLE_CHANGED 0x12</span></div>
<div class="line"><a name="l00092"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a0987119cfc40f3011a2cec69686034df"> 92</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define EV_NUM_COMPLETE_PKT 0x13</span></div>
<div class="line"><a name="l00093"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a935633384e87daa14b60549134014ec4"> 93</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define EV_PIN_CODE_REQUEST 0x16</span></div>
<div class="line"><a name="l00094"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a8c77c922bb61301760ebf5af5f1cc7f0"> 94</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define EV_LINK_KEY_REQUEST 0x17</span></div>
<div class="line"><a name="l00095"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a8c662496af1164370e5fdf7149ecd842"> 95</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define EV_LINK_KEY_NOTIFICATION 0x18</span></div>
<div class="line"><a name="l00096"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a6f8b4cf8546d9928a34c9c681dc5a6d5"> 96</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define EV_DATA_BUFFER_OVERFLOW 0x1A</span></div>
<div class="line"><a name="l00097"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a2ad6543cdfe06cbf0924c287c08f36d7"> 97</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define EV_MAX_SLOTS_CHANGE 0x1B</span></div>
<div class="line"><a name="l00098"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a830b2a3bcb09c4802910e8b05531d317"> 98</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define EV_READ_REMOTE_VERSION_INFORMATION_COMPLETE 0x0C</span></div>
<div class="line"><a name="l00099"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a1b58792b76e0f216df8160bf055032c3"> 99</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define EV_QOS_SETUP_COMPLETE 0x0D</span></div>
<div class="line"><a name="l00100"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a81b71e0ba648260143529b04ae84e528"> 100</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define EV_COMMAND_COMPLETE 0x0E</span></div>
<div class="line"><a name="l00101"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a090ee10cc1a1c1c3bbb29a93c330d2d4"> 101</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define EV_COMMAND_STATUS 0x0F</span></div>
<div class="line"><a name="l00102"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#acd5f65703cc34b112a1f656d9a49551b"> 102</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define EV_LOOPBACK_COMMAND 0x19</span></div>
<div class="line"><a name="l00103"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#ad8481acc0b144d97017f8a06d63ff47c"> 103</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define EV_PAGE_SCAN_REP_MODE 0x20</span></div>
<div class="line"><a name="l00104"></a><span class="lineno"> 104</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00105"></a><span class="lineno"> 105</span>&#160;<span class="comment">/* L2CAP signaling commands */</span></div>
<div class="line"><a name="l00106"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a6ffcd72787c86f248192eb06a3fe18cb"> 106</a></span>&#160;<span class="preprocessor">#define L2CAP_CMD_COMMAND_REJECT 0x01</span></div>
<div class="line"><a name="l00107"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#ac4bae0c65fd00ed849cb226302d19c85"> 107</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define L2CAP_CMD_CONNECTION_REQUEST 0x02</span></div>
<div class="line"><a name="l00108"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#aef7b306479de265d725dbe5816a8227b"> 108</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define L2CAP_CMD_CONNECTION_RESPONSE 0x03</span></div>
<div class="line"><a name="l00109"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a48bcd73461d736d0ef889e1fe6e36f69"> 109</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define L2CAP_CMD_CONFIG_REQUEST 0x04</span></div>
<div class="line"><a name="l00110"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a8151b1fe5d940a5a7a34f43a8b8ce434"> 110</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define L2CAP_CMD_CONFIG_RESPONSE 0x05</span></div>
<div class="line"><a name="l00111"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a398676a2e9a2351a5a52afdddf4b660b"> 111</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define L2CAP_CMD_DISCONNECT_REQUEST 0x06</span></div>
<div class="line"><a name="l00112"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a4c64a41200714e457b397496183dc0e4"> 112</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define L2CAP_CMD_DISCONNECT_RESPONSE 0x07</span></div>
<div class="line"><a name="l00113"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a200eb6c7c905ec74a9daf0f262af0448"> 113</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define L2CAP_CMD_INFORMATION_REQUEST 0x0A</span></div>
<div class="line"><a name="l00114"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#af32d4c53927d596a8727ff232310dec1"> 114</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define L2CAP_CMD_INFORMATION_RESPONSE 0x0B</span></div>
<div class="line"><a name="l00115"></a><span class="lineno"> 115</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00116"></a><span class="lineno"> 116</span>&#160;<span class="comment">// Used For Connection Response - Remember to Include High Byte</span></div>
<div class="line"><a name="l00117"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a9960d0d5ae92fc92c70bbb84c2a5c0cc"> 117</a></span>&#160;<span class="preprocessor">#define PENDING 0x01</span></div>
<div class="line"><a name="l00118"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a1be7a56cdddcdb7dedf16d4dee381e93"> 118</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define SUCCESSFUL 0x00</span></div>
<div class="line"><a name="l00119"></a><span class="lineno"> 119</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00120"></a><span class="lineno"> 120</span>&#160;<span class="comment">/* Bluetooth L2CAP PSM - see http://www.bluetooth.org/Technical/AssignedNumbers/logical_link.htm */</span></div>
<div class="line"><a name="l00121"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a25ce859d7ee2730e1d22d11c051ed60d"> 121</a></span>&#160;<span class="preprocessor">#define SDP_PSM 0x01 // Service Discovery Protocol PSM Value</span></div>
<div class="line"><a name="l00122"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a2924020f2e7e82fe956574538e2bc3eb"> 122</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define RFCOMM_PSM 0x03 // RFCOMM PSM Value</span></div>
<div class="line"><a name="l00123"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a1465673868452307bcdab8e201430c27"> 123</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define HID_CTRL_PSM 0x11 // HID_Control PSM Value</span></div>
<div class="line"><a name="l00124"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a4c5ac96db74d61d4a5a5d945a400e7da"> 124</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define HID_INTR_PSM 0x13 // HID_Interrupt PSM Value</span></div>
<div class="line"><a name="l00125"></a><span class="lineno"> 125</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span>&#160;<span class="comment">// Used to determine if it is a Bluetooth dongle</span></div>
<div class="line"><a name="l00127"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a177fe269ddb7979d99b76d52bc281551"> 127</a></span>&#160;<span class="preprocessor">#define WI_SUBCLASS_RF 0x01 // RF Controller</span></div>
<div class="line"><a name="l00128"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a05903a9351c5ced6b8be27b2869e62af"> 128</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define WI_PROTOCOL_BT 0x01 // Bluetooth Programming Interface</span></div>
<div class="line"><a name="l00129"></a><span class="lineno"> 129</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00130"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#aee41c4878894db24e7ad8cd6246595cd"> 130</a></span>&#160;<span class="preprocessor">#define BTD_MAX_ENDPOINTS 4</span></div>
<div class="line"><a name="l00131"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a2222709eed4c8af293e881ea36f599b0"> 131</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define BTD_NUMSERVICES 4 // Max number of Bluetooth services</span></div>
<div class="line"><a name="l00132"></a><span class="lineno"> 132</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00134"></a><span class="lineno"><a class="code" href="class_bluetooth_service.html"> 134</a></span>&#160;<span class="keyword">class </span><a class="code" href="class_bluetooth_service.html">BluetoothService</a> {</div>
<div class="line"><a name="l00135"></a><span class="lineno"> 135</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00140"></a><span class="lineno"> 140</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_bluetooth_service.html#a8dc98310fe481357eaa86c53e49af113">ACLData</a>(uint8_t* <a class="code" href="class_bluetooth_service.html#a8dc98310fe481357eaa86c53e49af113">ACLData</a>);</div>
<div class="line"><a name="l00142"></a><span class="lineno"> 142</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_bluetooth_service.html#a680692ff13cb37eb81ddbb74bc9e0383">Run</a>();</div>
<div class="line"><a name="l00144"></a><span class="lineno"> 144</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_bluetooth_service.html#a1dff7caf251f1d8a5f358b368445cb48">Reset</a>();</div>
<div class="line"><a name="l00146"></a><span class="lineno"> 146</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_bluetooth_service.html#a66ee2f09c6087b82e3920c3d652a99b2">disconnect</a>();</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="l00153"></a><span class="lineno"><a class="code" href="class_b_t_d.html"> 153</a></span>&#160;<span class="keyword">class </span><a class="code" href="class_b_t_d.html">BTD</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="l00154"></a><span class="lineno"> 154</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00159"></a><span class="lineno"> 159</span>&#160; <a class="code" href="class_b_t_d.html#a5f07597fe15a2b917cce405fe87f2981">BTD</a>(<a class="code" href="class_u_s_b.html">USB</a> *p);</div>
<div class="line"><a name="l00160"></a><span class="lineno"> 160</span>&#160; </div>
<div class="line"><a name="l00169"></a><span class="lineno"> 169</span>&#160; <span class="keyword">virtual</span> uint8_t <a class="code" href="class_b_t_d.html#a48608619d8253972dd132edbb3001c5f">Init</a>(uint8_t parent, uint8_t port, <span class="keywordtype">bool</span> lowspeed);</div>
<div class="line"><a name="l00174"></a><span class="lineno"> 174</span>&#160; <span class="keyword">virtual</span> uint8_t <a class="code" href="class_b_t_d.html#aa87c23bce56a20f2db47c6a40c8eda87">Release</a>();</div>
<div class="line"><a name="l00179"></a><span class="lineno"> 179</span>&#160; <span class="keyword">virtual</span> uint8_t <a class="code" href="class_b_t_d.html#a76e201c5b561e3a6d0405894ba5c2e41">Poll</a>();</div>
<div class="line"><a name="l00184"></a><span class="lineno"><a class="code" href="class_b_t_d.html#aecdd9d00fc9c12bb3677ed213a6687c3"> 184</a></span>&#160; <span class="keyword">virtual</span> uint8_t <a class="code" href="class_b_t_d.html#aecdd9d00fc9c12bb3677ed213a6687c3">GetAddress</a>() { <span class="keywordflow">return</span> <a class="code" href="class_b_t_d.html#a58f78a9a28db81858dcc34a32a2ec82c">bAddress</a>; };</div>
<div class="line"><a name="l00189"></a><span class="lineno"><a class="code" href="class_b_t_d.html#a1b2440748bdaaeb552a05b0f0902f5d8"> 189</a></span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="class_b_t_d.html#a1b2440748bdaaeb552a05b0f0902f5d8">isReady</a>() { <span class="keywordflow">return</span> bPollEnable; };</div>
<div class="line"><a name="l00201"></a><span class="lineno"> 201</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#a23928cd0e5711a2433aec763cfa55773">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="l00205"></a><span class="lineno"><a class="code" href="class_b_t_d.html#a610183f9ddf04155ef2612d1839af7da"> 205</a></span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#a610183f9ddf04155ef2612d1839af7da">disconnect</a>() {</div>
<div class="line"><a name="l00206"></a><span class="lineno"> 206</span>&#160; <span class="keywordflow">for</span> (uint8_t i=0; i&lt;<a class="code" href="_b_t_d_8h.html#a2222709eed4c8af293e881ea36f599b0">BTD_NUMSERVICES</a>; i++)</div>
<div class="line"><a name="l00207"></a><span class="lineno"> 207</span>&#160; <span class="keywordflow">if</span> (btService[i])</div>
<div class="line"><a name="l00208"></a><span class="lineno"> 208</span>&#160; btService[i]-&gt;<a class="code" href="class_bluetooth_service.html#a66ee2f09c6087b82e3920c3d652a99b2">disconnect</a>();</div>
<div class="line"><a name="l00209"></a><span class="lineno"> 209</span>&#160; };</div>
<div class="line"><a name="l00215"></a><span class="lineno"><a class="code" href="class_b_t_d.html#a4adfc7e51ad3b3c03e7c37d1af159e73"> 215</a></span>&#160; int8_t <a class="code" href="class_b_t_d.html#a4adfc7e51ad3b3c03e7c37d1af159e73">registerServiceClass</a>(<a class="code" href="class_bluetooth_service.html">BluetoothService</a> *pService) {</div>
<div class="line"><a name="l00216"></a><span class="lineno"> 216</span>&#160; <span class="keywordflow">for</span> (uint8_t i=0; i&lt;<a class="code" href="_b_t_d_8h.html#a2222709eed4c8af293e881ea36f599b0">BTD_NUMSERVICES</a>; i++) {</div>
<div class="line"><a name="l00217"></a><span class="lineno"> 217</span>&#160; <span class="keywordflow">if</span> (!btService[i]) {</div>
<div class="line"><a name="l00218"></a><span class="lineno"> 218</span>&#160; btService[i] = pService;</div>
<div class="line"><a name="l00219"></a><span class="lineno"> 219</span>&#160; <span class="keywordflow">return</span> i; <span class="comment">// Return ID</span></div>
<div class="line"><a name="l00220"></a><span class="lineno"> 220</span>&#160; }</div>
<div class="line"><a name="l00221"></a><span class="lineno"> 221</span>&#160; }</div>
<div class="line"><a name="l00222"></a><span class="lineno"> 222</span>&#160; <span class="keywordflow">return</span> -1; <span class="comment">// ErrorregisterServiceClass</span></div>
<div class="line"><a name="l00223"></a><span class="lineno"> 223</span>&#160; };</div>
<div class="line"><a name="l00224"></a><span class="lineno"> 224</span>&#160; </div>
<div class="line"><a name="l00231"></a><span class="lineno"> 231</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#af11ad71d20783d46fe42dd405d10dfda">HCI_Command</a>(uint8_t* data, uint16_t nbytes);</div>
<div class="line"><a name="l00233"></a><span class="lineno"> 233</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#ae6f942eabd29257bc4896e5f263275b6">hci_reset</a>();</div>
<div class="line"><a name="l00235"></a><span class="lineno"> 235</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#acb94a629477d85cebd16a9c5ecd4a8b3">hci_read_bdaddr</a>();</div>
<div class="line"><a name="l00237"></a><span class="lineno"> 237</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#ae2ba215b6942f4131e4c5fdef2771e22">hci_read_local_version_information</a>();</div>
<div class="line"><a name="l00242"></a><span class="lineno"> 242</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#a9a6747d58951f53389922d80e25b886c">hci_set_local_name</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* name);</div>
<div class="line"><a name="l00244"></a><span class="lineno"> 244</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#a7dd7faaec1d3d9a1d8159cc2a4190977">hci_write_scan_enable</a>();</div>
<div class="line"><a name="l00246"></a><span class="lineno"> 246</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#aff59ab45d917406141ae0c9c79047f08">hci_write_scan_disable</a>();</div>
<div class="line"><a name="l00248"></a><span class="lineno"> 248</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#a8767529bd203c549348a38ac9c6682b3">hci_remote_name</a>();</div>
<div class="line"><a name="l00250"></a><span class="lineno"> 250</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#a1cb07a155c69bb1fcf45ae030b8947ec">hci_accept_connection</a>();</div>
<div class="line"><a name="l00255"></a><span class="lineno"> 255</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#a1bea5dd793a2f47006b4a7642efc9e56">hci_disconnect</a>(uint16_t handle);</div>
<div class="line"><a name="l00261"></a><span class="lineno"> 261</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#a70047b0f624c3f0ef29f8b76b8a34938">hci_pin_code_request_reply</a>();</div>
<div class="line"><a name="l00263"></a><span class="lineno"> 263</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#a7114d2cb62aa413e5ecb25c45c76832b">hci_pin_code_negative_request_reply</a>();</div>
<div class="line"><a name="l00268"></a><span class="lineno"> 268</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#af4d28b9c1a3b9688a1871610caee2cfc">hci_link_key_request_negative_reply</a>();</div>
<div class="line"><a name="l00270"></a><span class="lineno"> 270</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#addd07c18c725a324a05792a83026d36d">hci_authentication_request</a>();</div>
<div class="line"><a name="l00272"></a><span class="lineno"> 272</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#a678f2c995553ce6a9f48f9b59f2f1555">hci_inquiry</a>();</div>
<div class="line"><a name="l00274"></a><span class="lineno"> 274</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#a45ffbc7a40bbb763b0ece907c3dfc9ff">hci_inquiry_cancel</a>();</div>
<div class="line"><a name="l00276"></a><span class="lineno"> 276</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#ae7066ea743f8907708db945ebef3ad76">hci_connect</a>();</div>
<div class="line"><a name="l00288"></a><span class="lineno"> 288</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#aad7d8ef46e60b48ff4aaabefb0b290e7">L2CAP_Command</a>(uint16_t handle, uint8_t* data, uint8_t nbytes, uint8_t channelLow = 0x01, uint8_t channelHigh = 0x00);</div>
<div class="line"><a name="l00296"></a><span class="lineno"> 296</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#a55cf412a2053972a353b1ab964ca9d3e">l2cap_connection_request</a>(uint16_t handle, uint8_t rxid, uint8_t* scid, uint16_t psm);</div>
<div class="line"><a name="l00305"></a><span class="lineno"> 305</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#a7d34c62b1d561679dea5cd27356b38a7">l2cap_connection_response</a>(uint16_t handle, uint8_t rxid, uint8_t* dcid, uint8_t* scid, uint8_t result);</div>
<div class="line"><a name="l00312"></a><span class="lineno"> 312</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#ab646a59311344966f139bb3b78f30233">l2cap_config_request</a>(uint16_t handle, uint8_t rxid, uint8_t* dcid);</div>
<div class="line"><a name="l00319"></a><span class="lineno"> 319</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#a792ac4529b65235698ecf3d37982c05e">l2cap_config_response</a>(uint16_t handle, uint8_t rxid, uint8_t* scid);</div>
<div class="line"><a name="l00327"></a><span class="lineno"> 327</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#ac7053ef7ac690be3afbbdd985b163f10">l2cap_disconnection_request</a>(uint16_t handle, uint8_t rxid, uint8_t* dcid, uint8_t* scid);</div>
<div class="line"><a name="l00335"></a><span class="lineno"> 335</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#a29d176d9194e5c92fbe54791fc245407">l2cap_disconnection_response</a>(uint16_t handle, uint8_t rxid, uint8_t* dcid, uint8_t* scid);</div>
<div class="line"><a name="l00342"></a><span class="lineno"> 342</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#a91f61915c503fe7b861c88f5b3e6733c">l2cap_information_response</a>(uint16_t handle, uint8_t rxid, uint8_t infoTypeLow, uint8_t infoTypeHigh);</div>
<div class="line"><a name="l00346"></a><span class="lineno"><a class="code" href="class_b_t_d.html#aa7735da01865bab01b569ee836173737"> 346</a></span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_b_t_d.html#aa7735da01865bab01b569ee836173737">watingForConnection</a>;</div>
<div class="line"><a name="l00348"></a><span class="lineno"><a class="code" href="class_b_t_d.html#a0f1c28a03bcbe62cc7c083f97ea27594"> 348</a></span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_b_t_d.html#a0f1c28a03bcbe62cc7c083f97ea27594">l2capConnectionClaimed</a>;</div>
<div class="line"><a name="l00350"></a><span class="lineno"><a class="code" href="class_b_t_d.html#af5e5b085cec1da5c83c75e80e95b3590"> 350</a></span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_b_t_d.html#af5e5b085cec1da5c83c75e80e95b3590">sdpConnectionClaimed</a>;</div>
<div class="line"><a name="l00352"></a><span class="lineno"><a class="code" href="class_b_t_d.html#a9e5a34242007b64cd6a226cfd1901e74"> 352</a></span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_b_t_d.html#a9e5a34242007b64cd6a226cfd1901e74">rfcommConnectionClaimed</a>;</div>
<div class="line"><a name="l00353"></a><span class="lineno"> 353</span>&#160; </div>
<div class="line"><a name="l00355"></a><span class="lineno"><a class="code" href="class_b_t_d.html#a0359c0c158c864c27319810cbd1534f9"> 355</a></span>&#160; <span class="keyword">const</span> <span class="keywordtype">char</span>* <a class="code" href="class_b_t_d.html#a0359c0c158c864c27319810cbd1534f9">btdName</a>;</div>
<div class="line"><a name="l00357"></a><span class="lineno"><a class="code" href="class_b_t_d.html#a215cb939c01ed3ff56db37841224546c"> 357</a></span>&#160; <span class="keyword">const</span> <span class="keywordtype">char</span>* <a class="code" href="class_b_t_d.html#a215cb939c01ed3ff56db37841224546c">btdPin</a>;</div>
<div class="line"><a name="l00358"></a><span class="lineno"> 358</span>&#160; </div>
<div class="line"><a name="l00360"></a><span class="lineno"><a class="code" href="class_b_t_d.html#a1f8e9171a310e50f2c4a3c19066efe5a"> 360</a></span>&#160; uint8_t <a class="code" href="class_b_t_d.html#a1f8e9171a310e50f2c4a3c19066efe5a">my_bdaddr</a>[6];</div>
<div class="line"><a name="l00362"></a><span class="lineno"><a class="code" href="class_b_t_d.html#aa3bb6c692701cb33dfad1ea4d68b6f98"> 362</a></span>&#160; uint16_t <a class="code" href="class_b_t_d.html#aa3bb6c692701cb33dfad1ea4d68b6f98">hci_handle</a>;</div>
<div class="line"><a name="l00364"></a><span class="lineno"><a class="code" href="class_b_t_d.html#ab23f95f12675d7b4505ca6807d379182"> 364</a></span>&#160; uint8_t <a class="code" href="class_b_t_d.html#ab23f95f12675d7b4505ca6807d379182">disc_bdaddr</a>[6];</div>
<div class="line"><a name="l00366"></a><span class="lineno"><a class="code" href="class_b_t_d.html#aede42d995c384c238fd49d728df01e4e"> 366</a></span>&#160; uint8_t <a class="code" href="class_b_t_d.html#aede42d995c384c238fd49d728df01e4e">remote_name</a>[30];</div>
<div class="line"><a name="l00372"></a><span class="lineno"><a class="code" href="class_b_t_d.html#addaddee110af23a3195ad56f631e69ea"> 372</a></span>&#160; uint8_t <a class="code" href="class_b_t_d.html#addaddee110af23a3195ad56f631e69ea">hci_version</a>;</div>
<div class="line"><a name="l00374"></a><span class="lineno"><a class="code" href="class_b_t_d.html#ac7caac80fb6f5f0e794af3644887d88e"> 374</a></span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_b_t_d.html#ac7caac80fb6f5f0e794af3644887d88e">connectToWii</a>;</div>
<div class="line"><a name="l00376"></a><span class="lineno"><a class="code" href="class_b_t_d.html#a4dc8f94fe85028f3d54f13dde1e5b4ee"> 376</a></span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_b_t_d.html#a4dc8f94fe85028f3d54f13dde1e5b4ee">incomingWii</a>;</div>
<div class="line"><a name="l00378"></a><span class="lineno"><a class="code" href="class_b_t_d.html#a0c8cc2a2dd2cda3e760b8b4c1a2d169c"> 378</a></span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_b_t_d.html#a0c8cc2a2dd2cda3e760b8b4c1a2d169c">pairWithWii</a>;</div>
<div class="line"><a name="l00380"></a><span class="lineno"><a class="code" href="class_b_t_d.html#a3aea445b2349e99ef057db1a4ffdd9dc"> 380</a></span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_b_t_d.html#a3aea445b2349e99ef057db1a4ffdd9dc">motionPlusInside</a>;</div>
<div class="line"><a name="l00382"></a><span class="lineno"><a class="code" href="class_b_t_d.html#a962a5714c225dcb633434f02e3657583"> 382</a></span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_b_t_d.html#a962a5714c225dcb633434f02e3657583">wiiUProController</a>;</div>
<div class="line"><a name="l00042"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#aa4e852587db5ad51c6c5cfb8e9d4f002"> 42</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define HCI_CLASS_STATE 2</span></div>
<div class="line"><a name="l00043"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a86fd72d2518d27c02c15af635b55fc8f"> 43</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define HCI_BDADDR_STATE 3</span></div>
<div class="line"><a name="l00044"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a8f1d666addd0c2bba7602fbd7a692228"> 44</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define HCI_LOCAL_VERSION_STATE 4</span></div>
<div class="line"><a name="l00045"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a1939cc2e06b3185be07a93c1ac7a10e1"> 45</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define HCI_SET_NAME_STATE 5</span></div>
<div class="line"><a name="l00046"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a36daee23c5d0f4276e6eb32f3fd79124"> 46</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define HCI_CHECK_WII_SERVICE 6</span></div>
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00048"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a09fa39bcefd3255f8ef762034e45679e"> 48</a></span>&#160;<span class="preprocessor">#define HCI_INQUIRY_STATE 7 // These three states are only used if it should pair and connect to a Wii controller</span></div>
<div class="line"><a name="l00049"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a2733141c8dae8cd14f78b11b21d58ebb"> 49</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define HCI_CONNECT_WII_STATE 8</span></div>
<div class="line"><a name="l00050"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#ad497b58476b921e620f05791fa864f04"> 50</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define HCI_CONNECTED_WII_STATE 9</span></div>
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00052"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#acc9b6954b4bb6c19a9d25242869d5ddf"> 52</a></span>&#160;<span class="preprocessor">#define HCI_SCANNING_STATE 10</span></div>
<div class="line"><a name="l00053"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a8bfcf6e1a0a044aba26d728fb0c6a17a"> 53</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define HCI_CONNECT_IN_STATE 11</span></div>
<div class="line"><a name="l00054"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a4bad48092981dffe97edb052f5ae08bd"> 54</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define HCI_REMOTE_NAME_STATE 12</span></div>
<div class="line"><a name="l00055"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#ae0a16d1cc0142186a20379b5c68bd1e0"> 55</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define HCI_CONNECTED_STATE 13</span></div>
<div class="line"><a name="l00056"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#ad3500c7116f1bb564011dac09a387a5c"> 56</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define HCI_DISABLE_SCAN_STATE 14</span></div>
<div class="line"><a name="l00057"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a20fc1ebfc3da8e048f6afe53330e6b8f"> 57</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define HCI_DONE_STATE 15</span></div>
<div class="line"><a name="l00058"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a31398eae2e433d1b7b39ea3d6d07cdd0"> 58</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define HCI_DISCONNECT_STATE 16</span></div>
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span>&#160;<span class="comment">/* HCI event flags*/</span></div>
<div class="line"><a name="l00061"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a14087b750ea2da7f0cef4daaa7683d01"> 61</a></span>&#160;<span class="preprocessor">#define HCI_FLAG_CMD_COMPLETE 0x01</span></div>
<div class="line"><a name="l00062"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#aa05458d2a47122cd62cd0748c7e1e313"> 62</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define HCI_FLAG_CONN_COMPLETE 0x02</span></div>
<div class="line"><a name="l00063"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#aec17e7d699b1023a0b6f675feddd7d58"> 63</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define HCI_FLAG_DISCONN_COMPLETE 0x04</span></div>
<div class="line"><a name="l00064"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a400af4b61f6e94ab821fa368d8bf2b07"> 64</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define HCI_FLAG_REMOTE_NAME_COMPLETE 0x08</span></div>
<div class="line"><a name="l00065"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a0e8a8ce5838e265c1732795bf8822043"> 65</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define HCI_FLAG_INCOMING_REQUEST 0x10</span></div>
<div class="line"><a name="l00066"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#aabbf8a2ed694a2dc4d4e60fd389c44dd"> 66</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define HCI_FLAG_READ_BDADDR 0x20</span></div>
<div class="line"><a name="l00067"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#ab3b1f616c1e885e697806f0167b73e8e"> 67</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define HCI_FLAG_READ_VERSION 0x40</span></div>
<div class="line"><a name="l00068"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#aa991873698787cf45d26efaa370f34e2"> 68</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define HCI_FLAG_WII_FOUND 0x80</span></div>
<div class="line"><a name="l00069"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#ad14762241e9195fc9a3b0a69ef1ab7f3"> 69</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define HCI_FLAG_CONNECT_EVENT 0x100</span></div>
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>&#160;<span class="comment">/*Macros for HCI event flag tests */</span></div>
<div class="line"><a name="l00072"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a9cc765dd92016efe6eaeff535a5193c1"> 72</a></span>&#160;<span class="preprocessor">#define hci_cmd_complete (hci_event_flag &amp; HCI_FLAG_CMD_COMPLETE)</span></div>
<div class="line"><a name="l00073"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#ae43eba7b19fa5c92de5344819b99ec61"> 73</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define hci_connect_complete (hci_event_flag &amp; HCI_FLAG_CONN_COMPLETE)</span></div>
<div class="line"><a name="l00074"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#ae67c9cc739a52a8f4a3c28871a07bf1b"> 74</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define hci_disconnect_complete (hci_event_flag &amp; HCI_FLAG_DISCONN_COMPLETE)</span></div>
<div class="line"><a name="l00075"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a8f97f22fe3bc827916b8adb724b64a7f"> 75</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define hci_remote_name_complete (hci_event_flag &amp; HCI_FLAG_REMOTE_NAME_COMPLETE)</span></div>
<div class="line"><a name="l00076"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#aeb3a24db49f8158f85b928385e28d83a"> 76</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define hci_incoming_connect_request (hci_event_flag &amp; HCI_FLAG_INCOMING_REQUEST)</span></div>
<div class="line"><a name="l00077"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#afc5a7e103eb1301c12aa35af25cc8293"> 77</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define hci_read_bdaddr_complete (hci_event_flag &amp; HCI_FLAG_READ_BDADDR)</span></div>
<div class="line"><a name="l00078"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#ad205c180970335a666dfe5081b55ade4"> 78</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define hci_read_version_complete (hci_event_flag &amp; HCI_FLAG_READ_VERSION)</span></div>
<div class="line"><a name="l00079"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#aa12b77df715652f4735cb6620cd595a4"> 79</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define hci_wii_found (hci_event_flag &amp; HCI_FLAG_WII_FOUND)</span></div>
<div class="line"><a name="l00080"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a11ae66a6caad9105b8e7658189dcfa7b"> 80</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define hci_connect_event (hci_event_flag &amp; HCI_FLAG_CONNECT_EVENT)</span></div>
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00082"></a><span class="lineno"> 82</span>&#160;<span class="comment">/* HCI Events managed */</span></div>
<div class="line"><a name="l00083"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a4c6ca5696adeab36258b3b0c58d804e0"> 83</a></span>&#160;<span class="preprocessor">#define EV_INQUIRY_COMPLETE 0x01</span></div>
<div class="line"><a name="l00084"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a335df6d48c8cac828d62196eeaff360b"> 84</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define EV_INQUIRY_RESULT 0x02</span></div>
<div class="line"><a name="l00085"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#ad4bce42e1ef20447655f8916f23d07a7"> 85</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define EV_CONNECT_COMPLETE 0x03</span></div>
<div class="line"><a name="l00086"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#af6c5584636f8958689f5cd67290254e1"> 86</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define EV_INCOMING_CONNECT 0x04</span></div>
<div class="line"><a name="l00087"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a1cf7e4d4426dcabed8976b65beee0d99"> 87</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define EV_DISCONNECT_COMPLETE 0x05</span></div>
<div class="line"><a name="l00088"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a68b8f78a0e0da80434afb1e6d40eacf4"> 88</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define EV_AUTHENTICATION_COMPLETE 0x06</span></div>
<div class="line"><a name="l00089"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a29c1744f72f3cd85865c8173eace5a36"> 89</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define EV_REMOTE_NAME_COMPLETE 0x07</span></div>
<div class="line"><a name="l00090"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#aa0bf5ac66c412d3415dbb753630d0e58"> 90</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define EV_ENCRYPTION_CHANGE 0x08</span></div>
<div class="line"><a name="l00091"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a3e107e9d07793ca5cfaeea8b2181d4a4"> 91</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define EV_CHANGE_CONNECTION_LINK 0x09</span></div>
<div class="line"><a name="l00092"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#ac61db50de3007a22e19e660bd7e68e69"> 92</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define EV_ROLE_CHANGED 0x12</span></div>
<div class="line"><a name="l00093"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a0987119cfc40f3011a2cec69686034df"> 93</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define EV_NUM_COMPLETE_PKT 0x13</span></div>
<div class="line"><a name="l00094"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a935633384e87daa14b60549134014ec4"> 94</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define EV_PIN_CODE_REQUEST 0x16</span></div>
<div class="line"><a name="l00095"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a8c77c922bb61301760ebf5af5f1cc7f0"> 95</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define EV_LINK_KEY_REQUEST 0x17</span></div>
<div class="line"><a name="l00096"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a8c662496af1164370e5fdf7149ecd842"> 96</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define EV_LINK_KEY_NOTIFICATION 0x18</span></div>
<div class="line"><a name="l00097"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a6f8b4cf8546d9928a34c9c681dc5a6d5"> 97</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define EV_DATA_BUFFER_OVERFLOW 0x1A</span></div>
<div class="line"><a name="l00098"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a2ad6543cdfe06cbf0924c287c08f36d7"> 98</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define EV_MAX_SLOTS_CHANGE 0x1B</span></div>
<div class="line"><a name="l00099"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a830b2a3bcb09c4802910e8b05531d317"> 99</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define EV_READ_REMOTE_VERSION_INFORMATION_COMPLETE 0x0C</span></div>
<div class="line"><a name="l00100"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a1b58792b76e0f216df8160bf055032c3"> 100</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define EV_QOS_SETUP_COMPLETE 0x0D</span></div>
<div class="line"><a name="l00101"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a81b71e0ba648260143529b04ae84e528"> 101</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define EV_COMMAND_COMPLETE 0x0E</span></div>
<div class="line"><a name="l00102"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a090ee10cc1a1c1c3bbb29a93c330d2d4"> 102</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define EV_COMMAND_STATUS 0x0F</span></div>
<div class="line"><a name="l00103"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#acd5f65703cc34b112a1f656d9a49551b"> 103</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define EV_LOOPBACK_COMMAND 0x19</span></div>
<div class="line"><a name="l00104"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#ad8481acc0b144d97017f8a06d63ff47c"> 104</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define EV_PAGE_SCAN_REP_MODE 0x20</span></div>
<div class="line"><a name="l00105"></a><span class="lineno"> 105</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00106"></a><span class="lineno"> 106</span>&#160;<span class="comment">/* L2CAP signaling commands */</span></div>
<div class="line"><a name="l00107"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a6ffcd72787c86f248192eb06a3fe18cb"> 107</a></span>&#160;<span class="preprocessor">#define L2CAP_CMD_COMMAND_REJECT 0x01</span></div>
<div class="line"><a name="l00108"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#ac4bae0c65fd00ed849cb226302d19c85"> 108</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define L2CAP_CMD_CONNECTION_REQUEST 0x02</span></div>
<div class="line"><a name="l00109"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#aef7b306479de265d725dbe5816a8227b"> 109</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define L2CAP_CMD_CONNECTION_RESPONSE 0x03</span></div>
<div class="line"><a name="l00110"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a48bcd73461d736d0ef889e1fe6e36f69"> 110</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define L2CAP_CMD_CONFIG_REQUEST 0x04</span></div>
<div class="line"><a name="l00111"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a8151b1fe5d940a5a7a34f43a8b8ce434"> 111</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define L2CAP_CMD_CONFIG_RESPONSE 0x05</span></div>
<div class="line"><a name="l00112"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a398676a2e9a2351a5a52afdddf4b660b"> 112</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define L2CAP_CMD_DISCONNECT_REQUEST 0x06</span></div>
<div class="line"><a name="l00113"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a4c64a41200714e457b397496183dc0e4"> 113</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define L2CAP_CMD_DISCONNECT_RESPONSE 0x07</span></div>
<div class="line"><a name="l00114"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a200eb6c7c905ec74a9daf0f262af0448"> 114</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define L2CAP_CMD_INFORMATION_REQUEST 0x0A</span></div>
<div class="line"><a name="l00115"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#af32d4c53927d596a8727ff232310dec1"> 115</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define L2CAP_CMD_INFORMATION_RESPONSE 0x0B</span></div>
<div class="line"><a name="l00116"></a><span class="lineno"> 116</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00117"></a><span class="lineno"> 117</span>&#160;<span class="comment">// Used For Connection Response - Remember to Include High Byte</span></div>
<div class="line"><a name="l00118"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a9960d0d5ae92fc92c70bbb84c2a5c0cc"> 118</a></span>&#160;<span class="preprocessor">#define PENDING 0x01</span></div>
<div class="line"><a name="l00119"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a1be7a56cdddcdb7dedf16d4dee381e93"> 119</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define SUCCESSFUL 0x00</span></div>
<div class="line"><a name="l00120"></a><span class="lineno"> 120</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00121"></a><span class="lineno"> 121</span>&#160;<span class="comment">/* Bluetooth L2CAP PSM - see http://www.bluetooth.org/Technical/AssignedNumbers/logical_link.htm */</span></div>
<div class="line"><a name="l00122"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a25ce859d7ee2730e1d22d11c051ed60d"> 122</a></span>&#160;<span class="preprocessor">#define SDP_PSM 0x01 // Service Discovery Protocol PSM Value</span></div>
<div class="line"><a name="l00123"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a2924020f2e7e82fe956574538e2bc3eb"> 123</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define RFCOMM_PSM 0x03 // RFCOMM PSM Value</span></div>
<div class="line"><a name="l00124"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a1465673868452307bcdab8e201430c27"> 124</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define HID_CTRL_PSM 0x11 // HID_Control PSM Value</span></div>
<div class="line"><a name="l00125"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a4c5ac96db74d61d4a5a5d945a400e7da"> 125</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define HID_INTR_PSM 0x13 // HID_Interrupt PSM Value</span></div>
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00127"></a><span class="lineno"> 127</span>&#160;<span class="comment">// Used to determine if it is a Bluetooth dongle</span></div>
<div class="line"><a name="l00128"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a177fe269ddb7979d99b76d52bc281551"> 128</a></span>&#160;<span class="preprocessor">#define WI_SUBCLASS_RF 0x01 // RF Controller</span></div>
<div class="line"><a name="l00129"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a05903a9351c5ced6b8be27b2869e62af"> 129</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define WI_PROTOCOL_BT 0x01 // Bluetooth Programming Interface</span></div>
<div class="line"><a name="l00130"></a><span class="lineno"> 130</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00131"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#aee41c4878894db24e7ad8cd6246595cd"> 131</a></span>&#160;<span class="preprocessor">#define BTD_MAX_ENDPOINTS 4</span></div>
<div class="line"><a name="l00132"></a><span class="lineno"><a class="code" href="_b_t_d_8h.html#a2222709eed4c8af293e881ea36f599b0"> 132</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define BTD_NUMSERVICES 4 // Max number of Bluetooth services</span></div>
<div class="line"><a name="l00133"></a><span class="lineno"> 133</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00135"></a><span class="lineno"><a class="code" href="class_bluetooth_service.html"> 135</a></span>&#160;<span class="keyword">class </span><a class="code" href="class_bluetooth_service.html">BluetoothService</a> {</div>
<div class="line"><a name="l00136"></a><span class="lineno"> 136</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00141"></a><span class="lineno"> 141</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_bluetooth_service.html#a8dc98310fe481357eaa86c53e49af113">ACLData</a>(uint8_t* <a class="code" href="class_bluetooth_service.html#a8dc98310fe481357eaa86c53e49af113">ACLData</a>);</div>
<div class="line"><a name="l00143"></a><span class="lineno"> 143</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_bluetooth_service.html#a680692ff13cb37eb81ddbb74bc9e0383">Run</a>();</div>
<div class="line"><a name="l00145"></a><span class="lineno"> 145</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_bluetooth_service.html#a1dff7caf251f1d8a5f358b368445cb48">Reset</a>();</div>
<div class="line"><a name="l00147"></a><span class="lineno"> 147</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_bluetooth_service.html#a66ee2f09c6087b82e3920c3d652a99b2">disconnect</a>();</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;</div>
<div class="line"><a name="l00154"></a><span class="lineno"><a class="code" href="class_b_t_d.html"> 154</a></span>&#160;<span class="keyword">class </span><a class="code" href="class_b_t_d.html">BTD</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="l00155"></a><span class="lineno"> 155</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00160"></a><span class="lineno"> 160</span>&#160; <a class="code" href="class_b_t_d.html#a5f07597fe15a2b917cce405fe87f2981">BTD</a>(<a class="code" href="class_u_s_b.html">USB</a> *p);</div>
<div class="line"><a name="l00161"></a><span class="lineno"> 161</span>&#160;</div>
<div class="line"><a name="l00170"></a><span class="lineno"> 170</span>&#160; <span class="keyword">virtual</span> uint8_t <a class="code" href="class_b_t_d.html#a48608619d8253972dd132edbb3001c5f">Init</a>(uint8_t parent, uint8_t port, <span class="keywordtype">bool</span> lowspeed);</div>
<div class="line"><a name="l00175"></a><span class="lineno"> 175</span>&#160; <span class="keyword">virtual</span> uint8_t <a class="code" href="class_b_t_d.html#aa87c23bce56a20f2db47c6a40c8eda87">Release</a>();</div>
<div class="line"><a name="l00180"></a><span class="lineno"> 180</span>&#160; <span class="keyword">virtual</span> uint8_t <a class="code" href="class_b_t_d.html#a76e201c5b561e3a6d0405894ba5c2e41">Poll</a>();</div>
<div class="line"><a name="l00181"></a><span class="lineno"> 181</span>&#160;</div>
<div class="line"><a name="l00186"></a><span class="lineno"><a class="code" href="class_b_t_d.html#aecdd9d00fc9c12bb3677ed213a6687c3"> 186</a></span>&#160; <span class="keyword">virtual</span> uint8_t <a class="code" href="class_b_t_d.html#aecdd9d00fc9c12bb3677ed213a6687c3">GetAddress</a>() {</div>
<div class="line"><a name="l00187"></a><span class="lineno"> 187</span>&#160; <span class="keywordflow">return</span> <a class="code" href="class_b_t_d.html#a58f78a9a28db81858dcc34a32a2ec82c">bAddress</a>;</div>
<div class="line"><a name="l00188"></a><span class="lineno"> 188</span>&#160; };</div>
<div class="line"><a name="l00189"></a><span class="lineno"> 189</span>&#160;</div>
<div class="line"><a name="l00194"></a><span class="lineno"><a class="code" href="class_b_t_d.html#a1b2440748bdaaeb552a05b0f0902f5d8"> 194</a></span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="class_b_t_d.html#a1b2440748bdaaeb552a05b0f0902f5d8">isReady</a>() {</div>
<div class="line"><a name="l00195"></a><span class="lineno"> 195</span>&#160; <span class="keywordflow">return</span> bPollEnable;</div>
<div class="line"><a name="l00196"></a><span class="lineno"> 196</span>&#160; };</div>
<div class="line"><a name="l00208"></a><span class="lineno"> 208</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#a23928cd0e5711a2433aec763cfa55773">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="l00212"></a><span class="lineno"><a class="code" href="class_b_t_d.html#a610183f9ddf04155ef2612d1839af7da"> 212</a></span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#a610183f9ddf04155ef2612d1839af7da">disconnect</a>() {</div>
<div class="line"><a name="l00213"></a><span class="lineno"> 213</span>&#160; <span class="keywordflow">for</span>(uint8_t i = 0; i &lt; <a class="code" href="_b_t_d_8h.html#a2222709eed4c8af293e881ea36f599b0">BTD_NUMSERVICES</a>; i++)</div>
<div class="line"><a name="l00214"></a><span class="lineno"> 214</span>&#160; <span class="keywordflow">if</span>(btService[i])</div>
<div class="line"><a name="l00215"></a><span class="lineno"> 215</span>&#160; btService[i]-&gt;<a class="code" href="class_bluetooth_service.html#a66ee2f09c6087b82e3920c3d652a99b2">disconnect</a>();</div>
<div class="line"><a name="l00216"></a><span class="lineno"> 216</span>&#160; };</div>
<div class="line"><a name="l00217"></a><span class="lineno"> 217</span>&#160;</div>
<div class="line"><a name="l00223"></a><span class="lineno"><a class="code" href="class_b_t_d.html#a4adfc7e51ad3b3c03e7c37d1af159e73"> 223</a></span>&#160; int8_t <a class="code" href="class_b_t_d.html#a4adfc7e51ad3b3c03e7c37d1af159e73">registerServiceClass</a>(<a class="code" href="class_bluetooth_service.html">BluetoothService</a> *pService) {</div>
<div class="line"><a name="l00224"></a><span class="lineno"> 224</span>&#160; <span class="keywordflow">for</span>(uint8_t i = 0; i &lt; <a class="code" href="_b_t_d_8h.html#a2222709eed4c8af293e881ea36f599b0">BTD_NUMSERVICES</a>; i++) {</div>
<div class="line"><a name="l00225"></a><span class="lineno"> 225</span>&#160; <span class="keywordflow">if</span>(!btService[i]) {</div>
<div class="line"><a name="l00226"></a><span class="lineno"> 226</span>&#160; btService[i] = pService;</div>
<div class="line"><a name="l00227"></a><span class="lineno"> 227</span>&#160; <span class="keywordflow">return</span> i; <span class="comment">// Return ID</span></div>
<div class="line"><a name="l00228"></a><span class="lineno"> 228</span>&#160; }</div>
<div class="line"><a name="l00229"></a><span class="lineno"> 229</span>&#160; }</div>
<div class="line"><a name="l00230"></a><span class="lineno"> 230</span>&#160; <span class="keywordflow">return</span> -1; <span class="comment">// ErrorregisterServiceClass</span></div>
<div class="line"><a name="l00231"></a><span class="lineno"> 231</span>&#160; };</div>
<div class="line"><a name="l00232"></a><span class="lineno"> 232</span>&#160;</div>
<div class="line"><a name="l00239"></a><span class="lineno"> 239</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#af11ad71d20783d46fe42dd405d10dfda">HCI_Command</a>(uint8_t* data, uint16_t nbytes);</div>
<div class="line"><a name="l00241"></a><span class="lineno"> 241</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#ae6f942eabd29257bc4896e5f263275b6">hci_reset</a>();</div>
<div class="line"><a name="l00243"></a><span class="lineno"> 243</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#acb94a629477d85cebd16a9c5ecd4a8b3">hci_read_bdaddr</a>();</div>
<div class="line"><a name="l00245"></a><span class="lineno"> 245</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#ae2ba215b6942f4131e4c5fdef2771e22">hci_read_local_version_information</a>();</div>
<div class="line"><a name="l00250"></a><span class="lineno"> 250</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#a9a6747d58951f53389922d80e25b886c">hci_set_local_name</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* name);</div>
<div class="line"><a name="l00252"></a><span class="lineno"> 252</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#a7dd7faaec1d3d9a1d8159cc2a4190977">hci_write_scan_enable</a>();</div>
<div class="line"><a name="l00254"></a><span class="lineno"> 254</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#aff59ab45d917406141ae0c9c79047f08">hci_write_scan_disable</a>();</div>
<div class="line"><a name="l00256"></a><span class="lineno"> 256</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#a8767529bd203c549348a38ac9c6682b3">hci_remote_name</a>();</div>
<div class="line"><a name="l00258"></a><span class="lineno"> 258</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#a1cb07a155c69bb1fcf45ae030b8947ec">hci_accept_connection</a>();</div>
<div class="line"><a name="l00263"></a><span class="lineno"> 263</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#a1bea5dd793a2f47006b4a7642efc9e56">hci_disconnect</a>(uint16_t handle);</div>
<div class="line"><a name="l00269"></a><span class="lineno"> 269</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#a70047b0f624c3f0ef29f8b76b8a34938">hci_pin_code_request_reply</a>();</div>
<div class="line"><a name="l00271"></a><span class="lineno"> 271</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#a7114d2cb62aa413e5ecb25c45c76832b">hci_pin_code_negative_request_reply</a>();</div>
<div class="line"><a name="l00276"></a><span class="lineno"> 276</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#af4d28b9c1a3b9688a1871610caee2cfc">hci_link_key_request_negative_reply</a>();</div>
<div class="line"><a name="l00278"></a><span class="lineno"> 278</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#addd07c18c725a324a05792a83026d36d">hci_authentication_request</a>();</div>
<div class="line"><a name="l00280"></a><span class="lineno"> 280</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#a678f2c995553ce6a9f48f9b59f2f1555">hci_inquiry</a>();</div>
<div class="line"><a name="l00282"></a><span class="lineno"> 282</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#a45ffbc7a40bbb763b0ece907c3dfc9ff">hci_inquiry_cancel</a>();</div>
<div class="line"><a name="l00284"></a><span class="lineno"> 284</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#ae7066ea743f8907708db945ebef3ad76">hci_connect</a>();</div>
<div class="line"><a name="l00286"></a><span class="lineno"> 286</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#a9a17405df60591b909ff1502fb8f3141">hci_write_class_of_device</a>();</div>
<div class="line"><a name="l00298"></a><span class="lineno"> 298</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#aad7d8ef46e60b48ff4aaabefb0b290e7">L2CAP_Command</a>(uint16_t handle, uint8_t* data, uint8_t nbytes, uint8_t channelLow = 0x01, uint8_t channelHigh = 0x00);</div>
<div class="line"><a name="l00306"></a><span class="lineno"> 306</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#a55cf412a2053972a353b1ab964ca9d3e">l2cap_connection_request</a>(uint16_t handle, uint8_t rxid, uint8_t* scid, uint16_t psm);</div>
<div class="line"><a name="l00315"></a><span class="lineno"> 315</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#a7d34c62b1d561679dea5cd27356b38a7">l2cap_connection_response</a>(uint16_t handle, uint8_t rxid, uint8_t* dcid, uint8_t* scid, uint8_t result);</div>
<div class="line"><a name="l00322"></a><span class="lineno"> 322</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#ab646a59311344966f139bb3b78f30233">l2cap_config_request</a>(uint16_t handle, uint8_t rxid, uint8_t* dcid);</div>
<div class="line"><a name="l00329"></a><span class="lineno"> 329</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#a792ac4529b65235698ecf3d37982c05e">l2cap_config_response</a>(uint16_t handle, uint8_t rxid, uint8_t* scid);</div>
<div class="line"><a name="l00337"></a><span class="lineno"> 337</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#ac7053ef7ac690be3afbbdd985b163f10">l2cap_disconnection_request</a>(uint16_t handle, uint8_t rxid, uint8_t* dcid, uint8_t* scid);</div>
<div class="line"><a name="l00345"></a><span class="lineno"> 345</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#a29d176d9194e5c92fbe54791fc245407">l2cap_disconnection_response</a>(uint16_t handle, uint8_t rxid, uint8_t* dcid, uint8_t* scid);</div>
<div class="line"><a name="l00352"></a><span class="lineno"> 352</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#a91f61915c503fe7b861c88f5b3e6733c">l2cap_information_response</a>(uint16_t handle, uint8_t rxid, uint8_t infoTypeLow, uint8_t infoTypeHigh);</div>
<div class="line"><a name="l00356"></a><span class="lineno"><a class="code" href="class_b_t_d.html#aa7735da01865bab01b569ee836173737"> 356</a></span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_b_t_d.html#aa7735da01865bab01b569ee836173737">watingForConnection</a>;</div>
<div class="line"><a name="l00358"></a><span class="lineno"><a class="code" href="class_b_t_d.html#a0f1c28a03bcbe62cc7c083f97ea27594"> 358</a></span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_b_t_d.html#a0f1c28a03bcbe62cc7c083f97ea27594">l2capConnectionClaimed</a>;</div>
<div class="line"><a name="l00360"></a><span class="lineno"><a class="code" href="class_b_t_d.html#af5e5b085cec1da5c83c75e80e95b3590"> 360</a></span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_b_t_d.html#af5e5b085cec1da5c83c75e80e95b3590">sdpConnectionClaimed</a>;</div>
<div class="line"><a name="l00362"></a><span class="lineno"><a class="code" href="class_b_t_d.html#a9e5a34242007b64cd6a226cfd1901e74"> 362</a></span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_b_t_d.html#a9e5a34242007b64cd6a226cfd1901e74">rfcommConnectionClaimed</a>;</div>
<div class="line"><a name="l00363"></a><span class="lineno"> 363</span>&#160;</div>
<div class="line"><a name="l00365"></a><span class="lineno"><a class="code" href="class_b_t_d.html#a0359c0c158c864c27319810cbd1534f9"> 365</a></span>&#160; <span class="keyword">const</span> <span class="keywordtype">char</span>* <a class="code" href="class_b_t_d.html#a0359c0c158c864c27319810cbd1534f9">btdName</a>;</div>
<div class="line"><a name="l00367"></a><span class="lineno"><a class="code" href="class_b_t_d.html#a215cb939c01ed3ff56db37841224546c"> 367</a></span>&#160; <span class="keyword">const</span> <span class="keywordtype">char</span>* <a class="code" href="class_b_t_d.html#a215cb939c01ed3ff56db37841224546c">btdPin</a>;</div>
<div class="line"><a name="l00368"></a><span class="lineno"> 368</span>&#160;</div>
<div class="line"><a name="l00370"></a><span class="lineno"><a class="code" href="class_b_t_d.html#a1f8e9171a310e50f2c4a3c19066efe5a"> 370</a></span>&#160; uint8_t <a class="code" href="class_b_t_d.html#a1f8e9171a310e50f2c4a3c19066efe5a">my_bdaddr</a>[6];</div>
<div class="line"><a name="l00372"></a><span class="lineno"><a class="code" href="class_b_t_d.html#aa3bb6c692701cb33dfad1ea4d68b6f98"> 372</a></span>&#160; uint16_t <a class="code" href="class_b_t_d.html#aa3bb6c692701cb33dfad1ea4d68b6f98">hci_handle</a>;</div>
<div class="line"><a name="l00374"></a><span class="lineno"><a class="code" href="class_b_t_d.html#ab23f95f12675d7b4505ca6807d379182"> 374</a></span>&#160; uint8_t <a class="code" href="class_b_t_d.html#ab23f95f12675d7b4505ca6807d379182">disc_bdaddr</a>[6];</div>
<div class="line"><a name="l00376"></a><span class="lineno"><a class="code" href="class_b_t_d.html#aede42d995c384c238fd49d728df01e4e"> 376</a></span>&#160; uint8_t <a class="code" href="class_b_t_d.html#aede42d995c384c238fd49d728df01e4e">remote_name</a>[30];</div>
<div class="line"><a name="l00382"></a><span class="lineno"><a class="code" href="class_b_t_d.html#addaddee110af23a3195ad56f631e69ea"> 382</a></span>&#160; uint8_t <a class="code" href="class_b_t_d.html#addaddee110af23a3195ad56f631e69ea">hci_version</a>;</div>
<div class="line"><a name="l00383"></a><span class="lineno"> 383</span>&#160;</div>
<div class="line"><a name="l00388"></a><span class="lineno"><a class="code" href="class_b_t_d.html#a2a9ecb996243e070e70972370e45e4fd"> 388</a></span>&#160; uint8_t <a class="code" href="class_b_t_d.html#a2a9ecb996243e070e70972370e45e4fd">readPollInterval</a>() { <span class="keywordflow">return</span> pollInterval; };</div>
<div class="line"><a name="l00389"></a><span class="lineno"> 389</span>&#160; </div>
<div class="line"><a name="l00390"></a><span class="lineno"> 390</span>&#160;<span class="keyword">protected</span>:</div>
<div class="line"><a name="l00392"></a><span class="lineno"> 392</span>&#160; <a class="code" href="class_u_s_b.html">USB</a> *<a class="code" href="class_b_t_d.html#a4bcd1d622a6455ee3d0cccc4408700a1">pUsb</a>;</div>
<div class="line"><a name="l00394"></a><span class="lineno"><a class="code" href="class_b_t_d.html#a58f78a9a28db81858dcc34a32a2ec82c"> 394</a></span>&#160; uint8_t <a class="code" href="class_b_t_d.html#a58f78a9a28db81858dcc34a32a2ec82c">bAddress</a>;</div>
<div class="line"><a name="l00396"></a><span class="lineno"><a class="code" href="class_b_t_d.html#a91d92fee94e5a4cbca472bb3fd883e3e"> 396</a></span>&#160; <a class="code" href="struct_ep_info.html">EpInfo</a> <a class="code" href="class_b_t_d.html#a91d92fee94e5a4cbca472bb3fd883e3e">epInfo</a>[<a class="code" href="_b_t_d_8h.html#aee41c4878894db24e7ad8cd6246595cd">BTD_MAX_ENDPOINTS</a>];</div>
<div class="line"><a name="l00397"></a><span class="lineno"> 397</span>&#160; </div>
<div class="line"><a name="l00399"></a><span class="lineno"><a class="code" href="class_b_t_d.html#a10c34527ae90e95791ac48ac7d1154a2"> 399</a></span>&#160; uint8_t <a class="code" href="class_b_t_d.html#a10c34527ae90e95791ac48ac7d1154a2">bConfNum</a>;</div>
<div class="line"><a name="l00401"></a><span class="lineno"><a class="code" href="class_b_t_d.html#a893dd35932821cddda7e482a1904af66"> 401</a></span>&#160; uint8_t <a class="code" href="class_b_t_d.html#a893dd35932821cddda7e482a1904af66">bNumEP</a>;</div>
<div class="line"><a name="l00403"></a><span class="lineno"><a class="code" href="class_b_t_d.html#a52d6c7895f6bb01729d01ce28a2f3079"> 403</a></span>&#160; uint32_t <a class="code" href="class_b_t_d.html#a52d6c7895f6bb01729d01ce28a2f3079">qNextPollTime</a>;</div>
<div class="line"><a name="l00404"></a><span class="lineno"> 404</span>&#160; </div>
<div class="line"><a name="l00406"></a><span class="lineno"><a class="code" href="class_b_t_d.html#a49f433ab824f259c3815e180c73bb0ad"> 406</a></span>&#160; <span class="keyword">static</span> <span class="keyword">const</span> uint8_t <a class="code" href="class_b_t_d.html#a49f433ab824f259c3815e180c73bb0ad">BTD_CONTROL_PIPE</a>;</div>
<div class="line"><a name="l00408"></a><span class="lineno"><a class="code" href="class_b_t_d.html#a24166c9b308925eeb2f635fae43ca5ec"> 408</a></span>&#160; <span class="keyword">static</span> <span class="keyword">const</span> uint8_t <a class="code" href="class_b_t_d.html#a24166c9b308925eeb2f635fae43ca5ec">BTD_EVENT_PIPE</a>;</div>
<div class="line"><a name="l00410"></a><span class="lineno"><a class="code" href="class_b_t_d.html#a480510bd399ae74a97cd74c8474ef59c"> 410</a></span>&#160; <span class="keyword">static</span> <span class="keyword">const</span> uint8_t <a class="code" href="class_b_t_d.html#a480510bd399ae74a97cd74c8474ef59c">BTD_DATAIN_PIPE</a>;</div>
<div class="line"><a name="l00412"></a><span class="lineno"><a class="code" href="class_b_t_d.html#a0d82870f7eef8c27c33e6f5989d7a4dd"> 412</a></span>&#160; <span class="keyword">static</span> <span class="keyword">const</span> uint8_t <a class="code" href="class_b_t_d.html#a0d82870f7eef8c27c33e6f5989d7a4dd">BTD_DATAOUT_PIPE</a>;</div>
<div class="line"><a name="l00413"></a><span class="lineno"> 413</span>&#160; </div>
<div class="line"><a name="l00418"></a><span class="lineno"> 418</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#aa5976eead215a58553aee683d42405a0">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="l00419"></a><span class="lineno"> 419</span>&#160; </div>
<div class="line"><a name="l00420"></a><span class="lineno"> 420</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00421"></a><span class="lineno"> 421</span>&#160; <a class="code" href="class_bluetooth_service.html">BluetoothService</a>* btService[<a class="code" href="_b_t_d_8h.html#a2222709eed4c8af293e881ea36f599b0">BTD_NUMSERVICES</a>];</div>
<div class="line"><a name="l00385"></a><span class="lineno"><a class="code" href="class_b_t_d.html#a6b66a27c0fd359e3129f53451352b55c"> 385</a></span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#a6b66a27c0fd359e3129f53451352b55c">pairWithWiimote</a>() {</div>
<div class="line"><a name="l00386"></a><span class="lineno"> 386</span>&#160; <a class="code" href="class_b_t_d.html#a0c8cc2a2dd2cda3e760b8b4c1a2d169c">pairWithWii</a> = <span class="keyword">true</span>;</div>
<div class="line"><a name="l00387"></a><span class="lineno"> 387</span>&#160; hci_state = <a class="code" href="_b_t_d_8h.html#a36daee23c5d0f4276e6eb32f3fd79124">HCI_CHECK_WII_SERVICE</a>;</div>
<div class="line"><a name="l00388"></a><span class="lineno"><a class="code" href="class_b_t_d.html#ac7caac80fb6f5f0e794af3644887d88e"> 388</a></span>&#160; };</div>
<div class="line"><a name="l00390"></a><span class="lineno"> 390</span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_b_t_d.html#ac7caac80fb6f5f0e794af3644887d88e">connectToWii</a>;</div>
<div class="line"><a name="l00392"></a><span class="lineno"><a class="code" href="class_b_t_d.html#a4dc8f94fe85028f3d54f13dde1e5b4ee"> 392</a></span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_b_t_d.html#a4dc8f94fe85028f3d54f13dde1e5b4ee">incomingWii</a>;</div>
<div class="line"><a name="l00394"></a><span class="lineno"><a class="code" href="class_b_t_d.html#a0c8cc2a2dd2cda3e760b8b4c1a2d169c"> 394</a></span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_b_t_d.html#a0c8cc2a2dd2cda3e760b8b4c1a2d169c">pairWithWii</a>;</div>
<div class="line"><a name="l00396"></a><span class="lineno"><a class="code" href="class_b_t_d.html#a3aea445b2349e99ef057db1a4ffdd9dc"> 396</a></span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_b_t_d.html#a3aea445b2349e99ef057db1a4ffdd9dc">motionPlusInside</a>;</div>
<div class="line"><a name="l00398"></a><span class="lineno"><a class="code" href="class_b_t_d.html#a962a5714c225dcb633434f02e3657583"> 398</a></span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_b_t_d.html#a962a5714c225dcb633434f02e3657583">wiiUProController</a>;</div>
<div class="line"><a name="l00399"></a><span class="lineno"> 399</span>&#160;</div>
<div class="line"><a name="l00404"></a><span class="lineno"><a class="code" href="class_b_t_d.html#a2a9ecb996243e070e70972370e45e4fd"> 404</a></span>&#160; uint8_t <a class="code" href="class_b_t_d.html#a2a9ecb996243e070e70972370e45e4fd">readPollInterval</a>() {</div>
<div class="line"><a name="l00405"></a><span class="lineno"> 405</span>&#160; <span class="keywordflow">return</span> pollInterval;</div>
<div class="line"><a name="l00406"></a><span class="lineno"><a class="code" href="class_b_t_d.html#a4bcd1d622a6455ee3d0cccc4408700a1"> 406</a></span>&#160; };</div>
<div class="line"><a name="l00407"></a><span class="lineno"> 407</span>&#160;</div>
<div class="line"><a name="l00408"></a><span class="lineno"> 408</span>&#160;<span class="keyword">protected</span>:</div>
<div class="line"><a name="l00410"></a><span class="lineno"> 410</span>&#160; <a class="code" href="class_u_s_b.html">USB</a> *<a class="code" href="class_b_t_d.html#a4bcd1d622a6455ee3d0cccc4408700a1">pUsb</a>;</div>
<div class="line"><a name="l00412"></a><span class="lineno"><a class="code" href="class_b_t_d.html#a58f78a9a28db81858dcc34a32a2ec82c"> 412</a></span>&#160; uint8_t <a class="code" href="class_b_t_d.html#a58f78a9a28db81858dcc34a32a2ec82c">bAddress</a>;</div>
<div class="line"><a name="l00414"></a><span class="lineno"><a class="code" href="class_b_t_d.html#a91d92fee94e5a4cbca472bb3fd883e3e"> 414</a></span>&#160; <a class="code" href="struct_ep_info.html">EpInfo</a> <a class="code" href="class_b_t_d.html#a91d92fee94e5a4cbca472bb3fd883e3e">epInfo</a>[<a class="code" href="_b_t_d_8h.html#aee41c4878894db24e7ad8cd6246595cd">BTD_MAX_ENDPOINTS</a>];</div>
<div class="line"><a name="l00415"></a><span class="lineno"> 415</span>&#160;</div>
<div class="line"><a name="l00417"></a><span class="lineno"><a class="code" href="class_b_t_d.html#a10c34527ae90e95791ac48ac7d1154a2"> 417</a></span>&#160; uint8_t <a class="code" href="class_b_t_d.html#a10c34527ae90e95791ac48ac7d1154a2">bConfNum</a>;</div>
<div class="line"><a name="l00419"></a><span class="lineno"><a class="code" href="class_b_t_d.html#a893dd35932821cddda7e482a1904af66"> 419</a></span>&#160; uint8_t <a class="code" href="class_b_t_d.html#a893dd35932821cddda7e482a1904af66">bNumEP</a>;</div>
<div class="line"><a name="l00421"></a><span class="lineno"><a class="code" href="class_b_t_d.html#a52d6c7895f6bb01729d01ce28a2f3079"> 421</a></span>&#160; uint32_t <a class="code" href="class_b_t_d.html#a52d6c7895f6bb01729d01ce28a2f3079">qNextPollTime</a>;</div>
<div class="line"><a name="l00422"></a><span class="lineno"> 422</span>&#160;</div>
<div class="line"><a name="l00423"></a><span class="lineno"> 423</span>&#160; <span class="keywordtype">bool</span> bPollEnable;</div>
<div class="line"><a name="l00424"></a><span class="lineno"> 424</span>&#160; uint8_t pollInterval;</div>
<div class="line"><a name="l00425"></a><span class="lineno"> 425</span>&#160; </div>
<div class="line"><a name="l00426"></a><span class="lineno"> 426</span>&#160; <span class="comment">/* Variables used by high level HCI task */</span> </div>
<div class="line"><a name="l00427"></a><span class="lineno"> 427</span>&#160; uint8_t hci_state; <span class="comment">//current state of bluetooth hci connection</span></div>
<div class="line"><a name="l00428"></a><span class="lineno"> 428</span>&#160; uint16_t hci_counter; <span class="comment">// counter used for bluetooth hci reset loops</span></div>
<div class="line"><a name="l00429"></a><span class="lineno"> 429</span>&#160; uint8_t hci_num_reset_loops; <span class="comment">// this value indicate how many times it should read before trying to reset</span></div>
<div class="line"><a name="l00430"></a><span class="lineno"> 430</span>&#160; uint16_t hci_event_flag; <span class="comment">// hci flags of received bluetooth events</span></div>
<div class="line"><a name="l00431"></a><span class="lineno"> 431</span>&#160; uint8_t inquiry_counter;</div>
<div class="line"><a name="l00432"></a><span class="lineno"> 432</span>&#160; </div>
<div class="line"><a name="l00433"></a><span class="lineno"> 433</span>&#160; uint8_t hcibuf[<a class="code" href="_b_t_d_8h.html#a32d591ef5742a99963130616ef146787">BULK_MAXPKTSIZE</a>];<span class="comment">//General purpose buffer for hci data</span></div>
<div class="line"><a name="l00434"></a><span class="lineno"> 434</span>&#160; uint8_t l2capinbuf[<a class="code" href="_b_t_d_8h.html#a32d591ef5742a99963130616ef146787">BULK_MAXPKTSIZE</a>];<span class="comment">//General purpose buffer for l2cap in data</span></div>
<div class="line"><a name="l00435"></a><span class="lineno"> 435</span>&#160; uint8_t l2capoutbuf[<a class="code" href="_b_t_d_8h.html#a32d591ef5742a99963130616ef146787">BULK_MAXPKTSIZE</a>];<span class="comment">//General purpose buffer for l2cap out data</span></div>
<div class="line"><a name="l00436"></a><span class="lineno"> 436</span>&#160; </div>
<div class="line"><a name="l00437"></a><span class="lineno"> 437</span>&#160; <span class="comment">/* State machines */</span></div>
<div class="line"><a name="l00438"></a><span class="lineno"> 438</span>&#160; <span class="keywordtype">void</span> HCI_event_task(); <span class="comment">// Poll the HCI event pipe</span></div>
<div class="line"><a name="l00439"></a><span class="lineno"> 439</span>&#160; <span class="keywordtype">void</span> HCI_task(); <span class="comment">// HCI state machine</span></div>
<div class="line"><a name="l00440"></a><span class="lineno"> 440</span>&#160; <span class="keywordtype">void</span> ACL_event_task(); <span class="comment">// ACL input pipe</span></div>
<div class="line"><a name="l00441"></a><span class="lineno"> 441</span>&#160; </div>
<div class="line"><a name="l00442"></a><span class="lineno"> 442</span>&#160; <span class="comment">/* Used to set the Bluetooth Address internally to the PS3 Controllers */</span></div>
<div class="line"><a name="l00443"></a><span class="lineno"> 443</span>&#160; <span class="keywordtype">void</span> setBdaddr(uint8_t* BDADDR);</div>
<div class="line"><a name="l00444"></a><span class="lineno"> 444</span>&#160; <span class="keywordtype">void</span> setMoveBdaddr(uint8_t* BDADDR);</div>
<div class="line"><a name="l00445"></a><span class="lineno"> 445</span>&#160;};</div>
<div class="line"><a name="l00446"></a><span class="lineno"> 446</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00424"></a><span class="lineno"><a class="code" href="class_b_t_d.html#a49f433ab824f259c3815e180c73bb0ad"> 424</a></span>&#160; <span class="keyword">static</span> <span class="keyword">const</span> uint8_t <a class="code" href="class_b_t_d.html#a49f433ab824f259c3815e180c73bb0ad">BTD_CONTROL_PIPE</a>;</div>
<div class="line"><a name="l00426"></a><span class="lineno"><a class="code" href="class_b_t_d.html#a24166c9b308925eeb2f635fae43ca5ec"> 426</a></span>&#160; <span class="keyword">static</span> <span class="keyword">const</span> uint8_t <a class="code" href="class_b_t_d.html#a24166c9b308925eeb2f635fae43ca5ec">BTD_EVENT_PIPE</a>;</div>
<div class="line"><a name="l00428"></a><span class="lineno"><a class="code" href="class_b_t_d.html#a480510bd399ae74a97cd74c8474ef59c"> 428</a></span>&#160; <span class="keyword">static</span> <span class="keyword">const</span> uint8_t <a class="code" href="class_b_t_d.html#a480510bd399ae74a97cd74c8474ef59c">BTD_DATAIN_PIPE</a>;</div>
<div class="line"><a name="l00430"></a><span class="lineno"><a class="code" href="class_b_t_d.html#a0d82870f7eef8c27c33e6f5989d7a4dd"> 430</a></span>&#160; <span class="keyword">static</span> <span class="keyword">const</span> uint8_t <a class="code" href="class_b_t_d.html#a0d82870f7eef8c27c33e6f5989d7a4dd">BTD_DATAOUT_PIPE</a>;</div>
<div class="line"><a name="l00431"></a><span class="lineno"> 431</span>&#160;</div>
<div class="line"><a name="l00436"></a><span class="lineno"> 436</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_b_t_d.html#aa5976eead215a58553aee683d42405a0">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="l00437"></a><span class="lineno"> 437</span>&#160;</div>
<div class="line"><a name="l00438"></a><span class="lineno"> 438</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00439"></a><span class="lineno"> 439</span>&#160; <a class="code" href="class_bluetooth_service.html">BluetoothService</a>* btService[<a class="code" href="_b_t_d_8h.html#a2222709eed4c8af293e881ea36f599b0">BTD_NUMSERVICES</a>];</div>
<div class="line"><a name="l00440"></a><span class="lineno"> 440</span>&#160;</div>
<div class="line"><a name="l00441"></a><span class="lineno"> 441</span>&#160; <span class="keywordtype">bool</span> bPollEnable;</div>
<div class="line"><a name="l00442"></a><span class="lineno"> 442</span>&#160; uint8_t pollInterval;</div>
<div class="line"><a name="l00443"></a><span class="lineno"> 443</span>&#160;</div>
<div class="line"><a name="l00444"></a><span class="lineno"> 444</span>&#160; <span class="comment">/* Variables used by high level HCI task */</span></div>
<div class="line"><a name="l00445"></a><span class="lineno"> 445</span>&#160; uint8_t hci_state; <span class="comment">//current state of bluetooth hci connection</span></div>
<div class="line"><a name="l00446"></a><span class="lineno"> 446</span>&#160; uint16_t hci_counter; <span class="comment">// counter used for bluetooth hci reset loops</span></div>
<div class="line"><a name="l00447"></a><span class="lineno"> 447</span>&#160; uint8_t hci_num_reset_loops; <span class="comment">// this value indicate how many times it should read before trying to reset</span></div>
<div class="line"><a name="l00448"></a><span class="lineno"> 448</span>&#160; uint16_t hci_event_flag; <span class="comment">// hci flags of received bluetooth events</span></div>
<div class="line"><a name="l00449"></a><span class="lineno"> 449</span>&#160; uint8_t inquiry_counter;</div>
<div class="line"><a name="l00450"></a><span class="lineno"> 450</span>&#160;</div>
<div class="line"><a name="l00451"></a><span class="lineno"> 451</span>&#160; uint8_t hcibuf[<a class="code" href="_b_t_d_8h.html#a32d591ef5742a99963130616ef146787">BULK_MAXPKTSIZE</a>]; <span class="comment">//General purpose buffer for hci data</span></div>
<div class="line"><a name="l00452"></a><span class="lineno"> 452</span>&#160; uint8_t l2capinbuf[<a class="code" href="_b_t_d_8h.html#a32d591ef5742a99963130616ef146787">BULK_MAXPKTSIZE</a>]; <span class="comment">//General purpose buffer for l2cap in data</span></div>
<div class="line"><a name="l00453"></a><span class="lineno"> 453</span>&#160; uint8_t l2capoutbuf[<a class="code" href="_b_t_d_8h.html#a32d591ef5742a99963130616ef146787">BULK_MAXPKTSIZE</a>]; <span class="comment">//General purpose buffer for l2cap out data</span></div>
<div class="line"><a name="l00454"></a><span class="lineno"> 454</span>&#160;</div>
<div class="line"><a name="l00455"></a><span class="lineno"> 455</span>&#160; <span class="comment">/* State machines */</span></div>
<div class="line"><a name="l00456"></a><span class="lineno"> 456</span>&#160; <span class="keywordtype">void</span> HCI_event_task(); <span class="comment">// Poll the HCI event pipe</span></div>
<div class="line"><a name="l00457"></a><span class="lineno"> 457</span>&#160; <span class="keywordtype">void</span> HCI_task(); <span class="comment">// HCI state machine</span></div>
<div class="line"><a name="l00458"></a><span class="lineno"> 458</span>&#160; <span class="keywordtype">void</span> ACL_event_task(); <span class="comment">// ACL input pipe</span></div>
<div class="line"><a name="l00459"></a><span class="lineno"> 459</span>&#160;</div>
<div class="line"><a name="l00460"></a><span class="lineno"> 460</span>&#160; <span class="comment">/* Used to set the Bluetooth Address internally to the PS3 Controllers */</span></div>
<div class="line"><a name="l00461"></a><span class="lineno"> 461</span>&#160; <span class="keywordtype">void</span> setBdaddr(uint8_t* BDADDR);</div>
<div class="line"><a name="l00462"></a><span class="lineno"> 462</span>&#160; <span class="keywordtype">void</span> setMoveBdaddr(uint8_t* BDADDR);</div>
<div class="line"><a name="l00463"></a><span class="lineno"> 463</span>&#160;};</div>
<div class="line"><a name="l00464"></a><span class="lineno"> 464</span>&#160;<span class="preprocessor">#endif</span></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>

View file

@ -98,7 +98,7 @@ Include dependency graph for PS3BT.cpp:</div>
<div class="dyncontent">
<div class="center"><img src="_p_s3_b_t_8cpp__incl.png" border="0" usemap="#_p_s3_b_t_8cpp" alt=""/></div>
<map name="_p_s3_b_t_8cpp" id="_p_s3_b_t_8cpp">
<area shape="rect" id="node2" href="_p_s3_b_t_8h.html" title="PS3BT.h" alt="" coords="613,75,667,96"/><area shape="rect" id="node3" href="_b_t_d_8h.html" title="BTD.h" alt="" coords="575,144,621,165"/><area shape="rect" id="node21" href="_p_s3_enums_8h.html" title="PS3Enums.h" alt="" coords="649,144,718,165"/><area shape="rect" id="node4" href="_usb_8h.html" title="Usb.h" alt="" coords="577,213,619,235"/><area shape="rect" id="node19" href="confdescparser_8h.html" title="confdescparser.h" alt="" coords="140,213,223,235"/><area shape="rect" id="node7" href="avrpins_8h.html" title="avrpins.h" alt="" coords="832,352,886,373"/><area shape="rect" id="node9" href="max3421e_8h.html" title="max3421e.h" alt="" coords="649,352,715,373"/><area shape="rect" id="node10" href="usbhost_8h.html" title="usbhost.h" alt="" coords="736,283,793,304"/><area shape="rect" id="node11" href="usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="739,352,798,373"/><area shape="rect" id="node12" href="address_8h.html" title="address.h" alt="" coords="477,283,534,304"/><area shape="rect" id="node15" href="printhex_8h.html" title="printhex.h" alt="" coords="187,421,243,443"/><area shape="rect" id="node16" href="hexdump_8h.html" title="hexdump.h" alt="" coords="99,352,161,373"/><area shape="rect" id="node18" href="message_8h.html" title="message.h" alt="" coords="185,352,246,373"/><area shape="rect" id="node20" href="parsetools_8h.html" title="parsetools.h" alt="" coords="28,283,93,304"/><area shape="rect" id="node22" href="controller_enums_8h.html" title="controllerEnums.h" alt="" coords="644,213,730,235"/></map>
<area shape="rect" id="node2" href="_p_s3_b_t_8h.html" title="PS3BT.h" alt="" coords="525,75,579,96"/><area shape="rect" id="node3" href="_b_t_d_8h.html" title="BTD.h" alt="" coords="489,144,535,165"/><area shape="rect" id="node21" href="_p_s3_enums_8h.html" title="PS3Enums.h" alt="" coords="559,144,628,165"/><area shape="rect" id="node4" href="_usb_8h.html" title="Usb.h" alt="" coords="619,283,661,304"/><area shape="rect" id="node19" href="confdescparser_8h.html" title="confdescparser.h" alt="" coords="297,213,380,235"/><area shape="rect" id="node7" href="avrpins_8h.html" title="avrpins.h" alt="" coords="845,421,899,443"/><area shape="rect" id="node9" href="max3421e_8h.html" title="max3421e.h" alt="" coords="671,421,737,443"/><area shape="rect" id="node10" href="usbhost_8h.html" title="usbhost.h" alt="" coords="762,352,819,373"/><area shape="rect" id="node11" href="usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="761,421,820,443"/><area shape="rect" id="node12" href="address_8h.html" title="address.h" alt="" coords="578,352,635,373"/><area shape="rect" id="node15" href="message_8h.html" title="message.h" alt="" coords="308,352,369,373"/><area shape="rect" id="node17" href="printhex_8h.html" title="printhex.h" alt="" coords="210,421,267,443"/><area shape="rect" id="node18" href="hexdump_8h.html" title="hexdump.h" alt="" coords="73,421,135,443"/><area shape="rect" id="node20" href="parsetools_8h.html" title="parsetools.h" alt="" coords="187,283,252,304"/><area shape="rect" id="node22" href="controller_enums_8h.html" title="controllerEnums.h" alt="" coords="550,213,636,235"/></map>
</div>
</div>
<p><a href="_p_s3_b_t_8cpp_source.html">Go to the source code of this file.</a></p>
@ -110,9 +110,8 @@ Macros</h2></td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="var-members"></a>
Variables</h2></td></tr>
<tr class="memitem:a554d83ee81af8e8083760b8a8ff9b9ea"><td class="memItemLeft" align="right" valign="top">const uint8_t <br class="typebreak"/>
OUTPUT_REPORT_BUFFER[]&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_p_s3_b_t_8cpp.html#a554d83ee81af8e8083760b8a8ff9b9ea">PROGMEM</a></td></tr>
<tr class="separator:a554d83ee81af8e8083760b8a8ff9b9ea"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4f830e7a33ce04f33c953cf40d975d25"><td class="memItemLeft" align="right" valign="top">const uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_p_s3_b_t_8cpp.html#a4f830e7a33ce04f33c953cf40d975d25">OUTPUT_REPORT_BUFFER</a> []</td></tr>
<tr class="separator:a4f830e7a33ce04f33c953cf40d975d25"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Macro Definition Documentation</h2>
<a class="anchor" id="ad72dbcf6d0153db1b8d8a58001feed83"></a>
@ -130,12 +129,12 @@ OUTPUT_REPORT_BUFFER[]&#160;</td><td class="memItemRight" valign="bottom"><a cla
</div>
</div>
<h2 class="groupheader">Variable Documentation</h2>
<a class="anchor" id="a554d83ee81af8e8083760b8a8ff9b9ea"></a>
<a class="anchor" id="a4f830e7a33ce04f33c953cf40d975d25"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">const uint8_t OUTPUT_REPORT_BUFFER [] PROGMEM</td>
<td class="memname">const uint8_t OUTPUT_REPORT_BUFFER[]</td>
</tr>
</table>
</div><div class="memdoc">

View file

@ -1,17 +1,17 @@
<map id="PS3BT.cpp" name="PS3BT.cpp">
<area shape="rect" id="node2" href="$_p_s3_b_t_8h.html" title="PS3BT.h" alt="" coords="613,75,667,96"/>
<area shape="rect" id="node3" href="$_b_t_d_8h.html" title="BTD.h" alt="" coords="575,144,621,165"/>
<area shape="rect" id="node21" href="$_p_s3_enums_8h.html" title="PS3Enums.h" alt="" coords="649,144,718,165"/>
<area shape="rect" id="node4" href="$_usb_8h.html" title="Usb.h" alt="" coords="577,213,619,235"/>
<area shape="rect" id="node19" href="$confdescparser_8h.html" title="confdescparser.h" alt="" coords="140,213,223,235"/>
<area shape="rect" id="node7" href="$avrpins_8h.html" title="avrpins.h" alt="" coords="832,352,886,373"/>
<area shape="rect" id="node9" href="$max3421e_8h.html" title="max3421e.h" alt="" coords="649,352,715,373"/>
<area shape="rect" id="node10" href="$usbhost_8h.html" title="usbhost.h" alt="" coords="736,283,793,304"/>
<area shape="rect" id="node11" href="$usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="739,352,798,373"/>
<area shape="rect" id="node12" href="$address_8h.html" title="address.h" alt="" coords="477,283,534,304"/>
<area shape="rect" id="node15" href="$printhex_8h.html" title="printhex.h" alt="" coords="187,421,243,443"/>
<area shape="rect" id="node16" href="$hexdump_8h.html" title="hexdump.h" alt="" coords="99,352,161,373"/>
<area shape="rect" id="node18" href="$message_8h.html" title="message.h" alt="" coords="185,352,246,373"/>
<area shape="rect" id="node20" href="$parsetools_8h.html" title="parsetools.h" alt="" coords="28,283,93,304"/>
<area shape="rect" id="node22" href="$controller_enums_8h.html" title="controllerEnums.h" alt="" coords="644,213,730,235"/>
<area shape="rect" id="node2" href="$_p_s3_b_t_8h.html" title="PS3BT.h" alt="" coords="525,75,579,96"/>
<area shape="rect" id="node3" href="$_b_t_d_8h.html" title="BTD.h" alt="" coords="489,144,535,165"/>
<area shape="rect" id="node21" href="$_p_s3_enums_8h.html" title="PS3Enums.h" alt="" coords="559,144,628,165"/>
<area shape="rect" id="node4" href="$_usb_8h.html" title="Usb.h" alt="" coords="619,283,661,304"/>
<area shape="rect" id="node19" href="$confdescparser_8h.html" title="confdescparser.h" alt="" coords="297,213,380,235"/>
<area shape="rect" id="node7" href="$avrpins_8h.html" title="avrpins.h" alt="" coords="845,421,899,443"/>
<area shape="rect" id="node9" href="$max3421e_8h.html" title="max3421e.h" alt="" coords="671,421,737,443"/>
<area shape="rect" id="node10" href="$usbhost_8h.html" title="usbhost.h" alt="" coords="762,352,819,373"/>
<area shape="rect" id="node11" href="$usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="761,421,820,443"/>
<area shape="rect" id="node12" href="$address_8h.html" title="address.h" alt="" coords="578,352,635,373"/>
<area shape="rect" id="node15" href="$message_8h.html" title="message.h" alt="" coords="308,352,369,373"/>
<area shape="rect" id="node17" href="$printhex_8h.html" title="printhex.h" alt="" coords="210,421,267,443"/>
<area shape="rect" id="node18" href="$hexdump_8h.html" title="hexdump.h" alt="" coords="73,421,135,443"/>
<area shape="rect" id="node20" href="$parsetools_8h.html" title="parsetools.h" alt="" coords="187,283,252,304"/>
<area shape="rect" id="node22" href="$controller_enums_8h.html" title="controllerEnums.h" alt="" coords="550,213,636,235"/>
</map>

View file

@ -1 +1 @@
b25f4430aa7dfcfa094ddd6ae2fec3f6
aee95b9f8dc4f9ab59f10b0141c407bb

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 KiB

After

Width:  |  Height:  |  Size: 77 KiB

File diff suppressed because it is too large Load diff

View file

@ -99,7 +99,7 @@ Include dependency graph for PS3BT.h:</div>
<div class="dyncontent">
<div class="center"><img src="_p_s3_b_t_8h__incl.png" border="0" usemap="#_p_s3_b_t_8h" alt=""/></div>
<map name="_p_s3_b_t_8h" id="_p_s3_b_t_8h">
<area shape="rect" id="node2" href="_b_t_d_8h.html" title="BTD.h" alt="" coords="575,75,621,96"/><area shape="rect" id="node20" href="_p_s3_enums_8h.html" title="PS3Enums.h" alt="" coords="649,75,718,96"/><area shape="rect" id="node3" href="_usb_8h.html" title="Usb.h" alt="" coords="577,144,619,165"/><area shape="rect" id="node18" href="confdescparser_8h.html" title="confdescparser.h" alt="" coords="140,144,223,165"/><area shape="rect" id="node6" href="avrpins_8h.html" title="avrpins.h" alt="" coords="832,283,886,304"/><area shape="rect" id="node8" href="max3421e_8h.html" title="max3421e.h" alt="" coords="649,283,715,304"/><area shape="rect" id="node9" href="usbhost_8h.html" title="usbhost.h" alt="" coords="736,213,793,235"/><area shape="rect" id="node10" href="usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="739,283,798,304"/><area shape="rect" id="node11" href="address_8h.html" title="address.h" alt="" coords="477,213,534,235"/><area shape="rect" id="node14" href="printhex_8h.html" title="printhex.h" alt="" coords="187,352,243,373"/><area shape="rect" id="node15" href="hexdump_8h.html" title="hexdump.h" alt="" coords="99,283,161,304"/><area shape="rect" id="node17" href="message_8h.html" title="message.h" alt="" coords="185,283,246,304"/><area shape="rect" id="node19" href="parsetools_8h.html" title="parsetools.h" alt="" coords="28,213,93,235"/><area shape="rect" id="node21" href="controller_enums_8h.html" title="controllerEnums.h" alt="" coords="644,144,730,165"/></map>
<area shape="rect" id="node2" href="_b_t_d_8h.html" title="BTD.h" alt="" coords="489,75,535,96"/><area shape="rect" id="node20" href="_p_s3_enums_8h.html" title="PS3Enums.h" alt="" coords="559,75,628,96"/><area shape="rect" id="node3" href="_usb_8h.html" title="Usb.h" alt="" coords="619,213,661,235"/><area shape="rect" id="node18" href="confdescparser_8h.html" title="confdescparser.h" alt="" coords="297,144,380,165"/><area shape="rect" id="node6" href="avrpins_8h.html" title="avrpins.h" alt="" coords="845,352,899,373"/><area shape="rect" id="node8" href="max3421e_8h.html" title="max3421e.h" alt="" coords="671,352,737,373"/><area shape="rect" id="node9" href="usbhost_8h.html" title="usbhost.h" alt="" coords="762,283,819,304"/><area shape="rect" id="node10" href="usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="761,352,820,373"/><area shape="rect" id="node11" href="address_8h.html" title="address.h" alt="" coords="578,283,635,304"/><area shape="rect" id="node14" href="message_8h.html" title="message.h" alt="" coords="308,283,369,304"/><area shape="rect" id="node16" href="printhex_8h.html" title="printhex.h" alt="" coords="210,352,267,373"/><area shape="rect" id="node17" href="hexdump_8h.html" title="hexdump.h" alt="" coords="73,352,135,373"/><area shape="rect" id="node19" href="parsetools_8h.html" title="parsetools.h" alt="" coords="187,213,252,235"/><area shape="rect" id="node21" href="controller_enums_8h.html" title="controllerEnums.h" alt="" coords="550,144,636,165"/></map>
</div>
</div><div class="textblock"><div class="dynheader">
This graph shows which files directly or indirectly include this file:</div>

View file

@ -1,16 +1,16 @@
<map id="PS3BT.h" name="PS3BT.h">
<area shape="rect" id="node2" href="$_b_t_d_8h.html" title="BTD.h" alt="" coords="575,75,621,96"/>
<area shape="rect" id="node20" href="$_p_s3_enums_8h.html" title="PS3Enums.h" alt="" coords="649,75,718,96"/>
<area shape="rect" id="node3" href="$_usb_8h.html" title="Usb.h" alt="" coords="577,144,619,165"/>
<area shape="rect" id="node18" href="$confdescparser_8h.html" title="confdescparser.h" alt="" coords="140,144,223,165"/>
<area shape="rect" id="node6" href="$avrpins_8h.html" title="avrpins.h" alt="" coords="832,283,886,304"/>
<area shape="rect" id="node8" href="$max3421e_8h.html" title="max3421e.h" alt="" coords="649,283,715,304"/>
<area shape="rect" id="node9" href="$usbhost_8h.html" title="usbhost.h" alt="" coords="736,213,793,235"/>
<area shape="rect" id="node10" href="$usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="739,283,798,304"/>
<area shape="rect" id="node11" href="$address_8h.html" title="address.h" alt="" coords="477,213,534,235"/>
<area shape="rect" id="node14" href="$printhex_8h.html" title="printhex.h" alt="" coords="187,352,243,373"/>
<area shape="rect" id="node15" href="$hexdump_8h.html" title="hexdump.h" alt="" coords="99,283,161,304"/>
<area shape="rect" id="node17" href="$message_8h.html" title="message.h" alt="" coords="185,283,246,304"/>
<area shape="rect" id="node19" href="$parsetools_8h.html" title="parsetools.h" alt="" coords="28,213,93,235"/>
<area shape="rect" id="node21" href="$controller_enums_8h.html" title="controllerEnums.h" alt="" coords="644,144,730,165"/>
<area shape="rect" id="node2" href="$_b_t_d_8h.html" title="BTD.h" alt="" coords="489,75,535,96"/>
<area shape="rect" id="node20" href="$_p_s3_enums_8h.html" title="PS3Enums.h" alt="" coords="559,75,628,96"/>
<area shape="rect" id="node3" href="$_usb_8h.html" title="Usb.h" alt="" coords="619,213,661,235"/>
<area shape="rect" id="node18" href="$confdescparser_8h.html" title="confdescparser.h" alt="" coords="297,144,380,165"/>
<area shape="rect" id="node6" href="$avrpins_8h.html" title="avrpins.h" alt="" coords="845,352,899,373"/>
<area shape="rect" id="node8" href="$max3421e_8h.html" title="max3421e.h" alt="" coords="671,352,737,373"/>
<area shape="rect" id="node9" href="$usbhost_8h.html" title="usbhost.h" alt="" coords="762,283,819,304"/>
<area shape="rect" id="node10" href="$usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="761,352,820,373"/>
<area shape="rect" id="node11" href="$address_8h.html" title="address.h" alt="" coords="578,283,635,304"/>
<area shape="rect" id="node14" href="$message_8h.html" title="message.h" alt="" coords="308,283,369,304"/>
<area shape="rect" id="node16" href="$printhex_8h.html" title="printhex.h" alt="" coords="210,352,267,373"/>
<area shape="rect" id="node17" href="$hexdump_8h.html" title="hexdump.h" alt="" coords="73,352,135,373"/>
<area shape="rect" id="node19" href="$parsetools_8h.html" title="parsetools.h" alt="" coords="187,213,252,235"/>
<area shape="rect" id="node21" href="$controller_enums_8h.html" title="controllerEnums.h" alt="" coords="550,144,636,165"/>
</map>

View file

@ -1 +1 @@
1fe21500c534f0e743d0877bdd624301
6630a4e7e61f93b1abda0bc89fee8c54

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 76 KiB

View file

@ -170,58 +170,61 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<div class="line"><a name="l00158"></a><span class="lineno"> 158</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_p_s3_b_t.html#a6ee74242b0c1644496ff04b457f39cd2">setAllOff</a>();</div>
<div class="line"><a name="l00160"></a><span class="lineno"> 160</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_p_s3_b_t.html#a5c87e7db5311a5d56f78c994b5545e4e">setRumbleOff</a>();</div>
<div class="line"><a name="l00165"></a><span class="lineno"> 165</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_p_s3_b_t.html#ad18e284705a4899d72937b97e27cb0a4">setRumbleOn</a>(<a class="code" href="_p_s3_enums_8h.html#aff4be38428d075a117a5bb7f6209a231">Rumble</a> mode);</div>
<div class="line"><a name="l00170"></a><span class="lineno"> 170</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_p_s3_b_t.html#aa84e4cb30f827c8d8d981c1de82c53ad">setLedOff</a>(<a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6">LED</a> a);</div>
<div class="line"><a name="l00175"></a><span class="lineno"> 175</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_p_s3_b_t.html#ad400e1ce37c2dadd48938187b5021d42">setLedOn</a>(<a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6">LED</a> a);</div>
<div class="line"><a name="l00180"></a><span class="lineno"> 180</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_p_s3_b_t.html#a313d4c962273fc7daccb0319d80c5f61">setLedToggle</a>(<a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6">LED</a> a);</div>
<div class="line"><a name="l00181"></a><span class="lineno"> 181</span>&#160; </div>
<div class="line"><a name="l00186"></a><span class="lineno"> 186</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_p_s3_b_t.html#ad0926b75edcbb12ddf76f78e66728782">moveSetBulb</a>(uint8_t r, uint8_t g, uint8_t b);</div>
<div class="line"><a name="l00191"></a><span class="lineno"> 191</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_p_s3_b_t.html#ad0926b75edcbb12ddf76f78e66728782">moveSetBulb</a>(<a class="code" href="_p_s3_enums_8h.html#a55ecd4f2ec2ebfe8d5b0163e4ac2a967">Colors</a> color);</div>
<div class="line"><a name="l00196"></a><span class="lineno"> 196</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_p_s3_b_t.html#ac14d338ddb573d1c06f70749f9205689">moveSetRumble</a>(uint8_t rumble);</div>
<div class="line"><a name="l00200"></a><span class="lineno"><a class="code" href="class_p_s3_b_t.html#a2804535e3164eafca80a6f6c6bd9a4f9"> 200</a></span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_p_s3_b_t.html#a2804535e3164eafca80a6f6c6bd9a4f9">PS3Connected</a>;</div>
<div class="line"><a name="l00202"></a><span class="lineno"><a class="code" href="class_p_s3_b_t.html#a9273b6796948b83772117b3805421b4a"> 202</a></span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_p_s3_b_t.html#a9273b6796948b83772117b3805421b4a">PS3MoveConnected</a>;</div>
<div class="line"><a name="l00204"></a><span class="lineno"><a class="code" href="class_p_s3_b_t.html#ab35277632083d43f8750d130bea6d430"> 204</a></span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_p_s3_b_t.html#ab35277632083d43f8750d130bea6d430">PS3NavigationConnected</a>;</div>
<div class="line"><a name="l00205"></a><span class="lineno"> 205</span>&#160; </div>
<div class="line"><a name="l00206"></a><span class="lineno"> 206</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00207"></a><span class="lineno"> 207</span>&#160; <span class="comment">/* mandatory members */</span></div>
<div class="line"><a name="l00208"></a><span class="lineno"> 208</span>&#160; <a class="code" href="class_b_t_d.html">BTD</a> *pBtd;</div>
<div class="line"><a name="l00209"></a><span class="lineno"> 209</span>&#160; </div>
<div class="line"><a name="l00210"></a><span class="lineno"> 210</span>&#160; <span class="keywordtype">void</span> L2CAP_task(); <span class="comment">// L2CAP state machine</span></div>
<div class="line"><a name="l00211"></a><span class="lineno"> 211</span>&#160; </div>
<div class="line"><a name="l00212"></a><span class="lineno"> 212</span>&#160; <span class="comment">/* Variables filled from HCI event management */</span></div>
<div class="line"><a name="l00213"></a><span class="lineno"> 213</span>&#160; int16_t hci_handle;</div>
<div class="line"><a name="l00214"></a><span class="lineno"> 214</span>&#160; uint8_t remote_name[30]; <span class="comment">// First 30 chars of remote name</span></div>
<div class="line"><a name="l00215"></a><span class="lineno"> 215</span>&#160; <span class="keywordtype">bool</span> activeConnection; <span class="comment">// Used to indicate if it&#39;s already has established a connection</span></div>
<div class="line"><a name="l00216"></a><span class="lineno"> 216</span>&#160; </div>
<div class="line"><a name="l00217"></a><span class="lineno"> 217</span>&#160; <span class="comment">/* variables used by high level L2CAP task */</span> </div>
<div class="line"><a name="l00218"></a><span class="lineno"> 218</span>&#160; uint8_t l2cap_state;</div>
<div class="line"><a name="l00219"></a><span class="lineno"> 219</span>&#160; uint16_t l2cap_event_flag; <span class="comment">// L2CAP flags of received bluetooth events</span></div>
<div class="line"><a name="l00220"></a><span class="lineno"> 220</span>&#160; </div>
<div class="line"><a name="l00221"></a><span class="lineno"> 221</span>&#160; <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> timer;</div>
<div class="line"><a name="l00222"></a><span class="lineno"> 222</span>&#160; </div>
<div class="line"><a name="l00223"></a><span class="lineno"> 223</span>&#160; uint32_t ButtonState;</div>
<div class="line"><a name="l00224"></a><span class="lineno"> 224</span>&#160; uint32_t OldButtonState;</div>
<div class="line"><a name="l00225"></a><span class="lineno"> 225</span>&#160; uint32_t ButtonClickState;</div>
<div class="line"><a name="l00226"></a><span class="lineno"> 226</span>&#160; </div>
<div class="line"><a name="l00227"></a><span class="lineno"> 227</span>&#160; uint32_t timerHID; <span class="comment">// Timer used see if there has to be a delay before a new HID command</span></div>
<div class="line"><a name="l00228"></a><span class="lineno"> 228</span>&#160; uint32_t timerBulbRumble;<span class="comment">// used to continuously set PS3 Move controller Bulb and rumble values</span></div>
<div class="line"><a name="l00229"></a><span class="lineno"> 229</span>&#160; </div>
<div class="line"><a name="l00230"></a><span class="lineno"> 230</span>&#160; uint8_t l2capinbuf[<a class="code" href="_b_t_d_8h.html#a32d591ef5742a99963130616ef146787">BULK_MAXPKTSIZE</a>]; <span class="comment">// General purpose buffer for L2CAP in data</span></div>
<div class="line"><a name="l00231"></a><span class="lineno"> 231</span>&#160; uint8_t HIDBuffer[<a class="code" href="_p_s3_b_t_8h.html#a465c4c33eae0fd5f934ae12bc8d6ca7e">HID_BUFFERSIZE</a>]; <span class="comment">// Used to store HID commands</span></div>
<div class="line"><a name="l00232"></a><span class="lineno"> 232</span>&#160; uint8_t HIDMoveBuffer[<a class="code" href="_p_s3_b_t_8h.html#a465c4c33eae0fd5f934ae12bc8d6ca7e">HID_BUFFERSIZE</a>]; <span class="comment">// Used to store HID commands for the Move controller </span></div>
<div class="line"><a name="l00233"></a><span class="lineno"> 233</span>&#160; </div>
<div class="line"><a name="l00234"></a><span class="lineno"> 234</span>&#160; <span class="comment">/* L2CAP Channels */</span></div>
<div class="line"><a name="l00235"></a><span class="lineno"> 235</span>&#160; uint8_t control_scid[2]; <span class="comment">// L2CAP source CID for HID_Control </span></div>
<div class="line"><a name="l00236"></a><span class="lineno"> 236</span>&#160; uint8_t control_dcid[2]; <span class="comment">// 0x0040</span></div>
<div class="line"><a name="l00237"></a><span class="lineno"> 237</span>&#160; uint8_t interrupt_scid[2]; <span class="comment">// L2CAP source CID for HID_Interrupt </span></div>
<div class="line"><a name="l00238"></a><span class="lineno"> 238</span>&#160; uint8_t interrupt_dcid[2]; <span class="comment">// 0x0041</span></div>
<div class="line"><a name="l00239"></a><span class="lineno"> 239</span>&#160; uint8_t identifier; <span class="comment">// Identifier for connection </span></div>
<div class="line"><a name="l00173"></a><span class="lineno"> 173</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_p_s3_b_t.html#ad18e284705a4899d72937b97e27cb0a4">setRumbleOn</a>(uint8_t rightDuration, uint8_t rightPower, uint8_t leftDuration, uint8_t leftPower);</div>
<div class="line"><a name="l00174"></a><span class="lineno"> 174</span>&#160;</div>
<div class="line"><a name="l00179"></a><span class="lineno"> 179</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_p_s3_b_t.html#a0acdc09661a8099b2d5e8b59cd8325bb">setLedRaw</a>(uint8_t value);</div>
<div class="line"><a name="l00184"></a><span class="lineno"> 184</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_p_s3_b_t.html#aa84e4cb30f827c8d8d981c1de82c53ad">setLedOff</a>(<a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6">LED</a> a);</div>
<div class="line"><a name="l00189"></a><span class="lineno"> 189</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_p_s3_b_t.html#ad400e1ce37c2dadd48938187b5021d42">setLedOn</a>(<a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6">LED</a> a);</div>
<div class="line"><a name="l00194"></a><span class="lineno"> 194</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_p_s3_b_t.html#a313d4c962273fc7daccb0319d80c5f61">setLedToggle</a>(<a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6">LED</a> a);</div>
<div class="line"><a name="l00195"></a><span class="lineno"> 195</span>&#160;</div>
<div class="line"><a name="l00200"></a><span class="lineno"> 200</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_p_s3_b_t.html#ad0926b75edcbb12ddf76f78e66728782">moveSetBulb</a>(uint8_t r, uint8_t g, uint8_t b);</div>
<div class="line"><a name="l00205"></a><span class="lineno"> 205</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_p_s3_b_t.html#ad0926b75edcbb12ddf76f78e66728782">moveSetBulb</a>(<a class="code" href="_p_s3_enums_8h.html#a55ecd4f2ec2ebfe8d5b0163e4ac2a967">Colors</a> color);</div>
<div class="line"><a name="l00210"></a><span class="lineno"> 210</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_p_s3_b_t.html#ac14d338ddb573d1c06f70749f9205689">moveSetRumble</a>(uint8_t rumble);</div>
<div class="line"><a name="l00214"></a><span class="lineno"><a class="code" href="class_p_s3_b_t.html#a2804535e3164eafca80a6f6c6bd9a4f9"> 214</a></span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_p_s3_b_t.html#a2804535e3164eafca80a6f6c6bd9a4f9">PS3Connected</a>;</div>
<div class="line"><a name="l00216"></a><span class="lineno"><a class="code" href="class_p_s3_b_t.html#a9273b6796948b83772117b3805421b4a"> 216</a></span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_p_s3_b_t.html#a9273b6796948b83772117b3805421b4a">PS3MoveConnected</a>;</div>
<div class="line"><a name="l00218"></a><span class="lineno"><a class="code" href="class_p_s3_b_t.html#ab35277632083d43f8750d130bea6d430"> 218</a></span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_p_s3_b_t.html#ab35277632083d43f8750d130bea6d430">PS3NavigationConnected</a>;</div>
<div class="line"><a name="l00219"></a><span class="lineno"> 219</span>&#160;</div>
<div class="line"><a name="l00220"></a><span class="lineno"> 220</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00221"></a><span class="lineno"> 221</span>&#160; <span class="comment">/* mandatory members */</span></div>
<div class="line"><a name="l00222"></a><span class="lineno"> 222</span>&#160; <a class="code" href="class_b_t_d.html">BTD</a> *pBtd;</div>
<div class="line"><a name="l00223"></a><span class="lineno"> 223</span>&#160;</div>
<div class="line"><a name="l00224"></a><span class="lineno"> 224</span>&#160; <span class="keywordtype">void</span> L2CAP_task(); <span class="comment">// L2CAP state machine</span></div>
<div class="line"><a name="l00225"></a><span class="lineno"> 225</span>&#160;</div>
<div class="line"><a name="l00226"></a><span class="lineno"> 226</span>&#160; <span class="comment">/* Variables filled from HCI event management */</span></div>
<div class="line"><a name="l00227"></a><span class="lineno"> 227</span>&#160; int16_t hci_handle;</div>
<div class="line"><a name="l00228"></a><span class="lineno"> 228</span>&#160; uint8_t remote_name[30]; <span class="comment">// First 30 chars of remote name</span></div>
<div class="line"><a name="l00229"></a><span class="lineno"> 229</span>&#160; <span class="keywordtype">bool</span> activeConnection; <span class="comment">// Used to indicate if it&#39;s already has established a connection</span></div>
<div class="line"><a name="l00230"></a><span class="lineno"> 230</span>&#160;</div>
<div class="line"><a name="l00231"></a><span class="lineno"> 231</span>&#160; <span class="comment">/* variables used by high level L2CAP task */</span></div>
<div class="line"><a name="l00232"></a><span class="lineno"> 232</span>&#160; uint8_t l2cap_state;</div>
<div class="line"><a name="l00233"></a><span class="lineno"> 233</span>&#160; uint16_t l2cap_event_flag; <span class="comment">// L2CAP flags of received bluetooth events</span></div>
<div class="line"><a name="l00234"></a><span class="lineno"> 234</span>&#160;</div>
<div class="line"><a name="l00235"></a><span class="lineno"> 235</span>&#160; <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> timer;</div>
<div class="line"><a name="l00236"></a><span class="lineno"> 236</span>&#160;</div>
<div class="line"><a name="l00237"></a><span class="lineno"> 237</span>&#160; uint32_t ButtonState;</div>
<div class="line"><a name="l00238"></a><span class="lineno"> 238</span>&#160; uint32_t OldButtonState;</div>
<div class="line"><a name="l00239"></a><span class="lineno"> 239</span>&#160; uint32_t ButtonClickState;</div>
<div class="line"><a name="l00240"></a><span class="lineno"> 240</span>&#160;</div>
<div class="line"><a name="l00241"></a><span class="lineno"> 241</span>&#160; <span class="comment">/* HID Commands */</span></div>
<div class="line"><a name="l00242"></a><span class="lineno"> 242</span>&#160; <span class="keywordtype">void</span> HID_Command(uint8_t* data, uint8_t nbytes);</div>
<div class="line"><a name="l00243"></a><span class="lineno"> 243</span>&#160; <span class="keywordtype">void</span> HIDMove_Command(uint8_t* data, uint8_t nbytes);</div>
<div class="line"><a name="l00244"></a><span class="lineno"> 244</span>&#160; <span class="keywordtype">void</span> enable_sixaxis(); <span class="comment">// Command used to enable the Dualshock 3 and Navigation controller to send data via Bluetooth</span></div>
<div class="line"><a name="l00245"></a><span class="lineno"> 245</span>&#160;};</div>
<div class="line"><a name="l00246"></a><span class="lineno"> 246</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00241"></a><span class="lineno"> 241</span>&#160; uint32_t timerHID; <span class="comment">// Timer used see if there has to be a delay before a new HID command</span></div>
<div class="line"><a name="l00242"></a><span class="lineno"> 242</span>&#160; uint32_t timerBulbRumble; <span class="comment">// used to continuously set PS3 Move controller Bulb and rumble values</span></div>
<div class="line"><a name="l00243"></a><span class="lineno"> 243</span>&#160;</div>
<div class="line"><a name="l00244"></a><span class="lineno"> 244</span>&#160; uint8_t l2capinbuf[<a class="code" href="_b_t_d_8h.html#a32d591ef5742a99963130616ef146787">BULK_MAXPKTSIZE</a>]; <span class="comment">// General purpose buffer for L2CAP in data</span></div>
<div class="line"><a name="l00245"></a><span class="lineno"> 245</span>&#160; uint8_t HIDBuffer[<a class="code" href="_p_s3_b_t_8h.html#a465c4c33eae0fd5f934ae12bc8d6ca7e">HID_BUFFERSIZE</a>]; <span class="comment">// Used to store HID commands</span></div>
<div class="line"><a name="l00246"></a><span class="lineno"> 246</span>&#160; uint8_t HIDMoveBuffer[<a class="code" href="_p_s3_b_t_8h.html#a465c4c33eae0fd5f934ae12bc8d6ca7e">HID_BUFFERSIZE</a>]; <span class="comment">// Used to store HID commands for the Move controller</span></div>
<div class="line"><a name="l00247"></a><span class="lineno"> 247</span>&#160;</div>
<div class="line"><a name="l00248"></a><span class="lineno"> 248</span>&#160; <span class="comment">/* L2CAP Channels */</span></div>
<div class="line"><a name="l00249"></a><span class="lineno"> 249</span>&#160; uint8_t control_scid[2]; <span class="comment">// L2CAP source CID for HID_Control</span></div>
<div class="line"><a name="l00250"></a><span class="lineno"> 250</span>&#160; uint8_t control_dcid[2]; <span class="comment">// 0x0040</span></div>
<div class="line"><a name="l00251"></a><span class="lineno"> 251</span>&#160; uint8_t interrupt_scid[2]; <span class="comment">// L2CAP source CID for HID_Interrupt</span></div>
<div class="line"><a name="l00252"></a><span class="lineno"> 252</span>&#160; uint8_t interrupt_dcid[2]; <span class="comment">// 0x0041</span></div>
<div class="line"><a name="l00253"></a><span class="lineno"> 253</span>&#160; uint8_t identifier; <span class="comment">// Identifier for connection</span></div>
<div class="line"><a name="l00254"></a><span class="lineno"> 254</span>&#160;</div>
<div class="line"><a name="l00255"></a><span class="lineno"> 255</span>&#160; <span class="comment">/* HID Commands */</span></div>
<div class="line"><a name="l00256"></a><span class="lineno"> 256</span>&#160; <span class="keywordtype">void</span> HID_Command(uint8_t* data, uint8_t nbytes);</div>
<div class="line"><a name="l00257"></a><span class="lineno"> 257</span>&#160; <span class="keywordtype">void</span> HIDMove_Command(uint8_t* data, uint8_t nbytes);</div>
<div class="line"><a name="l00258"></a><span class="lineno"> 258</span>&#160; <span class="keywordtype">void</span> enable_sixaxis(); <span class="comment">// Command used to enable the Dualshock 3 and Navigation controller to send data via Bluetooth</span></div>
<div class="line"><a name="l00259"></a><span class="lineno"> 259</span>&#160;};</div>
<div class="line"><a name="l00260"></a><span class="lineno"> 260</span>&#160;<span class="preprocessor">#endif</span></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>

View file

@ -185,8 +185,12 @@ Enumerations</h2></td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="var-members"></a>
Variables</h2></td></tr>
<tr class="memitem:aefe67abcaf27811cfe8d010add39ae4e"><td class="memItemLeft" align="right" valign="top">const uint8_t LEDS[]&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_p_s3_enums_8h.html#aefe67abcaf27811cfe8d010add39ae4e">PROGMEM</a></td></tr>
<tr class="separator:aefe67abcaf27811cfe8d010add39ae4e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af83672eccf0c7a02847ce75bc5c55a1a"><td class="memItemLeft" align="right" valign="top">const uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_p_s3_enums_8h.html#af83672eccf0c7a02847ce75bc5c55a1a">LEDS</a> []</td></tr>
<tr class="separator:af83672eccf0c7a02847ce75bc5c55a1a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af3392eea150ac9151bef45148f0d7895"><td class="memItemLeft" align="right" valign="top">const uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_p_s3_enums_8h.html#af3392eea150ac9151bef45148f0d7895">BUTTONS</a> []</td></tr>
<tr class="separator:af3392eea150ac9151bef45148f0d7895"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abb19c2ede75659ab3b926996a8a09f2f"><td class="memItemLeft" align="right" valign="top">const uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_p_s3_enums_8h.html#abb19c2ede75659ab3b926996a8a09f2f">ANALOGBUTTONS</a> []</td></tr>
<tr class="separator:abb19c2ede75659ab3b926996a8a09f2f"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Enumeration Type Documentation</h2>
<a class="anchor" id="a55ecd4f2ec2ebfe8d5b0163e4ac2a967"></a>
@ -307,7 +311,7 @@ Variables</h2></td></tr>
</td></tr>
</table>
<p>Definition at line <a class="el" href="_p_s3_enums_8h_source.html#l00157">157</a> of file <a class="el" href="_p_s3_enums_8h_source.html">PS3Enums.h</a>.</p>
<p>Definition at line <a class="el" href="_p_s3_enums_8h_source.html#l00158">158</a> of file <a class="el" href="_p_s3_enums_8h_source.html">PS3Enums.h</a>.</p>
</div>
</div>
@ -363,7 +367,7 @@ Variables</h2></td></tr>
</td></tr>
</table>
<p>Definition at line <a class="el" href="_p_s3_enums_8h_source.html#l00161">161</a> of file <a class="el" href="_p_s3_enums_8h_source.html">PS3Enums.h</a>.</p>
<p>Definition at line <a class="el" href="_p_s3_enums_8h_source.html#l00163">163</a> of file <a class="el" href="_p_s3_enums_8h_source.html">PS3Enums.h</a>.</p>
</div>
</div>
@ -383,17 +387,17 @@ Variables</h2></td></tr>
</td></tr>
</table>
<p>Definition at line <a class="el" href="_p_s3_enums_8h_source.html#l00188">188</a> of file <a class="el" href="_p_s3_enums_8h_source.html">PS3Enums.h</a>.</p>
<p>Definition at line <a class="el" href="_p_s3_enums_8h_source.html#l00191">191</a> of file <a class="el" href="_p_s3_enums_8h_source.html">PS3Enums.h</a>.</p>
</div>
</div>
<h2 class="groupheader">Variable Documentation</h2>
<a class="anchor" id="aefe67abcaf27811cfe8d010add39ae4e"></a>
<a class="anchor" id="af83672eccf0c7a02847ce75bc5c55a1a"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">const uint8_t ANALOGBUTTONS [] PROGMEM</td>
<td class="memname">const uint8_t LEDS[]</td>
</tr>
</table>
</div><div class="memdoc">
@ -411,13 +415,86 @@ Variables</h2></td></tr>
<div class="line"> 0x0F </div>
<div class="line">}</div>
</div><!-- fragment --><p>Used to set the LEDs on the controllers </p>
<p>Buttons on the controllers</p>
<p><b>Note:</b> that the location is shiftet 9 when it's connected via <a class="el" href="class_u_s_b.html">USB</a>.</p>
<p>Analog buttons on the controllers</p>
<p><b>Note:</b> that the location is shiftet 9 when it's connected via <a class="el" href="class_u_s_b.html">USB</a>. </p>
<p>Definition at line <a class="el" href="_p_s3_enums_8h_source.html#l00024">24</a> of file <a class="el" href="_p_s3_enums_8h_source.html">PS3Enums.h</a>.</p>
</div>
</div>
<a class="anchor" id="af3392eea150ac9151bef45148f0d7895"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">const uint32_t BUTTONS[]</td>
</tr>
</table>
</div><div class="memdoc">
<b>Initial value:</b><div class="fragment"><div class="line">= {</div>
<div class="line"> 0x10, </div>
<div class="line"> 0x20, </div>
<div class="line"> 0x40, </div>
<div class="line"> 0x80, </div>
<div class="line"></div>
<div class="line"> 0x01, </div>
<div class="line"> 0x08, </div>
<div class="line"> 0x02, </div>
<div class="line"> 0x04, </div>
<div class="line"></div>
<div class="line"> 0x0100, </div>
<div class="line"> 0x0200, </div>
<div class="line"> 0x0400, </div>
<div class="line"> 0x0800, </div>
<div class="line"></div>
<div class="line"> 0x1000, </div>
<div class="line"> 0x2000, </div>
<div class="line"> 0x4000, </div>
<div class="line"> 0x8000, </div>
<div class="line"></div>
<div class="line"> 0x010000, </div>
<div class="line"> 0x080000, </div>
<div class="line"> 0x100000 </div>
<div class="line">}</div>
</div><!-- fragment --><p>Buttons on the controllers</p>
<p><b>Note:</b> that the location is shiftet 9 when it's connected via <a class="el" href="class_u_s_b.html">USB</a>. </p>
<p>Definition at line <a class="el" href="_p_s3_enums_8h_source.html#l00043">43</a> of file <a class="el" href="_p_s3_enums_8h_source.html">PS3Enums.h</a>.</p>
</div>
</div>
<a class="anchor" id="abb19c2ede75659ab3b926996a8a09f2f"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">const uint8_t ANALOGBUTTONS[]</td>
</tr>
</table>
</div><div class="memdoc">
<b>Initial value:</b><div class="fragment"><div class="line">= {</div>
<div class="line"> 23, </div>
<div class="line"> 24, </div>
<div class="line"> 25, </div>
<div class="line"> 26, </div>
<div class="line"> 0, 0, 0, 0, </div>
<div class="line"></div>
<div class="line"> 27, </div>
<div class="line"> 28, </div>
<div class="line"> 29, </div>
<div class="line"> 30, </div>
<div class="line"> 31, </div>
<div class="line"> 32, </div>
<div class="line"> 33, </div>
<div class="line"> 34, </div>
<div class="line"> 0, 0, </div>
<div class="line"></div>
<div class="line"> </div>
<div class="line"> 15 </div>
<div class="line">}</div>
</div><!-- fragment --><p>Analog buttons on the controllers</p>
<p><b>Note:</b> that the location is shiftet 9 when it's connected via <a class="el" href="class_u_s_b.html">USB</a>. </p>
<p>Definition at line <a class="el" href="_p_s3_enums_8h_source.html#l00074">74</a> of file <a class="el" href="_p_s3_enums_8h_source.html">PS3Enums.h</a>.</p>
</div>
</div>
</div><!-- contents -->

View file

@ -111,7 +111,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="controller_enums_8h.html">controllerEnums.h</a>&quot;</span></div>
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span>&#160;</div>
<div class="line"><a name="l00024"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#aefe67abcaf27811cfe8d010add39ae4e"> 24</a></span>&#160;<span class="keyword">const</span> uint8_t LEDS[] <a class="code" href="hidboot_8cpp.html#ad1eb9d7b0347c20d121c984618c442f0">PROGMEM</a> = {</div>
<div class="line"><a name="l00024"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#af83672eccf0c7a02847ce75bc5c55a1a"> 24</a></span>&#160;<span class="keyword">const</span> uint8_t <a class="code" href="_p_s3_enums_8h.html#af83672eccf0c7a02847ce75bc5c55a1a">LEDS</a>[] PROGMEM = {</div>
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span>&#160; 0x01, <span class="comment">// LED1</span></div>
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span>&#160; 0x02, <span class="comment">// LED2</span></div>
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span>&#160; 0x04, <span class="comment">// LED3</span></div>
@ -125,7 +125,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span>&#160; 0x0F <span class="comment">// LED10</span></div>
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span>&#160;};</div>
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span>&#160;</div>
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span>&#160;<span class="keyword">const</span> uint32_t BUTTONS[] <a class="code" href="hidboot_8cpp.html#ad1eb9d7b0347c20d121c984618c442f0">PROGMEM</a> = {</div>
<div class="line"><a name="l00043"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#af3392eea150ac9151bef45148f0d7895"> 43</a></span>&#160;<span class="keyword">const</span> uint32_t <a class="code" href="_p_s3_enums_8h.html#af3392eea150ac9151bef45148f0d7895">BUTTONS</a>[] PROGMEM = {</div>
<div class="line"><a name="l00044"></a><span class="lineno"> 44</span>&#160; 0x10, <span class="comment">// UP</span></div>
<div class="line"><a name="l00045"></a><span class="lineno"> 45</span>&#160; 0x20, <span class="comment">// RIGHT</span></div>
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span>&#160; 0x40, <span class="comment">// DOWN</span></div>
@ -151,7 +151,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>&#160; 0x100000 <span class="comment">// T - covers 12 bits - we only need to read the top 8</span></div>
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span>&#160;};</div>
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>&#160;</div>
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span>&#160;<span class="keyword">const</span> uint8_t ANALOGBUTTONS[] <a class="code" href="hidboot_8cpp.html#ad1eb9d7b0347c20d121c984618c442f0">PROGMEM</a> = {</div>
<div class="line"><a name="l00074"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#abb19c2ede75659ab3b926996a8a09f2f"> 74</a></span>&#160;<span class="keyword">const</span> uint8_t <a class="code" href="_p_s3_enums_8h.html#abb19c2ede75659ab3b926996a8a09f2f">ANALOGBUTTONS</a>[] PROGMEM = {</div>
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span>&#160; 23, <span class="comment">// UP_ANALOG</span></div>
<div class="line"><a name="l00076"></a><span class="lineno"> 76</span>&#160; 24, <span class="comment">// RIGHT_ANALOG</span></div>
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span>&#160; 25, <span class="comment">// DOWN_ANALOG</span></div>
@ -205,43 +205,46 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<div class="line"><a name="l00152"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#a9628766e5f200cc84b296b071b09ff4aa1b4c8ce0561fd9c003a6389d7c6fb503"> 152</a></span>&#160; <a class="code" href="_p_s3_enums_8h.html#a9628766e5f200cc84b296b071b09ff4aa1b4c8ce0561fd9c003a6389d7c6fb503">mZmove</a> = 49,</div>
<div class="line"><a name="l00154"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#a9628766e5f200cc84b296b071b09ff4aaee1254b85fe360243299d2041323aa78"> 154</a></span>&#160; <a class="code" href="_p_s3_enums_8h.html#a9628766e5f200cc84b296b071b09ff4aaee1254b85fe360243299d2041323aa78">mYmove</a> = 50,</div>
<div class="line"><a name="l00155"></a><span class="lineno"> 155</span>&#160;};</div>
<div class="line"><a name="l00157"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#a0200d2d1b3a7930d0be6c50e7c8ae7d1"> 157</a></span>&#160;<span class="keyword">enum</span> <a class="code" href="_p_s3_enums_8h.html#a0200d2d1b3a7930d0be6c50e7c8ae7d1">Angle</a> {</div>
<div class="line"><a name="l00158"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#a0200d2d1b3a7930d0be6c50e7c8ae7d1ae3a34b760fa4a6854f28852e91d8bb47"> 158</a></span>&#160; <a class="code" href="_p_s3_enums_8h.html#a0200d2d1b3a7930d0be6c50e7c8ae7d1ae3a34b760fa4a6854f28852e91d8bb47">Pitch</a> = 0x01,</div>
<div class="line"><a name="l00159"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#a0200d2d1b3a7930d0be6c50e7c8ae7d1a9d80e5f030503ccac779c6491826a173"> 159</a></span>&#160; <a class="code" href="_p_s3_enums_8h.html#a0200d2d1b3a7930d0be6c50e7c8ae7d1a9d80e5f030503ccac779c6491826a173">Roll</a> = 0x02,</div>
<div class="line"><a name="l00160"></a><span class="lineno"> 160</span>&#160;};</div>
<div class="line"><a name="l00161"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70b"> 161</a></span>&#160;<span class="keyword">enum</span> <a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70b">Status</a> {</div>
<div class="line"><a name="l00162"></a><span class="lineno"> 162</span>&#160; <span class="comment">// Note that the location is shiftet 9 when it&#39;s connected via USB</span></div>
<div class="line"><a name="l00163"></a><span class="lineno"> 163</span>&#160; <span class="comment">// Byte location | bit location</span></div>
<div class="line"><a name="l00164"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70baff01ce39b42bec30132b0fc53c882387"> 164</a></span>&#160; <a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70baff01ce39b42bec30132b0fc53c882387">Plugged</a> = (38 &lt;&lt; 8) | 0x02,</div>
<div class="line"><a name="l00165"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70bae37160f3a65bb54a91fb5efb4f971924"> 165</a></span>&#160; <a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70bae37160f3a65bb54a91fb5efb4f971924">Unplugged</a> = (38 &lt;&lt; 8) | 0x03,</div>
<div class="line"><a name="l00166"></a><span class="lineno"> 166</span>&#160; </div>
<div class="line"><a name="l00167"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba5a86ae1482947377a116685c168d1773"> 167</a></span>&#160; <a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba5a86ae1482947377a116685c168d1773">Charging</a> = (39 &lt;&lt; 8) | 0xEE,</div>
<div class="line"><a name="l00168"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70bac138cecbd4ef1ba0f9e0ab12440a6df6"> 168</a></span>&#160; <a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70bac138cecbd4ef1ba0f9e0ab12440a6df6">NotCharging</a> = (39 &lt;&lt; 8) | 0xF1,</div>
<div class="line"><a name="l00169"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba82084136e62c38642986b05419b4e734"> 169</a></span>&#160; <a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba82084136e62c38642986b05419b4e734">Shutdown</a> = (39 &lt;&lt; 8) | 0x01,</div>
<div class="line"><a name="l00170"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba96cc2a0090ada376561406d48d1f2089"> 170</a></span>&#160; <a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba96cc2a0090ada376561406d48d1f2089">Dying</a> = (39 &lt;&lt; 8) | 0x02,</div>
<div class="line"><a name="l00171"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba7a352a3dd2accc1dd65a4538c3754ee8"> 171</a></span>&#160; <a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba7a352a3dd2accc1dd65a4538c3754ee8">Low</a> = (39 &lt;&lt; 8) | 0x03,</div>
<div class="line"><a name="l00172"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba24c57acd029e3f96fede49402ea01e6f"> 172</a></span>&#160; <a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba24c57acd029e3f96fede49402ea01e6f">High</a> = (39 &lt;&lt; 8) | 0x04,</div>
<div class="line"><a name="l00173"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba8b7c5cd8bd8eb51ee6d3fd0eac584679"> 173</a></span>&#160; <a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba8b7c5cd8bd8eb51ee6d3fd0eac584679">Full</a> = (39 &lt;&lt; 8) | 0x05,</div>
<div class="line"><a name="l00174"></a><span class="lineno"> 174</span>&#160; </div>
<div class="line"><a name="l00175"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba1a18b1e66913bf3103ec5f81a124d030"> 175</a></span>&#160; <a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba1a18b1e66913bf3103ec5f81a124d030">MoveCharging</a> = (21 &lt;&lt; 8) | 0xEE,</div>
<div class="line"><a name="l00176"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70baa66a4c4924065859bcee07c677554e2a"> 176</a></span>&#160; <a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70baa66a4c4924065859bcee07c677554e2a">MoveNotCharging</a> = (21 &lt;&lt; 8) | 0xF1,</div>
<div class="line"><a name="l00177"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba90b649581a499e75735f153a32dfd71c"> 177</a></span>&#160; <a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba90b649581a499e75735f153a32dfd71c">MoveShutdown</a> = (21 &lt;&lt; 8) | 0x01,</div>
<div class="line"><a name="l00178"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba74ec9082d76bf71ae74ad5d948c311f8"> 178</a></span>&#160; <a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba74ec9082d76bf71ae74ad5d948c311f8">MoveDying</a> = (21 &lt;&lt; 8) | 0x02,</div>
<div class="line"><a name="l00179"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba429562e406bab9f30a0290306c6abdbf"> 179</a></span>&#160; <a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba429562e406bab9f30a0290306c6abdbf">MoveLow</a> = (21 &lt;&lt; 8) | 0x03,</div>
<div class="line"><a name="l00180"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba7719066bf7a360dfe51ccbf81a148bcb"> 180</a></span>&#160; <a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba7719066bf7a360dfe51ccbf81a148bcb">MoveHigh</a> = (21 &lt;&lt; 8) | 0x04,</div>
<div class="line"><a name="l00181"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70baccd6c38d1a97db0feafc9f88909ce943"> 181</a></span>&#160; <a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70baccd6c38d1a97db0feafc9f88909ce943">MoveFull</a> = (21 &lt;&lt; 8) | 0x05,</div>
<div class="line"><a name="l00182"></a><span class="lineno"> 182</span>&#160; </div>
<div class="line"><a name="l00183"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba71c14aef95c9953673a880e2633fa209"> 183</a></span>&#160; <a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba71c14aef95c9953673a880e2633fa209">CableRumble</a> = (40 &lt;&lt; 8) | 0x10,<span class="comment">//Opperating by USB and rumble is turned on</span></div>
<div class="line"><a name="l00184"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba1a36ca9a60a5e244f3404ec0db7b44a1"> 184</a></span>&#160; <a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba1a36ca9a60a5e244f3404ec0db7b44a1">Cable</a> = (40 &lt;&lt; 8) | 0x12,<span class="comment">//Opperating by USB and rumble is turned off</span></div>
<div class="line"><a name="l00185"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba27912f9ea05a45aada21fc375817342c"> 185</a></span>&#160; <a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba27912f9ea05a45aada21fc375817342c">BluetoothRumble</a> = (40 &lt;&lt; 8) | 0x14,<span class="comment">//Opperating by bluetooth and rumble is turned on</span></div>
<div class="line"><a name="l00186"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba730728c9aac83393ac83f96a8125b8bb"> 186</a></span>&#160; <a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba730728c9aac83393ac83f96a8125b8bb">Bluetooth</a> = (40 &lt;&lt; 8) | 0x16,<span class="comment">//Opperating by bluetooth and rumble is turned off</span></div>
<div class="line"><a name="l00187"></a><span class="lineno"> 187</span>&#160;};</div>
<div class="line"><a name="l00188"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#aff4be38428d075a117a5bb7f6209a231"> 188</a></span>&#160;<span class="keyword">enum</span> <a class="code" href="_p_s3_enums_8h.html#aff4be38428d075a117a5bb7f6209a231">Rumble</a> { </div>
<div class="line"><a name="l00189"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#aff4be38428d075a117a5bb7f6209a231a5819f165165589a8e65b07bf46c7382b"> 189</a></span>&#160; <a class="code" href="_p_s3_enums_8h.html#aff4be38428d075a117a5bb7f6209a231a5819f165165589a8e65b07bf46c7382b">RumbleHigh</a> = 0x10,</div>
<div class="line"><a name="l00190"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#aff4be38428d075a117a5bb7f6209a231a080b52389e532b79b9e48f43ae6086ac"> 190</a></span>&#160; <a class="code" href="_p_s3_enums_8h.html#aff4be38428d075a117a5bb7f6209a231a080b52389e532b79b9e48f43ae6086ac">RumbleLow</a> = 0x20,</div>
<div class="line"><a name="l00191"></a><span class="lineno"> 191</span>&#160;};</div>
<div class="line"><a name="l00192"></a><span class="lineno"> 192</span>&#160;</div>
<div class="line"><a name="l00193"></a><span class="lineno"> 193</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00156"></a><span class="lineno"> 156</span>&#160;</div>
<div class="line"><a name="l00158"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#a0200d2d1b3a7930d0be6c50e7c8ae7d1"> 158</a></span>&#160;<span class="keyword">enum</span> <a class="code" href="_p_s3_enums_8h.html#a0200d2d1b3a7930d0be6c50e7c8ae7d1">Angle</a> {</div>
<div class="line"><a name="l00159"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#a0200d2d1b3a7930d0be6c50e7c8ae7d1ae3a34b760fa4a6854f28852e91d8bb47"> 159</a></span>&#160; <a class="code" href="_p_s3_enums_8h.html#a0200d2d1b3a7930d0be6c50e7c8ae7d1ae3a34b760fa4a6854f28852e91d8bb47">Pitch</a> = 0x01,</div>
<div class="line"><a name="l00160"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#a0200d2d1b3a7930d0be6c50e7c8ae7d1a9d80e5f030503ccac779c6491826a173"> 160</a></span>&#160; <a class="code" href="_p_s3_enums_8h.html#a0200d2d1b3a7930d0be6c50e7c8ae7d1a9d80e5f030503ccac779c6491826a173">Roll</a> = 0x02,</div>
<div class="line"><a name="l00161"></a><span class="lineno"> 161</span>&#160;};</div>
<div class="line"><a name="l00162"></a><span class="lineno"> 162</span>&#160;</div>
<div class="line"><a name="l00163"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70b"> 163</a></span>&#160;<span class="keyword">enum</span> <a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70b">Status</a> {</div>
<div class="line"><a name="l00164"></a><span class="lineno"> 164</span>&#160; <span class="comment">// Note that the location is shiftet 9 when it&#39;s connected via USB</span></div>
<div class="line"><a name="l00165"></a><span class="lineno"> 165</span>&#160; <span class="comment">// Byte location | bit location</span></div>
<div class="line"><a name="l00166"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70baff01ce39b42bec30132b0fc53c882387"> 166</a></span>&#160; <a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70baff01ce39b42bec30132b0fc53c882387">Plugged</a> = (38 &lt;&lt; 8) | 0x02,</div>
<div class="line"><a name="l00167"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70bae37160f3a65bb54a91fb5efb4f971924"> 167</a></span>&#160; <a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70bae37160f3a65bb54a91fb5efb4f971924">Unplugged</a> = (38 &lt;&lt; 8) | 0x03,</div>
<div class="line"><a name="l00168"></a><span class="lineno"> 168</span>&#160;</div>
<div class="line"><a name="l00169"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba5a86ae1482947377a116685c168d1773"> 169</a></span>&#160; <a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba5a86ae1482947377a116685c168d1773">Charging</a> = (39 &lt;&lt; 8) | 0xEE,</div>
<div class="line"><a name="l00170"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70bac138cecbd4ef1ba0f9e0ab12440a6df6"> 170</a></span>&#160; <a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70bac138cecbd4ef1ba0f9e0ab12440a6df6">NotCharging</a> = (39 &lt;&lt; 8) | 0xF1,</div>
<div class="line"><a name="l00171"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba82084136e62c38642986b05419b4e734"> 171</a></span>&#160; <a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba82084136e62c38642986b05419b4e734">Shutdown</a> = (39 &lt;&lt; 8) | 0x01,</div>
<div class="line"><a name="l00172"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba96cc2a0090ada376561406d48d1f2089"> 172</a></span>&#160; <a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba96cc2a0090ada376561406d48d1f2089">Dying</a> = (39 &lt;&lt; 8) | 0x02,</div>
<div class="line"><a name="l00173"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba7a352a3dd2accc1dd65a4538c3754ee8"> 173</a></span>&#160; <a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba7a352a3dd2accc1dd65a4538c3754ee8">Low</a> = (39 &lt;&lt; 8) | 0x03,</div>
<div class="line"><a name="l00174"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba24c57acd029e3f96fede49402ea01e6f"> 174</a></span>&#160; <a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba24c57acd029e3f96fede49402ea01e6f">High</a> = (39 &lt;&lt; 8) | 0x04,</div>
<div class="line"><a name="l00175"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba8b7c5cd8bd8eb51ee6d3fd0eac584679"> 175</a></span>&#160; <a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba8b7c5cd8bd8eb51ee6d3fd0eac584679">Full</a> = (39 &lt;&lt; 8) | 0x05,</div>
<div class="line"><a name="l00176"></a><span class="lineno"> 176</span>&#160;</div>
<div class="line"><a name="l00177"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba1a18b1e66913bf3103ec5f81a124d030"> 177</a></span>&#160; <a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba1a18b1e66913bf3103ec5f81a124d030">MoveCharging</a> = (21 &lt;&lt; 8) | 0xEE,</div>
<div class="line"><a name="l00178"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70baa66a4c4924065859bcee07c677554e2a"> 178</a></span>&#160; <a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70baa66a4c4924065859bcee07c677554e2a">MoveNotCharging</a> = (21 &lt;&lt; 8) | 0xF1,</div>
<div class="line"><a name="l00179"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba90b649581a499e75735f153a32dfd71c"> 179</a></span>&#160; <a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba90b649581a499e75735f153a32dfd71c">MoveShutdown</a> = (21 &lt;&lt; 8) | 0x01,</div>
<div class="line"><a name="l00180"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba74ec9082d76bf71ae74ad5d948c311f8"> 180</a></span>&#160; <a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba74ec9082d76bf71ae74ad5d948c311f8">MoveDying</a> = (21 &lt;&lt; 8) | 0x02,</div>
<div class="line"><a name="l00181"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba429562e406bab9f30a0290306c6abdbf"> 181</a></span>&#160; <a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba429562e406bab9f30a0290306c6abdbf">MoveLow</a> = (21 &lt;&lt; 8) | 0x03,</div>
<div class="line"><a name="l00182"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba7719066bf7a360dfe51ccbf81a148bcb"> 182</a></span>&#160; <a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba7719066bf7a360dfe51ccbf81a148bcb">MoveHigh</a> = (21 &lt;&lt; 8) | 0x04,</div>
<div class="line"><a name="l00183"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70baccd6c38d1a97db0feafc9f88909ce943"> 183</a></span>&#160; <a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70baccd6c38d1a97db0feafc9f88909ce943">MoveFull</a> = (21 &lt;&lt; 8) | 0x05,</div>
<div class="line"><a name="l00184"></a><span class="lineno"> 184</span>&#160;</div>
<div class="line"><a name="l00185"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba71c14aef95c9953673a880e2633fa209"> 185</a></span>&#160; <a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba71c14aef95c9953673a880e2633fa209">CableRumble</a> = (40 &lt;&lt; 8) | 0x10, <span class="comment">//Opperating by USB and rumble is turned on</span></div>
<div class="line"><a name="l00186"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba1a36ca9a60a5e244f3404ec0db7b44a1"> 186</a></span>&#160; <a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba1a36ca9a60a5e244f3404ec0db7b44a1">Cable</a> = (40 &lt;&lt; 8) | 0x12, <span class="comment">//Opperating by USB and rumble is turned off</span></div>
<div class="line"><a name="l00187"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba27912f9ea05a45aada21fc375817342c"> 187</a></span>&#160; <a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba27912f9ea05a45aada21fc375817342c">BluetoothRumble</a> = (40 &lt;&lt; 8) | 0x14, <span class="comment">//Opperating by bluetooth and rumble is turned on</span></div>
<div class="line"><a name="l00188"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba730728c9aac83393ac83f96a8125b8bb"> 188</a></span>&#160; <a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba730728c9aac83393ac83f96a8125b8bb">Bluetooth</a> = (40 &lt;&lt; 8) | 0x16, <span class="comment">//Opperating by bluetooth and rumble is turned off</span></div>
<div class="line"><a name="l00189"></a><span class="lineno"> 189</span>&#160;};</div>
<div class="line"><a name="l00190"></a><span class="lineno"> 190</span>&#160;</div>
<div class="line"><a name="l00191"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#aff4be38428d075a117a5bb7f6209a231"> 191</a></span>&#160;<span class="keyword">enum</span> <a class="code" href="_p_s3_enums_8h.html#aff4be38428d075a117a5bb7f6209a231">Rumble</a> {</div>
<div class="line"><a name="l00192"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#aff4be38428d075a117a5bb7f6209a231a5819f165165589a8e65b07bf46c7382b"> 192</a></span>&#160; <a class="code" href="_p_s3_enums_8h.html#aff4be38428d075a117a5bb7f6209a231a5819f165165589a8e65b07bf46c7382b">RumbleHigh</a> = 0x10,</div>
<div class="line"><a name="l00193"></a><span class="lineno"><a class="code" href="_p_s3_enums_8h.html#aff4be38428d075a117a5bb7f6209a231a080b52389e532b79b9e48f43ae6086ac"> 193</a></span>&#160; <a class="code" href="_p_s3_enums_8h.html#aff4be38428d075a117a5bb7f6209a231a080b52389e532b79b9e48f43ae6086ac">RumbleLow</a> = 0x20,</div>
<div class="line"><a name="l00194"></a><span class="lineno"> 194</span>&#160;};</div>
<div class="line"><a name="l00195"></a><span class="lineno"> 195</span>&#160;</div>
<div class="line"><a name="l00196"></a><span class="lineno"> 196</span>&#160;<span class="preprocessor">#endif</span></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>

View file

@ -98,7 +98,7 @@ Include dependency graph for PS3USB.cpp:</div>
<div class="dyncontent">
<div class="center"><img src="_p_s3_u_s_b_8cpp__incl.png" border="0" usemap="#_p_s3_u_s_b_8cpp" alt=""/></div>
<map name="_p_s3_u_s_b_8cpp" id="_p_s3_u_s_b_8cpp">
<area shape="rect" id="node2" href="_p_s3_u_s_b_8h.html" title="PS3USB.h" alt="" coords="726,75,785,96"/><area shape="rect" id="node4" href="_usb_8h.html" title="Usb.h" alt="" coords="397,144,440,165"/><area shape="rect" id="node18" href="_p_s3_enums_8h.html" title="PS3Enums.h" alt="" coords="797,144,866,165"/><area shape="rect" id="node7" href="avrpins_8h.html" title="avrpins.h" alt="" coords="528,283,582,304"/><area shape="rect" id="node9" href="max3421e_8h.html" title="max3421e.h" alt="" coords="146,283,213,304"/><area shape="rect" id="node10" href="usbhost_8h.html" title="usbhost.h" alt="" coords="212,213,269,235"/><area shape="rect" id="node11" href="usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="237,283,296,304"/><area shape="rect" id="node12" href="address_8h.html" title="address.h" alt="" coords="79,213,136,235"/><area shape="rect" id="node14" href="printhex_8h.html" title="printhex.h" alt="" coords="608,283,665,304"/><area shape="rect" id="node15" href="hexdump_8h.html" title="hexdump.h" alt="" coords="430,213,492,235"/><area shape="rect" id="node17" href="message_8h.html" title="message.h" alt="" coords="345,213,406,235"/><area shape="rect" id="node19" href="controller_enums_8h.html" title="controllerEnums.h" alt="" coords="794,213,880,235"/></map>
<area shape="rect" id="node2" href="_p_s3_u_s_b_8h.html" title="PS3USB.h" alt="" coords="441,75,500,96"/><area shape="rect" id="node4" href="_usb_8h.html" title="Usb.h" alt="" coords="449,144,492,165"/><area shape="rect" id="node18" href="_p_s3_enums_8h.html" title="PS3Enums.h" alt="" coords="653,144,723,165"/><area shape="rect" id="node7" href="avrpins_8h.html" title="avrpins.h" alt="" coords="474,283,528,304"/><area shape="rect" id="node9" href="max3421e_8h.html" title="max3421e.h" alt="" coords="553,283,620,304"/><area shape="rect" id="node10" href="usbhost_8h.html" title="usbhost.h" alt="" coords="442,213,499,235"/><area shape="rect" id="node11" href="usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="391,283,449,304"/><area shape="rect" id="node12" href="address_8h.html" title="address.h" alt="" coords="701,213,757,235"/><area shape="rect" id="node14" href="message_8h.html" title="message.h" alt="" coords="204,213,265,235"/><area shape="rect" id="node16" href="printhex_8h.html" title="printhex.h" alt="" coords="71,283,128,304"/><area shape="rect" id="node17" href="hexdump_8h.html" title="hexdump.h" alt="" coords="204,283,265,304"/><area shape="rect" id="node19" href="controller_enums_8h.html" title="controllerEnums.h" alt="" coords="782,213,868,235"/></map>
</div>
</div>
<p><a href="_p_s3_u_s_b_8cpp_source.html">Go to the source code of this file.</a></p>
@ -110,8 +110,10 @@ Macros</h2></td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="var-members"></a>
Variables</h2></td></tr>
<tr class="memitem:a5442183aed6e48d11b22eb790351a5cd"><td class="memItemLeft" align="right" valign="top">const uint8_t PS3_REPORT_BUFFER[]&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_p_s3_u_s_b_8cpp.html#a5442183aed6e48d11b22eb790351a5cd">PROGMEM</a></td></tr>
<tr class="separator:a5442183aed6e48d11b22eb790351a5cd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8cf62ee374ebaa5f7582c073e624bc74"><td class="memItemLeft" align="right" valign="top">const uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_p_s3_u_s_b_8cpp.html#a8cf62ee374ebaa5f7582c073e624bc74">PS3_REPORT_BUFFER</a> []</td></tr>
<tr class="separator:a8cf62ee374ebaa5f7582c073e624bc74"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1417ae57ea78c9a70a275149e90d2d5d"><td class="memItemLeft" align="right" valign="top">const uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_p_s3_u_s_b_8cpp.html#a1417ae57ea78c9a70a275149e90d2d5d">MOVE_REPORT_BUFFER</a> []</td></tr>
<tr class="separator:a1417ae57ea78c9a70a275149e90d2d5d"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Macro Definition Documentation</h2>
<a class="anchor" id="ad72dbcf6d0153db1b8d8a58001feed83"></a>
@ -129,12 +131,12 @@ Variables</h2></td></tr>
</div>
</div>
<h2 class="groupheader">Variable Documentation</h2>
<a class="anchor" id="a5442183aed6e48d11b22eb790351a5cd"></a>
<a class="anchor" id="a8cf62ee374ebaa5f7582c073e624bc74"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">const uint8_t MOVE_REPORT_BUFFER [] PROGMEM</td>
<td class="memname">const uint8_t PS3_REPORT_BUFFER[]</td>
</tr>
</table>
</div><div class="memdoc">
@ -152,6 +154,26 @@ Variables</h2></td></tr>
</div><!-- fragment -->
<p>Definition at line <a class="el" href="_p_s3_u_s_b_8cpp_source.html#l00023">23</a> of file <a class="el" href="_p_s3_u_s_b_8cpp_source.html">PS3USB.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="a1417ae57ea78c9a70a275149e90d2d5d"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">const uint8_t MOVE_REPORT_BUFFER[]</td>
</tr>
</table>
</div><div class="memdoc">
<b>Initial value:</b><div class="fragment"><div class="line">= {</div>
<div class="line"> 0x02, 0x00, </div>
<div class="line"> 0x00, 0x00, 0x00, </div>
<div class="line"> 0x00, </div>
<div class="line"> 0x00 </div>
<div class="line">}</div>
</div><!-- fragment -->
<p>Definition at line <a class="el" href="_p_s3_u_s_b_8cpp_source.html#l00034">34</a> of file <a class="el" href="_p_s3_u_s_b_8cpp_source.html">PS3USB.cpp</a>.</p>
</div>
</div>
</div><!-- contents -->

View file

@ -1,14 +1,14 @@
<map id="PS3USB.cpp" name="PS3USB.cpp">
<area shape="rect" id="node2" href="$_p_s3_u_s_b_8h.html" title="PS3USB.h" alt="" coords="726,75,785,96"/>
<area shape="rect" id="node4" href="$_usb_8h.html" title="Usb.h" alt="" coords="397,144,440,165"/>
<area shape="rect" id="node18" href="$_p_s3_enums_8h.html" title="PS3Enums.h" alt="" coords="797,144,866,165"/>
<area shape="rect" id="node7" href="$avrpins_8h.html" title="avrpins.h" alt="" coords="528,283,582,304"/>
<area shape="rect" id="node9" href="$max3421e_8h.html" title="max3421e.h" alt="" coords="146,283,213,304"/>
<area shape="rect" id="node10" href="$usbhost_8h.html" title="usbhost.h" alt="" coords="212,213,269,235"/>
<area shape="rect" id="node11" href="$usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="237,283,296,304"/>
<area shape="rect" id="node12" href="$address_8h.html" title="address.h" alt="" coords="79,213,136,235"/>
<area shape="rect" id="node14" href="$printhex_8h.html" title="printhex.h" alt="" coords="608,283,665,304"/>
<area shape="rect" id="node15" href="$hexdump_8h.html" title="hexdump.h" alt="" coords="430,213,492,235"/>
<area shape="rect" id="node17" href="$message_8h.html" title="message.h" alt="" coords="345,213,406,235"/>
<area shape="rect" id="node19" href="$controller_enums_8h.html" title="controllerEnums.h" alt="" coords="794,213,880,235"/>
<area shape="rect" id="node2" href="$_p_s3_u_s_b_8h.html" title="PS3USB.h" alt="" coords="441,75,500,96"/>
<area shape="rect" id="node4" href="$_usb_8h.html" title="Usb.h" alt="" coords="449,144,492,165"/>
<area shape="rect" id="node18" href="$_p_s3_enums_8h.html" title="PS3Enums.h" alt="" coords="653,144,723,165"/>
<area shape="rect" id="node7" href="$avrpins_8h.html" title="avrpins.h" alt="" coords="474,283,528,304"/>
<area shape="rect" id="node9" href="$max3421e_8h.html" title="max3421e.h" alt="" coords="553,283,620,304"/>
<area shape="rect" id="node10" href="$usbhost_8h.html" title="usbhost.h" alt="" coords="442,213,499,235"/>
<area shape="rect" id="node11" href="$usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="391,283,449,304"/>
<area shape="rect" id="node12" href="$address_8h.html" title="address.h" alt="" coords="701,213,757,235"/>
<area shape="rect" id="node14" href="$message_8h.html" title="message.h" alt="" coords="204,213,265,235"/>
<area shape="rect" id="node16" href="$printhex_8h.html" title="printhex.h" alt="" coords="71,283,128,304"/>
<area shape="rect" id="node17" href="$hexdump_8h.html" title="hexdump.h" alt="" coords="204,283,265,304"/>
<area shape="rect" id="node19" href="$controller_enums_8h.html" title="controllerEnums.h" alt="" coords="782,213,868,235"/>
</map>

View file

@ -1 +1 @@
0e685ac14f9abdc99ed5bf28556f2fc6
9291913c3b181df51a6c28b65d6f85e4

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 53 KiB

View file

@ -111,7 +111,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span>&#160;<span class="preprocessor"></span><span class="comment">//#define EXTRADEBUG // Uncomment to get even more debugging data</span></div>
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span>&#160;<span class="comment">//#define PRINTREPORT // Uncomment to print the report send by the PS3 Controllers</span></div>
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span>&#160;</div>
<div class="line"><a name="l00023"></a><span class="lineno"><a class="code" href="_p_s3_u_s_b_8cpp.html#a5442183aed6e48d11b22eb790351a5cd"> 23</a></span>&#160;<span class="keyword">const</span> uint8_t PS3_REPORT_BUFFER[] <a class="code" href="hidboot_8cpp.html#ad1eb9d7b0347c20d121c984618c442f0">PROGMEM</a> = {</div>
<div class="line"><a name="l00023"></a><span class="lineno"><a class="code" href="_p_s3_u_s_b_8cpp.html#a8cf62ee374ebaa5f7582c073e624bc74"> 23</a></span>&#160;<span class="keyword">const</span> uint8_t <a class="code" href="_p_s3_u_s_b_8cpp.html#a8cf62ee374ebaa5f7582c073e624bc74">PS3_REPORT_BUFFER</a>[] PROGMEM = {</div>
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span>&#160; 0x00, 0x00, 0x00, 0x00, 0x00,</div>
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span>&#160; 0x00, 0x00, 0x00, 0x00, 0x00,</div>
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span>&#160; 0xff, 0x27, 0x10, 0x00, 0x32,</div>
@ -122,7 +122,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span>&#160; 0x00, 0x00, 0x00, 0x00, 0x00,</div>
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span>&#160; 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00</div>
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span>&#160;};</div>
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span>&#160;<span class="keyword">const</span> uint8_t MOVE_REPORT_BUFFER[] <a class="code" href="hidboot_8cpp.html#ad1eb9d7b0347c20d121c984618c442f0">PROGMEM</a> = {</div>
<div class="line"><a name="l00034"></a><span class="lineno"><a class="code" href="_p_s3_u_s_b_8cpp.html#a1417ae57ea78c9a70a275149e90d2d5d"> 34</a></span>&#160;<span class="keyword">const</span> uint8_t <a class="code" href="_p_s3_u_s_b_8cpp.html#a1417ae57ea78c9a70a275149e90d2d5d">MOVE_REPORT_BUFFER</a>[] PROGMEM = {</div>
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span>&#160; 0x02, 0x00, <span class="comment">// Always 0x02, 0x00,</span></div>
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span>&#160; 0x00, 0x00, 0x00, <span class="comment">// r, g, b,</span></div>
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span>&#160; 0x00, <span class="comment">// Always 0x00,</span></div>
@ -163,12 +163,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>&#160; <span class="comment">// get memory address of USB device address pool</span></div>
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span>&#160; <a class="code" href="class_address_pool.html">AddressPool</a> &amp;addrPool = <a class="code" href="class_p_s3_u_s_b.html#aa1873f41ae0da7c4568cfb7517560c48">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a66ab8f5eda239e761d5a48741ea1f9d4">GetAddressPool</a>();</div>
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span>&#160;<span class="preprocessor">#ifdef EXTRADEBUG</span></div>
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nPS3USB Init&quot;</span>));</div>
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a1e8693828152de8408add858dc461dea">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nPS3USB Init&quot;</span>), 0x80);</div>
<div class="line"><a name="l00076"></a><span class="lineno"> 76</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span>&#160;<span class="preprocessor"></span> <span class="comment">// check if address has already been assigned to an instance</span></div>
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span>&#160; <span class="keywordflow">if</span> (<a class="code" href="class_p_s3_u_s_b.html#a3f43df159277003acdf7dd107bda27fd">bAddress</a>) {</div>
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>&#160;<span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nAddress in use&quot;</span>));</div>
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a1e8693828152de8408add858dc461dea">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nAddress in use&quot;</span>), 0x80);</div>
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00082"></a><span class="lineno"> 82</span>&#160;<span class="preprocessor"></span> <span class="keywordflow">return</span> <a class="code" href="_usb_8h.html#a44416ff64fc0e3691f98addac13d4595">USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE</a>;</div>
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span>&#160; }</div>
@ -178,14 +178,14 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<div class="line"><a name="l00087"></a><span class="lineno"> 87</span>&#160;</div>
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>&#160; <span class="keywordflow">if</span> (!p) {</div>
<div class="line"><a name="l00089"></a><span class="lineno"> 89</span>&#160;<span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nAddress not found&quot;</span>));</div>
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a1e8693828152de8408add858dc461dea">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nAddress not found&quot;</span>), 0x80);</div>
<div class="line"><a name="l00091"></a><span class="lineno"> 91</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00092"></a><span class="lineno"> 92</span>&#160;<span class="preprocessor"></span> <span class="keywordflow">return</span> <a class="code" href="_usb_8h.html#afe2fedb4b0ccc89a688c0b4b59691ce0">USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL</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;</div>
<div class="line"><a name="l00095"></a><span class="lineno"> 95</span>&#160; <span class="keywordflow">if</span> (!p-&gt;<a class="code" href="struct_usb_device.html#a410d39fb7758157f57794335e990ed02">epinfo</a>) {</div>
<div class="line"><a name="l00096"></a><span class="lineno"> 96</span>&#160;<span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><a name="l00097"></a><span class="lineno"> 97</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nepinfo is null&quot;</span>));</div>
<div class="line"><a name="l00097"></a><span class="lineno"> 97</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a1e8693828152de8408add858dc461dea">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nepinfo is null&quot;</span>), 0x80);</div>
<div class="line"><a name="l00098"></a><span class="lineno"> 98</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00099"></a><span class="lineno"> 99</span>&#160;<span class="preprocessor"></span> <span class="keywordflow">return</span> <a class="code" href="_usb_8h.html#af192c59cafe2192ad802b22e6dbc077d">USB_ERROR_EPINFO_IS_NULL</a>;</div>
<div class="line"><a name="l00100"></a><span class="lineno"> 100</span>&#160; }</div>
@ -228,26 +228,26 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<div class="line"><a name="l00137"></a><span class="lineno"> 137</span>&#160; addrPool.<a class="code" href="class_address_pool.html#a15fde13223dcb1da89305ad229763562">FreeAddress</a>(<a class="code" href="class_p_s3_u_s_b.html#a3f43df159277003acdf7dd107bda27fd">bAddress</a>);</div>
<div class="line"><a name="l00138"></a><span class="lineno"> 138</span>&#160; <a class="code" href="class_p_s3_u_s_b.html#a3f43df159277003acdf7dd107bda27fd">bAddress</a> = 0;</div>
<div class="line"><a name="l00139"></a><span class="lineno"> 139</span>&#160;<span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><a name="l00140"></a><span class="lineno"> 140</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nsetAddr: &quot;</span>));</div>
<div class="line"><a name="l00140"></a><span class="lineno"> 140</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a1e8693828152de8408add858dc461dea">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nsetAddr: &quot;</span>), 0x80);</div>
<div class="line"><a name="l00141"></a><span class="lineno"> 141</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00142"></a><span class="lineno"> 142</span>&#160;<span class="preprocessor"></span> PrintHex&lt;uint8_t&gt;(rcode);</div>
<div class="line"><a name="l00142"></a><span class="lineno"> 142</span>&#160;<span class="preprocessor"></span> PrintHex&lt;uint8_t &gt; (rcode, 0x80);</div>
<div class="line"><a name="l00143"></a><span class="lineno"> 143</span>&#160; <span class="keywordflow">return</span> rcode;</div>
<div class="line"><a name="l00144"></a><span class="lineno"> 144</span>&#160; }</div>
<div class="line"><a name="l00145"></a><span class="lineno"> 145</span>&#160;<span class="preprocessor">#ifdef EXTRADEBUG</span></div>
<div class="line"><a name="l00146"></a><span class="lineno"> 146</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nAddr: &quot;</span>));</div>
<div class="line"><a name="l00147"></a><span class="lineno"> 147</span>&#160; PrintHex&lt;uint8_t&gt;(<a class="code" href="class_p_s3_u_s_b.html#a3f43df159277003acdf7dd107bda27fd">bAddress</a>);</div>
<div class="line"><a name="l00146"></a><span class="lineno"> 146</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a1e8693828152de8408add858dc461dea">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nAddr: &quot;</span>), 0x80);</div>
<div class="line"><a name="l00147"></a><span class="lineno"> 147</span>&#160; PrintHex&lt;uint8_t &gt; (<a class="code" href="class_p_s3_u_s_b.html#a3f43df159277003acdf7dd107bda27fd">bAddress</a>, 0x80);</div>
<div class="line"><a name="l00148"></a><span class="lineno"> 148</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00149"></a><span class="lineno"> 149</span>&#160;<span class="preprocessor"></span> p-&gt;<a class="code" href="struct_usb_device.html#a86a815577ad7883437d3ca72b32b8e8a">lowspeed</a> = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00150"></a><span class="lineno"> 150</span>&#160;</div>
<div class="line"><a name="l00151"></a><span class="lineno"> 151</span>&#160; <span class="comment">//get pointer to assigned address record</span></div>
<div class="line"><a name="l00152"></a><span class="lineno"> 152</span>&#160; p = addrPool.<a class="code" href="class_address_pool.html#aa92d7e8f0f515340ae2dc1679b627056">GetUsbDevicePtr</a>(<a class="code" href="class_p_s3_u_s_b.html#a3f43df159277003acdf7dd107bda27fd">bAddress</a>);</div>
<div class="line"><a name="l00152"></a><span class="lineno"> 152</span>&#160; p = addrPool.<a class="code" href="class_address_pool.html#aa92d7e8f0f515340ae2dc1679b627056">GetUsbDevicePtr</a>(bAddress);</div>
<div class="line"><a name="l00153"></a><span class="lineno"> 153</span>&#160; <span class="keywordflow">if</span> (!p)</div>
<div class="line"><a name="l00154"></a><span class="lineno"> 154</span>&#160; <span class="keywordflow">return</span> <a class="code" href="_usb_8h.html#afe2fedb4b0ccc89a688c0b4b59691ce0">USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL</a>;</div>
<div class="line"><a name="l00155"></a><span class="lineno"> 155</span>&#160;</div>
<div class="line"><a name="l00156"></a><span class="lineno"> 156</span>&#160; p-&gt;<a class="code" href="struct_usb_device.html#a86a815577ad7883437d3ca72b32b8e8a">lowspeed</a> = lowspeed;</div>
<div class="line"><a name="l00157"></a><span class="lineno"> 157</span>&#160;</div>
<div class="line"><a name="l00158"></a><span class="lineno"> 158</span>&#160; <span class="comment">// Assign epInfo to epinfo pointer - only EP0 is known</span></div>
<div class="line"><a name="l00159"></a><span class="lineno"> 159</span>&#160; rcode = <a class="code" href="class_p_s3_u_s_b.html#aa1873f41ae0da7c4568cfb7517560c48">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a6c3ba3f7e6dccb450267011ce783d7ea">setEpInfoEntry</a>(<a class="code" href="class_p_s3_u_s_b.html#a3f43df159277003acdf7dd107bda27fd">bAddress</a>, 1, <a class="code" href="class_p_s3_u_s_b.html#a394dbb0a59b587210e5958f08dac48f1">epInfo</a>);</div>
<div class="line"><a name="l00159"></a><span class="lineno"> 159</span>&#160; rcode = <a class="code" href="class_p_s3_u_s_b.html#aa1873f41ae0da7c4568cfb7517560c48">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a6c3ba3f7e6dccb450267011ce783d7ea">setEpInfoEntry</a>(bAddress, 1, <a class="code" href="class_p_s3_u_s_b.html#a394dbb0a59b587210e5958f08dac48f1">epInfo</a>);</div>
<div class="line"><a name="l00160"></a><span class="lineno"> 160</span>&#160; <span class="keywordflow">if</span> (rcode)</div>
<div class="line"><a name="l00161"></a><span class="lineno"> 161</span>&#160; <span class="keywordflow">goto</span> FailSetDevTblEntry;</div>
<div class="line"><a name="l00162"></a><span class="lineno"> 162</span>&#160;</div>
@ -270,25 +270,25 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<div class="line"><a name="l00179"></a><span class="lineno"> 179</span>&#160; <a class="code" href="class_p_s3_u_s_b.html#a394dbb0a59b587210e5958f08dac48f1">epInfo</a>[ <a class="code" href="_p_s3_u_s_b_8h.html#aca3cbaad8732d9185bb9bda1a32cd18d">PS3_INPUT_PIPE</a> ].<a class="code" href="struct_ep_info.html#ac85bff70ad0e5d71e50cb501f4d8caf3">bmSndToggle</a> = <a class="code" href="max3421e_8h.html#a4834ae7378471b63b9a1985c6294006f">bmSNDTOG0</a>;</div>
<div class="line"><a name="l00180"></a><span class="lineno"> 180</span>&#160; <a class="code" href="class_p_s3_u_s_b.html#a394dbb0a59b587210e5958f08dac48f1">epInfo</a>[ <a class="code" href="_p_s3_u_s_b_8h.html#aca3cbaad8732d9185bb9bda1a32cd18d">PS3_INPUT_PIPE</a> ].<a class="code" href="struct_ep_info.html#a9238dd40c096baedf041c98b19386a14">bmRcvToggle</a> = <a class="code" href="max3421e_8h.html#aca6a8aa4f0aebbe07c5e175572a92ef7">bmRCVTOG0</a>;</div>
<div class="line"><a name="l00181"></a><span class="lineno"> 181</span>&#160;</div>
<div class="line"><a name="l00182"></a><span class="lineno"> 182</span>&#160; rcode = <a class="code" href="class_p_s3_u_s_b.html#aa1873f41ae0da7c4568cfb7517560c48">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a6c3ba3f7e6dccb450267011ce783d7ea">setEpInfoEntry</a>(<a class="code" href="class_p_s3_u_s_b.html#a3f43df159277003acdf7dd107bda27fd">bAddress</a>, 3, <a class="code" href="class_p_s3_u_s_b.html#a394dbb0a59b587210e5958f08dac48f1">epInfo</a>);</div>
<div class="line"><a name="l00182"></a><span class="lineno"> 182</span>&#160; rcode = <a class="code" href="class_p_s3_u_s_b.html#aa1873f41ae0da7c4568cfb7517560c48">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a6c3ba3f7e6dccb450267011ce783d7ea">setEpInfoEntry</a>(bAddress, 3, <a class="code" href="class_p_s3_u_s_b.html#a394dbb0a59b587210e5958f08dac48f1">epInfo</a>);</div>
<div class="line"><a name="l00183"></a><span class="lineno"> 183</span>&#160; <span class="keywordflow">if</span> (rcode)</div>
<div class="line"><a name="l00184"></a><span class="lineno"> 184</span>&#160; <span class="keywordflow">goto</span> FailSetDevTblEntry;</div>
<div class="line"><a name="l00185"></a><span class="lineno"> 185</span>&#160;</div>
<div class="line"><a name="l00186"></a><span class="lineno"> 186</span>&#160; delay(200); <span class="comment">//Give time for address change</span></div>
<div class="line"><a name="l00187"></a><span class="lineno"> 187</span>&#160;</div>
<div class="line"><a name="l00188"></a><span class="lineno"> 188</span>&#160; rcode = <a class="code" href="class_p_s3_u_s_b.html#aa1873f41ae0da7c4568cfb7517560c48">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a31e2c132ec32ffdde94dff72be87c378">setConf</a>(<a class="code" href="class_p_s3_u_s_b.html#a3f43df159277003acdf7dd107bda27fd">bAddress</a>, <a class="code" href="class_p_s3_u_s_b.html#a394dbb0a59b587210e5958f08dac48f1">epInfo</a>[ <a class="code" href="_p_s3_u_s_b_8h.html#ae6276fa555fe14995bee0713be663333">PS3_CONTROL_PIPE</a> ].epAddr, 1);</div>
<div class="line"><a name="l00188"></a><span class="lineno"> 188</span>&#160; rcode = <a class="code" href="class_p_s3_u_s_b.html#aa1873f41ae0da7c4568cfb7517560c48">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a31e2c132ec32ffdde94dff72be87c378">setConf</a>(bAddress, <a class="code" href="class_p_s3_u_s_b.html#a394dbb0a59b587210e5958f08dac48f1">epInfo</a>[ <a class="code" href="_p_s3_u_s_b_8h.html#ae6276fa555fe14995bee0713be663333">PS3_CONTROL_PIPE</a> ].epAddr, 1);</div>
<div class="line"><a name="l00189"></a><span class="lineno"> 189</span>&#160; <span class="keywordflow">if</span> (rcode)</div>
<div class="line"><a name="l00190"></a><span class="lineno"> 190</span>&#160; <span class="keywordflow">goto</span> FailSetConf;</div>
<div class="line"><a name="l00190"></a><span class="lineno"> 190</span>&#160; <span class="keywordflow">goto</span> FailSetConfDescr;</div>
<div class="line"><a name="l00191"></a><span class="lineno"> 191</span>&#160;</div>
<div class="line"><a name="l00192"></a><span class="lineno"> 192</span>&#160; <span class="keywordflow">if</span> (PID == <a class="code" href="_b_t_d_8h.html#a0ae276efa5e73a4da658c714e70402c0">PS3_PID</a> || PID == <a class="code" href="_b_t_d_8h.html#a54903b410722a45f8246653cd4d00632">PS3NAVIGATION_PID</a>) {</div>
<div class="line"><a name="l00193"></a><span class="lineno"> 193</span>&#160; <span class="keywordflow">if</span> (PID == <a class="code" href="_b_t_d_8h.html#a0ae276efa5e73a4da658c714e70402c0">PS3_PID</a>) {</div>
<div class="line"><a name="l00194"></a><span class="lineno"> 194</span>&#160;<span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><a name="l00195"></a><span class="lineno"> 195</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nDualshock 3 Controller Connected&quot;</span>));</div>
<div class="line"><a name="l00195"></a><span class="lineno"> 195</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a1e8693828152de8408add858dc461dea">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nDualshock 3 Controller Connected&quot;</span>), 0x80);</div>
<div class="line"><a name="l00196"></a><span class="lineno"> 196</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00197"></a><span class="lineno"> 197</span>&#160;<span class="preprocessor"></span> <a class="code" href="class_p_s3_u_s_b.html#a0dad8754ff18d0c375c2569791d50876">PS3Connected</a> = <span class="keyword">true</span>;</div>
<div class="line"><a name="l00198"></a><span class="lineno"> 198</span>&#160; } <span class="keywordflow">else</span> { <span class="comment">// must be a navigation controller</span></div>
<div class="line"><a name="l00199"></a><span class="lineno"> 199</span>&#160;<span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><a name="l00200"></a><span class="lineno"> 200</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nNavigation Controller Connected&quot;</span>));</div>
<div class="line"><a name="l00200"></a><span class="lineno"> 200</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a1e8693828152de8408add858dc461dea">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nNavigation Controller Connected&quot;</span>), 0x80);</div>
<div class="line"><a name="l00201"></a><span class="lineno"> 201</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00202"></a><span class="lineno"> 202</span>&#160;<span class="preprocessor"></span> <a class="code" href="class_p_s3_u_s_b.html#a54b2dcaa1e9acef83de2376b50c7ff09">PS3NavigationConnected</a> = <span class="keyword">true</span>;</div>
<div class="line"><a name="l00203"></a><span class="lineno"> 203</span>&#160; }</div>
@ -299,347 +299,354 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<div class="line"><a name="l00208"></a><span class="lineno"> 208</span>&#160;</div>
<div class="line"><a name="l00209"></a><span class="lineno"> 209</span>&#160; <span class="comment">// Needed for PS3 Dualshock and Navigation commands to work</span></div>
<div class="line"><a name="l00210"></a><span class="lineno"> 210</span>&#160; <span class="keywordflow">for</span> (uint8_t i = 0; i &lt; <a class="code" href="_p_s3_u_s_b_8h.html#a4898fccf5d2aa053bc67894aa3627e0f">PS3_REPORT_BUFFER_SIZE</a>; i++)</div>
<div class="line"><a name="l00211"></a><span class="lineno"> 211</span>&#160; writeBuf[i] = pgm_read_byte(&amp;PS3_REPORT_BUFFER[i]);</div>
<div class="line"><a name="l00211"></a><span class="lineno"> 211</span>&#160; writeBuf[i] = pgm_read_byte(&amp;<a class="code" href="_p_s3_u_s_b_8cpp.html#a8cf62ee374ebaa5f7582c073e624bc74">PS3_REPORT_BUFFER</a>[i]);</div>
<div class="line"><a name="l00212"></a><span class="lineno"> 212</span>&#160;</div>
<div class="line"><a name="l00213"></a><span class="lineno"> 213</span>&#160; <span class="keywordflow">for</span> (uint8_t i = 6; i &lt; 10; i++)</div>
<div class="line"><a name="l00214"></a><span class="lineno"> 214</span>&#160; readBuf[i] = 0x7F; <span class="comment">// Set the analog joystick values to center position</span></div>
<div class="line"><a name="l00215"></a><span class="lineno"> 215</span>&#160; }</div>
<div class="line"><a name="l00216"></a><span class="lineno"> 216</span>&#160; <span class="keywordflow">else</span> { <span class="comment">// must be a Motion controller</span></div>
<div class="line"><a name="l00217"></a><span class="lineno"> 217</span>&#160;<span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><a name="l00218"></a><span class="lineno"> 218</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nMotion Controller Connected&quot;</span>));</div>
<div class="line"><a name="l00219"></a><span class="lineno"> 219</span>&#160;<span class="preprocessor">#endif </span></div>
<div class="line"><a name="l00220"></a><span class="lineno"> 220</span>&#160;<span class="preprocessor"></span> <a class="code" href="class_p_s3_u_s_b.html#a89aa4233f3eeeb99693a099da527ec28">PS3MoveConnected</a> = <span class="keyword">true</span>;</div>
<div class="line"><a name="l00221"></a><span class="lineno"> 221</span>&#160; <a class="code" href="class_p_s3_u_s_b.html#a3be69a3c6e24bf2b53bc06c85829e62a">setMoveBdaddr</a>(my_bdaddr); <span class="comment">// Set internal bluetooth address</span></div>
<div class="line"><a name="l00222"></a><span class="lineno"> 222</span>&#160; <a class="code" href="class_p_s3_u_s_b.html#ae9cfdaad3e54dbc271519e22082399c7">moveSetBulb</a>(<a class="code" href="_p_s3_enums_8h.html#a55ecd4f2ec2ebfe8d5b0163e4ac2a967ad3163c1fcda01965b692ec2c3122b743">Red</a>);</div>
<div class="line"><a name="l00223"></a><span class="lineno"> 223</span>&#160; </div>
<div class="line"><a name="l00224"></a><span class="lineno"> 224</span>&#160; <span class="comment">// Needed for Move commands to work</span></div>
<div class="line"><a name="l00225"></a><span class="lineno"> 225</span>&#160; <span class="keywordflow">for</span> (uint8_t i = 0; i &lt; <a class="code" href="_p_s3_u_s_b_8h.html#a2c6c24a4b63d9a34926fb35d6b49cd17">MOVE_REPORT_BUFFER_SIZE</a>; i++)</div>
<div class="line"><a name="l00226"></a><span class="lineno"> 226</span>&#160; writeBuf[i] = pgm_read_byte(&amp;MOVE_REPORT_BUFFER[i]);</div>
<div class="line"><a name="l00227"></a><span class="lineno"> 227</span>&#160; }</div>
<div class="line"><a name="l00228"></a><span class="lineno"> 228</span>&#160;</div>
<div class="line"><a name="l00229"></a><span class="lineno"> 229</span>&#160; bPollEnable = <span class="keyword">true</span>;</div>
<div class="line"><a name="l00230"></a><span class="lineno"> 230</span>&#160; <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\n&quot;</span>));</div>
<div class="line"><a name="l00231"></a><span class="lineno"> 231</span>&#160; timer = millis();</div>
<div class="line"><a name="l00232"></a><span class="lineno"> 232</span>&#160; <span class="keywordflow">return</span> 0; <span class="comment">// successful configuration</span></div>
<div class="line"><a name="l00233"></a><span class="lineno"> 233</span>&#160; </div>
<div class="line"><a name="l00234"></a><span class="lineno"> 234</span>&#160; <span class="comment">/* diagnostic messages */</span> </div>
<div class="line"><a name="l00235"></a><span class="lineno"> 235</span>&#160;FailGetDevDescr:</div>
<div class="line"><a name="l00236"></a><span class="lineno"> 236</span>&#160;<span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><a name="l00237"></a><span class="lineno"> 237</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\ngetDevDescr:&quot;</span>));</div>
<div class="line"><a name="l00238"></a><span class="lineno"> 238</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00239"></a><span class="lineno"> 239</span>&#160;<span class="preprocessor"></span> <span class="keywordflow">goto</span> Fail; </div>
<div class="line"><a name="l00240"></a><span class="lineno"> 240</span>&#160;FailSetDevTblEntry:</div>
<div class="line"><a name="l00241"></a><span class="lineno"> 241</span>&#160;<span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><a name="l00242"></a><span class="lineno"> 242</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nsetDevTblEn:&quot;</span>));</div>
<div class="line"><a name="l00243"></a><span class="lineno"> 243</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00244"></a><span class="lineno"> 244</span>&#160;<span class="preprocessor"></span> <span class="keywordflow">goto</span> Fail;</div>
<div class="line"><a name="l00245"></a><span class="lineno"> 245</span>&#160;FailSetConf:</div>
<div class="line"><a name="l00246"></a><span class="lineno"> 246</span>&#160;<span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><a name="l00247"></a><span class="lineno"> 247</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nsetConf:&quot;</span>));</div>
<div class="line"><a name="l00248"></a><span class="lineno"> 248</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00249"></a><span class="lineno"> 249</span>&#160;<span class="preprocessor"></span> <span class="keywordflow">goto</span> Fail; </div>
<div class="line"><a name="l00250"></a><span class="lineno"> 250</span>&#160;FailUnknownDevice:</div>
<div class="line"><a name="l00251"></a><span class="lineno"> 251</span>&#160;<span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><a name="l00252"></a><span class="lineno"> 252</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nUnknown Device Connected - VID: &quot;</span>));</div>
<div class="line"><a name="l00253"></a><span class="lineno"> 253</span>&#160; PrintHex&lt;uint16_t&gt;(VID);</div>
<div class="line"><a name="l00254"></a><span class="lineno"> 254</span>&#160; <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot; PID: &quot;</span>));</div>
<div class="line"><a name="l00255"></a><span class="lineno"> 255</span>&#160; PrintHex&lt;uint16_t&gt;(PID);</div>
<div class="line"><a name="l00256"></a><span class="lineno"> 256</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00257"></a><span class="lineno"> 257</span>&#160;<span class="preprocessor"></span> rcode = <a class="code" href="_usb_8h.html#ae9e139d0fd29bb0b3e7afad2f76cd589">USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED</a>;</div>
<div class="line"><a name="l00258"></a><span class="lineno"> 258</span>&#160; <span class="keywordflow">goto</span> Fail;</div>
<div class="line"><a name="l00259"></a><span class="lineno"> 259</span>&#160;Fail:</div>
<div class="line"><a name="l00260"></a><span class="lineno"> 260</span>&#160;<span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><a name="l00261"></a><span class="lineno"> 261</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nPS3 Init Failed, error code: &quot;</span>));</div>
<div class="line"><a name="l00262"></a><span class="lineno"> 262</span>&#160; Serial.print(rcode,HEX);</div>
<div class="line"><a name="l00263"></a><span class="lineno"> 263</span>&#160;<span class="preprocessor">#endif </span></div>
<div class="line"><a name="l00264"></a><span class="lineno"> 264</span>&#160;<span class="preprocessor"></span> <a class="code" href="class_p_s3_u_s_b.html#a5750c5448bf1ec73a7669ca2e4799c98">Release</a>();</div>
<div class="line"><a name="l00265"></a><span class="lineno"> 265</span>&#160; <span class="keywordflow">return</span> rcode;</div>
<div class="line"><a name="l00266"></a><span class="lineno"> 266</span>&#160;}</div>
<div class="line"><a name="l00267"></a><span class="lineno"> 267</span>&#160;</div>
<div class="line"><a name="l00268"></a><span class="lineno"> 268</span>&#160;<span class="comment">/* Performs a cleanup after failed Init() attempt */</span></div>
<div class="line"><a name="l00269"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#a5750c5448bf1ec73a7669ca2e4799c98"> 269</a></span>&#160;uint8_t <a class="code" href="class_p_s3_u_s_b.html#a5750c5448bf1ec73a7669ca2e4799c98">PS3USB::Release</a>() {</div>
<div class="line"><a name="l00270"></a><span class="lineno"> 270</span>&#160; <a class="code" href="class_p_s3_u_s_b.html#a0dad8754ff18d0c375c2569791d50876">PS3Connected</a> = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00271"></a><span class="lineno"> 271</span>&#160; <a class="code" href="class_p_s3_u_s_b.html#a89aa4233f3eeeb99693a099da527ec28">PS3MoveConnected</a> = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00272"></a><span class="lineno"> 272</span>&#160; <a class="code" href="class_p_s3_u_s_b.html#a54b2dcaa1e9acef83de2376b50c7ff09">PS3NavigationConnected</a> = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00273"></a><span class="lineno"> 273</span>&#160; <a class="code" href="class_p_s3_u_s_b.html#aa1873f41ae0da7c4568cfb7517560c48">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a66ab8f5eda239e761d5a48741ea1f9d4">GetAddressPool</a>().<a class="code" href="class_address_pool.html#a15fde13223dcb1da89305ad229763562">FreeAddress</a>(<a class="code" href="class_p_s3_u_s_b.html#a3f43df159277003acdf7dd107bda27fd">bAddress</a>); </div>
<div class="line"><a name="l00274"></a><span class="lineno"> 274</span>&#160; <a class="code" href="class_p_s3_u_s_b.html#a3f43df159277003acdf7dd107bda27fd">bAddress</a> = 0;</div>
<div class="line"><a name="l00275"></a><span class="lineno"> 275</span>&#160; bPollEnable = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00276"></a><span class="lineno"> 276</span>&#160; <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00277"></a><span class="lineno"> 277</span>&#160;}</div>
<div class="line"><a name="l00278"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#a9068e2a036012614c0db163830cbcf00"> 278</a></span>&#160;uint8_t <a class="code" href="class_p_s3_u_s_b.html#a9068e2a036012614c0db163830cbcf00">PS3USB::Poll</a>() { </div>
<div class="line"><a name="l00279"></a><span class="lineno"> 279</span>&#160; <span class="keywordflow">if</span> (!bPollEnable)</div>
<div class="line"><a name="l00280"></a><span class="lineno"> 280</span>&#160; <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00281"></a><span class="lineno"> 281</span>&#160; </div>
<div class="line"><a name="l00282"></a><span class="lineno"> 282</span>&#160; <span class="keywordflow">if</span>(<a class="code" href="class_p_s3_u_s_b.html#a0dad8754ff18d0c375c2569791d50876">PS3Connected</a> || <a class="code" href="class_p_s3_u_s_b.html#a54b2dcaa1e9acef83de2376b50c7ff09">PS3NavigationConnected</a>) {</div>
<div class="line"><a name="l00283"></a><span class="lineno"> 283</span>&#160; uint16_t BUFFER_SIZE = <a class="code" href="_p_s3_u_s_b_8h.html#abcb805b13bfd36145e252b0633bbcfc0">EP_MAXPKTSIZE</a>;</div>
<div class="line"><a name="l00284"></a><span class="lineno"> 284</span>&#160; <a class="code" href="class_p_s3_u_s_b.html#aa1873f41ae0da7c4568cfb7517560c48">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#ad75d64f648b102fab2bd75e53e1324a4">inTransfer</a>(<a class="code" href="class_p_s3_u_s_b.html#a3f43df159277003acdf7dd107bda27fd">bAddress</a>, <a class="code" href="class_p_s3_u_s_b.html#a394dbb0a59b587210e5958f08dac48f1">epInfo</a>[ <a class="code" href="_p_s3_u_s_b_8h.html#aca3cbaad8732d9185bb9bda1a32cd18d">PS3_INPUT_PIPE</a> ].epAddr, &amp;BUFFER_SIZE, readBuf); <span class="comment">// input on endpoint 1</span></div>
<div class="line"><a name="l00285"></a><span class="lineno"> 285</span>&#160; <span class="keywordflow">if</span>(millis() - timer &gt; 100) { <span class="comment">// Loop 100ms before processing data</span></div>
<div class="line"><a name="l00286"></a><span class="lineno"> 286</span>&#160; readReport();</div>
<div class="line"><a name="l00287"></a><span class="lineno"> 287</span>&#160;<span class="preprocessor">#ifdef PRINTREPORT</span></div>
<div class="line"><a name="l00288"></a><span class="lineno"> 288</span>&#160;<span class="preprocessor"></span> printReport(); <span class="comment">// Uncomment &quot;#define PRINTREPORT&quot; to print the report send by the PS3 Controllers</span></div>
<div class="line"><a name="l00289"></a><span class="lineno"> 289</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00290"></a><span class="lineno"> 290</span>&#160;<span class="preprocessor"></span> }</div>
<div class="line"><a name="l00291"></a><span class="lineno"> 291</span>&#160; }</div>
<div class="line"><a name="l00292"></a><span class="lineno"> 292</span>&#160; <span class="keywordflow">else</span> <span class="keywordflow">if</span>(<a class="code" href="class_p_s3_u_s_b.html#a89aa4233f3eeeb99693a099da527ec28">PS3MoveConnected</a>) { <span class="comment">// One can only set the color of the bulb, set the rumble, set and get the bluetooth address and calibrate the magnetometer via USB </span></div>
<div class="line"><a name="l00293"></a><span class="lineno"> 293</span>&#160; <span class="keywordflow">if</span> (millis() - timer &gt; 4000) <span class="comment">// Send at least every 4th second</span></div>
<div class="line"><a name="l00294"></a><span class="lineno"> 294</span>&#160; {</div>
<div class="line"><a name="l00295"></a><span class="lineno"> 295</span>&#160; Move_Command(writeBuf, <a class="code" href="_p_s3_u_s_b_8h.html#a2c6c24a4b63d9a34926fb35d6b49cd17">MOVE_REPORT_BUFFER_SIZE</a>); <span class="comment">// The Bulb and rumble values, has to be written again and again, for it to stay turned on</span></div>
<div class="line"><a name="l00296"></a><span class="lineno"> 296</span>&#160; timer = millis();</div>
<div class="line"><a name="l00297"></a><span class="lineno"> 297</span>&#160; } </div>
<div class="line"><a name="l00298"></a><span class="lineno"> 298</span>&#160; } </div>
<div class="line"><a name="l00299"></a><span class="lineno"> 299</span>&#160; <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00300"></a><span class="lineno"> 300</span>&#160;}</div>
<div class="line"><a name="l00301"></a><span class="lineno"> 301</span>&#160;</div>
<div class="line"><a name="l00302"></a><span class="lineno"> 302</span>&#160;<span class="keywordtype">void</span> PS3USB::readReport() { </div>
<div class="line"><a name="l00303"></a><span class="lineno"> 303</span>&#160; <span class="keywordflow">if</span> (readBuf == NULL)</div>
<div class="line"><a name="l00304"></a><span class="lineno"> 304</span>&#160; <span class="keywordflow">return</span>; </div>
<div class="line"><a name="l00305"></a><span class="lineno"> 305</span>&#160;</div>
<div class="line"><a name="l00306"></a><span class="lineno"> 306</span>&#160; ButtonState = (uint32_t)(readBuf[2] | ((uint16_t)readBuf[3] &lt;&lt; 8) | ((uint32_t)readBuf[4] &lt;&lt; 16));</div>
<div class="line"><a name="l00307"></a><span class="lineno"> 307</span>&#160; </div>
<div class="line"><a name="l00308"></a><span class="lineno"> 308</span>&#160; <span class="comment">//Notify(PSTR(&quot;\r\nButtonState&quot;);</span></div>
<div class="line"><a name="l00309"></a><span class="lineno"> 309</span>&#160; <span class="comment">//PrintHex&lt;uint32_t&gt;(ButtonState);</span></div>
<div class="line"><a name="l00310"></a><span class="lineno"> 310</span>&#160; </div>
<div class="line"><a name="l00311"></a><span class="lineno"> 311</span>&#160; <span class="keywordflow">if</span>(ButtonState != OldButtonState) {</div>
<div class="line"><a name="l00312"></a><span class="lineno"> 312</span>&#160; ButtonClickState = ButtonState &amp; ~OldButtonState; <span class="comment">// Update click state variable</span></div>
<div class="line"><a name="l00313"></a><span class="lineno"> 313</span>&#160; OldButtonState = ButtonState;</div>
<div class="line"><a name="l00215"></a><span class="lineno"> 215</span>&#160; } <span class="keywordflow">else</span> { <span class="comment">// must be a Motion controller</span></div>
<div class="line"><a name="l00216"></a><span class="lineno"> 216</span>&#160;<span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><a name="l00217"></a><span class="lineno"> 217</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a1e8693828152de8408add858dc461dea">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nMotion Controller Connected&quot;</span>), 0x80);</div>
<div class="line"><a name="l00218"></a><span class="lineno"> 218</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00219"></a><span class="lineno"> 219</span>&#160;<span class="preprocessor"></span> <a class="code" href="class_p_s3_u_s_b.html#a89aa4233f3eeeb99693a099da527ec28">PS3MoveConnected</a> = <span class="keyword">true</span>;</div>
<div class="line"><a name="l00220"></a><span class="lineno"> 220</span>&#160; <a class="code" href="class_p_s3_u_s_b.html#a3be69a3c6e24bf2b53bc06c85829e62a">setMoveBdaddr</a>(my_bdaddr); <span class="comment">// Set internal bluetooth address</span></div>
<div class="line"><a name="l00221"></a><span class="lineno"> 221</span>&#160; <a class="code" href="class_p_s3_u_s_b.html#ae9cfdaad3e54dbc271519e22082399c7">moveSetBulb</a>(<a class="code" href="_p_s3_enums_8h.html#a55ecd4f2ec2ebfe8d5b0163e4ac2a967ad3163c1fcda01965b692ec2c3122b743">Red</a>);</div>
<div class="line"><a name="l00222"></a><span class="lineno"> 222</span>&#160;</div>
<div class="line"><a name="l00223"></a><span class="lineno"> 223</span>&#160; <span class="comment">// Needed for Move commands to work</span></div>
<div class="line"><a name="l00224"></a><span class="lineno"> 224</span>&#160; <span class="keywordflow">for</span> (uint8_t i = 0; i &lt; <a class="code" href="_p_s3_u_s_b_8h.html#a2c6c24a4b63d9a34926fb35d6b49cd17">MOVE_REPORT_BUFFER_SIZE</a>; i++)</div>
<div class="line"><a name="l00225"></a><span class="lineno"> 225</span>&#160; writeBuf[i] = pgm_read_byte(&amp;<a class="code" href="_p_s3_u_s_b_8cpp.html#a1417ae57ea78c9a70a275149e90d2d5d">MOVE_REPORT_BUFFER</a>[i]);</div>
<div class="line"><a name="l00226"></a><span class="lineno"> 226</span>&#160; }</div>
<div class="line"><a name="l00227"></a><span class="lineno"> 227</span>&#160;</div>
<div class="line"><a name="l00228"></a><span class="lineno"> 228</span>&#160; bPollEnable = <span class="keyword">true</span>;</div>
<div class="line"><a name="l00229"></a><span class="lineno"> 229</span>&#160; <a class="code" href="message_8cpp.html#a1e8693828152de8408add858dc461dea">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\n&quot;</span>), 0x80);</div>
<div class="line"><a name="l00230"></a><span class="lineno"> 230</span>&#160; timer = millis();</div>
<div class="line"><a name="l00231"></a><span class="lineno"> 231</span>&#160; <span class="keywordflow">return</span> 0; <span class="comment">// successful configuration</span></div>
<div class="line"><a name="l00232"></a><span class="lineno"> 232</span>&#160;</div>
<div class="line"><a name="l00233"></a><span class="lineno"> 233</span>&#160; <span class="comment">/* diagnostic messages */</span></div>
<div class="line"><a name="l00234"></a><span class="lineno"> 234</span>&#160;FailGetDevDescr:</div>
<div class="line"><a name="l00235"></a><span class="lineno"> 235</span>&#160; <a class="code" href="message_8cpp.html#ace40a5d826a882de0c5a25aece111d3f">NotifyFailGetDevDescr</a>();</div>
<div class="line"><a name="l00236"></a><span class="lineno"> 236</span>&#160; <span class="keywordflow">goto</span> Fail;</div>
<div class="line"><a name="l00237"></a><span class="lineno"> 237</span>&#160;</div>
<div class="line"><a name="l00238"></a><span class="lineno"> 238</span>&#160;FailSetDevTblEntry:</div>
<div class="line"><a name="l00239"></a><span class="lineno"> 239</span>&#160; <a class="code" href="message_8cpp.html#aa65008f9251787149e391f89e68b32be">NotifyFailSetDevTblEntry</a>();</div>
<div class="line"><a name="l00240"></a><span class="lineno"> 240</span>&#160; <span class="keywordflow">goto</span> Fail;</div>
<div class="line"><a name="l00241"></a><span class="lineno"> 241</span>&#160;</div>
<div class="line"><a name="l00242"></a><span class="lineno"> 242</span>&#160;FailSetConfDescr:</div>
<div class="line"><a name="l00243"></a><span class="lineno"> 243</span>&#160; <a class="code" href="message_8cpp.html#a08b840c377ca6f8154d6924d51338d89">NotifyFailSetConfDescr</a>();</div>
<div class="line"><a name="l00244"></a><span class="lineno"> 244</span>&#160; <span class="keywordflow">goto</span> Fail;</div>
<div class="line"><a name="l00245"></a><span class="lineno"> 245</span>&#160;FailUnknownDevice:</div>
<div class="line"><a name="l00246"></a><span class="lineno"> 246</span>&#160; <a class="code" href="message_8cpp.html#a7103129ed2b7b7896461c0a3cd924eb4">NotifyFailUnknownDevice</a>(VID,PID);</div>
<div class="line"><a name="l00247"></a><span class="lineno"> 247</span>&#160; rcode = <a class="code" href="_usb_8h.html#ae9e139d0fd29bb0b3e7afad2f76cd589">USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED</a>;</div>
<div class="line"><a name="l00248"></a><span class="lineno"> 248</span>&#160; Fail:</div>
<div class="line"><a name="l00249"></a><span class="lineno"> 249</span>&#160;</div>
<div class="line"><a name="l00250"></a><span class="lineno"> 250</span>&#160;<span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><a name="l00251"></a><span class="lineno"> 251</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a1e8693828152de8408add858dc461dea">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nPS3 Init Failed, error code: &quot;</span>), 0x80);</div>
<div class="line"><a name="l00252"></a><span class="lineno"> 252</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00253"></a><span class="lineno"> 253</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a5ae2cb9bf877595104f2425f50e2057f">NotifyFail</a>(rcode);</div>
<div class="line"><a name="l00254"></a><span class="lineno"> 254</span>&#160; <a class="code" href="class_p_s3_u_s_b.html#a5750c5448bf1ec73a7669ca2e4799c98">Release</a>();</div>
<div class="line"><a name="l00255"></a><span class="lineno"> 255</span>&#160; <span class="keywordflow">return</span> rcode;</div>
<div class="line"><a name="l00256"></a><span class="lineno"> 256</span>&#160;}</div>
<div class="line"><a name="l00257"></a><span class="lineno"> 257</span>&#160;</div>
<div class="line"><a name="l00258"></a><span class="lineno"> 258</span>&#160;<span class="comment">/* Performs a cleanup after failed Init() attempt */</span></div>
<div class="line"><a name="l00259"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#a5750c5448bf1ec73a7669ca2e4799c98"> 259</a></span>&#160;uint8_t <a class="code" href="class_p_s3_u_s_b.html#a5750c5448bf1ec73a7669ca2e4799c98">PS3USB::Release</a>() {</div>
<div class="line"><a name="l00260"></a><span class="lineno"> 260</span>&#160; <a class="code" href="class_p_s3_u_s_b.html#a0dad8754ff18d0c375c2569791d50876">PS3Connected</a> = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00261"></a><span class="lineno"> 261</span>&#160; <a class="code" href="class_p_s3_u_s_b.html#a89aa4233f3eeeb99693a099da527ec28">PS3MoveConnected</a> = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00262"></a><span class="lineno"> 262</span>&#160; <a class="code" href="class_p_s3_u_s_b.html#a54b2dcaa1e9acef83de2376b50c7ff09">PS3NavigationConnected</a> = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00263"></a><span class="lineno"> 263</span>&#160; <a class="code" href="class_p_s3_u_s_b.html#aa1873f41ae0da7c4568cfb7517560c48">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a66ab8f5eda239e761d5a48741ea1f9d4">GetAddressPool</a>().<a class="code" href="class_address_pool.html#a15fde13223dcb1da89305ad229763562">FreeAddress</a>(<a class="code" href="class_p_s3_u_s_b.html#a3f43df159277003acdf7dd107bda27fd">bAddress</a>);</div>
<div class="line"><a name="l00264"></a><span class="lineno"> 264</span>&#160; <a class="code" href="class_p_s3_u_s_b.html#a3f43df159277003acdf7dd107bda27fd">bAddress</a> = 0;</div>
<div class="line"><a name="l00265"></a><span class="lineno"> 265</span>&#160; bPollEnable = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00266"></a><span class="lineno"> 266</span>&#160; <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00267"></a><span class="lineno"> 267</span>&#160;}</div>
<div class="line"><a name="l00268"></a><span class="lineno"> 268</span>&#160;</div>
<div class="line"><a name="l00269"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#a9068e2a036012614c0db163830cbcf00"> 269</a></span>&#160;uint8_t <a class="code" href="class_p_s3_u_s_b.html#a9068e2a036012614c0db163830cbcf00">PS3USB::Poll</a>() {</div>
<div class="line"><a name="l00270"></a><span class="lineno"> 270</span>&#160; <span class="keywordflow">if</span> (!bPollEnable)</div>
<div class="line"><a name="l00271"></a><span class="lineno"> 271</span>&#160; <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00272"></a><span class="lineno"> 272</span>&#160;</div>
<div class="line"><a name="l00273"></a><span class="lineno"> 273</span>&#160; <span class="keywordflow">if</span> (<a class="code" href="class_p_s3_u_s_b.html#a0dad8754ff18d0c375c2569791d50876">PS3Connected</a> || <a class="code" href="class_p_s3_u_s_b.html#a54b2dcaa1e9acef83de2376b50c7ff09">PS3NavigationConnected</a>) {</div>
<div class="line"><a name="l00274"></a><span class="lineno"> 274</span>&#160; uint16_t BUFFER_SIZE = <a class="code" href="_p_s3_u_s_b_8h.html#abcb805b13bfd36145e252b0633bbcfc0">EP_MAXPKTSIZE</a>;</div>
<div class="line"><a name="l00275"></a><span class="lineno"> 275</span>&#160; <a class="code" href="class_p_s3_u_s_b.html#aa1873f41ae0da7c4568cfb7517560c48">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#ad75d64f648b102fab2bd75e53e1324a4">inTransfer</a>(<a class="code" href="class_p_s3_u_s_b.html#a3f43df159277003acdf7dd107bda27fd">bAddress</a>, <a class="code" href="class_p_s3_u_s_b.html#a394dbb0a59b587210e5958f08dac48f1">epInfo</a>[ <a class="code" href="_p_s3_u_s_b_8h.html#aca3cbaad8732d9185bb9bda1a32cd18d">PS3_INPUT_PIPE</a> ].epAddr, &amp;BUFFER_SIZE, readBuf); <span class="comment">// input on endpoint 1</span></div>
<div class="line"><a name="l00276"></a><span class="lineno"> 276</span>&#160; <span class="keywordflow">if</span> (millis() - timer &gt; 100) { <span class="comment">// Loop 100ms before processing data</span></div>
<div class="line"><a name="l00277"></a><span class="lineno"> 277</span>&#160; readReport();</div>
<div class="line"><a name="l00278"></a><span class="lineno"> 278</span>&#160;<span class="preprocessor">#ifdef PRINTREPORT</span></div>
<div class="line"><a name="l00279"></a><span class="lineno"> 279</span>&#160;<span class="preprocessor"></span> printReport(); <span class="comment">// Uncomment &quot;#define PRINTREPORT&quot; to print the report send by the PS3 Controllers</span></div>
<div class="line"><a name="l00280"></a><span class="lineno"> 280</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00281"></a><span class="lineno"> 281</span>&#160;<span class="preprocessor"></span> }</div>
<div class="line"><a name="l00282"></a><span class="lineno"> 282</span>&#160; } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="class_p_s3_u_s_b.html#a89aa4233f3eeeb99693a099da527ec28">PS3MoveConnected</a>) { <span class="comment">// One can only set the color of the bulb, set the rumble, set and get the bluetooth address and calibrate the magnetometer via USB</span></div>
<div class="line"><a name="l00283"></a><span class="lineno"> 283</span>&#160; <span class="keywordflow">if</span> (millis() - timer &gt; 4000) <span class="comment">// Send at least every 4th second</span></div>
<div class="line"><a name="l00284"></a><span class="lineno"> 284</span>&#160; {</div>
<div class="line"><a name="l00285"></a><span class="lineno"> 285</span>&#160; Move_Command(writeBuf, <a class="code" href="_p_s3_u_s_b_8h.html#a2c6c24a4b63d9a34926fb35d6b49cd17">MOVE_REPORT_BUFFER_SIZE</a>); <span class="comment">// The Bulb and rumble values, has to be written again and again, for it to stay turned on</span></div>
<div class="line"><a name="l00286"></a><span class="lineno"> 286</span>&#160; timer = millis();</div>
<div class="line"><a name="l00287"></a><span class="lineno"> 287</span>&#160; }</div>
<div class="line"><a name="l00288"></a><span class="lineno"> 288</span>&#160; }</div>
<div class="line"><a name="l00289"></a><span class="lineno"> 289</span>&#160; <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00290"></a><span class="lineno"> 290</span>&#160;}</div>
<div class="line"><a name="l00291"></a><span class="lineno"> 291</span>&#160;</div>
<div class="line"><a name="l00292"></a><span class="lineno"> 292</span>&#160;<span class="keywordtype">void</span> PS3USB::readReport() {</div>
<div class="line"><a name="l00293"></a><span class="lineno"> 293</span>&#160; <span class="keywordflow">if</span> (readBuf == NULL)</div>
<div class="line"><a name="l00294"></a><span class="lineno"> 294</span>&#160; <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00295"></a><span class="lineno"> 295</span>&#160;</div>
<div class="line"><a name="l00296"></a><span class="lineno"> 296</span>&#160; ButtonState = (uint32_t)(readBuf[2] | ((uint16_t)readBuf[3] &lt;&lt; 8) | ((uint32_t)readBuf[4] &lt;&lt; 16));</div>
<div class="line"><a name="l00297"></a><span class="lineno"> 297</span>&#160;</div>
<div class="line"><a name="l00298"></a><span class="lineno"> 298</span>&#160; <span class="comment">//Notify(PSTR(&quot;\r\nButtonState&quot;, 0x80);</span></div>
<div class="line"><a name="l00299"></a><span class="lineno"> 299</span>&#160; <span class="comment">//PrintHex&lt;uint32_t&gt;(ButtonState, 0x80);</span></div>
<div class="line"><a name="l00300"></a><span class="lineno"> 300</span>&#160;</div>
<div class="line"><a name="l00301"></a><span class="lineno"> 301</span>&#160; <span class="keywordflow">if</span> (ButtonState != OldButtonState) {</div>
<div class="line"><a name="l00302"></a><span class="lineno"> 302</span>&#160; ButtonClickState = ButtonState &amp; ~OldButtonState; <span class="comment">// Update click state variable</span></div>
<div class="line"><a name="l00303"></a><span class="lineno"> 303</span>&#160; OldButtonState = ButtonState;</div>
<div class="line"><a name="l00304"></a><span class="lineno"> 304</span>&#160; }</div>
<div class="line"><a name="l00305"></a><span class="lineno"> 305</span>&#160;}</div>
<div class="line"><a name="l00306"></a><span class="lineno"> 306</span>&#160;</div>
<div class="line"><a name="l00307"></a><span class="lineno"> 307</span>&#160;<span class="keywordtype">void</span> PS3USB::printReport() { <span class="comment">//Uncomment &quot;#define PRINTREPORT&quot; to print the report send by the PS3 Controllers</span></div>
<div class="line"><a name="l00308"></a><span class="lineno"> 308</span>&#160;<span class="preprocessor">#ifdef PRINTREPORT</span></div>
<div class="line"><a name="l00309"></a><span class="lineno"> 309</span>&#160;<span class="preprocessor"></span> <span class="keywordflow">if</span> (readBuf == NULL)</div>
<div class="line"><a name="l00310"></a><span class="lineno"> 310</span>&#160; <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00311"></a><span class="lineno"> 311</span>&#160; <span class="keywordflow">for</span> (uint8_t i = 0; i &lt; <a class="code" href="_p_s3_u_s_b_8h.html#a4898fccf5d2aa053bc67894aa3627e0f">PS3_REPORT_BUFFER_SIZE</a>; i++) {</div>
<div class="line"><a name="l00312"></a><span class="lineno"> 312</span>&#160; PrintHex&lt;uint8_t &gt; (readBuf[i], 0x80);</div>
<div class="line"><a name="l00313"></a><span class="lineno"> 313</span>&#160; Serial.print(<span class="stringliteral">&quot; &quot;</span>);</div>
<div class="line"><a name="l00314"></a><span class="lineno"> 314</span>&#160; }</div>
<div class="line"><a name="l00315"></a><span class="lineno"> 315</span>&#160;}</div>
<div class="line"><a name="l00316"></a><span class="lineno"> 316</span>&#160;</div>
<div class="line"><a name="l00317"></a><span class="lineno"> 317</span>&#160;<span class="keywordtype">void</span> PS3USB::printReport() { <span class="comment">//Uncomment &quot;#define PRINTREPORT&quot; to print the report send by the PS3 Controllers</span></div>
<div class="line"><a name="l00318"></a><span class="lineno"> 318</span>&#160;<span class="preprocessor">#ifdef PRINTREPORT</span></div>
<div class="line"><a name="l00319"></a><span class="lineno"> 319</span>&#160;<span class="preprocessor"></span> <span class="keywordflow">if</span> (readBuf == NULL)</div>
<div class="line"><a name="l00320"></a><span class="lineno"> 320</span>&#160; <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00321"></a><span class="lineno"> 321</span>&#160; <span class="keywordflow">for</span>(uint8_t i = 0; i &lt; <a class="code" href="_p_s3_u_s_b_8h.html#a4898fccf5d2aa053bc67894aa3627e0f">PS3_REPORT_BUFFER_SIZE</a>;i++) {</div>
<div class="line"><a name="l00322"></a><span class="lineno"> 322</span>&#160; PrintHex&lt;uint8_t&gt;(readBuf[i]);</div>
<div class="line"><a name="l00323"></a><span class="lineno"> 323</span>&#160; Serial.print(<span class="stringliteral">&quot; &quot;</span>);</div>
<div class="line"><a name="l00324"></a><span class="lineno"> 324</span>&#160; } </div>
<div class="line"><a name="l00325"></a><span class="lineno"> 325</span>&#160; Serial.println();</div>
<div class="line"><a name="l00326"></a><span class="lineno"> 326</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00327"></a><span class="lineno"> 327</span>&#160;<span class="preprocessor"></span>}</div>
<div class="line"><a name="l00328"></a><span class="lineno"> 328</span>&#160;</div>
<div class="line"><a name="l00329"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#ad1de9af6fb34f4cff6c1ed0af21b0141"> 329</a></span>&#160;<span class="keywordtype">bool</span> <a class="code" href="class_p_s3_u_s_b.html#ad1de9af6fb34f4cff6c1ed0af21b0141">PS3USB::getButtonPress</a>(<a class="code" href="controller_enums_8h.html#a03bfec859eac87be20f8952c1eb89de0">Button</a> b) {</div>
<div class="line"><a name="l00330"></a><span class="lineno"> 330</span>&#160; <span class="keywordflow">return</span> (ButtonState &amp; pgm_read_dword(&amp;BUTTONS[(uint8_t)b]));</div>
<div class="line"><a name="l00331"></a><span class="lineno"> 331</span>&#160;}</div>
<div class="line"><a name="l00332"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#a9a50f5ed5b41232336cc6d1870795230"> 332</a></span>&#160;<span class="keywordtype">bool</span> <a class="code" href="class_p_s3_u_s_b.html#a9a50f5ed5b41232336cc6d1870795230">PS3USB::getButtonClick</a>(<a class="code" href="controller_enums_8h.html#a03bfec859eac87be20f8952c1eb89de0">Button</a> b) {</div>
<div class="line"><a name="l00333"></a><span class="lineno"> 333</span>&#160; uint32_t button = pgm_read_dword(&amp;BUTTONS[(uint8_t)b]);</div>
<div class="line"><a name="l00334"></a><span class="lineno"> 334</span>&#160; <span class="keywordtype">bool</span> click = (ButtonClickState &amp; button);</div>
<div class="line"><a name="l00335"></a><span class="lineno"> 335</span>&#160; ButtonClickState &amp;= ~button; <span class="comment">// clear &quot;click&quot; event</span></div>
<div class="line"><a name="l00336"></a><span class="lineno"> 336</span>&#160; <span class="keywordflow">return</span> click;</div>
<div class="line"><a name="l00337"></a><span class="lineno"> 337</span>&#160;}</div>
<div class="line"><a name="l00338"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#a2d30813a3f5c4729b5c1662832d5a6e0"> 338</a></span>&#160;uint8_t <a class="code" href="class_p_s3_u_s_b.html#a2d30813a3f5c4729b5c1662832d5a6e0">PS3USB::getAnalogButton</a>(<a class="code" href="controller_enums_8h.html#a03bfec859eac87be20f8952c1eb89de0">Button</a> a) {</div>
<div class="line"><a name="l00339"></a><span class="lineno"> 339</span>&#160; <span class="keywordflow">if</span> (readBuf == NULL)</div>
<div class="line"><a name="l00340"></a><span class="lineno"> 340</span>&#160; <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00341"></a><span class="lineno"> 341</span>&#160; <span class="keywordflow">return</span> (uint8_t)(readBuf[(pgm_read_byte(&amp;ANALOGBUTTONS[(uint8_t)a]))-9]);</div>
<div class="line"><a name="l00342"></a><span class="lineno"> 342</span>&#160;}</div>
<div class="line"><a name="l00343"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#a2b0f391b8ae3e80b18cf9108c3e8f7e3"> 343</a></span>&#160;uint8_t <a class="code" href="class_p_s3_u_s_b.html#a2b0f391b8ae3e80b18cf9108c3e8f7e3">PS3USB::getAnalogHat</a>(<a class="code" href="controller_enums_8h.html#aaaabdefc068fd57ec2bef2b62ea4ba92">AnalogHat</a> a) {</div>
<div class="line"><a name="l00344"></a><span class="lineno"> 344</span>&#160; <span class="keywordflow">if</span> (readBuf == NULL)</div>
<div class="line"><a name="l00345"></a><span class="lineno"> 345</span>&#160; <span class="keywordflow">return</span> 0; </div>
<div class="line"><a name="l00346"></a><span class="lineno"> 346</span>&#160; <span class="keywordflow">return</span> (uint8_t)(readBuf[((uint8_t)a+6)]);</div>
<div class="line"><a name="l00347"></a><span class="lineno"> 347</span>&#160;}</div>
<div class="line"><a name="l00348"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#a4fe61beae6f0e36e4df1ea388bed0783"> 348</a></span>&#160;uint16_t <a class="code" href="class_p_s3_u_s_b.html#a4fe61beae6f0e36e4df1ea388bed0783">PS3USB::getSensor</a>(<a class="code" href="_p_s3_enums_8h.html#a9628766e5f200cc84b296b071b09ff4a">Sensor</a> a) {</div>
<div class="line"><a name="l00349"></a><span class="lineno"> 349</span>&#160; <span class="keywordflow">if</span> (readBuf == NULL)</div>
<div class="line"><a name="l00350"></a><span class="lineno"> 350</span>&#160; <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00351"></a><span class="lineno"> 351</span>&#160; <span class="keywordflow">return</span> ((readBuf[((uint16_t)a)-9] &lt;&lt; 8) | readBuf[((uint16_t)a + 1)-9]);</div>
<div class="line"><a name="l00352"></a><span class="lineno"> 352</span>&#160;}</div>
<div class="line"><a name="l00353"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#a9b9e5a3a3e80957f47f86f4155fee777"> 353</a></span>&#160;<span class="keywordtype">double</span> <a class="code" href="class_p_s3_u_s_b.html#a9b9e5a3a3e80957f47f86f4155fee777">PS3USB::getAngle</a>(<a class="code" href="_p_s3_enums_8h.html#a0200d2d1b3a7930d0be6c50e7c8ae7d1">Angle</a> a) { </div>
<div class="line"><a name="l00354"></a><span class="lineno"> 354</span>&#160; <span class="keywordflow">if</span>(<a class="code" href="class_p_s3_u_s_b.html#a0dad8754ff18d0c375c2569791d50876">PS3Connected</a>) {</div>
<div class="line"><a name="l00355"></a><span class="lineno"> 355</span>&#160; <span class="keywordtype">double</span> accXval;</div>
<div class="line"><a name="l00356"></a><span class="lineno"> 356</span>&#160; <span class="keywordtype">double</span> accYval;</div>
<div class="line"><a name="l00357"></a><span class="lineno"> 357</span>&#160; <span class="keywordtype">double</span> accZval;</div>
<div class="line"><a name="l00358"></a><span class="lineno"> 358</span>&#160; </div>
<div class="line"><a name="l00359"></a><span class="lineno"> 359</span>&#160; <span class="comment">// Data for the Kionix KXPC4 used in the DualShock 3</span></div>
<div class="line"><a name="l00360"></a><span class="lineno"> 360</span>&#160; <span class="keyword">const</span> <span class="keywordtype">double</span> zeroG = 511.5; <span class="comment">// 1.65/3.3*1023 (1,65V)</span></div>
<div class="line"><a name="l00361"></a><span class="lineno"> 361</span>&#160; accXval = -((double)<a class="code" href="class_p_s3_u_s_b.html#a4fe61beae6f0e36e4df1ea388bed0783">getSensor</a>(<a class="code" href="_p_s3_enums_8h.html#a9628766e5f200cc84b296b071b09ff4aa1b657addccd19368e17fd15ce396a2eb">aX</a>)-zeroG);</div>
<div class="line"><a name="l00362"></a><span class="lineno"> 362</span>&#160; accYval = -((double)<a class="code" href="class_p_s3_u_s_b.html#a4fe61beae6f0e36e4df1ea388bed0783">getSensor</a>(<a class="code" href="_p_s3_enums_8h.html#a9628766e5f200cc84b296b071b09ff4aaba377ea700e0cdf1c61034ef60b259bd">aY</a>)-zeroG);</div>
<div class="line"><a name="l00363"></a><span class="lineno"> 363</span>&#160; accZval = -((double)<a class="code" href="class_p_s3_u_s_b.html#a4fe61beae6f0e36e4df1ea388bed0783">getSensor</a>(<a class="code" href="_p_s3_enums_8h.html#a9628766e5f200cc84b296b071b09ff4aa4a709497e95c67840807ab9e99af2bbc">aZ</a>)-zeroG);</div>
<div class="line"><a name="l00364"></a><span class="lineno"> 364</span>&#160; </div>
<div class="line"><a name="l00365"></a><span class="lineno"> 365</span>&#160; <span class="comment">// Convert to 360 degrees resolution</span></div>
<div class="line"><a name="l00366"></a><span class="lineno"> 366</span>&#160; <span class="comment">// atan2 outputs the value of -π to π (radians)</span></div>
<div class="line"><a name="l00367"></a><span class="lineno"> 367</span>&#160; <span class="comment">// We are then converting it to 0 to 2π and then to degrees </span></div>
<div class="line"><a name="l00368"></a><span class="lineno"> 368</span>&#160; <span class="keywordflow">if</span> (a == <a class="code" href="_p_s3_enums_8h.html#a0200d2d1b3a7930d0be6c50e7c8ae7d1ae3a34b760fa4a6854f28852e91d8bb47">Pitch</a>) { </div>
<div class="line"><a name="l00369"></a><span class="lineno"> 369</span>&#160; <span class="keywordtype">double</span> angle = (atan2(accYval,accZval)+PI)*RAD_TO_DEG;</div>
<div class="line"><a name="l00370"></a><span class="lineno"> 370</span>&#160; <span class="keywordflow">return</span> angle;</div>
<div class="line"><a name="l00371"></a><span class="lineno"> 371</span>&#160; } <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00372"></a><span class="lineno"> 372</span>&#160; <span class="keywordtype">double</span> angle = (atan2(accXval,accZval)+PI)*RAD_TO_DEG;</div>
<div class="line"><a name="l00373"></a><span class="lineno"> 373</span>&#160; <span class="keywordflow">return</span> angle;</div>
<div class="line"><a name="l00374"></a><span class="lineno"> 374</span>&#160; }</div>
<div class="line"><a name="l00375"></a><span class="lineno"> 375</span>&#160; } <span class="keywordflow">else</span></div>
<div class="line"><a name="l00376"></a><span class="lineno"> 376</span>&#160; <span class="keywordflow">return</span> 0; </div>
<div class="line"><a name="l00377"></a><span class="lineno"> 377</span>&#160;}</div>
<div class="line"><a name="l00378"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#a09da3bcd33a8dd20d7cb06a70833e448"> 378</a></span>&#160;<span class="keywordtype">bool</span> <a class="code" href="class_p_s3_u_s_b.html#a09da3bcd33a8dd20d7cb06a70833e448">PS3USB::getStatus</a>(<a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70b">Status</a> c) {</div>
<div class="line"><a name="l00379"></a><span class="lineno"> 379</span>&#160; <span class="keywordflow">if</span> (readBuf == NULL)</div>
<div class="line"><a name="l00380"></a><span class="lineno"> 380</span>&#160; <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l00381"></a><span class="lineno"> 381</span>&#160; <span class="keywordflow">if</span> (readBuf[((uint16_t)c &gt;&gt; 8)-9] == ((uint8_t)c &amp; 0xff))</div>
<div class="line"><a name="l00382"></a><span class="lineno"> 382</span>&#160; <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00383"></a><span class="lineno"> 383</span>&#160; <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l00384"></a><span class="lineno"> 384</span>&#160;}</div>
<div class="line"><a name="l00385"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#ae3f19089341bb545f31b3b01e77131ae"> 385</a></span>&#160;String <a class="code" href="class_p_s3_u_s_b.html#ae3f19089341bb545f31b3b01e77131ae">PS3USB::getStatusString</a>() {</div>
<div class="line"><a name="l00386"></a><span class="lineno"> 386</span>&#160; <span class="keywordflow">if</span> (<a class="code" href="class_p_s3_u_s_b.html#a0dad8754ff18d0c375c2569791d50876">PS3Connected</a> || <a class="code" href="class_p_s3_u_s_b.html#a54b2dcaa1e9acef83de2376b50c7ff09">PS3NavigationConnected</a>) {</div>
<div class="line"><a name="l00387"></a><span class="lineno"> 387</span>&#160; <span class="keywordtype">char</span> statusOutput[100];</div>
<div class="line"><a name="l00388"></a><span class="lineno"> 388</span>&#160; </div>
<div class="line"><a name="l00389"></a><span class="lineno"> 389</span>&#160; strcpy(statusOutput,<span class="stringliteral">&quot;ConnectionStatus: &quot;</span>);</div>
<div class="line"><a name="l00390"></a><span class="lineno"> 390</span>&#160; </div>
<div class="line"><a name="l00391"></a><span class="lineno"> 391</span>&#160; <span class="keywordflow">if</span> (<a class="code" href="class_p_s3_u_s_b.html#a09da3bcd33a8dd20d7cb06a70833e448">getStatus</a>(<a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70baff01ce39b42bec30132b0fc53c882387">Plugged</a>)) strcat(statusOutput,<span class="stringliteral">&quot;Plugged&quot;</span>);</div>
<div class="line"><a name="l00392"></a><span class="lineno"> 392</span>&#160; <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="class_p_s3_u_s_b.html#a09da3bcd33a8dd20d7cb06a70833e448">getStatus</a>(<a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70bae37160f3a65bb54a91fb5efb4f971924">Unplugged</a>)) strcat(statusOutput,<span class="stringliteral">&quot;Unplugged&quot;</span>);</div>
<div class="line"><a name="l00393"></a><span class="lineno"> 393</span>&#160; <span class="keywordflow">else</span> strcat(statusOutput,<span class="stringliteral">&quot;Error&quot;</span>);</div>
<div class="line"><a name="l00315"></a><span class="lineno"> 315</span>&#160; Serial.println();</div>
<div class="line"><a name="l00316"></a><span class="lineno"> 316</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00317"></a><span class="lineno"> 317</span>&#160;<span class="preprocessor"></span>}</div>
<div class="line"><a name="l00318"></a><span class="lineno"> 318</span>&#160;</div>
<div class="line"><a name="l00319"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#ad1de9af6fb34f4cff6c1ed0af21b0141"> 319</a></span>&#160;<span class="keywordtype">bool</span> <a class="code" href="class_p_s3_u_s_b.html#ad1de9af6fb34f4cff6c1ed0af21b0141">PS3USB::getButtonPress</a>(<a class="code" href="controller_enums_8h.html#a03bfec859eac87be20f8952c1eb89de0">Button</a> b) {</div>
<div class="line"><a name="l00320"></a><span class="lineno"> 320</span>&#160; <span class="keywordflow">return</span> (ButtonState &amp; pgm_read_dword(&amp;<a class="code" href="_p_s3_enums_8h.html#af3392eea150ac9151bef45148f0d7895">BUTTONS</a>[(uint8_t)b]));</div>
<div class="line"><a name="l00321"></a><span class="lineno"> 321</span>&#160;}</div>
<div class="line"><a name="l00322"></a><span class="lineno"> 322</span>&#160;</div>
<div class="line"><a name="l00323"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#a9a50f5ed5b41232336cc6d1870795230"> 323</a></span>&#160;<span class="keywordtype">bool</span> <a class="code" href="class_p_s3_u_s_b.html#a9a50f5ed5b41232336cc6d1870795230">PS3USB::getButtonClick</a>(<a class="code" href="controller_enums_8h.html#a03bfec859eac87be20f8952c1eb89de0">Button</a> b) {</div>
<div class="line"><a name="l00324"></a><span class="lineno"> 324</span>&#160; uint32_t button = pgm_read_dword(&amp;<a class="code" href="_p_s3_enums_8h.html#af3392eea150ac9151bef45148f0d7895">BUTTONS</a>[(uint8_t)b]);</div>
<div class="line"><a name="l00325"></a><span class="lineno"> 325</span>&#160; <span class="keywordtype">bool</span> click = (ButtonClickState &amp; button);</div>
<div class="line"><a name="l00326"></a><span class="lineno"> 326</span>&#160; ButtonClickState &amp;= ~button; <span class="comment">// clear &quot;click&quot; event</span></div>
<div class="line"><a name="l00327"></a><span class="lineno"> 327</span>&#160; <span class="keywordflow">return</span> click;</div>
<div class="line"><a name="l00328"></a><span class="lineno"> 328</span>&#160;}</div>
<div class="line"><a name="l00329"></a><span class="lineno"> 329</span>&#160;</div>
<div class="line"><a name="l00330"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#a2d30813a3f5c4729b5c1662832d5a6e0"> 330</a></span>&#160;uint8_t <a class="code" href="class_p_s3_u_s_b.html#a2d30813a3f5c4729b5c1662832d5a6e0">PS3USB::getAnalogButton</a>(<a class="code" href="controller_enums_8h.html#a03bfec859eac87be20f8952c1eb89de0">Button</a> a) {</div>
<div class="line"><a name="l00331"></a><span class="lineno"> 331</span>&#160; <span class="keywordflow">if</span> (readBuf == NULL)</div>
<div class="line"><a name="l00332"></a><span class="lineno"> 332</span>&#160; <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00333"></a><span class="lineno"> 333</span>&#160; <span class="keywordflow">return</span> (uint8_t)(readBuf[(pgm_read_byte(&amp;<a class="code" href="_p_s3_enums_8h.html#abb19c2ede75659ab3b926996a8a09f2f">ANALOGBUTTONS</a>[(uint8_t)a])) - 9]);</div>
<div class="line"><a name="l00334"></a><span class="lineno"> 334</span>&#160;}</div>
<div class="line"><a name="l00335"></a><span class="lineno"> 335</span>&#160;</div>
<div class="line"><a name="l00336"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#a2b0f391b8ae3e80b18cf9108c3e8f7e3"> 336</a></span>&#160;uint8_t <a class="code" href="class_p_s3_u_s_b.html#a2b0f391b8ae3e80b18cf9108c3e8f7e3">PS3USB::getAnalogHat</a>(<a class="code" href="controller_enums_8h.html#aaaabdefc068fd57ec2bef2b62ea4ba92">AnalogHat</a> a) {</div>
<div class="line"><a name="l00337"></a><span class="lineno"> 337</span>&#160; <span class="keywordflow">if</span> (readBuf == NULL)</div>
<div class="line"><a name="l00338"></a><span class="lineno"> 338</span>&#160; <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00339"></a><span class="lineno"> 339</span>&#160; <span class="keywordflow">return</span> (uint8_t)(readBuf[((uint8_t)a + 6)]);</div>
<div class="line"><a name="l00340"></a><span class="lineno"> 340</span>&#160;}</div>
<div class="line"><a name="l00341"></a><span class="lineno"> 341</span>&#160;</div>
<div class="line"><a name="l00342"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#a4fe61beae6f0e36e4df1ea388bed0783"> 342</a></span>&#160;uint16_t <a class="code" href="class_p_s3_u_s_b.html#a4fe61beae6f0e36e4df1ea388bed0783">PS3USB::getSensor</a>(<a class="code" href="_p_s3_enums_8h.html#a9628766e5f200cc84b296b071b09ff4a">Sensor</a> a) {</div>
<div class="line"><a name="l00343"></a><span class="lineno"> 343</span>&#160; <span class="keywordflow">if</span> (readBuf == NULL)</div>
<div class="line"><a name="l00344"></a><span class="lineno"> 344</span>&#160; <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00345"></a><span class="lineno"> 345</span>&#160; <span class="keywordflow">return</span> ((readBuf[((uint16_t)a) - 9] &lt;&lt; 8) | readBuf[((uint16_t)a + 1) - 9]);</div>
<div class="line"><a name="l00346"></a><span class="lineno"> 346</span>&#160;}</div>
<div class="line"><a name="l00347"></a><span class="lineno"> 347</span>&#160;</div>
<div class="line"><a name="l00348"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#a9b9e5a3a3e80957f47f86f4155fee777"> 348</a></span>&#160;<span class="keywordtype">double</span> <a class="code" href="class_p_s3_u_s_b.html#a9b9e5a3a3e80957f47f86f4155fee777">PS3USB::getAngle</a>(<a class="code" href="_p_s3_enums_8h.html#a0200d2d1b3a7930d0be6c50e7c8ae7d1">Angle</a> a) {</div>
<div class="line"><a name="l00349"></a><span class="lineno"> 349</span>&#160; <span class="keywordflow">if</span> (<a class="code" href="class_p_s3_u_s_b.html#a0dad8754ff18d0c375c2569791d50876">PS3Connected</a>) {</div>
<div class="line"><a name="l00350"></a><span class="lineno"> 350</span>&#160; <span class="keywordtype">double</span> accXval;</div>
<div class="line"><a name="l00351"></a><span class="lineno"> 351</span>&#160; <span class="keywordtype">double</span> accYval;</div>
<div class="line"><a name="l00352"></a><span class="lineno"> 352</span>&#160; <span class="keywordtype">double</span> accZval;</div>
<div class="line"><a name="l00353"></a><span class="lineno"> 353</span>&#160;</div>
<div class="line"><a name="l00354"></a><span class="lineno"> 354</span>&#160; <span class="comment">// Data for the Kionix KXPC4 used in the DualShock 3</span></div>
<div class="line"><a name="l00355"></a><span class="lineno"> 355</span>&#160; <span class="keyword">const</span> <span class="keywordtype">double</span> zeroG = 511.5; <span class="comment">// 1.65/3.3*1023 (1,65V)</span></div>
<div class="line"><a name="l00356"></a><span class="lineno"> 356</span>&#160; accXval = -((double)<a class="code" href="class_p_s3_u_s_b.html#a4fe61beae6f0e36e4df1ea388bed0783">getSensor</a>(<a class="code" href="_p_s3_enums_8h.html#a9628766e5f200cc84b296b071b09ff4aa1b657addccd19368e17fd15ce396a2eb">aX</a>) - zeroG);</div>
<div class="line"><a name="l00357"></a><span class="lineno"> 357</span>&#160; accYval = -((double)<a class="code" href="class_p_s3_u_s_b.html#a4fe61beae6f0e36e4df1ea388bed0783">getSensor</a>(<a class="code" href="_p_s3_enums_8h.html#a9628766e5f200cc84b296b071b09ff4aaba377ea700e0cdf1c61034ef60b259bd">aY</a>) - zeroG);</div>
<div class="line"><a name="l00358"></a><span class="lineno"> 358</span>&#160; accZval = -((double)<a class="code" href="class_p_s3_u_s_b.html#a4fe61beae6f0e36e4df1ea388bed0783">getSensor</a>(<a class="code" href="_p_s3_enums_8h.html#a9628766e5f200cc84b296b071b09ff4aa4a709497e95c67840807ab9e99af2bbc">aZ</a>) - zeroG);</div>
<div class="line"><a name="l00359"></a><span class="lineno"> 359</span>&#160;</div>
<div class="line"><a name="l00360"></a><span class="lineno"> 360</span>&#160; <span class="comment">// Convert to 360 degrees resolution</span></div>
<div class="line"><a name="l00361"></a><span class="lineno"> 361</span>&#160; <span class="comment">// atan2 outputs the value of -π to π (radians)</span></div>
<div class="line"><a name="l00362"></a><span class="lineno"> 362</span>&#160; <span class="comment">// We are then converting it to 0 to 2π and then to degrees</span></div>
<div class="line"><a name="l00363"></a><span class="lineno"> 363</span>&#160; <span class="keywordflow">if</span> (a == <a class="code" href="_p_s3_enums_8h.html#a0200d2d1b3a7930d0be6c50e7c8ae7d1ae3a34b760fa4a6854f28852e91d8bb47">Pitch</a>) {</div>
<div class="line"><a name="l00364"></a><span class="lineno"> 364</span>&#160; <span class="keywordtype">double</span> angle = (atan2(accYval, accZval) + PI) * RAD_TO_DEG;</div>
<div class="line"><a name="l00365"></a><span class="lineno"> 365</span>&#160; <span class="keywordflow">return</span> angle;</div>
<div class="line"><a name="l00366"></a><span class="lineno"> 366</span>&#160; } <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00367"></a><span class="lineno"> 367</span>&#160; <span class="keywordtype">double</span> angle = (atan2(accXval, accZval) + PI) * RAD_TO_DEG;</div>
<div class="line"><a name="l00368"></a><span class="lineno"> 368</span>&#160; <span class="keywordflow">return</span> angle;</div>
<div class="line"><a name="l00369"></a><span class="lineno"> 369</span>&#160; }</div>
<div class="line"><a name="l00370"></a><span class="lineno"> 370</span>&#160; } <span class="keywordflow">else</span></div>
<div class="line"><a name="l00371"></a><span class="lineno"> 371</span>&#160; <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00372"></a><span class="lineno"> 372</span>&#160;}</div>
<div class="line"><a name="l00373"></a><span class="lineno"> 373</span>&#160;</div>
<div class="line"><a name="l00374"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#a09da3bcd33a8dd20d7cb06a70833e448"> 374</a></span>&#160;<span class="keywordtype">bool</span> <a class="code" href="class_p_s3_u_s_b.html#a09da3bcd33a8dd20d7cb06a70833e448">PS3USB::getStatus</a>(<a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70b">Status</a> c) {</div>
<div class="line"><a name="l00375"></a><span class="lineno"> 375</span>&#160; <span class="keywordflow">if</span> (readBuf == NULL)</div>
<div class="line"><a name="l00376"></a><span class="lineno"> 376</span>&#160; <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l00377"></a><span class="lineno"> 377</span>&#160; <span class="keywordflow">if</span> (readBuf[((uint16_t)c &gt;&gt; 8) - 9] == ((uint8_t)c &amp; 0xff))</div>
<div class="line"><a name="l00378"></a><span class="lineno"> 378</span>&#160; <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00379"></a><span class="lineno"> 379</span>&#160; <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l00380"></a><span class="lineno"> 380</span>&#160;}</div>
<div class="line"><a name="l00381"></a><span class="lineno"> 381</span>&#160;</div>
<div class="line"><a name="l00382"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#ae3f19089341bb545f31b3b01e77131ae"> 382</a></span>&#160;String <a class="code" href="class_p_s3_u_s_b.html#ae3f19089341bb545f31b3b01e77131ae">PS3USB::getStatusString</a>() {</div>
<div class="line"><a name="l00383"></a><span class="lineno"> 383</span>&#160; <span class="keywordflow">if</span> (<a class="code" href="class_p_s3_u_s_b.html#a0dad8754ff18d0c375c2569791d50876">PS3Connected</a> || <a class="code" href="class_p_s3_u_s_b.html#a54b2dcaa1e9acef83de2376b50c7ff09">PS3NavigationConnected</a>) {</div>
<div class="line"><a name="l00384"></a><span class="lineno"> 384</span>&#160; <span class="keywordtype">char</span> statusOutput[100];</div>
<div class="line"><a name="l00385"></a><span class="lineno"> 385</span>&#160;</div>
<div class="line"><a name="l00386"></a><span class="lineno"> 386</span>&#160; strcpy(statusOutput, <span class="stringliteral">&quot;ConnectionStatus: &quot;</span>);</div>
<div class="line"><a name="l00387"></a><span class="lineno"> 387</span>&#160;</div>
<div class="line"><a name="l00388"></a><span class="lineno"> 388</span>&#160; <span class="keywordflow">if</span> (<a class="code" href="class_p_s3_u_s_b.html#a09da3bcd33a8dd20d7cb06a70833e448">getStatus</a>(<a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70baff01ce39b42bec30132b0fc53c882387">Plugged</a>)) strcat(statusOutput, <span class="stringliteral">&quot;Plugged&quot;</span>);</div>
<div class="line"><a name="l00389"></a><span class="lineno"> 389</span>&#160; <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="class_p_s3_u_s_b.html#a09da3bcd33a8dd20d7cb06a70833e448">getStatus</a>(<a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70bae37160f3a65bb54a91fb5efb4f971924">Unplugged</a>)) strcat(statusOutput, <span class="stringliteral">&quot;Unplugged&quot;</span>);</div>
<div class="line"><a name="l00390"></a><span class="lineno"> 390</span>&#160; <span class="keywordflow">else</span> strcat(statusOutput, <span class="stringliteral">&quot;Error&quot;</span>);</div>
<div class="line"><a name="l00391"></a><span class="lineno"> 391</span>&#160;</div>
<div class="line"><a name="l00392"></a><span class="lineno"> 392</span>&#160;</div>
<div class="line"><a name="l00393"></a><span class="lineno"> 393</span>&#160; strcat(statusOutput, <span class="stringliteral">&quot; - PowerRating: &quot;</span>);</div>
<div class="line"><a name="l00394"></a><span class="lineno"> 394</span>&#160;</div>
<div class="line"><a name="l00395"></a><span class="lineno"> 395</span>&#160; </div>
<div class="line"><a name="l00396"></a><span class="lineno"> 396</span>&#160; strcat(statusOutput,<span class="stringliteral">&quot; - PowerRating: &quot;</span>);</div>
<div class="line"><a name="l00397"></a><span class="lineno"> 397</span>&#160; </div>
<div class="line"><a name="l00398"></a><span class="lineno"> 398</span>&#160; <span class="keywordflow">if</span> (<a class="code" href="class_p_s3_u_s_b.html#a09da3bcd33a8dd20d7cb06a70833e448">getStatus</a>(<a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba5a86ae1482947377a116685c168d1773">Charging</a>)) strcat(statusOutput,<span class="stringliteral">&quot;Charging&quot;</span>);</div>
<div class="line"><a name="l00399"></a><span class="lineno"> 399</span>&#160; <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="class_p_s3_u_s_b.html#a09da3bcd33a8dd20d7cb06a70833e448">getStatus</a>(<a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70bac138cecbd4ef1ba0f9e0ab12440a6df6">NotCharging</a>)) strcat(statusOutput,<span class="stringliteral">&quot;Not Charging&quot;</span>);</div>
<div class="line"><a name="l00400"></a><span class="lineno"> 400</span>&#160; <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="class_p_s3_u_s_b.html#a09da3bcd33a8dd20d7cb06a70833e448">getStatus</a>(<a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba82084136e62c38642986b05419b4e734">Shutdown</a>)) strcat(statusOutput,<span class="stringliteral">&quot;Shutdown&quot;</span>);</div>
<div class="line"><a name="l00401"></a><span class="lineno"> 401</span>&#160; <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="class_p_s3_u_s_b.html#a09da3bcd33a8dd20d7cb06a70833e448">getStatus</a>(<a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba96cc2a0090ada376561406d48d1f2089">Dying</a>)) strcat(statusOutput,<span class="stringliteral">&quot;Dying&quot;</span>);</div>
<div class="line"><a name="l00402"></a><span class="lineno"> 402</span>&#160; <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="class_p_s3_u_s_b.html#a09da3bcd33a8dd20d7cb06a70833e448">getStatus</a>(<a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba7a352a3dd2accc1dd65a4538c3754ee8">Low</a>)) strcat(statusOutput,<span class="stringliteral">&quot;Low&quot;</span>);</div>
<div class="line"><a name="l00403"></a><span class="lineno"> 403</span>&#160; <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="class_p_s3_u_s_b.html#a09da3bcd33a8dd20d7cb06a70833e448">getStatus</a>(<a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba24c57acd029e3f96fede49402ea01e6f">High</a>)) strcat(statusOutput,<span class="stringliteral">&quot;High&quot;</span>);</div>
<div class="line"><a name="l00404"></a><span class="lineno"> 404</span>&#160; <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="class_p_s3_u_s_b.html#a09da3bcd33a8dd20d7cb06a70833e448">getStatus</a>(<a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba8b7c5cd8bd8eb51ee6d3fd0eac584679">Full</a>)) strcat(statusOutput,<span class="stringliteral">&quot;Full&quot;</span>);</div>
<div class="line"><a name="l00405"></a><span class="lineno"> 405</span>&#160; <span class="keywordflow">else</span> strcat(statusOutput,<span class="stringliteral">&quot;Error&quot;</span>);</div>
<div class="line"><a name="l00406"></a><span class="lineno"> 406</span>&#160; </div>
<div class="line"><a name="l00407"></a><span class="lineno"> 407</span>&#160; strcat(statusOutput,<span class="stringliteral">&quot; - WirelessStatus: &quot;</span>);</div>
<div class="line"><a name="l00408"></a><span class="lineno"> 408</span>&#160; </div>
<div class="line"><a name="l00409"></a><span class="lineno"> 409</span>&#160; <span class="keywordflow">if</span> (<a class="code" href="class_p_s3_u_s_b.html#a09da3bcd33a8dd20d7cb06a70833e448">getStatus</a>(<a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba71c14aef95c9953673a880e2633fa209">CableRumble</a>)) strcat(statusOutput,<span class="stringliteral">&quot;Cable - Rumble is on&quot;</span>);</div>
<div class="line"><a name="l00410"></a><span class="lineno"> 410</span>&#160; <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="class_p_s3_u_s_b.html#a09da3bcd33a8dd20d7cb06a70833e448">getStatus</a>(<a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba1a36ca9a60a5e244f3404ec0db7b44a1">Cable</a>)) strcat(statusOutput,<span class="stringliteral">&quot;Cable - Rumble is off&quot;</span>);</div>
<div class="line"><a name="l00411"></a><span class="lineno"> 411</span>&#160; <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="class_p_s3_u_s_b.html#a09da3bcd33a8dd20d7cb06a70833e448">getStatus</a>(<a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba27912f9ea05a45aada21fc375817342c">BluetoothRumble</a>)) strcat(statusOutput,<span class="stringliteral">&quot;Bluetooth - Rumble is on&quot;</span>);</div>
<div class="line"><a name="l00412"></a><span class="lineno"> 412</span>&#160; <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="class_p_s3_u_s_b.html#a09da3bcd33a8dd20d7cb06a70833e448">getStatus</a>(<a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba730728c9aac83393ac83f96a8125b8bb">Bluetooth</a>)) strcat(statusOutput,<span class="stringliteral">&quot;Bluetooth - Rumble is off&quot;</span>);</div>
<div class="line"><a name="l00413"></a><span class="lineno"> 413</span>&#160; <span class="keywordflow">else</span> strcat(statusOutput,<span class="stringliteral">&quot;Error&quot;</span>);</div>
<div class="line"><a name="l00414"></a><span class="lineno"> 414</span>&#160; </div>
<div class="line"><a name="l00415"></a><span class="lineno"> 415</span>&#160; <span class="keywordflow">return</span> statusOutput; </div>
<div class="line"><a name="l00416"></a><span class="lineno"> 416</span>&#160; }</div>
<div class="line"><a name="l00417"></a><span class="lineno"> 417</span>&#160;}</div>
<div class="line"><a name="l00418"></a><span class="lineno"> 418</span>&#160;</div>
<div class="line"><a name="l00419"></a><span class="lineno"> 419</span>&#160;<span class="comment">/* Playstation Sixaxis Dualshock and Navigation Controller commands */</span></div>
<div class="line"><a name="l00420"></a><span class="lineno"> 420</span>&#160;<span class="keywordtype">void</span> PS3USB::PS3_Command(uint8_t* data, uint16_t nbytes) {</div>
<div class="line"><a name="l00421"></a><span class="lineno"> 421</span>&#160; <span class="comment">//bmRequest = Host to device (0x00) | Class (0x20) | Interface (0x01) = 0x21, bRequest = Set Report (0x09), Report ID (0x01), Report Type (Output 0x02), interface (0x00), datalength, datalength, data)</span></div>
<div class="line"><a name="l00422"></a><span class="lineno"> 422</span>&#160; <a class="code" href="class_p_s3_u_s_b.html#aa1873f41ae0da7c4568cfb7517560c48">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a636695a5c3d35cd6b9e31c54edfacd7c">ctrlReq</a>(<a class="code" href="class_p_s3_u_s_b.html#a3f43df159277003acdf7dd107bda27fd">bAddress</a>,<a class="code" href="class_p_s3_u_s_b.html#a394dbb0a59b587210e5958f08dac48f1">epInfo</a>[<a class="code" href="_p_s3_u_s_b_8h.html#ae6276fa555fe14995bee0713be663333">PS3_CONTROL_PIPE</a>].epAddr, <a class="code" href="_b_t_d_8h.html#a5bd4ea095da29635414952894bd527f5">bmREQ_HID_OUT</a>, <a class="code" href="_b_t_d_8h.html#aee05d40a014750b24a7e9967f6f389f4">HID_REQUEST_SET_REPORT</a>, 0x01, 0x02, 0x00, nbytes, nbytes, data, NULL);</div>
<div class="line"><a name="l00423"></a><span class="lineno"> 423</span>&#160;}</div>
<div class="line"><a name="l00424"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#ac7adc7365bb45d15c37e22f26f012498"> 424</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_p_s3_u_s_b.html#ac7adc7365bb45d15c37e22f26f012498">PS3USB::setAllOff</a>() {</div>
<div class="line"><a name="l00425"></a><span class="lineno"> 425</span>&#160; <span class="keywordflow">for</span> (uint8_t i = 0; i &lt; <a class="code" href="_p_s3_u_s_b_8h.html#a4898fccf5d2aa053bc67894aa3627e0f">PS3_REPORT_BUFFER_SIZE</a>; i++)</div>
<div class="line"><a name="l00426"></a><span class="lineno"> 426</span>&#160; writeBuf[i] = pgm_read_byte(&amp;PS3_REPORT_BUFFER[i]); <span class="comment">// Reset buffer</span></div>
<div class="line"><a name="l00427"></a><span class="lineno"> 427</span>&#160; </div>
<div class="line"><a name="l00428"></a><span class="lineno"> 428</span>&#160; PS3_Command(writeBuf, PS3_REPORT_BUFFER_SIZE);</div>
<div class="line"><a name="l00429"></a><span class="lineno"> 429</span>&#160;}</div>
<div class="line"><a name="l00430"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#aaa1e66d7397be6364d4f76749cbaad5a"> 430</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_p_s3_u_s_b.html#aaa1e66d7397be6364d4f76749cbaad5a">PS3USB::setRumbleOff</a>() {</div>
<div class="line"><a name="l00431"></a><span class="lineno"> 431</span>&#160; writeBuf[1] = 0x00;</div>
<div class="line"><a name="l00432"></a><span class="lineno"> 432</span>&#160; writeBuf[2] = 0x00;<span class="comment">//low mode off</span></div>
<div class="line"><a name="l00433"></a><span class="lineno"> 433</span>&#160; writeBuf[3] = 0x00;</div>
<div class="line"><a name="l00434"></a><span class="lineno"> 434</span>&#160; writeBuf[4] = 0x00;<span class="comment">//high mode off</span></div>
<div class="line"><a name="l00435"></a><span class="lineno"> 435</span>&#160; </div>
<div class="line"><a name="l00436"></a><span class="lineno"> 436</span>&#160; PS3_Command(writeBuf, PS3_REPORT_BUFFER_SIZE);</div>
<div class="line"><a name="l00437"></a><span class="lineno"> 437</span>&#160;}</div>
<div class="line"><a name="l00395"></a><span class="lineno"> 395</span>&#160; <span class="keywordflow">if</span> (<a class="code" href="class_p_s3_u_s_b.html#a09da3bcd33a8dd20d7cb06a70833e448">getStatus</a>(<a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba5a86ae1482947377a116685c168d1773">Charging</a>)) strcat(statusOutput, <span class="stringliteral">&quot;Charging&quot;</span>);</div>
<div class="line"><a name="l00396"></a><span class="lineno"> 396</span>&#160; <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="class_p_s3_u_s_b.html#a09da3bcd33a8dd20d7cb06a70833e448">getStatus</a>(<a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70bac138cecbd4ef1ba0f9e0ab12440a6df6">NotCharging</a>)) strcat(statusOutput, <span class="stringliteral">&quot;Not Charging&quot;</span>);</div>
<div class="line"><a name="l00397"></a><span class="lineno"> 397</span>&#160; <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="class_p_s3_u_s_b.html#a09da3bcd33a8dd20d7cb06a70833e448">getStatus</a>(<a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba82084136e62c38642986b05419b4e734">Shutdown</a>)) strcat(statusOutput, <span class="stringliteral">&quot;Shutdown&quot;</span>);</div>
<div class="line"><a name="l00398"></a><span class="lineno"> 398</span>&#160; <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="class_p_s3_u_s_b.html#a09da3bcd33a8dd20d7cb06a70833e448">getStatus</a>(<a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba96cc2a0090ada376561406d48d1f2089">Dying</a>)) strcat(statusOutput, <span class="stringliteral">&quot;Dying&quot;</span>);</div>
<div class="line"><a name="l00399"></a><span class="lineno"> 399</span>&#160; <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="class_p_s3_u_s_b.html#a09da3bcd33a8dd20d7cb06a70833e448">getStatus</a>(<a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba7a352a3dd2accc1dd65a4538c3754ee8">Low</a>)) strcat(statusOutput, <span class="stringliteral">&quot;Low&quot;</span>);</div>
<div class="line"><a name="l00400"></a><span class="lineno"> 400</span>&#160; <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="class_p_s3_u_s_b.html#a09da3bcd33a8dd20d7cb06a70833e448">getStatus</a>(<a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba24c57acd029e3f96fede49402ea01e6f">High</a>)) strcat(statusOutput, <span class="stringliteral">&quot;High&quot;</span>);</div>
<div class="line"><a name="l00401"></a><span class="lineno"> 401</span>&#160; <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="class_p_s3_u_s_b.html#a09da3bcd33a8dd20d7cb06a70833e448">getStatus</a>(<a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba8b7c5cd8bd8eb51ee6d3fd0eac584679">Full</a>)) strcat(statusOutput, <span class="stringliteral">&quot;Full&quot;</span>);</div>
<div class="line"><a name="l00402"></a><span class="lineno"> 402</span>&#160; <span class="keywordflow">else</span> strcat(statusOutput, <span class="stringliteral">&quot;Error&quot;</span>);</div>
<div class="line"><a name="l00403"></a><span class="lineno"> 403</span>&#160;</div>
<div class="line"><a name="l00404"></a><span class="lineno"> 404</span>&#160; strcat(statusOutput, <span class="stringliteral">&quot; - WirelessStatus: &quot;</span>);</div>
<div class="line"><a name="l00405"></a><span class="lineno"> 405</span>&#160;</div>
<div class="line"><a name="l00406"></a><span class="lineno"> 406</span>&#160; <span class="keywordflow">if</span> (<a class="code" href="class_p_s3_u_s_b.html#a09da3bcd33a8dd20d7cb06a70833e448">getStatus</a>(<a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba71c14aef95c9953673a880e2633fa209">CableRumble</a>)) strcat(statusOutput, <span class="stringliteral">&quot;Cable - Rumble is on&quot;</span>);</div>
<div class="line"><a name="l00407"></a><span class="lineno"> 407</span>&#160; <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="class_p_s3_u_s_b.html#a09da3bcd33a8dd20d7cb06a70833e448">getStatus</a>(<a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba1a36ca9a60a5e244f3404ec0db7b44a1">Cable</a>)) strcat(statusOutput, <span class="stringliteral">&quot;Cable - Rumble is off&quot;</span>);</div>
<div class="line"><a name="l00408"></a><span class="lineno"> 408</span>&#160; <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="class_p_s3_u_s_b.html#a09da3bcd33a8dd20d7cb06a70833e448">getStatus</a>(<a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba27912f9ea05a45aada21fc375817342c">BluetoothRumble</a>)) strcat(statusOutput, <span class="stringliteral">&quot;Bluetooth - Rumble is on&quot;</span>);</div>
<div class="line"><a name="l00409"></a><span class="lineno"> 409</span>&#160; <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="class_p_s3_u_s_b.html#a09da3bcd33a8dd20d7cb06a70833e448">getStatus</a>(<a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba730728c9aac83393ac83f96a8125b8bb">Bluetooth</a>)) strcat(statusOutput, <span class="stringliteral">&quot;Bluetooth - Rumble is off&quot;</span>);</div>
<div class="line"><a name="l00410"></a><span class="lineno"> 410</span>&#160; <span class="keywordflow">else</span> strcat(statusOutput, <span class="stringliteral">&quot;Error&quot;</span>);</div>
<div class="line"><a name="l00411"></a><span class="lineno"> 411</span>&#160;</div>
<div class="line"><a name="l00412"></a><span class="lineno"> 412</span>&#160; <span class="keywordflow">return</span> statusOutput;</div>
<div class="line"><a name="l00413"></a><span class="lineno"> 413</span>&#160; }</div>
<div class="line"><a name="l00414"></a><span class="lineno"> 414</span>&#160;}</div>
<div class="line"><a name="l00415"></a><span class="lineno"> 415</span>&#160;</div>
<div class="line"><a name="l00416"></a><span class="lineno"> 416</span>&#160;<span class="comment">/* Playstation Sixaxis Dualshock and Navigation Controller commands */</span></div>
<div class="line"><a name="l00417"></a><span class="lineno"> 417</span>&#160;<span class="keywordtype">void</span> PS3USB::PS3_Command(uint8_t* data, uint16_t nbytes) {</div>
<div class="line"><a name="l00418"></a><span class="lineno"> 418</span>&#160; <span class="comment">//bmRequest = Host to device (0x00) | Class (0x20) | Interface (0x01) = 0x21, bRequest = Set Report (0x09), Report ID (0x01), Report Type (Output 0x02), interface (0x00), datalength, datalength, data)</span></div>
<div class="line"><a name="l00419"></a><span class="lineno"> 419</span>&#160; <a class="code" href="class_p_s3_u_s_b.html#aa1873f41ae0da7c4568cfb7517560c48">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a636695a5c3d35cd6b9e31c54edfacd7c">ctrlReq</a>(<a class="code" href="class_p_s3_u_s_b.html#a3f43df159277003acdf7dd107bda27fd">bAddress</a>, <a class="code" href="class_p_s3_u_s_b.html#a394dbb0a59b587210e5958f08dac48f1">epInfo</a>[<a class="code" href="_p_s3_u_s_b_8h.html#ae6276fa555fe14995bee0713be663333">PS3_CONTROL_PIPE</a>].epAddr, <a class="code" href="_b_t_d_8h.html#a5bd4ea095da29635414952894bd527f5">bmREQ_HID_OUT</a>, <a class="code" href="_b_t_d_8h.html#aee05d40a014750b24a7e9967f6f389f4">HID_REQUEST_SET_REPORT</a>, 0x01, 0x02, 0x00, nbytes, nbytes, data, NULL);</div>
<div class="line"><a name="l00420"></a><span class="lineno"> 420</span>&#160;}</div>
<div class="line"><a name="l00421"></a><span class="lineno"> 421</span>&#160;</div>
<div class="line"><a name="l00422"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#ac7adc7365bb45d15c37e22f26f012498"> 422</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_p_s3_u_s_b.html#ac7adc7365bb45d15c37e22f26f012498">PS3USB::setAllOff</a>() {</div>
<div class="line"><a name="l00423"></a><span class="lineno"> 423</span>&#160; <span class="keywordflow">for</span> (uint8_t i = 0; i &lt; <a class="code" href="_p_s3_u_s_b_8h.html#a4898fccf5d2aa053bc67894aa3627e0f">PS3_REPORT_BUFFER_SIZE</a>; i++)</div>
<div class="line"><a name="l00424"></a><span class="lineno"> 424</span>&#160; writeBuf[i] = pgm_read_byte(&amp;<a class="code" href="_p_s3_u_s_b_8cpp.html#a8cf62ee374ebaa5f7582c073e624bc74">PS3_REPORT_BUFFER</a>[i]); <span class="comment">// Reset buffer</span></div>
<div class="line"><a name="l00425"></a><span class="lineno"> 425</span>&#160;</div>
<div class="line"><a name="l00426"></a><span class="lineno"> 426</span>&#160; PS3_Command(writeBuf, PS3_REPORT_BUFFER_SIZE);</div>
<div class="line"><a name="l00427"></a><span class="lineno"> 427</span>&#160;}</div>
<div class="line"><a name="l00428"></a><span class="lineno"> 428</span>&#160;</div>
<div class="line"><a name="l00429"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#aaa1e66d7397be6364d4f76749cbaad5a"> 429</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_p_s3_u_s_b.html#aaa1e66d7397be6364d4f76749cbaad5a">PS3USB::setRumbleOff</a>() {</div>
<div class="line"><a name="l00430"></a><span class="lineno"> 430</span>&#160; writeBuf[1] = 0x00;</div>
<div class="line"><a name="l00431"></a><span class="lineno"> 431</span>&#160; writeBuf[2] = 0x00; <span class="comment">//low mode off</span></div>
<div class="line"><a name="l00432"></a><span class="lineno"> 432</span>&#160; writeBuf[3] = 0x00;</div>
<div class="line"><a name="l00433"></a><span class="lineno"> 433</span>&#160; writeBuf[4] = 0x00; <span class="comment">//high mode off</span></div>
<div class="line"><a name="l00434"></a><span class="lineno"> 434</span>&#160;</div>
<div class="line"><a name="l00435"></a><span class="lineno"> 435</span>&#160; PS3_Command(writeBuf, PS3_REPORT_BUFFER_SIZE);</div>
<div class="line"><a name="l00436"></a><span class="lineno"> 436</span>&#160;}</div>
<div class="line"><a name="l00437"></a><span class="lineno"> 437</span>&#160;</div>
<div class="line"><a name="l00438"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#a5dc4e5d1ebd5ca24da7cdc9dd08c94e1"> 438</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_p_s3_u_s_b.html#a5dc4e5d1ebd5ca24da7cdc9dd08c94e1">PS3USB::setRumbleOn</a>(<a class="code" href="_p_s3_enums_8h.html#aff4be38428d075a117a5bb7f6209a231">Rumble</a> mode) {</div>
<div class="line"><a name="l00439"></a><span class="lineno"> 439</span>&#160; <span class="comment">/* Still not totally sure how it works, maybe something like this instead?</span></div>
<div class="line"><a name="l00440"></a><span class="lineno"> 440</span>&#160;<span class="comment"> * 3 - duration_right</span></div>
<div class="line"><a name="l00441"></a><span class="lineno"> 441</span>&#160;<span class="comment"> * 4 - power_right</span></div>
<div class="line"><a name="l00442"></a><span class="lineno"> 442</span>&#160;<span class="comment"> * 5 - duration_left</span></div>
<div class="line"><a name="l00443"></a><span class="lineno"> 443</span>&#160;<span class="comment"> * 6 - power_left</span></div>
<div class="line"><a name="l00444"></a><span class="lineno"> 444</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00445"></a><span class="lineno"> 445</span>&#160; <span class="keywordflow">if</span> ((mode &amp; 0x30) &gt; 0) {</div>
<div class="line"><a name="l00446"></a><span class="lineno"> 446</span>&#160; writeBuf[1] = 0xfe;</div>
<div class="line"><a name="l00447"></a><span class="lineno"> 447</span>&#160; writeBuf[3] = 0xfe; </div>
<div class="line"><a name="l00448"></a><span class="lineno"> 448</span>&#160; <span class="keywordflow">if</span> (mode == <a class="code" href="_p_s3_enums_8h.html#aff4be38428d075a117a5bb7f6209a231a5819f165165589a8e65b07bf46c7382b">RumbleHigh</a>) {</div>
<div class="line"><a name="l00449"></a><span class="lineno"> 449</span>&#160; writeBuf[2] = 0;<span class="comment">//low mode off</span></div>
<div class="line"><a name="l00450"></a><span class="lineno"> 450</span>&#160; writeBuf[4] = 0xff;<span class="comment">//high mode on</span></div>
<div class="line"><a name="l00451"></a><span class="lineno"> 451</span>&#160; }</div>
<div class="line"><a name="l00452"></a><span class="lineno"> 452</span>&#160; <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00453"></a><span class="lineno"> 453</span>&#160; writeBuf[2] = 0xff;<span class="comment">//low mode on</span></div>
<div class="line"><a name="l00454"></a><span class="lineno"> 454</span>&#160; writeBuf[4] = 0;<span class="comment">//high mode off</span></div>
<div class="line"><a name="l00439"></a><span class="lineno"> 439</span>&#160; <span class="keywordflow">if</span> ((mode &amp; 0x30) &gt; 0x00) {</div>
<div class="line"><a name="l00440"></a><span class="lineno"> 440</span>&#160; uint8_t power[2] = { 0xff, 0x00 }; <span class="comment">// Defaults to RumbleLow</span></div>
<div class="line"><a name="l00441"></a><span class="lineno"> 441</span>&#160; <span class="keywordflow">if</span> (mode == <a class="code" href="_p_s3_enums_8h.html#aff4be38428d075a117a5bb7f6209a231a5819f165165589a8e65b07bf46c7382b">RumbleHigh</a>) {</div>
<div class="line"><a name="l00442"></a><span class="lineno"> 442</span>&#160; power[0] = 0x00;</div>
<div class="line"><a name="l00443"></a><span class="lineno"> 443</span>&#160; power[1] = 0xff;</div>
<div class="line"><a name="l00444"></a><span class="lineno"> 444</span>&#160; }</div>
<div class="line"><a name="l00445"></a><span class="lineno"> 445</span>&#160; <a class="code" href="class_p_s3_u_s_b.html#a5dc4e5d1ebd5ca24da7cdc9dd08c94e1">setRumbleOn</a>(0xfe, power[0], 0xfe, power[1]);</div>
<div class="line"><a name="l00446"></a><span class="lineno"> 446</span>&#160; }</div>
<div class="line"><a name="l00447"></a><span class="lineno"> 447</span>&#160;}</div>
<div class="line"><a name="l00448"></a><span class="lineno"> 448</span>&#160;</div>
<div class="line"><a name="l00449"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#a0c2015b53aa60081aa28299800509f80"> 449</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_p_s3_u_s_b.html#a5dc4e5d1ebd5ca24da7cdc9dd08c94e1">PS3USB::setRumbleOn</a>(uint8_t rightDuration, uint8_t rightPower, uint8_t leftDuration, uint8_t leftPower) {</div>
<div class="line"><a name="l00450"></a><span class="lineno"> 450</span>&#160; writeBuf[1] = rightDuration;</div>
<div class="line"><a name="l00451"></a><span class="lineno"> 451</span>&#160; writeBuf[2] = rightPower;</div>
<div class="line"><a name="l00452"></a><span class="lineno"> 452</span>&#160; writeBuf[3] = leftDuration;</div>
<div class="line"><a name="l00453"></a><span class="lineno"> 453</span>&#160; writeBuf[4] = leftPower;</div>
<div class="line"><a name="l00454"></a><span class="lineno"> 454</span>&#160; PS3_Command(writeBuf, PS3_REPORT_BUFFER_SIZE);</div>
<div class="line"><a name="l00455"></a><span class="lineno"> 455</span>&#160;}</div>
<div class="line"><a name="l00456"></a><span class="lineno"> 456</span>&#160; PS3_Command(writeBuf, PS3_REPORT_BUFFER_SIZE);</div>
<div class="line"><a name="l00457"></a><span class="lineno"> 457</span>&#160; }</div>
<div class="line"><a name="l00458"></a><span class="lineno"> 458</span>&#160;}</div>
<div class="line"><a name="l00459"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#adb361fecbe4eb6fc5635dc7135cfff03"> 459</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_p_s3_u_s_b.html#adb361fecbe4eb6fc5635dc7135cfff03">PS3USB::setLedOff</a>(<a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6">LED</a> a) {</div>
<div class="line"><a name="l00460"></a><span class="lineno"> 460</span>&#160; writeBuf[9] &amp;= ~((uint8_t)((pgm_read_byte(&amp;LEDS[(uint8_t)a]) &amp; 0x0f) &lt;&lt; 1));</div>
<div class="line"><a name="l00461"></a><span class="lineno"> 461</span>&#160; PS3_Command(writeBuf, PS3_REPORT_BUFFER_SIZE);</div>
<div class="line"><a name="l00462"></a><span class="lineno"> 462</span>&#160;}</div>
<div class="line"><a name="l00463"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#a44c4bff09064a09ef97c7bb6b8c0810b"> 463</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_p_s3_u_s_b.html#a44c4bff09064a09ef97c7bb6b8c0810b">PS3USB::setLedOn</a>(<a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6">LED</a> a) {</div>
<div class="line"><a name="l00464"></a><span class="lineno"> 464</span>&#160; writeBuf[9] |= (uint8_t)((pgm_read_byte(&amp;LEDS[(uint8_t)a]) &amp; 0x0f) &lt;&lt; 1);</div>
<div class="line"><a name="l00465"></a><span class="lineno"> 465</span>&#160; PS3_Command(writeBuf, PS3_REPORT_BUFFER_SIZE);</div>
<div class="line"><a name="l00466"></a><span class="lineno"> 466</span>&#160;}</div>
<div class="line"><a name="l00467"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#acbab64f537f092e2fb125f9001f46090"> 467</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_p_s3_u_s_b.html#acbab64f537f092e2fb125f9001f46090">PS3USB::setLedToggle</a>(<a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6">LED</a> a) {</div>
<div class="line"><a name="l00468"></a><span class="lineno"> 468</span>&#160; writeBuf[9] ^= (uint8_t)((pgm_read_byte(&amp;LEDS[(uint8_t)a]) &amp; 0x0f) &lt;&lt; 1);</div>
<div class="line"><a name="l00469"></a><span class="lineno"> 469</span>&#160; PS3_Command(writeBuf, PS3_REPORT_BUFFER_SIZE);</div>
<div class="line"><a name="l00470"></a><span class="lineno"> 470</span>&#160;}</div>
<div class="line"><a name="l00471"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#af13993073ab245ece6d3fe9e9f41df87"> 471</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_p_s3_u_s_b.html#af13993073ab245ece6d3fe9e9f41df87">PS3USB::setBdaddr</a>(uint8_t* BDADDR) { </div>
<div class="line"><a name="l00472"></a><span class="lineno"> 472</span>&#160; <span class="comment">/* Set the internal bluetooth address */</span> </div>
<div class="line"><a name="l00473"></a><span class="lineno"> 473</span>&#160; uint8_t buf[8]; </div>
<div class="line"><a name="l00474"></a><span class="lineno"> 474</span>&#160; buf[0] = 0x01;</div>
<div class="line"><a name="l00475"></a><span class="lineno"> 475</span>&#160; buf[1] = 0x00;</div>
<div class="line"><a name="l00476"></a><span class="lineno"> 476</span>&#160; <span class="keywordflow">for</span> (uint8_t i = 0; i &lt; 6; i++)</div>
<div class="line"><a name="l00477"></a><span class="lineno"> 477</span>&#160; buf[i+2] = BDADDR[5 - i];<span class="comment">//Copy into buffer, has to be written reversed</span></div>
<div class="line"><a name="l00478"></a><span class="lineno"> 478</span>&#160; </div>
<div class="line"><a name="l00479"></a><span class="lineno"> 479</span>&#160; <span class="comment">//bmRequest = Host to device (0x00) | Class (0x20) | Interface (0x01) = 0x21, bRequest = Set Report (0x09), Report ID (0xF5), Report Type (Feature 0x03), interface (0x00), datalength, datalength, data)</span></div>
<div class="line"><a name="l00480"></a><span class="lineno"> 480</span>&#160; <a class="code" href="class_p_s3_u_s_b.html#aa1873f41ae0da7c4568cfb7517560c48">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a636695a5c3d35cd6b9e31c54edfacd7c">ctrlReq</a>(<a class="code" href="class_p_s3_u_s_b.html#a3f43df159277003acdf7dd107bda27fd">bAddress</a>,<a class="code" href="class_p_s3_u_s_b.html#a394dbb0a59b587210e5958f08dac48f1">epInfo</a>[<a class="code" href="_p_s3_u_s_b_8h.html#ae6276fa555fe14995bee0713be663333">PS3_CONTROL_PIPE</a>].epAddr, <a class="code" href="_b_t_d_8h.html#a5bd4ea095da29635414952894bd527f5">bmREQ_HID_OUT</a>, <a class="code" href="_b_t_d_8h.html#aee05d40a014750b24a7e9967f6f389f4">HID_REQUEST_SET_REPORT</a>, 0xF5, 0x03, 0x00, 8, 8, buf, NULL); </div>
<div class="line"><a name="l00481"></a><span class="lineno"> 481</span>&#160;<span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><a name="l00482"></a><span class="lineno"> 482</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nBluetooth Address was set to: &quot;</span>));</div>
<div class="line"><a name="l00483"></a><span class="lineno"> 483</span>&#160; <span class="keywordflow">for</span>(int8_t i = 5; i &gt; 0; i--) {</div>
<div class="line"><a name="l00484"></a><span class="lineno"> 484</span>&#160; PrintHex&lt;uint8_t&gt;(my_bdaddr[i]);</div>
<div class="line"><a name="l00485"></a><span class="lineno"> 485</span>&#160; Serial.print(<span class="stringliteral">&quot;:&quot;</span>);</div>
<div class="line"><a name="l00486"></a><span class="lineno"> 486</span>&#160; }</div>
<div class="line"><a name="l00487"></a><span class="lineno"> 487</span>&#160; PrintHex&lt;uint8_t&gt;(my_bdaddr[0]);</div>
<div class="line"><a name="l00488"></a><span class="lineno"> 488</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00489"></a><span class="lineno"> 489</span>&#160;<span class="preprocessor"></span> <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00490"></a><span class="lineno"> 490</span>&#160;}</div>
<div class="line"><a name="l00491"></a><span class="lineno"> 491</span>&#160;<span class="keywordtype">void</span> PS3USB::enable_sixaxis() { <span class="comment">//Command used to enable the Dualshock 3 and Navigation controller to send data via USB</span></div>
<div class="line"><a name="l00492"></a><span class="lineno"> 492</span>&#160; uint8_t cmd_buf[4];</div>
<div class="line"><a name="l00493"></a><span class="lineno"> 493</span>&#160; cmd_buf[0] = 0x42;<span class="comment">// Special PS3 Controller enable commands</span></div>
<div class="line"><a name="l00494"></a><span class="lineno"> 494</span>&#160; cmd_buf[1] = 0x0c;</div>
<div class="line"><a name="l00495"></a><span class="lineno"> 495</span>&#160; cmd_buf[2] = 0x00;</div>
<div class="line"><a name="l00496"></a><span class="lineno"> 496</span>&#160; cmd_buf[3] = 0x00;</div>
<div class="line"><a name="l00497"></a><span class="lineno"> 497</span>&#160; </div>
<div class="line"><a name="l00498"></a><span class="lineno"> 498</span>&#160; <span class="comment">//bmRequest = Host to device (0x00) | Class (0x20) | Interface (0x01) = 0x21, bRequest = Set Report (0x09), Report ID (0xF4), Report Type (Feature 0x03), interface (0x00), datalength, datalength, data)</span></div>
<div class="line"><a name="l00499"></a><span class="lineno"> 499</span>&#160; <a class="code" href="class_p_s3_u_s_b.html#aa1873f41ae0da7c4568cfb7517560c48">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a636695a5c3d35cd6b9e31c54edfacd7c">ctrlReq</a>(<a class="code" href="class_p_s3_u_s_b.html#a3f43df159277003acdf7dd107bda27fd">bAddress</a>,<a class="code" href="class_p_s3_u_s_b.html#a394dbb0a59b587210e5958f08dac48f1">epInfo</a>[<a class="code" href="_p_s3_u_s_b_8h.html#ae6276fa555fe14995bee0713be663333">PS3_CONTROL_PIPE</a>].epAddr, <a class="code" href="_b_t_d_8h.html#a5bd4ea095da29635414952894bd527f5">bmREQ_HID_OUT</a>, <a class="code" href="_b_t_d_8h.html#aee05d40a014750b24a7e9967f6f389f4">HID_REQUEST_SET_REPORT</a>, 0xF4, 0x03, 0x00, 4, 4, cmd_buf, NULL);</div>
<div class="line"><a name="l00500"></a><span class="lineno"> 500</span>&#160;}</div>
<div class="line"><a name="l00456"></a><span class="lineno"> 456</span>&#160;</div>
<div class="line"><a name="l00457"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#aa0aac5ea016db4cd6736a15e9d6eb41b"> 457</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_p_s3_u_s_b.html#aa0aac5ea016db4cd6736a15e9d6eb41b">PS3USB::setLedRaw</a>(uint8_t value) {</div>
<div class="line"><a name="l00458"></a><span class="lineno"> 458</span>&#160; writeBuf[9] = value;</div>
<div class="line"><a name="l00459"></a><span class="lineno"> 459</span>&#160; PS3_Command(writeBuf, PS3_REPORT_BUFFER_SIZE);</div>
<div class="line"><a name="l00460"></a><span class="lineno"> 460</span>&#160;}</div>
<div class="line"><a name="l00461"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#adb361fecbe4eb6fc5635dc7135cfff03"> 461</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_p_s3_u_s_b.html#adb361fecbe4eb6fc5635dc7135cfff03">PS3USB::setLedOff</a>(<a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6">LED</a> a) {</div>
<div class="line"><a name="l00462"></a><span class="lineno"> 462</span>&#160; writeBuf[9] &amp;= ~((uint8_t)((pgm_read_byte(&amp;<a class="code" href="_p_s3_enums_8h.html#af83672eccf0c7a02847ce75bc5c55a1a">LEDS</a>[(uint8_t)a]) &amp; 0x0f) &lt;&lt; 1));</div>
<div class="line"><a name="l00463"></a><span class="lineno"> 463</span>&#160; PS3_Command(writeBuf, PS3_REPORT_BUFFER_SIZE);</div>
<div class="line"><a name="l00464"></a><span class="lineno"> 464</span>&#160;}</div>
<div class="line"><a name="l00465"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#a44c4bff09064a09ef97c7bb6b8c0810b"> 465</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_p_s3_u_s_b.html#a44c4bff09064a09ef97c7bb6b8c0810b">PS3USB::setLedOn</a>(<a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6">LED</a> a) {</div>
<div class="line"><a name="l00466"></a><span class="lineno"> 466</span>&#160; writeBuf[9] |= (uint8_t)((pgm_read_byte(&amp;<a class="code" href="_p_s3_enums_8h.html#af83672eccf0c7a02847ce75bc5c55a1a">LEDS</a>[(uint8_t)a]) &amp; 0x0f) &lt;&lt; 1);</div>
<div class="line"><a name="l00467"></a><span class="lineno"> 467</span>&#160; PS3_Command(writeBuf, PS3_REPORT_BUFFER_SIZE);</div>
<div class="line"><a name="l00468"></a><span class="lineno"> 468</span>&#160;}</div>
<div class="line"><a name="l00469"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#acbab64f537f092e2fb125f9001f46090"> 469</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_p_s3_u_s_b.html#acbab64f537f092e2fb125f9001f46090">PS3USB::setLedToggle</a>(<a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6">LED</a> a) {</div>
<div class="line"><a name="l00470"></a><span class="lineno"> 470</span>&#160; writeBuf[9] ^= (uint8_t)((pgm_read_byte(&amp;<a class="code" href="_p_s3_enums_8h.html#af83672eccf0c7a02847ce75bc5c55a1a">LEDS</a>[(uint8_t)a]) &amp; 0x0f) &lt;&lt; 1);</div>
<div class="line"><a name="l00471"></a><span class="lineno"> 471</span>&#160; PS3_Command(writeBuf, PS3_REPORT_BUFFER_SIZE);</div>
<div class="line"><a name="l00472"></a><span class="lineno"> 472</span>&#160;}</div>
<div class="line"><a name="l00473"></a><span class="lineno"> 473</span>&#160;</div>
<div class="line"><a name="l00474"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#af13993073ab245ece6d3fe9e9f41df87"> 474</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_p_s3_u_s_b.html#af13993073ab245ece6d3fe9e9f41df87">PS3USB::setBdaddr</a>(uint8_t* BDADDR) {</div>
<div class="line"><a name="l00475"></a><span class="lineno"> 475</span>&#160; <span class="comment">/* Set the internal bluetooth address */</span></div>
<div class="line"><a name="l00476"></a><span class="lineno"> 476</span>&#160; uint8_t buf[8];</div>
<div class="line"><a name="l00477"></a><span class="lineno"> 477</span>&#160; buf[0] = 0x01;</div>
<div class="line"><a name="l00478"></a><span class="lineno"> 478</span>&#160; buf[1] = 0x00;</div>
<div class="line"><a name="l00479"></a><span class="lineno"> 479</span>&#160; <span class="keywordflow">for</span> (uint8_t i = 0; i &lt; 6; i++)</div>
<div class="line"><a name="l00480"></a><span class="lineno"> 480</span>&#160; buf[i + 2] = BDADDR[5 - i]; <span class="comment">//Copy into buffer, has to be written reversed</span></div>
<div class="line"><a name="l00481"></a><span class="lineno"> 481</span>&#160;</div>
<div class="line"><a name="l00482"></a><span class="lineno"> 482</span>&#160; <span class="comment">//bmRequest = Host to device (0x00) | Class (0x20) | Interface (0x01) = 0x21, bRequest = Set Report (0x09), Report ID (0xF5), Report Type (Feature 0x03), interface (0x00), datalength, datalength, data)</span></div>
<div class="line"><a name="l00483"></a><span class="lineno"> 483</span>&#160; <a class="code" href="class_p_s3_u_s_b.html#aa1873f41ae0da7c4568cfb7517560c48">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a636695a5c3d35cd6b9e31c54edfacd7c">ctrlReq</a>(<a class="code" href="class_p_s3_u_s_b.html#a3f43df159277003acdf7dd107bda27fd">bAddress</a>, <a class="code" href="class_p_s3_u_s_b.html#a394dbb0a59b587210e5958f08dac48f1">epInfo</a>[<a class="code" href="_p_s3_u_s_b_8h.html#ae6276fa555fe14995bee0713be663333">PS3_CONTROL_PIPE</a>].epAddr, <a class="code" href="_b_t_d_8h.html#a5bd4ea095da29635414952894bd527f5">bmREQ_HID_OUT</a>, <a class="code" href="_b_t_d_8h.html#aee05d40a014750b24a7e9967f6f389f4">HID_REQUEST_SET_REPORT</a>, 0xF5, 0x03, 0x00, 8, 8, buf, NULL);</div>
<div class="line"><a name="l00484"></a><span class="lineno"> 484</span>&#160;<span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><a name="l00485"></a><span class="lineno"> 485</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a1e8693828152de8408add858dc461dea">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nBluetooth Address was set to: &quot;</span>), 0x80);</div>
<div class="line"><a name="l00486"></a><span class="lineno"> 486</span>&#160; <span class="keywordflow">for</span> (int8_t i = 5; i &gt; 0; i--) {</div>
<div class="line"><a name="l00487"></a><span class="lineno"> 487</span>&#160; PrintHex&lt;uint8_t &gt; (my_bdaddr[i], 0x80);</div>
<div class="line"><a name="l00488"></a><span class="lineno"> 488</span>&#160; Serial.print(<span class="stringliteral">&quot;:&quot;</span>);</div>
<div class="line"><a name="l00489"></a><span class="lineno"> 489</span>&#160; }</div>
<div class="line"><a name="l00490"></a><span class="lineno"> 490</span>&#160; PrintHex&lt;uint8_t &gt; (my_bdaddr[0], 0x80);</div>
<div class="line"><a name="l00491"></a><span class="lineno"> 491</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00492"></a><span class="lineno"> 492</span>&#160;<span class="preprocessor"></span> <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00493"></a><span class="lineno"> 493</span>&#160;}</div>
<div class="line"><a name="l00494"></a><span class="lineno"> 494</span>&#160;</div>
<div class="line"><a name="l00495"></a><span class="lineno"> 495</span>&#160;<span class="keywordtype">void</span> PS3USB::enable_sixaxis() { <span class="comment">//Command used to enable the Dualshock 3 and Navigation controller to send data via USB</span></div>
<div class="line"><a name="l00496"></a><span class="lineno"> 496</span>&#160; uint8_t cmd_buf[4];</div>
<div class="line"><a name="l00497"></a><span class="lineno"> 497</span>&#160; cmd_buf[0] = 0x42; <span class="comment">// Special PS3 Controller enable commands</span></div>
<div class="line"><a name="l00498"></a><span class="lineno"> 498</span>&#160; cmd_buf[1] = 0x0c;</div>
<div class="line"><a name="l00499"></a><span class="lineno"> 499</span>&#160; cmd_buf[2] = 0x00;</div>
<div class="line"><a name="l00500"></a><span class="lineno"> 500</span>&#160; cmd_buf[3] = 0x00;</div>
<div class="line"><a name="l00501"></a><span class="lineno"> 501</span>&#160;</div>
<div class="line"><a name="l00502"></a><span class="lineno"> 502</span>&#160;<span class="comment">/* Playstation Move Controller commands */</span></div>
<div class="line"><a name="l00503"></a><span class="lineno"> 503</span>&#160;<span class="keywordtype">void</span> PS3USB::Move_Command(uint8_t* data, uint16_t nbytes) {</div>
<div class="line"><a name="l00504"></a><span class="lineno"> 504</span>&#160; <a class="code" href="class_p_s3_u_s_b.html#aa1873f41ae0da7c4568cfb7517560c48">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#affbc018973a588995457d535b0ac7ee7">outTransfer</a>(<a class="code" href="class_p_s3_u_s_b.html#a3f43df159277003acdf7dd107bda27fd">bAddress</a>, <a class="code" href="class_p_s3_u_s_b.html#a394dbb0a59b587210e5958f08dac48f1">epInfo</a>[ <a class="code" href="_p_s3_u_s_b_8h.html#a0da271fcb10181b3ce15aefe76c259bb">PS3_OUTPUT_PIPE</a> ].epAddr, nbytes, data);</div>
<div class="line"><a name="l00505"></a><span class="lineno"> 505</span>&#160;} </div>
<div class="line"><a name="l00506"></a><span class="lineno"> 506</span>&#160;</div>
<div class="line"><a name="l00507"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#ae9cfdaad3e54dbc271519e22082399c7"> 507</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_p_s3_u_s_b.html#ae9cfdaad3e54dbc271519e22082399c7">PS3USB::moveSetBulb</a>(uint8_t r, uint8_t g, uint8_t b) { <span class="comment">//Use this to set the Color using RGB values</span></div>
<div class="line"><a name="l00508"></a><span class="lineno"> 508</span>&#160; <span class="comment">// set the Bulb&#39;s values into the write buffer </span></div>
<div class="line"><a name="l00509"></a><span class="lineno"> 509</span>&#160; writeBuf[2] = r;</div>
<div class="line"><a name="l00510"></a><span class="lineno"> 510</span>&#160; writeBuf[3] = g;</div>
<div class="line"><a name="l00511"></a><span class="lineno"> 511</span>&#160; writeBuf[4] = b;</div>
<div class="line"><a name="l00512"></a><span class="lineno"> 512</span>&#160; </div>
<div class="line"><a name="l00513"></a><span class="lineno"> 513</span>&#160; Move_Command(writeBuf, <a class="code" href="_p_s3_u_s_b_8h.html#a2c6c24a4b63d9a34926fb35d6b49cd17">MOVE_REPORT_BUFFER_SIZE</a>); </div>
<div class="line"><a name="l00514"></a><span class="lineno"> 514</span>&#160;}</div>
<div class="line"><a name="l00515"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#a34c83190306752e68c5704eece875d49"> 515</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_p_s3_u_s_b.html#ae9cfdaad3e54dbc271519e22082399c7">PS3USB::moveSetBulb</a>(<a class="code" href="_p_s3_enums_8h.html#a55ecd4f2ec2ebfe8d5b0163e4ac2a967">Colors</a> color) { <span class="comment">//Use this to set the Color using the predefined colors in &quot;enums.h&quot;</span></div>
<div class="line"><a name="l00516"></a><span class="lineno"> 516</span>&#160; <a class="code" href="class_p_s3_u_s_b.html#ae9cfdaad3e54dbc271519e22082399c7">moveSetBulb</a>((uint8_t)(color &gt;&gt; 16),(uint8_t)(color &gt;&gt; 8),(uint8_t)(color));</div>
<div class="line"><a name="l00517"></a><span class="lineno"> 517</span>&#160;}</div>
<div class="line"><a name="l00518"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#a66d542c2cec73cefb3cdda36ff080e1a"> 518</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_p_s3_u_s_b.html#a66d542c2cec73cefb3cdda36ff080e1a">PS3USB::moveSetRumble</a>(uint8_t rumble) {</div>
<div class="line"><a name="l00519"></a><span class="lineno"> 519</span>&#160;<span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><a name="l00520"></a><span class="lineno"> 520</span>&#160;<span class="preprocessor"></span> <span class="keywordflow">if</span>(rumble &lt; 64 &amp;&amp; rumble != 0) <span class="comment">// The rumble value has to at least 64, or approximately 25% (64/255*100)</span></div>
<div class="line"><a name="l00521"></a><span class="lineno"> 521</span>&#160; <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nThe rumble value has to at least 64, or approximately 25%&quot;</span>));</div>
<div class="line"><a name="l00522"></a><span class="lineno"> 522</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00523"></a><span class="lineno"> 523</span>&#160;<span class="preprocessor"></span> <span class="comment">//set the rumble value into the write buffer</span></div>
<div class="line"><a name="l00524"></a><span class="lineno"> 524</span>&#160; writeBuf[6] = rumble;</div>
<div class="line"><a name="l00525"></a><span class="lineno"> 525</span>&#160; </div>
<div class="line"><a name="l00526"></a><span class="lineno"> 526</span>&#160; Move_Command(writeBuf, <a class="code" href="_p_s3_u_s_b_8h.html#a2c6c24a4b63d9a34926fb35d6b49cd17">MOVE_REPORT_BUFFER_SIZE</a>); </div>
<div class="line"><a name="l00527"></a><span class="lineno"> 527</span>&#160;}</div>
<div class="line"><a name="l00528"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#a3be69a3c6e24bf2b53bc06c85829e62a"> 528</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_p_s3_u_s_b.html#a3be69a3c6e24bf2b53bc06c85829e62a">PS3USB::setMoveBdaddr</a>(uint8_t* BDADDR) {</div>
<div class="line"><a name="l00529"></a><span class="lineno"> 529</span>&#160; <span class="comment">/* Set the internal bluetooth address */</span> </div>
<div class="line"><a name="l00530"></a><span class="lineno"> 530</span>&#160; uint8_t buf[11];</div>
<div class="line"><a name="l00531"></a><span class="lineno"> 531</span>&#160; buf[0] = 0x05;</div>
<div class="line"><a name="l00532"></a><span class="lineno"> 532</span>&#160; buf[7] = 0x10;</div>
<div class="line"><a name="l00533"></a><span class="lineno"> 533</span>&#160; buf[8] = 0x01;</div>
<div class="line"><a name="l00534"></a><span class="lineno"> 534</span>&#160; buf[9] = 0x02;</div>
<div class="line"><a name="l00535"></a><span class="lineno"> 535</span>&#160; buf[10] = 0x12; </div>
<div class="line"><a name="l00536"></a><span class="lineno"> 536</span>&#160; </div>
<div class="line"><a name="l00537"></a><span class="lineno"> 537</span>&#160; <span class="keywordflow">for</span> (uint8_t i = 0; i &lt; 6; i++)</div>
<div class="line"><a name="l00538"></a><span class="lineno"> 538</span>&#160; buf[i + 1] = BDADDR[i];</div>
<div class="line"><a name="l00539"></a><span class="lineno"> 539</span>&#160; </div>
<div class="line"><a name="l00540"></a><span class="lineno"> 540</span>&#160; <span class="comment">//bmRequest = Host to device (0x00) | Class (0x20) | Interface (0x01) = 0x21, bRequest = Set Report (0x09), Report ID (0x05), Report Type (Feature 0x03), interface (0x00), datalength, datalength, data)</span></div>
<div class="line"><a name="l00541"></a><span class="lineno"> 541</span>&#160; <a class="code" href="class_p_s3_u_s_b.html#aa1873f41ae0da7c4568cfb7517560c48">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a636695a5c3d35cd6b9e31c54edfacd7c">ctrlReq</a>(<a class="code" href="class_p_s3_u_s_b.html#a3f43df159277003acdf7dd107bda27fd">bAddress</a>,<a class="code" href="class_p_s3_u_s_b.html#a394dbb0a59b587210e5958f08dac48f1">epInfo</a>[<a class="code" href="_p_s3_u_s_b_8h.html#ae6276fa555fe14995bee0713be663333">PS3_CONTROL_PIPE</a>].epAddr, <a class="code" href="_b_t_d_8h.html#a5bd4ea095da29635414952894bd527f5">bmREQ_HID_OUT</a>, <a class="code" href="_b_t_d_8h.html#aee05d40a014750b24a7e9967f6f389f4">HID_REQUEST_SET_REPORT</a>, 0x05, 0x03, 0x00,11,11, buf, NULL); </div>
<div class="line"><a name="l00542"></a><span class="lineno"> 542</span>&#160;<span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><a name="l00543"></a><span class="lineno"> 543</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nBluetooth Address was set to: &quot;</span>));</div>
<div class="line"><a name="l00544"></a><span class="lineno"> 544</span>&#160; <span class="keywordflow">for</span>(int8_t i = 5; i &gt; 0; i--) {</div>
<div class="line"><a name="l00545"></a><span class="lineno"> 545</span>&#160; PrintHex&lt;uint8_t&gt;(my_bdaddr[i]);</div>
<div class="line"><a name="l00546"></a><span class="lineno"> 546</span>&#160; Serial.print(<span class="stringliteral">&quot;:&quot;</span>);</div>
<div class="line"><a name="l00547"></a><span class="lineno"> 547</span>&#160; }</div>
<div class="line"><a name="l00548"></a><span class="lineno"> 548</span>&#160; PrintHex&lt;uint8_t&gt;(my_bdaddr[0]); </div>
<div class="line"><a name="l00549"></a><span class="lineno"> 549</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00550"></a><span class="lineno"> 550</span>&#160;<span class="preprocessor"></span> <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00551"></a><span class="lineno"> 551</span>&#160;}</div>
<div class="line"><a name="l00502"></a><span class="lineno"> 502</span>&#160; <span class="comment">//bmRequest = Host to device (0x00) | Class (0x20) | Interface (0x01) = 0x21, bRequest = Set Report (0x09), Report ID (0xF4), Report Type (Feature 0x03), interface (0x00), datalength, datalength, data)</span></div>
<div class="line"><a name="l00503"></a><span class="lineno"> 503</span>&#160; <a class="code" href="class_p_s3_u_s_b.html#aa1873f41ae0da7c4568cfb7517560c48">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a636695a5c3d35cd6b9e31c54edfacd7c">ctrlReq</a>(<a class="code" href="class_p_s3_u_s_b.html#a3f43df159277003acdf7dd107bda27fd">bAddress</a>, <a class="code" href="class_p_s3_u_s_b.html#a394dbb0a59b587210e5958f08dac48f1">epInfo</a>[<a class="code" href="_p_s3_u_s_b_8h.html#ae6276fa555fe14995bee0713be663333">PS3_CONTROL_PIPE</a>].epAddr, <a class="code" href="_b_t_d_8h.html#a5bd4ea095da29635414952894bd527f5">bmREQ_HID_OUT</a>, <a class="code" href="_b_t_d_8h.html#aee05d40a014750b24a7e9967f6f389f4">HID_REQUEST_SET_REPORT</a>, 0xF4, 0x03, 0x00, 4, 4, cmd_buf, NULL);</div>
<div class="line"><a name="l00504"></a><span class="lineno"> 504</span>&#160;}</div>
<div class="line"><a name="l00505"></a><span class="lineno"> 505</span>&#160;</div>
<div class="line"><a name="l00506"></a><span class="lineno"> 506</span>&#160;<span class="comment">/* Playstation Move Controller commands */</span></div>
<div class="line"><a name="l00507"></a><span class="lineno"> 507</span>&#160;<span class="keywordtype">void</span> PS3USB::Move_Command(uint8_t* data, uint16_t nbytes) {</div>
<div class="line"><a name="l00508"></a><span class="lineno"> 508</span>&#160; <a class="code" href="class_p_s3_u_s_b.html#aa1873f41ae0da7c4568cfb7517560c48">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#affbc018973a588995457d535b0ac7ee7">outTransfer</a>(<a class="code" href="class_p_s3_u_s_b.html#a3f43df159277003acdf7dd107bda27fd">bAddress</a>, <a class="code" href="class_p_s3_u_s_b.html#a394dbb0a59b587210e5958f08dac48f1">epInfo</a>[ <a class="code" href="_p_s3_u_s_b_8h.html#a0da271fcb10181b3ce15aefe76c259bb">PS3_OUTPUT_PIPE</a> ].epAddr, nbytes, data);</div>
<div class="line"><a name="l00509"></a><span class="lineno"> 509</span>&#160;}</div>
<div class="line"><a name="l00510"></a><span class="lineno"> 510</span>&#160;</div>
<div class="line"><a name="l00511"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#ae9cfdaad3e54dbc271519e22082399c7"> 511</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_p_s3_u_s_b.html#ae9cfdaad3e54dbc271519e22082399c7">PS3USB::moveSetBulb</a>(uint8_t r, uint8_t g, uint8_t b) { <span class="comment">//Use this to set the Color using RGB values</span></div>
<div class="line"><a name="l00512"></a><span class="lineno"> 512</span>&#160; <span class="comment">// set the Bulb&#39;s values into the write buffer</span></div>
<div class="line"><a name="l00513"></a><span class="lineno"> 513</span>&#160; writeBuf[2] = r;</div>
<div class="line"><a name="l00514"></a><span class="lineno"> 514</span>&#160; writeBuf[3] = g;</div>
<div class="line"><a name="l00515"></a><span class="lineno"> 515</span>&#160; writeBuf[4] = b;</div>
<div class="line"><a name="l00516"></a><span class="lineno"> 516</span>&#160;</div>
<div class="line"><a name="l00517"></a><span class="lineno"> 517</span>&#160; Move_Command(writeBuf, <a class="code" href="_p_s3_u_s_b_8h.html#a2c6c24a4b63d9a34926fb35d6b49cd17">MOVE_REPORT_BUFFER_SIZE</a>);</div>
<div class="line"><a name="l00518"></a><span class="lineno"> 518</span>&#160;}</div>
<div class="line"><a name="l00519"></a><span class="lineno"> 519</span>&#160;</div>
<div class="line"><a name="l00520"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#a34c83190306752e68c5704eece875d49"> 520</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_p_s3_u_s_b.html#ae9cfdaad3e54dbc271519e22082399c7">PS3USB::moveSetBulb</a>(<a class="code" href="_p_s3_enums_8h.html#a55ecd4f2ec2ebfe8d5b0163e4ac2a967">Colors</a> color) { <span class="comment">//Use this to set the Color using the predefined colors in &quot;enums.h&quot;</span></div>
<div class="line"><a name="l00521"></a><span class="lineno"> 521</span>&#160; <a class="code" href="class_p_s3_u_s_b.html#ae9cfdaad3e54dbc271519e22082399c7">moveSetBulb</a>((uint8_t)(color &gt;&gt; 16), (uint8_t)(color &gt;&gt; 8), (uint8_t)(color));</div>
<div class="line"><a name="l00522"></a><span class="lineno"> 522</span>&#160;}</div>
<div class="line"><a name="l00523"></a><span class="lineno"> 523</span>&#160;</div>
<div class="line"><a name="l00524"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#a66d542c2cec73cefb3cdda36ff080e1a"> 524</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_p_s3_u_s_b.html#a66d542c2cec73cefb3cdda36ff080e1a">PS3USB::moveSetRumble</a>(uint8_t rumble) {</div>
<div class="line"><a name="l00525"></a><span class="lineno"> 525</span>&#160;<span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><a name="l00526"></a><span class="lineno"> 526</span>&#160;<span class="preprocessor"></span> <span class="keywordflow">if</span> (rumble &lt; 64 &amp;&amp; rumble != 0) <span class="comment">// The rumble value has to at least 64, or approximately 25% (64/255*100)</span></div>
<div class="line"><a name="l00527"></a><span class="lineno"> 527</span>&#160; <a class="code" href="message_8cpp.html#a1e8693828152de8408add858dc461dea">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nThe rumble value has to at least 64, or approximately 25%&quot;</span>), 0x80);</div>
<div class="line"><a name="l00528"></a><span class="lineno"> 528</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00529"></a><span class="lineno"> 529</span>&#160;<span class="preprocessor"></span> <span class="comment">//set the rumble value into the write buffer</span></div>
<div class="line"><a name="l00530"></a><span class="lineno"> 530</span>&#160; writeBuf[6] = rumble;</div>
<div class="line"><a name="l00531"></a><span class="lineno"> 531</span>&#160;</div>
<div class="line"><a name="l00532"></a><span class="lineno"> 532</span>&#160; Move_Command(writeBuf, <a class="code" href="_p_s3_u_s_b_8h.html#a2c6c24a4b63d9a34926fb35d6b49cd17">MOVE_REPORT_BUFFER_SIZE</a>);</div>
<div class="line"><a name="l00533"></a><span class="lineno"> 533</span>&#160;}</div>
<div class="line"><a name="l00534"></a><span class="lineno"> 534</span>&#160;</div>
<div class="line"><a name="l00535"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#a3be69a3c6e24bf2b53bc06c85829e62a"> 535</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_p_s3_u_s_b.html#a3be69a3c6e24bf2b53bc06c85829e62a">PS3USB::setMoveBdaddr</a>(uint8_t* BDADDR) {</div>
<div class="line"><a name="l00536"></a><span class="lineno"> 536</span>&#160; <span class="comment">/* Set the internal bluetooth address */</span></div>
<div class="line"><a name="l00537"></a><span class="lineno"> 537</span>&#160; uint8_t buf[11];</div>
<div class="line"><a name="l00538"></a><span class="lineno"> 538</span>&#160; buf[0] = 0x05;</div>
<div class="line"><a name="l00539"></a><span class="lineno"> 539</span>&#160; buf[7] = 0x10;</div>
<div class="line"><a name="l00540"></a><span class="lineno"> 540</span>&#160; buf[8] = 0x01;</div>
<div class="line"><a name="l00541"></a><span class="lineno"> 541</span>&#160; buf[9] = 0x02;</div>
<div class="line"><a name="l00542"></a><span class="lineno"> 542</span>&#160; buf[10] = 0x12;</div>
<div class="line"><a name="l00543"></a><span class="lineno"> 543</span>&#160;</div>
<div class="line"><a name="l00544"></a><span class="lineno"> 544</span>&#160; <span class="keywordflow">for</span> (uint8_t i = 0; i &lt; 6; i++)</div>
<div class="line"><a name="l00545"></a><span class="lineno"> 545</span>&#160; buf[i + 1] = BDADDR[i];</div>
<div class="line"><a name="l00546"></a><span class="lineno"> 546</span>&#160;</div>
<div class="line"><a name="l00547"></a><span class="lineno"> 547</span>&#160; <span class="comment">//bmRequest = Host to device (0x00) | Class (0x20) | Interface (0x01) = 0x21, bRequest = Set Report (0x09), Report ID (0x05), Report Type (Feature 0x03), interface (0x00), datalength, datalength, data)</span></div>
<div class="line"><a name="l00548"></a><span class="lineno"> 548</span>&#160; <a class="code" href="class_p_s3_u_s_b.html#aa1873f41ae0da7c4568cfb7517560c48">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a636695a5c3d35cd6b9e31c54edfacd7c">ctrlReq</a>(<a class="code" href="class_p_s3_u_s_b.html#a3f43df159277003acdf7dd107bda27fd">bAddress</a>, <a class="code" href="class_p_s3_u_s_b.html#a394dbb0a59b587210e5958f08dac48f1">epInfo</a>[<a class="code" href="_p_s3_u_s_b_8h.html#ae6276fa555fe14995bee0713be663333">PS3_CONTROL_PIPE</a>].epAddr, <a class="code" href="_b_t_d_8h.html#a5bd4ea095da29635414952894bd527f5">bmREQ_HID_OUT</a>, <a class="code" href="_b_t_d_8h.html#aee05d40a014750b24a7e9967f6f389f4">HID_REQUEST_SET_REPORT</a>, 0x05, 0x03, 0x00, 11, 11, buf, NULL);</div>
<div class="line"><a name="l00549"></a><span class="lineno"> 549</span>&#160;<span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><a name="l00550"></a><span class="lineno"> 550</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a1e8693828152de8408add858dc461dea">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nBluetooth Address was set to: &quot;</span>), 0x80);</div>
<div class="line"><a name="l00551"></a><span class="lineno"> 551</span>&#160; <span class="keywordflow">for</span> (int8_t i = 5; i &gt; 0; i--) {</div>
<div class="line"><a name="l00552"></a><span class="lineno"> 552</span>&#160; PrintHex&lt;uint8_t &gt; (my_bdaddr[i], 0x80);</div>
<div class="line"><a name="l00553"></a><span class="lineno"> 553</span>&#160; Serial.print(<span class="stringliteral">&quot;:&quot;</span>);</div>
<div class="line"><a name="l00554"></a><span class="lineno"> 554</span>&#160; }</div>
<div class="line"><a name="l00555"></a><span class="lineno"> 555</span>&#160; PrintHex&lt;uint8_t &gt; (my_bdaddr[0], 0x80);</div>
<div class="line"><a name="l00556"></a><span class="lineno"> 556</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00557"></a><span class="lineno"> 557</span>&#160;<span class="preprocessor"></span> <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00558"></a><span class="lineno"> 558</span>&#160;}</div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>

View file

@ -100,7 +100,7 @@ Include dependency graph for PS3USB.h:</div>
<div class="dyncontent">
<div class="center"><img src="_p_s3_u_s_b_8h__incl.png" border="0" usemap="#_p_s3_u_s_b_8h" alt=""/></div>
<map name="_p_s3_u_s_b_8h" id="_p_s3_u_s_b_8h">
<area shape="rect" id="node3" href="_usb_8h.html" title="Usb.h" alt="" coords="397,75,440,96"/><area shape="rect" id="node17" href="_p_s3_enums_8h.html" title="PS3Enums.h" alt="" coords="797,75,866,96"/><area shape="rect" id="node6" href="avrpins_8h.html" title="avrpins.h" alt="" coords="528,213,582,235"/><area shape="rect" id="node8" href="max3421e_8h.html" title="max3421e.h" alt="" coords="146,213,213,235"/><area shape="rect" id="node9" href="usbhost_8h.html" title="usbhost.h" alt="" coords="212,144,269,165"/><area shape="rect" id="node10" href="usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="237,213,296,235"/><area shape="rect" id="node11" href="address_8h.html" title="address.h" alt="" coords="79,144,136,165"/><area shape="rect" id="node13" href="printhex_8h.html" title="printhex.h" alt="" coords="608,213,665,235"/><area shape="rect" id="node14" href="hexdump_8h.html" title="hexdump.h" alt="" coords="430,144,492,165"/><area shape="rect" id="node16" href="message_8h.html" title="message.h" alt="" coords="345,144,406,165"/><area shape="rect" id="node18" href="controller_enums_8h.html" title="controllerEnums.h" alt="" coords="794,144,880,165"/></map>
<area shape="rect" id="node3" href="_usb_8h.html" title="Usb.h" alt="" coords="449,75,492,96"/><area shape="rect" id="node17" href="_p_s3_enums_8h.html" title="PS3Enums.h" alt="" coords="653,75,723,96"/><area shape="rect" id="node6" href="avrpins_8h.html" title="avrpins.h" alt="" coords="474,213,528,235"/><area shape="rect" id="node8" href="max3421e_8h.html" title="max3421e.h" alt="" coords="553,213,620,235"/><area shape="rect" id="node9" href="usbhost_8h.html" title="usbhost.h" alt="" coords="442,144,499,165"/><area shape="rect" id="node10" href="usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="391,213,449,235"/><area shape="rect" id="node11" href="address_8h.html" title="address.h" alt="" coords="701,144,757,165"/><area shape="rect" id="node13" href="message_8h.html" title="message.h" alt="" coords="204,144,265,165"/><area shape="rect" id="node15" href="printhex_8h.html" title="printhex.h" alt="" coords="71,213,128,235"/><area shape="rect" id="node16" href="hexdump_8h.html" title="hexdump.h" alt="" coords="204,213,265,235"/><area shape="rect" id="node18" href="controller_enums_8h.html" title="controllerEnums.h" alt="" coords="782,144,868,165"/></map>
</div>
</div><div class="textblock"><div class="dynheader">
This graph shows which files directly or indirectly include this file:</div>

View file

@ -1,13 +1,13 @@
<map id="PS3USB.h" name="PS3USB.h">
<area shape="rect" id="node3" href="$_usb_8h.html" title="Usb.h" alt="" coords="397,75,440,96"/>
<area shape="rect" id="node17" href="$_p_s3_enums_8h.html" title="PS3Enums.h" alt="" coords="797,75,866,96"/>
<area shape="rect" id="node6" href="$avrpins_8h.html" title="avrpins.h" alt="" coords="528,213,582,235"/>
<area shape="rect" id="node8" href="$max3421e_8h.html" title="max3421e.h" alt="" coords="146,213,213,235"/>
<area shape="rect" id="node9" href="$usbhost_8h.html" title="usbhost.h" alt="" coords="212,144,269,165"/>
<area shape="rect" id="node10" href="$usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="237,213,296,235"/>
<area shape="rect" id="node11" href="$address_8h.html" title="address.h" alt="" coords="79,144,136,165"/>
<area shape="rect" id="node13" href="$printhex_8h.html" title="printhex.h" alt="" coords="608,213,665,235"/>
<area shape="rect" id="node14" href="$hexdump_8h.html" title="hexdump.h" alt="" coords="430,144,492,165"/>
<area shape="rect" id="node16" href="$message_8h.html" title="message.h" alt="" coords="345,144,406,165"/>
<area shape="rect" id="node18" href="$controller_enums_8h.html" title="controllerEnums.h" alt="" coords="794,144,880,165"/>
<area shape="rect" id="node3" href="$_usb_8h.html" title="Usb.h" alt="" coords="449,75,492,96"/>
<area shape="rect" id="node17" href="$_p_s3_enums_8h.html" title="PS3Enums.h" alt="" coords="653,75,723,96"/>
<area shape="rect" id="node6" href="$avrpins_8h.html" title="avrpins.h" alt="" coords="474,213,528,235"/>
<area shape="rect" id="node8" href="$max3421e_8h.html" title="max3421e.h" alt="" coords="553,213,620,235"/>
<area shape="rect" id="node9" href="$usbhost_8h.html" title="usbhost.h" alt="" coords="442,144,499,165"/>
<area shape="rect" id="node10" href="$usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="391,213,449,235"/>
<area shape="rect" id="node11" href="$address_8h.html" title="address.h" alt="" coords="701,144,757,165"/>
<area shape="rect" id="node13" href="$message_8h.html" title="message.h" alt="" coords="204,144,265,165"/>
<area shape="rect" id="node15" href="$printhex_8h.html" title="printhex.h" alt="" coords="71,213,128,235"/>
<area shape="rect" id="node16" href="$hexdump_8h.html" title="hexdump.h" alt="" coords="204,213,265,235"/>
<area shape="rect" id="node18" href="$controller_enums_8h.html" title="controllerEnums.h" alt="" coords="782,144,868,165"/>
</map>

View file

@ -1 +1 @@
94d781798494bbe53b0ee1dedc2aa161
6cea3eaa38742a521814c303ac3dc51a

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 51 KiB

View file

@ -151,61 +151,70 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span>&#160; <span class="keyword">virtual</span> uint8_t <a class="code" href="class_p_s3_u_s_b.html#a0083545cb99fb8786e60281fe7a9050d">Init</a>(uint8_t parent, uint8_t port, <span class="keywordtype">bool</span> lowspeed);</div>
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>&#160; <span class="keyword">virtual</span> uint8_t <a class="code" href="class_p_s3_u_s_b.html#a5750c5448bf1ec73a7669ca2e4799c98">Release</a>();</div>
<div class="line"><a name="l00093"></a><span class="lineno"> 93</span>&#160; <span class="keyword">virtual</span> uint8_t <a class="code" href="class_p_s3_u_s_b.html#a9068e2a036012614c0db163830cbcf00">Poll</a>();</div>
<div class="line"><a name="l00098"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#a04b79c271ca14e1e095c6e305c672627"> 98</a></span>&#160; <span class="keyword">virtual</span> uint8_t <a class="code" href="class_p_s3_u_s_b.html#a04b79c271ca14e1e095c6e305c672627">GetAddress</a>() { <span class="keywordflow">return</span> <a class="code" href="class_p_s3_u_s_b.html#a3f43df159277003acdf7dd107bda27fd">bAddress</a>; };</div>
<div class="line"><a name="l00103"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#a02a5b0244665d5a790d1020e51c94479"> 103</a></span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="class_p_s3_u_s_b.html#a02a5b0244665d5a790d1020e51c94479">isReady</a>() { <span class="keywordflow">return</span> bPollEnable; };</div>
<div class="line"><a name="l00110"></a><span class="lineno"> 110</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_p_s3_u_s_b.html#af13993073ab245ece6d3fe9e9f41df87">setBdaddr</a>(uint8_t* BDADDR);</div>
<div class="line"><a name="l00115"></a><span class="lineno"> 115</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_p_s3_u_s_b.html#a3be69a3c6e24bf2b53bc06c85829e62a">setMoveBdaddr</a>(uint8_t* BDADDR);</div>
<div class="line"><a name="l00116"></a><span class="lineno"> 116</span>&#160;</div>
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_p_s3_u_s_b.html#ad1de9af6fb34f4cff6c1ed0af21b0141">getButtonPress</a>(<a class="code" href="controller_enums_8h.html#a03bfec859eac87be20f8952c1eb89de0">Button</a> b);</div>
<div class="line"><a name="l00127"></a><span class="lineno"> 127</span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_p_s3_u_s_b.html#a9a50f5ed5b41232336cc6d1870795230">getButtonClick</a>(<a class="code" href="controller_enums_8h.html#a03bfec859eac87be20f8952c1eb89de0">Button</a> b);</div>
<div class="line"><a name="l00138"></a><span class="lineno"> 138</span>&#160; uint8_t <a class="code" href="class_p_s3_u_s_b.html#a2d30813a3f5c4729b5c1662832d5a6e0">getAnalogButton</a>(<a class="code" href="controller_enums_8h.html#a03bfec859eac87be20f8952c1eb89de0">Button</a> a);</div>
<div class="line"><a name="l00144"></a><span class="lineno"> 144</span>&#160; uint8_t <a class="code" href="class_p_s3_u_s_b.html#a2b0f391b8ae3e80b18cf9108c3e8f7e3">getAnalogHat</a>(<a class="code" href="controller_enums_8h.html#aaaabdefc068fd57ec2bef2b62ea4ba92">AnalogHat</a> a);</div>
<div class="line"><a name="l00151"></a><span class="lineno"> 151</span>&#160; uint16_t <a class="code" href="class_p_s3_u_s_b.html#a4fe61beae6f0e36e4df1ea388bed0783">getSensor</a>(<a class="code" href="_p_s3_enums_8h.html#a9628766e5f200cc84b296b071b09ff4a">Sensor</a> a);</div>
<div class="line"><a name="l00157"></a><span class="lineno"> 157</span>&#160; <span class="keywordtype">double</span> <a class="code" href="class_p_s3_u_s_b.html#a9b9e5a3a3e80957f47f86f4155fee777">getAngle</a>(<a class="code" href="_p_s3_enums_8h.html#a0200d2d1b3a7930d0be6c50e7c8ae7d1">Angle</a> a);</div>
<div class="line"><a name="l00163"></a><span class="lineno"> 163</span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_p_s3_u_s_b.html#a09da3bcd33a8dd20d7cb06a70833e448">getStatus</a>(<a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70b">Status</a> c);</div>
<div class="line"><a name="l00168"></a><span class="lineno"> 168</span>&#160; String <a class="code" href="class_p_s3_u_s_b.html#ae3f19089341bb545f31b3b01e77131ae">getStatusString</a>();</div>
<div class="line"><a name="l00169"></a><span class="lineno"> 169</span>&#160;</div>
<div class="line"><a name="l00171"></a><span class="lineno"> 171</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_p_s3_u_s_b.html#ac7adc7365bb45d15c37e22f26f012498">setAllOff</a>();</div>
<div class="line"><a name="l00173"></a><span class="lineno"> 173</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_p_s3_u_s_b.html#aaa1e66d7397be6364d4f76749cbaad5a">setRumbleOff</a>();</div>
<div class="line"><a name="l00178"></a><span class="lineno"> 178</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_p_s3_u_s_b.html#a5dc4e5d1ebd5ca24da7cdc9dd08c94e1">setRumbleOn</a>(<a class="code" href="_p_s3_enums_8h.html#aff4be38428d075a117a5bb7f6209a231">Rumble</a> mode);</div>
<div class="line"><a name="l00183"></a><span class="lineno"> 183</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_p_s3_u_s_b.html#adb361fecbe4eb6fc5635dc7135cfff03">setLedOff</a>(<a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6">LED</a> a);</div>
<div class="line"><a name="l00188"></a><span class="lineno"> 188</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_p_s3_u_s_b.html#a44c4bff09064a09ef97c7bb6b8c0810b">setLedOn</a>(<a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6">LED</a> a);</div>
<div class="line"><a name="l00193"></a><span class="lineno"> 193</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_p_s3_u_s_b.html#acbab64f537f092e2fb125f9001f46090">setLedToggle</a>(<a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6">LED</a> a);</div>
<div class="line"><a name="l00194"></a><span class="lineno"> 194</span>&#160; </div>
<div class="line"><a name="l00199"></a><span class="lineno"> 199</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_p_s3_u_s_b.html#ae9cfdaad3e54dbc271519e22082399c7">moveSetBulb</a>(uint8_t r, uint8_t g, uint8_t b);</div>
<div class="line"><a name="l00204"></a><span class="lineno"> 204</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_p_s3_u_s_b.html#ae9cfdaad3e54dbc271519e22082399c7">moveSetBulb</a>(<a class="code" href="_p_s3_enums_8h.html#a55ecd4f2ec2ebfe8d5b0163e4ac2a967">Colors</a> color);</div>
<div class="line"><a name="l00209"></a><span class="lineno"> 209</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_p_s3_u_s_b.html#a66d542c2cec73cefb3cdda36ff080e1a">moveSetRumble</a>(uint8_t rumble);</div>
<div class="line"><a name="l00213"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#a0dad8754ff18d0c375c2569791d50876"> 213</a></span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_p_s3_u_s_b.html#a0dad8754ff18d0c375c2569791d50876">PS3Connected</a>;</div>
<div class="line"><a name="l00215"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#a89aa4233f3eeeb99693a099da527ec28"> 215</a></span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_p_s3_u_s_b.html#a89aa4233f3eeeb99693a099da527ec28">PS3MoveConnected</a>;</div>
<div class="line"><a name="l00217"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#a54b2dcaa1e9acef83de2376b50c7ff09"> 217</a></span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_p_s3_u_s_b.html#a54b2dcaa1e9acef83de2376b50c7ff09">PS3NavigationConnected</a>;</div>
<div class="line"><a name="l00218"></a><span class="lineno"> 218</span>&#160; </div>
<div class="line"><a name="l00219"></a><span class="lineno"> 219</span>&#160;<span class="keyword">protected</span>: </div>
<div class="line"><a name="l00221"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#aa1873f41ae0da7c4568cfb7517560c48"> 221</a></span>&#160; <a class="code" href="class_u_s_b.html">USB</a> *<a class="code" href="class_p_s3_u_s_b.html#aa1873f41ae0da7c4568cfb7517560c48">pUsb</a>;</div>
<div class="line"><a name="l00223"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#a3f43df159277003acdf7dd107bda27fd"> 223</a></span>&#160; uint8_t <a class="code" href="class_p_s3_u_s_b.html#a3f43df159277003acdf7dd107bda27fd">bAddress</a>;</div>
<div class="line"><a name="l00225"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#a394dbb0a59b587210e5958f08dac48f1"> 225</a></span>&#160; <a class="code" href="struct_ep_info.html">EpInfo</a> <a class="code" href="class_p_s3_u_s_b.html#a394dbb0a59b587210e5958f08dac48f1">epInfo</a>[<a class="code" href="_p_s3_u_s_b_8h.html#a168ab47b14a95d7cf8066d553a9cb862">PS3_MAX_ENDPOINTS</a>];</div>
<div class="line"><a name="l00226"></a><span class="lineno"> 226</span>&#160; </div>
<div class="line"><a name="l00227"></a><span class="lineno"> 227</span>&#160;<span class="keyword">private</span>: </div>
<div class="line"><a name="l00228"></a><span class="lineno"> 228</span>&#160; <span class="keywordtype">bool</span> bPollEnable;</div>
<div class="line"><a name="l00229"></a><span class="lineno"> 229</span>&#160; </div>
<div class="line"><a name="l00230"></a><span class="lineno"> 230</span>&#160; uint32_t timer; <span class="comment">// used to continuously set PS3 Move controller Bulb and rumble values</span></div>
<div class="line"><a name="l00231"></a><span class="lineno"> 231</span>&#160;</div>
<div class="line"><a name="l00232"></a><span class="lineno"> 232</span>&#160; uint32_t ButtonState;</div>
<div class="line"><a name="l00233"></a><span class="lineno"> 233</span>&#160; uint32_t OldButtonState;</div>
<div class="line"><a name="l00234"></a><span class="lineno"> 234</span>&#160; uint32_t ButtonClickState;</div>
<div class="line"><a name="l00235"></a><span class="lineno"> 235</span>&#160; </div>
<div class="line"><a name="l00236"></a><span class="lineno"> 236</span>&#160; uint8_t my_bdaddr[6]; <span class="comment">// Change to your dongles Bluetooth address in the constructor</span></div>
<div class="line"><a name="l00237"></a><span class="lineno"> 237</span>&#160; uint8_t readBuf[<a class="code" href="_p_s3_u_s_b_8h.html#abcb805b13bfd36145e252b0633bbcfc0">EP_MAXPKTSIZE</a>]; <span class="comment">// General purpose buffer for input data</span></div>
<div class="line"><a name="l00238"></a><span class="lineno"> 238</span>&#160; uint8_t writeBuf[<a class="code" href="_p_s3_u_s_b_8h.html#abcb805b13bfd36145e252b0633bbcfc0">EP_MAXPKTSIZE</a>]; <span class="comment">// General purpose buffer for output data</span></div>
<div class="line"><a name="l00239"></a><span class="lineno"> 239</span>&#160; </div>
<div class="line"><a name="l00240"></a><span class="lineno"> 240</span>&#160; <span class="keywordtype">void</span> readReport(); <span class="comment">// read incoming data</span></div>
<div class="line"><a name="l00241"></a><span class="lineno"> 241</span>&#160; <span class="keywordtype">void</span> printReport(); <span class="comment">// print incoming date - Uncomment for debugging</span></div>
<div class="line"><a name="l00242"></a><span class="lineno"> 242</span>&#160;</div>
<div class="line"><a name="l00243"></a><span class="lineno"> 243</span>&#160; <span class="comment">/* Private commands */</span></div>
<div class="line"><a name="l00244"></a><span class="lineno"> 244</span>&#160; <span class="keywordtype">void</span> PS3_Command(uint8_t* data, uint16_t nbytes);</div>
<div class="line"><a name="l00245"></a><span class="lineno"> 245</span>&#160; <span class="keywordtype">void</span> enable_sixaxis(); <span class="comment">// Command used to enable the Dualshock 3 and Navigation controller to send data via USB</span></div>
<div class="line"><a name="l00246"></a><span class="lineno"> 246</span>&#160; <span class="keywordtype">void</span> Move_Command(uint8_t* data, uint16_t nbytes); </div>
<div class="line"><a name="l00247"></a><span class="lineno"> 247</span>&#160;};</div>
<div class="line"><a name="l00248"></a><span class="lineno"> 248</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00094"></a><span class="lineno"> 94</span>&#160;</div>
<div class="line"><a name="l00099"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#a04b79c271ca14e1e095c6e305c672627"> 99</a></span>&#160; <span class="keyword">virtual</span> uint8_t <a class="code" href="class_p_s3_u_s_b.html#a04b79c271ca14e1e095c6e305c672627">GetAddress</a>() {</div>
<div class="line"><a name="l00100"></a><span class="lineno"> 100</span>&#160; <span class="keywordflow">return</span> <a class="code" href="class_p_s3_u_s_b.html#a3f43df159277003acdf7dd107bda27fd">bAddress</a>;</div>
<div class="line"><a name="l00101"></a><span class="lineno"> 101</span>&#160; };</div>
<div class="line"><a name="l00102"></a><span class="lineno"> 102</span>&#160;</div>
<div class="line"><a name="l00107"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#a02a5b0244665d5a790d1020e51c94479"> 107</a></span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="class_p_s3_u_s_b.html#a02a5b0244665d5a790d1020e51c94479">isReady</a>() {</div>
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span>&#160; <span class="keywordflow">return</span> bPollEnable;</div>
<div class="line"><a name="l00109"></a><span class="lineno"> 109</span>&#160; };</div>
<div class="line"><a name="l00116"></a><span class="lineno"> 116</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_p_s3_u_s_b.html#af13993073ab245ece6d3fe9e9f41df87">setBdaddr</a>(uint8_t* BDADDR);</div>
<div class="line"><a name="l00121"></a><span class="lineno"> 121</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_p_s3_u_s_b.html#a3be69a3c6e24bf2b53bc06c85829e62a">setMoveBdaddr</a>(uint8_t* BDADDR);</div>
<div class="line"><a name="l00122"></a><span class="lineno"> 122</span>&#160;</div>
<div class="line"><a name="l00132"></a><span class="lineno"> 132</span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_p_s3_u_s_b.html#ad1de9af6fb34f4cff6c1ed0af21b0141">getButtonPress</a>(<a class="code" href="controller_enums_8h.html#a03bfec859eac87be20f8952c1eb89de0">Button</a> b);</div>
<div class="line"><a name="l00133"></a><span class="lineno"> 133</span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_p_s3_u_s_b.html#a9a50f5ed5b41232336cc6d1870795230">getButtonClick</a>(<a class="code" href="controller_enums_8h.html#a03bfec859eac87be20f8952c1eb89de0">Button</a> b);</div>
<div class="line"><a name="l00144"></a><span class="lineno"> 144</span>&#160; uint8_t <a class="code" href="class_p_s3_u_s_b.html#a2d30813a3f5c4729b5c1662832d5a6e0">getAnalogButton</a>(<a class="code" href="controller_enums_8h.html#a03bfec859eac87be20f8952c1eb89de0">Button</a> a);</div>
<div class="line"><a name="l00150"></a><span class="lineno"> 150</span>&#160; uint8_t <a class="code" href="class_p_s3_u_s_b.html#a2b0f391b8ae3e80b18cf9108c3e8f7e3">getAnalogHat</a>(<a class="code" href="controller_enums_8h.html#aaaabdefc068fd57ec2bef2b62ea4ba92">AnalogHat</a> a);</div>
<div class="line"><a name="l00157"></a><span class="lineno"> 157</span>&#160; uint16_t <a class="code" href="class_p_s3_u_s_b.html#a4fe61beae6f0e36e4df1ea388bed0783">getSensor</a>(<a class="code" href="_p_s3_enums_8h.html#a9628766e5f200cc84b296b071b09ff4a">Sensor</a> a);</div>
<div class="line"><a name="l00163"></a><span class="lineno"> 163</span>&#160; <span class="keywordtype">double</span> <a class="code" href="class_p_s3_u_s_b.html#a9b9e5a3a3e80957f47f86f4155fee777">getAngle</a>(<a class="code" href="_p_s3_enums_8h.html#a0200d2d1b3a7930d0be6c50e7c8ae7d1">Angle</a> a);</div>
<div class="line"><a name="l00169"></a><span class="lineno"> 169</span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_p_s3_u_s_b.html#a09da3bcd33a8dd20d7cb06a70833e448">getStatus</a>(<a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70b">Status</a> c);</div>
<div class="line"><a name="l00174"></a><span class="lineno"> 174</span>&#160; String <a class="code" href="class_p_s3_u_s_b.html#ae3f19089341bb545f31b3b01e77131ae">getStatusString</a>();</div>
<div class="line"><a name="l00175"></a><span class="lineno"> 175</span>&#160;</div>
<div class="line"><a name="l00177"></a><span class="lineno"> 177</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_p_s3_u_s_b.html#ac7adc7365bb45d15c37e22f26f012498">setAllOff</a>();</div>
<div class="line"><a name="l00179"></a><span class="lineno"> 179</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_p_s3_u_s_b.html#aaa1e66d7397be6364d4f76749cbaad5a">setRumbleOff</a>();</div>
<div class="line"><a name="l00184"></a><span class="lineno"> 184</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_p_s3_u_s_b.html#a5dc4e5d1ebd5ca24da7cdc9dd08c94e1">setRumbleOn</a>(<a class="code" href="_p_s3_enums_8h.html#aff4be38428d075a117a5bb7f6209a231">Rumble</a> mode);</div>
<div class="line"><a name="l00192"></a><span class="lineno"> 192</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_p_s3_u_s_b.html#a5dc4e5d1ebd5ca24da7cdc9dd08c94e1">setRumbleOn</a>(uint8_t rightDuration, uint8_t rightPower, uint8_t leftDuration, uint8_t leftPower);</div>
<div class="line"><a name="l00193"></a><span class="lineno"> 193</span>&#160;</div>
<div class="line"><a name="l00198"></a><span class="lineno"> 198</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_p_s3_u_s_b.html#aa0aac5ea016db4cd6736a15e9d6eb41b">setLedRaw</a>(uint8_t value);</div>
<div class="line"><a name="l00203"></a><span class="lineno"> 203</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_p_s3_u_s_b.html#adb361fecbe4eb6fc5635dc7135cfff03">setLedOff</a>(<a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6">LED</a> a);</div>
<div class="line"><a name="l00208"></a><span class="lineno"> 208</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_p_s3_u_s_b.html#a44c4bff09064a09ef97c7bb6b8c0810b">setLedOn</a>(<a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6">LED</a> a);</div>
<div class="line"><a name="l00213"></a><span class="lineno"> 213</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_p_s3_u_s_b.html#acbab64f537f092e2fb125f9001f46090">setLedToggle</a>(<a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6">LED</a> a);</div>
<div class="line"><a name="l00214"></a><span class="lineno"> 214</span>&#160;</div>
<div class="line"><a name="l00219"></a><span class="lineno"> 219</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_p_s3_u_s_b.html#ae9cfdaad3e54dbc271519e22082399c7">moveSetBulb</a>(uint8_t r, uint8_t g, uint8_t b);</div>
<div class="line"><a name="l00224"></a><span class="lineno"> 224</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_p_s3_u_s_b.html#ae9cfdaad3e54dbc271519e22082399c7">moveSetBulb</a>(<a class="code" href="_p_s3_enums_8h.html#a55ecd4f2ec2ebfe8d5b0163e4ac2a967">Colors</a> color);</div>
<div class="line"><a name="l00229"></a><span class="lineno"> 229</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_p_s3_u_s_b.html#a66d542c2cec73cefb3cdda36ff080e1a">moveSetRumble</a>(uint8_t rumble);</div>
<div class="line"><a name="l00233"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#a0dad8754ff18d0c375c2569791d50876"> 233</a></span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_p_s3_u_s_b.html#a0dad8754ff18d0c375c2569791d50876">PS3Connected</a>;</div>
<div class="line"><a name="l00235"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#a89aa4233f3eeeb99693a099da527ec28"> 235</a></span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_p_s3_u_s_b.html#a89aa4233f3eeeb99693a099da527ec28">PS3MoveConnected</a>;</div>
<div class="line"><a name="l00237"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#a54b2dcaa1e9acef83de2376b50c7ff09"> 237</a></span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_p_s3_u_s_b.html#a54b2dcaa1e9acef83de2376b50c7ff09">PS3NavigationConnected</a>;</div>
<div class="line"><a name="l00238"></a><span class="lineno"> 238</span>&#160;</div>
<div class="line"><a name="l00239"></a><span class="lineno"> 239</span>&#160;<span class="keyword">protected</span>:</div>
<div class="line"><a name="l00241"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#aa1873f41ae0da7c4568cfb7517560c48"> 241</a></span>&#160; <a class="code" href="class_u_s_b.html">USB</a> *<a class="code" href="class_p_s3_u_s_b.html#aa1873f41ae0da7c4568cfb7517560c48">pUsb</a>;</div>
<div class="line"><a name="l00243"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#a3f43df159277003acdf7dd107bda27fd"> 243</a></span>&#160; uint8_t <a class="code" href="class_p_s3_u_s_b.html#a3f43df159277003acdf7dd107bda27fd">bAddress</a>;</div>
<div class="line"><a name="l00245"></a><span class="lineno"><a class="code" href="class_p_s3_u_s_b.html#a394dbb0a59b587210e5958f08dac48f1"> 245</a></span>&#160; <a class="code" href="struct_ep_info.html">EpInfo</a> <a class="code" href="class_p_s3_u_s_b.html#a394dbb0a59b587210e5958f08dac48f1">epInfo</a>[<a class="code" href="_p_s3_u_s_b_8h.html#a168ab47b14a95d7cf8066d553a9cb862">PS3_MAX_ENDPOINTS</a>];</div>
<div class="line"><a name="l00246"></a><span class="lineno"> 246</span>&#160;</div>
<div class="line"><a name="l00247"></a><span class="lineno"> 247</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00248"></a><span class="lineno"> 248</span>&#160; <span class="keywordtype">bool</span> bPollEnable;</div>
<div class="line"><a name="l00249"></a><span class="lineno"> 249</span>&#160;</div>
<div class="line"><a name="l00250"></a><span class="lineno"> 250</span>&#160; uint32_t timer; <span class="comment">// used to continuously set PS3 Move controller Bulb and rumble values</span></div>
<div class="line"><a name="l00251"></a><span class="lineno"> 251</span>&#160;</div>
<div class="line"><a name="l00252"></a><span class="lineno"> 252</span>&#160; uint32_t ButtonState;</div>
<div class="line"><a name="l00253"></a><span class="lineno"> 253</span>&#160; uint32_t OldButtonState;</div>
<div class="line"><a name="l00254"></a><span class="lineno"> 254</span>&#160; uint32_t ButtonClickState;</div>
<div class="line"><a name="l00255"></a><span class="lineno"> 255</span>&#160;</div>
<div class="line"><a name="l00256"></a><span class="lineno"> 256</span>&#160; uint8_t my_bdaddr[6]; <span class="comment">// Change to your dongles Bluetooth address in the constructor</span></div>
<div class="line"><a name="l00257"></a><span class="lineno"> 257</span>&#160; uint8_t readBuf[<a class="code" href="_p_s3_u_s_b_8h.html#abcb805b13bfd36145e252b0633bbcfc0">EP_MAXPKTSIZE</a>]; <span class="comment">// General purpose buffer for input data</span></div>
<div class="line"><a name="l00258"></a><span class="lineno"> 258</span>&#160; uint8_t writeBuf[<a class="code" href="_p_s3_u_s_b_8h.html#abcb805b13bfd36145e252b0633bbcfc0">EP_MAXPKTSIZE</a>]; <span class="comment">// General purpose buffer for output data</span></div>
<div class="line"><a name="l00259"></a><span class="lineno"> 259</span>&#160;</div>
<div class="line"><a name="l00260"></a><span class="lineno"> 260</span>&#160; <span class="keywordtype">void</span> readReport(); <span class="comment">// read incoming data</span></div>
<div class="line"><a name="l00261"></a><span class="lineno"> 261</span>&#160; <span class="keywordtype">void</span> printReport(); <span class="comment">// print incoming date - Uncomment for debugging</span></div>
<div class="line"><a name="l00262"></a><span class="lineno"> 262</span>&#160;</div>
<div class="line"><a name="l00263"></a><span class="lineno"> 263</span>&#160; <span class="comment">/* Private commands */</span></div>
<div class="line"><a name="l00264"></a><span class="lineno"> 264</span>&#160; <span class="keywordtype">void</span> PS3_Command(uint8_t* data, uint16_t nbytes);</div>
<div class="line"><a name="l00265"></a><span class="lineno"> 265</span>&#160; <span class="keywordtype">void</span> enable_sixaxis(); <span class="comment">// Command used to enable the Dualshock 3 and Navigation controller to send data via USB</span></div>
<div class="line"><a name="l00266"></a><span class="lineno"> 266</span>&#160; <span class="keywordtype">void</span> Move_Command(uint8_t* data, uint16_t nbytes);</div>
<div class="line"><a name="l00267"></a><span class="lineno"> 267</span>&#160;};</div>
<div class="line"><a name="l00268"></a><span class="lineno"> 268</span>&#160;<span class="preprocessor">#endif</span></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>

View file

@ -133,125 +133,128 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span>&#160;<span class="stringliteral"></span></div>
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span>&#160;<span class="stringliteral"># How to use the library</span></div>
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span>&#160;<span class="stringliteral"></span></div>
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span>&#160;<span class="stringliteral">### Arduino ADK</span></div>
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span>&#160;<span class="stringliteral">To use this library with the official [Arduino ADK](http://arduino.cc/en/Main/ArduinoBoardADK) uncomment the following line in [avrpins.h](https://github.com/felis/USB_Host_Shield_2.0/blob/master/avrpins.h):</span></div>
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>&#160;<span class="stringliteral"></span></div>
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span>&#160;<span class="stringliteral">&lt;code&gt;</span></div>
<div class="line"><a name="l00053"></a><span class="lineno"> 53</span>&#160;<span class="stringliteral">\#define BOARD\_MEGA_ADK</span></div>
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span>&#160;<span class="stringliteral">&lt;/code&gt;</span></div>
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span>&#160;<span class="stringliteral">### Documentation</span></div>
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span>&#160;<span class="stringliteral"></span></div>
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>&#160;<span class="stringliteral">Documentation for the library can be found at the following link: &lt;http://felis.github.com/USB_Host_Shield_2.0/&gt;.</span></div>
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span>&#160;<span class="stringliteral"></span></div>
<div class="line"><a name="l00053"></a><span class="lineno"> 53</span>&#160;<span class="stringliteral">### Arduino ADK</span></div>
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span>&#160;<span class="stringliteral">To use this library with the official [Arduino ADK](http://arduino.cc/en/Main/ArduinoBoardADK) uncomment the following line in [avrpins.h](https://github.com/felis/USB_Host_Shield_2.0/blob/master/avrpins.h):</span></div>
<div class="line"><a name="l00055"></a><span class="lineno"> 55</span>&#160;<span class="stringliteral"></span></div>
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>&#160;<span class="stringliteral">### [Bluetooth libraries](https://github.com/felis/USB_Host_Shield_2.0/blob/master/BTD.cpp)</span></div>
<div class="line"><a name="l00057"></a><span class="lineno"> 57</span>&#160;<span class="stringliteral"></span></div>
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span>&#160;<span class="stringliteral">The [BTD library](https://github.com/felis/USB_Host_Shield_2.0/blob/master/BTD.cpp) is a general purpose library for an ordinary Bluetooth dongle.</span></div>
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span>&#160;<span class="stringliteral">This library make it easy to add support for different Bluetooth services like a PS3 or a Wii controller or SPP which is a virtual serial port via Bluetooth.</span></div>
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span>&#160;<span class="stringliteral">Some different examples can be found in the [example directory](https://github.com/felis/USB_Host_Shield_2.0/tree/master/examples/Bluetooth).</span></div>
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>&#160;<span class="stringliteral">&lt;code&gt;</span></div>
<div class="line"><a name="l00057"></a><span class="lineno"> 57</span>&#160;<span class="stringliteral">\#define BOARD\_MEGA_ADK</span></div>
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span>&#160;<span class="stringliteral">&lt;/code&gt;</span></div>
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span>&#160;<span class="stringliteral"></span></div>
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span>&#160;<span class="stringliteral">### [Bluetooth libraries](https://github.com/felis/USB_Host_Shield_2.0/blob/master/BTD.cpp)</span></div>
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span>&#160;<span class="stringliteral"></span></div>
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>&#160;<span class="stringliteral">The BTD library will also make it possible to use multiple services at once, the following example sketch is an example of this:</span></div>
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span>&#160;<span class="stringliteral">&lt;https://github.com/felis/USB_Host_Shield_2.0/blob/master/examples/Bluetooth/PS3SPP/PS3SPP.ino&gt;</span></div>
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>&#160;<span class="stringliteral"></span></div>
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>&#160;<span class="stringliteral">### [SPP library](https://github.com/felis/USB_Host_Shield_2.0/blob/master/SPP.cpp)</span></div>
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>&#160;<span class="stringliteral"></span></div>
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span>&#160;<span class="stringliteral">SPP stands for &quot;Serial Port Profile&quot; and is a Bluetooth protocol that implements a virtual comport which allows you to send data back and forth from your computer/phone to your Arduino via Bluetooth.</span></div>
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>&#160;<span class="stringliteral">It has been tested successfully on Windows, Mac OS X, Linux, and Android.</span></div>
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>&#160;<span class="stringliteral">Unfortunately Google broke something in Android 4.2, so it&#39;</span>s currently not working in <span class="keyword">this</span> version of Android.</div>
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>&#160;</div>
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>&#160;More information can be found at these blog posts:</div>
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>&#160;</div>
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span>&#160;* &lt;http:<span class="comment">//www.circuitsathome.com/mcu/bluetooth-rfcommspp-service-support-for-usb-host-2-0-library-released&gt;</span></div>
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span>&#160;* &lt;http:<span class="comment">//blog.tkjelectronics.dk/2012/07/rfcommspp-library-for-arduino/&gt;</span></div>
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span>&#160;</div>
<div class="line"><a name="l00076"></a><span class="lineno"> 76</span>&#160;To implement the <a class="code" href="class_s_p_p.html">SPP</a> protocol I used a <a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba730728c9aac83393ac83f96a8125b8bb">Bluetooth</a> sniffing tool called [PacketLogger](http:<span class="comment">//www.tkjelectronics.com/uploads/PacketLogger.zip) developed by Apple. </span></div>
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span>&#160;It enables me to see the <a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba730728c9aac83393ac83f96a8125b8bb">Bluetooth</a> communication between my Mac and any device.</div>
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span>&#160;</div>
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>&#160;### PS3 Library</div>
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>&#160;</div>
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span>&#160;These libraries consist of the [<a class="code" href="class_p_s3_b_t.html">PS3BT</a>](https:<span class="comment">//github.com/felis/USB_Host_Shield_2.0/blob/master/PS3BT.cpp) and [PS3USB](https://github.com/felis/USB_Host_Shield_2.0/blob/master/PS3USB.cpp). These libraries allows you to use a Dualshock 3, Navigation or a Motion controller with the USB Host Shield both via Bluetooth and USB.</span></div>
<div class="line"><a name="l00082"></a><span class="lineno"> 82</span>&#160;</div>
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span>&#160;In order to use your Playstation controller via <a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba730728c9aac83393ac83f96a8125b8bb">Bluetooth</a> you have to <span class="keyword">set</span> the <a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba730728c9aac83393ac83f96a8125b8bb">Bluetooth</a> address of the dongle internally to your PS3 Controller. This can be achieved by plugging the controller in via <a class="code" href="class_u_s_b.html">USB</a> and letting the library <span class="keyword">set</span> it automatically.</div>
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span>&#160;</div>
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span>&#160;__Note:__ To obtain the address you have to plug in the <a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba730728c9aac83393ac83f96a8125b8bb">Bluetooth</a> dongle before connecting the controller, or alternatively you could <span class="keyword">set</span> it in code like so: &lt;https:<span class="comment">//github.com/felis/USB_Host_Shield_2.0/blob/master/examples/Bluetooth/PS3BT/PS3BT.ino#L12&gt;.</span></div>
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span>&#160;</div>
<div class="line"><a name="l00087"></a><span class="lineno"> 87</span>&#160;For more information about the PS3 protocol see the official wiki: &lt;https:<span class="comment">//github.com/felis/USB_Host_Shield_2.0/wiki/PS3-Information&gt;.</span></div>
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>&#160;</div>
<div class="line"><a name="l00089"></a><span class="lineno"> 89</span>&#160;Also take a look at the blog posts:</div>
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span>&#160;</div>
<div class="line"><a name="l00091"></a><span class="lineno"> 91</span>&#160;* &lt;http:<span class="comment">//blog.tkjelectronics.dk/2012/01/ps3-controller-bt-library-for-arduino/&gt;</span></div>
<div class="line"><a name="l00092"></a><span class="lineno"> 92</span>&#160;* &lt;http:<span class="comment">//www.circuitsathome.com/mcu/sony-ps3-controller-support-added-to-usb-host-library&gt;</span></div>
<div class="line"><a name="l00093"></a><span class="lineno"> 93</span>&#160;* &lt;http:<span class="comment">//www.circuitsathome.com/mcu/arduino/interfacing-ps3-controllers-via-usb&gt;</span></div>
<div class="line"><a name="l00094"></a><span class="lineno"> 94</span>&#160;</div>
<div class="line"><a name="l00095"></a><span class="lineno"> 95</span>&#160;<a class="code" href="controller_enums_8h.html#a03bfec859eac87be20f8952c1eb89de0a42a4ade1acd55a49164099104990e09f">A</a> special thanks go to the following people:</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;1. _Richard Ibbotson_ who made <span class="keyword">this</span> excellent guide: &lt;http:<span class="comment">//www.circuitsathome.com/mcu/ps3-and-wiimote-game-controllers-on-the-arduino-host-shield-part&gt;</span></div>
<div class="line"><a name="l00098"></a><span class="lineno"> 98</span>&#160;2. _Tomoyuki Tanaka_ <span class="keywordflow">for</span> releasing his code <span class="keywordflow">for</span> the Arduino <a class="code" href="class_u_s_b.html">USB</a> Host shield connected to the wiimote: &lt;http:<span class="comment">//www.circuitsathome.com/mcu/rc-car-controlled-by-wii-remote-on-arduino&gt;</span></div>
<div class="line"><a name="l00099"></a><span class="lineno"> 99</span>&#160;</div>
<div class="line"><a name="l00100"></a><span class="lineno"> 100</span>&#160;Also a big thanks all the people behind these sites about the Motion controller:</div>
<div class="line"><a name="l00101"></a><span class="lineno"> 101</span>&#160;</div>
<div class="line"><a name="l00102"></a><span class="lineno"> 102</span>&#160;* &lt;http:<span class="comment">//thp.io/2010/psmove/&gt;</span></div>
<div class="line"><a name="l00103"></a><span class="lineno"> 103</span>&#160;* &lt;http:<span class="comment">//www.copenhagengamecollective.org/unimove/&gt;</span></div>
<div class="line"><a name="l00104"></a><span class="lineno"> 104</span>&#160;* &lt;https:<span class="comment">//github.com/thp/psmoveapi&gt;</span></div>
<div class="line"><a name="l00105"></a><span class="lineno"> 105</span>&#160;* &lt;http:<span class="comment">//code.google.com/p/moveonpc/&gt;</span></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="preprocessor">### Xbox 360 Library</span></div>
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00109"></a><span class="lineno"> 109</span>&#160;The library support one Xbox 360 via <a class="code" href="class_u_s_b.html">USB</a> or up to four Xbox 360 controllers wirelessly by <span class="keyword">using</span> a [Xbox 360 wireless receiver](http:<span class="comment">//blog.tkjelectronics.dk/wp-content/uploads/xbox360-wireless-receiver.jpg).</span></div>
<div class="line"><a name="l00110"></a><span class="lineno"> 110</span>&#160;</div>
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span>&#160;To use it via <a class="code" href="class_u_s_b.html">USB</a> use the [<a class="code" href="class_x_b_o_x_u_s_b.html">XBOXUSB</a>](https:<span class="comment">//github.com/felis/USB_Host_Shield_2.0/blob/master/XBOXUSB.cpp) library or to use it wirelessly use the [XBOXRECV](https://github.com/felis/USB_Host_Shield_2.0/blob/master/XBOXRECV.cpp) library.</span></div>
<div class="line"><a name="l00112"></a><span class="lineno"> 112</span>&#160;</div>
<div class="line"><a name="l00113"></a><span class="lineno"> 113</span>&#160;__Note that a Wireless controller can NOT be used via <a class="code" href="class_u_s_b.html">USB</a>!__</div>
<div class="line"><a name="l00114"></a><span class="lineno"> 114</span>&#160;</div>
<div class="line"><a name="l00115"></a><span class="lineno"> 115</span>&#160;Examples code can be found in the [examples directory](https:<span class="comment">//github.com/felis/USB_Host_Shield_2.0/tree/master/examples/Xbox).</span></div>
<div class="line"><a name="l00116"></a><span class="lineno"> 116</span>&#160;</div>
<div class="line"><a name="l00117"></a><span class="lineno"> 117</span>&#160;Also see the following blog posts:</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;* &lt;http:<span class="comment">//www.circuitsathome.com/mcu/xbox360-controller-support-added-to-usb-host-shield-2-0-library&gt;</span></div>
<div class="line"><a name="l00120"></a><span class="lineno"> 120</span>&#160;* &lt;http:<span class="comment">//blog.tkjelectronics.dk/2012/07/xbox-360-controller-support-added-to-the-usb-host-library/&gt;</span></div>
<div class="line"><a name="l00121"></a><span class="lineno"> 121</span>&#160;* &lt;http:<span class="comment">//blog.tkjelectronics.dk/2012/12/xbox-360-receiver-added-to-the-usb-host-library/&gt;</span></div>
<div class="line"><a name="l00122"></a><span class="lineno"> 122</span>&#160;</div>
<div class="line"><a name="l00123"></a><span class="lineno"> 123</span>&#160;All the information regarding the Xbox 360 controller protocol are form these sites:</div>
<div class="line"><a name="l00124"></a><span class="lineno"> 124</span>&#160;</div>
<div class="line"><a name="l00125"></a><span class="lineno"> 125</span>&#160;* &lt;http:<span class="comment">//tattiebogle.net/index.php/ProjectRoot/Xbox360Controller/UsbInfo&gt;</span></div>
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span>&#160;* &lt;http:<span class="comment">//tattiebogle.net/index.php/ProjectRoot/Xbox360Controller/WirelessUsbInfo&gt;</span></div>
<div class="line"><a name="l00127"></a><span class="lineno"> 127</span>&#160;* &lt;https:<span class="comment">//github.com/Grumbel/xboxdrv/blob/master/PROTOCOL&gt;</span></div>
<div class="line"><a name="l00128"></a><span class="lineno"> 128</span>&#160;</div>
<div class="line"><a name="l00129"></a><span class="lineno"> 129</span>&#160;<span class="preprocessor">### [Wii library](https://github.com/felis/USB_Host_Shield_2.0/blob/master/Wii.cpp)</span></div>
<div class="line"><a name="l00130"></a><span class="lineno"> 130</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00131"></a><span class="lineno"> 131</span>&#160;The [Wii](https:<span class="comment">//github.com/felis/USB_Host_Shield_2.0/blob/master/Wii.cpp) library support the Wiimote, but also the Nunchuch and Motion Plus extensions via Bluetooth. The Wii U Pro Controller is also supported via Bluetooth.</span></div>
<div class="line"><a name="l00132"></a><span class="lineno"> 132</span>&#160;</div>
<div class="line"><a name="l00133"></a><span class="lineno"> 133</span>&#160;First you have to pair with the controller, <span class="keyword">this</span> is done automatically by the library <span class="keywordflow">if</span> you create the instance like so:</div>
<div class="line"><a name="l00134"></a><span class="lineno"> 134</span>&#160;</div>
<div class="line"><a name="l00135"></a><span class="lineno"> 135</span>&#160;&lt;code&gt;</div>
<div class="line"><a name="l00136"></a><span class="lineno"> 136</span>&#160;<a class="code" href="class_w_i_i.html">WII</a> Wii(&amp;Btd,<a class="code" href="_wii_8h.html#a8f0b5b0dedaf5c25c4887f03ebfdd425">PAIR</a>);</div>
<div class="line"><a name="l00137"></a><span class="lineno"> 137</span>&#160;&lt;/code&gt;</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;And then press 1 &amp; 2 at once on the Wiimote or press sync <span class="keywordflow">if</span> you are <span class="keyword">using</span> a Wii U Pro Controller.</div>
<div class="line"><a name="l00140"></a><span class="lineno"> 140</span>&#160;</div>
<div class="line"><a name="l00141"></a><span class="lineno"> 141</span>&#160;After that you can simply create the instance like so:</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;&lt;code&gt;</div>
<div class="line"><a name="l00144"></a><span class="lineno"> 144</span>&#160;<a class="code" href="class_w_i_i.html">WII</a> Wii(&amp;Btd);</div>
<div class="line"><a name="l00145"></a><span class="lineno"> 145</span>&#160;&lt;/code&gt;</div>
<div class="line"><a name="l00146"></a><span class="lineno"> 146</span>&#160;</div>
<div class="line"><a name="l00147"></a><span class="lineno"> 147</span>&#160;Then just press any button any button on the Wiimote and it will connect to the dongle.</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;Take a look at the example <span class="keywordflow">for</span> more information: &lt;https:<span class="comment">//github.com/felis/USB_Host_Shield_2.0/blob/master/examples/Bluetooth/Wii/Wii.ino&gt;.</span></div>
<div class="line"><a name="l00150"></a><span class="lineno"> 150</span>&#160;</div>
<div class="line"><a name="l00151"></a><span class="lineno"> 151</span>&#160;Also take a look at the blog post:</div>
<div class="line"><a name="l00152"></a><span class="lineno"> 152</span>&#160;</div>
<div class="line"><a name="l00153"></a><span class="lineno"> 153</span>&#160;* &lt;http:<span class="comment">//blog.tkjelectronics.dk/2012/08/wiimote-added-to-usb-host-library/&gt;</span></div>
<div class="line"><a name="l00154"></a><span class="lineno"> 154</span>&#160;</div>
<div class="line"><a name="l00155"></a><span class="lineno"> 155</span>&#160;All the information about the Wii controllers are from these sites:</div>
<div class="line"><a name="l00156"></a><span class="lineno"> 156</span>&#160;</div>
<div class="line"><a name="l00157"></a><span class="lineno"> 157</span>&#160;* &lt;http:<span class="comment">//wiibrew.org/wiki/Wiimote&gt;</span></div>
<div class="line"><a name="l00158"></a><span class="lineno"> 158</span>&#160;* &lt;http:<span class="comment">//wiibrew.org/wiki/Wiimote/Extension_Controllers&gt;</span></div>
<div class="line"><a name="l00159"></a><span class="lineno"> 159</span>&#160;* &lt;http:<span class="comment">//wiibrew.org/wiki/Wiimote/Extension_Controllers/Nunchuck&gt;</span></div>
<div class="line"><a name="l00160"></a><span class="lineno"> 160</span>&#160;* &lt;http:<span class="comment">//wiibrew.org/wiki/Wiimote/Extension_Controllers/Wii_Motion_Plus&gt;</span></div>
<div class="line"><a name="l00161"></a><span class="lineno"> 161</span>&#160;* The old library created by _Tomoyuki Tanaka_: &lt;https:<span class="comment">//github.com/moyuchin/WiiRemote_on_Arduino&gt; also helped a lot.</span></div>
<div class="line"><a name="l00162"></a><span class="lineno"> 162</span>&#160;</div>
<div class="line"><a name="l00163"></a><span class="lineno"> 163</span>&#160;<span class="preprocessor"># FAQ</span></div>
<div class="line"><a name="l00164"></a><span class="lineno"> 164</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00165"></a><span class="lineno"> 165</span>&#160;&gt; When I plug my device into the <a class="code" href="class_u_s_b.html">USB</a> connector nothing happens?</div>
<div class="line"><a name="l00166"></a><span class="lineno"> 166</span>&#160;</div>
<div class="line"><a name="l00167"></a><span class="lineno"> 167</span>&#160;Try to connect a external power supply to the Arduino - <span class="keyword">this</span> solves the problem in most cases.</div>
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>&#160;<span class="stringliteral">The [BTD library](https://github.com/felis/USB_Host_Shield_2.0/blob/master/BTD.cpp) is a general purpose library for an ordinary Bluetooth dongle.</span></div>
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span>&#160;<span class="stringliteral">This library make it easy to add support for different Bluetooth services like a PS3 or a Wii controller or SPP which is a virtual serial port via Bluetooth.</span></div>
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>&#160;<span class="stringliteral">Some different examples can be found in the [example directory](https://github.com/felis/USB_Host_Shield_2.0/tree/master/examples/Bluetooth).</span></div>
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>&#160;<span class="stringliteral"></span></div>
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>&#160;<span class="stringliteral">The BTD library will also make it possible to use multiple services at once, the following example sketch is an example of this:</span></div>
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span>&#160;<span class="stringliteral">&lt;https://github.com/felis/USB_Host_Shield_2.0/blob/master/examples/Bluetooth/PS3SPP/PS3SPP.ino&gt;</span></div>
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>&#160;<span class="stringliteral"></span></div>
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>&#160;<span class="stringliteral">### [SPP library](https://github.com/felis/USB_Host_Shield_2.0/blob/master/SPP.cpp)</span></div>
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>&#160;<span class="stringliteral"></span></div>
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>&#160;<span class="stringliteral">SPP stands for &quot;Serial Port Profile&quot; and is a Bluetooth protocol that implements a virtual comport which allows you to send data back and forth from your computer/phone to your Arduino via Bluetooth.</span></div>
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>&#160;<span class="stringliteral">It has been tested successfully on Windows, Mac OS X, Linux, and Android.</span></div>
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span>&#160;<span class="stringliteral"></span></div>
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span>&#160;<span class="stringliteral">More information can be found at these blog posts:</span></div>
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span>&#160;<span class="stringliteral"></span></div>
<div class="line"><a name="l00076"></a><span class="lineno"> 76</span>&#160;<span class="stringliteral">* &lt;http://www.circuitsathome.com/mcu/bluetooth-rfcommspp-service-support-for-usb-host-2-0-library-released&gt;</span></div>
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span>&#160;<span class="stringliteral">* &lt;http://blog.tkjelectronics.dk/2012/07/rfcommspp-library-for-arduino/&gt;</span></div>
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span>&#160;<span class="stringliteral"></span></div>
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>&#160;<span class="stringliteral">To implement the SPP protocol I used a Bluetooth sniffing tool called [PacketLogger](http://www.tkjelectronics.com/uploads/PacketLogger.zip) developed by Apple. </span></div>
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>&#160;<span class="stringliteral">It enables me to see the Bluetooth communication between my Mac and any device.</span></div>
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span>&#160;<span class="stringliteral"></span></div>
<div class="line"><a name="l00082"></a><span class="lineno"> 82</span>&#160;<span class="stringliteral">### PS3 Library</span></div>
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span>&#160;<span class="stringliteral"></span></div>
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span>&#160;<span class="stringliteral">These libraries consist of the [PS3BT](https://github.com/felis/USB_Host_Shield_2.0/blob/master/PS3BT.cpp) and [PS3USB](https://github.com/felis/USB_Host_Shield_2.0/blob/master/PS3USB.cpp). These libraries allows you to use a Dualshock 3, Navigation or a Motion controller with the USB Host Shield both via Bluetooth and USB.</span></div>
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span>&#160;<span class="stringliteral"></span></div>
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span>&#160;<span class="stringliteral">In order to use your Playstation controller via Bluetooth you have to set the Bluetooth address of the dongle internally to your PS3 Controller. This can be achieved by plugging the controller in via USB and letting the library set it automatically.</span></div>
<div class="line"><a name="l00087"></a><span class="lineno"> 87</span>&#160;<span class="stringliteral"></span></div>
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>&#160;<span class="stringliteral">__Note:__ To obtain the address you have to plug in the Bluetooth dongle before connecting the controller, or alternatively you could set it in code like so: &lt;https://github.com/felis/USB_Host_Shield_2.0/blob/master/examples/Bluetooth/PS3BT/PS3BT.ino#L12&gt;.</span></div>
<div class="line"><a name="l00089"></a><span class="lineno"> 89</span>&#160;<span class="stringliteral"></span></div>
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span>&#160;<span class="stringliteral">For more information about the PS3 protocol see the official wiki: &lt;https://github.com/felis/USB_Host_Shield_2.0/wiki/PS3-Information&gt;.</span></div>
<div class="line"><a name="l00091"></a><span class="lineno"> 91</span>&#160;<span class="stringliteral"></span></div>
<div class="line"><a name="l00092"></a><span class="lineno"> 92</span>&#160;<span class="stringliteral">Also take a look at the blog posts:</span></div>
<div class="line"><a name="l00093"></a><span class="lineno"> 93</span>&#160;<span class="stringliteral"></span></div>
<div class="line"><a name="l00094"></a><span class="lineno"> 94</span>&#160;<span class="stringliteral">* &lt;http://blog.tkjelectronics.dk/2012/01/ps3-controller-bt-library-for-arduino/&gt;</span></div>
<div class="line"><a name="l00095"></a><span class="lineno"> 95</span>&#160;<span class="stringliteral">* &lt;http://www.circuitsathome.com/mcu/sony-ps3-controller-support-added-to-usb-host-library&gt;</span></div>
<div class="line"><a name="l00096"></a><span class="lineno"> 96</span>&#160;<span class="stringliteral">* &lt;http://www.circuitsathome.com/mcu/arduino/interfacing-ps3-controllers-via-usb&gt;</span></div>
<div class="line"><a name="l00097"></a><span class="lineno"> 97</span>&#160;<span class="stringliteral"></span></div>
<div class="line"><a name="l00098"></a><span class="lineno"> 98</span>&#160;<span class="stringliteral">A special thanks go to the following people:</span></div>
<div class="line"><a name="l00099"></a><span class="lineno"> 99</span>&#160;<span class="stringliteral"></span></div>
<div class="line"><a name="l00100"></a><span class="lineno"> 100</span>&#160;<span class="stringliteral">1. _Richard Ibbotson_ who made this excellent guide: &lt;http://www.circuitsathome.com/mcu/ps3-and-wiimote-game-controllers-on-the-arduino-host-shield-part&gt;</span></div>
<div class="line"><a name="l00101"></a><span class="lineno"> 101</span>&#160;<span class="stringliteral">2. _Tomoyuki Tanaka_ for releasing his code for the Arduino USB Host shield connected to the wiimote: &lt;http://www.circuitsathome.com/mcu/rc-car-controlled-by-wii-remote-on-arduino&gt;</span></div>
<div class="line"><a name="l00102"></a><span class="lineno"> 102</span>&#160;<span class="stringliteral"></span></div>
<div class="line"><a name="l00103"></a><span class="lineno"> 103</span>&#160;<span class="stringliteral">Also a big thanks all the people behind these sites about the Motion controller:</span></div>
<div class="line"><a name="l00104"></a><span class="lineno"> 104</span>&#160;<span class="stringliteral"></span></div>
<div class="line"><a name="l00105"></a><span class="lineno"> 105</span>&#160;<span class="stringliteral">* &lt;http://thp.io/2010/psmove/&gt;</span></div>
<div class="line"><a name="l00106"></a><span class="lineno"> 106</span>&#160;<span class="stringliteral">* &lt;http://www.copenhagengamecollective.org/unimove/&gt;</span></div>
<div class="line"><a name="l00107"></a><span class="lineno"> 107</span>&#160;<span class="stringliteral">* &lt;https://github.com/thp/psmoveapi&gt;</span></div>
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span>&#160;<span class="stringliteral">* &lt;http://code.google.com/p/moveonpc/&gt;</span></div>
<div class="line"><a name="l00109"></a><span class="lineno"> 109</span>&#160;<span class="stringliteral"></span></div>
<div class="line"><a name="l00110"></a><span class="lineno"> 110</span>&#160;<span class="stringliteral">### Xbox 360 Library</span></div>
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span>&#160;<span class="stringliteral"></span></div>
<div class="line"><a name="l00112"></a><span class="lineno"> 112</span>&#160;<span class="stringliteral">The library support one Xbox 360 via USB or up to four Xbox 360 controllers wirelessly by using a [Xbox 360 wireless receiver](http://blog.tkjelectronics.dk/wp-content/uploads/xbox360-wireless-receiver.jpg).</span></div>
<div class="line"><a name="l00113"></a><span class="lineno"> 113</span>&#160;<span class="stringliteral"></span></div>
<div class="line"><a name="l00114"></a><span class="lineno"> 114</span>&#160;<span class="stringliteral">To use it via USB use the [XBOXUSB](https://github.com/felis/USB_Host_Shield_2.0/blob/master/XBOXUSB.cpp) library or to use it wirelessly use the [XBOXRECV](https://github.com/felis/USB_Host_Shield_2.0/blob/master/XBOXRECV.cpp) library.</span></div>
<div class="line"><a name="l00115"></a><span class="lineno"> 115</span>&#160;<span class="stringliteral"></span></div>
<div class="line"><a name="l00116"></a><span class="lineno"> 116</span>&#160;<span class="stringliteral">__Note that a Wireless controller can NOT be used via USB!__</span></div>
<div class="line"><a name="l00117"></a><span class="lineno"> 117</span>&#160;<span class="stringliteral"></span></div>
<div class="line"><a name="l00118"></a><span class="lineno"> 118</span>&#160;<span class="stringliteral">Examples code can be found in the [examples directory](https://github.com/felis/USB_Host_Shield_2.0/tree/master/examples/Xbox).</span></div>
<div class="line"><a name="l00119"></a><span class="lineno"> 119</span>&#160;<span class="stringliteral"></span></div>
<div class="line"><a name="l00120"></a><span class="lineno"> 120</span>&#160;<span class="stringliteral">Also see the following blog posts:</span></div>
<div class="line"><a name="l00121"></a><span class="lineno"> 121</span>&#160;<span class="stringliteral"></span></div>
<div class="line"><a name="l00122"></a><span class="lineno"> 122</span>&#160;<span class="stringliteral">* &lt;http://www.circuitsathome.com/mcu/xbox360-controller-support-added-to-usb-host-shield-2-0-library&gt;</span></div>
<div class="line"><a name="l00123"></a><span class="lineno"> 123</span>&#160;<span class="stringliteral">* &lt;http://blog.tkjelectronics.dk/2012/07/xbox-360-controller-support-added-to-the-usb-host-library/&gt;</span></div>
<div class="line"><a name="l00124"></a><span class="lineno"> 124</span>&#160;<span class="stringliteral">* &lt;http://blog.tkjelectronics.dk/2012/12/xbox-360-receiver-added-to-the-usb-host-library/&gt;</span></div>
<div class="line"><a name="l00125"></a><span class="lineno"> 125</span>&#160;<span class="stringliteral"></span></div>
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span>&#160;<span class="stringliteral">All the information regarding the Xbox 360 controller protocol are form these sites:</span></div>
<div class="line"><a name="l00127"></a><span class="lineno"> 127</span>&#160;<span class="stringliteral"></span></div>
<div class="line"><a name="l00128"></a><span class="lineno"> 128</span>&#160;<span class="stringliteral">* &lt;http://tattiebogle.net/index.php/ProjectRoot/Xbox360Controller/UsbInfo&gt;</span></div>
<div class="line"><a name="l00129"></a><span class="lineno"> 129</span>&#160;<span class="stringliteral">* &lt;http://tattiebogle.net/index.php/ProjectRoot/Xbox360Controller/WirelessUsbInfo&gt;</span></div>
<div class="line"><a name="l00130"></a><span class="lineno"> 130</span>&#160;<span class="stringliteral">* &lt;https://github.com/Grumbel/xboxdrv/blob/master/PROTOCOL&gt;</span></div>
<div class="line"><a name="l00131"></a><span class="lineno"> 131</span>&#160;<span class="stringliteral"></span></div>
<div class="line"><a name="l00132"></a><span class="lineno"> 132</span>&#160;<span class="stringliteral">### [Wii library](https://github.com/felis/USB_Host_Shield_2.0/blob/master/Wii.cpp)</span></div>
<div class="line"><a name="l00133"></a><span class="lineno"> 133</span>&#160;<span class="stringliteral"></span></div>
<div class="line"><a name="l00134"></a><span class="lineno"> 134</span>&#160;<span class="stringliteral">The [Wii](https://github.com/felis/USB_Host_Shield_2.0/blob/master/Wii.cpp) library support the Wiimote, but also the Nunchuch and Motion Plus extensions via Bluetooth. The Wii U Pro Controller is also supported via Bluetooth.</span></div>
<div class="line"><a name="l00135"></a><span class="lineno"> 135</span>&#160;<span class="stringliteral"></span></div>
<div class="line"><a name="l00136"></a><span class="lineno"> 136</span>&#160;<span class="stringliteral">First you have to pair with the controller, this is done automatically by the library if you create the instance like so:</span></div>
<div class="line"><a name="l00137"></a><span class="lineno"> 137</span>&#160;<span class="stringliteral"></span></div>
<div class="line"><a name="l00138"></a><span class="lineno"> 138</span>&#160;<span class="stringliteral">&lt;code&gt;</span></div>
<div class="line"><a name="l00139"></a><span class="lineno"> 139</span>&#160;<span class="stringliteral">WII Wii(&amp;Btd,PAIR);</span></div>
<div class="line"><a name="l00140"></a><span class="lineno"> 140</span>&#160;<span class="stringliteral">&lt;/code&gt;</span></div>
<div class="line"><a name="l00141"></a><span class="lineno"> 141</span>&#160;<span class="stringliteral"></span></div>
<div class="line"><a name="l00142"></a><span class="lineno"> 142</span>&#160;<span class="stringliteral">And then press 1 &amp; 2 at once on the Wiimote or press sync if you are using a Wii U Pro Controller.</span></div>
<div class="line"><a name="l00143"></a><span class="lineno"> 143</span>&#160;<span class="stringliteral"></span></div>
<div class="line"><a name="l00144"></a><span class="lineno"> 144</span>&#160;<span class="stringliteral">After that you can simply create the instance like so:</span></div>
<div class="line"><a name="l00145"></a><span class="lineno"> 145</span>&#160;<span class="stringliteral"></span></div>
<div class="line"><a name="l00146"></a><span class="lineno"> 146</span>&#160;<span class="stringliteral">&lt;code&gt;</span></div>
<div class="line"><a name="l00147"></a><span class="lineno"> 147</span>&#160;<span class="stringliteral">WII Wii(&amp;Btd);</span></div>
<div class="line"><a name="l00148"></a><span class="lineno"> 148</span>&#160;<span class="stringliteral">&lt;/code&gt;</span></div>
<div class="line"><a name="l00149"></a><span class="lineno"> 149</span>&#160;<span class="stringliteral"></span></div>
<div class="line"><a name="l00150"></a><span class="lineno"> 150</span>&#160;<span class="stringliteral">Then just press any button any button on the Wiimote and it will connect to the dongle.</span></div>
<div class="line"><a name="l00151"></a><span class="lineno"> 151</span>&#160;<span class="stringliteral"></span></div>
<div class="line"><a name="l00152"></a><span class="lineno"> 152</span>&#160;<span class="stringliteral">Take a look at the example for more information: &lt;https://github.com/felis/USB_Host_Shield_2.0/blob/master/examples/Bluetooth/Wii/Wii.ino&gt;.</span></div>
<div class="line"><a name="l00153"></a><span class="lineno"> 153</span>&#160;<span class="stringliteral"></span></div>
<div class="line"><a name="l00154"></a><span class="lineno"> 154</span>&#160;<span class="stringliteral">Also take a look at the blog post:</span></div>
<div class="line"><a name="l00155"></a><span class="lineno"> 155</span>&#160;<span class="stringliteral"></span></div>
<div class="line"><a name="l00156"></a><span class="lineno"> 156</span>&#160;<span class="stringliteral">* &lt;http://blog.tkjelectronics.dk/2012/08/wiimote-added-to-usb-host-library/&gt;</span></div>
<div class="line"><a name="l00157"></a><span class="lineno"> 157</span>&#160;<span class="stringliteral"></span></div>
<div class="line"><a name="l00158"></a><span class="lineno"> 158</span>&#160;<span class="stringliteral">All the information about the Wii controllers are from these sites:</span></div>
<div class="line"><a name="l00159"></a><span class="lineno"> 159</span>&#160;<span class="stringliteral"></span></div>
<div class="line"><a name="l00160"></a><span class="lineno"> 160</span>&#160;<span class="stringliteral">* &lt;http://wiibrew.org/wiki/Wiimote&gt;</span></div>
<div class="line"><a name="l00161"></a><span class="lineno"> 161</span>&#160;<span class="stringliteral">* &lt;http://wiibrew.org/wiki/Wiimote/Extension_Controllers&gt;</span></div>
<div class="line"><a name="l00162"></a><span class="lineno"> 162</span>&#160;<span class="stringliteral">* &lt;http://wiibrew.org/wiki/Wiimote/Extension_Controllers/Nunchuck&gt;</span></div>
<div class="line"><a name="l00163"></a><span class="lineno"> 163</span>&#160;<span class="stringliteral">* &lt;http://wiibrew.org/wiki/Wiimote/Extension_Controllers/Wii_Motion_Plus&gt;</span></div>
<div class="line"><a name="l00164"></a><span class="lineno"> 164</span>&#160;<span class="stringliteral">* The old library created by _Tomoyuki Tanaka_: &lt;https://github.com/moyuchin/WiiRemote_on_Arduino&gt; also helped a lot.</span></div>
<div class="line"><a name="l00165"></a><span class="lineno"> 165</span>&#160;<span class="stringliteral"></span></div>
<div class="line"><a name="l00166"></a><span class="lineno"> 166</span>&#160;<span class="stringliteral"># FAQ</span></div>
<div class="line"><a name="l00167"></a><span class="lineno"> 167</span>&#160;<span class="stringliteral"></span></div>
<div class="line"><a name="l00168"></a><span class="lineno"> 168</span>&#160;<span class="stringliteral">&gt; When I plug my device into the USB connector nothing happens?</span></div>
<div class="line"><a name="l00169"></a><span class="lineno"> 169</span>&#160;<span class="stringliteral"></span></div>
<div class="line"><a name="l00170"></a><span class="lineno"> 170</span>&#160;<span class="stringliteral">Try to connect a external power supply to the Arduino - this solves the problem in most cases.</span></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>

View file

@ -98,7 +98,7 @@ Include dependency graph for SPP.cpp:</div>
<div class="dyncontent">
<div class="center"><img src="_s_p_p_8cpp__incl.png" border="0" usemap="#_s_p_p_8cpp" alt=""/></div>
<map name="_s_p_p_8cpp" id="_s_p_p_8cpp">
<area shape="rect" id="node2" href="_s_p_p_8h.html" title="SPP.h" alt="" coords="549,75,594,96"/><area shape="rect" id="node3" href="_b_t_d_8h.html" title="BTD.h" alt="" coords="549,144,594,165"/><area shape="rect" id="node4" href="_usb_8h.html" title="Usb.h" alt="" coords="342,213,385,235"/><area shape="rect" id="node19" href="confdescparser_8h.html" title="confdescparser.h" alt="" coords="708,213,791,235"/><area shape="rect" id="node7" href="avrpins_8h.html" title="avrpins.h" alt="" coords="251,352,305,373"/><area shape="rect" id="node9" href="max3421e_8h.html" title="max3421e.h" alt="" coords="159,352,226,373"/><area shape="rect" id="node10" href="usbhost_8h.html" title="usbhost.h" alt="" coords="175,283,231,304"/><area shape="rect" id="node11" href="usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="349,352,407,373"/><area shape="rect" id="node12" href="address_8h.html" title="address.h" alt="" coords="41,283,98,304"/><area shape="rect" id="node15" href="printhex_8h.html" title="printhex.h" alt="" coords="721,421,778,443"/><area shape="rect" id="node16" href="hexdump_8h.html" title="hexdump.h" alt="" coords="634,352,695,373"/><area shape="rect" id="node18" href="message_8h.html" title="message.h" alt="" coords="719,352,781,373"/><area shape="rect" id="node20" href="parsetools_8h.html" title="parsetools.h" alt="" coords="788,283,853,304"/></map>
<area shape="rect" id="node2" href="_s_p_p_8h.html" title="SPP.h" alt="" coords="551,75,596,96"/><area shape="rect" id="node3" href="_b_t_d_8h.html" title="BTD.h" alt="" coords="551,144,596,165"/><area shape="rect" id="node4" href="_usb_8h.html" title="Usb.h" alt="" coords="288,283,331,304"/><area shape="rect" id="node19" href="confdescparser_8h.html" title="confdescparser.h" alt="" coords="635,213,719,235"/><area shape="rect" id="node7" href="avrpins_8h.html" title="avrpins.h" alt="" coords="5,421,59,443"/><area shape="rect" id="node9" href="max3421e_8h.html" title="max3421e.h" alt="" coords="180,421,247,443"/><area shape="rect" id="node10" href="usbhost_8h.html" title="usbhost.h" alt="" coords="181,352,237,373"/><area shape="rect" id="node11" href="usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="97,421,156,443"/><area shape="rect" id="node12" href="address_8h.html" title="address.h" alt="" coords="314,352,371,373"/><area shape="rect" id="node15" href="message_8h.html" title="message.h" alt="" coords="648,352,709,373"/><area shape="rect" id="node17" href="printhex_8h.html" title="printhex.h" alt="" coords="650,421,707,443"/><area shape="rect" id="node18" href="hexdump_8h.html" title="hexdump.h" alt="" coords="783,421,844,443"/><area shape="rect" id="node20" href="parsetools_8h.html" title="parsetools.h" alt="" coords="715,283,780,304"/></map>
</div>
</div>
<p><a href="_s_p_p_8cpp_source.html">Go to the source code of this file.</a></p>
@ -110,8 +110,8 @@ Macros</h2></td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="var-members"></a>
Variables</h2></td></tr>
<tr class="memitem:a5c3da75486e8c6a65da9ecc5c9c588e1"><td class="memItemLeft" align="right" valign="top">const uint8_t rfcomm_crc_table[256]&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_p_p_8cpp.html#a5c3da75486e8c6a65da9ecc5c9c588e1">PROGMEM</a></td></tr>
<tr class="separator:a5c3da75486e8c6a65da9ecc5c9c588e1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a91baaa87e7a685c42b0ac9f5fca8529d"><td class="memItemLeft" align="right" valign="top">const uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_p_p_8cpp.html#a91baaa87e7a685c42b0ac9f5fca8529d">rfcomm_crc_table</a> [256]</td></tr>
<tr class="separator:a91baaa87e7a685c42b0ac9f5fca8529d"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Macro Definition Documentation</h2>
<a class="anchor" id="ad72dbcf6d0153db1b8d8a58001feed83"></a>
@ -129,12 +129,12 @@ Variables</h2></td></tr>
</div>
</div>
<h2 class="groupheader">Variable Documentation</h2>
<a class="anchor" id="a5c3da75486e8c6a65da9ecc5c9c588e1"></a>
<a class="anchor" id="a91baaa87e7a685c42b0ac9f5fca8529d"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">const uint8_t rfcomm_crc_table [256] PROGMEM</td>
<td class="memname">const uint8_t rfcomm_crc_table[256]</td>
</tr>
</table>
</div><div class="memdoc">

View file

@ -1,15 +1,15 @@
<map id="SPP.cpp" name="SPP.cpp">
<area shape="rect" id="node2" href="$_s_p_p_8h.html" title="SPP.h" alt="" coords="549,75,594,96"/>
<area shape="rect" id="node3" href="$_b_t_d_8h.html" title="BTD.h" alt="" coords="549,144,594,165"/>
<area shape="rect" id="node4" href="$_usb_8h.html" title="Usb.h" alt="" coords="342,213,385,235"/>
<area shape="rect" id="node19" href="$confdescparser_8h.html" title="confdescparser.h" alt="" coords="708,213,791,235"/>
<area shape="rect" id="node7" href="$avrpins_8h.html" title="avrpins.h" alt="" coords="251,352,305,373"/>
<area shape="rect" id="node9" href="$max3421e_8h.html" title="max3421e.h" alt="" coords="159,352,226,373"/>
<area shape="rect" id="node10" href="$usbhost_8h.html" title="usbhost.h" alt="" coords="175,283,231,304"/>
<area shape="rect" id="node11" href="$usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="349,352,407,373"/>
<area shape="rect" id="node12" href="$address_8h.html" title="address.h" alt="" coords="41,283,98,304"/>
<area shape="rect" id="node15" href="$printhex_8h.html" title="printhex.h" alt="" coords="721,421,778,443"/>
<area shape="rect" id="node16" href="$hexdump_8h.html" title="hexdump.h" alt="" coords="634,352,695,373"/>
<area shape="rect" id="node18" href="$message_8h.html" title="message.h" alt="" coords="719,352,781,373"/>
<area shape="rect" id="node20" href="$parsetools_8h.html" title="parsetools.h" alt="" coords="788,283,853,304"/>
<area shape="rect" id="node2" href="$_s_p_p_8h.html" title="SPP.h" alt="" coords="551,75,596,96"/>
<area shape="rect" id="node3" href="$_b_t_d_8h.html" title="BTD.h" alt="" coords="551,144,596,165"/>
<area shape="rect" id="node4" href="$_usb_8h.html" title="Usb.h" alt="" coords="288,283,331,304"/>
<area shape="rect" id="node19" href="$confdescparser_8h.html" title="confdescparser.h" alt="" coords="635,213,719,235"/>
<area shape="rect" id="node7" href="$avrpins_8h.html" title="avrpins.h" alt="" coords="5,421,59,443"/>
<area shape="rect" id="node9" href="$max3421e_8h.html" title="max3421e.h" alt="" coords="180,421,247,443"/>
<area shape="rect" id="node10" href="$usbhost_8h.html" title="usbhost.h" alt="" coords="181,352,237,373"/>
<area shape="rect" id="node11" href="$usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="97,421,156,443"/>
<area shape="rect" id="node12" href="$address_8h.html" title="address.h" alt="" coords="314,352,371,373"/>
<area shape="rect" id="node15" href="$message_8h.html" title="message.h" alt="" coords="648,352,709,373"/>
<area shape="rect" id="node17" href="$printhex_8h.html" title="printhex.h" alt="" coords="650,421,707,443"/>
<area shape="rect" id="node18" href="$hexdump_8h.html" title="hexdump.h" alt="" coords="783,421,844,443"/>
<area shape="rect" id="node20" href="$parsetools_8h.html" title="parsetools.h" alt="" coords="715,283,780,304"/>
</map>

View file

@ -1 +1 @@
2f7003b020bb21ce85b8a33ce0382ea3
33aa8c0c9a2d418a2bf5751b5cad51a2

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 75 KiB

File diff suppressed because it is too large Load diff

View file

@ -98,7 +98,7 @@ Include dependency graph for SPP.h:</div>
<div class="dyncontent">
<div class="center"><img src="_s_p_p_8h__incl.png" border="0" usemap="#_s_p_p_8h" alt=""/></div>
<map name="_s_p_p_8h" id="_s_p_p_8h">
<area shape="rect" id="node2" href="_b_t_d_8h.html" title="BTD.h" alt="" coords="549,75,594,96"/><area shape="rect" id="node3" href="_usb_8h.html" title="Usb.h" alt="" coords="342,144,385,165"/><area shape="rect" id="node18" href="confdescparser_8h.html" title="confdescparser.h" alt="" coords="708,144,791,165"/><area shape="rect" id="node6" href="avrpins_8h.html" title="avrpins.h" alt="" coords="251,283,305,304"/><area shape="rect" id="node8" href="max3421e_8h.html" title="max3421e.h" alt="" coords="159,283,226,304"/><area shape="rect" id="node9" href="usbhost_8h.html" title="usbhost.h" alt="" coords="175,213,231,235"/><area shape="rect" id="node10" href="usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="349,283,407,304"/><area shape="rect" id="node11" href="address_8h.html" title="address.h" alt="" coords="41,213,98,235"/><area shape="rect" id="node14" href="printhex_8h.html" title="printhex.h" alt="" coords="721,352,778,373"/><area shape="rect" id="node15" href="hexdump_8h.html" title="hexdump.h" alt="" coords="634,283,695,304"/><area shape="rect" id="node17" href="message_8h.html" title="message.h" alt="" coords="719,283,781,304"/><area shape="rect" id="node19" href="parsetools_8h.html" title="parsetools.h" alt="" coords="788,213,853,235"/></map>
<area shape="rect" id="node2" href="_b_t_d_8h.html" title="BTD.h" alt="" coords="551,75,596,96"/><area shape="rect" id="node3" href="_usb_8h.html" title="Usb.h" alt="" coords="288,213,331,235"/><area shape="rect" id="node18" href="confdescparser_8h.html" title="confdescparser.h" alt="" coords="635,144,719,165"/><area shape="rect" id="node6" href="avrpins_8h.html" title="avrpins.h" alt="" coords="5,352,59,373"/><area shape="rect" id="node8" href="max3421e_8h.html" title="max3421e.h" alt="" coords="180,352,247,373"/><area shape="rect" id="node9" href="usbhost_8h.html" title="usbhost.h" alt="" coords="181,283,237,304"/><area shape="rect" id="node10" href="usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="97,352,156,373"/><area shape="rect" id="node11" href="address_8h.html" title="address.h" alt="" coords="314,283,371,304"/><area shape="rect" id="node14" href="message_8h.html" title="message.h" alt="" coords="648,283,709,304"/><area shape="rect" id="node16" href="printhex_8h.html" title="printhex.h" alt="" coords="650,352,707,373"/><area shape="rect" id="node17" href="hexdump_8h.html" title="hexdump.h" alt="" coords="783,352,844,373"/><area shape="rect" id="node19" href="parsetools_8h.html" title="parsetools.h" alt="" coords="715,213,780,235"/></map>
</div>
</div><div class="textblock"><div class="dynheader">
This graph shows which files directly or indirectly include this file:</div>

View file

@ -1,14 +1,14 @@
<map id="SPP.h" name="SPP.h">
<area shape="rect" id="node2" href="$_b_t_d_8h.html" title="BTD.h" alt="" coords="549,75,594,96"/>
<area shape="rect" id="node3" href="$_usb_8h.html" title="Usb.h" alt="" coords="342,144,385,165"/>
<area shape="rect" id="node18" href="$confdescparser_8h.html" title="confdescparser.h" alt="" coords="708,144,791,165"/>
<area shape="rect" id="node6" href="$avrpins_8h.html" title="avrpins.h" alt="" coords="251,283,305,304"/>
<area shape="rect" id="node8" href="$max3421e_8h.html" title="max3421e.h" alt="" coords="159,283,226,304"/>
<area shape="rect" id="node9" href="$usbhost_8h.html" title="usbhost.h" alt="" coords="175,213,231,235"/>
<area shape="rect" id="node10" href="$usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="349,283,407,304"/>
<area shape="rect" id="node11" href="$address_8h.html" title="address.h" alt="" coords="41,213,98,235"/>
<area shape="rect" id="node14" href="$printhex_8h.html" title="printhex.h" alt="" coords="721,352,778,373"/>
<area shape="rect" id="node15" href="$hexdump_8h.html" title="hexdump.h" alt="" coords="634,283,695,304"/>
<area shape="rect" id="node17" href="$message_8h.html" title="message.h" alt="" coords="719,283,781,304"/>
<area shape="rect" id="node19" href="$parsetools_8h.html" title="parsetools.h" alt="" coords="788,213,853,235"/>
<area shape="rect" id="node2" href="$_b_t_d_8h.html" title="BTD.h" alt="" coords="551,75,596,96"/>
<area shape="rect" id="node3" href="$_usb_8h.html" title="Usb.h" alt="" coords="288,213,331,235"/>
<area shape="rect" id="node18" href="$confdescparser_8h.html" title="confdescparser.h" alt="" coords="635,144,719,165"/>
<area shape="rect" id="node6" href="$avrpins_8h.html" title="avrpins.h" alt="" coords="5,352,59,373"/>
<area shape="rect" id="node8" href="$max3421e_8h.html" title="max3421e.h" alt="" coords="180,352,247,373"/>
<area shape="rect" id="node9" href="$usbhost_8h.html" title="usbhost.h" alt="" coords="181,283,237,304"/>
<area shape="rect" id="node10" href="$usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="97,352,156,373"/>
<area shape="rect" id="node11" href="$address_8h.html" title="address.h" alt="" coords="314,283,371,304"/>
<area shape="rect" id="node14" href="$message_8h.html" title="message.h" alt="" coords="648,283,709,304"/>
<area shape="rect" id="node16" href="$printhex_8h.html" title="printhex.h" alt="" coords="650,352,707,373"/>
<area shape="rect" id="node17" href="$hexdump_8h.html" title="hexdump.h" alt="" coords="783,352,844,373"/>
<area shape="rect" id="node19" href="$parsetools_8h.html" title="parsetools.h" alt="" coords="715,213,780,235"/>
</map>

View file

@ -1 +1 @@
53fae4c3b12bfc2cdd59188598bfc1d0
b0ceda8ab8c0919f8856bd5609fd1ff0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

After

Width:  |  Height:  |  Size: 74 KiB

View file

@ -192,91 +192,146 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<div class="line"><a name="l00119"></a><span class="lineno"> 119</span>&#160;</div>
<div class="line"><a name="l00125"></a><span class="lineno"> 125</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_s_p_p.html#acbea2d8894757fad6f9b903cad942b36">print</a>(<span class="keyword">const</span> String &amp;str);</div>
<div class="line"><a name="l00130"></a><span class="lineno"> 130</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_s_p_p.html#a4afe343fc15bba50507ab9205165b8dd">println</a>(<span class="keyword">const</span> String &amp;str);</div>
<div class="line"><a name="l00135"></a><span class="lineno"> 135</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_s_p_p.html#acbea2d8894757fad6f9b903cad942b36">print</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* str);</div>
<div class="line"><a name="l00140"></a><span class="lineno"> 140</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_s_p_p.html#a4afe343fc15bba50507ab9205165b8dd">println</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* str);</div>
<div class="line"><a name="l00145"></a><span class="lineno"> 145</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_s_p_p.html#acbea2d8894757fad6f9b903cad942b36">print</a>(uint8_t data);</div>
<div class="line"><a name="l00150"></a><span class="lineno"> 150</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_s_p_p.html#a4afe343fc15bba50507ab9205165b8dd">println</a>(uint8_t data);</div>
<div class="line"><a name="l00156"></a><span class="lineno"> 156</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_s_p_p.html#acbea2d8894757fad6f9b903cad942b36">print</a>(uint8_t* array, uint8_t length);</div>
<div class="line"><a name="l00162"></a><span class="lineno"> 162</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_s_p_p.html#a4afe343fc15bba50507ab9205165b8dd">println</a>(uint8_t* array, uint8_t length);</div>
<div class="line"><a name="l00167"></a><span class="lineno"> 167</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_s_p_p.html#acbea2d8894757fad6f9b903cad942b36">print</a>(<span class="keyword">const</span> __FlashStringHelper *ifsh);</div>
<div class="line"><a name="l00172"></a><span class="lineno"> 172</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_s_p_p.html#a4afe343fc15bba50507ab9205165b8dd">println</a>(<span class="keyword">const</span> __FlashStringHelper *ifsh);</div>
<div class="line"><a name="l00174"></a><span class="lineno"> 174</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_s_p_p.html#a4afe343fc15bba50507ab9205165b8dd">println</a>(<span class="keywordtype">void</span>);</div>
<div class="line"><a name="l00175"></a><span class="lineno"> 175</span>&#160; </div>
<div class="line"><a name="l00180"></a><span class="lineno"> 180</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_s_p_p.html#af31f14d7249f8a5b6eb2230a42a9d5ae">printNumber</a>(int32_t n);</div>
<div class="line"><a name="l00185"></a><span class="lineno"> 185</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_s_p_p.html#ac3a2e5fa45ba0fe17d3341998a6c4640">printNumberln</a>(int32_t n);</div>
<div class="line"><a name="l00191"></a><span class="lineno"> 191</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_s_p_p.html#af31f14d7249f8a5b6eb2230a42a9d5ae">printNumber</a>(<span class="keywordtype">double</span> n, uint8_t digits = 2);</div>
<div class="line"><a name="l00197"></a><span class="lineno"> 197</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_s_p_p.html#ac3a2e5fa45ba0fe17d3341998a6c4640">printNumberln</a>(<span class="keywordtype">double</span> n, uint8_t digits = 2); </div>
<div class="line"><a name="l00198"></a><span class="lineno"> 198</span>&#160; </div>
<div class="line"><a name="l00205"></a><span class="lineno"> 205</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_s_p_p.html#a3117df8f320d9d010b57c30255db054b">doubleToString</a>(<span class="keywordtype">double</span> input, <span class="keywordtype">char</span>* output, uint8_t digits = 2);</div>
<div class="line"><a name="l00206"></a><span class="lineno"> 206</span>&#160; </div>
<div class="line"><a name="l00211"></a><span class="lineno"><a class="code" href="class_s_p_p.html#a7de4c895e4056ac2964ce5d020611deb"> 211</a></span>&#160; uint8_t <a class="code" href="class_s_p_p.html#a7de4c895e4056ac2964ce5d020611deb">available</a>() { <span class="keywordflow">return</span> rfcommAvailable; };</div>
<div class="line"><a name="l00216"></a><span class="lineno"> 216</span>&#160; uint8_t <a class="code" href="class_s_p_p.html#a53980e0d20944454790febe5c9be66af">read</a>();</div>
<div class="line"><a name="l00218"></a><span class="lineno"><a class="code" href="class_s_p_p.html#af354c72d54243f891faf4cc60a7b94aa"> 218</a></span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_s_p_p.html#af354c72d54243f891faf4cc60a7b94aa">flush</a>() { rfcommAvailable = 0; };</div>
<div class="line"><a name="l00221"></a><span class="lineno"> 221</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00222"></a><span class="lineno"> 222</span>&#160; <span class="comment">/* Bluetooth dongle library pointer */</span></div>
<div class="line"><a name="l00223"></a><span class="lineno"> 223</span>&#160; <a class="code" href="class_b_t_d.html">BTD</a> *pBtd;</div>
<div class="line"><a name="l00224"></a><span class="lineno"> 224</span>&#160; </div>
<div class="line"><a name="l00225"></a><span class="lineno"> 225</span>&#160; <span class="comment">/* Set true when a channel is created */</span></div>
<div class="line"><a name="l00226"></a><span class="lineno"> 226</span>&#160; <span class="keywordtype">bool</span> SDPConnected;</div>
<div class="line"><a name="l00227"></a><span class="lineno"> 227</span>&#160; <span class="keywordtype">bool</span> RFCOMMConnected;</div>
<div class="line"><a name="l00228"></a><span class="lineno"> 228</span>&#160; </div>
<div class="line"><a name="l00229"></a><span class="lineno"> 229</span>&#160; uint16_t hci_handle; <span class="comment">// The HCI Handle for the connection</span></div>
<div class="line"><a name="l00230"></a><span class="lineno"> 230</span>&#160; </div>
<div class="line"><a name="l00231"></a><span class="lineno"> 231</span>&#160; <span class="comment">/* Variables used by L2CAP state maschines */</span> </div>
<div class="line"><a name="l00232"></a><span class="lineno"> 232</span>&#160; uint8_t l2cap_sdp_state;</div>
<div class="line"><a name="l00233"></a><span class="lineno"> 233</span>&#160; uint8_t l2cap_rfcomm_state;</div>
<div class="line"><a name="l00234"></a><span class="lineno"> 234</span>&#160; uint16_t l2cap_event_flag; <span class="comment">// l2cap flags of received bluetooth events</span></div>
<div class="line"><a name="l00131"></a><span class="lineno"> 131</span>&#160;</div>
<div class="line"><a name="l00136"></a><span class="lineno"> 136</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_s_p_p.html#acbea2d8894757fad6f9b903cad942b36">print</a>(<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="keywordtype">void</span> <a class="code" href="class_s_p_p.html#a4afe343fc15bba50507ab9205165b8dd">println</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* str);</div>
<div class="line"><a name="l00142"></a><span class="lineno"> 142</span>&#160;</div>
<div class="line"><a name="l00147"></a><span class="lineno"><a class="code" href="class_s_p_p.html#a6bf2176a1fd3772e2c903eee680307b4"> 147</a></span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_s_p_p.html#a6bf2176a1fd3772e2c903eee680307b4">print</a>(uint8_t data) {</div>
<div class="line"><a name="l00148"></a><span class="lineno"> 148</span>&#160; <a class="code" href="class_s_p_p.html#acbea2d8894757fad6f9b903cad942b36">print</a>(&amp;data, 1);</div>
<div class="line"><a name="l00149"></a><span class="lineno"> 149</span>&#160; };</div>
<div class="line"><a name="l00154"></a><span class="lineno"> 154</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_s_p_p.html#a4afe343fc15bba50507ab9205165b8dd">println</a>(uint8_t data);</div>
<div class="line"><a name="l00155"></a><span class="lineno"> 155</span>&#160;</div>
<div class="line"><a name="l00161"></a><span class="lineno"> 161</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_s_p_p.html#acbea2d8894757fad6f9b903cad942b36">print</a>(uint8_t* array, uint8_t length);</div>
<div class="line"><a name="l00167"></a><span class="lineno"> 167</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_s_p_p.html#a4afe343fc15bba50507ab9205165b8dd">println</a>(uint8_t* array, uint8_t length);</div>
<div class="line"><a name="l00168"></a><span class="lineno"> 168</span>&#160;</div>
<div class="line"><a name="l00174"></a><span class="lineno"><a class="code" href="class_s_p_p.html#aa534ca2960b81635c9ef00baaa04b37c"> 174</a></span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_s_p_p.html#aa534ca2960b81635c9ef00baaa04b37c">print</a>(<span class="keyword">const</span> __FlashStringHelper *ifsh) {</div>
<div class="line"><a name="l00175"></a><span class="lineno"> 175</span>&#160; <a class="code" href="class_s_p_p.html#a5bc1ae85e87f5f1355551a0bc26c5d14">printFlashString</a>(ifsh, <span class="keyword">false</span>);</div>
<div class="line"><a name="l00176"></a><span class="lineno"> 176</span>&#160; };</div>
<div class="line"><a name="l00177"></a><span class="lineno"> 177</span>&#160;</div>
<div class="line"><a name="l00182"></a><span class="lineno"><a class="code" href="class_s_p_p.html#a53cae4e7a1a6208f348b9509dbe94d24"> 182</a></span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_s_p_p.html#a53cae4e7a1a6208f348b9509dbe94d24">println</a>(<span class="keyword">const</span> __FlashStringHelper *ifsh) {</div>
<div class="line"><a name="l00183"></a><span class="lineno"> 183</span>&#160; <a class="code" href="class_s_p_p.html#a5bc1ae85e87f5f1355551a0bc26c5d14">printFlashString</a>(ifsh, <span class="keyword">true</span>);</div>
<div class="line"><a name="l00184"></a><span class="lineno"> 184</span>&#160; };</div>
<div class="line"><a name="l00190"></a><span class="lineno"> 190</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_s_p_p.html#a5bc1ae85e87f5f1355551a0bc26c5d14">printFlashString</a>(<span class="keyword">const</span> __FlashStringHelper *ifsh, <span class="keywordtype">bool</span> newline);</div>
<div class="line"><a name="l00191"></a><span class="lineno"> 191</span>&#160;</div>
<div class="line"><a name="l00192"></a><span class="lineno"> 192</span>&#160;</div>
<div class="line"><a name="l00194"></a><span class="lineno"> 194</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_s_p_p.html#a4afe343fc15bba50507ab9205165b8dd">println</a>(<span class="keywordtype">void</span>);</div>
<div class="line"><a name="l00195"></a><span class="lineno"> 195</span>&#160;</div>
<div class="line"><a name="l00200"></a><span class="lineno"><a class="code" href="class_s_p_p.html#a087b2008d2474ea027470e7233b312fc"> 200</a></span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_s_p_p.html#a087b2008d2474ea027470e7233b312fc">printNumber</a>(uint8_t n) {</div>
<div class="line"><a name="l00201"></a><span class="lineno"> 201</span>&#160; <a class="code" href="class_s_p_p.html#a087b2008d2474ea027470e7233b312fc">printNumber</a>((uint32_t) n);</div>
<div class="line"><a name="l00202"></a><span class="lineno"> 202</span>&#160; };</div>
<div class="line"><a name="l00203"></a><span class="lineno"> 203</span>&#160;</div>
<div class="line"><a name="l00208"></a><span class="lineno"><a class="code" href="class_s_p_p.html#a6f7e7bd8889edeb11d08e67e80976ef4"> 208</a></span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_s_p_p.html#a6f7e7bd8889edeb11d08e67e80976ef4">printNumberln</a>(uint8_t n) {</div>
<div class="line"><a name="l00209"></a><span class="lineno"> 209</span>&#160; <a class="code" href="class_s_p_p.html#a6f7e7bd8889edeb11d08e67e80976ef4">printNumberln</a>((uint32_t) n);</div>
<div class="line"><a name="l00210"></a><span class="lineno"> 210</span>&#160; };</div>
<div class="line"><a name="l00211"></a><span class="lineno"> 211</span>&#160;</div>
<div class="line"><a name="l00216"></a><span class="lineno"><a class="code" href="class_s_p_p.html#a0e6a77bce4a0d15c9f416354a60c62cd"> 216</a></span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_s_p_p.html#a0e6a77bce4a0d15c9f416354a60c62cd">printNumber</a>(int8_t n) {</div>
<div class="line"><a name="l00217"></a><span class="lineno"> 217</span>&#160; <a class="code" href="class_s_p_p.html#a087b2008d2474ea027470e7233b312fc">printNumber</a>((int32_t) n);</div>
<div class="line"><a name="l00218"></a><span class="lineno"> 218</span>&#160; };</div>
<div class="line"><a name="l00219"></a><span class="lineno"> 219</span>&#160;</div>
<div class="line"><a name="l00224"></a><span class="lineno"><a class="code" href="class_s_p_p.html#a2a4ebaf0782c6ba67f9e7503c465e8c2"> 224</a></span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_s_p_p.html#a2a4ebaf0782c6ba67f9e7503c465e8c2">printNumberln</a>(int8_t n) {</div>
<div class="line"><a name="l00225"></a><span class="lineno"> 225</span>&#160; <a class="code" href="class_s_p_p.html#a6f7e7bd8889edeb11d08e67e80976ef4">printNumberln</a>((int32_t) n);</div>
<div class="line"><a name="l00226"></a><span class="lineno"> 226</span>&#160; };</div>
<div class="line"><a name="l00227"></a><span class="lineno"> 227</span>&#160;</div>
<div class="line"><a name="l00232"></a><span class="lineno"><a class="code" href="class_s_p_p.html#ab0638c8ea85069861189add4b8c37e30"> 232</a></span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_s_p_p.html#ab0638c8ea85069861189add4b8c37e30">printNumber</a>(uint16_t n) {</div>
<div class="line"><a name="l00233"></a><span class="lineno"> 233</span>&#160; <a class="code" href="class_s_p_p.html#a087b2008d2474ea027470e7233b312fc">printNumber</a>((uint32_t) n);</div>
<div class="line"><a name="l00234"></a><span class="lineno"> 234</span>&#160; };</div>
<div class="line"><a name="l00235"></a><span class="lineno"> 235</span>&#160;</div>
<div class="line"><a name="l00236"></a><span class="lineno"> 236</span>&#160; uint8_t l2capoutbuf[<a class="code" href="_b_t_d_8h.html#a32d591ef5742a99963130616ef146787">BULK_MAXPKTSIZE</a>]; <span class="comment">// General purpose buffer for l2cap out data</span></div>
<div class="line"><a name="l00237"></a><span class="lineno"> 237</span>&#160; uint8_t rfcommbuf[10]; <span class="comment">// Buffer for RFCOMM Commands</span></div>
<div class="line"><a name="l00238"></a><span class="lineno"> 238</span>&#160; </div>
<div class="line"><a name="l00239"></a><span class="lineno"> 239</span>&#160; <span class="comment">/* L2CAP Channels */</span></div>
<div class="line"><a name="l00240"></a><span class="lineno"> 240</span>&#160; uint8_t sdp_scid[2]; <span class="comment">// L2CAP source CID for SDP </span></div>
<div class="line"><a name="l00241"></a><span class="lineno"> 241</span>&#160; uint8_t sdp_dcid[2]; <span class="comment">// 0x0050</span></div>
<div class="line"><a name="l00242"></a><span class="lineno"> 242</span>&#160; uint8_t rfcomm_scid[2]; <span class="comment">// L2CAP source CID for RFCOMM </span></div>
<div class="line"><a name="l00243"></a><span class="lineno"> 243</span>&#160; uint8_t rfcomm_dcid[2]; <span class="comment">// 0x0051</span></div>
<div class="line"><a name="l00244"></a><span class="lineno"> 244</span>&#160; uint8_t identifier; <span class="comment">// Identifier for command</span></div>
<div class="line"><a name="l00245"></a><span class="lineno"> 245</span>&#160;</div>
<div class="line"><a name="l00246"></a><span class="lineno"> 246</span>&#160; <span class="comment">/* RFCOMM Variables */</span></div>
<div class="line"><a name="l00247"></a><span class="lineno"> 247</span>&#160; uint8_t rfcommChannel;</div>
<div class="line"><a name="l00248"></a><span class="lineno"> 248</span>&#160; uint8_t rfcommChannelConnection; <span class="comment">// This is the channel the SPP chanel will be running at</span></div>
<div class="line"><a name="l00249"></a><span class="lineno"> 249</span>&#160; uint8_t rfcommDirection;</div>
<div class="line"><a name="l00250"></a><span class="lineno"> 250</span>&#160; uint8_t rfcommCommandResponse; </div>
<div class="line"><a name="l00251"></a><span class="lineno"> 251</span>&#160; uint8_t rfcommChannelType;</div>
<div class="line"><a name="l00252"></a><span class="lineno"> 252</span>&#160; uint8_t rfcommPfBit;</div>
<div class="line"><a name="l00253"></a><span class="lineno"> 253</span>&#160; </div>
<div class="line"><a name="l00254"></a><span class="lineno"> 254</span>&#160; <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> timer;</div>
<div class="line"><a name="l00255"></a><span class="lineno"> 255</span>&#160; <span class="keywordtype">bool</span> waitForLastCommand;</div>
<div class="line"><a name="l00256"></a><span class="lineno"> 256</span>&#160; <span class="keywordtype">bool</span> creditSent; </div>
<div class="line"><a name="l00257"></a><span class="lineno"> 257</span>&#160; </div>
<div class="line"><a name="l00258"></a><span class="lineno"> 258</span>&#160; uint8_t rfcommDataBuffer[100]; <span class="comment">// Create a 100 sized buffer for incoming data</span></div>
<div class="line"><a name="l00259"></a><span class="lineno"> 259</span>&#160; uint8_t rfcommAvailable;</div>
<div class="line"><a name="l00260"></a><span class="lineno"> 260</span>&#160; </div>
<div class="line"><a name="l00261"></a><span class="lineno"> 261</span>&#160; <span class="keywordtype">bool</span> firstMessage; <span class="comment">// Used to see if it&#39;s the first SDP request received </span></div>
<div class="line"><a name="l00262"></a><span class="lineno"> 262</span>&#160; uint8_t bytesRead; <span class="comment">// Counter to see when it&#39;s time to send more credit</span></div>
<div class="line"><a name="l00263"></a><span class="lineno"> 263</span>&#160; </div>
<div class="line"><a name="l00264"></a><span class="lineno"> 264</span>&#160; <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> printTimer; <span class="comment">// Used to set a delay, so it doesn&#39;t try to print too fast</span></div>
<div class="line"><a name="l00265"></a><span class="lineno"> 265</span>&#160; </div>
<div class="line"><a name="l00266"></a><span class="lineno"> 266</span>&#160; <span class="comment">/* State machines */</span></div>
<div class="line"><a name="l00267"></a><span class="lineno"> 267</span>&#160; <span class="keywordtype">void</span> SDP_task(); <span class="comment">// SDP state machine</span></div>
<div class="line"><a name="l00268"></a><span class="lineno"> 268</span>&#160; <span class="keywordtype">void</span> RFCOMM_task(); <span class="comment">// RFCOMM state machine</span></div>
<div class="line"><a name="l00269"></a><span class="lineno"> 269</span>&#160; </div>
<div class="line"><a name="l00270"></a><span class="lineno"> 270</span>&#160; <span class="comment">/* SDP Commands */</span></div>
<div class="line"><a name="l00271"></a><span class="lineno"> 271</span>&#160; <span class="keywordtype">void</span> SDP_Command(uint8_t* data, uint8_t nbytes);</div>
<div class="line"><a name="l00272"></a><span class="lineno"> 272</span>&#160; <span class="keywordtype">void</span> serviceNotSupported(uint8_t transactionIDHigh, uint8_t transactionIDLow);</div>
<div class="line"><a name="l00273"></a><span class="lineno"> 273</span>&#160; <span class="keywordtype">void</span> serialPortResponse1(uint8_t transactionIDHigh, uint8_t transactionIDLow);</div>
<div class="line"><a name="l00274"></a><span class="lineno"> 274</span>&#160; <span class="keywordtype">void</span> serialPortResponse2(uint8_t transactionIDHigh, uint8_t transactionIDLow);</div>
<div class="line"><a name="l00275"></a><span class="lineno"> 275</span>&#160; <span class="keywordtype">void</span> l2capResponse1(uint8_t transactionIDHigh, uint8_t transactionIDLow);</div>
<div class="line"><a name="l00276"></a><span class="lineno"> 276</span>&#160; <span class="keywordtype">void</span> l2capResponse2(uint8_t transactionIDHigh, uint8_t transactionIDLow);</div>
<div class="line"><a name="l00277"></a><span class="lineno"> 277</span>&#160; </div>
<div class="line"><a name="l00278"></a><span class="lineno"> 278</span>&#160; <span class="comment">/* RFCOMM Commands */</span></div>
<div class="line"><a name="l00279"></a><span class="lineno"> 279</span>&#160; <span class="keywordtype">void</span> RFCOMM_Command(uint8_t* data, uint8_t nbytes);</div>
<div class="line"><a name="l00280"></a><span class="lineno"> 280</span>&#160; <span class="keywordtype">void</span> sendRfcomm(uint8_t channel, uint8_t direction, uint8_t CR, uint8_t channelType, uint8_t pfBit, uint8_t* data, uint8_t length);</div>
<div class="line"><a name="l00281"></a><span class="lineno"> 281</span>&#160; <span class="keywordtype">void</span> sendRfcommCredit(uint8_t channel, uint8_t direction, uint8_t CR, uint8_t channelType, uint8_t pfBit, uint8_t credit);</div>
<div class="line"><a name="l00282"></a><span class="lineno"> 282</span>&#160; uint8_t calcFcs(uint8_t *data);</div>
<div class="line"><a name="l00283"></a><span class="lineno"> 283</span>&#160; uint8_t __crc(uint8_t* data);</div>
<div class="line"><a name="l00284"></a><span class="lineno"> 284</span>&#160;};</div>
<div class="line"><a name="l00285"></a><span class="lineno"> 285</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00240"></a><span class="lineno"><a class="code" href="class_s_p_p.html#af3830211f7f64ee71e6420e3d6ef42f4"> 240</a></span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_s_p_p.html#af3830211f7f64ee71e6420e3d6ef42f4">printNumberln</a>(uint16_t n) {</div>
<div class="line"><a name="l00241"></a><span class="lineno"> 241</span>&#160; <a class="code" href="class_s_p_p.html#a6f7e7bd8889edeb11d08e67e80976ef4">printNumberln</a>((uint32_t) n);</div>
<div class="line"><a name="l00242"></a><span class="lineno"> 242</span>&#160; };</div>
<div class="line"><a name="l00243"></a><span class="lineno"> 243</span>&#160;</div>
<div class="line"><a name="l00248"></a><span class="lineno"><a class="code" href="class_s_p_p.html#a1d9d28454b84e334a0560a4b2182716e"> 248</a></span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_s_p_p.html#a1d9d28454b84e334a0560a4b2182716e">printNumber</a>(int16_t n) {</div>
<div class="line"><a name="l00249"></a><span class="lineno"> 249</span>&#160; <a class="code" href="class_s_p_p.html#a087b2008d2474ea027470e7233b312fc">printNumber</a>((int32_t) n);</div>
<div class="line"><a name="l00250"></a><span class="lineno"> 250</span>&#160; };</div>
<div class="line"><a name="l00251"></a><span class="lineno"> 251</span>&#160;</div>
<div class="line"><a name="l00256"></a><span class="lineno"><a class="code" href="class_s_p_p.html#a92cde4ff57b4375474c1b5d6b56b4bd2"> 256</a></span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_s_p_p.html#a92cde4ff57b4375474c1b5d6b56b4bd2">printNumberln</a>(int16_t n) {</div>
<div class="line"><a name="l00257"></a><span class="lineno"> 257</span>&#160; <a class="code" href="class_s_p_p.html#a6f7e7bd8889edeb11d08e67e80976ef4">printNumberln</a>((int32_t) n);</div>
<div class="line"><a name="l00258"></a><span class="lineno"> 258</span>&#160; };</div>
<div class="line"><a name="l00259"></a><span class="lineno"> 259</span>&#160;</div>
<div class="line"><a name="l00264"></a><span class="lineno"> 264</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_s_p_p.html#a087b2008d2474ea027470e7233b312fc">printNumber</a>(uint32_t n);</div>
<div class="line"><a name="l00269"></a><span class="lineno"> 269</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_s_p_p.html#a6f7e7bd8889edeb11d08e67e80976ef4">printNumberln</a>(uint32_t n);</div>
<div class="line"><a name="l00270"></a><span class="lineno"> 270</span>&#160;</div>
<div class="line"><a name="l00275"></a><span class="lineno"> 275</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_s_p_p.html#a087b2008d2474ea027470e7233b312fc">printNumber</a>(int32_t n);</div>
<div class="line"><a name="l00280"></a><span class="lineno"> 280</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_s_p_p.html#a6f7e7bd8889edeb11d08e67e80976ef4">printNumberln</a>(int32_t n);</div>
<div class="line"><a name="l00281"></a><span class="lineno"> 281</span>&#160;</div>
<div class="line"><a name="l00287"></a><span class="lineno"> 287</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_s_p_p.html#a8959dc26a7e6a614127a4527a6b5a509">intToString</a>(int32_t input, <span class="keywordtype">char</span>* output);</div>
<div class="line"><a name="l00293"></a><span class="lineno"> 293</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_s_p_p.html#a8959dc26a7e6a614127a4527a6b5a509">intToString</a>(uint32_t input, <span class="keywordtype">char</span>* output);</div>
<div class="line"><a name="l00294"></a><span class="lineno"> 294</span>&#160;</div>
<div class="line"><a name="l00300"></a><span class="lineno"> 300</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_s_p_p.html#a087b2008d2474ea027470e7233b312fc">printNumber</a>(<span class="keywordtype">double</span> n, uint8_t digits = 2);</div>
<div class="line"><a name="l00306"></a><span class="lineno"> 306</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_s_p_p.html#a6f7e7bd8889edeb11d08e67e80976ef4">printNumberln</a>(<span class="keywordtype">double</span> n, uint8_t digits = 2);</div>
<div class="line"><a name="l00313"></a><span class="lineno"> 313</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_s_p_p.html#a3117df8f320d9d010b57c30255db054b">doubleToString</a>(<span class="keywordtype">double</span> input, <span class="keywordtype">char</span>* output, uint8_t digits = 2);</div>
<div class="line"><a name="l00314"></a><span class="lineno"> 314</span>&#160;</div>
<div class="line"><a name="l00319"></a><span class="lineno"><a class="code" href="class_s_p_p.html#a7de4c895e4056ac2964ce5d020611deb"> 319</a></span>&#160; uint8_t <a class="code" href="class_s_p_p.html#a7de4c895e4056ac2964ce5d020611deb">available</a>() {</div>
<div class="line"><a name="l00320"></a><span class="lineno"> 320</span>&#160; <span class="keywordflow">return</span> rfcommAvailable;</div>
<div class="line"><a name="l00321"></a><span class="lineno"> 321</span>&#160; };</div>
<div class="line"><a name="l00326"></a><span class="lineno"> 326</span>&#160; uint8_t <a class="code" href="class_s_p_p.html#a53980e0d20944454790febe5c9be66af">read</a>();</div>
<div class="line"><a name="l00327"></a><span class="lineno"> 327</span>&#160;</div>
<div class="line"><a name="l00329"></a><span class="lineno"><a class="code" href="class_s_p_p.html#af354c72d54243f891faf4cc60a7b94aa"> 329</a></span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_s_p_p.html#af354c72d54243f891faf4cc60a7b94aa">flush</a>() {</div>
<div class="line"><a name="l00330"></a><span class="lineno"> 330</span>&#160; rfcommAvailable = 0;</div>
<div class="line"><a name="l00331"></a><span class="lineno"> 331</span>&#160; };</div>
<div class="line"><a name="l00334"></a><span class="lineno"> 334</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00335"></a><span class="lineno"> 335</span>&#160; <span class="comment">/* Bluetooth dongle library pointer */</span></div>
<div class="line"><a name="l00336"></a><span class="lineno"> 336</span>&#160; <a class="code" href="class_b_t_d.html">BTD</a> *pBtd;</div>
<div class="line"><a name="l00337"></a><span class="lineno"> 337</span>&#160;</div>
<div class="line"><a name="l00338"></a><span class="lineno"> 338</span>&#160; <span class="comment">/* Set true when a channel is created */</span></div>
<div class="line"><a name="l00339"></a><span class="lineno"> 339</span>&#160; <span class="keywordtype">bool</span> SDPConnected;</div>
<div class="line"><a name="l00340"></a><span class="lineno"> 340</span>&#160; <span class="keywordtype">bool</span> RFCOMMConnected;</div>
<div class="line"><a name="l00341"></a><span class="lineno"> 341</span>&#160;</div>
<div class="line"><a name="l00342"></a><span class="lineno"> 342</span>&#160; uint16_t hci_handle; <span class="comment">// The HCI Handle for the connection</span></div>
<div class="line"><a name="l00343"></a><span class="lineno"> 343</span>&#160;</div>
<div class="line"><a name="l00344"></a><span class="lineno"> 344</span>&#160; <span class="comment">/* Variables used by L2CAP state maschines */</span></div>
<div class="line"><a name="l00345"></a><span class="lineno"> 345</span>&#160; uint8_t l2cap_sdp_state;</div>
<div class="line"><a name="l00346"></a><span class="lineno"> 346</span>&#160; uint8_t l2cap_rfcomm_state;</div>
<div class="line"><a name="l00347"></a><span class="lineno"> 347</span>&#160; uint16_t l2cap_event_flag; <span class="comment">// l2cap flags of received bluetooth events</span></div>
<div class="line"><a name="l00348"></a><span class="lineno"> 348</span>&#160;</div>
<div class="line"><a name="l00349"></a><span class="lineno"> 349</span>&#160; uint8_t l2capoutbuf[<a class="code" href="_b_t_d_8h.html#a32d591ef5742a99963130616ef146787">BULK_MAXPKTSIZE</a>]; <span class="comment">// General purpose buffer for l2cap out data</span></div>
<div class="line"><a name="l00350"></a><span class="lineno"> 350</span>&#160; uint8_t rfcommbuf[10]; <span class="comment">// Buffer for RFCOMM Commands</span></div>
<div class="line"><a name="l00351"></a><span class="lineno"> 351</span>&#160;</div>
<div class="line"><a name="l00352"></a><span class="lineno"> 352</span>&#160; <span class="comment">/* L2CAP Channels */</span></div>
<div class="line"><a name="l00353"></a><span class="lineno"> 353</span>&#160; uint8_t sdp_scid[2]; <span class="comment">// L2CAP source CID for SDP</span></div>
<div class="line"><a name="l00354"></a><span class="lineno"> 354</span>&#160; uint8_t sdp_dcid[2]; <span class="comment">// 0x0050</span></div>
<div class="line"><a name="l00355"></a><span class="lineno"> 355</span>&#160; uint8_t rfcomm_scid[2]; <span class="comment">// L2CAP source CID for RFCOMM</span></div>
<div class="line"><a name="l00356"></a><span class="lineno"> 356</span>&#160; uint8_t rfcomm_dcid[2]; <span class="comment">// 0x0051</span></div>
<div class="line"><a name="l00357"></a><span class="lineno"> 357</span>&#160; uint8_t identifier; <span class="comment">// Identifier for command</span></div>
<div class="line"><a name="l00358"></a><span class="lineno"> 358</span>&#160;</div>
<div class="line"><a name="l00359"></a><span class="lineno"> 359</span>&#160; <span class="comment">/* RFCOMM Variables */</span></div>
<div class="line"><a name="l00360"></a><span class="lineno"> 360</span>&#160; uint8_t rfcommChannel;</div>
<div class="line"><a name="l00361"></a><span class="lineno"> 361</span>&#160; uint8_t rfcommChannelConnection; <span class="comment">// This is the channel the SPP chanel will be running at</span></div>
<div class="line"><a name="l00362"></a><span class="lineno"> 362</span>&#160; uint8_t rfcommDirection;</div>
<div class="line"><a name="l00363"></a><span class="lineno"> 363</span>&#160; uint8_t rfcommCommandResponse;</div>
<div class="line"><a name="l00364"></a><span class="lineno"> 364</span>&#160; uint8_t rfcommChannelType;</div>
<div class="line"><a name="l00365"></a><span class="lineno"> 365</span>&#160; uint8_t rfcommPfBit;</div>
<div class="line"><a name="l00366"></a><span class="lineno"> 366</span>&#160;</div>
<div class="line"><a name="l00367"></a><span class="lineno"> 367</span>&#160; <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> timer;</div>
<div class="line"><a name="l00368"></a><span class="lineno"> 368</span>&#160; <span class="keywordtype">bool</span> waitForLastCommand;</div>
<div class="line"><a name="l00369"></a><span class="lineno"> 369</span>&#160; <span class="keywordtype">bool</span> creditSent;</div>
<div class="line"><a name="l00370"></a><span class="lineno"> 370</span>&#160;</div>
<div class="line"><a name="l00371"></a><span class="lineno"> 371</span>&#160; uint8_t rfcommDataBuffer[100]; <span class="comment">// Create a 100 sized buffer for incoming data</span></div>
<div class="line"><a name="l00372"></a><span class="lineno"> 372</span>&#160; uint8_t rfcommAvailable;</div>
<div class="line"><a name="l00373"></a><span class="lineno"> 373</span>&#160;</div>
<div class="line"><a name="l00374"></a><span class="lineno"> 374</span>&#160; <span class="keywordtype">bool</span> firstMessage; <span class="comment">// Used to see if it&#39;s the first SDP request received</span></div>
<div class="line"><a name="l00375"></a><span class="lineno"> 375</span>&#160; uint8_t bytesRead; <span class="comment">// Counter to see when it&#39;s time to send more credit</span></div>
<div class="line"><a name="l00376"></a><span class="lineno"> 376</span>&#160;</div>
<div class="line"><a name="l00377"></a><span class="lineno"> 377</span>&#160; <span class="comment">/* State machines */</span></div>
<div class="line"><a name="l00378"></a><span class="lineno"> 378</span>&#160; <span class="keywordtype">void</span> SDP_task(); <span class="comment">// SDP state machine</span></div>
<div class="line"><a name="l00379"></a><span class="lineno"> 379</span>&#160; <span class="keywordtype">void</span> RFCOMM_task(); <span class="comment">// RFCOMM state machine</span></div>
<div class="line"><a name="l00380"></a><span class="lineno"> 380</span>&#160;</div>
<div class="line"><a name="l00381"></a><span class="lineno"> 381</span>&#160; <span class="comment">/* SDP Commands */</span></div>
<div class="line"><a name="l00382"></a><span class="lineno"> 382</span>&#160; <span class="keywordtype">void</span> SDP_Command(uint8_t* data, uint8_t nbytes);</div>
<div class="line"><a name="l00383"></a><span class="lineno"> 383</span>&#160; <span class="keywordtype">void</span> serviceNotSupported(uint8_t transactionIDHigh, uint8_t transactionIDLow);</div>
<div class="line"><a name="l00384"></a><span class="lineno"> 384</span>&#160; <span class="keywordtype">void</span> serialPortResponse1(uint8_t transactionIDHigh, uint8_t transactionIDLow);</div>
<div class="line"><a name="l00385"></a><span class="lineno"> 385</span>&#160; <span class="keywordtype">void</span> serialPortResponse2(uint8_t transactionIDHigh, uint8_t transactionIDLow);</div>
<div class="line"><a name="l00386"></a><span class="lineno"> 386</span>&#160; <span class="keywordtype">void</span> l2capResponse1(uint8_t transactionIDHigh, uint8_t transactionIDLow);</div>
<div class="line"><a name="l00387"></a><span class="lineno"> 387</span>&#160; <span class="keywordtype">void</span> l2capResponse2(uint8_t transactionIDHigh, uint8_t transactionIDLow);</div>
<div class="line"><a name="l00388"></a><span class="lineno"> 388</span>&#160;</div>
<div class="line"><a name="l00389"></a><span class="lineno"> 389</span>&#160; <span class="comment">/* RFCOMM Commands */</span></div>
<div class="line"><a name="l00390"></a><span class="lineno"> 390</span>&#160; <span class="keywordtype">void</span> RFCOMM_Command(uint8_t* data, uint8_t nbytes);</div>
<div class="line"><a name="l00391"></a><span class="lineno"> 391</span>&#160; <span class="keywordtype">void</span> sendRfcomm(uint8_t channel, uint8_t direction, uint8_t CR, uint8_t channelType, uint8_t pfBit, uint8_t* data, uint8_t length);</div>
<div class="line"><a name="l00392"></a><span class="lineno"> 392</span>&#160; <span class="keywordtype">void</span> sendRfcommCredit(uint8_t channel, uint8_t direction, uint8_t CR, uint8_t channelType, uint8_t pfBit, uint8_t credit);</div>
<div class="line"><a name="l00393"></a><span class="lineno"> 393</span>&#160; uint8_t calcFcs(uint8_t *data);</div>
<div class="line"><a name="l00394"></a><span class="lineno"> 394</span>&#160; uint8_t __crc(uint8_t* data);</div>
<div class="line"><a name="l00395"></a><span class="lineno"> 395</span>&#160;};</div>
<div class="line"><a name="l00396"></a><span class="lineno"> 396</span>&#160;<span class="preprocessor">#endif</span></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>

View file

@ -99,7 +99,7 @@ Include dependency graph for Usb.cpp:</div>
<div class="dyncontent">
<div class="center"><img src="_usb_8cpp__incl.png" border="0" usemap="#_usb_8cpp" alt=""/></div>
<map name="_usb_8cpp" id="_usb_8cpp">
<area shape="rect" id="node2" href="avrpins_8h.html" title="avrpins.h" alt="" coords="5,213,59,235"/><area shape="rect" id="node4" href="max3421e_8h.html" title="max3421e.h" alt="" coords="171,213,237,235"/><area shape="rect" id="node5" href="usbhost_8h.html" title="usbhost.h" alt="" coords="70,144,127,165"/><area shape="rect" id="node8" href="_usb_8h.html" title="Usb.h" alt="" coords="345,75,388,96"/><area shape="rect" id="node6" href="usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="88,213,147,235"/><area shape="rect" id="node10" href="address_8h.html" title="address.h" alt="" coords="305,144,361,165"/><area shape="rect" id="node13" href="printhex_8h.html" title="printhex.h" alt="" coords="647,213,704,235"/><area shape="rect" id="node14" href="hexdump_8h.html" title="hexdump.h" alt="" coords="437,144,499,165"/><area shape="rect" id="node16" href="message_8h.html" title="message.h" alt="" coords="523,144,584,165"/></map>
<area shape="rect" id="node2" href="avrpins_8h.html" title="avrpins.h" alt="" coords="5,213,59,235"/><area shape="rect" id="node4" href="max3421e_8h.html" title="max3421e.h" alt="" coords="84,213,151,235"/><area shape="rect" id="node5" href="usbhost_8h.html" title="usbhost.h" alt="" coords="117,144,173,165"/><area shape="rect" id="node8" href="_usb_8h.html" title="Usb.h" alt="" coords="275,75,317,96"/><area shape="rect" id="node6" href="usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="175,213,233,235"/><area shape="rect" id="node10" href="address_8h.html" title="address.h" alt="" coords="301,144,357,165"/><area shape="rect" id="node13" href="message_8h.html" title="message.h" alt="" coords="508,144,569,165"/><area shape="rect" id="node15" href="printhex_8h.html" title="printhex.h" alt="" coords="621,213,677,235"/><area shape="rect" id="node16" href="hexdump_8h.html" title="hexdump.h" alt="" coords="484,213,545,235"/></map>
</div>
</div>
<p><a href="_usb_8cpp_source.html">Go to the source code of this file.</a></p>

View file

@ -1,11 +1,11 @@
<map id="Usb.cpp" name="Usb.cpp">
<area shape="rect" id="node2" href="$avrpins_8h.html" title="avrpins.h" alt="" coords="5,213,59,235"/>
<area shape="rect" id="node4" href="$max3421e_8h.html" title="max3421e.h" alt="" coords="171,213,237,235"/>
<area shape="rect" id="node5" href="$usbhost_8h.html" title="usbhost.h" alt="" coords="70,144,127,165"/>
<area shape="rect" id="node8" href="$_usb_8h.html" title="Usb.h" alt="" coords="345,75,388,96"/>
<area shape="rect" id="node6" href="$usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="88,213,147,235"/>
<area shape="rect" id="node10" href="$address_8h.html" title="address.h" alt="" coords="305,144,361,165"/>
<area shape="rect" id="node13" href="$printhex_8h.html" title="printhex.h" alt="" coords="647,213,704,235"/>
<area shape="rect" id="node14" href="$hexdump_8h.html" title="hexdump.h" alt="" coords="437,144,499,165"/>
<area shape="rect" id="node16" href="$message_8h.html" title="message.h" alt="" coords="523,144,584,165"/>
<area shape="rect" id="node4" href="$max3421e_8h.html" title="max3421e.h" alt="" coords="84,213,151,235"/>
<area shape="rect" id="node5" href="$usbhost_8h.html" title="usbhost.h" alt="" coords="117,144,173,165"/>
<area shape="rect" id="node8" href="$_usb_8h.html" title="Usb.h" alt="" coords="275,75,317,96"/>
<area shape="rect" id="node6" href="$usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="175,213,233,235"/>
<area shape="rect" id="node10" href="$address_8h.html" title="address.h" alt="" coords="301,144,357,165"/>
<area shape="rect" id="node13" href="$message_8h.html" title="message.h" alt="" coords="508,144,569,165"/>
<area shape="rect" id="node15" href="$printhex_8h.html" title="printhex.h" alt="" coords="621,213,677,235"/>
<area shape="rect" id="node16" href="$hexdump_8h.html" title="hexdump.h" alt="" coords="484,213,545,235"/>
</map>

View file

@ -1 +1 @@
cdb076cb0e199df9a64c785444f040d3
76414eb5b333c825182eee0402948c94

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 53 KiB

File diff suppressed because it is too large Load diff

View file

@ -101,15 +101,13 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<code>#include &quot;<a class="el" href="usb__ch9_8h_source.html">usb_ch9.h</a>&quot;</code><br/>
<code>#include &quot;<a class="el" href="address_8h_source.html">address.h</a>&quot;</code><br/>
<code>#include &quot;Arduino.h&quot;</code><br/>
<code>#include &quot;<a class="el" href="printhex_8h_source.html">printhex.h</a>&quot;</code><br/>
<code>#include &quot;<a class="el" href="hexdump_8h_source.html">hexdump.h</a>&quot;</code><br/>
<code>#include &quot;<a class="el" href="message_8h_source.html">message.h</a>&quot;</code><br/>
</div><div class="textblock"><div class="dynheader">
Include dependency graph for Usb.h:</div>
<div class="dyncontent">
<div class="center"><img src="_usb_8h__incl.png" border="0" usemap="#_usb_8h" alt=""/></div>
<map name="_usb_8h" id="_usb_8h">
<area shape="rect" id="node4" href="avrpins_8h.html" title="avrpins.h" alt="" coords="5,144,59,165"/><area shape="rect" id="node6" href="max3421e_8h.html" title="max3421e.h" alt="" coords="180,144,247,165"/><area shape="rect" id="node7" href="usbhost_8h.html" title="usbhost.h" alt="" coords="181,75,237,96"/><area shape="rect" id="node8" href="usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="97,144,156,165"/><area shape="rect" id="node9" href="address_8h.html" title="address.h" alt="" coords="314,75,371,96"/><area shape="rect" id="node12" href="printhex_8h.html" title="printhex.h" alt="" coords="653,144,709,165"/><area shape="rect" id="node13" href="hexdump_8h.html" title="hexdump.h" alt="" coords="551,75,612,96"/><area shape="rect" id="node15" href="message_8h.html" title="message.h" alt="" coords="453,75,515,96"/></map>
<area shape="rect" id="node4" href="avrpins_8h.html" title="avrpins.h" alt="" coords="320,144,374,165"/><area shape="rect" id="node6" href="max3421e_8h.html" title="max3421e.h" alt="" coords="146,144,213,165"/><area shape="rect" id="node7" href="usbhost_8h.html" title="usbhost.h" alt="" coords="268,75,325,96"/><area shape="rect" id="node8" href="usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="237,144,296,165"/><area shape="rect" id="node9" href="address_8h.html" title="address.h" alt="" coords="82,75,138,96"/><area shape="rect" id="node12" href="message_8h.html" title="message.h" alt="" coords="450,75,512,96"/><area shape="rect" id="node14" href="printhex_8h.html" title="printhex.h" alt="" coords="587,144,644,165"/><area shape="rect" id="node15" href="hexdump_8h.html" title="hexdump.h" alt="" coords="450,144,512,165"/></map>
</div>
</div><div class="textblock"><div class="dynheader">
This graph shows which files directly or indirectly include this file:</div>
@ -136,9 +134,9 @@ Classes</h2></td></tr>
Macros</h2></td></tr>
<tr class="memitem:a59c611df6811225e1cca2d1ce5a09cfb"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_usb_8h.html#a59c611df6811225e1cca2d1ce5a09cfb">USB_METHODS_INLINE</a></td></tr>
<tr class="separator:a59c611df6811225e1cca2d1ce5a09cfb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afc6fe7f947af35317a49a4dcfc8189fd"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_usb_8h.html#afc6fe7f947af35317a49a4dcfc8189fd">USBTRACE</a>(s)&#160;&#160;&#160;(Serial.print((s)))</td></tr>
<tr class="memitem:afc6fe7f947af35317a49a4dcfc8189fd"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_usb_8h.html#afc6fe7f947af35317a49a4dcfc8189fd">USBTRACE</a>(s)&#160;&#160;&#160;(<a class="el" href="message_8h.html#a1e8693828152de8408add858dc461dea">Notify</a>(PSTR(s), 0x80))</td></tr>
<tr class="separator:afc6fe7f947af35317a49a4dcfc8189fd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:adbe3f00986df48a9254f8bf0992041d3"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_usb_8h.html#adbe3f00986df48a9254f8bf0992041d3">USBTRACE2</a>(s, r)&#160;&#160;&#160;(Serial.print((s)), Serial.println((r),HEX))</td></tr>
<tr class="memitem:adbe3f00986df48a9254f8bf0992041d3"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_usb_8h.html#adbe3f00986df48a9254f8bf0992041d3">USBTRACE2</a>(s, r)&#160;&#160;&#160;(<a class="el" href="message_8h.html#a1e8693828152de8408add858dc461dea">Notify</a>(PSTR(s), 0x80), PrintHex((r), 0x80), Notify(PSTR(&quot;\r\n&quot;), 0x80))</td></tr>
<tr class="separator:adbe3f00986df48a9254f8bf0992041d3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a060f3a6423f1e3640aa7b14d5ce72285"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_usb_8h.html#a060f3a6423f1e3640aa7b14d5ce72285">bmREQ_GET_DESCR</a>&#160;&#160;&#160;<a class="el" href="usb__ch9_8h.html#a35c2a529dc87a274b2eb6f9e33682449">USB_SETUP_DEVICE_TO_HOST</a>|<a class="el" href="usb__ch9_8h.html#a3b51a35acaa76cafbb987c07186a7868">USB_SETUP_TYPE_STANDARD</a>|<a class="el" href="usb__ch9_8h.html#ad48131dc5ca47b4b2def65e7bbc8442f">USB_SETUP_RECIPIENT_DEVICE</a></td></tr>
<tr class="separator:a060f3a6423f1e3640aa7b14d5ce72285"><td class="memSeparator" colspan="2">&#160;</td></tr>
@ -265,7 +263,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00025">25</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00023">23</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -278,12 +276,12 @@ Typedefs</h2></td></tr>
<td>(</td>
<td class="paramtype">&#160;</td>
<td class="paramname">s</td><td>)</td>
<td>&#160;&#160;&#160;(Serial.print((s)))</td>
<td>&#160;&#160;&#160;(<a class="el" href="message_8h.html#a1e8693828152de8408add858dc461dea">Notify</a>(PSTR(s), 0x80))</td>
</tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00067">67</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00061">61</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -306,12 +304,12 @@ Typedefs</h2></td></tr>
<tr>
<td></td>
<td>)</td>
<td></td><td>&#160;&#160;&#160;(Serial.print((s)), Serial.println((r),HEX))</td>
<td></td><td>&#160;&#160;&#160;(<a class="el" href="message_8h.html#a1e8693828152de8408add858dc461dea">Notify</a>(PSTR(s), 0x80), PrintHex((r), 0x80), Notify(PSTR(&quot;\r\n&quot;), 0x80))</td>
</tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00068">68</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00062">62</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -325,7 +323,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00073">73</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00067">67</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -339,7 +337,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00074">74</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00068">68</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -353,7 +351,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00075">75</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00069">69</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -367,7 +365,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00082">82</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00076">76</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -381,7 +379,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00083">83</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00077">77</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -395,7 +393,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00084">84</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00078">78</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -409,7 +407,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00085">85</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00079">79</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -423,7 +421,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00086">86</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00080">80</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -437,7 +435,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00087">87</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00081">81</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -451,7 +449,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00088">88</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00082">82</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -465,7 +463,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00089">89</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00083">83</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -479,7 +477,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00090">90</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00084">84</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -493,7 +491,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00091">91</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00085">85</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -507,7 +505,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00092">92</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00086">86</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -521,7 +519,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00093">93</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00087">87</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -535,7 +533,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00094">94</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00088">88</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -549,7 +547,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00095">95</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00089">89</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -563,7 +561,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00096">96</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00090">90</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -577,7 +575,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00097">97</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00091">91</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -591,7 +589,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00098">98</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00092">92</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -605,7 +603,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00099">99</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00093">93</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -619,7 +617,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00100">100</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00094">94</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -633,7 +631,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00103">103</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00097">97</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -647,7 +645,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00104">104</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00098">98</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -661,7 +659,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00105">105</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00099">99</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -675,7 +673,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00106">106</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00100">100</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -689,7 +687,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00107">107</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00101">101</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -703,7 +701,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00108">108</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00102">102</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -717,7 +715,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00109">109</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00103">103</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -731,7 +729,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00110">110</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00104">104</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -745,7 +743,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00111">111</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00105">105</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -759,7 +757,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00112">112</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00106">106</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -773,7 +771,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00113">113</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00107">107</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -787,7 +785,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00114">114</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00108">108</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -801,7 +799,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00125">125</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00118">118</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -815,7 +813,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00127">127</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00120">120</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -829,7 +827,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00128">128</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00121">121</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -843,7 +841,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00130">130</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00123">123</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -857,7 +855,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00132">132</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00125">125</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -871,7 +869,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00135">135</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00128">128</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -885,7 +883,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00137">137</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00130">130</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -899,7 +897,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00138">138</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00131">131</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -913,7 +911,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00139">139</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00132">132</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -927,7 +925,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00140">140</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00133">133</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -941,7 +939,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00141">141</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00134">134</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -955,7 +953,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00142">142</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00135">135</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -969,7 +967,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00143">143</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00136">136</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -983,7 +981,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00144">144</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00137">137</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -997,7 +995,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00145">145</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00138">138</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -1011,7 +1009,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00146">146</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00139">139</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -1025,7 +1023,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00147">147</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00140">140</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -1039,7 +1037,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00148">148</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00141">141</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -1053,7 +1051,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00149">149</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00142">142</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>
@ -1068,7 +1066,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00063">63</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
<p>Definition at line <a class="el" href="_usb_8h_source.html#l00057">57</a> of file <a class="el" href="_usb_8h_source.html">Usb.h</a>.</p>
</div>
</div>

View file

@ -1,10 +1,10 @@
<map id="Usb.h" name="Usb.h">
<area shape="rect" id="node4" href="$avrpins_8h.html" title="avrpins.h" alt="" coords="5,144,59,165"/>
<area shape="rect" id="node6" href="$max3421e_8h.html" title="max3421e.h" alt="" coords="180,144,247,165"/>
<area shape="rect" id="node7" href="$usbhost_8h.html" title="usbhost.h" alt="" coords="181,75,237,96"/>
<area shape="rect" id="node8" href="$usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="97,144,156,165"/>
<area shape="rect" id="node9" href="$address_8h.html" title="address.h" alt="" coords="314,75,371,96"/>
<area shape="rect" id="node12" href="$printhex_8h.html" title="printhex.h" alt="" coords="653,144,709,165"/>
<area shape="rect" id="node13" href="$hexdump_8h.html" title="hexdump.h" alt="" coords="551,75,612,96"/>
<area shape="rect" id="node15" href="$message_8h.html" title="message.h" alt="" coords="453,75,515,96"/>
<area shape="rect" id="node4" href="$avrpins_8h.html" title="avrpins.h" alt="" coords="320,144,374,165"/>
<area shape="rect" id="node6" href="$max3421e_8h.html" title="max3421e.h" alt="" coords="146,144,213,165"/>
<area shape="rect" id="node7" href="$usbhost_8h.html" title="usbhost.h" alt="" coords="268,75,325,96"/>
<area shape="rect" id="node8" href="$usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="237,144,296,165"/>
<area shape="rect" id="node9" href="$address_8h.html" title="address.h" alt="" coords="82,75,138,96"/>
<area shape="rect" id="node12" href="$message_8h.html" title="message.h" alt="" coords="450,75,512,96"/>
<area shape="rect" id="node14" href="$printhex_8h.html" title="printhex.h" alt="" coords="587,144,644,165"/>
<area shape="rect" id="node15" href="$hexdump_8h.html" title="hexdump.h" alt="" coords="450,144,512,165"/>
</map>

View file

@ -1 +1 @@
639d1c1636721c9fb3a70d904c2e1f72
d7e3042d71e752f1afbf6b063abdad3f

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 42 KiB

View file

@ -109,271 +109,268 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<div class="line"><a name="l00018"></a><span class="lineno"> 18</span>&#160;<span class="preprocessor">#ifndef _usb_h_</span></div>
<div class="line"><a name="l00019"></a><span class="lineno"> 19</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define _usb_h_</span></div>
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span>&#160;</div>
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span>&#160;<span class="comment">//#define BOARD_BLACK_WIDDOW</span></div>
<div class="line"><a name="l00023"></a><span class="lineno"> 23</span>&#160;</div>
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span>&#160;</div>
<div class="line"><a name="l00025"></a><span class="lineno"><a class="code" href="_usb_8h.html#a59c611df6811225e1cca2d1ce5a09cfb"> 25</a></span>&#160;<span class="preprocessor">#define USB_METHODS_INLINE</span></div>
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span>&#160;<span class="preprocessor">#include &lt;inttypes.h&gt;</span></div>
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span>&#160;<span class="comment">//#define BOARD_BLACK_WIDDOW</span></div>
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span>&#160;</div>
<div class="line"><a name="l00023"></a><span class="lineno"><a class="code" href="_usb_8h.html#a59c611df6811225e1cca2d1ce5a09cfb"> 23</a></span>&#160;<span class="preprocessor">#define USB_METHODS_INLINE</span></div>
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span>&#160;<span class="preprocessor">#include &lt;inttypes.h&gt;</span></div>
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span>&#160;</div>
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span>&#160;<span class="preprocessor">#include &lt;assert.h&gt;</span></div>
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span>&#160;</div>
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span>&#160;<span class="preprocessor">#include &lt;assert.h&gt;</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">#include &quot;<a class="code" href="avrpins_8h.html">avrpins.h</a>&quot;</span></div>
<div class="line"><a name="l00032"></a><span class="lineno"> 32</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="l00033"></a><span class="lineno"> 33</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="l00034"></a><span class="lineno"> 34</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="l00035"></a><span class="lineno"> 35</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="address_8h.html">address.h</a>&quot;</span></div>
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span>&#160;</div>
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span>&#160;<span class="preprocessor">#if defined(ARDUINO) &amp;&amp; ARDUINO &gt;=100</span></div>
<div class="line"><a name="l00038"></a><span class="lineno"> 38</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#include &quot;Arduino.h&quot;</span></div>
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span>&#160;<span class="preprocessor">#else</span></div>
<div class="line"><a name="l00040"></a><span class="lineno"> 40</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#include &lt;WProgram.h&gt;</span></div>
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00043"></a><span class="lineno"> 43</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="l00044"></a><span class="lineno"> 44</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="l00045"></a><span class="lineno"> 45</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="l00046"></a><span class="lineno"> 46</span>&#160;</div>
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span>&#160;</div>
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span>&#160;<span class="comment">/* shield pins. First parameter - SS pin, second parameter - INT pin */</span></div>
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span>&#160;</div>
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span>&#160;<span class="preprocessor">#if defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)</span></div>
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define BOARD_TEENSY_PLUS_PLUS</span></div>
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00053"></a><span class="lineno"> 53</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span>&#160;<span class="preprocessor">#ifdef BOARD_BLACK_WIDDOW</span></div>
<div class="line"><a name="l00055"></a><span class="lineno"> 55</span>&#160;<span class="preprocessor"></span><span class="keyword">typedef</span> <a class="code" href="class_m_a_x3421e.html">MAX3421e&lt;P6, P3&gt;</a> <a class="code" href="_usb_8h.html#ae8ea2a106e94f5bb20be2fcbd4e402fb">MAX3421E</a>; <span class="comment">// Black Widow</span></div>
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>&#160;<span class="preprocessor">#elif defined(BOARD_TEENSY_PLUS_PLUS)</span></div>
<div class="line"><a name="l00057"></a><span class="lineno"> 57</span>&#160;<span class="preprocessor"></span><span class="keyword">typedef</span> <a class="code" href="class_m_a_x3421e.html">MAX3421e&lt;P9, P8&gt;</a> <a class="code" href="_usb_8h.html#ae8ea2a106e94f5bb20be2fcbd4e402fb">MAX3421E</a>; <span class="comment">// Teensy++ 2.0 &amp; 1.0</span></div>
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span>&#160;<span class="preprocessor">#elif defined(BOARD_MEGA_ADK)</span></div>
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span>&#160;<span class="preprocessor"></span><span class="keyword">typedef</span> <a class="code" href="class_m_a_x3421e.html">MAX3421e&lt;P53, P54&gt;</a> <a class="code" href="_usb_8h.html#ae8ea2a106e94f5bb20be2fcbd4e402fb">MAX3421E</a>; <span class="comment">// Arduino Mega ADK</span></div>
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span>&#160;<span class="preprocessor">#elif defined(BOARD_BALANDUINO)</span></div>
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span>&#160;<span class="preprocessor"></span><span class="keyword">typedef</span> <a class="code" href="class_m_a_x3421e.html">MAX3421e&lt;P20, P19&gt;</a> <a class="code" href="_usb_8h.html#ae8ea2a106e94f5bb20be2fcbd4e402fb">MAX3421E</a>; <span class="comment">// Balanduino</span></div>
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>&#160;<span class="preprocessor">#else</span></div>
<div class="line"><a name="l00063"></a><span class="lineno"><a class="code" href="_usb_8h.html#ae8ea2a106e94f5bb20be2fcbd4e402fb"> 63</a></span>&#160;<span class="preprocessor"></span><span class="keyword">typedef</span> <a class="code" href="class_m_a_x3421e.html">MAX3421e&lt;P10, P9&gt;</a> <a class="code" href="_usb_8h.html#ae8ea2a106e94f5bb20be2fcbd4e402fb">MAX3421E</a>; <span class="comment">// Official Arduinos (UNO, Duemilanove, Mega, 2560, Leonardo etc.)</span></div>
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>&#160;<span class="comment">//Debug macros. In 1.0 it is possible to move strings to PROGMEM by defining USBTRACE (Serial.print(F(s)))</span></div>
<div class="line"><a name="l00067"></a><span class="lineno"><a class="code" href="_usb_8h.html#afc6fe7f947af35317a49a4dcfc8189fd"> 67</a></span>&#160;<span class="preprocessor">#define USBTRACE(s) (Serial.print((s)))</span></div>
<div class="line"><a name="l00068"></a><span class="lineno"><a class="code" href="_usb_8h.html#adbe3f00986df48a9254f8bf0992041d3"> 68</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USBTRACE2(s,r) (Serial.print((s)), Serial.println((r),HEX))</span></div>
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>&#160;</div>
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>&#160;</div>
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>&#160;<span class="comment">/* Common setup data constant combinations */</span></div>
<div class="line"><a name="l00073"></a><span class="lineno"><a class="code" href="_usb_8h.html#a060f3a6423f1e3640aa7b14d5ce72285"> 73</a></span>&#160;<span class="preprocessor">#define bmREQ_GET_DESCR USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_STANDARD|USB_SETUP_RECIPIENT_DEVICE //get descriptor request type</span></div>
<div class="line"><a name="l00074"></a><span class="lineno"><a class="code" href="_usb_8h.html#af4965e768593007eacde7644979f56da"> 74</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define bmREQ_SET USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_STANDARD|USB_SETUP_RECIPIENT_DEVICE //set request type for all but &#39;set feature&#39; and &#39;set interface&#39;</span></div>
<div class="line"><a name="l00075"></a><span class="lineno"><a class="code" href="_usb_8h.html#a9495c8ffdb784e111e8174e1541676f0"> 75</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define bmREQ_CL_GET_INTF USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_INTERFACE //get interface request type</span></div>
<div class="line"><a name="l00076"></a><span class="lineno"> 76</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span>&#160;<span class="comment">// D7 data transfer direction (0 - host-to-device, 1 - device-to-host)</span></div>
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span>&#160;<span class="comment">// D6-5 Type (0- standard, 1 - class, 2 - vendor, 3 - reserved)</span></div>
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>&#160;<span class="comment">// D4-0 Recipient (0 - device, 1 - interface, 2 - endpoint, 3 - other, 4..31 - reserved)</span></div>
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>&#160;</div>
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span>&#160;<span class="comment">// USB Device Classes</span></div>
<div class="line"><a name="l00082"></a><span class="lineno"><a class="code" href="_usb_8h.html#ae157c9a62665e9ca41bf765518077f40"> 82</a></span>&#160;<span class="preprocessor">#define USB_CLASS_USE_CLASS_INFO 0x00 // Use Class Info in the Interface Descriptors</span></div>
<div class="line"><a name="l00083"></a><span class="lineno"><a class="code" href="_usb_8h.html#a8785f84db1be6b0b5da34cd91a1b6138"> 83</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_CLASS_AUDIO 0x01 // Audio</span></div>
<div class="line"><a name="l00084"></a><span class="lineno"><a class="code" href="_usb_8h.html#abb99f6b1f38ff79ec678cd957ac86758"> 84</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_CLASS_COM_AND_CDC_CTRL 0x02 // Communications and CDC Control</span></div>
<div class="line"><a name="l00085"></a><span class="lineno"><a class="code" href="_usb_8h.html#af062e949014bed74a8b5fedcf1705602"> 85</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_CLASS_HID 0x03 // HID</span></div>
<div class="line"><a name="l00086"></a><span class="lineno"><a class="code" href="_usb_8h.html#aa5f3153d014b6267ba8da243b6b46443"> 86</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_CLASS_PHYSICAL 0x05 // Physical</span></div>
<div class="line"><a name="l00087"></a><span class="lineno"><a class="code" href="_usb_8h.html#a1cddf36a39f1299fcf654628c40eaafe"> 87</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_CLASS_IMAGE 0x06 // Image</span></div>
<div class="line"><a name="l00088"></a><span class="lineno"><a class="code" href="_usb_8h.html#ab3e03403111b64480ba298d2641cf92f"> 88</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_CLASS_PRINTER 0x07 // Printer</span></div>
<div class="line"><a name="l00089"></a><span class="lineno"><a class="code" href="_usb_8h.html#aa99b73e335df09e6545fc44798a3c1f2"> 89</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_CLASS_MASS_STORAGE 0x08 // Mass Storage</span></div>
<div class="line"><a name="l00090"></a><span class="lineno"><a class="code" href="_usb_8h.html#aac5a936a2d1a6e3403798b031294992a"> 90</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_CLASS_HUB 0x09 // Hub</span></div>
<div class="line"><a name="l00091"></a><span class="lineno"><a class="code" href="_usb_8h.html#a7dae7df3ce2685f96775f2a0fb8658ae"> 91</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_CLASS_CDC_DATA 0x0a // CDC-Data</span></div>
<div class="line"><a name="l00092"></a><span class="lineno"><a class="code" href="_usb_8h.html#a823e1d95a677968ba93d6bb1968c48db"> 92</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_CLASS_SMART_CARD 0x0b // Smart-Card</span></div>
<div class="line"><a name="l00093"></a><span class="lineno"><a class="code" href="_usb_8h.html#a311fda5cdf4960e05a892084c1b11288"> 93</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_CLASS_CONTENT_SECURITY 0x0d // Content Security</span></div>
<div class="line"><a name="l00094"></a><span class="lineno"><a class="code" href="_usb_8h.html#a42a579e1be399e32a495b82634411449"> 94</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_CLASS_VIDEO 0x0e // Video</span></div>
<div class="line"><a name="l00095"></a><span class="lineno"><a class="code" href="_usb_8h.html#aef502b63c6eb8229ba4d67224f19fb84"> 95</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_CLASS_PERSONAL_HEALTH 0x0f // Personal Healthcare</span></div>
<div class="line"><a name="l00096"></a><span class="lineno"><a class="code" href="_usb_8h.html#aa31549c5c0d9e18f310dddaeab27068b"> 96</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_CLASS_DIAGNOSTIC_DEVICE 0xdc // Diagnostic Device</span></div>
<div class="line"><a name="l00097"></a><span class="lineno"><a class="code" href="_usb_8h.html#afce880b09049d7105f8e68ff36d9ad17"> 97</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_CLASS_WIRELESS_CTRL 0xe0 // Wireless Controller</span></div>
<div class="line"><a name="l00098"></a><span class="lineno"><a class="code" href="_usb_8h.html#a02fb07e20ad6d1af64439f40093bc80f"> 98</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_CLASS_MISC 0xef // Miscellaneous</span></div>
<div class="line"><a name="l00099"></a><span class="lineno"><a class="code" href="_usb_8h.html#a47087a6e244a02251b650921ea3b71db"> 99</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_CLASS_APP_SPECIFIC 0xfe // Application Specific</span></div>
<div class="line"><a name="l00100"></a><span class="lineno"><a class="code" href="_usb_8h.html#a7c6212a5385ca1b4af75eeff62f7a871"> 100</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_CLASS_VENDOR_SPECIFIC 0xff // Vendor Specific</span></div>
<div class="line"><a name="l00101"></a><span class="lineno"> 101</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00102"></a><span class="lineno"> 102</span>&#160;<span class="comment">// Additional Error Codes</span></div>
<div class="line"><a name="l00103"></a><span class="lineno"><a class="code" href="_usb_8h.html#ae9e139d0fd29bb0b3e7afad2f76cd589"> 103</a></span>&#160;<span class="preprocessor">#define USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED 0xD1</span></div>
<div class="line"><a name="l00104"></a><span class="lineno"><a class="code" href="_usb_8h.html#a7cb7070e699b7815e3c45dc8f7dd67f1"> 104</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_DEV_CONFIG_ERROR_DEVICE_INIT_INCOMPLETE 0xD2</span></div>
<div class="line"><a name="l00105"></a><span class="lineno"><a class="code" href="_usb_8h.html#ad4929f74079f3bc22b00936ae84d18b0"> 105</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_ERROR_UNABLE_TO_REGISTER_DEVICE_CLASS 0xD3</span></div>
<div class="line"><a name="l00106"></a><span class="lineno"><a class="code" href="_usb_8h.html#a15370eb665cdded5514e69ca58d9f39d"> 106</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL 0xD4</span></div>
<div class="line"><a name="l00107"></a><span class="lineno"><a class="code" href="_usb_8h.html#ada55913b93ef46c430ed6979022c31b1"> 107</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_ERROR_HUB_ADDRESS_OVERFLOW 0xD5</span></div>
<div class="line"><a name="l00108"></a><span class="lineno"><a class="code" href="_usb_8h.html#afe2fedb4b0ccc89a688c0b4b59691ce0"> 108</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL 0xD6</span></div>
<div class="line"><a name="l00109"></a><span class="lineno"><a class="code" href="_usb_8h.html#af192c59cafe2192ad802b22e6dbc077d"> 109</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_ERROR_EPINFO_IS_NULL 0xD7</span></div>
<div class="line"><a name="l00110"></a><span class="lineno"><a class="code" href="_usb_8h.html#a52c379fe7e22f53d3e3d47d65735fa3b"> 110</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_ERROR_INVALID_ARGUMENT 0xD8</span></div>
<div class="line"><a name="l00111"></a><span class="lineno"><a class="code" href="_usb_8h.html#a44416ff64fc0e3691f98addac13d4595"> 111</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE 0xD9</span></div>
<div class="line"><a name="l00112"></a><span class="lineno"><a class="code" href="_usb_8h.html#a272428aaee5fccec4661bd5457d1928f"> 112</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_ERROR_INVALID_MAX_PKT_SIZE 0xDA</span></div>
<div class="line"><a name="l00113"></a><span class="lineno"><a class="code" href="_usb_8h.html#ad55f0079a95df5e4a9bb22e88a7395f5"> 113</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_ERROR_EP_NOT_FOUND_IN_TBL 0xDB</span></div>
<div class="line"><a name="l00114"></a><span class="lineno"><a class="code" href="_usb_8h.html#ae691ccb027b8e281ac87522a0e66aaa7"> 114</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_ERROR_TRANSFER_TIMEOUT 0xFF</span></div>
<div class="line"><a name="l00115"></a><span class="lineno"> 115</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00116"></a><span class="lineno"><a class="code" href="class_u_s_b_device_config.html"> 116</a></span>&#160;<span class="keyword">class </span><a class="code" href="class_u_s_b_device_config.html">USBDeviceConfig</a></div>
<div class="line"><a name="l00117"></a><span class="lineno"> 117</span>&#160;{</div>
<div class="line"><a name="l00118"></a><span class="lineno"> 118</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00119"></a><span class="lineno"> 119</span>&#160; <span class="keyword">virtual</span> uint8_t <a class="code" href="class_u_s_b_device_config.html#a391dc824a3271671890cebeb829b35ed">Init</a>(uint8_t parent, uint8_t port, <span class="keywordtype">bool</span> lowspeed) = 0;</div>
<div class="line"><a name="l00120"></a><span class="lineno"> 120</span>&#160; <span class="keyword">virtual</span> uint8_t <a class="code" href="class_u_s_b_device_config.html#a74c06c5fe641b20faeeebd39e33248b3">Release</a>() = 0;</div>
<div class="line"><a name="l00121"></a><span class="lineno"> 121</span>&#160; <span class="keyword">virtual</span> uint8_t <a class="code" href="class_u_s_b_device_config.html#a4961e92df3e75c38e6953fb08b11f8b6">Poll</a>() = 0;</div>
<div class="line"><a name="l00122"></a><span class="lineno"> 122</span>&#160; <span class="keyword">virtual</span> uint8_t <a class="code" href="class_u_s_b_device_config.html#aae3130517514c902bad5f153849b3811">GetAddress</a>() = 0;</div>
<div class="line"><a name="l00123"></a><span class="lineno"> 123</span>&#160;};</div>
<div class="line"><a name="l00124"></a><span class="lineno"> 124</span>&#160;</div>
<div class="line"><a name="l00125"></a><span class="lineno"><a class="code" href="_usb_8h.html#ad8686abbfa0d98547d450fe2a105a588"> 125</a></span>&#160;<span class="preprocessor">#define USB_XFER_TIMEOUT 5000 //USB transfer timeout in milliseconds, per section 9.2.6.1 of USB 2.0 spec</span></div>
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span>&#160;<span class="preprocessor"></span><span class="comment">//#define USB_NAK_LIMIT 32000 //NAK limit for a transfer. 0 means NAKs are not counted</span></div>
<div class="line"><a name="l00127"></a><span class="lineno"><a class="code" href="_usb_8h.html#a857a9899ad4f277faf074c3012e14ffa"> 127</a></span>&#160;<span class="preprocessor">#define USB_RETRY_LIMIT 3 //retry limit for a transfer</span></div>
<div class="line"><a name="l00128"></a><span class="lineno"><a class="code" href="_usb_8h.html#a1b082667723b29243b021a1829bdd8d6"> 128</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_SETTLE_DELAY 200 //settle delay in milliseconds</span></div>
<div class="line"><a name="l00029"></a><span class="lineno"> 29</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="l00030"></a><span class="lineno"> 30</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="l00031"></a><span class="lineno"> 31</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="l00032"></a><span class="lineno"> 32</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="l00033"></a><span class="lineno"> 33</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="address_8h.html">address.h</a>&quot;</span></div>
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span>&#160;</div>
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span>&#160;<span class="preprocessor">#if defined(ARDUINO) &amp;&amp; ARDUINO &gt;=100</span></div>
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#include &quot;Arduino.h&quot;</span></div>
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span>&#160;<span class="preprocessor">#else</span></div>
<div class="line"><a name="l00038"></a><span class="lineno"> 38</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#include &lt;WProgram.h&gt;</span></div>
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00040"></a><span class="lineno"> 40</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#include &quot;<a class="code" href="message_8h.html">message.h</a>&quot;</span></div>
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span>&#160;</div>
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span>&#160;<span class="comment">/* shield pins. First parameter - SS pin, second parameter - INT pin */</span></div>
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span>&#160;</div>
<div class="line"><a name="l00044"></a><span class="lineno"> 44</span>&#160;<span class="preprocessor">#if defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)</span></div>
<div class="line"><a name="l00045"></a><span class="lineno"> 45</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define BOARD_TEENSY_PLUS_PLUS</span></div>
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span>&#160;<span class="preprocessor">#ifdef BOARD_BLACK_WIDDOW</span></div>
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span>&#160;<span class="preprocessor"></span><span class="keyword">typedef</span> <a class="code" href="class_m_a_x3421e.html">MAX3421e&lt;P6, P3&gt;</a> <a class="code" href="_usb_8h.html#ae8ea2a106e94f5bb20be2fcbd4e402fb">MAX3421E</a>; <span class="comment">// Black Widow</span></div>
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span>&#160;<span class="preprocessor">#elif defined(BOARD_TEENSY_PLUS_PLUS)</span></div>
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>&#160;<span class="preprocessor"></span><span class="keyword">typedef</span> <a class="code" href="class_m_a_x3421e.html">MAX3421e&lt;P9, P8&gt;</a> <a class="code" href="_usb_8h.html#ae8ea2a106e94f5bb20be2fcbd4e402fb">MAX3421E</a>; <span class="comment">// Teensy++ 2.0 &amp; 1.0</span></div>
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span>&#160;<span class="preprocessor">#elif defined(BOARD_MEGA_ADK)</span></div>
<div class="line"><a name="l00053"></a><span class="lineno"> 53</span>&#160;<span class="preprocessor"></span><span class="keyword">typedef</span> <a class="code" href="class_m_a_x3421e.html">MAX3421e&lt;P53, P54&gt;</a> <a class="code" href="_usb_8h.html#ae8ea2a106e94f5bb20be2fcbd4e402fb">MAX3421E</a>; <span class="comment">// Arduino Mega ADK</span></div>
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span>&#160;<span class="preprocessor">#elif defined(BOARD_BALANDUINO)</span></div>
<div class="line"><a name="l00055"></a><span class="lineno"> 55</span>&#160;<span class="preprocessor"></span><span class="keyword">typedef</span> <a class="code" href="class_m_a_x3421e.html">MAX3421e&lt;P20, P19&gt;</a> <a class="code" href="_usb_8h.html#ae8ea2a106e94f5bb20be2fcbd4e402fb">MAX3421E</a>; <span class="comment">// Balanduino</span></div>
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>&#160;<span class="preprocessor">#else</span></div>
<div class="line"><a name="l00057"></a><span class="lineno"><a class="code" href="_usb_8h.html#ae8ea2a106e94f5bb20be2fcbd4e402fb"> 57</a></span>&#160;<span class="preprocessor"></span><span class="keyword">typedef</span> <a class="code" href="class_m_a_x3421e.html">MAX3421e&lt;P10, P9&gt;</a> <a class="code" href="_usb_8h.html#ae8ea2a106e94f5bb20be2fcbd4e402fb">MAX3421E</a>; <span class="comment">// Official Arduinos (UNO, Duemilanove, Mega, 2560, Leonardo etc.)</span></div>
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span>&#160;<span class="comment">//Debug macros. In 1.0 it is possible to move strings to PROGMEM by defining USBTRACE (Serial.print(F(s)))</span></div>
<div class="line"><a name="l00061"></a><span class="lineno"><a class="code" href="_usb_8h.html#afc6fe7f947af35317a49a4dcfc8189fd"> 61</a></span>&#160;<span class="preprocessor">#define USBTRACE(s) (Notify(PSTR(s), 0x80))</span></div>
<div class="line"><a name="l00062"></a><span class="lineno"><a class="code" href="_usb_8h.html#adbe3f00986df48a9254f8bf0992041d3"> 62</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USBTRACE2(s,r) (Notify(PSTR(s), 0x80), PrintHex((r), 0x80), Notify(PSTR(&quot;\r\n&quot;), 0x80))</span></div>
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>&#160;</div>
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>&#160;</div>
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>&#160;<span class="comment">/* Common setup data constant combinations */</span></div>
<div class="line"><a name="l00067"></a><span class="lineno"><a class="code" href="_usb_8h.html#a060f3a6423f1e3640aa7b14d5ce72285"> 67</a></span>&#160;<span class="preprocessor">#define bmREQ_GET_DESCR USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_STANDARD|USB_SETUP_RECIPIENT_DEVICE //get descriptor request type</span></div>
<div class="line"><a name="l00068"></a><span class="lineno"><a class="code" href="_usb_8h.html#af4965e768593007eacde7644979f56da"> 68</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define bmREQ_SET USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_STANDARD|USB_SETUP_RECIPIENT_DEVICE //set request type for all but &#39;set feature&#39; and &#39;set interface&#39;</span></div>
<div class="line"><a name="l00069"></a><span class="lineno"><a class="code" href="_usb_8h.html#a9495c8ffdb784e111e8174e1541676f0"> 69</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define bmREQ_CL_GET_INTF USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_INTERFACE //get interface request type</span></div>
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>&#160;<span class="comment">// D7 data transfer direction (0 - host-to-device, 1 - device-to-host)</span></div>
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>&#160;<span class="comment">// D6-5 Type (0- standard, 1 - class, 2 - vendor, 3 - reserved)</span></div>
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span>&#160;<span class="comment">// D4-0 Recipient (0 - device, 1 - interface, 2 - endpoint, 3 - other, 4..31 - reserved)</span></div>
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span>&#160;</div>
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span>&#160;<span class="comment">// USB Device Classes</span></div>
<div class="line"><a name="l00076"></a><span class="lineno"><a class="code" href="_usb_8h.html#ae157c9a62665e9ca41bf765518077f40"> 76</a></span>&#160;<span class="preprocessor">#define USB_CLASS_USE_CLASS_INFO 0x00 // Use Class Info in the Interface Descriptors</span></div>
<div class="line"><a name="l00077"></a><span class="lineno"><a class="code" href="_usb_8h.html#a8785f84db1be6b0b5da34cd91a1b6138"> 77</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_CLASS_AUDIO 0x01 // Audio</span></div>
<div class="line"><a name="l00078"></a><span class="lineno"><a class="code" href="_usb_8h.html#abb99f6b1f38ff79ec678cd957ac86758"> 78</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_CLASS_COM_AND_CDC_CTRL 0x02 // Communications and CDC Control</span></div>
<div class="line"><a name="l00079"></a><span class="lineno"><a class="code" href="_usb_8h.html#af062e949014bed74a8b5fedcf1705602"> 79</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_CLASS_HID 0x03 // HID</span></div>
<div class="line"><a name="l00080"></a><span class="lineno"><a class="code" href="_usb_8h.html#aa5f3153d014b6267ba8da243b6b46443"> 80</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_CLASS_PHYSICAL 0x05 // Physical</span></div>
<div class="line"><a name="l00081"></a><span class="lineno"><a class="code" href="_usb_8h.html#a1cddf36a39f1299fcf654628c40eaafe"> 81</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_CLASS_IMAGE 0x06 // Image</span></div>
<div class="line"><a name="l00082"></a><span class="lineno"><a class="code" href="_usb_8h.html#ab3e03403111b64480ba298d2641cf92f"> 82</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_CLASS_PRINTER 0x07 // Printer</span></div>
<div class="line"><a name="l00083"></a><span class="lineno"><a class="code" href="_usb_8h.html#aa99b73e335df09e6545fc44798a3c1f2"> 83</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_CLASS_MASS_STORAGE 0x08 // Mass Storage</span></div>
<div class="line"><a name="l00084"></a><span class="lineno"><a class="code" href="_usb_8h.html#aac5a936a2d1a6e3403798b031294992a"> 84</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_CLASS_HUB 0x09 // Hub</span></div>
<div class="line"><a name="l00085"></a><span class="lineno"><a class="code" href="_usb_8h.html#a7dae7df3ce2685f96775f2a0fb8658ae"> 85</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_CLASS_CDC_DATA 0x0a // CDC-Data</span></div>
<div class="line"><a name="l00086"></a><span class="lineno"><a class="code" href="_usb_8h.html#a823e1d95a677968ba93d6bb1968c48db"> 86</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_CLASS_SMART_CARD 0x0b // Smart-Card</span></div>
<div class="line"><a name="l00087"></a><span class="lineno"><a class="code" href="_usb_8h.html#a311fda5cdf4960e05a892084c1b11288"> 87</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_CLASS_CONTENT_SECURITY 0x0d // Content Security</span></div>
<div class="line"><a name="l00088"></a><span class="lineno"><a class="code" href="_usb_8h.html#a42a579e1be399e32a495b82634411449"> 88</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_CLASS_VIDEO 0x0e // Video</span></div>
<div class="line"><a name="l00089"></a><span class="lineno"><a class="code" href="_usb_8h.html#aef502b63c6eb8229ba4d67224f19fb84"> 89</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_CLASS_PERSONAL_HEALTH 0x0f // Personal Healthcare</span></div>
<div class="line"><a name="l00090"></a><span class="lineno"><a class="code" href="_usb_8h.html#aa31549c5c0d9e18f310dddaeab27068b"> 90</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_CLASS_DIAGNOSTIC_DEVICE 0xdc // Diagnostic Device</span></div>
<div class="line"><a name="l00091"></a><span class="lineno"><a class="code" href="_usb_8h.html#afce880b09049d7105f8e68ff36d9ad17"> 91</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_CLASS_WIRELESS_CTRL 0xe0 // Wireless Controller</span></div>
<div class="line"><a name="l00092"></a><span class="lineno"><a class="code" href="_usb_8h.html#a02fb07e20ad6d1af64439f40093bc80f"> 92</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_CLASS_MISC 0xef // Miscellaneous</span></div>
<div class="line"><a name="l00093"></a><span class="lineno"><a class="code" href="_usb_8h.html#a47087a6e244a02251b650921ea3b71db"> 93</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_CLASS_APP_SPECIFIC 0xfe // Application Specific</span></div>
<div class="line"><a name="l00094"></a><span class="lineno"><a class="code" href="_usb_8h.html#a7c6212a5385ca1b4af75eeff62f7a871"> 94</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_CLASS_VENDOR_SPECIFIC 0xff // Vendor Specific</span></div>
<div class="line"><a name="l00095"></a><span class="lineno"> 95</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00096"></a><span class="lineno"> 96</span>&#160;<span class="comment">// Additional Error Codes</span></div>
<div class="line"><a name="l00097"></a><span class="lineno"><a class="code" href="_usb_8h.html#ae9e139d0fd29bb0b3e7afad2f76cd589"> 97</a></span>&#160;<span class="preprocessor">#define USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED 0xD1</span></div>
<div class="line"><a name="l00098"></a><span class="lineno"><a class="code" href="_usb_8h.html#a7cb7070e699b7815e3c45dc8f7dd67f1"> 98</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_DEV_CONFIG_ERROR_DEVICE_INIT_INCOMPLETE 0xD2</span></div>
<div class="line"><a name="l00099"></a><span class="lineno"><a class="code" href="_usb_8h.html#ad4929f74079f3bc22b00936ae84d18b0"> 99</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_ERROR_UNABLE_TO_REGISTER_DEVICE_CLASS 0xD3</span></div>
<div class="line"><a name="l00100"></a><span class="lineno"><a class="code" href="_usb_8h.html#a15370eb665cdded5514e69ca58d9f39d"> 100</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL 0xD4</span></div>
<div class="line"><a name="l00101"></a><span class="lineno"><a class="code" href="_usb_8h.html#ada55913b93ef46c430ed6979022c31b1"> 101</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_ERROR_HUB_ADDRESS_OVERFLOW 0xD5</span></div>
<div class="line"><a name="l00102"></a><span class="lineno"><a class="code" href="_usb_8h.html#afe2fedb4b0ccc89a688c0b4b59691ce0"> 102</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL 0xD6</span></div>
<div class="line"><a name="l00103"></a><span class="lineno"><a class="code" href="_usb_8h.html#af192c59cafe2192ad802b22e6dbc077d"> 103</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_ERROR_EPINFO_IS_NULL 0xD7</span></div>
<div class="line"><a name="l00104"></a><span class="lineno"><a class="code" href="_usb_8h.html#a52c379fe7e22f53d3e3d47d65735fa3b"> 104</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_ERROR_INVALID_ARGUMENT 0xD8</span></div>
<div class="line"><a name="l00105"></a><span class="lineno"><a class="code" href="_usb_8h.html#a44416ff64fc0e3691f98addac13d4595"> 105</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE 0xD9</span></div>
<div class="line"><a name="l00106"></a><span class="lineno"><a class="code" href="_usb_8h.html#a272428aaee5fccec4661bd5457d1928f"> 106</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_ERROR_INVALID_MAX_PKT_SIZE 0xDA</span></div>
<div class="line"><a name="l00107"></a><span class="lineno"><a class="code" href="_usb_8h.html#ad55f0079a95df5e4a9bb22e88a7395f5"> 107</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_ERROR_EP_NOT_FOUND_IN_TBL 0xDB</span></div>
<div class="line"><a name="l00108"></a><span class="lineno"><a class="code" href="_usb_8h.html#ae691ccb027b8e281ac87522a0e66aaa7"> 108</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_ERROR_TRANSFER_TIMEOUT 0xFF</span></div>
<div class="line"><a name="l00109"></a><span class="lineno"> 109</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00110"></a><span class="lineno"><a class="code" href="class_u_s_b_device_config.html"> 110</a></span>&#160;<span class="keyword">class </span><a class="code" href="class_u_s_b_device_config.html">USBDeviceConfig</a> {</div>
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00112"></a><span class="lineno"> 112</span>&#160; <span class="keyword">virtual</span> uint8_t <a class="code" href="class_u_s_b_device_config.html#a391dc824a3271671890cebeb829b35ed">Init</a>(uint8_t parent, uint8_t port, <span class="keywordtype">bool</span> lowspeed) = 0;</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_u_s_b_device_config.html#a74c06c5fe641b20faeeebd39e33248b3">Release</a>() = 0;</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_u_s_b_device_config.html#a4961e92df3e75c38e6953fb08b11f8b6">Poll</a>() = 0;</div>
<div class="line"><a name="l00115"></a><span class="lineno"> 115</span>&#160; <span class="keyword">virtual</span> uint8_t <a class="code" href="class_u_s_b_device_config.html#aae3130517514c902bad5f153849b3811">GetAddress</a>() = 0;</div>
<div class="line"><a name="l00116"></a><span class="lineno"> 116</span>&#160;};</div>
<div class="line"><a name="l00117"></a><span class="lineno"> 117</span>&#160;</div>
<div class="line"><a name="l00118"></a><span class="lineno"><a class="code" href="_usb_8h.html#ad8686abbfa0d98547d450fe2a105a588"> 118</a></span>&#160;<span class="preprocessor">#define USB_XFER_TIMEOUT 5000 //USB transfer timeout in milliseconds, per section 9.2.6.1 of USB 2.0 spec</span></div>
<div class="line"><a name="l00119"></a><span class="lineno"> 119</span>&#160;<span class="preprocessor"></span><span class="comment">//#define USB_NAK_LIMIT 32000 //NAK limit for a transfer. 0 means NAKs are not counted</span></div>
<div class="line"><a name="l00120"></a><span class="lineno"><a class="code" href="_usb_8h.html#a857a9899ad4f277faf074c3012e14ffa"> 120</a></span>&#160;<span class="preprocessor">#define USB_RETRY_LIMIT 3 //retry limit for a transfer</span></div>
<div class="line"><a name="l00121"></a><span class="lineno"><a class="code" href="_usb_8h.html#a1b082667723b29243b021a1829bdd8d6"> 121</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_SETTLE_DELAY 200 //settle delay in milliseconds</span></div>
<div class="line"><a name="l00122"></a><span class="lineno"> 122</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00123"></a><span class="lineno"><a class="code" href="_usb_8h.html#a0282f9f7a0313f957e02449d7313b7b5"> 123</a></span>&#160;<span class="preprocessor">#define USB_NUMDEVICES 16 //number of USB devices</span></div>
<div class="line"><a name="l00124"></a><span class="lineno"> 124</span>&#160;<span class="preprocessor"></span><span class="comment">//#define HUB_MAX_HUBS 7 // maximum number of hubs that can be attached to the host controller</span></div>
<div class="line"><a name="l00125"></a><span class="lineno"><a class="code" href="_usb_8h.html#ae843af5aa0de74b17c3d8c8f8fab4c00"> 125</a></span>&#160;<span class="preprocessor">#define HUB_PORT_RESET_DELAY 20 // hub port reset delay 10 ms recomended, can be up to 20 ms</span></div>
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00127"></a><span class="lineno"> 127</span>&#160;<span class="comment">/* USB state machine states */</span></div>
<div class="line"><a name="l00128"></a><span class="lineno"><a class="code" href="_usb_8h.html#a3168cf67661a2716677b9830f30b880c"> 128</a></span>&#160;<span class="preprocessor">#define USB_STATE_MASK 0xf0</span></div>
<div class="line"><a name="l00129"></a><span class="lineno"> 129</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00130"></a><span class="lineno"><a class="code" href="_usb_8h.html#a0282f9f7a0313f957e02449d7313b7b5"> 130</a></span>&#160;<span class="preprocessor">#define USB_NUMDEVICES 16 //number of USB devices</span></div>
<div class="line"><a name="l00131"></a><span class="lineno"> 131</span>&#160;<span class="preprocessor"></span><span class="comment">//#define HUB_MAX_HUBS 7 // maximum number of hubs that can be attached to the host controller</span></div>
<div class="line"><a name="l00132"></a><span class="lineno"><a class="code" href="_usb_8h.html#ae843af5aa0de74b17c3d8c8f8fab4c00"> 132</a></span>&#160;<span class="preprocessor">#define HUB_PORT_RESET_DELAY 20 // hub port reset delay 10 ms recomended, can be up to 20 ms</span></div>
<div class="line"><a name="l00133"></a><span class="lineno"> 133</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00134"></a><span class="lineno"> 134</span>&#160;<span class="comment">/* USB state machine states */</span></div>
<div class="line"><a name="l00135"></a><span class="lineno"><a class="code" href="_usb_8h.html#a3168cf67661a2716677b9830f30b880c"> 135</a></span>&#160;<span class="preprocessor">#define USB_STATE_MASK 0xf0</span></div>
<div class="line"><a name="l00136"></a><span class="lineno"> 136</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00137"></a><span class="lineno"><a class="code" href="_usb_8h.html#ae7fd7c5bb6dc87f44724dde2ad57df87"> 137</a></span>&#160;<span class="preprocessor">#define USB_STATE_DETACHED 0x10</span></div>
<div class="line"><a name="l00138"></a><span class="lineno"><a class="code" href="_usb_8h.html#a60a744d0f1386e4b28053a41bd6a958f"> 138</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_DETACHED_SUBSTATE_INITIALIZE 0x11 </span></div>
<div class="line"><a name="l00139"></a><span class="lineno"><a class="code" href="_usb_8h.html#a3708f4e8166d5d099e1982aa956eacce"> 139</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_DETACHED_SUBSTATE_WAIT_FOR_DEVICE 0x12</span></div>
<div class="line"><a name="l00140"></a><span class="lineno"><a class="code" href="_usb_8h.html#aff6ab2376cd29385b20c2b63d4ddd26d"> 140</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_DETACHED_SUBSTATE_ILLEGAL 0x13</span></div>
<div class="line"><a name="l00141"></a><span class="lineno"><a class="code" href="_usb_8h.html#aaadb20392558e23e3eba073e358a4493"> 141</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_ATTACHED_SUBSTATE_SETTLE 0x20</span></div>
<div class="line"><a name="l00142"></a><span class="lineno"><a class="code" href="_usb_8h.html#ada22633d6de30155a60cb19f6e6452fe"> 142</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_ATTACHED_SUBSTATE_RESET_DEVICE 0x30 </span></div>
<div class="line"><a name="l00143"></a><span class="lineno"><a class="code" href="_usb_8h.html#a311f11b79c4020d771cd6930e0a3223d"> 143</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_ATTACHED_SUBSTATE_WAIT_RESET_COMPLETE 0x40</span></div>
<div class="line"><a name="l00144"></a><span class="lineno"><a class="code" href="_usb_8h.html#a2d69537e663e7d5f188004f0d25ec0cc"> 144</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_ATTACHED_SUBSTATE_WAIT_SOF 0x50</span></div>
<div class="line"><a name="l00145"></a><span class="lineno"><a class="code" href="_usb_8h.html#a23ebcbb956f600e06435b28ae0c855d4"> 145</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_ATTACHED_SUBSTATE_GET_DEVICE_DESCRIPTOR_SIZE 0x60</span></div>
<div class="line"><a name="l00146"></a><span class="lineno"><a class="code" href="_usb_8h.html#a474a95baaeb99abd17538c2a1364bf96"> 146</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_STATE_ADDRESSING 0x70</span></div>
<div class="line"><a name="l00147"></a><span class="lineno"><a class="code" href="_usb_8h.html#aac8c844e6a20f42298d70e4438a029e5"> 147</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_STATE_CONFIGURING 0x80</span></div>
<div class="line"><a name="l00148"></a><span class="lineno"><a class="code" href="_usb_8h.html#a138c40c59f628eefbe273a8db0a96753"> 148</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_STATE_RUNNING 0x90</span></div>
<div class="line"><a name="l00149"></a><span class="lineno"><a class="code" href="_usb_8h.html#a6fef5305841ac36f67d8ddb0bd9127d4"> 149</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_STATE_ERROR 0xa0</span></div>
<div class="line"><a name="l00150"></a><span class="lineno"> 150</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00151"></a><span class="lineno"> 151</span>&#160;<span class="comment">/* USB Setup Packet Structure */</span></div>
<div class="line"><a name="l00152"></a><span class="lineno"><a class="code" href="struct_s_e_t_u_p___p_k_t.html"> 152</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span>{</div>
<div class="line"><a name="l00153"></a><span class="lineno"> 153</span>&#160; <span class="keyword">union </span>{ <span class="comment">// offset description</span></div>
<div class="line"><a name="l00154"></a><span class="lineno"><a class="code" href="struct_s_e_t_u_p___p_k_t.html#a9bbd6cf5a93a6433d2eb97c59b9102d5"> 154</a></span>&#160; uint8_t <a class="code" href="struct_s_e_t_u_p___p_k_t.html#a9bbd6cf5a93a6433d2eb97c59b9102d5">bmRequestType</a>; <span class="comment">// 0 Bit-map of request type</span></div>
<div class="line"><a name="l00155"></a><span class="lineno"> 155</span>&#160; <span class="keyword">struct </span>{</div>
<div class="line"><a name="l00156"></a><span class="lineno"><a class="code" href="struct_s_e_t_u_p___p_k_t.html#a690a55f65b2ce4e69c426b92004a1cc6"> 156</a></span>&#160; uint8_t recipient: 5; <span class="comment">// Recipient of the request</span></div>
<div class="line"><a name="l00157"></a><span class="lineno"><a class="code" href="struct_s_e_t_u_p___p_k_t.html#ad9346ba7b7a4da6829142e23e3ba8a2f"> 157</a></span>&#160; uint8_t type: 2; <span class="comment">// Type of request</span></div>
<div class="line"><a name="l00158"></a><span class="lineno"><a class="code" href="struct_s_e_t_u_p___p_k_t.html#ab50c95fb951cdebc78c3e024de1d6d65"> 158</a></span>&#160; uint8_t direction: 1; <span class="comment">// Direction of data X-fer</span></div>
<div class="line"><a name="l00159"></a><span class="lineno"> 159</span>&#160; };</div>
<div class="line"><a name="l00160"></a><span class="lineno"> 160</span>&#160; }ReqType_u;</div>
<div class="line"><a name="l00161"></a><span class="lineno"><a class="code" href="struct_s_e_t_u_p___p_k_t.html#a321b931277d6ce278416dc5d74059016"> 161</a></span>&#160; uint8_t <a class="code" href="struct_s_e_t_u_p___p_k_t.html#a321b931277d6ce278416dc5d74059016">bRequest</a>; <span class="comment">// 1 Request</span></div>
<div class="line"><a name="l00162"></a><span class="lineno"> 162</span>&#160; <span class="keyword">union </span>{</div>
<div class="line"><a name="l00163"></a><span class="lineno"><a class="code" href="struct_s_e_t_u_p___p_k_t.html#a1382f4a10a9b0774f803d1125dd9bb52"> 163</a></span>&#160; uint16_t <a class="code" href="struct_s_e_t_u_p___p_k_t.html#a1382f4a10a9b0774f803d1125dd9bb52">wValue</a>; <span class="comment">// 2 Depends on bRequest</span></div>
<div class="line"><a name="l00164"></a><span class="lineno"> 164</span>&#160; <span class="keyword">struct </span>{</div>
<div class="line"><a name="l00165"></a><span class="lineno"><a class="code" href="struct_s_e_t_u_p___p_k_t.html#a68c9436c00560f96e044052c3fb681e9"> 165</a></span>&#160; uint8_t <a class="code" href="struct_s_e_t_u_p___p_k_t.html#a68c9436c00560f96e044052c3fb681e9">wValueLo</a>;</div>
<div class="line"><a name="l00166"></a><span class="lineno"><a class="code" href="struct_s_e_t_u_p___p_k_t.html#a04ea2d151f9edb6575fc159a58f1e443"> 166</a></span>&#160; uint8_t <a class="code" href="struct_s_e_t_u_p___p_k_t.html#a04ea2d151f9edb6575fc159a58f1e443">wValueHi</a>;</div>
<div class="line"><a name="l00167"></a><span class="lineno"> 167</span>&#160; };</div>
<div class="line"><a name="l00168"></a><span class="lineno"> 168</span>&#160; }wVal_u;</div>
<div class="line"><a name="l00169"></a><span class="lineno"><a class="code" href="struct_s_e_t_u_p___p_k_t.html#a299d9f88d294369ea88b48b5026f4c7e"> 169</a></span>&#160; uint16_t <a class="code" href="struct_s_e_t_u_p___p_k_t.html#a299d9f88d294369ea88b48b5026f4c7e">wIndex</a>; <span class="comment">// 4 Depends on bRequest</span></div>
<div class="line"><a name="l00170"></a><span class="lineno"><a class="code" href="struct_s_e_t_u_p___p_k_t.html#a1ec9b19c0ed1e66e399ad9cf3c4a6537"> 170</a></span>&#160; uint16_t <a class="code" href="struct_s_e_t_u_p___p_k_t.html#a1ec9b19c0ed1e66e399ad9cf3c4a6537">wLength</a>; <span class="comment">// 6 Depends on bRequest</span></div>
<div class="line"><a name="l00171"></a><span class="lineno"> 171</span>&#160;} <a class="code" href="struct_s_e_t_u_p___p_k_t.html">SETUP_PKT</a>, *<a class="code" href="_usb_8h.html#af36716855ff65599786d9bdf6e4c11f9">PSETUP_PKT</a>;</div>
<div class="line"><a name="l00172"></a><span class="lineno"> 172</span>&#160;</div>
<div class="line"><a name="l00130"></a><span class="lineno"><a class="code" href="_usb_8h.html#ae7fd7c5bb6dc87f44724dde2ad57df87"> 130</a></span>&#160;<span class="preprocessor">#define USB_STATE_DETACHED 0x10</span></div>
<div class="line"><a name="l00131"></a><span class="lineno"><a class="code" href="_usb_8h.html#a60a744d0f1386e4b28053a41bd6a958f"> 131</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_DETACHED_SUBSTATE_INITIALIZE 0x11</span></div>
<div class="line"><a name="l00132"></a><span class="lineno"><a class="code" href="_usb_8h.html#a3708f4e8166d5d099e1982aa956eacce"> 132</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_DETACHED_SUBSTATE_WAIT_FOR_DEVICE 0x12</span></div>
<div class="line"><a name="l00133"></a><span class="lineno"><a class="code" href="_usb_8h.html#aff6ab2376cd29385b20c2b63d4ddd26d"> 133</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_DETACHED_SUBSTATE_ILLEGAL 0x13</span></div>
<div class="line"><a name="l00134"></a><span class="lineno"><a class="code" href="_usb_8h.html#aaadb20392558e23e3eba073e358a4493"> 134</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_ATTACHED_SUBSTATE_SETTLE 0x20</span></div>
<div class="line"><a name="l00135"></a><span class="lineno"><a class="code" href="_usb_8h.html#ada22633d6de30155a60cb19f6e6452fe"> 135</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_ATTACHED_SUBSTATE_RESET_DEVICE 0x30</span></div>
<div class="line"><a name="l00136"></a><span class="lineno"><a class="code" href="_usb_8h.html#a311f11b79c4020d771cd6930e0a3223d"> 136</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_ATTACHED_SUBSTATE_WAIT_RESET_COMPLETE 0x40</span></div>
<div class="line"><a name="l00137"></a><span class="lineno"><a class="code" href="_usb_8h.html#a2d69537e663e7d5f188004f0d25ec0cc"> 137</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_ATTACHED_SUBSTATE_WAIT_SOF 0x50</span></div>
<div class="line"><a name="l00138"></a><span class="lineno"><a class="code" href="_usb_8h.html#a23ebcbb956f600e06435b28ae0c855d4"> 138</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_ATTACHED_SUBSTATE_GET_DEVICE_DESCRIPTOR_SIZE 0x60</span></div>
<div class="line"><a name="l00139"></a><span class="lineno"><a class="code" href="_usb_8h.html#a474a95baaeb99abd17538c2a1364bf96"> 139</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_STATE_ADDRESSING 0x70</span></div>
<div class="line"><a name="l00140"></a><span class="lineno"><a class="code" href="_usb_8h.html#aac8c844e6a20f42298d70e4438a029e5"> 140</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_STATE_CONFIGURING 0x80</span></div>
<div class="line"><a name="l00141"></a><span class="lineno"><a class="code" href="_usb_8h.html#a138c40c59f628eefbe273a8db0a96753"> 141</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_STATE_RUNNING 0x90</span></div>
<div class="line"><a name="l00142"></a><span class="lineno"><a class="code" href="_usb_8h.html#a6fef5305841ac36f67d8ddb0bd9127d4"> 142</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_STATE_ERROR 0xa0</span></div>
<div class="line"><a name="l00143"></a><span class="lineno"> 143</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00144"></a><span class="lineno"> 144</span>&#160;<span class="comment">/* USB Setup Packet Structure */</span></div>
<div class="line"><a name="l00145"></a><span class="lineno"><a class="code" href="struct_s_e_t_u_p___p_k_t.html"> 145</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span>{</div>
<div class="line"><a name="l00146"></a><span class="lineno"> 146</span>&#160;</div>
<div class="line"><a name="l00147"></a><span class="lineno"> 147</span>&#160; <span class="keyword">union </span>{ <span class="comment">// offset description</span></div>
<div class="line"><a name="l00148"></a><span class="lineno"><a class="code" href="struct_s_e_t_u_p___p_k_t.html#a9bbd6cf5a93a6433d2eb97c59b9102d5"> 148</a></span>&#160; uint8_t <a class="code" href="struct_s_e_t_u_p___p_k_t.html#a9bbd6cf5a93a6433d2eb97c59b9102d5">bmRequestType</a>; <span class="comment">// 0 Bit-map of request type</span></div>
<div class="line"><a name="l00149"></a><span class="lineno"> 149</span>&#160;</div>
<div class="line"><a name="l00150"></a><span class="lineno"> 150</span>&#160; <span class="keyword">struct </span>{</div>
<div class="line"><a name="l00151"></a><span class="lineno"><a class="code" href="struct_s_e_t_u_p___p_k_t.html#a690a55f65b2ce4e69c426b92004a1cc6"> 151</a></span>&#160; uint8_t recipient : 5; <span class="comment">// Recipient of the request</span></div>
<div class="line"><a name="l00152"></a><span class="lineno"><a class="code" href="struct_s_e_t_u_p___p_k_t.html#ad9346ba7b7a4da6829142e23e3ba8a2f"> 152</a></span>&#160; uint8_t type : 2; <span class="comment">// Type of request</span></div>
<div class="line"><a name="l00153"></a><span class="lineno"><a class="code" href="struct_s_e_t_u_p___p_k_t.html#ab50c95fb951cdebc78c3e024de1d6d65"> 153</a></span>&#160; uint8_t direction : 1; <span class="comment">// Direction of data X-fer</span></div>
<div class="line"><a name="l00154"></a><span class="lineno"> 154</span>&#160; } __attribute__((packed));</div>
<div class="line"><a name="l00155"></a><span class="lineno"> 155</span>&#160; } ReqType_u;</div>
<div class="line"><a name="l00156"></a><span class="lineno"><a class="code" href="struct_s_e_t_u_p___p_k_t.html#a321b931277d6ce278416dc5d74059016"> 156</a></span>&#160; uint8_t <a class="code" href="struct_s_e_t_u_p___p_k_t.html#a321b931277d6ce278416dc5d74059016">bRequest</a>; <span class="comment">// 1 Request</span></div>
<div class="line"><a name="l00157"></a><span class="lineno"> 157</span>&#160;</div>
<div class="line"><a name="l00158"></a><span class="lineno"> 158</span>&#160; <span class="keyword">union </span>{</div>
<div class="line"><a name="l00159"></a><span class="lineno"><a class="code" href="struct_s_e_t_u_p___p_k_t.html#a1382f4a10a9b0774f803d1125dd9bb52"> 159</a></span>&#160; uint16_t <a class="code" href="struct_s_e_t_u_p___p_k_t.html#a1382f4a10a9b0774f803d1125dd9bb52">wValue</a>; <span class="comment">// 2 Depends on bRequest</span></div>
<div class="line"><a name="l00160"></a><span class="lineno"> 160</span>&#160;</div>
<div class="line"><a name="l00161"></a><span class="lineno"> 161</span>&#160; <span class="keyword">struct </span>{</div>
<div class="line"><a name="l00162"></a><span class="lineno"><a class="code" href="struct_s_e_t_u_p___p_k_t.html#a68c9436c00560f96e044052c3fb681e9"> 162</a></span>&#160; uint8_t <a class="code" href="struct_s_e_t_u_p___p_k_t.html#a68c9436c00560f96e044052c3fb681e9">wValueLo</a>;</div>
<div class="line"><a name="l00163"></a><span class="lineno"><a class="code" href="struct_s_e_t_u_p___p_k_t.html#a04ea2d151f9edb6575fc159a58f1e443"> 163</a></span>&#160; uint8_t <a class="code" href="struct_s_e_t_u_p___p_k_t.html#a04ea2d151f9edb6575fc159a58f1e443">wValueHi</a>;</div>
<div class="line"><a name="l00164"></a><span class="lineno"> 164</span>&#160; } __attribute__((packed));</div>
<div class="line"><a name="l00165"></a><span class="lineno"> 165</span>&#160; } wVal_u;</div>
<div class="line"><a name="l00166"></a><span class="lineno"><a class="code" href="struct_s_e_t_u_p___p_k_t.html#a299d9f88d294369ea88b48b5026f4c7e"> 166</a></span>&#160; uint16_t <a class="code" href="struct_s_e_t_u_p___p_k_t.html#a299d9f88d294369ea88b48b5026f4c7e">wIndex</a>; <span class="comment">// 4 Depends on bRequest</span></div>
<div class="line"><a name="l00167"></a><span class="lineno"><a class="code" href="struct_s_e_t_u_p___p_k_t.html#a1ec9b19c0ed1e66e399ad9cf3c4a6537"> 167</a></span>&#160; uint16_t <a class="code" href="struct_s_e_t_u_p___p_k_t.html#a1ec9b19c0ed1e66e399ad9cf3c4a6537">wLength</a>; <span class="comment">// 6 Depends on bRequest</span></div>
<div class="line"><a name="l00168"></a><span class="lineno"> 168</span>&#160;} <a class="code" href="struct_s_e_t_u_p___p_k_t.html">SETUP_PKT</a>, *<a class="code" href="struct_s_e_t_u_p___p_k_t.html">PSETUP_PKT</a> __attribute__((packed));</div>
<div class="line"><a name="l00169"></a><span class="lineno"> 169</span>&#160;</div>
<div class="line"><a name="l00170"></a><span class="lineno"> 170</span>&#160;</div>
<div class="line"><a name="l00171"></a><span class="lineno"> 171</span>&#160;</div>
<div class="line"><a name="l00172"></a><span class="lineno"> 172</span>&#160;<span class="comment">// Base class for incomming data parser</span></div>
<div class="line"><a name="l00173"></a><span class="lineno"> 173</span>&#160;</div>
<div class="line"><a name="l00174"></a><span class="lineno"> 174</span>&#160;</div>
<div class="line"><a name="l00175"></a><span class="lineno"> 175</span>&#160;<span class="comment">// Base class for incomming data parser</span></div>
<div class="line"><a name="l00176"></a><span class="lineno"><a class="code" href="class_u_s_b_read_parser.html"> 176</a></span>&#160;<span class="keyword">class </span><a class="code" href="class_u_s_b_read_parser.html">USBReadParser</a></div>
<div class="line"><a name="l00177"></a><span class="lineno"> 177</span>&#160;{</div>
<div class="line"><a name="l00178"></a><span class="lineno"> 178</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00179"></a><span class="lineno"> 179</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_u_s_b_read_parser.html#afdb9cea2a2fe18d26f4ec595b86a7f7c">Parse</a>(<span class="keyword">const</span> uint16_t len, <span class="keyword">const</span> uint8_t *pbuf, <span class="keyword">const</span> uint16_t &amp;offset) = 0;</div>
<div class="line"><a name="l00180"></a><span class="lineno"> 180</span>&#160;};</div>
<div class="line"><a name="l00181"></a><span class="lineno"> 181</span>&#160;</div>
<div class="line"><a name="l00182"></a><span class="lineno"> 182</span>&#160;</div>
<div class="line"><a name="l00183"></a><span class="lineno"><a class="code" href="class_u_s_b.html"> 183</a></span>&#160;<span class="keyword">class </span><a class="code" href="class_u_s_b.html">USB</a> : <span class="keyword">public</span> <a class="code" href="class_m_a_x3421e.html">MAX3421E</a></div>
<div class="line"><a name="l00184"></a><span class="lineno"> 184</span>&#160;{</div>
<div class="line"><a name="l00185"></a><span class="lineno"> 185</span>&#160; <a class="code" href="class_address_pool_impl.html">AddressPoolImpl&lt;USB_NUMDEVICES&gt;</a> addrPool;</div>
<div class="line"><a name="l00186"></a><span class="lineno"> 186</span>&#160; <a class="code" href="class_u_s_b_device_config.html">USBDeviceConfig</a>* devConfig[<a class="code" href="_usb_8h.html#a0282f9f7a0313f957e02449d7313b7b5">USB_NUMDEVICES</a>];</div>
<div class="line"><a name="l00187"></a><span class="lineno"> 187</span>&#160; uint8_t devConfigIndex;</div>
<div class="line"><a name="l00188"></a><span class="lineno"> 188</span>&#160; uint8_t bmHubPre;</div>
<div class="line"><a name="l00189"></a><span class="lineno"> 189</span>&#160;</div>
<div class="line"><a name="l00190"></a><span class="lineno"> 190</span>&#160; <span class="keyword">public</span>:</div>
<div class="line"><a name="l00191"></a><span class="lineno"> 191</span>&#160; <a class="code" href="class_u_s_b.html#a8ff8cd03496bdcb0ca26f18878ad299d">USB</a>( <span class="keywordtype">void</span> );</div>
<div class="line"><a name="l00192"></a><span class="lineno"> 192</span>&#160;</div>
<div class="line"><a name="l00193"></a><span class="lineno"><a class="code" href="class_u_s_b.html#aedcc6c06badd14b6fd3b0dda94269ad4"> 193</a></span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_u_s_b.html#aedcc6c06badd14b6fd3b0dda94269ad4">SetHubPreMask</a>() { bmHubPre |= <a class="code" href="max3421e_8h.html#a8816c259368604d0de57f31bcb6c1674">bmHUBPRE</a>; };</div>
<div class="line"><a name="l00194"></a><span class="lineno"><a class="code" href="class_u_s_b.html#a5b4de045ea7fefe0fab967ddf44c39b1"> 194</a></span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_u_s_b.html#a5b4de045ea7fefe0fab967ddf44c39b1">ResetHubPreMask</a>() { bmHubPre &amp;= (~<a class="code" href="max3421e_8h.html#a8816c259368604d0de57f31bcb6c1674">bmHUBPRE</a>); };</div>
<div class="line"><a name="l00174"></a><span class="lineno"><a class="code" href="class_u_s_b_read_parser.html"> 174</a></span>&#160;<span class="keyword">class </span><a class="code" href="class_u_s_b_read_parser.html">USBReadParser</a> {</div>
<div class="line"><a name="l00175"></a><span class="lineno"> 175</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00176"></a><span class="lineno"> 176</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_u_s_b_read_parser.html#afdb9cea2a2fe18d26f4ec595b86a7f7c">Parse</a>(<span class="keyword">const</span> uint16_t len, <span class="keyword">const</span> uint8_t *pbuf, <span class="keyword">const</span> uint16_t &amp;offset) = 0;</div>
<div class="line"><a name="l00177"></a><span class="lineno"> 177</span>&#160;};</div>
<div class="line"><a name="l00178"></a><span class="lineno"> 178</span>&#160;</div>
<div class="line"><a name="l00179"></a><span class="lineno"><a class="code" href="class_u_s_b.html"> 179</a></span>&#160;<span class="keyword">class </span><a class="code" href="class_u_s_b.html">USB</a> : <span class="keyword">public</span> <a class="code" href="class_m_a_x3421e.html">MAX3421E</a> {</div>
<div class="line"><a name="l00180"></a><span class="lineno"> 180</span>&#160; <a class="code" href="class_address_pool_impl.html">AddressPoolImpl&lt;USB_NUMDEVICES&gt;</a> addrPool;</div>
<div class="line"><a name="l00181"></a><span class="lineno"> 181</span>&#160; <a class="code" href="class_u_s_b_device_config.html">USBDeviceConfig</a>* devConfig[<a class="code" href="_usb_8h.html#a0282f9f7a0313f957e02449d7313b7b5">USB_NUMDEVICES</a>];</div>
<div class="line"><a name="l00182"></a><span class="lineno"> 182</span>&#160; uint8_t devConfigIndex;</div>
<div class="line"><a name="l00183"></a><span class="lineno"> 183</span>&#160; uint8_t bmHubPre;</div>
<div class="line"><a name="l00184"></a><span class="lineno"> 184</span>&#160;</div>
<div class="line"><a name="l00185"></a><span class="lineno"> 185</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00186"></a><span class="lineno"> 186</span>&#160; <a class="code" href="class_u_s_b.html#a8ff8cd03496bdcb0ca26f18878ad299d">USB</a>(<span class="keywordtype">void</span>);</div>
<div class="line"><a name="l00187"></a><span class="lineno"> 187</span>&#160;</div>
<div class="line"><a name="l00188"></a><span class="lineno"><a class="code" href="class_u_s_b.html#aedcc6c06badd14b6fd3b0dda94269ad4"> 188</a></span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_u_s_b.html#aedcc6c06badd14b6fd3b0dda94269ad4">SetHubPreMask</a>() {</div>
<div class="line"><a name="l00189"></a><span class="lineno"> 189</span>&#160; bmHubPre |= <a class="code" href="max3421e_8h.html#a8816c259368604d0de57f31bcb6c1674">bmHUBPRE</a>;</div>
<div class="line"><a name="l00190"></a><span class="lineno"> 190</span>&#160; };</div>
<div class="line"><a name="l00191"></a><span class="lineno"> 191</span>&#160;</div>
<div class="line"><a name="l00192"></a><span class="lineno"><a class="code" href="class_u_s_b.html#a5b4de045ea7fefe0fab967ddf44c39b1"> 192</a></span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_u_s_b.html#a5b4de045ea7fefe0fab967ddf44c39b1">ResetHubPreMask</a>() {</div>
<div class="line"><a name="l00193"></a><span class="lineno"> 193</span>&#160; bmHubPre &amp;= (~<a class="code" href="max3421e_8h.html#a8816c259368604d0de57f31bcb6c1674">bmHUBPRE</a>);</div>
<div class="line"><a name="l00194"></a><span class="lineno"> 194</span>&#160; };</div>
<div class="line"><a name="l00195"></a><span class="lineno"> 195</span>&#160;</div>
<div class="line"><a name="l00196"></a><span class="lineno"><a class="code" href="class_u_s_b.html#a66ab8f5eda239e761d5a48741ea1f9d4"> 196</a></span>&#160; <a class="code" href="class_address_pool.html">AddressPool</a>&amp; <a class="code" href="class_u_s_b.html#a66ab8f5eda239e761d5a48741ea1f9d4">GetAddressPool</a>()</div>
<div class="line"><a name="l00197"></a><span class="lineno"> 197</span>&#160; {</div>
<div class="line"><a name="l00198"></a><span class="lineno"> 198</span>&#160; <span class="keywordflow">return</span> (<a class="code" href="class_address_pool.html">AddressPool</a>&amp;)addrPool;</div>
<div class="line"><a name="l00199"></a><span class="lineno"> 199</span>&#160; };</div>
<div class="line"><a name="l00200"></a><span class="lineno"><a class="code" href="class_u_s_b.html#a3f66bf622590413ef2e1864f93a3e0d2"> 200</a></span>&#160; uint8_t <a class="code" href="class_u_s_b.html#a3f66bf622590413ef2e1864f93a3e0d2">RegisterDeviceClass</a>(<a class="code" href="class_u_s_b_device_config.html">USBDeviceConfig</a> *pdev)</div>
<div class="line"><a name="l00201"></a><span class="lineno"> 201</span>&#160; {</div>
<div class="line"><a name="l00202"></a><span class="lineno"> 202</span>&#160; <span class="keywordflow">for</span> (uint8_t i=0; i&lt;<a class="code" href="_usb_8h.html#a0282f9f7a0313f957e02449d7313b7b5">USB_NUMDEVICES</a>; i++)</div>
<div class="line"><a name="l00203"></a><span class="lineno"> 203</span>&#160; {</div>
<div class="line"><a name="l00204"></a><span class="lineno"> 204</span>&#160; <span class="keywordflow">if</span> (!devConfig[i])</div>
<div class="line"><a name="l00205"></a><span class="lineno"> 205</span>&#160; {</div>
<div class="line"><a name="l00206"></a><span class="lineno"> 206</span>&#160; devConfig[i] = pdev;</div>
<div class="line"><a name="l00207"></a><span class="lineno"> 207</span>&#160; <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00208"></a><span class="lineno"> 208</span>&#160; }</div>
<div class="line"><a name="l00209"></a><span class="lineno"> 209</span>&#160; }</div>
<div class="line"><a name="l00210"></a><span class="lineno"> 210</span>&#160; <span class="keywordflow">return</span> <a class="code" href="_usb_8h.html#ad4929f74079f3bc22b00936ae84d18b0">USB_ERROR_UNABLE_TO_REGISTER_DEVICE_CLASS</a>;</div>
<div class="line"><a name="l00211"></a><span class="lineno"> 211</span>&#160; };</div>
<div class="line"><a name="l00212"></a><span class="lineno"><a class="code" href="class_u_s_b.html#a8346db8f2219f65257d735834940bc42"> 212</a></span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_u_s_b.html#a8346db8f2219f65257d735834940bc42">ForEachUsbDevice</a>(<a class="code" href="address_8h.html#a90edb051235924cb5280032df397f393">UsbDeviceHandleFunc</a> pfunc)</div>
<div class="line"><a name="l00213"></a><span class="lineno"> 213</span>&#160; {</div>
<div class="line"><a name="l00214"></a><span class="lineno"> 214</span>&#160; addrPool.<a class="code" href="class_address_pool_impl.html#a09e6dc797f82543eba0879369116182e">ForEachUsbDevice</a>(pfunc);</div>
<div class="line"><a name="l00215"></a><span class="lineno"> 215</span>&#160; };</div>
<div class="line"><a name="l00216"></a><span class="lineno"> 216</span>&#160; uint8_t <a class="code" href="class_u_s_b.html#a1c1aad8269403bf488e3bc4c79886ce4">getUsbTaskState</a>( <span class="keywordtype">void</span> );</div>
<div class="line"><a name="l00217"></a><span class="lineno"> 217</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_u_s_b.html#a8ff697d334dc611720419374acd1e5fb">setUsbTaskState</a>( uint8_t state );</div>
<div class="line"><a name="l00196"></a><span class="lineno"><a class="code" href="class_u_s_b.html#a66ab8f5eda239e761d5a48741ea1f9d4"> 196</a></span>&#160; <a class="code" href="class_address_pool.html">AddressPool</a>&amp; <a class="code" href="class_u_s_b.html#a66ab8f5eda239e761d5a48741ea1f9d4">GetAddressPool</a>() {</div>
<div class="line"><a name="l00197"></a><span class="lineno"> 197</span>&#160; <span class="keywordflow">return</span>(<a class="code" href="class_address_pool.html">AddressPool</a>&amp;) addrPool;</div>
<div class="line"><a name="l00198"></a><span class="lineno"> 198</span>&#160; };</div>
<div class="line"><a name="l00199"></a><span class="lineno"> 199</span>&#160;</div>
<div class="line"><a name="l00200"></a><span class="lineno"><a class="code" href="class_u_s_b.html#a3f66bf622590413ef2e1864f93a3e0d2"> 200</a></span>&#160; uint8_t <a class="code" href="class_u_s_b.html#a3f66bf622590413ef2e1864f93a3e0d2">RegisterDeviceClass</a>(<a class="code" href="class_u_s_b_device_config.html">USBDeviceConfig</a> *pdev) {</div>
<div class="line"><a name="l00201"></a><span class="lineno"> 201</span>&#160; <span class="keywordflow">for</span>(uint8_t i = 0; i &lt; <a class="code" href="_usb_8h.html#a0282f9f7a0313f957e02449d7313b7b5">USB_NUMDEVICES</a>; i++) {</div>
<div class="line"><a name="l00202"></a><span class="lineno"> 202</span>&#160; <span class="keywordflow">if</span>(!devConfig[i]) {</div>
<div class="line"><a name="l00203"></a><span class="lineno"> 203</span>&#160; devConfig[i] = pdev;</div>
<div class="line"><a name="l00204"></a><span class="lineno"> 204</span>&#160; <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00205"></a><span class="lineno"> 205</span>&#160; }</div>
<div class="line"><a name="l00206"></a><span class="lineno"> 206</span>&#160; }</div>
<div class="line"><a name="l00207"></a><span class="lineno"> 207</span>&#160; <span class="keywordflow">return</span> <a class="code" href="_usb_8h.html#ad4929f74079f3bc22b00936ae84d18b0">USB_ERROR_UNABLE_TO_REGISTER_DEVICE_CLASS</a>;</div>
<div class="line"><a name="l00208"></a><span class="lineno"> 208</span>&#160; };</div>
<div class="line"><a name="l00209"></a><span class="lineno"> 209</span>&#160;</div>
<div class="line"><a name="l00210"></a><span class="lineno"><a class="code" href="class_u_s_b.html#a8346db8f2219f65257d735834940bc42"> 210</a></span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_u_s_b.html#a8346db8f2219f65257d735834940bc42">ForEachUsbDevice</a>(<a class="code" href="address_8h.html#a90edb051235924cb5280032df397f393">UsbDeviceHandleFunc</a> pfunc) {</div>
<div class="line"><a name="l00211"></a><span class="lineno"> 211</span>&#160; addrPool.<a class="code" href="class_address_pool_impl.html#a09e6dc797f82543eba0879369116182e">ForEachUsbDevice</a>(pfunc);</div>
<div class="line"><a name="l00212"></a><span class="lineno"> 212</span>&#160; };</div>
<div class="line"><a name="l00213"></a><span class="lineno"> 213</span>&#160; uint8_t <a class="code" href="class_u_s_b.html#a1c1aad8269403bf488e3bc4c79886ce4">getUsbTaskState</a>(<span class="keywordtype">void</span>);</div>
<div class="line"><a name="l00214"></a><span class="lineno"> 214</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_u_s_b.html#a8ff697d334dc611720419374acd1e5fb">setUsbTaskState</a>(uint8_t state);</div>
<div class="line"><a name="l00215"></a><span class="lineno"> 215</span>&#160;</div>
<div class="line"><a name="l00216"></a><span class="lineno"> 216</span>&#160; <a class="code" href="struct_ep_info.html">EpInfo</a>* <a class="code" href="class_u_s_b.html#a59ee57083ba492d87ff2947547848d58">getEpInfoEntry</a>(uint8_t addr, uint8_t ep);</div>
<div class="line"><a name="l00217"></a><span class="lineno"> 217</span>&#160; uint8_t <a class="code" href="class_u_s_b.html#a6c3ba3f7e6dccb450267011ce783d7ea">setEpInfoEntry</a>(uint8_t addr, uint8_t epcount, <a class="code" href="struct_ep_info.html">EpInfo</a>* eprecord_ptr);</div>
<div class="line"><a name="l00218"></a><span class="lineno"> 218</span>&#160;</div>
<div class="line"><a name="l00219"></a><span class="lineno"> 219</span>&#160; <a class="code" href="struct_ep_info.html">EpInfo</a>* <a class="code" href="class_u_s_b.html#a59ee57083ba492d87ff2947547848d58">getEpInfoEntry</a>( uint8_t addr, uint8_t ep );</div>
<div class="line"><a name="l00220"></a><span class="lineno"> 220</span>&#160; uint8_t <a class="code" href="class_u_s_b.html#a6c3ba3f7e6dccb450267011ce783d7ea">setEpInfoEntry</a>( uint8_t addr, uint8_t epcount, <a class="code" href="struct_ep_info.html">EpInfo</a>* eprecord_ptr );</div>
<div class="line"><a name="l00221"></a><span class="lineno"> 221</span>&#160;</div>
<div class="line"><a name="l00222"></a><span class="lineno"> 222</span>&#160; <span class="comment">//uint8_t ctrlReq( uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi, uint16_t wInd, uint16_t nbytes, uint8_t* dataptr);</span></div>
<div class="line"><a name="l00223"></a><span class="lineno"> 223</span>&#160;</div>
<div class="line"><a name="l00224"></a><span class="lineno"> 224</span>&#160; <span class="comment">/* Control requests */</span></div>
<div class="line"><a name="l00225"></a><span class="lineno"> 225</span>&#160; uint8_t <a class="code" href="class_u_s_b.html#a193e63c149fad46adabd77ceb09b2b24" title="defined(USB_METHODS_INLINE)">getDevDescr</a>( uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* dataptr );</div>
<div class="line"><a name="l00226"></a><span class="lineno"> 226</span>&#160; uint8_t <a class="code" href="class_u_s_b.html#a618eedabc161d8315be45cae0c8b6f89">getConfDescr</a>( uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t* dataptr );</div>
<div class="line"><a name="l00227"></a><span class="lineno"> 227</span>&#160;</div>
<div class="line"><a name="l00228"></a><span class="lineno"> 228</span>&#160; uint8_t <a class="code" href="class_u_s_b.html#a618eedabc161d8315be45cae0c8b6f89">getConfDescr</a>( uint8_t addr, uint8_t ep, uint8_t conf, <a class="code" href="class_u_s_b_read_parser.html">USBReadParser</a> *p );</div>
<div class="line"><a name="l00229"></a><span class="lineno"> 229</span>&#160;</div>
<div class="line"><a name="l00230"></a><span class="lineno"> 230</span>&#160; uint8_t <a class="code" href="class_u_s_b.html#a372ecbe1d23955e8b04b5e95e0e4a833">getStrDescr</a>( uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t index, uint16_t langid, uint8_t* dataptr );</div>
<div class="line"><a name="l00231"></a><span class="lineno"> 231</span>&#160; uint8_t <a class="code" href="class_u_s_b.html#a3aea534daed66b5606fa798df7ad3c47">setAddr</a>( uint8_t oldaddr, uint8_t ep, uint8_t newaddr );</div>
<div class="line"><a name="l00232"></a><span class="lineno"> 232</span>&#160; uint8_t <a class="code" href="class_u_s_b.html#a31e2c132ec32ffdde94dff72be87c378">setConf</a>( uint8_t addr, uint8_t ep, uint8_t conf_value );</div>
<div class="line"><a name="l00233"></a><span class="lineno"> 233</span>&#160; </div>
<div class="line"><a name="l00234"></a><span class="lineno"> 234</span>&#160; uint8_t <a class="code" href="class_u_s_b.html#a994f9488ac6f91040c42d9b816d202c6">ctrlData</a>( uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* dataptr, <span class="keywordtype">boolean</span> direction );</div>
<div class="line"><a name="l00235"></a><span class="lineno"> 235</span>&#160; uint8_t <a class="code" href="class_u_s_b.html#ab18915ffbd8a70ac5bd6abc3e0f3c66a">ctrlStatus</a>( uint8_t ep, <span class="keywordtype">boolean</span> direction, uint16_t nak_limit );</div>
<div class="line"><a name="l00236"></a><span class="lineno"> 236</span>&#160; uint8_t <a class="code" href="class_u_s_b.html#ad75d64f648b102fab2bd75e53e1324a4">inTransfer</a>( uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t* data );</div>
<div class="line"><a name="l00237"></a><span class="lineno"> 237</span>&#160; uint8_t <a class="code" href="class_u_s_b.html#affbc018973a588995457d535b0ac7ee7">outTransfer</a>( uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* data );</div>
<div class="line"><a name="l00238"></a><span class="lineno"> 238</span>&#160; uint8_t <a class="code" href="class_u_s_b.html#a343d4b321cf8e99f0504cb04c7ce8b10">dispatchPkt</a>( uint8_t token, uint8_t ep, uint16_t nak_limit );</div>
<div class="line"><a name="l00239"></a><span class="lineno"> 239</span>&#160;</div>
<div class="line"><a name="l00240"></a><span class="lineno"> 240</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_u_s_b.html#aff8d1b2009c760bc27fb12762bd3c9b6">Task</a>( <span class="keywordtype">void</span> );</div>
<div class="line"><a name="l00241"></a><span class="lineno"> 241</span>&#160;</div>
<div class="line"><a name="l00242"></a><span class="lineno"> 242</span>&#160; uint8_t <a class="code" href="class_u_s_b.html#a5eb0d31372d26f0015a0d7be0b9ff4e1">DefaultAddressing</a>(uint8_t parent, uint8_t port, <span class="keywordtype">bool</span> lowspeed);</div>
<div class="line"><a name="l00243"></a><span class="lineno"> 243</span>&#160; uint8_t <a class="code" href="class_u_s_b.html#af4008dfc1c2d15c23cf8a7815cc17765">Configuring</a>(uint8_t parent, uint8_t port, <span class="keywordtype">bool</span> lowspeed);</div>
<div class="line"><a name="l00244"></a><span class="lineno"> 244</span>&#160; uint8_t <a class="code" href="class_u_s_b.html#ac681c6c98e1641f705bc14d670a2663a">ReleaseDevice</a>(uint8_t addr);</div>
<div class="line"><a name="l00219"></a><span class="lineno"> 219</span>&#160; <span class="comment">//uint8_t ctrlReq( uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi, uint16_t wInd, uint16_t nbytes, uint8_t* dataptr);</span></div>
<div class="line"><a name="l00220"></a><span class="lineno"> 220</span>&#160;</div>
<div class="line"><a name="l00221"></a><span class="lineno"> 221</span>&#160; <span class="comment">/* Control requests */</span></div>
<div class="line"><a name="l00222"></a><span class="lineno"> 222</span>&#160; uint8_t <a class="code" href="class_u_s_b.html#a193e63c149fad46adabd77ceb09b2b24" title="defined(USB_METHODS_INLINE)">getDevDescr</a>(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* dataptr);</div>
<div class="line"><a name="l00223"></a><span class="lineno"> 223</span>&#160; uint8_t <a class="code" href="class_u_s_b.html#a618eedabc161d8315be45cae0c8b6f89">getConfDescr</a>(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t* dataptr);</div>
<div class="line"><a name="l00224"></a><span class="lineno"> 224</span>&#160;</div>
<div class="line"><a name="l00225"></a><span class="lineno"> 225</span>&#160; uint8_t <a class="code" href="class_u_s_b.html#a618eedabc161d8315be45cae0c8b6f89">getConfDescr</a>(uint8_t addr, uint8_t ep, uint8_t conf, <a class="code" href="class_u_s_b_read_parser.html">USBReadParser</a> *p);</div>
<div class="line"><a name="l00226"></a><span class="lineno"> 226</span>&#160;</div>
<div class="line"><a name="l00227"></a><span class="lineno"> 227</span>&#160; uint8_t <a class="code" href="class_u_s_b.html#a372ecbe1d23955e8b04b5e95e0e4a833">getStrDescr</a>(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t index, uint16_t langid, uint8_t* dataptr);</div>
<div class="line"><a name="l00228"></a><span class="lineno"> 228</span>&#160; uint8_t <a class="code" href="class_u_s_b.html#a3aea534daed66b5606fa798df7ad3c47">setAddr</a>(uint8_t oldaddr, uint8_t ep, uint8_t newaddr);</div>
<div class="line"><a name="l00229"></a><span class="lineno"> 229</span>&#160; uint8_t <a class="code" href="class_u_s_b.html#a31e2c132ec32ffdde94dff72be87c378">setConf</a>(uint8_t addr, uint8_t ep, uint8_t conf_value);</div>
<div class="line"><a name="l00230"></a><span class="lineno"> 230</span>&#160; </div>
<div class="line"><a name="l00231"></a><span class="lineno"> 231</span>&#160; uint8_t <a class="code" href="class_u_s_b.html#a994f9488ac6f91040c42d9b816d202c6">ctrlData</a>(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* dataptr, <span class="keywordtype">boolean</span> direction);</div>
<div class="line"><a name="l00232"></a><span class="lineno"> 232</span>&#160; uint8_t <a class="code" href="class_u_s_b.html#ab18915ffbd8a70ac5bd6abc3e0f3c66a">ctrlStatus</a>(uint8_t ep, <span class="keywordtype">boolean</span> direction, uint16_t nak_limit);</div>
<div class="line"><a name="l00233"></a><span class="lineno"> 233</span>&#160; uint8_t <a class="code" href="class_u_s_b.html#ad75d64f648b102fab2bd75e53e1324a4">inTransfer</a>(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t* data);</div>
<div class="line"><a name="l00234"></a><span class="lineno"> 234</span>&#160; uint8_t <a class="code" href="class_u_s_b.html#affbc018973a588995457d535b0ac7ee7">outTransfer</a>(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* data);</div>
<div class="line"><a name="l00235"></a><span class="lineno"> 235</span>&#160; uint8_t <a class="code" href="class_u_s_b.html#a343d4b321cf8e99f0504cb04c7ce8b10">dispatchPkt</a>(uint8_t token, uint8_t ep, uint16_t nak_limit);</div>
<div class="line"><a name="l00236"></a><span class="lineno"> 236</span>&#160;</div>
<div class="line"><a name="l00237"></a><span class="lineno"> 237</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_u_s_b.html#aff8d1b2009c760bc27fb12762bd3c9b6">Task</a>(<span class="keywordtype">void</span>);</div>
<div class="line"><a name="l00238"></a><span class="lineno"> 238</span>&#160;</div>
<div class="line"><a name="l00239"></a><span class="lineno"> 239</span>&#160; uint8_t <a class="code" href="class_u_s_b.html#a5eb0d31372d26f0015a0d7be0b9ff4e1">DefaultAddressing</a>(uint8_t parent, uint8_t port, <span class="keywordtype">bool</span> lowspeed);</div>
<div class="line"><a name="l00240"></a><span class="lineno"> 240</span>&#160; uint8_t <a class="code" href="class_u_s_b.html#af4008dfc1c2d15c23cf8a7815cc17765">Configuring</a>(uint8_t parent, uint8_t port, <span class="keywordtype">bool</span> lowspeed);</div>
<div class="line"><a name="l00241"></a><span class="lineno"> 241</span>&#160; uint8_t <a class="code" href="class_u_s_b.html#ac681c6c98e1641f705bc14d670a2663a">ReleaseDevice</a>(uint8_t addr);</div>
<div class="line"><a name="l00242"></a><span class="lineno"> 242</span>&#160;</div>
<div class="line"><a name="l00243"></a><span class="lineno"> 243</span>&#160; uint8_t <a class="code" href="class_u_s_b.html#a636695a5c3d35cd6b9e31c54edfacd7c">ctrlReq</a>(uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi,</div>
<div class="line"><a name="l00244"></a><span class="lineno"> 244</span>&#160; uint16_t wInd, uint16_t total, uint16_t nbytes, uint8_t* dataptr, <a class="code" href="class_u_s_b_read_parser.html">USBReadParser</a> *p);</div>
<div class="line"><a name="l00245"></a><span class="lineno"> 245</span>&#160;</div>
<div class="line"><a name="l00246"></a><span class="lineno"> 246</span>&#160; uint8_t <a class="code" href="class_u_s_b.html#a636695a5c3d35cd6b9e31c54edfacd7c">ctrlReq</a>( uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi, </div>
<div class="line"><a name="l00247"></a><span class="lineno"> 247</span>&#160; uint16_t wInd, uint16_t total, uint16_t nbytes, uint8_t* dataptr, <a class="code" href="class_u_s_b_read_parser.html">USBReadParser</a> *p);</div>
<div class="line"><a name="l00248"></a><span class="lineno"> 248</span>&#160;</div>
<div class="line"><a name="l00249"></a><span class="lineno"> 249</span>&#160; <span class="keyword">private</span>:</div>
<div class="line"><a name="l00250"></a><span class="lineno"> 250</span>&#160; <span class="keywordtype">void</span> init();</div>
<div class="line"><a name="l00251"></a><span class="lineno"> 251</span>&#160; uint8_t SetAddress(uint8_t addr, uint8_t ep, <a class="code" href="struct_ep_info.html">EpInfo</a> **ppep, uint16_t &amp;nak_limit);</div>
<div class="line"><a name="l00252"></a><span class="lineno"> 252</span>&#160; uint8_t OutTransfer(<a class="code" href="struct_ep_info.html">EpInfo</a> *pep, uint16_t nak_limit, uint16_t nbytes, uint8_t *data);</div>
<div class="line"><a name="l00253"></a><span class="lineno"> 253</span>&#160; uint8_t InTransfer (<a class="code" href="struct_ep_info.html">EpInfo</a> *pep, uint16_t nak_limit, uint16_t *nbytesptr, uint8_t *data);</div>
<div class="line"><a name="l00254"></a><span class="lineno"> 254</span>&#160;};</div>
<div class="line"><a name="l00246"></a><span class="lineno"> 246</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00247"></a><span class="lineno"> 247</span>&#160; <span class="keywordtype">void</span> init();</div>
<div class="line"><a name="l00248"></a><span class="lineno"> 248</span>&#160; uint8_t SetAddress(uint8_t addr, uint8_t ep, <a class="code" href="struct_ep_info.html">EpInfo</a> **ppep, uint16_t &amp;nak_limit);</div>
<div class="line"><a name="l00249"></a><span class="lineno"> 249</span>&#160; uint8_t OutTransfer(<a class="code" href="struct_ep_info.html">EpInfo</a> *pep, uint16_t nak_limit, uint16_t nbytes, uint8_t *data);</div>
<div class="line"><a name="l00250"></a><span class="lineno"> 250</span>&#160; uint8_t InTransfer(<a class="code" href="struct_ep_info.html">EpInfo</a> *pep, uint16_t nak_limit, uint16_t *nbytesptr, uint8_t *data);</div>
<div class="line"><a name="l00251"></a><span class="lineno"> 251</span>&#160;};</div>
<div class="line"><a name="l00252"></a><span class="lineno"> 252</span>&#160;</div>
<div class="line"><a name="l00253"></a><span class="lineno"> 253</span>&#160;<span class="preprocessor">#if 0 //defined(USB_METHODS_INLINE)</span></div>
<div class="line"><a name="l00254"></a><span class="lineno"> 254</span>&#160;<span class="preprocessor"></span><span class="comment">//get device descriptor</span></div>
<div class="line"><a name="l00255"></a><span class="lineno"> 255</span>&#160;</div>
<div class="line"><a name="l00256"></a><span class="lineno"> 256</span>&#160;<span class="preprocessor">#if 0 //defined(USB_METHODS_INLINE)</span></div>
<div class="line"><a name="l00257"></a><span class="lineno"> 257</span>&#160;<span class="preprocessor"></span><span class="comment">//get device descriptor</span></div>
<div class="line"><a name="l00258"></a><span class="lineno"> 258</span>&#160;<span class="keyword">inline</span> uint8_t <a class="code" href="class_u_s_b.html#a193e63c149fad46adabd77ceb09b2b24" title="defined(USB_METHODS_INLINE)">USB::getDevDescr</a>( uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* dataptr ) </div>
<div class="line"><a name="l00259"></a><span class="lineno"> 259</span>&#160;{</div>
<div class="line"><a name="l00260"></a><span class="lineno"> 260</span>&#160; <span class="keywordflow">return</span>( <a class="code" href="class_u_s_b.html#a636695a5c3d35cd6b9e31c54edfacd7c">ctrlReq</a>( addr, ep, <a class="code" href="_usb_8h.html#a060f3a6423f1e3640aa7b14d5ce72285">bmREQ_GET_DESCR</a>, <a class="code" href="usb__ch9_8h.html#a3572226ee2137c7fbf7487a02b0f560f">USB_REQUEST_GET_DESCRIPTOR</a>, 0x00, <a class="code" href="usb__ch9_8h.html#ac6d0566773ed4549fe1a7a932e6c46de">USB_DESCRIPTOR_DEVICE</a>, 0x0000, nbytes, dataptr ));</div>
<div class="line"><a name="l00261"></a><span class="lineno"> 261</span>&#160;}</div>
<div class="line"><a name="l00262"></a><span class="lineno"> 262</span>&#160;<span class="comment">//get configuration descriptor </span></div>
<div class="line"><a name="l00263"></a><span class="lineno"> 263</span>&#160;<span class="keyword">inline</span> uint8_t <a class="code" href="class_u_s_b.html#a618eedabc161d8315be45cae0c8b6f89">USB::getConfDescr</a>( uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t* dataptr ) </div>
<div class="line"><a name="l00264"></a><span class="lineno"> 264</span>&#160;{</div>
<div class="line"><a name="l00265"></a><span class="lineno"> 265</span>&#160; <span class="keywordflow">return</span>( <a class="code" href="class_u_s_b.html#a636695a5c3d35cd6b9e31c54edfacd7c">ctrlReq</a>( addr, ep, <a class="code" href="_usb_8h.html#a060f3a6423f1e3640aa7b14d5ce72285">bmREQ_GET_DESCR</a>, <a class="code" href="usb__ch9_8h.html#a3572226ee2137c7fbf7487a02b0f560f">USB_REQUEST_GET_DESCRIPTOR</a>, conf, <a class="code" href="usb__ch9_8h.html#aa17b365c4eb8bd2f6a4d4e4fb5f881c7">USB_DESCRIPTOR_CONFIGURATION</a>, 0x0000, nbytes, dataptr ));</div>
<div class="line"><a name="l00266"></a><span class="lineno"> 266</span>&#160;}</div>
<div class="line"><a name="l00267"></a><span class="lineno"> 267</span>&#160;<span class="comment">//get string descriptor</span></div>
<div class="line"><a name="l00268"></a><span class="lineno"> 268</span>&#160;<span class="keyword">inline</span> uint8_t <a class="code" href="class_u_s_b.html#a372ecbe1d23955e8b04b5e95e0e4a833">USB::getStrDescr</a>( uint8_t addr, uint8_t ep, uint16_t nuint8_ts, uint8_t index, uint16_t langid, uint8_t* dataptr ) </div>
<div class="line"><a name="l00269"></a><span class="lineno"> 269</span>&#160;{</div>
<div class="line"><a name="l00270"></a><span class="lineno"> 270</span>&#160; <span class="keywordflow">return</span>( <a class="code" href="class_u_s_b.html#a636695a5c3d35cd6b9e31c54edfacd7c">ctrlReq</a>( addr, ep, <a class="code" href="_usb_8h.html#a060f3a6423f1e3640aa7b14d5ce72285">bmREQ_GET_DESCR</a>, <a class="code" href="usb__ch9_8h.html#a3572226ee2137c7fbf7487a02b0f560f">USB_REQUEST_GET_DESCRIPTOR</a>, index, <a class="code" href="usb__ch9_8h.html#abbad38caa1ca9c52f47adccd3a850aed">USB_DESCRIPTOR_STRING</a>, langid, nuint8_ts, dataptr ));</div>
<div class="line"><a name="l00271"></a><span class="lineno"> 271</span>&#160;}</div>
<div class="line"><a name="l00272"></a><span class="lineno"> 272</span>&#160;<span class="comment">//set address </span></div>
<div class="line"><a name="l00273"></a><span class="lineno"> 273</span>&#160;<span class="keyword">inline</span> uint8_t <a class="code" href="class_u_s_b.html#a3aea534daed66b5606fa798df7ad3c47">USB::setAddr</a>( uint8_t oldaddr, uint8_t ep, uint8_t newaddr ) </div>
<div class="line"><a name="l00274"></a><span class="lineno"> 274</span>&#160;{</div>
<div class="line"><a name="l00275"></a><span class="lineno"> 275</span>&#160; <span class="keywordflow">return</span>( <a class="code" href="class_u_s_b.html#a636695a5c3d35cd6b9e31c54edfacd7c">ctrlReq</a>( oldaddr, ep, <a class="code" href="_usb_8h.html#af4965e768593007eacde7644979f56da">bmREQ_SET</a>, <a class="code" href="usb__ch9_8h.html#ac87659819bfd6491120c819fae2d46bc">USB_REQUEST_SET_ADDRESS</a>, newaddr, 0x00, 0x0000, 0x0000, NULL ));</div>
<div class="line"><a name="l00276"></a><span class="lineno"> 276</span>&#160;}</div>
<div class="line"><a name="l00277"></a><span class="lineno"> 277</span>&#160;<span class="comment">//set configuration</span></div>
<div class="line"><a name="l00278"></a><span class="lineno"> 278</span>&#160;<span class="keyword">inline</span> uint8_t <a class="code" href="class_u_s_b.html#a31e2c132ec32ffdde94dff72be87c378">USB::setConf</a>( uint8_t addr, uint8_t ep, uint8_t conf_value ) </div>
<div class="line"><a name="l00279"></a><span class="lineno"> 279</span>&#160;{</div>
<div class="line"><a name="l00280"></a><span class="lineno"> 280</span>&#160; <span class="keywordflow">return</span>( <a class="code" href="class_u_s_b.html#a636695a5c3d35cd6b9e31c54edfacd7c">ctrlReq</a>( addr, ep, <a class="code" href="_usb_8h.html#af4965e768593007eacde7644979f56da">bmREQ_SET</a>, <a class="code" href="usb__ch9_8h.html#aadef005acc40340955d34d9767ef297c">USB_REQUEST_SET_CONFIGURATION</a>, conf_value, 0x00, 0x0000, 0x0000, NULL )); </div>
<div class="line"><a name="l00281"></a><span class="lineno"> 281</span>&#160;}</div>
<div class="line"><a name="l00282"></a><span class="lineno"> 282</span>&#160;</div>
<div class="line"><a name="l00283"></a><span class="lineno"> 283</span>&#160;<span class="preprocessor">#endif // defined(USB_METHODS_INLINE)</span></div>
<div class="line"><a name="l00284"></a><span class="lineno"> 284</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00285"></a><span class="lineno"> 285</span>&#160;<span class="preprocessor">#endif //_usb_h_</span></div>
<div class="line"><a name="l00256"></a><span class="lineno"> 256</span>&#160;<span class="keyword">inline</span> uint8_t <a class="code" href="class_u_s_b.html#a193e63c149fad46adabd77ceb09b2b24" title="defined(USB_METHODS_INLINE)">USB::getDevDescr</a>(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* dataptr) {</div>
<div class="line"><a name="l00257"></a><span class="lineno"> 257</span>&#160; <span class="keywordflow">return</span>( <a class="code" href="class_u_s_b.html#a636695a5c3d35cd6b9e31c54edfacd7c">ctrlReq</a>(addr, ep, <a class="code" href="_usb_8h.html#a060f3a6423f1e3640aa7b14d5ce72285">bmREQ_GET_DESCR</a>, <a class="code" href="usb__ch9_8h.html#a3572226ee2137c7fbf7487a02b0f560f">USB_REQUEST_GET_DESCRIPTOR</a>, 0x00, <a class="code" href="usb__ch9_8h.html#ac6d0566773ed4549fe1a7a932e6c46de">USB_DESCRIPTOR_DEVICE</a>, 0x0000, nbytes, dataptr));</div>
<div class="line"><a name="l00258"></a><span class="lineno"> 258</span>&#160;}</div>
<div class="line"><a name="l00259"></a><span class="lineno"> 259</span>&#160;<span class="comment">//get configuration descriptor</span></div>
<div class="line"><a name="l00260"></a><span class="lineno"> 260</span>&#160;</div>
<div class="line"><a name="l00261"></a><span class="lineno"> 261</span>&#160;<span class="keyword">inline</span> uint8_t <a class="code" href="class_u_s_b.html#a618eedabc161d8315be45cae0c8b6f89">USB::getConfDescr</a>(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t* dataptr) {</div>
<div class="line"><a name="l00262"></a><span class="lineno"> 262</span>&#160; <span class="keywordflow">return</span>( <a class="code" href="class_u_s_b.html#a636695a5c3d35cd6b9e31c54edfacd7c">ctrlReq</a>(addr, ep, <a class="code" href="_usb_8h.html#a060f3a6423f1e3640aa7b14d5ce72285">bmREQ_GET_DESCR</a>, <a class="code" href="usb__ch9_8h.html#a3572226ee2137c7fbf7487a02b0f560f">USB_REQUEST_GET_DESCRIPTOR</a>, conf, <a class="code" href="usb__ch9_8h.html#aa17b365c4eb8bd2f6a4d4e4fb5f881c7">USB_DESCRIPTOR_CONFIGURATION</a>, 0x0000, nbytes, dataptr));</div>
<div class="line"><a name="l00263"></a><span class="lineno"> 263</span>&#160;}</div>
<div class="line"><a name="l00264"></a><span class="lineno"> 264</span>&#160;<span class="comment">//get string descriptor</span></div>
<div class="line"><a name="l00265"></a><span class="lineno"> 265</span>&#160;</div>
<div class="line"><a name="l00266"></a><span class="lineno"> 266</span>&#160;<span class="keyword">inline</span> uint8_t <a class="code" href="class_u_s_b.html#a372ecbe1d23955e8b04b5e95e0e4a833">USB::getStrDescr</a>(uint8_t addr, uint8_t ep, uint16_t nuint8_ts, uint8_t index, uint16_t langid, uint8_t* dataptr) {</div>
<div class="line"><a name="l00267"></a><span class="lineno"> 267</span>&#160; <span class="keywordflow">return</span>( <a class="code" href="class_u_s_b.html#a636695a5c3d35cd6b9e31c54edfacd7c">ctrlReq</a>(addr, ep, <a class="code" href="_usb_8h.html#a060f3a6423f1e3640aa7b14d5ce72285">bmREQ_GET_DESCR</a>, <a class="code" href="usb__ch9_8h.html#a3572226ee2137c7fbf7487a02b0f560f">USB_REQUEST_GET_DESCRIPTOR</a>, index, <a class="code" href="usb__ch9_8h.html#abbad38caa1ca9c52f47adccd3a850aed">USB_DESCRIPTOR_STRING</a>, langid, nuint8_ts, dataptr));</div>
<div class="line"><a name="l00268"></a><span class="lineno"> 268</span>&#160;}</div>
<div class="line"><a name="l00269"></a><span class="lineno"> 269</span>&#160;<span class="comment">//set address</span></div>
<div class="line"><a name="l00270"></a><span class="lineno"> 270</span>&#160;</div>
<div class="line"><a name="l00271"></a><span class="lineno"> 271</span>&#160;<span class="keyword">inline</span> uint8_t <a class="code" href="class_u_s_b.html#a3aea534daed66b5606fa798df7ad3c47">USB::setAddr</a>(uint8_t oldaddr, uint8_t ep, uint8_t newaddr) {</div>
<div class="line"><a name="l00272"></a><span class="lineno"> 272</span>&#160; <span class="keywordflow">return</span>( <a class="code" href="class_u_s_b.html#a636695a5c3d35cd6b9e31c54edfacd7c">ctrlReq</a>(oldaddr, ep, <a class="code" href="_usb_8h.html#af4965e768593007eacde7644979f56da">bmREQ_SET</a>, <a class="code" href="usb__ch9_8h.html#ac87659819bfd6491120c819fae2d46bc">USB_REQUEST_SET_ADDRESS</a>, newaddr, 0x00, 0x0000, 0x0000, NULL));</div>
<div class="line"><a name="l00273"></a><span class="lineno"> 273</span>&#160;}</div>
<div class="line"><a name="l00274"></a><span class="lineno"> 274</span>&#160;<span class="comment">//set configuration</span></div>
<div class="line"><a name="l00275"></a><span class="lineno"> 275</span>&#160;</div>
<div class="line"><a name="l00276"></a><span class="lineno"> 276</span>&#160;<span class="keyword">inline</span> uint8_t <a class="code" href="class_u_s_b.html#a31e2c132ec32ffdde94dff72be87c378">USB::setConf</a>(uint8_t addr, uint8_t ep, uint8_t conf_value) {</div>
<div class="line"><a name="l00277"></a><span class="lineno"> 277</span>&#160; <span class="keywordflow">return</span>( <a class="code" href="class_u_s_b.html#a636695a5c3d35cd6b9e31c54edfacd7c">ctrlReq</a>(addr, ep, <a class="code" href="_usb_8h.html#af4965e768593007eacde7644979f56da">bmREQ_SET</a>, <a class="code" href="usb__ch9_8h.html#aadef005acc40340955d34d9767ef297c">USB_REQUEST_SET_CONFIGURATION</a>, conf_value, 0x00, 0x0000, 0x0000, NULL));</div>
<div class="line"><a name="l00278"></a><span class="lineno"> 278</span>&#160;}</div>
<div class="line"><a name="l00279"></a><span class="lineno"> 279</span>&#160;</div>
<div class="line"><a name="l00280"></a><span class="lineno"> 280</span>&#160;<span class="preprocessor">#endif // defined(USB_METHODS_INLINE)</span></div>
<div class="line"><a name="l00281"></a><span class="lineno"> 281</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00282"></a><span class="lineno"> 282</span>&#160;<span class="preprocessor">#endif //_usb_h_</span></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>

View file

@ -98,7 +98,7 @@ Include dependency graph for Wii.cpp:</div>
<div class="dyncontent">
<div class="center"><img src="_wii_8cpp__incl.png" border="0" usemap="#_wii_8cpp" alt=""/></div>
<map name="_wii_8cpp" id="_wii_8cpp">
<area shape="rect" id="node2" href="_wii_8h.html" title="Wii.h" alt="" coords="597,75,637,96"/><area shape="rect" id="node3" href="_b_t_d_8h.html" title="BTD.h" alt="" coords="549,144,594,165"/><area shape="rect" id="node21" href="controller_enums_8h.html" title="controllerEnums.h" alt="" coords="619,144,705,165"/><area shape="rect" id="node4" href="_usb_8h.html" title="Usb.h" alt="" coords="342,213,385,235"/><area shape="rect" id="node19" href="confdescparser_8h.html" title="confdescparser.h" alt="" coords="708,213,791,235"/><area shape="rect" id="node7" href="avrpins_8h.html" title="avrpins.h" alt="" coords="251,352,305,373"/><area shape="rect" id="node9" href="max3421e_8h.html" title="max3421e.h" alt="" coords="159,352,226,373"/><area shape="rect" id="node10" href="usbhost_8h.html" title="usbhost.h" alt="" coords="175,283,231,304"/><area shape="rect" id="node11" href="usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="349,352,407,373"/><area shape="rect" id="node12" href="address_8h.html" title="address.h" alt="" coords="41,283,98,304"/><area shape="rect" id="node15" href="printhex_8h.html" title="printhex.h" alt="" coords="721,421,778,443"/><area shape="rect" id="node16" href="hexdump_8h.html" title="hexdump.h" alt="" coords="634,352,695,373"/><area shape="rect" id="node18" href="message_8h.html" title="message.h" alt="" coords="719,352,781,373"/><area shape="rect" id="node20" href="parsetools_8h.html" title="parsetools.h" alt="" coords="788,283,853,304"/></map>
<area shape="rect" id="node2" href="_wii_8h.html" title="Wii.h" alt="" coords="599,75,639,96"/><area shape="rect" id="node3" href="_b_t_d_8h.html" title="BTD.h" alt="" coords="551,144,596,165"/><area shape="rect" id="node21" href="controller_enums_8h.html" title="controllerEnums.h" alt="" coords="621,144,707,165"/><area shape="rect" id="node4" href="_usb_8h.html" title="Usb.h" alt="" coords="288,283,331,304"/><area shape="rect" id="node19" href="confdescparser_8h.html" title="confdescparser.h" alt="" coords="635,213,719,235"/><area shape="rect" id="node7" href="avrpins_8h.html" title="avrpins.h" alt="" coords="5,421,59,443"/><area shape="rect" id="node9" href="max3421e_8h.html" title="max3421e.h" alt="" coords="180,421,247,443"/><area shape="rect" id="node10" href="usbhost_8h.html" title="usbhost.h" alt="" coords="181,352,237,373"/><area shape="rect" id="node11" href="usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="97,421,156,443"/><area shape="rect" id="node12" href="address_8h.html" title="address.h" alt="" coords="314,352,371,373"/><area shape="rect" id="node15" href="message_8h.html" title="message.h" alt="" coords="648,352,709,373"/><area shape="rect" id="node17" href="printhex_8h.html" title="printhex.h" alt="" coords="650,421,707,443"/><area shape="rect" id="node18" href="hexdump_8h.html" title="hexdump.h" alt="" coords="783,421,844,443"/><area shape="rect" id="node20" href="parsetools_8h.html" title="parsetools.h" alt="" coords="715,283,780,304"/></map>
</div>
</div>
<p><a href="_wii_8cpp_source.html">Go to the source code of this file.</a></p>
@ -110,8 +110,12 @@ Macros</h2></td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="var-members"></a>
Variables</h2></td></tr>
<tr class="memitem:aa59a533c04572a9aa97676c8e9a40d80"><td class="memItemLeft" align="right" valign="top">const uint8_t LEDS[]&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_wii_8cpp.html#aa59a533c04572a9aa97676c8e9a40d80">PROGMEM</a></td></tr>
<tr class="separator:aa59a533c04572a9aa97676c8e9a40d80"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af83672eccf0c7a02847ce75bc5c55a1a"><td class="memItemLeft" align="right" valign="top">const uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_wii_8cpp.html#af83672eccf0c7a02847ce75bc5c55a1a">LEDS</a> []</td></tr>
<tr class="separator:af83672eccf0c7a02847ce75bc5c55a1a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af3392eea150ac9151bef45148f0d7895"><td class="memItemLeft" align="right" valign="top">const uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_wii_8cpp.html#af3392eea150ac9151bef45148f0d7895">BUTTONS</a> []</td></tr>
<tr class="separator:af3392eea150ac9151bef45148f0d7895"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6571a59427c954eefde75bb40f02443e"><td class="memItemLeft" align="right" valign="top">const uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_wii_8cpp.html#a6571a59427c954eefde75bb40f02443e">PROCONTROLLERBUTTONS</a> []</td></tr>
<tr class="separator:a6571a59427c954eefde75bb40f02443e"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Macro Definition Documentation</h2>
<a class="anchor" id="ad72dbcf6d0153db1b8d8a58001feed83"></a>
@ -129,12 +133,12 @@ Variables</h2></td></tr>
</div>
</div>
<h2 class="groupheader">Variable Documentation</h2>
<a class="anchor" id="aa59a533c04572a9aa97676c8e9a40d80"></a>
<a class="anchor" id="af83672eccf0c7a02847ce75bc5c55a1a"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">const uint32_t PROCONTROLLERBUTTONS [] PROGMEM</td>
<td class="memname">const uint8_t LEDS[]</td>
</tr>
</table>
</div><div class="memdoc">
@ -154,6 +158,78 @@ Variables</h2></td></tr>
</div><!-- fragment -->
<p>Definition at line <a class="el" href="_wii_8cpp_source.html#l00027">27</a> of file <a class="el" href="_wii_8cpp_source.html">Wii.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="af3392eea150ac9151bef45148f0d7895"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">const uint32_t BUTTONS[]</td>
</tr>
</table>
</div><div class="memdoc">
<b>Initial value:</b><div class="fragment"><div class="line">= {</div>
<div class="line"> 0x00008, </div>
<div class="line"> 0x00002, </div>
<div class="line"> 0x00004, </div>
<div class="line"> 0x00001, </div>
<div class="line"></div>
<div class="line"> 0, </div>
<div class="line"> 0x00010, </div>
<div class="line"> 0x00100, </div>
<div class="line"> 0x00200, </div>
<div class="line"></div>
<div class="line"> 0x01000, </div>
<div class="line"> 0x08000, </div>
<div class="line"> 0x10000, </div>
<div class="line"> 0x20000, </div>
<div class="line"></div>
<div class="line"> 0x00400, </div>
<div class="line"> 0x00800 </div>
<div class="line">}</div>
</div><!-- fragment -->
<p>Definition at line <a class="el" href="_wii_8cpp_source.html#l00041">41</a> of file <a class="el" href="_wii_8cpp_source.html">Wii.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="a6571a59427c954eefde75bb40f02443e"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">const uint32_t PROCONTROLLERBUTTONS[]</td>
</tr>
</table>
</div><div class="memdoc">
<b>Initial value:</b><div class="fragment"><div class="line">= {</div>
<div class="line"> 0x00100, </div>
<div class="line"> 0x00080, </div>
<div class="line"> 0x00040, </div>
<div class="line"> 0x00200, </div>
<div class="line"></div>
<div class="line"> 0, </div>
<div class="line"> 0x00004, </div>
<div class="line"> 0x20000, </div>
<div class="line"> 0x10000, </div>
<div class="line"></div>
<div class="line"> 0x00010, </div>
<div class="line"> 0x00008, </div>
<div class="line"> 0, 0, </div>
<div class="line"></div>
<div class="line"> 0x04000, </div>
<div class="line"> 0x01000, </div>
<div class="line"> 0x00800, </div>
<div class="line"> 0x02000, </div>
<div class="line"></div>
<div class="line"> 0x00020, </div>
<div class="line"> 0x00002, </div>
<div class="line"> 0x08000, </div>
<div class="line"> 0x00400 </div>
<div class="line">}</div>
</div><!-- fragment -->
<p>Definition at line <a class="el" href="_wii_8cpp_source.html#l00060">60</a> of file <a class="el" href="_wii_8cpp_source.html">Wii.cpp</a>.</p>
</div>
</div>
</div><!-- contents -->

View file

@ -1,16 +1,16 @@
<map id="Wii.cpp" name="Wii.cpp">
<area shape="rect" id="node2" href="$_wii_8h.html" title="Wii.h" alt="" coords="597,75,637,96"/>
<area shape="rect" id="node3" href="$_b_t_d_8h.html" title="BTD.h" alt="" coords="549,144,594,165"/>
<area shape="rect" id="node21" href="$controller_enums_8h.html" title="controllerEnums.h" alt="" coords="619,144,705,165"/>
<area shape="rect" id="node4" href="$_usb_8h.html" title="Usb.h" alt="" coords="342,213,385,235"/>
<area shape="rect" id="node19" href="$confdescparser_8h.html" title="confdescparser.h" alt="" coords="708,213,791,235"/>
<area shape="rect" id="node7" href="$avrpins_8h.html" title="avrpins.h" alt="" coords="251,352,305,373"/>
<area shape="rect" id="node9" href="$max3421e_8h.html" title="max3421e.h" alt="" coords="159,352,226,373"/>
<area shape="rect" id="node10" href="$usbhost_8h.html" title="usbhost.h" alt="" coords="175,283,231,304"/>
<area shape="rect" id="node11" href="$usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="349,352,407,373"/>
<area shape="rect" id="node12" href="$address_8h.html" title="address.h" alt="" coords="41,283,98,304"/>
<area shape="rect" id="node15" href="$printhex_8h.html" title="printhex.h" alt="" coords="721,421,778,443"/>
<area shape="rect" id="node16" href="$hexdump_8h.html" title="hexdump.h" alt="" coords="634,352,695,373"/>
<area shape="rect" id="node18" href="$message_8h.html" title="message.h" alt="" coords="719,352,781,373"/>
<area shape="rect" id="node20" href="$parsetools_8h.html" title="parsetools.h" alt="" coords="788,283,853,304"/>
<area shape="rect" id="node2" href="$_wii_8h.html" title="Wii.h" alt="" coords="599,75,639,96"/>
<area shape="rect" id="node3" href="$_b_t_d_8h.html" title="BTD.h" alt="" coords="551,144,596,165"/>
<area shape="rect" id="node21" href="$controller_enums_8h.html" title="controllerEnums.h" alt="" coords="621,144,707,165"/>
<area shape="rect" id="node4" href="$_usb_8h.html" title="Usb.h" alt="" coords="288,283,331,304"/>
<area shape="rect" id="node19" href="$confdescparser_8h.html" title="confdescparser.h" alt="" coords="635,213,719,235"/>
<area shape="rect" id="node7" href="$avrpins_8h.html" title="avrpins.h" alt="" coords="5,421,59,443"/>
<area shape="rect" id="node9" href="$max3421e_8h.html" title="max3421e.h" alt="" coords="180,421,247,443"/>
<area shape="rect" id="node10" href="$usbhost_8h.html" title="usbhost.h" alt="" coords="181,352,237,373"/>
<area shape="rect" id="node11" href="$usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="97,421,156,443"/>
<area shape="rect" id="node12" href="$address_8h.html" title="address.h" alt="" coords="314,352,371,373"/>
<area shape="rect" id="node15" href="$message_8h.html" title="message.h" alt="" coords="648,352,709,373"/>
<area shape="rect" id="node17" href="$printhex_8h.html" title="printhex.h" alt="" coords="650,421,707,443"/>
<area shape="rect" id="node18" href="$hexdump_8h.html" title="hexdump.h" alt="" coords="783,421,844,443"/>
<area shape="rect" id="node20" href="$parsetools_8h.html" title="parsetools.h" alt="" coords="715,283,780,304"/>
</map>

View file

@ -1 +1 @@
8302a88cea650fea3caea3b14ed4804b
92196a68a2e7066e730ae6e063a43a10

Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 KiB

After

Width:  |  Height:  |  Size: 77 KiB

File diff suppressed because it is too large Load diff

View file

@ -100,7 +100,7 @@ Include dependency graph for Wii.h:</div>
<div class="dyncontent">
<div class="center"><img src="_wii_8h__incl.png" border="0" usemap="#_wii_8h" alt=""/></div>
<map name="_wii_8h" id="_wii_8h">
<area shape="rect" id="node2" href="_b_t_d_8h.html" title="BTD.h" alt="" coords="549,75,594,96"/><area shape="rect" id="node20" href="controller_enums_8h.html" title="controllerEnums.h" alt="" coords="619,75,705,96"/><area shape="rect" id="node3" href="_usb_8h.html" title="Usb.h" alt="" coords="342,144,385,165"/><area shape="rect" id="node18" href="confdescparser_8h.html" title="confdescparser.h" alt="" coords="708,144,791,165"/><area shape="rect" id="node6" href="avrpins_8h.html" title="avrpins.h" alt="" coords="251,283,305,304"/><area shape="rect" id="node8" href="max3421e_8h.html" title="max3421e.h" alt="" coords="159,283,226,304"/><area shape="rect" id="node9" href="usbhost_8h.html" title="usbhost.h" alt="" coords="175,213,231,235"/><area shape="rect" id="node10" href="usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="349,283,407,304"/><area shape="rect" id="node11" href="address_8h.html" title="address.h" alt="" coords="41,213,98,235"/><area shape="rect" id="node14" href="printhex_8h.html" title="printhex.h" alt="" coords="721,352,778,373"/><area shape="rect" id="node15" href="hexdump_8h.html" title="hexdump.h" alt="" coords="634,283,695,304"/><area shape="rect" id="node17" href="message_8h.html" title="message.h" alt="" coords="719,283,781,304"/><area shape="rect" id="node19" href="parsetools_8h.html" title="parsetools.h" alt="" coords="788,213,853,235"/></map>
<area shape="rect" id="node2" href="_b_t_d_8h.html" title="BTD.h" alt="" coords="551,75,596,96"/><area shape="rect" id="node20" href="controller_enums_8h.html" title="controllerEnums.h" alt="" coords="621,75,707,96"/><area shape="rect" id="node3" href="_usb_8h.html" title="Usb.h" alt="" coords="288,213,331,235"/><area shape="rect" id="node18" href="confdescparser_8h.html" title="confdescparser.h" alt="" coords="635,144,719,165"/><area shape="rect" id="node6" href="avrpins_8h.html" title="avrpins.h" alt="" coords="5,352,59,373"/><area shape="rect" id="node8" href="max3421e_8h.html" title="max3421e.h" alt="" coords="180,352,247,373"/><area shape="rect" id="node9" href="usbhost_8h.html" title="usbhost.h" alt="" coords="181,283,237,304"/><area shape="rect" id="node10" href="usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="97,352,156,373"/><area shape="rect" id="node11" href="address_8h.html" title="address.h" alt="" coords="314,283,371,304"/><area shape="rect" id="node14" href="message_8h.html" title="message.h" alt="" coords="648,283,709,304"/><area shape="rect" id="node16" href="printhex_8h.html" title="printhex.h" alt="" coords="650,352,707,373"/><area shape="rect" id="node17" href="hexdump_8h.html" title="hexdump.h" alt="" coords="783,352,844,373"/><area shape="rect" id="node19" href="parsetools_8h.html" title="parsetools.h" alt="" coords="715,213,780,235"/></map>
</div>
</div><div class="textblock"><div class="dynheader">
This graph shows which files directly or indirectly include this file:</div>

View file

@ -1,15 +1,15 @@
<map id="Wii.h" name="Wii.h">
<area shape="rect" id="node2" href="$_b_t_d_8h.html" title="BTD.h" alt="" coords="549,75,594,96"/>
<area shape="rect" id="node20" href="$controller_enums_8h.html" title="controllerEnums.h" alt="" coords="619,75,705,96"/>
<area shape="rect" id="node3" href="$_usb_8h.html" title="Usb.h" alt="" coords="342,144,385,165"/>
<area shape="rect" id="node18" href="$confdescparser_8h.html" title="confdescparser.h" alt="" coords="708,144,791,165"/>
<area shape="rect" id="node6" href="$avrpins_8h.html" title="avrpins.h" alt="" coords="251,283,305,304"/>
<area shape="rect" id="node8" href="$max3421e_8h.html" title="max3421e.h" alt="" coords="159,283,226,304"/>
<area shape="rect" id="node9" href="$usbhost_8h.html" title="usbhost.h" alt="" coords="175,213,231,235"/>
<area shape="rect" id="node10" href="$usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="349,283,407,304"/>
<area shape="rect" id="node11" href="$address_8h.html" title="address.h" alt="" coords="41,213,98,235"/>
<area shape="rect" id="node14" href="$printhex_8h.html" title="printhex.h" alt="" coords="721,352,778,373"/>
<area shape="rect" id="node15" href="$hexdump_8h.html" title="hexdump.h" alt="" coords="634,283,695,304"/>
<area shape="rect" id="node17" href="$message_8h.html" title="message.h" alt="" coords="719,283,781,304"/>
<area shape="rect" id="node19" href="$parsetools_8h.html" title="parsetools.h" alt="" coords="788,213,853,235"/>
<area shape="rect" id="node2" href="$_b_t_d_8h.html" title="BTD.h" alt="" coords="551,75,596,96"/>
<area shape="rect" id="node20" href="$controller_enums_8h.html" title="controllerEnums.h" alt="" coords="621,75,707,96"/>
<area shape="rect" id="node3" href="$_usb_8h.html" title="Usb.h" alt="" coords="288,213,331,235"/>
<area shape="rect" id="node18" href="$confdescparser_8h.html" title="confdescparser.h" alt="" coords="635,144,719,165"/>
<area shape="rect" id="node6" href="$avrpins_8h.html" title="avrpins.h" alt="" coords="5,352,59,373"/>
<area shape="rect" id="node8" href="$max3421e_8h.html" title="max3421e.h" alt="" coords="180,352,247,373"/>
<area shape="rect" id="node9" href="$usbhost_8h.html" title="usbhost.h" alt="" coords="181,283,237,304"/>
<area shape="rect" id="node10" href="$usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="97,352,156,373"/>
<area shape="rect" id="node11" href="$address_8h.html" title="address.h" alt="" coords="314,283,371,304"/>
<area shape="rect" id="node14" href="$message_8h.html" title="message.h" alt="" coords="648,283,709,304"/>
<area shape="rect" id="node16" href="$printhex_8h.html" title="printhex.h" alt="" coords="650,352,707,373"/>
<area shape="rect" id="node17" href="$hexdump_8h.html" title="hexdump.h" alt="" coords="783,352,844,373"/>
<area shape="rect" id="node19" href="$parsetools_8h.html" title="parsetools.h" alt="" coords="715,213,780,235"/>
</map>

View file

@ -1 +1 @@
805e126ec89ff09282a5760e2eff90dd
209252d4e5b8261066f58eb78ab79741

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 76 KiB

View file

@ -188,157 +188,205 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<div class="line"><a name="l00139"></a><span class="lineno"> 139</span>&#160; uint8_t <a class="code" href="class_w_i_i.html#ab16e907132354be9848fd91a6a5171db">getAnalogHat</a>(<a class="code" href="_wii_8h.html#a3edd2b2fd262b698309012868fad0be7">Hat</a> a);</div>
<div class="line"><a name="l00145"></a><span class="lineno"> 145</span>&#160; uint16_t <a class="code" href="class_w_i_i.html#ab16e907132354be9848fd91a6a5171db">getAnalogHat</a>(<a class="code" href="controller_enums_8h.html#aaaabdefc068fd57ec2bef2b62ea4ba92">AnalogHat</a> a);</div>
<div class="line"><a name="l00146"></a><span class="lineno"> 146</span>&#160;</div>
<div class="line"><a name="l00151"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a748172bd57804856594ea8e21601319e"> 151</a></span>&#160; <span class="keywordtype">double</span> <a class="code" href="class_w_i_i.html#a748172bd57804856594ea8e21601319e">getPitch</a>() { <span class="keywordflow">return</span> pitch; };</div>
<div class="line"><a name="l00156"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a6ac037d884f97319892e8671ef070c03"> 156</a></span>&#160; <span class="keywordtype">double</span> <a class="code" href="class_w_i_i.html#a6ac037d884f97319892e8671ef070c03">getRoll</a>() { <span class="keywordflow">return</span> roll; };</div>
<div class="line"><a name="l00163"></a><span class="lineno"><a class="code" href="class_w_i_i.html#ae92e129c54c8131f4a2c55582dfd2f11"> 163</a></span>&#160; <span class="keywordtype">double</span> <a class="code" href="class_w_i_i.html#ae92e129c54c8131f4a2c55582dfd2f11">getYaw</a>() { <span class="keywordflow">return</span> <a class="code" href="class_w_i_i.html#a988db5b35cfc3c543f93f49587a50e62">gyroYaw</a>; };</div>
<div class="line"><a name="l00164"></a><span class="lineno"> 164</span>&#160; </div>
<div class="line"><a name="l00166"></a><span class="lineno"> 166</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_w_i_i.html#a6e97bfcfb134b63d7190ba1bc326e1d3">setAllOff</a>();</div>
<div class="line"><a name="l00168"></a><span class="lineno"> 168</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_w_i_i.html#a2c5c32841b020b248f757cb793acb936">setRumbleOff</a>();</div>
<div class="line"><a name="l00170"></a><span class="lineno"> 170</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_w_i_i.html#a0d9c869bd3677c4488a586c38558a137">setRumbleOn</a>();</div>
<div class="line"><a name="l00172"></a><span class="lineno"> 172</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_w_i_i.html#a841396b533cccccb05db37d35f6fef9c">setRumbleToggle</a>();</div>
<div class="line"><a name="l00177"></a><span class="lineno"> 177</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_w_i_i.html#a7efe7577ba30c218f6fbd3804a53d242">setLedOff</a>(<a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6">LED</a> a);</div>
<div class="line"><a name="l00182"></a><span class="lineno"> 182</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_w_i_i.html#a3a7b9dd571c5a8597bfb194000bd517c">setLedOn</a>(<a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6">LED</a> a);</div>
<div class="line"><a name="l00187"></a><span class="lineno"> 187</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_w_i_i.html#af7755e2b2a161a550c99de2ca1018ce3">setLedToggle</a>(<a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6">LED</a> a);</div>
<div class="line"><a name="l00197"></a><span class="lineno"> 197</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_w_i_i.html#a5d3b4a33ebc2ca9ebb154e10a05dbdd4">setLedStatus</a>();</div>
<div class="line"><a name="l00198"></a><span class="lineno"> 198</span>&#160;</div>
<div class="line"><a name="l00203"></a><span class="lineno"><a class="code" href="class_w_i_i.html#ae946f7d6e9ce89fb083f5f138c0736c2"> 203</a></span>&#160; uint8_t <a class="code" href="class_w_i_i.html#ae946f7d6e9ce89fb083f5f138c0736c2">getBatteryLevel</a>() { <span class="keywordflow">return</span> batteryLevel; };</div>
<div class="line"><a name="l00208"></a><span class="lineno"><a class="code" href="class_w_i_i.html#ae25a8ea1b0713801e0209e795b4596fa"> 208</a></span>&#160; uint8_t <a class="code" href="class_w_i_i.html#a8e9ac1d379db5c07c478401046a1c0ac">getWiiState</a>() { <span class="keywordflow">return</span> wiiState; };</div>
<div class="line"><a name="l00213"></a><span class="lineno"> 213</span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_w_i_i.html#ae25a8ea1b0713801e0209e795b4596fa">wiimoteConnected</a>;</div>
<div class="line"><a name="l00215"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a7cb4cec343c65fd350e6b05043d7f1a8"> 215</a></span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_w_i_i.html#a7cb4cec343c65fd350e6b05043d7f1a8">nunchuckConnected</a>;</div>
<div class="line"><a name="l00217"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a72bd4fad2e524276712a154b8cc2a16c"> 217</a></span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_w_i_i.html#a72bd4fad2e524276712a154b8cc2a16c">motionPlusConnected</a>;</div>
<div class="line"><a name="l00219"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a461f5b7a5f2bc874e107fc776c284b16"> 219</a></span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_w_i_i.html#a461f5b7a5f2bc874e107fc776c284b16">wiiUProControllerConnected</a>;</div>
<div class="line"><a name="l00222"></a><span class="lineno"> 222</span>&#160; <span class="comment">/* IMU Data, might be usefull if you need to do something more advanced than just calculating the angle */</span></div>
<div class="line"><a name="l00223"></a><span class="lineno"> 223</span>&#160; </div>
<div class="line"><a name="l00226"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a1421306c25a76c0fa24f7ee4b10b757b"> 226</a></span>&#160; <span class="keywordtype">double</span> <a class="code" href="class_w_i_i.html#a1421306c25a76c0fa24f7ee4b10b757b">wiimotePitch</a>;</div>
<div class="line"><a name="l00227"></a><span class="lineno"><a class="code" href="class_w_i_i.html#ab22594da86218dccf86806b13d6a7a70"> 227</a></span>&#160; <span class="keywordtype">double</span> <a class="code" href="class_w_i_i.html#ab22594da86218dccf86806b13d6a7a70">wiimoteRoll</a>;</div>
<div class="line"><a name="l00232"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a2b5a934a1be4d7c5e788d3742dd09cbf"> 232</a></span>&#160; <span class="keywordtype">double</span> <a class="code" href="class_w_i_i.html#a2b5a934a1be4d7c5e788d3742dd09cbf">nunchuckPitch</a>;</div>
<div class="line"><a name="l00233"></a><span class="lineno"><a class="code" href="class_w_i_i.html#ad6c01ce2e1f7bac2c8982ecfb3f53f71"> 233</a></span>&#160; <span class="keywordtype">double</span> <a class="code" href="class_w_i_i.html#ad6c01ce2e1f7bac2c8982ecfb3f53f71">nunchuckRoll</a>;</div>
<div class="line"><a name="l00238"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a48bcc2e5c6253d0554d70357625ff3fb"> 238</a></span>&#160; int16_t <a class="code" href="class_w_i_i.html#a48bcc2e5c6253d0554d70357625ff3fb">accX</a>;</div>
<div class="line"><a name="l00239"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a07bef4e4acd42d680ac676b0e6315b2a"> 239</a></span>&#160; int16_t <a class="code" href="class_w_i_i.html#a07bef4e4acd42d680ac676b0e6315b2a">accY</a>;</div>
<div class="line"><a name="l00240"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a7323e1f8b76f3f11f91cdb9601759cc4"> 240</a></span>&#160; int16_t <a class="code" href="class_w_i_i.html#a7323e1f8b76f3f11f91cdb9601759cc4">accZ</a>;</div>
<div class="line"><a name="l00243"></a><span class="lineno"> 243</span>&#160; <span class="comment">/* Variables for the gyro inside the Motion Plus */</span></div>
<div class="line"><a name="l00245"></a><span class="lineno"><a class="code" href="class_w_i_i.html#af61f57d34b81f2a878f0126a074e3af4"> 245</a></span>&#160; <span class="keywordtype">double</span> <a class="code" href="class_w_i_i.html#af61f57d34b81f2a878f0126a074e3af4">gyroPitch</a>;</div>
<div class="line"><a name="l00247"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a2a0e4745bff7cfec644bcebe984c2bc8"> 247</a></span>&#160; <span class="keywordtype">double</span> <a class="code" href="class_w_i_i.html#a2a0e4745bff7cfec644bcebe984c2bc8">gyroRoll</a>;</div>
<div class="line"><a name="l00249"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a988db5b35cfc3c543f93f49587a50e62"> 249</a></span>&#160; <span class="keywordtype">double</span> <a class="code" href="class_w_i_i.html#a988db5b35cfc3c543f93f49587a50e62">gyroYaw</a>;</div>
<div class="line"><a name="l00250"></a><span class="lineno"> 250</span>&#160;</div>
<div class="line"><a name="l00253"></a><span class="lineno"><a class="code" href="class_w_i_i.html#acfb290a86aa9a65dd4ae84d02e3c6ded"> 253</a></span>&#160; <span class="keywordtype">double</span> <a class="code" href="class_w_i_i.html#acfb290a86aa9a65dd4ae84d02e3c6ded">pitchGyroSpeed</a>;</div>
<div class="line"><a name="l00254"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a3fb552c6ad486e23434dcb347a2a4b84"> 254</a></span>&#160; <span class="keywordtype">double</span> <a class="code" href="class_w_i_i.html#a3fb552c6ad486e23434dcb347a2a4b84">rollGyroSpeed</a>;</div>
<div class="line"><a name="l00255"></a><span class="lineno"><a class="code" href="class_w_i_i.html#ad5df436cc5d073f26bf3ea5c60d788d6"> 255</a></span>&#160; <span class="keywordtype">double</span> <a class="code" href="class_w_i_i.html#ad5df436cc5d073f26bf3ea5c60d788d6">yawGyroSpeed</a>;</div>
<div class="line"><a name="l00260"></a><span class="lineno"><a class="code" href="class_w_i_i.html#aea6ce6f3222df3e547e9957673c7a07a"> 260</a></span>&#160; uint16_t <a class="code" href="class_w_i_i.html#aea6ce6f3222df3e547e9957673c7a07a">pitchGyroScale</a>;</div>
<div class="line"><a name="l00261"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a6c0971ae4c9ab752888a5871020c8331"> 261</a></span>&#160; uint16_t <a class="code" href="class_w_i_i.html#a6c0971ae4c9ab752888a5871020c8331">rollGyroScale</a>;</div>
<div class="line"><a name="l00262"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a0694969a30092b9b1dcb26120c7cff73"> 262</a></span>&#160; uint16_t <a class="code" href="class_w_i_i.html#a0694969a30092b9b1dcb26120c7cff73">yawGyroScale</a>;</div>
<div class="line"><a name="l00267"></a><span class="lineno"><a class="code" href="class_w_i_i.html#ab813b65548e827f41a5192fcc34056ea"> 267</a></span>&#160; int16_t <a class="code" href="class_w_i_i.html#ab813b65548e827f41a5192fcc34056ea">gyroYawRaw</a>;</div>
<div class="line"><a name="l00268"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a0784c779ebeae2d459996c35a54ee3b8"> 268</a></span>&#160; int16_t <a class="code" href="class_w_i_i.html#a0784c779ebeae2d459996c35a54ee3b8">gyroRollRaw</a>;</div>
<div class="line"><a name="l00269"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a749ea9dd39ba9a5320c5b24ce93bc544"> 269</a></span>&#160; int16_t <a class="code" href="class_w_i_i.html#a749ea9dd39ba9a5320c5b24ce93bc544">gyroPitchRaw</a>;</div>
<div class="line"><a name="l00274"></a><span class="lineno"><a class="code" href="class_w_i_i.html#ad4f0d2456c56414f9b8013b85a1ee7d2"> 274</a></span>&#160; int16_t <a class="code" href="class_w_i_i.html#ad4f0d2456c56414f9b8013b85a1ee7d2">gyroYawZero</a>;</div>
<div class="line"><a name="l00275"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a10d91cd5d73bc655be776b44d27004c9"> 275</a></span>&#160; int16_t <a class="code" href="class_w_i_i.html#a10d91cd5d73bc655be776b44d27004c9">gyroRollZero</a>;</div>
<div class="line"><a name="l00276"></a><span class="lineno"><a class="code" href="class_w_i_i.html#abbc31ecd4495d70258cfa095e34cb3c3"> 276</a></span>&#160; int16_t <a class="code" href="class_w_i_i.html#abbc31ecd4495d70258cfa095e34cb3c3">gyroPitchZero</a>;</div>
<div class="line"><a name="l00279"></a><span class="lineno"> 279</span>&#160;<span class="preprocessor">#ifdef WIICAMERA</span></div>
<div class="line"><a name="l00280"></a><span class="lineno"> 280</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00284"></a><span class="lineno"> 284</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_w_i_i.html#a3505abbc01c71d134ce301dfb7c0c5b5">IRinitialize</a>();</div>
<div class="line"><a name="l00285"></a><span class="lineno"> 285</span>&#160;</div>
<div class="line"><a name="l00290"></a><span class="lineno"><a class="code" href="class_w_i_i.html#af380eb3bf65ce33a60aaf35f74a44f6d"> 290</a></span>&#160; uint16_t <a class="code" href="class_w_i_i.html#af380eb3bf65ce33a60aaf35f74a44f6d">getIRx1</a>() { <span class="keywordflow">return</span> IR_object_x1; };</div>
<div class="line"><a name="l00295"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a341b9a50bfdb18af9c66a3079e5804d9"> 295</a></span>&#160; uint16_t <a class="code" href="class_w_i_i.html#a341b9a50bfdb18af9c66a3079e5804d9">getIRy1</a>() { <span class="keywordflow">return</span> IR_object_y1; };</div>
<div class="line"><a name="l00300"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a2d8fd822e6e9c271d59c71dc7b757421"> 300</a></span>&#160; uint8_t <a class="code" href="class_w_i_i.html#a2d8fd822e6e9c271d59c71dc7b757421">getIRs1</a>() { <span class="keywordflow">return</span> IR_object_s1; };</div>
<div class="line"><a name="l00301"></a><span class="lineno"> 301</span>&#160;</div>
<div class="line"><a name="l00306"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a551e48a50c7b60722e807e68ae25f084"> 306</a></span>&#160; uint16_t <a class="code" href="class_w_i_i.html#a551e48a50c7b60722e807e68ae25f084">getIRx2</a>() { <span class="keywordflow">return</span> IR_object_x2; };</div>
<div class="line"><a name="l00311"></a><span class="lineno"><a class="code" href="class_w_i_i.html#ae148de3c99b3fb4ef65ea62d2848df7d"> 311</a></span>&#160; uint16_t <a class="code" href="class_w_i_i.html#ae148de3c99b3fb4ef65ea62d2848df7d">getIRy2</a>() { <span class="keywordflow">return</span> IR_object_y2; };</div>
<div class="line"><a name="l00316"></a><span class="lineno"><a class="code" href="class_w_i_i.html#accf6ca623ffe93b3c78aaf60c7fd1f46"> 316</a></span>&#160; uint8_t <a class="code" href="class_w_i_i.html#accf6ca623ffe93b3c78aaf60c7fd1f46">getIRs2</a>() { <span class="keywordflow">return</span> IR_object_s2; };</div>
<div class="line"><a name="l00317"></a><span class="lineno"> 317</span>&#160;</div>
<div class="line"><a name="l00322"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a5648a03968d0c2331867f9b7bcaa3e3e"> 322</a></span>&#160; uint16_t <a class="code" href="class_w_i_i.html#a5648a03968d0c2331867f9b7bcaa3e3e">getIRx3</a>() { <span class="keywordflow">return</span> IR_object_x3; };</div>
<div class="line"><a name="l00327"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a5e778f879c6d0a73a94bd61e42d05b8d"> 327</a></span>&#160; uint16_t <a class="code" href="class_w_i_i.html#a5e778f879c6d0a73a94bd61e42d05b8d">getIRy3</a>() { <span class="keywordflow">return</span> IR_object_y3; };</div>
<div class="line"><a name="l00332"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a05841e1975803d561f80aeb3dd0a4a1e"> 332</a></span>&#160; uint8_t <a class="code" href="class_w_i_i.html#a05841e1975803d561f80aeb3dd0a4a1e">getIRs3</a>() { <span class="keywordflow">return</span> IR_object_s3; };</div>
<div class="line"><a name="l00333"></a><span class="lineno"> 333</span>&#160;</div>
<div class="line"><a name="l00338"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a7a92d63c7cf9d3d5b38bdb9ad4d7ef66"> 338</a></span>&#160; uint16_t <a class="code" href="class_w_i_i.html#a7a92d63c7cf9d3d5b38bdb9ad4d7ef66">getIRx4</a>() { <span class="keywordflow">return</span> IR_object_x4; };</div>
<div class="line"><a name="l00343"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a759837b933f63ce7c3235639be29250a"> 343</a></span>&#160; uint16_t <a class="code" href="class_w_i_i.html#a759837b933f63ce7c3235639be29250a">getIRy4</a>() { <span class="keywordflow">return</span> IR_object_y4; };</div>
<div class="line"><a name="l00348"></a><span class="lineno"><a class="code" href="class_w_i_i.html#aef56b9f37422b0a41642b39d10db0735"> 348</a></span>&#160; uint8_t <a class="code" href="class_w_i_i.html#aef56b9f37422b0a41642b39d10db0735">getIRs4</a>() { <span class="keywordflow">return</span> IR_object_s4; };</div>
<div class="line"><a name="l00349"></a><span class="lineno"> 349</span>&#160;</div>
<div class="line"><a name="l00355"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a0a444d7e348026e062751cf723877e8f"> 355</a></span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_w_i_i.html#a0a444d7e348026e062751cf723877e8f">isIRCameraEnabled</a>() { <span class="keywordflow">return</span> (wiiState &amp; 0x08); };</div>
<div class="line"><a name="l00357"></a><span class="lineno"> 357</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00358"></a><span class="lineno"> 358</span>&#160;<span class="preprocessor"></span> </div>
<div class="line"><a name="l00359"></a><span class="lineno"> 359</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00360"></a><span class="lineno"> 360</span>&#160; <span class="comment">/* Mandatory members */</span></div>
<div class="line"><a name="l00361"></a><span class="lineno"> 361</span>&#160; <a class="code" href="class_b_t_d.html">BTD</a> *pBtd;</div>
<div class="line"><a name="l00362"></a><span class="lineno"> 362</span>&#160; </div>
<div class="line"><a name="l00363"></a><span class="lineno"> 363</span>&#160; <span class="keywordtype">void</span> L2CAP_task(); <span class="comment">// L2CAP state machine</span></div>
<div class="line"><a name="l00364"></a><span class="lineno"> 364</span>&#160; </div>
<div class="line"><a name="l00365"></a><span class="lineno"> 365</span>&#160; <span class="comment">/* Variables filled from HCI event management */</span></div>
<div class="line"><a name="l00366"></a><span class="lineno"> 366</span>&#160; uint16_t hci_handle;</div>
<div class="line"><a name="l00367"></a><span class="lineno"> 367</span>&#160; <span class="keywordtype">bool</span> activeConnection; <span class="comment">// Used to indicate if it&#39;s already has established a connection</span></div>
<div class="line"><a name="l00368"></a><span class="lineno"> 368</span>&#160; </div>
<div class="line"><a name="l00369"></a><span class="lineno"> 369</span>&#160; <span class="comment">/* variables used by high level L2CAP task */</span> </div>
<div class="line"><a name="l00370"></a><span class="lineno"> 370</span>&#160; uint8_t l2cap_state;</div>
<div class="line"><a name="l00371"></a><span class="lineno"> 371</span>&#160; uint16_t l2cap_event_flag;<span class="comment">// l2cap flags of received bluetooth events </span></div>
<div class="line"><a name="l00372"></a><span class="lineno"> 372</span>&#160; </div>
<div class="line"><a name="l00373"></a><span class="lineno"> 373</span>&#160; uint32_t ButtonState;</div>
<div class="line"><a name="l00374"></a><span class="lineno"> 374</span>&#160; uint32_t OldButtonState;</div>
<div class="line"><a name="l00375"></a><span class="lineno"> 375</span>&#160; uint32_t ButtonClickState;</div>
<div class="line"><a name="l00376"></a><span class="lineno"> 376</span>&#160; uint16_t hatValues[4];</div>
<div class="line"><a name="l00377"></a><span class="lineno"> 377</span>&#160; </div>
<div class="line"><a name="l00378"></a><span class="lineno"> 378</span>&#160; uint8_t HIDBuffer[3];<span class="comment">// Used to store HID commands</span></div>
<div class="line"><a name="l00151"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a748172bd57804856594ea8e21601319e"> 151</a></span>&#160; <span class="keywordtype">double</span> <a class="code" href="class_w_i_i.html#a748172bd57804856594ea8e21601319e">getPitch</a>() {</div>
<div class="line"><a name="l00152"></a><span class="lineno"> 152</span>&#160; <span class="keywordflow">return</span> pitch;</div>
<div class="line"><a name="l00153"></a><span class="lineno"> 153</span>&#160; };</div>
<div class="line"><a name="l00154"></a><span class="lineno"> 154</span>&#160;</div>
<div class="line"><a name="l00159"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a6ac037d884f97319892e8671ef070c03"> 159</a></span>&#160; <span class="keywordtype">double</span> <a class="code" href="class_w_i_i.html#a6ac037d884f97319892e8671ef070c03">getRoll</a>() {</div>
<div class="line"><a name="l00160"></a><span class="lineno"> 160</span>&#160; <span class="keywordflow">return</span> roll;</div>
<div class="line"><a name="l00161"></a><span class="lineno"> 161</span>&#160; };</div>
<div class="line"><a name="l00162"></a><span class="lineno"> 162</span>&#160;</div>
<div class="line"><a name="l00169"></a><span class="lineno"><a class="code" href="class_w_i_i.html#ae92e129c54c8131f4a2c55582dfd2f11"> 169</a></span>&#160; <span class="keywordtype">double</span> <a class="code" href="class_w_i_i.html#ae92e129c54c8131f4a2c55582dfd2f11">getYaw</a>() {</div>
<div class="line"><a name="l00170"></a><span class="lineno"> 170</span>&#160; <span class="keywordflow">return</span> <a class="code" href="class_w_i_i.html#a988db5b35cfc3c543f93f49587a50e62">gyroYaw</a>;</div>
<div class="line"><a name="l00171"></a><span class="lineno"> 171</span>&#160; };</div>
<div class="line"><a name="l00172"></a><span class="lineno"> 172</span>&#160;</div>
<div class="line"><a name="l00174"></a><span class="lineno"> 174</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_w_i_i.html#a6e97bfcfb134b63d7190ba1bc326e1d3">setAllOff</a>();</div>
<div class="line"><a name="l00176"></a><span class="lineno"> 176</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_w_i_i.html#a2c5c32841b020b248f757cb793acb936">setRumbleOff</a>();</div>
<div class="line"><a name="l00178"></a><span class="lineno"> 178</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_w_i_i.html#a0d9c869bd3677c4488a586c38558a137">setRumbleOn</a>();</div>
<div class="line"><a name="l00180"></a><span class="lineno"> 180</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_w_i_i.html#a841396b533cccccb05db37d35f6fef9c">setRumbleToggle</a>();</div>
<div class="line"><a name="l00181"></a><span class="lineno"> 181</span>&#160;</div>
<div class="line"><a name="l00186"></a><span class="lineno"> 186</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_w_i_i.html#ae7e07f929fba8f0ff061a1405baa2b58">setLedRaw</a>(uint8_t value);</div>
<div class="line"><a name="l00191"></a><span class="lineno"> 191</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_w_i_i.html#a7efe7577ba30c218f6fbd3804a53d242">setLedOff</a>(<a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6">LED</a> a);</div>
<div class="line"><a name="l00196"></a><span class="lineno"> 196</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_w_i_i.html#a3a7b9dd571c5a8597bfb194000bd517c">setLedOn</a>(<a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6">LED</a> a);</div>
<div class="line"><a name="l00201"></a><span class="lineno"> 201</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_w_i_i.html#af7755e2b2a161a550c99de2ca1018ce3">setLedToggle</a>(<a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6">LED</a> a);</div>
<div class="line"><a name="l00211"></a><span class="lineno"> 211</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_w_i_i.html#a5d3b4a33ebc2ca9ebb154e10a05dbdd4">setLedStatus</a>();</div>
<div class="line"><a name="l00212"></a><span class="lineno"> 212</span>&#160;</div>
<div class="line"><a name="l00216"></a><span class="lineno"> 216</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_w_i_i.html#acf275afab058a712ab84fac6c38f8f54">statusRequest</a>();</div>
<div class="line"><a name="l00221"></a><span class="lineno"><a class="code" href="class_w_i_i.html#ae946f7d6e9ce89fb083f5f138c0736c2"> 221</a></span>&#160; uint8_t <a class="code" href="class_w_i_i.html#ae946f7d6e9ce89fb083f5f138c0736c2">getBatteryLevel</a>() {</div>
<div class="line"><a name="l00222"></a><span class="lineno"> 222</span>&#160; <span class="keywordflow">return</span> batteryLevel;</div>
<div class="line"><a name="l00223"></a><span class="lineno"> 223</span>&#160; };</div>
<div class="line"><a name="l00228"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a8e9ac1d379db5c07c478401046a1c0ac"> 228</a></span>&#160; uint8_t <a class="code" href="class_w_i_i.html#a8e9ac1d379db5c07c478401046a1c0ac">getWiiState</a>() {</div>
<div class="line"><a name="l00229"></a><span class="lineno"> 229</span>&#160; <span class="keywordflow">return</span> wiiState;</div>
<div class="line"><a name="l00230"></a><span class="lineno"><a class="code" href="class_w_i_i.html#ae25a8ea1b0713801e0209e795b4596fa"> 230</a></span>&#160; };</div>
<div class="line"><a name="l00235"></a><span class="lineno"> 235</span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_w_i_i.html#ae25a8ea1b0713801e0209e795b4596fa">wiimoteConnected</a>;</div>
<div class="line"><a name="l00237"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a7cb4cec343c65fd350e6b05043d7f1a8"> 237</a></span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_w_i_i.html#a7cb4cec343c65fd350e6b05043d7f1a8">nunchuckConnected</a>;</div>
<div class="line"><a name="l00239"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a72bd4fad2e524276712a154b8cc2a16c"> 239</a></span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_w_i_i.html#a72bd4fad2e524276712a154b8cc2a16c">motionPlusConnected</a>;</div>
<div class="line"><a name="l00241"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a461f5b7a5f2bc874e107fc776c284b16"> 241</a></span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_w_i_i.html#a461f5b7a5f2bc874e107fc776c284b16">wiiUProControllerConnected</a>;</div>
<div class="line"><a name="l00244"></a><span class="lineno"> 244</span>&#160; <span class="comment">/* IMU Data, might be usefull if you need to do something more advanced than just calculating the angle */</span></div>
<div class="line"><a name="l00245"></a><span class="lineno"> 245</span>&#160;</div>
<div class="line"><a name="l00248"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a1421306c25a76c0fa24f7ee4b10b757b"> 248</a></span>&#160; <span class="keywordtype">double</span> <a class="code" href="class_w_i_i.html#a1421306c25a76c0fa24f7ee4b10b757b">wiimotePitch</a>;</div>
<div class="line"><a name="l00249"></a><span class="lineno"><a class="code" href="class_w_i_i.html#ab22594da86218dccf86806b13d6a7a70"> 249</a></span>&#160; <span class="keywordtype">double</span> <a class="code" href="class_w_i_i.html#ab22594da86218dccf86806b13d6a7a70">wiimoteRoll</a>;</div>
<div class="line"><a name="l00254"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a2b5a934a1be4d7c5e788d3742dd09cbf"> 254</a></span>&#160; <span class="keywordtype">double</span> <a class="code" href="class_w_i_i.html#a2b5a934a1be4d7c5e788d3742dd09cbf">nunchuckPitch</a>;</div>
<div class="line"><a name="l00255"></a><span class="lineno"><a class="code" href="class_w_i_i.html#ad6c01ce2e1f7bac2c8982ecfb3f53f71"> 255</a></span>&#160; <span class="keywordtype">double</span> <a class="code" href="class_w_i_i.html#ad6c01ce2e1f7bac2c8982ecfb3f53f71">nunchuckRoll</a>;</div>
<div class="line"><a name="l00260"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a48bcc2e5c6253d0554d70357625ff3fb"> 260</a></span>&#160; int16_t <a class="code" href="class_w_i_i.html#a48bcc2e5c6253d0554d70357625ff3fb">accX</a>;</div>
<div class="line"><a name="l00261"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a07bef4e4acd42d680ac676b0e6315b2a"> 261</a></span>&#160; int16_t <a class="code" href="class_w_i_i.html#a07bef4e4acd42d680ac676b0e6315b2a">accY</a>;</div>
<div class="line"><a name="l00262"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a7323e1f8b76f3f11f91cdb9601759cc4"> 262</a></span>&#160; int16_t <a class="code" href="class_w_i_i.html#a7323e1f8b76f3f11f91cdb9601759cc4">accZ</a>;</div>
<div class="line"><a name="l00265"></a><span class="lineno"> 265</span>&#160; <span class="comment">/* Variables for the gyro inside the Motion Plus */</span></div>
<div class="line"><a name="l00267"></a><span class="lineno"><a class="code" href="class_w_i_i.html#af61f57d34b81f2a878f0126a074e3af4"> 267</a></span>&#160; <span class="keywordtype">double</span> <a class="code" href="class_w_i_i.html#af61f57d34b81f2a878f0126a074e3af4">gyroPitch</a>;</div>
<div class="line"><a name="l00269"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a2a0e4745bff7cfec644bcebe984c2bc8"> 269</a></span>&#160; <span class="keywordtype">double</span> <a class="code" href="class_w_i_i.html#a2a0e4745bff7cfec644bcebe984c2bc8">gyroRoll</a>;</div>
<div class="line"><a name="l00271"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a988db5b35cfc3c543f93f49587a50e62"> 271</a></span>&#160; <span class="keywordtype">double</span> <a class="code" href="class_w_i_i.html#a988db5b35cfc3c543f93f49587a50e62">gyroYaw</a>;</div>
<div class="line"><a name="l00272"></a><span class="lineno"> 272</span>&#160;</div>
<div class="line"><a name="l00275"></a><span class="lineno"><a class="code" href="class_w_i_i.html#acfb290a86aa9a65dd4ae84d02e3c6ded"> 275</a></span>&#160; <span class="keywordtype">double</span> <a class="code" href="class_w_i_i.html#acfb290a86aa9a65dd4ae84d02e3c6ded">pitchGyroSpeed</a>;</div>
<div class="line"><a name="l00276"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a3fb552c6ad486e23434dcb347a2a4b84"> 276</a></span>&#160; <span class="keywordtype">double</span> <a class="code" href="class_w_i_i.html#a3fb552c6ad486e23434dcb347a2a4b84">rollGyroSpeed</a>;</div>
<div class="line"><a name="l00277"></a><span class="lineno"><a class="code" href="class_w_i_i.html#ad5df436cc5d073f26bf3ea5c60d788d6"> 277</a></span>&#160; <span class="keywordtype">double</span> <a class="code" href="class_w_i_i.html#ad5df436cc5d073f26bf3ea5c60d788d6">yawGyroSpeed</a>;</div>
<div class="line"><a name="l00282"></a><span class="lineno"><a class="code" href="class_w_i_i.html#aea6ce6f3222df3e547e9957673c7a07a"> 282</a></span>&#160; uint16_t <a class="code" href="class_w_i_i.html#aea6ce6f3222df3e547e9957673c7a07a">pitchGyroScale</a>;</div>
<div class="line"><a name="l00283"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a6c0971ae4c9ab752888a5871020c8331"> 283</a></span>&#160; uint16_t <a class="code" href="class_w_i_i.html#a6c0971ae4c9ab752888a5871020c8331">rollGyroScale</a>;</div>
<div class="line"><a name="l00284"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a0694969a30092b9b1dcb26120c7cff73"> 284</a></span>&#160; uint16_t <a class="code" href="class_w_i_i.html#a0694969a30092b9b1dcb26120c7cff73">yawGyroScale</a>;</div>
<div class="line"><a name="l00289"></a><span class="lineno"><a class="code" href="class_w_i_i.html#ab813b65548e827f41a5192fcc34056ea"> 289</a></span>&#160; int16_t <a class="code" href="class_w_i_i.html#ab813b65548e827f41a5192fcc34056ea">gyroYawRaw</a>;</div>
<div class="line"><a name="l00290"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a0784c779ebeae2d459996c35a54ee3b8"> 290</a></span>&#160; int16_t <a class="code" href="class_w_i_i.html#a0784c779ebeae2d459996c35a54ee3b8">gyroRollRaw</a>;</div>
<div class="line"><a name="l00291"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a749ea9dd39ba9a5320c5b24ce93bc544"> 291</a></span>&#160; int16_t <a class="code" href="class_w_i_i.html#a749ea9dd39ba9a5320c5b24ce93bc544">gyroPitchRaw</a>;</div>
<div class="line"><a name="l00296"></a><span class="lineno"><a class="code" href="class_w_i_i.html#ad4f0d2456c56414f9b8013b85a1ee7d2"> 296</a></span>&#160; int16_t <a class="code" href="class_w_i_i.html#ad4f0d2456c56414f9b8013b85a1ee7d2">gyroYawZero</a>;</div>
<div class="line"><a name="l00297"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a10d91cd5d73bc655be776b44d27004c9"> 297</a></span>&#160; int16_t <a class="code" href="class_w_i_i.html#a10d91cd5d73bc655be776b44d27004c9">gyroRollZero</a>;</div>
<div class="line"><a name="l00298"></a><span class="lineno"><a class="code" href="class_w_i_i.html#abbc31ecd4495d70258cfa095e34cb3c3"> 298</a></span>&#160; int16_t <a class="code" href="class_w_i_i.html#abbc31ecd4495d70258cfa095e34cb3c3">gyroPitchZero</a>;</div>
<div class="line"><a name="l00301"></a><span class="lineno"> 301</span>&#160;<span class="preprocessor">#ifdef WIICAMERA</span></div>
<div class="line"><a name="l00302"></a><span class="lineno"> 302</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00306"></a><span class="lineno"> 306</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_w_i_i.html#a3505abbc01c71d134ce301dfb7c0c5b5">IRinitialize</a>();</div>
<div class="line"><a name="l00307"></a><span class="lineno"> 307</span>&#160;</div>
<div class="line"><a name="l00312"></a><span class="lineno"><a class="code" href="class_w_i_i.html#af380eb3bf65ce33a60aaf35f74a44f6d"> 312</a></span>&#160; uint16_t <a class="code" href="class_w_i_i.html#af380eb3bf65ce33a60aaf35f74a44f6d">getIRx1</a>() {</div>
<div class="line"><a name="l00313"></a><span class="lineno"> 313</span>&#160; <span class="keywordflow">return</span> IR_object_x1;</div>
<div class="line"><a name="l00314"></a><span class="lineno"> 314</span>&#160; };</div>
<div class="line"><a name="l00315"></a><span class="lineno"> 315</span>&#160;</div>
<div class="line"><a name="l00320"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a341b9a50bfdb18af9c66a3079e5804d9"> 320</a></span>&#160; uint16_t <a class="code" href="class_w_i_i.html#a341b9a50bfdb18af9c66a3079e5804d9">getIRy1</a>() {</div>
<div class="line"><a name="l00321"></a><span class="lineno"> 321</span>&#160; <span class="keywordflow">return</span> IR_object_y1;</div>
<div class="line"><a name="l00322"></a><span class="lineno"> 322</span>&#160; };</div>
<div class="line"><a name="l00323"></a><span class="lineno"> 323</span>&#160;</div>
<div class="line"><a name="l00328"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a2d8fd822e6e9c271d59c71dc7b757421"> 328</a></span>&#160; uint8_t <a class="code" href="class_w_i_i.html#a2d8fd822e6e9c271d59c71dc7b757421">getIRs1</a>() {</div>
<div class="line"><a name="l00329"></a><span class="lineno"> 329</span>&#160; <span class="keywordflow">return</span> IR_object_s1;</div>
<div class="line"><a name="l00330"></a><span class="lineno"> 330</span>&#160; };</div>
<div class="line"><a name="l00331"></a><span class="lineno"> 331</span>&#160;</div>
<div class="line"><a name="l00336"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a551e48a50c7b60722e807e68ae25f084"> 336</a></span>&#160; uint16_t <a class="code" href="class_w_i_i.html#a551e48a50c7b60722e807e68ae25f084">getIRx2</a>() {</div>
<div class="line"><a name="l00337"></a><span class="lineno"> 337</span>&#160; <span class="keywordflow">return</span> IR_object_x2;</div>
<div class="line"><a name="l00338"></a><span class="lineno"> 338</span>&#160; };</div>
<div class="line"><a name="l00339"></a><span class="lineno"> 339</span>&#160;</div>
<div class="line"><a name="l00344"></a><span class="lineno"><a class="code" href="class_w_i_i.html#ae148de3c99b3fb4ef65ea62d2848df7d"> 344</a></span>&#160; uint16_t <a class="code" href="class_w_i_i.html#ae148de3c99b3fb4ef65ea62d2848df7d">getIRy2</a>() {</div>
<div class="line"><a name="l00345"></a><span class="lineno"> 345</span>&#160; <span class="keywordflow">return</span> IR_object_y2;</div>
<div class="line"><a name="l00346"></a><span class="lineno"> 346</span>&#160; };</div>
<div class="line"><a name="l00347"></a><span class="lineno"> 347</span>&#160;</div>
<div class="line"><a name="l00352"></a><span class="lineno"><a class="code" href="class_w_i_i.html#accf6ca623ffe93b3c78aaf60c7fd1f46"> 352</a></span>&#160; uint8_t <a class="code" href="class_w_i_i.html#accf6ca623ffe93b3c78aaf60c7fd1f46">getIRs2</a>() {</div>
<div class="line"><a name="l00353"></a><span class="lineno"> 353</span>&#160; <span class="keywordflow">return</span> IR_object_s2;</div>
<div class="line"><a name="l00354"></a><span class="lineno"> 354</span>&#160; };</div>
<div class="line"><a name="l00355"></a><span class="lineno"> 355</span>&#160;</div>
<div class="line"><a name="l00360"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a5648a03968d0c2331867f9b7bcaa3e3e"> 360</a></span>&#160; uint16_t <a class="code" href="class_w_i_i.html#a5648a03968d0c2331867f9b7bcaa3e3e">getIRx3</a>() {</div>
<div class="line"><a name="l00361"></a><span class="lineno"> 361</span>&#160; <span class="keywordflow">return</span> IR_object_x3;</div>
<div class="line"><a name="l00362"></a><span class="lineno"> 362</span>&#160; };</div>
<div class="line"><a name="l00363"></a><span class="lineno"> 363</span>&#160;</div>
<div class="line"><a name="l00368"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a5e778f879c6d0a73a94bd61e42d05b8d"> 368</a></span>&#160; uint16_t <a class="code" href="class_w_i_i.html#a5e778f879c6d0a73a94bd61e42d05b8d">getIRy3</a>() {</div>
<div class="line"><a name="l00369"></a><span class="lineno"> 369</span>&#160; <span class="keywordflow">return</span> IR_object_y3;</div>
<div class="line"><a name="l00370"></a><span class="lineno"> 370</span>&#160; };</div>
<div class="line"><a name="l00371"></a><span class="lineno"> 371</span>&#160;</div>
<div class="line"><a name="l00376"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a05841e1975803d561f80aeb3dd0a4a1e"> 376</a></span>&#160; uint8_t <a class="code" href="class_w_i_i.html#a05841e1975803d561f80aeb3dd0a4a1e">getIRs3</a>() {</div>
<div class="line"><a name="l00377"></a><span class="lineno"> 377</span>&#160; <span class="keywordflow">return</span> IR_object_s3;</div>
<div class="line"><a name="l00378"></a><span class="lineno"> 378</span>&#160; };</div>
<div class="line"><a name="l00379"></a><span class="lineno"> 379</span>&#160;</div>
<div class="line"><a name="l00380"></a><span class="lineno"> 380</span>&#160; uint16_t stateCounter;</div>
<div class="line"><a name="l00381"></a><span class="lineno"> 381</span>&#160; <span class="keywordtype">bool</span> unknownExtensionConnected;</div>
<div class="line"><a name="l00382"></a><span class="lineno"> 382</span>&#160; <span class="keywordtype">bool</span> extensionConnected;</div>
<div class="line"><a name="l00383"></a><span class="lineno"> 383</span>&#160; </div>
<div class="line"><a name="l00384"></a><span class="lineno"> 384</span>&#160; <span class="comment">/* L2CAP Channels */</span></div>
<div class="line"><a name="l00385"></a><span class="lineno"> 385</span>&#160; uint8_t control_scid[2]; <span class="comment">// L2CAP source CID for HID_Control</span></div>
<div class="line"><a name="l00386"></a><span class="lineno"> 386</span>&#160; uint8_t control_dcid[2]; <span class="comment">// 0x0060</span></div>
<div class="line"><a name="l00387"></a><span class="lineno"> 387</span>&#160; uint8_t interrupt_scid[2]; <span class="comment">// L2CAP source CID for HID_Interrupt</span></div>
<div class="line"><a name="l00388"></a><span class="lineno"> 388</span>&#160; uint8_t interrupt_dcid[2]; <span class="comment">// 0x0061</span></div>
<div class="line"><a name="l00389"></a><span class="lineno"> 389</span>&#160; uint8_t identifier; <span class="comment">// Identifier for connection</span></div>
<div class="line"><a name="l00390"></a><span class="lineno"> 390</span>&#160; </div>
<div class="line"><a name="l00391"></a><span class="lineno"> 391</span>&#160; <span class="comment">/* HID Commands */</span></div>
<div class="line"><a name="l00392"></a><span class="lineno"> 392</span>&#160; <span class="keywordtype">void</span> HID_Command(uint8_t* data, uint8_t nbytes);</div>
<div class="line"><a name="l00393"></a><span class="lineno"> 393</span>&#160; <span class="keywordtype">void</span> setReportMode(<span class="keywordtype">bool</span> continuous, uint8_t mode);</div>
<div class="line"><a name="l00394"></a><span class="lineno"> 394</span>&#160; <span class="keywordtype">void</span> statusRequest();</div>
<div class="line"><a name="l00384"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a7a92d63c7cf9d3d5b38bdb9ad4d7ef66"> 384</a></span>&#160; uint16_t <a class="code" href="class_w_i_i.html#a7a92d63c7cf9d3d5b38bdb9ad4d7ef66">getIRx4</a>() {</div>
<div class="line"><a name="l00385"></a><span class="lineno"> 385</span>&#160; <span class="keywordflow">return</span> IR_object_x4;</div>
<div class="line"><a name="l00386"></a><span class="lineno"> 386</span>&#160; };</div>
<div class="line"><a name="l00387"></a><span class="lineno"> 387</span>&#160;</div>
<div class="line"><a name="l00392"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a759837b933f63ce7c3235639be29250a"> 392</a></span>&#160; uint16_t <a class="code" href="class_w_i_i.html#a759837b933f63ce7c3235639be29250a">getIRy4</a>() {</div>
<div class="line"><a name="l00393"></a><span class="lineno"> 393</span>&#160; <span class="keywordflow">return</span> IR_object_y4;</div>
<div class="line"><a name="l00394"></a><span class="lineno"> 394</span>&#160; };</div>
<div class="line"><a name="l00395"></a><span class="lineno"> 395</span>&#160;</div>
<div class="line"><a name="l00396"></a><span class="lineno"> 396</span>&#160; <span class="keywordtype">void</span> writeData(uint32_t offset, uint8_t size, uint8_t* data);</div>
<div class="line"><a name="l00397"></a><span class="lineno"> 397</span>&#160; <span class="keywordtype">void</span> initExtension1();</div>
<div class="line"><a name="l00398"></a><span class="lineno"> 398</span>&#160; <span class="keywordtype">void</span> initExtension2();</div>
<div class="line"><a name="l00399"></a><span class="lineno"> 399</span>&#160; </div>
<div class="line"><a name="l00400"></a><span class="lineno"> 400</span>&#160; <span class="keywordtype">void</span> readData(uint32_t offset, uint16_t size, <span class="keywordtype">bool</span> EEPROM);</div>
<div class="line"><a name="l00401"></a><span class="lineno"> 401</span>&#160; <span class="keywordtype">void</span> readExtensionType();</div>
<div class="line"><a name="l00402"></a><span class="lineno"> 402</span>&#160; <span class="keywordtype">void</span> readCalData();</div>
<div class="line"><a name="l00400"></a><span class="lineno"><a class="code" href="class_w_i_i.html#aef56b9f37422b0a41642b39d10db0735"> 400</a></span>&#160; uint8_t <a class="code" href="class_w_i_i.html#aef56b9f37422b0a41642b39d10db0735">getIRs4</a>() {</div>
<div class="line"><a name="l00401"></a><span class="lineno"> 401</span>&#160; <span class="keywordflow">return</span> IR_object_s4;</div>
<div class="line"><a name="l00402"></a><span class="lineno"> 402</span>&#160; };</div>
<div class="line"><a name="l00403"></a><span class="lineno"> 403</span>&#160;</div>
<div class="line"><a name="l00404"></a><span class="lineno"> 404</span>&#160; <span class="keywordtype">void</span> checkMotionPresent(); <span class="comment">// Used to see if a Motion Plus is connected to the Wiimote</span></div>
<div class="line"><a name="l00405"></a><span class="lineno"> 405</span>&#160; <span class="keywordtype">void</span> initMotionPlus();</div>
<div class="line"><a name="l00406"></a><span class="lineno"> 406</span>&#160; <span class="keywordtype">void</span> activateMotionPlus();</div>
<div class="line"><a name="l00407"></a><span class="lineno"> 407</span>&#160;</div>
<div class="line"><a name="l00408"></a><span class="lineno"> 408</span>&#160; <span class="keywordtype">double</span> pitch; <span class="comment">// Fusioned angle using a complimentary filter if the Motion Plus is connected</span></div>
<div class="line"><a name="l00409"></a><span class="lineno"> 409</span>&#160; <span class="keywordtype">double</span> roll; <span class="comment">// Fusioned angle using a complimentary filter if the Motion Plus is connected</span></div>
<div class="line"><a name="l00410"></a><span class="lineno"> 410</span>&#160; </div>
<div class="line"><a name="l00411"></a><span class="lineno"> 411</span>&#160; <span class="keywordtype">bool</span> activateNunchuck;</div>
<div class="line"><a name="l00412"></a><span class="lineno"> 412</span>&#160; <span class="keywordtype">bool</span> motionValuesReset; <span class="comment">// This bool is true when the gyro values has been reset</span></div>
<div class="line"><a name="l00413"></a><span class="lineno"> 413</span>&#160; <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> timer;</div>
<div class="line"><a name="l00414"></a><span class="lineno"> 414</span>&#160;</div>
<div class="line"><a name="l00415"></a><span class="lineno"> 415</span>&#160; uint8_t wiiState; <span class="comment">// Stores the value in l2capinbuf[12] - (0x01: Battery is nearly empty), (0x02: An Extension Controller is connected), (0x04: Speaker enabled), (0x08: IR enabled), (0x10: LED1, 0x20: LED2, 0x40: LED3, 0x80: LED4)</span></div>
<div class="line"><a name="l00416"></a><span class="lineno"> 416</span>&#160; uint8_t batteryLevel;</div>
<div class="line"><a name="l00417"></a><span class="lineno"> 417</span>&#160; </div>
<div class="line"><a name="l00418"></a><span class="lineno"> 418</span>&#160;<span class="preprocessor">#ifdef WIICAMERA</span></div>
<div class="line"><a name="l00419"></a><span class="lineno"> 419</span>&#160;<span class="preprocessor"></span> <span class="comment">/* Private function and variables for the readings from teh IR Camera */</span></div>
<div class="line"><a name="l00420"></a><span class="lineno"> 420</span>&#160; <span class="keywordtype">void</span> enableIRCamera1(); <span class="comment">// Sets bit 2 of output report 13 </span></div>
<div class="line"><a name="l00421"></a><span class="lineno"> 421</span>&#160; <span class="keywordtype">void</span> enableIRCamera2(); <span class="comment">// Sets bit 2 of output report 1A</span></div>
<div class="line"><a name="l00422"></a><span class="lineno"> 422</span>&#160; <span class="keywordtype">void</span> writeSensitivityBlock1();</div>
<div class="line"><a name="l00423"></a><span class="lineno"> 423</span>&#160; <span class="keywordtype">void</span> writeSensitivityBlock2();</div>
<div class="line"><a name="l00424"></a><span class="lineno"> 424</span>&#160; <span class="keywordtype">void</span> write0x08Value();</div>
<div class="line"><a name="l00425"></a><span class="lineno"> 425</span>&#160; <span class="keywordtype">void</span> setWiiModeNumber(uint8_t mode_number);</div>
<div class="line"><a name="l00426"></a><span class="lineno"> 426</span>&#160; </div>
<div class="line"><a name="l00427"></a><span class="lineno"> 427</span>&#160; uint16_t IR_object_x1; <span class="comment">// IR x position 10 bits</span></div>
<div class="line"><a name="l00428"></a><span class="lineno"> 428</span>&#160; uint16_t IR_object_y1; <span class="comment">// IR y position 10 bits</span></div>
<div class="line"><a name="l00429"></a><span class="lineno"> 429</span>&#160; uint8_t IR_object_s1; <span class="comment">// IR size value</span></div>
<div class="line"><a name="l00430"></a><span class="lineno"> 430</span>&#160; uint16_t IR_object_x2;</div>
<div class="line"><a name="l00431"></a><span class="lineno"> 431</span>&#160; uint16_t IR_object_y2;</div>
<div class="line"><a name="l00432"></a><span class="lineno"> 432</span>&#160; uint8_t IR_object_s2;</div>
<div class="line"><a name="l00433"></a><span class="lineno"> 433</span>&#160; uint16_t IR_object_x3; <span class="comment">// IR x position 10 bits</span></div>
<div class="line"><a name="l00434"></a><span class="lineno"> 434</span>&#160; uint16_t IR_object_y3; <span class="comment">// IR y position 10 bits</span></div>
<div class="line"><a name="l00435"></a><span class="lineno"> 435</span>&#160; uint8_t IR_object_s3; <span class="comment">// IR size value</span></div>
<div class="line"><a name="l00436"></a><span class="lineno"> 436</span>&#160; uint16_t IR_object_x4;</div>
<div class="line"><a name="l00437"></a><span class="lineno"> 437</span>&#160; uint16_t IR_object_y4;</div>
<div class="line"><a name="l00438"></a><span class="lineno"> 438</span>&#160; uint8_t IR_object_s4;</div>
<div class="line"><a name="l00439"></a><span class="lineno"> 439</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00440"></a><span class="lineno"> 440</span>&#160;<span class="preprocessor"></span>};</div>
<div class="line"><a name="l00441"></a><span class="lineno"> 441</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00409"></a><span class="lineno"><a class="code" href="class_w_i_i.html#a0a444d7e348026e062751cf723877e8f"> 409</a></span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_w_i_i.html#a0a444d7e348026e062751cf723877e8f">isIRCameraEnabled</a>() {</div>
<div class="line"><a name="l00410"></a><span class="lineno"> 410</span>&#160; <span class="keywordflow">return</span>(wiiState &amp; 0x08);</div>
<div class="line"><a name="l00411"></a><span class="lineno"> 411</span>&#160; };</div>
<div class="line"><a name="l00413"></a><span class="lineno"> 413</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00414"></a><span class="lineno"> 414</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00415"></a><span class="lineno"> 415</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00416"></a><span class="lineno"> 416</span>&#160; <span class="comment">/* Mandatory members */</span></div>
<div class="line"><a name="l00417"></a><span class="lineno"> 417</span>&#160; <a class="code" href="class_b_t_d.html">BTD</a> *pBtd;</div>
<div class="line"><a name="l00418"></a><span class="lineno"> 418</span>&#160;</div>
<div class="line"><a name="l00419"></a><span class="lineno"> 419</span>&#160; <span class="keywordtype">void</span> L2CAP_task(); <span class="comment">// L2CAP state machine</span></div>
<div class="line"><a name="l00420"></a><span class="lineno"> 420</span>&#160;</div>
<div class="line"><a name="l00421"></a><span class="lineno"> 421</span>&#160; <span class="comment">/* Variables filled from HCI event management */</span></div>
<div class="line"><a name="l00422"></a><span class="lineno"> 422</span>&#160; uint16_t hci_handle;</div>
<div class="line"><a name="l00423"></a><span class="lineno"> 423</span>&#160; <span class="keywordtype">bool</span> activeConnection; <span class="comment">// Used to indicate if it&#39;s already has established a connection</span></div>
<div class="line"><a name="l00424"></a><span class="lineno"> 424</span>&#160;</div>
<div class="line"><a name="l00425"></a><span class="lineno"> 425</span>&#160; <span class="comment">/* variables used by high level L2CAP task */</span></div>
<div class="line"><a name="l00426"></a><span class="lineno"> 426</span>&#160; uint8_t l2cap_state;</div>
<div class="line"><a name="l00427"></a><span class="lineno"> 427</span>&#160; uint16_t l2cap_event_flag; <span class="comment">// l2cap flags of received bluetooth events</span></div>
<div class="line"><a name="l00428"></a><span class="lineno"> 428</span>&#160;</div>
<div class="line"><a name="l00429"></a><span class="lineno"> 429</span>&#160; uint32_t ButtonState;</div>
<div class="line"><a name="l00430"></a><span class="lineno"> 430</span>&#160; uint32_t OldButtonState;</div>
<div class="line"><a name="l00431"></a><span class="lineno"> 431</span>&#160; uint32_t ButtonClickState;</div>
<div class="line"><a name="l00432"></a><span class="lineno"> 432</span>&#160; uint16_t hatValues[4];</div>
<div class="line"><a name="l00433"></a><span class="lineno"> 433</span>&#160;</div>
<div class="line"><a name="l00434"></a><span class="lineno"> 434</span>&#160; uint8_t HIDBuffer[3]; <span class="comment">// Used to store HID commands</span></div>
<div class="line"><a name="l00435"></a><span class="lineno"> 435</span>&#160;</div>
<div class="line"><a name="l00436"></a><span class="lineno"> 436</span>&#160; uint16_t stateCounter;</div>
<div class="line"><a name="l00437"></a><span class="lineno"> 437</span>&#160; <span class="keywordtype">bool</span> unknownExtensionConnected;</div>
<div class="line"><a name="l00438"></a><span class="lineno"> 438</span>&#160; <span class="keywordtype">bool</span> extensionConnected;</div>
<div class="line"><a name="l00439"></a><span class="lineno"> 439</span>&#160;</div>
<div class="line"><a name="l00440"></a><span class="lineno"> 440</span>&#160; <span class="comment">/* L2CAP Channels */</span></div>
<div class="line"><a name="l00441"></a><span class="lineno"> 441</span>&#160; uint8_t control_scid[2]; <span class="comment">// L2CAP source CID for HID_Control</span></div>
<div class="line"><a name="l00442"></a><span class="lineno"> 442</span>&#160; uint8_t control_dcid[2]; <span class="comment">// 0x0060</span></div>
<div class="line"><a name="l00443"></a><span class="lineno"> 443</span>&#160; uint8_t interrupt_scid[2]; <span class="comment">// L2CAP source CID for HID_Interrupt</span></div>
<div class="line"><a name="l00444"></a><span class="lineno"> 444</span>&#160; uint8_t interrupt_dcid[2]; <span class="comment">// 0x0061</span></div>
<div class="line"><a name="l00445"></a><span class="lineno"> 445</span>&#160; uint8_t identifier; <span class="comment">// Identifier for connection</span></div>
<div class="line"><a name="l00446"></a><span class="lineno"> 446</span>&#160;</div>
<div class="line"><a name="l00447"></a><span class="lineno"> 447</span>&#160; <span class="comment">/* HID Commands */</span></div>
<div class="line"><a name="l00448"></a><span class="lineno"> 448</span>&#160; <span class="keywordtype">void</span> HID_Command(uint8_t* data, uint8_t nbytes);</div>
<div class="line"><a name="l00449"></a><span class="lineno"> 449</span>&#160; <span class="keywordtype">void</span> setReportMode(<span class="keywordtype">bool</span> continuous, uint8_t mode);</div>
<div class="line"><a name="l00450"></a><span class="lineno"> 450</span>&#160;</div>
<div class="line"><a name="l00451"></a><span class="lineno"> 451</span>&#160; <span class="keywordtype">void</span> writeData(uint32_t offset, uint8_t size, uint8_t* data);</div>
<div class="line"><a name="l00452"></a><span class="lineno"> 452</span>&#160; <span class="keywordtype">void</span> initExtension1();</div>
<div class="line"><a name="l00453"></a><span class="lineno"> 453</span>&#160; <span class="keywordtype">void</span> initExtension2();</div>
<div class="line"><a name="l00454"></a><span class="lineno"> 454</span>&#160;</div>
<div class="line"><a name="l00455"></a><span class="lineno"> 455</span>&#160; <span class="keywordtype">void</span> readData(uint32_t offset, uint16_t size, <span class="keywordtype">bool</span> EEPROM);</div>
<div class="line"><a name="l00456"></a><span class="lineno"> 456</span>&#160; <span class="keywordtype">void</span> readExtensionType();</div>
<div class="line"><a name="l00457"></a><span class="lineno"> 457</span>&#160; <span class="keywordtype">void</span> readCalData();</div>
<div class="line"><a name="l00458"></a><span class="lineno"> 458</span>&#160;</div>
<div class="line"><a name="l00459"></a><span class="lineno"> 459</span>&#160; <span class="keywordtype">void</span> checkMotionPresent(); <span class="comment">// Used to see if a Motion Plus is connected to the Wiimote</span></div>
<div class="line"><a name="l00460"></a><span class="lineno"> 460</span>&#160; <span class="keywordtype">void</span> initMotionPlus();</div>
<div class="line"><a name="l00461"></a><span class="lineno"> 461</span>&#160; <span class="keywordtype">void</span> activateMotionPlus();</div>
<div class="line"><a name="l00462"></a><span class="lineno"> 462</span>&#160;</div>
<div class="line"><a name="l00463"></a><span class="lineno"> 463</span>&#160; <span class="keywordtype">double</span> pitch; <span class="comment">// Fusioned angle using a complimentary filter if the Motion Plus is connected</span></div>
<div class="line"><a name="l00464"></a><span class="lineno"> 464</span>&#160; <span class="keywordtype">double</span> roll; <span class="comment">// Fusioned angle using a complimentary filter if the Motion Plus is connected</span></div>
<div class="line"><a name="l00465"></a><span class="lineno"> 465</span>&#160;</div>
<div class="line"><a name="l00466"></a><span class="lineno"> 466</span>&#160; <span class="keywordtype">bool</span> activateNunchuck;</div>
<div class="line"><a name="l00467"></a><span class="lineno"> 467</span>&#160; <span class="keywordtype">bool</span> motionValuesReset; <span class="comment">// This bool is true when the gyro values has been reset</span></div>
<div class="line"><a name="l00468"></a><span class="lineno"> 468</span>&#160; <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> timer;</div>
<div class="line"><a name="l00469"></a><span class="lineno"> 469</span>&#160;</div>
<div class="line"><a name="l00470"></a><span class="lineno"> 470</span>&#160; uint8_t wiiState; <span class="comment">// Stores the value in l2capinbuf[12] - (0x01: Battery is nearly empty), (0x02: An Extension Controller is connected), (0x04: Speaker enabled), (0x08: IR enabled), (0x10: LED1, 0x20: LED2, 0x40: LED3, 0x80: LED4)</span></div>
<div class="line"><a name="l00471"></a><span class="lineno"> 471</span>&#160; uint8_t batteryLevel;</div>
<div class="line"><a name="l00472"></a><span class="lineno"> 472</span>&#160;</div>
<div class="line"><a name="l00473"></a><span class="lineno"> 473</span>&#160;<span class="preprocessor">#ifdef WIICAMERA</span></div>
<div class="line"><a name="l00474"></a><span class="lineno"> 474</span>&#160;<span class="preprocessor"></span> <span class="comment">/* Private function and variables for the readings from teh IR Camera */</span></div>
<div class="line"><a name="l00475"></a><span class="lineno"> 475</span>&#160; <span class="keywordtype">void</span> enableIRCamera1(); <span class="comment">// Sets bit 2 of output report 13</span></div>
<div class="line"><a name="l00476"></a><span class="lineno"> 476</span>&#160; <span class="keywordtype">void</span> enableIRCamera2(); <span class="comment">// Sets bit 2 of output report 1A</span></div>
<div class="line"><a name="l00477"></a><span class="lineno"> 477</span>&#160; <span class="keywordtype">void</span> writeSensitivityBlock1();</div>
<div class="line"><a name="l00478"></a><span class="lineno"> 478</span>&#160; <span class="keywordtype">void</span> writeSensitivityBlock2();</div>
<div class="line"><a name="l00479"></a><span class="lineno"> 479</span>&#160; <span class="keywordtype">void</span> write0x08Value();</div>
<div class="line"><a name="l00480"></a><span class="lineno"> 480</span>&#160; <span class="keywordtype">void</span> setWiiModeNumber(uint8_t mode_number);</div>
<div class="line"><a name="l00481"></a><span class="lineno"> 481</span>&#160;</div>
<div class="line"><a name="l00482"></a><span class="lineno"> 482</span>&#160; uint16_t IR_object_x1; <span class="comment">// IR x position 10 bits</span></div>
<div class="line"><a name="l00483"></a><span class="lineno"> 483</span>&#160; uint16_t IR_object_y1; <span class="comment">// IR y position 10 bits</span></div>
<div class="line"><a name="l00484"></a><span class="lineno"> 484</span>&#160; uint8_t IR_object_s1; <span class="comment">// IR size value</span></div>
<div class="line"><a name="l00485"></a><span class="lineno"> 485</span>&#160; uint16_t IR_object_x2;</div>
<div class="line"><a name="l00486"></a><span class="lineno"> 486</span>&#160; uint16_t IR_object_y2;</div>
<div class="line"><a name="l00487"></a><span class="lineno"> 487</span>&#160; uint8_t IR_object_s2;</div>
<div class="line"><a name="l00488"></a><span class="lineno"> 488</span>&#160; uint16_t IR_object_x3; <span class="comment">// IR x position 10 bits</span></div>
<div class="line"><a name="l00489"></a><span class="lineno"> 489</span>&#160; uint16_t IR_object_y3; <span class="comment">// IR y position 10 bits</span></div>
<div class="line"><a name="l00490"></a><span class="lineno"> 490</span>&#160; uint8_t IR_object_s3; <span class="comment">// IR size value</span></div>
<div class="line"><a name="l00491"></a><span class="lineno"> 491</span>&#160; uint16_t IR_object_x4;</div>
<div class="line"><a name="l00492"></a><span class="lineno"> 492</span>&#160; uint16_t IR_object_y4;</div>
<div class="line"><a name="l00493"></a><span class="lineno"> 493</span>&#160; uint8_t IR_object_s4;</div>
<div class="line"><a name="l00494"></a><span class="lineno"> 494</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00495"></a><span class="lineno"> 495</span>&#160;<span class="preprocessor"></span>};</div>
<div class="line"><a name="l00496"></a><span class="lineno"> 496</span>&#160;<span class="preprocessor">#endif</span></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>

View file

@ -87,17 +87,17 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<div class="contents">
<a href="_wii_camera_readme_8md.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;Please see &lt;http:<span class="comment">//wiibrew.org/wiki/Wiimote#IR_Camera&gt; for the complete capabilities of the Wii camera. The IR camera code was written based on the above website and with support from Kristian Lauszus.</span></div>
<div class="line"><a name="l00002"></a><span class="lineno"> 2</span>&#160;</div>
<div class="line"><a name="l00003"></a><span class="lineno"> 3</span>&#160;Must omit the <span class="stringliteral">&quot;.&quot;</span> in the name of the USB_Host_Shiled_2.0 library folder when inserting into the Arudino library folder.</div>
<div class="line"><a name="l00003"></a><span class="lineno"> 3</span>&#160;Must omit the <span class="stringliteral">&quot;.&quot;</span> in the name of the USB\_Host\_Shiled\_2.0 library folder when inserting into the Arudino library folder.</div>
<div class="line"><a name="l00004"></a><span class="lineno"> 4</span>&#160;</div>
<div class="line"><a name="l00005"></a><span class="lineno"> 5</span>&#160;This library is large, <span class="keywordflow">if</span> you run into memory problems when uploading to the arduino, comment out the #define <a class="code" href="_b_t_d_8cpp.html#ad72dbcf6d0153db1b8d8a58001feed83">DEBUG</a> in the <a class="code" href="class_b_t_d.html">BTD</a>.cpp and Wii.cpp files.</div>
<div class="line"><a name="l00005"></a><span class="lineno"> 5</span>&#160;This library is large, <span class="keywordflow">if</span> you run into memory problems when uploading to the Arduino, comment out the \#define <a class="code" href="_b_t_d_8cpp.html#ad72dbcf6d0153db1b8d8a58001feed83">DEBUG</a> in the <a class="code" href="class_b_t_d.html">BTD</a>.cpp and Wii.cpp files.</div>
<div class="line"><a name="l00006"></a><span class="lineno"> 6</span>&#160;</div>
<div class="line"><a name="l00007"></a><span class="lineno"> 7</span>&#160;To enable the IR camera code, uncomment #define <a class="code" href="_wii_8h.html#a8a70a2d3fd20f9005aa8dc5849beb147">WIICAMERA</a> in Wii.h.</div>
<div class="line"><a name="l00007"></a><span class="lineno"> 7</span>&#160;To enable the IR camera code, uncomment \#define <a class="code" href="_wii_8h.html#a8a70a2d3fd20f9005aa8dc5849beb147">WIICAMERA</a> in Wii.h.</div>
<div class="line"><a name="l00008"></a><span class="lineno"> 8</span>&#160;</div>
<div class="line"><a name="l00009"></a><span class="lineno"> 9</span>&#160;This library impliments the following settings:</div>
<div class="line"><a name="l00009"></a><span class="lineno"> 9</span>&#160;This library implements the following settings:</div>
<div class="line"><a name="l00010"></a><span class="lineno"> 10</span>&#160;</div>
<div class="line"><a name="l00011"></a><span class="lineno"> 11</span>&#160;* Report sensitivity mode: 00 00 00 00 00 00 90 00 41 40 00 Suggested by inio (high sensitivity)</div>
<div class="line"><a name="l00012"></a><span class="lineno"> 12</span>&#160;* Data Format: Extended mode (0x03). <a class="code" href="_p_s3_enums_8h.html#a67a0db04d321a74b7e7fcfd3f1a3f70ba8b7c5cd8bd8eb51ee6d3fd0eac584679">Full</a> mode is not working yet. The output reports 0x3e and 0x3f need tampering with</div>
<div class="line"><a name="l00013"></a><span class="lineno"> 13</span>&#160; * In <span class="keyword">this</span> mode the camera outputs x and y corridinates and a size dimension <span class="keywordflow">for</span> the 4 brightest points.</div>
<div class="line"><a name="l00013"></a><span class="lineno"> 13</span>&#160; * In <span class="keyword">this</span> mode the camera outputs x and y coordinates and a size dimension <span class="keywordflow">for</span> the 4 brightest points.</div>
<div class="line"><a name="l00014"></a><span class="lineno"> 14</span>&#160;</div>
<div class="line"><a name="l00015"></a><span class="lineno"> 15</span>&#160;Again, read through &lt;http:<span class="comment">//wiibrew.org/wiki/Wiimote#IR_Camera&gt; to get an understanding of the camera and its settings.</span></div>
</div><!-- fragment --></div><!-- contents -->

View file

@ -97,7 +97,7 @@ Include dependency graph for XBOXRECV.cpp:</div>
<div class="dyncontent">
<div class="center"><img src="_x_b_o_x_r_e_c_v_8cpp__incl.png" border="0" usemap="#_x_b_o_x_r_e_c_v_8cpp" alt=""/></div>
<map name="_x_b_o_x_r_e_c_v_8cpp" id="_x_b_o_x_r_e_c_v_8cpp">
<area shape="rect" id="node2" href="_x_b_o_x_r_e_c_v_8h.html" title="XBOXRECV.h" alt="" coords="719,75,792,96"/><area shape="rect" id="node4" href="_usb_8h.html" title="Usb.h" alt="" coords="397,144,440,165"/><area shape="rect" id="node18" href="xbox_enums_8h.html" title="xboxEnums.h" alt="" coords="798,144,868,165"/><area shape="rect" id="node7" href="avrpins_8h.html" title="avrpins.h" alt="" coords="528,283,582,304"/><area shape="rect" id="node9" href="max3421e_8h.html" title="max3421e.h" alt="" coords="146,283,213,304"/><area shape="rect" id="node10" href="usbhost_8h.html" title="usbhost.h" alt="" coords="212,213,269,235"/><area shape="rect" id="node11" href="usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="237,283,296,304"/><area shape="rect" id="node12" href="address_8h.html" title="address.h" alt="" coords="79,213,136,235"/><area shape="rect" id="node14" href="printhex_8h.html" title="printhex.h" alt="" coords="608,283,665,304"/><area shape="rect" id="node15" href="hexdump_8h.html" title="hexdump.h" alt="" coords="430,213,492,235"/><area shape="rect" id="node17" href="message_8h.html" title="message.h" alt="" coords="345,213,406,235"/><area shape="rect" id="node19" href="controller_enums_8h.html" title="controllerEnums.h" alt="" coords="794,213,880,235"/></map>
<area shape="rect" id="node2" href="_x_b_o_x_r_e_c_v_8h.html" title="XBOXRECV.h" alt="" coords="434,75,507,96"/><area shape="rect" id="node4" href="_usb_8h.html" title="Usb.h" alt="" coords="449,144,492,165"/><area shape="rect" id="node18" href="xbox_enums_8h.html" title="xboxEnums.h" alt="" coords="653,144,723,165"/><area shape="rect" id="node7" href="avrpins_8h.html" title="avrpins.h" alt="" coords="474,283,528,304"/><area shape="rect" id="node9" href="max3421e_8h.html" title="max3421e.h" alt="" coords="553,283,620,304"/><area shape="rect" id="node10" href="usbhost_8h.html" title="usbhost.h" alt="" coords="442,213,499,235"/><area shape="rect" id="node11" href="usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="391,283,449,304"/><area shape="rect" id="node12" href="address_8h.html" title="address.h" alt="" coords="701,213,757,235"/><area shape="rect" id="node14" href="message_8h.html" title="message.h" alt="" coords="204,213,265,235"/><area shape="rect" id="node16" href="printhex_8h.html" title="printhex.h" alt="" coords="71,283,128,304"/><area shape="rect" id="node17" href="hexdump_8h.html" title="hexdump.h" alt="" coords="204,283,265,304"/><area shape="rect" id="node19" href="controller_enums_8h.html" title="controllerEnums.h" alt="" coords="782,213,868,235"/></map>
</div>
</div>
<p><a href="_x_b_o_x_r_e_c_v_8cpp_source.html">Go to the source code of this file.</a></p>

View file

@ -1,14 +1,14 @@
<map id="XBOXRECV.cpp" name="XBOXRECV.cpp">
<area shape="rect" id="node2" href="$_x_b_o_x_r_e_c_v_8h.html" title="XBOXRECV.h" alt="" coords="719,75,792,96"/>
<area shape="rect" id="node4" href="$_usb_8h.html" title="Usb.h" alt="" coords="397,144,440,165"/>
<area shape="rect" id="node18" href="$xbox_enums_8h.html" title="xboxEnums.h" alt="" coords="798,144,868,165"/>
<area shape="rect" id="node7" href="$avrpins_8h.html" title="avrpins.h" alt="" coords="528,283,582,304"/>
<area shape="rect" id="node9" href="$max3421e_8h.html" title="max3421e.h" alt="" coords="146,283,213,304"/>
<area shape="rect" id="node10" href="$usbhost_8h.html" title="usbhost.h" alt="" coords="212,213,269,235"/>
<area shape="rect" id="node11" href="$usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="237,283,296,304"/>
<area shape="rect" id="node12" href="$address_8h.html" title="address.h" alt="" coords="79,213,136,235"/>
<area shape="rect" id="node14" href="$printhex_8h.html" title="printhex.h" alt="" coords="608,283,665,304"/>
<area shape="rect" id="node15" href="$hexdump_8h.html" title="hexdump.h" alt="" coords="430,213,492,235"/>
<area shape="rect" id="node17" href="$message_8h.html" title="message.h" alt="" coords="345,213,406,235"/>
<area shape="rect" id="node19" href="$controller_enums_8h.html" title="controllerEnums.h" alt="" coords="794,213,880,235"/>
<area shape="rect" id="node2" href="$_x_b_o_x_r_e_c_v_8h.html" title="XBOXRECV.h" alt="" coords="434,75,507,96"/>
<area shape="rect" id="node4" href="$_usb_8h.html" title="Usb.h" alt="" coords="449,144,492,165"/>
<area shape="rect" id="node18" href="$xbox_enums_8h.html" title="xboxEnums.h" alt="" coords="653,144,723,165"/>
<area shape="rect" id="node7" href="$avrpins_8h.html" title="avrpins.h" alt="" coords="474,283,528,304"/>
<area shape="rect" id="node9" href="$max3421e_8h.html" title="max3421e.h" alt="" coords="553,283,620,304"/>
<area shape="rect" id="node10" href="$usbhost_8h.html" title="usbhost.h" alt="" coords="442,213,499,235"/>
<area shape="rect" id="node11" href="$usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="391,283,449,304"/>
<area shape="rect" id="node12" href="$address_8h.html" title="address.h" alt="" coords="701,213,757,235"/>
<area shape="rect" id="node14" href="$message_8h.html" title="message.h" alt="" coords="204,213,265,235"/>
<area shape="rect" id="node16" href="$printhex_8h.html" title="printhex.h" alt="" coords="71,283,128,304"/>
<area shape="rect" id="node17" href="$hexdump_8h.html" title="hexdump.h" alt="" coords="204,283,265,304"/>
<area shape="rect" id="node19" href="$controller_enums_8h.html" title="controllerEnums.h" alt="" coords="782,213,868,235"/>
</map>

View file

@ -1 +1 @@
61989c7a9fc6a14c10c7e5dd46752793
3012a27875f68523ad5eb7ea0dd0b724

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 53 KiB

View file

@ -139,12 +139,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span>&#160; <span class="comment">// get memory address of USB device address pool</span></div>
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span>&#160; <a class="code" href="class_address_pool.html">AddressPool</a> &amp;addrPool = <a class="code" href="class_x_b_o_x_r_e_c_v.html#a53047c86c8c2f625916af62238d50fc8">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a66ab8f5eda239e761d5a48741ea1f9d4">GetAddressPool</a>();</div>
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span>&#160;<span class="preprocessor">#ifdef EXTRADEBUG</span></div>
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nXBOXRECV Init&quot;</span>));</div>
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a1e8693828152de8408add858dc461dea">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nXBOXRECV Init&quot;</span>), 0x80);</div>
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00053"></a><span class="lineno"> 53</span>&#160;<span class="preprocessor"></span> <span class="comment">// check if address has already been assigned to an instance</span></div>
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span>&#160; <span class="keywordflow">if</span> (<a class="code" href="class_x_b_o_x_r_e_c_v.html#a1d4bdb1b740c87fd51aca3969e67c730">bAddress</a>) {</div>
<div class="line"><a name="l00055"></a><span class="lineno"> 55</span>&#160;<span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nAddress in use&quot;</span>));</div>
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a1e8693828152de8408add858dc461dea">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nAddress in use&quot;</span>), 0x80);</div>
<div class="line"><a name="l00057"></a><span class="lineno"> 57</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span>&#160;<span class="preprocessor"></span> <span class="keywordflow">return</span> <a class="code" href="_usb_8h.html#a44416ff64fc0e3691f98addac13d4595">USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE</a>;</div>
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span>&#160; }</div>
@ -154,14 +154,14 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span>&#160;</div>
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>&#160; <span class="keywordflow">if</span> (!p) {</div>
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>&#160;<span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nAddress not found&quot;</span>));</div>
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a1e8693828152de8408add858dc461dea">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nAddress not found&quot;</span>), 0x80);</div>
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>&#160;<span class="preprocessor"></span> <span class="keywordflow">return</span> <a class="code" href="_usb_8h.html#afe2fedb4b0ccc89a688c0b4b59691ce0">USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL</a>;</div>
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>&#160; }</div>
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>&#160;</div>
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>&#160; <span class="keywordflow">if</span> (!p-&gt;<a class="code" href="struct_usb_device.html#a410d39fb7758157f57794335e990ed02">epinfo</a>) {</div>
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>&#160;<span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nepinfo is null&quot;</span>));</div>
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a1e8693828152de8408add858dc461dea">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nepinfo is null&quot;</span>), 0x80);</div>
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span>&#160;<span class="preprocessor"></span> <span class="keywordflow">return</span> <a class="code" href="_usb_8h.html#af192c59cafe2192ad802b22e6dbc077d">USB_ERROR_EPINFO_IS_NULL</a>;</div>
<div class="line"><a name="l00076"></a><span class="lineno"> 76</span>&#160; }</div>
@ -189,7 +189,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<div class="line"><a name="l00098"></a><span class="lineno"> 98</span>&#160; <span class="keywordflow">goto</span> FailUnknownDevice;</div>
<div class="line"><a name="l00099"></a><span class="lineno"> 99</span>&#160; <span class="keywordflow">else</span> <span class="keywordflow">if</span> (PID != <a class="code" href="_x_b_o_x_r_e_c_v_8h.html#a1a97ce2829a30b96ea6640d387d245a9">XBOX_WIRELESS_RECEIVER_PID</a> &amp;&amp; PID != <a class="code" href="_x_b_o_x_r_e_c_v_8h.html#a6842663964e470b86786f046e4bc30d9">XBOX_WIRELESS_RECEIVER_THIRD_PARTY_PID</a>) {</div>
<div class="line"><a name="l00100"></a><span class="lineno"> 100</span>&#160;<span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><a name="l00101"></a><span class="lineno"> 101</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nYou&#39;ll need a wireless receiver for this libary to work&quot;</span>));</div>
<div class="line"><a name="l00101"></a><span class="lineno"> 101</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a1e8693828152de8408add858dc461dea">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nYou&#39;ll need a wireless receiver for this libary to work&quot;</span>), 0x80);</div>
<div class="line"><a name="l00102"></a><span class="lineno"> 102</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00103"></a><span class="lineno"> 103</span>&#160;<span class="preprocessor"></span> <span class="keywordflow">goto</span> FailUnknownDevice;</div>
<div class="line"><a name="l00104"></a><span class="lineno"> 104</span>&#160; }</div>
@ -210,26 +210,26 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<div class="line"><a name="l00119"></a><span class="lineno"> 119</span>&#160; addrPool.<a class="code" href="class_address_pool.html#a15fde13223dcb1da89305ad229763562">FreeAddress</a>(<a class="code" href="class_x_b_o_x_r_e_c_v.html#a1d4bdb1b740c87fd51aca3969e67c730">bAddress</a>);</div>
<div class="line"><a name="l00120"></a><span class="lineno"> 120</span>&#160; <a class="code" href="class_x_b_o_x_r_e_c_v.html#a1d4bdb1b740c87fd51aca3969e67c730">bAddress</a> = 0;</div>
<div class="line"><a name="l00121"></a><span class="lineno"> 121</span>&#160;<span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><a name="l00122"></a><span class="lineno"> 122</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nsetAddr: &quot;</span>));</div>
<div class="line"><a name="l00122"></a><span class="lineno"> 122</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a1e8693828152de8408add858dc461dea">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nsetAddr: &quot;</span>), 0x80);</div>
<div class="line"><a name="l00123"></a><span class="lineno"> 123</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00124"></a><span class="lineno"> 124</span>&#160;<span class="preprocessor"></span> PrintHex&lt;uint8_t&gt;(rcode);</div>
<div class="line"><a name="l00124"></a><span class="lineno"> 124</span>&#160;<span class="preprocessor"></span> PrintHex&lt;uint8_t &gt; (rcode, 0x80);</div>
<div class="line"><a name="l00125"></a><span class="lineno"> 125</span>&#160; <span class="keywordflow">return</span> rcode;</div>
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span>&#160; }</div>
<div class="line"><a name="l00127"></a><span class="lineno"> 127</span>&#160;<span class="preprocessor">#ifdef EXTRADEBUG</span></div>
<div class="line"><a name="l00128"></a><span class="lineno"> 128</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nAddr: &quot;</span>));</div>
<div class="line"><a name="l00129"></a><span class="lineno"> 129</span>&#160; PrintHex&lt;uint8_t&gt;(<a class="code" href="class_x_b_o_x_r_e_c_v.html#a1d4bdb1b740c87fd51aca3969e67c730">bAddress</a>);</div>
<div class="line"><a name="l00128"></a><span class="lineno"> 128</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a1e8693828152de8408add858dc461dea">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nAddr: &quot;</span>), 0x80);</div>
<div class="line"><a name="l00129"></a><span class="lineno"> 129</span>&#160; PrintHex&lt;uint8_t &gt; (<a class="code" href="class_x_b_o_x_r_e_c_v.html#a1d4bdb1b740c87fd51aca3969e67c730">bAddress</a>, 0x80);</div>
<div class="line"><a name="l00130"></a><span class="lineno"> 130</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00131"></a><span class="lineno"> 131</span>&#160;<span class="preprocessor"></span> p-&gt;<a class="code" href="struct_usb_device.html#a86a815577ad7883437d3ca72b32b8e8a">lowspeed</a> = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00132"></a><span class="lineno"> 132</span>&#160;</div>
<div class="line"><a name="l00133"></a><span class="lineno"> 133</span>&#160; <span class="comment">//get pointer to assigned address record</span></div>
<div class="line"><a name="l00134"></a><span class="lineno"> 134</span>&#160; p = addrPool.<a class="code" href="class_address_pool.html#aa92d7e8f0f515340ae2dc1679b627056">GetUsbDevicePtr</a>(<a class="code" href="class_x_b_o_x_r_e_c_v.html#a1d4bdb1b740c87fd51aca3969e67c730">bAddress</a>);</div>
<div class="line"><a name="l00134"></a><span class="lineno"> 134</span>&#160; p = addrPool.<a class="code" href="class_address_pool.html#aa92d7e8f0f515340ae2dc1679b627056">GetUsbDevicePtr</a>(bAddress);</div>
<div class="line"><a name="l00135"></a><span class="lineno"> 135</span>&#160; <span class="keywordflow">if</span> (!p)</div>
<div class="line"><a name="l00136"></a><span class="lineno"> 136</span>&#160; <span class="keywordflow">return</span> <a class="code" href="_usb_8h.html#afe2fedb4b0ccc89a688c0b4b59691ce0">USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL</a>;</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; p-&gt;<a class="code" href="struct_usb_device.html#a86a815577ad7883437d3ca72b32b8e8a">lowspeed</a> = lowspeed;</div>
<div class="line"><a name="l00139"></a><span class="lineno"> 139</span>&#160;</div>
<div class="line"><a name="l00140"></a><span class="lineno"> 140</span>&#160; <span class="comment">// Assign epInfo to epinfo pointer - only EP0 is known</span></div>
<div class="line"><a name="l00141"></a><span class="lineno"> 141</span>&#160; rcode = <a class="code" href="class_x_b_o_x_r_e_c_v.html#a53047c86c8c2f625916af62238d50fc8">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a6c3ba3f7e6dccb450267011ce783d7ea">setEpInfoEntry</a>(<a class="code" href="class_x_b_o_x_r_e_c_v.html#a1d4bdb1b740c87fd51aca3969e67c730">bAddress</a>, 1, <a class="code" href="class_x_b_o_x_r_e_c_v.html#af97c8d0efc945fa4ba1d120c8a5a9cbb">epInfo</a>);</div>
<div class="line"><a name="l00141"></a><span class="lineno"> 141</span>&#160; rcode = <a class="code" href="class_x_b_o_x_r_e_c_v.html#a53047c86c8c2f625916af62238d50fc8">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a6c3ba3f7e6dccb450267011ce783d7ea">setEpInfoEntry</a>(bAddress, 1, <a class="code" href="class_x_b_o_x_r_e_c_v.html#af97c8d0efc945fa4ba1d120c8a5a9cbb">epInfo</a>);</div>
<div class="line"><a name="l00142"></a><span class="lineno"> 142</span>&#160; <span class="keywordflow">if</span> (rcode)</div>
<div class="line"><a name="l00143"></a><span class="lineno"> 143</span>&#160; <span class="keywordflow">goto</span> FailSetDevTblEntry;</div>
<div class="line"><a name="l00144"></a><span class="lineno"> 144</span>&#160;</div>
@ -290,18 +290,18 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<div class="line"><a name="l00199"></a><span class="lineno"> 199</span>&#160; <a class="code" href="class_x_b_o_x_r_e_c_v.html#af97c8d0efc945fa4ba1d120c8a5a9cbb">epInfo</a>[ <a class="code" href="_x_b_o_x_r_e_c_v_8h.html#a7a74e0ea052831dbbb4a0973fffc8179">XBOX_OUTPUT_PIPE_4</a> ].<a class="code" href="struct_ep_info.html#ac85bff70ad0e5d71e50cb501f4d8caf3">bmSndToggle</a> = <a class="code" href="max3421e_8h.html#a4834ae7378471b63b9a1985c6294006f">bmSNDTOG0</a>;</div>
<div class="line"><a name="l00200"></a><span class="lineno"> 200</span>&#160; <a class="code" href="class_x_b_o_x_r_e_c_v.html#af97c8d0efc945fa4ba1d120c8a5a9cbb">epInfo</a>[ <a class="code" href="_x_b_o_x_r_e_c_v_8h.html#a7a74e0ea052831dbbb4a0973fffc8179">XBOX_OUTPUT_PIPE_4</a> ].<a class="code" href="struct_ep_info.html#a9238dd40c096baedf041c98b19386a14">bmRcvToggle</a> = <a class="code" href="max3421e_8h.html#aca6a8aa4f0aebbe07c5e175572a92ef7">bmRCVTOG0</a>;</div>
<div class="line"><a name="l00201"></a><span class="lineno"> 201</span>&#160;</div>
<div class="line"><a name="l00202"></a><span class="lineno"> 202</span>&#160; rcode = <a class="code" href="class_x_b_o_x_r_e_c_v.html#a53047c86c8c2f625916af62238d50fc8">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a6c3ba3f7e6dccb450267011ce783d7ea">setEpInfoEntry</a>(<a class="code" href="class_x_b_o_x_r_e_c_v.html#a1d4bdb1b740c87fd51aca3969e67c730">bAddress</a>, 9, <a class="code" href="class_x_b_o_x_r_e_c_v.html#af97c8d0efc945fa4ba1d120c8a5a9cbb">epInfo</a>);</div>
<div class="line"><a name="l00202"></a><span class="lineno"> 202</span>&#160; rcode = <a class="code" href="class_x_b_o_x_r_e_c_v.html#a53047c86c8c2f625916af62238d50fc8">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a6c3ba3f7e6dccb450267011ce783d7ea">setEpInfoEntry</a>(bAddress, 9, <a class="code" href="class_x_b_o_x_r_e_c_v.html#af97c8d0efc945fa4ba1d120c8a5a9cbb">epInfo</a>);</div>
<div class="line"><a name="l00203"></a><span class="lineno"> 203</span>&#160; <span class="keywordflow">if</span> (rcode)</div>
<div class="line"><a name="l00204"></a><span class="lineno"> 204</span>&#160; <span class="keywordflow">goto</span> FailSetDevTblEntry;</div>
<div class="line"><a name="l00205"></a><span class="lineno"> 205</span>&#160;</div>
<div class="line"><a name="l00206"></a><span class="lineno"> 206</span>&#160; delay(200); <span class="comment">//Give time for address change</span></div>
<div class="line"><a name="l00207"></a><span class="lineno"> 207</span>&#160;</div>
<div class="line"><a name="l00208"></a><span class="lineno"> 208</span>&#160; rcode = <a class="code" href="class_x_b_o_x_r_e_c_v.html#a53047c86c8c2f625916af62238d50fc8">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a31e2c132ec32ffdde94dff72be87c378">setConf</a>(<a class="code" href="class_x_b_o_x_r_e_c_v.html#a1d4bdb1b740c87fd51aca3969e67c730">bAddress</a>, <a class="code" href="class_x_b_o_x_r_e_c_v.html#af97c8d0efc945fa4ba1d120c8a5a9cbb">epInfo</a>[ <a class="code" href="_x_b_o_x_r_e_c_v_8h.html#a8f4ee68cc0f05690f5f26104c7d9e490">XBOX_CONTROL_PIPE</a> ].epAddr, 1);</div>
<div class="line"><a name="l00208"></a><span class="lineno"> 208</span>&#160; rcode = <a class="code" href="class_x_b_o_x_r_e_c_v.html#a53047c86c8c2f625916af62238d50fc8">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a31e2c132ec32ffdde94dff72be87c378">setConf</a>(bAddress, <a class="code" href="class_x_b_o_x_r_e_c_v.html#af97c8d0efc945fa4ba1d120c8a5a9cbb">epInfo</a>[ <a class="code" href="_x_b_o_x_r_e_c_v_8h.html#a8f4ee68cc0f05690f5f26104c7d9e490">XBOX_CONTROL_PIPE</a> ].epAddr, 1);</div>
<div class="line"><a name="l00209"></a><span class="lineno"> 209</span>&#160; <span class="keywordflow">if</span> (rcode)</div>
<div class="line"><a name="l00210"></a><span class="lineno"> 210</span>&#160; <span class="keywordflow">goto</span> FailSetConf; </div>
<div class="line"><a name="l00210"></a><span class="lineno"> 210</span>&#160; <span class="keywordflow">goto</span> FailSetConfDescr;</div>
<div class="line"><a name="l00211"></a><span class="lineno"> 211</span>&#160;</div>
<div class="line"><a name="l00212"></a><span class="lineno"> 212</span>&#160;<span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><a name="l00213"></a><span class="lineno"> 213</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nXbox Wireless Receiver Connected\r\n&quot;</span>));</div>
<div class="line"><a name="l00213"></a><span class="lineno"> 213</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a1e8693828152de8408add858dc461dea">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nXbox Wireless Receiver Connected\r\n&quot;</span>), 0x80);</div>
<div class="line"><a name="l00214"></a><span class="lineno"> 214</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00215"></a><span class="lineno"> 215</span>&#160;<span class="preprocessor"></span> <a class="code" href="class_x_b_o_x_r_e_c_v.html#a5ff16bba78f05af3023f395a342b625c">XboxReceiverConnected</a> = <span class="keyword">true</span>;</div>
<div class="line"><a name="l00216"></a><span class="lineno"> 216</span>&#160; bPollEnable = <span class="keyword">true</span>;</div>
@ -309,295 +309,309 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<div class="line"><a name="l00218"></a><span class="lineno"> 218</span>&#160;</div>
<div class="line"><a name="l00219"></a><span class="lineno"> 219</span>&#160; <span class="comment">/* diagnostic messages */</span></div>
<div class="line"><a name="l00220"></a><span class="lineno"> 220</span>&#160;FailGetDevDescr:</div>
<div class="line"><a name="l00221"></a><span class="lineno"> 221</span>&#160;<span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><a name="l00222"></a><span class="lineno"> 222</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\ngetDevDescr:&quot;</span>));</div>
<div class="line"><a name="l00223"></a><span class="lineno"> 223</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00224"></a><span class="lineno"> 224</span>&#160;<span class="preprocessor"></span> <span class="keywordflow">goto</span> Fail; </div>
<div class="line"><a name="l00225"></a><span class="lineno"> 225</span>&#160;FailSetDevTblEntry:</div>
<div class="line"><a name="l00226"></a><span class="lineno"> 226</span>&#160;<span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><a name="l00227"></a><span class="lineno"> 227</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nsetDevTblEn:&quot;</span>));</div>
<div class="line"><a name="l00228"></a><span class="lineno"> 228</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00229"></a><span class="lineno"> 229</span>&#160;<span class="preprocessor"></span> <span class="keywordflow">goto</span> Fail;</div>
<div class="line"><a name="l00230"></a><span class="lineno"> 230</span>&#160;FailSetConf:</div>
<div class="line"><a name="l00231"></a><span class="lineno"> 231</span>&#160;<span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><a name="l00232"></a><span class="lineno"> 232</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nsetConf:&quot;</span>));</div>
<div class="line"><a name="l00233"></a><span class="lineno"> 233</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00234"></a><span class="lineno"> 234</span>&#160;<span class="preprocessor"></span> <span class="keywordflow">goto</span> Fail; </div>
<div class="line"><a name="l00235"></a><span class="lineno"> 235</span>&#160;FailUnknownDevice:</div>
<div class="line"><a name="l00236"></a><span class="lineno"> 236</span>&#160;<span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><a name="l00237"></a><span class="lineno"> 237</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nUnknown Device Connected - VID: &quot;</span>));</div>
<div class="line"><a name="l00238"></a><span class="lineno"> 238</span>&#160; PrintHex&lt;uint16_t&gt;(VID);</div>
<div class="line"><a name="l00239"></a><span class="lineno"> 239</span>&#160; <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot; PID: &quot;</span>));</div>
<div class="line"><a name="l00240"></a><span class="lineno"> 240</span>&#160; PrintHex&lt;uint16_t&gt;(PID);</div>
<div class="line"><a name="l00241"></a><span class="lineno"> 241</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00242"></a><span class="lineno"> 242</span>&#160;<span class="preprocessor"></span> rcode = <a class="code" href="_usb_8h.html#ae9e139d0fd29bb0b3e7afad2f76cd589">USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED</a>;</div>
<div class="line"><a name="l00243"></a><span class="lineno"> 243</span>&#160; <span class="keywordflow">goto</span> Fail;</div>
<div class="line"><a name="l00244"></a><span class="lineno"> 244</span>&#160;Fail:</div>
<div class="line"><a name="l00245"></a><span class="lineno"> 245</span>&#160;<span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><a name="l00246"></a><span class="lineno"> 246</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nXbox 360 Init Failed, error code: &quot;</span>));</div>
<div class="line"><a name="l00247"></a><span class="lineno"> 247</span>&#160; Serial.print(rcode,HEX);</div>
<div class="line"><a name="l00248"></a><span class="lineno"> 248</span>&#160;<span class="preprocessor">#endif </span></div>
<div class="line"><a name="l00249"></a><span class="lineno"> 249</span>&#160;<span class="preprocessor"></span> <a class="code" href="class_x_b_o_x_r_e_c_v.html#ad0e6b53a818516b7d6af0beaa8cebc7a">Release</a>();</div>
<div class="line"><a name="l00250"></a><span class="lineno"> 250</span>&#160; <span class="keywordflow">return</span> rcode;</div>
<div class="line"><a name="l00251"></a><span class="lineno"> 251</span>&#160;}</div>
<div class="line"><a name="l00252"></a><span class="lineno"> 252</span>&#160;</div>
<div class="line"><a name="l00253"></a><span class="lineno"> 253</span>&#160;<span class="comment">/* Performs a cleanup after failed Init() attempt */</span></div>
<div class="line"><a name="l00254"></a><span class="lineno"><a class="code" href="class_x_b_o_x_r_e_c_v.html#ad0e6b53a818516b7d6af0beaa8cebc7a"> 254</a></span>&#160;uint8_t <a class="code" href="class_x_b_o_x_r_e_c_v.html#ad0e6b53a818516b7d6af0beaa8cebc7a">XBOXRECV::Release</a>() {</div>
<div class="line"><a name="l00255"></a><span class="lineno"> 255</span>&#160; <a class="code" href="class_x_b_o_x_r_e_c_v.html#a5ff16bba78f05af3023f395a342b625c">XboxReceiverConnected</a> = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00256"></a><span class="lineno"> 256</span>&#160; <span class="keywordflow">for</span>(uint8_t i=0;i&lt;4;i++)</div>
<div class="line"><a name="l00257"></a><span class="lineno"> 257</span>&#160; <a class="code" href="class_x_b_o_x_r_e_c_v.html#ac07faada38e159f1e7831d90863ebe3a">Xbox360Connected</a>[i] = 0x00;</div>
<div class="line"><a name="l00258"></a><span class="lineno"> 258</span>&#160; <a class="code" href="class_x_b_o_x_r_e_c_v.html#a53047c86c8c2f625916af62238d50fc8">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a66ab8f5eda239e761d5a48741ea1f9d4">GetAddressPool</a>().<a class="code" href="class_address_pool.html#a15fde13223dcb1da89305ad229763562">FreeAddress</a>(<a class="code" href="class_x_b_o_x_r_e_c_v.html#a1d4bdb1b740c87fd51aca3969e67c730">bAddress</a>); </div>
<div class="line"><a name="l00259"></a><span class="lineno"> 259</span>&#160; <a class="code" href="class_x_b_o_x_r_e_c_v.html#a1d4bdb1b740c87fd51aca3969e67c730">bAddress</a> = 0;</div>
<div class="line"><a name="l00260"></a><span class="lineno"> 260</span>&#160; bPollEnable = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00261"></a><span class="lineno"> 261</span>&#160; <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00221"></a><span class="lineno"> 221</span>&#160; <a class="code" href="message_8cpp.html#ace40a5d826a882de0c5a25aece111d3f">NotifyFailGetDevDescr</a>();</div>
<div class="line"><a name="l00222"></a><span class="lineno"> 222</span>&#160; <span class="keywordflow">goto</span> Fail;</div>
<div class="line"><a name="l00223"></a><span class="lineno"> 223</span>&#160;</div>
<div class="line"><a name="l00224"></a><span class="lineno"> 224</span>&#160;FailSetDevTblEntry:</div>
<div class="line"><a name="l00225"></a><span class="lineno"> 225</span>&#160; <a class="code" href="message_8cpp.html#aa65008f9251787149e391f89e68b32be">NotifyFailSetDevTblEntry</a>();</div>
<div class="line"><a name="l00226"></a><span class="lineno"> 226</span>&#160; <span class="keywordflow">goto</span> Fail;</div>
<div class="line"><a name="l00227"></a><span class="lineno"> 227</span>&#160;</div>
<div class="line"><a name="l00228"></a><span class="lineno"> 228</span>&#160;FailSetConfDescr:</div>
<div class="line"><a name="l00229"></a><span class="lineno"> 229</span>&#160; <a class="code" href="message_8cpp.html#a08b840c377ca6f8154d6924d51338d89">NotifyFailSetConfDescr</a>();</div>
<div class="line"><a name="l00230"></a><span class="lineno"> 230</span>&#160; <span class="keywordflow">goto</span> Fail;</div>
<div class="line"><a name="l00231"></a><span class="lineno"> 231</span>&#160;</div>
<div class="line"><a name="l00232"></a><span class="lineno"> 232</span>&#160;FailUnknownDevice:</div>
<div class="line"><a name="l00233"></a><span class="lineno"> 233</span>&#160; <a class="code" href="message_8cpp.html#a7103129ed2b7b7896461c0a3cd924eb4">NotifyFailUnknownDevice</a>(VID,PID);</div>
<div class="line"><a name="l00234"></a><span class="lineno"> 234</span>&#160; rcode = <a class="code" href="_usb_8h.html#ae9e139d0fd29bb0b3e7afad2f76cd589">USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED</a>;</div>
<div class="line"><a name="l00235"></a><span class="lineno"> 235</span>&#160;</div>
<div class="line"><a name="l00236"></a><span class="lineno"> 236</span>&#160;Fail:</div>
<div class="line"><a name="l00237"></a><span class="lineno"> 237</span>&#160;<span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><a name="l00238"></a><span class="lineno"> 238</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a1e8693828152de8408add858dc461dea">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nXbox 360 Init Failed, error code: &quot;</span>), 0x80);</div>
<div class="line"><a name="l00239"></a><span class="lineno"> 239</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00240"></a><span class="lineno"> 240</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a5ae2cb9bf877595104f2425f50e2057f">NotifyFail</a>(rcode);</div>
<div class="line"><a name="l00241"></a><span class="lineno"> 241</span>&#160; <a class="code" href="class_x_b_o_x_r_e_c_v.html#ad0e6b53a818516b7d6af0beaa8cebc7a">Release</a>();</div>
<div class="line"><a name="l00242"></a><span class="lineno"> 242</span>&#160; <span class="keywordflow">return</span> rcode;</div>
<div class="line"><a name="l00243"></a><span class="lineno"> 243</span>&#160;}</div>
<div class="line"><a name="l00244"></a><span class="lineno"> 244</span>&#160;</div>
<div class="line"><a name="l00245"></a><span class="lineno"> 245</span>&#160;<span class="comment">/* Performs a cleanup after failed Init() attempt */</span></div>
<div class="line"><a name="l00246"></a><span class="lineno"><a class="code" href="class_x_b_o_x_r_e_c_v.html#ad0e6b53a818516b7d6af0beaa8cebc7a"> 246</a></span>&#160;uint8_t <a class="code" href="class_x_b_o_x_r_e_c_v.html#ad0e6b53a818516b7d6af0beaa8cebc7a">XBOXRECV::Release</a>() {</div>
<div class="line"><a name="l00247"></a><span class="lineno"> 247</span>&#160; <a class="code" href="class_x_b_o_x_r_e_c_v.html#a5ff16bba78f05af3023f395a342b625c">XboxReceiverConnected</a> = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00248"></a><span class="lineno"> 248</span>&#160; <span class="keywordflow">for</span> (uint8_t i = 0; i &lt; 4; i++)</div>
<div class="line"><a name="l00249"></a><span class="lineno"> 249</span>&#160; <a class="code" href="class_x_b_o_x_r_e_c_v.html#ac07faada38e159f1e7831d90863ebe3a">Xbox360Connected</a>[i] = 0x00;</div>
<div class="line"><a name="l00250"></a><span class="lineno"> 250</span>&#160; <a class="code" href="class_x_b_o_x_r_e_c_v.html#a53047c86c8c2f625916af62238d50fc8">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a66ab8f5eda239e761d5a48741ea1f9d4">GetAddressPool</a>().<a class="code" href="class_address_pool.html#a15fde13223dcb1da89305ad229763562">FreeAddress</a>(<a class="code" href="class_x_b_o_x_r_e_c_v.html#a1d4bdb1b740c87fd51aca3969e67c730">bAddress</a>);</div>
<div class="line"><a name="l00251"></a><span class="lineno"> 251</span>&#160; <a class="code" href="class_x_b_o_x_r_e_c_v.html#a1d4bdb1b740c87fd51aca3969e67c730">bAddress</a> = 0;</div>
<div class="line"><a name="l00252"></a><span class="lineno"> 252</span>&#160; bPollEnable = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00253"></a><span class="lineno"> 253</span>&#160; <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00254"></a><span class="lineno"> 254</span>&#160;}</div>
<div class="line"><a name="l00255"></a><span class="lineno"> 255</span>&#160;</div>
<div class="line"><a name="l00256"></a><span class="lineno"><a class="code" href="class_x_b_o_x_r_e_c_v.html#aafe1688ba3dc9b9ac425ebbbf001a1cc"> 256</a></span>&#160;uint8_t <a class="code" href="class_x_b_o_x_r_e_c_v.html#aafe1688ba3dc9b9ac425ebbbf001a1cc">XBOXRECV::Poll</a>() {</div>
<div class="line"><a name="l00257"></a><span class="lineno"> 257</span>&#160; <span class="keywordflow">if</span> (!bPollEnable)</div>
<div class="line"><a name="l00258"></a><span class="lineno"> 258</span>&#160; <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00259"></a><span class="lineno"> 259</span>&#160; <span class="keywordflow">if</span> (!timer || ((millis() - timer) &gt; 3000)) { <span class="comment">// Run checkStatus every 3 seconds</span></div>
<div class="line"><a name="l00260"></a><span class="lineno"> 260</span>&#160; timer = millis();</div>
<div class="line"><a name="l00261"></a><span class="lineno"> 261</span>&#160; checkStatus();</div>
<div class="line"><a name="l00262"></a><span class="lineno"> 262</span>&#160; }</div>
<div class="line"><a name="l00263"></a><span class="lineno"><a class="code" href="class_x_b_o_x_r_e_c_v.html#aafe1688ba3dc9b9ac425ebbbf001a1cc"> 263</a></span>&#160;uint8_t <a class="code" href="class_x_b_o_x_r_e_c_v.html#aafe1688ba3dc9b9ac425ebbbf001a1cc">XBOXRECV::Poll</a>() { </div>
<div class="line"><a name="l00264"></a><span class="lineno"> 264</span>&#160; <span class="keywordflow">if</span> (!bPollEnable)</div>
<div class="line"><a name="l00265"></a><span class="lineno"> 265</span>&#160; <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00266"></a><span class="lineno"> 266</span>&#160; <span class="keywordflow">if</span>(!timer || ((millis() - timer) &gt; 3000)) { <span class="comment">// Run checkStatus every 3 seconds</span></div>
<div class="line"><a name="l00267"></a><span class="lineno"> 267</span>&#160; timer = millis();</div>
<div class="line"><a name="l00268"></a><span class="lineno"> 268</span>&#160; checkStatus();</div>
<div class="line"><a name="l00269"></a><span class="lineno"> 269</span>&#160; }</div>
<div class="line"><a name="l00270"></a><span class="lineno"> 270</span>&#160; uint8_t inputPipe;</div>
<div class="line"><a name="l00271"></a><span class="lineno"> 271</span>&#160; uint16_t bufferSize;</div>
<div class="line"><a name="l00272"></a><span class="lineno"> 272</span>&#160; <span class="keywordflow">for</span>(uint8_t i=0;i&lt;4;i++) { </div>
<div class="line"><a name="l00273"></a><span class="lineno"> 273</span>&#160; <span class="keywordflow">switch</span> (i) {</div>
<div class="line"><a name="l00274"></a><span class="lineno"> 274</span>&#160; <span class="keywordflow">case</span> 0: inputPipe = <a class="code" href="_x_b_o_x_r_e_c_v_8h.html#a2824b25aa9a384c29f27a4e1bb443799">XBOX_INPUT_PIPE_1</a>; <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00275"></a><span class="lineno"> 275</span>&#160; <span class="keywordflow">case</span> 1: inputPipe = <a class="code" href="_x_b_o_x_r_e_c_v_8h.html#aab6feb681a78b190190bcc081868a485">XBOX_INPUT_PIPE_2</a>; <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00276"></a><span class="lineno"> 276</span>&#160; <span class="keywordflow">case</span> 2: inputPipe = <a class="code" href="_x_b_o_x_r_e_c_v_8h.html#a86a3e5765d02bc043d5d1f674a7ffb0f">XBOX_INPUT_PIPE_3</a>; <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00277"></a><span class="lineno"> 277</span>&#160; <span class="keywordflow">case</span> 3: inputPipe = <a class="code" href="_x_b_o_x_r_e_c_v_8h.html#a5acfdaefe74aba1632c71acb79c49671">XBOX_INPUT_PIPE_4</a>; <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00278"></a><span class="lineno"> 278</span>&#160; }</div>
<div class="line"><a name="l00279"></a><span class="lineno"> 279</span>&#160; bufferSize = <a class="code" href="_p_s3_u_s_b_8h.html#abcb805b13bfd36145e252b0633bbcfc0">EP_MAXPKTSIZE</a>; <span class="comment">// This is the maximum number of bytes we want to receive</span></div>
<div class="line"><a name="l00280"></a><span class="lineno"> 280</span>&#160; <a class="code" href="class_x_b_o_x_r_e_c_v.html#a53047c86c8c2f625916af62238d50fc8">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#ad75d64f648b102fab2bd75e53e1324a4">inTransfer</a>(<a class="code" href="class_x_b_o_x_r_e_c_v.html#a1d4bdb1b740c87fd51aca3969e67c730">bAddress</a>, <a class="code" href="class_x_b_o_x_r_e_c_v.html#af97c8d0efc945fa4ba1d120c8a5a9cbb">epInfo</a>[ inputPipe ].epAddr, &amp;bufferSize, readBuf);</div>
<div class="line"><a name="l00281"></a><span class="lineno"> 281</span>&#160; <span class="keywordflow">if</span>(bufferSize &gt; 0) { <span class="comment">// The number of received bytes</span></div>
<div class="line"><a name="l00282"></a><span class="lineno"> 282</span>&#160;<span class="preprocessor">#ifdef EXTRADEBUG</span></div>
<div class="line"><a name="l00283"></a><span class="lineno"> 283</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;Bytes Received: &quot;</span>));</div>
<div class="line"><a name="l00284"></a><span class="lineno"> 284</span>&#160; Serial.print(bufferSize);</div>
<div class="line"><a name="l00285"></a><span class="lineno"> 285</span>&#160; <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\n&quot;</span>));</div>
<div class="line"><a name="l00286"></a><span class="lineno"> 286</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00287"></a><span class="lineno"> 287</span>&#160;<span class="preprocessor"></span> readReport(i);</div>
<div class="line"><a name="l00288"></a><span class="lineno"> 288</span>&#160;<span class="preprocessor">#ifdef PRINTREPORT</span></div>
<div class="line"><a name="l00289"></a><span class="lineno"> 289</span>&#160;<span class="preprocessor"></span> printReport(i,bufferSize); <span class="comment">// Uncomment &quot;#define PRINTREPORT&quot; to print the report send by the Xbox 360 Controller</span></div>
<div class="line"><a name="l00290"></a><span class="lineno"> 290</span>&#160;<span class="preprocessor">#endif </span></div>
<div class="line"><a name="l00291"></a><span class="lineno"> 291</span>&#160;<span class="preprocessor"></span> }</div>
<div class="line"><a name="l00292"></a><span class="lineno"> 292</span>&#160; }</div>
<div class="line"><a name="l00293"></a><span class="lineno"> 293</span>&#160; <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00294"></a><span class="lineno"> 294</span>&#160;}</div>
<div class="line"><a name="l00295"></a><span class="lineno"> 295</span>&#160;</div>
<div class="line"><a name="l00296"></a><span class="lineno"> 296</span>&#160;<span class="keywordtype">void</span> XBOXRECV::readReport(uint8_t controller) {</div>
<div class="line"><a name="l00297"></a><span class="lineno"> 297</span>&#160; <span class="keywordflow">if</span> (readBuf == NULL)</div>
<div class="line"><a name="l00298"></a><span class="lineno"> 298</span>&#160; <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00299"></a><span class="lineno"> 299</span>&#160; <span class="comment">// This report is send when a controller is connected and disconnected</span></div>
<div class="line"><a name="l00300"></a><span class="lineno"> 300</span>&#160; <span class="keywordflow">if</span>(readBuf[0] == 0x08 &amp;&amp; readBuf[1] != <a class="code" href="class_x_b_o_x_r_e_c_v.html#ac07faada38e159f1e7831d90863ebe3a">Xbox360Connected</a>[controller]) {</div>
<div class="line"><a name="l00301"></a><span class="lineno"> 301</span>&#160; <a class="code" href="class_x_b_o_x_r_e_c_v.html#ac07faada38e159f1e7831d90863ebe3a">Xbox360Connected</a>[controller] = readBuf[1];</div>
<div class="line"><a name="l00302"></a><span class="lineno"> 302</span>&#160;<span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><a name="l00303"></a><span class="lineno"> 303</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;Controller &quot;</span>));</div>
<div class="line"><a name="l00304"></a><span class="lineno"> 304</span>&#160; Serial.print(controller);</div>
<div class="line"><a name="l00305"></a><span class="lineno"> 305</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00306"></a><span class="lineno"> 306</span>&#160;<span class="preprocessor"></span> <span class="keywordflow">if</span>(<a class="code" href="class_x_b_o_x_r_e_c_v.html#ac07faada38e159f1e7831d90863ebe3a">Xbox360Connected</a>[controller]) {</div>
<div class="line"><a name="l00307"></a><span class="lineno"> 307</span>&#160;<span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><a name="l00308"></a><span class="lineno"> 308</span>&#160;<span class="preprocessor"></span> <span class="keywordtype">char</span>* str = 0;</div>
<div class="line"><a name="l00309"></a><span class="lineno"> 309</span>&#160; <span class="keywordflow">switch</span>(readBuf[1]) {</div>
<div class="line"><a name="l00310"></a><span class="lineno"> 310</span>&#160; <span class="keywordflow">case</span> 0x80: str = PSTR(<span class="stringliteral">&quot; as controller\r\n&quot;</span>); <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00311"></a><span class="lineno"> 311</span>&#160; <span class="keywordflow">case</span> 0x40: str = PSTR(<span class="stringliteral">&quot; as headset\r\n&quot;</span>); <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00312"></a><span class="lineno"> 312</span>&#160; <span class="keywordflow">case</span> 0xC0: str = PSTR(<span class="stringliteral">&quot; as controller+headset\r\n&quot;</span>); <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00263"></a><span class="lineno"> 263</span>&#160; uint8_t inputPipe;</div>
<div class="line"><a name="l00264"></a><span class="lineno"> 264</span>&#160; uint16_t bufferSize;</div>
<div class="line"><a name="l00265"></a><span class="lineno"> 265</span>&#160; <span class="keywordflow">for</span> (uint8_t i = 0; i &lt; 4; i++) {</div>
<div class="line"><a name="l00266"></a><span class="lineno"> 266</span>&#160; <span class="keywordflow">switch</span> (i) {</div>
<div class="line"><a name="l00267"></a><span class="lineno"> 267</span>&#160; <span class="keywordflow">case</span> 0: inputPipe = <a class="code" href="_x_b_o_x_r_e_c_v_8h.html#a2824b25aa9a384c29f27a4e1bb443799">XBOX_INPUT_PIPE_1</a>;</div>
<div class="line"><a name="l00268"></a><span class="lineno"> 268</span>&#160; <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00269"></a><span class="lineno"> 269</span>&#160; <span class="keywordflow">case</span> 1: inputPipe = <a class="code" href="_x_b_o_x_r_e_c_v_8h.html#aab6feb681a78b190190bcc081868a485">XBOX_INPUT_PIPE_2</a>;</div>
<div class="line"><a name="l00270"></a><span class="lineno"> 270</span>&#160; <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00271"></a><span class="lineno"> 271</span>&#160; <span class="keywordflow">case</span> 2: inputPipe = <a class="code" href="_x_b_o_x_r_e_c_v_8h.html#a86a3e5765d02bc043d5d1f674a7ffb0f">XBOX_INPUT_PIPE_3</a>;</div>
<div class="line"><a name="l00272"></a><span class="lineno"> 272</span>&#160; <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00273"></a><span class="lineno"> 273</span>&#160; <span class="keywordflow">case</span> 3: inputPipe = <a class="code" href="_x_b_o_x_r_e_c_v_8h.html#a5acfdaefe74aba1632c71acb79c49671">XBOX_INPUT_PIPE_4</a>;</div>
<div class="line"><a name="l00274"></a><span class="lineno"> 274</span>&#160; <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00275"></a><span class="lineno"> 275</span>&#160; }</div>
<div class="line"><a name="l00276"></a><span class="lineno"> 276</span>&#160; bufferSize = <a class="code" href="_p_s3_u_s_b_8h.html#abcb805b13bfd36145e252b0633bbcfc0">EP_MAXPKTSIZE</a>; <span class="comment">// This is the maximum number of bytes we want to receive</span></div>
<div class="line"><a name="l00277"></a><span class="lineno"> 277</span>&#160; <a class="code" href="class_x_b_o_x_r_e_c_v.html#a53047c86c8c2f625916af62238d50fc8">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#ad75d64f648b102fab2bd75e53e1324a4">inTransfer</a>(<a class="code" href="class_x_b_o_x_r_e_c_v.html#a1d4bdb1b740c87fd51aca3969e67c730">bAddress</a>, <a class="code" href="class_x_b_o_x_r_e_c_v.html#af97c8d0efc945fa4ba1d120c8a5a9cbb">epInfo</a>[ inputPipe ].epAddr, &amp;bufferSize, readBuf);</div>
<div class="line"><a name="l00278"></a><span class="lineno"> 278</span>&#160; <span class="keywordflow">if</span> (bufferSize &gt; 0) { <span class="comment">// The number of received bytes</span></div>
<div class="line"><a name="l00279"></a><span class="lineno"> 279</span>&#160;<span class="preprocessor">#ifdef EXTRADEBUG</span></div>
<div class="line"><a name="l00280"></a><span class="lineno"> 280</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a1e8693828152de8408add858dc461dea">Notify</a>(PSTR(<span class="stringliteral">&quot;Bytes Received: &quot;</span>), 0x80);</div>
<div class="line"><a name="l00281"></a><span class="lineno"> 281</span>&#160; Serial.print(bufferSize);</div>
<div class="line"><a name="l00282"></a><span class="lineno"> 282</span>&#160; <a class="code" href="message_8cpp.html#a1e8693828152de8408add858dc461dea">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\n&quot;</span>), 0x80);</div>
<div class="line"><a name="l00283"></a><span class="lineno"> 283</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00284"></a><span class="lineno"> 284</span>&#160;<span class="preprocessor"></span> readReport(i);</div>
<div class="line"><a name="l00285"></a><span class="lineno"> 285</span>&#160;<span class="preprocessor">#ifdef PRINTREPORT</span></div>
<div class="line"><a name="l00286"></a><span class="lineno"> 286</span>&#160;<span class="preprocessor"></span> printReport(i, bufferSize); <span class="comment">// Uncomment &quot;#define PRINTREPORT&quot; to print the report send by the Xbox 360 Controller</span></div>
<div class="line"><a name="l00287"></a><span class="lineno"> 287</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00288"></a><span class="lineno"> 288</span>&#160;<span class="preprocessor"></span> }</div>
<div class="line"><a name="l00289"></a><span class="lineno"> 289</span>&#160; }</div>
<div class="line"><a name="l00290"></a><span class="lineno"> 290</span>&#160; <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00291"></a><span class="lineno"> 291</span>&#160;}</div>
<div class="line"><a name="l00292"></a><span class="lineno"> 292</span>&#160;</div>
<div class="line"><a name="l00293"></a><span class="lineno"> 293</span>&#160;<span class="keywordtype">void</span> XBOXRECV::readReport(uint8_t controller) {</div>
<div class="line"><a name="l00294"></a><span class="lineno"> 294</span>&#160; <span class="keywordflow">if</span> (readBuf == NULL)</div>
<div class="line"><a name="l00295"></a><span class="lineno"> 295</span>&#160; <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00296"></a><span class="lineno"> 296</span>&#160; <span class="comment">// This report is send when a controller is connected and disconnected</span></div>
<div class="line"><a name="l00297"></a><span class="lineno"> 297</span>&#160; <span class="keywordflow">if</span> (readBuf[0] == 0x08 &amp;&amp; readBuf[1] != <a class="code" href="class_x_b_o_x_r_e_c_v.html#ac07faada38e159f1e7831d90863ebe3a">Xbox360Connected</a>[controller]) {</div>
<div class="line"><a name="l00298"></a><span class="lineno"> 298</span>&#160; <a class="code" href="class_x_b_o_x_r_e_c_v.html#ac07faada38e159f1e7831d90863ebe3a">Xbox360Connected</a>[controller] = readBuf[1];</div>
<div class="line"><a name="l00299"></a><span class="lineno"> 299</span>&#160;<span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><a name="l00300"></a><span class="lineno"> 300</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a1e8693828152de8408add858dc461dea">Notify</a>(PSTR(<span class="stringliteral">&quot;Controller &quot;</span>), 0x80);</div>
<div class="line"><a name="l00301"></a><span class="lineno"> 301</span>&#160; Serial.print(controller);</div>
<div class="line"><a name="l00302"></a><span class="lineno"> 302</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00303"></a><span class="lineno"> 303</span>&#160;<span class="preprocessor"></span> <span class="keywordflow">if</span> (<a class="code" href="class_x_b_o_x_r_e_c_v.html#ac07faada38e159f1e7831d90863ebe3a">Xbox360Connected</a>[controller]) {</div>
<div class="line"><a name="l00304"></a><span class="lineno"> 304</span>&#160;<span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><a name="l00305"></a><span class="lineno"> 305</span>&#160;<span class="preprocessor"></span> <span class="keywordtype">char</span>* str = 0;</div>
<div class="line"><a name="l00306"></a><span class="lineno"> 306</span>&#160; <span class="keywordflow">switch</span> (readBuf[1]) {</div>
<div class="line"><a name="l00307"></a><span class="lineno"> 307</span>&#160; <span class="keywordflow">case</span> 0x80: str = PSTR(<span class="stringliteral">&quot; as controller\r\n&quot;</span>);</div>
<div class="line"><a name="l00308"></a><span class="lineno"> 308</span>&#160; <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00309"></a><span class="lineno"> 309</span>&#160; <span class="keywordflow">case</span> 0x40: str = PSTR(<span class="stringliteral">&quot; as headset\r\n&quot;</span>);</div>
<div class="line"><a name="l00310"></a><span class="lineno"> 310</span>&#160; <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00311"></a><span class="lineno"> 311</span>&#160; <span class="keywordflow">case</span> 0xC0: str = PSTR(<span class="stringliteral">&quot; as controller+headset\r\n&quot;</span>);</div>
<div class="line"><a name="l00312"></a><span class="lineno"> 312</span>&#160; <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00313"></a><span class="lineno"> 313</span>&#160; }</div>
<div class="line"><a name="l00314"></a><span class="lineno"> 314</span>&#160; <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;: connected&quot;</span>));</div>
<div class="line"><a name="l00315"></a><span class="lineno"> 315</span>&#160; <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(str);</div>
<div class="line"><a name="l00314"></a><span class="lineno"> 314</span>&#160; <a class="code" href="message_8cpp.html#a1e8693828152de8408add858dc461dea">Notify</a>(PSTR(<span class="stringliteral">&quot;: connected&quot;</span>), 0x80);</div>
<div class="line"><a name="l00315"></a><span class="lineno"> 315</span>&#160; <a class="code" href="message_8cpp.html#a1e8693828152de8408add858dc461dea">Notify</a>(str, 0x80);</div>
<div class="line"><a name="l00316"></a><span class="lineno"> 316</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00317"></a><span class="lineno"> 317</span>&#160;<span class="preprocessor"></span> <a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6">LED</a> led;</div>
<div class="line"><a name="l00318"></a><span class="lineno"> 318</span>&#160; <span class="keywordflow">switch</span> (controller) {</div>
<div class="line"><a name="l00319"></a><span class="lineno"> 319</span>&#160; <span class="keywordflow">case</span> 0: led = <a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6adac6477842247cab1a8c02c65f431b44">LED1</a>; <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00320"></a><span class="lineno"> 320</span>&#160; <span class="keywordflow">case</span> 1: led = <a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6a8379bbaa96d151e6adac488b2a147b7a">LED2</a>; <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00321"></a><span class="lineno"> 321</span>&#160; <span class="keywordflow">case</span> 2: led = <a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6a5dec293e081e0fc78369c842fab8452b">LED3</a>; <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00322"></a><span class="lineno"> 322</span>&#160; <span class="keywordflow">case</span> 3: led = <a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6ad60e39b8d1701d30aa64f80343217342">LED4</a>; <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00323"></a><span class="lineno"> 323</span>&#160; }</div>
<div class="line"><a name="l00324"></a><span class="lineno"> 324</span>&#160; <a class="code" href="class_x_b_o_x_r_e_c_v.html#a9e17aa44f2946e710fb9343f27290c85">setLedOn</a>(controller,led);</div>
<div class="line"><a name="l00325"></a><span class="lineno"> 325</span>&#160; }</div>
<div class="line"><a name="l00326"></a><span class="lineno"> 326</span>&#160;<span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><a name="l00327"></a><span class="lineno"> 327</span>&#160;<span class="preprocessor"></span> <span class="keywordflow">else</span></div>
<div class="line"><a name="l00328"></a><span class="lineno"> 328</span>&#160; <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;: disconnected\r\n&quot;</span>));</div>
<div class="line"><a name="l00329"></a><span class="lineno"> 329</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00330"></a><span class="lineno"> 330</span>&#160;<span class="preprocessor"></span> <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00331"></a><span class="lineno"> 331</span>&#160; }</div>
<div class="line"><a name="l00332"></a><span class="lineno"> 332</span>&#160; <span class="comment">// Controller status report</span></div>
<div class="line"><a name="l00333"></a><span class="lineno"> 333</span>&#160; <span class="keywordflow">if</span>(readBuf[1] == 0x00 &amp;&amp; readBuf[3] &amp; 0x13 &amp;&amp; readBuf[4] &gt;= 0x22) {</div>
<div class="line"><a name="l00334"></a><span class="lineno"> 334</span>&#160; controllerStatus[controller] = ((uint16_t)readBuf[3] &lt;&lt; 8) | readBuf[4];</div>
<div class="line"><a name="l00335"></a><span class="lineno"> 335</span>&#160; <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00336"></a><span class="lineno"> 336</span>&#160; }</div>
<div class="line"><a name="l00337"></a><span class="lineno"> 337</span>&#160; <span class="keywordflow">if</span>(readBuf[1] != 0x01) <span class="comment">// Check if it&#39;s the correct report - the receiver also sends different status reports</span></div>
<div class="line"><a name="l00338"></a><span class="lineno"> 338</span>&#160; <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00339"></a><span class="lineno"> 339</span>&#160; </div>
<div class="line"><a name="l00340"></a><span class="lineno"> 340</span>&#160; <span class="comment">// A controller must be connected if it&#39;s sending data</span></div>
<div class="line"><a name="l00341"></a><span class="lineno"> 341</span>&#160; <span class="keywordflow">if</span>(!<a class="code" href="class_x_b_o_x_r_e_c_v.html#ac07faada38e159f1e7831d90863ebe3a">Xbox360Connected</a>[controller])</div>
<div class="line"><a name="l00342"></a><span class="lineno"> 342</span>&#160; <a class="code" href="class_x_b_o_x_r_e_c_v.html#ac07faada38e159f1e7831d90863ebe3a">Xbox360Connected</a>[controller] |= 0x80;</div>
<div class="line"><a name="l00319"></a><span class="lineno"> 319</span>&#160; <span class="keywordflow">case</span> 0: led = <a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6adac6477842247cab1a8c02c65f431b44">LED1</a>;</div>
<div class="line"><a name="l00320"></a><span class="lineno"> 320</span>&#160; <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00321"></a><span class="lineno"> 321</span>&#160; <span class="keywordflow">case</span> 1: led = <a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6a8379bbaa96d151e6adac488b2a147b7a">LED2</a>;</div>
<div class="line"><a name="l00322"></a><span class="lineno"> 322</span>&#160; <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00323"></a><span class="lineno"> 323</span>&#160; <span class="keywordflow">case</span> 2: led = <a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6a5dec293e081e0fc78369c842fab8452b">LED3</a>;</div>
<div class="line"><a name="l00324"></a><span class="lineno"> 324</span>&#160; <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00325"></a><span class="lineno"> 325</span>&#160; <span class="keywordflow">case</span> 3: led = <a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6ad60e39b8d1701d30aa64f80343217342">LED4</a>;</div>
<div class="line"><a name="l00326"></a><span class="lineno"> 326</span>&#160; <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00327"></a><span class="lineno"> 327</span>&#160; }</div>
<div class="line"><a name="l00328"></a><span class="lineno"> 328</span>&#160; <a class="code" href="class_x_b_o_x_r_e_c_v.html#a9e17aa44f2946e710fb9343f27290c85">setLedOn</a>(controller, led);</div>
<div class="line"><a name="l00329"></a><span class="lineno"> 329</span>&#160; }</div>
<div class="line"><a name="l00330"></a><span class="lineno"> 330</span>&#160;<span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><a name="l00331"></a><span class="lineno"> 331</span>&#160;<span class="preprocessor"></span> <span class="keywordflow">else</span></div>
<div class="line"><a name="l00332"></a><span class="lineno"> 332</span>&#160; <a class="code" href="message_8cpp.html#a1e8693828152de8408add858dc461dea">Notify</a>(PSTR(<span class="stringliteral">&quot;: disconnected\r\n&quot;</span>), 0x80);</div>
<div class="line"><a name="l00333"></a><span class="lineno"> 333</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00334"></a><span class="lineno"> 334</span>&#160;<span class="preprocessor"></span> <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00335"></a><span class="lineno"> 335</span>&#160; }</div>
<div class="line"><a name="l00336"></a><span class="lineno"> 336</span>&#160; <span class="comment">// Controller status report</span></div>
<div class="line"><a name="l00337"></a><span class="lineno"> 337</span>&#160; <span class="keywordflow">if</span> (readBuf[1] == 0x00 &amp;&amp; readBuf[3] &amp; 0x13 &amp;&amp; readBuf[4] &gt;= 0x22) {</div>
<div class="line"><a name="l00338"></a><span class="lineno"> 338</span>&#160; controllerStatus[controller] = ((uint16_t)readBuf[3] &lt;&lt; 8) | readBuf[4];</div>
<div class="line"><a name="l00339"></a><span class="lineno"> 339</span>&#160; <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00340"></a><span class="lineno"> 340</span>&#160; }</div>
<div class="line"><a name="l00341"></a><span class="lineno"> 341</span>&#160; <span class="keywordflow">if</span> (readBuf[1] != 0x01) <span class="comment">// Check if it&#39;s the correct report - the receiver also sends different status reports</span></div>
<div class="line"><a name="l00342"></a><span class="lineno"> 342</span>&#160; <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00343"></a><span class="lineno"> 343</span>&#160;</div>
<div class="line"><a name="l00344"></a><span class="lineno"> 344</span>&#160; ButtonState[controller] = (uint32_t)(readBuf[9] | ((uint16_t)readBuf[8] &lt;&lt; 8) | ((uint32_t)readBuf[7] &lt;&lt; 16) | ((uint32_t)readBuf[6] &lt;&lt; 24));</div>
<div class="line"><a name="l00345"></a><span class="lineno"> 345</span>&#160; </div>
<div class="line"><a name="l00346"></a><span class="lineno"> 346</span>&#160; hatValue[controller][<a class="code" href="controller_enums_8h.html#aaaabdefc068fd57ec2bef2b62ea4ba92a383cb8895dd296b7f69ce845ed16b0ca">LeftHatX</a>] = (int16_t)(((uint16_t)readBuf[11] &lt;&lt; 8) | readBuf[10]);</div>
<div class="line"><a name="l00347"></a><span class="lineno"> 347</span>&#160; hatValue[controller][<a class="code" href="controller_enums_8h.html#aaaabdefc068fd57ec2bef2b62ea4ba92af3f3925efa9762c4e9e71ac7da7a94a3">LeftHatY</a>] = (int16_t)(((uint16_t)readBuf[13] &lt;&lt; 8) | readBuf[12]);</div>
<div class="line"><a name="l00348"></a><span class="lineno"> 348</span>&#160; hatValue[controller][<a class="code" href="controller_enums_8h.html#aaaabdefc068fd57ec2bef2b62ea4ba92aaeb027a0ae5bbc6ba25e1c78a6486c7b">RightHatX</a>] = (int16_t)(((uint16_t)readBuf[15] &lt;&lt; 8) | readBuf[14]);</div>
<div class="line"><a name="l00349"></a><span class="lineno"> 349</span>&#160; hatValue[controller][<a class="code" href="controller_enums_8h.html#aaaabdefc068fd57ec2bef2b62ea4ba92a7f1fb2db5381286691f4dec179ed5d5a">RightHatY</a>] = (int16_t)(((uint16_t)readBuf[17] &lt;&lt; 8) | readBuf[16]);</div>
<div class="line"><a name="l00350"></a><span class="lineno"> 350</span>&#160; </div>
<div class="line"><a name="l00351"></a><span class="lineno"> 351</span>&#160; <span class="comment">//Notify(PSTR(&quot;\r\nButtonState: &quot;));</span></div>
<div class="line"><a name="l00352"></a><span class="lineno"> 352</span>&#160; <span class="comment">//PrintHex&lt;uint32_t&gt;(ButtonState[controller]);</span></div>
<div class="line"><a name="l00353"></a><span class="lineno"> 353</span>&#160; </div>
<div class="line"><a name="l00354"></a><span class="lineno"> 354</span>&#160; <span class="keywordflow">if</span>(ButtonState[controller] != OldButtonState[controller]) {</div>
<div class="line"><a name="l00355"></a><span class="lineno"> 355</span>&#160; buttonStateChanged[controller] = <span class="keyword">true</span>;</div>
<div class="line"><a name="l00356"></a><span class="lineno"> 356</span>&#160; ButtonClickState[controller] = (ButtonState[controller] &gt;&gt; 16) &amp; ((~OldButtonState[controller]) &gt;&gt; 16); <span class="comment">// Update click state variable, but don&#39;t include the two trigger buttons L2 and R2</span></div>
<div class="line"><a name="l00357"></a><span class="lineno"> 357</span>&#160; <span class="keywordflow">if</span>(((uint8_t)OldButtonState[controller]) == 0 &amp;&amp; ((uint8_t)ButtonState[controller]) != 0) <span class="comment">// The L2 and R2 buttons are special as they are analog buttons</span></div>
<div class="line"><a name="l00358"></a><span class="lineno"> 358</span>&#160; R2Clicked[controller] = <span class="keyword">true</span>;</div>
<div class="line"><a name="l00359"></a><span class="lineno"> 359</span>&#160; <span class="keywordflow">if</span>((uint8_t)(OldButtonState[controller] &gt;&gt; 8) == 0 &amp;&amp; (uint8_t)(ButtonState[controller] &gt;&gt; 8) != 0)</div>
<div class="line"><a name="l00360"></a><span class="lineno"> 360</span>&#160; L2Clicked[controller] = <span class="keyword">true</span>;</div>
<div class="line"><a name="l00361"></a><span class="lineno"> 361</span>&#160; OldButtonState[controller] = ButtonState[controller];</div>
<div class="line"><a name="l00362"></a><span class="lineno"> 362</span>&#160; }</div>
<div class="line"><a name="l00363"></a><span class="lineno"> 363</span>&#160;}</div>
<div class="line"><a name="l00364"></a><span class="lineno"> 364</span>&#160;</div>
<div class="line"><a name="l00365"></a><span class="lineno"> 365</span>&#160;<span class="keywordtype">void</span> XBOXRECV::printReport(uint8_t controller, uint8_t nBytes) { <span class="comment">//Uncomment &quot;#define PRINTREPORT&quot; to print the report send by the Xbox 360 Controller</span></div>
<div class="line"><a name="l00366"></a><span class="lineno"> 366</span>&#160;<span class="preprocessor">#ifdef PRINTREPORT</span></div>
<div class="line"><a name="l00367"></a><span class="lineno"> 367</span>&#160;<span class="preprocessor"></span> <span class="keywordflow">if</span> (readBuf == NULL)</div>
<div class="line"><a name="l00368"></a><span class="lineno"> 368</span>&#160; <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00369"></a><span class="lineno"> 369</span>&#160; <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;Controller &quot;</span>));</div>
<div class="line"><a name="l00370"></a><span class="lineno"> 370</span>&#160; Serial.print(controller);</div>
<div class="line"><a name="l00371"></a><span class="lineno"> 371</span>&#160; <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;: &quot;</span>));</div>
<div class="line"><a name="l00372"></a><span class="lineno"> 372</span>&#160; <span class="keywordflow">for</span>(uint8_t i = 0; i &lt; nBytes;i++) {</div>
<div class="line"><a name="l00373"></a><span class="lineno"> 373</span>&#160; PrintHex&lt;uint8_t&gt;(readBuf[i]);</div>
<div class="line"><a name="l00374"></a><span class="lineno"> 374</span>&#160; Serial.print(<span class="stringliteral">&quot; &quot;</span>);</div>
<div class="line"><a name="l00375"></a><span class="lineno"> 375</span>&#160; }</div>
<div class="line"><a name="l00376"></a><span class="lineno"> 376</span>&#160; Serial.println();</div>
<div class="line"><a name="l00377"></a><span class="lineno"> 377</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00378"></a><span class="lineno"> 378</span>&#160;<span class="preprocessor"></span>}</div>
<div class="line"><a name="l00379"></a><span class="lineno"><a class="code" href="class_x_b_o_x_r_e_c_v.html#ad33cd16d10e438bb8051f7fa6052f6c9"> 379</a></span>&#160;uint8_t <a class="code" href="class_x_b_o_x_r_e_c_v.html#ad33cd16d10e438bb8051f7fa6052f6c9">XBOXRECV::getButtonPress</a>(uint8_t controller, <a class="code" href="controller_enums_8h.html#a03bfec859eac87be20f8952c1eb89de0">Button</a> b) {</div>
<div class="line"><a name="l00380"></a><span class="lineno"> 380</span>&#160; <span class="keywordflow">if</span>(b == <a class="code" href="controller_enums_8h.html#a03bfec859eac87be20f8952c1eb89de0a0adffb24dae0c41be5b803f4d444f066">L2</a>) <span class="comment">// These are analog buttons</span></div>
<div class="line"><a name="l00381"></a><span class="lineno"> 381</span>&#160; <span class="keywordflow">return</span> (uint8_t)(ButtonState[controller] &gt;&gt; 8);</div>
<div class="line"><a name="l00382"></a><span class="lineno"> 382</span>&#160; <span class="keywordflow">else</span> <span class="keywordflow">if</span>(b == <a class="code" href="controller_enums_8h.html#a03bfec859eac87be20f8952c1eb89de0a629d7b403cea5f826352f3aefb9a6d6a">R2</a>)</div>
<div class="line"><a name="l00383"></a><span class="lineno"> 383</span>&#160; <span class="keywordflow">return</span> (uint8_t)ButtonState[controller];</div>
<div class="line"><a name="l00384"></a><span class="lineno"> 384</span>&#160; <span class="keywordflow">return</span> (ButtonState[controller] &amp; ((uint32_t)pgm_read_word(&amp;XBOXBUTTONS[(uint8_t)b]) &lt;&lt; 16));</div>
<div class="line"><a name="l00385"></a><span class="lineno"> 385</span>&#160;}</div>
<div class="line"><a name="l00386"></a><span class="lineno"><a class="code" href="class_x_b_o_x_r_e_c_v.html#a5e9a59d90ec1941c7152cdd438c284d0"> 386</a></span>&#160;<span class="keywordtype">bool</span> <a class="code" href="class_x_b_o_x_r_e_c_v.html#a5e9a59d90ec1941c7152cdd438c284d0">XBOXRECV::getButtonClick</a>(uint8_t controller, <a class="code" href="controller_enums_8h.html#a03bfec859eac87be20f8952c1eb89de0">Button</a> b) {</div>
<div class="line"><a name="l00387"></a><span class="lineno"> 387</span>&#160; <span class="keywordflow">if</span>(b == <a class="code" href="controller_enums_8h.html#a03bfec859eac87be20f8952c1eb89de0a0adffb24dae0c41be5b803f4d444f066">L2</a>) {</div>
<div class="line"><a name="l00388"></a><span class="lineno"> 388</span>&#160; <span class="keywordflow">if</span>(L2Clicked[controller]) {</div>
<div class="line"><a name="l00389"></a><span class="lineno"> 389</span>&#160; L2Clicked[controller] = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00390"></a><span class="lineno"> 390</span>&#160; <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00391"></a><span class="lineno"> 391</span>&#160; }</div>
<div class="line"><a name="l00392"></a><span class="lineno"> 392</span>&#160; <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l00393"></a><span class="lineno"> 393</span>&#160; }</div>
<div class="line"><a name="l00394"></a><span class="lineno"> 394</span>&#160; <span class="keywordflow">else</span> <span class="keywordflow">if</span>(b == <a class="code" href="controller_enums_8h.html#a03bfec859eac87be20f8952c1eb89de0a629d7b403cea5f826352f3aefb9a6d6a">R2</a>) {</div>
<div class="line"><a name="l00395"></a><span class="lineno"> 395</span>&#160; <span class="keywordflow">if</span>(R2Clicked[controller]) {</div>
<div class="line"><a name="l00396"></a><span class="lineno"> 396</span>&#160; R2Clicked[controller] = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00397"></a><span class="lineno"> 397</span>&#160; <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00398"></a><span class="lineno"> 398</span>&#160; }</div>
<div class="line"><a name="l00399"></a><span class="lineno"> 399</span>&#160; <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l00400"></a><span class="lineno"> 400</span>&#160; }</div>
<div class="line"><a name="l00401"></a><span class="lineno"> 401</span>&#160; uint16_t button = pgm_read_word(&amp;XBOXBUTTONS[(uint8_t)b]);</div>
<div class="line"><a name="l00402"></a><span class="lineno"> 402</span>&#160; <span class="keywordtype">bool</span> click = (ButtonClickState[controller] &amp; button);</div>
<div class="line"><a name="l00403"></a><span class="lineno"> 403</span>&#160; ButtonClickState[controller] &amp;= ~button; <span class="comment">// clear &quot;click&quot; event</span></div>
<div class="line"><a name="l00404"></a><span class="lineno"> 404</span>&#160; <span class="keywordflow">return</span> click;</div>
<div class="line"><a name="l00344"></a><span class="lineno"> 344</span>&#160; <span class="comment">// A controller must be connected if it&#39;s sending data</span></div>
<div class="line"><a name="l00345"></a><span class="lineno"> 345</span>&#160; <span class="keywordflow">if</span> (!<a class="code" href="class_x_b_o_x_r_e_c_v.html#ac07faada38e159f1e7831d90863ebe3a">Xbox360Connected</a>[controller])</div>
<div class="line"><a name="l00346"></a><span class="lineno"> 346</span>&#160; <a class="code" href="class_x_b_o_x_r_e_c_v.html#ac07faada38e159f1e7831d90863ebe3a">Xbox360Connected</a>[controller] |= 0x80;</div>
<div class="line"><a name="l00347"></a><span class="lineno"> 347</span>&#160;</div>
<div class="line"><a name="l00348"></a><span class="lineno"> 348</span>&#160; ButtonState[controller] = (uint32_t)(readBuf[9] | ((uint16_t)readBuf[8] &lt;&lt; 8) | ((uint32_t)readBuf[7] &lt;&lt; 16) | ((uint32_t)readBuf[6] &lt;&lt; 24));</div>
<div class="line"><a name="l00349"></a><span class="lineno"> 349</span>&#160;</div>
<div class="line"><a name="l00350"></a><span class="lineno"> 350</span>&#160; hatValue[controller][<a class="code" href="controller_enums_8h.html#aaaabdefc068fd57ec2bef2b62ea4ba92a383cb8895dd296b7f69ce845ed16b0ca">LeftHatX</a>] = (int16_t)(((uint16_t)readBuf[11] &lt;&lt; 8) | readBuf[10]);</div>
<div class="line"><a name="l00351"></a><span class="lineno"> 351</span>&#160; hatValue[controller][<a class="code" href="controller_enums_8h.html#aaaabdefc068fd57ec2bef2b62ea4ba92af3f3925efa9762c4e9e71ac7da7a94a3">LeftHatY</a>] = (int16_t)(((uint16_t)readBuf[13] &lt;&lt; 8) | readBuf[12]);</div>
<div class="line"><a name="l00352"></a><span class="lineno"> 352</span>&#160; hatValue[controller][<a class="code" href="controller_enums_8h.html#aaaabdefc068fd57ec2bef2b62ea4ba92aaeb027a0ae5bbc6ba25e1c78a6486c7b">RightHatX</a>] = (int16_t)(((uint16_t)readBuf[15] &lt;&lt; 8) | readBuf[14]);</div>
<div class="line"><a name="l00353"></a><span class="lineno"> 353</span>&#160; hatValue[controller][<a class="code" href="controller_enums_8h.html#aaaabdefc068fd57ec2bef2b62ea4ba92a7f1fb2db5381286691f4dec179ed5d5a">RightHatY</a>] = (int16_t)(((uint16_t)readBuf[17] &lt;&lt; 8) | readBuf[16]);</div>
<div class="line"><a name="l00354"></a><span class="lineno"> 354</span>&#160;</div>
<div class="line"><a name="l00355"></a><span class="lineno"> 355</span>&#160; <span class="comment">//Notify(PSTR(&quot;\r\nButtonState: &quot;), 0x80);</span></div>
<div class="line"><a name="l00356"></a><span class="lineno"> 356</span>&#160; <span class="comment">//PrintHex&lt;uint32_t&gt;(ButtonState[controller], 0x80);</span></div>
<div class="line"><a name="l00357"></a><span class="lineno"> 357</span>&#160;</div>
<div class="line"><a name="l00358"></a><span class="lineno"> 358</span>&#160; <span class="keywordflow">if</span> (ButtonState[controller] != OldButtonState[controller]) {</div>
<div class="line"><a name="l00359"></a><span class="lineno"> 359</span>&#160; buttonStateChanged[controller] = <span class="keyword">true</span>;</div>
<div class="line"><a name="l00360"></a><span class="lineno"> 360</span>&#160; ButtonClickState[controller] = (ButtonState[controller] &gt;&gt; 16) &amp; ((~OldButtonState[controller]) &gt;&gt; 16); <span class="comment">// Update click state variable, but don&#39;t include the two trigger buttons L2 and R2</span></div>
<div class="line"><a name="l00361"></a><span class="lineno"> 361</span>&#160; <span class="keywordflow">if</span> (((uint8_t)OldButtonState[controller]) == 0 &amp;&amp; ((uint8_t)ButtonState[controller]) != 0) <span class="comment">// The L2 and R2 buttons are special as they are analog buttons</span></div>
<div class="line"><a name="l00362"></a><span class="lineno"> 362</span>&#160; R2Clicked[controller] = <span class="keyword">true</span>;</div>
<div class="line"><a name="l00363"></a><span class="lineno"> 363</span>&#160; <span class="keywordflow">if</span> ((uint8_t)(OldButtonState[controller] &gt;&gt; 8) == 0 &amp;&amp; (uint8_t)(ButtonState[controller] &gt;&gt; 8) != 0)</div>
<div class="line"><a name="l00364"></a><span class="lineno"> 364</span>&#160; L2Clicked[controller] = <span class="keyword">true</span>;</div>
<div class="line"><a name="l00365"></a><span class="lineno"> 365</span>&#160; OldButtonState[controller] = ButtonState[controller];</div>
<div class="line"><a name="l00366"></a><span class="lineno"> 366</span>&#160; }</div>
<div class="line"><a name="l00367"></a><span class="lineno"> 367</span>&#160;}</div>
<div class="line"><a name="l00368"></a><span class="lineno"> 368</span>&#160;</div>
<div class="line"><a name="l00369"></a><span class="lineno"> 369</span>&#160;<span class="keywordtype">void</span> XBOXRECV::printReport(uint8_t controller, uint8_t nBytes) { <span class="comment">//Uncomment &quot;#define PRINTREPORT&quot; to print the report send by the Xbox 360 Controller</span></div>
<div class="line"><a name="l00370"></a><span class="lineno"> 370</span>&#160;<span class="preprocessor">#ifdef PRINTREPORT</span></div>
<div class="line"><a name="l00371"></a><span class="lineno"> 371</span>&#160;<span class="preprocessor"></span> <span class="keywordflow">if</span> (readBuf == NULL)</div>
<div class="line"><a name="l00372"></a><span class="lineno"> 372</span>&#160; <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00373"></a><span class="lineno"> 373</span>&#160; <a class="code" href="message_8cpp.html#a1e8693828152de8408add858dc461dea">Notify</a>(PSTR(<span class="stringliteral">&quot;Controller &quot;</span>), 0x80);</div>
<div class="line"><a name="l00374"></a><span class="lineno"> 374</span>&#160; Serial.print(controller);</div>
<div class="line"><a name="l00375"></a><span class="lineno"> 375</span>&#160; <a class="code" href="message_8cpp.html#a1e8693828152de8408add858dc461dea">Notify</a>(PSTR(<span class="stringliteral">&quot;: &quot;</span>), 0x80);</div>
<div class="line"><a name="l00376"></a><span class="lineno"> 376</span>&#160; <span class="keywordflow">for</span> (uint8_t i = 0; i &lt; nBytes; i++) {</div>
<div class="line"><a name="l00377"></a><span class="lineno"> 377</span>&#160; PrintHex&lt;uint8_t &gt; (readBuf[i], 0x80);</div>
<div class="line"><a name="l00378"></a><span class="lineno"> 378</span>&#160; Serial.print(<span class="stringliteral">&quot; &quot;</span>);</div>
<div class="line"><a name="l00379"></a><span class="lineno"> 379</span>&#160; }</div>
<div class="line"><a name="l00380"></a><span class="lineno"> 380</span>&#160; Serial.println();</div>
<div class="line"><a name="l00381"></a><span class="lineno"> 381</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00382"></a><span class="lineno"> 382</span>&#160;<span class="preprocessor"></span>}</div>
<div class="line"><a name="l00383"></a><span class="lineno"> 383</span>&#160;</div>
<div class="line"><a name="l00384"></a><span class="lineno"><a class="code" href="class_x_b_o_x_r_e_c_v.html#ad33cd16d10e438bb8051f7fa6052f6c9"> 384</a></span>&#160;uint8_t <a class="code" href="class_x_b_o_x_r_e_c_v.html#ad33cd16d10e438bb8051f7fa6052f6c9">XBOXRECV::getButtonPress</a>(uint8_t controller, <a class="code" href="controller_enums_8h.html#a03bfec859eac87be20f8952c1eb89de0">Button</a> b) {</div>
<div class="line"><a name="l00385"></a><span class="lineno"> 385</span>&#160; <span class="keywordflow">if</span> (b == <a class="code" href="controller_enums_8h.html#a03bfec859eac87be20f8952c1eb89de0a0adffb24dae0c41be5b803f4d444f066">L2</a>) <span class="comment">// These are analog buttons</span></div>
<div class="line"><a name="l00386"></a><span class="lineno"> 386</span>&#160; <span class="keywordflow">return</span> (uint8_t)(ButtonState[controller] &gt;&gt; 8);</div>
<div class="line"><a name="l00387"></a><span class="lineno"> 387</span>&#160; <span class="keywordflow">else</span> <span class="keywordflow">if</span> (b == <a class="code" href="controller_enums_8h.html#a03bfec859eac87be20f8952c1eb89de0a629d7b403cea5f826352f3aefb9a6d6a">R2</a>)</div>
<div class="line"><a name="l00388"></a><span class="lineno"> 388</span>&#160; <span class="keywordflow">return</span> (uint8_t)ButtonState[controller];</div>
<div class="line"><a name="l00389"></a><span class="lineno"> 389</span>&#160; <span class="keywordflow">return</span> (ButtonState[controller] &amp; ((uint32_t)pgm_read_word(&amp;<a class="code" href="xbox_enums_8h.html#a7e55826e75b9b88578c8b0edaaf523d7">XBOXBUTTONS</a>[(uint8_t)b]) &lt;&lt; 16));</div>
<div class="line"><a name="l00390"></a><span class="lineno"> 390</span>&#160;}</div>
<div class="line"><a name="l00391"></a><span class="lineno"> 391</span>&#160;</div>
<div class="line"><a name="l00392"></a><span class="lineno"><a class="code" href="class_x_b_o_x_r_e_c_v.html#a5e9a59d90ec1941c7152cdd438c284d0"> 392</a></span>&#160;<span class="keywordtype">bool</span> <a class="code" href="class_x_b_o_x_r_e_c_v.html#a5e9a59d90ec1941c7152cdd438c284d0">XBOXRECV::getButtonClick</a>(uint8_t controller, <a class="code" href="controller_enums_8h.html#a03bfec859eac87be20f8952c1eb89de0">Button</a> b) {</div>
<div class="line"><a name="l00393"></a><span class="lineno"> 393</span>&#160; <span class="keywordflow">if</span> (b == <a class="code" href="controller_enums_8h.html#a03bfec859eac87be20f8952c1eb89de0a0adffb24dae0c41be5b803f4d444f066">L2</a>) {</div>
<div class="line"><a name="l00394"></a><span class="lineno"> 394</span>&#160; <span class="keywordflow">if</span> (L2Clicked[controller]) {</div>
<div class="line"><a name="l00395"></a><span class="lineno"> 395</span>&#160; L2Clicked[controller] = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00396"></a><span class="lineno"> 396</span>&#160; <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00397"></a><span class="lineno"> 397</span>&#160; }</div>
<div class="line"><a name="l00398"></a><span class="lineno"> 398</span>&#160; <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l00399"></a><span class="lineno"> 399</span>&#160; } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (b == <a class="code" href="controller_enums_8h.html#a03bfec859eac87be20f8952c1eb89de0a629d7b403cea5f826352f3aefb9a6d6a">R2</a>) {</div>
<div class="line"><a name="l00400"></a><span class="lineno"> 400</span>&#160; <span class="keywordflow">if</span> (R2Clicked[controller]) {</div>
<div class="line"><a name="l00401"></a><span class="lineno"> 401</span>&#160; R2Clicked[controller] = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00402"></a><span class="lineno"> 402</span>&#160; <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00403"></a><span class="lineno"> 403</span>&#160; }</div>
<div class="line"><a name="l00404"></a><span class="lineno"> 404</span>&#160; <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l00405"></a><span class="lineno"> 405</span>&#160; }</div>
<div class="line"><a name="l00406"></a><span class="lineno"><a class="code" href="class_x_b_o_x_r_e_c_v.html#a1b277f0980bd53f30283d4af9d9b8926"> 406</a></span>&#160;int16_t <a class="code" href="class_x_b_o_x_r_e_c_v.html#a1b277f0980bd53f30283d4af9d9b8926">XBOXRECV::getAnalogHat</a>(uint8_t controller, <a class="code" href="controller_enums_8h.html#aaaabdefc068fd57ec2bef2b62ea4ba92">AnalogHat</a> a) {</div>
<div class="line"><a name="l00407"></a><span class="lineno"> 407</span>&#160; <span class="keywordflow">return</span> hatValue[controller][a];</div>
<div class="line"><a name="l00408"></a><span class="lineno"> 408</span>&#160;}</div>
<div class="line"><a name="l00409"></a><span class="lineno"><a class="code" href="class_x_b_o_x_r_e_c_v.html#aa2263642c0d422c6d21fed3933d6044c"> 409</a></span>&#160;<span class="keywordtype">bool</span> <a class="code" href="class_x_b_o_x_r_e_c_v.html#aa2263642c0d422c6d21fed3933d6044c">XBOXRECV::buttonChanged</a>(uint8_t controller) {</div>
<div class="line"><a name="l00410"></a><span class="lineno"> 410</span>&#160; <span class="keywordtype">bool</span> state = buttonStateChanged[controller];</div>
<div class="line"><a name="l00411"></a><span class="lineno"> 411</span>&#160; buttonStateChanged[controller] = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00412"></a><span class="lineno"> 412</span>&#160; <span class="keywordflow">return</span> state;</div>
<div class="line"><a name="l00413"></a><span class="lineno"> 413</span>&#160;}</div>
<div class="line"><a name="l00414"></a><span class="lineno"> 414</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00415"></a><span class="lineno"> 415</span>&#160;<span class="comment">ControllerStatus Breakdown</span></div>
<div class="line"><a name="l00416"></a><span class="lineno"> 416</span>&#160;<span class="comment"> ControllerStatus[controller] &amp; 0x0001 // 0</span></div>
<div class="line"><a name="l00417"></a><span class="lineno"> 417</span>&#160;<span class="comment"> ControllerStatus[controller] &amp; 0x0002 // normal batteries, no rechargeable battery pack</span></div>
<div class="line"><a name="l00418"></a><span class="lineno"> 418</span>&#160;<span class="comment"> ControllerStatus[controller] &amp; 0x0004 // controller starting up / settling</span></div>
<div class="line"><a name="l00419"></a><span class="lineno"> 419</span>&#160;<span class="comment"> ControllerStatus[controller] &amp; 0x0008 // headset adapter plugged in, but no headphones connected (mute?)</span></div>
<div class="line"><a name="l00420"></a><span class="lineno"> 420</span>&#160;<span class="comment"> ControllerStatus[controller] &amp; 0x0010 // 0</span></div>
<div class="line"><a name="l00421"></a><span class="lineno"> 421</span>&#160;<span class="comment"> ControllerStatus[controller] &amp; 0x0020 // 1</span></div>
<div class="line"><a name="l00422"></a><span class="lineno"> 422</span>&#160;<span class="comment"> ControllerStatus[controller] &amp; 0x0040 // battery level (high bit)</span></div>
<div class="line"><a name="l00423"></a><span class="lineno"> 423</span>&#160;<span class="comment"> ControllerStatus[controller] &amp; 0x0080 // battery level (low bit)</span></div>
<div class="line"><a name="l00424"></a><span class="lineno"> 424</span>&#160;<span class="comment"> ControllerStatus[controller] &amp; 0x0100 // 1</span></div>
<div class="line"><a name="l00425"></a><span class="lineno"> 425</span>&#160;<span class="comment"> ControllerStatus[controller] &amp; 0x0200 // 1</span></div>
<div class="line"><a name="l00426"></a><span class="lineno"> 426</span>&#160;<span class="comment"> ControllerStatus[controller] &amp; 0x0400 // headset adapter plugged in</span></div>
<div class="line"><a name="l00427"></a><span class="lineno"> 427</span>&#160;<span class="comment"> ControllerStatus[controller] &amp; 0x0800 // 0</span></div>
<div class="line"><a name="l00428"></a><span class="lineno"> 428</span>&#160;<span class="comment"> ControllerStatus[controller] &amp; 0x1000 // 1</span></div>
<div class="line"><a name="l00429"></a><span class="lineno"> 429</span>&#160;<span class="comment"> ControllerStatus[controller] &amp; 0x2000 // 0</span></div>
<div class="line"><a name="l00430"></a><span class="lineno"> 430</span>&#160;<span class="comment"> ControllerStatus[controller] &amp; 0x4000 // 0</span></div>
<div class="line"><a name="l00431"></a><span class="lineno"> 431</span>&#160;<span class="comment"> ControllerStatus[controller] &amp; 0x8000 // 0</span></div>
<div class="line"><a name="l00432"></a><span class="lineno"> 432</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l00433"></a><span class="lineno"><a class="code" href="class_x_b_o_x_r_e_c_v.html#a671caa6d19debca8ff14dc82ac3ed005"> 433</a></span>&#160;uint8_t <a class="code" href="class_x_b_o_x_r_e_c_v.html#a671caa6d19debca8ff14dc82ac3ed005">XBOXRECV::getBatteryLevel</a>(uint8_t controller) {</div>
<div class="line"><a name="l00434"></a><span class="lineno"> 434</span>&#160; uint8_t batteryLevel = ((controllerStatus[controller] &amp; 0x00C0) &gt;&gt; 6) * 33;</div>
<div class="line"><a name="l00435"></a><span class="lineno"> 435</span>&#160; <span class="keywordflow">if</span>(batteryLevel == 99)</div>
<div class="line"><a name="l00436"></a><span class="lineno"> 436</span>&#160; batteryLevel = 100; </div>
<div class="line"><a name="l00437"></a><span class="lineno"> 437</span>&#160; <span class="keywordflow">return</span> batteryLevel; </div>
<div class="line"><a name="l00438"></a><span class="lineno"> 438</span>&#160;}</div>
<div class="line"><a name="l00439"></a><span class="lineno"> 439</span>&#160;</div>
<div class="line"><a name="l00440"></a><span class="lineno"> 440</span>&#160;<span class="keywordtype">void</span> XBOXRECV::XboxCommand(uint8_t controller, uint8_t* data, uint16_t nbytes) {</div>
<div class="line"><a name="l00441"></a><span class="lineno"> 441</span>&#160; uint8_t rcode;</div>
<div class="line"><a name="l00442"></a><span class="lineno"> 442</span>&#160; uint8_t outputPipe;</div>
<div class="line"><a name="l00443"></a><span class="lineno"> 443</span>&#160; <span class="keywordflow">switch</span> (controller) {</div>
<div class="line"><a name="l00444"></a><span class="lineno"> 444</span>&#160; <span class="keywordflow">case</span> 0: outputPipe = <a class="code" href="_x_b_o_x_r_e_c_v_8h.html#a962be1e740bce25cf37e111bd88be9bf">XBOX_OUTPUT_PIPE_1</a>; <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00445"></a><span class="lineno"> 445</span>&#160; <span class="keywordflow">case</span> 1: outputPipe = <a class="code" href="_x_b_o_x_r_e_c_v_8h.html#a8ba688a4bdb47869d7ee3f49b6d07b7c">XBOX_OUTPUT_PIPE_2</a>; <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00446"></a><span class="lineno"> 446</span>&#160; <span class="keywordflow">case</span> 2: outputPipe = <a class="code" href="_x_b_o_x_r_e_c_v_8h.html#afce4154cabb3a0d2c7eeb39b1c15d353">XBOX_OUTPUT_PIPE_3</a>; <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00447"></a><span class="lineno"> 447</span>&#160; <span class="keywordflow">case</span> 3: outputPipe = <a class="code" href="_x_b_o_x_r_e_c_v_8h.html#a7a74e0ea052831dbbb4a0973fffc8179">XBOX_OUTPUT_PIPE_4</a>; <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00448"></a><span class="lineno"> 448</span>&#160; }</div>
<div class="line"><a name="l00449"></a><span class="lineno"> 449</span>&#160; rcode = <a class="code" href="class_x_b_o_x_r_e_c_v.html#a53047c86c8c2f625916af62238d50fc8">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#affbc018973a588995457d535b0ac7ee7">outTransfer</a>(<a class="code" href="class_x_b_o_x_r_e_c_v.html#a1d4bdb1b740c87fd51aca3969e67c730">bAddress</a>, <a class="code" href="class_x_b_o_x_r_e_c_v.html#af97c8d0efc945fa4ba1d120c8a5a9cbb">epInfo</a>[ outputPipe ].epAddr, nbytes, data);</div>
<div class="line"><a name="l00450"></a><span class="lineno"> 450</span>&#160;<span class="preprocessor">#ifdef EXTRADEBUG</span></div>
<div class="line"><a name="l00451"></a><span class="lineno"> 451</span>&#160;<span class="preprocessor"></span> <span class="keywordflow">if</span>(rcode)</div>
<div class="line"><a name="l00452"></a><span class="lineno"> 452</span>&#160; <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;Error sending Xbox message\r\n&quot;</span>));</div>
<div class="line"><a name="l00453"></a><span class="lineno"> 453</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00454"></a><span class="lineno"> 454</span>&#160;<span class="preprocessor"></span>}</div>
<div class="line"><a name="l00455"></a><span class="lineno"><a class="code" href="class_x_b_o_x_r_e_c_v.html#a354ede498c38b95a60c1b27deb01e47d"> 455</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_x_b_o_x_r_e_c_v.html#a354ede498c38b95a60c1b27deb01e47d">XBOXRECV::setLedRaw</a>(uint8_t controller, uint8_t value) {</div>
<div class="line"><a name="l00456"></a><span class="lineno"> 456</span>&#160; writeBuf[0] = 0x00;</div>
<div class="line"><a name="l00457"></a><span class="lineno"> 457</span>&#160; writeBuf[1] = 0x00;</div>
<div class="line"><a name="l00458"></a><span class="lineno"> 458</span>&#160; writeBuf[2] = 0x08;</div>
<div class="line"><a name="l00459"></a><span class="lineno"> 459</span>&#160; writeBuf[3] = value | 0x40;</div>
<div class="line"><a name="l00460"></a><span class="lineno"> 460</span>&#160; </div>
<div class="line"><a name="l00461"></a><span class="lineno"> 461</span>&#160; XboxCommand(controller, writeBuf, 4);</div>
<div class="line"><a name="l00462"></a><span class="lineno"> 462</span>&#160;}</div>
<div class="line"><a name="l00463"></a><span class="lineno"><a class="code" href="class_x_b_o_x_r_e_c_v.html#a9e17aa44f2946e710fb9343f27290c85"> 463</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_x_b_o_x_r_e_c_v.html#a9e17aa44f2946e710fb9343f27290c85">XBOXRECV::setLedOn</a>(uint8_t controller, <a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6">LED</a> led) {</div>
<div class="line"><a name="l00464"></a><span class="lineno"> 464</span>&#160; <span class="keywordflow">if</span>(led != <a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6ab1d5eac4b1dca480c8056eaea7663b7a">ALL</a>) <span class="comment">// All LEDs can&#39;t be on a the same time</span></div>
<div class="line"><a name="l00465"></a><span class="lineno"> 465</span>&#160; <a class="code" href="class_x_b_o_x_r_e_c_v.html#a354ede498c38b95a60c1b27deb01e47d">setLedRaw</a>(controller,(pgm_read_byte(&amp;XBOXLEDS[(uint8_t)led]))+4);</div>
<div class="line"><a name="l00466"></a><span class="lineno"> 466</span>&#160;}</div>
<div class="line"><a name="l00467"></a><span class="lineno"><a class="code" href="class_x_b_o_x_r_e_c_v.html#a54490f57e16eaee6689ca92351958017"> 467</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_x_b_o_x_r_e_c_v.html#a54490f57e16eaee6689ca92351958017">XBOXRECV::setLedBlink</a>(uint8_t controller, <a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6">LED</a> led) {</div>
<div class="line"><a name="l00468"></a><span class="lineno"> 468</span>&#160; <a class="code" href="class_x_b_o_x_r_e_c_v.html#a354ede498c38b95a60c1b27deb01e47d">setLedRaw</a>(controller,pgm_read_byte(&amp;XBOXLEDS[(uint8_t)led]));</div>
<div class="line"><a name="l00469"></a><span class="lineno"> 469</span>&#160;}</div>
<div class="line"><a name="l00470"></a><span class="lineno"><a class="code" href="class_x_b_o_x_r_e_c_v.html#ace7deafed6fa6991d38417b41a490c57"> 470</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_x_b_o_x_r_e_c_v.html#ace7deafed6fa6991d38417b41a490c57">XBOXRECV::setLedMode</a>(uint8_t controller, <a class="code" href="xbox_enums_8h.html#a57effb96f46e458675a2653d4c543ca2">LEDMode</a> ledMode) { <span class="comment">// This function is used to do some speciel LED stuff the controller supports</span></div>
<div class="line"><a name="l00471"></a><span class="lineno"> 471</span>&#160; <a class="code" href="class_x_b_o_x_r_e_c_v.html#a354ede498c38b95a60c1b27deb01e47d">setLedRaw</a>(controller,(uint8_t)ledMode);</div>
<div class="line"><a name="l00406"></a><span class="lineno"> 406</span>&#160; uint16_t button = pgm_read_word(&amp;<a class="code" href="xbox_enums_8h.html#a7e55826e75b9b88578c8b0edaaf523d7">XBOXBUTTONS</a>[(uint8_t)b]);</div>
<div class="line"><a name="l00407"></a><span class="lineno"> 407</span>&#160; <span class="keywordtype">bool</span> click = (ButtonClickState[controller] &amp; button);</div>
<div class="line"><a name="l00408"></a><span class="lineno"> 408</span>&#160; ButtonClickState[controller] &amp;= ~button; <span class="comment">// clear &quot;click&quot; event</span></div>
<div class="line"><a name="l00409"></a><span class="lineno"> 409</span>&#160; <span class="keywordflow">return</span> click;</div>
<div class="line"><a name="l00410"></a><span class="lineno"> 410</span>&#160;}</div>
<div class="line"><a name="l00411"></a><span class="lineno"> 411</span>&#160;</div>
<div class="line"><a name="l00412"></a><span class="lineno"><a class="code" href="class_x_b_o_x_r_e_c_v.html#a1b277f0980bd53f30283d4af9d9b8926"> 412</a></span>&#160;int16_t <a class="code" href="class_x_b_o_x_r_e_c_v.html#a1b277f0980bd53f30283d4af9d9b8926">XBOXRECV::getAnalogHat</a>(uint8_t controller, <a class="code" href="controller_enums_8h.html#aaaabdefc068fd57ec2bef2b62ea4ba92">AnalogHat</a> a) {</div>
<div class="line"><a name="l00413"></a><span class="lineno"> 413</span>&#160; <span class="keywordflow">return</span> hatValue[controller][a];</div>
<div class="line"><a name="l00414"></a><span class="lineno"> 414</span>&#160;}</div>
<div class="line"><a name="l00415"></a><span class="lineno"> 415</span>&#160;</div>
<div class="line"><a name="l00416"></a><span class="lineno"><a class="code" href="class_x_b_o_x_r_e_c_v.html#aa2263642c0d422c6d21fed3933d6044c"> 416</a></span>&#160;<span class="keywordtype">bool</span> <a class="code" href="class_x_b_o_x_r_e_c_v.html#aa2263642c0d422c6d21fed3933d6044c">XBOXRECV::buttonChanged</a>(uint8_t controller) {</div>
<div class="line"><a name="l00417"></a><span class="lineno"> 417</span>&#160; <span class="keywordtype">bool</span> state = buttonStateChanged[controller];</div>
<div class="line"><a name="l00418"></a><span class="lineno"> 418</span>&#160; buttonStateChanged[controller] = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00419"></a><span class="lineno"> 419</span>&#160; <span class="keywordflow">return</span> state;</div>
<div class="line"><a name="l00420"></a><span class="lineno"> 420</span>&#160;}</div>
<div class="line"><a name="l00421"></a><span class="lineno"> 421</span>&#160;</div>
<div class="line"><a name="l00422"></a><span class="lineno"> 422</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00423"></a><span class="lineno"> 423</span>&#160;<span class="comment">ControllerStatus Breakdown</span></div>
<div class="line"><a name="l00424"></a><span class="lineno"> 424</span>&#160;<span class="comment"> ControllerStatus[controller] &amp; 0x0001 // 0</span></div>
<div class="line"><a name="l00425"></a><span class="lineno"> 425</span>&#160;<span class="comment"> ControllerStatus[controller] &amp; 0x0002 // normal batteries, no rechargeable battery pack</span></div>
<div class="line"><a name="l00426"></a><span class="lineno"> 426</span>&#160;<span class="comment"> ControllerStatus[controller] &amp; 0x0004 // controller starting up / settling</span></div>
<div class="line"><a name="l00427"></a><span class="lineno"> 427</span>&#160;<span class="comment"> ControllerStatus[controller] &amp; 0x0008 // headset adapter plugged in, but no headphones connected (mute?)</span></div>
<div class="line"><a name="l00428"></a><span class="lineno"> 428</span>&#160;<span class="comment"> ControllerStatus[controller] &amp; 0x0010 // 0</span></div>
<div class="line"><a name="l00429"></a><span class="lineno"> 429</span>&#160;<span class="comment"> ControllerStatus[controller] &amp; 0x0020 // 1</span></div>
<div class="line"><a name="l00430"></a><span class="lineno"> 430</span>&#160;<span class="comment"> ControllerStatus[controller] &amp; 0x0040 // battery level (high bit)</span></div>
<div class="line"><a name="l00431"></a><span class="lineno"> 431</span>&#160;<span class="comment"> ControllerStatus[controller] &amp; 0x0080 // battery level (low bit)</span></div>
<div class="line"><a name="l00432"></a><span class="lineno"> 432</span>&#160;<span class="comment"> ControllerStatus[controller] &amp; 0x0100 // 1</span></div>
<div class="line"><a name="l00433"></a><span class="lineno"> 433</span>&#160;<span class="comment"> ControllerStatus[controller] &amp; 0x0200 // 1</span></div>
<div class="line"><a name="l00434"></a><span class="lineno"> 434</span>&#160;<span class="comment"> ControllerStatus[controller] &amp; 0x0400 // headset adapter plugged in</span></div>
<div class="line"><a name="l00435"></a><span class="lineno"> 435</span>&#160;<span class="comment"> ControllerStatus[controller] &amp; 0x0800 // 0</span></div>
<div class="line"><a name="l00436"></a><span class="lineno"> 436</span>&#160;<span class="comment"> ControllerStatus[controller] &amp; 0x1000 // 1</span></div>
<div class="line"><a name="l00437"></a><span class="lineno"> 437</span>&#160;<span class="comment"> ControllerStatus[controller] &amp; 0x2000 // 0</span></div>
<div class="line"><a name="l00438"></a><span class="lineno"> 438</span>&#160;<span class="comment"> ControllerStatus[controller] &amp; 0x4000 // 0</span></div>
<div class="line"><a name="l00439"></a><span class="lineno"> 439</span>&#160;<span class="comment"> ControllerStatus[controller] &amp; 0x8000 // 0</span></div>
<div class="line"><a name="l00440"></a><span class="lineno"> 440</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00441"></a><span class="lineno"><a class="code" href="class_x_b_o_x_r_e_c_v.html#a671caa6d19debca8ff14dc82ac3ed005"> 441</a></span>&#160;uint8_t <a class="code" href="class_x_b_o_x_r_e_c_v.html#a671caa6d19debca8ff14dc82ac3ed005">XBOXRECV::getBatteryLevel</a>(uint8_t controller) {</div>
<div class="line"><a name="l00442"></a><span class="lineno"> 442</span>&#160; <span class="keywordflow">return</span> ((controllerStatus[controller] &amp; 0x00C0) &gt;&gt; 6);</div>
<div class="line"><a name="l00443"></a><span class="lineno"> 443</span>&#160;}</div>
<div class="line"><a name="l00444"></a><span class="lineno"> 444</span>&#160;</div>
<div class="line"><a name="l00445"></a><span class="lineno"> 445</span>&#160;<span class="keywordtype">void</span> XBOXRECV::XboxCommand(uint8_t controller, uint8_t* data, uint16_t nbytes) {</div>
<div class="line"><a name="l00446"></a><span class="lineno"> 446</span>&#160; uint8_t rcode;</div>
<div class="line"><a name="l00447"></a><span class="lineno"> 447</span>&#160; uint8_t outputPipe;</div>
<div class="line"><a name="l00448"></a><span class="lineno"> 448</span>&#160; <span class="keywordflow">switch</span> (controller) {</div>
<div class="line"><a name="l00449"></a><span class="lineno"> 449</span>&#160; <span class="keywordflow">case</span> 0: outputPipe = <a class="code" href="_x_b_o_x_r_e_c_v_8h.html#a962be1e740bce25cf37e111bd88be9bf">XBOX_OUTPUT_PIPE_1</a>;</div>
<div class="line"><a name="l00450"></a><span class="lineno"> 450</span>&#160; <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00451"></a><span class="lineno"> 451</span>&#160; <span class="keywordflow">case</span> 1: outputPipe = <a class="code" href="_x_b_o_x_r_e_c_v_8h.html#a8ba688a4bdb47869d7ee3f49b6d07b7c">XBOX_OUTPUT_PIPE_2</a>;</div>
<div class="line"><a name="l00452"></a><span class="lineno"> 452</span>&#160; <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00453"></a><span class="lineno"> 453</span>&#160; <span class="keywordflow">case</span> 2: outputPipe = <a class="code" href="_x_b_o_x_r_e_c_v_8h.html#afce4154cabb3a0d2c7eeb39b1c15d353">XBOX_OUTPUT_PIPE_3</a>;</div>
<div class="line"><a name="l00454"></a><span class="lineno"> 454</span>&#160; <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00455"></a><span class="lineno"> 455</span>&#160; <span class="keywordflow">case</span> 3: outputPipe = <a class="code" href="_x_b_o_x_r_e_c_v_8h.html#a7a74e0ea052831dbbb4a0973fffc8179">XBOX_OUTPUT_PIPE_4</a>;</div>
<div class="line"><a name="l00456"></a><span class="lineno"> 456</span>&#160; <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00457"></a><span class="lineno"> 457</span>&#160; }</div>
<div class="line"><a name="l00458"></a><span class="lineno"> 458</span>&#160; rcode = <a class="code" href="class_x_b_o_x_r_e_c_v.html#a53047c86c8c2f625916af62238d50fc8">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#affbc018973a588995457d535b0ac7ee7">outTransfer</a>(<a class="code" href="class_x_b_o_x_r_e_c_v.html#a1d4bdb1b740c87fd51aca3969e67c730">bAddress</a>, <a class="code" href="class_x_b_o_x_r_e_c_v.html#af97c8d0efc945fa4ba1d120c8a5a9cbb">epInfo</a>[ outputPipe ].epAddr, nbytes, data);</div>
<div class="line"><a name="l00459"></a><span class="lineno"> 459</span>&#160;<span class="preprocessor">#ifdef EXTRADEBUG</span></div>
<div class="line"><a name="l00460"></a><span class="lineno"> 460</span>&#160;<span class="preprocessor"></span> <span class="keywordflow">if</span> (rcode)</div>
<div class="line"><a name="l00461"></a><span class="lineno"> 461</span>&#160; <a class="code" href="message_8cpp.html#a1e8693828152de8408add858dc461dea">Notify</a>(PSTR(<span class="stringliteral">&quot;Error sending Xbox message\r\n&quot;</span>), 0x80);</div>
<div class="line"><a name="l00462"></a><span class="lineno"> 462</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00463"></a><span class="lineno"> 463</span>&#160;<span class="preprocessor"></span>}</div>
<div class="line"><a name="l00464"></a><span class="lineno"> 464</span>&#160;</div>
<div class="line"><a name="l00465"></a><span class="lineno"><a class="code" href="class_x_b_o_x_r_e_c_v.html#a354ede498c38b95a60c1b27deb01e47d"> 465</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_x_b_o_x_r_e_c_v.html#a354ede498c38b95a60c1b27deb01e47d">XBOXRECV::setLedRaw</a>(uint8_t controller, uint8_t value) {</div>
<div class="line"><a name="l00466"></a><span class="lineno"> 466</span>&#160; writeBuf[0] = 0x00;</div>
<div class="line"><a name="l00467"></a><span class="lineno"> 467</span>&#160; writeBuf[1] = 0x00;</div>
<div class="line"><a name="l00468"></a><span class="lineno"> 468</span>&#160; writeBuf[2] = 0x08;</div>
<div class="line"><a name="l00469"></a><span class="lineno"> 469</span>&#160; writeBuf[3] = value | 0x40;</div>
<div class="line"><a name="l00470"></a><span class="lineno"> 470</span>&#160;</div>
<div class="line"><a name="l00471"></a><span class="lineno"> 471</span>&#160; XboxCommand(controller, writeBuf, 4);</div>
<div class="line"><a name="l00472"></a><span class="lineno"> 472</span>&#160;}</div>
<div class="line"><a name="l00473"></a><span class="lineno"> 473</span>&#160;<span class="comment">/* PC runs this at interval of approx 2 seconds </span></div>
<div class="line"><a name="l00474"></a><span class="lineno"> 474</span>&#160;<span class="comment">Thanks to BusHound from Perisoft.net for the Windows USB Analysis output</span></div>
<div class="line"><a name="l00475"></a><span class="lineno"> 475</span>&#160;<span class="comment">Found by timstamp.co.uk</span></div>
<div class="line"><a name="l00476"></a><span class="lineno"> 476</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l00477"></a><span class="lineno"> 477</span>&#160;<span class="keywordtype">void</span> XBOXRECV::checkStatus() {</div>
<div class="line"><a name="l00478"></a><span class="lineno"> 478</span>&#160; <span class="keywordflow">if</span>(!bPollEnable) </div>
<div class="line"><a name="l00479"></a><span class="lineno"> 479</span>&#160; <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00480"></a><span class="lineno"> 480</span>&#160; <span class="comment">// Get controller info</span></div>
<div class="line"><a name="l00481"></a><span class="lineno"> 481</span>&#160; writeBuf[0] = 0x08;</div>
<div class="line"><a name="l00482"></a><span class="lineno"> 482</span>&#160; writeBuf[1] = 0x00;</div>
<div class="line"><a name="l00483"></a><span class="lineno"> 483</span>&#160; writeBuf[2] = 0x0f;</div>
<div class="line"><a name="l00484"></a><span class="lineno"> 484</span>&#160; writeBuf[3] = 0xc0;</div>
<div class="line"><a name="l00485"></a><span class="lineno"> 485</span>&#160; <span class="keywordflow">for</span>(uint8_t i=0; i&lt;4; i++) {</div>
<div class="line"><a name="l00486"></a><span class="lineno"> 486</span>&#160; XboxCommand(i, writeBuf, 4);</div>
<div class="line"><a name="l00487"></a><span class="lineno"> 487</span>&#160; }</div>
<div class="line"><a name="l00488"></a><span class="lineno"> 488</span>&#160; <span class="comment">// Get battery status</span></div>
<div class="line"><a name="l00489"></a><span class="lineno"> 489</span>&#160; writeBuf[0] = 0x00;</div>
<div class="line"><a name="l00490"></a><span class="lineno"> 490</span>&#160; writeBuf[1] = 0x00;</div>
<div class="line"><a name="l00491"></a><span class="lineno"> 491</span>&#160; writeBuf[2] = 0x00;</div>
<div class="line"><a name="l00492"></a><span class="lineno"> 492</span>&#160; writeBuf[3] = 0x40;</div>
<div class="line"><a name="l00493"></a><span class="lineno"> 493</span>&#160; <span class="keywordflow">for</span>(uint8_t i=0; i&lt;4; i++) {</div>
<div class="line"><a name="l00494"></a><span class="lineno"> 494</span>&#160; <span class="keywordflow">if</span>(<a class="code" href="class_x_b_o_x_r_e_c_v.html#ac07faada38e159f1e7831d90863ebe3a">Xbox360Connected</a>[i])</div>
<div class="line"><a name="l00495"></a><span class="lineno"> 495</span>&#160; XboxCommand(i, writeBuf, 4);</div>
<div class="line"><a name="l00496"></a><span class="lineno"> 496</span>&#160; }</div>
<div class="line"><a name="l00497"></a><span class="lineno"> 497</span>&#160;}</div>
<div class="line"><a name="l00498"></a><span class="lineno"> 498</span>&#160;</div>
<div class="line"><a name="l00499"></a><span class="lineno"><a class="code" href="class_x_b_o_x_r_e_c_v.html#afd1f58838a9aea8e742103fddbe8fe69"> 499</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_x_b_o_x_r_e_c_v.html#afd1f58838a9aea8e742103fddbe8fe69">XBOXRECV::setRumbleOn</a>(uint8_t controller, uint8_t lValue, uint8_t rValue) {</div>
<div class="line"><a name="l00500"></a><span class="lineno"> 500</span>&#160; writeBuf[0] = 0x00;</div>
<div class="line"><a name="l00501"></a><span class="lineno"> 501</span>&#160; writeBuf[1] = 0x01;</div>
<div class="line"><a name="l00502"></a><span class="lineno"> 502</span>&#160; writeBuf[2] = 0x0f;</div>
<div class="line"><a name="l00503"></a><span class="lineno"> 503</span>&#160; writeBuf[3] = 0xc0;</div>
<div class="line"><a name="l00504"></a><span class="lineno"> 504</span>&#160; writeBuf[4] = 0x00;</div>
<div class="line"><a name="l00505"></a><span class="lineno"> 505</span>&#160; writeBuf[5] = lValue; <span class="comment">// big weight</span></div>
<div class="line"><a name="l00506"></a><span class="lineno"> 506</span>&#160; writeBuf[6] = rValue; <span class="comment">// small weight</span></div>
<div class="line"><a name="l00507"></a><span class="lineno"> 507</span>&#160; </div>
<div class="line"><a name="l00508"></a><span class="lineno"> 508</span>&#160; XboxCommand(controller, writeBuf, 7);</div>
<div class="line"><a name="l00509"></a><span class="lineno"> 509</span>&#160;}</div>
<div class="line"><a name="l00473"></a><span class="lineno"> 473</span>&#160;</div>
<div class="line"><a name="l00474"></a><span class="lineno"><a class="code" href="class_x_b_o_x_r_e_c_v.html#a9e17aa44f2946e710fb9343f27290c85"> 474</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_x_b_o_x_r_e_c_v.html#a9e17aa44f2946e710fb9343f27290c85">XBOXRECV::setLedOn</a>(uint8_t controller, <a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6">LED</a> led) {</div>
<div class="line"><a name="l00475"></a><span class="lineno"> 475</span>&#160; <span class="keywordflow">if</span> (led != <a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6ab1d5eac4b1dca480c8056eaea7663b7a">ALL</a>) <span class="comment">// All LEDs can&#39;t be on a the same time</span></div>
<div class="line"><a name="l00476"></a><span class="lineno"> 476</span>&#160; <a class="code" href="class_x_b_o_x_r_e_c_v.html#a354ede498c38b95a60c1b27deb01e47d">setLedRaw</a>(controller, (pgm_read_byte(&amp;<a class="code" href="xbox_enums_8h.html#a867f3bf7a14d4647290f1ac7f76b23ee">XBOXLEDS</a>[(uint8_t)led])) + 4);</div>
<div class="line"><a name="l00477"></a><span class="lineno"> 477</span>&#160;}</div>
<div class="line"><a name="l00478"></a><span class="lineno"> 478</span>&#160;</div>
<div class="line"><a name="l00479"></a><span class="lineno"><a class="code" href="class_x_b_o_x_r_e_c_v.html#a54490f57e16eaee6689ca92351958017"> 479</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_x_b_o_x_r_e_c_v.html#a54490f57e16eaee6689ca92351958017">XBOXRECV::setLedBlink</a>(uint8_t controller, <a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6">LED</a> led) {</div>
<div class="line"><a name="l00480"></a><span class="lineno"> 480</span>&#160; <a class="code" href="class_x_b_o_x_r_e_c_v.html#a354ede498c38b95a60c1b27deb01e47d">setLedRaw</a>(controller, pgm_read_byte(&amp;<a class="code" href="xbox_enums_8h.html#a867f3bf7a14d4647290f1ac7f76b23ee">XBOXLEDS</a>[(uint8_t)led]));</div>
<div class="line"><a name="l00481"></a><span class="lineno"> 481</span>&#160;}</div>
<div class="line"><a name="l00482"></a><span class="lineno"> 482</span>&#160;</div>
<div class="line"><a name="l00483"></a><span class="lineno"><a class="code" href="class_x_b_o_x_r_e_c_v.html#ace7deafed6fa6991d38417b41a490c57"> 483</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_x_b_o_x_r_e_c_v.html#ace7deafed6fa6991d38417b41a490c57">XBOXRECV::setLedMode</a>(uint8_t controller, <a class="code" href="xbox_enums_8h.html#a57effb96f46e458675a2653d4c543ca2">LEDMode</a> ledMode) { <span class="comment">// This function is used to do some speciel LED stuff the controller supports</span></div>
<div class="line"><a name="l00484"></a><span class="lineno"> 484</span>&#160; <a class="code" href="class_x_b_o_x_r_e_c_v.html#a354ede498c38b95a60c1b27deb01e47d">setLedRaw</a>(controller, (uint8_t)ledMode);</div>
<div class="line"><a name="l00485"></a><span class="lineno"> 485</span>&#160;}</div>
<div class="line"><a name="l00486"></a><span class="lineno"> 486</span>&#160;</div>
<div class="line"><a name="l00487"></a><span class="lineno"> 487</span>&#160;<span class="comment">/* PC runs this at interval of approx 2 seconds</span></div>
<div class="line"><a name="l00488"></a><span class="lineno"> 488</span>&#160;<span class="comment">Thanks to BusHound from Perisoft.net for the Windows USB Analysis output</span></div>
<div class="line"><a name="l00489"></a><span class="lineno"> 489</span>&#160;<span class="comment">Found by timstamp.co.uk</span></div>
<div class="line"><a name="l00490"></a><span class="lineno"> 490</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00491"></a><span class="lineno"> 491</span>&#160;<span class="keywordtype">void</span> XBOXRECV::checkStatus() {</div>
<div class="line"><a name="l00492"></a><span class="lineno"> 492</span>&#160; <span class="keywordflow">if</span> (!bPollEnable)</div>
<div class="line"><a name="l00493"></a><span class="lineno"> 493</span>&#160; <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00494"></a><span class="lineno"> 494</span>&#160; <span class="comment">// Get controller info</span></div>
<div class="line"><a name="l00495"></a><span class="lineno"> 495</span>&#160; writeBuf[0] = 0x08;</div>
<div class="line"><a name="l00496"></a><span class="lineno"> 496</span>&#160; writeBuf[1] = 0x00;</div>
<div class="line"><a name="l00497"></a><span class="lineno"> 497</span>&#160; writeBuf[2] = 0x0f;</div>
<div class="line"><a name="l00498"></a><span class="lineno"> 498</span>&#160; writeBuf[3] = 0xc0;</div>
<div class="line"><a name="l00499"></a><span class="lineno"> 499</span>&#160; <span class="keywordflow">for</span> (uint8_t i = 0; i &lt; 4; i++) {</div>
<div class="line"><a name="l00500"></a><span class="lineno"> 500</span>&#160; XboxCommand(i, writeBuf, 4);</div>
<div class="line"><a name="l00501"></a><span class="lineno"> 501</span>&#160; }</div>
<div class="line"><a name="l00502"></a><span class="lineno"> 502</span>&#160; <span class="comment">// Get battery status</span></div>
<div class="line"><a name="l00503"></a><span class="lineno"> 503</span>&#160; writeBuf[0] = 0x00;</div>
<div class="line"><a name="l00504"></a><span class="lineno"> 504</span>&#160; writeBuf[1] = 0x00;</div>
<div class="line"><a name="l00505"></a><span class="lineno"> 505</span>&#160; writeBuf[2] = 0x00;</div>
<div class="line"><a name="l00506"></a><span class="lineno"> 506</span>&#160; writeBuf[3] = 0x40;</div>
<div class="line"><a name="l00507"></a><span class="lineno"> 507</span>&#160; <span class="keywordflow">for</span> (uint8_t i = 0; i &lt; 4; i++) {</div>
<div class="line"><a name="l00508"></a><span class="lineno"> 508</span>&#160; <span class="keywordflow">if</span> (<a class="code" href="class_x_b_o_x_r_e_c_v.html#ac07faada38e159f1e7831d90863ebe3a">Xbox360Connected</a>[i])</div>
<div class="line"><a name="l00509"></a><span class="lineno"> 509</span>&#160; XboxCommand(i, writeBuf, 4);</div>
<div class="line"><a name="l00510"></a><span class="lineno"> 510</span>&#160; }</div>
<div class="line"><a name="l00511"></a><span class="lineno"> 511</span>&#160;}</div>
<div class="line"><a name="l00512"></a><span class="lineno"> 512</span>&#160;</div>
<div class="line"><a name="l00513"></a><span class="lineno"><a class="code" href="class_x_b_o_x_r_e_c_v.html#afd1f58838a9aea8e742103fddbe8fe69"> 513</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_x_b_o_x_r_e_c_v.html#afd1f58838a9aea8e742103fddbe8fe69">XBOXRECV::setRumbleOn</a>(uint8_t controller, uint8_t lValue, uint8_t rValue) {</div>
<div class="line"><a name="l00514"></a><span class="lineno"> 514</span>&#160; writeBuf[0] = 0x00;</div>
<div class="line"><a name="l00515"></a><span class="lineno"> 515</span>&#160; writeBuf[1] = 0x01;</div>
<div class="line"><a name="l00516"></a><span class="lineno"> 516</span>&#160; writeBuf[2] = 0x0f;</div>
<div class="line"><a name="l00517"></a><span class="lineno"> 517</span>&#160; writeBuf[3] = 0xc0;</div>
<div class="line"><a name="l00518"></a><span class="lineno"> 518</span>&#160; writeBuf[4] = 0x00;</div>
<div class="line"><a name="l00519"></a><span class="lineno"> 519</span>&#160; writeBuf[5] = lValue; <span class="comment">// big weight</span></div>
<div class="line"><a name="l00520"></a><span class="lineno"> 520</span>&#160; writeBuf[6] = rValue; <span class="comment">// small weight</span></div>
<div class="line"><a name="l00521"></a><span class="lineno"> 521</span>&#160;</div>
<div class="line"><a name="l00522"></a><span class="lineno"> 522</span>&#160; XboxCommand(controller, writeBuf, 7);</div>
<div class="line"><a name="l00523"></a><span class="lineno"> 523</span>&#160;}</div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>

View file

@ -100,7 +100,7 @@ Include dependency graph for XBOXRECV.h:</div>
<div class="dyncontent">
<div class="center"><img src="_x_b_o_x_r_e_c_v_8h__incl.png" border="0" usemap="#_x_b_o_x_r_e_c_v_8h" alt=""/></div>
<map name="_x_b_o_x_r_e_c_v_8h" id="_x_b_o_x_r_e_c_v_8h">
<area shape="rect" id="node3" href="_usb_8h.html" title="Usb.h" alt="" coords="397,75,440,96"/><area shape="rect" id="node17" href="xbox_enums_8h.html" title="xboxEnums.h" alt="" coords="798,75,868,96"/><area shape="rect" id="node6" href="avrpins_8h.html" title="avrpins.h" alt="" coords="528,213,582,235"/><area shape="rect" id="node8" href="max3421e_8h.html" title="max3421e.h" alt="" coords="146,213,213,235"/><area shape="rect" id="node9" href="usbhost_8h.html" title="usbhost.h" alt="" coords="212,144,269,165"/><area shape="rect" id="node10" href="usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="237,213,296,235"/><area shape="rect" id="node11" href="address_8h.html" title="address.h" alt="" coords="79,144,136,165"/><area shape="rect" id="node13" href="printhex_8h.html" title="printhex.h" alt="" coords="608,213,665,235"/><area shape="rect" id="node14" href="hexdump_8h.html" title="hexdump.h" alt="" coords="430,144,492,165"/><area shape="rect" id="node16" href="message_8h.html" title="message.h" alt="" coords="345,144,406,165"/><area shape="rect" id="node18" href="controller_enums_8h.html" title="controllerEnums.h" alt="" coords="794,144,880,165"/></map>
<area shape="rect" id="node3" href="_usb_8h.html" title="Usb.h" alt="" coords="449,75,492,96"/><area shape="rect" id="node17" href="xbox_enums_8h.html" title="xboxEnums.h" alt="" coords="653,75,723,96"/><area shape="rect" id="node6" href="avrpins_8h.html" title="avrpins.h" alt="" coords="474,213,528,235"/><area shape="rect" id="node8" href="max3421e_8h.html" title="max3421e.h" alt="" coords="553,213,620,235"/><area shape="rect" id="node9" href="usbhost_8h.html" title="usbhost.h" alt="" coords="442,144,499,165"/><area shape="rect" id="node10" href="usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="391,213,449,235"/><area shape="rect" id="node11" href="address_8h.html" title="address.h" alt="" coords="701,144,757,165"/><area shape="rect" id="node13" href="message_8h.html" title="message.h" alt="" coords="204,144,265,165"/><area shape="rect" id="node15" href="printhex_8h.html" title="printhex.h" alt="" coords="71,213,128,235"/><area shape="rect" id="node16" href="hexdump_8h.html" title="hexdump.h" alt="" coords="204,213,265,235"/><area shape="rect" id="node18" href="controller_enums_8h.html" title="controllerEnums.h" alt="" coords="782,144,868,165"/></map>
</div>
</div><div class="textblock"><div class="dynheader">
This graph shows which files directly or indirectly include this file:</div>

View file

@ -1,13 +1,13 @@
<map id="XBOXRECV.h" name="XBOXRECV.h">
<area shape="rect" id="node3" href="$_usb_8h.html" title="Usb.h" alt="" coords="397,75,440,96"/>
<area shape="rect" id="node17" href="$xbox_enums_8h.html" title="xboxEnums.h" alt="" coords="798,75,868,96"/>
<area shape="rect" id="node6" href="$avrpins_8h.html" title="avrpins.h" alt="" coords="528,213,582,235"/>
<area shape="rect" id="node8" href="$max3421e_8h.html" title="max3421e.h" alt="" coords="146,213,213,235"/>
<area shape="rect" id="node9" href="$usbhost_8h.html" title="usbhost.h" alt="" coords="212,144,269,165"/>
<area shape="rect" id="node10" href="$usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="237,213,296,235"/>
<area shape="rect" id="node11" href="$address_8h.html" title="address.h" alt="" coords="79,144,136,165"/>
<area shape="rect" id="node13" href="$printhex_8h.html" title="printhex.h" alt="" coords="608,213,665,235"/>
<area shape="rect" id="node14" href="$hexdump_8h.html" title="hexdump.h" alt="" coords="430,144,492,165"/>
<area shape="rect" id="node16" href="$message_8h.html" title="message.h" alt="" coords="345,144,406,165"/>
<area shape="rect" id="node18" href="$controller_enums_8h.html" title="controllerEnums.h" alt="" coords="794,144,880,165"/>
<area shape="rect" id="node3" href="$_usb_8h.html" title="Usb.h" alt="" coords="449,75,492,96"/>
<area shape="rect" id="node17" href="$xbox_enums_8h.html" title="xboxEnums.h" alt="" coords="653,75,723,96"/>
<area shape="rect" id="node6" href="$avrpins_8h.html" title="avrpins.h" alt="" coords="474,213,528,235"/>
<area shape="rect" id="node8" href="$max3421e_8h.html" title="max3421e.h" alt="" coords="553,213,620,235"/>
<area shape="rect" id="node9" href="$usbhost_8h.html" title="usbhost.h" alt="" coords="442,144,499,165"/>
<area shape="rect" id="node10" href="$usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="391,213,449,235"/>
<area shape="rect" id="node11" href="$address_8h.html" title="address.h" alt="" coords="701,144,757,165"/>
<area shape="rect" id="node13" href="$message_8h.html" title="message.h" alt="" coords="204,144,265,165"/>
<area shape="rect" id="node15" href="$printhex_8h.html" title="printhex.h" alt="" coords="71,213,128,235"/>
<area shape="rect" id="node16" href="$hexdump_8h.html" title="hexdump.h" alt="" coords="204,213,265,235"/>
<area shape="rect" id="node18" href="$controller_enums_8h.html" title="controllerEnums.h" alt="" coords="782,144,868,165"/>
</map>

View file

@ -1 +1 @@
b706bf6b82e6c4c084191859cdb64634
4ba38c24b020d5cb04bd0339f7b48ca5

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 51 KiB

View file

@ -153,56 +153,72 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>&#160; <span class="keyword">virtual</span> uint8_t <a class="code" href="class_x_b_o_x_r_e_c_v.html#a07de216bf16a83501d74463c00bf1fc8">Init</a>(uint8_t parent, uint8_t port, <span class="keywordtype">bool</span> lowspeed);</div>
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span>&#160; <span class="keyword">virtual</span> uint8_t <a class="code" href="class_x_b_o_x_r_e_c_v.html#ad0e6b53a818516b7d6af0beaa8cebc7a">Release</a>();</div>
<div class="line"><a name="l00089"></a><span class="lineno"> 89</span>&#160; <span class="keyword">virtual</span> uint8_t <a class="code" href="class_x_b_o_x_r_e_c_v.html#aafe1688ba3dc9b9ac425ebbbf001a1cc">Poll</a>();</div>
<div class="line"><a name="l00094"></a><span class="lineno"><a class="code" href="class_x_b_o_x_r_e_c_v.html#a2d58b0a20eb804d853713ade83d01631"> 94</a></span>&#160; <span class="keyword">virtual</span> uint8_t <a class="code" href="class_x_b_o_x_r_e_c_v.html#a2d58b0a20eb804d853713ade83d01631">GetAddress</a>() { <span class="keywordflow">return</span> <a class="code" href="class_x_b_o_x_r_e_c_v.html#a1d4bdb1b740c87fd51aca3969e67c730">bAddress</a>; };</div>
<div class="line"><a name="l00099"></a><span class="lineno"><a class="code" href="class_x_b_o_x_r_e_c_v.html#a570568108edafee8d060aad8fe40db57"> 99</a></span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="class_x_b_o_x_r_e_c_v.html#a570568108edafee8d060aad8fe40db57">isReady</a>() { <span class="keywordflow">return</span> bPollEnable; };</div>
<div class="line"><a name="l00115"></a><span class="lineno"> 115</span>&#160; uint8_t <a class="code" href="class_x_b_o_x_r_e_c_v.html#ad33cd16d10e438bb8051f7fa6052f6c9">getButtonPress</a>(uint8_t controller, <a class="code" href="controller_enums_8h.html#a03bfec859eac87be20f8952c1eb89de0">Button</a> b);</div>
<div class="line"><a name="l00116"></a><span class="lineno"> 116</span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_x_b_o_x_r_e_c_v.html#a5e9a59d90ec1941c7152cdd438c284d0">getButtonClick</a>(uint8_t controller, <a class="code" href="controller_enums_8h.html#a03bfec859eac87be20f8952c1eb89de0">Button</a> b);</div>
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span>&#160; int16_t <a class="code" href="class_x_b_o_x_r_e_c_v.html#a1b277f0980bd53f30283d4af9d9b8926">getAnalogHat</a>(uint8_t controller, <a class="code" href="controller_enums_8h.html#aaaabdefc068fd57ec2bef2b62ea4ba92">AnalogHat</a> a);</div>
<div class="line"><a name="l00131"></a><span class="lineno"><a class="code" href="class_x_b_o_x_r_e_c_v.html#a65f4ca4dc0156418fbac30060c06730d"> 131</a></span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_x_b_o_x_r_e_c_v.html#a65f4ca4dc0156418fbac30060c06730d">setAllOff</a>(uint8_t controller) { <a class="code" href="class_x_b_o_x_r_e_c_v.html#afd1f58838a9aea8e742103fddbe8fe69">setRumbleOn</a>(controller,0,0); <a class="code" href="class_x_b_o_x_r_e_c_v.html#abedb93ccf24954f652d8f1cbc138924f">setLedOff</a>(controller); };</div>
<div class="line"><a name="l00136"></a><span class="lineno"><a class="code" href="class_x_b_o_x_r_e_c_v.html#aa75c1d01b94b7c50fb518bc0f9228782"> 136</a></span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_x_b_o_x_r_e_c_v.html#aa75c1d01b94b7c50fb518bc0f9228782">setRumbleOff</a>(uint8_t controller) { <a class="code" href="class_x_b_o_x_r_e_c_v.html#afd1f58838a9aea8e742103fddbe8fe69">setRumbleOn</a>(controller,0,0); };</div>
<div class="line"><a name="l00143"></a><span class="lineno"> 143</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_x_b_o_x_r_e_c_v.html#afd1f58838a9aea8e742103fddbe8fe69">setRumbleOn</a>(uint8_t controller, uint8_t lValue, uint8_t rValue);</div>
<div class="line"><a name="l00151"></a><span class="lineno"> 151</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_x_b_o_x_r_e_c_v.html#a354ede498c38b95a60c1b27deb01e47d">setLedRaw</a>(uint8_t controller, uint8_t value);</div>
<div class="line"><a name="l00156"></a><span class="lineno"><a class="code" href="class_x_b_o_x_r_e_c_v.html#abedb93ccf24954f652d8f1cbc138924f"> 156</a></span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_x_b_o_x_r_e_c_v.html#abedb93ccf24954f652d8f1cbc138924f">setLedOff</a>(uint8_t controller) { <a class="code" href="class_x_b_o_x_r_e_c_v.html#a354ede498c38b95a60c1b27deb01e47d">setLedRaw</a>(controller,0); };</div>
<div class="line"><a name="l00162"></a><span class="lineno"> 162</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_x_b_o_x_r_e_c_v.html#a9e17aa44f2946e710fb9343f27290c85">setLedOn</a>(uint8_t controller, <a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6">LED</a> l);</div>
<div class="line"><a name="l00168"></a><span class="lineno"> 168</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_x_b_o_x_r_e_c_v.html#a54490f57e16eaee6689ca92351958017">setLedBlink</a>(uint8_t controller, <a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6">LED</a> l);</div>
<div class="line"><a name="l00174"></a><span class="lineno"> 174</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_x_b_o_x_r_e_c_v.html#ace7deafed6fa6991d38417b41a490c57">setLedMode</a>(uint8_t controller, <a class="code" href="xbox_enums_8h.html#a57effb96f46e458675a2653d4c543ca2">LEDMode</a> lm);</div>
<div class="line"><a name="l00180"></a><span class="lineno"> 180</span>&#160; uint8_t <a class="code" href="class_x_b_o_x_r_e_c_v.html#a671caa6d19debca8ff14dc82ac3ed005">getBatteryLevel</a>(uint8_t controller);</div>
<div class="line"><a name="l00186"></a><span class="lineno"> 186</span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_x_b_o_x_r_e_c_v.html#aa2263642c0d422c6d21fed3933d6044c">buttonChanged</a>(uint8_t controller);</div>
<div class="line"><a name="l00190"></a><span class="lineno"><a class="code" href="class_x_b_o_x_r_e_c_v.html#a5ff16bba78f05af3023f395a342b625c"> 190</a></span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_x_b_o_x_r_e_c_v.html#a5ff16bba78f05af3023f395a342b625c">XboxReceiverConnected</a>;</div>
<div class="line"><a name="l00192"></a><span class="lineno"><a class="code" href="class_x_b_o_x_r_e_c_v.html#ac07faada38e159f1e7831d90863ebe3a"> 192</a></span>&#160; uint8_t <a class="code" href="class_x_b_o_x_r_e_c_v.html#ac07faada38e159f1e7831d90863ebe3a">Xbox360Connected</a>[4];</div>
<div class="line"><a name="l00193"></a><span class="lineno"> 193</span>&#160; </div>
<div class="line"><a name="l00194"></a><span class="lineno"> 194</span>&#160;<span class="keyword">protected</span>: </div>
<div class="line"><a name="l00196"></a><span class="lineno"><a class="code" href="class_x_b_o_x_r_e_c_v.html#a53047c86c8c2f625916af62238d50fc8"> 196</a></span>&#160; <a class="code" href="class_u_s_b.html">USB</a> *<a class="code" href="class_x_b_o_x_r_e_c_v.html#a53047c86c8c2f625916af62238d50fc8">pUsb</a>;</div>
<div class="line"><a name="l00198"></a><span class="lineno"><a class="code" href="class_x_b_o_x_r_e_c_v.html#a1d4bdb1b740c87fd51aca3969e67c730"> 198</a></span>&#160; uint8_t <a class="code" href="class_x_b_o_x_r_e_c_v.html#a1d4bdb1b740c87fd51aca3969e67c730">bAddress</a>;</div>
<div class="line"><a name="l00200"></a><span class="lineno"><a class="code" href="class_x_b_o_x_r_e_c_v.html#af97c8d0efc945fa4ba1d120c8a5a9cbb"> 200</a></span>&#160; <a class="code" href="struct_ep_info.html">EpInfo</a> <a class="code" href="class_x_b_o_x_r_e_c_v.html#af97c8d0efc945fa4ba1d120c8a5a9cbb">epInfo</a>[<a class="code" href="_x_b_o_x_r_e_c_v_8h.html#af35f872fc33e690571eb99de648e8e96">XBOX_MAX_ENDPOINTS</a>];</div>
<div class="line"><a name="l00201"></a><span class="lineno"> 201</span>&#160; </div>
<div class="line"><a name="l00202"></a><span class="lineno"> 202</span>&#160;<span class="keyword">private</span>: </div>
<div class="line"><a name="l00203"></a><span class="lineno"> 203</span>&#160; <span class="keywordtype">bool</span> bPollEnable; </div>
<div class="line"><a name="l00204"></a><span class="lineno"> 204</span>&#160;</div>
<div class="line"><a name="l00205"></a><span class="lineno"> 205</span>&#160; <span class="comment">/* Variables to store the buttons */</span></div>
<div class="line"><a name="l00206"></a><span class="lineno"> 206</span>&#160; uint32_t ButtonState[4];</div>
<div class="line"><a name="l00207"></a><span class="lineno"> 207</span>&#160; uint32_t OldButtonState[4];</div>
<div class="line"><a name="l00208"></a><span class="lineno"> 208</span>&#160; uint16_t ButtonClickState[4];</div>
<div class="line"><a name="l00209"></a><span class="lineno"> 209</span>&#160; int16_t hatValue[4][4];</div>
<div class="line"><a name="l00210"></a><span class="lineno"> 210</span>&#160; uint16_t controllerStatus[4];</div>
<div class="line"><a name="l00211"></a><span class="lineno"> 211</span>&#160; <span class="keywordtype">bool</span> buttonStateChanged[4]; <span class="comment">// True if a button has changed</span></div>
<div class="line"><a name="l00212"></a><span class="lineno"> 212</span>&#160; </div>
<div class="line"><a name="l00213"></a><span class="lineno"> 213</span>&#160; <span class="keywordtype">bool</span> L2Clicked[4]; <span class="comment">// These buttons are analog, so we use we use these bools to check if they where clicked or not</span></div>
<div class="line"><a name="l00214"></a><span class="lineno"> 214</span>&#160; <span class="keywordtype">bool</span> R2Clicked[4];</div>
<div class="line"><a name="l00215"></a><span class="lineno"> 215</span>&#160;</div>
<div class="line"><a name="l00216"></a><span class="lineno"> 216</span>&#160; <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> timer; <span class="comment">// Timing for checkStatus() signals</span></div>
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span>&#160;</div>
<div class="line"><a name="l00095"></a><span class="lineno"><a class="code" href="class_x_b_o_x_r_e_c_v.html#a2d58b0a20eb804d853713ade83d01631"> 95</a></span>&#160; <span class="keyword">virtual</span> uint8_t <a class="code" href="class_x_b_o_x_r_e_c_v.html#a2d58b0a20eb804d853713ade83d01631">GetAddress</a>() {</div>
<div class="line"><a name="l00096"></a><span class="lineno"> 96</span>&#160; <span class="keywordflow">return</span> <a class="code" href="class_x_b_o_x_r_e_c_v.html#a1d4bdb1b740c87fd51aca3969e67c730">bAddress</a>;</div>
<div class="line"><a name="l00097"></a><span class="lineno"> 97</span>&#160; };</div>
<div class="line"><a name="l00098"></a><span class="lineno"> 98</span>&#160;</div>
<div class="line"><a name="l00103"></a><span class="lineno"><a class="code" href="class_x_b_o_x_r_e_c_v.html#a570568108edafee8d060aad8fe40db57"> 103</a></span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="class_x_b_o_x_r_e_c_v.html#a570568108edafee8d060aad8fe40db57">isReady</a>() {</div>
<div class="line"><a name="l00104"></a><span class="lineno"> 104</span>&#160; <span class="keywordflow">return</span> bPollEnable;</div>
<div class="line"><a name="l00105"></a><span class="lineno"> 105</span>&#160; };</div>
<div class="line"><a name="l00121"></a><span class="lineno"> 121</span>&#160; uint8_t <a class="code" href="class_x_b_o_x_r_e_c_v.html#ad33cd16d10e438bb8051f7fa6052f6c9">getButtonPress</a>(uint8_t controller, <a class="code" href="controller_enums_8h.html#a03bfec859eac87be20f8952c1eb89de0">Button</a> b);</div>
<div class="line"><a name="l00122"></a><span class="lineno"> 122</span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_x_b_o_x_r_e_c_v.html#a5e9a59d90ec1941c7152cdd438c284d0">getButtonClick</a>(uint8_t controller, <a class="code" href="controller_enums_8h.html#a03bfec859eac87be20f8952c1eb89de0">Button</a> b);</div>
<div class="line"><a name="l00132"></a><span class="lineno"> 132</span>&#160; int16_t <a class="code" href="class_x_b_o_x_r_e_c_v.html#a1b277f0980bd53f30283d4af9d9b8926">getAnalogHat</a>(uint8_t controller, <a class="code" href="controller_enums_8h.html#aaaabdefc068fd57ec2bef2b62ea4ba92">AnalogHat</a> a);</div>
<div class="line"><a name="l00133"></a><span class="lineno"> 133</span>&#160;</div>
<div class="line"><a name="l00138"></a><span class="lineno"><a class="code" href="class_x_b_o_x_r_e_c_v.html#a65f4ca4dc0156418fbac30060c06730d"> 138</a></span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_x_b_o_x_r_e_c_v.html#a65f4ca4dc0156418fbac30060c06730d">setAllOff</a>(uint8_t controller) {</div>
<div class="line"><a name="l00139"></a><span class="lineno"> 139</span>&#160; <a class="code" href="class_x_b_o_x_r_e_c_v.html#afd1f58838a9aea8e742103fddbe8fe69">setRumbleOn</a>(controller, 0, 0);</div>
<div class="line"><a name="l00140"></a><span class="lineno"> 140</span>&#160; <a class="code" href="class_x_b_o_x_r_e_c_v.html#abedb93ccf24954f652d8f1cbc138924f">setLedOff</a>(controller);</div>
<div class="line"><a name="l00141"></a><span class="lineno"> 141</span>&#160; };</div>
<div class="line"><a name="l00142"></a><span class="lineno"> 142</span>&#160;</div>
<div class="line"><a name="l00147"></a><span class="lineno"><a class="code" href="class_x_b_o_x_r_e_c_v.html#aa75c1d01b94b7c50fb518bc0f9228782"> 147</a></span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_x_b_o_x_r_e_c_v.html#aa75c1d01b94b7c50fb518bc0f9228782">setRumbleOff</a>(uint8_t controller) {</div>
<div class="line"><a name="l00148"></a><span class="lineno"> 148</span>&#160; <a class="code" href="class_x_b_o_x_r_e_c_v.html#afd1f58838a9aea8e742103fddbe8fe69">setRumbleOn</a>(controller, 0, 0);</div>
<div class="line"><a name="l00149"></a><span class="lineno"> 149</span>&#160; };</div>
<div class="line"><a name="l00156"></a><span class="lineno"> 156</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_x_b_o_x_r_e_c_v.html#afd1f58838a9aea8e742103fddbe8fe69">setRumbleOn</a>(uint8_t controller, uint8_t lValue, uint8_t rValue);</div>
<div class="line"><a name="l00164"></a><span class="lineno"> 164</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_x_b_o_x_r_e_c_v.html#a354ede498c38b95a60c1b27deb01e47d">setLedRaw</a>(uint8_t controller, uint8_t value);</div>
<div class="line"><a name="l00165"></a><span class="lineno"> 165</span>&#160;</div>
<div class="line"><a name="l00170"></a><span class="lineno"><a class="code" href="class_x_b_o_x_r_e_c_v.html#abedb93ccf24954f652d8f1cbc138924f"> 170</a></span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_x_b_o_x_r_e_c_v.html#abedb93ccf24954f652d8f1cbc138924f">setLedOff</a>(uint8_t controller) {</div>
<div class="line"><a name="l00171"></a><span class="lineno"> 171</span>&#160; <a class="code" href="class_x_b_o_x_r_e_c_v.html#a354ede498c38b95a60c1b27deb01e47d">setLedRaw</a>(controller, 0);</div>
<div class="line"><a name="l00172"></a><span class="lineno"> 172</span>&#160; };</div>
<div class="line"><a name="l00178"></a><span class="lineno"> 178</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_x_b_o_x_r_e_c_v.html#a9e17aa44f2946e710fb9343f27290c85">setLedOn</a>(uint8_t controller, <a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6">LED</a> l);</div>
<div class="line"><a name="l00184"></a><span class="lineno"> 184</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_x_b_o_x_r_e_c_v.html#a54490f57e16eaee6689ca92351958017">setLedBlink</a>(uint8_t controller, <a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6">LED</a> l);</div>
<div class="line"><a name="l00190"></a><span class="lineno"> 190</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_x_b_o_x_r_e_c_v.html#ace7deafed6fa6991d38417b41a490c57">setLedMode</a>(uint8_t controller, <a class="code" href="xbox_enums_8h.html#a57effb96f46e458675a2653d4c543ca2">LEDMode</a> lm);</div>
<div class="line"><a name="l00196"></a><span class="lineno"> 196</span>&#160; uint8_t <a class="code" href="class_x_b_o_x_r_e_c_v.html#a671caa6d19debca8ff14dc82ac3ed005">getBatteryLevel</a>(uint8_t controller);</div>
<div class="line"><a name="l00202"></a><span class="lineno"> 202</span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_x_b_o_x_r_e_c_v.html#aa2263642c0d422c6d21fed3933d6044c">buttonChanged</a>(uint8_t controller);</div>
<div class="line"><a name="l00206"></a><span class="lineno"><a class="code" href="class_x_b_o_x_r_e_c_v.html#a5ff16bba78f05af3023f395a342b625c"> 206</a></span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_x_b_o_x_r_e_c_v.html#a5ff16bba78f05af3023f395a342b625c">XboxReceiverConnected</a>;</div>
<div class="line"><a name="l00208"></a><span class="lineno"><a class="code" href="class_x_b_o_x_r_e_c_v.html#ac07faada38e159f1e7831d90863ebe3a"> 208</a></span>&#160; uint8_t <a class="code" href="class_x_b_o_x_r_e_c_v.html#ac07faada38e159f1e7831d90863ebe3a">Xbox360Connected</a>[4];</div>
<div class="line"><a name="l00209"></a><span class="lineno"> 209</span>&#160;</div>
<div class="line"><a name="l00210"></a><span class="lineno"> 210</span>&#160;<span class="keyword">protected</span>:</div>
<div class="line"><a name="l00212"></a><span class="lineno"><a class="code" href="class_x_b_o_x_r_e_c_v.html#a53047c86c8c2f625916af62238d50fc8"> 212</a></span>&#160; <a class="code" href="class_u_s_b.html">USB</a> *<a class="code" href="class_x_b_o_x_r_e_c_v.html#a53047c86c8c2f625916af62238d50fc8">pUsb</a>;</div>
<div class="line"><a name="l00214"></a><span class="lineno"><a class="code" href="class_x_b_o_x_r_e_c_v.html#a1d4bdb1b740c87fd51aca3969e67c730"> 214</a></span>&#160; uint8_t <a class="code" href="class_x_b_o_x_r_e_c_v.html#a1d4bdb1b740c87fd51aca3969e67c730">bAddress</a>;</div>
<div class="line"><a name="l00216"></a><span class="lineno"><a class="code" href="class_x_b_o_x_r_e_c_v.html#af97c8d0efc945fa4ba1d120c8a5a9cbb"> 216</a></span>&#160; <a class="code" href="struct_ep_info.html">EpInfo</a> <a class="code" href="class_x_b_o_x_r_e_c_v.html#af97c8d0efc945fa4ba1d120c8a5a9cbb">epInfo</a>[<a class="code" href="_x_b_o_x_r_e_c_v_8h.html#af35f872fc33e690571eb99de648e8e96">XBOX_MAX_ENDPOINTS</a>];</div>
<div class="line"><a name="l00217"></a><span class="lineno"> 217</span>&#160;</div>
<div class="line"><a name="l00218"></a><span class="lineno"> 218</span>&#160; uint8_t readBuf[<a class="code" href="_x_b_o_x_r_e_c_v_8h.html#abcb805b13bfd36145e252b0633bbcfc0">EP_MAXPKTSIZE</a>]; <span class="comment">// General purpose buffer for input data</span></div>
<div class="line"><a name="l00219"></a><span class="lineno"> 219</span>&#160; uint8_t writeBuf[<a class="code" href="_x_b_o_x_r_e_c_v_8h.html#abcb805b13bfd36145e252b0633bbcfc0">EP_MAXPKTSIZE</a>]; <span class="comment">// General purpose buffer for output data</span></div>
<div class="line"><a name="l00218"></a><span class="lineno"> 218</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00219"></a><span class="lineno"> 219</span>&#160; <span class="keywordtype">bool</span> bPollEnable;</div>
<div class="line"><a name="l00220"></a><span class="lineno"> 220</span>&#160;</div>
<div class="line"><a name="l00221"></a><span class="lineno"> 221</span>&#160; <span class="keywordtype">void</span> readReport(uint8_t controller); <span class="comment">// read incoming data</span></div>
<div class="line"><a name="l00222"></a><span class="lineno"> 222</span>&#160; <span class="keywordtype">void</span> printReport(uint8_t controller, uint8_t nBytes); <span class="comment">// print incoming date - Uncomment for debugging</span></div>
<div class="line"><a name="l00223"></a><span class="lineno"> 223</span>&#160;</div>
<div class="line"><a name="l00224"></a><span class="lineno"> 224</span>&#160; <span class="comment">/* Private commands */</span></div>
<div class="line"><a name="l00225"></a><span class="lineno"> 225</span>&#160; <span class="keywordtype">void</span> XboxCommand(uint8_t controller, uint8_t* data, uint16_t nbytes);</div>
<div class="line"><a name="l00226"></a><span class="lineno"> 226</span>&#160; <span class="keywordtype">void</span> checkStatus();</div>
<div class="line"><a name="l00227"></a><span class="lineno"> 227</span>&#160;};</div>
<div class="line"><a name="l00228"></a><span class="lineno"> 228</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00221"></a><span class="lineno"> 221</span>&#160; <span class="comment">/* Variables to store the buttons */</span></div>
<div class="line"><a name="l00222"></a><span class="lineno"> 222</span>&#160; uint32_t ButtonState[4];</div>
<div class="line"><a name="l00223"></a><span class="lineno"> 223</span>&#160; uint32_t OldButtonState[4];</div>
<div class="line"><a name="l00224"></a><span class="lineno"> 224</span>&#160; uint16_t ButtonClickState[4];</div>
<div class="line"><a name="l00225"></a><span class="lineno"> 225</span>&#160; int16_t hatValue[4][4];</div>
<div class="line"><a name="l00226"></a><span class="lineno"> 226</span>&#160; uint16_t controllerStatus[4];</div>
<div class="line"><a name="l00227"></a><span class="lineno"> 227</span>&#160; <span class="keywordtype">bool</span> buttonStateChanged[4]; <span class="comment">// True if a button has changed</span></div>
<div class="line"><a name="l00228"></a><span class="lineno"> 228</span>&#160;</div>
<div class="line"><a name="l00229"></a><span class="lineno"> 229</span>&#160; <span class="keywordtype">bool</span> L2Clicked[4]; <span class="comment">// These buttons are analog, so we use we use these bools to check if they where clicked or not</span></div>
<div class="line"><a name="l00230"></a><span class="lineno"> 230</span>&#160; <span class="keywordtype">bool</span> R2Clicked[4];</div>
<div class="line"><a name="l00231"></a><span class="lineno"> 231</span>&#160;</div>
<div class="line"><a name="l00232"></a><span class="lineno"> 232</span>&#160; <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> timer; <span class="comment">// Timing for checkStatus() signals</span></div>
<div class="line"><a name="l00233"></a><span class="lineno"> 233</span>&#160;</div>
<div class="line"><a name="l00234"></a><span class="lineno"> 234</span>&#160; uint8_t readBuf[<a class="code" href="_x_b_o_x_r_e_c_v_8h.html#abcb805b13bfd36145e252b0633bbcfc0">EP_MAXPKTSIZE</a>]; <span class="comment">// General purpose buffer for input data</span></div>
<div class="line"><a name="l00235"></a><span class="lineno"> 235</span>&#160; uint8_t writeBuf[<a class="code" href="_x_b_o_x_r_e_c_v_8h.html#abcb805b13bfd36145e252b0633bbcfc0">EP_MAXPKTSIZE</a>]; <span class="comment">// General purpose buffer for output data</span></div>
<div class="line"><a name="l00236"></a><span class="lineno"> 236</span>&#160;</div>
<div class="line"><a name="l00237"></a><span class="lineno"> 237</span>&#160; <span class="keywordtype">void</span> readReport(uint8_t controller); <span class="comment">// read incoming data</span></div>
<div class="line"><a name="l00238"></a><span class="lineno"> 238</span>&#160; <span class="keywordtype">void</span> printReport(uint8_t controller, uint8_t nBytes); <span class="comment">// print incoming date - Uncomment for debugging</span></div>
<div class="line"><a name="l00239"></a><span class="lineno"> 239</span>&#160;</div>
<div class="line"><a name="l00240"></a><span class="lineno"> 240</span>&#160; <span class="comment">/* Private commands */</span></div>
<div class="line"><a name="l00241"></a><span class="lineno"> 241</span>&#160; <span class="keywordtype">void</span> XboxCommand(uint8_t controller, uint8_t* data, uint16_t nbytes);</div>
<div class="line"><a name="l00242"></a><span class="lineno"> 242</span>&#160; <span class="keywordtype">void</span> checkStatus();</div>
<div class="line"><a name="l00243"></a><span class="lineno"> 243</span>&#160;};</div>
<div class="line"><a name="l00244"></a><span class="lineno"> 244</span>&#160;<span class="preprocessor">#endif</span></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>

View file

@ -97,7 +97,7 @@ Include dependency graph for XBOXUSB.cpp:</div>
<div class="dyncontent">
<div class="center"><img src="_x_b_o_x_u_s_b_8cpp__incl.png" border="0" usemap="#_x_b_o_x_u_s_b_8cpp" alt=""/></div>
<map name="_x_b_o_x_u_s_b_8cpp" id="_x_b_o_x_u_s_b_8cpp">
<area shape="rect" id="node2" href="_x_b_o_x_u_s_b_8h.html" title="XBOXUSB.h" alt="" coords="722,75,789,96"/><area shape="rect" id="node4" href="_usb_8h.html" title="Usb.h" alt="" coords="397,144,440,165"/><area shape="rect" id="node18" href="xbox_enums_8h.html" title="xboxEnums.h" alt="" coords="798,144,868,165"/><area shape="rect" id="node7" href="avrpins_8h.html" title="avrpins.h" alt="" coords="528,283,582,304"/><area shape="rect" id="node9" href="max3421e_8h.html" title="max3421e.h" alt="" coords="146,283,213,304"/><area shape="rect" id="node10" href="usbhost_8h.html" title="usbhost.h" alt="" coords="212,213,269,235"/><area shape="rect" id="node11" href="usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="237,283,296,304"/><area shape="rect" id="node12" href="address_8h.html" title="address.h" alt="" coords="79,213,136,235"/><area shape="rect" id="node14" href="printhex_8h.html" title="printhex.h" alt="" coords="608,283,665,304"/><area shape="rect" id="node15" href="hexdump_8h.html" title="hexdump.h" alt="" coords="430,213,492,235"/><area shape="rect" id="node17" href="message_8h.html" title="message.h" alt="" coords="345,213,406,235"/><area shape="rect" id="node19" href="controller_enums_8h.html" title="controllerEnums.h" alt="" coords="794,213,880,235"/></map>
<area shape="rect" id="node2" href="_x_b_o_x_u_s_b_8h.html" title="XBOXUSB.h" alt="" coords="437,75,504,96"/><area shape="rect" id="node4" href="_usb_8h.html" title="Usb.h" alt="" coords="449,144,492,165"/><area shape="rect" id="node18" href="xbox_enums_8h.html" title="xboxEnums.h" alt="" coords="653,144,723,165"/><area shape="rect" id="node7" href="avrpins_8h.html" title="avrpins.h" alt="" coords="474,283,528,304"/><area shape="rect" id="node9" href="max3421e_8h.html" title="max3421e.h" alt="" coords="553,283,620,304"/><area shape="rect" id="node10" href="usbhost_8h.html" title="usbhost.h" alt="" coords="442,213,499,235"/><area shape="rect" id="node11" href="usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="391,283,449,304"/><area shape="rect" id="node12" href="address_8h.html" title="address.h" alt="" coords="701,213,757,235"/><area shape="rect" id="node14" href="message_8h.html" title="message.h" alt="" coords="204,213,265,235"/><area shape="rect" id="node16" href="printhex_8h.html" title="printhex.h" alt="" coords="71,283,128,304"/><area shape="rect" id="node17" href="hexdump_8h.html" title="hexdump.h" alt="" coords="204,283,265,304"/><area shape="rect" id="node19" href="controller_enums_8h.html" title="controllerEnums.h" alt="" coords="782,213,868,235"/></map>
</div>
</div>
<p><a href="_x_b_o_x_u_s_b_8cpp_source.html">Go to the source code of this file.</a></p>

View file

@ -1,14 +1,14 @@
<map id="XBOXUSB.cpp" name="XBOXUSB.cpp">
<area shape="rect" id="node2" href="$_x_b_o_x_u_s_b_8h.html" title="XBOXUSB.h" alt="" coords="722,75,789,96"/>
<area shape="rect" id="node4" href="$_usb_8h.html" title="Usb.h" alt="" coords="397,144,440,165"/>
<area shape="rect" id="node18" href="$xbox_enums_8h.html" title="xboxEnums.h" alt="" coords="798,144,868,165"/>
<area shape="rect" id="node7" href="$avrpins_8h.html" title="avrpins.h" alt="" coords="528,283,582,304"/>
<area shape="rect" id="node9" href="$max3421e_8h.html" title="max3421e.h" alt="" coords="146,283,213,304"/>
<area shape="rect" id="node10" href="$usbhost_8h.html" title="usbhost.h" alt="" coords="212,213,269,235"/>
<area shape="rect" id="node11" href="$usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="237,283,296,304"/>
<area shape="rect" id="node12" href="$address_8h.html" title="address.h" alt="" coords="79,213,136,235"/>
<area shape="rect" id="node14" href="$printhex_8h.html" title="printhex.h" alt="" coords="608,283,665,304"/>
<area shape="rect" id="node15" href="$hexdump_8h.html" title="hexdump.h" alt="" coords="430,213,492,235"/>
<area shape="rect" id="node17" href="$message_8h.html" title="message.h" alt="" coords="345,213,406,235"/>
<area shape="rect" id="node19" href="$controller_enums_8h.html" title="controllerEnums.h" alt="" coords="794,213,880,235"/>
<area shape="rect" id="node2" href="$_x_b_o_x_u_s_b_8h.html" title="XBOXUSB.h" alt="" coords="437,75,504,96"/>
<area shape="rect" id="node4" href="$_usb_8h.html" title="Usb.h" alt="" coords="449,144,492,165"/>
<area shape="rect" id="node18" href="$xbox_enums_8h.html" title="xboxEnums.h" alt="" coords="653,144,723,165"/>
<area shape="rect" id="node7" href="$avrpins_8h.html" title="avrpins.h" alt="" coords="474,283,528,304"/>
<area shape="rect" id="node9" href="$max3421e_8h.html" title="max3421e.h" alt="" coords="553,283,620,304"/>
<area shape="rect" id="node10" href="$usbhost_8h.html" title="usbhost.h" alt="" coords="442,213,499,235"/>
<area shape="rect" id="node11" href="$usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="391,283,449,304"/>
<area shape="rect" id="node12" href="$address_8h.html" title="address.h" alt="" coords="701,213,757,235"/>
<area shape="rect" id="node14" href="$message_8h.html" title="message.h" alt="" coords="204,213,265,235"/>
<area shape="rect" id="node16" href="$printhex_8h.html" title="printhex.h" alt="" coords="71,283,128,304"/>
<area shape="rect" id="node17" href="$hexdump_8h.html" title="hexdump.h" alt="" coords="204,283,265,304"/>
<area shape="rect" id="node19" href="$controller_enums_8h.html" title="controllerEnums.h" alt="" coords="782,213,868,235"/>
</map>

View file

@ -1 +1 @@
3ca153d023e1731c3bdf798e2214196b
1b8350cfc5b0ac72ce377d1cdd1d6c17

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 53 KiB

View file

@ -137,12 +137,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span>&#160; <span class="comment">// get memory address of USB device address pool</span></div>
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span>&#160; <a class="code" href="class_address_pool.html">AddressPool</a> &amp;addrPool = <a class="code" href="class_x_b_o_x_u_s_b.html#a9c701658d4f63b5407cbcd5b78d8eb18">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a66ab8f5eda239e761d5a48741ea1f9d4">GetAddressPool</a>();</div>
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span>&#160;<span class="preprocessor">#ifdef EXTRADEBUG</span></div>
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nXBOXUSB Init&quot;</span>));</div>
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a1e8693828152de8408add858dc461dea">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nXBOXUSB Init&quot;</span>), 0x80);</div>
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>&#160;<span class="preprocessor"></span> <span class="comment">// check if address has already been assigned to an instance</span></div>
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span>&#160; <span class="keywordflow">if</span> (<a class="code" href="class_x_b_o_x_u_s_b.html#a5e9c00af9f4b978c53819791b0a0eb65">bAddress</a>) {</div>
<div class="line"><a name="l00053"></a><span class="lineno"> 53</span>&#160;<span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nAddress in use&quot;</span>));</div>
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a1e8693828152de8408add858dc461dea">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nAddress in use&quot;</span>), 0x80);</div>
<div class="line"><a name="l00055"></a><span class="lineno"> 55</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>&#160;<span class="preprocessor"></span> <span class="keywordflow">return</span> <a class="code" href="_usb_8h.html#a44416ff64fc0e3691f98addac13d4595">USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE</a>;</div>
<div class="line"><a name="l00057"></a><span class="lineno"> 57</span>&#160; }</div>
@ -152,14 +152,14 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span>&#160;</div>
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>&#160; <span class="keywordflow">if</span> (!p) {</div>
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span>&#160;<span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nAddress not found&quot;</span>));</div>
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a1e8693828152de8408add858dc461dea">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nAddress not found&quot;</span>), 0x80);</div>
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>&#160;<span class="preprocessor"></span> <span class="keywordflow">return</span> <a class="code" href="_usb_8h.html#afe2fedb4b0ccc89a688c0b4b59691ce0">USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL</a>;</div>
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span>&#160; }</div>
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>&#160;</div>
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>&#160; <span class="keywordflow">if</span> (!p-&gt;<a class="code" href="struct_usb_device.html#a410d39fb7758157f57794335e990ed02">epinfo</a>) {</div>
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>&#160;<span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nepinfo is null&quot;</span>));</div>
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a1e8693828152de8408add858dc461dea">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nepinfo is null&quot;</span>), 0x80);</div>
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span>&#160;<span class="preprocessor"></span> <span class="keywordflow">return</span> <a class="code" href="_usb_8h.html#af192c59cafe2192ad802b22e6dbc077d">USB_ERROR_EPINFO_IS_NULL</a>;</div>
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span>&#160; }</div>
@ -187,250 +187,247 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<div class="line"><a name="l00096"></a><span class="lineno"> 96</span>&#160; <span class="keywordflow">goto</span> FailUnknownDevice;</div>
<div class="line"><a name="l00097"></a><span class="lineno"> 97</span>&#160; <span class="keywordflow">if</span> (PID == <a class="code" href="_x_b_o_x_u_s_b_8h.html#a10c2a7a8da78e76d7020c2c347f0a687">XBOX_WIRELESS_PID</a>) {</div>
<div class="line"><a name="l00098"></a><span class="lineno"> 98</span>&#160;<span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><a name="l00099"></a><span class="lineno"> 99</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nYou have plugged in a wireless Xbox 360 controller - it doesn&#39;t support USB communication&quot;</span>));</div>
<div class="line"><a name="l00099"></a><span class="lineno"> 99</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a1e8693828152de8408add858dc461dea">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nYou have plugged in a wireless Xbox 360 controller - it doesn&#39;t support USB communication&quot;</span>), 0x80);</div>
<div class="line"><a name="l00100"></a><span class="lineno"> 100</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00101"></a><span class="lineno"> 101</span>&#160;<span class="preprocessor"></span> <span class="keywordflow">goto</span> FailUnknownDevice;</div>
<div class="line"><a name="l00102"></a><span class="lineno"> 102</span>&#160; }</div>
<div class="line"><a name="l00103"></a><span class="lineno"> 103</span>&#160; <span class="keywordflow">else</span> <span class="keywordflow">if</span>(PID == <a class="code" href="_x_b_o_x_r_e_c_v_8h.html#a1a97ce2829a30b96ea6640d387d245a9">XBOX_WIRELESS_RECEIVER_PID</a> || PID == <a class="code" href="_x_b_o_x_r_e_c_v_8h.html#a6842663964e470b86786f046e4bc30d9">XBOX_WIRELESS_RECEIVER_THIRD_PARTY_PID</a>) {</div>
<div class="line"><a name="l00104"></a><span class="lineno"> 104</span>&#160;<span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><a name="l00105"></a><span class="lineno"> 105</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nThis library only supports Xbox 360 controllers via USB&quot;</span>));</div>
<div class="line"><a name="l00106"></a><span class="lineno"> 106</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00107"></a><span class="lineno"> 107</span>&#160;<span class="preprocessor"></span> <span class="keywordflow">goto</span> FailUnknownDevice;</div>
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span>&#160; } </div>
<div class="line"><a name="l00109"></a><span class="lineno"> 109</span>&#160; </div>
<div class="line"><a name="l00110"></a><span class="lineno"> 110</span>&#160; <span class="comment">// Allocate new address according to device class</span></div>
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span>&#160; <a class="code" href="class_x_b_o_x_u_s_b.html#a5e9c00af9f4b978c53819791b0a0eb65">bAddress</a> = addrPool.<a class="code" href="class_address_pool.html#a97df4ef42e50960ce2165f4cdb53e590">AllocAddress</a>(parent, <span class="keyword">false</span>, port);</div>
<div class="line"><a name="l00112"></a><span class="lineno"> 112</span>&#160; </div>
<div class="line"><a name="l00113"></a><span class="lineno"> 113</span>&#160; <span class="keywordflow">if</span> (!<a class="code" href="class_x_b_o_x_u_s_b.html#a5e9c00af9f4b978c53819791b0a0eb65">bAddress</a>)</div>
<div class="line"><a name="l00114"></a><span class="lineno"> 114</span>&#160; <span class="keywordflow">return</span> <a class="code" href="_usb_8h.html#a15370eb665cdded5514e69ca58d9f39d">USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL</a>;</div>
<div class="line"><a name="l00115"></a><span class="lineno"> 115</span>&#160; </div>
<div class="line"><a name="l00116"></a><span class="lineno"> 116</span>&#160; <span class="comment">// Extract Max Packet Size from device descriptor</span></div>
<div class="line"><a name="l00117"></a><span class="lineno"> 117</span>&#160; <a class="code" href="class_x_b_o_x_u_s_b.html#abef4a852d877d8136f198431ce54550f">epInfo</a>[0].<a class="code" href="struct_ep_info.html#aa2ca775b63736df4008e88da7dd4dddb">maxPktSize</a> = (uint8_t)((<a class="code" href="struct_u_s_b___d_e_v_i_c_e___d_e_s_c_r_i_p_t_o_r.html">USB_DEVICE_DESCRIPTOR</a>*)buf)-&gt;bMaxPacketSize0; </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; <span class="comment">// Assign new address to the device</span></div>
<div class="line"><a name="l00120"></a><span class="lineno"> 120</span>&#160; rcode = <a class="code" href="class_x_b_o_x_u_s_b.html#a9c701658d4f63b5407cbcd5b78d8eb18">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a3aea534daed66b5606fa798df7ad3c47">setAddr</a>( 0, 0, <a class="code" href="class_x_b_o_x_u_s_b.html#a5e9c00af9f4b978c53819791b0a0eb65">bAddress</a> );</div>
<div class="line"><a name="l00121"></a><span class="lineno"> 121</span>&#160; <span class="keywordflow">if</span> (rcode) {</div>
<div class="line"><a name="l00122"></a><span class="lineno"> 122</span>&#160; p-&gt;<a class="code" href="struct_usb_device.html#a86a815577ad7883437d3ca72b32b8e8a">lowspeed</a> = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00123"></a><span class="lineno"> 123</span>&#160; addrPool.<a class="code" href="class_address_pool.html#a15fde13223dcb1da89305ad229763562">FreeAddress</a>(<a class="code" href="class_x_b_o_x_u_s_b.html#a5e9c00af9f4b978c53819791b0a0eb65">bAddress</a>);</div>
<div class="line"><a name="l00124"></a><span class="lineno"> 124</span>&#160; <a class="code" href="class_x_b_o_x_u_s_b.html#a5e9c00af9f4b978c53819791b0a0eb65">bAddress</a> = 0;</div>
<div class="line"><a name="l00125"></a><span class="lineno"> 125</span>&#160;<span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nsetAddr: &quot;</span>));</div>
<div class="line"><a name="l00127"></a><span class="lineno"> 127</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00128"></a><span class="lineno"> 128</span>&#160;<span class="preprocessor"></span> PrintHex&lt;uint8_t&gt;(rcode);</div>
<div class="line"><a name="l00129"></a><span class="lineno"> 129</span>&#160; <span class="keywordflow">return</span> rcode;</div>
<div class="line"><a name="l00130"></a><span class="lineno"> 130</span>&#160; }</div>
<div class="line"><a name="l00131"></a><span class="lineno"> 131</span>&#160;<span class="preprocessor">#ifdef EXTRADEBUG</span></div>
<div class="line"><a name="l00132"></a><span class="lineno"> 132</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nAddr: &quot;</span>));</div>
<div class="line"><a name="l00133"></a><span class="lineno"> 133</span>&#160; PrintHex&lt;uint8_t&gt;(<a class="code" href="class_x_b_o_x_u_s_b.html#a5e9c00af9f4b978c53819791b0a0eb65">bAddress</a>);</div>
<div class="line"><a name="l00134"></a><span class="lineno"> 134</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00135"></a><span class="lineno"> 135</span>&#160;<span class="preprocessor"></span> p-&gt;<a class="code" href="struct_usb_device.html#a86a815577ad7883437d3ca72b32b8e8a">lowspeed</a> = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00136"></a><span class="lineno"> 136</span>&#160; </div>
<div class="line"><a name="l00137"></a><span class="lineno"> 137</span>&#160; <span class="comment">//get pointer to assigned address record</span></div>
<div class="line"><a name="l00138"></a><span class="lineno"> 138</span>&#160; p = addrPool.<a class="code" href="class_address_pool.html#aa92d7e8f0f515340ae2dc1679b627056">GetUsbDevicePtr</a>(<a class="code" href="class_x_b_o_x_u_s_b.html#a5e9c00af9f4b978c53819791b0a0eb65">bAddress</a>);</div>
<div class="line"><a name="l00139"></a><span class="lineno"> 139</span>&#160; <span class="keywordflow">if</span> (!p) </div>
<div class="line"><a name="l00140"></a><span class="lineno"> 140</span>&#160; <span class="keywordflow">return</span> <a class="code" href="_usb_8h.html#afe2fedb4b0ccc89a688c0b4b59691ce0">USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL</a>;</div>
<div class="line"><a name="l00141"></a><span class="lineno"> 141</span>&#160; </div>
<div class="line"><a name="l00142"></a><span class="lineno"> 142</span>&#160; p-&gt;<a class="code" href="struct_usb_device.html#a86a815577ad7883437d3ca72b32b8e8a">lowspeed</a> = lowspeed; </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">// Assign epInfo to epinfo pointer - only EP0 is known</span></div>
<div class="line"><a name="l00145"></a><span class="lineno"> 145</span>&#160; rcode = <a class="code" href="class_x_b_o_x_u_s_b.html#a9c701658d4f63b5407cbcd5b78d8eb18">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a6c3ba3f7e6dccb450267011ce783d7ea">setEpInfoEntry</a>(<a class="code" href="class_x_b_o_x_u_s_b.html#a5e9c00af9f4b978c53819791b0a0eb65">bAddress</a>, 1, <a class="code" href="class_x_b_o_x_u_s_b.html#abef4a852d877d8136f198431ce54550f">epInfo</a>);</div>
<div class="line"><a name="l00146"></a><span class="lineno"> 146</span>&#160; <span class="keywordflow">if</span> (rcode)</div>
<div class="line"><a name="l00147"></a><span class="lineno"> 147</span>&#160; <span class="keywordflow">goto</span> FailSetDevTblEntry;</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="comment">/* The application will work in reduced host mode, so we can save program and data</span></div>
<div class="line"><a name="l00150"></a><span class="lineno"> 150</span>&#160;<span class="comment"> memory space. After verifying the VID we will use known values for the</span></div>
<div class="line"><a name="l00151"></a><span class="lineno"> 151</span>&#160;<span class="comment"> configuration values for device, interface, endpoints and HID for the XBOX360 Controllers */</span></div>
<div class="line"><a name="l00152"></a><span class="lineno"> 152</span>&#160; </div>
<div class="line"><a name="l00153"></a><span class="lineno"> 153</span>&#160; <span class="comment">/* Initialize data structures for endpoints of device */</span></div>
<div class="line"><a name="l00154"></a><span class="lineno"> 154</span>&#160; <a class="code" href="class_x_b_o_x_u_s_b.html#abef4a852d877d8136f198431ce54550f">epInfo</a>[ <a class="code" href="_x_b_o_x_u_s_b_8h.html#a4fd9ad9bf7a7d5767940c2ec224ef5e8">XBOX_INPUT_PIPE</a> ].<a class="code" href="struct_ep_info.html#a9f92be74c75c037b39e2cae1eb49b89b">epAddr</a> = 0x01; <span class="comment">// XBOX 360 report endpoint</span></div>
<div class="line"><a name="l00155"></a><span class="lineno"> 155</span>&#160; <a class="code" href="class_x_b_o_x_u_s_b.html#abef4a852d877d8136f198431ce54550f">epInfo</a>[ <a class="code" href="_x_b_o_x_u_s_b_8h.html#a4fd9ad9bf7a7d5767940c2ec224ef5e8">XBOX_INPUT_PIPE</a> ].<a class="code" href="struct_ep_info.html#a1dea928517c961235eef7b0876e69f10">epAttribs</a> = <a class="code" href="_p_s3_u_s_b_8h.html#ad4d26e1c566064f2259faf65f0858b6e">EP_INTERRUPT</a>;</div>
<div class="line"><a name="l00156"></a><span class="lineno"> 156</span>&#160; <a class="code" href="class_x_b_o_x_u_s_b.html#abef4a852d877d8136f198431ce54550f">epInfo</a>[ <a class="code" href="_x_b_o_x_u_s_b_8h.html#a4fd9ad9bf7a7d5767940c2ec224ef5e8">XBOX_INPUT_PIPE</a> ].<a class="code" href="struct_ep_info.html#a3a5b1c017a034cd9e06e76729e727c46">bmNakPower</a> = <a class="code" href="address_8h.html#a660e8da9c1167a8450aef91c5c03761d">USB_NAK_NOWAIT</a>; <span class="comment">// Only poll once for interrupt endpoints</span></div>
<div class="line"><a name="l00157"></a><span class="lineno"> 157</span>&#160; <a class="code" href="class_x_b_o_x_u_s_b.html#abef4a852d877d8136f198431ce54550f">epInfo</a>[ <a class="code" href="_x_b_o_x_u_s_b_8h.html#a4fd9ad9bf7a7d5767940c2ec224ef5e8">XBOX_INPUT_PIPE</a> ].<a class="code" href="struct_ep_info.html#aa2ca775b63736df4008e88da7dd4dddb">maxPktSize</a> = <a class="code" href="_p_s3_u_s_b_8h.html#abcb805b13bfd36145e252b0633bbcfc0">EP_MAXPKTSIZE</a>;</div>
<div class="line"><a name="l00158"></a><span class="lineno"> 158</span>&#160; <a class="code" href="class_x_b_o_x_u_s_b.html#abef4a852d877d8136f198431ce54550f">epInfo</a>[ <a class="code" href="_x_b_o_x_u_s_b_8h.html#a4fd9ad9bf7a7d5767940c2ec224ef5e8">XBOX_INPUT_PIPE</a> ].<a class="code" href="struct_ep_info.html#ac85bff70ad0e5d71e50cb501f4d8caf3">bmSndToggle</a> = <a class="code" href="max3421e_8h.html#a4834ae7378471b63b9a1985c6294006f">bmSNDTOG0</a>;</div>
<div class="line"><a name="l00159"></a><span class="lineno"> 159</span>&#160; <a class="code" href="class_x_b_o_x_u_s_b.html#abef4a852d877d8136f198431ce54550f">epInfo</a>[ <a class="code" href="_x_b_o_x_u_s_b_8h.html#a4fd9ad9bf7a7d5767940c2ec224ef5e8">XBOX_INPUT_PIPE</a> ].<a class="code" href="struct_ep_info.html#a9238dd40c096baedf041c98b19386a14">bmRcvToggle</a> = <a class="code" href="max3421e_8h.html#aca6a8aa4f0aebbe07c5e175572a92ef7">bmRCVTOG0</a>;</div>
<div class="line"><a name="l00160"></a><span class="lineno"> 160</span>&#160; <a class="code" href="class_x_b_o_x_u_s_b.html#abef4a852d877d8136f198431ce54550f">epInfo</a>[ <a class="code" href="_x_b_o_x_u_s_b_8h.html#a92d2d844a70224a10c100c0a877aacfe">XBOX_OUTPUT_PIPE</a> ].<a class="code" href="struct_ep_info.html#a9f92be74c75c037b39e2cae1eb49b89b">epAddr</a> = 0x02; <span class="comment">// XBOX 360 output endpoint</span></div>
<div class="line"><a name="l00161"></a><span class="lineno"> 161</span>&#160; <a class="code" href="class_x_b_o_x_u_s_b.html#abef4a852d877d8136f198431ce54550f">epInfo</a>[ <a class="code" href="_x_b_o_x_u_s_b_8h.html#a92d2d844a70224a10c100c0a877aacfe">XBOX_OUTPUT_PIPE</a> ].<a class="code" href="struct_ep_info.html#a1dea928517c961235eef7b0876e69f10">epAttribs</a> = <a class="code" href="_p_s3_u_s_b_8h.html#ad4d26e1c566064f2259faf65f0858b6e">EP_INTERRUPT</a>;</div>
<div class="line"><a name="l00162"></a><span class="lineno"> 162</span>&#160; <a class="code" href="class_x_b_o_x_u_s_b.html#abef4a852d877d8136f198431ce54550f">epInfo</a>[ <a class="code" href="_x_b_o_x_u_s_b_8h.html#a92d2d844a70224a10c100c0a877aacfe">XBOX_OUTPUT_PIPE</a> ].<a class="code" href="struct_ep_info.html#a3a5b1c017a034cd9e06e76729e727c46">bmNakPower</a> = <a class="code" href="address_8h.html#a660e8da9c1167a8450aef91c5c03761d">USB_NAK_NOWAIT</a>; <span class="comment">// Only poll once for interrupt endpoints</span></div>
<div class="line"><a name="l00163"></a><span class="lineno"> 163</span>&#160; <a class="code" href="class_x_b_o_x_u_s_b.html#abef4a852d877d8136f198431ce54550f">epInfo</a>[ <a class="code" href="_x_b_o_x_u_s_b_8h.html#a92d2d844a70224a10c100c0a877aacfe">XBOX_OUTPUT_PIPE</a> ].<a class="code" href="struct_ep_info.html#aa2ca775b63736df4008e88da7dd4dddb">maxPktSize</a> = <a class="code" href="_p_s3_u_s_b_8h.html#abcb805b13bfd36145e252b0633bbcfc0">EP_MAXPKTSIZE</a>;</div>
<div class="line"><a name="l00164"></a><span class="lineno"> 164</span>&#160; <a class="code" href="class_x_b_o_x_u_s_b.html#abef4a852d877d8136f198431ce54550f">epInfo</a>[ <a class="code" href="_x_b_o_x_u_s_b_8h.html#a92d2d844a70224a10c100c0a877aacfe">XBOX_OUTPUT_PIPE</a> ].<a class="code" href="struct_ep_info.html#ac85bff70ad0e5d71e50cb501f4d8caf3">bmSndToggle</a> = <a class="code" href="max3421e_8h.html#a4834ae7378471b63b9a1985c6294006f">bmSNDTOG0</a>;</div>
<div class="line"><a name="l00165"></a><span class="lineno"> 165</span>&#160; <a class="code" href="class_x_b_o_x_u_s_b.html#abef4a852d877d8136f198431ce54550f">epInfo</a>[ <a class="code" href="_x_b_o_x_u_s_b_8h.html#a92d2d844a70224a10c100c0a877aacfe">XBOX_OUTPUT_PIPE</a> ].<a class="code" href="struct_ep_info.html#a9238dd40c096baedf041c98b19386a14">bmRcvToggle</a> = <a class="code" href="max3421e_8h.html#aca6a8aa4f0aebbe07c5e175572a92ef7">bmRCVTOG0</a>;</div>
<div class="line"><a name="l00166"></a><span class="lineno"> 166</span>&#160; </div>
<div class="line"><a name="l00167"></a><span class="lineno"> 167</span>&#160; rcode = <a class="code" href="class_x_b_o_x_u_s_b.html#a9c701658d4f63b5407cbcd5b78d8eb18">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a6c3ba3f7e6dccb450267011ce783d7ea">setEpInfoEntry</a>(<a class="code" href="class_x_b_o_x_u_s_b.html#a5e9c00af9f4b978c53819791b0a0eb65">bAddress</a>, 3, <a class="code" href="class_x_b_o_x_u_s_b.html#abef4a852d877d8136f198431ce54550f">epInfo</a>);</div>
<div class="line"><a name="l00168"></a><span class="lineno"> 168</span>&#160; <span class="keywordflow">if</span>( rcode )</div>
<div class="line"><a name="l00169"></a><span class="lineno"> 169</span>&#160; <span class="keywordflow">goto</span> FailSetDevTblEntry;</div>
<div class="line"><a name="l00170"></a><span class="lineno"> 170</span>&#160; </div>
<div class="line"><a name="l00171"></a><span class="lineno"> 171</span>&#160; delay(200);<span class="comment">//Give time for address change</span></div>
<div class="line"><a name="l00172"></a><span class="lineno"> 172</span>&#160; </div>
<div class="line"><a name="l00173"></a><span class="lineno"> 173</span>&#160; rcode = <a class="code" href="class_x_b_o_x_u_s_b.html#a9c701658d4f63b5407cbcd5b78d8eb18">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a31e2c132ec32ffdde94dff72be87c378">setConf</a>(<a class="code" href="class_x_b_o_x_u_s_b.html#a5e9c00af9f4b978c53819791b0a0eb65">bAddress</a>, <a class="code" href="class_x_b_o_x_u_s_b.html#abef4a852d877d8136f198431ce54550f">epInfo</a>[ <a class="code" href="_x_b_o_x_r_e_c_v_8h.html#a8f4ee68cc0f05690f5f26104c7d9e490">XBOX_CONTROL_PIPE</a> ].epAddr, 1);</div>
<div class="line"><a name="l00174"></a><span class="lineno"> 174</span>&#160; <span class="keywordflow">if</span>( rcode )</div>
<div class="line"><a name="l00175"></a><span class="lineno"> 175</span>&#160; <span class="keywordflow">goto</span> FailSetConf; </div>
<div class="line"><a name="l00176"></a><span class="lineno"> 176</span>&#160;</div>
<div class="line"><a name="l00177"></a><span class="lineno"> 177</span>&#160;<span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><a name="l00178"></a><span class="lineno"> 178</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nXbox 360 Controller Connected\r\n&quot;</span>));</div>
<div class="line"><a name="l00179"></a><span class="lineno"> 179</span>&#160;<span class="preprocessor">#endif </span></div>
<div class="line"><a name="l00180"></a><span class="lineno"> 180</span>&#160;<span class="preprocessor"></span> <a class="code" href="class_x_b_o_x_u_s_b.html#a2348a35d4302f0a76bbeb319e84349a1">setLedOn</a>(<a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6adac6477842247cab1a8c02c65f431b44">LED1</a>);</div>
<div class="line"><a name="l00181"></a><span class="lineno"> 181</span>&#160; <a class="code" href="class_x_b_o_x_u_s_b.html#a1c779ae5483a2f73426650242a37d868">Xbox360Connected</a> = <span class="keyword">true</span>;</div>
<div class="line"><a name="l00182"></a><span class="lineno"> 182</span>&#160; bPollEnable = <span class="keyword">true</span>;</div>
<div class="line"><a name="l00183"></a><span class="lineno"> 183</span>&#160; <span class="keywordflow">return</span> 0; <span class="comment">// successful configuration</span></div>
<div class="line"><a name="l00184"></a><span class="lineno"> 184</span>&#160; </div>
<div class="line"><a name="l00185"></a><span class="lineno"> 185</span>&#160; <span class="comment">/* diagnostic messages */</span> </div>
<div class="line"><a name="l00186"></a><span class="lineno"> 186</span>&#160;FailGetDevDescr:</div>
<div class="line"><a name="l00187"></a><span class="lineno"> 187</span>&#160;<span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><a name="l00188"></a><span class="lineno"> 188</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\ngetDevDescr:&quot;</span>));</div>
<div class="line"><a name="l00189"></a><span class="lineno"> 189</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00190"></a><span class="lineno"> 190</span>&#160;<span class="preprocessor"></span> <span class="keywordflow">goto</span> Fail; </div>
<div class="line"><a name="l00191"></a><span class="lineno"> 191</span>&#160;FailSetDevTblEntry:</div>
<div class="line"><a name="l00192"></a><span class="lineno"> 192</span>&#160;<span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><a name="l00193"></a><span class="lineno"> 193</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nsetDevTblEn:&quot;</span>));</div>
<div class="line"><a name="l00194"></a><span class="lineno"> 194</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00195"></a><span class="lineno"> 195</span>&#160;<span class="preprocessor"></span> <span class="keywordflow">goto</span> Fail;</div>
<div class="line"><a name="l00196"></a><span class="lineno"> 196</span>&#160;FailSetConf:</div>
<div class="line"><a name="l00197"></a><span class="lineno"> 197</span>&#160;<span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><a name="l00198"></a><span class="lineno"> 198</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nsetConf:&quot;</span>));</div>
<div class="line"><a name="l00199"></a><span class="lineno"> 199</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00200"></a><span class="lineno"> 200</span>&#160;<span class="preprocessor"></span> <span class="keywordflow">goto</span> Fail; </div>
<div class="line"><a name="l00201"></a><span class="lineno"> 201</span>&#160;FailUnknownDevice:</div>
<div class="line"><a name="l00202"></a><span class="lineno"> 202</span>&#160;<span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><a name="l00203"></a><span class="lineno"> 203</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nUnknown Device Connected - VID: &quot;</span>));</div>
<div class="line"><a name="l00204"></a><span class="lineno"> 204</span>&#160; PrintHex&lt;uint16_t&gt;(VID);</div>
<div class="line"><a name="l00205"></a><span class="lineno"> 205</span>&#160; <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot; PID: &quot;</span>));</div>
<div class="line"><a name="l00206"></a><span class="lineno"> 206</span>&#160; PrintHex&lt;uint16_t&gt;(PID);</div>
<div class="line"><a name="l00207"></a><span class="lineno"> 207</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00208"></a><span class="lineno"> 208</span>&#160;<span class="preprocessor"></span> rcode = <a class="code" href="_usb_8h.html#ae9e139d0fd29bb0b3e7afad2f76cd589">USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED</a>;</div>
<div class="line"><a name="l00209"></a><span class="lineno"> 209</span>&#160; <span class="keywordflow">goto</span> Fail;</div>
<div class="line"><a name="l00210"></a><span class="lineno"> 210</span>&#160;Fail:</div>
<div class="line"><a name="l00211"></a><span class="lineno"> 211</span>&#160;<span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><a name="l00212"></a><span class="lineno"> 212</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nXbox 360 Init Failed, error code: &quot;</span>));</div>
<div class="line"><a name="l00213"></a><span class="lineno"> 213</span>&#160; Serial.print(rcode,HEX);</div>
<div class="line"><a name="l00214"></a><span class="lineno"> 214</span>&#160;<span class="preprocessor">#endif </span></div>
<div class="line"><a name="l00215"></a><span class="lineno"> 215</span>&#160;<span class="preprocessor"></span> <a class="code" href="class_x_b_o_x_u_s_b.html#a9a296b98b40f5a36d46297d98ef0f9b5">Release</a>();</div>
<div class="line"><a name="l00216"></a><span class="lineno"> 216</span>&#160; <span class="keywordflow">return</span> rcode;</div>
<div class="line"><a name="l00217"></a><span class="lineno"> 217</span>&#160;}</div>
<div class="line"><a name="l00218"></a><span class="lineno"> 218</span>&#160;</div>
<div class="line"><a name="l00219"></a><span class="lineno"> 219</span>&#160;<span class="comment">/* Performs a cleanup after failed Init() attempt */</span></div>
<div class="line"><a name="l00220"></a><span class="lineno"><a class="code" href="class_x_b_o_x_u_s_b.html#a9a296b98b40f5a36d46297d98ef0f9b5"> 220</a></span>&#160;uint8_t <a class="code" href="class_x_b_o_x_u_s_b.html#a9a296b98b40f5a36d46297d98ef0f9b5">XBOXUSB::Release</a>() {</div>
<div class="line"><a name="l00221"></a><span class="lineno"> 221</span>&#160; <a class="code" href="class_x_b_o_x_u_s_b.html#a1c779ae5483a2f73426650242a37d868">Xbox360Connected</a> = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00222"></a><span class="lineno"> 222</span>&#160; <a class="code" href="class_x_b_o_x_u_s_b.html#a9c701658d4f63b5407cbcd5b78d8eb18">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a66ab8f5eda239e761d5a48741ea1f9d4">GetAddressPool</a>().<a class="code" href="class_address_pool.html#a15fde13223dcb1da89305ad229763562">FreeAddress</a>(<a class="code" href="class_x_b_o_x_u_s_b.html#a5e9c00af9f4b978c53819791b0a0eb65">bAddress</a>); </div>
<div class="line"><a name="l00223"></a><span class="lineno"> 223</span>&#160; <a class="code" href="class_x_b_o_x_u_s_b.html#a5e9c00af9f4b978c53819791b0a0eb65">bAddress</a> = 0;</div>
<div class="line"><a name="l00224"></a><span class="lineno"> 224</span>&#160; bPollEnable = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00225"></a><span class="lineno"> 225</span>&#160; <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00226"></a><span class="lineno"> 226</span>&#160;}</div>
<div class="line"><a name="l00227"></a><span class="lineno"><a class="code" href="class_x_b_o_x_u_s_b.html#a2f4684fe0785e50de434d95f4336fa12"> 227</a></span>&#160;uint8_t <a class="code" href="class_x_b_o_x_u_s_b.html#a2f4684fe0785e50de434d95f4336fa12">XBOXUSB::Poll</a>() { </div>
<div class="line"><a name="l00228"></a><span class="lineno"> 228</span>&#160; <span class="keywordflow">if</span> (!bPollEnable)</div>
<div class="line"><a name="l00229"></a><span class="lineno"> 229</span>&#160; <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00230"></a><span class="lineno"> 230</span>&#160; uint16_t BUFFER_SIZE = <a class="code" href="_p_s3_u_s_b_8h.html#abcb805b13bfd36145e252b0633bbcfc0">EP_MAXPKTSIZE</a>;</div>
<div class="line"><a name="l00231"></a><span class="lineno"> 231</span>&#160; <a class="code" href="class_x_b_o_x_u_s_b.html#a9c701658d4f63b5407cbcd5b78d8eb18">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#ad75d64f648b102fab2bd75e53e1324a4">inTransfer</a>(<a class="code" href="class_x_b_o_x_u_s_b.html#a5e9c00af9f4b978c53819791b0a0eb65">bAddress</a>, <a class="code" href="class_x_b_o_x_u_s_b.html#abef4a852d877d8136f198431ce54550f">epInfo</a>[ <a class="code" href="_x_b_o_x_u_s_b_8h.html#a4fd9ad9bf7a7d5767940c2ec224ef5e8">XBOX_INPUT_PIPE</a> ].epAddr, &amp;BUFFER_SIZE, readBuf); <span class="comment">// input on endpoint 1</span></div>
<div class="line"><a name="l00232"></a><span class="lineno"> 232</span>&#160; readReport();</div>
<div class="line"><a name="l00233"></a><span class="lineno"> 233</span>&#160;<span class="preprocessor">#ifdef PRINTREPORT</span></div>
<div class="line"><a name="l00234"></a><span class="lineno"> 234</span>&#160;<span class="preprocessor"></span> printReport(); <span class="comment">// Uncomment &quot;#define PRINTREPORT&quot; to print the report send by the Xbox 360 Controller</span></div>
<div class="line"><a name="l00235"></a><span class="lineno"> 235</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00236"></a><span class="lineno"> 236</span>&#160;<span class="preprocessor"></span> <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00237"></a><span class="lineno"> 237</span>&#160;}</div>
<div class="line"><a name="l00102"></a><span class="lineno"> 102</span>&#160; } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (PID == <a class="code" href="_x_b_o_x_r_e_c_v_8h.html#a1a97ce2829a30b96ea6640d387d245a9">XBOX_WIRELESS_RECEIVER_PID</a> || PID == <a class="code" href="_x_b_o_x_r_e_c_v_8h.html#a6842663964e470b86786f046e4bc30d9">XBOX_WIRELESS_RECEIVER_THIRD_PARTY_PID</a>) {</div>
<div class="line"><a name="l00103"></a><span class="lineno"> 103</span>&#160;<span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><a name="l00104"></a><span class="lineno"> 104</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a1e8693828152de8408add858dc461dea">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nThis library only supports Xbox 360 controllers via USB&quot;</span>), 0x80);</div>
<div class="line"><a name="l00105"></a><span class="lineno"> 105</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00106"></a><span class="lineno"> 106</span>&#160;<span class="preprocessor"></span> <span class="keywordflow">goto</span> FailUnknownDevice;</div>
<div class="line"><a name="l00107"></a><span class="lineno"> 107</span>&#160; }</div>
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span>&#160;</div>
<div class="line"><a name="l00109"></a><span class="lineno"> 109</span>&#160; <span class="comment">// Allocate new address according to device class</span></div>
<div class="line"><a name="l00110"></a><span class="lineno"> 110</span>&#160; <a class="code" href="class_x_b_o_x_u_s_b.html#a5e9c00af9f4b978c53819791b0a0eb65">bAddress</a> = addrPool.<a class="code" href="class_address_pool.html#a97df4ef42e50960ce2165f4cdb53e590">AllocAddress</a>(parent, <span class="keyword">false</span>, port);</div>
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span>&#160;</div>
<div class="line"><a name="l00112"></a><span class="lineno"> 112</span>&#160; <span class="keywordflow">if</span> (!<a class="code" href="class_x_b_o_x_u_s_b.html#a5e9c00af9f4b978c53819791b0a0eb65">bAddress</a>)</div>
<div class="line"><a name="l00113"></a><span class="lineno"> 113</span>&#160; <span class="keywordflow">return</span> <a class="code" href="_usb_8h.html#a15370eb665cdded5514e69ca58d9f39d">USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL</a>;</div>
<div class="line"><a name="l00114"></a><span class="lineno"> 114</span>&#160;</div>
<div class="line"><a name="l00115"></a><span class="lineno"> 115</span>&#160; <span class="comment">// Extract Max Packet Size from device descriptor</span></div>
<div class="line"><a name="l00116"></a><span class="lineno"> 116</span>&#160; <a class="code" href="class_x_b_o_x_u_s_b.html#abef4a852d877d8136f198431ce54550f">epInfo</a>[0].<a class="code" href="struct_ep_info.html#aa2ca775b63736df4008e88da7dd4dddb">maxPktSize</a> = (uint8_t)((<a class="code" href="struct_u_s_b___d_e_v_i_c_e___d_e_s_c_r_i_p_t_o_r.html">USB_DEVICE_DESCRIPTOR</a>*)buf)-&gt;bMaxPacketSize0;</div>
<div class="line"><a name="l00117"></a><span class="lineno"> 117</span>&#160;</div>
<div class="line"><a name="l00118"></a><span class="lineno"> 118</span>&#160; <span class="comment">// Assign new address to the device</span></div>
<div class="line"><a name="l00119"></a><span class="lineno"> 119</span>&#160; rcode = <a class="code" href="class_x_b_o_x_u_s_b.html#a9c701658d4f63b5407cbcd5b78d8eb18">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a3aea534daed66b5606fa798df7ad3c47">setAddr</a>(0, 0, <a class="code" href="class_x_b_o_x_u_s_b.html#a5e9c00af9f4b978c53819791b0a0eb65">bAddress</a>);</div>
<div class="line"><a name="l00120"></a><span class="lineno"> 120</span>&#160; <span class="keywordflow">if</span> (rcode) {</div>
<div class="line"><a name="l00121"></a><span class="lineno"> 121</span>&#160; p-&gt;<a class="code" href="struct_usb_device.html#a86a815577ad7883437d3ca72b32b8e8a">lowspeed</a> = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00122"></a><span class="lineno"> 122</span>&#160; addrPool.<a class="code" href="class_address_pool.html#a15fde13223dcb1da89305ad229763562">FreeAddress</a>(<a class="code" href="class_x_b_o_x_u_s_b.html#a5e9c00af9f4b978c53819791b0a0eb65">bAddress</a>);</div>
<div class="line"><a name="l00123"></a><span class="lineno"> 123</span>&#160; <a class="code" href="class_x_b_o_x_u_s_b.html#a5e9c00af9f4b978c53819791b0a0eb65">bAddress</a> = 0;</div>
<div class="line"><a name="l00124"></a><span class="lineno"> 124</span>&#160;<span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><a name="l00125"></a><span class="lineno"> 125</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a1e8693828152de8408add858dc461dea">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nsetAddr: &quot;</span>), 0x80);</div>
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00127"></a><span class="lineno"> 127</span>&#160;<span class="preprocessor"></span> PrintHex&lt;uint8_t &gt; (rcode, 0x80);</div>
<div class="line"><a name="l00128"></a><span class="lineno"> 128</span>&#160; <span class="keywordflow">return</span> rcode;</div>
<div class="line"><a name="l00129"></a><span class="lineno"> 129</span>&#160; }</div>
<div class="line"><a name="l00130"></a><span class="lineno"> 130</span>&#160;<span class="preprocessor">#ifdef EXTRADEBUG</span></div>
<div class="line"><a name="l00131"></a><span class="lineno"> 131</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a1e8693828152de8408add858dc461dea">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nAddr: &quot;</span>), 0x80);</div>
<div class="line"><a name="l00132"></a><span class="lineno"> 132</span>&#160; PrintHex&lt;uint8_t &gt; (<a class="code" href="class_x_b_o_x_u_s_b.html#a5e9c00af9f4b978c53819791b0a0eb65">bAddress</a>, 0x80);</div>
<div class="line"><a name="l00133"></a><span class="lineno"> 133</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00134"></a><span class="lineno"> 134</span>&#160;<span class="preprocessor"></span> p-&gt;<a class="code" href="struct_usb_device.html#a86a815577ad7883437d3ca72b32b8e8a">lowspeed</a> = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00135"></a><span class="lineno"> 135</span>&#160;</div>
<div class="line"><a name="l00136"></a><span class="lineno"> 136</span>&#160; <span class="comment">//get pointer to assigned address record</span></div>
<div class="line"><a name="l00137"></a><span class="lineno"> 137</span>&#160; p = addrPool.<a class="code" href="class_address_pool.html#aa92d7e8f0f515340ae2dc1679b627056">GetUsbDevicePtr</a>(bAddress);</div>
<div class="line"><a name="l00138"></a><span class="lineno"> 138</span>&#160; <span class="keywordflow">if</span> (!p)</div>
<div class="line"><a name="l00139"></a><span class="lineno"> 139</span>&#160; <span class="keywordflow">return</span> <a class="code" href="_usb_8h.html#afe2fedb4b0ccc89a688c0b4b59691ce0">USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL</a>;</div>
<div class="line"><a name="l00140"></a><span class="lineno"> 140</span>&#160;</div>
<div class="line"><a name="l00141"></a><span class="lineno"> 141</span>&#160; p-&gt;<a class="code" href="struct_usb_device.html#a86a815577ad7883437d3ca72b32b8e8a">lowspeed</a> = lowspeed;</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; <span class="comment">// Assign epInfo to epinfo pointer - only EP0 is known</span></div>
<div class="line"><a name="l00144"></a><span class="lineno"> 144</span>&#160; rcode = <a class="code" href="class_x_b_o_x_u_s_b.html#a9c701658d4f63b5407cbcd5b78d8eb18">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a6c3ba3f7e6dccb450267011ce783d7ea">setEpInfoEntry</a>(bAddress, 1, <a class="code" href="class_x_b_o_x_u_s_b.html#abef4a852d877d8136f198431ce54550f">epInfo</a>);</div>
<div class="line"><a name="l00145"></a><span class="lineno"> 145</span>&#160; <span class="keywordflow">if</span> (rcode)</div>
<div class="line"><a name="l00146"></a><span class="lineno"> 146</span>&#160; <span class="keywordflow">goto</span> FailSetDevTblEntry;</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; <span class="comment">/* The application will work in reduced host mode, so we can save program and data</span></div>
<div class="line"><a name="l00149"></a><span class="lineno"> 149</span>&#160;<span class="comment"> memory space. After verifying the VID we will use known values for the</span></div>
<div class="line"><a name="l00150"></a><span class="lineno"> 150</span>&#160;<span class="comment"> configuration values for device, interface, endpoints and HID for the XBOX360 Controllers */</span></div>
<div class="line"><a name="l00151"></a><span class="lineno"> 151</span>&#160;</div>
<div class="line"><a name="l00152"></a><span class="lineno"> 152</span>&#160; <span class="comment">/* Initialize data structures for endpoints of device */</span></div>
<div class="line"><a name="l00153"></a><span class="lineno"> 153</span>&#160; <a class="code" href="class_x_b_o_x_u_s_b.html#abef4a852d877d8136f198431ce54550f">epInfo</a>[ <a class="code" href="_x_b_o_x_u_s_b_8h.html#a4fd9ad9bf7a7d5767940c2ec224ef5e8">XBOX_INPUT_PIPE</a> ].<a class="code" href="struct_ep_info.html#a9f92be74c75c037b39e2cae1eb49b89b">epAddr</a> = 0x01; <span class="comment">// XBOX 360 report endpoint</span></div>
<div class="line"><a name="l00154"></a><span class="lineno"> 154</span>&#160; <a class="code" href="class_x_b_o_x_u_s_b.html#abef4a852d877d8136f198431ce54550f">epInfo</a>[ <a class="code" href="_x_b_o_x_u_s_b_8h.html#a4fd9ad9bf7a7d5767940c2ec224ef5e8">XBOX_INPUT_PIPE</a> ].<a class="code" href="struct_ep_info.html#a1dea928517c961235eef7b0876e69f10">epAttribs</a> = <a class="code" href="_p_s3_u_s_b_8h.html#ad4d26e1c566064f2259faf65f0858b6e">EP_INTERRUPT</a>;</div>
<div class="line"><a name="l00155"></a><span class="lineno"> 155</span>&#160; <a class="code" href="class_x_b_o_x_u_s_b.html#abef4a852d877d8136f198431ce54550f">epInfo</a>[ <a class="code" href="_x_b_o_x_u_s_b_8h.html#a4fd9ad9bf7a7d5767940c2ec224ef5e8">XBOX_INPUT_PIPE</a> ].<a class="code" href="struct_ep_info.html#a3a5b1c017a034cd9e06e76729e727c46">bmNakPower</a> = <a class="code" href="address_8h.html#a660e8da9c1167a8450aef91c5c03761d">USB_NAK_NOWAIT</a>; <span class="comment">// Only poll once for interrupt endpoints</span></div>
<div class="line"><a name="l00156"></a><span class="lineno"> 156</span>&#160; <a class="code" href="class_x_b_o_x_u_s_b.html#abef4a852d877d8136f198431ce54550f">epInfo</a>[ <a class="code" href="_x_b_o_x_u_s_b_8h.html#a4fd9ad9bf7a7d5767940c2ec224ef5e8">XBOX_INPUT_PIPE</a> ].<a class="code" href="struct_ep_info.html#aa2ca775b63736df4008e88da7dd4dddb">maxPktSize</a> = <a class="code" href="_p_s3_u_s_b_8h.html#abcb805b13bfd36145e252b0633bbcfc0">EP_MAXPKTSIZE</a>;</div>
<div class="line"><a name="l00157"></a><span class="lineno"> 157</span>&#160; <a class="code" href="class_x_b_o_x_u_s_b.html#abef4a852d877d8136f198431ce54550f">epInfo</a>[ <a class="code" href="_x_b_o_x_u_s_b_8h.html#a4fd9ad9bf7a7d5767940c2ec224ef5e8">XBOX_INPUT_PIPE</a> ].<a class="code" href="struct_ep_info.html#ac85bff70ad0e5d71e50cb501f4d8caf3">bmSndToggle</a> = <a class="code" href="max3421e_8h.html#a4834ae7378471b63b9a1985c6294006f">bmSNDTOG0</a>;</div>
<div class="line"><a name="l00158"></a><span class="lineno"> 158</span>&#160; <a class="code" href="class_x_b_o_x_u_s_b.html#abef4a852d877d8136f198431ce54550f">epInfo</a>[ <a class="code" href="_x_b_o_x_u_s_b_8h.html#a4fd9ad9bf7a7d5767940c2ec224ef5e8">XBOX_INPUT_PIPE</a> ].<a class="code" href="struct_ep_info.html#a9238dd40c096baedf041c98b19386a14">bmRcvToggle</a> = <a class="code" href="max3421e_8h.html#aca6a8aa4f0aebbe07c5e175572a92ef7">bmRCVTOG0</a>;</div>
<div class="line"><a name="l00159"></a><span class="lineno"> 159</span>&#160; <a class="code" href="class_x_b_o_x_u_s_b.html#abef4a852d877d8136f198431ce54550f">epInfo</a>[ <a class="code" href="_x_b_o_x_u_s_b_8h.html#a92d2d844a70224a10c100c0a877aacfe">XBOX_OUTPUT_PIPE</a> ].<a class="code" href="struct_ep_info.html#a9f92be74c75c037b39e2cae1eb49b89b">epAddr</a> = 0x02; <span class="comment">// XBOX 360 output endpoint</span></div>
<div class="line"><a name="l00160"></a><span class="lineno"> 160</span>&#160; <a class="code" href="class_x_b_o_x_u_s_b.html#abef4a852d877d8136f198431ce54550f">epInfo</a>[ <a class="code" href="_x_b_o_x_u_s_b_8h.html#a92d2d844a70224a10c100c0a877aacfe">XBOX_OUTPUT_PIPE</a> ].<a class="code" href="struct_ep_info.html#a1dea928517c961235eef7b0876e69f10">epAttribs</a> = <a class="code" href="_p_s3_u_s_b_8h.html#ad4d26e1c566064f2259faf65f0858b6e">EP_INTERRUPT</a>;</div>
<div class="line"><a name="l00161"></a><span class="lineno"> 161</span>&#160; <a class="code" href="class_x_b_o_x_u_s_b.html#abef4a852d877d8136f198431ce54550f">epInfo</a>[ <a class="code" href="_x_b_o_x_u_s_b_8h.html#a92d2d844a70224a10c100c0a877aacfe">XBOX_OUTPUT_PIPE</a> ].<a class="code" href="struct_ep_info.html#a3a5b1c017a034cd9e06e76729e727c46">bmNakPower</a> = <a class="code" href="address_8h.html#a660e8da9c1167a8450aef91c5c03761d">USB_NAK_NOWAIT</a>; <span class="comment">// Only poll once for interrupt endpoints</span></div>
<div class="line"><a name="l00162"></a><span class="lineno"> 162</span>&#160; <a class="code" href="class_x_b_o_x_u_s_b.html#abef4a852d877d8136f198431ce54550f">epInfo</a>[ <a class="code" href="_x_b_o_x_u_s_b_8h.html#a92d2d844a70224a10c100c0a877aacfe">XBOX_OUTPUT_PIPE</a> ].<a class="code" href="struct_ep_info.html#aa2ca775b63736df4008e88da7dd4dddb">maxPktSize</a> = <a class="code" href="_p_s3_u_s_b_8h.html#abcb805b13bfd36145e252b0633bbcfc0">EP_MAXPKTSIZE</a>;</div>
<div class="line"><a name="l00163"></a><span class="lineno"> 163</span>&#160; <a class="code" href="class_x_b_o_x_u_s_b.html#abef4a852d877d8136f198431ce54550f">epInfo</a>[ <a class="code" href="_x_b_o_x_u_s_b_8h.html#a92d2d844a70224a10c100c0a877aacfe">XBOX_OUTPUT_PIPE</a> ].<a class="code" href="struct_ep_info.html#ac85bff70ad0e5d71e50cb501f4d8caf3">bmSndToggle</a> = <a class="code" href="max3421e_8h.html#a4834ae7378471b63b9a1985c6294006f">bmSNDTOG0</a>;</div>
<div class="line"><a name="l00164"></a><span class="lineno"> 164</span>&#160; <a class="code" href="class_x_b_o_x_u_s_b.html#abef4a852d877d8136f198431ce54550f">epInfo</a>[ <a class="code" href="_x_b_o_x_u_s_b_8h.html#a92d2d844a70224a10c100c0a877aacfe">XBOX_OUTPUT_PIPE</a> ].<a class="code" href="struct_ep_info.html#a9238dd40c096baedf041c98b19386a14">bmRcvToggle</a> = <a class="code" href="max3421e_8h.html#aca6a8aa4f0aebbe07c5e175572a92ef7">bmRCVTOG0</a>;</div>
<div class="line"><a name="l00165"></a><span class="lineno"> 165</span>&#160;</div>
<div class="line"><a name="l00166"></a><span class="lineno"> 166</span>&#160; rcode = <a class="code" href="class_x_b_o_x_u_s_b.html#a9c701658d4f63b5407cbcd5b78d8eb18">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a6c3ba3f7e6dccb450267011ce783d7ea">setEpInfoEntry</a>(bAddress, 3, <a class="code" href="class_x_b_o_x_u_s_b.html#abef4a852d877d8136f198431ce54550f">epInfo</a>);</div>
<div class="line"><a name="l00167"></a><span class="lineno"> 167</span>&#160; <span class="keywordflow">if</span> (rcode)</div>
<div class="line"><a name="l00168"></a><span class="lineno"> 168</span>&#160; <span class="keywordflow">goto</span> FailSetDevTblEntry;</div>
<div class="line"><a name="l00169"></a><span class="lineno"> 169</span>&#160;</div>
<div class="line"><a name="l00170"></a><span class="lineno"> 170</span>&#160; delay(200); <span class="comment">//Give time for address change</span></div>
<div class="line"><a name="l00171"></a><span class="lineno"> 171</span>&#160;</div>
<div class="line"><a name="l00172"></a><span class="lineno"> 172</span>&#160; rcode = <a class="code" href="class_x_b_o_x_u_s_b.html#a9c701658d4f63b5407cbcd5b78d8eb18">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a31e2c132ec32ffdde94dff72be87c378">setConf</a>(bAddress, <a class="code" href="class_x_b_o_x_u_s_b.html#abef4a852d877d8136f198431ce54550f">epInfo</a>[ <a class="code" href="_x_b_o_x_r_e_c_v_8h.html#a8f4ee68cc0f05690f5f26104c7d9e490">XBOX_CONTROL_PIPE</a> ].epAddr, 1);</div>
<div class="line"><a name="l00173"></a><span class="lineno"> 173</span>&#160; <span class="keywordflow">if</span> (rcode)</div>
<div class="line"><a name="l00174"></a><span class="lineno"> 174</span>&#160; <span class="keywordflow">goto</span> FailSetConfDescr;</div>
<div class="line"><a name="l00175"></a><span class="lineno"> 175</span>&#160;</div>
<div class="line"><a name="l00176"></a><span class="lineno"> 176</span>&#160;<span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><a name="l00177"></a><span class="lineno"> 177</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a1e8693828152de8408add858dc461dea">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nXbox 360 Controller Connected\r\n&quot;</span>), 0x80);</div>
<div class="line"><a name="l00178"></a><span class="lineno"> 178</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00179"></a><span class="lineno"> 179</span>&#160;<span class="preprocessor"></span> <a class="code" href="class_x_b_o_x_u_s_b.html#a2348a35d4302f0a76bbeb319e84349a1">setLedOn</a>(<a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6adac6477842247cab1a8c02c65f431b44">LED1</a>);</div>
<div class="line"><a name="l00180"></a><span class="lineno"> 180</span>&#160; <a class="code" href="class_x_b_o_x_u_s_b.html#a1c779ae5483a2f73426650242a37d868">Xbox360Connected</a> = <span class="keyword">true</span>;</div>
<div class="line"><a name="l00181"></a><span class="lineno"> 181</span>&#160; bPollEnable = <span class="keyword">true</span>;</div>
<div class="line"><a name="l00182"></a><span class="lineno"> 182</span>&#160; <span class="keywordflow">return</span> 0; <span class="comment">// successful configuration</span></div>
<div class="line"><a name="l00183"></a><span class="lineno"> 183</span>&#160;</div>
<div class="line"><a name="l00184"></a><span class="lineno"> 184</span>&#160; <span class="comment">/* diagnostic messages */</span></div>
<div class="line"><a name="l00185"></a><span class="lineno"> 185</span>&#160;FailGetDevDescr:</div>
<div class="line"><a name="l00186"></a><span class="lineno"> 186</span>&#160; <a class="code" href="message_8cpp.html#ace40a5d826a882de0c5a25aece111d3f">NotifyFailGetDevDescr</a>();</div>
<div class="line"><a name="l00187"></a><span class="lineno"> 187</span>&#160; <span class="keywordflow">goto</span> Fail;</div>
<div class="line"><a name="l00188"></a><span class="lineno"> 188</span>&#160;</div>
<div class="line"><a name="l00189"></a><span class="lineno"> 189</span>&#160;FailSetDevTblEntry:</div>
<div class="line"><a name="l00190"></a><span class="lineno"> 190</span>&#160; <a class="code" href="message_8cpp.html#aa65008f9251787149e391f89e68b32be">NotifyFailSetDevTblEntry</a>();</div>
<div class="line"><a name="l00191"></a><span class="lineno"> 191</span>&#160; <span class="keywordflow">goto</span> Fail;</div>
<div class="line"><a name="l00192"></a><span class="lineno"> 192</span>&#160;</div>
<div class="line"><a name="l00193"></a><span class="lineno"> 193</span>&#160;FailSetConfDescr:</div>
<div class="line"><a name="l00194"></a><span class="lineno"> 194</span>&#160; <a class="code" href="message_8cpp.html#a08b840c377ca6f8154d6924d51338d89">NotifyFailSetConfDescr</a>();</div>
<div class="line"><a name="l00195"></a><span class="lineno"> 195</span>&#160; <span class="keywordflow">goto</span> Fail;</div>
<div class="line"><a name="l00196"></a><span class="lineno"> 196</span>&#160;FailUnknownDevice:</div>
<div class="line"><a name="l00197"></a><span class="lineno"> 197</span>&#160; <a class="code" href="message_8cpp.html#a7103129ed2b7b7896461c0a3cd924eb4">NotifyFailUnknownDevice</a>(VID,PID);</div>
<div class="line"><a name="l00198"></a><span class="lineno"> 198</span>&#160; rcode = <a class="code" href="_usb_8h.html#ae9e139d0fd29bb0b3e7afad2f76cd589">USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED</a>;</div>
<div class="line"><a name="l00199"></a><span class="lineno"> 199</span>&#160;</div>
<div class="line"><a name="l00200"></a><span class="lineno"> 200</span>&#160;Fail:</div>
<div class="line"><a name="l00201"></a><span class="lineno"> 201</span>&#160;<span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><a name="l00202"></a><span class="lineno"> 202</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a1e8693828152de8408add858dc461dea">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nXbox 360 Init Failed, error code: &quot;</span>), 0x80);</div>
<div class="line"><a name="l00203"></a><span class="lineno"> 203</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00204"></a><span class="lineno"> 204</span>&#160;<span class="preprocessor"></span> <a class="code" href="message_8cpp.html#a5ae2cb9bf877595104f2425f50e2057f">NotifyFail</a>(rcode);</div>
<div class="line"><a name="l00205"></a><span class="lineno"> 205</span>&#160; <a class="code" href="class_x_b_o_x_u_s_b.html#a9a296b98b40f5a36d46297d98ef0f9b5">Release</a>();</div>
<div class="line"><a name="l00206"></a><span class="lineno"> 206</span>&#160; <span class="keywordflow">return</span> rcode;</div>
<div class="line"><a name="l00207"></a><span class="lineno"> 207</span>&#160;}</div>
<div class="line"><a name="l00208"></a><span class="lineno"> 208</span>&#160;</div>
<div class="line"><a name="l00209"></a><span class="lineno"> 209</span>&#160;<span class="comment">/* Performs a cleanup after failed Init() attempt */</span></div>
<div class="line"><a name="l00210"></a><span class="lineno"><a class="code" href="class_x_b_o_x_u_s_b.html#a9a296b98b40f5a36d46297d98ef0f9b5"> 210</a></span>&#160;uint8_t <a class="code" href="class_x_b_o_x_u_s_b.html#a9a296b98b40f5a36d46297d98ef0f9b5">XBOXUSB::Release</a>() {</div>
<div class="line"><a name="l00211"></a><span class="lineno"> 211</span>&#160; <a class="code" href="class_x_b_o_x_u_s_b.html#a1c779ae5483a2f73426650242a37d868">Xbox360Connected</a> = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00212"></a><span class="lineno"> 212</span>&#160; <a class="code" href="class_x_b_o_x_u_s_b.html#a9c701658d4f63b5407cbcd5b78d8eb18">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a66ab8f5eda239e761d5a48741ea1f9d4">GetAddressPool</a>().<a class="code" href="class_address_pool.html#a15fde13223dcb1da89305ad229763562">FreeAddress</a>(<a class="code" href="class_x_b_o_x_u_s_b.html#a5e9c00af9f4b978c53819791b0a0eb65">bAddress</a>);</div>
<div class="line"><a name="l00213"></a><span class="lineno"> 213</span>&#160; <a class="code" href="class_x_b_o_x_u_s_b.html#a5e9c00af9f4b978c53819791b0a0eb65">bAddress</a> = 0;</div>
<div class="line"><a name="l00214"></a><span class="lineno"> 214</span>&#160; bPollEnable = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00215"></a><span class="lineno"> 215</span>&#160; <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00216"></a><span class="lineno"> 216</span>&#160;}</div>
<div class="line"><a name="l00217"></a><span class="lineno"> 217</span>&#160;</div>
<div class="line"><a name="l00218"></a><span class="lineno"><a class="code" href="class_x_b_o_x_u_s_b.html#a2f4684fe0785e50de434d95f4336fa12"> 218</a></span>&#160;uint8_t <a class="code" href="class_x_b_o_x_u_s_b.html#a2f4684fe0785e50de434d95f4336fa12">XBOXUSB::Poll</a>() {</div>
<div class="line"><a name="l00219"></a><span class="lineno"> 219</span>&#160; <span class="keywordflow">if</span> (!bPollEnable)</div>
<div class="line"><a name="l00220"></a><span class="lineno"> 220</span>&#160; <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00221"></a><span class="lineno"> 221</span>&#160; uint16_t BUFFER_SIZE = <a class="code" href="_p_s3_u_s_b_8h.html#abcb805b13bfd36145e252b0633bbcfc0">EP_MAXPKTSIZE</a>;</div>
<div class="line"><a name="l00222"></a><span class="lineno"> 222</span>&#160; <a class="code" href="class_x_b_o_x_u_s_b.html#a9c701658d4f63b5407cbcd5b78d8eb18">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#ad75d64f648b102fab2bd75e53e1324a4">inTransfer</a>(<a class="code" href="class_x_b_o_x_u_s_b.html#a5e9c00af9f4b978c53819791b0a0eb65">bAddress</a>, <a class="code" href="class_x_b_o_x_u_s_b.html#abef4a852d877d8136f198431ce54550f">epInfo</a>[ <a class="code" href="_x_b_o_x_u_s_b_8h.html#a4fd9ad9bf7a7d5767940c2ec224ef5e8">XBOX_INPUT_PIPE</a> ].epAddr, &amp;BUFFER_SIZE, readBuf); <span class="comment">// input on endpoint 1</span></div>
<div class="line"><a name="l00223"></a><span class="lineno"> 223</span>&#160; readReport();</div>
<div class="line"><a name="l00224"></a><span class="lineno"> 224</span>&#160;<span class="preprocessor">#ifdef PRINTREPORT</span></div>
<div class="line"><a name="l00225"></a><span class="lineno"> 225</span>&#160;<span class="preprocessor"></span> printReport(); <span class="comment">// Uncomment &quot;#define PRINTREPORT&quot; to print the report send by the Xbox 360 Controller</span></div>
<div class="line"><a name="l00226"></a><span class="lineno"> 226</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00227"></a><span class="lineno"> 227</span>&#160;<span class="preprocessor"></span> <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00228"></a><span class="lineno"> 228</span>&#160;}</div>
<div class="line"><a name="l00229"></a><span class="lineno"> 229</span>&#160;</div>
<div class="line"><a name="l00230"></a><span class="lineno"> 230</span>&#160;<span class="keywordtype">void</span> XBOXUSB::readReport() {</div>
<div class="line"><a name="l00231"></a><span class="lineno"> 231</span>&#160; <span class="keywordflow">if</span> (readBuf == NULL)</div>
<div class="line"><a name="l00232"></a><span class="lineno"> 232</span>&#160; <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00233"></a><span class="lineno"> 233</span>&#160; <span class="keywordflow">if</span> (readBuf[0] != 0x00 || readBuf[1] != 0x14) { <span class="comment">// Check if it&#39;s the correct report - the controller also sends different status reports</span></div>
<div class="line"><a name="l00234"></a><span class="lineno"> 234</span>&#160; <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00235"></a><span class="lineno"> 235</span>&#160; }</div>
<div class="line"><a name="l00236"></a><span class="lineno"> 236</span>&#160;</div>
<div class="line"><a name="l00237"></a><span class="lineno"> 237</span>&#160; ButtonState = (uint32_t)(readBuf[5] | ((uint16_t)readBuf[4] &lt;&lt; 8) | ((uint32_t)readBuf[3] &lt;&lt; 16) | ((uint32_t)readBuf[2] &lt;&lt; 24));</div>
<div class="line"><a name="l00238"></a><span class="lineno"> 238</span>&#160;</div>
<div class="line"><a name="l00239"></a><span class="lineno"> 239</span>&#160;<span class="keywordtype">void</span> XBOXUSB::readReport() { </div>
<div class="line"><a name="l00240"></a><span class="lineno"> 240</span>&#160; <span class="keywordflow">if</span> (readBuf == NULL)</div>
<div class="line"><a name="l00241"></a><span class="lineno"> 241</span>&#160; <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00242"></a><span class="lineno"> 242</span>&#160; <span class="keywordflow">if</span>(readBuf[0] != 0x00 || readBuf[1] != 0x14) { <span class="comment">// Check if it&#39;s the correct report - the controller also sends different status reports</span></div>
<div class="line"><a name="l00243"></a><span class="lineno"> 243</span>&#160; <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00244"></a><span class="lineno"> 244</span>&#160; }</div>
<div class="line"><a name="l00245"></a><span class="lineno"> 245</span>&#160;</div>
<div class="line"><a name="l00246"></a><span class="lineno"> 246</span>&#160; ButtonState = (uint32_t)(readBuf[5] | ((uint16_t)readBuf[4] &lt;&lt; 8) | ((uint32_t)readBuf[3] &lt;&lt; 16) | ((uint32_t)readBuf[2] &lt;&lt; 24));</div>
<div class="line"><a name="l00247"></a><span class="lineno"> 247</span>&#160; </div>
<div class="line"><a name="l00248"></a><span class="lineno"> 248</span>&#160; hatValue[<a class="code" href="controller_enums_8h.html#aaaabdefc068fd57ec2bef2b62ea4ba92a383cb8895dd296b7f69ce845ed16b0ca">LeftHatX</a>] = (int16_t)(((uint16_t)readBuf[7] &lt;&lt; 8) | readBuf[6]);</div>
<div class="line"><a name="l00249"></a><span class="lineno"> 249</span>&#160; hatValue[<a class="code" href="controller_enums_8h.html#aaaabdefc068fd57ec2bef2b62ea4ba92af3f3925efa9762c4e9e71ac7da7a94a3">LeftHatY</a>] = (int16_t)(((uint16_t)readBuf[9] &lt;&lt; 8) | readBuf[8]);</div>
<div class="line"><a name="l00250"></a><span class="lineno"> 250</span>&#160; hatValue[<a class="code" href="controller_enums_8h.html#aaaabdefc068fd57ec2bef2b62ea4ba92aaeb027a0ae5bbc6ba25e1c78a6486c7b">RightHatX</a>] = (int16_t)(((uint16_t)readBuf[11] &lt;&lt; 8) | readBuf[10]);</div>
<div class="line"><a name="l00251"></a><span class="lineno"> 251</span>&#160; hatValue[<a class="code" href="controller_enums_8h.html#aaaabdefc068fd57ec2bef2b62ea4ba92a7f1fb2db5381286691f4dec179ed5d5a">RightHatY</a>] = (int16_t)(((uint16_t)readBuf[13] &lt;&lt; 8) | readBuf[12]);</div>
<div class="line"><a name="l00252"></a><span class="lineno"> 252</span>&#160; </div>
<div class="line"><a name="l00253"></a><span class="lineno"> 253</span>&#160; <span class="comment">//Notify(PSTR(&quot;\r\nButtonState&quot;));</span></div>
<div class="line"><a name="l00254"></a><span class="lineno"> 254</span>&#160; <span class="comment">//PrintHex&lt;uint32_t&gt;(ButtonState);</span></div>
<div class="line"><a name="l00255"></a><span class="lineno"> 255</span>&#160; </div>
<div class="line"><a name="l00256"></a><span class="lineno"> 256</span>&#160; <span class="keywordflow">if</span>(ButtonState != OldButtonState) {</div>
<div class="line"><a name="l00257"></a><span class="lineno"> 257</span>&#160; ButtonClickState = (ButtonState &gt;&gt; 16) &amp; ((~OldButtonState) &gt;&gt; 16); <span class="comment">// Update click state variable, but don&#39;t include the two trigger buttons L2 and R2</span></div>
<div class="line"><a name="l00258"></a><span class="lineno"> 258</span>&#160; <span class="keywordflow">if</span>(((uint8_t)OldButtonState) == 0 &amp;&amp; ((uint8_t)ButtonState) != 0) <span class="comment">// The L2 and R2 buttons are special as they are analog buttons</span></div>
<div class="line"><a name="l00259"></a><span class="lineno"> 259</span>&#160; R2Clicked = <span class="keyword">true</span>;</div>
<div class="line"><a name="l00260"></a><span class="lineno"> 260</span>&#160; <span class="keywordflow">if</span>((uint8_t)(OldButtonState &gt;&gt; 8) == 0 &amp;&amp; (uint8_t)(ButtonState &gt;&gt; 8) != 0)</div>
<div class="line"><a name="l00261"></a><span class="lineno"> 261</span>&#160; L2Clicked = <span class="keyword">true</span>;</div>
<div class="line"><a name="l00262"></a><span class="lineno"> 262</span>&#160; OldButtonState = ButtonState;</div>
<div class="line"><a name="l00263"></a><span class="lineno"> 263</span>&#160; }</div>
<div class="line"><a name="l00239"></a><span class="lineno"> 239</span>&#160; hatValue[<a class="code" href="controller_enums_8h.html#aaaabdefc068fd57ec2bef2b62ea4ba92a383cb8895dd296b7f69ce845ed16b0ca">LeftHatX</a>] = (int16_t)(((uint16_t)readBuf[7] &lt;&lt; 8) | readBuf[6]);</div>
<div class="line"><a name="l00240"></a><span class="lineno"> 240</span>&#160; hatValue[<a class="code" href="controller_enums_8h.html#aaaabdefc068fd57ec2bef2b62ea4ba92af3f3925efa9762c4e9e71ac7da7a94a3">LeftHatY</a>] = (int16_t)(((uint16_t)readBuf[9] &lt;&lt; 8) | readBuf[8]);</div>
<div class="line"><a name="l00241"></a><span class="lineno"> 241</span>&#160; hatValue[<a class="code" href="controller_enums_8h.html#aaaabdefc068fd57ec2bef2b62ea4ba92aaeb027a0ae5bbc6ba25e1c78a6486c7b">RightHatX</a>] = (int16_t)(((uint16_t)readBuf[11] &lt;&lt; 8) | readBuf[10]);</div>
<div class="line"><a name="l00242"></a><span class="lineno"> 242</span>&#160; hatValue[<a class="code" href="controller_enums_8h.html#aaaabdefc068fd57ec2bef2b62ea4ba92a7f1fb2db5381286691f4dec179ed5d5a">RightHatY</a>] = (int16_t)(((uint16_t)readBuf[13] &lt;&lt; 8) | readBuf[12]);</div>
<div class="line"><a name="l00243"></a><span class="lineno"> 243</span>&#160;</div>
<div class="line"><a name="l00244"></a><span class="lineno"> 244</span>&#160; <span class="comment">//Notify(PSTR(&quot;\r\nButtonState&quot;), 0x80);</span></div>
<div class="line"><a name="l00245"></a><span class="lineno"> 245</span>&#160; <span class="comment">//PrintHex&lt;uint32_t&gt;(ButtonState, 0x80);</span></div>
<div class="line"><a name="l00246"></a><span class="lineno"> 246</span>&#160;</div>
<div class="line"><a name="l00247"></a><span class="lineno"> 247</span>&#160; <span class="keywordflow">if</span> (ButtonState != OldButtonState) {</div>
<div class="line"><a name="l00248"></a><span class="lineno"> 248</span>&#160; ButtonClickState = (ButtonState &gt;&gt; 16) &amp; ((~OldButtonState) &gt;&gt; 16); <span class="comment">// Update click state variable, but don&#39;t include the two trigger buttons L2 and R2</span></div>
<div class="line"><a name="l00249"></a><span class="lineno"> 249</span>&#160; <span class="keywordflow">if</span> (((uint8_t)OldButtonState) == 0 &amp;&amp; ((uint8_t)ButtonState) != 0) <span class="comment">// The L2 and R2 buttons are special as they are analog buttons</span></div>
<div class="line"><a name="l00250"></a><span class="lineno"> 250</span>&#160; R2Clicked = <span class="keyword">true</span>;</div>
<div class="line"><a name="l00251"></a><span class="lineno"> 251</span>&#160; <span class="keywordflow">if</span> ((uint8_t)(OldButtonState &gt;&gt; 8) == 0 &amp;&amp; (uint8_t)(ButtonState &gt;&gt; 8) != 0)</div>
<div class="line"><a name="l00252"></a><span class="lineno"> 252</span>&#160; L2Clicked = <span class="keyword">true</span>;</div>
<div class="line"><a name="l00253"></a><span class="lineno"> 253</span>&#160; OldButtonState = ButtonState;</div>
<div class="line"><a name="l00254"></a><span class="lineno"> 254</span>&#160; }</div>
<div class="line"><a name="l00255"></a><span class="lineno"> 255</span>&#160;}</div>
<div class="line"><a name="l00256"></a><span class="lineno"> 256</span>&#160;</div>
<div class="line"><a name="l00257"></a><span class="lineno"> 257</span>&#160;<span class="keywordtype">void</span> XBOXUSB::printReport() { <span class="comment">//Uncomment &quot;#define PRINTREPORT&quot; to print the report send by the Xbox 360 Controller</span></div>
<div class="line"><a name="l00258"></a><span class="lineno"> 258</span>&#160;<span class="preprocessor">#ifdef PRINTREPORT</span></div>
<div class="line"><a name="l00259"></a><span class="lineno"> 259</span>&#160;<span class="preprocessor"></span> <span class="keywordflow">if</span> (readBuf == NULL)</div>
<div class="line"><a name="l00260"></a><span class="lineno"> 260</span>&#160; <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00261"></a><span class="lineno"> 261</span>&#160; <span class="keywordflow">for</span> (uint8_t i = 0; i &lt; <a class="code" href="_x_b_o_x_u_s_b_8h.html#aaa3e91675875fbf14a37369f9513874a">XBOX_REPORT_BUFFER_SIZE</a>; i++) {</div>
<div class="line"><a name="l00262"></a><span class="lineno"> 262</span>&#160; PrintHex&lt;uint8_t &gt; (readBuf[i], 0x80);</div>
<div class="line"><a name="l00263"></a><span class="lineno"> 263</span>&#160; Serial.print(<span class="stringliteral">&quot; &quot;</span>);</div>
<div class="line"><a name="l00264"></a><span class="lineno"> 264</span>&#160; }</div>
<div class="line"><a name="l00265"></a><span class="lineno"> 265</span>&#160;</div>
<div class="line"><a name="l00266"></a><span class="lineno"> 266</span>&#160;<span class="keywordtype">void</span> XBOXUSB::printReport() { <span class="comment">//Uncomment &quot;#define PRINTREPORT&quot; to print the report send by the Xbox 360 Controller</span></div>
<div class="line"><a name="l00267"></a><span class="lineno"> 267</span>&#160;<span class="preprocessor">#ifdef PRINTREPORT</span></div>
<div class="line"><a name="l00268"></a><span class="lineno"> 268</span>&#160;<span class="preprocessor"></span> <span class="keywordflow">if</span> (readBuf == NULL)</div>
<div class="line"><a name="l00269"></a><span class="lineno"> 269</span>&#160; <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00270"></a><span class="lineno"> 270</span>&#160; <span class="keywordflow">for</span>(uint8_t i = 0; i &lt; <a class="code" href="_x_b_o_x_u_s_b_8h.html#aaa3e91675875fbf14a37369f9513874a">XBOX_REPORT_BUFFER_SIZE</a>;i++) {</div>
<div class="line"><a name="l00271"></a><span class="lineno"> 271</span>&#160; PrintHex&lt;uint8_t&gt;(readBuf[i]);</div>
<div class="line"><a name="l00272"></a><span class="lineno"> 272</span>&#160; Serial.print(<span class="stringliteral">&quot; &quot;</span>);</div>
<div class="line"><a name="l00273"></a><span class="lineno"> 273</span>&#160; } </div>
<div class="line"><a name="l00274"></a><span class="lineno"> 274</span>&#160; Serial.println();</div>
<div class="line"><a name="l00275"></a><span class="lineno"> 275</span>&#160;<span class="preprocessor">#endif </span></div>
<div class="line"><a name="l00276"></a><span class="lineno"> 276</span>&#160;<span class="preprocessor"></span>}</div>
<div class="line"><a name="l00277"></a><span class="lineno"> 277</span>&#160;</div>
<div class="line"><a name="l00278"></a><span class="lineno"><a class="code" href="class_x_b_o_x_u_s_b.html#ae18ff481e9dd91658e5e45e7958e7775"> 278</a></span>&#160;uint8_t <a class="code" href="class_x_b_o_x_u_s_b.html#ae18ff481e9dd91658e5e45e7958e7775">XBOXUSB::getButtonPress</a>(<a class="code" href="controller_enums_8h.html#a03bfec859eac87be20f8952c1eb89de0">Button</a> b) {</div>
<div class="line"><a name="l00279"></a><span class="lineno"> 279</span>&#160; <span class="keywordflow">if</span>(b == <a class="code" href="controller_enums_8h.html#a03bfec859eac87be20f8952c1eb89de0a0adffb24dae0c41be5b803f4d444f066">L2</a>) <span class="comment">// These are analog buttons</span></div>
<div class="line"><a name="l00280"></a><span class="lineno"> 280</span>&#160; <span class="keywordflow">return</span> (uint8_t)(ButtonState &gt;&gt; 8);</div>
<div class="line"><a name="l00281"></a><span class="lineno"> 281</span>&#160; <span class="keywordflow">else</span> <span class="keywordflow">if</span>(b == <a class="code" href="controller_enums_8h.html#a03bfec859eac87be20f8952c1eb89de0a629d7b403cea5f826352f3aefb9a6d6a">R2</a>)</div>
<div class="line"><a name="l00282"></a><span class="lineno"> 282</span>&#160; <span class="keywordflow">return</span> (uint8_t)ButtonState;</div>
<div class="line"><a name="l00283"></a><span class="lineno"> 283</span>&#160; <span class="keywordflow">return</span> (ButtonState &amp; ((uint32_t)pgm_read_word(&amp;XBOXBUTTONS[(uint8_t)b]) &lt;&lt; 16));</div>
<div class="line"><a name="l00284"></a><span class="lineno"> 284</span>&#160;}</div>
<div class="line"><a name="l00285"></a><span class="lineno"><a class="code" href="class_x_b_o_x_u_s_b.html#ab85b8ce772b122f1b9df489c7e045635"> 285</a></span>&#160;<span class="keywordtype">bool</span> <a class="code" href="class_x_b_o_x_u_s_b.html#ab85b8ce772b122f1b9df489c7e045635">XBOXUSB::getButtonClick</a>(<a class="code" href="controller_enums_8h.html#a03bfec859eac87be20f8952c1eb89de0">Button</a> b) {</div>
<div class="line"><a name="l00286"></a><span class="lineno"> 286</span>&#160; <span class="keywordflow">if</span>(b == <a class="code" href="controller_enums_8h.html#a03bfec859eac87be20f8952c1eb89de0a0adffb24dae0c41be5b803f4d444f066">L2</a>) {</div>
<div class="line"><a name="l00287"></a><span class="lineno"> 287</span>&#160; <span class="keywordflow">if</span>(L2Clicked) {</div>
<div class="line"><a name="l00288"></a><span class="lineno"> 288</span>&#160; L2Clicked = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00289"></a><span class="lineno"> 289</span>&#160; <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00265"></a><span class="lineno"> 265</span>&#160; Serial.println();</div>
<div class="line"><a name="l00266"></a><span class="lineno"> 266</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00267"></a><span class="lineno"> 267</span>&#160;<span class="preprocessor"></span>}</div>
<div class="line"><a name="l00268"></a><span class="lineno"> 268</span>&#160;</div>
<div class="line"><a name="l00269"></a><span class="lineno"><a class="code" href="class_x_b_o_x_u_s_b.html#ae18ff481e9dd91658e5e45e7958e7775"> 269</a></span>&#160;uint8_t <a class="code" href="class_x_b_o_x_u_s_b.html#ae18ff481e9dd91658e5e45e7958e7775">XBOXUSB::getButtonPress</a>(<a class="code" href="controller_enums_8h.html#a03bfec859eac87be20f8952c1eb89de0">Button</a> b) {</div>
<div class="line"><a name="l00270"></a><span class="lineno"> 270</span>&#160; <span class="keywordflow">if</span> (b == <a class="code" href="controller_enums_8h.html#a03bfec859eac87be20f8952c1eb89de0a0adffb24dae0c41be5b803f4d444f066">L2</a>) <span class="comment">// These are analog buttons</span></div>
<div class="line"><a name="l00271"></a><span class="lineno"> 271</span>&#160; <span class="keywordflow">return</span> (uint8_t)(ButtonState &gt;&gt; 8);</div>
<div class="line"><a name="l00272"></a><span class="lineno"> 272</span>&#160; <span class="keywordflow">else</span> <span class="keywordflow">if</span> (b == <a class="code" href="controller_enums_8h.html#a03bfec859eac87be20f8952c1eb89de0a629d7b403cea5f826352f3aefb9a6d6a">R2</a>)</div>
<div class="line"><a name="l00273"></a><span class="lineno"> 273</span>&#160; <span class="keywordflow">return</span> (uint8_t)ButtonState;</div>
<div class="line"><a name="l00274"></a><span class="lineno"> 274</span>&#160; <span class="keywordflow">return</span> (ButtonState &amp; ((uint32_t)pgm_read_word(&amp;<a class="code" href="xbox_enums_8h.html#a7e55826e75b9b88578c8b0edaaf523d7">XBOXBUTTONS</a>[(uint8_t)b]) &lt;&lt; 16));</div>
<div class="line"><a name="l00275"></a><span class="lineno"> 275</span>&#160;}</div>
<div class="line"><a name="l00276"></a><span class="lineno"> 276</span>&#160;</div>
<div class="line"><a name="l00277"></a><span class="lineno"><a class="code" href="class_x_b_o_x_u_s_b.html#ab85b8ce772b122f1b9df489c7e045635"> 277</a></span>&#160;<span class="keywordtype">bool</span> <a class="code" href="class_x_b_o_x_u_s_b.html#ab85b8ce772b122f1b9df489c7e045635">XBOXUSB::getButtonClick</a>(<a class="code" href="controller_enums_8h.html#a03bfec859eac87be20f8952c1eb89de0">Button</a> b) {</div>
<div class="line"><a name="l00278"></a><span class="lineno"> 278</span>&#160; <span class="keywordflow">if</span> (b == <a class="code" href="controller_enums_8h.html#a03bfec859eac87be20f8952c1eb89de0a0adffb24dae0c41be5b803f4d444f066">L2</a>) {</div>
<div class="line"><a name="l00279"></a><span class="lineno"> 279</span>&#160; <span class="keywordflow">if</span> (L2Clicked) {</div>
<div class="line"><a name="l00280"></a><span class="lineno"> 280</span>&#160; L2Clicked = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00281"></a><span class="lineno"> 281</span>&#160; <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00282"></a><span class="lineno"> 282</span>&#160; }</div>
<div class="line"><a name="l00283"></a><span class="lineno"> 283</span>&#160; <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l00284"></a><span class="lineno"> 284</span>&#160; } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (b == <a class="code" href="controller_enums_8h.html#a03bfec859eac87be20f8952c1eb89de0a629d7b403cea5f826352f3aefb9a6d6a">R2</a>) {</div>
<div class="line"><a name="l00285"></a><span class="lineno"> 285</span>&#160; <span class="keywordflow">if</span> (R2Clicked) {</div>
<div class="line"><a name="l00286"></a><span class="lineno"> 286</span>&#160; R2Clicked = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00287"></a><span class="lineno"> 287</span>&#160; <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00288"></a><span class="lineno"> 288</span>&#160; }</div>
<div class="line"><a name="l00289"></a><span class="lineno"> 289</span>&#160; <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l00290"></a><span class="lineno"> 290</span>&#160; }</div>
<div class="line"><a name="l00291"></a><span class="lineno"> 291</span>&#160; <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l00292"></a><span class="lineno"> 292</span>&#160; }</div>
<div class="line"><a name="l00293"></a><span class="lineno"> 293</span>&#160; <span class="keywordflow">else</span> <span class="keywordflow">if</span>(b == <a class="code" href="controller_enums_8h.html#a03bfec859eac87be20f8952c1eb89de0a629d7b403cea5f826352f3aefb9a6d6a">R2</a>) {</div>
<div class="line"><a name="l00294"></a><span class="lineno"> 294</span>&#160; <span class="keywordflow">if</span>(R2Clicked) {</div>
<div class="line"><a name="l00295"></a><span class="lineno"> 295</span>&#160; R2Clicked = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00296"></a><span class="lineno"> 296</span>&#160; <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00297"></a><span class="lineno"> 297</span>&#160; }</div>
<div class="line"><a name="l00298"></a><span class="lineno"> 298</span>&#160; <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l00291"></a><span class="lineno"> 291</span>&#160; uint16_t button = pgm_read_word(&amp;<a class="code" href="xbox_enums_8h.html#a7e55826e75b9b88578c8b0edaaf523d7">XBOXBUTTONS</a>[(uint8_t)b]);</div>
<div class="line"><a name="l00292"></a><span class="lineno"> 292</span>&#160; <span class="keywordtype">bool</span> click = (ButtonClickState &amp; button);</div>
<div class="line"><a name="l00293"></a><span class="lineno"> 293</span>&#160; ButtonClickState &amp;= ~button; <span class="comment">// clear &quot;click&quot; event</span></div>
<div class="line"><a name="l00294"></a><span class="lineno"> 294</span>&#160; <span class="keywordflow">return</span> click;</div>
<div class="line"><a name="l00295"></a><span class="lineno"> 295</span>&#160;}</div>
<div class="line"><a name="l00296"></a><span class="lineno"> 296</span>&#160;</div>
<div class="line"><a name="l00297"></a><span class="lineno"><a class="code" href="class_x_b_o_x_u_s_b.html#a7fcef8741de99d56f3a4d7fad9f954ff"> 297</a></span>&#160;int16_t <a class="code" href="class_x_b_o_x_u_s_b.html#a7fcef8741de99d56f3a4d7fad9f954ff">XBOXUSB::getAnalogHat</a>(<a class="code" href="controller_enums_8h.html#aaaabdefc068fd57ec2bef2b62ea4ba92">AnalogHat</a> a) {</div>
<div class="line"><a name="l00298"></a><span class="lineno"> 298</span>&#160; <span class="keywordflow">return</span> hatValue[a];</div>
<div class="line"><a name="l00299"></a><span class="lineno"> 299</span>&#160;}</div>
<div class="line"><a name="l00300"></a><span class="lineno"> 300</span>&#160; uint16_t button = pgm_read_word(&amp;XBOXBUTTONS[(uint8_t)b]);</div>
<div class="line"><a name="l00301"></a><span class="lineno"> 301</span>&#160; <span class="keywordtype">bool</span> click = (ButtonClickState &amp; button);</div>
<div class="line"><a name="l00302"></a><span class="lineno"> 302</span>&#160; ButtonClickState &amp;= ~button; <span class="comment">// clear &quot;click&quot; event</span></div>
<div class="line"><a name="l00303"></a><span class="lineno"> 303</span>&#160; <span class="keywordflow">return</span> click;</div>
<div class="line"><a name="l00304"></a><span class="lineno"> 304</span>&#160;}</div>
<div class="line"><a name="l00305"></a><span class="lineno"><a class="code" href="class_x_b_o_x_u_s_b.html#a7fcef8741de99d56f3a4d7fad9f954ff"> 305</a></span>&#160;int16_t <a class="code" href="class_x_b_o_x_u_s_b.html#a7fcef8741de99d56f3a4d7fad9f954ff">XBOXUSB::getAnalogHat</a>(<a class="code" href="controller_enums_8h.html#aaaabdefc068fd57ec2bef2b62ea4ba92">AnalogHat</a> a) {</div>
<div class="line"><a name="l00306"></a><span class="lineno"> 306</span>&#160; <span class="keywordflow">return</span> hatValue[a];</div>
<div class="line"><a name="l00307"></a><span class="lineno"> 307</span>&#160;}</div>
<div class="line"><a name="l00308"></a><span class="lineno"> 308</span>&#160;</div>
<div class="line"><a name="l00309"></a><span class="lineno"> 309</span>&#160;<span class="comment">/* Xbox Controller commands */</span></div>
<div class="line"><a name="l00310"></a><span class="lineno"> 310</span>&#160;<span class="keywordtype">void</span> XBOXUSB::XboxCommand(uint8_t* data, uint16_t nbytes) {</div>
<div class="line"><a name="l00311"></a><span class="lineno"> 311</span>&#160; <span class="comment">//bmRequest = Host to device (0x00) | Class (0x20) | Interface (0x01) = 0x21, bRequest = Set Report (0x09), Report ID (0x00), Report Type (Output 0x02), interface (0x00), datalength, datalength, data)</span></div>
<div class="line"><a name="l00312"></a><span class="lineno"> 312</span>&#160; <a class="code" href="class_x_b_o_x_u_s_b.html#a9c701658d4f63b5407cbcd5b78d8eb18">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a636695a5c3d35cd6b9e31c54edfacd7c">ctrlReq</a>(<a class="code" href="class_x_b_o_x_u_s_b.html#a5e9c00af9f4b978c53819791b0a0eb65">bAddress</a>,<a class="code" href="class_x_b_o_x_u_s_b.html#abef4a852d877d8136f198431ce54550f">epInfo</a>[<a class="code" href="_x_b_o_x_r_e_c_v_8h.html#a8f4ee68cc0f05690f5f26104c7d9e490">XBOX_CONTROL_PIPE</a>].epAddr, <a class="code" href="_b_t_d_8h.html#a5bd4ea095da29635414952894bd527f5">bmREQ_HID_OUT</a>, <a class="code" href="_b_t_d_8h.html#aee05d40a014750b24a7e9967f6f389f4">HID_REQUEST_SET_REPORT</a>, 0x00, 0x02, 0x00, nbytes, nbytes, data, NULL);</div>
<div class="line"><a name="l00300"></a><span class="lineno"> 300</span>&#160;</div>
<div class="line"><a name="l00301"></a><span class="lineno"> 301</span>&#160;<span class="comment">/* Xbox Controller commands */</span></div>
<div class="line"><a name="l00302"></a><span class="lineno"> 302</span>&#160;<span class="keywordtype">void</span> XBOXUSB::XboxCommand(uint8_t* data, uint16_t nbytes) {</div>
<div class="line"><a name="l00303"></a><span class="lineno"> 303</span>&#160; <span class="comment">//bmRequest = Host to device (0x00) | Class (0x20) | Interface (0x01) = 0x21, bRequest = Set Report (0x09), Report ID (0x00), Report Type (Output 0x02), interface (0x00), datalength, datalength, data)</span></div>
<div class="line"><a name="l00304"></a><span class="lineno"> 304</span>&#160; <a class="code" href="class_x_b_o_x_u_s_b.html#a9c701658d4f63b5407cbcd5b78d8eb18">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a636695a5c3d35cd6b9e31c54edfacd7c">ctrlReq</a>(<a class="code" href="class_x_b_o_x_u_s_b.html#a5e9c00af9f4b978c53819791b0a0eb65">bAddress</a>, <a class="code" href="class_x_b_o_x_u_s_b.html#abef4a852d877d8136f198431ce54550f">epInfo</a>[<a class="code" href="_x_b_o_x_r_e_c_v_8h.html#a8f4ee68cc0f05690f5f26104c7d9e490">XBOX_CONTROL_PIPE</a>].epAddr, <a class="code" href="_b_t_d_8h.html#a5bd4ea095da29635414952894bd527f5">bmREQ_HID_OUT</a>, <a class="code" href="_b_t_d_8h.html#aee05d40a014750b24a7e9967f6f389f4">HID_REQUEST_SET_REPORT</a>, 0x00, 0x02, 0x00, nbytes, nbytes, data, NULL);</div>
<div class="line"><a name="l00305"></a><span class="lineno"> 305</span>&#160;}</div>
<div class="line"><a name="l00306"></a><span class="lineno"> 306</span>&#160;</div>
<div class="line"><a name="l00307"></a><span class="lineno"><a class="code" href="class_x_b_o_x_u_s_b.html#a2cb9786f22e69ec3db26d9a55f95e22e"> 307</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_x_b_o_x_u_s_b.html#a2cb9786f22e69ec3db26d9a55f95e22e">XBOXUSB::setLedRaw</a>(uint8_t value) {</div>
<div class="line"><a name="l00308"></a><span class="lineno"> 308</span>&#160; writeBuf[0] = 0x01;</div>
<div class="line"><a name="l00309"></a><span class="lineno"> 309</span>&#160; writeBuf[1] = 0x03;</div>
<div class="line"><a name="l00310"></a><span class="lineno"> 310</span>&#160; writeBuf[2] = value;</div>
<div class="line"><a name="l00311"></a><span class="lineno"> 311</span>&#160;</div>
<div class="line"><a name="l00312"></a><span class="lineno"> 312</span>&#160; XboxCommand(writeBuf, 3);</div>
<div class="line"><a name="l00313"></a><span class="lineno"> 313</span>&#160;}</div>
<div class="line"><a name="l00314"></a><span class="lineno"><a class="code" href="class_x_b_o_x_u_s_b.html#a2cb9786f22e69ec3db26d9a55f95e22e"> 314</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_x_b_o_x_u_s_b.html#a2cb9786f22e69ec3db26d9a55f95e22e">XBOXUSB::setLedRaw</a>(uint8_t value) {</div>
<div class="line"><a name="l00315"></a><span class="lineno"> 315</span>&#160; writeBuf[0] = 0x01;</div>
<div class="line"><a name="l00316"></a><span class="lineno"> 316</span>&#160; writeBuf[1] = 0x03;</div>
<div class="line"><a name="l00317"></a><span class="lineno"> 317</span>&#160; writeBuf[2] = value;</div>
<div class="line"><a name="l00318"></a><span class="lineno"> 318</span>&#160; </div>
<div class="line"><a name="l00319"></a><span class="lineno"> 319</span>&#160; XboxCommand(writeBuf, 3);</div>
<div class="line"><a name="l00320"></a><span class="lineno"> 320</span>&#160;}</div>
<div class="line"><a name="l00321"></a><span class="lineno"><a class="code" href="class_x_b_o_x_u_s_b.html#a2348a35d4302f0a76bbeb319e84349a1"> 321</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_x_b_o_x_u_s_b.html#a2348a35d4302f0a76bbeb319e84349a1">XBOXUSB::setLedOn</a>(<a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6">LED</a> led) {</div>
<div class="line"><a name="l00322"></a><span class="lineno"> 322</span>&#160; <span class="keywordflow">if</span>(led != <a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6ab1d5eac4b1dca480c8056eaea7663b7a">ALL</a>) <span class="comment">// All LEDs can&#39;t be on a the same time</span></div>
<div class="line"><a name="l00323"></a><span class="lineno"> 323</span>&#160; <a class="code" href="class_x_b_o_x_u_s_b.html#a2cb9786f22e69ec3db26d9a55f95e22e">setLedRaw</a>((pgm_read_byte(&amp;XBOXLEDS[(uint8_t)led]))+4);</div>
<div class="line"><a name="l00324"></a><span class="lineno"> 324</span>&#160;}</div>
<div class="line"><a name="l00325"></a><span class="lineno"><a class="code" href="class_x_b_o_x_u_s_b.html#acc52982e6105d029d1e0980367dc10f6"> 325</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_x_b_o_x_u_s_b.html#acc52982e6105d029d1e0980367dc10f6">XBOXUSB::setLedBlink</a>(<a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6">LED</a> led) {</div>
<div class="line"><a name="l00326"></a><span class="lineno"> 326</span>&#160; <a class="code" href="class_x_b_o_x_u_s_b.html#a2cb9786f22e69ec3db26d9a55f95e22e">setLedRaw</a>(pgm_read_byte(&amp;XBOXLEDS[(uint8_t)led]));</div>
<div class="line"><a name="l00327"></a><span class="lineno"> 327</span>&#160;}</div>
<div class="line"><a name="l00328"></a><span class="lineno"><a class="code" href="class_x_b_o_x_u_s_b.html#a7426adef803da704df7593858389926e"> 328</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_x_b_o_x_u_s_b.html#a7426adef803da704df7593858389926e">XBOXUSB::setLedMode</a>(<a class="code" href="xbox_enums_8h.html#a57effb96f46e458675a2653d4c543ca2">LEDMode</a> ledMode) { <span class="comment">// This function is used to do some speciel LED stuff the controller supports</span></div>
<div class="line"><a name="l00329"></a><span class="lineno"> 329</span>&#160; <a class="code" href="class_x_b_o_x_u_s_b.html#a2cb9786f22e69ec3db26d9a55f95e22e">setLedRaw</a>((uint8_t)ledMode);</div>
<div class="line"><a name="l00330"></a><span class="lineno"> 330</span>&#160;}</div>
<div class="line"><a name="l00331"></a><span class="lineno"><a class="code" href="class_x_b_o_x_u_s_b.html#ae70ae50ed8188a2bf8c25d0ee17f54d9"> 331</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_x_b_o_x_u_s_b.html#ae70ae50ed8188a2bf8c25d0ee17f54d9">XBOXUSB::setRumbleOn</a>(uint8_t lValue, uint8_t rValue) {</div>
<div class="line"><a name="l00332"></a><span class="lineno"> 332</span>&#160; writeBuf[0] = 0x00;</div>
<div class="line"><a name="l00333"></a><span class="lineno"> 333</span>&#160; writeBuf[1] = 0x08;</div>
<div class="line"><a name="l00334"></a><span class="lineno"> 334</span>&#160; writeBuf[2] = 0x00;</div>
<div class="line"><a name="l00335"></a><span class="lineno"> 335</span>&#160; writeBuf[3] = lValue; <span class="comment">// big weight</span></div>
<div class="line"><a name="l00336"></a><span class="lineno"> 336</span>&#160; writeBuf[4] = rValue; <span class="comment">// small weight</span></div>
<div class="line"><a name="l00337"></a><span class="lineno"> 337</span>&#160; writeBuf[5] = 0x00;</div>
<div class="line"><a name="l00338"></a><span class="lineno"> 338</span>&#160; writeBuf[6] = 0x00;</div>
<div class="line"><a name="l00339"></a><span class="lineno"> 339</span>&#160; writeBuf[7] = 0x00;</div>
<div class="line"><a name="l00340"></a><span class="lineno"> 340</span>&#160; </div>
<div class="line"><a name="l00341"></a><span class="lineno"> 341</span>&#160; XboxCommand(writeBuf, 8);</div>
<div class="line"><a name="l00342"></a><span class="lineno"> 342</span>&#160;}</div>
<div class="line"><a name="l00314"></a><span class="lineno"> 314</span>&#160;</div>
<div class="line"><a name="l00315"></a><span class="lineno"><a class="code" href="class_x_b_o_x_u_s_b.html#a2348a35d4302f0a76bbeb319e84349a1"> 315</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_x_b_o_x_u_s_b.html#a2348a35d4302f0a76bbeb319e84349a1">XBOXUSB::setLedOn</a>(<a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6">LED</a> led) {</div>
<div class="line"><a name="l00316"></a><span class="lineno"> 316</span>&#160; <span class="keywordflow">if</span> (led != <a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6ab1d5eac4b1dca480c8056eaea7663b7a">ALL</a>) <span class="comment">// All LEDs can&#39;t be on a the same time</span></div>
<div class="line"><a name="l00317"></a><span class="lineno"> 317</span>&#160; <a class="code" href="class_x_b_o_x_u_s_b.html#a2cb9786f22e69ec3db26d9a55f95e22e">setLedRaw</a>((pgm_read_byte(&amp;<a class="code" href="xbox_enums_8h.html#a867f3bf7a14d4647290f1ac7f76b23ee">XBOXLEDS</a>[(uint8_t)led])) + 4);</div>
<div class="line"><a name="l00318"></a><span class="lineno"> 318</span>&#160;}</div>
<div class="line"><a name="l00319"></a><span class="lineno"> 319</span>&#160;</div>
<div class="line"><a name="l00320"></a><span class="lineno"><a class="code" href="class_x_b_o_x_u_s_b.html#acc52982e6105d029d1e0980367dc10f6"> 320</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_x_b_o_x_u_s_b.html#acc52982e6105d029d1e0980367dc10f6">XBOXUSB::setLedBlink</a>(<a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6">LED</a> led) {</div>
<div class="line"><a name="l00321"></a><span class="lineno"> 321</span>&#160; <a class="code" href="class_x_b_o_x_u_s_b.html#a2cb9786f22e69ec3db26d9a55f95e22e">setLedRaw</a>(pgm_read_byte(&amp;<a class="code" href="xbox_enums_8h.html#a867f3bf7a14d4647290f1ac7f76b23ee">XBOXLEDS</a>[(uint8_t)led]));</div>
<div class="line"><a name="l00322"></a><span class="lineno"> 322</span>&#160;}</div>
<div class="line"><a name="l00323"></a><span class="lineno"> 323</span>&#160;</div>
<div class="line"><a name="l00324"></a><span class="lineno"><a class="code" href="class_x_b_o_x_u_s_b.html#a7426adef803da704df7593858389926e"> 324</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_x_b_o_x_u_s_b.html#a7426adef803da704df7593858389926e">XBOXUSB::setLedMode</a>(<a class="code" href="xbox_enums_8h.html#a57effb96f46e458675a2653d4c543ca2">LEDMode</a> ledMode) { <span class="comment">// This function is used to do some speciel LED stuff the controller supports</span></div>
<div class="line"><a name="l00325"></a><span class="lineno"> 325</span>&#160; <a class="code" href="class_x_b_o_x_u_s_b.html#a2cb9786f22e69ec3db26d9a55f95e22e">setLedRaw</a>((uint8_t)ledMode);</div>
<div class="line"><a name="l00326"></a><span class="lineno"> 326</span>&#160;}</div>
<div class="line"><a name="l00327"></a><span class="lineno"> 327</span>&#160;</div>
<div class="line"><a name="l00328"></a><span class="lineno"><a class="code" href="class_x_b_o_x_u_s_b.html#ae70ae50ed8188a2bf8c25d0ee17f54d9"> 328</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_x_b_o_x_u_s_b.html#ae70ae50ed8188a2bf8c25d0ee17f54d9">XBOXUSB::setRumbleOn</a>(uint8_t lValue, uint8_t rValue) {</div>
<div class="line"><a name="l00329"></a><span class="lineno"> 329</span>&#160; writeBuf[0] = 0x00;</div>
<div class="line"><a name="l00330"></a><span class="lineno"> 330</span>&#160; writeBuf[1] = 0x08;</div>
<div class="line"><a name="l00331"></a><span class="lineno"> 331</span>&#160; writeBuf[2] = 0x00;</div>
<div class="line"><a name="l00332"></a><span class="lineno"> 332</span>&#160; writeBuf[3] = lValue; <span class="comment">// big weight</span></div>
<div class="line"><a name="l00333"></a><span class="lineno"> 333</span>&#160; writeBuf[4] = rValue; <span class="comment">// small weight</span></div>
<div class="line"><a name="l00334"></a><span class="lineno"> 334</span>&#160; writeBuf[5] = 0x00;</div>
<div class="line"><a name="l00335"></a><span class="lineno"> 335</span>&#160; writeBuf[6] = 0x00;</div>
<div class="line"><a name="l00336"></a><span class="lineno"> 336</span>&#160; writeBuf[7] = 0x00;</div>
<div class="line"><a name="l00337"></a><span class="lineno"> 337</span>&#160;</div>
<div class="line"><a name="l00338"></a><span class="lineno"> 338</span>&#160; XboxCommand(writeBuf, 8);</div>
<div class="line"><a name="l00339"></a><span class="lineno"> 339</span>&#160;}</div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>

View file

@ -100,7 +100,7 @@ Include dependency graph for XBOXUSB.h:</div>
<div class="dyncontent">
<div class="center"><img src="_x_b_o_x_u_s_b_8h__incl.png" border="0" usemap="#_x_b_o_x_u_s_b_8h" alt=""/></div>
<map name="_x_b_o_x_u_s_b_8h" id="_x_b_o_x_u_s_b_8h">
<area shape="rect" id="node3" href="_usb_8h.html" title="Usb.h" alt="" coords="397,75,440,96"/><area shape="rect" id="node17" href="xbox_enums_8h.html" title="xboxEnums.h" alt="" coords="798,75,868,96"/><area shape="rect" id="node6" href="avrpins_8h.html" title="avrpins.h" alt="" coords="528,213,582,235"/><area shape="rect" id="node8" href="max3421e_8h.html" title="max3421e.h" alt="" coords="146,213,213,235"/><area shape="rect" id="node9" href="usbhost_8h.html" title="usbhost.h" alt="" coords="212,144,269,165"/><area shape="rect" id="node10" href="usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="237,213,296,235"/><area shape="rect" id="node11" href="address_8h.html" title="address.h" alt="" coords="79,144,136,165"/><area shape="rect" id="node13" href="printhex_8h.html" title="printhex.h" alt="" coords="608,213,665,235"/><area shape="rect" id="node14" href="hexdump_8h.html" title="hexdump.h" alt="" coords="430,144,492,165"/><area shape="rect" id="node16" href="message_8h.html" title="message.h" alt="" coords="345,144,406,165"/><area shape="rect" id="node18" href="controller_enums_8h.html" title="controllerEnums.h" alt="" coords="794,144,880,165"/></map>
<area shape="rect" id="node3" href="_usb_8h.html" title="Usb.h" alt="" coords="449,75,492,96"/><area shape="rect" id="node17" href="xbox_enums_8h.html" title="xboxEnums.h" alt="" coords="653,75,723,96"/><area shape="rect" id="node6" href="avrpins_8h.html" title="avrpins.h" alt="" coords="474,213,528,235"/><area shape="rect" id="node8" href="max3421e_8h.html" title="max3421e.h" alt="" coords="553,213,620,235"/><area shape="rect" id="node9" href="usbhost_8h.html" title="usbhost.h" alt="" coords="442,144,499,165"/><area shape="rect" id="node10" href="usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="391,213,449,235"/><area shape="rect" id="node11" href="address_8h.html" title="address.h" alt="" coords="701,144,757,165"/><area shape="rect" id="node13" href="message_8h.html" title="message.h" alt="" coords="204,144,265,165"/><area shape="rect" id="node15" href="printhex_8h.html" title="printhex.h" alt="" coords="71,213,128,235"/><area shape="rect" id="node16" href="hexdump_8h.html" title="hexdump.h" alt="" coords="204,213,265,235"/><area shape="rect" id="node18" href="controller_enums_8h.html" title="controllerEnums.h" alt="" coords="782,144,868,165"/></map>
</div>
</div><div class="textblock"><div class="dynheader">
This graph shows which files directly or indirectly include this file:</div>

View file

@ -1,13 +1,13 @@
<map id="XBOXUSB.h" name="XBOXUSB.h">
<area shape="rect" id="node3" href="$_usb_8h.html" title="Usb.h" alt="" coords="397,75,440,96"/>
<area shape="rect" id="node17" href="$xbox_enums_8h.html" title="xboxEnums.h" alt="" coords="798,75,868,96"/>
<area shape="rect" id="node6" href="$avrpins_8h.html" title="avrpins.h" alt="" coords="528,213,582,235"/>
<area shape="rect" id="node8" href="$max3421e_8h.html" title="max3421e.h" alt="" coords="146,213,213,235"/>
<area shape="rect" id="node9" href="$usbhost_8h.html" title="usbhost.h" alt="" coords="212,144,269,165"/>
<area shape="rect" id="node10" href="$usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="237,213,296,235"/>
<area shape="rect" id="node11" href="$address_8h.html" title="address.h" alt="" coords="79,144,136,165"/>
<area shape="rect" id="node13" href="$printhex_8h.html" title="printhex.h" alt="" coords="608,213,665,235"/>
<area shape="rect" id="node14" href="$hexdump_8h.html" title="hexdump.h" alt="" coords="430,144,492,165"/>
<area shape="rect" id="node16" href="$message_8h.html" title="message.h" alt="" coords="345,144,406,165"/>
<area shape="rect" id="node18" href="$controller_enums_8h.html" title="controllerEnums.h" alt="" coords="794,144,880,165"/>
<area shape="rect" id="node3" href="$_usb_8h.html" title="Usb.h" alt="" coords="449,75,492,96"/>
<area shape="rect" id="node17" href="$xbox_enums_8h.html" title="xboxEnums.h" alt="" coords="653,75,723,96"/>
<area shape="rect" id="node6" href="$avrpins_8h.html" title="avrpins.h" alt="" coords="474,213,528,235"/>
<area shape="rect" id="node8" href="$max3421e_8h.html" title="max3421e.h" alt="" coords="553,213,620,235"/>
<area shape="rect" id="node9" href="$usbhost_8h.html" title="usbhost.h" alt="" coords="442,144,499,165"/>
<area shape="rect" id="node10" href="$usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="391,213,449,235"/>
<area shape="rect" id="node11" href="$address_8h.html" title="address.h" alt="" coords="701,144,757,165"/>
<area shape="rect" id="node13" href="$message_8h.html" title="message.h" alt="" coords="204,144,265,165"/>
<area shape="rect" id="node15" href="$printhex_8h.html" title="printhex.h" alt="" coords="71,213,128,235"/>
<area shape="rect" id="node16" href="$hexdump_8h.html" title="hexdump.h" alt="" coords="204,213,265,235"/>
<area shape="rect" id="node18" href="$controller_enums_8h.html" title="controllerEnums.h" alt="" coords="782,144,868,165"/>
</map>

View file

@ -1 +1 @@
acdb454213bd6a2a1c611203a1473383
1c6119f96994343efe9cd25fa3e34665

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 51 KiB

View file

@ -153,50 +153,65 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span>&#160; <span class="keyword">virtual</span> uint8_t <a class="code" href="class_x_b_o_x_u_s_b.html#a9d2ad06354787bc252058bb28015b56e">Init</a>(uint8_t parent, uint8_t port, <span class="keywordtype">bool</span> lowspeed);</div>
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>&#160; <span class="keyword">virtual</span> uint8_t <a class="code" href="class_x_b_o_x_u_s_b.html#a9a296b98b40f5a36d46297d98ef0f9b5">Release</a>();</div>
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span>&#160; <span class="keyword">virtual</span> uint8_t <a class="code" href="class_x_b_o_x_u_s_b.html#a2f4684fe0785e50de434d95f4336fa12">Poll</a>();</div>
<div class="line"><a name="l00090"></a><span class="lineno"><a class="code" href="class_x_b_o_x_u_s_b.html#a42c870e64582980634423248d64500b4"> 90</a></span>&#160; <span class="keyword">virtual</span> uint8_t <a class="code" href="class_x_b_o_x_u_s_b.html#a42c870e64582980634423248d64500b4">GetAddress</a>() { <span class="keywordflow">return</span> <a class="code" href="class_x_b_o_x_u_s_b.html#a5e9c00af9f4b978c53819791b0a0eb65">bAddress</a>; };</div>
<div class="line"><a name="l00095"></a><span class="lineno"><a class="code" href="class_x_b_o_x_u_s_b.html#ac2507bfe85896b7fcc772894a7a9f272"> 95</a></span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="class_x_b_o_x_u_s_b.html#ac2507bfe85896b7fcc772894a7a9f272">isReady</a>() { <span class="keywordflow">return</span> bPollEnable; };</div>
<div class="line"><a name="l00110"></a><span class="lineno"> 110</span>&#160; uint8_t <a class="code" href="class_x_b_o_x_u_s_b.html#ae18ff481e9dd91658e5e45e7958e7775">getButtonPress</a>(<a class="code" href="controller_enums_8h.html#a03bfec859eac87be20f8952c1eb89de0">Button</a> b);</div>
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_x_b_o_x_u_s_b.html#ab85b8ce772b122f1b9df489c7e045635">getButtonClick</a>(<a class="code" href="controller_enums_8h.html#a03bfec859eac87be20f8952c1eb89de0">Button</a> b);</div>
<div class="line"><a name="l00120"></a><span class="lineno"> 120</span>&#160; int16_t <a class="code" href="class_x_b_o_x_u_s_b.html#a7fcef8741de99d56f3a4d7fad9f954ff">getAnalogHat</a>(<a class="code" href="controller_enums_8h.html#aaaabdefc068fd57ec2bef2b62ea4ba92">AnalogHat</a> a);</div>
<div class="line"><a name="l00121"></a><span class="lineno"> 121</span>&#160; </div>
<div class="line"><a name="l00123"></a><span class="lineno"><a class="code" href="class_x_b_o_x_u_s_b.html#a6200dc185ecb6e0d3ffdb2a9ecf49c40"> 123</a></span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_x_b_o_x_u_s_b.html#a6200dc185ecb6e0d3ffdb2a9ecf49c40">setAllOff</a>() { <a class="code" href="class_x_b_o_x_u_s_b.html#ae70ae50ed8188a2bf8c25d0ee17f54d9">setRumbleOn</a>(0,0); <a class="code" href="class_x_b_o_x_u_s_b.html#a2cb9786f22e69ec3db26d9a55f95e22e">setLedRaw</a>(0); };</div>
<div class="line"><a name="l00125"></a><span class="lineno"><a class="code" href="class_x_b_o_x_u_s_b.html#a5d9ac92da5086409ad864484bdf95871"> 125</a></span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_x_b_o_x_u_s_b.html#a5d9ac92da5086409ad864484bdf95871">setRumbleOff</a>() { <a class="code" href="class_x_b_o_x_u_s_b.html#ae70ae50ed8188a2bf8c25d0ee17f54d9">setRumbleOn</a>(0,0); };</div>
<div class="line"><a name="l00131"></a><span class="lineno"> 131</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_x_b_o_x_u_s_b.html#ae70ae50ed8188a2bf8c25d0ee17f54d9">setRumbleOn</a>(uint8_t lValue, uint8_t rValue);</div>
<div class="line"><a name="l00138"></a><span class="lineno"> 138</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_x_b_o_x_u_s_b.html#a2cb9786f22e69ec3db26d9a55f95e22e">setLedRaw</a>(uint8_t value);</div>
<div class="line"><a name="l00140"></a><span class="lineno"><a class="code" href="class_x_b_o_x_u_s_b.html#a155637a4ef946f19c7ee40c0fc1c6b98"> 140</a></span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_x_b_o_x_u_s_b.html#a155637a4ef946f19c7ee40c0fc1c6b98">setLedOff</a>() { <a class="code" href="class_x_b_o_x_u_s_b.html#a2cb9786f22e69ec3db26d9a55f95e22e">setLedRaw</a>(0); };</div>
<div class="line"><a name="l00145"></a><span class="lineno"> 145</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_x_b_o_x_u_s_b.html#a2348a35d4302f0a76bbeb319e84349a1">setLedOn</a>(<a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6">LED</a> l);</div>
<div class="line"><a name="l00150"></a><span class="lineno"> 150</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_x_b_o_x_u_s_b.html#acc52982e6105d029d1e0980367dc10f6">setLedBlink</a>(<a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6">LED</a> l);</div>
<div class="line"><a name="l00156"></a><span class="lineno"> 156</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_x_b_o_x_u_s_b.html#a7426adef803da704df7593858389926e">setLedMode</a>(<a class="code" href="xbox_enums_8h.html#a57effb96f46e458675a2653d4c543ca2">LEDMode</a> lm);</div>
<div class="line"><a name="l00160"></a><span class="lineno"><a class="code" href="class_x_b_o_x_u_s_b.html#a1c779ae5483a2f73426650242a37d868"> 160</a></span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_x_b_o_x_u_s_b.html#a1c779ae5483a2f73426650242a37d868">Xbox360Connected</a>;</div>
<div class="line"><a name="l00161"></a><span class="lineno"> 161</span>&#160; </div>
<div class="line"><a name="l00162"></a><span class="lineno"> 162</span>&#160;<span class="keyword">protected</span>: </div>
<div class="line"><a name="l00164"></a><span class="lineno"><a class="code" href="class_x_b_o_x_u_s_b.html#a9c701658d4f63b5407cbcd5b78d8eb18"> 164</a></span>&#160; <a class="code" href="class_u_s_b.html">USB</a> *<a class="code" href="class_x_b_o_x_u_s_b.html#a9c701658d4f63b5407cbcd5b78d8eb18">pUsb</a>;</div>
<div class="line"><a name="l00166"></a><span class="lineno"><a class="code" href="class_x_b_o_x_u_s_b.html#a5e9c00af9f4b978c53819791b0a0eb65"> 166</a></span>&#160; uint8_t <a class="code" href="class_x_b_o_x_u_s_b.html#a5e9c00af9f4b978c53819791b0a0eb65">bAddress</a>;</div>
<div class="line"><a name="l00168"></a><span class="lineno"><a class="code" href="class_x_b_o_x_u_s_b.html#abef4a852d877d8136f198431ce54550f"> 168</a></span>&#160; <a class="code" href="struct_ep_info.html">EpInfo</a> <a class="code" href="class_x_b_o_x_u_s_b.html#abef4a852d877d8136f198431ce54550f">epInfo</a>[<a class="code" href="_x_b_o_x_u_s_b_8h.html#af35f872fc33e690571eb99de648e8e96">XBOX_MAX_ENDPOINTS</a>];</div>
<div class="line"><a name="l00169"></a><span class="lineno"> 169</span>&#160; </div>
<div class="line"><a name="l00170"></a><span class="lineno"> 170</span>&#160;<span class="keyword">private</span>: </div>
<div class="line"><a name="l00171"></a><span class="lineno"> 171</span>&#160; <span class="keywordtype">bool</span> bPollEnable;</div>
<div class="line"><a name="l00172"></a><span class="lineno"> 172</span>&#160;</div>
<div class="line"><a name="l00173"></a><span class="lineno"> 173</span>&#160; <span class="comment">/* Variables to store the buttons */</span></div>
<div class="line"><a name="l00174"></a><span class="lineno"> 174</span>&#160; uint32_t ButtonState;</div>
<div class="line"><a name="l00175"></a><span class="lineno"> 175</span>&#160; uint32_t OldButtonState;</div>
<div class="line"><a name="l00176"></a><span class="lineno"> 176</span>&#160; uint16_t ButtonClickState;</div>
<div class="line"><a name="l00177"></a><span class="lineno"> 177</span>&#160; int16_t hatValue[4];</div>
<div class="line"><a name="l00178"></a><span class="lineno"> 178</span>&#160; uint16_t controllerStatus;</div>
<div class="line"><a name="l00179"></a><span class="lineno"> 179</span>&#160; </div>
<div class="line"><a name="l00180"></a><span class="lineno"> 180</span>&#160; <span class="keywordtype">bool</span> L2Clicked; <span class="comment">// These buttons are analog, so we use we use these bools to check if they where clicked or not</span></div>
<div class="line"><a name="l00181"></a><span class="lineno"> 181</span>&#160; <span class="keywordtype">bool</span> R2Clicked;</div>
<div class="line"><a name="l00182"></a><span class="lineno"> 182</span>&#160; </div>
<div class="line"><a name="l00183"></a><span class="lineno"> 183</span>&#160; uint8_t readBuf[<a class="code" href="_x_b_o_x_u_s_b_8h.html#abcb805b13bfd36145e252b0633bbcfc0">EP_MAXPKTSIZE</a>]; <span class="comment">// General purpose buffer for input data</span></div>
<div class="line"><a name="l00184"></a><span class="lineno"> 184</span>&#160; uint8_t writeBuf[<a class="code" href="_x_b_o_x_u_s_b_8h.html#abcb805b13bfd36145e252b0633bbcfc0">EP_MAXPKTSIZE</a>]; <span class="comment">// General purpose buffer for output data</span></div>
<div class="line"><a name="l00185"></a><span class="lineno"> 185</span>&#160; </div>
<div class="line"><a name="l00186"></a><span class="lineno"> 186</span>&#160; <span class="keywordtype">void</span> readReport(); <span class="comment">// read incoming data</span></div>
<div class="line"><a name="l00187"></a><span class="lineno"> 187</span>&#160; <span class="keywordtype">void</span> printReport(); <span class="comment">// print incoming date - Uncomment for debugging</span></div>
<div class="line"><a name="l00188"></a><span class="lineno"> 188</span>&#160; </div>
<div class="line"><a name="l00189"></a><span class="lineno"> 189</span>&#160; <span class="comment">/* Private commands */</span></div>
<div class="line"><a name="l00190"></a><span class="lineno"> 190</span>&#160; <span class="keywordtype">void</span> XboxCommand(uint8_t* data, uint16_t nbytes);</div>
<div class="line"><a name="l00191"></a><span class="lineno"> 191</span>&#160;};</div>
<div class="line"><a name="l00192"></a><span class="lineno"> 192</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span>&#160;</div>
<div class="line"><a name="l00091"></a><span class="lineno"><a class="code" href="class_x_b_o_x_u_s_b.html#a42c870e64582980634423248d64500b4"> 91</a></span>&#160; <span class="keyword">virtual</span> uint8_t <a class="code" href="class_x_b_o_x_u_s_b.html#a42c870e64582980634423248d64500b4">GetAddress</a>() {</div>
<div class="line"><a name="l00092"></a><span class="lineno"> 92</span>&#160; <span class="keywordflow">return</span> <a class="code" href="class_x_b_o_x_u_s_b.html#a5e9c00af9f4b978c53819791b0a0eb65">bAddress</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;</div>
<div class="line"><a name="l00099"></a><span class="lineno"><a class="code" href="class_x_b_o_x_u_s_b.html#ac2507bfe85896b7fcc772894a7a9f272"> 99</a></span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="class_x_b_o_x_u_s_b.html#ac2507bfe85896b7fcc772894a7a9f272">isReady</a>() {</div>
<div class="line"><a name="l00100"></a><span class="lineno"> 100</span>&#160; <span class="keywordflow">return</span> bPollEnable;</div>
<div class="line"><a name="l00101"></a><span class="lineno"> 101</span>&#160; };</div>
<div class="line"><a name="l00116"></a><span class="lineno"> 116</span>&#160; uint8_t <a class="code" href="class_x_b_o_x_u_s_b.html#ae18ff481e9dd91658e5e45e7958e7775">getButtonPress</a>(<a class="code" href="controller_enums_8h.html#a03bfec859eac87be20f8952c1eb89de0">Button</a> b);</div>
<div class="line"><a name="l00117"></a><span class="lineno"> 117</span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_x_b_o_x_u_s_b.html#ab85b8ce772b122f1b9df489c7e045635">getButtonClick</a>(<a class="code" href="controller_enums_8h.html#a03bfec859eac87be20f8952c1eb89de0">Button</a> b);</div>
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span>&#160; int16_t <a class="code" href="class_x_b_o_x_u_s_b.html#a7fcef8741de99d56f3a4d7fad9f954ff">getAnalogHat</a>(<a class="code" href="controller_enums_8h.html#aaaabdefc068fd57ec2bef2b62ea4ba92">AnalogHat</a> a);</div>
<div class="line"><a name="l00127"></a><span class="lineno"> 127</span>&#160;</div>
<div class="line"><a name="l00129"></a><span class="lineno"><a class="code" href="class_x_b_o_x_u_s_b.html#a6200dc185ecb6e0d3ffdb2a9ecf49c40"> 129</a></span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_x_b_o_x_u_s_b.html#a6200dc185ecb6e0d3ffdb2a9ecf49c40">setAllOff</a>() {</div>
<div class="line"><a name="l00130"></a><span class="lineno"> 130</span>&#160; <a class="code" href="class_x_b_o_x_u_s_b.html#ae70ae50ed8188a2bf8c25d0ee17f54d9">setRumbleOn</a>(0, 0);</div>
<div class="line"><a name="l00131"></a><span class="lineno"> 131</span>&#160; <a class="code" href="class_x_b_o_x_u_s_b.html#a2cb9786f22e69ec3db26d9a55f95e22e">setLedRaw</a>(0);</div>
<div class="line"><a name="l00132"></a><span class="lineno"> 132</span>&#160; };</div>
<div class="line"><a name="l00133"></a><span class="lineno"> 133</span>&#160;</div>
<div class="line"><a name="l00135"></a><span class="lineno"><a class="code" href="class_x_b_o_x_u_s_b.html#a5d9ac92da5086409ad864484bdf95871"> 135</a></span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_x_b_o_x_u_s_b.html#a5d9ac92da5086409ad864484bdf95871">setRumbleOff</a>() {</div>
<div class="line"><a name="l00136"></a><span class="lineno"> 136</span>&#160; <a class="code" href="class_x_b_o_x_u_s_b.html#ae70ae50ed8188a2bf8c25d0ee17f54d9">setRumbleOn</a>(0, 0);</div>
<div class="line"><a name="l00137"></a><span class="lineno"> 137</span>&#160; };</div>
<div class="line"><a name="l00143"></a><span class="lineno"> 143</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_x_b_o_x_u_s_b.html#ae70ae50ed8188a2bf8c25d0ee17f54d9">setRumbleOn</a>(uint8_t lValue, uint8_t rValue);</div>
<div class="line"><a name="l00150"></a><span class="lineno"> 150</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_x_b_o_x_u_s_b.html#a2cb9786f22e69ec3db26d9a55f95e22e">setLedRaw</a>(uint8_t value);</div>
<div class="line"><a name="l00151"></a><span class="lineno"> 151</span>&#160;</div>
<div class="line"><a name="l00153"></a><span class="lineno"><a class="code" href="class_x_b_o_x_u_s_b.html#a155637a4ef946f19c7ee40c0fc1c6b98"> 153</a></span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_x_b_o_x_u_s_b.html#a155637a4ef946f19c7ee40c0fc1c6b98">setLedOff</a>() {</div>
<div class="line"><a name="l00154"></a><span class="lineno"> 154</span>&#160; <a class="code" href="class_x_b_o_x_u_s_b.html#a2cb9786f22e69ec3db26d9a55f95e22e">setLedRaw</a>(0);</div>
<div class="line"><a name="l00155"></a><span class="lineno"> 155</span>&#160; };</div>
<div class="line"><a name="l00160"></a><span class="lineno"> 160</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_x_b_o_x_u_s_b.html#a2348a35d4302f0a76bbeb319e84349a1">setLedOn</a>(<a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6">LED</a> l);</div>
<div class="line"><a name="l00165"></a><span class="lineno"> 165</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_x_b_o_x_u_s_b.html#acc52982e6105d029d1e0980367dc10f6">setLedBlink</a>(<a class="code" href="controller_enums_8h.html#aadcb6002d2b42fdfe01490f730ab00a6">LED</a> l);</div>
<div class="line"><a name="l00170"></a><span class="lineno"> 170</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_x_b_o_x_u_s_b.html#a7426adef803da704df7593858389926e">setLedMode</a>(<a class="code" href="xbox_enums_8h.html#a57effb96f46e458675a2653d4c543ca2">LEDMode</a> lm);</div>
<div class="line"><a name="l00174"></a><span class="lineno"><a class="code" href="class_x_b_o_x_u_s_b.html#a1c779ae5483a2f73426650242a37d868"> 174</a></span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_x_b_o_x_u_s_b.html#a1c779ae5483a2f73426650242a37d868">Xbox360Connected</a>;</div>
<div class="line"><a name="l00175"></a><span class="lineno"> 175</span>&#160;</div>
<div class="line"><a name="l00176"></a><span class="lineno"> 176</span>&#160;<span class="keyword">protected</span>:</div>
<div class="line"><a name="l00178"></a><span class="lineno"><a class="code" href="class_x_b_o_x_u_s_b.html#a9c701658d4f63b5407cbcd5b78d8eb18"> 178</a></span>&#160; <a class="code" href="class_u_s_b.html">USB</a> *<a class="code" href="class_x_b_o_x_u_s_b.html#a9c701658d4f63b5407cbcd5b78d8eb18">pUsb</a>;</div>
<div class="line"><a name="l00180"></a><span class="lineno"><a class="code" href="class_x_b_o_x_u_s_b.html#a5e9c00af9f4b978c53819791b0a0eb65"> 180</a></span>&#160; uint8_t <a class="code" href="class_x_b_o_x_u_s_b.html#a5e9c00af9f4b978c53819791b0a0eb65">bAddress</a>;</div>
<div class="line"><a name="l00182"></a><span class="lineno"><a class="code" href="class_x_b_o_x_u_s_b.html#abef4a852d877d8136f198431ce54550f"> 182</a></span>&#160; <a class="code" href="struct_ep_info.html">EpInfo</a> <a class="code" href="class_x_b_o_x_u_s_b.html#abef4a852d877d8136f198431ce54550f">epInfo</a>[<a class="code" href="_x_b_o_x_u_s_b_8h.html#af35f872fc33e690571eb99de648e8e96">XBOX_MAX_ENDPOINTS</a>];</div>
<div class="line"><a name="l00183"></a><span class="lineno"> 183</span>&#160;</div>
<div class="line"><a name="l00184"></a><span class="lineno"> 184</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00185"></a><span class="lineno"> 185</span>&#160; <span class="keywordtype">bool</span> bPollEnable;</div>
<div class="line"><a name="l00186"></a><span class="lineno"> 186</span>&#160;</div>
<div class="line"><a name="l00187"></a><span class="lineno"> 187</span>&#160; <span class="comment">/* Variables to store the buttons */</span></div>
<div class="line"><a name="l00188"></a><span class="lineno"> 188</span>&#160; uint32_t ButtonState;</div>
<div class="line"><a name="l00189"></a><span class="lineno"> 189</span>&#160; uint32_t OldButtonState;</div>
<div class="line"><a name="l00190"></a><span class="lineno"> 190</span>&#160; uint16_t ButtonClickState;</div>
<div class="line"><a name="l00191"></a><span class="lineno"> 191</span>&#160; int16_t hatValue[4];</div>
<div class="line"><a name="l00192"></a><span class="lineno"> 192</span>&#160; uint16_t controllerStatus;</div>
<div class="line"><a name="l00193"></a><span class="lineno"> 193</span>&#160;</div>
<div class="line"><a name="l00194"></a><span class="lineno"> 194</span>&#160; <span class="keywordtype">bool</span> L2Clicked; <span class="comment">// These buttons are analog, so we use we use these bools to check if they where clicked or not</span></div>
<div class="line"><a name="l00195"></a><span class="lineno"> 195</span>&#160; <span class="keywordtype">bool</span> R2Clicked;</div>
<div class="line"><a name="l00196"></a><span class="lineno"> 196</span>&#160;</div>
<div class="line"><a name="l00197"></a><span class="lineno"> 197</span>&#160; uint8_t readBuf[<a class="code" href="_x_b_o_x_u_s_b_8h.html#abcb805b13bfd36145e252b0633bbcfc0">EP_MAXPKTSIZE</a>]; <span class="comment">// General purpose buffer for input data</span></div>
<div class="line"><a name="l00198"></a><span class="lineno"> 198</span>&#160; uint8_t writeBuf[<a class="code" href="_x_b_o_x_u_s_b_8h.html#abcb805b13bfd36145e252b0633bbcfc0">EP_MAXPKTSIZE</a>]; <span class="comment">// General purpose buffer for output data</span></div>
<div class="line"><a name="l00199"></a><span class="lineno"> 199</span>&#160;</div>
<div class="line"><a name="l00200"></a><span class="lineno"> 200</span>&#160; <span class="keywordtype">void</span> readReport(); <span class="comment">// read incoming data</span></div>
<div class="line"><a name="l00201"></a><span class="lineno"> 201</span>&#160; <span class="keywordtype">void</span> printReport(); <span class="comment">// print incoming date - Uncomment for debugging</span></div>
<div class="line"><a name="l00202"></a><span class="lineno"> 202</span>&#160;</div>
<div class="line"><a name="l00203"></a><span class="lineno"> 203</span>&#160; <span class="comment">/* Private commands */</span></div>
<div class="line"><a name="l00204"></a><span class="lineno"> 204</span>&#160; <span class="keywordtype">void</span> XboxCommand(uint8_t* data, uint16_t nbytes);</div>
<div class="line"><a name="l00205"></a><span class="lineno"> 205</span>&#160;};</div>
<div class="line"><a name="l00206"></a><span class="lineno"> 206</span>&#160;<span class="preprocessor">#endif</span></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>

View file

@ -128,7 +128,7 @@ Classes</h2></td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:a517dfa014946e2d087d197312234a1de"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="address_8h.html#a517dfa014946e2d087d197312234a1de">USB_NAK_MAX_POWER</a>&#160;&#160;&#160;16</td></tr>
<tr class="memitem:a517dfa014946e2d087d197312234a1de"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="address_8h.html#a517dfa014946e2d087d197312234a1de">USB_NAK_MAX_POWER</a>&#160;&#160;&#160;15</td></tr>
<tr class="separator:a517dfa014946e2d087d197312234a1de"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a622e49a2b6b99500654d24321983930e"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="address_8h.html#a622e49a2b6b99500654d24321983930e">USB_NAK_DEFAULT</a>&#160;&#160;&#160;14</td></tr>
<tr class="separator:a622e49a2b6b99500654d24321983930e"><td class="memSeparator" colspan="2">&#160;</td></tr>
@ -158,7 +158,7 @@ Typedefs</h2></td></tr>
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define USB_NAK_MAX_POWER&#160;&#160;&#160;16</td>
<td class="memname">#define USB_NAK_MAX_POWER&#160;&#160;&#160;15</td>
</tr>
</table>
</div><div class="memdoc">
@ -219,7 +219,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="address_8h_source.html#l00074">74</a> of file <a class="el" href="address_8h_source.html">address.h</a>.</p>
<p>Definition at line <a class="el" href="address_8h_source.html#l00071">71</a> of file <a class="el" href="address_8h_source.html">address.h</a>.</p>
</div>
</div>
@ -233,7 +233,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="address_8h_source.html#l00075">75</a> of file <a class="el" href="address_8h_source.html">address.h</a>.</p>
<p>Definition at line <a class="el" href="address_8h_source.html#l00072">72</a> of file <a class="el" href="address_8h_source.html">address.h</a>.</p>
</div>
</div>
@ -247,7 +247,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="address_8h_source.html#l00076">76</a> of file <a class="el" href="address_8h_source.html">address.h</a>.</p>
<p>Definition at line <a class="el" href="address_8h_source.html#l00073">73</a> of file <a class="el" href="address_8h_source.html">address.h</a>.</p>
</div>
</div>
@ -261,7 +261,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="address_8h_source.html#l00097">97</a> of file <a class="el" href="address_8h_source.html">address.h</a>.</p>
<p>Definition at line <a class="el" href="address_8h_source.html#l00092">92</a> of file <a class="el" href="address_8h_source.html">address.h</a>.</p>
</div>
</div>
@ -275,7 +275,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="address_8h_source.html#l00098">98</a> of file <a class="el" href="address_8h_source.html">address.h</a>.</p>
<p>Definition at line <a class="el" href="address_8h_source.html#l00093">93</a> of file <a class="el" href="address_8h_source.html">address.h</a>.</p>
</div>
</div>
@ -290,7 +290,7 @@ Typedefs</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="address_8h_source.html#l00095">95</a> of file <a class="el" href="address_8h_source.html">address.h</a>.</p>
<p>Definition at line <a class="el" href="address_8h_source.html#l00090">90</a> of file <a class="el" href="address_8h_source.html">address.h</a>.</p>
</div>
</div>

View file

@ -115,268 +115,252 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span>&#160;</div>
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span>&#160;<span class="comment">/* NAK powers. To save space in endpoint data structure, amount of retries before giving up and returning 0x4 is stored in */</span></div>
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span>&#160;<span class="comment">/* bmNakPower as a power of 2. The actual nak_limit is then calculated as nak_limit = ( 2^bmNakPower - 1) */</span></div>
<div class="line"><a name="l00027"></a><span class="lineno"><a class="code" href="address_8h.html#a517dfa014946e2d087d197312234a1de"> 27</a></span>&#160;<span class="preprocessor">#define USB_NAK_MAX_POWER 16 //NAK binary order maximum value</span></div>
<div class="line"><a name="l00028"></a><span class="lineno"><a class="code" href="address_8h.html#a622e49a2b6b99500654d24321983930e"> 28</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_NAK_DEFAULT 14 //default 16K-1 NAKs before giving up</span></div>
<div class="line"><a name="l00027"></a><span class="lineno"><a class="code" href="address_8h.html#a517dfa014946e2d087d197312234a1de"> 27</a></span>&#160;<span class="preprocessor">#define USB_NAK_MAX_POWER 15 //NAK binary order maximum value</span></div>
<div class="line"><a name="l00028"></a><span class="lineno"><a class="code" href="address_8h.html#a622e49a2b6b99500654d24321983930e"> 28</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_NAK_DEFAULT 14 //default 32K-1 NAKs before giving up</span></div>
<div class="line"><a name="l00029"></a><span class="lineno"><a class="code" href="address_8h.html#a660e8da9c1167a8450aef91c5c03761d"> 29</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_NAK_NOWAIT 1 //Single NAK stops transfer</span></div>
<div class="line"><a name="l00030"></a><span class="lineno"><a class="code" href="address_8h.html#a39819e4b89e4bc769e2798f2ca6e3d7b"> 30</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_NAK_NONAK 0 //Do not count NAKs, stop retrying after USB Timeout</span></div>
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00032"></a><span class="lineno"><a class="code" href="struct_ep_info.html"> 32</a></span>&#160;<span class="keyword">struct </span><a class="code" href="struct_ep_info.html">EpInfo</a></div>
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span>&#160;{</div>
<div class="line"><a name="l00034"></a><span class="lineno"><a class="code" href="struct_ep_info.html#a9f92be74c75c037b39e2cae1eb49b89b"> 34</a></span>&#160; uint8_t <a class="code" href="struct_ep_info.html#a9f92be74c75c037b39e2cae1eb49b89b">epAddr</a>; <span class="comment">// Endpoint address </span></div>
<div class="line"><a name="l00035"></a><span class="lineno"><a class="code" href="struct_ep_info.html#aa2ca775b63736df4008e88da7dd4dddb"> 35</a></span>&#160; uint8_t <a class="code" href="struct_ep_info.html#aa2ca775b63736df4008e88da7dd4dddb">maxPktSize</a>; <span class="comment">// Maximum packet size</span></div>
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span>&#160;</div>
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span>&#160; <span class="keyword">union</span></div>
<div class="line"><a name="l00038"></a><span class="lineno"> 38</span>&#160; {</div>
<div class="line"><a name="l00039"></a><span class="lineno"><a class="code" href="struct_ep_info.html#a1dea928517c961235eef7b0876e69f10"> 39</a></span>&#160; uint8_t <a class="code" href="struct_ep_info.html#a1dea928517c961235eef7b0876e69f10">epAttribs</a>;</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="keyword">struct</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="struct_ep_info.html#ac85bff70ad0e5d71e50cb501f4d8caf3"> 43</a></span>&#160; uint8_t <a class="code" href="struct_ep_info.html#ac85bff70ad0e5d71e50cb501f4d8caf3">bmSndToggle</a> : 1; <span class="comment">// Send toggle, when zero bmSNDTOG0, bmSNDTOG1 otherwise</span></div>
<div class="line"><a name="l00044"></a><span class="lineno"><a class="code" href="struct_ep_info.html#a9238dd40c096baedf041c98b19386a14"> 44</a></span>&#160; uint8_t <a class="code" href="struct_ep_info.html#a9238dd40c096baedf041c98b19386a14">bmRcvToggle</a> : 1; <span class="comment">// Send toggle, when zero bmRCVTOG0, bmRCVTOG1 otherwise</span></div>
<div class="line"><a name="l00045"></a><span class="lineno"><a class="code" href="struct_ep_info.html#a3a5b1c017a034cd9e06e76729e727c46"> 45</a></span>&#160; uint8_t <a class="code" href="struct_ep_info.html#a3a5b1c017a034cd9e06e76729e727c46">bmNakPower</a> : 6; <span class="comment">// Binary order for NAK_LIMIT value</span></div>
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span>&#160; };</div>
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span>&#160; };</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"> 49</span>&#160;</div>
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span>&#160;<span class="comment">// 7 6 5 4 3 2 1 0</span></div>
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>&#160;<span class="comment">// ---------------------------------</span></div>
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span>&#160;<span class="comment">// | | H | P | P | P | A | A | A |</span></div>
<div class="line"><a name="l00053"></a><span class="lineno"> 53</span>&#160;<span class="comment">// ---------------------------------</span></div>
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span>&#160;<span class="comment">//</span></div>
<div class="line"><a name="l00055"></a><span class="lineno"> 55</span>&#160;<span class="comment">// H - if 1 the address is a hub address</span></div>
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>&#160;<span class="comment">// P - parent hub address</span></div>
<div class="line"><a name="l00057"></a><span class="lineno"> 57</span>&#160;<span class="comment">// A - device address / port number in case of hub</span></div>
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span>&#160;<span class="comment">//</span></div>
<div class="line"><a name="l00059"></a><span class="lineno"><a class="code" href="struct_usb_device_address.html"> 59</a></span>&#160;<span class="keyword">struct </span><a class="code" href="struct_usb_device_address.html">UsbDeviceAddress</a></div>
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span>&#160;{</div>
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span>&#160; <span class="keyword">union</span></div>
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>&#160; {</div>
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span>&#160; <span class="keyword">struct</span></div>
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>&#160; {</div>
<div class="line"><a name="l00065"></a><span class="lineno"><a class="code" href="struct_usb_device_address.html#ae12b0ac1b76a34d0a5080cc62f41c622"> 65</a></span>&#160; uint8_t <a class="code" href="struct_usb_device_address.html#ae12b0ac1b76a34d0a5080cc62f41c622">bmAddress</a> : 3; <span class="comment">// device address/port number</span></div>
<div class="line"><a name="l00066"></a><span class="lineno"><a class="code" href="struct_usb_device_address.html#abd628d37834249af6518f320f3f19065"> 66</a></span>&#160; uint8_t <a class="code" href="struct_usb_device_address.html#abd628d37834249af6518f320f3f19065">bmParent</a> : 3; <span class="comment">// parent hub address</span></div>
<div class="line"><a name="l00067"></a><span class="lineno"><a class="code" href="struct_usb_device_address.html#a0a8f124a7e7a2ba116e70c2fbf0c551e"> 67</a></span>&#160; uint8_t <a class="code" href="struct_usb_device_address.html#a0a8f124a7e7a2ba116e70c2fbf0c551e">bmHub</a> : 1; <span class="comment">// hub flag</span></div>
<div class="line"><a name="l00068"></a><span class="lineno"><a class="code" href="struct_usb_device_address.html#a28e8292497f782fbe83f97ac70eb0aef"> 68</a></span>&#160; uint8_t <a class="code" href="struct_usb_device_address.html#a28e8292497f782fbe83f97ac70eb0aef">bmReserved</a> : 1; <span class="comment">// reserved, must be zerro</span></div>
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>&#160; };</div>
<div class="line"><a name="l00070"></a><span class="lineno"><a class="code" href="struct_usb_device_address.html#a79ed442d6a357907ddb4d1697bd6af5f"> 70</a></span>&#160; uint8_t <a class="code" href="struct_usb_device_address.html#a79ed442d6a357907ddb4d1697bd6af5f">devAddress</a>;</div>
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>&#160; };</div>
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>&#160;};</div>
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span>&#160;</div>
<div class="line"><a name="l00074"></a><span class="lineno"><a class="code" href="address_8h.html#a3002da1b823cafeeac8ba4a33bb96905"> 74</a></span>&#160;<span class="preprocessor">#define bmUSB_DEV_ADDR_ADDRESS 0x07</span></div>
<div class="line"><a name="l00075"></a><span class="lineno"><a class="code" href="address_8h.html#a61b78658a9cc75f61841f2a0ac8e54fa"> 75</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define bmUSB_DEV_ADDR_PARENT 0x38</span></div>
<div class="line"><a name="l00076"></a><span class="lineno"><a class="code" href="address_8h.html#a32dbe85cf751ca8428d34c45a1931655"> 76</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define bmUSB_DEV_ADDR_HUB 0x40</span></div>
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00078"></a><span class="lineno"><a class="code" href="struct_usb_device.html"> 78</a></span>&#160;<span class="keyword">struct </span><a class="code" href="struct_usb_device.html">UsbDevice</a></div>
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>&#160;{</div>
<div class="line"><a name="l00080"></a><span class="lineno"><a class="code" href="struct_usb_device.html#a410d39fb7758157f57794335e990ed02"> 80</a></span>&#160; <a class="code" href="struct_ep_info.html">EpInfo</a> *<a class="code" href="struct_usb_device.html#a410d39fb7758157f57794335e990ed02">epinfo</a>; <span class="comment">// endpoint info pointer</span></div>
<div class="line"><a name="l00081"></a><span class="lineno"><a class="code" href="struct_usb_device.html#a855beb4cbe3e48b93298ea44d6cae86f"> 81</a></span>&#160; uint8_t <a class="code" href="struct_usb_device.html#a855beb4cbe3e48b93298ea44d6cae86f">address</a>; <span class="comment">// address</span></div>
<div class="line"><a name="l00082"></a><span class="lineno"><a class="code" href="struct_usb_device.html#a828814f5231b866ac665a24ec5edaa3a"> 82</a></span>&#160; uint8_t <a class="code" href="struct_usb_device.html#a828814f5231b866ac665a24ec5edaa3a">epcount</a>; <span class="comment">// number of endpoints</span></div>
<div class="line"><a name="l00083"></a><span class="lineno"><a class="code" href="struct_usb_device.html#a86a815577ad7883437d3ca72b32b8e8a"> 83</a></span>&#160; <span class="keywordtype">bool</span> <a class="code" href="struct_usb_device.html#a86a815577ad7883437d3ca72b32b8e8a">lowspeed</a>; <span class="comment">// indicates if a device is the low speed one</span></div>
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span>&#160;<span class="comment">// uint8_t devclass; // device class</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;</div>
<div class="line"><a name="l00087"></a><span class="lineno"><a class="code" href="class_address_pool.html"> 87</a></span>&#160;<span class="keyword">class </span><a class="code" href="class_address_pool.html">AddressPool</a></div>
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>&#160;{</div>
<div class="line"><a name="l00089"></a><span class="lineno"> 89</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span>&#160; <span class="keyword">virtual</span> <a class="code" href="struct_usb_device.html">UsbDevice</a>* <a class="code" href="class_address_pool.html#aa92d7e8f0f515340ae2dc1679b627056">GetUsbDevicePtr</a>(uint8_t addr) = 0;</div>
<div class="line"><a name="l00091"></a><span class="lineno"> 91</span>&#160; <span class="keyword">virtual</span> uint8_t <a class="code" href="class_address_pool.html#a97df4ef42e50960ce2165f4cdb53e590">AllocAddress</a>(uint8_t parent, <span class="keywordtype">bool</span> is_hub = <span class="keyword">false</span>, uint8_t port = 0) = 0;</div>
<div class="line"><a name="l00092"></a><span class="lineno"> 92</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_address_pool.html#a15fde13223dcb1da89305ad229763562">FreeAddress</a>(uint8_t addr) = 0;</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;</div>
<div class="line"><a name="l00095"></a><span class="lineno"><a class="code" href="address_8h.html#a90edb051235924cb5280032df397f393"> 95</a></span>&#160;<span class="keyword">typedef</span> void (*<a class="code" href="address_8h.html#a90edb051235924cb5280032df397f393">UsbDeviceHandleFunc</a>)(<a class="code" href="struct_usb_device.html">UsbDevice</a> *pdev);</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"><a class="code" href="address_8h.html#abeb4f5491e26a7f2cbf9201575d38104"> 97</a></span>&#160;<span class="preprocessor">#define ADDR_ERROR_INVALID_INDEX 0xFF</span></div>
<div class="line"><a name="l00098"></a><span class="lineno"><a class="code" href="address_8h.html#a8c4dc7975c713673cd832a3502f068d7"> 98</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define ADDR_ERROR_INVALID_ADDRESS 0xFF</span></div>
<div class="line"><a name="l00099"></a><span class="lineno"> 99</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00100"></a><span class="lineno"> 100</span>&#160;<span class="keyword">template</span> &lt;const u<span class="keywordtype">int</span>8_t MAX_DEVICES_ALLOWED&gt;</div>
<div class="line"><a name="l00101"></a><span class="lineno"><a class="code" href="class_address_pool_impl.html"> 101</a></span>&#160;<span class="keyword">class </span><a class="code" href="class_address_pool_impl.html">AddressPoolImpl</a> : <span class="keyword">public</span> <a class="code" href="class_address_pool.html">AddressPool</a></div>
<div class="line"><a name="l00102"></a><span class="lineno"> 102</span>&#160;{</div>
<div class="line"><a name="l00103"></a><span class="lineno"> 103</span>&#160; <a class="code" href="struct_ep_info.html">EpInfo</a> dev0ep; <span class="comment">//Endpoint data structure used during enumeration for uninitialized device</span></div>
<div class="line"><a name="l00104"></a><span class="lineno"> 104</span>&#160;</div>
<div class="line"><a name="l00105"></a><span class="lineno"> 105</span>&#160; uint8_t hubCounter; <span class="comment">// hub counter is kept </span></div>
<div class="line"><a name="l00106"></a><span class="lineno"> 106</span>&#160; <span class="comment">// in order to avoid hub address duplication</span></div>
<div class="line"><a name="l00107"></a><span class="lineno"> 107</span>&#160;</div>
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span>&#160; <a class="code" href="struct_usb_device.html">UsbDevice</a> thePool[MAX_DEVICES_ALLOWED];</div>
<div class="line"><a name="l00109"></a><span class="lineno"> 109</span>&#160;</div>
<div class="line"><a name="l00110"></a><span class="lineno"> 110</span>&#160; <span class="comment">// Initializes address pool entry</span></div>
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span>&#160; <span class="keywordtype">void</span> InitEntry(uint8_t index)</div>
<div class="line"><a name="l00112"></a><span class="lineno"> 112</span>&#160; {</div>
<div class="line"><a name="l00113"></a><span class="lineno"> 113</span>&#160; thePool[index].<a class="code" href="struct_usb_device.html#a855beb4cbe3e48b93298ea44d6cae86f">address</a> = 0;</div>
<div class="line"><a name="l00114"></a><span class="lineno"> 114</span>&#160; thePool[index].<a class="code" href="struct_usb_device.html#a828814f5231b866ac665a24ec5edaa3a">epcount</a> = 1;</div>
<div class="line"><a name="l00115"></a><span class="lineno"> 115</span>&#160; thePool[index].<a class="code" href="struct_usb_device.html#a86a815577ad7883437d3ca72b32b8e8a">lowspeed</a> = 0;</div>
<div class="line"><a name="l00116"></a><span class="lineno"> 116</span>&#160; thePool[index].<a class="code" href="struct_usb_device.html#a410d39fb7758157f57794335e990ed02">epinfo</a> = &amp;dev0ep;</div>
<div class="line"><a name="l00117"></a><span class="lineno"> 117</span>&#160; };</div>
<div class="line"><a name="l00118"></a><span class="lineno"> 118</span>&#160; <span class="comment">// Returns thePool index for a given address</span></div>
<div class="line"><a name="l00119"></a><span class="lineno"> 119</span>&#160; uint8_t FindAddressIndex(uint8_t address = 0)</div>
<div class="line"><a name="l00120"></a><span class="lineno"> 120</span>&#160; {</div>
<div class="line"><a name="l00121"></a><span class="lineno"> 121</span>&#160; <span class="keywordflow">for</span> (uint8_t i=1; i&lt;MAX_DEVICES_ALLOWED; i++)</div>
<div class="line"><a name="l00122"></a><span class="lineno"> 122</span>&#160; {</div>
<div class="line"><a name="l00123"></a><span class="lineno"> 123</span>&#160; <span class="keywordflow">if</span> (thePool[i].address == address)</div>
<div class="line"><a name="l00124"></a><span class="lineno"> 124</span>&#160; <span class="keywordflow">return</span> i;</div>
<div class="line"><a name="l00125"></a><span class="lineno"> 125</span>&#160; }</div>
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span>&#160; <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00127"></a><span class="lineno"> 127</span>&#160; };</div>
<div class="line"><a name="l00128"></a><span class="lineno"> 128</span>&#160; <span class="comment">// Returns thePool child index for a given parent</span></div>
<div class="line"><a name="l00129"></a><span class="lineno"> 129</span>&#160; uint8_t FindChildIndex(<a class="code" href="struct_usb_device_address.html">UsbDeviceAddress</a> addr, uint8_t start = 1)</div>
<div class="line"><a name="l00130"></a><span class="lineno"> 130</span>&#160; {</div>
<div class="line"><a name="l00131"></a><span class="lineno"> 131</span>&#160; <span class="keywordflow">for</span> (uint8_t i=(start&lt;1 || start&gt;=MAX_DEVICES_ALLOWED) ? 1 : start; i&lt;MAX_DEVICES_ALLOWED; i++)</div>
<div class="line"><a name="l00132"></a><span class="lineno"> 132</span>&#160; {</div>
<div class="line"><a name="l00133"></a><span class="lineno"> 133</span>&#160; <span class="keywordflow">if</span> (((<a class="code" href="struct_usb_device_address.html">UsbDeviceAddress</a>*)&amp;thePool[i].address)-&gt;bmParent == addr.<a class="code" href="struct_usb_device_address.html#ae12b0ac1b76a34d0a5080cc62f41c622">bmAddress</a>)</div>
<div class="line"><a name="l00134"></a><span class="lineno"> 134</span>&#160; <span class="keywordflow">return</span> i;</div>
<div class="line"><a name="l00135"></a><span class="lineno"> 135</span>&#160; }</div>
<div class="line"><a name="l00136"></a><span class="lineno"> 136</span>&#160; <span class="keywordflow">return</span> 0;</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; <span class="comment">// Frees address entry specified by index parameter</span></div>
<div class="line"><a name="l00139"></a><span class="lineno"> 139</span>&#160; <span class="keywordtype">void</span> FreeAddressByIndex(uint8_t index)</div>
<div class="line"><a name="l00140"></a><span class="lineno"> 140</span>&#160; {</div>
<div class="line"><a name="l00141"></a><span class="lineno"> 141</span>&#160; <span class="comment">// Zerro field is reserved and should not be affected</span></div>
<div class="line"><a name="l00142"></a><span class="lineno"> 142</span>&#160; <span class="keywordflow">if</span> (index == 0)</div>
<div class="line"><a name="l00143"></a><span class="lineno"> 143</span>&#160; <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00144"></a><span class="lineno"> 144</span>&#160;</div>
<div class="line"><a name="l00145"></a><span class="lineno"> 145</span>&#160; <span class="comment">// If a hub was switched off all port addresses should be freed</span></div>
<div class="line"><a name="l00146"></a><span class="lineno"> 146</span>&#160; <span class="keywordflow">if</span> (((<a class="code" href="struct_usb_device_address.html">UsbDeviceAddress</a>*)&amp;thePool[index].address)-&gt;bmHub == 1)</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; <span class="keywordflow">for</span> (uint8_t i=1; i = FindChildIndex(*((<a class="code" href="struct_usb_device_address.html">UsbDeviceAddress</a>*)&amp;thePool[index].address), i); )</div>
<div class="line"><a name="l00149"></a><span class="lineno"> 149</span>&#160; FreeAddressByIndex(i);</div>
<div class="line"><a name="l00150"></a><span class="lineno"> 150</span>&#160;</div>
<div class="line"><a name="l00151"></a><span class="lineno"> 151</span>&#160; <span class="comment">// If the hub had the last allocated address, hubCounter should be decremented</span></div>
<div class="line"><a name="l00152"></a><span class="lineno"> 152</span>&#160; <span class="keywordflow">if</span> (hubCounter == ((<a class="code" href="struct_usb_device_address.html">UsbDeviceAddress</a>*)&amp;thePool[index].address)-&gt;bmAddress)</div>
<div class="line"><a name="l00153"></a><span class="lineno"> 153</span>&#160; hubCounter --;</div>
<div class="line"><a name="l00154"></a><span class="lineno"> 154</span>&#160; }</div>
<div class="line"><a name="l00155"></a><span class="lineno"> 155</span>&#160; InitEntry(index);</div>
<div class="line"><a name="l00156"></a><span class="lineno"> 156</span>&#160; }</div>
<div class="line"><a name="l00157"></a><span class="lineno"> 157</span>&#160; <span class="comment">// Initializes the whole address pool at once</span></div>
<div class="line"><a name="l00158"></a><span class="lineno"> 158</span>&#160; <span class="keywordtype">void</span> InitAllAddresses()</div>
<div class="line"><a name="l00159"></a><span class="lineno"> 159</span>&#160; {</div>
<div class="line"><a name="l00160"></a><span class="lineno"> 160</span>&#160; <span class="keywordflow">for</span> (uint8_t i=1; i&lt;MAX_DEVICES_ALLOWED; i++)</div>
<div class="line"><a name="l00161"></a><span class="lineno"> 161</span>&#160; InitEntry(i);</div>
<div class="line"><a name="l00032"></a><span class="lineno"><a class="code" href="struct_ep_info.html"> 32</a></span>&#160;<span class="keyword">struct </span><a class="code" href="struct_ep_info.html">EpInfo</a> {</div>
<div class="line"><a name="l00033"></a><span class="lineno"><a class="code" href="struct_ep_info.html#a9f92be74c75c037b39e2cae1eb49b89b"> 33</a></span>&#160; uint8_t <a class="code" href="struct_ep_info.html#a9f92be74c75c037b39e2cae1eb49b89b">epAddr</a>; <span class="comment">// Endpoint address</span></div>
<div class="line"><a name="l00034"></a><span class="lineno"><a class="code" href="struct_ep_info.html#aa2ca775b63736df4008e88da7dd4dddb"> 34</a></span>&#160; uint8_t <a class="code" href="struct_ep_info.html#aa2ca775b63736df4008e88da7dd4dddb">maxPktSize</a>; <span class="comment">// Maximum packet size</span></div>
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span>&#160;</div>
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span>&#160; <span class="keyword">union </span>{</div>
<div class="line"><a name="l00037"></a><span class="lineno"><a class="code" href="struct_ep_info.html#a1dea928517c961235eef7b0876e69f10"> 37</a></span>&#160; uint8_t <a class="code" href="struct_ep_info.html#a1dea928517c961235eef7b0876e69f10">epAttribs</a>;</div>
<div class="line"><a name="l00038"></a><span class="lineno"> 38</span>&#160;</div>
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span>&#160; <span class="keyword">struct </span>{</div>
<div class="line"><a name="l00040"></a><span class="lineno"><a class="code" href="struct_ep_info.html#ac85bff70ad0e5d71e50cb501f4d8caf3"> 40</a></span>&#160; uint8_t <a class="code" href="struct_ep_info.html#ac85bff70ad0e5d71e50cb501f4d8caf3">bmSndToggle</a> : 1; <span class="comment">// Send toggle, when zero bmSNDTOG0, bmSNDTOG1 otherwise</span></div>
<div class="line"><a name="l00041"></a><span class="lineno"><a class="code" href="struct_ep_info.html#a9238dd40c096baedf041c98b19386a14"> 41</a></span>&#160; uint8_t <a class="code" href="struct_ep_info.html#a9238dd40c096baedf041c98b19386a14">bmRcvToggle</a> : 1; <span class="comment">// Send toggle, when zero bmRCVTOG0, bmRCVTOG1 otherwise</span></div>
<div class="line"><a name="l00042"></a><span class="lineno"><a class="code" href="struct_ep_info.html#a3a5b1c017a034cd9e06e76729e727c46"> 42</a></span>&#160; uint8_t <a class="code" href="struct_ep_info.html#a3a5b1c017a034cd9e06e76729e727c46">bmNakPower</a> : 6; <span class="comment">// Binary order for NAK_LIMIT value</span></div>
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span>&#160; } __attribute__((packed));</div>
<div class="line"><a name="l00044"></a><span class="lineno"> 44</span>&#160; };</div>
<div class="line"><a name="l00045"></a><span class="lineno"> 45</span>&#160;} __attribute__((packed));</div>
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span>&#160;</div>
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span>&#160;<span class="comment">// 7 6 5 4 3 2 1 0</span></div>
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span>&#160;<span class="comment">// ---------------------------------</span></div>
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span>&#160;<span class="comment">// | | H | P | P | P | A | A | A |</span></div>
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span>&#160;<span class="comment">// ---------------------------------</span></div>
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>&#160;<span class="comment">//</span></div>
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span>&#160;<span class="comment">// H - if 1 the address is a hub address</span></div>
<div class="line"><a name="l00053"></a><span class="lineno"> 53</span>&#160;<span class="comment">// P - parent hub address</span></div>
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span>&#160;<span class="comment">// A - device address / port number in case of hub</span></div>
<div class="line"><a name="l00055"></a><span class="lineno"> 55</span>&#160;<span class="comment">//</span></div>
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>&#160;</div>
<div class="line"><a name="l00057"></a><span class="lineno"><a class="code" href="struct_usb_device_address.html"> 57</a></span>&#160;<span class="keyword">struct </span><a class="code" href="struct_usb_device_address.html">UsbDeviceAddress</a> {</div>
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span>&#160;</div>
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span>&#160; <span class="keyword">union </span>{</div>
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span>&#160;</div>
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span>&#160; <span class="keyword">struct </span>{</div>
<div class="line"><a name="l00062"></a><span class="lineno"><a class="code" href="struct_usb_device_address.html#ae12b0ac1b76a34d0a5080cc62f41c622"> 62</a></span>&#160; uint8_t <a class="code" href="struct_usb_device_address.html#ae12b0ac1b76a34d0a5080cc62f41c622">bmAddress</a> : 3; <span class="comment">// device address/port number</span></div>
<div class="line"><a name="l00063"></a><span class="lineno"><a class="code" href="struct_usb_device_address.html#abd628d37834249af6518f320f3f19065"> 63</a></span>&#160; uint8_t <a class="code" href="struct_usb_device_address.html#abd628d37834249af6518f320f3f19065">bmParent</a> : 3; <span class="comment">// parent hub address</span></div>
<div class="line"><a name="l00064"></a><span class="lineno"><a class="code" href="struct_usb_device_address.html#a0a8f124a7e7a2ba116e70c2fbf0c551e"> 64</a></span>&#160; uint8_t <a class="code" href="struct_usb_device_address.html#a0a8f124a7e7a2ba116e70c2fbf0c551e">bmHub</a> : 1; <span class="comment">// hub flag</span></div>
<div class="line"><a name="l00065"></a><span class="lineno"><a class="code" href="struct_usb_device_address.html#a28e8292497f782fbe83f97ac70eb0aef"> 65</a></span>&#160; uint8_t <a class="code" href="struct_usb_device_address.html#a28e8292497f782fbe83f97ac70eb0aef">bmReserved</a> : 1; <span class="comment">// reserved, must be zerro</span></div>
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>&#160; } __attribute__((packed));</div>
<div class="line"><a name="l00067"></a><span class="lineno"><a class="code" href="struct_usb_device_address.html#a79ed442d6a357907ddb4d1697bd6af5f"> 67</a></span>&#160; uint8_t <a class="code" href="struct_usb_device_address.html#a79ed442d6a357907ddb4d1697bd6af5f">devAddress</a>;</div>
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>&#160; };</div>
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>&#160;} __attribute__((packed));</div>
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>&#160;</div>
<div class="line"><a name="l00071"></a><span class="lineno"><a class="code" href="address_8h.html#a3002da1b823cafeeac8ba4a33bb96905"> 71</a></span>&#160;<span class="preprocessor">#define bmUSB_DEV_ADDR_ADDRESS 0x07</span></div>
<div class="line"><a name="l00072"></a><span class="lineno"><a class="code" href="address_8h.html#a61b78658a9cc75f61841f2a0ac8e54fa"> 72</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define bmUSB_DEV_ADDR_PARENT 0x38</span></div>
<div class="line"><a name="l00073"></a><span class="lineno"><a class="code" href="address_8h.html#a32dbe85cf751ca8428d34c45a1931655"> 73</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define bmUSB_DEV_ADDR_HUB 0x40</span></div>
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00075"></a><span class="lineno"><a class="code" href="struct_usb_device.html"> 75</a></span>&#160;<span class="keyword">struct </span><a class="code" href="struct_usb_device.html">UsbDevice</a> {</div>
<div class="line"><a name="l00076"></a><span class="lineno"><a class="code" href="struct_usb_device.html#a410d39fb7758157f57794335e990ed02"> 76</a></span>&#160; <a class="code" href="struct_ep_info.html">EpInfo</a> *<a class="code" href="struct_usb_device.html#a410d39fb7758157f57794335e990ed02">epinfo</a>; <span class="comment">// endpoint info pointer</span></div>
<div class="line"><a name="l00077"></a><span class="lineno"><a class="code" href="struct_usb_device.html#a855beb4cbe3e48b93298ea44d6cae86f"> 77</a></span>&#160; uint8_t <a class="code" href="struct_usb_device.html#a855beb4cbe3e48b93298ea44d6cae86f">address</a>; <span class="comment">// address</span></div>
<div class="line"><a name="l00078"></a><span class="lineno"><a class="code" href="struct_usb_device.html#a828814f5231b866ac665a24ec5edaa3a"> 78</a></span>&#160; uint8_t <a class="code" href="struct_usb_device.html#a828814f5231b866ac665a24ec5edaa3a">epcount</a>; <span class="comment">// number of endpoints</span></div>
<div class="line"><a name="l00079"></a><span class="lineno"><a class="code" href="struct_usb_device.html#a86a815577ad7883437d3ca72b32b8e8a"> 79</a></span>&#160; <span class="keywordtype">bool</span> <a class="code" href="struct_usb_device.html#a86a815577ad7883437d3ca72b32b8e8a">lowspeed</a>; <span class="comment">// indicates if a device is the low speed one</span></div>
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>&#160; <span class="comment">// uint8_t devclass; // device class</span></div>
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span>&#160;} __attribute__((packed));</div>
<div class="line"><a name="l00082"></a><span class="lineno"> 82</span>&#160;</div>
<div class="line"><a name="l00083"></a><span class="lineno"><a class="code" href="class_address_pool.html"> 83</a></span>&#160;<span class="keyword">class </span><a class="code" href="class_address_pool.html">AddressPool</a> {</div>
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span>&#160; <span class="keyword">virtual</span> <a class="code" href="struct_usb_device.html">UsbDevice</a>* <a class="code" href="class_address_pool.html#aa92d7e8f0f515340ae2dc1679b627056">GetUsbDevicePtr</a>(uint8_t addr) = 0;</div>
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span>&#160; <span class="keyword">virtual</span> uint8_t <a class="code" href="class_address_pool.html#a97df4ef42e50960ce2165f4cdb53e590">AllocAddress</a>(uint8_t parent, <span class="keywordtype">bool</span> is_hub = <span class="keyword">false</span>, uint8_t port = 0) = 0;</div>
<div class="line"><a name="l00087"></a><span class="lineno"> 87</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_address_pool.html#a15fde13223dcb1da89305ad229763562">FreeAddress</a>(uint8_t addr) = 0;</div>
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>&#160;};</div>
<div class="line"><a name="l00089"></a><span class="lineno"> 89</span>&#160;</div>
<div class="line"><a name="l00090"></a><span class="lineno"><a class="code" href="address_8h.html#a90edb051235924cb5280032df397f393"> 90</a></span>&#160;<span class="keyword">typedef</span> void (*<a class="code" href="address_8h.html#a90edb051235924cb5280032df397f393">UsbDeviceHandleFunc</a>)(<a class="code" href="struct_usb_device.html">UsbDevice</a> *pdev);</div>
<div class="line"><a name="l00091"></a><span class="lineno"> 91</span>&#160;</div>
<div class="line"><a name="l00092"></a><span class="lineno"><a class="code" href="address_8h.html#abeb4f5491e26a7f2cbf9201575d38104"> 92</a></span>&#160;<span class="preprocessor">#define ADDR_ERROR_INVALID_INDEX 0xFF</span></div>
<div class="line"><a name="l00093"></a><span class="lineno"><a class="code" href="address_8h.html#a8c4dc7975c713673cd832a3502f068d7"> 93</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define ADDR_ERROR_INVALID_ADDRESS 0xFF</span></div>
<div class="line"><a name="l00094"></a><span class="lineno"> 94</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00095"></a><span class="lineno"> 95</span>&#160;<span class="keyword">template</span> &lt;const u<span class="keywordtype">int</span>8_t MAX_DEVICES_ALLOWED&gt;</div>
<div class="line"><a name="l00096"></a><span class="lineno"><a class="code" href="class_address_pool_impl.html"> 96</a></span>&#160;<span class="keyword">class </span><a class="code" href="class_address_pool_impl.html">AddressPoolImpl</a> : <span class="keyword">public</span> <a class="code" href="class_address_pool.html">AddressPool</a> {</div>
<div class="line"><a name="l00097"></a><span class="lineno"> 97</span>&#160; <a class="code" href="struct_ep_info.html">EpInfo</a> dev0ep; <span class="comment">//Endpoint data structure used during enumeration for uninitialized device</span></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; uint8_t hubCounter; <span class="comment">// hub counter is kept</span></div>
<div class="line"><a name="l00100"></a><span class="lineno"> 100</span>&#160; <span class="comment">// in order to avoid hub address duplication</span></div>
<div class="line"><a name="l00101"></a><span class="lineno"> 101</span>&#160;</div>
<div class="line"><a name="l00102"></a><span class="lineno"> 102</span>&#160; <a class="code" href="struct_usb_device.html">UsbDevice</a> thePool[MAX_DEVICES_ALLOWED];</div>
<div class="line"><a name="l00103"></a><span class="lineno"> 103</span>&#160;</div>
<div class="line"><a name="l00104"></a><span class="lineno"> 104</span>&#160; <span class="comment">// Initializes address pool entry</span></div>
<div class="line"><a name="l00105"></a><span class="lineno"> 105</span>&#160;</div>
<div class="line"><a name="l00106"></a><span class="lineno"> 106</span>&#160; <span class="keywordtype">void</span> InitEntry(uint8_t index) {</div>
<div class="line"><a name="l00107"></a><span class="lineno"> 107</span>&#160; thePool[index].<a class="code" href="struct_usb_device.html#a855beb4cbe3e48b93298ea44d6cae86f">address</a> = 0;</div>
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span>&#160; thePool[index].<a class="code" href="struct_usb_device.html#a828814f5231b866ac665a24ec5edaa3a">epcount</a> = 1;</div>
<div class="line"><a name="l00109"></a><span class="lineno"> 109</span>&#160; thePool[index].<a class="code" href="struct_usb_device.html#a86a815577ad7883437d3ca72b32b8e8a">lowspeed</a> = 0;</div>
<div class="line"><a name="l00110"></a><span class="lineno"> 110</span>&#160; thePool[index].<a class="code" href="struct_usb_device.html#a410d39fb7758157f57794335e990ed02">epinfo</a> = &amp;dev0ep;</div>
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span>&#160; };</div>
<div class="line"><a name="l00112"></a><span class="lineno"> 112</span>&#160; <span class="comment">// Returns thePool index for a given address</span></div>
<div class="line"><a name="l00113"></a><span class="lineno"> 113</span>&#160;</div>
<div class="line"><a name="l00114"></a><span class="lineno"> 114</span>&#160; uint8_t FindAddressIndex(uint8_t address = 0) {</div>
<div class="line"><a name="l00115"></a><span class="lineno"> 115</span>&#160; <span class="keywordflow">for</span>(uint8_t i = 1; i &lt; MAX_DEVICES_ALLOWED; i++) {</div>
<div class="line"><a name="l00116"></a><span class="lineno"> 116</span>&#160; <span class="keywordflow">if</span>(thePool[i].address == address)</div>
<div class="line"><a name="l00117"></a><span class="lineno"> 117</span>&#160; <span class="keywordflow">return</span> i;</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; <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00120"></a><span class="lineno"> 120</span>&#160; };</div>
<div class="line"><a name="l00121"></a><span class="lineno"> 121</span>&#160; <span class="comment">// Returns thePool child index for a given parent</span></div>
<div class="line"><a name="l00122"></a><span class="lineno"> 122</span>&#160;</div>
<div class="line"><a name="l00123"></a><span class="lineno"> 123</span>&#160; uint8_t FindChildIndex(<a class="code" href="struct_usb_device_address.html">UsbDeviceAddress</a> addr, uint8_t start = 1) {</div>
<div class="line"><a name="l00124"></a><span class="lineno"> 124</span>&#160; <span class="keywordflow">for</span>(uint8_t i = (start &lt; 1 || start &gt;= MAX_DEVICES_ALLOWED) ? 1 : start; i &lt; MAX_DEVICES_ALLOWED; i++) {</div>
<div class="line"><a name="l00125"></a><span class="lineno"> 125</span>&#160; <span class="keywordflow">if</span>(((<a class="code" href="struct_usb_device_address.html">UsbDeviceAddress</a>*) &amp; thePool[i].address)-&gt;bmParent == addr.<a class="code" href="struct_usb_device_address.html#ae12b0ac1b76a34d0a5080cc62f41c622">bmAddress</a>)</div>
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span>&#160; <span class="keywordflow">return</span> i;</div>
<div class="line"><a name="l00127"></a><span class="lineno"> 127</span>&#160; }</div>
<div class="line"><a name="l00128"></a><span class="lineno"> 128</span>&#160; <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00129"></a><span class="lineno"> 129</span>&#160; };</div>
<div class="line"><a name="l00130"></a><span class="lineno"> 130</span>&#160; <span class="comment">// Frees address entry specified by index parameter</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="keywordtype">void</span> FreeAddressByIndex(uint8_t index) {</div>
<div class="line"><a name="l00133"></a><span class="lineno"> 133</span>&#160; <span class="comment">// Zerro field is reserved and should not be affected</span></div>
<div class="line"><a name="l00134"></a><span class="lineno"> 134</span>&#160; <span class="keywordflow">if</span>(index == 0)</div>
<div class="line"><a name="l00135"></a><span class="lineno"> 135</span>&#160; <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00136"></a><span class="lineno"> 136</span>&#160;</div>
<div class="line"><a name="l00137"></a><span class="lineno"> 137</span>&#160; <span class="comment">// If a hub was switched off all port addresses should be freed</span></div>
<div class="line"><a name="l00138"></a><span class="lineno"> 138</span>&#160; <span class="keywordflow">if</span>(((<a class="code" href="struct_usb_device_address.html">UsbDeviceAddress</a>*) &amp; thePool[index].address)-&gt;bmHub == 1) {</div>
<div class="line"><a name="l00139"></a><span class="lineno"> 139</span>&#160; <span class="keywordflow">for</span>(uint8_t i = 1; (i = FindChildIndex(*((<a class="code" href="struct_usb_device_address.html">UsbDeviceAddress</a>*) &amp; thePool[index].address), i));)</div>
<div class="line"><a name="l00140"></a><span class="lineno"> 140</span>&#160; FreeAddressByIndex(i);</div>
<div class="line"><a name="l00141"></a><span class="lineno"> 141</span>&#160;</div>
<div class="line"><a name="l00142"></a><span class="lineno"> 142</span>&#160; <span class="comment">// If the hub had the last allocated address, hubCounter should be decremented</span></div>
<div class="line"><a name="l00143"></a><span class="lineno"> 143</span>&#160; <span class="keywordflow">if</span>(hubCounter == ((<a class="code" href="struct_usb_device_address.html">UsbDeviceAddress</a>*) &amp; thePool[index].<a class="code" href="struct_usb_device.html#a855beb4cbe3e48b93298ea44d6cae86f">address</a>)-&gt;bmAddress)</div>
<div class="line"><a name="l00144"></a><span class="lineno"> 144</span>&#160; hubCounter--;</div>
<div class="line"><a name="l00145"></a><span class="lineno"> 145</span>&#160; }</div>
<div class="line"><a name="l00146"></a><span class="lineno"> 146</span>&#160; InitEntry(index);</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; <span class="comment">// Initializes the whole address pool at once</span></div>
<div class="line"><a name="l00149"></a><span class="lineno"> 149</span>&#160;</div>
<div class="line"><a name="l00150"></a><span class="lineno"> 150</span>&#160; <span class="keywordtype">void</span> InitAllAddresses() {</div>
<div class="line"><a name="l00151"></a><span class="lineno"> 151</span>&#160; <span class="keywordflow">for</span>(uint8_t i = 1; i &lt; MAX_DEVICES_ALLOWED; i++)</div>
<div class="line"><a name="l00152"></a><span class="lineno"> 152</span>&#160; InitEntry(i);</div>
<div class="line"><a name="l00153"></a><span class="lineno"> 153</span>&#160;</div>
<div class="line"><a name="l00154"></a><span class="lineno"> 154</span>&#160; hubCounter = 0;</div>
<div class="line"><a name="l00155"></a><span class="lineno"> 155</span>&#160; };</div>
<div class="line"><a name="l00156"></a><span class="lineno"> 156</span>&#160;</div>
<div class="line"><a name="l00157"></a><span class="lineno"> 157</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00158"></a><span class="lineno"> 158</span>&#160;</div>
<div class="line"><a name="l00159"></a><span class="lineno"><a class="code" href="class_address_pool_impl.html#aeaf73d809ebb97bb1015789b8dc31ffa"> 159</a></span>&#160; <a class="code" href="class_address_pool_impl.html#aeaf73d809ebb97bb1015789b8dc31ffa">AddressPoolImpl</a>() : hubCounter(0) {</div>
<div class="line"><a name="l00160"></a><span class="lineno"> 160</span>&#160; <span class="comment">// Zero address is reserved</span></div>
<div class="line"><a name="l00161"></a><span class="lineno"> 161</span>&#160; InitEntry(0);</div>
<div class="line"><a name="l00162"></a><span class="lineno"> 162</span>&#160;</div>
<div class="line"><a name="l00163"></a><span class="lineno"> 163</span>&#160; hubCounter = 0;</div>
<div class="line"><a name="l00164"></a><span class="lineno"> 164</span>&#160; };</div>
<div class="line"><a name="l00165"></a><span class="lineno"> 165</span>&#160; </div>
<div class="line"><a name="l00166"></a><span class="lineno"> 166</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00167"></a><span class="lineno"><a class="code" href="class_address_pool_impl.html#aeaf73d809ebb97bb1015789b8dc31ffa"> 167</a></span>&#160; <a class="code" href="class_address_pool_impl.html#aeaf73d809ebb97bb1015789b8dc31ffa">AddressPoolImpl</a>() : hubCounter(0)</div>
<div class="line"><a name="l00168"></a><span class="lineno"> 168</span>&#160; {</div>
<div class="line"><a name="l00169"></a><span class="lineno"> 169</span>&#160; <span class="comment">// Zero address is reserved</span></div>
<div class="line"><a name="l00170"></a><span class="lineno"> 170</span>&#160; InitEntry(0);</div>
<div class="line"><a name="l00171"></a><span class="lineno"> 171</span>&#160;</div>
<div class="line"><a name="l00172"></a><span class="lineno"> 172</span>&#160; thePool[0].<a class="code" href="struct_usb_device.html#a855beb4cbe3e48b93298ea44d6cae86f">address</a> = 0;</div>
<div class="line"><a name="l00173"></a><span class="lineno"> 173</span>&#160; thePool[0].<a class="code" href="struct_usb_device.html#a410d39fb7758157f57794335e990ed02">epinfo</a> = &amp;dev0ep;</div>
<div class="line"><a name="l00174"></a><span class="lineno"> 174</span>&#160; dev0ep.<a class="code" href="struct_ep_info.html#a9f92be74c75c037b39e2cae1eb49b89b">epAddr</a> = 0;</div>
<div class="line"><a name="l00175"></a><span class="lineno"> 175</span>&#160; dev0ep.<a class="code" href="struct_ep_info.html#aa2ca775b63736df4008e88da7dd4dddb">maxPktSize</a> = 8;</div>
<div class="line"><a name="l00176"></a><span class="lineno"> 176</span>&#160; dev0ep.<a class="code" href="struct_ep_info.html#a1dea928517c961235eef7b0876e69f10">epAttribs</a> = 0; <span class="comment">//set DATA0/1 toggles to 0</span></div>
<div class="line"><a name="l00177"></a><span class="lineno"> 177</span>&#160; dev0ep.<a class="code" href="struct_ep_info.html#a3a5b1c017a034cd9e06e76729e727c46">bmNakPower</a> = <a class="code" href="address_8h.html#a517dfa014946e2d087d197312234a1de">USB_NAK_MAX_POWER</a>;</div>
<div class="line"><a name="l00178"></a><span class="lineno"> 178</span>&#160;</div>
<div class="line"><a name="l00179"></a><span class="lineno"> 179</span>&#160; InitAllAddresses();</div>
<div class="line"><a name="l00180"></a><span class="lineno"> 180</span>&#160; };</div>
<div class="line"><a name="l00181"></a><span class="lineno"> 181</span>&#160; <span class="comment">// Returns a pointer to a specified address entry</span></div>
<div class="line"><a name="l00182"></a><span class="lineno"><a class="code" href="class_address_pool_impl.html#aa3e12dda249ef6acbb27592fc8fe1cba"> 182</a></span>&#160; <span class="keyword">virtual</span> <a class="code" href="struct_usb_device.html">UsbDevice</a>* <a class="code" href="class_address_pool_impl.html#aa3e12dda249ef6acbb27592fc8fe1cba">GetUsbDevicePtr</a>(uint8_t addr)</div>
<div class="line"><a name="l00183"></a><span class="lineno"> 183</span>&#160; {</div>
<div class="line"><a name="l00184"></a><span class="lineno"> 184</span>&#160; <span class="keywordflow">if</span> (!addr)</div>
<div class="line"><a name="l00185"></a><span class="lineno"> 185</span>&#160; <span class="keywordflow">return</span> thePool;</div>
<div class="line"><a name="l00186"></a><span class="lineno"> 186</span>&#160;</div>
<div class="line"><a name="l00187"></a><span class="lineno"> 187</span>&#160; uint8_t index = FindAddressIndex(addr);</div>
<div class="line"><a name="l00163"></a><span class="lineno"> 163</span>&#160; thePool[0].<a class="code" href="struct_usb_device.html#a855beb4cbe3e48b93298ea44d6cae86f">address</a> = 0;</div>
<div class="line"><a name="l00164"></a><span class="lineno"> 164</span>&#160; thePool[0].<a class="code" href="struct_usb_device.html#a410d39fb7758157f57794335e990ed02">epinfo</a> = &amp;dev0ep;</div>
<div class="line"><a name="l00165"></a><span class="lineno"> 165</span>&#160; dev0ep.<a class="code" href="struct_ep_info.html#a9f92be74c75c037b39e2cae1eb49b89b">epAddr</a> = 0;</div>
<div class="line"><a name="l00166"></a><span class="lineno"> 166</span>&#160; dev0ep.<a class="code" href="struct_ep_info.html#aa2ca775b63736df4008e88da7dd4dddb">maxPktSize</a> = 8;</div>
<div class="line"><a name="l00167"></a><span class="lineno"> 167</span>&#160; dev0ep.<a class="code" href="struct_ep_info.html#a1dea928517c961235eef7b0876e69f10">epAttribs</a> = 0; <span class="comment">//set DATA0/1 toggles to 0</span></div>
<div class="line"><a name="l00168"></a><span class="lineno"> 168</span>&#160; dev0ep.<a class="code" href="struct_ep_info.html#a3a5b1c017a034cd9e06e76729e727c46">bmNakPower</a> = <a class="code" href="address_8h.html#a517dfa014946e2d087d197312234a1de">USB_NAK_MAX_POWER</a>;</div>
<div class="line"><a name="l00169"></a><span class="lineno"> 169</span>&#160;</div>
<div class="line"><a name="l00170"></a><span class="lineno"> 170</span>&#160; InitAllAddresses();</div>
<div class="line"><a name="l00171"></a><span class="lineno"> 171</span>&#160; };</div>
<div class="line"><a name="l00172"></a><span class="lineno"> 172</span>&#160; <span class="comment">// Returns a pointer to a specified address entry</span></div>
<div class="line"><a name="l00173"></a><span class="lineno"> 173</span>&#160;</div>
<div class="line"><a name="l00174"></a><span class="lineno"><a class="code" href="class_address_pool_impl.html#aa3e12dda249ef6acbb27592fc8fe1cba"> 174</a></span>&#160; <span class="keyword">virtual</span> <a class="code" href="struct_usb_device.html">UsbDevice</a>* <a class="code" href="class_address_pool_impl.html#aa3e12dda249ef6acbb27592fc8fe1cba">GetUsbDevicePtr</a>(uint8_t addr) {</div>
<div class="line"><a name="l00175"></a><span class="lineno"> 175</span>&#160; <span class="keywordflow">if</span>(!addr)</div>
<div class="line"><a name="l00176"></a><span class="lineno"> 176</span>&#160; <span class="keywordflow">return</span> thePool;</div>
<div class="line"><a name="l00177"></a><span class="lineno"> 177</span>&#160;</div>
<div class="line"><a name="l00178"></a><span class="lineno"> 178</span>&#160; uint8_t index = FindAddressIndex(addr);</div>
<div class="line"><a name="l00179"></a><span class="lineno"> 179</span>&#160;</div>
<div class="line"><a name="l00180"></a><span class="lineno"> 180</span>&#160; <span class="keywordflow">return</span>(!index) ? NULL : thePool + index;</div>
<div class="line"><a name="l00181"></a><span class="lineno"> 181</span>&#160; };</div>
<div class="line"><a name="l00182"></a><span class="lineno"> 182</span>&#160;</div>
<div class="line"><a name="l00183"></a><span class="lineno"> 183</span>&#160; <span class="comment">// Performs an operation specified by pfunc for each addressed device</span></div>
<div class="line"><a name="l00184"></a><span class="lineno"> 184</span>&#160;</div>
<div class="line"><a name="l00185"></a><span class="lineno"><a class="code" href="class_address_pool_impl.html#a09e6dc797f82543eba0879369116182e"> 185</a></span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_address_pool_impl.html#a09e6dc797f82543eba0879369116182e">ForEachUsbDevice</a>(<a class="code" href="address_8h.html#a90edb051235924cb5280032df397f393">UsbDeviceHandleFunc</a> pfunc) {</div>
<div class="line"><a name="l00186"></a><span class="lineno"> 186</span>&#160; <span class="keywordflow">if</span>(!pfunc)</div>
<div class="line"><a name="l00187"></a><span class="lineno"> 187</span>&#160; <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00188"></a><span class="lineno"> 188</span>&#160;</div>
<div class="line"><a name="l00189"></a><span class="lineno"> 189</span>&#160; <span class="keywordflow">return</span> (!index) ? NULL : thePool + index;</div>
<div class="line"><a name="l00190"></a><span class="lineno"> 190</span>&#160; };</div>
<div class="line"><a name="l00191"></a><span class="lineno"> 191</span>&#160; </div>
<div class="line"><a name="l00192"></a><span class="lineno"> 192</span>&#160; <span class="comment">// Performs an operation specified by pfunc for each addressed device</span></div>
<div class="line"><a name="l00193"></a><span class="lineno"><a class="code" href="class_address_pool_impl.html#a09e6dc797f82543eba0879369116182e"> 193</a></span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_address_pool_impl.html#a09e6dc797f82543eba0879369116182e">ForEachUsbDevice</a>(<a class="code" href="address_8h.html#a90edb051235924cb5280032df397f393">UsbDeviceHandleFunc</a> pfunc)</div>
<div class="line"><a name="l00194"></a><span class="lineno"> 194</span>&#160; {</div>
<div class="line"><a name="l00195"></a><span class="lineno"> 195</span>&#160; <span class="keywordflow">if</span> (!pfunc)</div>
<div class="line"><a name="l00196"></a><span class="lineno"> 196</span>&#160; <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00197"></a><span class="lineno"> 197</span>&#160;</div>
<div class="line"><a name="l00198"></a><span class="lineno"> 198</span>&#160; <span class="keywordflow">for</span> (uint8_t i=1; i&lt;MAX_DEVICES_ALLOWED; i++)</div>
<div class="line"><a name="l00199"></a><span class="lineno"> 199</span>&#160; <span class="keywordflow">if</span> (thePool[i].address)</div>
<div class="line"><a name="l00200"></a><span class="lineno"> 200</span>&#160; pfunc(thePool + i);</div>
<div class="line"><a name="l00201"></a><span class="lineno"> 201</span>&#160; };</div>
<div class="line"><a name="l00202"></a><span class="lineno"> 202</span>&#160; <span class="comment">// Allocates new address</span></div>
<div class="line"><a name="l00203"></a><span class="lineno"><a class="code" href="class_address_pool_impl.html#a14657183c73c631754b31bd0cc588c87"> 203</a></span>&#160; <span class="keyword">virtual</span> uint8_t <a class="code" href="class_address_pool_impl.html#a14657183c73c631754b31bd0cc588c87">AllocAddress</a>(uint8_t parent, <span class="keywordtype">bool</span> is_hub = <span class="keyword">false</span>, uint8_t port = 0)</div>
<div class="line"><a name="l00204"></a><span class="lineno"> 204</span>&#160; {</div>
<div class="line"><a name="l00205"></a><span class="lineno"> 205</span>&#160; <span class="comment">/* if (parent != 0 &amp;&amp; port == 0)</span></div>
<div class="line"><a name="l00206"></a><span class="lineno"> 206</span>&#160;<span class="comment"> Serial.println(&quot;PRT:0&quot;); */</span></div>
<div class="line"><a name="l00189"></a><span class="lineno"> 189</span>&#160; <span class="keywordflow">for</span>(uint8_t i = 1; i &lt; MAX_DEVICES_ALLOWED; i++)</div>
<div class="line"><a name="l00190"></a><span class="lineno"> 190</span>&#160; <span class="keywordflow">if</span>(thePool[i].address)</div>
<div class="line"><a name="l00191"></a><span class="lineno"> 191</span>&#160; pfunc(thePool + i);</div>
<div class="line"><a name="l00192"></a><span class="lineno"> 192</span>&#160; };</div>
<div class="line"><a name="l00193"></a><span class="lineno"> 193</span>&#160; <span class="comment">// Allocates new address</span></div>
<div class="line"><a name="l00194"></a><span class="lineno"> 194</span>&#160;</div>
<div class="line"><a name="l00195"></a><span class="lineno"><a class="code" href="class_address_pool_impl.html#a14657183c73c631754b31bd0cc588c87"> 195</a></span>&#160; <span class="keyword">virtual</span> uint8_t <a class="code" href="class_address_pool_impl.html#a14657183c73c631754b31bd0cc588c87">AllocAddress</a>(uint8_t parent, <span class="keywordtype">bool</span> is_hub = <span class="keyword">false</span>, uint8_t port = 0) {</div>
<div class="line"><a name="l00196"></a><span class="lineno"> 196</span>&#160; <span class="comment">/* if (parent != 0 &amp;&amp; port == 0)</span></div>
<div class="line"><a name="l00197"></a><span class="lineno"> 197</span>&#160;<span class="comment"> Serial.println(&quot;PRT:0&quot;); */</span></div>
<div class="line"><a name="l00198"></a><span class="lineno"> 198</span>&#160;</div>
<div class="line"><a name="l00199"></a><span class="lineno"> 199</span>&#160; <span class="keywordflow">if</span>(parent &gt; 127 || port &gt; 7)</div>
<div class="line"><a name="l00200"></a><span class="lineno"> 200</span>&#160; <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00201"></a><span class="lineno"> 201</span>&#160;</div>
<div class="line"><a name="l00202"></a><span class="lineno"> 202</span>&#160; <span class="keywordflow">if</span>(is_hub &amp;&amp; hubCounter == 7)</div>
<div class="line"><a name="l00203"></a><span class="lineno"> 203</span>&#160; <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00204"></a><span class="lineno"> 204</span>&#160;</div>
<div class="line"><a name="l00205"></a><span class="lineno"> 205</span>&#160; <span class="comment">// finds first empty address entry starting from one</span></div>
<div class="line"><a name="l00206"></a><span class="lineno"> 206</span>&#160; uint8_t index = FindAddressIndex(0);</div>
<div class="line"><a name="l00207"></a><span class="lineno"> 207</span>&#160;</div>
<div class="line"><a name="l00208"></a><span class="lineno"> 208</span>&#160; <span class="keywordflow">if</span> (parent &gt; 127 || port &gt; 7)</div>
<div class="line"><a name="l00208"></a><span class="lineno"> 208</span>&#160; <span class="keywordflow">if</span>(!index) <span class="comment">// if empty entry is not found</span></div>
<div class="line"><a name="l00209"></a><span class="lineno"> 209</span>&#160; <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00210"></a><span class="lineno"> 210</span>&#160;</div>
<div class="line"><a name="l00211"></a><span class="lineno"> 211</span>&#160; <span class="keywordflow">if</span> (is_hub &amp;&amp; hubCounter == 7)</div>
<div class="line"><a name="l00212"></a><span class="lineno"> 212</span>&#160; <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00213"></a><span class="lineno"> 213</span>&#160;</div>
<div class="line"><a name="l00214"></a><span class="lineno"> 214</span>&#160; <span class="comment">// finds first empty address entry starting from one</span></div>
<div class="line"><a name="l00215"></a><span class="lineno"> 215</span>&#160; uint8_t index = FindAddressIndex(0); </div>
<div class="line"><a name="l00216"></a><span class="lineno"> 216</span>&#160;</div>
<div class="line"><a name="l00217"></a><span class="lineno"> 217</span>&#160; <span class="keywordflow">if</span> (!index) <span class="comment">// if empty entry is not found</span></div>
<div class="line"><a name="l00218"></a><span class="lineno"> 218</span>&#160; <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00219"></a><span class="lineno"> 219</span>&#160;</div>
<div class="line"><a name="l00220"></a><span class="lineno"> 220</span>&#160; <span class="keywordflow">if</span> (parent == 0)</div>
<div class="line"><a name="l00221"></a><span class="lineno"> 221</span>&#160; {</div>
<div class="line"><a name="l00222"></a><span class="lineno"> 222</span>&#160; <span class="keywordflow">if</span> (is_hub)</div>
<div class="line"><a name="l00223"></a><span class="lineno"> 223</span>&#160; {</div>
<div class="line"><a name="l00224"></a><span class="lineno"> 224</span>&#160; thePool[index].<a class="code" href="struct_usb_device.html#a855beb4cbe3e48b93298ea44d6cae86f">address</a> = 0x41;</div>
<div class="line"><a name="l00225"></a><span class="lineno"> 225</span>&#160; hubCounter ++;</div>
<div class="line"><a name="l00226"></a><span class="lineno"> 226</span>&#160; }</div>
<div class="line"><a name="l00227"></a><span class="lineno"> 227</span>&#160; <span class="keywordflow">else</span></div>
<div class="line"><a name="l00228"></a><span class="lineno"> 228</span>&#160; thePool[index].<a class="code" href="struct_usb_device.html#a855beb4cbe3e48b93298ea44d6cae86f">address</a> = 1;</div>
<div class="line"><a name="l00229"></a><span class="lineno"> 229</span>&#160;</div>
<div class="line"><a name="l00230"></a><span class="lineno"> 230</span>&#160; <span class="keywordflow">return</span> thePool[index].<a class="code" href="struct_usb_device.html#a855beb4cbe3e48b93298ea44d6cae86f">address</a>;</div>
<div class="line"><a name="l00211"></a><span class="lineno"> 211</span>&#160; <span class="keywordflow">if</span>(parent == 0) {</div>
<div class="line"><a name="l00212"></a><span class="lineno"> 212</span>&#160; <span class="keywordflow">if</span>(is_hub) {</div>
<div class="line"><a name="l00213"></a><span class="lineno"> 213</span>&#160; thePool[index].<a class="code" href="struct_usb_device.html#a855beb4cbe3e48b93298ea44d6cae86f">address</a> = 0x41;</div>
<div class="line"><a name="l00214"></a><span class="lineno"> 214</span>&#160; hubCounter++;</div>
<div class="line"><a name="l00215"></a><span class="lineno"> 215</span>&#160; } <span class="keywordflow">else</span></div>
<div class="line"><a name="l00216"></a><span class="lineno"> 216</span>&#160; thePool[index].<a class="code" href="struct_usb_device.html#a855beb4cbe3e48b93298ea44d6cae86f">address</a> = 1;</div>
<div class="line"><a name="l00217"></a><span class="lineno"> 217</span>&#160;</div>
<div class="line"><a name="l00218"></a><span class="lineno"> 218</span>&#160; <span class="keywordflow">return</span> thePool[index].<a class="code" href="struct_usb_device.html#a855beb4cbe3e48b93298ea44d6cae86f">address</a>;</div>
<div class="line"><a name="l00219"></a><span class="lineno"> 219</span>&#160; }</div>
<div class="line"><a name="l00220"></a><span class="lineno"> 220</span>&#160;</div>
<div class="line"><a name="l00221"></a><span class="lineno"> 221</span>&#160; <a class="code" href="struct_usb_device_address.html">UsbDeviceAddress</a> addr;</div>
<div class="line"><a name="l00222"></a><span class="lineno"> 222</span>&#160;</div>
<div class="line"><a name="l00223"></a><span class="lineno"> 223</span>&#160; addr.<a class="code" href="struct_usb_device_address.html#abd628d37834249af6518f320f3f19065">bmParent</a> = ((<a class="code" href="struct_usb_device_address.html">UsbDeviceAddress</a>*) &amp; parent)-&gt;bmAddress;</div>
<div class="line"><a name="l00224"></a><span class="lineno"> 224</span>&#160;</div>
<div class="line"><a name="l00225"></a><span class="lineno"> 225</span>&#160; <span class="keywordflow">if</span>(is_hub) {</div>
<div class="line"><a name="l00226"></a><span class="lineno"> 226</span>&#160; addr.<a class="code" href="struct_usb_device_address.html#a0a8f124a7e7a2ba116e70c2fbf0c551e">bmHub</a> = 1;</div>
<div class="line"><a name="l00227"></a><span class="lineno"> 227</span>&#160; addr.<a class="code" href="struct_usb_device_address.html#ae12b0ac1b76a34d0a5080cc62f41c622">bmAddress</a> = ++hubCounter;</div>
<div class="line"><a name="l00228"></a><span class="lineno"> 228</span>&#160; } <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00229"></a><span class="lineno"> 229</span>&#160; addr.<a class="code" href="struct_usb_device_address.html#a0a8f124a7e7a2ba116e70c2fbf0c551e">bmHub</a> = 0;</div>
<div class="line"><a name="l00230"></a><span class="lineno"> 230</span>&#160; addr.<a class="code" href="struct_usb_device_address.html#ae12b0ac1b76a34d0a5080cc62f41c622">bmAddress</a> = port;</div>
<div class="line"><a name="l00231"></a><span class="lineno"> 231</span>&#160; }</div>
<div class="line"><a name="l00232"></a><span class="lineno"> 232</span>&#160;</div>
<div class="line"><a name="l00233"></a><span class="lineno"> 233</span>&#160; <a class="code" href="struct_usb_device_address.html">UsbDeviceAddress</a> addr;</div>
<div class="line"><a name="l00234"></a><span class="lineno"> 234</span>&#160;</div>
<div class="line"><a name="l00235"></a><span class="lineno"> 235</span>&#160; addr.<a class="code" href="struct_usb_device_address.html#abd628d37834249af6518f320f3f19065">bmParent</a> = ((<a class="code" href="struct_usb_device_address.html">UsbDeviceAddress</a>*)&amp;parent)-&gt;bmAddress;</div>
<div class="line"><a name="l00236"></a><span class="lineno"> 236</span>&#160;</div>
<div class="line"><a name="l00237"></a><span class="lineno"> 237</span>&#160; <span class="keywordflow">if</span> (is_hub)</div>
<div class="line"><a name="l00238"></a><span class="lineno"> 238</span>&#160; {</div>
<div class="line"><a name="l00239"></a><span class="lineno"> 239</span>&#160; addr.<a class="code" href="struct_usb_device_address.html#a0a8f124a7e7a2ba116e70c2fbf0c551e">bmHub</a> = 1;</div>
<div class="line"><a name="l00240"></a><span class="lineno"> 240</span>&#160; addr.<a class="code" href="struct_usb_device_address.html#ae12b0ac1b76a34d0a5080cc62f41c622">bmAddress</a> = ++hubCounter;</div>
<div class="line"><a name="l00241"></a><span class="lineno"> 241</span>&#160; }</div>
<div class="line"><a name="l00242"></a><span class="lineno"> 242</span>&#160; <span class="keywordflow">else</span></div>
<div class="line"><a name="l00243"></a><span class="lineno"> 243</span>&#160; {</div>
<div class="line"><a name="l00244"></a><span class="lineno"> 244</span>&#160; addr.<a class="code" href="struct_usb_device_address.html#a0a8f124a7e7a2ba116e70c2fbf0c551e">bmHub</a> = 0;</div>
<div class="line"><a name="l00245"></a><span class="lineno"> 245</span>&#160; addr.<a class="code" href="struct_usb_device_address.html#ae12b0ac1b76a34d0a5080cc62f41c622">bmAddress</a> = port;</div>
<div class="line"><a name="l00246"></a><span class="lineno"> 246</span>&#160; }</div>
<div class="line"><a name="l00247"></a><span class="lineno"> 247</span>&#160; thePool[index].<a class="code" href="struct_usb_device.html#a855beb4cbe3e48b93298ea44d6cae86f">address</a> = *((uint8_t*)&amp;addr);</div>
<div class="line"><a name="l00248"></a><span class="lineno"> 248</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00249"></a><span class="lineno"> 249</span>&#160;<span class="comment"> Serial.print(&quot;Addr:&quot;);</span></div>
<div class="line"><a name="l00250"></a><span class="lineno"> 250</span>&#160;<span class="comment"> Serial.print(addr.bmHub, HEX);</span></div>
<div class="line"><a name="l00251"></a><span class="lineno"> 251</span>&#160;<span class="comment"> Serial.print(&quot;.&quot;);</span></div>
<div class="line"><a name="l00252"></a><span class="lineno"> 252</span>&#160;<span class="comment"> Serial.print(addr.bmParent, HEX);</span></div>
<div class="line"><a name="l00253"></a><span class="lineno"> 253</span>&#160;<span class="comment"> Serial.print(&quot;.&quot;);</span></div>
<div class="line"><a name="l00254"></a><span class="lineno"> 254</span>&#160;<span class="comment"> Serial.println(addr.bmAddress, HEX);</span></div>
<div class="line"><a name="l00255"></a><span class="lineno"> 255</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l00256"></a><span class="lineno"> 256</span>&#160; <span class="keywordflow">return</span> thePool[index].<a class="code" href="struct_usb_device.html#a855beb4cbe3e48b93298ea44d6cae86f">address</a>;</div>
<div class="line"><a name="l00257"></a><span class="lineno"> 257</span>&#160; };</div>
<div class="line"><a name="l00258"></a><span class="lineno"> 258</span>&#160; <span class="comment">// Empties pool entry</span></div>
<div class="line"><a name="l00259"></a><span class="lineno"><a class="code" href="class_address_pool_impl.html#a3d59841faa336c359b0736ca45988ce5"> 259</a></span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_address_pool_impl.html#a3d59841faa336c359b0736ca45988ce5">FreeAddress</a>(uint8_t addr)</div>
<div class="line"><a name="l00260"></a><span class="lineno"> 260</span>&#160; {</div>
<div class="line"><a name="l00261"></a><span class="lineno"> 261</span>&#160; <span class="comment">// if the root hub is disconnected all the addresses should be initialized</span></div>
<div class="line"><a name="l00262"></a><span class="lineno"> 262</span>&#160; <span class="keywordflow">if</span> (addr == 0x41)</div>
<div class="line"><a name="l00263"></a><span class="lineno"> 263</span>&#160; {</div>
<div class="line"><a name="l00264"></a><span class="lineno"> 264</span>&#160; InitAllAddresses();</div>
<div class="line"><a name="l00265"></a><span class="lineno"> 265</span>&#160; <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00266"></a><span class="lineno"> 266</span>&#160; }</div>
<div class="line"><a name="l00267"></a><span class="lineno"> 267</span>&#160; uint8_t index = FindAddressIndex(addr);</div>
<div class="line"><a name="l00268"></a><span class="lineno"> 268</span>&#160; FreeAddressByIndex(index);</div>
<div class="line"><a name="l00269"></a><span class="lineno"> 269</span>&#160; };</div>
<div class="line"><a name="l00270"></a><span class="lineno"> 270</span>&#160; <span class="comment">// Returns number of hubs attached</span></div>
<div class="line"><a name="l00271"></a><span class="lineno"> 271</span>&#160; <span class="comment">// It can be rather helpfull to find out if there are hubs attached than getting the exact number of hubs.</span></div>
<div class="line"><a name="l00272"></a><span class="lineno"> 272</span>&#160; <span class="comment">//uint8_t GetNumHubs()</span></div>
<div class="line"><a name="l00273"></a><span class="lineno"> 273</span>&#160; <span class="comment">//{</span></div>
<div class="line"><a name="l00274"></a><span class="lineno"> 274</span>&#160; <span class="comment">// return hubCounter;</span></div>
<div class="line"><a name="l00275"></a><span class="lineno"> 275</span>&#160; <span class="comment">//};</span></div>
<div class="line"><a name="l00276"></a><span class="lineno"> 276</span>&#160; <span class="comment">//uint8_t GetNumDevices()</span></div>
<div class="line"><a name="l00277"></a><span class="lineno"> 277</span>&#160; <span class="comment">//{</span></div>
<div class="line"><a name="l00278"></a><span class="lineno"> 278</span>&#160; <span class="comment">// uint8_t counter = 0;</span></div>
<div class="line"><a name="l00279"></a><span class="lineno"> 279</span>&#160;</div>
<div class="line"><a name="l00280"></a><span class="lineno"> 280</span>&#160; <span class="comment">// for (uint8_t i=1; i&lt;MAX_DEVICES_ALLOWED; i++)</span></div>
<div class="line"><a name="l00281"></a><span class="lineno"> 281</span>&#160; <span class="comment">// if (thePool[i].address != 0);</span></div>
<div class="line"><a name="l00282"></a><span class="lineno"> 282</span>&#160; <span class="comment">// counter ++;</span></div>
<div class="line"><a name="l00283"></a><span class="lineno"> 283</span>&#160;</div>
<div class="line"><a name="l00284"></a><span class="lineno"> 284</span>&#160; <span class="comment">// return counter;</span></div>
<div class="line"><a name="l00285"></a><span class="lineno"> 285</span>&#160; <span class="comment">//};</span></div>
<div class="line"><a name="l00286"></a><span class="lineno"> 286</span>&#160;};</div>
<div class="line"><a name="l00287"></a><span class="lineno"> 287</span>&#160;</div>
<div class="line"><a name="l00288"></a><span class="lineno"> 288</span>&#160;<span class="preprocessor">#endif // __ADDRESS_H__</span></div>
<div class="line"><a name="l00232"></a><span class="lineno"> 232</span>&#160; thePool[index].<a class="code" href="struct_usb_device.html#a855beb4cbe3e48b93298ea44d6cae86f">address</a> = *((uint8_t*) &amp; addr);</div>
<div class="line"><a name="l00233"></a><span class="lineno"> 233</span>&#160; <span class="comment">/*</span></div>
<div class="line"><a name="l00234"></a><span class="lineno"> 234</span>&#160;<span class="comment"> Serial.print(&quot;Addr:&quot;);</span></div>
<div class="line"><a name="l00235"></a><span class="lineno"> 235</span>&#160;<span class="comment"> Serial.print(addr.bmHub, HEX);</span></div>
<div class="line"><a name="l00236"></a><span class="lineno"> 236</span>&#160;<span class="comment"> Serial.print(&quot;.&quot;);</span></div>
<div class="line"><a name="l00237"></a><span class="lineno"> 237</span>&#160;<span class="comment"> Serial.print(addr.bmParent, HEX);</span></div>
<div class="line"><a name="l00238"></a><span class="lineno"> 238</span>&#160;<span class="comment"> Serial.print(&quot;.&quot;);</span></div>
<div class="line"><a name="l00239"></a><span class="lineno"> 239</span>&#160;<span class="comment"> Serial.println(addr.bmAddress, HEX);</span></div>
<div class="line"><a name="l00240"></a><span class="lineno"> 240</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00241"></a><span class="lineno"> 241</span>&#160; <span class="keywordflow">return</span> thePool[index].<a class="code" href="struct_usb_device.html#a855beb4cbe3e48b93298ea44d6cae86f">address</a>;</div>
<div class="line"><a name="l00242"></a><span class="lineno"> 242</span>&#160; };</div>
<div class="line"><a name="l00243"></a><span class="lineno"> 243</span>&#160; <span class="comment">// Empties pool entry</span></div>
<div class="line"><a name="l00244"></a><span class="lineno"> 244</span>&#160;</div>
<div class="line"><a name="l00245"></a><span class="lineno"><a class="code" href="class_address_pool_impl.html#a3d59841faa336c359b0736ca45988ce5"> 245</a></span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_address_pool_impl.html#a3d59841faa336c359b0736ca45988ce5">FreeAddress</a>(uint8_t addr) {</div>
<div class="line"><a name="l00246"></a><span class="lineno"> 246</span>&#160; <span class="comment">// if the root hub is disconnected all the addresses should be initialized</span></div>
<div class="line"><a name="l00247"></a><span class="lineno"> 247</span>&#160; <span class="keywordflow">if</span>(addr == 0x41) {</div>
<div class="line"><a name="l00248"></a><span class="lineno"> 248</span>&#160; InitAllAddresses();</div>
<div class="line"><a name="l00249"></a><span class="lineno"> 249</span>&#160; <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00250"></a><span class="lineno"> 250</span>&#160; }</div>
<div class="line"><a name="l00251"></a><span class="lineno"> 251</span>&#160; uint8_t index = FindAddressIndex(addr);</div>
<div class="line"><a name="l00252"></a><span class="lineno"> 252</span>&#160; FreeAddressByIndex(index);</div>
<div class="line"><a name="l00253"></a><span class="lineno"> 253</span>&#160; };</div>
<div class="line"><a name="l00254"></a><span class="lineno"> 254</span>&#160; <span class="comment">// Returns number of hubs attached</span></div>
<div class="line"><a name="l00255"></a><span class="lineno"> 255</span>&#160; <span class="comment">// It can be rather helpfull to find out if there are hubs attached than getting the exact number of hubs.</span></div>
<div class="line"><a name="l00256"></a><span class="lineno"> 256</span>&#160; <span class="comment">//uint8_t GetNumHubs()</span></div>
<div class="line"><a name="l00257"></a><span class="lineno"> 257</span>&#160; <span class="comment">//{</span></div>
<div class="line"><a name="l00258"></a><span class="lineno"> 258</span>&#160; <span class="comment">// return hubCounter;</span></div>
<div class="line"><a name="l00259"></a><span class="lineno"> 259</span>&#160; <span class="comment">//};</span></div>
<div class="line"><a name="l00260"></a><span class="lineno"> 260</span>&#160; <span class="comment">//uint8_t GetNumDevices()</span></div>
<div class="line"><a name="l00261"></a><span class="lineno"> 261</span>&#160; <span class="comment">//{</span></div>
<div class="line"><a name="l00262"></a><span class="lineno"> 262</span>&#160; <span class="comment">// uint8_t counter = 0;</span></div>
<div class="line"><a name="l00263"></a><span class="lineno"> 263</span>&#160;</div>
<div class="line"><a name="l00264"></a><span class="lineno"> 264</span>&#160; <span class="comment">// for (uint8_t i=1; i&lt;MAX_DEVICES_ALLOWED; i++)</span></div>
<div class="line"><a name="l00265"></a><span class="lineno"> 265</span>&#160; <span class="comment">// if (thePool[i].address != 0);</span></div>
<div class="line"><a name="l00266"></a><span class="lineno"> 266</span>&#160; <span class="comment">// counter ++;</span></div>
<div class="line"><a name="l00267"></a><span class="lineno"> 267</span>&#160;</div>
<div class="line"><a name="l00268"></a><span class="lineno"> 268</span>&#160; <span class="comment">// return counter;</span></div>
<div class="line"><a name="l00269"></a><span class="lineno"> 269</span>&#160; <span class="comment">//};</span></div>
<div class="line"><a name="l00270"></a><span class="lineno"> 270</span>&#160;};</div>
<div class="line"><a name="l00271"></a><span class="lineno"> 271</span>&#160;</div>
<div class="line"><a name="l00272"></a><span class="lineno"> 272</span>&#160;<span class="preprocessor">#endif // __ADDRESS_H__</span></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>

View file

@ -95,7 +95,7 @@ Include dependency graph for adk.cpp:</div>
<div class="dyncontent">
<div class="center"><img src="adk_8cpp__incl.png" border="0" usemap="#adk_8cpp" alt=""/></div>
<map name="adk_8cpp" id="adk_8cpp">
<area shape="rect" id="node2" href="adk_8h.html" title="adk.h" alt="" coords="706,75,747,96"/><area shape="rect" id="node5" href="avrpins_8h.html" title="avrpins.h" alt="" coords="79,283,133,304"/><area shape="rect" id="node7" href="max3421e_8h.html" title="max3421e.h" alt="" coords="213,283,280,304"/><area shape="rect" id="node8" href="usbhost_8h.html" title="usbhost.h" alt="" coords="195,213,252,235"/><area shape="rect" id="node9" href="usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="613,283,672,304"/><area shape="rect" id="node10" href="_usb_8h.html" title="Usb.h" alt="" coords="477,144,520,165"/><area shape="rect" id="node15" href="printhex_8h.html" title="printhex.h" alt="" coords="1151,352,1208,373"/><area shape="rect" id="node16" href="hexdump_8h.html" title="hexdump.h" alt="" coords="1104,283,1165,304"/><area shape="rect" id="node17" href="message_8h.html" title="message.h" alt="" coords="816,283,877,304"/><area shape="rect" id="node18" href="confdescparser_8h.html" title="confdescparser.h" alt="" coords="933,144,1016,165"/><area shape="rect" id="node12" href="address_8h.html" title="address.h" alt="" coords="430,213,487,235"/><area shape="rect" id="node19" href="parsetools_8h.html" title="parsetools.h" alt="" coords="942,213,1007,235"/></map>
<area shape="rect" id="node2" href="adk_8h.html" title="adk.h" alt="" coords="533,75,573,96"/><area shape="rect" id="node5" href="avrpins_8h.html" title="avrpins.h" alt="" coords="89,283,143,304"/><area shape="rect" id="node7" href="max3421e_8h.html" title="max3421e.h" alt="" coords="283,283,349,304"/><area shape="rect" id="node8" href="usbhost_8h.html" title="usbhost.h" alt="" coords="73,213,129,235"/><area shape="rect" id="node9" href="usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="5,283,64,304"/><area shape="rect" id="node10" href="_usb_8h.html" title="Usb.h" alt="" coords="288,144,331,165"/><area shape="rect" id="node16" href="printhex_8h.html" title="printhex.h" alt="" coords="949,352,1005,373"/><area shape="rect" id="node17" href="hexdump_8h.html" title="hexdump.h" alt="" coords="701,352,763,373"/><area shape="rect" id="node15" href="message_8h.html" title="message.h" alt="" coords="701,283,763,304"/><area shape="rect" id="node18" href="confdescparser_8h.html" title="confdescparser.h" alt="" coords="739,144,823,165"/><area shape="rect" id="node12" href="address_8h.html" title="address.h" alt="" coords="433,213,489,235"/><area shape="rect" id="node19" href="parsetools_8h.html" title="parsetools.h" alt="" coords="819,213,884,235"/></map>
</div>
</div>
<p><a href="adk_8cpp_source.html">Go to the source code of this file.</a></p>

View file

@ -1,14 +1,14 @@
<map id="adk.cpp" name="adk.cpp">
<area shape="rect" id="node2" href="$adk_8h.html" title="adk.h" alt="" coords="706,75,747,96"/>
<area shape="rect" id="node5" href="$avrpins_8h.html" title="avrpins.h" alt="" coords="79,283,133,304"/>
<area shape="rect" id="node7" href="$max3421e_8h.html" title="max3421e.h" alt="" coords="213,283,280,304"/>
<area shape="rect" id="node8" href="$usbhost_8h.html" title="usbhost.h" alt="" coords="195,213,252,235"/>
<area shape="rect" id="node9" href="$usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="613,283,672,304"/>
<area shape="rect" id="node10" href="$_usb_8h.html" title="Usb.h" alt="" coords="477,144,520,165"/>
<area shape="rect" id="node15" href="$printhex_8h.html" title="printhex.h" alt="" coords="1151,352,1208,373"/>
<area shape="rect" id="node16" href="$hexdump_8h.html" title="hexdump.h" alt="" coords="1104,283,1165,304"/>
<area shape="rect" id="node17" href="$message_8h.html" title="message.h" alt="" coords="816,283,877,304"/>
<area shape="rect" id="node18" href="$confdescparser_8h.html" title="confdescparser.h" alt="" coords="933,144,1016,165"/>
<area shape="rect" id="node12" href="$address_8h.html" title="address.h" alt="" coords="430,213,487,235"/>
<area shape="rect" id="node19" href="$parsetools_8h.html" title="parsetools.h" alt="" coords="942,213,1007,235"/>
<area shape="rect" id="node2" href="$adk_8h.html" title="adk.h" alt="" coords="533,75,573,96"/>
<area shape="rect" id="node5" href="$avrpins_8h.html" title="avrpins.h" alt="" coords="89,283,143,304"/>
<area shape="rect" id="node7" href="$max3421e_8h.html" title="max3421e.h" alt="" coords="283,283,349,304"/>
<area shape="rect" id="node8" href="$usbhost_8h.html" title="usbhost.h" alt="" coords="73,213,129,235"/>
<area shape="rect" id="node9" href="$usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="5,283,64,304"/>
<area shape="rect" id="node10" href="$_usb_8h.html" title="Usb.h" alt="" coords="288,144,331,165"/>
<area shape="rect" id="node16" href="$printhex_8h.html" title="printhex.h" alt="" coords="949,352,1005,373"/>
<area shape="rect" id="node17" href="$hexdump_8h.html" title="hexdump.h" alt="" coords="701,352,763,373"/>
<area shape="rect" id="node15" href="$message_8h.html" title="message.h" alt="" coords="701,283,763,304"/>
<area shape="rect" id="node18" href="$confdescparser_8h.html" title="confdescparser.h" alt="" coords="739,144,823,165"/>
<area shape="rect" id="node12" href="$address_8h.html" title="address.h" alt="" coords="433,213,489,235"/>
<area shape="rect" id="node19" href="$parsetools_8h.html" title="parsetools.h" alt="" coords="819,213,884,235"/>
</map>

View file

@ -1 +1 @@
f975598aa39e612926199ebe40b2af46
8e1a236ca758d488357f4e29241421de

Binary file not shown.

Before

Width:  |  Height:  |  Size: 129 KiB

After

Width:  |  Height:  |  Size: 124 KiB

View file

@ -120,28 +120,28 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span>&#160; <span class="keyword">const</span> <span class="keywordtype">char</span>* uri,</div>
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span>&#160; <span class="keyword">const</span> <span class="keywordtype">char</span>* serial) :</div>
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span>&#160;</div>
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span>&#160; pUsb(p), <span class="comment">//pointer to USB class instance - mandatory</span></div>
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span>&#160; bAddress(0), <span class="comment">//device address - mandatory </span></div>
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span>&#160; bNumEP(1), <span class="comment">//if config descriptor needs to be parsed</span></div>
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span>&#160; ready(false),</div>
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span>&#160; </div>
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span>&#160; <span class="comment">/* ADK ID Strings */</span></div>
<div class="line"><a name="l00038"></a><span class="lineno"> 38</span>&#160; </div>
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span>&#160; manufacturer(manufacturer),</div>
<div class="line"><a name="l00040"></a><span class="lineno"> 40</span>&#160; model(model),</div>
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span>&#160; description(description),</div>
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span>&#160; version(version),</div>
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span>&#160; uri(uri),</div>
<div class="line"><a name="l00044"></a><span class="lineno"> 44</span>&#160; serial(serial)</div>
<div class="line"><a name="l00045"></a><span class="lineno"> 45</span>&#160; </div>
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span>&#160;{</div>
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span>&#160; <span class="comment">// initialize endpoint data structures</span></div>
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span>&#160; <span class="keywordflow">for</span>(uint8_t i=0; i&lt;<a class="code" href="adk_8h.html#ac39da606ffc273bd855152107297d6a1">ADK_MAX_ENDPOINTS</a>; i++) {</div>
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span>&#160; <a class="code" href="class_a_d_k.html#a6ffc693d731ddeb9499c11e893fc467d">epInfo</a>[i].<a class="code" href="struct_ep_info.html#a9f92be74c75c037b39e2cae1eb49b89b">epAddr</a> = 0;</div>
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span>&#160; <a class="code" href="class_a_d_k.html#a6ffc693d731ddeb9499c11e893fc467d">epInfo</a>[i].<a class="code" href="struct_ep_info.html#aa2ca775b63736df4008e88da7dd4dddb">maxPktSize</a> = (i) ? 0 : 8;</div>
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>&#160; <a class="code" href="class_a_d_k.html#a6ffc693d731ddeb9499c11e893fc467d">epInfo</a>[i].<a class="code" href="struct_ep_info.html#a1dea928517c961235eef7b0876e69f10">epAttribs</a> = 0;</div>
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span>&#160; <a class="code" href="class_a_d_k.html#a6ffc693d731ddeb9499c11e893fc467d">epInfo</a>[i].<a class="code" href="struct_ep_info.html#a3a5b1c017a034cd9e06e76729e727c46">bmNakPower</a> = (i) ? <a class="code" href="address_8h.html#a660e8da9c1167a8450aef91c5c03761d">USB_NAK_NOWAIT</a> : <a class="code" href="address_8h.html#a517dfa014946e2d087d197312234a1de">USB_NAK_MAX_POWER</a>;</div>
<div class="line"><a name="l00053"></a><span class="lineno"> 53</span>&#160; }<span class="comment">//for(uint8_t i=0; i&lt;ADK_MAX_ENDPOINTS; i++...</span></div>
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span>&#160;<span class="comment">/* ADK ID Strings */</span></div>
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span>&#160;</div>
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span>&#160;manufacturer(manufacturer),</div>
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span>&#160;model(model),</div>
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span>&#160;description(description),</div>
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span>&#160;version(version),</div>
<div class="line"><a name="l00038"></a><span class="lineno"> 38</span>&#160;uri(uri),</div>
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span>&#160;serial(serial),</div>
<div class="line"><a name="l00040"></a><span class="lineno"> 40</span>&#160;pUsb(p), <span class="comment">//pointer to USB class instance - mandatory</span></div>
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span>&#160;bAddress(0), <span class="comment">//device address - mandatory</span></div>
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span>&#160;bConfNum(0), <span class="comment">//configuration number</span></div>
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span>&#160;bNumEP(1), <span class="comment">//if config descriptor needs to be parsed</span></div>
<div class="line"><a name="l00044"></a><span class="lineno"> 44</span>&#160;ready(false) {</div>
<div class="line"><a name="l00045"></a><span class="lineno"> 45</span>&#160; <span class="comment">// initialize endpoint data structures</span></div>
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span>&#160; <span class="keywordflow">for</span> (uint8_t i = 0; i &lt; <a class="code" href="adk_8h.html#ac39da606ffc273bd855152107297d6a1">ADK_MAX_ENDPOINTS</a>; i++) {</div>
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span>&#160; <a class="code" href="class_a_d_k.html#a6ffc693d731ddeb9499c11e893fc467d">epInfo</a>[i].<a class="code" href="struct_ep_info.html#a9f92be74c75c037b39e2cae1eb49b89b">epAddr</a> = 0;</div>
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span>&#160; <a class="code" href="class_a_d_k.html#a6ffc693d731ddeb9499c11e893fc467d">epInfo</a>[i].<a class="code" href="struct_ep_info.html#aa2ca775b63736df4008e88da7dd4dddb">maxPktSize</a> = (i) ? 0 : 8;</div>
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span>&#160; <a class="code" href="class_a_d_k.html#a6ffc693d731ddeb9499c11e893fc467d">epInfo</a>[i].<a class="code" href="struct_ep_info.html#a1dea928517c961235eef7b0876e69f10">epAttribs</a> = (0xfc &amp; (<a class="code" href="address_8h.html#a517dfa014946e2d087d197312234a1de">USB_NAK_MAX_POWER</a> &lt;&lt; 2));</div>
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span>&#160; }<span class="comment">//for(uint8_t i=0; i&lt;ADK_MAX_ENDPOINTS; i++...</span></div>
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>&#160;</div>
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span>&#160; <span class="comment">//set bulk-IN EP naklimit to 1</span></div>
<div class="line"><a name="l00053"></a><span class="lineno"> 53</span>&#160; <a class="code" href="class_a_d_k.html#a6ffc693d731ddeb9499c11e893fc467d">epInfo</a>[<a class="code" href="class_a_d_k.html#a964ec80ac133bf8d65cf0274e37b29da">epDataInIndex</a>].<a class="code" href="struct_ep_info.html#a1dea928517c961235eef7b0876e69f10">epAttribs</a> = (0xfc &amp; (<a class="code" href="address_8h.html#a660e8da9c1167a8450aef91c5c03761d">USB_NAK_NOWAIT</a> &lt;&lt; 2));</div>
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span>&#160;</div>
<div class="line"><a name="l00055"></a><span class="lineno"> 55</span>&#160; <span class="comment">// register in USB subsystem</span></div>
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>&#160; <span class="keywordflow">if</span> (<a class="code" href="class_a_d_k.html#ab28e3a19569c27f3ed5362e9800065c1">pUsb</a>) {</div>
@ -150,300 +150,277 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span>&#160;}</div>
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span>&#160;</div>
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span>&#160;<span class="comment">/* Connection initialization of an Android phone */</span></div>
<div class="line"><a name="l00062"></a><span class="lineno"><a class="code" href="class_a_d_k.html#a8c5c2e212c748966ccd863499d202063"> 62</a></span>&#160;uint8_t <a class="code" href="class_a_d_k.html#a8c5c2e212c748966ccd863499d202063">ADK::Init</a>(uint8_t parent, uint8_t port, <span class="keywordtype">bool</span> lowspeed)</div>
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span>&#160;{</div>
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>&#160; </div>
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>&#160; uint8_t buf[<span class="keyword">sizeof</span>(<a class="code" href="struct_u_s_b___d_e_v_i_c_e___d_e_s_c_r_i_p_t_o_r.html">USB_DEVICE_DESCRIPTOR</a>)];</div>
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>&#160; uint8_t rcode;</div>
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span>&#160; <a class="code" href="struct_usb_device.html">UsbDevice</a> *p = NULL;</div>
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>&#160; <a class="code" href="struct_ep_info.html">EpInfo</a> *oldep_ptr = NULL;</div>
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>&#160; uint8_t num_of_conf; <span class="comment">// number of configurations</span></div>
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>&#160; </div>
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>&#160; <span class="comment">// get memory address of USB device address pool</span></div>
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>&#160; <a class="code" href="class_address_pool.html">AddressPool</a> &amp;addrPool = <a class="code" href="class_a_d_k.html#ab28e3a19569c27f3ed5362e9800065c1">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a66ab8f5eda239e761d5a48741ea1f9d4">GetAddressPool</a>();</div>
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span>&#160;</div>
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span>&#160; <a class="code" href="_usb_8h.html#afc6fe7f947af35317a49a4dcfc8189fd">USBTRACE</a>(<span class="stringliteral">&quot;\r\nADK Init&quot;</span>);</div>
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span>&#160; </div>
<div class="line"><a name="l00076"></a><span class="lineno"> 76</span>&#160; <span class="comment">// check if address has already been assigned to an instance</span></div>
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span>&#160; <span class="keywordflow">if</span> (<a class="code" href="class_a_d_k.html#ab22a7c60cec56823727d4ff2cf2c4edf">bAddress</a>) {</div>
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span>&#160; <a class="code" href="_usb_8h.html#afc6fe7f947af35317a49a4dcfc8189fd">USBTRACE</a>(<span class="stringliteral">&quot;\r\nAddress in use&quot;</span>);</div>
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>&#160; <span class="keywordflow">return</span> <a class="code" href="_usb_8h.html#a44416ff64fc0e3691f98addac13d4595">USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE</a>;</div>
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>&#160; }</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="comment">// Get pointer to pseudo device with address 0 assigned</span></div>
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span>&#160; p = addrPool.<a class="code" href="class_address_pool.html#aa92d7e8f0f515340ae2dc1679b627056">GetUsbDevicePtr</a>(0);</div>
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span>&#160;</div>
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span>&#160; <span class="keywordflow">if</span> (!p) {</div>
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span>&#160; <a class="code" href="_usb_8h.html#afc6fe7f947af35317a49a4dcfc8189fd">USBTRACE</a>(<span class="stringliteral">&quot;\r\nAddress not found&quot;</span>);</div>
<div class="line"><a name="l00087"></a><span class="lineno"> 87</span>&#160; <span class="keywordflow">return</span> <a class="code" href="_usb_8h.html#afe2fedb4b0ccc89a688c0b4b59691ce0">USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL</a>;</div>
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>&#160; }</div>
<div class="line"><a name="l00089"></a><span class="lineno"> 89</span>&#160; </div>
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span>&#160; <span class="keywordflow">if</span> (!p-&gt;<a class="code" href="struct_usb_device.html#a410d39fb7758157f57794335e990ed02">epinfo</a>) {</div>
<div class="line"><a name="l00091"></a><span class="lineno"> 91</span>&#160; <a class="code" href="_usb_8h.html#afc6fe7f947af35317a49a4dcfc8189fd">USBTRACE</a>(<span class="stringliteral">&quot;epinfo is null\r\n&quot;</span>);</div>
<div class="line"><a name="l00092"></a><span class="lineno"> 92</span>&#160; <span class="keywordflow">return</span> <a class="code" href="_usb_8h.html#af192c59cafe2192ad802b22e6dbc077d">USB_ERROR_EPINFO_IS_NULL</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; </div>
<div class="line"><a name="l00095"></a><span class="lineno"> 95</span>&#160; <span class="comment">// Save old pointer to EP_RECORD of address 0</span></div>
<div class="line"><a name="l00096"></a><span class="lineno"> 96</span>&#160; oldep_ptr = p-&gt;<a class="code" href="struct_usb_device.html#a410d39fb7758157f57794335e990ed02">epinfo</a>;</div>
<div class="line"><a name="l00097"></a><span class="lineno"> 97</span>&#160;</div>
<div class="line"><a name="l00098"></a><span class="lineno"> 98</span>&#160; <span class="comment">// Temporary assign new pointer to epInfo to p-&gt;epinfo in order to avoid toggle inconsistence</span></div>
<div class="line"><a name="l00099"></a><span class="lineno"> 99</span>&#160; p-&gt;<a class="code" href="struct_usb_device.html#a410d39fb7758157f57794335e990ed02">epinfo</a> = <a class="code" href="class_a_d_k.html#a6ffc693d731ddeb9499c11e893fc467d">epInfo</a>;</div>
<div class="line"><a name="l00100"></a><span class="lineno"> 100</span>&#160;</div>
<div class="line"><a name="l00101"></a><span class="lineno"> 101</span>&#160; p-&gt;<a class="code" href="struct_usb_device.html#a86a815577ad7883437d3ca72b32b8e8a">lowspeed</a> = lowspeed;</div>
<div class="line"><a name="l00102"></a><span class="lineno"> 102</span>&#160;</div>
<div class="line"><a name="l00103"></a><span class="lineno"> 103</span>&#160; <span class="comment">// Get device descriptor</span></div>
<div class="line"><a name="l00104"></a><span class="lineno"> 104</span>&#160; rcode = <a class="code" href="class_a_d_k.html#ab28e3a19569c27f3ed5362e9800065c1">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a193e63c149fad46adabd77ceb09b2b24" title="defined(USB_METHODS_INLINE)">getDevDescr</a>( 0, 0, <span class="keyword">sizeof</span>(<a class="code" href="struct_u_s_b___d_e_v_i_c_e___d_e_s_c_r_i_p_t_o_r.html">USB_DEVICE_DESCRIPTOR</a>), (uint8_t*)buf );</div>
<div class="line"><a name="l00105"></a><span class="lineno"> 105</span>&#160;</div>
<div class="line"><a name="l00106"></a><span class="lineno"> 106</span>&#160; <span class="comment">// Restore p-&gt;epinfo</span></div>
<div class="line"><a name="l00107"></a><span class="lineno"> 107</span>&#160; p-&gt;<a class="code" href="struct_usb_device.html#a410d39fb7758157f57794335e990ed02">epinfo</a> = oldep_ptr;</div>
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span>&#160;</div>
<div class="line"><a name="l00109"></a><span class="lineno"> 109</span>&#160; <span class="keywordflow">if</span>( rcode ){ </div>
<div class="line"><a name="l00110"></a><span class="lineno"> 110</span>&#160; <span class="keywordflow">goto</span> FailGetDevDescr;</div>
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span>&#160; }</div>
<div class="line"><a name="l00112"></a><span class="lineno"> 112</span>&#160;</div>
<div class="line"><a name="l00113"></a><span class="lineno"> 113</span>&#160; <span class="comment">// Allocate new address according to device class</span></div>
<div class="line"><a name="l00114"></a><span class="lineno"> 114</span>&#160; <a class="code" href="class_a_d_k.html#ab22a7c60cec56823727d4ff2cf2c4edf">bAddress</a> = addrPool.<a class="code" href="class_address_pool.html#a97df4ef42e50960ce2165f4cdb53e590">AllocAddress</a>(parent, <span class="keyword">false</span>, port);</div>
<div class="line"><a name="l00115"></a><span class="lineno"> 115</span>&#160;</div>
<div class="line"><a name="l00116"></a><span class="lineno"> 116</span>&#160; <span class="comment">// Extract Max Packet Size from device descriptor</span></div>
<div class="line"><a name="l00117"></a><span class="lineno"> 117</span>&#160; <a class="code" href="class_a_d_k.html#a6ffc693d731ddeb9499c11e893fc467d">epInfo</a>[0].<a class="code" href="struct_ep_info.html#aa2ca775b63736df4008e88da7dd4dddb">maxPktSize</a> = (uint8_t)((<a class="code" href="struct_u_s_b___d_e_v_i_c_e___d_e_s_c_r_i_p_t_o_r.html">USB_DEVICE_DESCRIPTOR</a>*)buf)-&gt;bMaxPacketSize0; </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; <span class="comment">// Assign new address to the device</span></div>
<div class="line"><a name="l00120"></a><span class="lineno"> 120</span>&#160; rcode = <a class="code" href="class_a_d_k.html#ab28e3a19569c27f3ed5362e9800065c1">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a3aea534daed66b5606fa798df7ad3c47">setAddr</a>( 0, 0, <a class="code" href="class_a_d_k.html#ab22a7c60cec56823727d4ff2cf2c4edf">bAddress</a> );</div>
<div class="line"><a name="l00121"></a><span class="lineno"> 121</span>&#160; <span class="keywordflow">if</span> (rcode) {</div>
<div class="line"><a name="l00122"></a><span class="lineno"> 122</span>&#160; p-&gt;<a class="code" href="struct_usb_device.html#a86a815577ad7883437d3ca72b32b8e8a">lowspeed</a> = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00123"></a><span class="lineno"> 123</span>&#160; addrPool.<a class="code" href="class_address_pool.html#a15fde13223dcb1da89305ad229763562">FreeAddress</a>(<a class="code" href="class_a_d_k.html#ab22a7c60cec56823727d4ff2cf2c4edf">bAddress</a>);</div>
<div class="line"><a name="l00124"></a><span class="lineno"> 124</span>&#160; <a class="code" href="class_a_d_k.html#ab22a7c60cec56823727d4ff2cf2c4edf">bAddress</a> = 0;</div>
<div class="line"><a name="l00125"></a><span class="lineno"> 125</span>&#160; <span class="comment">//USBTRACE2(&quot;setAddr:&quot;,rcode);</span></div>
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span>&#160; <span class="keywordflow">return</span> rcode;</div>
<div class="line"><a name="l00127"></a><span class="lineno"> 127</span>&#160; }<span class="comment">//if (rcode...</span></div>
<div class="line"><a name="l00128"></a><span class="lineno"> 128</span>&#160;</div>
<div class="line"><a name="l00129"></a><span class="lineno"> 129</span>&#160; <span class="comment">//USBTRACE2(&quot;\r\nAddr:&quot;, bAddress);</span></div>
<div class="line"><a name="l00130"></a><span class="lineno"> 130</span>&#160;</div>
<div class="line"><a name="l00131"></a><span class="lineno"> 131</span>&#160; p-&gt;<a class="code" href="struct_usb_device.html#a86a815577ad7883437d3ca72b32b8e8a">lowspeed</a> = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00132"></a><span class="lineno"> 132</span>&#160; </div>
<div class="line"><a name="l00133"></a><span class="lineno"> 133</span>&#160; <span class="comment">//get pointer to assigned address record</span></div>
<div class="line"><a name="l00134"></a><span class="lineno"> 134</span>&#160; p = addrPool.<a class="code" href="class_address_pool.html#aa92d7e8f0f515340ae2dc1679b627056">GetUsbDevicePtr</a>(<a class="code" href="class_a_d_k.html#ab22a7c60cec56823727d4ff2cf2c4edf">bAddress</a>);</div>
<div class="line"><a name="l00135"></a><span class="lineno"> 135</span>&#160; <span class="keywordflow">if</span> (!p) {</div>
<div class="line"><a name="l00136"></a><span class="lineno"> 136</span>&#160; <span class="keywordflow">return</span> <a class="code" href="_usb_8h.html#afe2fedb4b0ccc89a688c0b4b59691ce0">USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL</a>;</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; p-&gt;<a class="code" href="struct_usb_device.html#a86a815577ad7883437d3ca72b32b8e8a">lowspeed</a> = lowspeed;</div>
<div class="line"><a name="l00140"></a><span class="lineno"> 140</span>&#160;</div>
<div class="line"><a name="l00141"></a><span class="lineno"> 141</span>&#160; <span class="comment">// Assign epInfo to epinfo pointer - only EP0 is known</span></div>
<div class="line"><a name="l00142"></a><span class="lineno"> 142</span>&#160; rcode = <a class="code" href="class_a_d_k.html#ab28e3a19569c27f3ed5362e9800065c1">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a6c3ba3f7e6dccb450267011ce783d7ea">setEpInfoEntry</a>(<a class="code" href="class_a_d_k.html#ab22a7c60cec56823727d4ff2cf2c4edf">bAddress</a>, 1, <a class="code" href="class_a_d_k.html#a6ffc693d731ddeb9499c11e893fc467d">epInfo</a>);</div>
<div class="line"><a name="l00143"></a><span class="lineno"> 143</span>&#160; <span class="keywordflow">if</span> (rcode) {</div>
<div class="line"><a name="l00144"></a><span class="lineno"> 144</span>&#160; <span class="keywordflow">goto</span> FailSetDevTblEntry;</div>
<div class="line"><a name="l00145"></a><span class="lineno"> 145</span>&#160; }</div>
<div class="line"><a name="l00146"></a><span class="lineno"> 146</span>&#160;</div>
<div class="line"><a name="l00147"></a><span class="lineno"> 147</span>&#160; <span class="comment">//check if ADK device is already in accessory mode; if yes, configure and exit</span></div>
<div class="line"><a name="l00148"></a><span class="lineno"> 148</span>&#160; <span class="keywordflow">if</span>(((<a class="code" href="struct_u_s_b___d_e_v_i_c_e___d_e_s_c_r_i_p_t_o_r.html">USB_DEVICE_DESCRIPTOR</a>*)buf)-&gt;idVendor == <a class="code" href="adk_8h.html#a37223416b6c1bba6b86ab17211bc9af2">ADK_VID</a> &amp;&amp;</div>
<div class="line"><a name="l00149"></a><span class="lineno"> 149</span>&#160; (((<a class="code" href="struct_u_s_b___d_e_v_i_c_e___d_e_s_c_r_i_p_t_o_r.html">USB_DEVICE_DESCRIPTOR</a>*)buf)-&gt;idProduct == <a class="code" href="adk_8h.html#a32e861258886323d4dbcf066641597a4">ADK_PID</a> || ((<a class="code" href="struct_u_s_b___d_e_v_i_c_e___d_e_s_c_r_i_p_t_o_r.html">USB_DEVICE_DESCRIPTOR</a>*)buf)-&gt;idProduct == <a class="code" href="adk_8h.html#a355cd5e5557b754645d4e1bfffabbf99">ADB_PID</a>)) {</div>
<div class="line"><a name="l00150"></a><span class="lineno"> 150</span>&#160; <a class="code" href="_usb_8h.html#afc6fe7f947af35317a49a4dcfc8189fd">USBTRACE</a>(<span class="stringliteral">&quot;\r\nAcc.mode device detected&quot;</span>);</div>
<div class="line"><a name="l00151"></a><span class="lineno"> 151</span>&#160; <span class="comment">/* go through configurations, find first bulk-IN, bulk-OUT EP, fill epInfo and quit */</span></div>
<div class="line"><a name="l00152"></a><span class="lineno"> 152</span>&#160; num_of_conf = ((<a class="code" href="struct_u_s_b___d_e_v_i_c_e___d_e_s_c_r_i_p_t_o_r.html">USB_DEVICE_DESCRIPTOR</a>*)buf)-&gt;bNumConfigurations;</div>
<div class="line"><a name="l00153"></a><span class="lineno"> 153</span>&#160; </div>
<div class="line"><a name="l00154"></a><span class="lineno"> 154</span>&#160; <span class="comment">//USBTRACE2(&quot;\r\nNC:&quot;,num_of_conf);</span></div>
<div class="line"><a name="l00155"></a><span class="lineno"> 155</span>&#160;</div>
<div class="line"><a name="l00156"></a><span class="lineno"> 156</span>&#160; <span class="keywordflow">for</span> (uint8_t i=0; i&lt;num_of_conf; i++) {</div>
<div class="line"><a name="l00157"></a><span class="lineno"> 157</span>&#160; <a class="code" href="class_config_desc_parser.html">ConfigDescParser&lt;0, 0, 0, 0&gt;</a> confDescrParser(<span class="keyword">this</span>);</div>
<div class="line"><a name="l00158"></a><span class="lineno"> 158</span>&#160; delay(1);</div>
<div class="line"><a name="l00159"></a><span class="lineno"> 159</span>&#160; rcode = <a class="code" href="class_a_d_k.html#ab28e3a19569c27f3ed5362e9800065c1">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a618eedabc161d8315be45cae0c8b6f89">getConfDescr</a>(<a class="code" href="class_a_d_k.html#ab22a7c60cec56823727d4ff2cf2c4edf">bAddress</a>, 0, i, &amp;confDescrParser);</div>
<div class="line"><a name="l00160"></a><span class="lineno"> 160</span>&#160;<span class="preprocessor">#if defined(XOOM)</span></div>
<div class="line"><a name="l00161"></a><span class="lineno"> 161</span>&#160;<span class="preprocessor"></span> <span class="comment">//added by Jaylen Scott Vanorden</span></div>
<div class="line"><a name="l00162"></a><span class="lineno"> 162</span>&#160; <span class="keywordflow">if</span>( rcode ) {</div>
<div class="line"><a name="l00163"></a><span class="lineno"> 163</span>&#160; <a class="code" href="_usb_8h.html#adbe3f00986df48a9254f8bf0992041d3">USBTRACE2</a>(<span class="stringliteral">&quot;\r\nGot 1st bad code for config: &quot;</span>, rcode);</div>
<div class="line"><a name="l00164"></a><span class="lineno"> 164</span>&#160; <span class="comment">// Try once more</span></div>
<div class="line"><a name="l00165"></a><span class="lineno"> 165</span>&#160; rcode = <a class="code" href="class_a_d_k.html#ab28e3a19569c27f3ed5362e9800065c1">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a618eedabc161d8315be45cae0c8b6f89">getConfDescr</a>(<a class="code" href="class_a_d_k.html#ab22a7c60cec56823727d4ff2cf2c4edf">bAddress</a>, 0, i, &amp;confDescrParser);</div>
<div class="line"><a name="l00166"></a><span class="lineno"> 166</span>&#160; }</div>
<div class="line"><a name="l00167"></a><span class="lineno"> 167</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00168"></a><span class="lineno"> 168</span>&#160;<span class="preprocessor"></span> <span class="keywordflow">if</span>( rcode ) {</div>
<div class="line"><a name="l00169"></a><span class="lineno"> 169</span>&#160; <span class="keywordflow">goto</span> FailGetConfDescr;</div>
<div class="line"><a name="l00170"></a><span class="lineno"> 170</span>&#160; }</div>
<div class="line"><a name="l00171"></a><span class="lineno"> 171</span>&#160; <span class="keywordflow">if</span>( <a class="code" href="class_a_d_k.html#adf969d306da15baecd5c59bbb568053e">bNumEP</a> &gt; 2 ) {</div>
<div class="line"><a name="l00172"></a><span class="lineno"> 172</span>&#160; <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00173"></a><span class="lineno"> 173</span>&#160; }</div>
<div class="line"><a name="l00174"></a><span class="lineno"> 174</span>&#160; } <span class="comment">// for (uint8_t i=0; i&lt;num_of_conf; i++...</span></div>
<div class="line"><a name="l00062"></a><span class="lineno"><a class="code" href="class_a_d_k.html#a8c5c2e212c748966ccd863499d202063"> 62</a></span>&#160;uint8_t <a class="code" href="class_a_d_k.html#a8c5c2e212c748966ccd863499d202063">ADK::Init</a>(uint8_t parent, uint8_t port, <span class="keywordtype">bool</span> lowspeed) {</div>
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span>&#160;</div>
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>&#160; uint8_t buf[<span class="keyword">sizeof</span> (<a class="code" href="struct_u_s_b___d_e_v_i_c_e___d_e_s_c_r_i_p_t_o_r.html">USB_DEVICE_DESCRIPTOR</a>)];</div>
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>&#160; uint8_t rcode;</div>
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>&#160; <a class="code" href="struct_usb_device.html">UsbDevice</a> *p = NULL;</div>
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span>&#160; <a class="code" href="struct_ep_info.html">EpInfo</a> *oldep_ptr = NULL;</div>
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>&#160; uint8_t num_of_conf; <span class="comment">// number of configurations</span></div>
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>&#160;</div>
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>&#160; <span class="comment">// get memory address of USB device address pool</span></div>
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>&#160; <a class="code" href="class_address_pool.html">AddressPool</a> &amp;addrPool = <a class="code" href="class_a_d_k.html#ab28e3a19569c27f3ed5362e9800065c1">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a66ab8f5eda239e761d5a48741ea1f9d4">GetAddressPool</a>();</div>
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>&#160;</div>
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span>&#160; <a class="code" href="_usb_8h.html#afc6fe7f947af35317a49a4dcfc8189fd">USBTRACE</a>(<span class="stringliteral">&quot;\r\nADK Init&quot;</span>);</div>
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span>&#160;</div>
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span>&#160; <span class="comment">// check if address has already been assigned to an instance</span></div>
<div class="line"><a name="l00076"></a><span class="lineno"> 76</span>&#160; <span class="keywordflow">if</span> (<a class="code" href="class_a_d_k.html#ab22a7c60cec56823727d4ff2cf2c4edf">bAddress</a>) {</div>
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span>&#160; <a class="code" href="_usb_8h.html#afc6fe7f947af35317a49a4dcfc8189fd">USBTRACE</a>(<span class="stringliteral">&quot;\r\nAddress in use&quot;</span>);</div>
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span>&#160; <span class="keywordflow">return</span> <a class="code" href="_usb_8h.html#a44416ff64fc0e3691f98addac13d4595">USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE</a>;</div>
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>&#160; }</div>
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>&#160;</div>
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span>&#160; <span class="comment">// Get pointer to pseudo device with address 0 assigned</span></div>
<div class="line"><a name="l00082"></a><span class="lineno"> 82</span>&#160; p = addrPool.<a class="code" href="class_address_pool.html#aa92d7e8f0f515340ae2dc1679b627056">GetUsbDevicePtr</a>(0);</div>
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span>&#160;</div>
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span>&#160; <span class="keywordflow">if</span> (!p) {</div>
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span>&#160; <a class="code" href="_usb_8h.html#afc6fe7f947af35317a49a4dcfc8189fd">USBTRACE</a>(<span class="stringliteral">&quot;\r\nAddress not found&quot;</span>);</div>
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span>&#160; <span class="keywordflow">return</span> <a class="code" href="_usb_8h.html#afe2fedb4b0ccc89a688c0b4b59691ce0">USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL</a>;</div>
<div class="line"><a name="l00087"></a><span class="lineno"> 87</span>&#160; }</div>
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>&#160;</div>
<div class="line"><a name="l00089"></a><span class="lineno"> 89</span>&#160; <span class="keywordflow">if</span> (!p-&gt;<a class="code" href="struct_usb_device.html#a410d39fb7758157f57794335e990ed02">epinfo</a>) {</div>
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span>&#160; <a class="code" href="_usb_8h.html#afc6fe7f947af35317a49a4dcfc8189fd">USBTRACE</a>(<span class="stringliteral">&quot;epinfo is null\r\n&quot;</span>);</div>
<div class="line"><a name="l00091"></a><span class="lineno"> 91</span>&#160; <span class="keywordflow">return</span> <a class="code" href="_usb_8h.html#af192c59cafe2192ad802b22e6dbc077d">USB_ERROR_EPINFO_IS_NULL</a>;</div>
<div class="line"><a name="l00092"></a><span class="lineno"> 92</span>&#160; }</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">// Save old pointer to EP_RECORD of address 0</span></div>
<div class="line"><a name="l00095"></a><span class="lineno"> 95</span>&#160; oldep_ptr = p-&gt;<a class="code" href="struct_usb_device.html#a410d39fb7758157f57794335e990ed02">epinfo</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="comment">// Temporary assign new pointer to epInfo to p-&gt;epinfo in order to avoid toggle inconsistence</span></div>
<div class="line"><a name="l00098"></a><span class="lineno"> 98</span>&#160; p-&gt;<a class="code" href="struct_usb_device.html#a410d39fb7758157f57794335e990ed02">epinfo</a> = <a class="code" href="class_a_d_k.html#a6ffc693d731ddeb9499c11e893fc467d">epInfo</a>;</div>
<div class="line"><a name="l00099"></a><span class="lineno"> 99</span>&#160;</div>
<div class="line"><a name="l00100"></a><span class="lineno"> 100</span>&#160; p-&gt;<a class="code" href="struct_usb_device.html#a86a815577ad7883437d3ca72b32b8e8a">lowspeed</a> = lowspeed;</div>
<div class="line"><a name="l00101"></a><span class="lineno"> 101</span>&#160;</div>
<div class="line"><a name="l00102"></a><span class="lineno"> 102</span>&#160; <span class="comment">// Get device descriptor</span></div>
<div class="line"><a name="l00103"></a><span class="lineno"> 103</span>&#160; rcode = <a class="code" href="class_a_d_k.html#ab28e3a19569c27f3ed5362e9800065c1">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a193e63c149fad46adabd77ceb09b2b24" title="defined(USB_METHODS_INLINE)">getDevDescr</a>(0, 0, <span class="keyword">sizeof</span> (<a class="code" href="struct_u_s_b___d_e_v_i_c_e___d_e_s_c_r_i_p_t_o_r.html">USB_DEVICE_DESCRIPTOR</a>), (uint8_t*)buf);</div>
<div class="line"><a name="l00104"></a><span class="lineno"> 104</span>&#160;</div>
<div class="line"><a name="l00105"></a><span class="lineno"> 105</span>&#160; <span class="comment">// Restore p-&gt;epinfo</span></div>
<div class="line"><a name="l00106"></a><span class="lineno"> 106</span>&#160; p-&gt;<a class="code" href="struct_usb_device.html#a410d39fb7758157f57794335e990ed02">epinfo</a> = oldep_ptr;</div>
<div class="line"><a name="l00107"></a><span class="lineno"> 107</span>&#160;</div>
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span>&#160; <span class="keywordflow">if</span> (rcode) {</div>
<div class="line"><a name="l00109"></a><span class="lineno"> 109</span>&#160; <span class="keywordflow">goto</span> FailGetDevDescr;</div>
<div class="line"><a name="l00110"></a><span class="lineno"> 110</span>&#160; }</div>
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span>&#160;</div>
<div class="line"><a name="l00112"></a><span class="lineno"> 112</span>&#160; <span class="comment">// Allocate new address according to device class</span></div>
<div class="line"><a name="l00113"></a><span class="lineno"> 113</span>&#160; <a class="code" href="class_a_d_k.html#ab22a7c60cec56823727d4ff2cf2c4edf">bAddress</a> = addrPool.<a class="code" href="class_address_pool.html#a97df4ef42e50960ce2165f4cdb53e590">AllocAddress</a>(parent, <span class="keyword">false</span>, port);</div>
<div class="line"><a name="l00114"></a><span class="lineno"> 114</span>&#160;</div>
<div class="line"><a name="l00115"></a><span class="lineno"> 115</span>&#160; <span class="comment">// Extract Max Packet Size from device descriptor</span></div>
<div class="line"><a name="l00116"></a><span class="lineno"> 116</span>&#160; <a class="code" href="class_a_d_k.html#a6ffc693d731ddeb9499c11e893fc467d">epInfo</a>[0].<a class="code" href="struct_ep_info.html#aa2ca775b63736df4008e88da7dd4dddb">maxPktSize</a> = (uint8_t)((<a class="code" href="struct_u_s_b___d_e_v_i_c_e___d_e_s_c_r_i_p_t_o_r.html">USB_DEVICE_DESCRIPTOR</a>*)buf)-&gt;bMaxPacketSize0;</div>
<div class="line"><a name="l00117"></a><span class="lineno"> 117</span>&#160;</div>
<div class="line"><a name="l00118"></a><span class="lineno"> 118</span>&#160; <span class="comment">// Assign new address to the device</span></div>
<div class="line"><a name="l00119"></a><span class="lineno"> 119</span>&#160; rcode = <a class="code" href="class_a_d_k.html#ab28e3a19569c27f3ed5362e9800065c1">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a3aea534daed66b5606fa798df7ad3c47">setAddr</a>(0, 0, <a class="code" href="class_a_d_k.html#ab22a7c60cec56823727d4ff2cf2c4edf">bAddress</a>);</div>
<div class="line"><a name="l00120"></a><span class="lineno"> 120</span>&#160; <span class="keywordflow">if</span> (rcode) {</div>
<div class="line"><a name="l00121"></a><span class="lineno"> 121</span>&#160; p-&gt;<a class="code" href="struct_usb_device.html#a86a815577ad7883437d3ca72b32b8e8a">lowspeed</a> = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00122"></a><span class="lineno"> 122</span>&#160; addrPool.<a class="code" href="class_address_pool.html#a15fde13223dcb1da89305ad229763562">FreeAddress</a>(<a class="code" href="class_a_d_k.html#ab22a7c60cec56823727d4ff2cf2c4edf">bAddress</a>);</div>
<div class="line"><a name="l00123"></a><span class="lineno"> 123</span>&#160; <a class="code" href="class_a_d_k.html#ab22a7c60cec56823727d4ff2cf2c4edf">bAddress</a> = 0;</div>
<div class="line"><a name="l00124"></a><span class="lineno"> 124</span>&#160; <span class="comment">//USBTRACE2(&quot;setAddr:&quot;,rcode);</span></div>
<div class="line"><a name="l00125"></a><span class="lineno"> 125</span>&#160; <span class="keywordflow">return</span> rcode;</div>
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span>&#160; }<span class="comment">//if (rcode...</span></div>
<div class="line"><a name="l00127"></a><span class="lineno"> 127</span>&#160;</div>
<div class="line"><a name="l00128"></a><span class="lineno"> 128</span>&#160; <span class="comment">//USBTRACE2(&quot;\r\nAddr:&quot;, bAddress);</span></div>
<div class="line"><a name="l00129"></a><span class="lineno"> 129</span>&#160;</div>
<div class="line"><a name="l00130"></a><span class="lineno"> 130</span>&#160; p-&gt;<a class="code" href="struct_usb_device.html#a86a815577ad7883437d3ca72b32b8e8a">lowspeed</a> = <span class="keyword">false</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 pointer to assigned address record</span></div>
<div class="line"><a name="l00133"></a><span class="lineno"> 133</span>&#160; p = addrPool.<a class="code" href="class_address_pool.html#aa92d7e8f0f515340ae2dc1679b627056">GetUsbDevicePtr</a>(<a class="code" href="class_a_d_k.html#ab22a7c60cec56823727d4ff2cf2c4edf">bAddress</a>);</div>
<div class="line"><a name="l00134"></a><span class="lineno"> 134</span>&#160; <span class="keywordflow">if</span> (!p) {</div>
<div class="line"><a name="l00135"></a><span class="lineno"> 135</span>&#160; <span class="keywordflow">return</span> <a class="code" href="_usb_8h.html#afe2fedb4b0ccc89a688c0b4b59691ce0">USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL</a>;</div>
<div class="line"><a name="l00136"></a><span class="lineno"> 136</span>&#160; }</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; p-&gt;<a class="code" href="struct_usb_device.html#a86a815577ad7883437d3ca72b32b8e8a">lowspeed</a> = lowspeed;</div>
<div class="line"><a name="l00139"></a><span class="lineno"> 139</span>&#160;</div>
<div class="line"><a name="l00140"></a><span class="lineno"> 140</span>&#160; <span class="comment">// Assign epInfo to epinfo pointer - only EP0 is known</span></div>
<div class="line"><a name="l00141"></a><span class="lineno"> 141</span>&#160; rcode = <a class="code" href="class_a_d_k.html#ab28e3a19569c27f3ed5362e9800065c1">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a6c3ba3f7e6dccb450267011ce783d7ea">setEpInfoEntry</a>(<a class="code" href="class_a_d_k.html#ab22a7c60cec56823727d4ff2cf2c4edf">bAddress</a>, 1, <a class="code" href="class_a_d_k.html#a6ffc693d731ddeb9499c11e893fc467d">epInfo</a>);</div>
<div class="line"><a name="l00142"></a><span class="lineno"> 142</span>&#160; <span class="keywordflow">if</span> (rcode) {</div>
<div class="line"><a name="l00143"></a><span class="lineno"> 143</span>&#160; <span class="keywordflow">goto</span> FailSetDevTblEntry;</div>
<div class="line"><a name="l00144"></a><span class="lineno"> 144</span>&#160; }</div>
<div class="line"><a name="l00145"></a><span class="lineno"> 145</span>&#160;</div>
<div class="line"><a name="l00146"></a><span class="lineno"> 146</span>&#160; <span class="comment">//check if ADK device is already in accessory mode; if yes, configure and exit</span></div>
<div class="line"><a name="l00147"></a><span class="lineno"> 147</span>&#160; <span class="keywordflow">if</span> (((<a class="code" href="struct_u_s_b___d_e_v_i_c_e___d_e_s_c_r_i_p_t_o_r.html">USB_DEVICE_DESCRIPTOR</a>*)buf)-&gt;idVendor == <a class="code" href="adk_8h.html#a37223416b6c1bba6b86ab17211bc9af2">ADK_VID</a> &amp;&amp;</div>
<div class="line"><a name="l00148"></a><span class="lineno"> 148</span>&#160; (((<a class="code" href="struct_u_s_b___d_e_v_i_c_e___d_e_s_c_r_i_p_t_o_r.html">USB_DEVICE_DESCRIPTOR</a>*)buf)-&gt;idProduct == <a class="code" href="adk_8h.html#a32e861258886323d4dbcf066641597a4">ADK_PID</a> || ((<a class="code" href="struct_u_s_b___d_e_v_i_c_e___d_e_s_c_r_i_p_t_o_r.html">USB_DEVICE_DESCRIPTOR</a>*)buf)-&gt;idProduct == <a class="code" href="adk_8h.html#a355cd5e5557b754645d4e1bfffabbf99">ADB_PID</a>)) {</div>
<div class="line"><a name="l00149"></a><span class="lineno"> 149</span>&#160; <a class="code" href="_usb_8h.html#afc6fe7f947af35317a49a4dcfc8189fd">USBTRACE</a>(<span class="stringliteral">&quot;\r\nAcc.mode device detected&quot;</span>);</div>
<div class="line"><a name="l00150"></a><span class="lineno"> 150</span>&#160; <span class="comment">/* go through configurations, find first bulk-IN, bulk-OUT EP, fill epInfo and quit */</span></div>
<div class="line"><a name="l00151"></a><span class="lineno"> 151</span>&#160; num_of_conf = ((<a class="code" href="struct_u_s_b___d_e_v_i_c_e___d_e_s_c_r_i_p_t_o_r.html">USB_DEVICE_DESCRIPTOR</a>*)buf)-&gt;bNumConfigurations;</div>
<div class="line"><a name="l00152"></a><span class="lineno"> 152</span>&#160;</div>
<div class="line"><a name="l00153"></a><span class="lineno"> 153</span>&#160; <span class="comment">//USBTRACE2(&quot;\r\nNC:&quot;,num_of_conf);</span></div>
<div class="line"><a name="l00154"></a><span class="lineno"> 154</span>&#160;</div>
<div class="line"><a name="l00155"></a><span class="lineno"> 155</span>&#160; <span class="keywordflow">for</span> (uint8_t i = 0; i &lt; num_of_conf; i++) {</div>
<div class="line"><a name="l00156"></a><span class="lineno"> 156</span>&#160; <a class="code" href="class_config_desc_parser.html">ConfigDescParser &lt; 0, 0, 0, 0 &gt;</a> confDescrParser(<span class="keyword">this</span>);</div>
<div class="line"><a name="l00157"></a><span class="lineno"> 157</span>&#160; rcode = <a class="code" href="class_a_d_k.html#ab28e3a19569c27f3ed5362e9800065c1">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a618eedabc161d8315be45cae0c8b6f89">getConfDescr</a>(<a class="code" href="class_a_d_k.html#ab22a7c60cec56823727d4ff2cf2c4edf">bAddress</a>, 0, i, &amp;confDescrParser);</div>
<div class="line"><a name="l00158"></a><span class="lineno"> 158</span>&#160; <span class="keywordflow">if</span> (rcode) {</div>
<div class="line"><a name="l00159"></a><span class="lineno"> 159</span>&#160; <span class="keywordflow">goto</span> FailGetConfDescr;</div>
<div class="line"><a name="l00160"></a><span class="lineno"> 160</span>&#160; }</div>
<div class="line"><a name="l00161"></a><span class="lineno"> 161</span>&#160; <span class="keywordflow">if</span> (<a class="code" href="class_a_d_k.html#adf969d306da15baecd5c59bbb568053e">bNumEP</a> &gt; 2) {</div>
<div class="line"><a name="l00162"></a><span class="lineno"> 162</span>&#160; <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00163"></a><span class="lineno"> 163</span>&#160; }</div>
<div class="line"><a name="l00164"></a><span class="lineno"> 164</span>&#160; } <span class="comment">// for (uint8_t i=0; i&lt;num_of_conf; i++...</span></div>
<div class="line"><a name="l00165"></a><span class="lineno"> 165</span>&#160;</div>
<div class="line"><a name="l00166"></a><span class="lineno"> 166</span>&#160; <span class="keywordflow">if</span> (<a class="code" href="class_a_d_k.html#adf969d306da15baecd5c59bbb568053e">bNumEP</a> == 3) {</div>
<div class="line"><a name="l00167"></a><span class="lineno"> 167</span>&#160; <span class="comment">// Assign epInfo to epinfo pointer - this time all 3 endpoins</span></div>
<div class="line"><a name="l00168"></a><span class="lineno"> 168</span>&#160; rcode = <a class="code" href="class_a_d_k.html#ab28e3a19569c27f3ed5362e9800065c1">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a6c3ba3f7e6dccb450267011ce783d7ea">setEpInfoEntry</a>(<a class="code" href="class_a_d_k.html#ab22a7c60cec56823727d4ff2cf2c4edf">bAddress</a>, 3, <a class="code" href="class_a_d_k.html#a6ffc693d731ddeb9499c11e893fc467d">epInfo</a>);</div>
<div class="line"><a name="l00169"></a><span class="lineno"> 169</span>&#160; <span class="keywordflow">if</span> (rcode) {</div>
<div class="line"><a name="l00170"></a><span class="lineno"> 170</span>&#160; <span class="keywordflow">goto</span> FailSetDevTblEntry;</div>
<div class="line"><a name="l00171"></a><span class="lineno"> 171</span>&#160; }</div>
<div class="line"><a name="l00172"></a><span class="lineno"> 172</span>&#160; }</div>
<div class="line"><a name="l00173"></a><span class="lineno"> 173</span>&#160;</div>
<div class="line"><a name="l00174"></a><span class="lineno"> 174</span>&#160;</div>
<div class="line"><a name="l00175"></a><span class="lineno"> 175</span>&#160;</div>
<div class="line"><a name="l00176"></a><span class="lineno"> 176</span>&#160; <span class="keywordflow">if</span>( <a class="code" href="class_a_d_k.html#adf969d306da15baecd5c59bbb568053e">bNumEP</a> == 3 ) {</div>
<div class="line"><a name="l00177"></a><span class="lineno"> 177</span>&#160; <span class="comment">// Assign epInfo to epinfo pointer - this time all 3 endpoins</span></div>
<div class="line"><a name="l00178"></a><span class="lineno"> 178</span>&#160; rcode = <a class="code" href="class_a_d_k.html#ab28e3a19569c27f3ed5362e9800065c1">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a6c3ba3f7e6dccb450267011ce783d7ea">setEpInfoEntry</a>(<a class="code" href="class_a_d_k.html#ab22a7c60cec56823727d4ff2cf2c4edf">bAddress</a>, 3, <a class="code" href="class_a_d_k.html#a6ffc693d731ddeb9499c11e893fc467d">epInfo</a>);</div>
<div class="line"><a name="l00179"></a><span class="lineno"> 179</span>&#160; <span class="keywordflow">if</span> (rcode) {</div>
<div class="line"><a name="l00180"></a><span class="lineno"> 180</span>&#160; <span class="keywordflow">goto</span> FailSetDevTblEntry;</div>
<div class="line"><a name="l00181"></a><span class="lineno"> 181</span>&#160; }</div>
<div class="line"><a name="l00182"></a><span class="lineno"> 182</span>&#160; }</div>
<div class="line"><a name="l00183"></a><span class="lineno"> 183</span>&#160; </div>
<div class="line"><a name="l00184"></a><span class="lineno"> 184</span>&#160; </div>
<div class="line"><a name="l00185"></a><span class="lineno"> 185</span>&#160; </div>
<div class="line"><a name="l00186"></a><span class="lineno"> 186</span>&#160; <span class="comment">// Set Configuration Value</span></div>
<div class="line"><a name="l00187"></a><span class="lineno"> 187</span>&#160; rcode = <a class="code" href="class_a_d_k.html#ab28e3a19569c27f3ed5362e9800065c1">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a31e2c132ec32ffdde94dff72be87c378">setConf</a>(<a class="code" href="class_a_d_k.html#ab22a7c60cec56823727d4ff2cf2c4edf">bAddress</a>, 0, <a class="code" href="class_a_d_k.html#ae8fcc6a6fccab61116cea10dd1f17738">bConfNum</a>);</div>
<div class="line"><a name="l00188"></a><span class="lineno"> 188</span>&#160; <span class="keywordflow">if</span>( rcode ){ </div>
<div class="line"><a name="l00189"></a><span class="lineno"> 189</span>&#160; <span class="keywordflow">goto</span> FailSetConf;</div>
<div class="line"><a name="l00190"></a><span class="lineno"> 190</span>&#160; }</div>
<div class="line"><a name="l00191"></a><span class="lineno"> 191</span>&#160; <span class="comment">/* print endpoint structure */</span></div>
<div class="line"><a name="l00192"></a><span class="lineno"> 192</span>&#160;<span class="comment">// USBTRACE(&quot;\r\nEndpoint Structure:&quot;);</span></div>
<div class="line"><a name="l00193"></a><span class="lineno"> 193</span>&#160;<span class="comment">// USBTRACE(&quot;\r\nEP0:&quot;);</span></div>
<div class="line"><a name="l00194"></a><span class="lineno"> 194</span>&#160;<span class="comment">// USBTRACE2(&quot;\r\nAddr: &quot;, epInfo[0].epAddr );</span></div>
<div class="line"><a name="l00195"></a><span class="lineno"> 195</span>&#160;<span class="comment">// USBTRACE2(&quot;\r\nMax.pkt.size: &quot;, epInfo[0].maxPktSize );</span></div>
<div class="line"><a name="l00196"></a><span class="lineno"> 196</span>&#160;<span class="comment">// USBTRACE2(&quot;\r\nAttr: &quot;, epInfo[0].epAttribs );</span></div>
<div class="line"><a name="l00197"></a><span class="lineno"> 197</span>&#160;<span class="comment">// USBTRACE(&quot;\r\nEpout:&quot;);</span></div>
<div class="line"><a name="l00198"></a><span class="lineno"> 198</span>&#160;<span class="comment">// USBTRACE2(&quot;\r\nAddr: &quot;, epInfo[epDataOutIndex].epAddr );</span></div>
<div class="line"><a name="l00199"></a><span class="lineno"> 199</span>&#160;<span class="comment">// USBTRACE2(&quot;\r\nMax.pkt.size: &quot;, epInfo[epDataOutIndex].maxPktSize );</span></div>
<div class="line"><a name="l00200"></a><span class="lineno"> 200</span>&#160;<span class="comment">// USBTRACE2(&quot;\r\nAttr: &quot;, epInfo[epDataOutIndex].epAttribs );</span></div>
<div class="line"><a name="l00201"></a><span class="lineno"> 201</span>&#160;<span class="comment">// USBTRACE(&quot;\r\nEpin:&quot;);</span></div>
<div class="line"><a name="l00202"></a><span class="lineno"> 202</span>&#160;<span class="comment">// USBTRACE2(&quot;\r\nAddr: &quot;, epInfo[epDataInIndex].epAddr );</span></div>
<div class="line"><a name="l00203"></a><span class="lineno"> 203</span>&#160;<span class="comment">// USBTRACE2(&quot;\r\nMax.pkt.size: &quot;, epInfo[epDataInIndex].maxPktSize );</span></div>
<div class="line"><a name="l00204"></a><span class="lineno"> 204</span>&#160;<span class="comment">// USBTRACE2(&quot;\r\nAttr: &quot;, epInfo[epDataInIndex].epAttribs );</span></div>
<div class="line"><a name="l00205"></a><span class="lineno"> 205</span>&#160; </div>
<div class="line"><a name="l00206"></a><span class="lineno"> 206</span>&#160; <a class="code" href="_usb_8h.html#afc6fe7f947af35317a49a4dcfc8189fd">USBTRACE</a>(<span class="stringliteral">&quot;\r\nConfiguration successful&quot;</span>);</div>
<div class="line"><a name="l00207"></a><span class="lineno"> 207</span>&#160; <a class="code" href="class_a_d_k.html#a135db75b9e8cdd59b89f46c44dd83dd4">ready</a> = <span class="keyword">true</span>;</div>
<div class="line"><a name="l00208"></a><span class="lineno"> 208</span>&#160; <span class="keywordflow">return</span> 0; <span class="comment">//successful configuration</span></div>
<div class="line"><a name="l00209"></a><span class="lineno"> 209</span>&#160; }<span class="comment">//if( buf-&gt;idVendor == ADK_VID...</span></div>
<div class="line"><a name="l00176"></a><span class="lineno"> 176</span>&#160; <span class="comment">// Set Configuration Value</span></div>
<div class="line"><a name="l00177"></a><span class="lineno"> 177</span>&#160; rcode = <a class="code" href="class_a_d_k.html#ab28e3a19569c27f3ed5362e9800065c1">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a31e2c132ec32ffdde94dff72be87c378">setConf</a>(<a class="code" href="class_a_d_k.html#ab22a7c60cec56823727d4ff2cf2c4edf">bAddress</a>, 0, <a class="code" href="class_a_d_k.html#ae8fcc6a6fccab61116cea10dd1f17738">bConfNum</a>);</div>
<div class="line"><a name="l00178"></a><span class="lineno"> 178</span>&#160; <span class="keywordflow">if</span> (rcode) {</div>
<div class="line"><a name="l00179"></a><span class="lineno"> 179</span>&#160; <span class="keywordflow">goto</span> FailSetConfDescr;</div>
<div class="line"><a name="l00180"></a><span class="lineno"> 180</span>&#160; }</div>
<div class="line"><a name="l00181"></a><span class="lineno"> 181</span>&#160; <span class="comment">/* print endpoint structure */</span></div>
<div class="line"><a name="l00182"></a><span class="lineno"> 182</span>&#160; <span class="comment">// USBTRACE(&quot;\r\nEndpoint Structure:&quot;);</span></div>
<div class="line"><a name="l00183"></a><span class="lineno"> 183</span>&#160; <span class="comment">// USBTRACE(&quot;\r\nEP0:&quot;);</span></div>
<div class="line"><a name="l00184"></a><span class="lineno"> 184</span>&#160; <span class="comment">// USBTRACE2(&quot;\r\nAddr: &quot;, epInfo[0].epAddr );</span></div>
<div class="line"><a name="l00185"></a><span class="lineno"> 185</span>&#160; <span class="comment">// USBTRACE2(&quot;\r\nMax.pkt.size: &quot;, epInfo[0].maxPktSize );</span></div>
<div class="line"><a name="l00186"></a><span class="lineno"> 186</span>&#160; <span class="comment">// USBTRACE2(&quot;\r\nAttr: &quot;, epInfo[0].epAttribs );</span></div>
<div class="line"><a name="l00187"></a><span class="lineno"> 187</span>&#160; <span class="comment">// USBTRACE(&quot;\r\nEpout:&quot;);</span></div>
<div class="line"><a name="l00188"></a><span class="lineno"> 188</span>&#160; <span class="comment">// USBTRACE2(&quot;\r\nAddr: &quot;, epInfo[epDataOutIndex].epAddr );</span></div>
<div class="line"><a name="l00189"></a><span class="lineno"> 189</span>&#160; <span class="comment">// USBTRACE2(&quot;\r\nMax.pkt.size: &quot;, epInfo[epDataOutIndex].maxPktSize );</span></div>
<div class="line"><a name="l00190"></a><span class="lineno"> 190</span>&#160; <span class="comment">// USBTRACE2(&quot;\r\nAttr: &quot;, epInfo[epDataOutIndex].epAttribs );</span></div>
<div class="line"><a name="l00191"></a><span class="lineno"> 191</span>&#160; <span class="comment">// USBTRACE(&quot;\r\nEpin:&quot;);</span></div>
<div class="line"><a name="l00192"></a><span class="lineno"> 192</span>&#160; <span class="comment">// USBTRACE2(&quot;\r\nAddr: &quot;, epInfo[epDataInIndex].epAddr );</span></div>
<div class="line"><a name="l00193"></a><span class="lineno"> 193</span>&#160; <span class="comment">// USBTRACE2(&quot;\r\nMax.pkt.size: &quot;, epInfo[epDataInIndex].maxPktSize );</span></div>
<div class="line"><a name="l00194"></a><span class="lineno"> 194</span>&#160; <span class="comment">// USBTRACE2(&quot;\r\nAttr: &quot;, epInfo[epDataInIndex].epAttribs );</span></div>
<div class="line"><a name="l00195"></a><span class="lineno"> 195</span>&#160;</div>
<div class="line"><a name="l00196"></a><span class="lineno"> 196</span>&#160; <a class="code" href="_usb_8h.html#afc6fe7f947af35317a49a4dcfc8189fd">USBTRACE</a>(<span class="stringliteral">&quot;\r\nConfiguration successful&quot;</span>);</div>
<div class="line"><a name="l00197"></a><span class="lineno"> 197</span>&#160; <a class="code" href="class_a_d_k.html#a135db75b9e8cdd59b89f46c44dd83dd4">ready</a> = <span class="keyword">true</span>;</div>
<div class="line"><a name="l00198"></a><span class="lineno"> 198</span>&#160; <span class="keywordflow">return</span> 0; <span class="comment">//successful configuration</span></div>
<div class="line"><a name="l00199"></a><span class="lineno"> 199</span>&#160; }<span class="comment">//if( buf-&gt;idVendor == ADK_VID...</span></div>
<div class="line"><a name="l00200"></a><span class="lineno"> 200</span>&#160;</div>
<div class="line"><a name="l00201"></a><span class="lineno"> 201</span>&#160; <span class="comment">//probe device - get accessory protocol revision</span></div>
<div class="line"><a name="l00202"></a><span class="lineno"> 202</span>&#160; {</div>
<div class="line"><a name="l00203"></a><span class="lineno"> 203</span>&#160; uint16_t adkproto = -1;</div>
<div class="line"><a name="l00204"></a><span class="lineno"> 204</span>&#160; rcode = getProto((uint8_t*) &amp; adkproto);</div>
<div class="line"><a name="l00205"></a><span class="lineno"> 205</span>&#160; <span class="keywordflow">if</span> (rcode) {</div>
<div class="line"><a name="l00206"></a><span class="lineno"> 206</span>&#160; <span class="keywordflow">goto</span> FailGetProto; <span class="comment">//init fails</span></div>
<div class="line"><a name="l00207"></a><span class="lineno"> 207</span>&#160; }</div>
<div class="line"><a name="l00208"></a><span class="lineno"> 208</span>&#160; <a class="code" href="_usb_8h.html#adbe3f00986df48a9254f8bf0992041d3">USBTRACE2</a>(<span class="stringliteral">&quot;\r\nADK protocol rev. &quot;</span>, adkproto);</div>
<div class="line"><a name="l00209"></a><span class="lineno"> 209</span>&#160; }</div>
<div class="line"><a name="l00210"></a><span class="lineno"> 210</span>&#160;</div>
<div class="line"><a name="l00211"></a><span class="lineno"> 211</span>&#160; <span class="comment">//probe device - get accessory protocol revision</span></div>
<div class="line"><a name="l00212"></a><span class="lineno"> 212</span>&#160; {</div>
<div class="line"><a name="l00213"></a><span class="lineno"> 213</span>&#160; uint16_t adkproto = -1;</div>
<div class="line"><a name="l00214"></a><span class="lineno"> 214</span>&#160; delay(1);</div>
<div class="line"><a name="l00215"></a><span class="lineno"> 215</span>&#160; rcode = getProto((uint8_t*)&amp;adkproto );</div>
<div class="line"><a name="l00216"></a><span class="lineno"> 216</span>&#160;<span class="preprocessor">#if defined(XOOM)</span></div>
<div class="line"><a name="l00217"></a><span class="lineno"> 217</span>&#160;<span class="preprocessor"></span> <span class="comment">//added by Jaylen Scott Vanorden</span></div>
<div class="line"><a name="l00218"></a><span class="lineno"> 218</span>&#160; <span class="keywordflow">if</span>( rcode ) {</div>
<div class="line"><a name="l00219"></a><span class="lineno"> 219</span>&#160; <a class="code" href="_usb_8h.html#adbe3f00986df48a9254f8bf0992041d3">USBTRACE2</a>(<span class="stringliteral">&quot;\r\nGot 1st bad code for proto: &quot;</span>, rcode);</div>
<div class="line"><a name="l00220"></a><span class="lineno"> 220</span>&#160; <span class="comment">// Try once more</span></div>
<div class="line"><a name="l00221"></a><span class="lineno"> 221</span>&#160; rcode = getProto((uint8_t*)&amp;adkproto );</div>
<div class="line"><a name="l00222"></a><span class="lineno"> 222</span>&#160; } </div>
<div class="line"><a name="l00223"></a><span class="lineno"> 223</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00224"></a><span class="lineno"> 224</span>&#160;<span class="preprocessor"></span> <span class="keywordflow">if</span>( rcode ){</div>
<div class="line"><a name="l00225"></a><span class="lineno"> 225</span>&#160; <span class="keywordflow">goto</span> FailGetProto; <span class="comment">//init fails</span></div>
<div class="line"><a name="l00226"></a><span class="lineno"> 226</span>&#160; }</div>
<div class="line"><a name="l00227"></a><span class="lineno"> 227</span>&#160; <a class="code" href="_usb_8h.html#adbe3f00986df48a9254f8bf0992041d3">USBTRACE2</a>(<span class="stringliteral">&quot;\r\nADK protocol rev. &quot;</span>, adkproto );</div>
<div class="line"><a name="l00228"></a><span class="lineno"> 228</span>&#160; }</div>
<div class="line"><a name="l00229"></a><span class="lineno"> 229</span>&#160; </div>
<div class="line"><a name="l00230"></a><span class="lineno"> 230</span>&#160; <span class="comment">//sending ID strings</span></div>
<div class="line"><a name="l00231"></a><span class="lineno"> 231</span>&#160; sendStr( <a class="code" href="adk_8h.html#a12e00d6841cbb8fd9ae7c97402efa062">ACCESSORY_STRING_MANUFACTURER</a>, manufacturer);</div>
<div class="line"><a name="l00232"></a><span class="lineno"> 232</span>&#160; sendStr( <a class="code" href="adk_8h.html#a962954d4b489994aa347721c582fe242">ACCESSORY_STRING_MODEL</a>, model);</div>
<div class="line"><a name="l00233"></a><span class="lineno"> 233</span>&#160; sendStr( <a class="code" href="adk_8h.html#aa376dd887b57d0628df287dd1fce7f3b">ACCESSORY_STRING_DESCRIPTION</a>, description);</div>
<div class="line"><a name="l00234"></a><span class="lineno"> 234</span>&#160; sendStr( <a class="code" href="adk_8h.html#aab852db9aa38642ad7be827ae95351c5">ACCESSORY_STRING_VERSION</a>, version);</div>
<div class="line"><a name="l00235"></a><span class="lineno"> 235</span>&#160; sendStr( <a class="code" href="adk_8h.html#a0485b5be230520d0acde7ef32fb8210e">ACCESSORY_STRING_URI</a>, uri);</div>
<div class="line"><a name="l00236"></a><span class="lineno"> 236</span>&#160; sendStr( <a class="code" href="adk_8h.html#a31b2b6ec818e90cd9fe47bd4f7f86c16">ACCESSORY_STRING_SERIAL</a>, serial);</div>
<div class="line"><a name="l00237"></a><span class="lineno"> 237</span>&#160; </div>
<div class="line"><a name="l00238"></a><span class="lineno"> 238</span>&#160; <span class="comment">//switch to accessory mode</span></div>
<div class="line"><a name="l00239"></a><span class="lineno"> 239</span>&#160; <span class="comment">//the Android phone will reset </span></div>
<div class="line"><a name="l00240"></a><span class="lineno"> 240</span>&#160; rcode = switchAcc();</div>
<div class="line"><a name="l00241"></a><span class="lineno"> 241</span>&#160; <span class="keywordflow">if</span>( rcode ) {</div>
<div class="line"><a name="l00242"></a><span class="lineno"> 242</span>&#160; <span class="keywordflow">goto</span> FailSwAcc; <span class="comment">//init fails</span></div>
<div class="line"><a name="l00243"></a><span class="lineno"> 243</span>&#160; }</div>
<div class="line"><a name="l00244"></a><span class="lineno"> 244</span>&#160; rcode = -1;</div>
<div class="line"><a name="l00245"></a><span class="lineno"> 245</span>&#160; <span class="keywordflow">goto</span> SwAttempt; <span class="comment">//switch to accessory mode attempted</span></div>
<div class="line"><a name="l00246"></a><span class="lineno"> 246</span>&#160; </div>
<div class="line"><a name="l00247"></a><span class="lineno"> 247</span>&#160; <span class="comment">/* diagnostic messages */</span> </div>
<div class="line"><a name="l00248"></a><span class="lineno"> 248</span>&#160;FailGetDevDescr:</div>
<div class="line"><a name="l00249"></a><span class="lineno"> 249</span>&#160; <a class="code" href="_usb_8h.html#afc6fe7f947af35317a49a4dcfc8189fd">USBTRACE</a>(<span class="stringliteral">&quot;\r\ngetDevDescr:&quot;</span>);</div>
<div class="line"><a name="l00250"></a><span class="lineno"> 250</span>&#160; <span class="keywordflow">goto</span> Fail;</div>
<div class="line"><a name="l00251"></a><span class="lineno"> 251</span>&#160;</div>
<div class="line"><a name="l00252"></a><span class="lineno"> 252</span>&#160;FailSetDevTblEntry:</div>
<div class="line"><a name="l00253"></a><span class="lineno"> 253</span>&#160; <a class="code" href="_usb_8h.html#afc6fe7f947af35317a49a4dcfc8189fd">USBTRACE</a>(<span class="stringliteral">&quot;\r\nsetDevTblEn:&quot;</span>);</div>
<div class="line"><a name="l00254"></a><span class="lineno"> 254</span>&#160; <span class="keywordflow">goto</span> Fail;</div>
<div class="line"><a name="l00255"></a><span class="lineno"> 255</span>&#160;</div>
<div class="line"><a name="l00256"></a><span class="lineno"> 256</span>&#160;FailGetProto:</div>
<div class="line"><a name="l00257"></a><span class="lineno"> 257</span>&#160; <a class="code" href="_usb_8h.html#afc6fe7f947af35317a49a4dcfc8189fd">USBTRACE</a>(<span class="stringliteral">&quot;\r\ngetProto:&quot;</span>);</div>
<div class="line"><a name="l00258"></a><span class="lineno"> 258</span>&#160; <span class="keywordflow">goto</span> Fail;</div>
<div class="line"><a name="l00259"></a><span class="lineno"> 259</span>&#160; </div>
<div class="line"><a name="l00260"></a><span class="lineno"> 260</span>&#160;FailSwAcc:</div>
<div class="line"><a name="l00261"></a><span class="lineno"> 261</span>&#160; <a class="code" href="_usb_8h.html#afc6fe7f947af35317a49a4dcfc8189fd">USBTRACE</a>(<span class="stringliteral">&quot;\r\nswAcc:&quot;</span>);</div>
<div class="line"><a name="l00262"></a><span class="lineno"> 262</span>&#160; <span class="keywordflow">goto</span> Fail;</div>
<div class="line"><a name="l00263"></a><span class="lineno"> 263</span>&#160; </div>
<div class="line"><a name="l00264"></a><span class="lineno"> 264</span>&#160;SwAttempt:</div>
<div class="line"><a name="l00265"></a><span class="lineno"> 265</span>&#160; <a class="code" href="_usb_8h.html#afc6fe7f947af35317a49a4dcfc8189fd">USBTRACE</a>(<span class="stringliteral">&quot;\r\nAccessory mode switch attempt&quot;</span>);</div>
<div class="line"><a name="l00266"></a><span class="lineno"> 266</span>&#160; <span class="keywordflow">goto</span> Fail; </div>
<div class="line"><a name="l00211"></a><span class="lineno"> 211</span>&#160; <span class="comment">//sending ID strings</span></div>
<div class="line"><a name="l00212"></a><span class="lineno"> 212</span>&#160; sendStr(<a class="code" href="adk_8h.html#a12e00d6841cbb8fd9ae7c97402efa062">ACCESSORY_STRING_MANUFACTURER</a>, manufacturer);</div>
<div class="line"><a name="l00213"></a><span class="lineno"> 213</span>&#160; sendStr(<a class="code" href="adk_8h.html#a962954d4b489994aa347721c582fe242">ACCESSORY_STRING_MODEL</a>, model);</div>
<div class="line"><a name="l00214"></a><span class="lineno"> 214</span>&#160; sendStr(<a class="code" href="adk_8h.html#aa376dd887b57d0628df287dd1fce7f3b">ACCESSORY_STRING_DESCRIPTION</a>, description);</div>
<div class="line"><a name="l00215"></a><span class="lineno"> 215</span>&#160; sendStr(<a class="code" href="adk_8h.html#aab852db9aa38642ad7be827ae95351c5">ACCESSORY_STRING_VERSION</a>, version);</div>
<div class="line"><a name="l00216"></a><span class="lineno"> 216</span>&#160; sendStr(<a class="code" href="adk_8h.html#a0485b5be230520d0acde7ef32fb8210e">ACCESSORY_STRING_URI</a>, uri);</div>
<div class="line"><a name="l00217"></a><span class="lineno"> 217</span>&#160; sendStr(<a class="code" href="adk_8h.html#a31b2b6ec818e90cd9fe47bd4f7f86c16">ACCESSORY_STRING_SERIAL</a>, serial);</div>
<div class="line"><a name="l00218"></a><span class="lineno"> 218</span>&#160;</div>
<div class="line"><a name="l00219"></a><span class="lineno"> 219</span>&#160; <span class="comment">//switch to accessory mode</span></div>
<div class="line"><a name="l00220"></a><span class="lineno"> 220</span>&#160; <span class="comment">//the Android phone will reset</span></div>
<div class="line"><a name="l00221"></a><span class="lineno"> 221</span>&#160; rcode = switchAcc();</div>
<div class="line"><a name="l00222"></a><span class="lineno"> 222</span>&#160; <span class="keywordflow">if</span> (rcode) {</div>
<div class="line"><a name="l00223"></a><span class="lineno"> 223</span>&#160; <span class="keywordflow">goto</span> FailSwAcc; <span class="comment">//init fails</span></div>
<div class="line"><a name="l00224"></a><span class="lineno"> 224</span>&#160; }</div>
<div class="line"><a name="l00225"></a><span class="lineno"> 225</span>&#160; rcode = -1;</div>
<div class="line"><a name="l00226"></a><span class="lineno"> 226</span>&#160; <span class="keywordflow">goto</span> SwAttempt; <span class="comment">//switch to accessory mode attempted</span></div>
<div class="line"><a name="l00227"></a><span class="lineno"> 227</span>&#160;</div>
<div class="line"><a name="l00228"></a><span class="lineno"> 228</span>&#160; <span class="comment">/* diagnostic messages */</span></div>
<div class="line"><a name="l00229"></a><span class="lineno"> 229</span>&#160;FailGetDevDescr:</div>
<div class="line"><a name="l00230"></a><span class="lineno"> 230</span>&#160; <a class="code" href="message_8cpp.html#ace40a5d826a882de0c5a25aece111d3f">NotifyFailGetDevDescr</a>();</div>
<div class="line"><a name="l00231"></a><span class="lineno"> 231</span>&#160; <span class="keywordflow">goto</span> Fail;</div>
<div class="line"><a name="l00232"></a><span class="lineno"> 232</span>&#160;</div>
<div class="line"><a name="l00233"></a><span class="lineno"> 233</span>&#160;FailSetDevTblEntry:</div>
<div class="line"><a name="l00234"></a><span class="lineno"> 234</span>&#160; <a class="code" href="message_8cpp.html#aa65008f9251787149e391f89e68b32be">NotifyFailSetDevTblEntry</a>();</div>
<div class="line"><a name="l00235"></a><span class="lineno"> 235</span>&#160; <span class="keywordflow">goto</span> Fail;</div>
<div class="line"><a name="l00236"></a><span class="lineno"> 236</span>&#160;</div>
<div class="line"><a name="l00237"></a><span class="lineno"> 237</span>&#160;FailGetConfDescr:</div>
<div class="line"><a name="l00238"></a><span class="lineno"> 238</span>&#160; <a class="code" href="message_8cpp.html#a8990b7c46c3f20489c3f205fa173f110">NotifyFailGetConfDescr</a>();</div>
<div class="line"><a name="l00239"></a><span class="lineno"> 239</span>&#160; <span class="keywordflow">goto</span> Fail;</div>
<div class="line"><a name="l00240"></a><span class="lineno"> 240</span>&#160;</div>
<div class="line"><a name="l00241"></a><span class="lineno"> 241</span>&#160;FailSetConfDescr:</div>
<div class="line"><a name="l00242"></a><span class="lineno"> 242</span>&#160; <a class="code" href="message_8cpp.html#a08b840c377ca6f8154d6924d51338d89">NotifyFailSetConfDescr</a>();</div>
<div class="line"><a name="l00243"></a><span class="lineno"> 243</span>&#160; <span class="keywordflow">goto</span> Fail;</div>
<div class="line"><a name="l00244"></a><span class="lineno"> 244</span>&#160;</div>
<div class="line"><a name="l00245"></a><span class="lineno"> 245</span>&#160;FailGetProto:</div>
<div class="line"><a name="l00246"></a><span class="lineno"> 246</span>&#160; <a class="code" href="_usb_8h.html#afc6fe7f947af35317a49a4dcfc8189fd">USBTRACE</a>(<span class="stringliteral">&quot;\r\ngetProto:&quot;</span>);</div>
<div class="line"><a name="l00247"></a><span class="lineno"> 247</span>&#160; <span class="keywordflow">goto</span> Fail;</div>
<div class="line"><a name="l00248"></a><span class="lineno"> 248</span>&#160;</div>
<div class="line"><a name="l00249"></a><span class="lineno"> 249</span>&#160;FailSwAcc:</div>
<div class="line"><a name="l00250"></a><span class="lineno"> 250</span>&#160; <a class="code" href="_usb_8h.html#afc6fe7f947af35317a49a4dcfc8189fd">USBTRACE</a>(<span class="stringliteral">&quot;\r\nswAcc:&quot;</span>);</div>
<div class="line"><a name="l00251"></a><span class="lineno"> 251</span>&#160; <span class="keywordflow">goto</span> Fail;</div>
<div class="line"><a name="l00252"></a><span class="lineno"> 252</span>&#160;</div>
<div class="line"><a name="l00253"></a><span class="lineno"> 253</span>&#160;SwAttempt:</div>
<div class="line"><a name="l00254"></a><span class="lineno"> 254</span>&#160; <a class="code" href="_usb_8h.html#afc6fe7f947af35317a49a4dcfc8189fd">USBTRACE</a>(<span class="stringliteral">&quot;\r\nAccessory mode switch attempt&quot;</span>);</div>
<div class="line"><a name="l00255"></a><span class="lineno"> 255</span>&#160; <span class="comment">// goto Fail;</span></div>
<div class="line"><a name="l00256"></a><span class="lineno"> 256</span>&#160;</div>
<div class="line"><a name="l00257"></a><span class="lineno"> 257</span>&#160;<span class="comment">//FailOnInit:</span></div>
<div class="line"><a name="l00258"></a><span class="lineno"> 258</span>&#160; <span class="comment">// USBTRACE(&quot;OnInit:&quot;);</span></div>
<div class="line"><a name="l00259"></a><span class="lineno"> 259</span>&#160; <span class="comment">// goto Fail;</span></div>
<div class="line"><a name="l00260"></a><span class="lineno"> 260</span>&#160; <span class="comment">//</span></div>
<div class="line"><a name="l00261"></a><span class="lineno"> 261</span>&#160;Fail:</div>
<div class="line"><a name="l00262"></a><span class="lineno"> 262</span>&#160; <span class="comment">//USBTRACE2(&quot;\r\nADK Init Failed, error code: &quot;, rcode);</span></div>
<div class="line"><a name="l00263"></a><span class="lineno"> 263</span>&#160; <span class="comment">//NotifyFail(rcode);</span></div>
<div class="line"><a name="l00264"></a><span class="lineno"> 264</span>&#160; <a class="code" href="class_a_d_k.html#a7f64af34d7890f87ceab5d144f6c26ef">Release</a>();</div>
<div class="line"><a name="l00265"></a><span class="lineno"> 265</span>&#160; <span class="keywordflow">return</span> rcode;</div>
<div class="line"><a name="l00266"></a><span class="lineno"> 266</span>&#160;}</div>
<div class="line"><a name="l00267"></a><span class="lineno"> 267</span>&#160;</div>
<div class="line"><a name="l00268"></a><span class="lineno"> 268</span>&#160;FailGetConfDescr:</div>
<div class="line"><a name="l00269"></a><span class="lineno"> 269</span>&#160;<span class="comment">// USBTRACE(&quot;getConf:&quot;);</span></div>
<div class="line"><a name="l00270"></a><span class="lineno"> 270</span>&#160; <span class="keywordflow">goto</span> Fail;</div>
<div class="line"><a name="l00271"></a><span class="lineno"> 271</span>&#160;<span class="comment">//</span></div>
<div class="line"><a name="l00272"></a><span class="lineno"> 272</span>&#160;FailSetConf:</div>
<div class="line"><a name="l00273"></a><span class="lineno"> 273</span>&#160;<span class="comment">// USBTRACE(&quot;setConf:&quot;);</span></div>
<div class="line"><a name="l00274"></a><span class="lineno"> 274</span>&#160; <span class="keywordflow">goto</span> Fail;</div>
<div class="line"><a name="l00275"></a><span class="lineno"> 275</span>&#160;<span class="comment">//</span></div>
<div class="line"><a name="l00276"></a><span class="lineno"> 276</span>&#160;<span class="comment">//FailOnInit:</span></div>
<div class="line"><a name="l00277"></a><span class="lineno"> 277</span>&#160;<span class="comment">// USBTRACE(&quot;OnInit:&quot;);</span></div>
<div class="line"><a name="l00278"></a><span class="lineno"> 278</span>&#160;<span class="comment">// goto Fail;</span></div>
<div class="line"><a name="l00279"></a><span class="lineno"> 279</span>&#160;<span class="comment">//</span></div>
<div class="line"><a name="l00280"></a><span class="lineno"> 280</span>&#160;Fail:</div>
<div class="line"><a name="l00281"></a><span class="lineno"> 281</span>&#160; <span class="comment">//USBTRACE2(&quot;\r\nADK Init Failed, error code: &quot;, rcode);</span></div>
<div class="line"><a name="l00282"></a><span class="lineno"> 282</span>&#160; <a class="code" href="class_a_d_k.html#a7f64af34d7890f87ceab5d144f6c26ef">Release</a>();</div>
<div class="line"><a name="l00283"></a><span class="lineno"> 283</span>&#160; <span class="keywordflow">return</span> rcode;</div>
<div class="line"><a name="l00284"></a><span class="lineno"> 284</span>&#160;}</div>
<div class="line"><a name="l00285"></a><span class="lineno"> 285</span>&#160;</div>
<div class="line"><a name="l00286"></a><span class="lineno"> 286</span>&#160;<span class="comment">/* Extracts bulk-IN and bulk-OUT endpoint information from config descriptor */</span></div>
<div class="line"><a name="l00287"></a><span class="lineno"><a class="code" href="class_a_d_k.html#aac2fac5410faea0e439b4f7e688b3d75"> 287</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_a_d_k.html#aac2fac5410faea0e439b4f7e688b3d75">ADK::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> *pep) </div>
<div class="line"><a name="l00288"></a><span class="lineno"> 288</span>&#160;{</div>
<div class="line"><a name="l00289"></a><span class="lineno"> 289</span>&#160; <span class="comment">//ErrorMessage&lt;uint8_t&gt;(PSTR(&quot;Conf.Val&quot;), conf);</span></div>
<div class="line"><a name="l00290"></a><span class="lineno"> 290</span>&#160; <span class="comment">//ErrorMessage&lt;uint8_t&gt;(PSTR(&quot;Iface Num&quot;),iface);</span></div>
<div class="line"><a name="l00291"></a><span class="lineno"> 291</span>&#160; <span class="comment">//ErrorMessage&lt;uint8_t&gt;(PSTR(&quot;Alt.Set&quot;), alt);</span></div>
<div class="line"><a name="l00268"></a><span class="lineno"> 268</span>&#160;<span class="comment">/* Extracts bulk-IN and bulk-OUT endpoint information from config descriptor */</span></div>
<div class="line"><a name="l00269"></a><span class="lineno"><a class="code" href="class_a_d_k.html#aac2fac5410faea0e439b4f7e688b3d75"> 269</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_a_d_k.html#aac2fac5410faea0e439b4f7e688b3d75">ADK::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> *pep) {</div>
<div class="line"><a name="l00270"></a><span class="lineno"> 270</span>&#160; <span class="comment">//ErrorMessage&lt;uint8_t&gt;(PSTR(&quot;Conf.Val&quot;), conf);</span></div>
<div class="line"><a name="l00271"></a><span class="lineno"> 271</span>&#160; <span class="comment">//ErrorMessage&lt;uint8_t&gt;(PSTR(&quot;Iface Num&quot;),iface);</span></div>
<div class="line"><a name="l00272"></a><span class="lineno"> 272</span>&#160; <span class="comment">//ErrorMessage&lt;uint8_t&gt;(PSTR(&quot;Alt.Set&quot;), alt);</span></div>
<div class="line"><a name="l00273"></a><span class="lineno"> 273</span>&#160;</div>
<div class="line"><a name="l00274"></a><span class="lineno"> 274</span>&#160; <span class="comment">//added by Yuuichi Akagawa</span></div>
<div class="line"><a name="l00275"></a><span class="lineno"> 275</span>&#160; <span class="keywordflow">if</span> (<a class="code" href="class_a_d_k.html#adf969d306da15baecd5c59bbb568053e">bNumEP</a> == 3) {</div>
<div class="line"><a name="l00276"></a><span class="lineno"> 276</span>&#160; <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00277"></a><span class="lineno"> 277</span>&#160; }</div>
<div class="line"><a name="l00278"></a><span class="lineno"> 278</span>&#160;</div>
<div class="line"><a name="l00279"></a><span class="lineno"> 279</span>&#160; <a class="code" href="class_a_d_k.html#ae8fcc6a6fccab61116cea10dd1f17738">bConfNum</a> = conf;</div>
<div class="line"><a name="l00280"></a><span class="lineno"> 280</span>&#160;</div>
<div class="line"><a name="l00281"></a><span class="lineno"> 281</span>&#160; uint8_t index;</div>
<div class="line"><a name="l00282"></a><span class="lineno"> 282</span>&#160;</div>
<div class="line"><a name="l00283"></a><span class="lineno"> 283</span>&#160; <span class="comment">// if ((pep-&gt;bmAttributes &amp; 0x02) == 2) {</span></div>
<div class="line"><a name="l00284"></a><span class="lineno"> 284</span>&#160; index = ((pep-&gt;<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#a23fbb539d72d10a6cb12efedf7d3457c">bEndpointAddress</a> &amp; 0x80) == 0x80) ? <a class="code" href="class_a_d_k.html#a964ec80ac133bf8d65cf0274e37b29da">epDataInIndex</a> : <a class="code" href="class_a_d_k.html#acfc5a7e45f15bba7ff8cd42552796624">epDataOutIndex</a>;</div>
<div class="line"><a name="l00285"></a><span class="lineno"> 285</span>&#160; <span class="comment">// }</span></div>
<div class="line"><a name="l00286"></a><span class="lineno"> 286</span>&#160;</div>
<div class="line"><a name="l00287"></a><span class="lineno"> 287</span>&#160; <span class="comment">// Fill in the endpoint info structure</span></div>
<div class="line"><a name="l00288"></a><span class="lineno"> 288</span>&#160; <a class="code" href="class_a_d_k.html#a6ffc693d731ddeb9499c11e893fc467d">epInfo</a>[index].<a class="code" href="struct_ep_info.html#a9f92be74c75c037b39e2cae1eb49b89b">epAddr</a> = (pep-&gt;<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#a23fbb539d72d10a6cb12efedf7d3457c">bEndpointAddress</a> &amp; 0x0F);</div>
<div class="line"><a name="l00289"></a><span class="lineno"> 289</span>&#160; <a class="code" href="class_a_d_k.html#a6ffc693d731ddeb9499c11e893fc467d">epInfo</a>[index].<a class="code" href="struct_ep_info.html#aa2ca775b63736df4008e88da7dd4dddb">maxPktSize</a> = (uint8_t)pep-&gt;<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#af34105fa6bd0029d9c6b73d85f7853c6">wMaxPacketSize</a>;</div>
<div class="line"><a name="l00290"></a><span class="lineno"> 290</span>&#160;</div>
<div class="line"><a name="l00291"></a><span class="lineno"> 291</span>&#160; <a class="code" href="class_a_d_k.html#adf969d306da15baecd5c59bbb568053e">bNumEP</a>++;</div>
<div class="line"><a name="l00292"></a><span class="lineno"> 292</span>&#160;</div>
<div class="line"><a name="l00293"></a><span class="lineno"> 293</span>&#160; <span class="comment">//added by Yuuichi Akagawa</span></div>
<div class="line"><a name="l00294"></a><span class="lineno"> 294</span>&#160; <span class="keywordflow">if</span>( <a class="code" href="class_a_d_k.html#adf969d306da15baecd5c59bbb568053e">bNumEP</a> == 3 ) {</div>
<div class="line"><a name="l00295"></a><span class="lineno"> 295</span>&#160; <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00296"></a><span class="lineno"> 296</span>&#160; }</div>
<div class="line"><a name="l00297"></a><span class="lineno"> 297</span>&#160; </div>
<div class="line"><a name="l00298"></a><span class="lineno"> 298</span>&#160; <a class="code" href="class_a_d_k.html#ae8fcc6a6fccab61116cea10dd1f17738">bConfNum</a> = conf;</div>
<div class="line"><a name="l00293"></a><span class="lineno"> 293</span>&#160; <span class="comment">//PrintEndpointDescriptor(pep);</span></div>
<div class="line"><a name="l00294"></a><span class="lineno"> 294</span>&#160;}</div>
<div class="line"><a name="l00295"></a><span class="lineno"> 295</span>&#160;</div>
<div class="line"><a name="l00296"></a><span class="lineno"> 296</span>&#160;<span class="comment">/* Performs a cleanup after failed Init() attempt */</span></div>
<div class="line"><a name="l00297"></a><span class="lineno"><a class="code" href="class_a_d_k.html#a7f64af34d7890f87ceab5d144f6c26ef"> 297</a></span>&#160;uint8_t <a class="code" href="class_a_d_k.html#a7f64af34d7890f87ceab5d144f6c26ef">ADK::Release</a>() {</div>
<div class="line"><a name="l00298"></a><span class="lineno"> 298</span>&#160; <a class="code" href="class_a_d_k.html#ab28e3a19569c27f3ed5362e9800065c1">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a66ab8f5eda239e761d5a48741ea1f9d4">GetAddressPool</a>().<a class="code" href="class_address_pool.html#a15fde13223dcb1da89305ad229763562">FreeAddress</a>(<a class="code" href="class_a_d_k.html#ab22a7c60cec56823727d4ff2cf2c4edf">bAddress</a>);</div>
<div class="line"><a name="l00299"></a><span class="lineno"> 299</span>&#160;</div>
<div class="line"><a name="l00300"></a><span class="lineno"> 300</span>&#160; uint8_t index;</div>
<div class="line"><a name="l00300"></a><span class="lineno"> 300</span>&#160; <a class="code" href="class_a_d_k.html#adf969d306da15baecd5c59bbb568053e">bNumEP</a> = 1; <span class="comment">//must have to be reset to 1</span></div>
<div class="line"><a name="l00301"></a><span class="lineno"> 301</span>&#160;</div>
<div class="line"><a name="l00302"></a><span class="lineno"> 302</span>&#160; <span class="keywordflow">if</span> ((pep-&gt;<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#a8ee7f1bafac335258c6e742969387f57">bmAttributes</a> &amp; 0x02) == 2) {</div>
<div class="line"><a name="l00303"></a><span class="lineno"> 303</span>&#160; index = ((pep-&gt;<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#a23fbb539d72d10a6cb12efedf7d3457c">bEndpointAddress</a> &amp; 0x80) == 0x80) ? <a class="code" href="class_a_d_k.html#a964ec80ac133bf8d65cf0274e37b29da">epDataInIndex</a> : <a class="code" href="class_a_d_k.html#acfc5a7e45f15bba7ff8cd42552796624">epDataOutIndex</a>;</div>
<div class="line"><a name="l00304"></a><span class="lineno"> 304</span>&#160; }</div>
<div class="line"><a name="l00305"></a><span class="lineno"> 305</span>&#160; </div>
<div class="line"><a name="l00306"></a><span class="lineno"> 306</span>&#160; <span class="comment">// Fill in the endpoint info structure</span></div>
<div class="line"><a name="l00307"></a><span class="lineno"> 307</span>&#160; <a class="code" href="class_a_d_k.html#a6ffc693d731ddeb9499c11e893fc467d">epInfo</a>[index].<a class="code" href="struct_ep_info.html#a9f92be74c75c037b39e2cae1eb49b89b">epAddr</a> = (pep-&gt;<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#a23fbb539d72d10a6cb12efedf7d3457c">bEndpointAddress</a> &amp; 0x0F);</div>
<div class="line"><a name="l00308"></a><span class="lineno"> 308</span>&#160; <a class="code" href="class_a_d_k.html#a6ffc693d731ddeb9499c11e893fc467d">epInfo</a>[index].<a class="code" href="struct_ep_info.html#aa2ca775b63736df4008e88da7dd4dddb">maxPktSize</a> = (uint8_t)pep-&gt;<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#af34105fa6bd0029d9c6b73d85f7853c6">wMaxPacketSize</a>;</div>
<div class="line"><a name="l00309"></a><span class="lineno"> 309</span>&#160;</div>
<div class="line"><a name="l00310"></a><span class="lineno"> 310</span>&#160; <a class="code" href="class_a_d_k.html#adf969d306da15baecd5c59bbb568053e">bNumEP</a> ++;</div>
<div class="line"><a name="l00311"></a><span class="lineno"> 311</span>&#160;</div>
<div class="line"><a name="l00312"></a><span class="lineno"> 312</span>&#160; <span class="comment">//PrintEndpointDescriptor(pep);</span></div>
<div class="line"><a name="l00313"></a><span class="lineno"> 313</span>&#160;}</div>
<div class="line"><a name="l00314"></a><span class="lineno"> 314</span>&#160;</div>
<div class="line"><a name="l00315"></a><span class="lineno"> 315</span>&#160;<span class="comment">/* Performs a cleanup after failed Init() attempt */</span></div>
<div class="line"><a name="l00316"></a><span class="lineno"><a class="code" href="class_a_d_k.html#a7f64af34d7890f87ceab5d144f6c26ef"> 316</a></span>&#160;uint8_t <a class="code" href="class_a_d_k.html#a7f64af34d7890f87ceab5d144f6c26ef">ADK::Release</a>()</div>
<div class="line"><a name="l00317"></a><span class="lineno"> 317</span>&#160;{</div>
<div class="line"><a name="l00318"></a><span class="lineno"> 318</span>&#160; <a class="code" href="class_a_d_k.html#ab28e3a19569c27f3ed5362e9800065c1">pUsb</a>-&gt;<a class="code" href="class_u_s_b.html#a66ab8f5eda239e761d5a48741ea1f9d4">GetAddressPool</a>().<a class="code" href="class_address_pool.html#a15fde13223dcb1da89305ad229763562">FreeAddress</a>(<a class="code" href="class_a_d_k.html#ab22a7c60cec56823727d4ff2cf2c4edf">bAddress</a>);</div>
<div class="line"><a name="l00319"></a><span class="lineno"> 319</span>&#160;</div>
<div class="line"><a name="l00320"></a><span class="lineno"> 320</span>&#160; <a class="code" href="class_a_d_k.html#adf969d306da15baecd5c59bbb568053e">bNumEP</a> = 1; <span class="comment">//must have to be reset to 1 </span></div>
<div class="line"><a name="l00321"></a><span class="lineno"> 321</span>&#160; </div>
<div class="line"><a name="l00322"></a><span class="lineno"> 322</span>&#160; <a class="code" href="class_a_d_k.html#ab22a7c60cec56823727d4ff2cf2c4edf">bAddress</a> = 0;</div>
<div class="line"><a name="l00323"></a><span class="lineno"> 323</span>&#160; <a class="code" href="class_a_d_k.html#a135db75b9e8cdd59b89f46c44dd83dd4">ready</a> = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00324"></a><span class="lineno"> 324</span>&#160; <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00325"></a><span class="lineno"> 325</span>&#160;}</div>
<div class="line"><a name="l00326"></a><span class="lineno"> 326</span>&#160;</div>
<div class="line"><a name="l00327"></a><span class="lineno"><a class="code" href="class_a_d_k.html#a66b9943dfa89f783a8cdeb655e6fe9b1"> 327</a></span>&#160;uint8_t <a class="code" href="class_a_d_k.html#a66b9943dfa89f783a8cdeb655e6fe9b1">ADK::RcvData</a>(uint16_t *bytes_rcvd, uint8_t *dataptr)</div>
<div class="line"><a name="l00328"></a><span class="lineno"> 328</span>&#160;{</div>
<div class="line"><a name="l00329"></a><span class="lineno"> 329</span>&#160; <span class="comment">//USBTRACE2(&quot;\r\nAddr: &quot;, bAddress );</span></div>
<div class="line"><a name="l00330"></a><span class="lineno"> 330</span>&#160; <span class="comment">//USBTRACE2(&quot;\r\nEP: &quot;,epInfo[epDataInIndex].epAddr);</span></div>
<div class="line"><a name="l00331"></a><span class="lineno"> 331</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#ad75d64f648b102fab2bd75e53e1324a4">inTransfer</a>(<a class="code" href="class_a_d_k.html#ab22a7c60cec56823727d4ff2cf2c4edf">bAddress</a>, <a class="code" href="class_a_d_k.html#a6ffc693d731ddeb9499c11e893fc467d">epInfo</a>[<a class="code" href="class_a_d_k.html#a964ec80ac133bf8d65cf0274e37b29da">epDataInIndex</a>].epAddr, bytes_rcvd, dataptr);</div>
<div class="line"><a name="l00302"></a><span class="lineno"> 302</span>&#160; <a class="code" href="class_a_d_k.html#ab22a7c60cec56823727d4ff2cf2c4edf">bAddress</a> = 0;</div>
<div class="line"><a name="l00303"></a><span class="lineno"> 303</span>&#160; <a class="code" href="class_a_d_k.html#a135db75b9e8cdd59b89f46c44dd83dd4">ready</a> = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00304"></a><span class="lineno"> 304</span>&#160; <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00305"></a><span class="lineno"> 305</span>&#160;}</div>
<div class="line"><a name="l00306"></a><span class="lineno"> 306</span>&#160;</div>
<div class="line"><a name="l00307"></a><span class="lineno"><a class="code" href="class_a_d_k.html#a66b9943dfa89f783a8cdeb655e6fe9b1"> 307</a></span>&#160;uint8_t <a class="code" href="class_a_d_k.html#a66b9943dfa89f783a8cdeb655e6fe9b1">ADK::RcvData</a>(uint16_t *bytes_rcvd, uint8_t *dataptr) {</div>
<div class="line"><a name="l00308"></a><span class="lineno"> 308</span>&#160; <span class="comment">//USBTRACE2(&quot;\r\nAddr: &quot;, bAddress );</span></div>
<div class="line"><a name="l00309"></a><span class="lineno"> 309</span>&#160; <span class="comment">//USBTRACE2(&quot;\r\nEP: &quot;,epInfo[epDataInIndex].epAddr);</span></div>
<div class="line"><a name="l00310"></a><span class="lineno"> 310</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#ad75d64f648b102fab2bd75e53e1324a4">inTransfer</a>(<a class="code" href="class_a_d_k.html#ab22a7c60cec56823727d4ff2cf2c4edf">bAddress</a>, <a class="code" href="class_a_d_k.html#a6ffc693d731ddeb9499c11e893fc467d">epInfo</a>[<a class="code" href="class_a_d_k.html#a964ec80ac133bf8d65cf0274e37b29da">epDataInIndex</a>].epAddr, bytes_rcvd, dataptr);</div>
<div class="line"><a name="l00311"></a><span class="lineno"> 311</span>&#160;}</div>
<div class="line"><a name="l00312"></a><span class="lineno"> 312</span>&#160;</div>
<div class="line"><a name="l00313"></a><span class="lineno"><a class="code" href="class_a_d_k.html#ac37bde02b6ed1436712d3619afb07c84"> 313</a></span>&#160;uint8_t <a class="code" href="class_a_d_k.html#ac37bde02b6ed1436712d3619afb07c84">ADK::SndData</a>(uint16_t nbytes, uint8_t *dataptr) {</div>
<div class="line"><a name="l00314"></a><span class="lineno"> 314</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#affbc018973a588995457d535b0ac7ee7">outTransfer</a>(<a class="code" href="class_a_d_k.html#ab22a7c60cec56823727d4ff2cf2c4edf">bAddress</a>, <a class="code" href="class_a_d_k.html#a6ffc693d731ddeb9499c11e893fc467d">epInfo</a>[<a class="code" href="class_a_d_k.html#acfc5a7e45f15bba7ff8cd42552796624">epDataOutIndex</a>].epAddr, nbytes, dataptr);</div>
<div class="line"><a name="l00315"></a><span class="lineno"> 315</span>&#160;}</div>
<div class="line"><a name="l00316"></a><span class="lineno"> 316</span>&#160;</div>
<div class="line"><a name="l00317"></a><span class="lineno"><a class="code" href="class_a_d_k.html#ac4bd3303b99921289c3f59e2df219e50"> 317</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_a_d_k.html#ac4bd3303b99921289c3f59e2df219e50">ADK::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="l00318"></a><span class="lineno"> 318</span>&#160; <a class="code" href="message_8cpp.html#a1e8693828152de8408add858dc461dea">Notify</a>(PSTR(<span class="stringliteral">&quot;Endpoint descriptor:&quot;</span>), 0x80);</div>
<div class="line"><a name="l00319"></a><span class="lineno"> 319</span>&#160; <a class="code" href="message_8cpp.html#a1e8693828152de8408add858dc461dea">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nLength:\t\t&quot;</span>), 0x80);</div>
<div class="line"><a name="l00320"></a><span class="lineno"> 320</span>&#160; PrintHex&lt;uint8_t &gt; (ep_ptr-&gt;<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#a55263a9cc9dc17abc37226ac8a471ad0">bLength</a>, 0x80);</div>
<div class="line"><a name="l00321"></a><span class="lineno"> 321</span>&#160; <a class="code" href="message_8cpp.html#a1e8693828152de8408add858dc461dea">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nType:\t\t&quot;</span>), 0x80);</div>
<div class="line"><a name="l00322"></a><span class="lineno"> 322</span>&#160; PrintHex&lt;uint8_t &gt; (ep_ptr-&gt;<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#af39d036ab903a96b9d4d56b879555d6c">bDescriptorType</a>, 0x80);</div>
<div class="line"><a name="l00323"></a><span class="lineno"> 323</span>&#160; <a class="code" href="message_8cpp.html#a1e8693828152de8408add858dc461dea">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nAddress:\t&quot;</span>), 0x80);</div>
<div class="line"><a name="l00324"></a><span class="lineno"> 324</span>&#160; PrintHex&lt;uint8_t &gt; (ep_ptr-&gt;<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#a23fbb539d72d10a6cb12efedf7d3457c">bEndpointAddress</a>, 0x80);</div>
<div class="line"><a name="l00325"></a><span class="lineno"> 325</span>&#160; <a class="code" href="message_8cpp.html#a1e8693828152de8408add858dc461dea">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nAttributes:\t&quot;</span>), 0x80);</div>
<div class="line"><a name="l00326"></a><span class="lineno"> 326</span>&#160; PrintHex&lt;uint8_t &gt; (ep_ptr-&gt;<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#a8ee7f1bafac335258c6e742969387f57">bmAttributes</a>, 0x80);</div>
<div class="line"><a name="l00327"></a><span class="lineno"> 327</span>&#160; <a class="code" href="message_8cpp.html#a1e8693828152de8408add858dc461dea">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nMaxPktSize:\t&quot;</span>), 0x80);</div>
<div class="line"><a name="l00328"></a><span class="lineno"> 328</span>&#160; PrintHex&lt;uint16_t &gt; (ep_ptr-&gt;<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#af34105fa6bd0029d9c6b73d85f7853c6">wMaxPacketSize</a>, 0x80);</div>
<div class="line"><a name="l00329"></a><span class="lineno"> 329</span>&#160; <a class="code" href="message_8cpp.html#a1e8693828152de8408add858dc461dea">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nPoll Intrv:\t&quot;</span>), 0x80);</div>
<div class="line"><a name="l00330"></a><span class="lineno"> 330</span>&#160; PrintHex&lt;uint8_t &gt; (ep_ptr-&gt;<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#a95cd9669dee9cab375a7c5e62284a01b">bInterval</a>, 0x80);</div>
<div class="line"><a name="l00331"></a><span class="lineno"> 331</span>&#160; <a class="code" href="message_8cpp.html#a1e8693828152de8408add858dc461dea">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\n&quot;</span>), 0x80);</div>
<div class="line"><a name="l00332"></a><span class="lineno"> 332</span>&#160;}</div>
<div class="line"><a name="l00333"></a><span class="lineno"> 333</span>&#160;</div>
<div class="line"><a name="l00334"></a><span class="lineno"><a class="code" href="class_a_d_k.html#ac37bde02b6ed1436712d3619afb07c84"> 334</a></span>&#160;uint8_t <a class="code" href="class_a_d_k.html#ac37bde02b6ed1436712d3619afb07c84">ADK::SndData</a>(uint16_t nbytes, uint8_t *dataptr)</div>
<div class="line"><a name="l00335"></a><span class="lineno"> 335</span>&#160;{</div>
<div class="line"><a name="l00336"></a><span class="lineno"> 336</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#affbc018973a588995457d535b0ac7ee7">outTransfer</a>(<a class="code" href="class_a_d_k.html#ab22a7c60cec56823727d4ff2cf2c4edf">bAddress</a>, <a class="code" href="class_a_d_k.html#a6ffc693d731ddeb9499c11e893fc467d">epInfo</a>[<a class="code" href="class_a_d_k.html#acfc5a7e45f15bba7ff8cd42552796624">epDataOutIndex</a>].epAddr, nbytes, dataptr);</div>
<div class="line"><a name="l00337"></a><span class="lineno"> 337</span>&#160;}</div>
<div class="line"><a name="l00338"></a><span class="lineno"> 338</span>&#160;</div>
<div class="line"><a name="l00339"></a><span class="lineno"><a class="code" href="class_a_d_k.html#ac4bd3303b99921289c3f59e2df219e50"> 339</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_a_d_k.html#ac4bd3303b99921289c3f59e2df219e50">ADK::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="l00340"></a><span class="lineno"> 340</span>&#160;{</div>
<div class="line"><a name="l00341"></a><span class="lineno"> 341</span>&#160; <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;Endpoint descriptor:&quot;</span>));</div>
<div class="line"><a name="l00342"></a><span class="lineno"> 342</span>&#160; <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nLength:\t\t&quot;</span>));</div>
<div class="line"><a name="l00343"></a><span class="lineno"> 343</span>&#160; PrintHex&lt;uint8_t&gt;(ep_ptr-&gt;<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#a55263a9cc9dc17abc37226ac8a471ad0">bLength</a>);</div>
<div class="line"><a name="l00344"></a><span class="lineno"> 344</span>&#160; <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nType:\t\t&quot;</span>));</div>
<div class="line"><a name="l00345"></a><span class="lineno"> 345</span>&#160; PrintHex&lt;uint8_t&gt;(ep_ptr-&gt;<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#af39d036ab903a96b9d4d56b879555d6c">bDescriptorType</a>);</div>
<div class="line"><a name="l00346"></a><span class="lineno"> 346</span>&#160; <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nAddress:\t&quot;</span>));</div>
<div class="line"><a name="l00347"></a><span class="lineno"> 347</span>&#160; PrintHex&lt;uint8_t&gt;(ep_ptr-&gt;<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#a23fbb539d72d10a6cb12efedf7d3457c">bEndpointAddress</a>);</div>
<div class="line"><a name="l00348"></a><span class="lineno"> 348</span>&#160; <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nAttributes:\t&quot;</span>));</div>
<div class="line"><a name="l00349"></a><span class="lineno"> 349</span>&#160; PrintHex&lt;uint8_t&gt;(ep_ptr-&gt;<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#a8ee7f1bafac335258c6e742969387f57">bmAttributes</a>);</div>
<div class="line"><a name="l00350"></a><span class="lineno"> 350</span>&#160; <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nMaxPktSize:\t&quot;</span>));</div>
<div class="line"><a name="l00351"></a><span class="lineno"> 351</span>&#160; PrintHex&lt;uint16_t&gt;(ep_ptr-&gt;<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#af34105fa6bd0029d9c6b73d85f7853c6">wMaxPacketSize</a>);</div>
<div class="line"><a name="l00352"></a><span class="lineno"> 352</span>&#160; <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\nPoll Intrv:\t&quot;</span>));</div>
<div class="line"><a name="l00353"></a><span class="lineno"> 353</span>&#160; PrintHex&lt;uint8_t&gt;(ep_ptr-&gt;<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#a95cd9669dee9cab375a7c5e62284a01b">bInterval</a>);</div>
<div class="line"><a name="l00354"></a><span class="lineno"> 354</span>&#160; <a class="code" href="message_8cpp.html#a968335d1c8fd7b45c95634e0828411be">Notify</a>(PSTR(<span class="stringliteral">&quot;\r\n&quot;</span>));</div>
<div class="line"><a name="l00355"></a><span class="lineno"> 355</span>&#160;}</div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>

View file

@ -109,7 +109,7 @@ Include dependency graph for adk.h:</div>
<div class="dyncontent">
<div class="center"><img src="adk_8h__incl.png" border="0" usemap="#adk_8h" alt=""/></div>
<map name="adk_8h" id="adk_8h">
<area shape="rect" id="node4" href="avrpins_8h.html" title="avrpins.h" alt="" coords="79,213,133,235"/><area shape="rect" id="node6" href="max3421e_8h.html" title="max3421e.h" alt="" coords="213,213,280,235"/><area shape="rect" id="node7" href="usbhost_8h.html" title="usbhost.h" alt="" coords="195,144,252,165"/><area shape="rect" id="node8" href="usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="613,213,672,235"/><area shape="rect" id="node9" href="_usb_8h.html" title="Usb.h" alt="" coords="477,75,520,96"/><area shape="rect" id="node14" href="printhex_8h.html" title="printhex.h" alt="" coords="1151,283,1208,304"/><area shape="rect" id="node15" href="hexdump_8h.html" title="hexdump.h" alt="" coords="1104,213,1165,235"/><area shape="rect" id="node16" href="message_8h.html" title="message.h" alt="" coords="816,213,877,235"/><area shape="rect" id="node17" href="confdescparser_8h.html" title="confdescparser.h" alt="" coords="933,75,1016,96"/><area shape="rect" id="node11" href="address_8h.html" title="address.h" alt="" coords="430,144,487,165"/><area shape="rect" id="node18" href="parsetools_8h.html" title="parsetools.h" alt="" coords="942,144,1007,165"/></map>
<area shape="rect" id="node4" href="avrpins_8h.html" title="avrpins.h" alt="" coords="89,213,143,235"/><area shape="rect" id="node6" href="max3421e_8h.html" title="max3421e.h" alt="" coords="283,213,349,235"/><area shape="rect" id="node7" href="usbhost_8h.html" title="usbhost.h" alt="" coords="73,144,129,165"/><area shape="rect" id="node8" href="usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="5,213,64,235"/><area shape="rect" id="node9" href="_usb_8h.html" title="Usb.h" alt="" coords="288,75,331,96"/><area shape="rect" id="node15" href="printhex_8h.html" title="printhex.h" alt="" coords="949,283,1005,304"/><area shape="rect" id="node16" href="hexdump_8h.html" title="hexdump.h" alt="" coords="701,283,763,304"/><area shape="rect" id="node14" href="message_8h.html" title="message.h" alt="" coords="701,213,763,235"/><area shape="rect" id="node17" href="confdescparser_8h.html" title="confdescparser.h" alt="" coords="739,75,823,96"/><area shape="rect" id="node11" href="address_8h.html" title="address.h" alt="" coords="433,144,489,165"/><area shape="rect" id="node18" href="parsetools_8h.html" title="parsetools.h" alt="" coords="819,144,884,165"/></map>
</div>
</div><div class="textblock"><div class="dynheader">
This graph shows which files directly or indirectly include this file:</div>
@ -134,8 +134,6 @@ Macros</h2></td></tr>
<tr class="separator:a32e861258886323d4dbcf066641597a4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a355cd5e5557b754645d4e1bfffabbf99"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="adk_8h.html#a355cd5e5557b754645d4e1bfffabbf99">ADB_PID</a>&#160;&#160;&#160;0x2D01</td></tr>
<tr class="separator:a355cd5e5557b754645d4e1bfffabbf99"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aeb9a797aace2bcf4a9d1f786a632ca4b"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="adk_8h.html#aeb9a797aace2bcf4a9d1f786a632ca4b">XOOM</a></td></tr>
<tr class="separator:aeb9a797aace2bcf4a9d1f786a632ca4b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4c3e43d4d2955f93260f3e5ffe207e41"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="adk_8h.html#a4c3e43d4d2955f93260f3e5ffe207e41">ADK_GETPROTO</a>&#160;&#160;&#160;51</td></tr>
<tr class="separator:a4c3e43d4d2955f93260f3e5ffe207e41"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4ab0e7e3adbc8bfc1bcdf29887c9a455"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="adk_8h.html#a4ab0e7e3adbc8bfc1bcdf29887c9a455">ADK_SENDSTR</a>&#160;&#160;&#160;52</td></tr>
@ -202,20 +200,6 @@ Macros</h2></td></tr>
<p>Definition at line <a class="el" href="adk_8h_source.html#l00045">45</a> of file <a class="el" href="adk_8h_source.html">adk.h</a>.</p>
</div>
</div>
<a class="anchor" id="aeb9a797aace2bcf4a9d1f786a632ca4b"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define XOOM</td>
</tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="adk_8h_source.html#l00047">47</a> of file <a class="el" href="adk_8h_source.html">adk.h</a>.</p>
</div>
</div>
<a class="anchor" id="a4c3e43d4d2955f93260f3e5ffe207e41"></a>
@ -228,7 +212,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="adk_8h_source.html#l00053">53</a> of file <a class="el" href="adk_8h_source.html">adk.h</a>.</p>
<p>Definition at line <a class="el" href="adk_8h_source.html#l00049">49</a> of file <a class="el" href="adk_8h_source.html">adk.h</a>.</p>
</div>
</div>
@ -242,7 +226,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="adk_8h_source.html#l00054">54</a> of file <a class="el" href="adk_8h_source.html">adk.h</a>.</p>
<p>Definition at line <a class="el" href="adk_8h_source.html#l00050">50</a> of file <a class="el" href="adk_8h_source.html">adk.h</a>.</p>
</div>
</div>
@ -256,7 +240,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="adk_8h_source.html#l00055">55</a> of file <a class="el" href="adk_8h_source.html">adk.h</a>.</p>
<p>Definition at line <a class="el" href="adk_8h_source.html#l00051">51</a> of file <a class="el" href="adk_8h_source.html">adk.h</a>.</p>
</div>
</div>
@ -270,7 +254,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="adk_8h_source.html#l00057">57</a> of file <a class="el" href="adk_8h_source.html">adk.h</a>.</p>
<p>Definition at line <a class="el" href="adk_8h_source.html#l00053">53</a> of file <a class="el" href="adk_8h_source.html">adk.h</a>.</p>
</div>
</div>
@ -284,7 +268,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="adk_8h_source.html#l00058">58</a> of file <a class="el" href="adk_8h_source.html">adk.h</a>.</p>
<p>Definition at line <a class="el" href="adk_8h_source.html#l00054">54</a> of file <a class="el" href="adk_8h_source.html">adk.h</a>.</p>
</div>
</div>
@ -298,7 +282,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="adk_8h_source.html#l00060">60</a> of file <a class="el" href="adk_8h_source.html">adk.h</a>.</p>
<p>Definition at line <a class="el" href="adk_8h_source.html#l00056">56</a> of file <a class="el" href="adk_8h_source.html">adk.h</a>.</p>
</div>
</div>
@ -312,7 +296,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="adk_8h_source.html#l00061">61</a> of file <a class="el" href="adk_8h_source.html">adk.h</a>.</p>
<p>Definition at line <a class="el" href="adk_8h_source.html#l00057">57</a> of file <a class="el" href="adk_8h_source.html">adk.h</a>.</p>
</div>
</div>
@ -326,7 +310,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="adk_8h_source.html#l00062">62</a> of file <a class="el" href="adk_8h_source.html">adk.h</a>.</p>
<p>Definition at line <a class="el" href="adk_8h_source.html#l00058">58</a> of file <a class="el" href="adk_8h_source.html">adk.h</a>.</p>
</div>
</div>
@ -340,7 +324,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="adk_8h_source.html#l00063">63</a> of file <a class="el" href="adk_8h_source.html">adk.h</a>.</p>
<p>Definition at line <a class="el" href="adk_8h_source.html#l00059">59</a> of file <a class="el" href="adk_8h_source.html">adk.h</a>.</p>
</div>
</div>
@ -354,7 +338,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="adk_8h_source.html#l00064">64</a> of file <a class="el" href="adk_8h_source.html">adk.h</a>.</p>
<p>Definition at line <a class="el" href="adk_8h_source.html#l00060">60</a> of file <a class="el" href="adk_8h_source.html">adk.h</a>.</p>
</div>
</div>
@ -368,7 +352,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="adk_8h_source.html#l00065">65</a> of file <a class="el" href="adk_8h_source.html">adk.h</a>.</p>
<p>Definition at line <a class="el" href="adk_8h_source.html#l00061">61</a> of file <a class="el" href="adk_8h_source.html">adk.h</a>.</p>
</div>
</div>
@ -382,7 +366,7 @@ Macros</h2></td></tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="adk_8h_source.html#l00067">67</a> of file <a class="el" href="adk_8h_source.html">adk.h</a>.</p>
<p>Definition at line <a class="el" href="adk_8h_source.html#l00063">63</a> of file <a class="el" href="adk_8h_source.html">adk.h</a>.</p>
</div>
</div>

View file

@ -1,13 +1,13 @@
<map id="adk.h" name="adk.h">
<area shape="rect" id="node4" href="$avrpins_8h.html" title="avrpins.h" alt="" coords="79,213,133,235"/>
<area shape="rect" id="node6" href="$max3421e_8h.html" title="max3421e.h" alt="" coords="213,213,280,235"/>
<area shape="rect" id="node7" href="$usbhost_8h.html" title="usbhost.h" alt="" coords="195,144,252,165"/>
<area shape="rect" id="node8" href="$usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="613,213,672,235"/>
<area shape="rect" id="node9" href="$_usb_8h.html" title="Usb.h" alt="" coords="477,75,520,96"/>
<area shape="rect" id="node14" href="$printhex_8h.html" title="printhex.h" alt="" coords="1151,283,1208,304"/>
<area shape="rect" id="node15" href="$hexdump_8h.html" title="hexdump.h" alt="" coords="1104,213,1165,235"/>
<area shape="rect" id="node16" href="$message_8h.html" title="message.h" alt="" coords="816,213,877,235"/>
<area shape="rect" id="node17" href="$confdescparser_8h.html" title="confdescparser.h" alt="" coords="933,75,1016,96"/>
<area shape="rect" id="node11" href="$address_8h.html" title="address.h" alt="" coords="430,144,487,165"/>
<area shape="rect" id="node18" href="$parsetools_8h.html" title="parsetools.h" alt="" coords="942,144,1007,165"/>
<area shape="rect" id="node4" href="$avrpins_8h.html" title="avrpins.h" alt="" coords="89,213,143,235"/>
<area shape="rect" id="node6" href="$max3421e_8h.html" title="max3421e.h" alt="" coords="283,213,349,235"/>
<area shape="rect" id="node7" href="$usbhost_8h.html" title="usbhost.h" alt="" coords="73,144,129,165"/>
<area shape="rect" id="node8" href="$usb__ch9_8h.html" title="usb_ch9.h" alt="" coords="5,213,64,235"/>
<area shape="rect" id="node9" href="$_usb_8h.html" title="Usb.h" alt="" coords="288,75,331,96"/>
<area shape="rect" id="node15" href="$printhex_8h.html" title="printhex.h" alt="" coords="949,283,1005,304"/>
<area shape="rect" id="node16" href="$hexdump_8h.html" title="hexdump.h" alt="" coords="701,283,763,304"/>
<area shape="rect" id="node14" href="$message_8h.html" title="message.h" alt="" coords="701,213,763,235"/>
<area shape="rect" id="node17" href="$confdescparser_8h.html" title="confdescparser.h" alt="" coords="739,75,823,96"/>
<area shape="rect" id="node11" href="$address_8h.html" title="address.h" alt="" coords="433,144,489,165"/>
<area shape="rect" id="node18" href="$parsetools_8h.html" title="parsetools.h" alt="" coords="819,144,884,165"/>
</map>

View file

@ -1 +1 @@
eedfc8b2363ce002d69c88466e724e25
22f03cde536a29beee865eef188aa9b8

Binary file not shown.

Before

Width:  |  Height:  |  Size: 127 KiB

After

Width:  |  Height:  |  Size: 123 KiB

View file

@ -135,105 +135,109 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<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>
<div class="line"><a name="l00047"></a><span class="lineno"><a class="code" href="adk_8h.html#aeb9a797aace2bcf4a9d1f786a632ca4b"> 47</a></span>&#160;<span class="preprocessor">#define XOOM //enables repeating getProto() and getConf() attempts</span></div>
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span>&#160;<span class="preprocessor"></span> <span class="comment">//necessary for slow devices such as Motorola XOOM</span></div>
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span>&#160; <span class="comment">//defined by default, can be commented out to save memory</span></div>
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span>&#160;</div>
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>&#160;<span class="comment">/* requests */</span></div>
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span>&#160;</div>
<div class="line"><a name="l00053"></a><span class="lineno"><a class="code" href="adk_8h.html#a4c3e43d4d2955f93260f3e5ffe207e41"> 53</a></span>&#160;<span class="preprocessor">#define ADK_GETPROTO 51 //check USB accessory protocol version</span></div>
<div class="line"><a name="l00054"></a><span class="lineno"><a class="code" href="adk_8h.html#a4ab0e7e3adbc8bfc1bcdf29887c9a455"> 54</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define ADK_SENDSTR 52 //send identifying string</span></div>
<div class="line"><a name="l00055"></a><span class="lineno"><a class="code" href="adk_8h.html#a6ebdba027fb7072f681e6445a385e8f2"> 55</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="l00056"></a><span class="lineno"> 56</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00057"></a><span class="lineno"><a class="code" href="adk_8h.html#a67b2829fb8d9f0e52eebef518ec6ebb0"> 57</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="l00058"></a><span class="lineno"><a class="code" href="adk_8h.html#a7da9c6adbc669b65ca3e4bd3f90c4c7b"> 58</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="l00059"></a><span class="lineno"> 59</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00060"></a><span class="lineno"><a class="code" href="adk_8h.html#a12e00d6841cbb8fd9ae7c97402efa062"> 60</a></span>&#160;<span class="preprocessor">#define ACCESSORY_STRING_MANUFACTURER 0</span></div>
<div class="line"><a name="l00061"></a><span class="lineno"><a class="code" href="adk_8h.html#a962954d4b489994aa347721c582fe242"> 61</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define ACCESSORY_STRING_MODEL 1</span></div>
<div class="line"><a name="l00062"></a><span class="lineno"><a class="code" href="adk_8h.html#aa376dd887b57d0628df287dd1fce7f3b"> 62</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define ACCESSORY_STRING_DESCRIPTION 2</span></div>
<div class="line"><a name="l00063"></a><span class="lineno"><a class="code" href="adk_8h.html#aab852db9aa38642ad7be827ae95351c5"> 63</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define ACCESSORY_STRING_VERSION 3</span></div>
<div class="line"><a name="l00064"></a><span class="lineno"><a class="code" href="adk_8h.html#a0485b5be230520d0acde7ef32fb8210e"> 64</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define ACCESSORY_STRING_URI 4</span></div>
<div class="line"><a name="l00065"></a><span class="lineno"><a class="code" href="adk_8h.html#a31b2b6ec818e90cd9fe47bd4f7f86c16"> 65</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define ACCESSORY_STRING_SERIAL 5</span></div>
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00067"></a><span class="lineno"><a class="code" href="adk_8h.html#ac39da606ffc273bd855152107297d6a1"> 67</a></span>&#160;<span class="preprocessor">#define ADK_MAX_ENDPOINTS 3 //endpoint 0, bulk_IN, bulk_OUT</span></div>
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>&#160;<span class="keyword">class </span><a class="code" href="class_a_d_k.html">ADK</a>;</div>
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>&#160;</div>
<div class="line"><a name="l00071"></a><span class="lineno"><a class="code" href="class_a_d_k.html"> 71</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="l00072"></a><span class="lineno"> 72</span>&#160;{</div>
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span>&#160; <span class="comment">/* ID strings */</span></div>
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span>&#160; <span class="keyword">const</span> <span class="keywordtype">char</span>* manufacturer;</div>
<div class="line"><a name="l00076"></a><span class="lineno"> 76</span>&#160; <span class="keyword">const</span> <span class="keywordtype">char</span>* model;</div>
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span>&#160; <span class="keyword">const</span> <span class="keywordtype">char</span>* description;</div>
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span>&#160; <span class="keyword">const</span> <span class="keywordtype">char</span>* version;</div>
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>&#160; <span class="keyword">const</span> <span class="keywordtype">char</span>* uri;</div>
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>&#160; <span class="keyword">const</span> <span class="keywordtype">char</span>* serial;</div>
<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="comment">/* ADK proprietary requests */</span></div>
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span>&#160; uint8_t getProto( uint8_t* adkproto );</div>
<div class="line"><a name="l00084"></a><span class="lineno"> 84</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="l00085"></a><span class="lineno"> 85</span>&#160; uint8_t switchAcc( <span class="keywordtype">void</span> );</div>
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span>&#160;</div>
<div class="line"><a name="l00087"></a><span class="lineno"> 87</span>&#160;<span class="keyword">protected</span>:</div>
<div class="line"><a name="l00088"></a><span class="lineno"><a class="code" href="class_a_d_k.html#a964ec80ac133bf8d65cf0274e37b29da"> 88</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="l00089"></a><span class="lineno"><a class="code" href="class_a_d_k.html#acfc5a7e45f15bba7ff8cd42552796624"> 89</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="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>
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span>&#160;</div>
<div class="line"><a name="l00091"></a><span class="lineno"> 91</span>&#160; <span class="comment">/* mandatory members */</span></div>
<div class="line"><a name="l00092"></a><span class="lineno"><a class="code" href="class_a_d_k.html#ab28e3a19569c27f3ed5362e9800065c1"> 92</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="l00093"></a><span class="lineno"><a class="code" href="class_a_d_k.html#ab22a7c60cec56823727d4ff2cf2c4edf"> 93</a></span>&#160; uint8_t <a class="code" href="class_a_d_k.html#ab22a7c60cec56823727d4ff2cf2c4edf">bAddress</a>;</div>
<div class="line"><a name="l00094"></a><span class="lineno"><a class="code" href="class_a_d_k.html#ae8fcc6a6fccab61116cea10dd1f17738"> 94</a></span>&#160; uint8_t <a class="code" href="class_a_d_k.html#ae8fcc6a6fccab61116cea10dd1f17738">bConfNum</a>; <span class="comment">// configuration number</span></div>
<div class="line"><a name="l00095"></a><span class="lineno"> 95</span>&#160;</div>
<div class="line"><a name="l00096"></a><span class="lineno"><a class="code" href="class_a_d_k.html#adf969d306da15baecd5c59bbb568053e"> 96</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="l00097"></a><span class="lineno"><a class="code" href="class_a_d_k.html#a135db75b9e8cdd59b89f46c44dd83dd4"> 97</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="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="comment">/* Endpoint data structure */</span></div>
<div class="line"><a name="l00100"></a><span class="lineno"><a class="code" href="class_a_d_k.html#a6ffc693d731ddeb9499c11e893fc467d"> 100</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="l00101"></a><span class="lineno"> 101</span>&#160;</div>
<div class="line"><a name="l00102"></a><span class="lineno"> 102</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="l00103"></a><span class="lineno"> 103</span>&#160;</div>
<div class="line"><a name="l00104"></a><span class="lineno"> 104</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00105"></a><span class="lineno"> 105</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="l00106"></a><span class="lineno"> 106</span>&#160; <span class="keyword">const</span> <span class="keywordtype">char</span>* model,</div>
<div class="line"><a name="l00107"></a><span class="lineno"> 107</span>&#160; <span class="keyword">const</span> <span class="keywordtype">char</span>* description,</div>
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span>&#160; <span class="keyword">const</span> <span class="keywordtype">char</span>* version,</div>
<div class="line"><a name="l00109"></a><span class="lineno"> 109</span>&#160; <span class="keyword">const</span> <span class="keywordtype">char</span>* uri,</div>
<div class="line"><a name="l00110"></a><span class="lineno"> 110</span>&#160; <span class="keyword">const</span> <span class="keywordtype">char</span>* serial);</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>
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span>&#160;</div>
<div class="line"><a name="l00112"></a><span class="lineno"> 112</span>&#160; <span class="comment">// Methods for receiving and sending data</span></div>
<div class="line"><a name="l00113"></a><span class="lineno"> 113</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="l00114"></a><span class="lineno"> 114</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="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>
<div class="line"><a name="l00115"></a><span class="lineno"> 115</span>&#160;</div>
<div class="line"><a name="l00116"></a><span class="lineno"> 116</span>&#160;</div>
<div class="line"><a name="l00117"></a><span class="lineno"> 117</span>&#160; <span class="comment">// USBDeviceConfig implementation</span></div>
<div class="line"><a name="l00118"></a><span class="lineno"> 118</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="l00119"></a><span class="lineno"> 119</span>&#160; <span class="keyword">virtual</span> uint8_t <a class="code" href="class_a_d_k.html#a7f64af34d7890f87ceab5d144f6c26ef">Release</a>();</div>
<div class="line"><a name="l00120"></a><span class="lineno"><a class="code" href="class_a_d_k.html#af3784434ee6a1c6f3dc5b591f467e703"> 120</a></span>&#160; <span class="keyword">virtual</span> uint8_t <a class="code" href="class_a_d_k.html#af3784434ee6a1c6f3dc5b591f467e703">Poll</a>(){}; <span class="comment">//not implemented</span></div>
<div class="line"><a name="l00121"></a><span class="lineno"><a class="code" href="class_a_d_k.html#a1a972e8dc98b60ab27528db3af2618c3"> 121</a></span>&#160; <span class="keyword">virtual</span> uint8_t <a class="code" href="class_a_d_k.html#a1a972e8dc98b60ab27528db3af2618c3">GetAddress</a>() { <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"><a class="code" href="class_a_d_k.html#a1dee02856625dfcac4b0cdd4e8672cef"> 122</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>() { <span class="keywordflow">return</span> <a class="code" href="class_a_d_k.html#a135db75b9e8cdd59b89f46c44dd83dd4">ready</a>; };</div>
<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>
<div class="line"><a name="l00123"></a><span class="lineno"> 123</span>&#160;</div>
<div class="line"><a name="l00124"></a><span class="lineno"> 124</span>&#160; <span class="comment">//UsbConfigXtracter implementation</span></div>
<div class="line"><a name="l00125"></a><span class="lineno"> 125</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="l00126"></a><span class="lineno"> 126</span>&#160;}; <span class="comment">//class ADK : public USBDeviceConfig ...</span></div>
<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>
<div class="line"><a name="l00127"></a><span class="lineno"> 127</span>&#160;</div>
<div class="line"><a name="l00128"></a><span class="lineno"> 128</span>&#160;<span class="comment">/* get ADK protocol version */</span></div>
<div class="line"><a name="l00129"></a><span class="lineno"> 129</span>&#160;<span class="comment">/* returns 2 bytes in *adkproto */</span></div>
<div class="line"><a name="l00130"></a><span class="lineno"> 130</span>&#160;<span class="keyword">inline</span> uint8_t ADK::getProto( uint8_t* adkproto )</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="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="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">/* send ADK string */</span></div>
<div class="line"><a name="l00135"></a><span class="lineno"> 135</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="l00136"></a><span class="lineno"> 136</span>&#160;{</div>
<div class="line"><a name="l00137"></a><span class="lineno"> 137</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="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">/* switch to accessory mode */</span></div>
<div class="line"><a name="l00140"></a><span class="lineno"> 140</span>&#160;<span class="keyword">inline</span> uint8_t ADK::switchAcc( <span class="keywordtype">void</span> )</div>
<div class="line"><a name="l00141"></a><span class="lineno"> 141</span>&#160;{</div>
<div class="line"><a name="l00142"></a><span class="lineno"> 142</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="l00143"></a><span class="lineno"> 143</span>&#160;}</div>
<div class="line"><a name="l00144"></a><span class="lineno"> 144</span>&#160;</div>
<div class="line"><a name="l00145"></a><span class="lineno"> 145</span>&#160;<span class="preprocessor">#endif // _ADK_H_</span></div>
<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>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>

View file

@ -101,8 +101,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<tr id="row_9_"><td class="entry"><img src="ftv2node.png" alt="o" width="16" height="22" /><img src="ftv2cl.png" alt="C" width="24" height="22" /><a class="el" href="struct_c_a_l_l___m_g_m_n_t___f_u_n_c___d_e_s_c_r.html" target="_self">CALL_MGMNT_FUNC_DESCR</a></td><td class="desc"></td></tr>
<tr id="row_10_" class="even"><td class="entry"><img src="ftv2node.png" alt="o" width="16" height="22" /><img src="ftv2cl.png" alt="C" width="24" height="22" /><a class="el" href="struct_capacity.html" target="_self">Capacity</a></td><td class="desc"></td></tr>
<tr id="row_11_"><td class="entry"><img src="ftv2node.png" alt="o" width="16" height="22" /><img src="ftv2cl.png" alt="C" width="24" height="22" /><a class="el" href="class_c_d_c_async_oper.html" target="_self">CDCAsyncOper</a></td><td class="desc"></td></tr>
<tr id="row_12_" class="even"><td class="entry"><img src="ftv2node.png" alt="o" width="16" height="22" /><img src="ftv2cl.png" alt="C" width="24" height="22" /><a class="el" href="struct_c_l_a_s_s___n_o_t_i_f_i_c_a_t_i_o_n.html" target="_self">CLASS_NOTIFICATION</a></td><td class="desc"></td></tr>
<tr id="row_13_"><td class="entry"><img src="ftv2node.png" alt="o" width="16" height="22" /><img src="ftv2cl.png" alt="C" width="24" height="22" /><a class="el" href="struct_command_block_wrapper.html" target="_self">CommandBlockWrapper</a></td><td class="desc"></td></tr>
<tr id="row_12_" class="even"><td class="entry"><img src="ftv2node.png" alt="o" width="16" height="22" /><img src="ftv2cl.png" alt="C" width="24" height="22" /><a class="el" href="struct_command_block_wrapper.html" target="_self">CommandBlockWrapper</a></td><td class="desc"></td></tr>
<tr id="row_13_"><td class="entry"><img src="ftv2node.png" alt="o" width="16" height="22" /><img src="ftv2cl.png" alt="C" width="24" height="22" /><a class="el" href="struct_command_block_wrapper_base.html" target="_self">CommandBlockWrapperBase</a></td><td class="desc"></td></tr>
<tr id="row_14_" class="even"><td class="entry"><img src="ftv2node.png" alt="o" width="16" height="22" /><img src="ftv2cl.png" alt="C" width="24" height="22" /><a class="el" href="struct_command_status_wrapper.html" target="_self">CommandStatusWrapper</a></td><td class="desc"></td></tr>
<tr id="row_15_"><td class="entry"><img src="ftv2node.png" alt="o" width="16" height="22" /><img src="ftv2cl.png" alt="C" width="24" height="22" /><a class="el" href="class_config_desc_parser.html" target="_self">ConfigDescParser</a></td><td class="desc"></td></tr>
<tr id="row_16_" class="even"><td class="entry"><img src="ftv2node.png" alt="o" width="16" height="22" /><img src="ftv2cl.png" alt="C" width="24" height="22" /><a class="el" href="struct_ep_info.html" target="_self">EpInfo</a></td><td class="desc"></td></tr>

View file

@ -97,6 +97,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
Include dependency graph for avrpins.h:</div>
<div class="dyncontent">
<div class="center"><img src="avrpins_8h__incl.png" border="0" usemap="#avrpins_8h" alt=""/></div>
<map name="avrpins_8h" id="avrpins_8h">
</map>
</div>
</div><div class="textblock"><div class="dynheader">
This graph shows which files directly or indirectly include this file:</div>

File diff suppressed because it is too large Load diff

Some files were not shown because too many files have changed in this diff Show more