esp32-s2_dfu/0.4/md_demos_device_readme.html

187 lines
11 KiB
HTML

<!-- HTML header for doxygen 1.8.6-->
<!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.6"/>
<title>tinyusb: Device Demos</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
$(window).load(resizeHeight);
</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" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table width="100%" cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">tinyusb
&#160;<span id="projectnumber">0.4</span>
</div>
</td>
<td align="right">
<a href="https://pledgie.com/campaigns/24694"><img border="0" src="https://pledgie.com/campaigns/24694.png?skin_name=chrome" alt="Click here to lend your support to tinyusb donation and make a donation at pledgie.com"></a>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.6 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li class="current"><a href="pages.html"><span>Related&#160;Pages</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="annotated.html"><span>Data&#160;Structures</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 -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('md_demos_device_readme.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
<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>Data Structures</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>Groups</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">Device Demos </div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p><b>Table of Contents</b></p>
<ul>
<li><a href="#prerequisites">Prerequisites</a></li>
<li><a href="#human-interface-device-hid">Human Interface Device (HID)</a><ul>
<li><a href="#keyboard">Keyboard</a></li>
<li><a href="#mouse">Mouse</a></li>
</ul>
</li>
<li><a href="#mass-storage-class-device-msc">Mass Storage Class Device (MSC)</a></li>
<li><a href="#communication-class-device-cdc">Communication Class Device (CDC)</a><ul>
<li><a href="#serial">Serial</a></li>
</ul>
</li>
</ul>
<p>device application code is store at <em>demos/device/src</em> containing</p>
<table class="doxtable">
<tr>
<th>File </th><th>Description </th></tr>
<tr>
<td>main.c </td><td>Initialization (board, stack) and a RTOS task scheduler call or just simple a indefinite loop for non OS to invoke class-specific tasks. </td></tr>
<tr>
<td>tusb_config.h </td><td>tinyusb stack configuration. </td></tr>
<tr>
<td>tusb_descriptors(c,h) </td><td>contains all the required usb descriptors for all combination of supported classes. And definition of stack-required variable <em>tusbd_descriptor_pointers</em>. </td></tr>
<tr>
<td>app_os_prio.h </td><td>RTOS task priority definitions </td></tr>
<tr>
<td>Class-specific </td><td>Application files for supported classes. </td></tr>
</table>
<p>The demo will start with the greeting of enabled classes and chosen RTOS then start to blink an LED at 1 Hz.</p>
<h2>Prerequisites</h2>
<p>In order to run application demo, you would need</p>
<ul>
<li>A ../../boards/readme.md "supported development board" with at least a button for mouse, keyboard demo.</li>
<li>A supported toolchain: LPCXpresso, Keil, IAR.</li>
<li>A decent terminal such as <a href="http://en.sourceforge.jp/projects/ttssh2/">Tera Term</a> for CDC Serial.</li>
</ul>
<h2>Human Interface Device (HID)</h2>
<h3>Keyboard</h3>
<p>After the board get enumerated successfully, you can try to press some buttons while opening notepad. It should get some characters out accordingly. In addition, when you press Capslock or Numlock key on your own pc's keyboard, the LED will blink faster twice. This demonstrates that keyboard application can receive Set Report via control pipe.</p>
<p>Notes: The very same buttons may also used by Mouse application. You can get the mouse moving and character, should you enable both.</p>
<h3>Mouse</h3>
<p>After the board get enumerated successfully, you can try to press some buttons. The mouse's cursor should move accordingly.</p>
<p>Notes: The very same buttons may also used by Keyboard application. You can get the mouse moving and character, should you enable both.</p>
<h2>Mass Storage Class Device (MSC)</h2>
<p>This class is very simple, as soon as the demo work, you could open the demo drive. Inside, you should find a <em>README.TXT</em> file which contains a few lines of descriptions. The demo drive's format is FAT12 and only has 8KB, which is the smallest possible to work with most host OS (Windows/Linux).</p>
<p>Notes: The entire disk contents ( 8KB ) is located on MCU's SRAM if possible (such as lpc43xx, lpc175x_6x). For MCU (lpc11u, lpc13u) that cannot afford that, the contents is instead on internal Flash which make the demo drive is read-only.</p>
<h2>Communication Class Device (CDC)</h2>
<p>CDC has several subclass, currently tinyusb only supports the popular <em>Abstract Control Model (ACM)</em></p>
<h3>Serial</h3>
<p>The virtual COM is also as easy as MSC. Except that we need to "install" driver for the first plug if your host OS is Windows, Linux should be able to work right away.</p>
<p><b>Install Driver for Windows</b></p>
<p>Actually Windows already has the needed driver to operate with virtual serial of CDC-ACM, the <em>usbser</em>. However, since it also use Abstract Control Model for other purposes, it requires us to tell exactly which VendorID/ProductID comibination should be used as a virtual serial. The demo's src folder includes <em>WinCDCdriver.inf</em> to do just that.</p>
<p>Firstly open <em>Device Manager</em>, we should find our board under "Other devices", right click on it and choose "Update Driver Software..."</p>
<div class="image">
<img src="http://docs.tinyusb.org/images/demo_serial_driver.png" alt="Serial Install Driver"/>
</div>
<p>Then choose "Browse my computer for driver software" then navigate to the device demo's <em>src</em> and click next. Since I am nowhere near a known publisher to Microsoft, it will warn you with a scary dialog. With all your trust in me, click next and hope that nothing harmful will ever happen and we are done with the driver.</p>
<div class="image">
<img src="http://docs.tinyusb.org/images/demo_serial_driver2.png" alt="Serial Install Driver"/>
</div>
<p><b>Testing Demo</b></p>
<p>Connect to the "tinyusb Serial Port" with your terminal application, and start to type. You should get echo back as the CDC serial application demo is written to transmit what it received.</p>
<div class="image">
<img src="http://docs.tinyusb.org/images/demo_cdc_connect.png" alt="Serial Connect"/>
</div>
</div></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="md_doxygen_getting_started.html">Getting Started</a></li><li class="navelem"><a class="el" href="md_doxygen_started_demo.html">Demos</a></li>
<li class="footer">Generated on Thu Apr 17 2014 13:05:28 for tinyusb by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.6 </li>
</ul>
</div>
</body>
</html>