sdk-ameba-v4.0b_without_nda.../doc/api_doc/group__spi.html

633 lines
26 KiB
HTML
Raw Normal View History

2017-10-15 06:36:37 +00:00
<!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: SPI</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="summary">
<a href="#enumval-members">Enumerator</a> </div>
<div class="headertitle">
<div class="title">SPI<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>spi functions
<a href="#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="member-group"></a>
AmebaZ Only</h2></td></tr>
<tr class="memitem:ga023647011a0293a9aec1ca409f0013a6"><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__spi.html#ga023647011a0293a9aec1ca409f0013a6">MBED_SPI_IDX</a> { <a class="el" href="group__spi.html#gga023647011a0293a9aec1ca409f0013a6a5587575d5370281420a98eec392cfcf2">MBED_SPI0</a> = 0xF0,
<a class="el" href="group__spi.html#gga023647011a0293a9aec1ca409f0013a6a6e42ebc26db25ba9229b81954bab191b">MBED_SPI1</a> = 0xF1
}</td></tr>
<tr class="separator:ga023647011a0293a9aec1ca409f0013a6"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><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:ga4cb81928404a245a42be8e5f1607d6ab"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga4cb81928404a245a42be8e5f1607d6ab"></a>
typedef struct spi_s&#160;</td><td class="memItemRight" valign="bottom"><b>spi_t</b></td></tr>
<tr class="separator:ga4cb81928404a245a42be8e5f1607d6ab"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga967f9b6d5aa1172b30bb9aad3ebaab5a"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__spi.html#ga967f9b6d5aa1172b30bb9aad3ebaab5a">spi_init</a> (spi_t *obj, PinName mosi, PinName miso, PinName sclk, PinName ssel)</td></tr>
<tr class="memdesc:ga967f9b6d5aa1172b30bb9aad3ebaab5a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initializes the SPI device, include clock/function/interrupt/SPI registers. <a href="#ga967f9b6d5aa1172b30bb9aad3ebaab5a">More...</a><br /></td></tr>
<tr class="separator:ga967f9b6d5aa1172b30bb9aad3ebaab5a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga4a4e5102358b798793ca4f7ce2684506"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__spi.html#ga4a4e5102358b798793ca4f7ce2684506">spi_free</a> (spi_t *obj)</td></tr>
<tr class="memdesc:ga4a4e5102358b798793ca4f7ce2684506"><td class="mdescLeft">&#160;</td><td class="mdescRight">Deinitializes the SPI device, include interrupt/DMA/DISABLE SPI. <a href="#ga4a4e5102358b798793ca4f7ce2684506">More...</a><br /></td></tr>
<tr class="separator:ga4a4e5102358b798793ca4f7ce2684506"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gac07f1958da27a87ac2bc24fb76d9bf49"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__spi.html#gac07f1958da27a87ac2bc24fb76d9bf49">spi_format</a> (spi_t *obj, int bits, int mode, int slave)</td></tr>
<tr class="memdesc:gac07f1958da27a87ac2bc24fb76d9bf49"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set SPI format,include DFS/Phase/Polarity. <a href="#gac07f1958da27a87ac2bc24fb76d9bf49">More...</a><br /></td></tr>
<tr class="separator:gac07f1958da27a87ac2bc24fb76d9bf49"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga3ee20485d85ce03cb375b35040aa7098"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__spi.html#ga3ee20485d85ce03cb375b35040aa7098">spi_frequency</a> (spi_t *obj, int hz)</td></tr>
<tr class="memdesc:ga3ee20485d85ce03cb375b35040aa7098"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set SPI baudrate. <a href="#ga3ee20485d85ce03cb375b35040aa7098">More...</a><br /></td></tr>
<tr class="separator:ga3ee20485d85ce03cb375b35040aa7098"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga57530c123fbe845f1dd49a6527748bdc"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__spi.html#ga57530c123fbe845f1dd49a6527748bdc">spi_master_write</a> (spi_t *obj, int value)</td></tr>
<tr class="memdesc:ga57530c123fbe845f1dd49a6527748bdc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Master send one frame use SPI. <a href="#ga57530c123fbe845f1dd49a6527748bdc">More...</a><br /></td></tr>
<tr class="separator:ga57530c123fbe845f1dd49a6527748bdc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga7d1a0491debf0cda5af5e28694644680"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__spi.html#ga7d1a0491debf0cda5af5e28694644680">spi_slave_receive</a> (spi_t *obj)</td></tr>
<tr class="memdesc:ga7d1a0491debf0cda5af5e28694644680"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get slave readable &amp;&amp; busy state. <a href="#ga7d1a0491debf0cda5af5e28694644680">More...</a><br /></td></tr>
<tr class="separator:ga7d1a0491debf0cda5af5e28694644680"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga0e57d193ffd7a4a2560a119442eb3ce4"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__spi.html#ga0e57d193ffd7a4a2560a119442eb3ce4">spi_slave_read</a> (spi_t *obj)</td></tr>
<tr class="memdesc:ga0e57d193ffd7a4a2560a119442eb3ce4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Slave receive one frame use SPI. <a href="#ga0e57d193ffd7a4a2560a119442eb3ce4">More...</a><br /></td></tr>
<tr class="separator:ga0e57d193ffd7a4a2560a119442eb3ce4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga418f2ee3e2c97988d0699be5e7c3743f"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__spi.html#ga418f2ee3e2c97988d0699be5e7c3743f">spi_slave_write</a> (spi_t *obj, int value)</td></tr>
<tr class="memdesc:ga418f2ee3e2c97988d0699be5e7c3743f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Slave send one frame use SPI. <a href="#ga418f2ee3e2c97988d0699be5e7c3743f">More...</a><br /></td></tr>
<tr class="separator:ga418f2ee3e2c97988d0699be5e7c3743f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga2096773c147c0a2d337bb38562b5f5bd"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__spi.html#ga2096773c147c0a2d337bb38562b5f5bd">spi_busy</a> (spi_t *obj)</td></tr>
<tr class="memdesc:ga2096773c147c0a2d337bb38562b5f5bd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get SPI busy state. <a href="#ga2096773c147c0a2d337bb38562b5f5bd">More...</a><br /></td></tr>
<tr class="separator:ga2096773c147c0a2d337bb38562b5f5bd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga8281edfbe5d7d0fca234ccab5c1b9389"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__spi.html#ga8281edfbe5d7d0fca234ccab5c1b9389">spi_flush_rx_fifo</a> (spi_t *obj)</td></tr>
<tr class="memdesc:ga8281edfbe5d7d0fca234ccab5c1b9389"><td class="mdescLeft">&#160;</td><td class="mdescRight">SPI device to flush rx fifo. <a href="#ga8281edfbe5d7d0fca234ccab5c1b9389">More...</a><br /></td></tr>
<tr class="separator:ga8281edfbe5d7d0fca234ccab5c1b9389"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga48c2f03906f1033438a65d57c0329713"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__spi.html#ga48c2f03906f1033438a65d57c0329713">spi_enable</a> (spi_t *obj)</td></tr>
<tr class="memdesc:ga48c2f03906f1033438a65d57c0329713"><td class="mdescLeft">&#160;</td><td class="mdescRight">Open SPI device clock. <a href="#ga48c2f03906f1033438a65d57c0329713">More...</a><br /></td></tr>
<tr class="separator:ga48c2f03906f1033438a65d57c0329713"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga81afba468e501f5e94dcdff3d636ce6f"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__spi.html#ga81afba468e501f5e94dcdff3d636ce6f">spi_disable</a> (spi_t *obj)</td></tr>
<tr class="memdesc:ga81afba468e501f5e94dcdff3d636ce6f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Close SPI device clock. <a href="#ga81afba468e501f5e94dcdff3d636ce6f">More...</a><br /></td></tr>
<tr class="separator:ga81afba468e501f5e94dcdff3d636ce6f"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>spi functions </p>
<h2 class="groupheader">Enumeration Type Documentation</h2>
<a class="anchor" id="ga023647011a0293a9aec1ca409f0013a6"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">enum <a class="el" href="group__spi.html#ga023647011a0293a9aec1ca409f0013a6">MBED_SPI_IDX</a></td>
</tr>
</table>
</div><div class="memdoc">
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a class="anchor" id="gga023647011a0293a9aec1ca409f0013a6a5587575d5370281420a98eec392cfcf2"></a>MBED_SPI0&#160;</td><td class="fielddoc">
<p>means SPI0 </p>
</td></tr>
<tr><td class="fieldname"><a class="anchor" id="gga023647011a0293a9aec1ca409f0013a6a6e42ebc26db25ba9229b81954bab191b"></a>MBED_SPI1&#160;</td><td class="fielddoc">
<p>means SPI1 </p>
</td></tr>
</table>
</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="ga2096773c147c0a2d337bb38562b5f5bd"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int spi_busy </td>
<td>(</td>
<td class="paramtype">spi_t *&#160;</td>
<td class="paramname"><em>obj</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Get SPI busy state. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>spi 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>current busy state </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="ga81afba468e501f5e94dcdff3d636ce6f"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void spi_disable </td>
<td>(</td>
<td class="paramtype">spi_t *&#160;</td>
<td class="paramname"><em>obj</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Close SPI device clock. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>spi 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>
</div>
</div>
<a class="anchor" id="ga48c2f03906f1033438a65d57c0329713"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void spi_enable </td>
<td>(</td>
<td class="paramtype">spi_t *&#160;</td>
<td class="paramname"><em>obj</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Open SPI device clock. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>spi 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>
</div>
</div>
<a class="anchor" id="ga8281edfbe5d7d0fca234ccab5c1b9389"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void spi_flush_rx_fifo </td>
<td>(</td>
<td class="paramtype">spi_t *&#160;</td>
<td class="paramname"><em>obj</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>SPI device to flush rx fifo. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>spi 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>
</div>
</div>
<a class="anchor" id="gac07f1958da27a87ac2bc24fb76d9bf49"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void spi_format </td>
<td>(</td>
<td class="paramtype">spi_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>bits</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>mode</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>slave</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Set SPI format,include DFS/Phase/Polarity. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>spi object define in application software. </td></tr>
<tr><td class="paramname">bits</td><td>data frame size, 4-16 supported. </td></tr>
<tr><td class="paramname">mode</td><td>this parameter can be one of the following values: <ul>
<li>0 : [Polarity,Phase]=[0,0] </li>
<li>1 : [Polarity,Phase]=[0,1] </li>
<li>2 : [Polarity,Phase]=[1,0] </li>
<li>3 : [Polarity,Phase]=[1,1] </li>
</ul>
</td></tr>
<tr><td class="paramname">slave</td><td>this parameter can be one of the following values: <ul>
<li>0 : indicates role-master </li>
<li>1 : indicates role-slave </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="ga4a4e5102358b798793ca4f7ce2684506"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void spi_free </td>
<td>(</td>
<td class="paramtype">spi_t *&#160;</td>
<td class="paramname"><em>obj</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Deinitializes the SPI device, include interrupt/DMA/DISABLE SPI. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>spi 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>
</div>
</div>
<a class="anchor" id="ga3ee20485d85ce03cb375b35040aa7098"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void spi_frequency </td>
<td>(</td>
<td class="paramtype">spi_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>hz</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Set SPI baudrate. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>spi master object define in application software. </td></tr>
<tr><td class="paramname">hz</td><td>baudrate for SPI bus </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>"hz" should be less or equal to half of the SPI IpClk </dd></dl>
</div>
</div>
<a class="anchor" id="ga967f9b6d5aa1172b30bb9aad3ebaab5a"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void spi_init </td>
<td>(</td>
<td class="paramtype">spi_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>mosi</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">PinName&#160;</td>
<td class="paramname"><em>miso</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">PinName&#160;</td>
<td class="paramname"><em>sclk</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">PinName&#160;</td>
<td class="paramname"><em>ssel</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Initializes the SPI device, include clock/function/interrupt/SPI registers. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>spi object define in application software. </td></tr>
<tr><td class="paramname">mosi</td><td>MOSI PinName according to pinmux spec. </td></tr>
<tr><td class="paramname">miso</td><td>MISO PinName according to pinmux spec. </td></tr>
<tr><td class="paramname">sclk</td><td>SCLK PinName according to pinmux spec. </td></tr>
<tr><td class="paramname">ssel</td><td>CS 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>
<dl class="section note"><dt>Note</dt><dd>must set obj-&gt;spi_index to MBED_SPI0 or MBED_SPI1 before using spi_init </dd></dl>
</div>
</div>
<a class="anchor" id="ga57530c123fbe845f1dd49a6527748bdc"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int spi_master_write </td>
<td>(</td>
<td class="paramtype">spi_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>value</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Master send one frame use SPI. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>spi master object define in application software. </td></tr>
<tr><td class="paramname">value</td><td>the data to transmit. </td></tr>
</table>
</dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
<tr><td class="paramname"></td><td>data received from slave </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="ga0e57d193ffd7a4a2560a119442eb3ce4"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int spi_slave_read </td>
<td>(</td>
<td class="paramtype">spi_t *&#160;</td>
<td class="paramname"><em>obj</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Slave receive one frame use SPI. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>spi slave 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>data received from master </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="ga7d1a0491debf0cda5af5e28694644680"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int spi_slave_receive </td>
<td>(</td>
<td class="paramtype">spi_t *&#160;</td>
<td class="paramname"><em>obj</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Get slave readable &amp;&amp; busy state. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>spi slave 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>slave Readable &amp;&amp; Busy State </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="ga418f2ee3e2c97988d0699be5e7c3743f"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void spi_slave_write </td>
<td>(</td>
<td class="paramtype">spi_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>value</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Slave send one frame use SPI. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>spi slave object define in application software. </td></tr>
<tr><td class="paramname">value</td><td>the data to transmit. </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>