1
0
mirror of https://github.com/taigrr/arduinolibs synced 2025-01-18 04:33:12 -08:00

Update docs

This commit is contained in:
Rhys Weatherley
2015-03-12 19:03:15 +10:00
parent 083448f195
commit c6206e4216
493 changed files with 35310 additions and 3018 deletions

View File

@@ -3,6 +3,7 @@
<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>ArduinoLibs: Running figure example</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
@@ -29,7 +30,7 @@
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.1.2 -->
<!-- Generated by Doxygen 1.8.6 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
@@ -82,7 +83,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<p>The first step is to initialize the display:</p>
<div class="fragment"><div class="line"><span class="preprocessor">#include &lt;DMD.h&gt;</span></div>
<div class="line"></div>
<div class="line"><a class="code" href="classDMD.html" title="Handle large dot matrix displays composed of LED&#39;s.">DMD</a> display;</div>
<div class="line"><a class="code" href="classDMD.html">DMD</a> display;</div>
</div><!-- fragment --></p>
<p>We will also need some bitmaps to animate the running figure. We will use static bitmaps stored in program memory. The first frame of the 10-frame animation is:</p>
<div class="fragment"><div class="line">byte <span class="keyword">const</span> run1[] PROGMEM = {</div>
@@ -107,7 +108,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
</div><!-- fragment --></p>
<p>As can be seen, the bitmap is made up of 0's and 1's; a 1 bit indicates that the corresponding LED will be lit when it is drawn to the dot matrix display. The first two bytes are the width and height of the bitmap in pixels. In this case, the first frame is 16x16 pixels. Other frames in the animation are 18x16 and 13x16.</p>
<p>We store pointers to all of the frames in a common array:</p>
<div class="fragment"><div class="line"><a class="code" href="classBitmap.html#a2fcc98fd7580932b218134126a29ce43" title="Type that represents a bitmap within program memory.">Bitmap::ProgMem</a> frames[] = {</div>
<div class="fragment"><div class="line"><a class="code" href="classBitmap.html#a2fcc98fd7580932b218134126a29ce43">Bitmap::ProgMem</a> frames[] = {</div>
<div class="line"> run1,</div>
<div class="line"> run2,</div>
<div class="line"> run3,</div>
@@ -132,32 +133,32 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<div class="line"></div>
<div class="line"><span class="keywordtype">void</span> loop() {</div>
<div class="line"> <span class="keywordflow">if</span> ((millis() - lastFrame) &gt;= ADVANCE_MS) {</div>
<div class="line"> display.<a class="code" href="classBitmap.html#a839dc8fab05a5ebf7a6b2e61436b2fa1" title="Clears the entire bitmap to the specified color.">clear</a>();</div>
<div class="line"> display.<a class="code" href="classBitmap.html#a839dc8fab05a5ebf7a6b2e61436b2fa1">clear</a>();</div>
<div class="line"> <span class="keywordtype">int</span> x = (32 - pgm_read_byte(frames[frame])) / 2;</div>
<div class="line"> display.<a class="code" href="classBitmap.html#a491e9c0bb20ddf5a5eb4933077c8ed72" title="Draws bitmap at (x, y) in color.">drawBitmap</a>(x, 0, frames[frame]);</div>
<div class="line"> display.<a class="code" href="classBitmap.html#a491e9c0bb20ddf5a5eb4933077c8ed72">drawBitmap</a>(x, 0, frames[frame]);</div>
<div class="line"> lastFrame += ADVANCE_MS;</div>
<div class="line"> frame = (frame + 1) % NUM_FRAMES;</div>
<div class="line"> }</div>
<div class="line"> display.<a class="code" href="classDMD.html#a2c74a0845ef6080056b972d490648114" title="Performs regular display refresh activities from the application&#39;s main loop.">loop</a>();</div>
<div class="line"> display.<a class="code" href="classDMD.html#a2c74a0845ef6080056b972d490648114">loop</a>();</div>
<div class="line">}</div>
</div><!-- fragment --></p>
<p>Each time <code>ADVANCE_MS</code> milliseconds expires, we clear the display and draw a bitmap centered on the screen. To help with the centering, we read the width value from the bitmap for the current frame (the height is always 16). We must also call <a class="el" href="classDMD.html#a2c74a0845ef6080056b972d490648114" title="Performs regular display refresh activities from the application&#39;s main loop.">DMD::loop()</a> repeatedly from the application's main <code>loop()</code> function to ensure that the display is kept refreshed.</p>
<p>Sometimes it can be inconvenient to arrange for <a class="el" href="classDMD.html#a2c74a0845ef6080056b972d490648114" title="Performs regular display refresh activities from the application&#39;s main loop.">DMD::loop()</a> to be called regularly. An alternative is to use Timer1 or Timer2 and <a class="el" href="classDMD.html#dmd_interrupts">interrupt-driven display refresh</a>:</p>
<p>Each time <code>ADVANCE_MS</code> milliseconds expires, we clear the display and draw a bitmap centered on the screen. To help with the centering, we read the width value from the bitmap for the current frame (the height is always 16). We must also call <a class="el" href="classDMD.html#a2c74a0845ef6080056b972d490648114" title="Performs regular display refresh activities from the application&#39;s main loop. ">DMD::loop()</a> repeatedly from the application's main <code>loop()</code> function to ensure that the display is kept refreshed.</p>
<p>Sometimes it can be inconvenient to arrange for <a class="el" href="classDMD.html#a2c74a0845ef6080056b972d490648114" title="Performs regular display refresh activities from the application&#39;s main loop. ">DMD::loop()</a> to be called regularly. An alternative is to use Timer1 or Timer2 and <a class="el" href="classDMD.html#dmd_interrupts">interrupt-driven display refresh</a>:</p>
<div class="fragment"><div class="line"><span class="preprocessor">#define ADVANCE_MS (1000 / NUM_FRAMES)</span></div>
<div class="line"><span class="preprocessor"></span></div>
<div class="line">ISR(TIMER1_OVF_vect)</div>
<div class="line">{</div>
<div class="line"> display.<a class="code" href="classDMD.html#a9e4bf2a9d247312d35c1401ff61261c8" title="Refresh the display.">refresh</a>();</div>
<div class="line"> display.<a class="code" href="classDMD.html#a9e4bf2a9d247312d35c1401ff61261c8">refresh</a>();</div>
<div class="line">}</div>
<div class="line"></div>
<div class="line"><span class="keywordtype">void</span> setup() {</div>
<div class="line"> display.<a class="code" href="classDMD.html#a4c3b04b384f3d656a9b59690836775e2" title="Enables Timer1 overflow interrupts for updating this display.">enableTimer1</a>();</div>
<div class="line"> display.<a class="code" href="classDMD.html#a4c3b04b384f3d656a9b59690836775e2">enableTimer1</a>();</div>
<div class="line">}</div>
<div class="line"></div>
<div class="line"><span class="keywordtype">void</span> loop() {</div>
<div class="line"> display.<a class="code" href="classBitmap.html#a839dc8fab05a5ebf7a6b2e61436b2fa1" title="Clears the entire bitmap to the specified color.">clear</a>();</div>
<div class="line"> display.<a class="code" href="classBitmap.html#a839dc8fab05a5ebf7a6b2e61436b2fa1">clear</a>();</div>
<div class="line"> <span class="keywordtype">int</span> x = (32 - pgm_read_byte(frames[frame])) / 2;</div>
<div class="line"> display.<a class="code" href="classBitmap.html#a491e9c0bb20ddf5a5eb4933077c8ed72" title="Draws bitmap at (x, y) in color.">drawBitmap</a>(x, 0, frames[frame]);</div>
<div class="line"> display.<a class="code" href="classBitmap.html#a491e9c0bb20ddf5a5eb4933077c8ed72">drawBitmap</a>(x, 0, frames[frame]);</div>
<div class="line"> frame = (frame + 1) % NUM_FRAMES;</div>
<div class="line"></div>
<div class="line"> delay(ADVANCE_MS);</div>
@@ -189,7 +190,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<div class="line"></div>
<div class="line"><span class="preprocessor">#include &lt;DMD.h&gt;</span></div>
<div class="line"></div>
<div class="line"><a class="code" href="classDMD.html" title="Handle large dot matrix displays composed of LED&#39;s.">DMD</a> display;</div>
<div class="line"><a class="code" href="classDMD.html">DMD</a> display;</div>
<div class="line"></div>
<div class="line"><span class="comment">// Running stick figure pictures are loosely based on those from this tutorial:</span></div>
<div class="line"><span class="comment">// http://www.fluidanims.com/FAelite/phpBB3/viewtopic.php?f=10&amp;t=102</span></div>
@@ -394,7 +395,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<div class="line"> B01000000, B00000000</div>
<div class="line">};</div>
<div class="line"></div>
<div class="line"><a class="code" href="classBitmap.html#a2fcc98fd7580932b218134126a29ce43" title="Type that represents a bitmap within program memory.">Bitmap::ProgMem</a> frames[] = {</div>
<div class="line"><a class="code" href="classBitmap.html#a2fcc98fd7580932b218134126a29ce43">Bitmap::ProgMem</a> frames[] = {</div>
<div class="line"> run1,</div>
<div class="line"> run2,</div>
<div class="line"> run3,</div>
@@ -418,20 +419,20 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<div class="line"></div>
<div class="line"><span class="keywordtype">void</span> loop() {</div>
<div class="line"> <span class="keywordflow">if</span> ((millis() - lastFrame) &gt;= ADVANCE_MS) {</div>
<div class="line"> display.<a class="code" href="classBitmap.html#a839dc8fab05a5ebf7a6b2e61436b2fa1" title="Clears the entire bitmap to the specified color.">clear</a>();</div>
<div class="line"> display.<a class="code" href="classBitmap.html#a839dc8fab05a5ebf7a6b2e61436b2fa1">clear</a>();</div>
<div class="line"> <span class="keywordtype">int</span> x = (32 - pgm_read_byte(frames[frame])) / 2;</div>
<div class="line"> display.<a class="code" href="classBitmap.html#a491e9c0bb20ddf5a5eb4933077c8ed72" title="Draws bitmap at (x, y) in color.">drawBitmap</a>(x, 0, frames[frame]);</div>
<div class="line"> display.<a class="code" href="classBitmap.html#a491e9c0bb20ddf5a5eb4933077c8ed72">drawBitmap</a>(x, 0, frames[frame]);</div>
<div class="line"> lastFrame += ADVANCE_MS;</div>
<div class="line"> frame = (frame + 1) % NUM_FRAMES;</div>
<div class="line"> }</div>
<div class="line"> display.<a class="code" href="classDMD.html#a2c74a0845ef6080056b972d490648114" title="Performs regular display refresh activities from the application&#39;s main loop.">loop</a>();</div>
<div class="line"> display.<a class="code" href="classDMD.html#a2c74a0845ef6080056b972d490648114">loop</a>();</div>
<div class="line">}</div>
</div><!-- fragment --> </div></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Sun Sep 29 2013 09:30:46 for ArduinoLibs by &#160;<a href="http://www.doxygen.org/index.html">
Generated on Thu Mar 12 2015 19:02:05 for ArduinoLibs by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.1.2
</a> 1.8.6
</small></address>
</body>
</html>