Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: ST_INTERFACES X_NUCLEO_COMMON
Fork of X_NUCLEO_IHM02A1 by
Components/Common/microstepping_motor.h@1:b78dab6d2c58, 2015-11-25 (annotated)
- Committer:
- Davidroid
- Date:
- Wed Nov 25 11:59:37 2015 +0000
- Revision:
- 1:b78dab6d2c58
- Parent:
- 0:92706998571a
- Child:
- 11:1aca63b2f034
+ Implemented all the StepperMotor's APIs.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| Davidroid | 0:92706998571a | 1 | /** |
| Davidroid | 0:92706998571a | 2 | ****************************************************************************** |
| Davidroid | 0:92706998571a | 3 | * @file microstepping_motor.h |
| Davidroid | 0:92706998571a | 4 | * @author IPD SYSTEM LAB & TECH MKTG |
| Davidroid | 0:92706998571a | 5 | * @version V0.0.1 |
| Davidroid | 0:92706998571a | 6 | * @date 04-June-2015 |
| Davidroid | 0:92706998571a | 7 | * @brief This file contains all the functions prototypes for the microstepping |
| Davidroid | 0:92706998571a | 8 | * motor driver with motion engine. |
| Davidroid | 0:92706998571a | 9 | ****************************************************************************** |
| Davidroid | 0:92706998571a | 10 | * @attention |
| Davidroid | 0:92706998571a | 11 | * |
| Davidroid | 0:92706998571a | 12 | * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> |
| Davidroid | 0:92706998571a | 13 | * |
| Davidroid | 0:92706998571a | 14 | * Redistribution and use in source and binary forms, with or without modification, |
| Davidroid | 0:92706998571a | 15 | * are permitted provided that the following conditions are met: |
| Davidroid | 0:92706998571a | 16 | * 1. Redistributions of source code must retain the above copyright notice, |
| Davidroid | 0:92706998571a | 17 | * this list of conditions and the following disclaimer. |
| Davidroid | 0:92706998571a | 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
| Davidroid | 0:92706998571a | 19 | * this list of conditions and the following disclaimer in the documentation |
| Davidroid | 0:92706998571a | 20 | * and/or other materials provided with the distribution. |
| Davidroid | 0:92706998571a | 21 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
| Davidroid | 0:92706998571a | 22 | * may be used to endorse or promote products derived from this software |
| Davidroid | 0:92706998571a | 23 | * without specific prior written permission. |
| Davidroid | 0:92706998571a | 24 | * |
| Davidroid | 0:92706998571a | 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| Davidroid | 0:92706998571a | 26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| Davidroid | 0:92706998571a | 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| Davidroid | 0:92706998571a | 28 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
| Davidroid | 0:92706998571a | 29 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| Davidroid | 0:92706998571a | 30 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| Davidroid | 0:92706998571a | 31 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| Davidroid | 0:92706998571a | 32 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| Davidroid | 0:92706998571a | 33 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| Davidroid | 0:92706998571a | 34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| Davidroid | 0:92706998571a | 35 | * |
| Davidroid | 0:92706998571a | 36 | ****************************************************************************** |
| Davidroid | 0:92706998571a | 37 | */ |
| Davidroid | 0:92706998571a | 38 | |
| Davidroid | 0:92706998571a | 39 | /* Define to prevent recursive inclusion -------------------------------------*/ |
| Davidroid | 0:92706998571a | 40 | #ifndef __MICROSTEPPINGMOTOR_H |
| Davidroid | 0:92706998571a | 41 | #define __MICROSTEPPINGMOTOR_H |
| Davidroid | 0:92706998571a | 42 | |
| Davidroid | 0:92706998571a | 43 | #ifdef __cplusplus |
| Davidroid | 0:92706998571a | 44 | extern "C" { |
| Davidroid | 0:92706998571a | 45 | #endif |
| Davidroid | 0:92706998571a | 46 | |
| Davidroid | 0:92706998571a | 47 | /* Includes ------------------------------------------------------------------*/ |
| Davidroid | 0:92706998571a | 48 | #include <stdint.h> |
| Davidroid | 0:92706998571a | 49 | #include "component.h" |
| Davidroid | 0:92706998571a | 50 | |
| Davidroid | 0:92706998571a | 51 | /** @addtogroup BSP |
| Davidroid | 0:92706998571a | 52 | * @{ |
| Davidroid | 0:92706998571a | 53 | */ |
| Davidroid | 0:92706998571a | 54 | |
| Davidroid | 0:92706998571a | 55 | /** @addtogroup Components |
| Davidroid | 0:92706998571a | 56 | * @{ |
| Davidroid | 0:92706998571a | 57 | */ |
| Davidroid | 0:92706998571a | 58 | |
| Davidroid | 0:92706998571a | 59 | /** @defgroup MicrosteppingMotorDriver |
| Davidroid | 0:92706998571a | 60 | * @{ |
| Davidroid | 0:92706998571a | 61 | */ |
| Davidroid | 0:92706998571a | 62 | |
| Davidroid | 0:92706998571a | 63 | /** @defgroup StepperMotorExportedTypes |
| Davidroid | 0:92706998571a | 64 | * @{ |
| Davidroid | 0:92706998571a | 65 | */ |
| Davidroid | 0:92706998571a | 66 | |
| Davidroid | 0:92706998571a | 67 | /** |
| Davidroid | 0:92706998571a | 68 | * @brief The L6470 Registers Identifiers. |
| Davidroid | 0:92706998571a | 69 | */ |
| Davidroid | 0:92706998571a | 70 | typedef enum { |
| Davidroid | 0:92706998571a | 71 | L6470_ABS_POS_ID = 0, //!< Current position |
| Davidroid | 0:92706998571a | 72 | L6470_EL_POS_ID, //!< Electrical position |
| Davidroid | 0:92706998571a | 73 | L6470_MARK_ID, //!< Mark position |
| Davidroid | 0:92706998571a | 74 | L6470_SPEED_ID, //!< Current speed |
| Davidroid | 0:92706998571a | 75 | L6470_ACC_ID, //!< Acceleration |
| Davidroid | 0:92706998571a | 76 | L6470_DEC_ID, //!< Deceleration |
| Davidroid | 0:92706998571a | 77 | L6470_MAX_SPEED_ID, //!< Maximum speed |
| Davidroid | 0:92706998571a | 78 | L6470_MIN_SPEED_ID, //!< Minimum speed |
| Davidroid | 0:92706998571a | 79 | L6470_FS_SPD_ID, //!< Full-step speed |
| Davidroid | 0:92706998571a | 80 | L6470_KVAL_HOLD_ID, //!< Holding KVAL |
| Davidroid | 0:92706998571a | 81 | L6470_KVAL_RUN_ID, //!< Constant speed KVAL |
| Davidroid | 0:92706998571a | 82 | L6470_KVAL_ACC_ID, //!< Acceleration starting KVAL |
| Davidroid | 0:92706998571a | 83 | L6470_KVAL_DEC_ID, //!< Deceleration starting KVAL |
| Davidroid | 0:92706998571a | 84 | L6470_INT_SPEED_ID, //!< Intersect speed |
| Davidroid | 0:92706998571a | 85 | L6470_ST_SLP_ID, //!< Start slope |
| Davidroid | 0:92706998571a | 86 | L6470_FN_SLP_ACC_ID, //!< Acceleration final slope |
| Davidroid | 0:92706998571a | 87 | L6470_FN_SLP_DEC_ID, //!< Deceleration final slope |
| Davidroid | 0:92706998571a | 88 | L6470_K_THERM_ID, //!< Thermal compensation factor |
| Davidroid | 0:92706998571a | 89 | L6470_ADC_OUT_ID, //!< ADC output, (the reset value is according to startup conditions) |
| Davidroid | 0:92706998571a | 90 | L6470_OCD_TH_ID, //!< OCD threshold |
| Davidroid | 0:92706998571a | 91 | L6470_STALL_TH_ID, //!< STALL threshold |
| Davidroid | 0:92706998571a | 92 | L6470_STEP_MODE_ID, //!< Step mode |
| Davidroid | 0:92706998571a | 93 | L6470_ALARM_EN_ID, //!< Alarm enable |
| Davidroid | 0:92706998571a | 94 | L6470_CONFIG_ID, //!< IC configuration |
| Davidroid | 1:b78dab6d2c58 | 95 | L6470_STATUS_ID //!< Status, (the reset value is according to startup conditions) |
| Davidroid | 0:92706998571a | 96 | } eL6470_RegId_t; |
| Davidroid | 0:92706998571a | 97 | |
| Davidroid | 0:92706998571a | 98 | /** |
| Davidroid | 0:92706998571a | 99 | * @brief The L6470 Application Commands Identifiers. |
| Davidroid | 0:92706998571a | 100 | */ |
| Davidroid | 0:92706998571a | 101 | typedef enum { |
| Davidroid | 0:92706998571a | 102 | L6470_NOP_ID = 0, //!< Nothing |
| Davidroid | 0:92706998571a | 103 | L6470_SETPARAM_ID, //!< Writes VALUE in PARAM register |
| Davidroid | 0:92706998571a | 104 | L6470_GETPARAM_ID, //!< Returns the stored value in PARAM register |
| Davidroid | 0:92706998571a | 105 | L6470_RUN_ID, //!< Sets the target speed and the motor direction |
| Davidroid | 0:92706998571a | 106 | L6470_STEPCLOCK_ID, //!< Puts the device into Step-clock mode and imposes DIR direction |
| Davidroid | 0:92706998571a | 107 | L6470_MOVE_ID, //!< Makes N_STEP (micro)steps in DIR direction (Not performable when motor is running) |
| Davidroid | 0:92706998571a | 108 | L6470_GOTO_ID, //!< Brings motor into ABS_POS position (minimum path) |
| Davidroid | 0:92706998571a | 109 | L6470_GOTODIR_ID, //!< Brings motor into ABS_POS position forcing DIR direction |
| Davidroid | 0:92706998571a | 110 | L6470_GOUNTIL_ID, //!< Performs a motion in DIR direction with speed SPD until SW is closed, the ACT action is executed then a SoftStop takes place |
| Davidroid | 0:92706998571a | 111 | L6470_RELEASESW_ID, //!< Performs a motion in DIR direction at minimum speed until the SW is released (open), the ACT action is executed then a HardStop takes place |
| Davidroid | 0:92706998571a | 112 | L6470_GOHOME_ID, //!< Brings the motor into HOME position |
| Davidroid | 0:92706998571a | 113 | L6470_GOMARK_ID, //!< Brings the motor into MARK position |
| Davidroid | 0:92706998571a | 114 | L6470_RESETPOS_ID, //!< Resets the ABS_POS register (set HOME position) |
| Davidroid | 0:92706998571a | 115 | L6470_RESETDEVICE_ID, //!< Device is reset to power-up conditions |
| Davidroid | 0:92706998571a | 116 | L6470_SOFTSTOP_ID, //!< Stops motor with a deceleration phase |
| Davidroid | 0:92706998571a | 117 | L6470_HARDSTOP_ID, //!< Stops motor immediately |
| Davidroid | 0:92706998571a | 118 | L6470_SOFTHIZ_ID, //!< Puts the bridges into high impedance status after a deceleration phase |
| Davidroid | 0:92706998571a | 119 | L6470_HARDHIZ_ID, //!< Puts the bridges into high impedance status immediately |
| Davidroid | 0:92706998571a | 120 | L6470_GETSTATUS_ID //!< Returns the STATUS register value |
| Davidroid | 0:92706998571a | 121 | } eL6470_AppCmdId_t; |
| Davidroid | 0:92706998571a | 122 | |
| Davidroid | 0:92706998571a | 123 | /** |
| Davidroid | 0:92706998571a | 124 | * @brief The L6470 Status Register Flag identifiers. |
| Davidroid | 0:92706998571a | 125 | */ |
| Davidroid | 0:92706998571a | 126 | typedef enum { |
| Davidroid | 0:92706998571a | 127 | HiZ_ID = 0, //!< HiZ flag identifier inside the L6470 Status Register |
| Davidroid | 0:92706998571a | 128 | BUSY_ID, //!< BUSY flag identifier inside the L6470 Status Register |
| Davidroid | 0:92706998571a | 129 | SW_F_ID, //!< SW_F flag identifier inside the L6470 Status Register |
| Davidroid | 0:92706998571a | 130 | SW_EVN_ID, //!< SW_EVN flag identifier inside the L6470 Status Register |
| Davidroid | 0:92706998571a | 131 | DIR_ID, //!< DIR flag identifier inside the L6470 Status Register |
| Davidroid | 0:92706998571a | 132 | MOT_STATUS_ID, //!< MOT_STATUS flag identifier inside the L6470 Status Register |
| Davidroid | 0:92706998571a | 133 | NOTPERF_CMD_ID, //!< NOTPERF_CMD flag identifier inside the L6470 Status Register |
| Davidroid | 0:92706998571a | 134 | WRONG_CMD_ID, //!< WRONG_CMD flag identifier inside the L6470 Status Register |
| Davidroid | 0:92706998571a | 135 | UVLO_ID, //!< UVLO flag identifier inside the L6470 Status Register |
| Davidroid | 0:92706998571a | 136 | TH_WRN_ID, //!< TH_WRN flag identifier inside the L6470 Status Register |
| Davidroid | 0:92706998571a | 137 | TH_SD_ID, //!< TH_SD flag identifier inside the L6470 Status Register |
| Davidroid | 0:92706998571a | 138 | OCD_ID, //!< OCD flag identifier inside the L6470 Status Register |
| Davidroid | 0:92706998571a | 139 | STEP_LOSS_A_ID, //!< STEP_LOSS_A flag identifier inside the L6470 Status Register |
| Davidroid | 0:92706998571a | 140 | STEP_LOSS_B_ID, //!< STEP_LOSS_B flag identifier inside the L6470 Status Register |
| Davidroid | 0:92706998571a | 141 | SCK_MOD_ID //!< SCK_MOD flag identifier inside the L6470 Status Register |
| Davidroid | 0:92706998571a | 142 | } eL6470_StatusRegisterFlagId_t; |
| Davidroid | 0:92706998571a | 143 | |
| Davidroid | 0:92706998571a | 144 | /** |
| Davidroid | 0:92706998571a | 145 | * @brief The L6470 Direction identifiers. |
| Davidroid | 0:92706998571a | 146 | */ |
| Davidroid | 0:92706998571a | 147 | typedef enum { |
| Davidroid | 0:92706998571a | 148 | L6470_DIR_REV_ID = 0, //!< Reverse direction |
| Davidroid | 0:92706998571a | 149 | L6470_DIR_FWD_ID //!< Forward direction |
| Davidroid | 0:92706998571a | 150 | } eL6470_DirId_t; |
| Davidroid | 0:92706998571a | 151 | |
| Davidroid | 0:92706998571a | 152 | /** |
| Davidroid | 0:92706998571a | 153 | * @brief The L6470 Action identifiers about ABS_POS register. |
| Davidroid | 0:92706998571a | 154 | */ |
| Davidroid | 0:92706998571a | 155 | typedef enum { |
| Davidroid | 0:92706998571a | 156 | L6470_ACT_RST_ID = 0, //!< ABS_POS register is reset |
| Davidroid | 0:92706998571a | 157 | L6470_ACT_CPY_ID //!< ABS_POS register value is copied into the MARK register |
| Davidroid | 0:92706998571a | 158 | } eL6470_ActId_t; |
| Davidroid | 0:92706998571a | 159 | |
| Davidroid | 0:92706998571a | 160 | /** |
| Davidroid | 0:92706998571a | 161 | * @brief The L6470 Status Register Flag states. |
| Davidroid | 0:92706998571a | 162 | */ |
| Davidroid | 0:92706998571a | 163 | typedef enum { |
| Davidroid | 0:92706998571a | 164 | ZERO_F = 0, //!< The flag is '0' |
| Davidroid | 0:92706998571a | 165 | ONE_F = !ZERO_F //!< The flag is '1' |
| Davidroid | 0:92706998571a | 166 | } eFlagStatus_t; |
| Davidroid | 0:92706998571a | 167 | |
| Davidroid | 0:92706998571a | 168 | /** |
| Davidroid | 0:92706998571a | 169 | * @brief The L6470 Motor Directions. |
| Davidroid | 0:92706998571a | 170 | */ |
| Davidroid | 0:92706998571a | 171 | typedef enum { |
| Davidroid | 0:92706998571a | 172 | REVERSE_F = 0, //!< Reverse motor direction |
| Davidroid | 0:92706998571a | 173 | FORWARD_F = !REVERSE_F //!< Forward motor direction |
| Davidroid | 0:92706998571a | 174 | } eMotorDirection_t; |
| Davidroid | 0:92706998571a | 175 | |
| Davidroid | 0:92706998571a | 176 | /** |
| Davidroid | 0:92706998571a | 177 | * @brief The L6470 Motor Status. |
| Davidroid | 0:92706998571a | 178 | */ |
| Davidroid | 0:92706998571a | 179 | typedef enum { |
| Davidroid | 0:92706998571a | 180 | STOPPED_F = 0, //!< Stopped |
| Davidroid | 0:92706998571a | 181 | ACCELERATION_F = 1, //!< Acceleration |
| Davidroid | 0:92706998571a | 182 | DECELERATION_F = 2, //!< Deceleration |
| Davidroid | 0:92706998571a | 183 | CONSTANTSPEED_F = 3 //!< Constant speed |
| Davidroid | 0:92706998571a | 184 | } eMotorStatus_t; |
| Davidroid | 0:92706998571a | 185 | |
| Davidroid | 0:92706998571a | 186 | /** |
| Davidroid | 0:92706998571a | 187 | * @brief The possible stepping modes for L6470. |
| Davidroid | 0:92706998571a | 188 | */ |
| Davidroid | 0:92706998571a | 189 | typedef enum |
| Davidroid | 0:92706998571a | 190 | { |
| Davidroid | 0:92706998571a | 191 | FULL_STEP = 0x00, //!< Full-step |
| Davidroid | 0:92706998571a | 192 | HALF_STEP = 0x01, //!< Half-step |
| Davidroid | 0:92706998571a | 193 | MICROSTEP_1_4 = 0x02, //!< 1/4 microstep |
| Davidroid | 0:92706998571a | 194 | MICROSTEP_1_8 = 0x03, //!< 1/8 microstep |
| Davidroid | 0:92706998571a | 195 | MICROSTEP_1_16 = 0x04, //!< 1/16 microstep |
| Davidroid | 0:92706998571a | 196 | MICROSTEP_1_32 = 0x05, //!< 1/32 microstep |
| Davidroid | 0:92706998571a | 197 | MICROSTEP_1_64 = 0x06, //!< 1/64 microstep |
| Davidroid | 0:92706998571a | 198 | MICROSTEP_1_128 = 0x07 //!< 1/128 microstep |
| Davidroid | 0:92706998571a | 199 | } eMotorStepMode_t; |
| Davidroid | 0:92706998571a | 200 | |
| Davidroid | 0:92706998571a | 201 | /** |
| Davidroid | 0:92706998571a | 202 | * @brief The identifiers for the possible L6470 alarm conditions. |
| Davidroid | 0:92706998571a | 203 | */ |
| Davidroid | 0:92706998571a | 204 | typedef enum |
| Davidroid | 0:92706998571a | 205 | { |
| Davidroid | 0:92706998571a | 206 | L6470_OVERCURRENT = 0x01, //!< Overcurrent |
| Davidroid | 0:92706998571a | 207 | L6470_THERMAL_SHUTDOWN = 0x02, //!< Thermal shutdown |
| Davidroid | 0:92706998571a | 208 | L6470_THERMAL_WARNING = 0x04, //!< Thermal warning |
| Davidroid | 0:92706998571a | 209 | L6470_UNDERVOLTAGE = 0x08, //!< Undervoltage |
| Davidroid | 0:92706998571a | 210 | L6470_STALL_DETECTION_A = 0x10, //!< Stall detection (Bridge A) |
| Davidroid | 0:92706998571a | 211 | L6470_STALL_DETECTION_B = 0x20, //!< Stall detection (Bridge B) |
| Davidroid | 0:92706998571a | 212 | L6470_SWITCH_TURN_ON_EVENT = 0x40, //!< Switch turn-on event |
| Davidroid | 0:92706998571a | 213 | L6470_WRONG_OR_NON_PERFORMABLE_COMMAND = 0x80 //!< Wrong or non-performable command |
| Davidroid | 0:92706998571a | 214 | } eL6470_AlarmCondition_t; |
| Davidroid | 0:92706998571a | 215 | |
| Davidroid | 0:92706998571a | 216 | /** |
| Davidroid | 0:92706998571a | 217 | * @brief The L6470 STEP_MODE Register (see L6470 DataSheet for more details). |
| Davidroid | 0:92706998571a | 218 | */ |
| Davidroid | 0:92706998571a | 219 | typedef struct { |
| Davidroid | 0:92706998571a | 220 | uint8_t STEP_SEL: 3; //!< Step mode |
| Davidroid | 0:92706998571a | 221 | uint8_t WRT: 1; //!< When the register is written, this bit should be set to 0. |
| Davidroid | 0:92706998571a | 222 | uint8_t SYNC_SEL: 3; //!< Synchronization selection |
| Davidroid | 0:92706998571a | 223 | uint8_t SYNC_EN: 1; //!< Synchronization enable |
| Davidroid | 0:92706998571a | 224 | } sL6470_StepModeRegister_t; |
| Davidroid | 0:92706998571a | 225 | |
| Davidroid | 0:92706998571a | 226 | /** |
| Davidroid | 0:92706998571a | 227 | * @brief The L6470 ALARM_EN Register (see L6470 DataSheet for more details). |
| Davidroid | 0:92706998571a | 228 | */ |
| Davidroid | 0:92706998571a | 229 | typedef struct { |
| Davidroid | 0:92706998571a | 230 | uint8_t OCD_EN: 1; //!< Overcurrent |
| Davidroid | 0:92706998571a | 231 | uint8_t TH_SD_EN: 1; //!< Thermal shutdown |
| Davidroid | 0:92706998571a | 232 | uint8_t TH_WRN_EN: 1; //!< Thermal warning |
| Davidroid | 0:92706998571a | 233 | uint8_t UVLO_EN: 1; //!< Undervoltage |
| Davidroid | 0:92706998571a | 234 | uint8_t STEP_LOSS_A_EN: 1; //!< Stall detection (Bridge A) |
| Davidroid | 0:92706998571a | 235 | uint8_t STEP_LOSS_B_EN: 1; //!< Stall detection (Bridge B) |
| Davidroid | 0:92706998571a | 236 | uint8_t SW_EVN_EN: 1; //!< Switch turn-on event |
| Davidroid | 0:92706998571a | 237 | uint8_t WRONG_NOTPERF_CMD_EN: 1; //!< Wrong or non-performable command |
| Davidroid | 0:92706998571a | 238 | } sL6470_AlarmEnRegister_t; |
| Davidroid | 0:92706998571a | 239 | |
| Davidroid | 0:92706998571a | 240 | /** |
| Davidroid | 0:92706998571a | 241 | * @brief The L6470 CONFIG Register (see L6470 DataSheet for more details). |
| Davidroid | 0:92706998571a | 242 | */ |
| Davidroid | 0:92706998571a | 243 | typedef struct { |
| Davidroid | 0:92706998571a | 244 | uint8_t OSC_SEL: 3; //!< Oscillator Selection |
| Davidroid | 0:92706998571a | 245 | uint8_t EXT_CLK: 1; //!< External Clock |
| Davidroid | 0:92706998571a | 246 | uint8_t SW_MODE: 1; //!< Switch mode |
| Davidroid | 0:92706998571a | 247 | uint8_t EN_VSCOMP: 1; //!< Motor supply voltage compensation |
| Davidroid | 0:92706998571a | 248 | uint8_t RESERVED: 1; //!< RESERVED |
| Davidroid | 0:92706998571a | 249 | uint8_t OC_SD: 1; //!< Overcurrent event |
| Davidroid | 0:92706998571a | 250 | uint8_t POW_SR: 2; //!< Output slew rate |
| Davidroid | 0:92706998571a | 251 | uint8_t F_PWM_DEC: 3; //!< Multiplication factor |
| Davidroid | 0:92706998571a | 252 | uint8_t F_PWM_INT: 3; //!< Integer division factor |
| Davidroid | 0:92706998571a | 253 | } sL6470_ConfigRegister_t; |
| Davidroid | 0:92706998571a | 254 | |
| Davidroid | 0:92706998571a | 255 | /** |
| Davidroid | 0:92706998571a | 256 | * @brief The L6470 STATUS Register (see L6470 DataSheet for more details). |
| Davidroid | 0:92706998571a | 257 | */ |
| Davidroid | 0:92706998571a | 258 | typedef struct { |
| Davidroid | 0:92706998571a | 259 | uint8_t HiZ: 1; //!< The bridges are in high impedance state (the flag is active high) |
| Davidroid | 0:92706998571a | 260 | uint8_t BUSY: 1; //!< BUSY pin status (the flag is active low) |
| Davidroid | 0:92706998571a | 261 | uint8_t SW_F: 1; //!< SW input status (the flag is low for open and high for closed) |
| Davidroid | 0:92706998571a | 262 | uint8_t SW_EVN: 1; //!< Switch turn-on event (the flag is active high) |
| Davidroid | 0:92706998571a | 263 | uint8_t DIR: 1; //!< The current motor direction (1 as forward, 0 as reverse) |
| Davidroid | 0:92706998571a | 264 | uint8_t MOT_STATUS: 2; //!< The current motor status (0 as stopped, 1 as acceleration, 2 as deceleration, 3 as constant speed) |
| Davidroid | 0:92706998571a | 265 | uint8_t NOTPERF_CMD: 1; //!< The command received by SPI cannot be performed (the flag is active high) |
| Davidroid | 0:92706998571a | 266 | uint8_t WRONG_CMD: 1; //!< The command received by SPI does not exist at all (the flag is active high) |
| Davidroid | 0:92706998571a | 267 | uint8_t UVLO: 1; //!< Undervoltage lockout or reset events (the flag is active low) |
| Davidroid | 0:92706998571a | 268 | uint8_t TH_WRN: 1; //!< Thermal warning event (the flag is active low) |
| Davidroid | 0:92706998571a | 269 | uint8_t TH_SD: 1; //!< Thermal shutdown event (the flag is active low) |
| Davidroid | 0:92706998571a | 270 | uint8_t OCD: 1; //!< Overcurrent detection event (the flag is active low) |
| Davidroid | 0:92706998571a | 271 | uint8_t STEP_LOSS_A: 1; //!< Stall detection on bridge A (the flag is active low) |
| Davidroid | 0:92706998571a | 272 | uint8_t STEP_LOSS_B: 1; //!< Stall detection on bridge B (the flag is active low) |
| Davidroid | 0:92706998571a | 273 | uint8_t SCK_MOD: 1; //!< Step-clock mode (the flag is active high) |
| Davidroid | 0:92706998571a | 274 | } sL6470_StatusRegister_t; |
| Davidroid | 0:92706998571a | 275 | |
| Davidroid | 0:92706998571a | 276 | /** |
| Davidroid | 0:92706998571a | 277 | * @brief Motor Parameter Data |
| Davidroid | 0:92706998571a | 278 | */ |
| Davidroid | 0:92706998571a | 279 | typedef struct |
| Davidroid | 0:92706998571a | 280 | { |
| Davidroid | 0:92706998571a | 281 | float motorvoltage; //!< motor supply voltage in V |
| Davidroid | 0:92706998571a | 282 | float fullstepsperrevolution; //!< min number of steps per revolution for the motor |
| Davidroid | 0:92706998571a | 283 | float phasecurrent; //!< max motor phase voltage in A |
| Davidroid | 0:92706998571a | 284 | float phasevoltage; //!< max motor phase voltage in V |
| Davidroid | 0:92706998571a | 285 | float speed; //!< motor initial speed [step/s] |
| Davidroid | 0:92706998571a | 286 | float acc; //!< motor acceleration [step/s^2] (comment for infinite acceleration mode) |
| Davidroid | 0:92706998571a | 287 | float dec; //!< motor deceleration [step/s^2] (comment for infinite deceleration mode) |
| Davidroid | 0:92706998571a | 288 | float maxspeed; //!< motor maximum speed [step/s] |
| Davidroid | 0:92706998571a | 289 | float minspeed; //!< motor minimum speed [step/s] |
| Davidroid | 0:92706998571a | 290 | float fsspd; //!< motor full-step speed threshold [step/s] |
| Davidroid | 0:92706998571a | 291 | float kvalhold; //!< holding kval [V] |
| Davidroid | 0:92706998571a | 292 | float kvalrun; //!< constant speed kval [V] |
| Davidroid | 0:92706998571a | 293 | float kvalacc; //!< acceleration starting kval [V] |
| Davidroid | 0:92706998571a | 294 | float kvaldec; //!< deceleration starting kval [V] |
| Davidroid | 0:92706998571a | 295 | float intspeed; //!< intersect speed for bemf compensation curve slope changing [step/s] |
| Davidroid | 0:92706998571a | 296 | float stslp; //!< start slope [s/step] |
| Davidroid | 0:92706998571a | 297 | float fnslpacc; //!< acceleration final slope [s/step] |
| Davidroid | 0:92706998571a | 298 | float fnslpdec; //!< deceleration final slope [s/step] |
| Davidroid | 0:92706998571a | 299 | uint8_t kterm; //!< thermal compensation factor (range [0, 15]) |
| Davidroid | 0:92706998571a | 300 | float ocdth; //!< ocd threshold [ma] (range [375 ma, 6000 ma]) |
| Davidroid | 0:92706998571a | 301 | float stallth; //!< stall threshold [ma] (range [31.25 ma, 4000 ma]) |
| Davidroid | 0:92706998571a | 302 | uint8_t step_sel; //!< step mode selection |
| Davidroid | 0:92706998571a | 303 | uint8_t alarmen; //!< alarm conditions enable |
| Davidroid | 0:92706998571a | 304 | uint16_t config; //!< ic configuration |
| Davidroid | 0:92706998571a | 305 | } MICROSTEPPING_MOTOR_InitTypeDef; |
| Davidroid | 0:92706998571a | 306 | |
| Davidroid | 0:92706998571a | 307 | /** |
| Davidroid | 0:92706998571a | 308 | * @brief Stepper Motor Registers |
| Davidroid | 0:92706998571a | 309 | */ |
| Davidroid | 0:92706998571a | 310 | typedef struct |
| Davidroid | 0:92706998571a | 311 | { |
| Davidroid | 0:92706998571a | 312 | uint32_t ABS_POS; //!< CurrentPosition Register |
| Davidroid | 0:92706998571a | 313 | uint16_t EL_POS; //!< ElectricalPosition Register |
| Davidroid | 0:92706998571a | 314 | uint32_t MARK; //!< MarkPosition Register |
| Davidroid | 0:92706998571a | 315 | uint32_t SPEED; //!< CurrentSpeed Register |
| Davidroid | 0:92706998571a | 316 | uint16_t ACC; //!< Acceleration Register |
| Davidroid | 0:92706998571a | 317 | uint16_t DEC; //!< Deceleration Register |
| Davidroid | 0:92706998571a | 318 | uint16_t MAX_SPEED; //!< MaximumSpeed Register |
| Davidroid | 0:92706998571a | 319 | uint16_t MIN_SPEED; //!< MinimumSpeed Register |
| Davidroid | 0:92706998571a | 320 | uint16_t FS_SPD; //!< FullStepSpeed Register |
| Davidroid | 0:92706998571a | 321 | uint8_t KVAL_HOLD; //!< HoldingKval Register |
| Davidroid | 0:92706998571a | 322 | uint8_t KVAL_RUN; //!< ConstantSpeedKval Register |
| Davidroid | 0:92706998571a | 323 | uint8_t KVAL_ACC; //!< AccelerationStartingKval Register |
| Davidroid | 0:92706998571a | 324 | uint8_t KVAL_DEC; //!< DecelerationStartingKval Register |
| Davidroid | 0:92706998571a | 325 | uint16_t INT_SPEED; //!< IntersectSpeed Register |
| Davidroid | 0:92706998571a | 326 | uint8_t ST_SLP; //!< StartSlope Register |
| Davidroid | 0:92706998571a | 327 | uint8_t FN_SLP_ACC; //!< AccelerationFinalSlope Register |
| Davidroid | 0:92706998571a | 328 | uint8_t FN_SLP_DEC; //!< DecelerationFinalSlope Register |
| Davidroid | 0:92706998571a | 329 | uint8_t K_THERM; //!< ThermalCompensationFactor Register |
| Davidroid | 0:92706998571a | 330 | uint8_t ADC_OUT; //!< AdcOutput Register |
| Davidroid | 0:92706998571a | 331 | uint8_t OCD_TH; //!< OcdThreshold Register |
| Davidroid | 0:92706998571a | 332 | uint8_t STALL_TH; //!< StallThreshold Register |
| Davidroid | 0:92706998571a | 333 | uint8_t STEP_MODE; //!< StepMode Register |
| Davidroid | 0:92706998571a | 334 | uint8_t ALARM_EN; //!< AlarmEnable Register |
| Davidroid | 0:92706998571a | 335 | uint16_t CONFIG; //!< Config Register |
| Davidroid | 0:92706998571a | 336 | uint16_t STATUS; //!< Status Register |
| Davidroid | 0:92706998571a | 337 | } StepperMotorRegister_t; |
| Davidroid | 0:92706998571a | 338 | |
| Davidroid | 0:92706998571a | 339 | /** |
| Davidroid | 0:92706998571a | 340 | * @brief Stepper Motor Driver Structure |
| Davidroid | 0:92706998571a | 341 | */ |
| Davidroid | 0:92706998571a | 342 | typedef struct |
| Davidroid | 0:92706998571a | 343 | { |
| Davidroid | 0:92706998571a | 344 | /* ACTION ----------------------------------------------------------------* |
| Davidroid | 0:92706998571a | 345 | * Declare here the component's generic functions. * |
| Davidroid | 0:92706998571a | 346 | * Tag this group of functions with the " Generic " C-style comment. * |
| Davidroid | 0:92706998571a | 347 | * A component's interface has to define at least the two generic * |
| Davidroid | 0:92706998571a | 348 | * functions provided here below within the "Example" section, as the * |
| Davidroid | 0:92706998571a | 349 | * first and second functions of its Virtual Table. They have to be * |
| Davidroid | 0:92706998571a | 350 | * specified exactly in the given way. * |
| Davidroid | 0:92706998571a | 351 | * * |
| Davidroid | 0:92706998571a | 352 | * Example: * |
| Davidroid | 0:92706998571a | 353 | * DrvStatusTypeDef (*Init)(void *handle, INTERFACE_InitTypeDef *init); * |
| Davidroid | 0:92706998571a | 354 | * DrvStatusTypeDef (*ReadID)(void *handle, uint8_t *id); * |
| Davidroid | 0:92706998571a | 355 | *------------------------------------------------------------------------*/ |
| Davidroid | 0:92706998571a | 356 | /* Generic */ |
| Davidroid | 0:92706998571a | 357 | DrvStatusTypeDef (*Init)(void *handle, MICROSTEPPING_MOTOR_InitTypeDef *init); |
| Davidroid | 0:92706998571a | 358 | DrvStatusTypeDef (*ReadID)(void *handle, uint8_t *id); |
| Davidroid | 0:92706998571a | 359 | |
| Davidroid | 0:92706998571a | 360 | /* ACTION ----------------------------------------------------------------* |
| Davidroid | 0:92706998571a | 361 | * Declare here the component's specific functions. * |
| Davidroid | 0:92706998571a | 362 | * Tag this group of functions with the " Specific " C-style comment. * |
| Davidroid | 0:92706998571a | 363 | * Do not specify any function if not required. * |
| Davidroid | 0:92706998571a | 364 | * * |
| Davidroid | 0:92706998571a | 365 | * Example: * |
| Davidroid | 0:92706998571a | 366 | * DrvStatusTypeDef (*GetValue)(void *handle, float *pfData); * |
| Davidroid | 0:92706998571a | 367 | *------------------------------------------------------------------------*/ |
| Davidroid | 0:92706998571a | 368 | /* Specific */ |
| Davidroid | 0:92706998571a | 369 | void (*SetParam)(void *handle, eL6470_RegId_t L6470_RegId, uint32_t Value); |
| Davidroid | 0:92706998571a | 370 | uint32_t (*GetParam)(void *handle, eL6470_RegId_t L6470_RegId); |
| Davidroid | 0:92706998571a | 371 | void (*Run)(void *handle, eL6470_DirId_t L6470_DirId, uint32_t Speed); |
| Davidroid | 0:92706998571a | 372 | void (*StepClock)(void *handle, eL6470_DirId_t L6470_DirId); |
| Davidroid | 0:92706998571a | 373 | void (*Move)(void *handle, eL6470_DirId_t L6470_DirId, uint32_t N_Step); |
| Davidroid | 0:92706998571a | 374 | void (*GoTo)(void *handle, uint32_t AbsPos); |
| Davidroid | 0:92706998571a | 375 | void (*GoToDir)(void *handle, eL6470_DirId_t L6470_DirId, uint32_t AbsPos); |
| Davidroid | 0:92706998571a | 376 | void (*GoUntil)(void *handle, eL6470_ActId_t L6470_ActId, eL6470_DirId_t L6470_DirId, uint32_t Speed); |
| Davidroid | 0:92706998571a | 377 | void (*ReleaseSW)(void *handle, eL6470_ActId_t L6470_ActId, eL6470_DirId_t L6470_DirId); |
| Davidroid | 0:92706998571a | 378 | void (*GoHome)(void *handle); |
| Davidroid | 0:92706998571a | 379 | void (*GoMark)(void *handle); |
| Davidroid | 0:92706998571a | 380 | void (*ResetPos)(void *handle); |
| Davidroid | 0:92706998571a | 381 | void (*ResetDevice)(void *handle); |
| Davidroid | 0:92706998571a | 382 | void (*SoftStop)(void *handle); |
| Davidroid | 0:92706998571a | 383 | void (*HardStop)(void *handle); |
| Davidroid | 0:92706998571a | 384 | void (*SoftHiZ)(void *handle); |
| Davidroid | 0:92706998571a | 385 | void (*HardHiZ)(void *handle); |
| Davidroid | 0:92706998571a | 386 | uint16_t (*GetStatus)(void *handle); |
| Davidroid | 0:92706998571a | 387 | void (*PrepareSetParam)(void *handle, eL6470_RegId_t L6470_RegId, uint32_t Value); |
| Davidroid | 0:92706998571a | 388 | void (*PrepareGetParam)(void *handle, eL6470_RegId_t L6470_RegId); |
| Davidroid | 0:92706998571a | 389 | void (*PrepareRun)(void *handle, eL6470_DirId_t L6470_DirId, uint32_t Speed); |
| Davidroid | 0:92706998571a | 390 | void (*PrepareStepClock)(void *handle, eL6470_DirId_t L6470_DirId); |
| Davidroid | 0:92706998571a | 391 | void (*PrepareMove)(void *handle, eL6470_DirId_t L6470_DirId, uint32_t N_Step); |
| Davidroid | 0:92706998571a | 392 | void (*PrepareGoTo)(void *handle, uint32_t AbsPos); |
| Davidroid | 0:92706998571a | 393 | void (*PrepareGoToDir)(void *handle, eL6470_DirId_t L6470_DirId, uint32_t AbsPos); |
| Davidroid | 0:92706998571a | 394 | void (*PrepareGoUntil)(void *handle, eL6470_ActId_t L6470_ActId, eL6470_DirId_t L6470_DirId, uint32_t Speed); |
| Davidroid | 0:92706998571a | 395 | void (*PrepareReleaseSW)(void *handle, eL6470_ActId_t L6470_ActId, eL6470_DirId_t L6470_DirId); |
| Davidroid | 0:92706998571a | 396 | void (*PrepareGoHome)(void *handle); |
| Davidroid | 0:92706998571a | 397 | void (*PrepareGoMark)(void *handle); |
| Davidroid | 0:92706998571a | 398 | void (*PrepareResetPos)(void *handle); |
| Davidroid | 0:92706998571a | 399 | void (*PrepareResetDevice)(void *handle); |
| Davidroid | 0:92706998571a | 400 | void (*PrepareSoftStop)(void *handle); |
| Davidroid | 0:92706998571a | 401 | void (*PrepareHardStop)(void *handle); |
| Davidroid | 0:92706998571a | 402 | void (*PrepareSoftHiZ)(void *handle); |
| Davidroid | 0:92706998571a | 403 | void (*PrepareHardHiZ)(void *handle); |
| Davidroid | 0:92706998571a | 404 | void (*PrepareGetStatus)(void *handle); |
| Davidroid | 0:92706998571a | 405 | uint8_t (*CheckStatusRegisterFlag)(void *handle, uint8_t L6470_StatusRegisterFlagId); |
| Davidroid | 0:92706998571a | 406 | uint8_t* (*PerformPreparedApplicationCommand)(void *handle); |
| Davidroid | 0:92706998571a | 407 | uint8_t* (*GetRegisterName)(void *handle, uint8_t id); |
| Davidroid | 0:92706998571a | 408 | int32_t (*AbsPos_2_Position)(void *handle, uint32_t AbsPos); |
| Davidroid | 0:92706998571a | 409 | uint32_t (*Position_2_AbsPos)(void *handle, int32_t Position); |
| Davidroid | 0:92706998571a | 410 | float (*Speed_2_Step_s)(void *handle, uint32_t Speed); |
| Davidroid | 0:92706998571a | 411 | uint32_t (*Step_s_2_Speed)(void *handle, float Step_s); |
| Davidroid | 0:92706998571a | 412 | float (*Acc_2_Step_s2)(void *handle, uint16_t Acc); |
| Davidroid | 0:92706998571a | 413 | uint16_t (*Step_s2_2_Acc)(void *handle, float Step_s2); |
| Davidroid | 0:92706998571a | 414 | float (*Dec_2_Step_s2)(void *handle, uint16_t Dec); |
| Davidroid | 0:92706998571a | 415 | uint16_t (*Step_s2_2_Dec)(void *handle, float Step_s2); |
| Davidroid | 0:92706998571a | 416 | float (*MaxSpeed_2_Step_s)(void *handle, uint16_t MaxSpeed); |
| Davidroid | 0:92706998571a | 417 | uint16_t (*Step_s_2_MaxSpeed)(void *handle, float Step_s); |
| Davidroid | 0:92706998571a | 418 | float (*MinSpeed_2_Step_s)(void *handle, uint16_t MinSpeed); |
| Davidroid | 0:92706998571a | 419 | uint16_t (*Step_s_2_MinSpeed)(void *handle, float Step_s); |
| Davidroid | 0:92706998571a | 420 | float (*FsSpd_2_Step_s)(void *handle, uint16_t FsSpd); |
| Davidroid | 0:92706998571a | 421 | uint16_t (*Step_s_2_FsSpd)(void *handle, float Step_s); |
| Davidroid | 0:92706998571a | 422 | float (*IntSpeed_2_Step_s)(void *handle, uint16_t IntSpeed); |
| Davidroid | 0:92706998571a | 423 | uint16_t (*Step_s_2_IntSpeed)(void *handle, float Step_s); |
| Davidroid | 0:92706998571a | 424 | float (*StSlp_2_s_Step)(void *handle, uint8_t StSlp); |
| Davidroid | 0:92706998571a | 425 | uint8_t (*s_Step_2_StSlp)(void *handle, float s_Step); |
| Davidroid | 0:92706998571a | 426 | float (*FnSlpAcc_2_s_Step)(void *handle, uint8_t FnSlpAcc); |
| Davidroid | 0:92706998571a | 427 | uint8_t (*s_Step_2_FnSlpAcc)(void *handle, float s_Step); |
| Davidroid | 0:92706998571a | 428 | float (*FnSlpDec_2_s_Step)(void *handle, uint8_t FnSlpDec); |
| Davidroid | 0:92706998571a | 429 | uint8_t (*s_Step_2_FnSlpDec)(void *handle, float s_Step); |
| Davidroid | 0:92706998571a | 430 | float (*OcdTh_2_mA)(void *handle, uint8_t OcdTh); |
| Davidroid | 0:92706998571a | 431 | uint8_t (*mA_2_OcdTh)(void *handle, float mA); |
| Davidroid | 0:92706998571a | 432 | float (*StallTh_2_mA)(void *handle, uint8_t StallTh); |
| Davidroid | 0:92706998571a | 433 | uint8_t (*mA_2_StallTh)(void *handle, float mA); |
| Davidroid | 0:92706998571a | 434 | } MICROSTEPPING_MOTOR_DrvVTableTypeDef; |
| Davidroid | 0:92706998571a | 435 | |
| Davidroid | 0:92706998571a | 436 | /** |
| Davidroid | 0:92706998571a | 437 | * @brief Stepper Motor Board Driver Structure |
| Davidroid | 0:92706998571a | 438 | */ |
| Davidroid | 0:92706998571a | 439 | typedef struct |
| Davidroid | 0:92706998571a | 440 | { |
| Davidroid | 0:92706998571a | 441 | void (*SetParam)(uint8_t, uint8_t, eL6470_RegId_t, uint32_t); |
| Davidroid | 0:92706998571a | 442 | uint32_t (*GetParam)(uint8_t, uint8_t, eL6470_RegId_t); |
| Davidroid | 0:92706998571a | 443 | void (*Run)(uint8_t, uint8_t, eL6470_DirId_t, uint32_t); |
| Davidroid | 0:92706998571a | 444 | void (*StepClock)(uint8_t, uint8_t, eL6470_DirId_t); |
| Davidroid | 0:92706998571a | 445 | void (*Move)(uint8_t, uint8_t, eL6470_DirId_t, uint32_t); |
| Davidroid | 0:92706998571a | 446 | void (*GoTo)(uint8_t, uint8_t L6470_Id, uint32_t AbsPos); |
| Davidroid | 0:92706998571a | 447 | void (*GoToDir)(uint8_t, uint8_t, eL6470_DirId_t, uint32_t); |
| Davidroid | 0:92706998571a | 448 | void (*GoUntil)(uint8_t, uint8_t, eL6470_ActId_t, eL6470_DirId_t, uint32_t); |
| Davidroid | 0:92706998571a | 449 | void (*ReleaseSW)(uint8_t, uint8_t, eL6470_ActId_t, eL6470_DirId_t); |
| Davidroid | 0:92706998571a | 450 | void (*GoHome)(uint8_t, uint8_t); |
| Davidroid | 0:92706998571a | 451 | void (*GoMark)(uint8_t, uint8_t); |
| Davidroid | 0:92706998571a | 452 | void (*ResetPos)(uint8_t, uint8_t); |
| Davidroid | 0:92706998571a | 453 | void (*ResetDevice)(uint8_t, uint8_t); |
| Davidroid | 0:92706998571a | 454 | void (*SoftStop)(uint8_t, uint8_t); |
| Davidroid | 0:92706998571a | 455 | void (*HardStop)(uint8_t, uint8_t); |
| Davidroid | 0:92706998571a | 456 | void (*SoftHiZ)(uint8_t, uint8_t); |
| Davidroid | 0:92706998571a | 457 | void (*HardHiZ)(uint8_t, uint8_t); |
| Davidroid | 0:92706998571a | 458 | uint16_t (*GetStatus)(uint8_t, uint8_t); |
| Davidroid | 0:92706998571a | 459 | uint8_t (*CheckStatusRegisterFlag)(uint8_t, uint8_t, uint8_t); |
| Davidroid | 0:92706998571a | 460 | uint8_t* (*PerformPreparedApplicationCommand)(uint8_t); |
| Davidroid | 0:92706998571a | 461 | } MICROSTEPPING_MOTOR_EB_DrvVTableTypeDef; |
| Davidroid | 0:92706998571a | 462 | |
| Davidroid | 0:92706998571a | 463 | /** |
| Davidroid | 0:92706998571a | 464 | * @brief Stepper Motor Handle Structure |
| Davidroid | 0:92706998571a | 465 | */ |
| Davidroid | 0:92706998571a | 466 | typedef struct __StepperMotorDriver_HandleTypeDef |
| Davidroid | 0:92706998571a | 467 | { |
| Davidroid | 0:92706998571a | 468 | uint8_t DaisyChainPosition; |
| Davidroid | 0:92706998571a | 469 | void (*Config)(MICROSTEPPING_MOTOR_InitTypeDef*); |
| Davidroid | 0:92706998571a | 470 | MICROSTEPPING_MOTOR_DrvVTableTypeDef *Command; |
| Davidroid | 0:92706998571a | 471 | } StepperMotorDriverHandle_t; |
| Davidroid | 0:92706998571a | 472 | |
| Davidroid | 0:92706998571a | 473 | /** |
| Davidroid | 0:92706998571a | 474 | * @brief Stepper Motor Handle Structure |
| Davidroid | 0:92706998571a | 475 | */ |
| Davidroid | 0:92706998571a | 476 | typedef struct __StepperMotorBoard_HandleTypeDef |
| Davidroid | 0:92706998571a | 477 | { |
| Davidroid | 0:92706998571a | 478 | uint8_t StackedPosition; |
| Davidroid | 0:92706998571a | 479 | void (*Config)(MICROSTEPPING_MOTOR_InitTypeDef*); |
| Davidroid | 0:92706998571a | 480 | MICROSTEPPING_MOTOR_EB_DrvVTableTypeDef *Command; |
| Davidroid | 0:92706998571a | 481 | StepperMotorDriverHandle_t *StepperMotorDriverHandle[2]; |
| Davidroid | 0:92706998571a | 482 | uint8_t (*Select)(uint8_t); |
| Davidroid | 0:92706998571a | 483 | } StepperMotorBoardHandle_t; |
| Davidroid | 0:92706998571a | 484 | |
| Davidroid | 0:92706998571a | 485 | /** |
| Davidroid | 0:92706998571a | 486 | * @} |
| Davidroid | 0:92706998571a | 487 | */ /* StepperMotorExportedTypes */ |
| Davidroid | 0:92706998571a | 488 | |
| Davidroid | 0:92706998571a | 489 | /** |
| Davidroid | 0:92706998571a | 490 | * @} |
| Davidroid | 0:92706998571a | 491 | */ /* MicrosteppingMotorDriver */ |
| Davidroid | 0:92706998571a | 492 | |
| Davidroid | 0:92706998571a | 493 | /** |
| Davidroid | 0:92706998571a | 494 | * @} |
| Davidroid | 0:92706998571a | 495 | */ /* Components */ |
| Davidroid | 0:92706998571a | 496 | |
| Davidroid | 0:92706998571a | 497 | /** |
| Davidroid | 0:92706998571a | 498 | * @} |
| Davidroid | 0:92706998571a | 499 | */ /* BSP */ |
| Davidroid | 0:92706998571a | 500 | |
| Davidroid | 0:92706998571a | 501 | #ifdef __cplusplus |
| Davidroid | 0:92706998571a | 502 | } |
| Davidroid | 0:92706998571a | 503 | #endif |
| Davidroid | 0:92706998571a | 504 | |
| Davidroid | 0:92706998571a | 505 | #endif /* __MICROSTEPPINGMOTOR_H */ |
| Davidroid | 0:92706998571a | 506 | |
| Davidroid | 0:92706998571a | 507 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
