mirror of
https://github.com/tebl/RC6502-Apple-1-Replica.git
synced 2024-11-30 21:49:36 +00:00
494 lines
24 KiB
HTML
494 lines
24 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.4"/>
|
|
<title>MCP23S17 Library: MCP23S17 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">MCP23S17 Library
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<!-- end header part -->
|
|
<!-- Generated by Doxygen 1.8.4 -->
|
|
<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 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="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>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><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="classMCP23S17-members.html">List of all members</a> </div>
|
|
<div class="headertitle">
|
|
<div class="title">MCP23S17 Class Reference</div> </div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
<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:a97d5acfce335affc1fd0e90f27bb2773"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classMCP23S17.html#a97d5acfce335affc1fd0e90f27bb2773">MCP23S17</a> (SPIClass *spi, uint8_t cs, uint8_t addr)</td></tr>
|
|
<tr class="separator:a97d5acfce335affc1fd0e90f27bb2773"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a406756f19493cdec55b56617ddc109f1"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classMCP23S17.html#a406756f19493cdec55b56617ddc109f1">begin</a> ()</td></tr>
|
|
<tr class="separator:a406756f19493cdec55b56617ddc109f1"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a6e9078f8c0e9c623de2505ed4c19f09e"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classMCP23S17.html#a6e9078f8c0e9c623de2505ed4c19f09e">pinMode</a> (uint8_t pin, uint8_t mode)</td></tr>
|
|
<tr class="separator:a6e9078f8c0e9c623de2505ed4c19f09e"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a14834358725d440513946ac3d6c6a02e"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classMCP23S17.html#a14834358725d440513946ac3d6c6a02e">digitalWrite</a> (uint8_t pin, uint8_t value)</td></tr>
|
|
<tr class="separator:a14834358725d440513946ac3d6c6a02e"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a30386f1e0486570613ea06d110387093"><td class="memItemLeft" align="right" valign="top">uint8_t </td><td class="memItemRight" valign="bottom"><a class="el" href="classMCP23S17.html#a30386f1e0486570613ea06d110387093">digitalRead</a> (uint8_t pin)</td></tr>
|
|
<tr class="separator:a30386f1e0486570613ea06d110387093"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:aa798040d8c6b863398978623a73d6cba"><td class="memItemLeft" align="right" valign="top">uint8_t </td><td class="memItemRight" valign="bottom"><a class="el" href="classMCP23S17.html#aa798040d8c6b863398978623a73d6cba">readPort</a> (uint8_t port)</td></tr>
|
|
<tr class="separator:aa798040d8c6b863398978623a73d6cba"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a45d1747d85825e3bf2cf4be7268c9b92"><td class="memItemLeft" align="right" valign="top">uint16_t </td><td class="memItemRight" valign="bottom"><a class="el" href="classMCP23S17.html#a45d1747d85825e3bf2cf4be7268c9b92">readPort</a> ()</td></tr>
|
|
<tr class="separator:a45d1747d85825e3bf2cf4be7268c9b92"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ad11ed96faaef273362d2c54260e68891"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classMCP23S17.html#ad11ed96faaef273362d2c54260e68891">writePort</a> (uint8_t port, uint8_t val)</td></tr>
|
|
<tr class="separator:ad11ed96faaef273362d2c54260e68891"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a63a34c5b29e75cfd715bd1449626f98e"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classMCP23S17.html#a63a34c5b29e75cfd715bd1449626f98e">writePort</a> (uint16_t val)</td></tr>
|
|
<tr class="separator:a63a34c5b29e75cfd715bd1449626f98e"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a8cfe7bd574736faeca00e133e5e19ec3"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classMCP23S17.html#a8cfe7bd574736faeca00e133e5e19ec3">enableInterrupt</a> (uint8_t pin, uint8_t type)</td></tr>
|
|
<tr class="separator:a8cfe7bd574736faeca00e133e5e19ec3"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:aff570e5211f9443769a53f017626b180"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classMCP23S17.html#aff570e5211f9443769a53f017626b180">disableInterrupt</a> (uint8_t pin)</td></tr>
|
|
<tr class="separator:aff570e5211f9443769a53f017626b180"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a5b9bcf0d06c5a15875f406e1ed73ecc7"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classMCP23S17.html#a5b9bcf0d06c5a15875f406e1ed73ecc7">setMirror</a> (boolean m)</td></tr>
|
|
<tr class="separator:a5b9bcf0d06c5a15875f406e1ed73ecc7"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ad1a11133076a20b9c16e30fb2ddc566c"><td class="memItemLeft" align="right" valign="top">uint16_t </td><td class="memItemRight" valign="bottom"><a class="el" href="classMCP23S17.html#ad1a11133076a20b9c16e30fb2ddc566c">getInterruptPins</a> ()</td></tr>
|
|
<tr class="separator:ad1a11133076a20b9c16e30fb2ddc566c"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:adf3b48d655eb9850a9349973d0ece330"><td class="memItemLeft" align="right" valign="top">uint16_t </td><td class="memItemRight" valign="bottom"><a class="el" href="classMCP23S17.html#adf3b48d655eb9850a9349973d0ece330">getInterruptValue</a> ()</td></tr>
|
|
<tr class="separator:adf3b48d655eb9850a9349973d0ece330"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a5786c6b9a618a1c7c0fd95ca7d93774d"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classMCP23S17.html#a5786c6b9a618a1c7c0fd95ca7d93774d">setInterruptLevel</a> (uint8_t level)</td></tr>
|
|
<tr class="separator:a5786c6b9a618a1c7c0fd95ca7d93774d"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:aef7c2e4c24141e8ba455aa1d2e497e6c"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classMCP23S17.html#aef7c2e4c24141e8ba455aa1d2e497e6c">setInterruptOD</a> (boolean openDrain)</td></tr>
|
|
<tr class="separator:aef7c2e4c24141e8ba455aa1d2e497e6c"><td class="memSeparator" colspan="2"> </td></tr>
|
|
</table>
|
|
<h2 class="groupheader">Constructor & Destructor Documentation</h2>
|
|
<a class="anchor" id="a97d5acfce335affc1fd0e90f27bb2773"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">MCP23S17::MCP23S17 </td>
|
|
<td>(</td>
|
|
<td class="paramtype">SPIClass * </td>
|
|
<td class="paramname"><em>spi</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">uint8_t </td>
|
|
<td class="paramname"><em>cs</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">uint8_t </td>
|
|
<td class="paramname"><em>addr</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<p>The constructor takes three parameters. The first is an SPI class pointer. This is the address of an SPI object (either the default SPI object on the Arduino, or an object made using the DSPIx classes on the chipKIT). The second parameter is the chip select pin number to use when communicating with the chip. The third is the internal address number of the chip. This is controlled by the three Ax pins on the chip.</p>
|
|
<p>Example:</p>
|
|
<pre class="fragment">MCP23S17 myExpander(&SPI, 10, 0);</pre>
|
|
</div>
|
|
</div>
|
|
<h2 class="groupheader">Member Function Documentation</h2>
|
|
<a class="anchor" id="a406756f19493cdec55b56617ddc109f1"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void MCP23S17::begin </td>
|
|
<td>(</td>
|
|
<td class="paramname">)</td><td></td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<p>The begin function performs the initial configuration of the IO expander chip. Not only does it set up the SPI communications, but it also configures the chip for address-based communication and sets the default parameters and registers to sensible values.</p>
|
|
<p>Example: </p>
|
|
<pre class="fragment">myExpander.begin();</pre>
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a30386f1e0486570613ea06d110387093"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">uint8_t MCP23S17::digitalRead </td>
|
|
<td>(</td>
|
|
<td class="paramtype">uint8_t </td>
|
|
<td class="paramname"><em>pin</em>)</td><td></td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<p>This will return the current state of a pin set to INPUT, or the last value written to a pin set to OUTPUT.</p>
|
|
<p>Example: </p>
|
|
<pre class="fragment">byte value = myExpander.digitalRead(4);</pre>
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a14834358725d440513946ac3d6c6a02e"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void MCP23S17::digitalWrite </td>
|
|
<td>(</td>
|
|
<td class="paramtype">uint8_t </td>
|
|
<td class="paramname"><em>pin</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>
|
|
</div><div class="memdoc">
|
|
<p>Like the Arduino API's namesake, this function will set an output pin to a specific value, either HIGH (1) or LOW (0). If the pin is currently set to an INPUT instead of an OUTPUT, then this function acts like the old way of enabling / disabling the pullup resistor, which pre-1.0.0 versions of the Arduino API used - i.e., set HIGH to enable the pullup, or LOW to disable it.</p>
|
|
<p>Example: </p>
|
|
<pre class="fragment">myExpander.digitalWrite(3, HIGH);</pre>
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="aff570e5211f9443769a53f017626b180"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void MCP23S17::disableInterrupt </td>
|
|
<td>(</td>
|
|
<td class="paramtype">uint8_t </td>
|
|
<td class="paramname"><em>pin</em>)</td><td></td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<p>This disables the interrupt functionality of a pin.</p>
|
|
<p>Example: </p>
|
|
<pre class="fragment">myExpander.disableInterrupt(4);</pre>
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a8cfe7bd574736faeca00e133e5e19ec3"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void MCP23S17::enableInterrupt </td>
|
|
<td>(</td>
|
|
<td class="paramtype">uint8_t </td>
|
|
<td class="paramname"><em>pin</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">uint8_t </td>
|
|
<td class="paramname"><em>type</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<p>This enables the interrupt functionality of a pin. The interrupt type can be one of:</p>
|
|
<ul>
|
|
<li>CHANGE</li>
|
|
<li>RISING</li>
|
|
<li>FALLING</li>
|
|
</ul>
|
|
<p>When an interrupt occurs the corresponding port's INT pin will be driven to it's configured level, and will remain there until either the port is read with a readPort or digitalRead, or the captured port status at the time of the interrupt is read using getInterruptValue.</p>
|
|
<p>Example: </p>
|
|
<pre class="fragment">myExpander.enableInterrupt(4, RISING);</pre>
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ad1a11133076a20b9c16e30fb2ddc566c"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">uint16_t MCP23S17::getInterruptPins </td>
|
|
<td>(</td>
|
|
<td class="paramname">)</td><td></td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<p>This function returns a 16-bit bitmap of the the pin or pins that have cause an interrupt to fire.</p>
|
|
<p>Example: </p>
|
|
<pre class="fragment">unsigned int pins = myExpander.getInterruptPins();</pre>
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="adf3b48d655eb9850a9349973d0ece330"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">uint16_t MCP23S17::getInterruptValue </td>
|
|
<td>(</td>
|
|
<td class="paramname">)</td><td></td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<p>This returns a snapshot of the IO pin states at the moment the last interrupt occured. Reading this value clears the interrupt status (and hence the INT pins) for the whole chip. Until this value is read (or the current live port value is read) no further interrupts can be indicated.</p>
|
|
<p>Example: </p>
|
|
<pre class="fragment">unsigned int pinValues = myExpander.getInterruptPins();</pre>
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a6e9078f8c0e9c623de2505ed4c19f09e"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void MCP23S17::pinMode </td>
|
|
<td>(</td>
|
|
<td class="paramtype">uint8_t </td>
|
|
<td class="paramname"><em>pin</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">uint8_t </td>
|
|
<td class="paramname"><em>mode</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<p>Just like the <a class="el" href="classMCP23S17.html#a6e9078f8c0e9c623de2505ed4c19f09e">pinMode()</a> function of the Arduino API, this function sets the direction of the pin. The first parameter is the pin nimber (0-15) to use, and the second parameter is the direction of the pin. There are standard Arduino macros for different modes which should be used. The supported macros are:</p>
|
|
<ul>
|
|
<li>OUTPUT</li>
|
|
<li>INPUT</li>
|
|
<li>INPUT_PULLUP</li>
|
|
</ul>
|
|
<p>The INPUT_PULLUP mode enables the weak pullup that is available on any pin.</p>
|
|
<p>Example: </p>
|
|
<pre class="fragment">myExpander.pinMode(5, INPUT_PULLUP);</pre>
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="aa798040d8c6b863398978623a73d6cba"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">uint8_t MCP23S17::readPort </td>
|
|
<td>(</td>
|
|
<td class="paramtype">uint8_t </td>
|
|
<td class="paramname"><em>port</em>)</td><td></td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<p>This function returns the entire 8-bit value of a GPIO port. Note that only the bits which correspond to a GPIO pin set to INPUT are valid. Other pins should be ignored. The only parameter defines which port (A/B) to retrieve: 0 is port A and 1 (or anything other than 0) is port B.</p>
|
|
<p>Example: </p>
|
|
<pre class="fragment">byte portA = myExpander.readPort(0);</pre>
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a45d1747d85825e3bf2cf4be7268c9b92"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">uint16_t MCP23S17::readPort </td>
|
|
<td>(</td>
|
|
<td class="paramname">)</td><td></td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<p>This is a full 16-bit version of the parameterised readPort function. This version reads the value of both ports and combines them into a single 16-bit value.</p>
|
|
<p>Example: </p>
|
|
<pre class="fragment">unsigned int value = myExpander.readPort();</pre>
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a5786c6b9a618a1c7c0fd95ca7d93774d"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void MCP23S17::setInterruptLevel </td>
|
|
<td>(</td>
|
|
<td class="paramtype">uint8_t </td>
|
|
<td class="paramname"><em>level</em>)</td><td></td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<p>This sets the "active" level for an interrupt. HIGH means the interrupt pin will go HIGH when an interrupt occurs, LOW means it will go LOW.</p>
|
|
<p>Example: </p>
|
|
<pre class="fragment">myExpander.setInterruptLevel(HIGH);</pre>
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="aef7c2e4c24141e8ba455aa1d2e497e6c"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void MCP23S17::setInterruptOD </td>
|
|
<td>(</td>
|
|
<td class="paramtype">boolean </td>
|
|
<td class="paramname"><em>openDrain</em>)</td><td></td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<p>Using this function it is possible to configure the interrupt output pins to be open drain. This means that interrupt pins from multiple chips can share the same interrupt pin on the host MCU. This causes the level set by setInterruptLevel to be ignored. A pullup resistor will be required on the host MCU's interrupt pin.</p>
|
|
<p>Example: </p>
|
|
<pre class="fragment">myExpander.setInterruptOD(true);</pre>
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a5b9bcf0d06c5a15875f406e1ed73ecc7"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void MCP23S17::setMirror </td>
|
|
<td>(</td>
|
|
<td class="paramtype">boolean </td>
|
|
<td class="paramname"><em>m</em>)</td><td></td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<p>The two IO banks can have their INT pins connected together. This enables you to monitor both banks with just one interrupt pin on the host microcontroller. Calling setMirror with a parameter of <em>true</em> will enable this feature. Calling it with <em>false</em> will disable it.</p>
|
|
<p>Example: </p>
|
|
<pre class="fragment">myExpander.setMirror(true);</pre>
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ad11ed96faaef273362d2c54260e68891"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void MCP23S17::writePort </td>
|
|
<td>(</td>
|
|
<td class="paramtype">uint8_t </td>
|
|
<td class="paramname"><em>port</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">uint8_t </td>
|
|
<td class="paramname"><em>val</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<p>This writes an 8-bit value to one of the two IO port banks (A/B) on the chip. The value is output direct to any pins on that bank that are set as OUTPUT. Any bits that correspond to pins set to INPUT are ignored. As with the readPort function the first parameter defines which bank to use (0 = A, 1+ = B).</p>
|
|
<p>Example: </p>
|
|
<pre class="fragment">myExpander.writePort(0, 0x55);</pre>
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a63a34c5b29e75cfd715bd1449626f98e"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void MCP23S17::writePort </td>
|
|
<td>(</td>
|
|
<td class="paramtype">uint16_t </td>
|
|
<td class="paramname"><em>val</em>)</td><td></td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<p>This is the 16-bit version of the writePort function. This takes a single 16-bit value and splits it between the two IO ports, the upper half going to port B and the lower to port A.</p>
|
|
<p>Example: </p>
|
|
<pre class="fragment">myExpander.writePort(0x55AA);</pre>
|
|
</div>
|
|
</div>
|
|
<hr/>The documentation for this class was generated from the following files:<ul>
|
|
<li><a class="el" href="MCP23S17_8h_source.html">MCP23S17.h</a></li>
|
|
<li>MCP23S17.cpp</li>
|
|
</ul>
|
|
</div><!-- contents -->
|
|
<!-- start footer part -->
|
|
<hr class="footer"/><address class="footer"><small>
|
|
Generated on Wed Jun 25 2014 19:37:57 for MCP23S17 Library by  <a href="http://www.doxygen.org/index.html">
|
|
<img class="footer" src="doxygen.png" alt="doxygen"/>
|
|
</a> 1.8.4
|
|
</small></address>
|
|
</body>
|
|
</html>
|