257 lines
29 KiB
HTML
257 lines
29 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"/>
|
||
|
<title>Trinamic TMC26X Stepper Driver for Arduino: TMC26XStepper.h Source File</title>
|
||
|
|
||
|
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
||
|
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
||
|
|
||
|
|
||
|
|
||
|
</head>
|
||
|
<body>
|
||
|
<div id="top"><!-- do not remove this div! -->
|
||
|
|
||
|
|
||
|
<div id="titlearea">
|
||
|
<table cellspacing="0" cellpadding="0">
|
||
|
<tbody>
|
||
|
<tr style="height: 56px;">
|
||
|
|
||
|
|
||
|
<td style="padding-left: 0.5em;">
|
||
|
<div id="projectname">Trinamic TMC26X Stepper Driver for Arduino
|
||
|
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
|
||
|
|
||
|
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</div>
|
||
|
|
||
|
<!-- Generated by Doxygen 1.7.6.1 -->
|
||
|
<div id="navrow1" class="tabs">
|
||
|
<ul class="tablist">
|
||
|
<li><a href="index.html"><span>Main Page</span></a></li>
|
||
|
<li><a href="annotated.html"><span>Classes</span></a></li>
|
||
|
<li class="current"><a href="files.html"><span>Files</span></a></li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
<div id="navrow2" class="tabs2">
|
||
|
<ul class="tablist">
|
||
|
<li><a href="files.html"><span>File List</span></a></li>
|
||
|
<li><a href="globals.html"><span>File Members</span></a></li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="header">
|
||
|
<div class="headertitle">
|
||
|
<div class="title">TMC26XStepper.h</div> </div>
|
||
|
</div><!--header-->
|
||
|
<div class="contents">
|
||
|
<a href="_t_m_c26_x_stepper_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
|
||
|
<a name="l00002"></a>00002 <span class="comment"> TMC26XStepper.cpp - - TMC26X Stepper library for Wiring/Arduino - Version 0.1</span>
|
||
|
<a name="l00003"></a>00003 <span class="comment"> </span>
|
||
|
<a name="l00004"></a>00004 <span class="comment"> based on the stepper library by Tom Igoe, et. al.</span>
|
||
|
<a name="l00005"></a>00005 <span class="comment"></span>
|
||
|
<a name="l00006"></a>00006 <span class="comment"> Copyright (c) 2011, Interactive Matter, Marcus Nowotny</span>
|
||
|
<a name="l00007"></a>00007 <span class="comment"> </span>
|
||
|
<a name="l00008"></a>00008 <span class="comment"> Permission is hereby granted, free of charge, to any person obtaining a copy</span>
|
||
|
<a name="l00009"></a>00009 <span class="comment"> of this software and associated documentation files (the "Software"), to deal</span>
|
||
|
<a name="l00010"></a>00010 <span class="comment"> in the Software without restriction, including without limitation the rights</span>
|
||
|
<a name="l00011"></a>00011 <span class="comment"> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell</span>
|
||
|
<a name="l00012"></a>00012 <span class="comment"> copies of the Software, and to permit persons to whom the Software is</span>
|
||
|
<a name="l00013"></a>00013 <span class="comment"> furnished to do so, subject to the following conditions:</span>
|
||
|
<a name="l00014"></a>00014 <span class="comment"> </span>
|
||
|
<a name="l00015"></a>00015 <span class="comment"> The above copyright notice and this permission notice shall be included in</span>
|
||
|
<a name="l00016"></a>00016 <span class="comment"> all copies or substantial portions of the Software.</span>
|
||
|
<a name="l00017"></a>00017 <span class="comment"> </span>
|
||
|
<a name="l00018"></a>00018 <span class="comment"> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR</span>
|
||
|
<a name="l00019"></a>00019 <span class="comment"> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,</span>
|
||
|
<a name="l00020"></a>00020 <span class="comment"> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE</span>
|
||
|
<a name="l00021"></a>00021 <span class="comment"> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER</span>
|
||
|
<a name="l00022"></a>00022 <span class="comment"> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,</span>
|
||
|
<a name="l00023"></a>00023 <span class="comment"> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN</span>
|
||
|
<a name="l00024"></a>00024 <span class="comment"> THE SOFTWARE.</span>
|
||
|
<a name="l00025"></a>00025 <span class="comment"></span>
|
||
|
<a name="l00026"></a>00026 <span class="comment"> */</span>
|
||
|
<a name="l00027"></a>00027
|
||
|
<a name="l00028"></a>00028
|
||
|
<a name="l00029"></a>00029 <span class="comment">// ensure this library description is only included once</span>
|
||
|
<a name="l00030"></a>00030 <span class="preprocessor">#ifndef TMC26XStepper_h</span>
|
||
|
<a name="l00031"></a>00031 <span class="preprocessor"></span><span class="preprocessor">#define TMC26XStepper_h</span>
|
||
|
<a name="l00032"></a>00032 <span class="preprocessor"></span>
|
||
|
<a name="l00034"></a>00034
|
||
|
<a name="l00039"></a><a class="code" href="_t_m_c26_x_stepper_8h.html#add42eee34f674f92c19bcd5266d2445f">00039</a> <span class="preprocessor">#define TMC26X_OVERTEMPERATURE_PREWARING 1</span>
|
||
|
<a name="l00040"></a>00040 <span class="preprocessor"></span>
|
||
|
<a name="l00041"></a>00041
|
||
|
<a name="l00047"></a><a class="code" href="_t_m_c26_x_stepper_8h.html#adae814ce848677abd87758c7ac79a436">00047</a> <span class="preprocessor">#define TMC26X_OVERTEMPERATURE_SHUTDOWN 2</span>
|
||
|
<a name="l00048"></a>00048 <span class="preprocessor"></span>
|
||
|
<a name="l00049"></a>00049 <span class="comment">//which values can be read out</span>
|
||
|
<a name="l00054"></a><a class="code" href="_t_m_c26_x_stepper_8h.html#aff05d4a47ef8821322ccc2a20785fbee">00054</a> <span class="comment"></span><span class="preprocessor">#define TMC26X_READOUT_POSITION 0</span>
|
||
|
<a name="l00055"></a>00055 <span class="preprocessor"></span>
|
||
|
<a name="l00059"></a><a class="code" href="_t_m_c26_x_stepper_8h.html#ac864ff8886123039c7d2d3c617f7ef87">00059</a> <span class="preprocessor">#define TMC26X_READOUT_STALLGUARD 1</span>
|
||
|
<a name="l00060"></a>00060 <span class="preprocessor"></span>
|
||
|
<a name="l00064"></a><a class="code" href="_t_m_c26_x_stepper_8h.html#a01760ad15e3846536526a990efe47094">00064</a> <span class="preprocessor">#define TMC26X_READOUT_CURRENT 3</span>
|
||
|
<a name="l00065"></a>00065 <span class="preprocessor"></span>
|
||
|
<a name="l00070"></a><a class="code" href="_t_m_c26_x_stepper_8h.html#a28b1774bd4aa854fb5e4b6dc7db96ecb">00070</a> <span class="preprocessor">#define COOL_STEP_HALF_CS_LIMIT 0</span>
|
||
|
<a name="l00071"></a>00071 <span class="preprocessor"></span>
|
||
|
<a name="l00075"></a><a class="code" href="_t_m_c26_x_stepper_8h.html#a1a4db5eafd0a9247677153cb4c8b7d54">00075</a> <span class="preprocessor">#define COOL_STEP_QUARTDER_CS_LIMIT 1</span>
|
||
|
<a name="l00076"></a>00076 <span class="preprocessor"></span>
|
||
|
<a name="l00101"></a><a class="code" href="class_t_m_c26_x_stepper.html">00101</a> <span class="keyword">class </span><a class="code" href="class_t_m_c26_x_stepper.html" title="Class representing a TMC26X stepper driver.">TMC26XStepper</a> {
|
||
|
<a name="l00102"></a>00102 <span class="keyword">public</span>:
|
||
|
<a name="l00124"></a>00124 <a class="code" href="class_t_m_c26_x_stepper.html#a3ef40763b8b8ab2b6ed4978c0647906c" title="creates a new represenatation of a stepper motor connected to a TMC26X stepper driver">TMC26XStepper</a>(<span class="keywordtype">int</span> number_of_steps, <span class="keywordtype">int</span> cs_pin, <span class="keywordtype">int</span> dir_pin, <span class="keywordtype">int</span> step_pin, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> current, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> resistor=150);
|
||
|
<a name="l00125"></a>00125
|
||
|
<a name="l00133"></a>00133 <span class="keywordtype">void</span> <a class="code" href="class_t_m_c26_x_stepper.html#aad1ed82b3e05940bde5a6c7ed3d3e8f7" title="configures and starts the TMC26X stepper driver. Before you called this function the stepper driver i...">start</a>();
|
||
|
<a name="l00134"></a>00134
|
||
|
<a name="l00145"></a>00145 <span class="keywordtype">void</span> <a class="code" href="class_t_m_c26_x_stepper.html#af968e70a13068f1e71ac0fa6865630c5" title="resets the stepper in unconfigured mode.">un_start</a>();
|
||
|
<a name="l00146"></a>00146
|
||
|
<a name="l00147"></a>00147
|
||
|
<a name="l00152"></a>00152 <span class="keywordtype">void</span> <a class="code" href="class_t_m_c26_x_stepper.html#a9478f43090995c8d5cdb4d4e8c07cdbd" title="Sets the rotation speed in revolutions per minute.">setSpeed</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> whatSpeed);
|
||
|
<a name="l00153"></a>00153
|
||
|
<a name="l00158"></a>00158 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_t_m_c26_x_stepper.html#aa564f5cc0218d30ef897c2830c768c29" title="reads out the currently selected speed in revolutions per minute.">getSpeed</a>(<span class="keywordtype">void</span>);
|
||
|
<a name="l00159"></a>00159
|
||
|
<a name="l00168"></a>00168 <span class="keywordtype">void</span> <a class="code" href="class_t_m_c26_x_stepper.html#a21041579c7f9284567ee2e2a55a3afd0" title="Set the number of microsteps in 2^i values (rounded) up to 256.">setMicrosteps</a>(<span class="keywordtype">int</span> number_of_steps);
|
||
|
<a name="l00169"></a>00169
|
||
|
<a name="l00178"></a>00178 <span class="keywordtype">int</span> <a class="code" href="class_t_m_c26_x_stepper.html#a5808551ced98b79c09bbb4bf47ecfec3" title="returns the effective current number of microsteps selected.">getMicrosteps</a>(<span class="keywordtype">void</span>);
|
||
|
<a name="l00179"></a>00179
|
||
|
<a name="l00195"></a>00195 <span class="keywordtype">char</span> <a class="code" href="class_t_m_c26_x_stepper.html#ac073a742496885f1f60751f9fb9c395d" title="Initiate a movement for the given number of steps. Positive numbers move in one, negative numbers in ...">step</a>(<span class="keywordtype">int</span> number_of_steps);
|
||
|
<a name="l00196"></a>00196
|
||
|
<a name="l00215"></a>00215 <span class="keywordtype">char</span> <a class="code" href="class_t_m_c26_x_stepper.html#aed5d81f1549615529c723600a68ba415" title="Central movement method, must be called as often as possible in the lopp function and is very fast...">move</a>(<span class="keywordtype">void</span>);
|
||
|
<a name="l00216"></a>00216
|
||
|
<a name="l00224"></a>00224 <span class="keywordtype">char</span> <a class="code" href="class_t_m_c26_x_stepper.html#a880d602be8414b7b965287c1790cd50e" title="checks if the motor still has to move to fulfill the last movement command.">isMoving</a>(<span class="keywordtype">void</span>);
|
||
|
<a name="l00225"></a>00225
|
||
|
<a name="l00230"></a>00230 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_t_m_c26_x_stepper.html#aa6c3211f85301ca0fb2e7b73cb8142a7" title="Get the number of steps left in the current movement.">getStepsLeft</a>(<span class="keywordtype">void</span>);
|
||
|
<a name="l00231"></a>00231
|
||
|
<a name="l00238"></a>00238 <span class="keywordtype">char</span> <a class="code" href="class_t_m_c26_x_stepper.html#a6315c18eadbc6bf4f3d81a6f80296123" title="Stops the motor regardless if it moves or not.">stop</a>(<span class="keywordtype">void</span>);
|
||
|
<a name="l00239"></a>00239
|
||
|
<a name="l00264"></a>00264 <span class="keywordtype">void</span> <a class="code" href="class_t_m_c26_x_stepper.html#ac2d8a2bbae2aba3ed7c98e3ff1a06649" title="Sets and configure the classical Constant Off Timer Chopper.">setConstantOffTimeChopper</a>(<span class="keywordtype">char</span> constant_off_time, <span class="keywordtype">char</span> blank_time, <span class="keywordtype">char</span> fast_decay_time_setting, <span class="keywordtype">char</span> sine_wave_offset, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> use_current_comparator);
|
||
|
<a name="l00265"></a>00265
|
||
|
<a name="l00286"></a>00286 <span class="keywordtype">void</span> <a class="code" href="class_t_m_c26_x_stepper.html#aa152bb7ddb72a2bc8465553a39232df2" title="Sets and configures with spread cycle chopper.">setSpreadCycleChopper</a>(<span class="keywordtype">char</span> constant_off_time, <span class="keywordtype">char</span> blank_time, <span class="keywordtype">char</span> hysteresis_start, <span class="keywordtype">char</span> hysteresis_end, <span class="keywordtype">char</span> hysteresis_decrement);
|
||
|
<a name="l00287"></a>00287
|
||
|
<a name="l00303"></a>00303 <span class="keywordtype">void</span> <a class="code" href="class_t_m_c26_x_stepper.html#a7ffd602cf4bf385847cba034417d5f0a" title="Use random off time for noise reduction (0 for off, -1 for on).">setRandomOffTime</a>(<span class="keywordtype">char</span> value);
|
||
|
<a name="l00304"></a>00304
|
||
|
<a name="l00312"></a>00312 <span class="keywordtype">void</span> <a class="code" href="class_t_m_c26_x_stepper.html#aaa35fac83417c16b3a941fa168e4a4d2" title="set the maximum motor current in mA (1000 is 1 Amp) Keep in mind this is the maximum peak Current...">setCurrent</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> current);
|
||
|
<a name="l00313"></a>00313
|
||
|
<a name="l00320"></a>00320 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_t_m_c26_x_stepper.html#a0c544e23efe3e4a912aacf57de84b71f" title="readout the motor maximum current in mA (1000 is an Amp) This is the maximum current. to get the current current - which may be affected by CoolStep us getCurrentCurrent()">getCurrent</a>(<span class="keywordtype">void</span>);
|
||
|
<a name="l00321"></a>00321
|
||
|
<a name="l00337"></a>00337 <span class="keywordtype">void</span> <a class="code" href="class_t_m_c26_x_stepper.html#af1a5abc23757860baf8ff421689a425a" title="set the StallGuard threshold in order to get sensible StallGuard readings.">setStallGuardThreshold</a>(<span class="keywordtype">char</span> stall_guard_threshold, <span class="keywordtype">char</span> stall_guard_filter_enabled);
|
||
|
<a name="l00338"></a>00338
|
||
|
<a name="l00343"></a>00343 <span class="keywordtype">char</span> <a class="code" href="class_t_m_c26_x_stepper.html#a056661f444725c3ae15696d1e8d91def" title="reads out the StallGuard threshold">getStallGuardThreshold</a>(<span class="keywordtype">void</span>);
|
||
|
<a name="l00344"></a>00344
|
||
|
<a name="l00349"></a>00349 <span class="keywordtype">char</span> <a class="code" href="class_t_m_c26_x_stepper.html#a47e3443e3e786314c1099b8f14a91b8a" title="returns the current setting of the StallGuard filter">getStallGuardFilter</a>(<span class="keywordtype">void</span>);
|
||
|
<a name="l00350"></a>00350
|
||
|
<a name="l00368"></a>00368 <span class="keywordtype">void</span> <a class="code" href="class_t_m_c26_x_stepper.html#a381fbcce7c586ca2f1da8f9e704df14e" title="This method configures the CoolStep smart energy operation. You must have a proper StallGuard configu...">setCoolStepConfiguration</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> lower_SG_threshold, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> SG_hysteresis, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> current_decrement_step_size,
|
||
|
<a name="l00369"></a>00369 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> current_increment_step_size, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> lower_current_limit);
|
||
|
<a name="l00370"></a>00370
|
||
|
<a name="l00376"></a>00376 <span class="keywordtype">void</span> <a class="code" href="class_t_m_c26_x_stepper.html#a15bf0ed5a166a5d9a41f90f3ccbc6157" title="enables or disables the CoolStep smart energy operation feature. It must be configured before enablin...">setCoolStepEnabled</a>(<span class="keywordtype">boolean</span> enabled);
|
||
|
<a name="l00377"></a>00377
|
||
|
<a name="l00378"></a>00378
|
||
|
<a name="l00383"></a>00383 <span class="keywordtype">boolean</span> <a class="code" href="class_t_m_c26_x_stepper.html#a6de2306b6d8dc1fa2e50fccb66d8e66d" title="check if the CoolStep feature is enabled">isCoolStepEnabled</a>();
|
||
|
<a name="l00384"></a>00384
|
||
|
<a name="l00389"></a>00389 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_t_m_c26_x_stepper.html#aa7469949deaa39a58038b3ddef532bc8" title="returns the lower StallGuard threshold for the CoolStep operation">getCoolStepLowerSgThreshold</a>();
|
||
|
<a name="l00390"></a>00390
|
||
|
<a name="l00395"></a>00395 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_t_m_c26_x_stepper.html#ac61298fd658773c28823d33ab04e970f" title="returns the upper StallGuard threshold for the CoolStep operation">getCoolStepUpperSgThreshold</a>();
|
||
|
<a name="l00396"></a>00396
|
||
|
<a name="l00401"></a>00401 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> <a class="code" href="class_t_m_c26_x_stepper.html#aad44ee5ae73bf8e69af05674a304ba46" title="returns the number of StallGuard readings befor CoolStep adjusts the motor current.">getCoolStepNumberOfSGReadings</a>();
|
||
|
<a name="l00402"></a>00402
|
||
|
<a name="l00407"></a>00407 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> <a class="code" href="class_t_m_c26_x_stepper.html#ababe688a15f087d23d4ff2094fcee883" title="returns the increment steps for the current for the CoolStep operation">getCoolStepCurrentIncrementSize</a>();
|
||
|
<a name="l00408"></a>00408
|
||
|
<a name="l00414"></a>00414 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> <a class="code" href="class_t_m_c26_x_stepper.html#a0c7e8541abc120a3910e35c6fbf2167c" title="returns the absolut minium current for the CoolStep operation">getCoolStepLowerCurrentLimit</a>();
|
||
|
<a name="l00415"></a>00415
|
||
|
<a name="l00422"></a>00422 <span class="keywordtype">int</span> <a class="code" href="class_t_m_c26_x_stepper.html#a1019f6f889acfd3176eecd60a0a20125" title="Get the current microstep position for phase A.">getMotorPosition</a>(<span class="keywordtype">void</span>);
|
||
|
<a name="l00423"></a>00423
|
||
|
<a name="l00430"></a>00430 <span class="keywordtype">int</span> <a class="code" href="class_t_m_c26_x_stepper.html#aed570ce3eea640e087b046333015de1e" title="Reads the current StallGuard value.">getCurrentStallGuardReading</a>(<span class="keywordtype">void</span>);
|
||
|
<a name="l00431"></a>00431
|
||
|
<a name="l00437"></a>00437 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> <a class="code" href="class_t_m_c26_x_stepper.html#a1a939fb495d747c2c11be99a740371e1" title="Reads the current current setting value as fraction of the maximum current Returns values between 0 a...">getCurrentCSReading</a>(<span class="keywordtype">void</span>);
|
||
|
<a name="l00438"></a>00438
|
||
|
<a name="l00439"></a>00439
|
||
|
<a name="l00444"></a>00444 <span class="keywordtype">boolean</span> <a class="code" href="class_t_m_c26_x_stepper.html#ad435db189ebb101fb2de90a484f33905" title="a convenience method to determine if the current scaling uses 0.31V or 0.165V as reference.">isCurrentScalingHalfed</a>();
|
||
|
<a name="l00445"></a>00445
|
||
|
<a name="l00453"></a>00453 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_t_m_c26_x_stepper.html#aa00741168a7def0a7a9d2f2c9d3b99d7" title="Reads the current current setting value and recalculates the absolute current in mA (1A would be 1000...">getCurrentCurrent</a>(<span class="keywordtype">void</span>);
|
||
|
<a name="l00454"></a>00454
|
||
|
<a name="l00463"></a>00463 <span class="keywordtype">boolean</span> <a class="code" href="class_t_m_c26_x_stepper.html#aea4c6e1fac909116c6b55f902d6cff41" title="checks if there is a StallGuard warning in the last status">isStallGuardOverThreshold</a>(<span class="keywordtype">void</span>);
|
||
|
<a name="l00464"></a>00464
|
||
|
<a name="l00471"></a>00471 <span class="keywordtype">char</span> <a class="code" href="class_t_m_c26_x_stepper.html#a7662c2fbc03d1f5a7da5cabcc153b2d7" title="Return over temperature status of the last status readout return 0 is everything is OK...">getOverTemperature</a>(<span class="keywordtype">void</span>);
|
||
|
<a name="l00472"></a>00472
|
||
|
<a name="l00480"></a>00480 <span class="keywordtype">boolean</span> <a class="code" href="class_t_m_c26_x_stepper.html#ad329fa4693d3139dea241ebe3d0f33cf" title="Is motor channel A shorted to ground detected in the last status readout.">isShortToGroundA</a>(<span class="keywordtype">void</span>);
|
||
|
<a name="l00481"></a>00481
|
||
|
<a name="l00488"></a>00488 <span class="keywordtype">boolean</span> <a class="code" href="class_t_m_c26_x_stepper.html#a0ccb54d40cce0d802aa56ff6261f9f3b" title="Is motor channel B shorted to ground detected in the last status readout.">isShortToGroundB</a>(<span class="keywordtype">void</span>);
|
||
|
<a name="l00495"></a>00495 <span class="keywordtype">boolean</span> <a class="code" href="class_t_m_c26_x_stepper.html#af97b2ab9d1ba36765ac6f17cf25ec45c" title="iIs motor channel A connected according to the last statu readout.">isOpenLoadA</a>(<span class="keywordtype">void</span>);
|
||
|
<a name="l00496"></a>00496
|
||
|
<a name="l00503"></a>00503 <span class="keywordtype">boolean</span> <a class="code" href="class_t_m_c26_x_stepper.html#a303590124f5ac6d6a06d0ec60d0b5303" title="iIs motor channel A connected according to the last statu readout.">isOpenLoadB</a>(<span class="keywordtype">void</span>);
|
||
|
<a name="l00504"></a>00504
|
||
|
<a name="l00511"></a>00511 <span class="keywordtype">boolean</span> <a class="code" href="class_t_m_c26_x_stepper.html#ab26602f360a4fb6ec6d262011675b2b0" title="Is chopper inactive since 2^20 clock cycles - defaults to ~0,08s.">isStandStill</a>(<span class="keywordtype">void</span>);
|
||
|
<a name="l00512"></a>00512
|
||
|
<a name="l00524"></a>00524 <span class="keywordtype">boolean</span> <a class="code" href="class_t_m_c26_x_stepper.html#afdeded501ec2cabeffde33d31b6573f7" title="checks if there is a StallGuard warning in the last status">isStallGuardReached</a>(<span class="keywordtype">void</span>);
|
||
|
<a name="l00525"></a>00525
|
||
|
<a name="l00530"></a>00530 <span class="keywordtype">void</span> <a class="code" href="class_t_m_c26_x_stepper.html#a4472cd86ad5b65dec5ec45ce69158305" title="enables or disables the motor driver bridges. If disabled the motor can run freely. If enabled not.">setEnabled</a>(<span class="keywordtype">boolean</span> enabled);
|
||
|
<a name="l00531"></a>00531
|
||
|
<a name="l00537"></a>00537 <span class="keywordtype">boolean</span> <a class="code" href="class_t_m_c26_x_stepper.html#a15796c0cbdeab23a343c3f25327283b6" title="checks if the output bridges are enabled. If the bridges are not enabled the motor can run freely...">isEnabled</a>();
|
||
|
<a name="l00538"></a>00538
|
||
|
<a name="l00548"></a>00548 <span class="keywordtype">void</span> <a class="code" href="class_t_m_c26_x_stepper.html#af95a824bfdf49ef979b5354798e52967" title="Manually read out the status register This function sends a byte to the motor driver in order to get ...">readStatus</a>(<span class="keywordtype">char</span> read_value);
|
||
|
<a name="l00549"></a>00549
|
||
|
<a name="l00554"></a>00554 <span class="keywordtype">int</span> <a class="code" href="class_t_m_c26_x_stepper.html#ae1db5ec2ec9bfbfaea83c659e006692e" title="Returns the current sense resistor value in milliohm. The default value of ,15 Ohm will return 150...">getResistor</a>();
|
||
|
<a name="l00555"></a>00555
|
||
|
<a name="l00560"></a>00560 <span class="keywordtype">void</span> <a class="code" href="class_t_m_c26_x_stepper.html#ad5e5b1bf5a46d02577dd548083877ec3" title="Prints out all the information that can be found in the last status read out - it does not force a st...">debugLastStatus</a>(<span class="keywordtype">void</span>);
|
||
|
<a name="l00565"></a>00565 <span class="keywordtype">int</span> <a class="code" href="class_t_m_c26_x_stepper.html#ab040d9df1e85d6fb0c105205a36b0215" title="library version">version</a>(<span class="keywordtype">void</span>);
|
||
|
<a name="l00566"></a>00566
|
||
|
<a name="l00567"></a>00567 <span class="keyword">private</span>:
|
||
|
<a name="l00568"></a>00568 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> steps_left; <span class="comment">//the steps the motor has to do to complete the movement</span>
|
||
|
<a name="l00569"></a>00569 <span class="keywordtype">int</span> direction; <span class="comment">// Direction of rotation</span>
|
||
|
<a name="l00570"></a>00570 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> step_delay; <span class="comment">// delay between steps, in ms, based on speed</span>
|
||
|
<a name="l00571"></a>00571 <span class="keywordtype">int</span> number_of_steps; <span class="comment">// total number of steps this motor can take</span>
|
||
|
<a name="l00572"></a>00572 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> speed; <span class="comment">// we need to store the current speed in order to change the speed after changing microstepping</span>
|
||
|
<a name="l00573"></a>00573 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> resistor; <span class="comment">//current sense resitor value in milliohm</span>
|
||
|
<a name="l00574"></a>00574
|
||
|
<a name="l00575"></a>00575 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> last_step_time; <span class="comment">// time stamp in ms of when the last step was taken</span>
|
||
|
<a name="l00576"></a>00576 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> next_step_time; <span class="comment">// time stamp in ms of when the last step was taken</span>
|
||
|
<a name="l00577"></a>00577
|
||
|
<a name="l00578"></a>00578 <span class="comment">//driver control register copies to easily set & modify the registers</span>
|
||
|
<a name="l00579"></a>00579 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> driver_control_register_value;
|
||
|
<a name="l00580"></a>00580 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> chopper_config_register;
|
||
|
<a name="l00581"></a>00581 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> cool_step_register_value;
|
||
|
<a name="l00582"></a>00582 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> stall_guard2_current_register_value;
|
||
|
<a name="l00583"></a>00583 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> driver_configuration_register_value;
|
||
|
<a name="l00584"></a>00584 <span class="comment">//the driver status result</span>
|
||
|
<a name="l00585"></a>00585 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> driver_status_result;
|
||
|
<a name="l00586"></a>00586
|
||
|
<a name="l00587"></a>00587 <span class="comment">//helper routione to get the top 10 bit of the readout</span>
|
||
|
<a name="l00588"></a>00588 <span class="keyword">inline</span> <span class="keywordtype">int</span> getReadoutValue();
|
||
|
<a name="l00589"></a>00589
|
||
|
<a name="l00590"></a>00590 <span class="comment">//the pins for the stepper driver</span>
|
||
|
<a name="l00591"></a>00591 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> cs_pin;
|
||
|
<a name="l00592"></a>00592 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> step_pin;
|
||
|
<a name="l00593"></a>00593 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> dir_pin;
|
||
|
<a name="l00594"></a>00594
|
||
|
<a name="l00595"></a>00595 <span class="comment">//status values </span>
|
||
|
<a name="l00596"></a>00596 <span class="keywordtype">boolean</span> started; <span class="comment">//if the stepper has been started yet</span>
|
||
|
<a name="l00597"></a>00597 <span class="keywordtype">int</span> microsteps; <span class="comment">//the current number of micro steps</span>
|
||
|
<a name="l00598"></a>00598 <span class="keywordtype">char</span> constant_off_time; <span class="comment">//we need to remember this value in order to enable and disable the motor</span>
|
||
|
<a name="l00599"></a>00599 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> cool_step_lower_threshold; <span class="comment">// we need to remember the threshold to enable and disable the CoolStep feature</span>
|
||
|
<a name="l00600"></a>00600 <span class="keywordtype">boolean</span> cool_step_enabled; <span class="comment">//we need to remember this to configure the coolstep if it si enabled</span>
|
||
|
<a name="l00601"></a>00601
|
||
|
<a name="l00602"></a>00602 <span class="comment">//SPI sender</span>
|
||
|
<a name="l00603"></a>00603 <span class="keyword">inline</span> <span class="keywordtype">void</span> send262(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> datagram);
|
||
|
<a name="l00604"></a>00604 };
|
||
|
<a name="l00605"></a>00605
|
||
|
<a name="l00606"></a>00606 <span class="preprocessor">#endif</span>
|
||
|
<a name="l00607"></a>00607 <span class="preprocessor"></span>
|
||
|
</pre></div></div><!-- contents -->
|
||
|
|
||
|
|
||
|
<hr class="footer"/><address class="footer"><small>
|
||
|
Generated on Mon Nov 19 2012 20:26:21 for Trinamic TMC26X Stepper Driver for Arduino by  <a href="http://www.doxygen.org/index.html">
|
||
|
<img class="footer" src="doxygen.png" alt="doxygen"/>
|
||
|
</a> 1.7.6.1
|
||
|
</small></address>
|
||
|
|
||
|
</body>
|
||
|
</html>
|