493 lines
26 KiB
HTML
493 lines
26 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: demo.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">demo.c File Reference</div> </div>
|
|
</div>
|
|
<div class="contents">
|
|
<div class="textblock"><code>#include <stdio.h></code><br/>
|
|
<code>#include <stdlib.h></code><br/>
|
|
<code>#include <string.h></code><br/>
|
|
<code>#include <math.h></code><br/>
|
|
<code>#include <usb.h></code><br/>
|
|
<code>#include "../firmware/globals.h"</code><br/>
|
|
</div><div class="textblock"><div class="dynheader">
|
|
Include dependency graph for demo.c:</div>
|
|
<div class="dyncontent">
|
|
<div class="center"><img src="demo_8c__incl.png" border="0" usemap="#demo_8c" alt=""/></div>
|
|
<map name="demo_8c" id="demo_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 </td><td class="memItemRight" valign="bottom"><a class="el" href="demo_8c.html#ab49cd720216d340f0a8d714c5a0edc0c">lc_setFrame</a> (unsigned long)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">The setFrame function. <a href="#ab49cd720216d340f0a8d714c5a0edc0c"></a><br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="demo_8c.html#a3f08044a8d0798166650fe7b6db4a9ef">lc_setMode</a> (int)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">The setMode function. <a href="#a3f08044a8d0798166650fe7b6db4a9ef"></a><br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="demo_8c.html#a5e18f08e6f672e6bd82897c3b4da6a43">lc_saveFrame</a> (unsigned long, int)</td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="demo_8c.html#ad597eaee897fac3032ba8f152ceeaab3">lc_init</a> (void)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">The init function. <a href="#ad597eaee897fac3032ba8f152ceeaab3"></a><br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="demo_8c.html#aac3c592ebdd30e903e4a6b3f1bc1fa6a">lc_close</a> (void)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">The close function. <a href="#aac3c592ebdd30e903e4a6b3f1bc1fa6a"></a><br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="demo_8c.html#a638f8457f4676ae31f332f031af1628a">eeprom1</a> ()</td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="demo_8c.html#ad06b2f63f5dd622044fe96d96bfe0859">sinus1</a> (int max)</td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="demo_8c.html#ac474183ee901f1980a9963e75699b6a1">demo</a> ()</td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="demo_8c.html#a3c04138a5bfe5d72780bb7e82a18e627">main</a> (int argc, char **argv)</td></tr>
|
|
</table>
|
|
<hr/><h2>Function Documentation</h2>
|
|
<a class="anchor" id="ac474183ee901f1980a9963e75699b6a1"></a><!-- doxytag: member="demo.c::demo" ref="ac474183ee901f1980a9963e75699b6a1" args="()" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void demo </td>
|
|
<td>(</td>
|
|
<td class="paramname"></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
<div class="fragment"><pre class="fragment">{
|
|
<span class="comment">// stop animation</span>
|
|
<a class="code" href="clcc_8c.html#a3f08044a8d0798166650fe7b6db4a9ef" title="The setMode function.">lc_setMode</a>(MODE_ANIMATION_STOP);
|
|
|
|
<span class="comment">//clear cube</span>
|
|
<a class="code" href="clcc_8c.html#ab49cd720216d340f0a8d714c5a0edc0c" title="The setFrame function.">lc_setFrame</a>(0);
|
|
|
|
sleep(1);
|
|
|
|
<span class="comment">// transfer one frame</span>
|
|
<a class="code" href="clcc_8c.html#ab49cd720216d340f0a8d714c5a0edc0c" title="The setFrame function.">lc_setFrame</a>(0x06127348);
|
|
|
|
sleep(1);
|
|
|
|
<span class="comment">// another frame</span>
|
|
<a class="code" href="clcc_8c.html#ab49cd720216d340f0a8d714c5a0edc0c" title="The setFrame function.">lc_setFrame</a>(0x07007007);
|
|
|
|
sleep(1);
|
|
|
|
<span class="comment">// switch all led on</span>
|
|
<a class="code" href="clcc_8c.html#ab49cd720216d340f0a8d714c5a0edc0c" title="The setFrame function.">lc_setFrame</a>(0x07ffffff);
|
|
|
|
sleep(1);
|
|
|
|
<span class="comment">// save animation to eeprom and animate for 60 seconds</span>
|
|
<span class="comment">//eeprom1();</span>
|
|
|
|
<span class="comment">//sleep(10);</span>
|
|
|
|
<span class="comment">// animate with a sinus wave</span>
|
|
<a class="code" href="demo_8c.html#ad06b2f63f5dd622044fe96d96bfe0859">sinus1</a>(25);
|
|
|
|
<span class="comment">// start animation one time</span>
|
|
<a class="code" href="clcc_8c.html#a3f08044a8d0798166650fe7b6db4a9ef" title="The setMode function.">lc_setMode</a>(MODE_ANIMATION_SINGLE);
|
|
}
|
|
</pre></div>
|
|
<p><div class="dynheader">
|
|
Here is the call graph for this function:</div>
|
|
<div class="dyncontent">
|
|
<div class="center"><img src="demo_8c_ac474183ee901f1980a9963e75699b6a1_cgraph.png" border="0" usemap="#demo_8c_ac474183ee901f1980a9963e75699b6a1_cgraph" alt=""/></div>
|
|
<map name="demo_8c_ac474183ee901f1980a9963e75699b6a1_cgraph" id="demo_8c_ac474183ee901f1980a9963e75699b6a1_cgraph">
|
|
<area shape="rect" id="node3" href="clcc_8c.html#ab49cd720216d340f0a8d714c5a0edc0c" title="The setFrame function." alt="" coords="220,5,313,35"/><area shape="rect" id="node5" href="clcc_8c.html#a3f08044a8d0798166650fe7b6db4a9ef" title="The setMode function." alt="" coords="223,71,311,100"/><area shape="rect" id="node7" href="demo_8c.html#ad06b2f63f5dd622044fe96d96bfe0859" title="sinus1" alt="" coords="111,44,169,73"/></map>
|
|
</div>
|
|
</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a638f8457f4676ae31f332f031af1628a"></a><!-- doxytag: member="demo.c::eeprom1" ref="a638f8457f4676ae31f332f031af1628a" args="()" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void eeprom1 </td>
|
|
<td>(</td>
|
|
<td class="paramname"></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
<div class="fragment"><pre class="fragment">{
|
|
|
|
<span class="comment">// lc_set animation stop</span>
|
|
<a class="code" href="clcc_8c.html#a3f08044a8d0798166650fe7b6db4a9ef" title="The setMode function.">lc_setMode</a>(MODE_ANIMATION_STOP);
|
|
|
|
<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> buf = 0;
|
|
<span class="keywordtype">int</span> tmp = 0;
|
|
<span class="keywordtype">int</span> tmp2 = 26;
|
|
<span class="keywordflow">for</span> (tmp = 0; tmp < 32; tmp++)
|
|
{
|
|
<span class="keywordflow">if</span> (tmp < 27)
|
|
buf = (1 << tmp);
|
|
<span class="keywordflow">else</span>
|
|
{
|
|
tmp2--;
|
|
buf = (1 << tmp2);
|
|
}
|
|
|
|
<span class="comment">// save to position tmp</span>
|
|
<a class="code" href="clcc_8c.html#a5e18f08e6f672e6bd82897c3b4da6a43">lc_saveFrame</a>(buf, tmp);
|
|
|
|
}
|
|
<span class="comment">//</span>
|
|
<span class="comment">// lc_set mode to animate endless loop</span>
|
|
<a class="code" href="clcc_8c.html#a3f08044a8d0798166650fe7b6db4a9ef" title="The setMode function.">lc_setMode</a>(MODE_ANIMATION_LOOP);
|
|
|
|
}
|
|
</pre></div>
|
|
<p><div class="dynheader">
|
|
Here is the call graph for this function:</div>
|
|
<div class="dyncontent">
|
|
<div class="center"><img src="demo_8c_a638f8457f4676ae31f332f031af1628a_cgraph.png" border="0" usemap="#demo_8c_a638f8457f4676ae31f332f031af1628a_cgraph" alt=""/></div>
|
|
<map name="demo_8c_a638f8457f4676ae31f332f031af1628a_cgraph" id="demo_8c_a638f8457f4676ae31f332f031af1628a_cgraph">
|
|
<area shape="rect" id="node3" href="clcc_8c.html#a5e18f08e6f672e6bd82897c3b4da6a43" title="lc_saveFrame" alt="" coords="125,5,229,35"/><area shape="rect" id="node5" href="clcc_8c.html#a3f08044a8d0798166650fe7b6db4a9ef" title="The setMode function." alt="" coords="133,59,221,88"/></map>
|
|
</div>
|
|
</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="aac3c592ebdd30e903e4a6b3f1bc1fa6a"></a><!-- doxytag: member="demo.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="demo.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>( &<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>
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a5e18f08e6f672e6bd82897c3b4da6a43"></a><!-- doxytag: member="demo.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 </td>
|
|
<td class="paramname"><em>long</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">int </td>
|
|
<td class="paramname"> </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="demo.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 </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="a3f08044a8d0798166650fe7b6db4a9ef"></a><!-- doxytag: member="demo.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 </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="demo.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 </td>
|
|
<td class="paramname"><em>argc</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">char ** </td>
|
|
<td class="paramname"><em>argv</em> </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>();
|
|
|
|
<a class="code" href="demo_8c.html#ac474183ee901f1980a9963e75699b6a1">demo</a>();
|
|
|
|
<a class="code" href="clcc_8c.html#a3f08044a8d0798166650fe7b6db4a9ef" title="The setMode function.">lc_setMode</a>(MODE_ANIMATION_LOOP);
|
|
|
|
<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="demo_8c_a3c04138a5bfe5d72780bb7e82a18e627_cgraph.png" border="0" usemap="#demo_8c_a3c04138a5bfe5d72780bb7e82a18e627_cgraph" alt=""/></div>
|
|
<map name="demo_8c_a3c04138a5bfe5d72780bb7e82a18e627_cgraph" id="demo_8c_a3c04138a5bfe5d72780bb7e82a18e627_cgraph">
|
|
<area shape="rect" id="node3" href="demo_8c.html#ac474183ee901f1980a9963e75699b6a1" title="demo" alt="" coords="113,57,167,87"/><area shape="rect" id="node7" href="clcc_8c.html#a3f08044a8d0798166650fe7b6db4a9ef" title="The setMode function." alt="" coords="337,84,425,113"/><area shape="rect" id="node13" href="clcc_8c.html#aac3c592ebdd30e903e4a6b3f1bc1fa6a" title="The close function." alt="" coords="105,187,175,216"/><area shape="rect" id="node15" href="clcc_8c.html#ad597eaee897fac3032ba8f152ceeaab3" title="The init function." alt="" coords="112,240,168,269"/><area shape="rect" id="node5" href="clcc_8c.html#ab49cd720216d340f0a8d714c5a0edc0c" title="The setFrame function." alt="" coords="335,5,428,35"/><area shape="rect" id="node9" href="demo_8c.html#ad06b2f63f5dd622044fe96d96bfe0859" title="sinus1" alt="" coords="225,32,284,61"/></map>
|
|
</div>
|
|
</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ad06b2f63f5dd622044fe96d96bfe0859"></a><!-- doxytag: member="demo.c::sinus1" ref="ad06b2f63f5dd622044fe96d96bfe0859" args="(int max)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void sinus1 </td>
|
|
<td>(</td>
|
|
<td class="paramtype">int </td>
|
|
<td class="paramname"><em>max</em></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
<div class="fragment"><pre class="fragment">{
|
|
|
|
<span class="comment">// lc_set animation stop</span>
|
|
<a class="code" href="clcc_8c.html#a3f08044a8d0798166650fe7b6db4a9ef" title="The setMode function.">lc_setMode</a>(MODE_ANIMATION_STOP);
|
|
|
|
<span class="keywordtype">int</span> j = max;
|
|
<span class="keywordflow">while</span> (--j)
|
|
{
|
|
|
|
<span class="keywordtype">int</span> i = 0;
|
|
<span class="keywordtype">int</span> k = 0;
|
|
<span class="comment">//for (i = 0; i < 360; i+=11)</span>
|
|
<span class="keywordflow">for</span> (i = 0; i < 360; i++)
|
|
{
|
|
<span class="comment">// 2 = 27</span>
|
|
<span class="comment">// 1 = 27 / 2</span>
|
|
<span class="comment">// n = 27 * n / 2</span>
|
|
<span class="keywordtype">double</span> d = cos((<span class="keywordtype">double</span>)((6.28*i)/360)) + 1; <span class="comment">// 6.28 = PI * 2</span>
|
|
<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> tmp = (1 << (int)((27 * d) / 2));
|
|
|
|
<span class="comment">// show frame</span>
|
|
<a class="code" href="clcc_8c.html#ab49cd720216d340f0a8d714c5a0edc0c" title="The setFrame function.">lc_setFrame</a>(tmp);
|
|
<span class="comment">// or save the frame to eeprom</span>
|
|
<span class="comment">//tmp = tmp + (k << 27);</span>
|
|
<span class="comment">//if (k < 32)</span>
|
|
<span class="comment">//lc_saveFrame(tmp, k, k);</span>
|
|
|
|
usleep(2500);
|
|
k++;
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
</pre></div>
|
|
<p><div class="dynheader">
|
|
Here is the call graph for this function:</div>
|
|
<div class="dyncontent">
|
|
<div class="center"><img src="demo_8c_ad06b2f63f5dd622044fe96d96bfe0859_cgraph.png" border="0" usemap="#demo_8c_ad06b2f63f5dd622044fe96d96bfe0859_cgraph" alt=""/></div>
|
|
<map name="demo_8c_ad06b2f63f5dd622044fe96d96bfe0859_cgraph" id="demo_8c_ad06b2f63f5dd622044fe96d96bfe0859_cgraph">
|
|
<area shape="rect" id="node3" href="clcc_8c.html#ab49cd720216d340f0a8d714c5a0edc0c" title="The setFrame function." alt="" coords="116,5,209,35"/><area shape="rect" id="node5" href="clcc_8c.html#a3f08044a8d0798166650fe7b6db4a9ef" title="The setMode function." alt="" coords="119,59,207,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"> </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>
|