Library for STMicroelectronics dSPIN L6470 stepper driver. "daisy-chain" supported.

Dependents:   L6470_daisy_chain l6470

Committer:
Yajirushi
Date:
Tue Jan 12 11:27:01 2016 +0000
Revision:
3:486fb90dc7d5
Parent:
2:2af83d3ccd97
Child:
4:4127dd195311
Add Daisy-Chain Queue and Method. Rewrite many comments.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Yajirushi 3:486fb90dc7d5 1 /* Copyright (c) 2014 Yajirushi(Cursor)
Yajirushi 3:486fb90dc7d5 2 *
Yajirushi 3:486fb90dc7d5 3 * Released under the MIT license
Yajirushi 3:486fb90dc7d5 4 * http://opensource.org/licenses/mit-license.php
Yajirushi 3:486fb90dc7d5 5 *
Yajirushi 3:486fb90dc7d5 6 * Permission is hereby granted, free of charge, to any person obtaining a copy
Yajirushi 3:486fb90dc7d5 7 * of this software and associated documentation files (the "Software"), to deal
Yajirushi 3:486fb90dc7d5 8 * in the Software without restriction, including without limitation the rights
Yajirushi 3:486fb90dc7d5 9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
Yajirushi 3:486fb90dc7d5 10 * copies of the Software, and to permit persons to whom the Software is
Yajirushi 3:486fb90dc7d5 11 * furnished to do so, subject to the following conditions:
Yajirushi 3:486fb90dc7d5 12 *
Yajirushi 3:486fb90dc7d5 13 * The above copyright notice and this permission notice shall be included in
Yajirushi 3:486fb90dc7d5 14 * all copies or substantial portions of the Software.
Yajirushi 3:486fb90dc7d5 15 *
Yajirushi 3:486fb90dc7d5 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
Yajirushi 3:486fb90dc7d5 17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
Yajirushi 3:486fb90dc7d5 18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Yajirushi 3:486fb90dc7d5 19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
Yajirushi 3:486fb90dc7d5 20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
Yajirushi 3:486fb90dc7d5 21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
Yajirushi 3:486fb90dc7d5 22 * THE SOFTWARE.
Yajirushi 3:486fb90dc7d5 23 */
Yajirushi 0:e1964b6e160c 24 #include "mbed.h"
Yajirushi 0:e1964b6e160c 25
Yajirushi 0:e1964b6e160c 26 #ifndef L6470SDC_H
Yajirushi 0:e1964b6e160c 27 #define L6470SDC_H
Yajirushi 0:e1964b6e160c 28
Yajirushi 3:486fb90dc7d5 29 /* ------------------------------------------------------------------
Yajirushi 3:486fb90dc7d5 30 The code below, please be rewritten to match your environment
Yajirushi 3:486fb90dc7d5 31 ------------------------------------------------------------------ */
Yajirushi 3:486fb90dc7d5 32
Yajirushi 3:486fb90dc7d5 33 //If not using Serial-print debugging: DEBUG_L6470SDC to comment out
Yajirushi 3:486fb90dc7d5 34 //If Serial-print debugging, must be connected "USBTX"(tx), "USBRX"(rx).
Yajirushi 0:e1964b6e160c 35 //#define DEBUG_L6470SDC
Yajirushi 0:e1964b6e160c 36
Yajirushi 3:486fb90dc7d5 37 //SPI signal frequency: Less than 5MHz(5,000,000)
Yajirushi 0:e1964b6e160c 38 #define L6470_SPI_FREQ 4960000
Yajirushi 0:e1964b6e160c 39
Yajirushi 3:486fb90dc7d5 40 /* ------------------------------------------------------------------
Yajirushi 3:486fb90dc7d5 41 No need to change the below code
Yajirushi 3:486fb90dc7d5 42 ------------------------------------------------------------------ */
Yajirushi 0:e1964b6e160c 43 #define CMD_NOP 0x0
Yajirushi 0:e1964b6e160c 44 #define CMD_SETPARAM 0x00
Yajirushi 0:e1964b6e160c 45 #define CMD_GETPARAM 0x20
Yajirushi 0:e1964b6e160c 46 #define CMD_RUN_PLUS 0x51
Yajirushi 0:e1964b6e160c 47 #define CMD_RUN_MINUS 0x50
Yajirushi 0:e1964b6e160c 48 #define CMD_STEP_PLUS 0x59
Yajirushi 0:e1964b6e160c 49 #define CMD_STEP_MINUS 0x58
Yajirushi 0:e1964b6e160c 50 #define CMD_ADDSTEP_PLUS 0x41
Yajirushi 0:e1964b6e160c 51 #define CMD_ADDSTEP_MINUS 0x40
Yajirushi 0:e1964b6e160c 52 #define CMD_GOTO 0x60
Yajirushi 0:e1964b6e160c 53 #define CMD_GOTO_DIR_PLUS 0x69
Yajirushi 0:e1964b6e160c 54 #define CMD_GOTO_DIR_MINUS 0x68
Yajirushi 0:e1964b6e160c 55 #define CMD_GO_UNTIL_PLUS 0x83
Yajirushi 0:e1964b6e160c 56 #define CMD_GO_UNTIL_MINUS 0x82
Yajirushi 0:e1964b6e160c 57 #define CMD_RELEASE_SW_PLUS 0x93
Yajirushi 0:e1964b6e160c 58 #define CMD_RELEASE_SW_MINUS 0x92
Yajirushi 0:e1964b6e160c 59 #define CMD_GO_HOME 0x70
Yajirushi 0:e1964b6e160c 60 #define CMD_GO_MARK 0x78
Yajirushi 0:e1964b6e160c 61 #define CMD_RESET_POS 0xD8
Yajirushi 0:e1964b6e160c 62 #define CMD_RESET_DEVICE 0xC0
Yajirushi 0:e1964b6e160c 63 #define CMD_SOFT_STOP 0xB0
Yajirushi 0:e1964b6e160c 64 #define CMD_HARD_STOP 0xB8
Yajirushi 0:e1964b6e160c 65 #define CMD_SOFT_HIZ 0xA0
Yajirushi 0:e1964b6e160c 66 #define CMD_HARD_HIZ 0xA8
Yajirushi 0:e1964b6e160c 67 #define CMD_GET_STATUS 0xD0
Yajirushi 0:e1964b6e160c 68
Yajirushi 0:e1964b6e160c 69 #define REG_NOTHING 0x0
Yajirushi 0:e1964b6e160c 70 #define REG_ABS_POS 0x01
Yajirushi 0:e1964b6e160c 71 #define REG_EL_POS 0x02
Yajirushi 0:e1964b6e160c 72 #define REG_MARK 0x03
Yajirushi 0:e1964b6e160c 73 #define REG_SPEED 0x04
Yajirushi 0:e1964b6e160c 74 #define REG_ACC 0x05
Yajirushi 0:e1964b6e160c 75 #define REG_DEC 0x06
Yajirushi 0:e1964b6e160c 76 #define REG_MAX_SPEED 0x07
Yajirushi 0:e1964b6e160c 77 #define REG_MIN_SPEED 0x08
Yajirushi 0:e1964b6e160c 78 #define REG_KVAL_HOLD 0x09
Yajirushi 0:e1964b6e160c 79 #define REG_KVAL_RUN 0x0A
Yajirushi 0:e1964b6e160c 80 #define REG_KVAL_ACC 0x0B
Yajirushi 0:e1964b6e160c 81 #define REG_KVAL_DEC 0x0C
Yajirushi 0:e1964b6e160c 82 #define REG_INT_SPD 0x0D
Yajirushi 0:e1964b6e160c 83 #define REG_ST_SLP 0x0E
Yajirushi 0:e1964b6e160c 84 #define REG_FN_SLP_ACC 0x0F
Yajirushi 0:e1964b6e160c 85 #define REG_FN_SLP_DEC 0x10
Yajirushi 0:e1964b6e160c 86 #define REG_K_THERM 0x11
Yajirushi 0:e1964b6e160c 87 #define REG_ADC_OUT 0x12
Yajirushi 0:e1964b6e160c 88 #define REG_OCD_TH 0x13
Yajirushi 0:e1964b6e160c 89 #define REG_STALL_TH 0x14
Yajirushi 0:e1964b6e160c 90 #define REG_FS_SPD 0x15
Yajirushi 0:e1964b6e160c 91 #define REG_STEP_MODE 0x16
Yajirushi 0:e1964b6e160c 92 #define REG_ALARM_EN 0x17
Yajirushi 0:e1964b6e160c 93 #define REG_CONFIG 0x18
Yajirushi 0:e1964b6e160c 94 #define REG_STATUS 0x19
Yajirushi 0:e1964b6e160c 95
Yajirushi 3:486fb90dc7d5 96 //DaisyChain CommandQueue Structure
Yajirushi 3:486fb90dc7d5 97 typedef struct L6470CommandQueue{
Yajirushi 3:486fb90dc7d5 98 unsigned char addr;
Yajirushi 3:486fb90dc7d5 99 unsigned long val;
Yajirushi 3:486fb90dc7d5 100 int bitLen;
Yajirushi 3:486fb90dc7d5 101 }L6470CMDQ;
Yajirushi 3:486fb90dc7d5 102
Yajirushi 3:486fb90dc7d5 103 /**
Yajirushi 3:486fb90dc7d5 104 * @~japanese
Yajirushi 3:486fb90dc7d5 105 * STマイクロエレクトロニクス社製のL6470ステッピングモーターコントローラー用ライブラリ
Yajirushi 3:486fb90dc7d5 106 * 真の意味でデイジーチェーンをサポートしています(もちろん個別結線でも使用可能です)
Yajirushi 3:486fb90dc7d5 107 *
Yajirushi 3:486fb90dc7d5 108 * @~english
Yajirushi 3:486fb90dc7d5 109 * Library for STMicroelectronics "L6470" stepper motor controller.
Yajirushi 3:486fb90dc7d5 110 * This library supported "SPI Daisy-Chain".
Yajirushi 1:db64ad30b4b3 111 *
Yajirushi 1:db64ad30b4b3 112 * Example:
Yajirushi 1:db64ad30b4b3 113 * @code
Yajirushi 3:486fb90dc7d5 114 * //case: Using "Daisy-Chained" 2 motors. not use Serial-Debugging.
Yajirushi 1:db64ad30b4b3 115 * #include "mbed.h"
Yajirushi 1:db64ad30b4b3 116 * #include "L6470SDC.h"
Yajirushi 1:db64ad30b4b3 117 *
Yajirushi 3:486fb90dc7d5 118 * int main(){
Yajirushi 3:486fb90dc7d5 119 * //create instance(Not use Serial-Debugging)
Yajirushi 3:486fb90dc7d5 120 * L6470SDC l6470(SPI_MOSI, SPI_MISO, SPI_SCK, D10);
Yajirushi 1:db64ad30b4b3 121 *
Yajirushi 3:486fb90dc7d5 122 * wait(1);
Yajirushi 3:486fb90dc7d5 123 *
Yajirushi 3:486fb90dc7d5 124 * //L6470 initialize
Yajirushi 1:db64ad30b4b3 125 * l6470.init();
Yajirushi 1:db64ad30b4b3 126 *
Yajirushi 3:486fb90dc7d5 127 * wait(5);
Yajirushi 1:db64ad30b4b3 128 *
Yajirushi 3:486fb90dc7d5 129 * //Set the rotation speed of the motor to 100step/s. (Daisy-chained motor No.1)
Yajirushi 3:486fb90dc7d5 130 * l6470.setMaximumSpeed(1, l6470.calcMaxSpd(100));
Yajirushi 3:486fb90dc7d5 131 * //Set the rotation speed of the motor to 200step/s. (Daisy-chained motor No.2)
Yajirushi 3:486fb90dc7d5 132 * l6470.setMaximumSpeed(2, l6470.calcMaxSpd(200));
Yajirushi 3:486fb90dc7d5 133 *
Yajirushi 3:486fb90dc7d5 134 * //Running motor 5seconds.
Yajirushi 3:486fb90dc7d5 135 * //Maximum speed = 300step/s
Yajirushi 3:486fb90dc7d5 136 * //!!Start timing deviate, because it does not use the "Queue"
Yajirushi 3:486fb90dc7d5 137 * l6470.run(1, l6470.calcSpd(300), true); //clockwise No.1
Yajirushi 3:486fb90dc7d5 138 * l6470.run(2, l6470.calcSpd(300), false); //counter-clockwise No.2
Yajirushi 1:db64ad30b4b3 139 * wait(5.0);
Yajirushi 3:486fb90dc7d5 140 * l6470.stop(1);
Yajirushi 3:486fb90dc7d5 141 * l6470.stop(2);
Yajirushi 1:db64ad30b4b3 142 *
Yajirushi 3:486fb90dc7d5 143 * //Waiting... until motor "absolute stop".
Yajirushi 3:486fb90dc7d5 144 * while(l6470.isBusy(1) || l6470.isBusy(2));
Yajirushi 3:486fb90dc7d5 145 *
Yajirushi 3:486fb90dc7d5 146 * wait(3.0);
Yajirushi 3:486fb90dc7d5 147 *
Yajirushi 3:486fb90dc7d5 148 * //Enqueue: Motor No.1 -> 7 rev rotation.(200step/rev * microstep-count * rev count), clockwise.
Yajirushi 3:486fb90dc7d5 149 * l6470.ENQ_move(1, 200*128*7, true);
Yajirushi 3:486fb90dc7d5 150 *
Yajirushi 3:486fb90dc7d5 151 * //Enqueue: Motor No.2 -> 7 rev rotation.(200step/rev * microstep-count * rev count), clockwise.
Yajirushi 3:486fb90dc7d5 152 * l6470.ENQ_move(2, 200*128*7, true);
Yajirushi 1:db64ad30b4b3 153 *
Yajirushi 3:486fb90dc7d5 154 * //Execute Queue
Yajirushi 3:486fb90dc7d5 155 * l6470.Qexec();
Yajirushi 3:486fb90dc7d5 156 *
Yajirushi 3:486fb90dc7d5 157 * //Waiting... until motor "absolute stop".
Yajirushi 3:486fb90dc7d5 158 * while(l6470.isBusy(1) || l6470.isBusy(2));
Yajirushi 3:486fb90dc7d5 159 *
Yajirushi 3:486fb90dc7d5 160 * //Set the rotation speed of the motor No.2 to motor No.1.
Yajirushi 3:486fb90dc7d5 161 * l6470.setMaximumSpeed(1, l6470.getMaximumSpeed(2));
Yajirushi 3:486fb90dc7d5 162 *
Yajirushi 3:486fb90dc7d5 163 * //Back to HOME_POS.("home" is aliase "zero")
Yajirushi 1:db64ad30b4b3 164 * l6470.home(1);
Yajirushi 3:486fb90dc7d5 165 * l6470.zero(2);
Yajirushi 1:db64ad30b4b3 166 * }
Yajirushi 1:db64ad30b4b3 167 * @endcode
Yajirushi 1:db64ad30b4b3 168 */
Yajirushi 0:e1964b6e160c 169 class L6470SDC{
Yajirushi 0:e1964b6e160c 170 public:
Yajirushi 3:486fb90dc7d5 171 /** Constructor:(Serial, SPI, CS)
Yajirushi 3:486fb90dc7d5 172 * @~japanese
Yajirushi 3:486fb90dc7d5 173 * @param tx シリアル通信で使用するTXピン(シリアルデバッグを使用する際は、#define DEBUG_L6470SDCのコメントアウトを解除してください)
Yajirushi 3:486fb90dc7d5 174 * @param rx シリアル通信で使用するRXピン(シリアルデバッグを使用する際は、#define DEBUG_L6470SDCのコメントアウトを解除してください)
Yajirushi 3:486fb90dc7d5 175 * @param mosi SPIのmosiピン
Yajirushi 3:486fb90dc7d5 176 * @param miso SPIのmisoピン
Yajirushi 3:486fb90dc7d5 177 * @param sclk SPIのsclkピン
Yajirushi 3:486fb90dc7d5 178 * @param csel SPIのChipSelectピン
Yajirushi 1:db64ad30b4b3 179 *
Yajirushi 3:486fb90dc7d5 180 * @~english
Yajirushi 3:486fb90dc7d5 181 * @param tx Serial USB_TX PinName (If using Serial-debugging. must be #define DEBUG_L6470SDC)
Yajirushi 3:486fb90dc7d5 182 * @param rx Serial USB_RX PinName (If using Serial-debugging. must be #define DEBUG_L6470SDC)
Yajirushi 1:db64ad30b4b3 183 * @param mosi SPI Master-out PinName
Yajirushi 1:db64ad30b4b3 184 * @param miso SPI Slave-out PinName
Yajirushi 1:db64ad30b4b3 185 * @param sclk SPI Clock PinName
Yajirushi 1:db64ad30b4b3 186 * @param csel SPI ChipSelect PinName
Yajirushi 3:486fb90dc7d5 187 *
Yajirushi 1:db64ad30b4b3 188 * Example:
Yajirushi 3:486fb90dc7d5 189 * @code
Yajirushi 3:486fb90dc7d5 190 * //create instance(case:NXP mbed LPC1768)
Yajirushi 3:486fb90dc7d5 191 * //hardware-SPI -> MOSI:p5, MISO:p6, SCK:p7
Yajirushi 3:486fb90dc7d5 192 * //ChipSelect -> select pin as you like.
Yajirushi 3:486fb90dc7d5 193 * L6470SDC l6470(USBTX, USBRX, p5, p6, p7, p8);
Yajirushi 3:486fb90dc7d5 194 * @endcode
Yajirushi 3:486fb90dc7d5 195 */
Yajirushi 3:486fb90dc7d5 196 L6470SDC(PinName tx, PinName rx, PinName mosi, PinName miso, PinName sclk, PinName csel);
Yajirushi 3:486fb90dc7d5 197
Yajirushi 3:486fb90dc7d5 198 /** Constructor:(Serial, SPI, CS) overlaod
Yajirushi 3:486fb90dc7d5 199 * @~japanese
Yajirushi 3:486fb90dc7d5 200 * @param tx シリアル通信で使用するTXピン(シリアルデバッグを使用する際は、#define DEBUG_L6470SDCのコメントアウトを解除してください)
Yajirushi 3:486fb90dc7d5 201 * @param rx シリアル通信で使用するRXピン(シリアルデバッグを使用する際は、#define DEBUG_L6470SDCのコメントアウトを解除してください)
Yajirushi 3:486fb90dc7d5 202 * @param mosi SPIのmosiピン
Yajirushi 3:486fb90dc7d5 203 * @param miso SPIのmisoピン
Yajirushi 3:486fb90dc7d5 204 * @param sclk SPIのsclkピン
Yajirushi 3:486fb90dc7d5 205 * @param *csel SPIのChipSelectピンのアドレス
Yajirushi 3:486fb90dc7d5 206 *
Yajirushi 3:486fb90dc7d5 207 * @~english
Yajirushi 3:486fb90dc7d5 208 * @param tx Serial USB_TX PinName (If using Serial-debugging. must be #define DEBUG_L6470SDC)
Yajirushi 3:486fb90dc7d5 209 * @param rx Serial USB_RX PinName (If using Serial-debugging. must be #define DEBUG_L6470SDC)
Yajirushi 3:486fb90dc7d5 210 * @param mosi SPI Master-out PinName
Yajirushi 3:486fb90dc7d5 211 * @param miso SPI Slave-out PinName
Yajirushi 3:486fb90dc7d5 212 * @param sclk SPI Clock PinName
Yajirushi 3:486fb90dc7d5 213 * @param *csel SPI ChipSelect Pin Addr
Yajirushi 3:486fb90dc7d5 214 *
Yajirushi 3:486fb90dc7d5 215 * Example:
Yajirushi 3:486fb90dc7d5 216 * @code
Yajirushi 3:486fb90dc7d5 217 * //create instance(case:NXP mbed LPC1768)
Yajirushi 3:486fb90dc7d5 218 * //hardware-SPI -> MOSI:p5, MISO:p6, SCK:p7
Yajirushi 3:486fb90dc7d5 219 *
Yajirushi 3:486fb90dc7d5 220 * //ChipSelect -> select pin as you like.
Yajirushi 3:486fb90dc7d5 221 * DigitalOut l6470cs(p8);
Yajirushi 3:486fb90dc7d5 222 *
Yajirushi 3:486fb90dc7d5 223 * L6470SDC l6470(USBTX, USBRX, p5, p6, p7, &l6470cs );
Yajirushi 3:486fb90dc7d5 224 * @endcode
Yajirushi 3:486fb90dc7d5 225 */
Yajirushi 3:486fb90dc7d5 226 L6470SDC(PinName tx, PinName rx, PinName mosi, PinName miso, PinName sclk, DigitalOut *csel);
Yajirushi 3:486fb90dc7d5 227
Yajirushi 3:486fb90dc7d5 228 /** Constructor:(Serial, SPI, CS) overlaod
Yajirushi 3:486fb90dc7d5 229 * @~japanese
Yajirushi 3:486fb90dc7d5 230 * @param *serial USBシリアルのアドレス(シリアルデバッグを使用する際は、#define DEBUG_L6470SDCのコメントアウトを解除してください)
Yajirushi 3:486fb90dc7d5 231 * @param mosi SPIのmosiピン
Yajirushi 3:486fb90dc7d5 232 * @param miso SPIのmisoピン
Yajirushi 3:486fb90dc7d5 233 * @param sclk SPIのsclkピン
Yajirushi 3:486fb90dc7d5 234 * @param *csel SPIのChipSelectピンのアドレス
Yajirushi 3:486fb90dc7d5 235 *
Yajirushi 3:486fb90dc7d5 236 * @~english
Yajirushi 3:486fb90dc7d5 237 * @param *serial USB Serial Addr (If using Serial-debugging. must be #define DEBUG_L6470SDC)
Yajirushi 3:486fb90dc7d5 238 * @param mosi SPI Master-out PinName
Yajirushi 3:486fb90dc7d5 239 * @param miso SPI Slave-out PinName
Yajirushi 3:486fb90dc7d5 240 * @param sclk SPI Clock PinName
Yajirushi 3:486fb90dc7d5 241 * @param *csel SPI ChipSelect Pin Addr
Yajirushi 3:486fb90dc7d5 242 *
Yajirushi 3:486fb90dc7d5 243 * Example:
Yajirushi 3:486fb90dc7d5 244 * @code
Yajirushi 3:486fb90dc7d5 245 * //create instance(case:NXP mbed LPC1768)
Yajirushi 3:486fb90dc7d5 246 * //hardware-SPI -> MOSI:p5, MISO:p6, SCK:p7
Yajirushi 3:486fb90dc7d5 247 *
Yajirushi 3:486fb90dc7d5 248 * //USB Serial
Yajirushi 3:486fb90dc7d5 249 * Serial l6470Serial(USBTX, USBRX);
Yajirushi 3:486fb90dc7d5 250 *
Yajirushi 3:486fb90dc7d5 251 * L6470SDC l6470( &l6470Serial , p5, p6, p7, p8);
Yajirushi 3:486fb90dc7d5 252 * @endcode
Yajirushi 1:db64ad30b4b3 253 */
Yajirushi 0:e1964b6e160c 254 L6470SDC(Serial *serial, PinName mosi, PinName miso, PinName sclk, PinName csel);
Yajirushi 1:db64ad30b4b3 255
Yajirushi 3:486fb90dc7d5 256 /** Constructor:(Serial, SPI, CS) overlaod
Yajirushi 3:486fb90dc7d5 257 * @~japanese
Yajirushi 3:486fb90dc7d5 258 * @param *serial USBシリアルのアドレス(シリアルデバッグを使用する際は、#define DEBUG_L6470SDCのコメントアウトを解除してください)
Yajirushi 3:486fb90dc7d5 259 * @param mosi SPIのmosiピン
Yajirushi 3:486fb90dc7d5 260 * @param miso SPIのmisoピン
Yajirushi 3:486fb90dc7d5 261 * @param sclk SPIのsclkピン
Yajirushi 3:486fb90dc7d5 262 * @param *csel SPIのChipSelectピンのアドレス
Yajirushi 1:db64ad30b4b3 263 *
Yajirushi 3:486fb90dc7d5 264 * @~english
Yajirushi 3:486fb90dc7d5 265 * @param *serial USB Serial Addr (If using Serial-debugging. must be #define DEBUG_L6470SDC)
Yajirushi 1:db64ad30b4b3 266 * @param mosi SPI Master-out PinName
Yajirushi 1:db64ad30b4b3 267 * @param miso SPI Slave-out PinName
Yajirushi 1:db64ad30b4b3 268 * @param sclk SPI Clock PinName
Yajirushi 3:486fb90dc7d5 269 * @param *csel SPI ChipSelect Pin Addr
Yajirushi 3:486fb90dc7d5 270 *
Yajirushi 1:db64ad30b4b3 271 * Example:
Yajirushi 3:486fb90dc7d5 272 * @code
Yajirushi 3:486fb90dc7d5 273 * //create instance(case:NXP mbed LPC1768)
Yajirushi 3:486fb90dc7d5 274 * //hardware-SPI -> MOSI:p5, MISO:p6, SCK:p7
Yajirushi 3:486fb90dc7d5 275 *
Yajirushi 3:486fb90dc7d5 276 * //USB Serial
Yajirushi 3:486fb90dc7d5 277 * Serial l6470Serial(USBTX, USBRX);
Yajirushi 3:486fb90dc7d5 278 *
Yajirushi 3:486fb90dc7d5 279 * //ChipSelect pin
Yajirushi 3:486fb90dc7d5 280 * DigitalOut l6470cs(p8);
Yajirushi 3:486fb90dc7d5 281 *
Yajirushi 3:486fb90dc7d5 282 * L6470SDC l6470( &l6470Serial , p5, p6, p7, &l6470cs );
Yajirushi 3:486fb90dc7d5 283 * @endcode
Yajirushi 1:db64ad30b4b3 284 */
Yajirushi 0:e1964b6e160c 285 L6470SDC(Serial *serial, PinName mosi, PinName miso, PinName sclk, DigitalOut *csel);
Yajirushi 1:db64ad30b4b3 286
Yajirushi 3:486fb90dc7d5 287 /** Constructor:(Serial, SPI, CS) overlaod
Yajirushi 3:486fb90dc7d5 288 * @~japanese
Yajirushi 3:486fb90dc7d5 289 * @param *serial USBシリアルのアドレス(シリアルデバッグを使用する際は、#define DEBUG_L6470SDCのコメントアウトを解除してください)
Yajirushi 3:486fb90dc7d5 290 * @param *spi SPIのアドレス
Yajirushi 3:486fb90dc7d5 291 * @param csel SPIのChipSelectピン
Yajirushi 1:db64ad30b4b3 292 *
Yajirushi 3:486fb90dc7d5 293 * @~english
Yajirushi 3:486fb90dc7d5 294 * @param *serial USB Serial Addr (If using Serial-debugging. must be #define DEBUG_L6470SDC)
Yajirushi 3:486fb90dc7d5 295 * @param *spi SPI Addr
Yajirushi 1:db64ad30b4b3 296 * @param csel SPI ChipSelect PinName
Yajirushi 3:486fb90dc7d5 297 *
Yajirushi 1:db64ad30b4b3 298 * Example:
Yajirushi 3:486fb90dc7d5 299 * @code
Yajirushi 3:486fb90dc7d5 300 * //create instance(case:NXP mbed LPC1768)
Yajirushi 3:486fb90dc7d5 301 * //hardware-SPI -> MOSI:p5, MISO:p6, SCK:p7
Yajirushi 3:486fb90dc7d5 302 * SPI l6470spi(p5, p6, p7);
Yajirushi 3:486fb90dc7d5 303 *
Yajirushi 3:486fb90dc7d5 304 * //USB Serial
Yajirushi 3:486fb90dc7d5 305 * Serial l6470Serial(USBTX, USBRX);
Yajirushi 3:486fb90dc7d5 306 *
Yajirushi 3:486fb90dc7d5 307 * L6470SDC l6470( &l6470Serial , &l6470spi , p8);
Yajirushi 3:486fb90dc7d5 308 * @endcode
Yajirushi 1:db64ad30b4b3 309 */
Yajirushi 0:e1964b6e160c 310 L6470SDC(Serial *serial, SPI *spi, PinName csel);
Yajirushi 1:db64ad30b4b3 311
Yajirushi 3:486fb90dc7d5 312 /** Constructor:(Serial, SPI, CS) overlaod
Yajirushi 3:486fb90dc7d5 313 * @~japanese
Yajirushi 3:486fb90dc7d5 314 * @param *serial USBシリアルのアドレス(シリアルデバッグを使用する際は、#define DEBUG_L6470SDCのコメントアウトを解除してください)
Yajirushi 3:486fb90dc7d5 315 * @param *spi SPIのアドレス
Yajirushi 3:486fb90dc7d5 316 * @param *csel SPIのChipSelectピンのアドレス
Yajirushi 3:486fb90dc7d5 317 *
Yajirushi 3:486fb90dc7d5 318 * @~english
Yajirushi 3:486fb90dc7d5 319 * @param *serial USB Serial Addr (If using Serial-debugging. must be #define DEBUG_L6470SDC)
Yajirushi 3:486fb90dc7d5 320 * @param *spi SPI Addr
Yajirushi 3:486fb90dc7d5 321 * @param *csel SPI ChipSelect Pin Addr
Yajirushi 1:db64ad30b4b3 322 *
Yajirushi 1:db64ad30b4b3 323 * Example:
Yajirushi 3:486fb90dc7d5 324 * @code
Yajirushi 3:486fb90dc7d5 325 * //create instance(case:NXP mbed LPC1768)
Yajirushi 3:486fb90dc7d5 326 * //hardware-SPI -> MOSI:p5, MISO:p6, SCK:p7
Yajirushi 3:486fb90dc7d5 327 * SPI l6470spi(p5, p6, p7);
Yajirushi 3:486fb90dc7d5 328 *
Yajirushi 3:486fb90dc7d5 329 * //USB Serial
Yajirushi 3:486fb90dc7d5 330 * Serial l6470Serial(USBTX, USBRX);
Yajirushi 3:486fb90dc7d5 331 *
Yajirushi 3:486fb90dc7d5 332 * //ChipSelect pin
Yajirushi 3:486fb90dc7d5 333 * DigitalOut l6470cs(p8);
Yajirushi 3:486fb90dc7d5 334 *
Yajirushi 3:486fb90dc7d5 335 * L6470SDC l6470( &l6470Serial , &l6470spi , &l6470cs );
Yajirushi 3:486fb90dc7d5 336 * @endcode
Yajirushi 1:db64ad30b4b3 337 */
Yajirushi 0:e1964b6e160c 338 L6470SDC(Serial *serial, SPI *spi, DigitalOut *csel);
Yajirushi 1:db64ad30b4b3 339
Yajirushi 3:486fb90dc7d5 340 /** Constructor:(SPI, CS) overload
Yajirushi 3:486fb90dc7d5 341 * @~japanese
Yajirushi 3:486fb90dc7d5 342 * @param mosi SPIのmosiピン
Yajirushi 3:486fb90dc7d5 343 * @param miso SPIのmisoピン
Yajirushi 3:486fb90dc7d5 344 * @param sclk SPIのsclkピン
Yajirushi 3:486fb90dc7d5 345 * @param csel SPIのChipSelectピン
Yajirushi 1:db64ad30b4b3 346 *
Yajirushi 3:486fb90dc7d5 347 * @~english
Yajirushi 1:db64ad30b4b3 348 * @param mosi SPI Master-out PinName
Yajirushi 1:db64ad30b4b3 349 * @param miso SPI Slave-out PinName
Yajirushi 1:db64ad30b4b3 350 * @param sclk SPI Clock PinName
Yajirushi 1:db64ad30b4b3 351 * @param csel SPI ChipSelect PinName
Yajirushi 3:486fb90dc7d5 352 *
Yajirushi 3:486fb90dc7d5 353 * Example:
Yajirushi 3:486fb90dc7d5 354 * @code
Yajirushi 3:486fb90dc7d5 355 * //create instance(case:NXP mbed LPC1768)
Yajirushi 3:486fb90dc7d5 356 * //hardware-SPI -> MOSI:p5, MISO:p6, SCK:p7
Yajirushi 3:486fb90dc7d5 357 * //ChipSelect -> select pin as you like.
Yajirushi 3:486fb90dc7d5 358 * L6470SDC l6470(p5, p6, p7, p8);
Yajirushi 3:486fb90dc7d5 359 * @endcode
Yajirushi 1:db64ad30b4b3 360 */
Yajirushi 0:e1964b6e160c 361 L6470SDC(PinName mosi, PinName miso, PinName sclk, PinName csel);
Yajirushi 1:db64ad30b4b3 362
Yajirushi 3:486fb90dc7d5 363 /** Constructor:(SPI, CS) overlaod
Yajirushi 3:486fb90dc7d5 364 * @~japanese
Yajirushi 3:486fb90dc7d5 365 * @param mosi SPIのmosiピン
Yajirushi 3:486fb90dc7d5 366 * @param miso SPIのmisoピン
Yajirushi 3:486fb90dc7d5 367 * @param sclk SPIのsclkピン
Yajirushi 3:486fb90dc7d5 368 * @param *csel SPIのChipSelectピンのアドレス
Yajirushi 1:db64ad30b4b3 369 *
Yajirushi 3:486fb90dc7d5 370 * @~english
Yajirushi 1:db64ad30b4b3 371 * @param mosi SPI Master-out PinName
Yajirushi 1:db64ad30b4b3 372 * @param miso SPI Slave-out PinName
Yajirushi 1:db64ad30b4b3 373 * @param sclk SPI Clock PinName
Yajirushi 3:486fb90dc7d5 374 * @param *csel SPI ChipSelect Pin Addr
Yajirushi 3:486fb90dc7d5 375 *
Yajirushi 1:db64ad30b4b3 376 * Example:
Yajirushi 3:486fb90dc7d5 377 * @code
Yajirushi 3:486fb90dc7d5 378 * //create instance(case:NXP mbed LPC1768)
Yajirushi 3:486fb90dc7d5 379 * //hardware-SPI -> MOSI:p5, MISO:p6, SCK:p7
Yajirushi 3:486fb90dc7d5 380 *
Yajirushi 3:486fb90dc7d5 381 * //ChipSelect -> select pin as you like.
Yajirushi 3:486fb90dc7d5 382 * DigitalOut l6470cs(p8);
Yajirushi 3:486fb90dc7d5 383 *
Yajirushi 3:486fb90dc7d5 384 * L6470SDC l6470(p5, p6, p7, &l6470cs );
Yajirushi 3:486fb90dc7d5 385 * @endcode
Yajirushi 1:db64ad30b4b3 386 */
Yajirushi 0:e1964b6e160c 387 L6470SDC(PinName mosi, PinName miso, PinName sclk, DigitalOut *csel);
Yajirushi 1:db64ad30b4b3 388
Yajirushi 3:486fb90dc7d5 389 /** Constructor:(SPI, CS) overlaod
Yajirushi 3:486fb90dc7d5 390 * @~japanese
Yajirushi 3:486fb90dc7d5 391 * @param *spi SPIのアドレス
Yajirushi 3:486fb90dc7d5 392 * @param csel SPIのChipSelectピン
Yajirushi 1:db64ad30b4b3 393 *
Yajirushi 3:486fb90dc7d5 394 * @~english
Yajirushi 3:486fb90dc7d5 395 * @param *spi SPI Addr
Yajirushi 1:db64ad30b4b3 396 * @param csel SPI ChipSelect PinName
Yajirushi 3:486fb90dc7d5 397 *
Yajirushi 1:db64ad30b4b3 398 * Example:
Yajirushi 3:486fb90dc7d5 399 * @code
Yajirushi 3:486fb90dc7d5 400 * //create instance(case:NXP mbed LPC1768)
Yajirushi 3:486fb90dc7d5 401 * //hardware-SPI -> MOSI:p5, MISO:p6, SCK:p7
Yajirushi 3:486fb90dc7d5 402 * SPI l6470spi(p5, p6, p7);
Yajirushi 3:486fb90dc7d5 403 *
Yajirushi 3:486fb90dc7d5 404 * L6470SDC l6470( &l6470spi , p8);
Yajirushi 3:486fb90dc7d5 405 * @endcode
Yajirushi 1:db64ad30b4b3 406 */
Yajirushi 0:e1964b6e160c 407 L6470SDC(SPI *spi, PinName csel);
Yajirushi 1:db64ad30b4b3 408
Yajirushi 3:486fb90dc7d5 409 /** Constructor:(SPI, CS) overlaod
Yajirushi 3:486fb90dc7d5 410 * @~japanese
Yajirushi 3:486fb90dc7d5 411 * @param *spi SPIのアドレス
Yajirushi 3:486fb90dc7d5 412 * @param *csel SPIのChipSelectピンのアドレス
Yajirushi 3:486fb90dc7d5 413 *
Yajirushi 3:486fb90dc7d5 414 * @~english
Yajirushi 3:486fb90dc7d5 415 * @param *spi SPI Addr
Yajirushi 3:486fb90dc7d5 416 * @param *csel SPI ChipSelect Pin Addr
Yajirushi 1:db64ad30b4b3 417 *
Yajirushi 1:db64ad30b4b3 418 * Example:
Yajirushi 3:486fb90dc7d5 419 * @code
Yajirushi 3:486fb90dc7d5 420 * //create instance(case:NXP mbed LPC1768)
Yajirushi 3:486fb90dc7d5 421 * //hardware-SPI -> MOSI:p5, MISO:p6, SCK:p7
Yajirushi 3:486fb90dc7d5 422 * SPI l6470spi(p5, p6, p7);
Yajirushi 3:486fb90dc7d5 423 *
Yajirushi 3:486fb90dc7d5 424 * //ChipSelect pin
Yajirushi 3:486fb90dc7d5 425 * DigitalOut l6470cs(p8);
Yajirushi 3:486fb90dc7d5 426 *
Yajirushi 3:486fb90dc7d5 427 * L6470SDC l6470( &l6470Serial , &l6470spi , &l6470cs );
Yajirushi 3:486fb90dc7d5 428 * @endcode
Yajirushi 1:db64ad30b4b3 429 */
Yajirushi 0:e1964b6e160c 430 L6470SDC(SPI *spi, DigitalOut *csel);
Yajirushi 3:486fb90dc7d5 431
Yajirushi 3:486fb90dc7d5 432 /** Destructor
Yajirushi 3:486fb90dc7d5 433 * @~japanese デストラクター(ユーザーが直接呼ぶ必要はありません)
Yajirushi 3:486fb90dc7d5 434 *
Yajirushi 3:486fb90dc7d5 435 * @~english Destructor. may be not called by user.
Yajirushi 3:486fb90dc7d5 436 */
Yajirushi 3:486fb90dc7d5 437 ~L6470SDC();
Yajirushi 0:e1964b6e160c 438
Yajirushi 0:e1964b6e160c 439 private:
Yajirushi 0:e1964b6e160c 440 Serial *pc;
Yajirushi 0:e1964b6e160c 441 SPI *spi;
Yajirushi 0:e1964b6e160c 442 DigitalOut *cs;
Yajirushi 0:e1964b6e160c 443
Yajirushi 0:e1964b6e160c 444 bool hasSerial;
Yajirushi 1:db64ad30b4b3 445 int motor_count;
Yajirushi 3:486fb90dc7d5 446
Yajirushi 3:486fb90dc7d5 447 L6470CMDQ *Queue; //ADD
Yajirushi 0:e1964b6e160c 448
Yajirushi 1:db64ad30b4b3 449 void setCmd(int motorNumber, unsigned char cmdAddress, unsigned long value, int bitLen);
Yajirushi 1:db64ad30b4b3 450 void setParam(int motorNumber, unsigned char regAddress, unsigned long value, int bitLen);
Yajirushi 1:db64ad30b4b3 451 unsigned long getParam(int motorNumber, unsigned char regAddress, int bitLen);
Yajirushi 1:db64ad30b4b3 452 void sendCMD(unsigned char cmd);
Yajirushi 0:e1964b6e160c 453
Yajirushi 0:e1964b6e160c 454 public:
Yajirushi 1:db64ad30b4b3 455 /** Initialize L6470
Yajirushi 3:486fb90dc7d5 456 * @~japanese
Yajirushi 3:486fb90dc7d5 457 * @param initSPI SPIに関するパラメーター(クロックやモード)を初期化しない場合はfalseに(デフォルトはtrue)
Yajirushi 1:db64ad30b4b3 458 *
Yajirushi 3:486fb90dc7d5 459 * @~english
Yajirushi 1:db64ad30b4b3 460 * @param initSPI If initialize SPI parameters.(e.g. clockspeed and mode) = true(default)
Yajirushi 1:db64ad30b4b3 461 */
Yajirushi 3:486fb90dc7d5 462 void init(bool initSPI=true);
Yajirushi 1:db64ad30b4b3 463
Yajirushi 1:db64ad30b4b3 464 /** Get connected(daisy-chained) motor count.
Yajirushi 3:486fb90dc7d5 465 * @~japanese
Yajirushi 3:486fb90dc7d5 466 * @returns デイジーチェーン接続されたモーター(ドライバー)の個数
Yajirushi 1:db64ad30b4b3 467 *
Yajirushi 3:486fb90dc7d5 468 * @~english
Yajirushi 1:db64ad30b4b3 469 * @returns Connected(daisy-chained) motor count. If not using daisy-chain, return always 1. maybe...
Yajirushi 1:db64ad30b4b3 470 */
Yajirushi 1:db64ad30b4b3 471 int getMotorCount();
Yajirushi 0:e1964b6e160c 472
Yajirushi 2:2af83d3ccd97 473 /** Get motor Busy-flag status
Yajirushi 3:486fb90dc7d5 474 * @~japanese
Yajirushi 3:486fb90dc7d5 475 * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定)
Yajirushi 3:486fb90dc7d5 476 * @returns 指定したモーター番号のBUSYフラグ(false = Busy-flag 0, true = Busy-flag 1)
Yajirushi 1:db64ad30b4b3 477 *
Yajirushi 3:486fb90dc7d5 478 * @~english
Yajirushi 1:db64ad30b4b3 479 * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1.
Yajirushi 1:db64ad30b4b3 480 * @returns Busy status.(false = Busy-flag 0, true = Busy-flag 1)
Yajirushi 1:db64ad30b4b3 481 */
Yajirushi 0:e1964b6e160c 482 bool isBusy(int motorNumber);
Yajirushi 1:db64ad30b4b3 483
Yajirushi 2:2af83d3ccd97 484 /** Run motor rotate
Yajirushi 3:486fb90dc7d5 485 * @~japanese
Yajirushi 3:486fb90dc7d5 486 * モーターを指定した速度で回転させます
Yajirushi 3:486fb90dc7d5 487 * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定)
Yajirushi 3:486fb90dc7d5 488 * @param hex_speed 16進数指定でのモーターの回転速度(step毎秒) 。関数 "calcSpd(stepPerSecond)" を使用して16進数換算の値を求めてください。
Yajirushi 3:486fb90dc7d5 489 * @param isClockwise 回転方向。true = 時計まわり. false = 反時計回り。(メーカーによって回転方向が違うかも)
Yajirushi 1:db64ad30b4b3 490 *
Yajirushi 3:486fb90dc7d5 491 * @~english
Yajirushi 3:486fb90dc7d5 492 * At the specified speed, run the motor rotation.
Yajirushi 1:db64ad30b4b3 493 * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1.
Yajirushi 1:db64ad30b4b3 494 * @param hex_speed Motor rotate speed(hex_value Step/s). -> please use "calcSpd(stepPerSecond)" method.
Yajirushi 2:2af83d3ccd97 495 * @param isClockwise Rotate direction. true = clockwise. false = counter-clockwise.
Yajirushi 3:486fb90dc7d5 496 *
Yajirushi 2:2af83d3ccd97 497 * Example:
Yajirushi 3:486fb90dc7d5 498 * @code
Yajirushi 3:486fb90dc7d5 499 * unsigned long calculatedValue = l6470.calcSpd(200); //Calculated "hex value" from "real value".
Yajirushi 3:486fb90dc7d5 500 * l6470.run(1, calculatedValue, true); //200step/s, clockwise
Yajirushi 3:486fb90dc7d5 501 * @endcode
Yajirushi 1:db64ad30b4b3 502 */
Yajirushi 0:e1964b6e160c 503 void run(int motorNumber, unsigned long hex_speed, bool isClockwise);
Yajirushi 1:db64ad30b4b3 504
Yajirushi 2:2af83d3ccd97 505 /** Run motor steps
Yajirushi 3:486fb90dc7d5 506 * @~japanese
Yajirushi 3:486fb90dc7d5 507 * 指定したステップの数だけモーターを回します
Yajirushi 3:486fb90dc7d5 508 * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定)
Yajirushi 3:486fb90dc7d5 509 * @param count 回転させるステップ数。マイクロステップモードを使用している場合は、その値を掛けなければなりません。
Yajirushi 3:486fb90dc7d5 510 * @param isClockwise 回転方向。true = 時計まわり. false = 反時計回り。(メーカーによって回転方向が違うかも)
Yajirushi 2:2af83d3ccd97 511 *
Yajirushi 3:486fb90dc7d5 512 * @~english
Yajirushi 3:486fb90dc7d5 513 * At the specified step count, run the motor rotation.
Yajirushi 2:2af83d3ccd97 514 * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1.
Yajirushi 2:2af83d3ccd97 515 * @param count Steps count. If using Microstep-mode, "count" must be multiplied by Microstep-value.
Yajirushi 2:2af83d3ccd97 516 * @param isClockwise Rotate direction. true = clockwise. false = counter-clockwise.
Yajirushi 3:486fb90dc7d5 517 *
Yajirushi 2:2af83d3ccd97 518 * Example:
Yajirushi 3:486fb90dc7d5 519 * @code
Yajirushi 3:486fb90dc7d5 520 * l6470.stop(1);
Yajirushi 3:486fb90dc7d5 521 * l6470.setStepMode(1, 0x07); //set microstep-mode 0x07 = 1/128 microstep.
Yajirushi 3:486fb90dc7d5 522 * l6470.step(1, 256, false); //(256/128)=2 step, counter cloclwise.
Yajirushi 3:486fb90dc7d5 523 * @endcode
Yajirushi 2:2af83d3ccd97 524 */
Yajirushi 0:e1964b6e160c 525 void step(int motorNumber, unsigned int count, bool isClockwise);
Yajirushi 2:2af83d3ccd97 526
Yajirushi 2:2af83d3ccd97 527 /** Run motor move
Yajirushi 3:486fb90dc7d5 528 * @~japanese
Yajirushi 3:486fb90dc7d5 529 * 指定したステップの数だけモーターを回します
Yajirushi 3:486fb90dc7d5 530 * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定)
Yajirushi 3:486fb90dc7d5 531 * @param stepsCount 回転させるステップ数。マイクロステップモードを使用している場合は、その値を掛けなければなりません。
Yajirushi 3:486fb90dc7d5 532 * @param isClockwise 回転方向。true = 時計まわり. false = 反時計回り。(メーカーによって回転方向が違うかも)
Yajirushi 3:486fb90dc7d5 533 * ステップ数が5未満 の場合 -> 関数 "step(int motorNumber, unsigned int count, bool isClockwise)" を使用
Yajirushi 3:486fb90dc7d5 534 * ステップ数が5以上 の場合 -> この関数を使用したほうがいい(ズレが生じるため)
Yajirushi 2:2af83d3ccd97 535 *
Yajirushi 3:486fb90dc7d5 536 * @~english
Yajirushi 3:486fb90dc7d5 537 * At the specified step count, run the motor rotation.
Yajirushi 2:2af83d3ccd97 538 * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1.
Yajirushi 2:2af83d3ccd97 539 * @param stepsCount Steps count. If using Microstep-mode, "stepsCount" must be multiplied by Microstep-value.
Yajirushi 2:2af83d3ccd97 540 * @param isClockwise Rotate direction. true = clockwise. false = counter-clockwise.
Yajirushi 2:2af83d3ccd97 541 * If less than 5step -> Please use the "step(int motorNumber, unsigned int count, bool isClockwise)".
Yajirushi 2:2af83d3ccd97 542 * If greater than 5step -> Please use this method.
Yajirushi 2:2af83d3ccd97 543 */
Yajirushi 0:e1964b6e160c 544 void move(int motorNumber, unsigned long stepsCount, bool isClockwise);
Yajirushi 2:2af83d3ccd97 545
Yajirushi 2:2af83d3ccd97 546 /** Go to motor ABS position (shortest path)
Yajirushi 3:486fb90dc7d5 547 * @~japanese
Yajirushi 3:486fb90dc7d5 548 * 最短パスで指定した座標まで回転します
Yajirushi 3:486fb90dc7d5 549 * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定)
Yajirushi 3:486fb90dc7d5 550 * @param ABSPos 停止させる絶対座標
Yajirushi 3:486fb90dc7d5 551 * 注意: 絶対座標への回転方向は不定です。移動距離が短いほうに回転します。
Yajirushi 2:2af83d3ccd97 552 *
Yajirushi 3:486fb90dc7d5 553 * @~english
Yajirushi 3:486fb90dc7d5 554 * Motor rotation to the specified position in the shortest path.
Yajirushi 2:2af83d3ccd97 555 * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1.
Yajirushi 2:2af83d3ccd97 556 * @param ABSPos Motor Absolute position.
Yajirushi 2:2af83d3ccd97 557 * CAUTION: This method a motion to ABS position through the shortest path. Rotate direction is not constant.
Yajirushi 2:2af83d3ccd97 558 */
Yajirushi 0:e1964b6e160c 559 void goto1(int motorNumber, unsigned long ABSPos);
Yajirushi 2:2af83d3ccd97 560
Yajirushi 2:2af83d3ccd97 561 /** Go to motor ABS position (Specify the rotate direction)
Yajirushi 3:486fb90dc7d5 562 * @~japanese
Yajirushi 3:486fb90dc7d5 563 * 指定した座標まで回転します
Yajirushi 3:486fb90dc7d5 564 * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定)
Yajirushi 3:486fb90dc7d5 565 * @param ABSPos 停止させる絶対座標
Yajirushi 3:486fb90dc7d5 566 * @param isClockwise 回転方向。true = 時計まわり. false = 反時計回り。(メーカーによって回転方向が違うかも)
Yajirushi 2:2af83d3ccd97 567 *
Yajirushi 3:486fb90dc7d5 568 * @~english
Yajirushi 3:486fb90dc7d5 569 * Motor rotation to the specified position.
Yajirushi 2:2af83d3ccd97 570 * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1.
Yajirushi 2:2af83d3ccd97 571 * @param ABSPos Motor Absolute position.
Yajirushi 2:2af83d3ccd97 572 * @param isClockwise Rotate direction. true = clockwise. false = counter-clockwise.
Yajirushi 2:2af83d3ccd97 573 */
Yajirushi 0:e1964b6e160c 574 void goto2(int motorNumber, unsigned long ABSPos, bool isClockwise);
Yajirushi 2:2af83d3ccd97 575
Yajirushi 2:2af83d3ccd97 576 /** ???Run motor rotate. Until external switch status change???
Yajirushi 3:486fb90dc7d5 577 * @~japanese
Yajirushi 3:486fb90dc7d5 578 * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定)
Yajirushi 3:486fb90dc7d5 579 * @param hex_speed 16進数指定でのモーターの回転速度(step毎秒) 。関数 "calcSpd(stepPerSecond)" を使用して16進数換算の値を求めてください。
Yajirushi 3:486fb90dc7d5 580 * @param isClockwise 回転方向。true = 時計まわり. false = 反時計回り。(メーカーによって回転方向が違うかも)
Yajirushi 3:486fb90dc7d5 581 * @param setMark 外部スイッチのステータス? ごめん。よくわかんないからデータシート見てね。
Yajirushi 2:2af83d3ccd97 582 *
Yajirushi 3:486fb90dc7d5 583 * @~english
Yajirushi 2:2af83d3ccd97 584 * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1.
Yajirushi 2:2af83d3ccd97 585 * @param hex_speed Motor rotate speed(hex_value Step/s). -> please use "calcSpd(stepPerSecond)" method.
Yajirushi 2:2af83d3ccd97 586 * @param isClockwise Rotate direction. true = clockwise. false = counter-clockwise.
Yajirushi 2:2af83d3ccd97 587 * @param setMark External switch status?...??.. Sorry... I could not understand. Please see L6470 datasheet.
Yajirushi 2:2af83d3ccd97 588 */
Yajirushi 0:e1964b6e160c 589 void goUntil(int motorNumber, unsigned long hex_speed, bool isClockwise, bool setMark);
Yajirushi 2:2af83d3ccd97 590
Yajirushi 2:2af83d3ccd97 591 /** ???Release external switch???
Yajirushi 3:486fb90dc7d5 592 * @~japanese
Yajirushi 3:486fb90dc7d5 593 * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定)
Yajirushi 3:486fb90dc7d5 594 * @param isClockwise 回転方向。true = 時計まわり. false = 反時計回り。(メーカーによって回転方向が違うかも)
Yajirushi 3:486fb90dc7d5 595 * @param setMark 外部スイッチのステータス? ごめん。よくわかんないからデータシート見てね。
Yajirushi 2:2af83d3ccd97 596 *
Yajirushi 3:486fb90dc7d5 597 * @~english
Yajirushi 2:2af83d3ccd97 598 * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1.
Yajirushi 2:2af83d3ccd97 599 * @param isClockwise Rotate direction. true = clockwise. false = counter-clockwise.
Yajirushi 2:2af83d3ccd97 600 * @param setMark External switch status?...??.. Sorry... I could not understand. Please see L6470 datasheet.
Yajirushi 2:2af83d3ccd97 601 */
Yajirushi 0:e1964b6e160c 602 void releaseSwitch(int motorNumber, bool isClockwise, bool setMark);
Yajirushi 2:2af83d3ccd97 603
Yajirushi 2:2af83d3ccd97 604 /** Go to motor home-position
Yajirushi 3:486fb90dc7d5 605 * @~japanese
Yajirushi 3:486fb90dc7d5 606 * モーターを原点復帰させます
Yajirushi 3:486fb90dc7d5 607 * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定)
Yajirushi 2:2af83d3ccd97 608 *
Yajirushi 3:486fb90dc7d5 609 * @~english
Yajirushi 3:486fb90dc7d5 610 * Return the motor to the zero-potition.
Yajirushi 2:2af83d3ccd97 611 * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1.
Yajirushi 2:2af83d3ccd97 612 */
Yajirushi 0:e1964b6e160c 613 void home(int motorNumber);
Yajirushi 2:2af83d3ccd97 614
Yajirushi 2:2af83d3ccd97 615 /** Go to motor home-position [alias: home(int motorNumber)]
Yajirushi 3:486fb90dc7d5 616 * @~japanese
Yajirushi 3:486fb90dc7d5 617 * モーターを原点復帰させます
Yajirushi 3:486fb90dc7d5 618 * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定)
Yajirushi 2:2af83d3ccd97 619 *
Yajirushi 3:486fb90dc7d5 620 * @~english
Yajirushi 3:486fb90dc7d5 621 * Return the motor to the zero-potition.
Yajirushi 2:2af83d3ccd97 622 * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1.
Yajirushi 2:2af83d3ccd97 623 */
Yajirushi 0:e1964b6e160c 624 void zero(int motorNumber);
Yajirushi 2:2af83d3ccd97 625
Yajirushi 2:2af83d3ccd97 626 /** Go to motor marked-position
Yajirushi 3:486fb90dc7d5 627 * @~japanese
Yajirushi 3:486fb90dc7d5 628 * 指定されたマーク位置まで回転します
Yajirushi 3:486fb90dc7d5 629 * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定)
Yajirushi 3:486fb90dc7d5 630 * マーク位置: -> 関数 "setMarkPosition(int motorNumber, unsigned long value)" を使用してください
Yajirushi 2:2af83d3ccd97 631 *
Yajirushi 3:486fb90dc7d5 632 * @~english
Yajirushi 3:486fb90dc7d5 633 * Motor rotation to the specified MARK Position.
Yajirushi 2:2af83d3ccd97 634 * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1.
Yajirushi 3:486fb90dc7d5 635 * MARK Position: -> Please use setMarkPosition(int motorNumber, unsigned long value).
Yajirushi 2:2af83d3ccd97 636 */
Yajirushi 0:e1964b6e160c 637 void gotoMark(int motorNumber);
Yajirushi 2:2af83d3ccd97 638
Yajirushi 2:2af83d3ccd97 639 /** Reset the ABS_POS register to zero (ABS_POS zero = home-position)
Yajirushi 3:486fb90dc7d5 640 * @~japanese
Yajirushi 3:486fb90dc7d5 641 * 現在位置を原点に設定します
Yajirushi 3:486fb90dc7d5 642 * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定)
Yajirushi 2:2af83d3ccd97 643 *
Yajirushi 3:486fb90dc7d5 644 * @~english
Yajirushi 3:486fb90dc7d5 645 * Set the zero-position to current position.
Yajirushi 2:2af83d3ccd97 646 * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1.
Yajirushi 2:2af83d3ccd97 647 */
Yajirushi 0:e1964b6e160c 648 void resetHome(int motorNumber);
Yajirushi 2:2af83d3ccd97 649
Yajirushi 3:486fb90dc7d5 650 /** Reset the ABS_POS register to zero (ABS_POS zero = home-position) [alias: resetHome(int motorNumber)]
Yajirushi 3:486fb90dc7d5 651 * @~japanese
Yajirushi 3:486fb90dc7d5 652 * キューに追加:現在位置を原点に設定します
Yajirushi 3:486fb90dc7d5 653 * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定)
Yajirushi 2:2af83d3ccd97 654 *
Yajirushi 3:486fb90dc7d5 655 * @~english
Yajirushi 3:486fb90dc7d5 656 * Set the zero-position to current position.
Yajirushi 2:2af83d3ccd97 657 * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1.
Yajirushi 2:2af83d3ccd97 658 */
Yajirushi 0:e1964b6e160c 659 void resetZero(int motorNumber);
Yajirushi 2:2af83d3ccd97 660
Yajirushi 3:486fb90dc7d5 661 /** Reset L6470.(software reset)
Yajirushi 3:486fb90dc7d5 662 * @~japanese
Yajirushi 3:486fb90dc7d5 663 * デバイスをリセットします
Yajirushi 3:486fb90dc7d5 664 * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定)
Yajirushi 2:2af83d3ccd97 665 *
Yajirushi 3:486fb90dc7d5 666 * @~english
Yajirushi 3:486fb90dc7d5 667 * Reset L6470 driver & motor.
Yajirushi 2:2af83d3ccd97 668 * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1.
Yajirushi 2:2af83d3ccd97 669 */
Yajirushi 0:e1964b6e160c 670 void motorReset(int motorNumber);
Yajirushi 2:2af83d3ccd97 671
Yajirushi 2:2af83d3ccd97 672 /** Stop rotation (soft-stop)
Yajirushi 3:486fb90dc7d5 673 * @~japanese
Yajirushi 3:486fb90dc7d5 674 * モーターを停止
Yajirushi 3:486fb90dc7d5 675 * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定)
Yajirushi 2:2af83d3ccd97 676 *
Yajirushi 3:486fb90dc7d5 677 * @~english
Yajirushi 3:486fb90dc7d5 678 * Stop motor.
Yajirushi 2:2af83d3ccd97 679 * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1.
Yajirushi 2:2af83d3ccd97 680 */
Yajirushi 0:e1964b6e160c 681 void stop(int motorNumber);
Yajirushi 2:2af83d3ccd97 682
Yajirushi 2:2af83d3ccd97 683 /** Stop rotation. Ignore deceleration (hard-stop)
Yajirushi 3:486fb90dc7d5 684 * @~japanese
Yajirushi 3:486fb90dc7d5 685 * 減速を無視して停止
Yajirushi 3:486fb90dc7d5 686 * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定)
Yajirushi 2:2af83d3ccd97 687 *
Yajirushi 3:486fb90dc7d5 688 * @~english
Yajirushi 3:486fb90dc7d5 689 * Stop immediately motor.
Yajirushi 2:2af83d3ccd97 690 * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1.
Yajirushi 2:2af83d3ccd97 691 */
Yajirushi 0:e1964b6e160c 692 void stopImmidiate(int motorNumber);
Yajirushi 2:2af83d3ccd97 693
Yajirushi 2:2af83d3ccd97 694 /** Stop rotation (soft-stop) state sets HighImpedance.
Yajirushi 3:486fb90dc7d5 695 * @~japanese
Yajirushi 3:486fb90dc7d5 696 * モーターを停止し、実行後ハイインピーダンス状態にします
Yajirushi 3:486fb90dc7d5 697 * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定)
Yajirushi 2:2af83d3ccd97 698 *
Yajirushi 3:486fb90dc7d5 699 * @~english
Yajirushi 3:486fb90dc7d5 700 * Stop motor. Set state "High Impedance" after stop.
Yajirushi 2:2af83d3ccd97 701 * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1.
Yajirushi 2:2af83d3ccd97 702 */
Yajirushi 0:e1964b6e160c 703 void stop_HighImpedance(int motorNumber);
Yajirushi 2:2af83d3ccd97 704
Yajirushi 2:2af83d3ccd97 705 /** Stop rotation. Ignore deceleration (hard-stop) state sets HighImpedance.
Yajirushi 3:486fb90dc7d5 706 * @~japanese
Yajirushi 3:486fb90dc7d5 707 * 減速を無視して停止し、実行後ハイインピーダンス状態にします
Yajirushi 3:486fb90dc7d5 708 * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定)
Yajirushi 2:2af83d3ccd97 709 *
Yajirushi 3:486fb90dc7d5 710 * @~english
Yajirushi 3:486fb90dc7d5 711 * Stop immediately motor. Set state "High Impedance" after stop.
Yajirushi 2:2af83d3ccd97 712 * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1.
Yajirushi 2:2af83d3ccd97 713 */
Yajirushi 0:e1964b6e160c 714 void stopImmidiate_HighImpedance(int motorNumber);
Yajirushi 0:e1964b6e160c 715
Yajirushi 3:486fb90dc7d5 716 //Daisy-chain Queue Method -----------------------------------------------------
Yajirushi 3:486fb90dc7d5 717 /** Enqueue Command [NOP]
Yajirushi 3:486fb90dc7d5 718 * @~japanese
Yajirushi 3:486fb90dc7d5 719 * キューに追加:何も実行しない
Yajirushi 3:486fb90dc7d5 720 * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定)
Yajirushi 3:486fb90dc7d5 721 *
Yajirushi 3:486fb90dc7d5 722 * @~english
Yajirushi 3:486fb90dc7d5 723 * Add Queue:No operation.
Yajirushi 3:486fb90dc7d5 724 * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1.
Yajirushi 3:486fb90dc7d5 725 */
Yajirushi 3:486fb90dc7d5 726 int ENQ_nop(int motorNumber);
Yajirushi 3:486fb90dc7d5 727
Yajirushi 3:486fb90dc7d5 728 /** Enqueue Command [run]
Yajirushi 3:486fb90dc7d5 729 * @~japanese
Yajirushi 3:486fb90dc7d5 730 * キューに追加:モーターを指定した速度で回転させます
Yajirushi 3:486fb90dc7d5 731 * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定)
Yajirushi 3:486fb90dc7d5 732 * @param hex_speed 16進数指定でのモーターの回転速度(step毎秒) 。関数 "calcSpd(stepPerSecond)" を使用して16進数換算の値を求めてください。
Yajirushi 3:486fb90dc7d5 733 * @param isClockwise 回転方向。true = 時計まわり. false = 反時計回り。(メーカーによって回転方向が違うかも)
Yajirushi 3:486fb90dc7d5 734 *
Yajirushi 3:486fb90dc7d5 735 * @~english
Yajirushi 3:486fb90dc7d5 736 * Add Queue:At the specified speed, run the motor rotation.
Yajirushi 3:486fb90dc7d5 737 * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1.
Yajirushi 3:486fb90dc7d5 738 * @param hex_speed Motor rotate speed(hex_value Step/s). -> please use "calcSpd(stepPerSecond)" method.
Yajirushi 3:486fb90dc7d5 739 * @param isClockwise Rotate direction. true = clockwise. false = counter-clockwise.
Yajirushi 3:486fb90dc7d5 740 *
Yajirushi 3:486fb90dc7d5 741 * Example:
Yajirushi 3:486fb90dc7d5 742 * @code
Yajirushi 3:486fb90dc7d5 743 * unsigned long calculatedValue = l6470.calcSpd(200); //Calculated "hex value" from "real value".
Yajirushi 3:486fb90dc7d5 744 * l6470.ENQ_run(1, calculatedValue, true); //200step/s, clockwise
Yajirushi 3:486fb90dc7d5 745 * l6470.ENQ_NOP(2);
Yajirushi 3:486fb90dc7d5 746 * l6470.Qexec();
Yajirushi 3:486fb90dc7d5 747 * @endcode
Yajirushi 3:486fb90dc7d5 748 */
Yajirushi 3:486fb90dc7d5 749 int ENQ_run(int motorNumber, unsigned long hex_speed, bool isClockwise);
Yajirushi 3:486fb90dc7d5 750
Yajirushi 3:486fb90dc7d5 751 /** Enqueue Command [move]
Yajirushi 3:486fb90dc7d5 752 * @~japanese
Yajirushi 3:486fb90dc7d5 753 * キューに追加:指定したステップの数だけモーターを回します
Yajirushi 3:486fb90dc7d5 754 * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定)
Yajirushi 3:486fb90dc7d5 755 * @param stepsCount 回転させるステップ数。マイクロステップモードを使用している場合は、その値を掛けなければなりません。
Yajirushi 3:486fb90dc7d5 756 * @param isClockwise 回転方向。true = 時計まわり. false = 反時計回り。(メーカーによって回転方向が違うかも)
Yajirushi 3:486fb90dc7d5 757 *
Yajirushi 3:486fb90dc7d5 758 * @~english
Yajirushi 3:486fb90dc7d5 759 * Add Queue:At the specified step count, run the motor rotation.
Yajirushi 3:486fb90dc7d5 760 * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1.
Yajirushi 3:486fb90dc7d5 761 * @param stepsCount Steps count. If using Microstep-mode, "stepsCount" must be multiplied by Microstep-value.
Yajirushi 3:486fb90dc7d5 762 * @param isClockwise Rotate direction. true = clockwise. false = counter-clockwise.
Yajirushi 3:486fb90dc7d5 763 *
Yajirushi 3:486fb90dc7d5 764 * Example:
Yajirushi 3:486fb90dc7d5 765 * @code
Yajirushi 3:486fb90dc7d5 766 * l6470.stop(1);
Yajirushi 3:486fb90dc7d5 767 * l6470.setStepMode(1, 0x07); //set microstep-mode 0x07 = 1/128 microstep.
Yajirushi 3:486fb90dc7d5 768 * l6470.step(1, 256, false); //(256/128)=2 step, counter cloclwise.
Yajirushi 3:486fb90dc7d5 769 * l6470.step(2, 1024, true); //(1024/128)=8 step, clockwise.
Yajirushi 3:486fb90dc7d5 770 * l6470.Qexec();
Yajirushi 3:486fb90dc7d5 771 * @endcode
Yajirushi 3:486fb90dc7d5 772 */
Yajirushi 3:486fb90dc7d5 773 int ENQ_move(int motorNumber, unsigned long stepsCount, bool isClockwise);
Yajirushi 3:486fb90dc7d5 774
Yajirushi 3:486fb90dc7d5 775 /** Enqueue Command [Goto] (shortest path)
Yajirushi 3:486fb90dc7d5 776 * @~japanese
Yajirushi 3:486fb90dc7d5 777 * キューに追加:最短パスで指定した座標まで回転します
Yajirushi 3:486fb90dc7d5 778 * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定)
Yajirushi 3:486fb90dc7d5 779 * @param ABSPos 停止させる絶対座標
Yajirushi 3:486fb90dc7d5 780 * 注意: 絶対座標への回転方向は不定です。移動距離が短いほうに回転します。
Yajirushi 3:486fb90dc7d5 781 *
Yajirushi 3:486fb90dc7d5 782 * @~english
Yajirushi 3:486fb90dc7d5 783 * Add Queue:Motor rotation to the specified position in the shortest path.
Yajirushi 3:486fb90dc7d5 784 * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1.
Yajirushi 3:486fb90dc7d5 785 * @param ABSPos Motor Absolute position.
Yajirushi 3:486fb90dc7d5 786 * CAUTION: This method a motion to ABS position through the shortest path. Rotate direction is not constant.
Yajirushi 3:486fb90dc7d5 787 */
Yajirushi 3:486fb90dc7d5 788 int ENQ_goto1(int motorNumber, unsigned long ABSPos);
Yajirushi 3:486fb90dc7d5 789
Yajirushi 3:486fb90dc7d5 790 /** Enqueue Command [Goto]
Yajirushi 3:486fb90dc7d5 791 * @~japanese
Yajirushi 3:486fb90dc7d5 792 * キューに追加:最短パスで指定した座標まで回転します
Yajirushi 3:486fb90dc7d5 793 * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定)
Yajirushi 3:486fb90dc7d5 794 * @param ABSPos 停止させる絶対座標
Yajirushi 3:486fb90dc7d5 795 * @param isClockwise 回転方向。true = 時計まわり. false = 反時計回り。(メーカーによって回転方向が違うかも)
Yajirushi 3:486fb90dc7d5 796 *
Yajirushi 3:486fb90dc7d5 797 * @~english
Yajirushi 3:486fb90dc7d5 798 * Add Queue:Motor rotation to the specified position.
Yajirushi 3:486fb90dc7d5 799 * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1.
Yajirushi 3:486fb90dc7d5 800 * @param ABSPos Motor Absolute position.
Yajirushi 3:486fb90dc7d5 801 * @param isClockwise Rotate direction. true = clockwise. false = counter-clockwise.
Yajirushi 3:486fb90dc7d5 802 */
Yajirushi 3:486fb90dc7d5 803 int ENQ_goto2(int motorNumber, unsigned long ABSPos, bool isClockwise);
Yajirushi 3:486fb90dc7d5 804
Yajirushi 3:486fb90dc7d5 805 /** Enqueue Command [???go Until]
Yajirushi 3:486fb90dc7d5 806 * @~japanese
Yajirushi 3:486fb90dc7d5 807 * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定)
Yajirushi 3:486fb90dc7d5 808 * @param hex_speed 16進数指定でのモーターの回転速度(step毎秒) 。関数 "calcSpd(stepPerSecond)" を使用して16進数換算の値を求めてください。
Yajirushi 3:486fb90dc7d5 809 * @param isClockwise 回転方向。true = 時計まわり. false = 反時計回り。(メーカーによって回転方向が違うかも)
Yajirushi 3:486fb90dc7d5 810 * @param setMark 外部スイッチのステータス? ごめん。よくわかんないからデータシート見てね。
Yajirushi 3:486fb90dc7d5 811 *
Yajirushi 3:486fb90dc7d5 812 * @~english
Yajirushi 3:486fb90dc7d5 813 * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1.
Yajirushi 3:486fb90dc7d5 814 * @param hex_speed Motor rotate speed(hex_value Step/s). -> please use "calcSpd(stepPerSecond)" method.
Yajirushi 3:486fb90dc7d5 815 * @param isClockwise Rotate direction. true = clockwise. false = counter-clockwise.
Yajirushi 3:486fb90dc7d5 816 * @param setMark External switch status?...??.. Sorry... I could not understand. Please see L6470 datasheet.
Yajirushi 3:486fb90dc7d5 817 */
Yajirushi 3:486fb90dc7d5 818 int ENQ_goUntil(int motorNumber, unsigned long hex_speed, bool isClockwise, bool setMark);
Yajirushi 3:486fb90dc7d5 819
Yajirushi 3:486fb90dc7d5 820 /** Enqueue Command [???Release external switch]
Yajirushi 3:486fb90dc7d5 821 * @~japanese
Yajirushi 3:486fb90dc7d5 822 * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定)
Yajirushi 3:486fb90dc7d5 823 * @param isClockwise 回転方向。true = 時計まわり. false = 反時計回り。(メーカーによって回転方向が違うかも)
Yajirushi 3:486fb90dc7d5 824 * @param setMark 外部スイッチのステータス? ごめん。よくわかんないからデータシート見てね。
Yajirushi 3:486fb90dc7d5 825 *
Yajirushi 3:486fb90dc7d5 826 * @~english
Yajirushi 3:486fb90dc7d5 827 * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1.
Yajirushi 3:486fb90dc7d5 828 * @param isClockwise Rotate direction. true = clockwise. false = counter-clockwise.
Yajirushi 3:486fb90dc7d5 829 * @param setMark External switch status?...??.. Sorry... I could not understand. Please see L6470 datasheet.
Yajirushi 3:486fb90dc7d5 830 */
Yajirushi 3:486fb90dc7d5 831 int ENQ_releaseSwitch(int motorNumber, bool isClockwise, bool setMark);
Yajirushi 3:486fb90dc7d5 832
Yajirushi 3:486fb90dc7d5 833 /** Enqueue Command [Goto HOME]
Yajirushi 3:486fb90dc7d5 834 * @~japanese
Yajirushi 3:486fb90dc7d5 835 * キューに追加:モーターを原点復帰させます
Yajirushi 3:486fb90dc7d5 836 * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定)
Yajirushi 3:486fb90dc7d5 837 *
Yajirushi 3:486fb90dc7d5 838 * @~english
Yajirushi 3:486fb90dc7d5 839 * Add Queue:Return the motor to the zero-potition.
Yajirushi 3:486fb90dc7d5 840 * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1.
Yajirushi 3:486fb90dc7d5 841 */
Yajirushi 3:486fb90dc7d5 842 int ENQ_home(int motorNumber);
Yajirushi 3:486fb90dc7d5 843
Yajirushi 3:486fb90dc7d5 844 /** Enqueue Command [Goto HOME] [aliase: ENQ_home(int motorNumber)]
Yajirushi 3:486fb90dc7d5 845 * @~japanese
Yajirushi 3:486fb90dc7d5 846 * キューに追加:モーターを原点復帰させます
Yajirushi 3:486fb90dc7d5 847 * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定)
Yajirushi 3:486fb90dc7d5 848 *
Yajirushi 3:486fb90dc7d5 849 * @~english
Yajirushi 3:486fb90dc7d5 850 * Add Queue:Return the motor to the zero-potition.
Yajirushi 3:486fb90dc7d5 851 * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1.
Yajirushi 3:486fb90dc7d5 852 */
Yajirushi 3:486fb90dc7d5 853 int ENQ_zero(int motorNumber);
Yajirushi 3:486fb90dc7d5 854
Yajirushi 3:486fb90dc7d5 855 /** Enqueue Command [Goto MARK]
Yajirushi 3:486fb90dc7d5 856 * @~japanese
Yajirushi 3:486fb90dc7d5 857 * キューに追加:指定されたマーク位置まで回転します
Yajirushi 3:486fb90dc7d5 858 * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定)
Yajirushi 3:486fb90dc7d5 859 * マーク位置: -> 関数 "setMarkPosition(int motorNumber, unsigned long value)" を使用してください
Yajirushi 3:486fb90dc7d5 860 *
Yajirushi 3:486fb90dc7d5 861 * @~english
Yajirushi 3:486fb90dc7d5 862 * Add Queue:Motor rotation to the specified MARK Position.
Yajirushi 3:486fb90dc7d5 863 * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1.
Yajirushi 3:486fb90dc7d5 864 * MARK Position: -> Please use setMarkPosition(int motorNumber, unsigned long value).
Yajirushi 3:486fb90dc7d5 865 */
Yajirushi 3:486fb90dc7d5 866 int ENQ_gotoMark(int motorNumber);
Yajirushi 3:486fb90dc7d5 867
Yajirushi 3:486fb90dc7d5 868 /** Enqueue Command [Reset HOME] (ABS_POS zero = home-position)
Yajirushi 3:486fb90dc7d5 869 * @~japanese
Yajirushi 3:486fb90dc7d5 870 * キューに追加:現在位置を原点に設定します
Yajirushi 3:486fb90dc7d5 871 * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定)
Yajirushi 3:486fb90dc7d5 872 *
Yajirushi 3:486fb90dc7d5 873 * @~english
Yajirushi 3:486fb90dc7d5 874 * Add Queue:Set the zero-position to current position.
Yajirushi 3:486fb90dc7d5 875 * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1.
Yajirushi 3:486fb90dc7d5 876 */
Yajirushi 3:486fb90dc7d5 877 int ENQ_resetHome(int motorNumber);
Yajirushi 3:486fb90dc7d5 878
Yajirushi 3:486fb90dc7d5 879 /** Enqueue Command [Reset HOME] [alias: ENQ_resetHome(int motorNumber)]
Yajirushi 3:486fb90dc7d5 880 * @~japanese
Yajirushi 3:486fb90dc7d5 881 * キューに追加:現在位置を原点に設定します
Yajirushi 3:486fb90dc7d5 882 * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定)
Yajirushi 3:486fb90dc7d5 883 *
Yajirushi 3:486fb90dc7d5 884 * @~english
Yajirushi 3:486fb90dc7d5 885 * Add Queue:Set the zero-position to current position.
Yajirushi 3:486fb90dc7d5 886 * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1.
Yajirushi 3:486fb90dc7d5 887 */
Yajirushi 3:486fb90dc7d5 888 int ENQ_resetZero(int motorNumber);
Yajirushi 0:e1964b6e160c 889
Yajirushi 3:486fb90dc7d5 890 /** Enqueue Command [Reset L6470] (software reset)
Yajirushi 3:486fb90dc7d5 891 * @~japanese
Yajirushi 3:486fb90dc7d5 892 * キューに追加:デバイスをリセットします
Yajirushi 3:486fb90dc7d5 893 * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定)
Yajirushi 3:486fb90dc7d5 894 *
Yajirushi 3:486fb90dc7d5 895 * @~english
Yajirushi 3:486fb90dc7d5 896 * Add Queue:Reset L6470 driver & motor.
Yajirushi 3:486fb90dc7d5 897 * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1.
Yajirushi 3:486fb90dc7d5 898 */
Yajirushi 3:486fb90dc7d5 899 int ENQ_motorReset(int motorNumber);
Yajirushi 3:486fb90dc7d5 900
Yajirushi 3:486fb90dc7d5 901 /** Enqueue Command [stop] (soft-stop)
Yajirushi 3:486fb90dc7d5 902 * @~japanese
Yajirushi 3:486fb90dc7d5 903 * キューに追加:モーターを停止
Yajirushi 3:486fb90dc7d5 904 * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定)
Yajirushi 3:486fb90dc7d5 905 *
Yajirushi 3:486fb90dc7d5 906 * @~english
Yajirushi 3:486fb90dc7d5 907 * Add Queue:Stop motor.
Yajirushi 3:486fb90dc7d5 908 * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1.
Yajirushi 3:486fb90dc7d5 909 */
Yajirushi 3:486fb90dc7d5 910 int ENQ_stop(int motorNumber);
Yajirushi 3:486fb90dc7d5 911
Yajirushi 3:486fb90dc7d5 912 /** Enqueue Command [hard stop]
Yajirushi 3:486fb90dc7d5 913 * @~japanese
Yajirushi 3:486fb90dc7d5 914 * キューに追加:減速を無視して停止
Yajirushi 3:486fb90dc7d5 915 * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定)
Yajirushi 3:486fb90dc7d5 916 *
Yajirushi 3:486fb90dc7d5 917 * @~english
Yajirushi 3:486fb90dc7d5 918 * Add Queue:Stop immediately motor.
Yajirushi 3:486fb90dc7d5 919 * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1.
Yajirushi 3:486fb90dc7d5 920 */
Yajirushi 3:486fb90dc7d5 921 int ENQ_stopImmidiate(int motorNumber);
Yajirushi 3:486fb90dc7d5 922
Yajirushi 3:486fb90dc7d5 923 /** Enqueue Command [HIZ stop]
Yajirushi 3:486fb90dc7d5 924 * @~japanese
Yajirushi 3:486fb90dc7d5 925 * キューに追加:モーターを停止し、実行後ハイインピーダンス状態にします
Yajirushi 3:486fb90dc7d5 926 * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定)
Yajirushi 3:486fb90dc7d5 927 *
Yajirushi 3:486fb90dc7d5 928 * @~english
Yajirushi 3:486fb90dc7d5 929 * Add Queue:Stop motor. Set state "High Impedance" after stop.
Yajirushi 3:486fb90dc7d5 930 * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1.
Yajirushi 3:486fb90dc7d5 931 */
Yajirushi 3:486fb90dc7d5 932 int ENQ_stop_HighImpedance(int motorNumber);
Yajirushi 3:486fb90dc7d5 933
Yajirushi 3:486fb90dc7d5 934 /** Enqueue Command [HIZ hard stop]
Yajirushi 3:486fb90dc7d5 935 * @~japanese
Yajirushi 3:486fb90dc7d5 936 * キューに追加:減速を無視して停止し、実行後ハイインピーダンス状態にします
Yajirushi 3:486fb90dc7d5 937 * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定)
Yajirushi 3:486fb90dc7d5 938 *
Yajirushi 3:486fb90dc7d5 939 * @~english
Yajirushi 3:486fb90dc7d5 940 * Add Queue:Stop immediately motor. Set state "High Impedance" after stop.
Yajirushi 3:486fb90dc7d5 941 * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1.
Yajirushi 3:486fb90dc7d5 942 */
Yajirushi 3:486fb90dc7d5 943 int ENQ_stopImmidiate_HighImpedance(int motorNumber);
Yajirushi 3:486fb90dc7d5 944
Yajirushi 3:486fb90dc7d5 945 /** Clear Queue
Yajirushi 3:486fb90dc7d5 946 * @~japanese コマンドキューを全てクリアします
Yajirushi 3:486fb90dc7d5 947 * @~english Command Queue all zero clear.
Yajirushi 3:486fb90dc7d5 948 */
Yajirushi 3:486fb90dc7d5 949 void Qclear();
Yajirushi 3:486fb90dc7d5 950
Yajirushi 3:486fb90dc7d5 951 /** Execute Queue
Yajirushi 3:486fb90dc7d5 952 * @~japanese
Yajirushi 3:486fb90dc7d5 953 * コマンドキューに格納されたコマンドを一度に実行します
Yajirushi 3:486fb90dc7d5 954 * @param finallyClearQueue 実行後にキューをクリアする(デフォルトはtrue)
Yajirushi 3:486fb90dc7d5 955 *
Yajirushi 3:486fb90dc7d5 956 * @~english
Yajirushi 3:486fb90dc7d5 957 * Execute Command Queue.
Yajirushi 3:486fb90dc7d5 958 * @param finallyClearQueue Clear Queue after execution.(default=true)
Yajirushi 3:486fb90dc7d5 959 */
Yajirushi 3:486fb90dc7d5 960 int Qexec(bool finallyClearQueue=true);
Yajirushi 3:486fb90dc7d5 961
Yajirushi 3:486fb90dc7d5 962 // calc method -----------------------------------------------------------------
Yajirushi 3:486fb90dc7d5 963 /** Caluculate HEX value from Speed value
Yajirushi 3:486fb90dc7d5 964 * @~japanese
Yajirushi 3:486fb90dc7d5 965 * 速度(step/s)をパラメーター用数値に変換します
Yajirushi 3:486fb90dc7d5 966 * @param stepPerSecond 回転速度(step/s)
Yajirushi 3:486fb90dc7d5 967 *
Yajirushi 3:486fb90dc7d5 968 * @returns 変換された16進数値
Yajirushi 3:486fb90dc7d5 969 *
Yajirushi 3:486fb90dc7d5 970 * @~english
Yajirushi 3:486fb90dc7d5 971 * Convert to Param(Hex) value from real speed value(step/s).
Yajirushi 3:486fb90dc7d5 972 * @param stepPerSecond Motor rotate speed(step/s).
Yajirushi 3:486fb90dc7d5 973 *
Yajirushi 3:486fb90dc7d5 974 * @returns Converted value.
Yajirushi 3:486fb90dc7d5 975 */
Yajirushi 3:486fb90dc7d5 976 unsigned long calcSpd(float stepPerSecond);
Yajirushi 3:486fb90dc7d5 977
Yajirushi 3:486fb90dc7d5 978 /** Caluculate HEX value from Acceleration speed value
Yajirushi 3:486fb90dc7d5 979 * @~japanese
Yajirushi 3:486fb90dc7d5 980 * 加速速度(step/s^2)をパラメーター用数値に変換します
Yajirushi 3:486fb90dc7d5 981 * @param stepPerSecond 加速速度(step/s^2)
Yajirushi 3:486fb90dc7d5 982 *
Yajirushi 3:486fb90dc7d5 983 * @returns 変換された16進数値
Yajirushi 3:486fb90dc7d5 984 *
Yajirushi 3:486fb90dc7d5 985 * @~english
Yajirushi 3:486fb90dc7d5 986 * Convert to Param(Hex) value from acceleration speed value(step/s^2).
Yajirushi 3:486fb90dc7d5 987 * @param stepPerSecond rotate acceleration speed(step/s^2).
Yajirushi 3:486fb90dc7d5 988 *
Yajirushi 3:486fb90dc7d5 989 * @returns Converted value.
Yajirushi 3:486fb90dc7d5 990 */
Yajirushi 3:486fb90dc7d5 991 unsigned short calcAcc(float stepPerSecond_2);
Yajirushi 3:486fb90dc7d5 992
Yajirushi 3:486fb90dc7d5 993 /** Caluculate HEX value from Deceleration speed value
Yajirushi 3:486fb90dc7d5 994 * @~japanese
Yajirushi 3:486fb90dc7d5 995 * 減速速度(step/s^2)をパラメーター用数値に変換します
Yajirushi 3:486fb90dc7d5 996 * @param stepPerSecond 減速速度(step/s^2)
Yajirushi 3:486fb90dc7d5 997 *
Yajirushi 3:486fb90dc7d5 998 * @returns 変換された16進数値
Yajirushi 3:486fb90dc7d5 999 *
Yajirushi 3:486fb90dc7d5 1000 * @~english
Yajirushi 3:486fb90dc7d5 1001 * Convert to Param(Hex) value from deceleration speed value(step/s^2).
Yajirushi 3:486fb90dc7d5 1002 * @param stepPerSecond rotate deceleration speed(step/s^2).
Yajirushi 3:486fb90dc7d5 1003 *
Yajirushi 3:486fb90dc7d5 1004 * @returns Converted value.
Yajirushi 3:486fb90dc7d5 1005 */
Yajirushi 3:486fb90dc7d5 1006 unsigned short calcDec(float stepPerSecond_2);
Yajirushi 3:486fb90dc7d5 1007
Yajirushi 3:486fb90dc7d5 1008 /** Caluculate HEX value from MAX speed value
Yajirushi 3:486fb90dc7d5 1009 * @~japanese
Yajirushi 3:486fb90dc7d5 1010 * 最大速度(step/s)をパラメーター用数値に変換します
Yajirushi 3:486fb90dc7d5 1011 * @param stepPerSecond 最大回転速度(step/s)
Yajirushi 3:486fb90dc7d5 1012 *
Yajirushi 3:486fb90dc7d5 1013 * @returns 変換された16進数値
Yajirushi 3:486fb90dc7d5 1014 *
Yajirushi 3:486fb90dc7d5 1015 * @~english
Yajirushi 3:486fb90dc7d5 1016 * Convert to Param(Hex) value from maximum speed value(step/s).
Yajirushi 3:486fb90dc7d5 1017 * @param stepPerSecond Motor rotate maximum speed(step/s).
Yajirushi 3:486fb90dc7d5 1018 *
Yajirushi 3:486fb90dc7d5 1019 * @returns Converted value.
Yajirushi 3:486fb90dc7d5 1020 */
Yajirushi 3:486fb90dc7d5 1021 unsigned short calcMaxSpd(float stepPerSecond);
Yajirushi 3:486fb90dc7d5 1022
Yajirushi 3:486fb90dc7d5 1023 /** Caluculate HEX value from MIN speed value
Yajirushi 3:486fb90dc7d5 1024 * @~japanese
Yajirushi 3:486fb90dc7d5 1025 * 最低速度(step/s)をパラメーター用数値に変換します
Yajirushi 3:486fb90dc7d5 1026 * @param stepPerSecond 最低回転速度(step/s)
Yajirushi 3:486fb90dc7d5 1027 *
Yajirushi 3:486fb90dc7d5 1028 * @returns 変換された16進数値
Yajirushi 3:486fb90dc7d5 1029 *
Yajirushi 3:486fb90dc7d5 1030 * @~english
Yajirushi 3:486fb90dc7d5 1031 * Convert to Param(Hex) value from minimum speed value(step/s).
Yajirushi 3:486fb90dc7d5 1032 * @param stepPerSecond Motor rotate minimum speed(step/s).
Yajirushi 3:486fb90dc7d5 1033 *
Yajirushi 3:486fb90dc7d5 1034 * @returns Converted value.
Yajirushi 3:486fb90dc7d5 1035 */
Yajirushi 3:486fb90dc7d5 1036 unsigned short calcMinSpd(float stepPerSecond);
Yajirushi 3:486fb90dc7d5 1037
Yajirushi 3:486fb90dc7d5 1038 /** Caluculate HEX value from acceleration and deceleration switched point speed
Yajirushi 3:486fb90dc7d5 1039 * @~japanese
Yajirushi 3:486fb90dc7d5 1040 * 加減速曲線が切り替わる速度を指定します
Yajirushi 3:486fb90dc7d5 1041 * @param stepPerSecond 加減速曲線が切り替わる速度(step/s)
Yajirushi 3:486fb90dc7d5 1042 *
Yajirushi 3:486fb90dc7d5 1043 * @returns 変換された16進数値
Yajirushi 3:486fb90dc7d5 1044 *
Yajirushi 3:486fb90dc7d5 1045 * @~english
Yajirushi 3:486fb90dc7d5 1046 * Convert to Param(Hex) value from acceleration and deceleration switched point speed(step/s).
Yajirushi 3:486fb90dc7d5 1047 * @param stepPerSecond switched point speed(step/s).
Yajirushi 3:486fb90dc7d5 1048 *
Yajirushi 3:486fb90dc7d5 1049 * @returns Converted value.
Yajirushi 3:486fb90dc7d5 1050 */
Yajirushi 3:486fb90dc7d5 1051 unsigned short calcIntSpd(float stepPerSecond);
Yajirushi 3:486fb90dc7d5 1052
Yajirushi 3:486fb90dc7d5 1053 /** Caluculate HEX value from full-step mode switched point speed
Yajirushi 3:486fb90dc7d5 1054 * @~japanese
Yajirushi 3:486fb90dc7d5 1055 * フルステップモードに切り替わる速度を指定します
Yajirushi 3:486fb90dc7d5 1056 * @param stepPerSecond フルステップモードに切り替わる速度(step/s)
Yajirushi 3:486fb90dc7d5 1057 *
Yajirushi 3:486fb90dc7d5 1058 * @returns 変換された16進数値
Yajirushi 3:486fb90dc7d5 1059 *
Yajirushi 3:486fb90dc7d5 1060 * @~english
Yajirushi 3:486fb90dc7d5 1061 * Convert to Param(Hex) value from full-step mode switched point speed(step/s).
Yajirushi 3:486fb90dc7d5 1062 * @param stepPerSecond switched point speed(step/s).
Yajirushi 3:486fb90dc7d5 1063 *
Yajirushi 3:486fb90dc7d5 1064 * @returns Converted value.
Yajirushi 3:486fb90dc7d5 1065 */
Yajirushi 3:486fb90dc7d5 1066 unsigned short calcFullStepSpd(float stepPerSecond);
Yajirushi 3:486fb90dc7d5 1067
Yajirushi 3:486fb90dc7d5 1068 // set method ------------------------------------------------------------------
Yajirushi 0:e1964b6e160c 1069 void setAbsPosition(int motorNumber, unsigned long value); //絶対座標設定
Yajirushi 0:e1964b6e160c 1070 void setElecPosition(int motorNumber, unsigned short value); //マイクロステップ位置設定
Yajirushi 3:486fb90dc7d5 1071 void setMarkPosition(int motorNumber, unsigned long value); //マークポジション設定
Yajirushi 0:e1964b6e160c 1072 void setAcceleration(int motorNumber, unsigned short value); //加速設定
Yajirushi 0:e1964b6e160c 1073 void setDeceleration(int motorNumber, unsigned short value); //減速設定
Yajirushi 0:e1964b6e160c 1074 void setMaximumSpeed(int motorNumber, unsigned short value); //最大回転速度設定
Yajirushi 0:e1964b6e160c 1075 void setMinimumSpeed(int motorNumber, unsigned short value); //最低回転速度設定(普通はゼロ)
Yajirushi 0:e1964b6e160c 1076 void setHoldingKVAL(int motorNumber, unsigned char value); //モーター停止中の電圧
Yajirushi 0:e1964b6e160c 1077 void setRunningKVAL(int motorNumber, unsigned char value); //モーター駆動中の電圧
Yajirushi 0:e1964b6e160c 1078 void setAccelerationKVAL(int motorNumber, unsigned char value); //モーター加速中の電圧
Yajirushi 0:e1964b6e160c 1079 void setDecelerationKVAL(int motorNumber, unsigned char value); //モーター減速中の電圧
Yajirushi 0:e1964b6e160c 1080 void setKVAL( //モーターの電圧(一度に設定)
Yajirushi 0:e1964b6e160c 1081 int motorNumber,
Yajirushi 0:e1964b6e160c 1082 unsigned char holdVal, unsigned char runVal,
Yajirushi 0:e1964b6e160c 1083 unsigned char accVal, unsigned char decVal
Yajirushi 0:e1964b6e160c 1084 );
Yajirushi 0:e1964b6e160c 1085 void setInterpolateSpeed(int motorNumber, unsigned short value); //加減速補間を開始するスピード
Yajirushi 0:e1964b6e160c 1086 void setInterpolateSlope(int motorNumber, unsigned char value); //加減速補間の傾き
Yajirushi 0:e1964b6e160c 1087 void setAccSlopeFinal(int motorNumber, unsigned char value); //加速最終時の補間の傾き
Yajirushi 0:e1964b6e160c 1088 void setDecSlopeFinal(int motorNumber, unsigned char value); //減速最終時の補間の傾き
Yajirushi 0:e1964b6e160c 1089 void setThermoCorrect(int motorNumber, unsigned char value); //高温時の補正
Yajirushi 0:e1964b6e160c 1090 void setOCThreshold(int motorNumber, unsigned char value); //オーバーカレントの電流閾値
Yajirushi 0:e1964b6e160c 1091 void setStallThreshold(int motorNumber, unsigned char value); //ストールの電流閾値
Yajirushi 0:e1964b6e160c 1092 void setFSSpeed(int motorNumber, unsigned short value); //フルステップ駆動に切り替えるスピード
Yajirushi 0:e1964b6e160c 1093 void setStepMode(int motorNumber, unsigned char value); //マイクロステッピングモード指定
Yajirushi 0:e1964b6e160c 1094 void setAlermEnable(int motorNumber, unsigned char value); //アラームの有効無効
Yajirushi 0:e1964b6e160c 1095 void setSystemConfig(int motorNumber, unsigned short value); //ドライバシステム設定
Yajirushi 0:e1964b6e160c 1096
Yajirushi 3:486fb90dc7d5 1097 // get method ------------------------------------------------------------------
Yajirushi 0:e1964b6e160c 1098 unsigned long getSpeed(int motorNumber); //現在の回転スピード
Yajirushi 0:e1964b6e160c 1099 unsigned short getADC(int motorNumber); //ADCの取得
Yajirushi 0:e1964b6e160c 1100 unsigned short getStatus(int motorNumber); //ステータス読み取り
Yajirushi 0:e1964b6e160c 1101 unsigned long getAbsPosition(int motorNumber); //絶対座標
Yajirushi 0:e1964b6e160c 1102 unsigned short getElecPosition(int motorNumber); //マイクロステップ位置
Yajirushi 3:486fb90dc7d5 1103 unsigned long getMarkPosition(int motorNumber); //マークポジション
Yajirushi 0:e1964b6e160c 1104 unsigned short getAcceleration(int motorNumber); //加速
Yajirushi 0:e1964b6e160c 1105 unsigned short getDeceleration(int motorNumber); //減速
Yajirushi 0:e1964b6e160c 1106 unsigned short getMaximumSpeed(int motorNumber); //最大回転速度
Yajirushi 0:e1964b6e160c 1107 unsigned short getMinimumSpeed(int motorNumber); //最低回転速度(普通はゼロ)
Yajirushi 0:e1964b6e160c 1108 unsigned char getHoldingKVAL(int motorNumber); //モーター停止中の電圧
Yajirushi 0:e1964b6e160c 1109 unsigned char getRunningKVAL(int motorNumber); //モーター駆動中の電圧
Yajirushi 0:e1964b6e160c 1110 unsigned char getAccelerationKVAL(int motorNumber); //モーター加速中の電圧
Yajirushi 0:e1964b6e160c 1111 unsigned char getDecelerationKVAL(int motorNumber); //モーター減速中の電圧
Yajirushi 0:e1964b6e160c 1112 unsigned short getInterpolateSpeed(int motorNumber); //加減速補間を開始するスピード
Yajirushi 0:e1964b6e160c 1113 unsigned char getInterpolateSlope(int motorNumber); //加減速補間の傾き
Yajirushi 0:e1964b6e160c 1114 unsigned char getAccSlopeFinal(int motorNumber); //加速最終時の補間の傾き
Yajirushi 0:e1964b6e160c 1115 unsigned char getDecSlopeFinal(int motorNumber); //減速最終時の補間の傾き
Yajirushi 0:e1964b6e160c 1116 unsigned char getThermoCorrect(int motorNumber); //高温時の補正
Yajirushi 0:e1964b6e160c 1117 unsigned char getOCThreshold(int motorNumber); //オーバーカレントの電流閾値
Yajirushi 0:e1964b6e160c 1118 unsigned char getStallThreshold(int motorNumber); //ストールの電流閾値
Yajirushi 0:e1964b6e160c 1119 unsigned short getFSSpeed(int motorNumber); //フルステップ駆動に切り替えるスピード
Yajirushi 0:e1964b6e160c 1120 unsigned char getStepMode(int motorNumber); //マイクロステッピングモード
Yajirushi 0:e1964b6e160c 1121 unsigned char getAlermEnable(int motorNumber); //アラームの有効無効
Yajirushi 0:e1964b6e160c 1122 unsigned short getSystemConfig(int motorNumber); //ドライバシステム設定
Yajirushi 0:e1964b6e160c 1123 };
Yajirushi 0:e1964b6e160c 1124
Yajirushi 0:e1964b6e160c 1125 #endif