sdk-ameba-v4.0b_without_nda.../doc/api_doc/group__pwm.html
2017-10-15 14:36:37 +08:00

529 lines
22 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>SDK4.0: PWM</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">SDK4.0
</div>
<div id="projectbrief">This document shows Ameba SDK 4.0 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&#160;Page</span></a></li>
<li class="current"><a href="modules.html"><span>Modules</span></a></li>
<li><a href="annotated.html"><span>Data&#160;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">PWM<div class="ingroups"><a class="el" href="group__sdk.html">Ameba SDK</a> &raquo; <a class="el" href="group__hal.html">HAL</a></div></div> </div>
</div><!--header-->
<div class="contents">
<p>pwm 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:ga6609ec508d3754cc47e6b771cbdca74d"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga6609ec508d3754cc47e6b771cbdca74d"></a>
typedef struct pwmout_s&#160;</td><td class="memItemRight" valign="bottom"><b>pwmout_t</b></td></tr>
<tr class="separator:ga6609ec508d3754cc47e6b771cbdca74d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga22ca92d9da21dff383a56b5b9c93ec26"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__pwm.html#ga22ca92d9da21dff383a56b5b9c93ec26">pwmout_init</a> (pwmout_t *obj, PinName pin)</td></tr>
<tr class="memdesc:ga22ca92d9da21dff383a56b5b9c93ec26"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initializes the PWM function/registers of the specified pin with default parameters. <a href="#ga22ca92d9da21dff383a56b5b9c93ec26">More...</a><br /></td></tr>
<tr class="separator:ga22ca92d9da21dff383a56b5b9c93ec26"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga845e5ad41ff502afabe60843652629ac"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__pwm.html#ga845e5ad41ff502afabe60843652629ac">pwmout_free</a> (pwmout_t *obj)</td></tr>
<tr class="memdesc:ga845e5ad41ff502afabe60843652629ac"><td class="mdescLeft">&#160;</td><td class="mdescRight">Deinitializes the PWM device of the specified channel. <a href="#ga845e5ad41ff502afabe60843652629ac">More...</a><br /></td></tr>
<tr class="separator:ga845e5ad41ff502afabe60843652629ac"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga003b71531bdbe5909c2610abb31ff359"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__pwm.html#ga003b71531bdbe5909c2610abb31ff359">pwmout_write</a> (pwmout_t *obj, float percent)</td></tr>
<tr class="memdesc:ga003b71531bdbe5909c2610abb31ff359"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the duty cycle of the specified channel. <a href="#ga003b71531bdbe5909c2610abb31ff359">More...</a><br /></td></tr>
<tr class="separator:ga003b71531bdbe5909c2610abb31ff359"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga64333f03eb44bb9eb7e0585c1c9cfada"><td class="memItemLeft" align="right" valign="top">float&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__pwm.html#ga64333f03eb44bb9eb7e0585c1c9cfada">pwmout_read</a> (pwmout_t *obj)</td></tr>
<tr class="memdesc:ga64333f03eb44bb9eb7e0585c1c9cfada"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the duty cycle value of the specified channel. <a href="#ga64333f03eb44bb9eb7e0585c1c9cfada">More...</a><br /></td></tr>
<tr class="separator:ga64333f03eb44bb9eb7e0585c1c9cfada"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gabfde33a9e4babe7cea1fdb86f2a44242"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__pwm.html#gabfde33a9e4babe7cea1fdb86f2a44242">pwmout_period</a> (pwmout_t *obj, float seconds)</td></tr>
<tr class="memdesc:gabfde33a9e4babe7cea1fdb86f2a44242"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the period of the specified channel in seconds. <a href="#gabfde33a9e4babe7cea1fdb86f2a44242">More...</a><br /></td></tr>
<tr class="separator:gabfde33a9e4babe7cea1fdb86f2a44242"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gac4c0b2e560746d320bb762920df98724"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__pwm.html#gac4c0b2e560746d320bb762920df98724">pwmout_period_ms</a> (pwmout_t *obj, int ms)</td></tr>
<tr class="memdesc:gac4c0b2e560746d320bb762920df98724"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the period of the specified channel in millseconds. <a href="#gac4c0b2e560746d320bb762920df98724">More...</a><br /></td></tr>
<tr class="separator:gac4c0b2e560746d320bb762920df98724"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga2724962892f5fa07799fdc0e5dee3cc5"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__pwm.html#ga2724962892f5fa07799fdc0e5dee3cc5">pwmout_period_us</a> (pwmout_t *obj, int us)</td></tr>
<tr class="memdesc:ga2724962892f5fa07799fdc0e5dee3cc5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the period of the specified channel in microseconds. <a href="#ga2724962892f5fa07799fdc0e5dee3cc5">More...</a><br /></td></tr>
<tr class="separator:ga2724962892f5fa07799fdc0e5dee3cc5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaaaed83e37b0e1c7bc291e09a943f8088"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__pwm.html#gaaaed83e37b0e1c7bc291e09a943f8088">pwmout_pulsewidth</a> (pwmout_t *obj, float seconds)</td></tr>
<tr class="memdesc:gaaaed83e37b0e1c7bc291e09a943f8088"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the pulse width of the specified channel in seconds. <a href="#gaaaed83e37b0e1c7bc291e09a943f8088">More...</a><br /></td></tr>
<tr class="separator:gaaaed83e37b0e1c7bc291e09a943f8088"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga07f0505dc979159073a0b35d29fb2094"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__pwm.html#ga07f0505dc979159073a0b35d29fb2094">pwmout_pulsewidth_ms</a> (pwmout_t *obj, int ms)</td></tr>
<tr class="memdesc:ga07f0505dc979159073a0b35d29fb2094"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the pulse width of the specified channel in milliseconds. <a href="#ga07f0505dc979159073a0b35d29fb2094">More...</a><br /></td></tr>
<tr class="separator:ga07f0505dc979159073a0b35d29fb2094"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gacd728677762b944897d0d5d304a4a4a4"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__pwm.html#gacd728677762b944897d0d5d304a4a4a4">pwmout_pulsewidth_us</a> (pwmout_t *obj, int us)</td></tr>
<tr class="memdesc:gacd728677762b944897d0d5d304a4a4a4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the pulse width of the specified channel in microseconds. <a href="#gacd728677762b944897d0d5d304a4a4a4">More...</a><br /></td></tr>
<tr class="separator:gacd728677762b944897d0d5d304a4a4a4"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>pwm functions </p>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="ga845e5ad41ff502afabe60843652629ac"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void pwmout_free </td>
<td>(</td>
<td class="paramtype">pwmout_t *&#160;</td>
<td class="paramname"><em>obj</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Deinitializes the PWM device of the specified channel. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>PWM 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">none</td><td></td></tr>
</table>
</dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>If all channels are released, TIM5 will also be disabled. </dd></dl>
</div>
</div>
<a class="anchor" id="ga22ca92d9da21dff383a56b5b9c93ec26"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void pwmout_init </td>
<td>(</td>
<td class="paramtype">pwmout_t *&#160;</td>
<td class="paramname"><em>obj</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">PinName&#160;</td>
<td class="paramname"><em>pin</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Initializes the PWM function/registers of the specified pin with default parameters. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>PWM object define in application software. </td></tr>
<tr><td class="paramname">pin</td><td>the pinname of specified channel to be set. </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>
<dl class="section note"><dt>Note</dt><dd><ul>
<li>default period: 1638us</li>
<li>default pulse width: 102us</li>
<li>default duty cycle: 6.227% </li>
</ul>
</dd></dl>
</div>
</div>
<a class="anchor" id="gabfde33a9e4babe7cea1fdb86f2a44242"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void pwmout_period </td>
<td>(</td>
<td class="paramtype">pwmout_t *&#160;</td>
<td class="paramname"><em>obj</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">float&#160;</td>
<td class="paramname"><em>seconds</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Set the period of the specified channel in seconds. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>PWM object define in application software. </td></tr>
<tr><td class="paramname">seconds</td><td>The period value to be set in seconds. </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="gac4c0b2e560746d320bb762920df98724"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void pwmout_period_ms </td>
<td>(</td>
<td class="paramtype">pwmout_t *&#160;</td>
<td class="paramname"><em>obj</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>ms</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Set the period of the specified channel in millseconds. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>PWM object define in application software. </td></tr>
<tr><td class="paramname">ms</td><td>The period value to be set in millseconds. </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="ga2724962892f5fa07799fdc0e5dee3cc5"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void pwmout_period_us </td>
<td>(</td>
<td class="paramtype">pwmout_t *&#160;</td>
<td class="paramname"><em>obj</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>us</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Set the period of the specified channel in microseconds. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>PWM object define in application software. </td></tr>
<tr><td class="paramname">us</td><td>The period value to be set in microseconds. </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="gaaaed83e37b0e1c7bc291e09a943f8088"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void pwmout_pulsewidth </td>
<td>(</td>
<td class="paramtype">pwmout_t *&#160;</td>
<td class="paramname"><em>obj</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">float&#160;</td>
<td class="paramname"><em>seconds</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Set the pulse width of the specified channel in seconds. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>PWM object define in application software. </td></tr>
<tr><td class="paramname">seconds</td><td>The pulse width value to be set in seconds. </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="ga07f0505dc979159073a0b35d29fb2094"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void pwmout_pulsewidth_ms </td>
<td>(</td>
<td class="paramtype">pwmout_t *&#160;</td>
<td class="paramname"><em>obj</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>ms</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Set the pulse width of the specified channel in milliseconds. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>PWM object define in application software. </td></tr>
<tr><td class="paramname">ms</td><td>The pulse width value to be set in milliseconds. </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="gacd728677762b944897d0d5d304a4a4a4"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void pwmout_pulsewidth_us </td>
<td>(</td>
<td class="paramtype">pwmout_t *&#160;</td>
<td class="paramname"><em>obj</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>us</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Set the pulse width of the specified channel in microseconds. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>PWM object define in application software. </td></tr>
<tr><td class="paramname">us</td><td>The pulse width value to be set in microseconds. </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="ga64333f03eb44bb9eb7e0585c1c9cfada"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">float pwmout_read </td>
<td>(</td>
<td class="paramtype">pwmout_t *&#160;</td>
<td class="paramname"><em>obj</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Get the duty cycle value of the specified channel. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>PWM 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"></td><td>the duty cycle value of the specified channel. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="ga003b71531bdbe5909c2610abb31ff359"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void pwmout_write </td>
<td>(</td>
<td class="paramtype">pwmout_t *&#160;</td>
<td class="paramname"><em>obj</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">float&#160;</td>
<td class="paramname"><em>percent</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Set the duty cycle of the specified channel. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>PWM object define in application software. </td></tr>
<tr><td class="paramname">percent</td><td>The duty cycle value to be set. </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 &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.11
</small></address>
</body>
</html>