Library for STMicroelectronics dSPIN L6470 stepper driver. "daisy-chain" supported.
Dependents: L6470_daisy_chain l6470
L6470SDC.h@4:4127dd195311, 2017-04-30 (annotated)
- Committer:
- Yajirushi
- Date:
- Sun Apr 30 03:52:13 2017 +0000
- Revision:
- 4:4127dd195311
- Parent:
- 3:486fb90dc7d5
Qexec() : i and j were wrong : line 552 - 555
Who changed what in which revision?
User | Revision | Line number | New 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 | 4:4127dd195311 | 171 | /** Constructor:(Serial, SPI, CS)@n |
Yajirushi | 3:486fb90dc7d5 | 172 | * @~japanese |
Yajirushi | 4:4127dd195311 | 173 | * コンストラクタ。シリアル通信デバッグを使用する。 |
Yajirushi | 3:486fb90dc7d5 | 174 | * @param tx シリアル通信で使用するTXピン(シリアルデバッグを使用する際は、#define DEBUG_L6470SDCのコメントアウトを解除してください) |
Yajirushi | 3:486fb90dc7d5 | 175 | * @param rx シリアル通信で使用するRXピン(シリアルデバッグを使用する際は、#define DEBUG_L6470SDCのコメントアウトを解除してください) |
Yajirushi | 3:486fb90dc7d5 | 176 | * @param mosi SPIのmosiピン |
Yajirushi | 3:486fb90dc7d5 | 177 | * @param miso SPIのmisoピン |
Yajirushi | 3:486fb90dc7d5 | 178 | * @param sclk SPIのsclkピン |
Yajirushi | 3:486fb90dc7d5 | 179 | * @param csel SPIのChipSelectピン |
Yajirushi | 1:db64ad30b4b3 | 180 | * |
Yajirushi | 3:486fb90dc7d5 | 181 | * @~english |
Yajirushi | 4:4127dd195311 | 182 | * Constructor. use Serial-Debugging. |
Yajirushi | 3:486fb90dc7d5 | 183 | * @param tx Serial USB_TX PinName (If using Serial-debugging. must be #define DEBUG_L6470SDC) |
Yajirushi | 3:486fb90dc7d5 | 184 | * @param rx Serial USB_RX PinName (If using Serial-debugging. must be #define DEBUG_L6470SDC) |
Yajirushi | 1:db64ad30b4b3 | 185 | * @param mosi SPI Master-out PinName |
Yajirushi | 1:db64ad30b4b3 | 186 | * @param miso SPI Slave-out PinName |
Yajirushi | 1:db64ad30b4b3 | 187 | * @param sclk SPI Clock PinName |
Yajirushi | 1:db64ad30b4b3 | 188 | * @param csel SPI ChipSelect PinName |
Yajirushi | 3:486fb90dc7d5 | 189 | * |
Yajirushi | 1:db64ad30b4b3 | 190 | * Example: |
Yajirushi | 3:486fb90dc7d5 | 191 | * @code |
Yajirushi | 3:486fb90dc7d5 | 192 | * //create instance(case:NXP mbed LPC1768) |
Yajirushi | 3:486fb90dc7d5 | 193 | * //hardware-SPI -> MOSI:p5, MISO:p6, SCK:p7 |
Yajirushi | 3:486fb90dc7d5 | 194 | * //ChipSelect -> select pin as you like. |
Yajirushi | 3:486fb90dc7d5 | 195 | * L6470SDC l6470(USBTX, USBRX, p5, p6, p7, p8); |
Yajirushi | 3:486fb90dc7d5 | 196 | * @endcode |
Yajirushi | 3:486fb90dc7d5 | 197 | */ |
Yajirushi | 3:486fb90dc7d5 | 198 | L6470SDC(PinName tx, PinName rx, PinName mosi, PinName miso, PinName sclk, PinName csel); |
Yajirushi | 3:486fb90dc7d5 | 199 | |
Yajirushi | 4:4127dd195311 | 200 | /** Constructor:(Serial, SPI, CS) overlaod@n |
Yajirushi | 3:486fb90dc7d5 | 201 | * @~japanese |
Yajirushi | 4:4127dd195311 | 202 | * コンストラクタ。シリアル通信デバッグを使用する。 |
Yajirushi | 3:486fb90dc7d5 | 203 | * @param tx シリアル通信で使用するTXピン(シリアルデバッグを使用する際は、#define DEBUG_L6470SDCのコメントアウトを解除してください) |
Yajirushi | 3:486fb90dc7d5 | 204 | * @param rx シリアル通信で使用するRXピン(シリアルデバッグを使用する際は、#define DEBUG_L6470SDCのコメントアウトを解除してください) |
Yajirushi | 3:486fb90dc7d5 | 205 | * @param mosi SPIのmosiピン |
Yajirushi | 3:486fb90dc7d5 | 206 | * @param miso SPIのmisoピン |
Yajirushi | 3:486fb90dc7d5 | 207 | * @param sclk SPIのsclkピン |
Yajirushi | 3:486fb90dc7d5 | 208 | * @param *csel SPIのChipSelectピンのアドレス |
Yajirushi | 3:486fb90dc7d5 | 209 | * |
Yajirushi | 3:486fb90dc7d5 | 210 | * @~english |
Yajirushi | 4:4127dd195311 | 211 | * Constructor. use Serial-Debugging. |
Yajirushi | 3:486fb90dc7d5 | 212 | * @param tx Serial USB_TX PinName (If using Serial-debugging. must be #define DEBUG_L6470SDC) |
Yajirushi | 3:486fb90dc7d5 | 213 | * @param rx Serial USB_RX PinName (If using Serial-debugging. must be #define DEBUG_L6470SDC) |
Yajirushi | 3:486fb90dc7d5 | 214 | * @param mosi SPI Master-out PinName |
Yajirushi | 3:486fb90dc7d5 | 215 | * @param miso SPI Slave-out PinName |
Yajirushi | 3:486fb90dc7d5 | 216 | * @param sclk SPI Clock PinName |
Yajirushi | 3:486fb90dc7d5 | 217 | * @param *csel SPI ChipSelect Pin Addr |
Yajirushi | 3:486fb90dc7d5 | 218 | * |
Yajirushi | 3:486fb90dc7d5 | 219 | * Example: |
Yajirushi | 3:486fb90dc7d5 | 220 | * @code |
Yajirushi | 3:486fb90dc7d5 | 221 | * //create instance(case:NXP mbed LPC1768) |
Yajirushi | 3:486fb90dc7d5 | 222 | * //hardware-SPI -> MOSI:p5, MISO:p6, SCK:p7 |
Yajirushi | 3:486fb90dc7d5 | 223 | * |
Yajirushi | 3:486fb90dc7d5 | 224 | * //ChipSelect -> select pin as you like. |
Yajirushi | 3:486fb90dc7d5 | 225 | * DigitalOut l6470cs(p8); |
Yajirushi | 3:486fb90dc7d5 | 226 | * |
Yajirushi | 3:486fb90dc7d5 | 227 | * L6470SDC l6470(USBTX, USBRX, p5, p6, p7, &l6470cs ); |
Yajirushi | 3:486fb90dc7d5 | 228 | * @endcode |
Yajirushi | 3:486fb90dc7d5 | 229 | */ |
Yajirushi | 3:486fb90dc7d5 | 230 | L6470SDC(PinName tx, PinName rx, PinName mosi, PinName miso, PinName sclk, DigitalOut *csel); |
Yajirushi | 3:486fb90dc7d5 | 231 | |
Yajirushi | 4:4127dd195311 | 232 | /** Constructor:(Serial, SPI, CS) overlaod@n |
Yajirushi | 3:486fb90dc7d5 | 233 | * @~japanese |
Yajirushi | 4:4127dd195311 | 234 | * コンストラクタ。シリアル通信デバッグを使用する。 |
Yajirushi | 3:486fb90dc7d5 | 235 | * @param *serial USBシリアルのアドレス(シリアルデバッグを使用する際は、#define DEBUG_L6470SDCのコメントアウトを解除してください) |
Yajirushi | 3:486fb90dc7d5 | 236 | * @param mosi SPIのmosiピン |
Yajirushi | 3:486fb90dc7d5 | 237 | * @param miso SPIのmisoピン |
Yajirushi | 3:486fb90dc7d5 | 238 | * @param sclk SPIのsclkピン |
Yajirushi | 3:486fb90dc7d5 | 239 | * @param *csel SPIのChipSelectピンのアドレス |
Yajirushi | 3:486fb90dc7d5 | 240 | * |
Yajirushi | 3:486fb90dc7d5 | 241 | * @~english |
Yajirushi | 4:4127dd195311 | 242 | * Constructor. use Serial-Debugging. |
Yajirushi | 3:486fb90dc7d5 | 243 | * @param *serial USB Serial Addr (If using Serial-debugging. must be #define DEBUG_L6470SDC) |
Yajirushi | 3:486fb90dc7d5 | 244 | * @param mosi SPI Master-out PinName |
Yajirushi | 3:486fb90dc7d5 | 245 | * @param miso SPI Slave-out PinName |
Yajirushi | 3:486fb90dc7d5 | 246 | * @param sclk SPI Clock PinName |
Yajirushi | 3:486fb90dc7d5 | 247 | * @param *csel SPI ChipSelect Pin Addr |
Yajirushi | 3:486fb90dc7d5 | 248 | * |
Yajirushi | 3:486fb90dc7d5 | 249 | * Example: |
Yajirushi | 3:486fb90dc7d5 | 250 | * @code |
Yajirushi | 3:486fb90dc7d5 | 251 | * //create instance(case:NXP mbed LPC1768) |
Yajirushi | 3:486fb90dc7d5 | 252 | * //hardware-SPI -> MOSI:p5, MISO:p6, SCK:p7 |
Yajirushi | 3:486fb90dc7d5 | 253 | * |
Yajirushi | 3:486fb90dc7d5 | 254 | * //USB Serial |
Yajirushi | 3:486fb90dc7d5 | 255 | * Serial l6470Serial(USBTX, USBRX); |
Yajirushi | 3:486fb90dc7d5 | 256 | * |
Yajirushi | 3:486fb90dc7d5 | 257 | * L6470SDC l6470( &l6470Serial , p5, p6, p7, p8); |
Yajirushi | 3:486fb90dc7d5 | 258 | * @endcode |
Yajirushi | 1:db64ad30b4b3 | 259 | */ |
Yajirushi | 0:e1964b6e160c | 260 | L6470SDC(Serial *serial, PinName mosi, PinName miso, PinName sclk, PinName csel); |
Yajirushi | 1:db64ad30b4b3 | 261 | |
Yajirushi | 4:4127dd195311 | 262 | /** Constructor:(Serial, SPI, CS) overlaod@n |
Yajirushi | 3:486fb90dc7d5 | 263 | * @~japanese |
Yajirushi | 4:4127dd195311 | 264 | * コンストラクタ。シリアル通信デバッグを使用する。 |
Yajirushi | 3:486fb90dc7d5 | 265 | * @param *serial USBシリアルのアドレス(シリアルデバッグを使用する際は、#define DEBUG_L6470SDCのコメントアウトを解除してください) |
Yajirushi | 3:486fb90dc7d5 | 266 | * @param mosi SPIのmosiピン |
Yajirushi | 3:486fb90dc7d5 | 267 | * @param miso SPIのmisoピン |
Yajirushi | 3:486fb90dc7d5 | 268 | * @param sclk SPIのsclkピン |
Yajirushi | 3:486fb90dc7d5 | 269 | * @param *csel SPIのChipSelectピンのアドレス |
Yajirushi | 1:db64ad30b4b3 | 270 | * |
Yajirushi | 3:486fb90dc7d5 | 271 | * @~english |
Yajirushi | 4:4127dd195311 | 272 | * Constructor. use Serial-Debugging. |
Yajirushi | 3:486fb90dc7d5 | 273 | * @param *serial USB Serial Addr (If using Serial-debugging. must be #define DEBUG_L6470SDC) |
Yajirushi | 1:db64ad30b4b3 | 274 | * @param mosi SPI Master-out PinName |
Yajirushi | 1:db64ad30b4b3 | 275 | * @param miso SPI Slave-out PinName |
Yajirushi | 1:db64ad30b4b3 | 276 | * @param sclk SPI Clock PinName |
Yajirushi | 3:486fb90dc7d5 | 277 | * @param *csel SPI ChipSelect Pin Addr |
Yajirushi | 3:486fb90dc7d5 | 278 | * |
Yajirushi | 1:db64ad30b4b3 | 279 | * Example: |
Yajirushi | 3:486fb90dc7d5 | 280 | * @code |
Yajirushi | 3:486fb90dc7d5 | 281 | * //create instance(case:NXP mbed LPC1768) |
Yajirushi | 3:486fb90dc7d5 | 282 | * //hardware-SPI -> MOSI:p5, MISO:p6, SCK:p7 |
Yajirushi | 3:486fb90dc7d5 | 283 | * |
Yajirushi | 3:486fb90dc7d5 | 284 | * //USB Serial |
Yajirushi | 3:486fb90dc7d5 | 285 | * Serial l6470Serial(USBTX, USBRX); |
Yajirushi | 3:486fb90dc7d5 | 286 | * |
Yajirushi | 3:486fb90dc7d5 | 287 | * //ChipSelect pin |
Yajirushi | 3:486fb90dc7d5 | 288 | * DigitalOut l6470cs(p8); |
Yajirushi | 3:486fb90dc7d5 | 289 | * |
Yajirushi | 3:486fb90dc7d5 | 290 | * L6470SDC l6470( &l6470Serial , p5, p6, p7, &l6470cs ); |
Yajirushi | 3:486fb90dc7d5 | 291 | * @endcode |
Yajirushi | 1:db64ad30b4b3 | 292 | */ |
Yajirushi | 0:e1964b6e160c | 293 | L6470SDC(Serial *serial, PinName mosi, PinName miso, PinName sclk, DigitalOut *csel); |
Yajirushi | 1:db64ad30b4b3 | 294 | |
Yajirushi | 4:4127dd195311 | 295 | /** Constructor:(Serial, SPI, CS) overlaod@n |
Yajirushi | 3:486fb90dc7d5 | 296 | * @~japanese |
Yajirushi | 4:4127dd195311 | 297 | * コンストラクタ。シリアル通信デバッグを使用する。 |
Yajirushi | 3:486fb90dc7d5 | 298 | * @param *serial USBシリアルのアドレス(シリアルデバッグを使用する際は、#define DEBUG_L6470SDCのコメントアウトを解除してください) |
Yajirushi | 3:486fb90dc7d5 | 299 | * @param *spi SPIのアドレス |
Yajirushi | 3:486fb90dc7d5 | 300 | * @param csel SPIのChipSelectピン |
Yajirushi | 1:db64ad30b4b3 | 301 | * |
Yajirushi | 3:486fb90dc7d5 | 302 | * @~english |
Yajirushi | 4:4127dd195311 | 303 | * Constructor. use Serial-Debugging. |
Yajirushi | 3:486fb90dc7d5 | 304 | * @param *serial USB Serial Addr (If using Serial-debugging. must be #define DEBUG_L6470SDC) |
Yajirushi | 3:486fb90dc7d5 | 305 | * @param *spi SPI Addr |
Yajirushi | 1:db64ad30b4b3 | 306 | * @param csel SPI ChipSelect PinName |
Yajirushi | 3:486fb90dc7d5 | 307 | * |
Yajirushi | 1:db64ad30b4b3 | 308 | * Example: |
Yajirushi | 3:486fb90dc7d5 | 309 | * @code |
Yajirushi | 3:486fb90dc7d5 | 310 | * //create instance(case:NXP mbed LPC1768) |
Yajirushi | 3:486fb90dc7d5 | 311 | * //hardware-SPI -> MOSI:p5, MISO:p6, SCK:p7 |
Yajirushi | 3:486fb90dc7d5 | 312 | * SPI l6470spi(p5, p6, p7); |
Yajirushi | 3:486fb90dc7d5 | 313 | * |
Yajirushi | 3:486fb90dc7d5 | 314 | * //USB Serial |
Yajirushi | 3:486fb90dc7d5 | 315 | * Serial l6470Serial(USBTX, USBRX); |
Yajirushi | 3:486fb90dc7d5 | 316 | * |
Yajirushi | 3:486fb90dc7d5 | 317 | * L6470SDC l6470( &l6470Serial , &l6470spi , p8); |
Yajirushi | 3:486fb90dc7d5 | 318 | * @endcode |
Yajirushi | 1:db64ad30b4b3 | 319 | */ |
Yajirushi | 0:e1964b6e160c | 320 | L6470SDC(Serial *serial, SPI *spi, PinName csel); |
Yajirushi | 1:db64ad30b4b3 | 321 | |
Yajirushi | 4:4127dd195311 | 322 | /** Constructor:(Serial, SPI, CS) overlaod@n |
Yajirushi | 3:486fb90dc7d5 | 323 | * @~japanese |
Yajirushi | 4:4127dd195311 | 324 | * コンストラクタ。シリアル通信デバッグを使用する。 |
Yajirushi | 3:486fb90dc7d5 | 325 | * @param *serial USBシリアルのアドレス(シリアルデバッグを使用する際は、#define DEBUG_L6470SDCのコメントアウトを解除してください) |
Yajirushi | 3:486fb90dc7d5 | 326 | * @param *spi SPIのアドレス |
Yajirushi | 3:486fb90dc7d5 | 327 | * @param *csel SPIのChipSelectピンのアドレス |
Yajirushi | 3:486fb90dc7d5 | 328 | * |
Yajirushi | 3:486fb90dc7d5 | 329 | * @~english |
Yajirushi | 4:4127dd195311 | 330 | * Constructor. use Serial-Debugging. |
Yajirushi | 3:486fb90dc7d5 | 331 | * @param *serial USB Serial Addr (If using Serial-debugging. must be #define DEBUG_L6470SDC) |
Yajirushi | 3:486fb90dc7d5 | 332 | * @param *spi SPI Addr |
Yajirushi | 3:486fb90dc7d5 | 333 | * @param *csel SPI ChipSelect Pin Addr |
Yajirushi | 1:db64ad30b4b3 | 334 | * |
Yajirushi | 1:db64ad30b4b3 | 335 | * Example: |
Yajirushi | 3:486fb90dc7d5 | 336 | * @code |
Yajirushi | 3:486fb90dc7d5 | 337 | * //create instance(case:NXP mbed LPC1768) |
Yajirushi | 3:486fb90dc7d5 | 338 | * //hardware-SPI -> MOSI:p5, MISO:p6, SCK:p7 |
Yajirushi | 3:486fb90dc7d5 | 339 | * SPI l6470spi(p5, p6, p7); |
Yajirushi | 3:486fb90dc7d5 | 340 | * |
Yajirushi | 3:486fb90dc7d5 | 341 | * //USB Serial |
Yajirushi | 3:486fb90dc7d5 | 342 | * Serial l6470Serial(USBTX, USBRX); |
Yajirushi | 3:486fb90dc7d5 | 343 | * |
Yajirushi | 3:486fb90dc7d5 | 344 | * //ChipSelect pin |
Yajirushi | 3:486fb90dc7d5 | 345 | * DigitalOut l6470cs(p8); |
Yajirushi | 3:486fb90dc7d5 | 346 | * |
Yajirushi | 3:486fb90dc7d5 | 347 | * L6470SDC l6470( &l6470Serial , &l6470spi , &l6470cs ); |
Yajirushi | 3:486fb90dc7d5 | 348 | * @endcode |
Yajirushi | 1:db64ad30b4b3 | 349 | */ |
Yajirushi | 0:e1964b6e160c | 350 | L6470SDC(Serial *serial, SPI *spi, DigitalOut *csel); |
Yajirushi | 1:db64ad30b4b3 | 351 | |
Yajirushi | 4:4127dd195311 | 352 | /** Constructor:(SPI, CS) overload@n |
Yajirushi | 3:486fb90dc7d5 | 353 | * @~japanese |
Yajirushi | 4:4127dd195311 | 354 | * コンストラクタ。 |
Yajirushi | 3:486fb90dc7d5 | 355 | * @param mosi SPIのmosiピン |
Yajirushi | 3:486fb90dc7d5 | 356 | * @param miso SPIのmisoピン |
Yajirushi | 3:486fb90dc7d5 | 357 | * @param sclk SPIのsclkピン |
Yajirushi | 3:486fb90dc7d5 | 358 | * @param csel SPIのChipSelectピン |
Yajirushi | 1:db64ad30b4b3 | 359 | * |
Yajirushi | 3:486fb90dc7d5 | 360 | * @~english |
Yajirushi | 4:4127dd195311 | 361 | * Constructor. |
Yajirushi | 1:db64ad30b4b3 | 362 | * @param mosi SPI Master-out PinName |
Yajirushi | 1:db64ad30b4b3 | 363 | * @param miso SPI Slave-out PinName |
Yajirushi | 1:db64ad30b4b3 | 364 | * @param sclk SPI Clock PinName |
Yajirushi | 1:db64ad30b4b3 | 365 | * @param csel SPI ChipSelect PinName |
Yajirushi | 3:486fb90dc7d5 | 366 | * |
Yajirushi | 3:486fb90dc7d5 | 367 | * Example: |
Yajirushi | 3:486fb90dc7d5 | 368 | * @code |
Yajirushi | 3:486fb90dc7d5 | 369 | * //create instance(case:NXP mbed LPC1768) |
Yajirushi | 3:486fb90dc7d5 | 370 | * //hardware-SPI -> MOSI:p5, MISO:p6, SCK:p7 |
Yajirushi | 3:486fb90dc7d5 | 371 | * //ChipSelect -> select pin as you like. |
Yajirushi | 3:486fb90dc7d5 | 372 | * L6470SDC l6470(p5, p6, p7, p8); |
Yajirushi | 3:486fb90dc7d5 | 373 | * @endcode |
Yajirushi | 1:db64ad30b4b3 | 374 | */ |
Yajirushi | 0:e1964b6e160c | 375 | L6470SDC(PinName mosi, PinName miso, PinName sclk, PinName csel); |
Yajirushi | 1:db64ad30b4b3 | 376 | |
Yajirushi | 4:4127dd195311 | 377 | /** Constructor:(SPI, CS) overlaod@n |
Yajirushi | 3:486fb90dc7d5 | 378 | * @~japanese |
Yajirushi | 4:4127dd195311 | 379 | * コンストラクタ。 |
Yajirushi | 3:486fb90dc7d5 | 380 | * @param mosi SPIのmosiピン |
Yajirushi | 3:486fb90dc7d5 | 381 | * @param miso SPIのmisoピン |
Yajirushi | 3:486fb90dc7d5 | 382 | * @param sclk SPIのsclkピン |
Yajirushi | 3:486fb90dc7d5 | 383 | * @param *csel SPIのChipSelectピンのアドレス |
Yajirushi | 1:db64ad30b4b3 | 384 | * |
Yajirushi | 3:486fb90dc7d5 | 385 | * @~english |
Yajirushi | 4:4127dd195311 | 386 | * Constructor. |
Yajirushi | 1:db64ad30b4b3 | 387 | * @param mosi SPI Master-out PinName |
Yajirushi | 1:db64ad30b4b3 | 388 | * @param miso SPI Slave-out PinName |
Yajirushi | 1:db64ad30b4b3 | 389 | * @param sclk SPI Clock PinName |
Yajirushi | 3:486fb90dc7d5 | 390 | * @param *csel SPI ChipSelect Pin Addr |
Yajirushi | 3:486fb90dc7d5 | 391 | * |
Yajirushi | 1:db64ad30b4b3 | 392 | * Example: |
Yajirushi | 3:486fb90dc7d5 | 393 | * @code |
Yajirushi | 3:486fb90dc7d5 | 394 | * //create instance(case:NXP mbed LPC1768) |
Yajirushi | 3:486fb90dc7d5 | 395 | * //hardware-SPI -> MOSI:p5, MISO:p6, SCK:p7 |
Yajirushi | 3:486fb90dc7d5 | 396 | * |
Yajirushi | 3:486fb90dc7d5 | 397 | * //ChipSelect -> select pin as you like. |
Yajirushi | 3:486fb90dc7d5 | 398 | * DigitalOut l6470cs(p8); |
Yajirushi | 3:486fb90dc7d5 | 399 | * |
Yajirushi | 3:486fb90dc7d5 | 400 | * L6470SDC l6470(p5, p6, p7, &l6470cs ); |
Yajirushi | 3:486fb90dc7d5 | 401 | * @endcode |
Yajirushi | 1:db64ad30b4b3 | 402 | */ |
Yajirushi | 0:e1964b6e160c | 403 | L6470SDC(PinName mosi, PinName miso, PinName sclk, DigitalOut *csel); |
Yajirushi | 1:db64ad30b4b3 | 404 | |
Yajirushi | 4:4127dd195311 | 405 | /** Constructor:(SPI, CS) overlaod@n |
Yajirushi | 3:486fb90dc7d5 | 406 | * @~japanese |
Yajirushi | 4:4127dd195311 | 407 | * コンストラクタ。 |
Yajirushi | 3:486fb90dc7d5 | 408 | * @param *spi SPIのアドレス |
Yajirushi | 3:486fb90dc7d5 | 409 | * @param csel SPIのChipSelectピン |
Yajirushi | 1:db64ad30b4b3 | 410 | * |
Yajirushi | 3:486fb90dc7d5 | 411 | * @~english |
Yajirushi | 4:4127dd195311 | 412 | * Constructor. |
Yajirushi | 3:486fb90dc7d5 | 413 | * @param *spi SPI Addr |
Yajirushi | 1:db64ad30b4b3 | 414 | * @param csel SPI ChipSelect PinName |
Yajirushi | 3:486fb90dc7d5 | 415 | * |
Yajirushi | 1:db64ad30b4b3 | 416 | * Example: |
Yajirushi | 3:486fb90dc7d5 | 417 | * @code |
Yajirushi | 3:486fb90dc7d5 | 418 | * //create instance(case:NXP mbed LPC1768) |
Yajirushi | 3:486fb90dc7d5 | 419 | * //hardware-SPI -> MOSI:p5, MISO:p6, SCK:p7 |
Yajirushi | 3:486fb90dc7d5 | 420 | * SPI l6470spi(p5, p6, p7); |
Yajirushi | 3:486fb90dc7d5 | 421 | * |
Yajirushi | 3:486fb90dc7d5 | 422 | * L6470SDC l6470( &l6470spi , p8); |
Yajirushi | 3:486fb90dc7d5 | 423 | * @endcode |
Yajirushi | 1:db64ad30b4b3 | 424 | */ |
Yajirushi | 0:e1964b6e160c | 425 | L6470SDC(SPI *spi, PinName csel); |
Yajirushi | 1:db64ad30b4b3 | 426 | |
Yajirushi | 4:4127dd195311 | 427 | /** Constructor:(SPI, CS) overlaod@n |
Yajirushi | 3:486fb90dc7d5 | 428 | * @~japanese |
Yajirushi | 4:4127dd195311 | 429 | * コンストラクタ。 |
Yajirushi | 3:486fb90dc7d5 | 430 | * @param *spi SPIのアドレス |
Yajirushi | 3:486fb90dc7d5 | 431 | * @param *csel SPIのChipSelectピンのアドレス |
Yajirushi | 3:486fb90dc7d5 | 432 | * |
Yajirushi | 3:486fb90dc7d5 | 433 | * @~english |
Yajirushi | 4:4127dd195311 | 434 | * Constructor. |
Yajirushi | 3:486fb90dc7d5 | 435 | * @param *spi SPI Addr |
Yajirushi | 3:486fb90dc7d5 | 436 | * @param *csel SPI ChipSelect Pin Addr |
Yajirushi | 1:db64ad30b4b3 | 437 | * |
Yajirushi | 1:db64ad30b4b3 | 438 | * Example: |
Yajirushi | 3:486fb90dc7d5 | 439 | * @code |
Yajirushi | 3:486fb90dc7d5 | 440 | * //create instance(case:NXP mbed LPC1768) |
Yajirushi | 3:486fb90dc7d5 | 441 | * //hardware-SPI -> MOSI:p5, MISO:p6, SCK:p7 |
Yajirushi | 3:486fb90dc7d5 | 442 | * SPI l6470spi(p5, p6, p7); |
Yajirushi | 3:486fb90dc7d5 | 443 | * |
Yajirushi | 3:486fb90dc7d5 | 444 | * //ChipSelect pin |
Yajirushi | 3:486fb90dc7d5 | 445 | * DigitalOut l6470cs(p8); |
Yajirushi | 3:486fb90dc7d5 | 446 | * |
Yajirushi | 3:486fb90dc7d5 | 447 | * L6470SDC l6470( &l6470Serial , &l6470spi , &l6470cs ); |
Yajirushi | 3:486fb90dc7d5 | 448 | * @endcode |
Yajirushi | 1:db64ad30b4b3 | 449 | */ |
Yajirushi | 0:e1964b6e160c | 450 | L6470SDC(SPI *spi, DigitalOut *csel); |
Yajirushi | 3:486fb90dc7d5 | 451 | |
Yajirushi | 4:4127dd195311 | 452 | /** Destructor@n |
Yajirushi | 3:486fb90dc7d5 | 453 | * @~japanese デストラクター(ユーザーが直接呼ぶ必要はありません) |
Yajirushi | 3:486fb90dc7d5 | 454 | * |
Yajirushi | 3:486fb90dc7d5 | 455 | * @~english Destructor. may be not called by user. |
Yajirushi | 3:486fb90dc7d5 | 456 | */ |
Yajirushi | 3:486fb90dc7d5 | 457 | ~L6470SDC(); |
Yajirushi | 0:e1964b6e160c | 458 | |
Yajirushi | 0:e1964b6e160c | 459 | private: |
Yajirushi | 0:e1964b6e160c | 460 | Serial *pc; |
Yajirushi | 0:e1964b6e160c | 461 | SPI *spi; |
Yajirushi | 0:e1964b6e160c | 462 | DigitalOut *cs; |
Yajirushi | 0:e1964b6e160c | 463 | |
Yajirushi | 0:e1964b6e160c | 464 | bool hasSerial; |
Yajirushi | 1:db64ad30b4b3 | 465 | int motor_count; |
Yajirushi | 3:486fb90dc7d5 | 466 | |
Yajirushi | 3:486fb90dc7d5 | 467 | L6470CMDQ *Queue; //ADD |
Yajirushi | 0:e1964b6e160c | 468 | |
Yajirushi | 1:db64ad30b4b3 | 469 | void setCmd(int motorNumber, unsigned char cmdAddress, unsigned long value, int bitLen); |
Yajirushi | 1:db64ad30b4b3 | 470 | void setParam(int motorNumber, unsigned char regAddress, unsigned long value, int bitLen); |
Yajirushi | 1:db64ad30b4b3 | 471 | unsigned long getParam(int motorNumber, unsigned char regAddress, int bitLen); |
Yajirushi | 1:db64ad30b4b3 | 472 | void sendCMD(unsigned char cmd); |
Yajirushi | 0:e1964b6e160c | 473 | |
Yajirushi | 0:e1964b6e160c | 474 | public: |
Yajirushi | 4:4127dd195311 | 475 | /** Initialize L6470@n |
Yajirushi | 3:486fb90dc7d5 | 476 | * @~japanese |
Yajirushi | 4:4127dd195311 | 477 | * L6470を初期化します |
Yajirushi | 3:486fb90dc7d5 | 478 | * @param initSPI SPIに関するパラメーター(クロックやモード)を初期化しない場合はfalseに(デフォルトはtrue) |
Yajirushi | 1:db64ad30b4b3 | 479 | * |
Yajirushi | 3:486fb90dc7d5 | 480 | * @~english |
Yajirushi | 1:db64ad30b4b3 | 481 | * @param initSPI If initialize SPI parameters.(e.g. clockspeed and mode) = true(default) |
Yajirushi | 1:db64ad30b4b3 | 482 | */ |
Yajirushi | 3:486fb90dc7d5 | 483 | void init(bool initSPI=true); |
Yajirushi | 1:db64ad30b4b3 | 484 | |
Yajirushi | 4:4127dd195311 | 485 | /** Get connected(daisy-chained) motor count.@n |
Yajirushi | 3:486fb90dc7d5 | 486 | * @~japanese |
Yajirushi | 4:4127dd195311 | 487 | * デイジーチェーン接続されたモーターの数を取得します |
Yajirushi | 3:486fb90dc7d5 | 488 | * @returns デイジーチェーン接続されたモーター(ドライバー)の個数 |
Yajirushi | 1:db64ad30b4b3 | 489 | * |
Yajirushi | 3:486fb90dc7d5 | 490 | * @~english |
Yajirushi | 1:db64ad30b4b3 | 491 | * @returns Connected(daisy-chained) motor count. If not using daisy-chain, return always 1. maybe... |
Yajirushi | 1:db64ad30b4b3 | 492 | */ |
Yajirushi | 1:db64ad30b4b3 | 493 | int getMotorCount(); |
Yajirushi | 0:e1964b6e160c | 494 | |
Yajirushi | 4:4127dd195311 | 495 | /** Get motor Busy-flag status@n |
Yajirushi | 3:486fb90dc7d5 | 496 | * @~japanese |
Yajirushi | 4:4127dd195311 | 497 | * モーター動作中フラグBUSYの状態を取得します |
Yajirushi | 3:486fb90dc7d5 | 498 | * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定) |
Yajirushi | 3:486fb90dc7d5 | 499 | * @returns 指定したモーター番号のBUSYフラグ(false = Busy-flag 0, true = Busy-flag 1) |
Yajirushi | 1:db64ad30b4b3 | 500 | * |
Yajirushi | 3:486fb90dc7d5 | 501 | * @~english |
Yajirushi | 1:db64ad30b4b3 | 502 | * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1. |
Yajirushi | 1:db64ad30b4b3 | 503 | * @returns Busy status.(false = Busy-flag 0, true = Busy-flag 1) |
Yajirushi | 1:db64ad30b4b3 | 504 | */ |
Yajirushi | 0:e1964b6e160c | 505 | bool isBusy(int motorNumber); |
Yajirushi | 1:db64ad30b4b3 | 506 | |
Yajirushi | 4:4127dd195311 | 507 | /** Run motor rotate@n |
Yajirushi | 3:486fb90dc7d5 | 508 | * @~japanese |
Yajirushi | 3:486fb90dc7d5 | 509 | * モーターを指定した速度で回転させます |
Yajirushi | 3:486fb90dc7d5 | 510 | * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定) |
Yajirushi | 3:486fb90dc7d5 | 511 | * @param hex_speed 16進数指定でのモーターの回転速度(step毎秒) 。関数 "calcSpd(stepPerSecond)" を使用して16進数換算の値を求めてください。 |
Yajirushi | 3:486fb90dc7d5 | 512 | * @param isClockwise 回転方向。true = 時計まわり. false = 反時計回り。(メーカーによって回転方向が違うかも) |
Yajirushi | 1:db64ad30b4b3 | 513 | * |
Yajirushi | 3:486fb90dc7d5 | 514 | * @~english |
Yajirushi | 3:486fb90dc7d5 | 515 | * At the specified speed, run the motor rotation. |
Yajirushi | 1:db64ad30b4b3 | 516 | * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1. |
Yajirushi | 1:db64ad30b4b3 | 517 | * @param hex_speed Motor rotate speed(hex_value Step/s). -> please use "calcSpd(stepPerSecond)" method. |
Yajirushi | 2:2af83d3ccd97 | 518 | * @param isClockwise Rotate direction. true = clockwise. false = counter-clockwise. |
Yajirushi | 3:486fb90dc7d5 | 519 | * |
Yajirushi | 2:2af83d3ccd97 | 520 | * Example: |
Yajirushi | 3:486fb90dc7d5 | 521 | * @code |
Yajirushi | 3:486fb90dc7d5 | 522 | * unsigned long calculatedValue = l6470.calcSpd(200); //Calculated "hex value" from "real value". |
Yajirushi | 3:486fb90dc7d5 | 523 | * l6470.run(1, calculatedValue, true); //200step/s, clockwise |
Yajirushi | 3:486fb90dc7d5 | 524 | * @endcode |
Yajirushi | 1:db64ad30b4b3 | 525 | */ |
Yajirushi | 0:e1964b6e160c | 526 | void run(int motorNumber, unsigned long hex_speed, bool isClockwise); |
Yajirushi | 1:db64ad30b4b3 | 527 | |
Yajirushi | 4:4127dd195311 | 528 | /** Run motor steps@n |
Yajirushi | 3:486fb90dc7d5 | 529 | * @~japanese |
Yajirushi | 3:486fb90dc7d5 | 530 | * 指定したステップの数だけモーターを回します |
Yajirushi | 3:486fb90dc7d5 | 531 | * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定) |
Yajirushi | 3:486fb90dc7d5 | 532 | * @param count 回転させるステップ数。マイクロステップモードを使用している場合は、その値を掛けなければなりません。 |
Yajirushi | 3:486fb90dc7d5 | 533 | * @param isClockwise 回転方向。true = 時計まわり. false = 反時計回り。(メーカーによって回転方向が違うかも) |
Yajirushi | 2:2af83d3ccd97 | 534 | * |
Yajirushi | 3:486fb90dc7d5 | 535 | * @~english |
Yajirushi | 3:486fb90dc7d5 | 536 | * At the specified step count, run the motor rotation. |
Yajirushi | 2:2af83d3ccd97 | 537 | * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1. |
Yajirushi | 2:2af83d3ccd97 | 538 | * @param count Steps count. If using Microstep-mode, "count" must be multiplied by Microstep-value. |
Yajirushi | 2:2af83d3ccd97 | 539 | * @param isClockwise Rotate direction. true = clockwise. false = counter-clockwise. |
Yajirushi | 3:486fb90dc7d5 | 540 | * |
Yajirushi | 2:2af83d3ccd97 | 541 | * Example: |
Yajirushi | 3:486fb90dc7d5 | 542 | * @code |
Yajirushi | 3:486fb90dc7d5 | 543 | * l6470.stop(1); |
Yajirushi | 3:486fb90dc7d5 | 544 | * l6470.setStepMode(1, 0x07); //set microstep-mode 0x07 = 1/128 microstep. |
Yajirushi | 3:486fb90dc7d5 | 545 | * l6470.step(1, 256, false); //(256/128)=2 step, counter cloclwise. |
Yajirushi | 3:486fb90dc7d5 | 546 | * @endcode |
Yajirushi | 2:2af83d3ccd97 | 547 | */ |
Yajirushi | 0:e1964b6e160c | 548 | void step(int motorNumber, unsigned int count, bool isClockwise); |
Yajirushi | 2:2af83d3ccd97 | 549 | |
Yajirushi | 4:4127dd195311 | 550 | /** Run motor move@n |
Yajirushi | 3:486fb90dc7d5 | 551 | * @~japanese |
Yajirushi | 3:486fb90dc7d5 | 552 | * 指定したステップの数だけモーターを回します |
Yajirushi | 3:486fb90dc7d5 | 553 | * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定) |
Yajirushi | 3:486fb90dc7d5 | 554 | * @param stepsCount 回転させるステップ数。マイクロステップモードを使用している場合は、その値を掛けなければなりません。 |
Yajirushi | 3:486fb90dc7d5 | 555 | * @param isClockwise 回転方向。true = 時計まわり. false = 反時計回り。(メーカーによって回転方向が違うかも) |
Yajirushi | 3:486fb90dc7d5 | 556 | * ステップ数が5未満 の場合 -> 関数 "step(int motorNumber, unsigned int count, bool isClockwise)" を使用 |
Yajirushi | 3:486fb90dc7d5 | 557 | * ステップ数が5以上 の場合 -> この関数を使用したほうがいい(ズレが生じるため) |
Yajirushi | 2:2af83d3ccd97 | 558 | * |
Yajirushi | 3:486fb90dc7d5 | 559 | * @~english |
Yajirushi | 3:486fb90dc7d5 | 560 | * At the specified step count, run the motor rotation. |
Yajirushi | 2:2af83d3ccd97 | 561 | * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1. |
Yajirushi | 2:2af83d3ccd97 | 562 | * @param stepsCount Steps count. If using Microstep-mode, "stepsCount" must be multiplied by Microstep-value. |
Yajirushi | 2:2af83d3ccd97 | 563 | * @param isClockwise Rotate direction. true = clockwise. false = counter-clockwise. |
Yajirushi | 2:2af83d3ccd97 | 564 | * If less than 5step -> Please use the "step(int motorNumber, unsigned int count, bool isClockwise)". |
Yajirushi | 2:2af83d3ccd97 | 565 | * If greater than 5step -> Please use this method. |
Yajirushi | 2:2af83d3ccd97 | 566 | */ |
Yajirushi | 0:e1964b6e160c | 567 | void move(int motorNumber, unsigned long stepsCount, bool isClockwise); |
Yajirushi | 2:2af83d3ccd97 | 568 | |
Yajirushi | 4:4127dd195311 | 569 | /** Go to motor ABS position (shortest path)@n |
Yajirushi | 3:486fb90dc7d5 | 570 | * @~japanese |
Yajirushi | 3:486fb90dc7d5 | 571 | * 最短パスで指定した座標まで回転します |
Yajirushi | 3:486fb90dc7d5 | 572 | * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定) |
Yajirushi | 3:486fb90dc7d5 | 573 | * @param ABSPos 停止させる絶対座標 |
Yajirushi | 3:486fb90dc7d5 | 574 | * 注意: 絶対座標への回転方向は不定です。移動距離が短いほうに回転します。 |
Yajirushi | 2:2af83d3ccd97 | 575 | * |
Yajirushi | 3:486fb90dc7d5 | 576 | * @~english |
Yajirushi | 3:486fb90dc7d5 | 577 | * Motor rotation to the specified position in the shortest path. |
Yajirushi | 2:2af83d3ccd97 | 578 | * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1. |
Yajirushi | 2:2af83d3ccd97 | 579 | * @param ABSPos Motor Absolute position. |
Yajirushi | 2:2af83d3ccd97 | 580 | * CAUTION: This method a motion to ABS position through the shortest path. Rotate direction is not constant. |
Yajirushi | 2:2af83d3ccd97 | 581 | */ |
Yajirushi | 0:e1964b6e160c | 582 | void goto1(int motorNumber, unsigned long ABSPos); |
Yajirushi | 2:2af83d3ccd97 | 583 | |
Yajirushi | 4:4127dd195311 | 584 | /** Go to motor ABS position (Specify the rotate direction)@n |
Yajirushi | 3:486fb90dc7d5 | 585 | * @~japanese |
Yajirushi | 3:486fb90dc7d5 | 586 | * 指定した座標まで回転します |
Yajirushi | 3:486fb90dc7d5 | 587 | * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定) |
Yajirushi | 3:486fb90dc7d5 | 588 | * @param ABSPos 停止させる絶対座標 |
Yajirushi | 3:486fb90dc7d5 | 589 | * @param isClockwise 回転方向。true = 時計まわり. false = 反時計回り。(メーカーによって回転方向が違うかも) |
Yajirushi | 2:2af83d3ccd97 | 590 | * |
Yajirushi | 3:486fb90dc7d5 | 591 | * @~english |
Yajirushi | 3:486fb90dc7d5 | 592 | * Motor rotation to the specified position. |
Yajirushi | 2:2af83d3ccd97 | 593 | * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1. |
Yajirushi | 2:2af83d3ccd97 | 594 | * @param ABSPos Motor Absolute position. |
Yajirushi | 2:2af83d3ccd97 | 595 | * @param isClockwise Rotate direction. true = clockwise. false = counter-clockwise. |
Yajirushi | 2:2af83d3ccd97 | 596 | */ |
Yajirushi | 0:e1964b6e160c | 597 | void goto2(int motorNumber, unsigned long ABSPos, bool isClockwise); |
Yajirushi | 2:2af83d3ccd97 | 598 | |
Yajirushi | 2:2af83d3ccd97 | 599 | /** ???Run motor rotate. Until external switch status change??? |
Yajirushi | 3:486fb90dc7d5 | 600 | * @~japanese |
Yajirushi | 3:486fb90dc7d5 | 601 | * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定) |
Yajirushi | 3:486fb90dc7d5 | 602 | * @param hex_speed 16進数指定でのモーターの回転速度(step毎秒) 。関数 "calcSpd(stepPerSecond)" を使用して16進数換算の値を求めてください。 |
Yajirushi | 3:486fb90dc7d5 | 603 | * @param isClockwise 回転方向。true = 時計まわり. false = 反時計回り。(メーカーによって回転方向が違うかも) |
Yajirushi | 3:486fb90dc7d5 | 604 | * @param setMark 外部スイッチのステータス? ごめん。よくわかんないからデータシート見てね。 |
Yajirushi | 2:2af83d3ccd97 | 605 | * |
Yajirushi | 3:486fb90dc7d5 | 606 | * @~english |
Yajirushi | 2:2af83d3ccd97 | 607 | * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1. |
Yajirushi | 2:2af83d3ccd97 | 608 | * @param hex_speed Motor rotate speed(hex_value Step/s). -> please use "calcSpd(stepPerSecond)" method. |
Yajirushi | 2:2af83d3ccd97 | 609 | * @param isClockwise Rotate direction. true = clockwise. false = counter-clockwise. |
Yajirushi | 2:2af83d3ccd97 | 610 | * @param setMark External switch status?...??.. Sorry... I could not understand. Please see L6470 datasheet. |
Yajirushi | 2:2af83d3ccd97 | 611 | */ |
Yajirushi | 0:e1964b6e160c | 612 | void goUntil(int motorNumber, unsigned long hex_speed, bool isClockwise, bool setMark); |
Yajirushi | 2:2af83d3ccd97 | 613 | |
Yajirushi | 2:2af83d3ccd97 | 614 | /** ???Release external switch??? |
Yajirushi | 3:486fb90dc7d5 | 615 | * @~japanese |
Yajirushi | 3:486fb90dc7d5 | 616 | * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定) |
Yajirushi | 3:486fb90dc7d5 | 617 | * @param isClockwise 回転方向。true = 時計まわり. false = 反時計回り。(メーカーによって回転方向が違うかも) |
Yajirushi | 3:486fb90dc7d5 | 618 | * @param setMark 外部スイッチのステータス? ごめん。よくわかんないからデータシート見てね。 |
Yajirushi | 2:2af83d3ccd97 | 619 | * |
Yajirushi | 3:486fb90dc7d5 | 620 | * @~english |
Yajirushi | 2:2af83d3ccd97 | 621 | * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1. |
Yajirushi | 2:2af83d3ccd97 | 622 | * @param isClockwise Rotate direction. true = clockwise. false = counter-clockwise. |
Yajirushi | 2:2af83d3ccd97 | 623 | * @param setMark External switch status?...??.. Sorry... I could not understand. Please see L6470 datasheet. |
Yajirushi | 2:2af83d3ccd97 | 624 | */ |
Yajirushi | 0:e1964b6e160c | 625 | void releaseSwitch(int motorNumber, bool isClockwise, bool setMark); |
Yajirushi | 2:2af83d3ccd97 | 626 | |
Yajirushi | 4:4127dd195311 | 627 | /** Go to motor home-position@n |
Yajirushi | 3:486fb90dc7d5 | 628 | * @~japanese |
Yajirushi | 3:486fb90dc7d5 | 629 | * モーターを原点復帰させます |
Yajirushi | 3:486fb90dc7d5 | 630 | * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定) |
Yajirushi | 2:2af83d3ccd97 | 631 | * |
Yajirushi | 3:486fb90dc7d5 | 632 | * @~english |
Yajirushi | 3:486fb90dc7d5 | 633 | * Return the motor to the zero-potition. |
Yajirushi | 2:2af83d3ccd97 | 634 | * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1. |
Yajirushi | 2:2af83d3ccd97 | 635 | */ |
Yajirushi | 0:e1964b6e160c | 636 | void home(int motorNumber); |
Yajirushi | 2:2af83d3ccd97 | 637 | |
Yajirushi | 4:4127dd195311 | 638 | /** Go to motor home-position [alias: home(int motorNumber)]@n |
Yajirushi | 3:486fb90dc7d5 | 639 | * @~japanese |
Yajirushi | 3:486fb90dc7d5 | 640 | * モーターを原点復帰させます |
Yajirushi | 3:486fb90dc7d5 | 641 | * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定) |
Yajirushi | 2:2af83d3ccd97 | 642 | * |
Yajirushi | 3:486fb90dc7d5 | 643 | * @~english |
Yajirushi | 3:486fb90dc7d5 | 644 | * Return the motor to the zero-potition. |
Yajirushi | 2:2af83d3ccd97 | 645 | * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1. |
Yajirushi | 2:2af83d3ccd97 | 646 | */ |
Yajirushi | 0:e1964b6e160c | 647 | void zero(int motorNumber); |
Yajirushi | 2:2af83d3ccd97 | 648 | |
Yajirushi | 4:4127dd195311 | 649 | /** Go to motor marked-position@n |
Yajirushi | 3:486fb90dc7d5 | 650 | * @~japanese |
Yajirushi | 3:486fb90dc7d5 | 651 | * 指定されたマーク位置まで回転します |
Yajirushi | 3:486fb90dc7d5 | 652 | * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定) |
Yajirushi | 3:486fb90dc7d5 | 653 | * マーク位置: -> 関数 "setMarkPosition(int motorNumber, unsigned long value)" を使用してください |
Yajirushi | 2:2af83d3ccd97 | 654 | * |
Yajirushi | 3:486fb90dc7d5 | 655 | * @~english |
Yajirushi | 3:486fb90dc7d5 | 656 | * Motor rotation to the specified MARK Position. |
Yajirushi | 2:2af83d3ccd97 | 657 | * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1. |
Yajirushi | 3:486fb90dc7d5 | 658 | * MARK Position: -> Please use setMarkPosition(int motorNumber, unsigned long value). |
Yajirushi | 2:2af83d3ccd97 | 659 | */ |
Yajirushi | 0:e1964b6e160c | 660 | void gotoMark(int motorNumber); |
Yajirushi | 2:2af83d3ccd97 | 661 | |
Yajirushi | 4:4127dd195311 | 662 | /** Reset the ABS_POS register to zero (ABS_POS zero = home-position)@n |
Yajirushi | 3:486fb90dc7d5 | 663 | * @~japanese |
Yajirushi | 3:486fb90dc7d5 | 664 | * 現在位置を原点に設定します |
Yajirushi | 3:486fb90dc7d5 | 665 | * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定) |
Yajirushi | 2:2af83d3ccd97 | 666 | * |
Yajirushi | 3:486fb90dc7d5 | 667 | * @~english |
Yajirushi | 3:486fb90dc7d5 | 668 | * Set the zero-position to current position. |
Yajirushi | 2:2af83d3ccd97 | 669 | * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1. |
Yajirushi | 2:2af83d3ccd97 | 670 | */ |
Yajirushi | 0:e1964b6e160c | 671 | void resetHome(int motorNumber); |
Yajirushi | 2:2af83d3ccd97 | 672 | |
Yajirushi | 4:4127dd195311 | 673 | /** Reset the ABS_POS register to zero (ABS_POS zero = home-position) [alias: resetHome(int motorNumber)]@n |
Yajirushi | 3:486fb90dc7d5 | 674 | * @~japanese |
Yajirushi | 3:486fb90dc7d5 | 675 | * キューに追加:現在位置を原点に設定します |
Yajirushi | 3:486fb90dc7d5 | 676 | * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定) |
Yajirushi | 2:2af83d3ccd97 | 677 | * |
Yajirushi | 3:486fb90dc7d5 | 678 | * @~english |
Yajirushi | 3:486fb90dc7d5 | 679 | * Set the zero-position to current position. |
Yajirushi | 2:2af83d3ccd97 | 680 | * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1. |
Yajirushi | 2:2af83d3ccd97 | 681 | */ |
Yajirushi | 0:e1964b6e160c | 682 | void resetZero(int motorNumber); |
Yajirushi | 2:2af83d3ccd97 | 683 | |
Yajirushi | 4:4127dd195311 | 684 | /** Reset L6470.(software reset)@n |
Yajirushi | 3:486fb90dc7d5 | 685 | * @~japanese |
Yajirushi | 3:486fb90dc7d5 | 686 | * デバイスをリセットします |
Yajirushi | 3:486fb90dc7d5 | 687 | * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定) |
Yajirushi | 2:2af83d3ccd97 | 688 | * |
Yajirushi | 3:486fb90dc7d5 | 689 | * @~english |
Yajirushi | 3:486fb90dc7d5 | 690 | * Reset L6470 driver & motor. |
Yajirushi | 2:2af83d3ccd97 | 691 | * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1. |
Yajirushi | 2:2af83d3ccd97 | 692 | */ |
Yajirushi | 0:e1964b6e160c | 693 | void motorReset(int motorNumber); |
Yajirushi | 2:2af83d3ccd97 | 694 | |
Yajirushi | 4:4127dd195311 | 695 | /** Stop rotation (soft-stop)@n |
Yajirushi | 3:486fb90dc7d5 | 696 | * @~japanese |
Yajirushi | 3:486fb90dc7d5 | 697 | * モーターを停止 |
Yajirushi | 3:486fb90dc7d5 | 698 | * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定) |
Yajirushi | 2:2af83d3ccd97 | 699 | * |
Yajirushi | 3:486fb90dc7d5 | 700 | * @~english |
Yajirushi | 3:486fb90dc7d5 | 701 | * Stop motor. |
Yajirushi | 2:2af83d3ccd97 | 702 | * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1. |
Yajirushi | 2:2af83d3ccd97 | 703 | */ |
Yajirushi | 0:e1964b6e160c | 704 | void stop(int motorNumber); |
Yajirushi | 2:2af83d3ccd97 | 705 | |
Yajirushi | 4:4127dd195311 | 706 | /** Stop rotation. Ignore deceleration (hard-stop)@n |
Yajirushi | 3:486fb90dc7d5 | 707 | * @~japanese |
Yajirushi | 3:486fb90dc7d5 | 708 | * 減速を無視して停止 |
Yajirushi | 3:486fb90dc7d5 | 709 | * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定) |
Yajirushi | 2:2af83d3ccd97 | 710 | * |
Yajirushi | 3:486fb90dc7d5 | 711 | * @~english |
Yajirushi | 3:486fb90dc7d5 | 712 | * Stop immediately motor. |
Yajirushi | 2:2af83d3ccd97 | 713 | * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1. |
Yajirushi | 2:2af83d3ccd97 | 714 | */ |
Yajirushi | 0:e1964b6e160c | 715 | void stopImmidiate(int motorNumber); |
Yajirushi | 2:2af83d3ccd97 | 716 | |
Yajirushi | 4:4127dd195311 | 717 | /** Stop rotation (soft-stop) state sets HighImpedance.@n |
Yajirushi | 3:486fb90dc7d5 | 718 | * @~japanese |
Yajirushi | 3:486fb90dc7d5 | 719 | * モーターを停止し、実行後ハイインピーダンス状態にします |
Yajirushi | 3:486fb90dc7d5 | 720 | * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定) |
Yajirushi | 2:2af83d3ccd97 | 721 | * |
Yajirushi | 3:486fb90dc7d5 | 722 | * @~english |
Yajirushi | 3:486fb90dc7d5 | 723 | * Stop motor. Set state "High Impedance" after stop. |
Yajirushi | 2:2af83d3ccd97 | 724 | * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1. |
Yajirushi | 2:2af83d3ccd97 | 725 | */ |
Yajirushi | 0:e1964b6e160c | 726 | void stop_HighImpedance(int motorNumber); |
Yajirushi | 2:2af83d3ccd97 | 727 | |
Yajirushi | 4:4127dd195311 | 728 | /** Stop rotation. Ignore deceleration (hard-stop) state sets HighImpedance.@n |
Yajirushi | 3:486fb90dc7d5 | 729 | * @~japanese |
Yajirushi | 3:486fb90dc7d5 | 730 | * 減速を無視して停止し、実行後ハイインピーダンス状態にします |
Yajirushi | 3:486fb90dc7d5 | 731 | * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定) |
Yajirushi | 2:2af83d3ccd97 | 732 | * |
Yajirushi | 3:486fb90dc7d5 | 733 | * @~english |
Yajirushi | 3:486fb90dc7d5 | 734 | * Stop immediately motor. Set state "High Impedance" after stop. |
Yajirushi | 2:2af83d3ccd97 | 735 | * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1. |
Yajirushi | 2:2af83d3ccd97 | 736 | */ |
Yajirushi | 0:e1964b6e160c | 737 | void stopImmidiate_HighImpedance(int motorNumber); |
Yajirushi | 0:e1964b6e160c | 738 | |
Yajirushi | 3:486fb90dc7d5 | 739 | //Daisy-chain Queue Method ----------------------------------------------------- |
Yajirushi | 4:4127dd195311 | 740 | /** Enqueue Command [NOP]@n |
Yajirushi | 3:486fb90dc7d5 | 741 | * @~japanese |
Yajirushi | 3:486fb90dc7d5 | 742 | * キューに追加:何も実行しない |
Yajirushi | 3:486fb90dc7d5 | 743 | * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定) |
Yajirushi | 3:486fb90dc7d5 | 744 | * |
Yajirushi | 3:486fb90dc7d5 | 745 | * @~english |
Yajirushi | 3:486fb90dc7d5 | 746 | * Add Queue:No operation. |
Yajirushi | 3:486fb90dc7d5 | 747 | * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1. |
Yajirushi | 3:486fb90dc7d5 | 748 | */ |
Yajirushi | 3:486fb90dc7d5 | 749 | int ENQ_nop(int motorNumber); |
Yajirushi | 3:486fb90dc7d5 | 750 | |
Yajirushi | 4:4127dd195311 | 751 | /** Enqueue Command [run]@n |
Yajirushi | 3:486fb90dc7d5 | 752 | * @~japanese |
Yajirushi | 3:486fb90dc7d5 | 753 | * キューに追加:モーターを指定した速度で回転させます |
Yajirushi | 3:486fb90dc7d5 | 754 | * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定) |
Yajirushi | 3:486fb90dc7d5 | 755 | * @param hex_speed 16進数指定でのモーターの回転速度(step毎秒) 。関数 "calcSpd(stepPerSecond)" を使用して16進数換算の値を求めてください。 |
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 speed, 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 hex_speed Motor rotate speed(hex_value Step/s). -> please use "calcSpd(stepPerSecond)" method. |
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 | * unsigned long calculatedValue = l6470.calcSpd(200); //Calculated "hex value" from "real value". |
Yajirushi | 3:486fb90dc7d5 | 767 | * l6470.ENQ_run(1, calculatedValue, true); //200step/s, clockwise |
Yajirushi | 3:486fb90dc7d5 | 768 | * l6470.ENQ_NOP(2); |
Yajirushi | 3:486fb90dc7d5 | 769 | * l6470.Qexec(); |
Yajirushi | 3:486fb90dc7d5 | 770 | * @endcode |
Yajirushi | 3:486fb90dc7d5 | 771 | */ |
Yajirushi | 3:486fb90dc7d5 | 772 | int ENQ_run(int motorNumber, unsigned long hex_speed, bool isClockwise); |
Yajirushi | 3:486fb90dc7d5 | 773 | |
Yajirushi | 4:4127dd195311 | 774 | /** Enqueue Command [move]@n |
Yajirushi | 3:486fb90dc7d5 | 775 | * @~japanese |
Yajirushi | 3:486fb90dc7d5 | 776 | * キューに追加:指定したステップの数だけモーターを回します |
Yajirushi | 3:486fb90dc7d5 | 777 | * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定) |
Yajirushi | 3:486fb90dc7d5 | 778 | * @param stepsCount 回転させるステップ数。マイクロステップモードを使用している場合は、その値を掛けなければなりません。 |
Yajirushi | 3:486fb90dc7d5 | 779 | * @param isClockwise 回転方向。true = 時計まわり. false = 反時計回り。(メーカーによって回転方向が違うかも) |
Yajirushi | 3:486fb90dc7d5 | 780 | * |
Yajirushi | 3:486fb90dc7d5 | 781 | * @~english |
Yajirushi | 3:486fb90dc7d5 | 782 | * Add Queue:At the specified step count, run the motor rotation. |
Yajirushi | 3:486fb90dc7d5 | 783 | * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1. |
Yajirushi | 3:486fb90dc7d5 | 784 | * @param stepsCount Steps count. If using Microstep-mode, "stepsCount" must be multiplied by Microstep-value. |
Yajirushi | 3:486fb90dc7d5 | 785 | * @param isClockwise Rotate direction. true = clockwise. false = counter-clockwise. |
Yajirushi | 3:486fb90dc7d5 | 786 | * |
Yajirushi | 3:486fb90dc7d5 | 787 | * Example: |
Yajirushi | 3:486fb90dc7d5 | 788 | * @code |
Yajirushi | 3:486fb90dc7d5 | 789 | * l6470.stop(1); |
Yajirushi | 3:486fb90dc7d5 | 790 | * l6470.setStepMode(1, 0x07); //set microstep-mode 0x07 = 1/128 microstep. |
Yajirushi | 3:486fb90dc7d5 | 791 | * l6470.step(1, 256, false); //(256/128)=2 step, counter cloclwise. |
Yajirushi | 3:486fb90dc7d5 | 792 | * l6470.step(2, 1024, true); //(1024/128)=8 step, clockwise. |
Yajirushi | 3:486fb90dc7d5 | 793 | * l6470.Qexec(); |
Yajirushi | 3:486fb90dc7d5 | 794 | * @endcode |
Yajirushi | 3:486fb90dc7d5 | 795 | */ |
Yajirushi | 3:486fb90dc7d5 | 796 | int ENQ_move(int motorNumber, unsigned long stepsCount, bool isClockwise); |
Yajirushi | 3:486fb90dc7d5 | 797 | |
Yajirushi | 4:4127dd195311 | 798 | /** Enqueue Command [Goto] (shortest path)@n |
Yajirushi | 3:486fb90dc7d5 | 799 | * @~japanese |
Yajirushi | 3:486fb90dc7d5 | 800 | * キューに追加:最短パスで指定した座標まで回転します |
Yajirushi | 3:486fb90dc7d5 | 801 | * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定) |
Yajirushi | 3:486fb90dc7d5 | 802 | * @param ABSPos 停止させる絶対座標 |
Yajirushi | 3:486fb90dc7d5 | 803 | * 注意: 絶対座標への回転方向は不定です。移動距離が短いほうに回転します。 |
Yajirushi | 3:486fb90dc7d5 | 804 | * |
Yajirushi | 3:486fb90dc7d5 | 805 | * @~english |
Yajirushi | 3:486fb90dc7d5 | 806 | * Add Queue:Motor rotation to the specified position in the shortest path. |
Yajirushi | 3:486fb90dc7d5 | 807 | * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1. |
Yajirushi | 3:486fb90dc7d5 | 808 | * @param ABSPos Motor Absolute position. |
Yajirushi | 3:486fb90dc7d5 | 809 | * CAUTION: This method a motion to ABS position through the shortest path. Rotate direction is not constant. |
Yajirushi | 3:486fb90dc7d5 | 810 | */ |
Yajirushi | 3:486fb90dc7d5 | 811 | int ENQ_goto1(int motorNumber, unsigned long ABSPos); |
Yajirushi | 3:486fb90dc7d5 | 812 | |
Yajirushi | 4:4127dd195311 | 813 | /** Enqueue Command [Goto]@n |
Yajirushi | 3:486fb90dc7d5 | 814 | * @~japanese |
Yajirushi | 3:486fb90dc7d5 | 815 | * キューに追加:最短パスで指定した座標まで回転します |
Yajirushi | 3:486fb90dc7d5 | 816 | * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定) |
Yajirushi | 3:486fb90dc7d5 | 817 | * @param ABSPos 停止させる絶対座標 |
Yajirushi | 3:486fb90dc7d5 | 818 | * @param isClockwise 回転方向。true = 時計まわり. false = 反時計回り。(メーカーによって回転方向が違うかも) |
Yajirushi | 3:486fb90dc7d5 | 819 | * |
Yajirushi | 3:486fb90dc7d5 | 820 | * @~english |
Yajirushi | 3:486fb90dc7d5 | 821 | * Add Queue:Motor rotation to the specified position. |
Yajirushi | 3:486fb90dc7d5 | 822 | * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1. |
Yajirushi | 3:486fb90dc7d5 | 823 | * @param ABSPos Motor Absolute position. |
Yajirushi | 3:486fb90dc7d5 | 824 | * @param isClockwise Rotate direction. true = clockwise. false = counter-clockwise. |
Yajirushi | 3:486fb90dc7d5 | 825 | */ |
Yajirushi | 3:486fb90dc7d5 | 826 | int ENQ_goto2(int motorNumber, unsigned long ABSPos, bool isClockwise); |
Yajirushi | 3:486fb90dc7d5 | 827 | |
Yajirushi | 4:4127dd195311 | 828 | /** Enqueue Command [???go Until]@n |
Yajirushi | 3:486fb90dc7d5 | 829 | * @~japanese |
Yajirushi | 3:486fb90dc7d5 | 830 | * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定) |
Yajirushi | 3:486fb90dc7d5 | 831 | * @param hex_speed 16進数指定でのモーターの回転速度(step毎秒) 。関数 "calcSpd(stepPerSecond)" を使用して16進数換算の値を求めてください。 |
Yajirushi | 3:486fb90dc7d5 | 832 | * @param isClockwise 回転方向。true = 時計まわり. false = 反時計回り。(メーカーによって回転方向が違うかも) |
Yajirushi | 3:486fb90dc7d5 | 833 | * @param setMark 外部スイッチのステータス? ごめん。よくわかんないからデータシート見てね。 |
Yajirushi | 3:486fb90dc7d5 | 834 | * |
Yajirushi | 3:486fb90dc7d5 | 835 | * @~english |
Yajirushi | 3:486fb90dc7d5 | 836 | * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1. |
Yajirushi | 3:486fb90dc7d5 | 837 | * @param hex_speed Motor rotate speed(hex_value Step/s). -> please use "calcSpd(stepPerSecond)" method. |
Yajirushi | 3:486fb90dc7d5 | 838 | * @param isClockwise Rotate direction. true = clockwise. false = counter-clockwise. |
Yajirushi | 3:486fb90dc7d5 | 839 | * @param setMark External switch status?...??.. Sorry... I could not understand. Please see L6470 datasheet. |
Yajirushi | 3:486fb90dc7d5 | 840 | */ |
Yajirushi | 3:486fb90dc7d5 | 841 | int ENQ_goUntil(int motorNumber, unsigned long hex_speed, bool isClockwise, bool setMark); |
Yajirushi | 3:486fb90dc7d5 | 842 | |
Yajirushi | 4:4127dd195311 | 843 | /** Enqueue Command [???Release external switch]@n |
Yajirushi | 3:486fb90dc7d5 | 844 | * @~japanese |
Yajirushi | 3:486fb90dc7d5 | 845 | * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定) |
Yajirushi | 3:486fb90dc7d5 | 846 | * @param isClockwise 回転方向。true = 時計まわり. false = 反時計回り。(メーカーによって回転方向が違うかも) |
Yajirushi | 3:486fb90dc7d5 | 847 | * @param setMark 外部スイッチのステータス? ごめん。よくわかんないからデータシート見てね。 |
Yajirushi | 3:486fb90dc7d5 | 848 | * |
Yajirushi | 3:486fb90dc7d5 | 849 | * @~english |
Yajirushi | 3:486fb90dc7d5 | 850 | * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1. |
Yajirushi | 3:486fb90dc7d5 | 851 | * @param isClockwise Rotate direction. true = clockwise. false = counter-clockwise. |
Yajirushi | 3:486fb90dc7d5 | 852 | * @param setMark External switch status?...??.. Sorry... I could not understand. Please see L6470 datasheet. |
Yajirushi | 3:486fb90dc7d5 | 853 | */ |
Yajirushi | 3:486fb90dc7d5 | 854 | int ENQ_releaseSwitch(int motorNumber, bool isClockwise, bool setMark); |
Yajirushi | 3:486fb90dc7d5 | 855 | |
Yajirushi | 4:4127dd195311 | 856 | /** Enqueue Command [Goto HOME]@n |
Yajirushi | 3:486fb90dc7d5 | 857 | * @~japanese |
Yajirushi | 3:486fb90dc7d5 | 858 | * キューに追加:モーターを原点復帰させます |
Yajirushi | 3:486fb90dc7d5 | 859 | * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定) |
Yajirushi | 3:486fb90dc7d5 | 860 | * |
Yajirushi | 3:486fb90dc7d5 | 861 | * @~english |
Yajirushi | 3:486fb90dc7d5 | 862 | * Add Queue:Return the motor to the zero-potition. |
Yajirushi | 3:486fb90dc7d5 | 863 | * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1. |
Yajirushi | 3:486fb90dc7d5 | 864 | */ |
Yajirushi | 3:486fb90dc7d5 | 865 | int ENQ_home(int motorNumber); |
Yajirushi | 3:486fb90dc7d5 | 866 | |
Yajirushi | 4:4127dd195311 | 867 | /** Enqueue Command [Goto HOME] [aliase: ENQ_home(int motorNumber)]@n |
Yajirushi | 3:486fb90dc7d5 | 868 | * @~japanese |
Yajirushi | 3:486fb90dc7d5 | 869 | * キューに追加:モーターを原点復帰させます |
Yajirushi | 3:486fb90dc7d5 | 870 | * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定) |
Yajirushi | 3:486fb90dc7d5 | 871 | * |
Yajirushi | 3:486fb90dc7d5 | 872 | * @~english |
Yajirushi | 3:486fb90dc7d5 | 873 | * Add Queue:Return the motor to the zero-potition. |
Yajirushi | 3:486fb90dc7d5 | 874 | * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1. |
Yajirushi | 3:486fb90dc7d5 | 875 | */ |
Yajirushi | 3:486fb90dc7d5 | 876 | int ENQ_zero(int motorNumber); |
Yajirushi | 3:486fb90dc7d5 | 877 | |
Yajirushi | 4:4127dd195311 | 878 | /** Enqueue Command [Goto MARK]@n |
Yajirushi | 3:486fb90dc7d5 | 879 | * @~japanese |
Yajirushi | 3:486fb90dc7d5 | 880 | * キューに追加:指定されたマーク位置まで回転します |
Yajirushi | 3:486fb90dc7d5 | 881 | * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定) |
Yajirushi | 3:486fb90dc7d5 | 882 | * マーク位置: -> 関数 "setMarkPosition(int motorNumber, unsigned long value)" を使用してください |
Yajirushi | 3:486fb90dc7d5 | 883 | * |
Yajirushi | 3:486fb90dc7d5 | 884 | * @~english |
Yajirushi | 3:486fb90dc7d5 | 885 | * Add Queue:Motor rotation to the specified MARK Position. |
Yajirushi | 3:486fb90dc7d5 | 886 | * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1. |
Yajirushi | 3:486fb90dc7d5 | 887 | * MARK Position: -> Please use setMarkPosition(int motorNumber, unsigned long value). |
Yajirushi | 3:486fb90dc7d5 | 888 | */ |
Yajirushi | 3:486fb90dc7d5 | 889 | int ENQ_gotoMark(int motorNumber); |
Yajirushi | 3:486fb90dc7d5 | 890 | |
Yajirushi | 4:4127dd195311 | 891 | /** Enqueue Command [Reset HOME] (ABS_POS zero = home-position)@n |
Yajirushi | 3:486fb90dc7d5 | 892 | * @~japanese |
Yajirushi | 3:486fb90dc7d5 | 893 | * キューに追加:現在位置を原点に設定します |
Yajirushi | 3:486fb90dc7d5 | 894 | * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定) |
Yajirushi | 3:486fb90dc7d5 | 895 | * |
Yajirushi | 3:486fb90dc7d5 | 896 | * @~english |
Yajirushi | 3:486fb90dc7d5 | 897 | * Add Queue:Set the zero-position to current position. |
Yajirushi | 3:486fb90dc7d5 | 898 | * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1. |
Yajirushi | 3:486fb90dc7d5 | 899 | */ |
Yajirushi | 3:486fb90dc7d5 | 900 | int ENQ_resetHome(int motorNumber); |
Yajirushi | 3:486fb90dc7d5 | 901 | |
Yajirushi | 4:4127dd195311 | 902 | /** Enqueue Command [Reset HOME] [alias: ENQ_resetHome(int motorNumber)]@n |
Yajirushi | 3:486fb90dc7d5 | 903 | * @~japanese |
Yajirushi | 3:486fb90dc7d5 | 904 | * キューに追加:現在位置を原点に設定します |
Yajirushi | 3:486fb90dc7d5 | 905 | * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定) |
Yajirushi | 3:486fb90dc7d5 | 906 | * |
Yajirushi | 3:486fb90dc7d5 | 907 | * @~english |
Yajirushi | 3:486fb90dc7d5 | 908 | * Add Queue:Set the zero-position to current position. |
Yajirushi | 3:486fb90dc7d5 | 909 | * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1. |
Yajirushi | 3:486fb90dc7d5 | 910 | */ |
Yajirushi | 3:486fb90dc7d5 | 911 | int ENQ_resetZero(int motorNumber); |
Yajirushi | 0:e1964b6e160c | 912 | |
Yajirushi | 4:4127dd195311 | 913 | /** Enqueue Command [Reset L6470] (software reset)@n |
Yajirushi | 3:486fb90dc7d5 | 914 | * @~japanese |
Yajirushi | 3:486fb90dc7d5 | 915 | * キューに追加:デバイスをリセットします |
Yajirushi | 3:486fb90dc7d5 | 916 | * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定) |
Yajirushi | 3:486fb90dc7d5 | 917 | * |
Yajirushi | 3:486fb90dc7d5 | 918 | * @~english |
Yajirushi | 3:486fb90dc7d5 | 919 | * Add Queue:Reset L6470 driver & motor. |
Yajirushi | 3:486fb90dc7d5 | 920 | * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1. |
Yajirushi | 3:486fb90dc7d5 | 921 | */ |
Yajirushi | 3:486fb90dc7d5 | 922 | int ENQ_motorReset(int motorNumber); |
Yajirushi | 3:486fb90dc7d5 | 923 | |
Yajirushi | 4:4127dd195311 | 924 | /** Enqueue Command [stop] (soft-stop)@n |
Yajirushi | 3:486fb90dc7d5 | 925 | * @~japanese |
Yajirushi | 3:486fb90dc7d5 | 926 | * キューに追加:モーターを停止 |
Yajirushi | 3:486fb90dc7d5 | 927 | * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定) |
Yajirushi | 3:486fb90dc7d5 | 928 | * |
Yajirushi | 3:486fb90dc7d5 | 929 | * @~english |
Yajirushi | 3:486fb90dc7d5 | 930 | * Add Queue:Stop motor. |
Yajirushi | 3:486fb90dc7d5 | 931 | * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1. |
Yajirushi | 3:486fb90dc7d5 | 932 | */ |
Yajirushi | 3:486fb90dc7d5 | 933 | int ENQ_stop(int motorNumber); |
Yajirushi | 3:486fb90dc7d5 | 934 | |
Yajirushi | 4:4127dd195311 | 935 | /** Enqueue Command [hard stop]@n |
Yajirushi | 3:486fb90dc7d5 | 936 | * @~japanese |
Yajirushi | 3:486fb90dc7d5 | 937 | * キューに追加:減速を無視して停止 |
Yajirushi | 3:486fb90dc7d5 | 938 | * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定) |
Yajirushi | 3:486fb90dc7d5 | 939 | * |
Yajirushi | 3:486fb90dc7d5 | 940 | * @~english |
Yajirushi | 3:486fb90dc7d5 | 941 | * Add Queue:Stop immediately motor. |
Yajirushi | 3:486fb90dc7d5 | 942 | * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1. |
Yajirushi | 3:486fb90dc7d5 | 943 | */ |
Yajirushi | 3:486fb90dc7d5 | 944 | int ENQ_stopImmidiate(int motorNumber); |
Yajirushi | 3:486fb90dc7d5 | 945 | |
Yajirushi | 4:4127dd195311 | 946 | /** Enqueue Command [HIZ stop]@n |
Yajirushi | 3:486fb90dc7d5 | 947 | * @~japanese |
Yajirushi | 3:486fb90dc7d5 | 948 | * キューに追加:モーターを停止し、実行後ハイインピーダンス状態にします |
Yajirushi | 3:486fb90dc7d5 | 949 | * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定) |
Yajirushi | 3:486fb90dc7d5 | 950 | * |
Yajirushi | 3:486fb90dc7d5 | 951 | * @~english |
Yajirushi | 3:486fb90dc7d5 | 952 | * Add Queue:Stop motor. Set state "High Impedance" after stop. |
Yajirushi | 3:486fb90dc7d5 | 953 | * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1. |
Yajirushi | 3:486fb90dc7d5 | 954 | */ |
Yajirushi | 3:486fb90dc7d5 | 955 | int ENQ_stop_HighImpedance(int motorNumber); |
Yajirushi | 3:486fb90dc7d5 | 956 | |
Yajirushi | 4:4127dd195311 | 957 | /** Enqueue Command [HIZ hard stop]@n |
Yajirushi | 3:486fb90dc7d5 | 958 | * @~japanese |
Yajirushi | 3:486fb90dc7d5 | 959 | * キューに追加:減速を無視して停止し、実行後ハイインピーダンス状態にします |
Yajirushi | 3:486fb90dc7d5 | 960 | * @param motorNumber 1から始まるモーター番号(デイジーチェーン接続していない場合は1を指定) |
Yajirushi | 3:486fb90dc7d5 | 961 | * |
Yajirushi | 3:486fb90dc7d5 | 962 | * @~english |
Yajirushi | 3:486fb90dc7d5 | 963 | * Add Queue:Stop immediately motor. Set state "High Impedance" after stop. |
Yajirushi | 3:486fb90dc7d5 | 964 | * @param motorNumber Chained motor-number. If not using daisy-chain, you must be motorNumber = 1. |
Yajirushi | 3:486fb90dc7d5 | 965 | */ |
Yajirushi | 3:486fb90dc7d5 | 966 | int ENQ_stopImmidiate_HighImpedance(int motorNumber); |
Yajirushi | 3:486fb90dc7d5 | 967 | |
Yajirushi | 4:4127dd195311 | 968 | /** Clear Queue@n |
Yajirushi | 3:486fb90dc7d5 | 969 | * @~japanese コマンドキューを全てクリアします |
Yajirushi | 3:486fb90dc7d5 | 970 | * @~english Command Queue all zero clear. |
Yajirushi | 3:486fb90dc7d5 | 971 | */ |
Yajirushi | 3:486fb90dc7d5 | 972 | void Qclear(); |
Yajirushi | 3:486fb90dc7d5 | 973 | |
Yajirushi | 4:4127dd195311 | 974 | /** Execute Queue@n |
Yajirushi | 3:486fb90dc7d5 | 975 | * @~japanese |
Yajirushi | 3:486fb90dc7d5 | 976 | * コマンドキューに格納されたコマンドを一度に実行します |
Yajirushi | 3:486fb90dc7d5 | 977 | * @param finallyClearQueue 実行後にキューをクリアする(デフォルトはtrue) |
Yajirushi | 3:486fb90dc7d5 | 978 | * |
Yajirushi | 3:486fb90dc7d5 | 979 | * @~english |
Yajirushi | 3:486fb90dc7d5 | 980 | * Execute Command Queue. |
Yajirushi | 3:486fb90dc7d5 | 981 | * @param finallyClearQueue Clear Queue after execution.(default=true) |
Yajirushi | 3:486fb90dc7d5 | 982 | */ |
Yajirushi | 3:486fb90dc7d5 | 983 | int Qexec(bool finallyClearQueue=true); |
Yajirushi | 3:486fb90dc7d5 | 984 | |
Yajirushi | 3:486fb90dc7d5 | 985 | // calc method ----------------------------------------------------------------- |
Yajirushi | 4:4127dd195311 | 986 | /** Caluculate HEX value from Speed value@n |
Yajirushi | 3:486fb90dc7d5 | 987 | * @~japanese |
Yajirushi | 3:486fb90dc7d5 | 988 | * 速度(step/s)をパラメーター用数値に変換します |
Yajirushi | 3:486fb90dc7d5 | 989 | * @param stepPerSecond 回転速度(step/s) |
Yajirushi | 3:486fb90dc7d5 | 990 | * |
Yajirushi | 3:486fb90dc7d5 | 991 | * @returns 変換された16進数値 |
Yajirushi | 3:486fb90dc7d5 | 992 | * |
Yajirushi | 3:486fb90dc7d5 | 993 | * @~english |
Yajirushi | 3:486fb90dc7d5 | 994 | * Convert to Param(Hex) value from real speed value(step/s). |
Yajirushi | 3:486fb90dc7d5 | 995 | * @param stepPerSecond Motor rotate speed(step/s). |
Yajirushi | 3:486fb90dc7d5 | 996 | * |
Yajirushi | 3:486fb90dc7d5 | 997 | * @returns Converted value. |
Yajirushi | 3:486fb90dc7d5 | 998 | */ |
Yajirushi | 3:486fb90dc7d5 | 999 | unsigned long calcSpd(float stepPerSecond); |
Yajirushi | 3:486fb90dc7d5 | 1000 | |
Yajirushi | 4:4127dd195311 | 1001 | /** Caluculate HEX value from Acceleration speed value@n |
Yajirushi | 3:486fb90dc7d5 | 1002 | * @~japanese |
Yajirushi | 3:486fb90dc7d5 | 1003 | * 加速速度(step/s^2)をパラメーター用数値に変換します |
Yajirushi | 3:486fb90dc7d5 | 1004 | * @param stepPerSecond 加速速度(step/s^2) |
Yajirushi | 3:486fb90dc7d5 | 1005 | * |
Yajirushi | 3:486fb90dc7d5 | 1006 | * @returns 変換された16進数値 |
Yajirushi | 3:486fb90dc7d5 | 1007 | * |
Yajirushi | 3:486fb90dc7d5 | 1008 | * @~english |
Yajirushi | 3:486fb90dc7d5 | 1009 | * Convert to Param(Hex) value from acceleration speed value(step/s^2). |
Yajirushi | 3:486fb90dc7d5 | 1010 | * @param stepPerSecond rotate acceleration speed(step/s^2). |
Yajirushi | 3:486fb90dc7d5 | 1011 | * |
Yajirushi | 3:486fb90dc7d5 | 1012 | * @returns Converted value. |
Yajirushi | 3:486fb90dc7d5 | 1013 | */ |
Yajirushi | 3:486fb90dc7d5 | 1014 | unsigned short calcAcc(float stepPerSecond_2); |
Yajirushi | 3:486fb90dc7d5 | 1015 | |
Yajirushi | 4:4127dd195311 | 1016 | /** Caluculate HEX value from Deceleration speed value@n |
Yajirushi | 3:486fb90dc7d5 | 1017 | * @~japanese |
Yajirushi | 3:486fb90dc7d5 | 1018 | * 減速速度(step/s^2)をパラメーター用数値に変換します |
Yajirushi | 3:486fb90dc7d5 | 1019 | * @param stepPerSecond 減速速度(step/s^2) |
Yajirushi | 3:486fb90dc7d5 | 1020 | * |
Yajirushi | 3:486fb90dc7d5 | 1021 | * @returns 変換された16進数値 |
Yajirushi | 3:486fb90dc7d5 | 1022 | * |
Yajirushi | 3:486fb90dc7d5 | 1023 | * @~english |
Yajirushi | 3:486fb90dc7d5 | 1024 | * Convert to Param(Hex) value from deceleration speed value(step/s^2). |
Yajirushi | 3:486fb90dc7d5 | 1025 | * @param stepPerSecond rotate deceleration speed(step/s^2). |
Yajirushi | 3:486fb90dc7d5 | 1026 | * |
Yajirushi | 3:486fb90dc7d5 | 1027 | * @returns Converted value. |
Yajirushi | 3:486fb90dc7d5 | 1028 | */ |
Yajirushi | 3:486fb90dc7d5 | 1029 | unsigned short calcDec(float stepPerSecond_2); |
Yajirushi | 3:486fb90dc7d5 | 1030 | |
Yajirushi | 4:4127dd195311 | 1031 | /** Caluculate HEX value from MAX speed value@n |
Yajirushi | 3:486fb90dc7d5 | 1032 | * @~japanese |
Yajirushi | 3:486fb90dc7d5 | 1033 | * 最大速度(step/s)をパラメーター用数値に変換します |
Yajirushi | 3:486fb90dc7d5 | 1034 | * @param stepPerSecond 最大回転速度(step/s) |
Yajirushi | 3:486fb90dc7d5 | 1035 | * |
Yajirushi | 3:486fb90dc7d5 | 1036 | * @returns 変換された16進数値 |
Yajirushi | 3:486fb90dc7d5 | 1037 | * |
Yajirushi | 3:486fb90dc7d5 | 1038 | * @~english |
Yajirushi | 3:486fb90dc7d5 | 1039 | * Convert to Param(Hex) value from maximum speed value(step/s). |
Yajirushi | 3:486fb90dc7d5 | 1040 | * @param stepPerSecond Motor rotate maximum speed(step/s). |
Yajirushi | 3:486fb90dc7d5 | 1041 | * |
Yajirushi | 3:486fb90dc7d5 | 1042 | * @returns Converted value. |
Yajirushi | 3:486fb90dc7d5 | 1043 | */ |
Yajirushi | 3:486fb90dc7d5 | 1044 | unsigned short calcMaxSpd(float stepPerSecond); |
Yajirushi | 3:486fb90dc7d5 | 1045 | |
Yajirushi | 4:4127dd195311 | 1046 | /** Caluculate HEX value from MIN speed value@n |
Yajirushi | 3:486fb90dc7d5 | 1047 | * @~japanese |
Yajirushi | 3:486fb90dc7d5 | 1048 | * 最低速度(step/s)をパラメーター用数値に変換します |
Yajirushi | 3:486fb90dc7d5 | 1049 | * @param stepPerSecond 最低回転速度(step/s) |
Yajirushi | 3:486fb90dc7d5 | 1050 | * |
Yajirushi | 3:486fb90dc7d5 | 1051 | * @returns 変換された16進数値 |
Yajirushi | 3:486fb90dc7d5 | 1052 | * |
Yajirushi | 3:486fb90dc7d5 | 1053 | * @~english |
Yajirushi | 3:486fb90dc7d5 | 1054 | * Convert to Param(Hex) value from minimum speed value(step/s). |
Yajirushi | 3:486fb90dc7d5 | 1055 | * @param stepPerSecond Motor rotate minimum speed(step/s). |
Yajirushi | 3:486fb90dc7d5 | 1056 | * |
Yajirushi | 3:486fb90dc7d5 | 1057 | * @returns Converted value. |
Yajirushi | 3:486fb90dc7d5 | 1058 | */ |
Yajirushi | 3:486fb90dc7d5 | 1059 | unsigned short calcMinSpd(float stepPerSecond); |
Yajirushi | 3:486fb90dc7d5 | 1060 | |
Yajirushi | 4:4127dd195311 | 1061 | /** Caluculate HEX value from acceleration and deceleration switched point speed@n |
Yajirushi | 3:486fb90dc7d5 | 1062 | * @~japanese |
Yajirushi | 3:486fb90dc7d5 | 1063 | * 加減速曲線が切り替わる速度を指定します |
Yajirushi | 3:486fb90dc7d5 | 1064 | * @param stepPerSecond 加減速曲線が切り替わる速度(step/s) |
Yajirushi | 3:486fb90dc7d5 | 1065 | * |
Yajirushi | 3:486fb90dc7d5 | 1066 | * @returns 変換された16進数値 |
Yajirushi | 3:486fb90dc7d5 | 1067 | * |
Yajirushi | 3:486fb90dc7d5 | 1068 | * @~english |
Yajirushi | 3:486fb90dc7d5 | 1069 | * Convert to Param(Hex) value from acceleration and deceleration switched point speed(step/s). |
Yajirushi | 3:486fb90dc7d5 | 1070 | * @param stepPerSecond switched point speed(step/s). |
Yajirushi | 3:486fb90dc7d5 | 1071 | * |
Yajirushi | 3:486fb90dc7d5 | 1072 | * @returns Converted value. |
Yajirushi | 3:486fb90dc7d5 | 1073 | */ |
Yajirushi | 3:486fb90dc7d5 | 1074 | unsigned short calcIntSpd(float stepPerSecond); |
Yajirushi | 3:486fb90dc7d5 | 1075 | |
Yajirushi | 4:4127dd195311 | 1076 | /** Caluculate HEX value from full-step mode switched point speed@n |
Yajirushi | 3:486fb90dc7d5 | 1077 | * @~japanese |
Yajirushi | 3:486fb90dc7d5 | 1078 | * フルステップモードに切り替わる速度を指定します |
Yajirushi | 3:486fb90dc7d5 | 1079 | * @param stepPerSecond フルステップモードに切り替わる速度(step/s) |
Yajirushi | 3:486fb90dc7d5 | 1080 | * |
Yajirushi | 3:486fb90dc7d5 | 1081 | * @returns 変換された16進数値 |
Yajirushi | 3:486fb90dc7d5 | 1082 | * |
Yajirushi | 3:486fb90dc7d5 | 1083 | * @~english |
Yajirushi | 3:486fb90dc7d5 | 1084 | * Convert to Param(Hex) value from full-step mode switched point speed(step/s). |
Yajirushi | 3:486fb90dc7d5 | 1085 | * @param stepPerSecond switched point speed(step/s). |
Yajirushi | 3:486fb90dc7d5 | 1086 | * |
Yajirushi | 3:486fb90dc7d5 | 1087 | * @returns Converted value. |
Yajirushi | 3:486fb90dc7d5 | 1088 | */ |
Yajirushi | 3:486fb90dc7d5 | 1089 | unsigned short calcFullStepSpd(float stepPerSecond); |
Yajirushi | 3:486fb90dc7d5 | 1090 | |
Yajirushi | 3:486fb90dc7d5 | 1091 | // set method ------------------------------------------------------------------ |
Yajirushi | 0:e1964b6e160c | 1092 | void setAbsPosition(int motorNumber, unsigned long value); //絶対座標設定 |
Yajirushi | 0:e1964b6e160c | 1093 | void setElecPosition(int motorNumber, unsigned short value); //マイクロステップ位置設定 |
Yajirushi | 3:486fb90dc7d5 | 1094 | void setMarkPosition(int motorNumber, unsigned long value); //マークポジション設定 |
Yajirushi | 0:e1964b6e160c | 1095 | void setAcceleration(int motorNumber, unsigned short value); //加速設定 |
Yajirushi | 0:e1964b6e160c | 1096 | void setDeceleration(int motorNumber, unsigned short value); //減速設定 |
Yajirushi | 0:e1964b6e160c | 1097 | void setMaximumSpeed(int motorNumber, unsigned short value); //最大回転速度設定 |
Yajirushi | 0:e1964b6e160c | 1098 | void setMinimumSpeed(int motorNumber, unsigned short value); //最低回転速度設定(普通はゼロ) |
Yajirushi | 0:e1964b6e160c | 1099 | void setHoldingKVAL(int motorNumber, unsigned char value); //モーター停止中の電圧 |
Yajirushi | 0:e1964b6e160c | 1100 | void setRunningKVAL(int motorNumber, unsigned char value); //モーター駆動中の電圧 |
Yajirushi | 0:e1964b6e160c | 1101 | void setAccelerationKVAL(int motorNumber, unsigned char value); //モーター加速中の電圧 |
Yajirushi | 0:e1964b6e160c | 1102 | void setDecelerationKVAL(int motorNumber, unsigned char value); //モーター減速中の電圧 |
Yajirushi | 0:e1964b6e160c | 1103 | void setKVAL( //モーターの電圧(一度に設定) |
Yajirushi | 0:e1964b6e160c | 1104 | int motorNumber, |
Yajirushi | 0:e1964b6e160c | 1105 | unsigned char holdVal, unsigned char runVal, |
Yajirushi | 0:e1964b6e160c | 1106 | unsigned char accVal, unsigned char decVal |
Yajirushi | 0:e1964b6e160c | 1107 | ); |
Yajirushi | 0:e1964b6e160c | 1108 | void setInterpolateSpeed(int motorNumber, unsigned short value); //加減速補間を開始するスピード |
Yajirushi | 0:e1964b6e160c | 1109 | void setInterpolateSlope(int motorNumber, unsigned char value); //加減速補間の傾き |
Yajirushi | 0:e1964b6e160c | 1110 | void setAccSlopeFinal(int motorNumber, unsigned char value); //加速最終時の補間の傾き |
Yajirushi | 0:e1964b6e160c | 1111 | void setDecSlopeFinal(int motorNumber, unsigned char value); //減速最終時の補間の傾き |
Yajirushi | 0:e1964b6e160c | 1112 | void setThermoCorrect(int motorNumber, unsigned char value); //高温時の補正 |
Yajirushi | 0:e1964b6e160c | 1113 | void setOCThreshold(int motorNumber, unsigned char value); //オーバーカレントの電流閾値 |
Yajirushi | 0:e1964b6e160c | 1114 | void setStallThreshold(int motorNumber, unsigned char value); //ストールの電流閾値 |
Yajirushi | 0:e1964b6e160c | 1115 | void setFSSpeed(int motorNumber, unsigned short value); //フルステップ駆動に切り替えるスピード |
Yajirushi | 0:e1964b6e160c | 1116 | void setStepMode(int motorNumber, unsigned char value); //マイクロステッピングモード指定 |
Yajirushi | 0:e1964b6e160c | 1117 | void setAlermEnable(int motorNumber, unsigned char value); //アラームの有効無効 |
Yajirushi | 0:e1964b6e160c | 1118 | void setSystemConfig(int motorNumber, unsigned short value); //ドライバシステム設定 |
Yajirushi | 0:e1964b6e160c | 1119 | |
Yajirushi | 3:486fb90dc7d5 | 1120 | // get method ------------------------------------------------------------------ |
Yajirushi | 0:e1964b6e160c | 1121 | unsigned long getSpeed(int motorNumber); //現在の回転スピード |
Yajirushi | 0:e1964b6e160c | 1122 | unsigned short getADC(int motorNumber); //ADCの取得 |
Yajirushi | 0:e1964b6e160c | 1123 | unsigned short getStatus(int motorNumber); //ステータス読み取り |
Yajirushi | 0:e1964b6e160c | 1124 | unsigned long getAbsPosition(int motorNumber); //絶対座標 |
Yajirushi | 0:e1964b6e160c | 1125 | unsigned short getElecPosition(int motorNumber); //マイクロステップ位置 |
Yajirushi | 3:486fb90dc7d5 | 1126 | unsigned long getMarkPosition(int motorNumber); //マークポジション |
Yajirushi | 0:e1964b6e160c | 1127 | unsigned short getAcceleration(int motorNumber); //加速 |
Yajirushi | 0:e1964b6e160c | 1128 | unsigned short getDeceleration(int motorNumber); //減速 |
Yajirushi | 0:e1964b6e160c | 1129 | unsigned short getMaximumSpeed(int motorNumber); //最大回転速度 |
Yajirushi | 0:e1964b6e160c | 1130 | unsigned short getMinimumSpeed(int motorNumber); //最低回転速度(普通はゼロ) |
Yajirushi | 0:e1964b6e160c | 1131 | unsigned char getHoldingKVAL(int motorNumber); //モーター停止中の電圧 |
Yajirushi | 0:e1964b6e160c | 1132 | unsigned char getRunningKVAL(int motorNumber); //モーター駆動中の電圧 |
Yajirushi | 0:e1964b6e160c | 1133 | unsigned char getAccelerationKVAL(int motorNumber); //モーター加速中の電圧 |
Yajirushi | 0:e1964b6e160c | 1134 | unsigned char getDecelerationKVAL(int motorNumber); //モーター減速中の電圧 |
Yajirushi | 0:e1964b6e160c | 1135 | unsigned short getInterpolateSpeed(int motorNumber); //加減速補間を開始するスピード |
Yajirushi | 0:e1964b6e160c | 1136 | unsigned char getInterpolateSlope(int motorNumber); //加減速補間の傾き |
Yajirushi | 0:e1964b6e160c | 1137 | unsigned char getAccSlopeFinal(int motorNumber); //加速最終時の補間の傾き |
Yajirushi | 0:e1964b6e160c | 1138 | unsigned char getDecSlopeFinal(int motorNumber); //減速最終時の補間の傾き |
Yajirushi | 0:e1964b6e160c | 1139 | unsigned char getThermoCorrect(int motorNumber); //高温時の補正 |
Yajirushi | 0:e1964b6e160c | 1140 | unsigned char getOCThreshold(int motorNumber); //オーバーカレントの電流閾値 |
Yajirushi | 0:e1964b6e160c | 1141 | unsigned char getStallThreshold(int motorNumber); //ストールの電流閾値 |
Yajirushi | 0:e1964b6e160c | 1142 | unsigned short getFSSpeed(int motorNumber); //フルステップ駆動に切り替えるスピード |
Yajirushi | 0:e1964b6e160c | 1143 | unsigned char getStepMode(int motorNumber); //マイクロステッピングモード |
Yajirushi | 0:e1964b6e160c | 1144 | unsigned char getAlermEnable(int motorNumber); //アラームの有効無効 |
Yajirushi | 0:e1964b6e160c | 1145 | unsigned short getSystemConfig(int motorNumber); //ドライバシステム設定 |
Yajirushi | 0:e1964b6e160c | 1146 | }; |
Yajirushi | 0:e1964b6e160c | 1147 | |
Yajirushi | 0:e1964b6e160c | 1148 | #endif |