first commit
This commit is contained in:
commit
92cbe97616
1978 files changed
+1688498
No files matched your search
@@ -0,0 +1,221 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||
<meta name="generator" content="Doxygen 1.13.2"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>LibL6474-C-Library: Stepper Library Lib6474</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>
|
||||
<script type="text/javascript" src="clipboard.js"></script>
|
||||
<link href="navtree.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="navtreedata.js"></script>
|
||||
<script type="text/javascript" src="navtree.js"></script>
|
||||
<script type="text/javascript" src="resize.js"></script>
|
||||
<script type="text/javascript" src="cookie.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>
|
||||
<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 id="projectrow">
|
||||
<td id="projectlogo"><img alt="Logo" src="banner.png"/></td>
|
||||
<td id="projectalign">
|
||||
<div id="projectname">LibL6474-C-Library<span id="projectnumber"> 1.0</span>
|
||||
</div>
|
||||
<div id="projectbrief">Library Code documentation</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.13.2 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "search/",'.html');
|
||||
/* @license-end */
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(function() { codefold.init(0); });
|
||||
/* @license-end */
|
||||
</script>
|
||||
<script type="text/javascript" src="menudata.js"></script>
|
||||
<script type="text/javascript" src="menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(function() {
|
||||
initMenu('',true,false,'search.php','Search',true);
|
||||
$(function() { init_search(); });
|
||||
});
|
||||
/* @license-end */
|
||||
</script>
|
||||
<div id="main-nav"></div>
|
||||
</div><!-- top -->
|
||||
<div id="side-nav" class="ui-resizable side-nav-resizable">
|
||||
<div id="nav-tree">
|
||||
<div id="nav-tree-contents">
|
||||
<div id="nav-sync" class="sync"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="splitbar" style="-moz-user-select:none;"
|
||||
class="ui-resizable-handle">
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(function(){initNavTree('index.html',''); initResizable(true); });
|
||||
/* @license-end */
|
||||
</script>
|
||||
<div id="doc-content">
|
||||
<!-- 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">
|
||||
<div id="MSearchResults">
|
||||
<div class="SRPage">
|
||||
<div id="SRIndex">
|
||||
<div id="SRResults"></div>
|
||||
<div class="SRStatus" id="Loading">Loading...</div>
|
||||
<div class="SRStatus" id="Searching">Searching...</div>
|
||||
<div class="SRStatus" id="NoMatches">No Matches</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div><div class="header">
|
||||
<div class="headertitle"><div class="title">Stepper Library Lib6474 </div></div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
<div class="textblock"><h1><a class="anchor" id="intro_sec"></a>
|
||||
Introduction</h1>
|
||||
<p>The following code documentation is a set of tips and diagrams as well as function and structure descriptions which help when using the library. It is used to increase the implementation speed. Some examples are attached in this documentation as well</p>
|
||||
<h1><a class="anchor" id="install_sec"></a>
|
||||
Static compile flags</h1>
|
||||
<p>LIBL6474_STEP_ASYNC: This DEFINE is used to switch from blocking synchronous mode to asynchronous non-blocking step mode. This changes the API behavior</p>
|
||||
<p>LIBL6474_HAS_LOCKING: This DEFINE is used to enable the lock guard and thread synchronization guard abstraction, which requires additional abstraction functions</p>
|
||||
<p>LIBL6474_DISABLE_OCD: Should only be used for debugging purposes and not for productive code! This DEFINE is used to disable the overcurrent detection feature in the library and the stepper driver</p>
|
||||
<p>LIBL6474_HAS_FLAG: enables the support of the flag pin This DEFINE is used to enable the FLAG pin support, which requires additional abstraction functions</p>
|
||||
<h1><a class="anchor" id="state_sec"></a>
|
||||
State diagram</h1>
|
||||
<p>The following state diagram shows the internal state machine handling which follows or represents the state of the stepper driver chip. The fault conditions are not depicted in the diagram but in all regular cases the error handling is done by resetting and reinitialization of the stepper driver by the library.</p>
|
||||
<div class="dotgraph">
|
||||
<img src="dot_inline_dotgraph_1.png" alt="dot_inline_dotgraph_1.png" border="0" usemap="#dot_inline_dotgraph_1.map"/>
|
||||
</div>
|
||||
<h1><a class="anchor" id="state_example"></a>
|
||||
Examples</h1>
|
||||
<p>The following example shows a part of the abstraction functions which are required for the usage of the Stepper library. It also shows how to create a instance of the stepper library. </p><div class="fragment"><div class="line"><span class="keyword">static</span> <span class="keywordtype">void</span>* StepLibraryMalloc( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> size )</div>
|
||||
<div class="line">{</div>
|
||||
<div class="line"> <span class="keywordflow">return</span> malloc(size);</div>
|
||||
<div class="line">}</div>
|
||||
<div class="line"> </div>
|
||||
<div class="line"><span class="keyword">static</span> <span class="keywordtype">void</span> StepLibraryFree( <span class="keyword">const</span> <span class="keywordtype">void</span>* <span class="keyword">const</span> ptr )</div>
|
||||
<div class="line">{</div>
|
||||
<div class="line"> free((<span class="keywordtype">void</span>*)ptr);</div>
|
||||
<div class="line">}</div>
|
||||
<div class="line"> </div>
|
||||
<div class="line"><span class="keyword">static</span> <span class="keywordtype">int</span> StepDriverSpiTransfer( <span class="keywordtype">void</span>* pIO, <span class="keywordtype">char</span>* pRX, <span class="keyword">const</span> <span class="keywordtype">char</span>* pTX, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length )</div>
|
||||
<div class="line">{</div>
|
||||
<div class="line"> <span class="comment">// byte based access, so keep in mind that only single byte transfers are performed!</span></div>
|
||||
<div class="line"> <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i = 0; i < length; i++ )</div>
|
||||
<div class="line"> {</div>
|
||||
<div class="line"> ...</div>
|
||||
<div class="line"> }</div>
|
||||
<div class="line"> <span class="keywordflow">return</span> 0;</div>
|
||||
<div class="line">}</div>
|
||||
<div class="line"> </div>
|
||||
<div class="line">...</div>
|
||||
<div class="line"> </div>
|
||||
<div class="line"><span class="comment">// pass all function pointers required by the stepper library</span></div>
|
||||
<div class="line"><span class="comment">// to a separate platform abstraction structure</span></div>
|
||||
<div class="line">L6474x_Platform_t p;</div>
|
||||
<div class="line">p.malloc = StepLibraryMalloc;</div>
|
||||
<div class="line">p.free = StepLibraryFree;</div>
|
||||
<div class="line">p.transfer = StepDriverSpiTransfer;</div>
|
||||
<div class="line">p.reset = StepDriverReset;</div>
|
||||
<div class="line">p.sleep = StepLibraryDelay;</div>
|
||||
<div class="line">p.stepAsync = StepTimerAsync;</div>
|
||||
<div class="line">p.cancelStep = StepTimerCancelAsync;</div>
|
||||
<div class="line"> </div>
|
||||
<div class="line"><span class="comment">// now create the handle</span></div>
|
||||
<div class="line"><a class="code hl_typedef" href="LibL6474_8h.html#a31a0c627342d952d0dddf3fbe0643cac">L6474_Handle_t</a> h = <a class="code hl_function" href="LibL6474x_8c.html#a86f889135167d8b4e889c620d0bf9990">L6474_CreateInstance</a>(&p, null, null, null); </div>
|
||||
<div class="ttc" id="aLibL6474_8h_html_a31a0c627342d952d0dddf3fbe0643cac"><div class="ttname"><a href="LibL6474_8h.html#a31a0c627342d952d0dddf3fbe0643cac">L6474_Handle_t</a></div><div class="ttdeci">struct L6474_Handle * L6474_Handle_t</div><div class="ttdef"><b>Definition</b> LibL6474.h:258</div></div>
|
||||
<div class="ttc" id="aLibL6474x_8c_html_a86f889135167d8b4e889c620d0bf9990"><div class="ttname"><a href="LibL6474x_8c.html#a86f889135167d8b4e889c620d0bf9990">L6474_CreateInstance</a></div><div class="ttdeci">L6474_Handle_t L6474_CreateInstance(L6474x_Platform_t *p, void *pIO, void *pGPO, void *pPWM)</div><div class="ttdef"><b>Definition</b> LibL6474x.c:440</div></div>
|
||||
</div><!-- fragment --><p>The following example shows a really simple instantiation and usage of the library with a simple default and straight forward configuration and no calculation of any step widths or resolutions</p>
|
||||
<div class="fragment"><div class="line">...</div>
|
||||
<div class="line"> </div>
|
||||
<div class="line">int result = 0;</div>
|
||||
<div class="line">...</div>
|
||||
<div class="line"> </div>
|
||||
<div class="line"><span class="comment">// reset all and take all initialization steps</span></div>
|
||||
<div class="line">result |= <a class="code hl_function" href="LibL6474x_8c.html#a9104da6893519c5eb0b33d56778fee2f">L6474_ResetStandBy</a>(h);</div>
|
||||
<div class="line">result |= <a class="code hl_function" href="LibL6474x_8c.html#a7b7f8efa1a972e53487d5cdfc8282784">L6474_Initialize</a>(h, &param);</div>
|
||||
<div class="line">result |= <a class="code hl_function" href="LibL6474x_8c.html#a18d8fb31625d8e3ee10fb37ff2054416">L6474_SetPowerOutputs</a>(h, 1);</div>
|
||||
<div class="line"> </div>
|
||||
<div class="line">...</div>
|
||||
<div class="line"> </div>
|
||||
<div class="line"><span class="comment">// in case we have no error, we can enable the drivers</span></div>
|
||||
<div class="line"><span class="comment">// and then we step a bit</span></div>
|
||||
<div class="line">if ( result == 0 )</div>
|
||||
<div class="line">{</div>
|
||||
<div class="line"> result |= <a class="code hl_function" href="LibL6474x_8c.html#aa4589feae28120554b6bdc708ee4e2e4">L6474_StepIncremental</a>(h, 1000 );</div>
|
||||
<div class="line">}</div>
|
||||
<div class="line"><span class="keywordflow">else</span></div>
|
||||
<div class="line">{</div>
|
||||
<div class="line"> <span class="comment">// error handling</span></div>
|
||||
<div class="line"> ...</div>
|
||||
<div class="line">}</div>
|
||||
<div class="line"> </div>
|
||||
<div class="line">...</div>
|
||||
<div class="ttc" id="aLibL6474x_8c_html_a18d8fb31625d8e3ee10fb37ff2054416"><div class="ttname"><a href="LibL6474x_8c.html#a18d8fb31625d8e3ee10fb37ff2054416">L6474_SetPowerOutputs</a></div><div class="ttdeci">int L6474_SetPowerOutputs(L6474_Handle_t h, int ena)</div><div class="ttdef"><b>Definition</b> LibL6474x.c:819</div></div>
|
||||
<div class="ttc" id="aLibL6474x_8c_html_a7b7f8efa1a972e53487d5cdfc8282784"><div class="ttname"><a href="LibL6474x_8c.html#a7b7f8efa1a972e53487d5cdfc8282784">L6474_Initialize</a></div><div class="ttdeci">int L6474_Initialize(L6474_Handle_t h, L6474_BaseParameter_t *p)</div><div class="ttdef"><b>Definition</b> LibL6474x.c:601</div></div>
|
||||
<div class="ttc" id="aLibL6474x_8c_html_a9104da6893519c5eb0b33d56778fee2f"><div class="ttname"><a href="LibL6474x_8c.html#a9104da6893519c5eb0b33d56778fee2f">L6474_ResetStandBy</a></div><div class="ttdeci">int L6474_ResetStandBy(L6474_Handle_t h)</div><div class="ttdef"><b>Definition</b> LibL6474x.c:521</div></div>
|
||||
<div class="ttc" id="aLibL6474x_8c_html_aa4589feae28120554b6bdc708ee4e2e4"><div class="ttname"><a href="LibL6474x_8c.html#aa4589feae28120554b6bdc708ee4e2e4">L6474_StepIncremental</a></div><div class="ttdeci">int L6474_StepIncremental(L6474_Handle_t h, int steps)</div><div class="ttdef"><b>Definition</b> LibL6474x.c:1283</div></div>
|
||||
</div><!-- fragment --><p>The following example shows how to change the phase current (max torque) of the stepper. This can be achieved by reinitializing the library or by changing the parameter by calling L6474_SetProperty;</p>
|
||||
<div class="fragment"><div class="line">...</div>
|
||||
<div class="line"> </div>
|
||||
<div class="line">int result = 0;</div>
|
||||
<div class="line">...</div>
|
||||
<div class="line"> </div>
|
||||
<div class="line"><span class="comment">// first way: set the torque on initialization</span></div>
|
||||
<div class="line">result |= <a class="code hl_function" href="LibL6474x_8c.html#a9104da6893519c5eb0b33d56778fee2f">L6474_ResetStandBy</a>(h);</div>
|
||||
<div class="line">result |= <a class="code hl_function" href="LibL6474x_8c.html#aa09b09b606dae725681f47cb44208df0">L6474_EncodePhaseCurrentParameter</a>(&param, 1200.0f);</div>
|
||||
<div class="line">result |= <a class="code hl_function" href="LibL6474x_8c.html#a7b7f8efa1a972e53487d5cdfc8282784">L6474_Initialize</a>(h, &param);</div>
|
||||
<div class="line"> </div>
|
||||
<div class="line">...</div>
|
||||
<div class="line"> </div>
|
||||
<div class="line"><span class="comment">// second way: set the torque after initialization</span></div>
|
||||
<div class="line">char torqueval = <a class="code hl_function" href="LibL6474x_8c.html#ab7a90876abaf436e55942909df4c3430">L6474_EncodePhaseCurrent</a>(1500.0f);</div>
|
||||
<div class="line">result |= <a class="code hl_function" href="LibL6474x_8c.html#ae15c095b47ecccc41e7dbecc4761c14d">L6474_SetProperty</a>(h, <a class="code hl_enumvalue" href="LibL6474_8h.html#a7dade050e47f1fea02eff190de585d22abccdf1a94c5d1a194f423948fcc35f8a">L6474_PROP_TORQUE</a>, torqueval);</div>
|
||||
<div class="line"> </div>
|
||||
<div class="line">...</div>
|
||||
<div class="ttc" id="aLibL6474_8h_html_a7dade050e47f1fea02eff190de585d22abccdf1a94c5d1a194f423948fcc35f8a"><div class="ttname"><a href="LibL6474_8h.html#a7dade050e47f1fea02eff190de585d22abccdf1a94c5d1a194f423948fcc35f8a">L6474_PROP_TORQUE</a></div><div class="ttdeci">@ L6474_PROP_TORQUE</div><div class="ttdef"><b>Definition</b> LibL6474.h:465</div></div>
|
||||
<div class="ttc" id="aLibL6474x_8c_html_aa09b09b606dae725681f47cb44208df0"><div class="ttname"><a href="LibL6474x_8c.html#aa09b09b606dae725681f47cb44208df0">L6474_EncodePhaseCurrentParameter</a></div><div class="ttdeci">int L6474_EncodePhaseCurrentParameter(L6474_BaseParameter_t *p, float mA)</div><div class="ttdef"><b>Definition</b> LibL6474x.c:591</div></div>
|
||||
<div class="ttc" id="aLibL6474x_8c_html_ab7a90876abaf436e55942909df4c3430"><div class="ttname"><a href="LibL6474x_8c.html#ab7a90876abaf436e55942909df4c3430">L6474_EncodePhaseCurrent</a></div><div class="ttdeci">char L6474_EncodePhaseCurrent(float mA)</div><div class="ttdef"><b>Definition</b> LibL6474x.c:581</div></div>
|
||||
<div class="ttc" id="aLibL6474x_8c_html_ae15c095b47ecccc41e7dbecc4761c14d"><div class="ttname"><a href="LibL6474x_8c.html#ae15c095b47ecccc41e7dbecc4761c14d">L6474_SetProperty</a></div><div class="ttdeci">int L6474_SetProperty(L6474_Handle_t h, L6474_Property_t prop, int value)</div><div class="ttdef"><b>Definition</b> LibL6474x.c:1086</div></div>
|
||||
</div><!-- fragment --> </div></div><!-- PageDoc -->
|
||||
<a href="doxygen_crawl.html"></a>
|
||||
</div><!-- contents -->
|
||||
</div><!-- doc-content -->
|
||||
<!-- start footer part -->
|
||||
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
||||
<ul>
|
||||
<li class="footer">Generated on Fri Oct 24 2025 14:30:58 for LibL6474-C-Library by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.13.2 </li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user