mini-led-cube/doc/doxygen/html/clcc_8c.html
2011-12-25 13:48:15 +01:00

317 lines
16 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"/>
<title>CTHN.de - LEDCube - commandline client: clcc.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body onload='searchBox.OnSelectItem(0);'>
<!-- Generated by Doxygen 1.7.4 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'Search');
--></script>
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">CTHN.de - LEDCube - commandline client</div>
</td>
</tr>
</tbody>
</table>
</div>
<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="files.html"><span>Files</span></a></li>
<li id="searchli">
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File&#160;List</span></a></li>
<li><a href="globals.html"><span>File&#160;Members</span></a></li>
</ul>
</div>
</div>
<div class="header">
<div class="summary">
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">clcc.c File Reference</div> </div>
</div>
<div class="contents">
<div class="textblock"><code>#include &lt;stdio.h&gt;</code><br/>
<code>#include &lt;stdlib.h&gt;</code><br/>
<code>#include &lt;string.h&gt;</code><br/>
<code>#include &lt;math.h&gt;</code><br/>
<code>#include &lt;usb.h&gt;</code><br/>
<code>#include &lt;argtable2.h&gt;</code><br/>
<code>#include &quot;../firmware/globals.h&quot;</code><br/>
</div><div class="textblock"><div class="dynheader">
Include dependency graph for clcc.c:</div>
<div class="dyncontent">
<div class="center"><img src="clcc_8c__incl.png" border="0" usemap="#clcc_8c" alt=""/></div>
<map name="clcc_8c" id="clcc_8c">
</map>
</div>
</div><table class="memberdecls">
<tr><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="clcc_8c.html#ab49cd720216d340f0a8d714c5a0edc0c">lc_setFrame</a> (unsigned long)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">The setFrame function. <a href="#ab49cd720216d340f0a8d714c5a0edc0c"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="clcc_8c.html#a3f08044a8d0798166650fe7b6db4a9ef">lc_setMode</a> (int)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">The setMode function. <a href="#a3f08044a8d0798166650fe7b6db4a9ef"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="clcc_8c.html#a5e18f08e6f672e6bd82897c3b4da6a43">lc_saveFrame</a> (unsigned long, int)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="clcc_8c.html#ad597eaee897fac3032ba8f152ceeaab3">lc_init</a> (void)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">The init function. <a href="#ad597eaee897fac3032ba8f152ceeaab3"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="clcc_8c.html#aac3c592ebdd30e903e4a6b3f1bc1fa6a">lc_close</a> (void)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">The close function. <a href="#aac3c592ebdd30e903e4a6b3f1bc1fa6a"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="clcc_8c.html#a3c04138a5bfe5d72780bb7e82a18e627">main</a> (int argc, char **argv)</td></tr>
</table>
<hr/><h2>Function Documentation</h2>
<a class="anchor" id="aac3c592ebdd30e903e4a6b3f1bc1fa6a"></a><!-- doxytag: member="clcc.c::lc_close" ref="aac3c592ebdd30e903e4a6b3f1bc1fa6a" args="(void)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void lc_close </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>The close function. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>NOT_CONNECTED_ERROR or return state of the usb_close function. </dd></dl>
<div class="fragment"><pre class="fragment">{
<span class="keywordflow">if</span> (<a class="code" href="ledcube_8h.html#a6425bf1a1c385443f415abfd8287f1a3">_lc_handle</a> == NULL)
<span class="keywordflow">return</span> <a class="code" href="ledcube_8h.html#ac70f88eda20bac5cf379d1512ad5f2ab">NOT_CONNECTED_ERROR</a>;
<span class="keywordflow">return</span> usb_close(<a class="code" href="ledcube_8h.html#a6425bf1a1c385443f415abfd8287f1a3">_lc_handle</a>);
}
</pre></div>
</div>
</div>
<a class="anchor" id="ad597eaee897fac3032ba8f152ceeaab3"></a><!-- doxytag: member="clcc.c::lc_init" ref="ad597eaee897fac3032ba8f152ceeaab3" args="(void)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void lc_init </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>The init function. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>SUCCESSFULLY_CONNECTED or DEVICE_NOT_FOUND_ERROR. </dd></dl>
<div class="fragment"><pre class="fragment">{
usb_init();
<span class="comment">/* compute lc_vid/lc_pid from usbconfig.h so that there is a central source of information */</span>
<a class="code" href="ledcube_8h.html#aa24273d8d3e8fd3f3af40fe62bf82439">_lc_vid</a> = <a class="code" href="ledcube_8h.html#a27287e09e72aa83387797c8f7934c404">_lc_rawVid</a>[1] * 256 + <a class="code" href="ledcube_8h.html#a27287e09e72aa83387797c8f7934c404">_lc_rawVid</a>[0];
<a class="code" href="ledcube_8h.html#a90c96f24a9760ef3a0e7e4d718fefe3f">_lc_pid</a> = <a class="code" href="ledcube_8h.html#af3706eb25df4a97fb3afb5c76b725ac2">_lc_rawPid</a>[1] * 256 + <a class="code" href="ledcube_8h.html#af3706eb25df4a97fb3afb5c76b725ac2">_lc_rawPid</a>[0];
<span class="comment">/* The following function is in opendevice.c: */</span>
<span class="keywordflow">if</span>( <a class="code" href="opendevice_8c.html#acea645564f1dfcd741ff20038d811ac5">usbOpenDevice</a>( &amp;<a class="code" href="ledcube_8h.html#a6425bf1a1c385443f415abfd8287f1a3">_lc_handle</a>, <a class="code" href="ledcube_8h.html#aa24273d8d3e8fd3f3af40fe62bf82439">_lc_vid</a>, <a class="code" href="ledcube_8h.html#ac302050d44ed50afec5d806d0834ff32">_lc_vendor</a>, <a class="code" href="ledcube_8h.html#a90c96f24a9760ef3a0e7e4d718fefe3f">_lc_pid</a>, <a class="code" href="ledcube_8h.html#aa46691773a9b13cbaee644ec4d4a28aa">_lc_product</a>, NULL, NULL, NULL) != 0)
{
fprintf(stderr, <span class="stringliteral">&quot;Could not find USB device \&quot;%s\&quot; with lc_vid=0x%x lc_pid=0x%x\n&quot;</span>, <a class="code" href="ledcube_8h.html#aa46691773a9b13cbaee644ec4d4a28aa">_lc_product</a>, <a class="code" href="ledcube_8h.html#aa24273d8d3e8fd3f3af40fe62bf82439">_lc_vid</a>, <a class="code" href="ledcube_8h.html#a90c96f24a9760ef3a0e7e4d718fefe3f">_lc_pid</a>);
<span class="keywordflow">return</span> <a class="code" href="ledcube_8h.html#a9346e6751e831ccf0560c7a1152a2fab">DEVICE_NOT_FOUND_ERROR</a>;
}
<span class="keywordflow">return</span> <a class="code" href="ledcube_8h.html#a685f5d598cb43342b6357ced7e77c380">SUCCESSFULLY_CONNECTED</a>;
}
</pre></div>
</div>
</div>
<a class="anchor" id="a5e18f08e6f672e6bd82897c3b4da6a43"></a><!-- doxytag: member="clcc.c::lc_saveFrame" ref="a5e18f08e6f672e6bd82897c3b4da6a43" args="(unsigned long, int)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void lc_saveFrame </td>
<td>(</td>
<td class="paramtype">unsigned&#160;</td>
<td class="paramname"><em>long</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&#160;</td>
<td class="paramname">&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
</div>
</div>
<a class="anchor" id="ab49cd720216d340f0a8d714c5a0edc0c"></a><!-- doxytag: member="clcc.c::lc_setFrame" ref="ab49cd720216d340f0a8d714c5a0edc0c" args="(unsigned long)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void lc_setFrame </td>
<td>(</td>
<td class="paramtype">unsigned long&#160;</td>
<td class="paramname"><em>frame</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>The setFrame function. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">frame</td><td>The 32bit frame data. Bit 0-8 equals layer one; bit 9 - 17 euqals layer two; bit 18 - 26 equals layer three. the 5 MSB is the lifetime of the current frame in ISR calls (300Hz). </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>NOT_CONNECTED_ERROR or the return value of the usb_control_msg function. </dd></dl>
<div class="fragment"><pre class="fragment">{
<span class="keywordflow">if</span> (<a class="code" href="ledcube_8h.html#a6425bf1a1c385443f415abfd8287f1a3">_lc_handle</a> == NULL)
<span class="keywordflow">return</span> <a class="code" href="ledcube_8h.html#ac70f88eda20bac5cf379d1512ad5f2ab">NOT_CONNECTED_ERROR</a>;
<span class="keywordtype">int</span> low = frame &amp; 0xffff;
<span class="keywordtype">int</span> high = (frame &amp; 0xffff0000) &gt;&gt; 16;
<span class="keywordtype">int</span> ret = usb_control_msg(<a class="code" href="ledcube_8h.html#a6425bf1a1c385443f415abfd8287f1a3">_lc_handle</a>, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_OUT, CUSTOM_RQ_SET_FRAME, low, 0, <a class="code" href="ledcube_8h.html#ac61239c8872d93071e0f9824234b6cd8">_lc_buffer</a>, 0, 300);
ret += usb_control_msg(<a class="code" href="ledcube_8h.html#a6425bf1a1c385443f415abfd8287f1a3">_lc_handle</a>, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_OUT, CUSTOM_RQ_SET_FRAME, high, 1, <a class="code" href="ledcube_8h.html#ac61239c8872d93071e0f9824234b6cd8">_lc_buffer</a>, 0, 300);
<span class="keywordflow">return</span> ret;
}
</pre></div>
</div>
</div>
<a class="anchor" id="a3f08044a8d0798166650fe7b6db4a9ef"></a><!-- doxytag: member="clcc.c::lc_setMode" ref="a3f08044a8d0798166650fe7b6db4a9ef" args="(int)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void lc_setMode </td>
<td>(</td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>mode</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>The setMode function. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">mode</td><td>The firmware mode. MODE_ANIMATION_STOP; MODE_ANIMATION_SINGLE; MODE_ANIMATION_LOOP </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>NOT_CONNECTED_ERROR or the return value of the usb_control_msg function. </dd></dl>
<div class="fragment"><pre class="fragment">{
<span class="keywordflow">if</span> (<a class="code" href="ledcube_8h.html#a6425bf1a1c385443f415abfd8287f1a3">_lc_handle</a> == NULL)
<span class="keywordflow">return</span> <a class="code" href="ledcube_8h.html#ac70f88eda20bac5cf379d1512ad5f2ab">NOT_CONNECTED_ERROR</a>;
<span class="keywordflow">return</span> usb_control_msg(<a class="code" href="ledcube_8h.html#a6425bf1a1c385443f415abfd8287f1a3">_lc_handle</a>, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_OUT, CUSTOM_RQ_SET_MODE, mode, 0, <a class="code" href="ledcube_8h.html#ac61239c8872d93071e0f9824234b6cd8">_lc_buffer</a>, 0, 300);
}
</pre></div>
</div>
</div>
<a class="anchor" id="a3c04138a5bfe5d72780bb7e82a18e627"></a><!-- doxytag: member="clcc.c::main" ref="a3c04138a5bfe5d72780bb7e82a18e627" args="(int argc, char **argv)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int main </td>
<td>(</td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>argc</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">char **&#160;</td>
<td class="paramname"><em>argv</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<div class="fragment"><pre class="fragment">{
<a class="code" href="clcc_8c.html#ad597eaee897fac3032ba8f152ceeaab3" title="The init function.">lc_init</a>();
<span class="comment">// TODO parse commandline parameters</span>
<a class="code" href="clcc_8c.html#aac3c592ebdd30e903e4a6b3f1bc1fa6a" title="The close function.">lc_close</a>();
<span class="keywordflow">return</span> 0;
}
</pre></div>
<p><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><img src="clcc_8c_a3c04138a5bfe5d72780bb7e82a18e627_cgraph.png" border="0" usemap="#clcc_8c_a3c04138a5bfe5d72780bb7e82a18e627_cgraph" alt=""/></div>
<map name="clcc_8c_a3c04138a5bfe5d72780bb7e82a18e627_cgraph" id="clcc_8c_a3c04138a5bfe5d72780bb7e82a18e627_cgraph">
<area shape="rect" id="node3" href="clcc_8c.html#aac3c592ebdd30e903e4a6b3f1bc1fa6a" title="The close function." alt="" coords="105,5,175,35"/><area shape="rect" id="node5" href="clcc_8c.html#ad597eaee897fac3032ba8f152ceeaab3" title="The init function." alt="" coords="112,59,168,88"/></map>
</div>
</p>
</div>
</div>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Defines</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>
<hr class="footer"/><address class="footer"><small>Generated on Sun Dec 25 2011 13:37:31 for CTHN.de - LEDCube - commandline client by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
</body>
</html>