USB_Host_Shield_2.0/index.html
2013-02-17 01:37:13 +01:00

194 lines
17 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.3.1"/>
<title>USB Host Shield 2.0: Main Page</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="imageStyle.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">USB Host Shield 2.0
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.3.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li class="current"><a href="index.html"><span>Main&#160;Page</span></a></li>
<li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Macros</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Pages</a></div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="headertitle">
<div class="title">USB Host Shield 2.0 Documentation</div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p>The code is released under the GNU General Public License. </p>
<hr/>
<h1>Summary</h1>
<p>This is Revision 2.0 of MAX3421E-based <a class="el" href="class_u_s_b.html">USB</a> Host Shield Library for AVR's.</p>
<p>Project main web site is: <a href="http://www.circuitsathome.com">http://www.circuitsathome.com</a>.</p>
<p>Some information can also be found at: <a href="http://blog.tkjelectronics.dk/">http://blog.tkjelectronics.dk/</a>.</p>
<p>The shield can be purchased at the main site: <a href="http://www.circuitsathome.com/products-page/arduino-shields">http://www.circuitsathome.com/products-page/arduino-shields</a> or from <a href="http://tkjelectronics.com/">TKJ Electronics</a>: <a href="http://shop.tkjelectronics.dk/product_info.php?products_id=43">http://shop.tkjelectronics.dk/product_info.php?products_id=43</a>.</p>
<div class="image">
<img src="http://www.circuitsathome.com/wp/wp-content/uploads/2012/02/UHS_20_main-288x216.jpg" alt="USB Host Shield"/>
</div>
<p>For more information about the hardware see the <a href="http://www.circuitsathome.com/usb-host-shield-hardware-manual">Hardware Manual</a>.</p>
<h1>Developed By</h1>
<ul>
<li><b>Oleg Mazurov, Circuits@Home</b> - <a href="#" onclick="location.href='mai'+'lto:'+'maz'+'ur'+'ov@'+'ci'+'rcu'+'it'+'sat'+'ho'+'me.'+'co'+'m'; return false;">mazur<span style="display: none;">.nosp@m.</span>ov@c<span style="display: none;">.nosp@m.</span>ircui<span style="display: none;">.nosp@m.</span>tsat<span style="display: none;">.nosp@m.</span>home.<span style="display: none;">.nosp@m.</span>com</a><ul>
<li>Developer of the <a class="el" href="class_u_s_b.html">USB</a> Core, <a class="el" href="class_h_i_d.html">HID</a>, <a class="el" href="class_f_t_d_i.html">FTDI</a>, <a class="el" href="class_a_d_k.html">ADK</a>, <a class="el" href="class_a_c_m.html">ACM</a>, and <a class="el" href="class_p_l2303.html">PL2303</a> libraries</li>
</ul>
</li>
<li><b>Kristian Lauszus, TKJ Electronics</b> - <a href="#" onclick="location.href='mai'+'lto:'+'kri'+'st'+'ian'+'l@'+'tkj'+'el'+'ect'+'ro'+'nic'+'s.'+'com'; return false;">krist<span style="display: none;">.nosp@m.</span>ianl<span style="display: none;">.nosp@m.</span>@tkje<span style="display: none;">.nosp@m.</span>lect<span style="display: none;">.nosp@m.</span>ronic<span style="display: none;">.nosp@m.</span>s.co<span style="display: none;">.nosp@m.</span>m</a><ul>
<li>Developer of the <a class="el" href="class_b_t_d.html">BTD</a>, <a class="el" href="class_s_p_p.html">SPP</a>, PS3, Wii, and Xbox libraries</li>
</ul>
</li>
</ul>
<h1>How to use the library</h1>
<h3>Arduino <a class="el" href="class_a_d_k.html">ADK</a></h3>
<p>To use this library with the official <a href="http://arduino.cc/en/Main/ArduinoBoardADK">Arduino ADK</a> uncomment the following line in <a href="https://github.com/felis/USB_Host_Shield_2.0/blob/master/avrpins.h">avrpins.h</a>:</p>
<p><code> #define BOARD_MEGA_ADK </code></p>
<h3><a href="https://github.com/felis/USB_Host_Shield_2.0/blob/master/BTD.cpp">Bluetooth libraries</a></h3>
<p>The <a href="https://github.com/felis/USB_Host_Shield_2.0/blob/master/BTD.cpp">BTD library</a> is a general purpose library for an ordinary Bluetooth dongle. This library make it easy to add support for different Bluetooth services like a PS3 or a Wii controller or <a class="el" href="class_s_p_p.html">SPP</a> which is a virtual serial port via Bluetooth. Some different examples can be found in the <a href="https://github.com/felis/USB_Host_Shield_2.0/tree/master/examples/Bluetooth">example directory</a>.</p>
<p>The <a class="el" href="class_b_t_d.html">BTD</a> library will also make it possible to use multiple services at once, the following example sketch is an example of this: <a href="https://github.com/felis/USB_Host_Shield_2.0/blob/master/examples/Bluetooth/PS3SPP/PS3SPP.ino">https://github.com/felis/USB_Host_Shield_2.0/blob/master/examples/Bluetooth/PS3SPP/PS3SPP.ino</a></p>
<h3><a href="https://github.com/felis/USB_Host_Shield_2.0/blob/master/SPP.cpp">SPP library</a></h3>
<p><a class="el" href="class_s_p_p.html">SPP</a> stands for "Serial Port Profile" 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. It has been tested successfully on Windows, Mac OS X, Linux, and Android. Unfortunately Google broke something in Android 4.2, so it's currently not working in this version of Android.</p>
<p>More information can be found at these blog posts:</p>
<ul>
<li><a href="http://www.circuitsathome.com/mcu/bluetooth-rfcommspp-service-support-for-usb-host-2-0-library-released">http://www.circuitsathome.com/mcu/bluetooth-rfcommspp-service-support-for-usb-host-2-0-library-released</a></li>
<li><a href="http://blog.tkjelectronics.dk/2012/07/rfcommspp-library-for-arduino/">http://blog.tkjelectronics.dk/2012/07/rfcommspp-library-for-arduino/</a></li>
</ul>
<p>To implement the <a class="el" href="class_s_p_p.html">SPP</a> protocol I used a Bluetooth sniffing tool called <a href="http://www.tkjelectronics.com/uploads/PacketLogger.zip">PacketLogger</a> developed by Apple. It enables me to see the Bluetooth communication between my Mac and any device.</p>
<h3>PS3 Library</h3>
<p>These libraries consist of the <a href="https://github.com/felis/USB_Host_Shield_2.0/blob/master/PS3BT.cpp">PS3BT</a> and <a href="https://github.com/felis/USB_Host_Shield_2.0/blob/master/PS3USB.cpp">PS3USB</a>. These libraries allows you to use a Dualshock 3, Navigation or a Motion controller with the <a class="el" href="class_u_s_b.html">USB</a> Host Shield both via Bluetooth and <a class="el" href="class_u_s_b.html">USB</a>.</p>
<p>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 <a class="el" href="class_u_s_b.html">USB</a> and letting the library set it automatically.</p>
<p><b>Note:</b> 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: <a href="https://github.com/felis/USB_Host_Shield_2.0/blob/master/examples/Bluetooth/PS3BT/PS3BT.ino#L12">https://github.com/felis/USB_Host_Shield_2.0/blob/master/examples/Bluetooth/PS3BT/PS3BT.ino#L12</a>.</p>
<p>For more information about the PS3 protocol see the official wiki: <a href="https://github.com/felis/USB_Host_Shield_2.0/wiki/PS3-Information">https://github.com/felis/USB_Host_Shield_2.0/wiki/PS3-Information</a>.</p>
<p>Also take a look at the blog posts:</p>
<ul>
<li><a href="http://blog.tkjelectronics.dk/2012/01/ps3-controller-bt-library-for-arduino/">http://blog.tkjelectronics.dk/2012/01/ps3-controller-bt-library-for-arduino/</a></li>
<li><a href="http://www.circuitsathome.com/mcu/sony-ps3-controller-support-added-to-usb-host-library">http://www.circuitsathome.com/mcu/sony-ps3-controller-support-added-to-usb-host-library</a></li>
<li><a href="http://www.circuitsathome.com/mcu/arduino/interfacing-ps3-controllers-via-usb">http://www.circuitsathome.com/mcu/arduino/interfacing-ps3-controllers-via-usb</a></li>
</ul>
<p>A special thanks go to the following people:</p>
<ol type="1">
<li><em>Richard Ibbotson</em> who made this excellent guide: <a href="http://www.circuitsathome.com/mcu/ps3-and-wiimote-game-controllers-on-the-arduino-host-shield-part">http://www.circuitsathome.com/mcu/ps3-and-wiimote-game-controllers-on-the-arduino-host-shield-part</a></li>
<li><em>Tomoyuki Tanaka</em> for releasing his code for the Arduino <a class="el" href="class_u_s_b.html">USB</a> Host shield connected to the wiimote: <a href="http://www.circuitsathome.com/mcu/rc-car-controlled-by-wii-remote-on-arduino">http://www.circuitsathome.com/mcu/rc-car-controlled-by-wii-remote-on-arduino</a></li>
</ol>
<p>Also a big thanks all the people behind these sites about the Motion controller:</p>
<ul>
<li><a href="http://thp.io/2010/psmove/">http://thp.io/2010/psmove/</a></li>
<li><a href="http://www.copenhagengamecollective.org/unimove/">http://www.copenhagengamecollective.org/unimove/</a></li>
<li><a href="https://github.com/thp/psmoveapi">https://github.com/thp/psmoveapi</a></li>
<li><a href="http://code.google.com/p/moveonpc/">http://code.google.com/p/moveonpc/</a></li>
</ul>
<h3>Xbox 360 Library</h3>
<p>The library support one Xbox 360 via <a class="el" href="class_u_s_b.html">USB</a> or up to four Xbox 360 controllers wirelessly by using a <a href="http://blog.tkjelectronics.dk/wp-content/uploads/xbox360-wireless-receiver.jpg">Xbox 360 wireless receiver</a>.</p>
<p>To use it via <a class="el" href="class_u_s_b.html">USB</a> use the <a href="https://github.com/felis/USB_Host_Shield_2.0/blob/master/XBOXUSB.cpp">XBOXUSB</a> library or to use it wirelessly use the <a href="https://github.com/felis/USB_Host_Shield_2.0/blob/master/XBOXRECV.cpp">XBOXRECV</a> library.</p>
<p><b>Note that a Wireless controller can NOT be used via USB!</b></p>
<p>Examples code can be found in the <a href="https://github.com/felis/USB_Host_Shield_2.0/tree/master/examples/Xbox">examples directory</a>.</p>
<p>Also see the following blog posts:</p>
<ul>
<li><a href="http://www.circuitsathome.com/mcu/xbox360-controller-support-added-to-usb-host-shield-2-0-library">http://www.circuitsathome.com/mcu/xbox360-controller-support-added-to-usb-host-shield-2-0-library</a></li>
<li><a href="http://blog.tkjelectronics.dk/2012/07/xbox-360-controller-support-added-to-the-usb-host-library/">http://blog.tkjelectronics.dk/2012/07/xbox-360-controller-support-added-to-the-usb-host-library/</a></li>
<li><a href="http://blog.tkjelectronics.dk/2012/12/xbox-360-receiver-added-to-the-usb-host-library/">http://blog.tkjelectronics.dk/2012/12/xbox-360-receiver-added-to-the-usb-host-library/</a></li>
</ul>
<p>All the information regarding the Xbox 360 controller protocol are form these sites:</p>
<ul>
<li><a href="http://tattiebogle.net/index.php/ProjectRoot/Xbox360Controller/UsbInfo">http://tattiebogle.net/index.php/ProjectRoot/Xbox360Controller/UsbInfo</a></li>
<li><a href="http://tattiebogle.net/index.php/ProjectRoot/Xbox360Controller/WirelessUsbInfo">http://tattiebogle.net/index.php/ProjectRoot/Xbox360Controller/WirelessUsbInfo</a></li>
<li><a href="https://github.com/Grumbel/xboxdrv/blob/master/PROTOCOL">https://github.com/Grumbel/xboxdrv/blob/master/PROTOCOL</a></li>
</ul>
<h3><a href="https://github.com/felis/USB_Host_Shield_2.0/blob/master/Wii.cpp">Wii library</a></h3>
<p>The <a href="https://github.com/felis/USB_Host_Shield_2.0/blob/master/Wii.cpp">Wii</a> library support the Wiimote, but also the Nunchuch and Motion Plus extensions via Bluetooth. The Wii U Pro Controller is also supported via Bluetooth.</p>
<p>First you have to pair with the controller, this is done automatically by the library if you create the instance like so:</p>
<p><code> <a class="el" href="class_w_i_i.html">WII</a> Wii(&amp;Btd,PAIR); </code></p>
<p>And then press 1 &amp; 2 at once on the Wiimote or press sync if you are using a Wii U Pro Controller.</p>
<p>After that you can simply create the instance like so:</p>
<p><code> <a class="el" href="class_w_i_i.html">WII</a> Wii(&amp;Btd); </code></p>
<p>Then just press any button any button on the Wiimote and it will connect to the dongle.</p>
<p>Take a look at the example for more information: <a href="https://github.com/felis/USB_Host_Shield_2.0/blob/master/examples/Bluetooth/Wii/Wii.ino">https://github.com/felis/USB_Host_Shield_2.0/blob/master/examples/Bluetooth/Wii/Wii.ino</a>.</p>
<p>Also take a look at the blog post:</p>
<ul>
<li><a href="http://blog.tkjelectronics.dk/2012/08/wiimote-added-to-usb-host-library/">http://blog.tkjelectronics.dk/2012/08/wiimote-added-to-usb-host-library/</a></li>
</ul>
<p>All the information about the Wii controllers are from these sites:</p>
<ul>
<li><a href="http://wiibrew.org/wiki/Wiimote">http://wiibrew.org/wiki/Wiimote</a></li>
<li><a href="http://wiibrew.org/wiki/Wiimote/Extension_Controllers">http://wiibrew.org/wiki/Wiimote/Extension_Controllers</a></li>
<li><a href="http://wiibrew.org/wiki/Wiimote/Extension_Controllers/Nunchuck">http://wiibrew.org/wiki/Wiimote/Extension_Controllers/Nunchuck</a></li>
<li><a href="http://wiibrew.org/wiki/Wiimote/Extension_Controllers/Wii_Motion_Plus">http://wiibrew.org/wiki/Wiimote/Extension_Controllers/Wii_Motion_Plus</a></li>
<li>The old library created by <em>Tomoyuki Tanaka</em>: <a href="https://github.com/moyuchin/WiiRemote_on_Arduino">https://github.com/moyuchin/WiiRemote_on_Arduino</a> also helped a lot.</li>
</ul>
<h1>FAQ</h1>
<blockquote class="doxtable">
<p>When I plug my device into the <a class="el" href="class_u_s_b.html">USB</a> connector nothing happens?</p>
<p></p>
</blockquote>
<p>Try to connect a external power supply to the Arduino - this solves the problem in most cases. </p>
</div></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.3.1
</small></address>
</body>
</html>