mirror of
https://github.com/taigrr/arduinolibs
synced 2025-01-18 04:33:12 -08:00
547 lines
37 KiB
HTML
547 lines
37 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"/>
|
|
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
|
<meta name="generator" content="Doxygen 1.8.6"/>
|
|
<title>ArduinoLibs: Charlieplex Class Reference</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="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 cellspacing="0" cellpadding="0">
|
|
<tbody>
|
|
<tr style="height: 56px;">
|
|
<td style="padding-left: 0.5em;">
|
|
<div id="projectname">ArduinoLibs
|
|
</div>
|
|
</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 Page</span></a></li>
|
|
<li><a href="pages.html"><span>Related Pages</span></a></li>
|
|
<li><a href="modules.html"><span>Modules</span></a></li>
|
|
<li class="current"><a href="annotated.html"><span>Classes</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 id="navrow2" class="tabs2">
|
|
<ul class="tablist">
|
|
<li><a href="annotated.html"><span>Class List</span></a></li>
|
|
<li><a href="classes.html"><span>Class Index</span></a></li>
|
|
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
|
|
<li><a href="functions.html"><span>Class Members</span></a></li>
|
|
</ul>
|
|
</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>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark"> </span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark"> </span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark"> </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><!-- top -->
|
|
<div class="header">
|
|
<div class="summary">
|
|
<a href="#pub-methods">Public Member Functions</a> |
|
|
<a href="classCharlieplex-members.html">List of all members</a> </div>
|
|
<div class="headertitle">
|
|
<div class="title">Charlieplex Class Reference</div> </div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
|
|
<p>Manage an array of LED's in a charlieplexed arrangement.
|
|
<a href="classCharlieplex.html#details">More...</a></p>
|
|
|
|
<p><code>#include <<a class="el" href="Charlieplex_8h_source.html">Charlieplex.h</a>></code></p>
|
|
<table class="memberdecls">
|
|
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
|
|
Public Member Functions</h2></td></tr>
|
|
<tr class="memitem:abfb0d0456bcbadbf60c21f615adacdbd"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classCharlieplex.html#abfb0d0456bcbadbf60c21f615adacdbd">Charlieplex</a> (const uint8_t *pins, uint8_t numPins)</td></tr>
|
|
<tr class="memdesc:abfb0d0456bcbadbf60c21f615adacdbd"><td class="mdescLeft"> </td><td class="mdescRight">Constructs a new charliexplexing array where the output pins are specified by the <em>numPins</em> entries in <em>pins</em>. <a href="#abfb0d0456bcbadbf60c21f615adacdbd">More...</a><br/></td></tr>
|
|
<tr class="separator:abfb0d0456bcbadbf60c21f615adacdbd"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a4dbe37ccba8ba18139f4e710afdcd103"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a4dbe37ccba8ba18139f4e710afdcd103"></a>
|
|
 </td><td class="memItemRight" valign="bottom"><a class="el" href="classCharlieplex.html#a4dbe37ccba8ba18139f4e710afdcd103">~Charlieplex</a> ()</td></tr>
|
|
<tr class="memdesc:a4dbe37ccba8ba18139f4e710afdcd103"><td class="mdescLeft"> </td><td class="mdescRight">Destroys this charlieplexed array. <br/></td></tr>
|
|
<tr class="separator:a4dbe37ccba8ba18139f4e710afdcd103"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a5008aa4143d381ce34a3aed1a3843e4e"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="classCharlieplex.html#a5008aa4143d381ce34a3aed1a3843e4e">count</a> () const </td></tr>
|
|
<tr class="memdesc:a5008aa4143d381ce34a3aed1a3843e4e"><td class="mdescLeft"> </td><td class="mdescRight">Returns the number of LED's in this charlieplexed array based on the number of pins. <a href="#a5008aa4143d381ce34a3aed1a3843e4e">More...</a><br/></td></tr>
|
|
<tr class="separator:a5008aa4143d381ce34a3aed1a3843e4e"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a90fd09f24b62424b0b7b8bcdb0140b9d"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classCharlieplex.html#a90fd09f24b62424b0b7b8bcdb0140b9d">led</a> (int index) const </td></tr>
|
|
<tr class="memdesc:a90fd09f24b62424b0b7b8bcdb0140b9d"><td class="mdescLeft"> </td><td class="mdescRight">Returns the value of the LED at <em>index</em> in the charplexed array; true if lit; false if not lit. <a href="#a90fd09f24b62424b0b7b8bcdb0140b9d">More...</a><br/></td></tr>
|
|
<tr class="separator:a90fd09f24b62424b0b7b8bcdb0140b9d"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ab103c9687a0890faf72e4da79e3de0a5"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classCharlieplex.html#ab103c9687a0890faf72e4da79e3de0a5">setLed</a> (int index, bool value)</td></tr>
|
|
<tr class="memdesc:ab103c9687a0890faf72e4da79e3de0a5"><td class="mdescLeft"> </td><td class="mdescRight">Sets the <em>value</em> of the LED at <em>index</em> in the charliplexed array. <a href="#ab103c9687a0890faf72e4da79e3de0a5">More...</a><br/></td></tr>
|
|
<tr class="separator:ab103c9687a0890faf72e4da79e3de0a5"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a89312f2fd1d27c4e56346ed9cccfb9f6"><td class="memItemLeft" align="right" valign="top">uint8_t </td><td class="memItemRight" valign="bottom"><a class="el" href="classCharlieplex.html#a89312f2fd1d27c4e56346ed9cccfb9f6">pwmLed</a> (int index) const </td></tr>
|
|
<tr class="memdesc:a89312f2fd1d27c4e56346ed9cccfb9f6"><td class="mdescLeft"> </td><td class="mdescRight">Returns the PWM value of the LED at <em>index</em> in the charplexed array; between 0 and 255. <a href="#a89312f2fd1d27c4e56346ed9cccfb9f6">More...</a><br/></td></tr>
|
|
<tr class="separator:a89312f2fd1d27c4e56346ed9cccfb9f6"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a605a302e13005a1aa3d68d0e22bc474b"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classCharlieplex.html#a605a302e13005a1aa3d68d0e22bc474b">setPwmLed</a> (int index, uint8_t value)</td></tr>
|
|
<tr class="memdesc:a605a302e13005a1aa3d68d0e22bc474b"><td class="mdescLeft"> </td><td class="mdescRight">Sets the PWM <em>value</em> of the LED at <em>index</em> in the charliplexed array; between 0 and 255. <a href="#a605a302e13005a1aa3d68d0e22bc474b">More...</a><br/></td></tr>
|
|
<tr class="separator:a605a302e13005a1aa3d68d0e22bc474b"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:abb429659a7b1ee4c7306ea659050cb30"><td class="memItemLeft" align="right" valign="top">unsigned long </td><td class="memItemRight" valign="bottom"><a class="el" href="classCharlieplex.html#abb429659a7b1ee4c7306ea659050cb30">holdTime</a> () const </td></tr>
|
|
<tr class="memdesc:abb429659a7b1ee4c7306ea659050cb30"><td class="mdescLeft"> </td><td class="mdescRight">Returns the number of microseconds that each LED should be held on for before moving onto the next in <a class="el" href="classCharlieplex.html#a8313edeacd8387c428b8299d52584d6a" title="Runs the multiplexing loop, to display the LED states on the charlieplexed array. ...">loop()</a>. <a href="#abb429659a7b1ee4c7306ea659050cb30">More...</a><br/></td></tr>
|
|
<tr class="separator:abb429659a7b1ee4c7306ea659050cb30"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a8502f4c752faba37023ced587695f6a4"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classCharlieplex.html#a8502f4c752faba37023ced587695f6a4">setHoldTime</a> (unsigned long us)</td></tr>
|
|
<tr class="memdesc:a8502f4c752faba37023ced587695f6a4"><td class="mdescLeft"> </td><td class="mdescRight">Sets the number of microseconds that each LED should be held on for before moving onto the next in <a class="el" href="classCharlieplex.html#a8313edeacd8387c428b8299d52584d6a" title="Runs the multiplexing loop, to display the LED states on the charlieplexed array. ...">loop()</a> to <em>us</em>. <a href="#a8502f4c752faba37023ced587695f6a4">More...</a><br/></td></tr>
|
|
<tr class="separator:a8502f4c752faba37023ced587695f6a4"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a8313edeacd8387c428b8299d52584d6a"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classCharlieplex.html#a8313edeacd8387c428b8299d52584d6a">loop</a> ()</td></tr>
|
|
<tr class="memdesc:a8313edeacd8387c428b8299d52584d6a"><td class="mdescLeft"> </td><td class="mdescRight">Runs the multiplexing loop, to display the LED states on the charlieplexed array. <a href="#a8313edeacd8387c428b8299d52584d6a">More...</a><br/></td></tr>
|
|
<tr class="separator:a8313edeacd8387c428b8299d52584d6a"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a3c961bfff866e400dad371f0376f096b"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classCharlieplex.html#a3c961bfff866e400dad371f0376f096b">refresh</a> ()</td></tr>
|
|
<tr class="memdesc:a3c961bfff866e400dad371f0376f096b"><td class="mdescLeft"> </td><td class="mdescRight">Refreshes the charlieplexed array by advancing to the next LED that needs to be lit. <a href="#a3c961bfff866e400dad371f0376f096b">More...</a><br/></td></tr>
|
|
<tr class="separator:a3c961bfff866e400dad371f0376f096b"><td class="memSeparator" colspan="2"> </td></tr>
|
|
</table>
|
|
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
|
<div class="textblock"><p>Manage an array of LED's in a charlieplexed arrangement. </p>
|
|
<p><a href="http://en.wikipedia.org/wiki/Charlieplexing">Charlieplexing</a> is a technique for multiplexing large numbers of LED's on a small number of microcontroller output pins. LED's are arranged in complementary pairs; the simplest being for two output pins:</p>
|
|
<div class="image">
|
|
<img src="charlieplex2pin.png" alt="charlieplex2pin.png"/>
|
|
</div>
|
|
<p>When Pin1 is 1 and Pin2 is 0, LED1 will be lit. When Pin1 is 0 and Pin2 is 1, then LED2 will be lit. The technique extends to 3 pins as follows:</p>
|
|
<div class="image">
|
|
<img src="charlieplex3pin.png" alt="charlieplex3pin.png"/>
|
|
</div>
|
|
<p>In this case, LED5 is lit when Pin1 is 1, Pin3 is 0, and Pin2 is set to a high-impedance input to "disconnect" it.</p>
|
|
<p><a class="el" href="classCharlieplex.html" title="Manage an array of LED's in a charlieplexed arrangement. ">Charlieplex</a> presents a simple array of <a class="el" href="classCharlieplex.html#a90fd09f24b62424b0b7b8bcdb0140b9d" title="Returns the value of the LED at index in the charplexed array; true if lit; false if not lit...">led()</a> values that indicate whether each LED is on, off, or in an intermediate PWM state (if <a class="el" href="classCharlieplex.html#a605a302e13005a1aa3d68d0e22bc474b" title="Sets the PWM value of the LED at index in the charliplexed array; between 0 and 255. ">setPwmLed()</a> is used). The application must call <a class="el" href="classCharlieplex.html#a8313edeacd8387c428b8299d52584d6a" title="Runs the multiplexing loop, to display the LED states on the charlieplexed array. ...">loop()</a> or <a class="el" href="classCharlieplex.html#a3c961bfff866e400dad371f0376f096b" title="Refreshes the charlieplexed array by advancing to the next LED that needs to be lit. ">refresh()</a> on a regular basis to ensure that the multiplexed display is kept up to date. The following example drives 6 LED's connected to the output pins D9, D10, and D11:</p>
|
|
<div class="fragment"><div class="line"><span class="preprocessor">#include <Charlieplex.h></span></div>
|
|
<div class="line"></div>
|
|
<div class="line">byte pins[3] = {9, 10, 11};</div>
|
|
<div class="line"><a class="code" href="classCharlieplex.html">Charlieplex</a> charlie(pins, <span class="keyword">sizeof</span>(pins));</div>
|
|
<div class="line"></div>
|
|
<div class="line"><span class="keywordtype">void</span> setup() {</div>
|
|
<div class="line"> charlie.setLed(0, <span class="keyword">true</span>); <span class="comment">// Turn on LED1</span></div>
|
|
<div class="line"> charlie.setLed(3, <span class="keyword">true</span>); <span class="comment">// Turn on LED4</span></div>
|
|
<div class="line"> charlie.setPwmLed(5, 64); <span class="comment">// Set LED6 to one-quarter on</span></div>
|
|
<div class="line">}</div>
|
|
<div class="line"></div>
|
|
<div class="line"><span class="keywordtype">void</span> <a class="code" href="classCharlieplex.html#a8313edeacd8387c428b8299d52584d6a">loop</a>() {</div>
|
|
<div class="line"> charlie.loop();</div>
|
|
<div class="line">}</div>
|
|
</div><!-- fragment --></p>
|
|
<p>The following diagram extends the circuit for 4 output pins and 12 LED's:</p>
|
|
<div class="image">
|
|
<img src="charlieplex4pin.png" alt="charlieplex4pin.png"/>
|
|
</div>
|
|
<p>The following diagram extends the circuit for 5 output pins and 20 LED's:</p>
|
|
<div class="image">
|
|
<img src="charlieplex5pin.png" alt="charlieplex5pin.png"/>
|
|
</div>
|
|
<p>Circuits for higher numbers of LED's get increasingly complex. For those cases it can be easier to use traditional multiplexing matrix arrangements and shift registers. The <a class="el" href="classDMD.html" title="Handle large dot matrix displays composed of LED's. ">DMD</a> class does this for a specific kind of large dot matrix display. Otherwise, use the following pseudocode to determine how to connect the LED's for higher numbers of pins:</p>
|
|
<div class="fragment"><div class="line">n = 1</div>
|
|
<div class="line"><span class="keywordflow">for</span> Pass = 1 to NumPins-1:</div>
|
|
<div class="line"> <span class="keywordflow">for</span> Pin = 1 to NumPins-Pass:</div>
|
|
<div class="line"> LED[n] is connected between Pin (anode) and Pin+Pass (cathode)</div>
|
|
<div class="line"> LED[n+1] is connected between Pin+Pass (anode) and Pin (cathode)</div>
|
|
<div class="line"> n = n + 2</div>
|
|
</div><!-- fragment --><p>Note: while the above circuit diagrams and psuedocode use 1-based numbering for LED's, <a class="el" href="classCharlieplex.html" title="Manage an array of LED's in a charlieplexed arrangement. ">Charlieplex</a> uses 0-based numbering in the <a class="el" href="classCharlieplex.html#a90fd09f24b62424b0b7b8bcdb0140b9d" title="Returns the value of the LED at index in the charplexed array; true if lit; false if not lit...">led()</a>, <a class="el" href="classCharlieplex.html#ab103c9687a0890faf72e4da79e3de0a5" title="Sets the value of the LED at index in the charliplexed array. ">setLed()</a>, <a class="el" href="classCharlieplex.html#a89312f2fd1d27c4e56346ed9cccfb9f6" title="Returns the PWM value of the LED at index in the charplexed array; between 0 and 255. ">pwmLed()</a>, and <a class="el" href="classCharlieplex.html#a605a302e13005a1aa3d68d0e22bc474b" title="Sets the PWM value of the LED at index in the charliplexed array; between 0 and 255. ">setPwmLed()</a> functions.</p>
|
|
<p>It isn't necessary to wire up all LED's. If you only need 10 LED's, then use the 4-output circuit and omit LED11 and LED12. <a class="el" href="classCharlieplex.html" title="Manage an array of LED's in a charlieplexed arrangement. ">Charlieplex</a> only drives LED's that are lit; LED's that are unlit or unused will be skipped during the refresh scan. The maximum number of LED's that that can be driven by a specific number of pins is given by the following table:</p>
|
|
<table class="doxtable">
|
|
<tr>
|
|
<td>Number of Pins</td><td>Number of LED's </td></tr>
|
|
<tr>
|
|
<td>2</td><td>2 </td></tr>
|
|
<tr>
|
|
<td>3</td><td>6 </td></tr>
|
|
<tr>
|
|
<td>4</td><td>12 </td></tr>
|
|
<tr>
|
|
<td>5</td><td>20 </td></tr>
|
|
<tr>
|
|
<td>6</td><td>30 </td></tr>
|
|
<tr>
|
|
<td>7</td><td>42 </td></tr>
|
|
<tr>
|
|
<td>8</td><td>56 </td></tr>
|
|
<tr>
|
|
<td>9</td><td>72 </td></tr>
|
|
<tr>
|
|
<td>10</td><td>90 </td></tr>
|
|
<tr>
|
|
<td>n</td><td>n * (n - 1) </td></tr>
|
|
</table>
|
|
|
|
<p>Definition at line <a class="el" href="Charlieplex_8h_source.html#l00028">28</a> of file <a class="el" href="Charlieplex_8h_source.html">Charlieplex.h</a>.</p>
|
|
</div><h2 class="groupheader">Constructor & Destructor Documentation</h2>
|
|
<a class="anchor" id="abfb0d0456bcbadbf60c21f615adacdbd"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">Charlieplex::Charlieplex </td>
|
|
<td>(</td>
|
|
<td class="paramtype">const uint8_t * </td>
|
|
<td class="paramname"><em>pins</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">uint8_t </td>
|
|
<td class="paramname"><em>numPins</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Constructs a new charliexplexing array where the output pins are specified by the <em>numPins</em> entries in <em>pins</em>. </p>
|
|
<p>Note: <em>numPins</em> must be 2 or greater for correct operation.</p>
|
|
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classCharlieplex.html#a5008aa4143d381ce34a3aed1a3843e4e" title="Returns the number of LED's in this charlieplexed array based on the number of pins. ">count()</a>, <a class="el" href="classCharlieplex.html#ab103c9687a0890faf72e4da79e3de0a5" title="Sets the value of the LED at index in the charliplexed array. ">setLed()</a> </dd></dl>
|
|
|
|
<p>Definition at line <a class="el" href="Charlieplex_8cpp_source.html#l00121">121</a> of file <a class="el" href="Charlieplex_8cpp_source.html">Charlieplex.cpp</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<h2 class="groupheader">Member Function Documentation</h2>
|
|
<a class="anchor" id="a5008aa4143d381ce34a3aed1a3843e4e"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">int Charlieplex::count </td>
|
|
<td>(</td>
|
|
<td class="paramname"></td><td>)</td>
|
|
<td> const</td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
<td class="mlabels-right">
|
|
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Returns the number of LED's in this charlieplexed array based on the number of pins. </p>
|
|
<table class="doxtable">
|
|
<tr>
|
|
<td>Number of Pins</td><td>Number of LED's </td></tr>
|
|
<tr>
|
|
<td>2</td><td>2 </td></tr>
|
|
<tr>
|
|
<td>3</td><td>6 </td></tr>
|
|
<tr>
|
|
<td>4</td><td>12 </td></tr>
|
|
<tr>
|
|
<td>5</td><td>20 </td></tr>
|
|
<tr>
|
|
<td>6</td><td>30 </td></tr>
|
|
<tr>
|
|
<td>7</td><td>42 </td></tr>
|
|
<tr>
|
|
<td>8</td><td>56 </td></tr>
|
|
<tr>
|
|
<td>9</td><td>72 </td></tr>
|
|
<tr>
|
|
<td>10</td><td>90 </td></tr>
|
|
<tr>
|
|
<td>n</td><td>n * (n - 1) </td></tr>
|
|
</table>
|
|
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classCharlieplex.html#a90fd09f24b62424b0b7b8bcdb0140b9d" title="Returns the value of the LED at index in the charplexed array; true if lit; false if not lit...">led()</a> </dd></dl>
|
|
|
|
<p>Definition at line <a class="el" href="Charlieplex_8h_source.html#l00034">34</a> of file <a class="el" href="Charlieplex_8h_source.html">Charlieplex.h</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="abb429659a7b1ee4c7306ea659050cb30"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">unsigned long Charlieplex::holdTime </td>
|
|
<td>(</td>
|
|
<td class="paramname"></td><td>)</td>
|
|
<td> const</td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
<td class="mlabels-right">
|
|
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Returns the number of microseconds that each LED should be held on for before moving onto the next in <a class="el" href="classCharlieplex.html#a8313edeacd8387c428b8299d52584d6a" title="Runs the multiplexing loop, to display the LED states on the charlieplexed array. ...">loop()</a>. </p>
|
|
<p>The default value is calculated so that all LED's can be refreshed with a rate of at least 200 Hz, which is necessary for handling PWM output on multiple LED's. The less LED's that are lit at once, the faster the display will refresh.</p>
|
|
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classCharlieplex.html#a8502f4c752faba37023ced587695f6a4" title="Sets the number of microseconds that each LED should be held on for before moving onto the next in lo...">setHoldTime()</a>, <a class="el" href="classCharlieplex.html#a8313edeacd8387c428b8299d52584d6a" title="Runs the multiplexing loop, to display the LED states on the charlieplexed array. ...">loop()</a> </dd></dl>
|
|
|
|
<p>Definition at line <a class="el" href="Charlieplex_8h_source.html#l00042">42</a> of file <a class="el" href="Charlieplex_8h_source.html">Charlieplex.h</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a90fd09f24b62424b0b7b8bcdb0140b9d"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">bool Charlieplex::led </td>
|
|
<td>(</td>
|
|
<td class="paramtype">int </td>
|
|
<td class="paramname"><em>index</em></td><td>)</td>
|
|
<td> const</td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
<td class="mlabels-right">
|
|
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Returns the value of the LED at <em>index</em> in the charplexed array; true if lit; false if not lit. </p>
|
|
<p>If the LED is displaying a PWM value, then this function will return true for any non-zero PWM value.</p>
|
|
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classCharlieplex.html#ab103c9687a0890faf72e4da79e3de0a5" title="Sets the value of the LED at index in the charliplexed array. ">setLed()</a>, <a class="el" href="classCharlieplex.html#a89312f2fd1d27c4e56346ed9cccfb9f6" title="Returns the PWM value of the LED at index in the charplexed array; between 0 and 255. ">pwmLed()</a> </dd></dl>
|
|
|
|
<p>Definition at line <a class="el" href="Charlieplex_8h_source.html#l00036">36</a> of file <a class="el" href="Charlieplex_8h_source.html">Charlieplex.h</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a8313edeacd8387c428b8299d52584d6a"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void Charlieplex::loop </td>
|
|
<td>(</td>
|
|
<td class="paramname"></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Runs the multiplexing loop, to display the LED states on the charlieplexed array. </p>
|
|
<p>If <a class="el" href="classCharlieplex.html#abb429659a7b1ee4c7306ea659050cb30" title="Returns the number of microseconds that each LED should be held on for before moving onto the next in...">holdTime()</a> microseconds have elapsed since the last call to <a class="el" href="classCharlieplex.html#a8313edeacd8387c428b8299d52584d6a" title="Runs the multiplexing loop, to display the LED states on the charlieplexed array. ...">loop()</a>, then the current LED is turned off and the next LED that needs to be lit is turned on.</p>
|
|
<p>LED's that do not need to be lit are skipped. The total time for a single pass through all lit LED's may be very short if only a few LED's are lit at once. If all LED's are lit, then the total time for a single pass will be <a class="el" href="classCharlieplex.html#a5008aa4143d381ce34a3aed1a3843e4e" title="Returns the number of LED's in this charlieplexed array based on the number of pins. ">count()</a> * <a class="el" href="classCharlieplex.html#abb429659a7b1ee4c7306ea659050cb30" title="Returns the number of microseconds that each LED should be held on for before moving onto the next in...">holdTime()</a> microseconds.</p>
|
|
<p>If the application is using timer interrupts to drive the multiplexing process, then use <a class="el" href="classCharlieplex.html#a3c961bfff866e400dad371f0376f096b" title="Refreshes the charlieplexed array by advancing to the next LED that needs to be lit. ">refresh()</a> instead of <a class="el" href="classCharlieplex.html#a8313edeacd8387c428b8299d52584d6a" title="Runs the multiplexing loop, to display the LED states on the charlieplexed array. ...">loop()</a>.</p>
|
|
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classCharlieplex.html#a90fd09f24b62424b0b7b8bcdb0140b9d" title="Returns the value of the LED at index in the charplexed array; true if lit; false if not lit...">led()</a>, <a class="el" href="classCharlieplex.html#a89312f2fd1d27c4e56346ed9cccfb9f6" title="Returns the PWM value of the LED at index in the charplexed array; between 0 and 255. ">pwmLed()</a>, <a class="el" href="classCharlieplex.html#abb429659a7b1ee4c7306ea659050cb30" title="Returns the number of microseconds that each LED should be held on for before moving onto the next in...">holdTime()</a>, <a class="el" href="classCharlieplex.html#a3c961bfff866e400dad371f0376f096b" title="Refreshes the charlieplexed array by advancing to the next LED that needs to be lit. ">refresh()</a> </dd></dl>
|
|
|
|
<p>Definition at line <a class="el" href="Charlieplex_8cpp_source.html#l00277">277</a> of file <a class="el" href="Charlieplex_8cpp_source.html">Charlieplex.cpp</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a89312f2fd1d27c4e56346ed9cccfb9f6"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">uint8_t Charlieplex::pwmLed </td>
|
|
<td>(</td>
|
|
<td class="paramtype">int </td>
|
|
<td class="paramname"><em>index</em></td><td>)</td>
|
|
<td> const</td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
<td class="mlabels-right">
|
|
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Returns the PWM value of the LED at <em>index</em> in the charplexed array; between 0 and 255. </p>
|
|
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classCharlieplex.html#a605a302e13005a1aa3d68d0e22bc474b" title="Sets the PWM value of the LED at index in the charliplexed array; between 0 and 255. ">setPwmLed()</a>, <a class="el" href="classCharlieplex.html#a90fd09f24b62424b0b7b8bcdb0140b9d" title="Returns the value of the LED at index in the charplexed array; true if lit; false if not lit...">led()</a> </dd></dl>
|
|
|
|
<p>Definition at line <a class="el" href="Charlieplex_8h_source.html#l00039">39</a> of file <a class="el" href="Charlieplex_8h_source.html">Charlieplex.h</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a3c961bfff866e400dad371f0376f096b"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void Charlieplex::refresh </td>
|
|
<td>(</td>
|
|
<td class="paramname"></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Refreshes the charlieplexed array by advancing to the next LED that needs to be lit. </p>
|
|
<p>This function is intended to be called from a timer interrupt service routine to advance the multiplexing state without the main application having to explicitly call <a class="el" href="classCharlieplex.html#a8313edeacd8387c428b8299d52584d6a" title="Runs the multiplexing loop, to display the LED states on the charlieplexed array. ...">loop()</a>.</p>
|
|
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classCharlieplex.html#a8313edeacd8387c428b8299d52584d6a" title="Runs the multiplexing loop, to display the LED states on the charlieplexed array. ...">loop()</a> </dd></dl>
|
|
|
|
<p>Definition at line <a class="el" href="Charlieplex_8cpp_source.html#l00296">296</a> of file <a class="el" href="Charlieplex_8cpp_source.html">Charlieplex.cpp</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a8502f4c752faba37023ced587695f6a4"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void Charlieplex::setHoldTime </td>
|
|
<td>(</td>
|
|
<td class="paramtype">unsigned long </td>
|
|
<td class="paramname"><em>us</em></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
<td class="mlabels-right">
|
|
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Sets the number of microseconds that each LED should be held on for before moving onto the next in <a class="el" href="classCharlieplex.html#a8313edeacd8387c428b8299d52584d6a" title="Runs the multiplexing loop, to display the LED states on the charlieplexed array. ...">loop()</a> to <em>us</em>. </p>
|
|
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classCharlieplex.html#abb429659a7b1ee4c7306ea659050cb30" title="Returns the number of microseconds that each LED should be held on for before moving onto the next in...">holdTime()</a>, <a class="el" href="classCharlieplex.html#a8313edeacd8387c428b8299d52584d6a" title="Runs the multiplexing loop, to display the LED states on the charlieplexed array. ...">loop()</a> </dd></dl>
|
|
|
|
<p>Definition at line <a class="el" href="Charlieplex_8h_source.html#l00043">43</a> of file <a class="el" href="Charlieplex_8h_source.html">Charlieplex.h</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ab103c9687a0890faf72e4da79e3de0a5"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void Charlieplex::setLed </td>
|
|
<td>(</td>
|
|
<td class="paramtype">int </td>
|
|
<td class="paramname"><em>index</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">bool </td>
|
|
<td class="paramname"><em>value</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
<td class="mlabels-right">
|
|
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Sets the <em>value</em> of the LED at <em>index</em> in the charliplexed array. </p>
|
|
<p>The brightness of the LED will be proportional to the number of LED's that are currently lit, as the <a class="el" href="classCharlieplex.html#abb429659a7b1ee4c7306ea659050cb30" title="Returns the number of microseconds that each LED should be held on for before moving onto the next in...">holdTime()</a> refresh rate will cause the LED to appear to dim; the more LED's that are lit the less overall time each individual LED is held on. For best results, only a single LED should be lit at once or higher-brightness LED's should be used.</p>
|
|
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classCharlieplex.html#a90fd09f24b62424b0b7b8bcdb0140b9d" title="Returns the value of the LED at index in the charplexed array; true if lit; false if not lit...">led()</a>, <a class="el" href="classCharlieplex.html#a605a302e13005a1aa3d68d0e22bc474b" title="Sets the PWM value of the LED at index in the charliplexed array; between 0 and 255. ">setPwmLed()</a> </dd></dl>
|
|
|
|
<p>Definition at line <a class="el" href="Charlieplex_8h_source.html#l00037">37</a> of file <a class="el" href="Charlieplex_8h_source.html">Charlieplex.h</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a605a302e13005a1aa3d68d0e22bc474b"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void Charlieplex::setPwmLed </td>
|
|
<td>(</td>
|
|
<td class="paramtype">int </td>
|
|
<td class="paramname"><em>index</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">uint8_t </td>
|
|
<td class="paramname"><em>value</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
<td class="mlabels-right">
|
|
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Sets the PWM <em>value</em> of the LED at <em>index</em> in the charliplexed array; between 0 and 255. </p>
|
|
<p>If this function is used, then it is assumed that the output pins are capable of PWM output.</p>
|
|
<p>The PWM-specified brightness of the LED will also be affected to the number of LED's that are currently lit, as the <a class="el" href="classCharlieplex.html#abb429659a7b1ee4c7306ea659050cb30" title="Returns the number of microseconds that each LED should be held on for before moving onto the next in...">holdTime()</a> refresh rate will cause the LED to appear to dim; the more LED's that are lit the less overall time each individual LED is held on. For best results, only a single LED should be lit at once or higher-brightness LED's should be used.</p>
|
|
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classCharlieplex.html#a89312f2fd1d27c4e56346ed9cccfb9f6" title="Returns the PWM value of the LED at index in the charplexed array; between 0 and 255. ">pwmLed()</a>, <a class="el" href="classCharlieplex.html#ab103c9687a0890faf72e4da79e3de0a5" title="Sets the value of the LED at index in the charliplexed array. ">setLed()</a> </dd></dl>
|
|
|
|
<p>Definition at line <a class="el" href="Charlieplex_8h_source.html#l00040">40</a> of file <a class="el" href="Charlieplex_8h_source.html">Charlieplex.h</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<hr/>The documentation for this class was generated from the following files:<ul>
|
|
<li><a class="el" href="Charlieplex_8h_source.html">Charlieplex.h</a></li>
|
|
<li><a class="el" href="Charlieplex_8cpp_source.html">Charlieplex.cpp</a></li>
|
|
</ul>
|
|
</div><!-- contents -->
|
|
<!-- start footer part -->
|
|
<hr class="footer"/><address class="footer"><small>
|
|
Generated on Thu Apr 2 2015 16:36:51 for ArduinoLibs by  <a href="http://www.doxygen.org/index.html">
|
|
<img class="footer" src="doxygen.png" alt="doxygen"/>
|
|
</a> 1.8.6
|
|
</small></address>
|
|
</body>
|
|
</html>
|