mirror of
https://github.com/jialexd/sdk-ameba-v4.0c_180328.git
synced 2024-12-01 18:50:36 +00:00
359 lines
14 KiB
HTML
359 lines
14 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.11"/>
|
||
|
<title>SDK3.5: GPIO</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/searchdata.js"></script>
|
||
|
<script type="text/javascript" src="search/search.js"></script>
|
||
|
<script type="text/javascript">
|
||
|
$(document).ready(function() { init_search(); });
|
||
|
</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 id="projectalign" style="padding-left: 0.5em;">
|
||
|
<div id="projectname">SDK3.5
|
||
|
</div>
|
||
|
<div id="projectbrief">This document shows Ameba SDK 3.5 APIs</div>
|
||
|
</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</div>
|
||
|
<!-- end header part -->
|
||
|
<!-- Generated by Doxygen 1.8.11 -->
|
||
|
<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 class="current"><a href="modules.html"><span>Modules</span></a></li>
|
||
|
<li><a href="annotated.html"><span>Data Structures</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><!-- top -->
|
||
|
<!-- window showing the filter options -->
|
||
|
<div id="MSearchSelectWindow"
|
||
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
||
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
||
|
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
||
|
</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 class="header">
|
||
|
<div class="headertitle">
|
||
|
<div class="title">GPIO<div class="ingroups"><a class="el" href="group__sdk.html">Ameba SDK</a> » <a class="el" href="group__hal.html">HAL</a></div></div> </div>
|
||
|
</div><!--header-->
|
||
|
<div class="contents">
|
||
|
|
||
|
<p>gpio functions
|
||
|
<a href="#details">More...</a></p>
|
||
|
<table class="memberdecls">
|
||
|
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="member-group"></a>
|
||
|
Ameba Common</h2></td></tr>
|
||
|
<tr class="memitem:ga80305b9e955f6ce5e555096932e76d8c"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__gpio.html#ga80305b9e955f6ce5e555096932e76d8c">gpio_init</a> (gpio_t *obj, PinName pin)</td></tr>
|
||
|
<tr class="memdesc:ga80305b9e955f6ce5e555096932e76d8c"><td class="mdescLeft"> </td><td class="mdescRight">Initializes the GPIO device, include mode/direction/pull control registers. <a href="#ga80305b9e955f6ce5e555096932e76d8c">More...</a><br /></td></tr>
|
||
|
<tr class="separator:ga80305b9e955f6ce5e555096932e76d8c"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
<tr class="memitem:gae7303f79f43bab40cf7fdb0e7f596d5b"><td class="memItemLeft" align="right" valign="top">uint32_t </td><td class="memItemRight" valign="bottom"><a class="el" href="group__gpio.html#gae7303f79f43bab40cf7fdb0e7f596d5b">gpio_set</a> (PinName pin)</td></tr>
|
||
|
<tr class="memdesc:gae7303f79f43bab40cf7fdb0e7f596d5b"><td class="mdescLeft"> </td><td class="mdescRight">Set the given pin as GPIO. <a href="#gae7303f79f43bab40cf7fdb0e7f596d5b">More...</a><br /></td></tr>
|
||
|
<tr class="separator:gae7303f79f43bab40cf7fdb0e7f596d5b"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
<tr class="memitem:ga980b8f8055986ffc177267488a4bd19d"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__gpio.html#ga980b8f8055986ffc177267488a4bd19d">gpio_mode</a> (gpio_t *obj, PinMode mode)</td></tr>
|
||
|
<tr class="memdesc:ga980b8f8055986ffc177267488a4bd19d"><td class="mdescLeft"> </td><td class="mdescRight">Set GPIO mode. <a href="#ga980b8f8055986ffc177267488a4bd19d">More...</a><br /></td></tr>
|
||
|
<tr class="separator:ga980b8f8055986ffc177267488a4bd19d"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
<tr class="memitem:ga5a6594d03628bb652d45bdd5bf266348"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__gpio.html#ga5a6594d03628bb652d45bdd5bf266348">gpio_dir</a> (gpio_t *obj, PinDirection direction)</td></tr>
|
||
|
<tr class="memdesc:ga5a6594d03628bb652d45bdd5bf266348"><td class="mdescLeft"> </td><td class="mdescRight">Set GPIO direction. <a href="#ga5a6594d03628bb652d45bdd5bf266348">More...</a><br /></td></tr>
|
||
|
<tr class="separator:ga5a6594d03628bb652d45bdd5bf266348"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
<tr class="memitem:gaedd478762e37aeafcf9ade8e255718b0"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__gpio.html#gaedd478762e37aeafcf9ade8e255718b0">gpio_write</a> (gpio_t *obj, int value)</td></tr>
|
||
|
<tr class="memdesc:gaedd478762e37aeafcf9ade8e255718b0"><td class="mdescLeft"> </td><td class="mdescRight">Sets value to the selected output port pin. <a href="#gaedd478762e37aeafcf9ade8e255718b0">More...</a><br /></td></tr>
|
||
|
<tr class="separator:gaedd478762e37aeafcf9ade8e255718b0"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
<tr class="memitem:gabb97298a1eb6f6c11b6290abe7a1823b"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__gpio.html#gabb97298a1eb6f6c11b6290abe7a1823b">gpio_read</a> (gpio_t *obj)</td></tr>
|
||
|
<tr class="memdesc:gabb97298a1eb6f6c11b6290abe7a1823b"><td class="mdescLeft"> </td><td class="mdescRight">Reads the specified gpio port pin. <a href="#gabb97298a1eb6f6c11b6290abe7a1823b">More...</a><br /></td></tr>
|
||
|
<tr class="separator:gabb97298a1eb6f6c11b6290abe7a1823b"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
</table>
|
||
|
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
||
|
<p>gpio functions </p>
|
||
|
<h2 class="groupheader">Function Documentation</h2>
|
||
|
<a class="anchor" id="ga5a6594d03628bb652d45bdd5bf266348"></a>
|
||
|
<div class="memitem">
|
||
|
<div class="memproto">
|
||
|
<table class="memname">
|
||
|
<tr>
|
||
|
<td class="memname">void gpio_dir </td>
|
||
|
<td>(</td>
|
||
|
<td class="paramtype">gpio_t * </td>
|
||
|
<td class="paramname"><em>obj</em>, </td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td class="paramkey"></td>
|
||
|
<td></td>
|
||
|
<td class="paramtype">PinDirection </td>
|
||
|
<td class="paramname"><em>direction</em> </td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td></td>
|
||
|
<td>)</td>
|
||
|
<td></td><td></td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</div><div class="memdoc">
|
||
|
|
||
|
<p>Set GPIO direction. </p>
|
||
|
<dl class="params"><dt>Parameters</dt><dd>
|
||
|
<table class="params">
|
||
|
<tr><td class="paramname">obj</td><td>gpio object define in application software. </td></tr>
|
||
|
<tr><td class="paramname">direction</td><td>this parameter can be one of the following values: <ul>
|
||
|
<li>PIN_INPUT: this pin is input </li>
|
||
|
<li>PIN_OUTPUT: this pin is output </li>
|
||
|
</ul>
|
||
|
</td></tr>
|
||
|
</table>
|
||
|
</dd>
|
||
|
</dl>
|
||
|
<dl class="retval"><dt>Return values</dt><dd>
|
||
|
<table class="retval">
|
||
|
<tr><td class="paramname">none</td><td></td></tr>
|
||
|
</table>
|
||
|
</dd>
|
||
|
</dl>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
<a class="anchor" id="ga80305b9e955f6ce5e555096932e76d8c"></a>
|
||
|
<div class="memitem">
|
||
|
<div class="memproto">
|
||
|
<table class="memname">
|
||
|
<tr>
|
||
|
<td class="memname">void gpio_init </td>
|
||
|
<td>(</td>
|
||
|
<td class="paramtype">gpio_t * </td>
|
||
|
<td class="paramname"><em>obj</em>, </td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td class="paramkey"></td>
|
||
|
<td></td>
|
||
|
<td class="paramtype">PinName </td>
|
||
|
<td class="paramname"><em>pin</em> </td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td></td>
|
||
|
<td>)</td>
|
||
|
<td></td><td></td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</div><div class="memdoc">
|
||
|
|
||
|
<p>Initializes the GPIO device, include mode/direction/pull control registers. </p>
|
||
|
<dl class="params"><dt>Parameters</dt><dd>
|
||
|
<table class="params">
|
||
|
<tr><td class="paramname">obj</td><td>gpio object define in application software. </td></tr>
|
||
|
<tr><td class="paramname">pin</td><td>PinName according to pinmux spec. </td></tr>
|
||
|
</table>
|
||
|
</dd>
|
||
|
</dl>
|
||
|
<dl class="retval"><dt>Return values</dt><dd>
|
||
|
<table class="retval">
|
||
|
<tr><td class="paramname">none</td><td></td></tr>
|
||
|
</table>
|
||
|
</dd>
|
||
|
</dl>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
<a class="anchor" id="ga980b8f8055986ffc177267488a4bd19d"></a>
|
||
|
<div class="memitem">
|
||
|
<div class="memproto">
|
||
|
<table class="memname">
|
||
|
<tr>
|
||
|
<td class="memname">void gpio_mode </td>
|
||
|
<td>(</td>
|
||
|
<td class="paramtype">gpio_t * </td>
|
||
|
<td class="paramname"><em>obj</em>, </td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td class="paramkey"></td>
|
||
|
<td></td>
|
||
|
<td class="paramtype">PinMode </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>Set GPIO mode. </p>
|
||
|
<dl class="params"><dt>Parameters</dt><dd>
|
||
|
<table class="params">
|
||
|
<tr><td class="paramname">obj</td><td>gpio object define in application software. </td></tr>
|
||
|
<tr><td class="paramname">mode</td><td>this parameter can be one of the following values: <ul>
|
||
|
<li>PullNone: HighZ, user can input high or low use this pin </li>
|
||
|
<li>OpenDrain(is OpenDrain output): no pull + OUT + GPIO[gpio_bit] = 0 </li>
|
||
|
<li>PullDown: pull down </li>
|
||
|
<li>PullUp: pull up </li>
|
||
|
</ul>
|
||
|
</td></tr>
|
||
|
</table>
|
||
|
</dd>
|
||
|
</dl>
|
||
|
<dl class="retval"><dt>Return values</dt><dd>
|
||
|
<table class="retval">
|
||
|
<tr><td class="paramname">none</td><td></td></tr>
|
||
|
</table>
|
||
|
</dd>
|
||
|
</dl>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
<a class="anchor" id="gabb97298a1eb6f6c11b6290abe7a1823b"></a>
|
||
|
<div class="memitem">
|
||
|
<div class="memproto">
|
||
|
<table class="memname">
|
||
|
<tr>
|
||
|
<td class="memname">int gpio_read </td>
|
||
|
<td>(</td>
|
||
|
<td class="paramtype">gpio_t * </td>
|
||
|
<td class="paramname"><em>obj</em></td><td>)</td>
|
||
|
<td></td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</div><div class="memdoc">
|
||
|
|
||
|
<p>Reads the specified gpio port pin. </p>
|
||
|
<dl class="params"><dt>Parameters</dt><dd>
|
||
|
<table class="params">
|
||
|
<tr><td class="paramname">obj</td><td>gpio object define in application software. </td></tr>
|
||
|
</table>
|
||
|
</dd>
|
||
|
</dl>
|
||
|
<dl class="retval"><dt>Return values</dt><dd>
|
||
|
<table class="retval">
|
||
|
<tr><td class="paramname">1</td><td>pin state is high </td></tr>
|
||
|
<tr><td class="paramname">0</td><td>pin state is low </td></tr>
|
||
|
</table>
|
||
|
</dd>
|
||
|
</dl>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
<a class="anchor" id="gae7303f79f43bab40cf7fdb0e7f596d5b"></a>
|
||
|
<div class="memitem">
|
||
|
<div class="memproto">
|
||
|
<table class="memname">
|
||
|
<tr>
|
||
|
<td class="memname">uint32_t gpio_set </td>
|
||
|
<td>(</td>
|
||
|
<td class="paramtype">PinName </td>
|
||
|
<td class="paramname"><em>pin</em></td><td>)</td>
|
||
|
<td></td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</div><div class="memdoc">
|
||
|
|
||
|
<p>Set the given pin as GPIO. </p>
|
||
|
<dl class="params"><dt>Parameters</dt><dd>
|
||
|
<table class="params">
|
||
|
<tr><td class="paramname">pin</td><td>PinName according to pinmux spec. </td></tr>
|
||
|
</table>
|
||
|
</dd>
|
||
|
</dl>
|
||
|
<dl class="retval"><dt>Return values</dt><dd>
|
||
|
<table class="retval">
|
||
|
<tr><td class="paramname"></td><td>The given pin with GPIO function </td></tr>
|
||
|
</table>
|
||
|
</dd>
|
||
|
</dl>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
<a class="anchor" id="gaedd478762e37aeafcf9ade8e255718b0"></a>
|
||
|
<div class="memitem">
|
||
|
<div class="memproto">
|
||
|
<table class="memname">
|
||
|
<tr>
|
||
|
<td class="memname">void gpio_write </td>
|
||
|
<td>(</td>
|
||
|
<td class="paramtype">gpio_t * </td>
|
||
|
<td class="paramname"><em>obj</em>, </td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td class="paramkey"></td>
|
||
|
<td></td>
|
||
|
<td class="paramtype">int </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>Sets value to the selected output port pin. </p>
|
||
|
<dl class="params"><dt>Parameters</dt><dd>
|
||
|
<table class="params">
|
||
|
<tr><td class="paramname">obj</td><td>gpio object define in application software. </td></tr>
|
||
|
<tr><td class="paramname">value</td><td>specifies the value to be written to the selected pin This parameter can be one of the following values: <ul>
|
||
|
<li>0: Pin state set to low </li>
|
||
|
<li>1: Pin state set to high </li>
|
||
|
</ul>
|
||
|
</td></tr>
|
||
|
</table>
|
||
|
</dd>
|
||
|
</dl>
|
||
|
<dl class="retval"><dt>Return values</dt><dd>
|
||
|
<table class="retval">
|
||
|
<tr><td class="paramname">none</td><td></td></tr>
|
||
|
</table>
|
||
|
</dd>
|
||
|
</dl>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
</div><!-- contents -->
|
||
|
<!-- start footer part -->
|
||
|
<hr class="footer"/><address class="footer"><small>
|
||
|
Generated by  <a href="http://www.doxygen.org/index.html">
|
||
|
<img class="footer" src="doxygen.png" alt="doxygen"/>
|
||
|
</a> 1.8.11
|
||
|
</small></address>
|
||
|
</body>
|
||
|
</html>
|