312 lines
18 KiB
HTML
312 lines
18 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: ledcube.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 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 List</span></a></li>
|
|
<li><a href="globals.html"><span>File 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">ledcube.c File Reference</div> </div>
|
|
</div>
|
|
<div class="contents">
|
|
<div class="textblock"><code>#include "<a class="el" href="ledcube_8h_source.html">ledcube.h</a>"</code><br/>
|
|
</div><div class="textblock"><div class="dynheader">
|
|
Include dependency graph for ledcube.c:</div>
|
|
<div class="dyncontent">
|
|
<div class="center"><img src="ledcube_8c__incl.png" border="0" usemap="#ledcube_8c" alt=""/></div>
|
|
<map name="ledcube_8c" id="ledcube_8c">
|
|
<area shape="rect" id="node3" href="ledcube_8h.html" title="ledcube.h" alt="" coords="221,83,299,112"/><area shape="rect" id="node9" href="opendevice_8h.html" title="opendevice.h" alt="" coords="71,160,169,189"/></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">int </td><td class="memItemRight" valign="bottom"><a class="el" href="ledcube_8c.html#ac423c9ff1fce94aaf618aea2342f0cfb">lc_setFrame</a> (unsigned long frame)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">The setFrame function. <a href="#ac423c9ff1fce94aaf618aea2342f0cfb"></a><br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="ledcube_8c.html#abdb7d4cfcd2cbe0825714ba64e74b36e">lc_setMode</a> (int mode)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">The setMode function. <a href="#abdb7d4cfcd2cbe0825714ba64e74b36e"></a><br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="ledcube_8c.html#a6d07d9a1ab6064fb8727ec03bbc71ade">lc_saveFrame</a> (unsigned long frame, int delay, int index)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">The saveFrame function. <a href="#a6d07d9a1ab6064fb8727ec03bbc71ade"></a><br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="ledcube_8c.html#a13e35739bd1ee4190f8a0bc350b663ba">lc_init</a> ()</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">The init function. <a href="#a13e35739bd1ee4190f8a0bc350b663ba"></a><br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="ledcube_8c.html#a95abb326c13549bd4d2d208d33dd7abc">lc_close</a> ()</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">The close function. <a href="#a95abb326c13549bd4d2d208d33dd7abc"></a><br/></td></tr>
|
|
</table>
|
|
<hr/><h2>Function Documentation</h2>
|
|
<a class="anchor" id="a95abb326c13549bd4d2d208d33dd7abc"></a><!-- doxytag: member="ledcube.c::lc_close" ref="a95abb326c13549bd4d2d208d33dd7abc" args="()" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">int lc_close </td>
|
|
<td>(</td>
|
|
<td class="paramtype">void </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="a13e35739bd1ee4190f8a0bc350b663ba"></a><!-- doxytag: member="ledcube.c::lc_init" ref="a13e35739bd1ee4190f8a0bc350b663ba" args="()" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">int lc_init </td>
|
|
<td>(</td>
|
|
<td class="paramtype">void </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>( &<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">"Could not find USB device \"%s\" with lc_vid=0x%x lc_pid=0x%x\n"</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>
|
|
<p><div class="dynheader">
|
|
Here is the call graph for this function:</div>
|
|
<div class="dyncontent">
|
|
<div class="center"><img src="ledcube_8c_a13e35739bd1ee4190f8a0bc350b663ba_cgraph.png" border="0" usemap="#ledcube_8c_a13e35739bd1ee4190f8a0bc350b663ba_cgraph" alt=""/></div>
|
|
<map name="ledcube_8c_a13e35739bd1ee4190f8a0bc350b663ba_cgraph" id="ledcube_8c_a13e35739bd1ee4190f8a0bc350b663ba_cgraph">
|
|
<area shape="rect" id="node3" href="opendevice_8c.html#acea645564f1dfcd741ff20038d811ac5" title="usbOpenDevice" alt="" coords="109,5,224,35"/><area shape="rect" id="node5" href="opendevice_8c.html#a75b5f0b18368de18125662f87524b5b0" title="usbGetStringAscii" alt="" coords="273,5,399,35"/></map>
|
|
</div>
|
|
</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a6d07d9a1ab6064fb8727ec03bbc71ade"></a><!-- doxytag: member="ledcube.c::lc_saveFrame" ref="a6d07d9a1ab6064fb8727ec03bbc71ade" args="(unsigned long frame, int delay, int index)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">int lc_saveFrame </td>
|
|
<td>(</td>
|
|
<td class="paramtype">unsigned long </td>
|
|
<td class="paramname"><em>frame</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">int </td>
|
|
<td class="paramname"><em>delay</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">int </td>
|
|
<td class="paramname"><em>index</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
|
|
<p>The saveFrame 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) multiplied by 8. </td></tr>
|
|
<tr><td class="paramname">deay</td><td>The lifetime (onyl 5 bits) of the given frame in ISR calls multiplied by 8. </td></tr>
|
|
<tr><td class="paramname">index</td><td>The position in the EEPROM (0 to 31) of the internal animation content. </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>;
|
|
|
|
frame = frame + (delay << 27);
|
|
|
|
<a class="code" href="clcc_8c.html#ab49cd720216d340f0a8d714c5a0edc0c" title="The setFrame function.">lc_setFrame</a>(frame);
|
|
|
|
<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_EEPROM_STORE_FRAME, 0, index, <a class="code" href="ledcube_8h.html#ac61239c8872d93071e0f9824234b6cd8">_lc_buffer</a>, 0, 300);
|
|
}
|
|
</pre></div>
|
|
<p><div class="dynheader">
|
|
Here is the call graph for this function:</div>
|
|
<div class="dyncontent">
|
|
<div class="center"><img src="ledcube_8c_a6d07d9a1ab6064fb8727ec03bbc71ade_cgraph.png" border="0" usemap="#ledcube_8c_a6d07d9a1ab6064fb8727ec03bbc71ade_cgraph" alt=""/></div>
|
|
<map name="ledcube_8c_a6d07d9a1ab6064fb8727ec03bbc71ade_cgraph" id="ledcube_8c_a6d07d9a1ab6064fb8727ec03bbc71ade_cgraph">
|
|
<area shape="rect" id="node3" href="clcc_8c.html#ab49cd720216d340f0a8d714c5a0edc0c" title="The setFrame function." alt="" coords="159,5,252,35"/></map>
|
|
</div>
|
|
</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ac423c9ff1fce94aaf618aea2342f0cfb"></a><!-- doxytag: member="ledcube.c::lc_setFrame" ref="ac423c9ff1fce94aaf618aea2342f0cfb" args="(unsigned long frame)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">int lc_setFrame </td>
|
|
<td>(</td>
|
|
<td class="paramtype">unsigned long </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 & 0xffff;
|
|
<span class="keywordtype">int</span> high = (frame & 0xffff0000) >> 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="abdb7d4cfcd2cbe0825714ba64e74b36e"></a><!-- doxytag: member="ledcube.c::lc_setMode" ref="abdb7d4cfcd2cbe0825714ba64e74b36e" args="(int mode)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">int lc_setMode </td>
|
|
<td>(</td>
|
|
<td class="paramtype">int </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>
|
|
</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"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </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 
|
|
<a href="http://www.doxygen.org/index.html">
|
|
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
|
|
</body>
|
|
</html>
|