📄 main_8c.html
字号:
</tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p>Emergency shut-off interrupt service routine. <p>This ISR is triggered if the emergency shutdown input changes state.<p><dl compact><dt><b>Note:</b></dt><dd>In the current implementation, the motor driver outputs are simply disabled and the program goes into an eternal loop on any change at this input. Custom code should be made here that handles such situation in a more intelligent way, adapted to the motor and driver stage.</dd></dl><dl compact><dt><b><a class="el" href="todo.html#_todo000002">Todo:</a></b></dt><dd>Change how emergency shut-off is handled. </dd></dl><p>Definition at line <a class="el" href="main_8c-source.html#l00901">901</a> of file <a class="el" href="main_8c-source.html">main.c</a>.<p>References <a class="el" href="main_8c-source.html#l00800">DisablePWMOutputs()</a>.<div class="fragment"><pre class="fragment"><a name="l00902"></a>00902 {<a name="l00903"></a>00903 <a class="code" href="main_8c.html#a35">DisablePWMOutputs</a>();<a name="l00904"></a>00904 <span class="keywordflow">for</span> (;;)<a name="l00905"></a>00905 {<a name="l00906"></a>00906 <a name="l00907"></a>00907 }<a name="l00908"></a>00908 }</pre></div><p><p>Here is the call graph for this function:<p><center><img src="main_8c_a39_cgraph.png" border="0" usemap="#main_8c_a39_cgraph_map" alt=""></center><map name="main_8c_a39_cgraph_map"><area href="main_8c.html#a35" shape="rect" coords="216,5,363,32" alt=""></map> </td> </tr></table><a class="anchor" name="a34"></a><!-- doxytag: member="main.c::EnablePWMOutputs" ref="a34" args="(void)" --><p><table class="mdTable" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top">static void EnablePWMOutputs </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">void </td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap><code> [static]</code></td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p>Enables PWM output pins. <p>This function enables PWM outputs by setting the port direction for all PWM pins as output. The PWM configuration itself is not altered in any way by running this function.<p>Definition at line <a class="el" href="main_8c-source.html#l00786">786</a> of file <a class="el" href="main_8c-source.html">main.c</a>.<p>References <a class="el" href="PMSM_8h-source.html#l00055">PWM_PATTERN_PORTB</a>, and <a class="el" href="PMSM_8h-source.html#l00058">PWM_PATTERN_PORTD</a>.<p>Referenced by <a class="el" href="main_8c-source.html#l00373">TimersSetModeBlockCommutation()</a>, <a class="el" href="main_8c-source.html#l00404">TimersSetModeBrake()</a>, and <a class="el" href="main_8c-source.html#l00341">TimersSetModeSinusoidal()</a>.<div class="fragment"><pre class="fragment"><a name="l00787"></a>00787 {<a name="l00788"></a>00788 DDRB |= <a class="code" href="PMSM_8h.html#a5">PWM_PATTERN_PORTB</a>;<a name="l00789"></a>00789 DDRD |= <a class="code" href="PMSM_8h.html#a6">PWM_PATTERN_PORTD</a>;<a name="l00790"></a>00790 }</pre></div><p> </td> </tr></table><a class="anchor" name="a23"></a><!-- doxytag: member="main.c::GetActualDirection" ref="a23" args="(void)" --><p><table class="mdTable" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top">static <a class="el" href="stdint_8h.html#a56">uint8_t</a> GetActualDirection </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">void </td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap><code> [static]</code></td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p>Returns the actual direction of the motor. <p>This function returns the actual direction of the motor.<p><dl compact><dt><b>Note:</b></dt><dd>Two hall changes in the same direction is needed before this function returns the correct direction of rotation.</dd></dl><dl compact><dt><b>Returns:</b></dt><dd>The desired direction.</dd></dl><dl compact><dt><b>Return values:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>DIRECTION_FORWARD</em> </td><td>Motor is running forward </td></tr> <tr><td valign="top"></td><td valign="top"><em>DIRECTION_REVERSE</em> </td><td>Motor is running in reverse </td></tr> <tr><td valign="top"></td><td valign="top"><em>DIRECTION_UNKNOWN</em> </td><td>The current direction of the motor can not be determined (may be stopped or turning), or the hall sensors output incorrect values.</td></tr> </table></dl><p>Definition at line <a class="el" href="main_8c-source.html#l00502">502</a> of file <a class="el" href="main_8c-source.html">main.c</a>.<p>Referenced by <a class="el" href="main_8c-source.html#l00633">ReverseRotationSignalUpdate()</a>.<div class="fragment"><pre class="fragment"><a name="l00503"></a>00503 {<a name="l00504"></a>00504 <span class="keywordflow">return</span> fastFlags.actualDirection;<a name="l00505"></a>00505 }</pre></div><p> </td> </tr></table><a class="anchor" name="a22"></a><!-- doxytag: member="main.c::GetDesiredDirection" ref="a22" args="(void)" --><p><table class="mdTable" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top">static <a class="el" href="stdint_8h.html#a56">uint8_t</a> GetDesiredDirection </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">void </td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap><code> [static]</code></td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p>Returns the desired direction. <p>This function returns the current desired direction. <dl compact><dt><b>Note:</b></dt><dd>The direction input is not read at this time. A separate pin change interrupt is responsible for reading the input.</dd></dl><dl compact><dt><b>Return values:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>DIRECTION_FORWARD</em> </td><td>Forward direction is requested. </td></tr> <tr><td valign="top"></td><td valign="top"><em>DIRECTION_REVERSE</em> </td><td>Reverse direction is requested.</td></tr> </table></dl><p>Definition at line <a class="el" href="main_8c-source.html#l00479">479</a> of file <a class="el" href="main_8c-source.html">main.c</a>.<p>Referenced by <a class="el" href="main_8c-source.html#l00816">CommutationTicksUpdate()</a>, <a class="el" href="main_8c-source.html#l00930">HallChangeISR()</a>, <a class="el" href="main_8c-source.html#l00633">ReverseRotationSignalUpdate()</a>, and <a class="el" href="main_8c-source.html#l01030">Timer1CaptureISR()</a>.<div class="fragment"><pre class="fragment"><a name="l00480"></a>00480 {<a name="l00481"></a>00481 <span class="keywordflow">return</span> (<a class="code" href="stdint_8h.html#a56">uint8_t</a>)fastFlags.desiredDirection;<a name="l00482"></a>00482 }</pre></div><p> </td> </tr></table><a class="anchor" name="a25"></a><!-- doxytag: member="main.c::GetHall" ref="a25" args="(void)" --><p><table class="mdTable" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top">static <a class="el" href="stdint_8h.html#a56">uint8_t</a> GetHall </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">void </td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap><code> [static]</code></td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p>Reads the hall sensor inputs. <p>This function reads the hall sensor inputs and converts it to a number from 1 to 6 by combining the hall sensors as bits: H3|H2|H1.<p><dl compact><dt><b>Note:</b></dt><dd>It is possible to change the physical placement of hall sensor inputs, but the recommended configuration is the one used in this example, since it requires very little code to decode the hall values.</dd></dl><dl compact><dt><b>Returns:</b></dt><dd>The decoded hall sensor value.</dd></dl><dl compact><dt><b>Return values:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>0</em> </td><td>Illegal hall state. Possible hardware error. </td></tr> <tr><td valign="top"></td><td valign="top"><em>1-6</em> </td><td>Legal hall sensor values. </td></tr> <tr><td valign="top"></
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -