Added ST_INTERFACES library.
Dependencies: ST_INTERFACES X_NUCLEO_COMMON
Fork of X_NUCLEO_IHM03A1 by
Components/Common/motor.h@0:00a3c3f5a8f0, 2016-04-05 (annotated)
- Committer:
- nucleosam
- Date:
- Tue Apr 05 15:18:56 2016 +0000
- Revision:
- 0:00a3c3f5a8f0
- Child:
- 1:8ce2a5d6fbf8
Initial version
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
nucleosam | 0:00a3c3f5a8f0 | 1 | /** |
nucleosam | 0:00a3c3f5a8f0 | 2 | ****************************************************************************** |
nucleosam | 0:00a3c3f5a8f0 | 3 | * @file motor.h |
nucleosam | 0:00a3c3f5a8f0 | 4 | * @author IPC Rennes |
nucleosam | 0:00a3c3f5a8f0 | 5 | * @version V1.5.0 |
nucleosam | 0:00a3c3f5a8f0 | 6 | * @date January 25, 2016 |
nucleosam | 0:00a3c3f5a8f0 | 7 | * @brief This file contains all the functions prototypes for motor drivers. |
nucleosam | 0:00a3c3f5a8f0 | 8 | ****************************************************************************** |
nucleosam | 0:00a3c3f5a8f0 | 9 | * @attention |
nucleosam | 0:00a3c3f5a8f0 | 10 | * |
nucleosam | 0:00a3c3f5a8f0 | 11 | * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> |
nucleosam | 0:00a3c3f5a8f0 | 12 | * |
nucleosam | 0:00a3c3f5a8f0 | 13 | * Redistribution and use in source and binary forms, with or without modification, |
nucleosam | 0:00a3c3f5a8f0 | 14 | * are permitted provided that the following conditions are met: |
nucleosam | 0:00a3c3f5a8f0 | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
nucleosam | 0:00a3c3f5a8f0 | 16 | * this list of conditions and the following disclaimer. |
nucleosam | 0:00a3c3f5a8f0 | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
nucleosam | 0:00a3c3f5a8f0 | 18 | * this list of conditions and the following disclaimer in the documentation |
nucleosam | 0:00a3c3f5a8f0 | 19 | * and/or other materials provided with the distribution. |
nucleosam | 0:00a3c3f5a8f0 | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
nucleosam | 0:00a3c3f5a8f0 | 21 | * may be used to endorse or promote products derived from this software |
nucleosam | 0:00a3c3f5a8f0 | 22 | * without specific prior written permission. |
nucleosam | 0:00a3c3f5a8f0 | 23 | * |
nucleosam | 0:00a3c3f5a8f0 | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
nucleosam | 0:00a3c3f5a8f0 | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
nucleosam | 0:00a3c3f5a8f0 | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
nucleosam | 0:00a3c3f5a8f0 | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
nucleosam | 0:00a3c3f5a8f0 | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
nucleosam | 0:00a3c3f5a8f0 | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
nucleosam | 0:00a3c3f5a8f0 | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
nucleosam | 0:00a3c3f5a8f0 | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
nucleosam | 0:00a3c3f5a8f0 | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
nucleosam | 0:00a3c3f5a8f0 | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
nucleosam | 0:00a3c3f5a8f0 | 34 | * |
nucleosam | 0:00a3c3f5a8f0 | 35 | ****************************************************************************** |
nucleosam | 0:00a3c3f5a8f0 | 36 | */ |
nucleosam | 0:00a3c3f5a8f0 | 37 | |
nucleosam | 0:00a3c3f5a8f0 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
nucleosam | 0:00a3c3f5a8f0 | 39 | #ifndef __MOTOR_H |
nucleosam | 0:00a3c3f5a8f0 | 40 | #define __MOTOR_H |
nucleosam | 0:00a3c3f5a8f0 | 41 | |
nucleosam | 0:00a3c3f5a8f0 | 42 | #ifdef __cplusplus |
nucleosam | 0:00a3c3f5a8f0 | 43 | extern "C" { |
nucleosam | 0:00a3c3f5a8f0 | 44 | #endif |
nucleosam | 0:00a3c3f5a8f0 | 45 | |
nucleosam | 0:00a3c3f5a8f0 | 46 | /* Includes ------------------------------------------------------------------*/ |
nucleosam | 0:00a3c3f5a8f0 | 47 | #include <stdint.h> |
nucleosam | 0:00a3c3f5a8f0 | 48 | #include "component.h" |
nucleosam | 0:00a3c3f5a8f0 | 49 | |
nucleosam | 0:00a3c3f5a8f0 | 50 | /* Definitions ---------------------------------------------------------------*/ |
nucleosam | 0:00a3c3f5a8f0 | 51 | /// boolean for false condition |
nucleosam | 0:00a3c3f5a8f0 | 52 | #ifndef FALSE |
nucleosam | 0:00a3c3f5a8f0 | 53 | #define FALSE (0) |
nucleosam | 0:00a3c3f5a8f0 | 54 | #endif |
nucleosam | 0:00a3c3f5a8f0 | 55 | /// boolean for true condition |
nucleosam | 0:00a3c3f5a8f0 | 56 | #ifndef TRUE |
nucleosam | 0:00a3c3f5a8f0 | 57 | #define TRUE (1) |
nucleosam | 0:00a3c3f5a8f0 | 58 | #endif |
nucleosam | 0:00a3c3f5a8f0 | 59 | |
nucleosam | 0:00a3c3f5a8f0 | 60 | /* Types ---------------------------------------------------------------------*/ |
nucleosam | 0:00a3c3f5a8f0 | 61 | /** @addtogroup BSP |
nucleosam | 0:00a3c3f5a8f0 | 62 | * @{ |
nucleosam | 0:00a3c3f5a8f0 | 63 | */ |
nucleosam | 0:00a3c3f5a8f0 | 64 | |
nucleosam | 0:00a3c3f5a8f0 | 65 | /** @addtogroup Components |
nucleosam | 0:00a3c3f5a8f0 | 66 | * @{ |
nucleosam | 0:00a3c3f5a8f0 | 67 | */ |
nucleosam | 0:00a3c3f5a8f0 | 68 | |
nucleosam | 0:00a3c3f5a8f0 | 69 | /** @defgroup Motor Motor |
nucleosam | 0:00a3c3f5a8f0 | 70 | * @{ |
nucleosam | 0:00a3c3f5a8f0 | 71 | */ |
nucleosam | 0:00a3c3f5a8f0 | 72 | |
nucleosam | 0:00a3c3f5a8f0 | 73 | /** @defgroup Motor_Exported_Types Motor Exported Types |
nucleosam | 0:00a3c3f5a8f0 | 74 | * @{ |
nucleosam | 0:00a3c3f5a8f0 | 75 | */ |
nucleosam | 0:00a3c3f5a8f0 | 76 | |
nucleosam | 0:00a3c3f5a8f0 | 77 | /** @defgroup Device_Direction_Options Device Direction Options |
nucleosam | 0:00a3c3f5a8f0 | 78 | * @{ |
nucleosam | 0:00a3c3f5a8f0 | 79 | */ |
nucleosam | 0:00a3c3f5a8f0 | 80 | /// Direction options |
nucleosam | 0:00a3c3f5a8f0 | 81 | typedef enum { |
nucleosam | 0:00a3c3f5a8f0 | 82 | BACKWARD = 0, |
nucleosam | 0:00a3c3f5a8f0 | 83 | FORWARD = 1, |
nucleosam | 0:00a3c3f5a8f0 | 84 | UNKNOW_DIR = ((uint8_t)0xFF) |
nucleosam | 0:00a3c3f5a8f0 | 85 | } motorDir_t; |
nucleosam | 0:00a3c3f5a8f0 | 86 | /** |
nucleosam | 0:00a3c3f5a8f0 | 87 | * @} |
nucleosam | 0:00a3c3f5a8f0 | 88 | */ |
nucleosam | 0:00a3c3f5a8f0 | 89 | |
nucleosam | 0:00a3c3f5a8f0 | 90 | /** @defgroup Device_Action_Options Device Action Options |
nucleosam | 0:00a3c3f5a8f0 | 91 | * @{ |
nucleosam | 0:00a3c3f5a8f0 | 92 | */ |
nucleosam | 0:00a3c3f5a8f0 | 93 | /// Action options |
nucleosam | 0:00a3c3f5a8f0 | 94 | typedef enum { |
nucleosam | 0:00a3c3f5a8f0 | 95 | ACTION_RESET = ((uint8_t)0x00), |
nucleosam | 0:00a3c3f5a8f0 | 96 | ACTION_COPY = ((uint8_t)0x08) |
nucleosam | 0:00a3c3f5a8f0 | 97 | } motorAction_t; |
nucleosam | 0:00a3c3f5a8f0 | 98 | /** |
nucleosam | 0:00a3c3f5a8f0 | 99 | * @} |
nucleosam | 0:00a3c3f5a8f0 | 100 | */ |
nucleosam | 0:00a3c3f5a8f0 | 101 | |
nucleosam | 0:00a3c3f5a8f0 | 102 | /** @defgroup Device_States Device States |
nucleosam | 0:00a3c3f5a8f0 | 103 | * @{ |
nucleosam | 0:00a3c3f5a8f0 | 104 | */ |
nucleosam | 0:00a3c3f5a8f0 | 105 | /// Device states |
nucleosam | 0:00a3c3f5a8f0 | 106 | typedef enum { |
nucleosam | 0:00a3c3f5a8f0 | 107 | ACCELERATING = 0, |
nucleosam | 0:00a3c3f5a8f0 | 108 | DECELERATINGTOSTOP = 1, |
nucleosam | 0:00a3c3f5a8f0 | 109 | DECELERATING = 2, |
nucleosam | 0:00a3c3f5a8f0 | 110 | STEADY = 3, |
nucleosam | 0:00a3c3f5a8f0 | 111 | INDEX_ACCEL = 4, |
nucleosam | 0:00a3c3f5a8f0 | 112 | INDEX_RUN = 5, |
nucleosam | 0:00a3c3f5a8f0 | 113 | INDEX_DECEL = 6, |
nucleosam | 0:00a3c3f5a8f0 | 114 | INDEX_DWELL = 7, |
nucleosam | 0:00a3c3f5a8f0 | 115 | INACTIVE = 8, |
nucleosam | 0:00a3c3f5a8f0 | 116 | STANDBY = 9, |
nucleosam | 0:00a3c3f5a8f0 | 117 | STANDBYTOINACTIVE = 10 |
nucleosam | 0:00a3c3f5a8f0 | 118 | } motorState_t; |
nucleosam | 0:00a3c3f5a8f0 | 119 | /** |
nucleosam | 0:00a3c3f5a8f0 | 120 | * @} |
nucleosam | 0:00a3c3f5a8f0 | 121 | */ |
nucleosam | 0:00a3c3f5a8f0 | 122 | |
nucleosam | 0:00a3c3f5a8f0 | 123 | /** @defgroup Device_Step_mode Device Step mode |
nucleosam | 0:00a3c3f5a8f0 | 124 | * @{ |
nucleosam | 0:00a3c3f5a8f0 | 125 | */ |
nucleosam | 0:00a3c3f5a8f0 | 126 | /// Stepping options |
nucleosam | 0:00a3c3f5a8f0 | 127 | typedef enum { |
nucleosam | 0:00a3c3f5a8f0 | 128 | STEP_MODE_FULL = ((uint8_t)0x00), |
nucleosam | 0:00a3c3f5a8f0 | 129 | STEP_MODE_HALF = ((uint8_t)0x01), |
nucleosam | 0:00a3c3f5a8f0 | 130 | STEP_MODE_1_4 = ((uint8_t)0x02), |
nucleosam | 0:00a3c3f5a8f0 | 131 | STEP_MODE_1_8 = ((uint8_t)0x03), |
nucleosam | 0:00a3c3f5a8f0 | 132 | STEP_MODE_1_16 = ((uint8_t)0x04), |
nucleosam | 0:00a3c3f5a8f0 | 133 | STEP_MODE_1_32 = ((uint8_t)0x05), |
nucleosam | 0:00a3c3f5a8f0 | 134 | STEP_MODE_1_64 = ((uint8_t)0x06), |
nucleosam | 0:00a3c3f5a8f0 | 135 | STEP_MODE_1_128 = ((uint8_t)0x07), |
nucleosam | 0:00a3c3f5a8f0 | 136 | STEP_MODE_1_256 = ((uint8_t)0x08), |
nucleosam | 0:00a3c3f5a8f0 | 137 | STEP_MODE_UNKNOW = ((uint8_t)0xFE), |
nucleosam | 0:00a3c3f5a8f0 | 138 | STEP_MODE_WAVE = ((uint8_t)0xFF) |
nucleosam | 0:00a3c3f5a8f0 | 139 | } motorStepMode_t; |
nucleosam | 0:00a3c3f5a8f0 | 140 | |
nucleosam | 0:00a3c3f5a8f0 | 141 | /** |
nucleosam | 0:00a3c3f5a8f0 | 142 | * @} |
nucleosam | 0:00a3c3f5a8f0 | 143 | */ |
nucleosam | 0:00a3c3f5a8f0 | 144 | |
nucleosam | 0:00a3c3f5a8f0 | 145 | /** @defgroup Decay_mode Decay mode |
nucleosam | 0:00a3c3f5a8f0 | 146 | * @{ |
nucleosam | 0:00a3c3f5a8f0 | 147 | */ |
nucleosam | 0:00a3c3f5a8f0 | 148 | /// Decay Mode |
nucleosam | 0:00a3c3f5a8f0 | 149 | typedef enum { |
nucleosam | 0:00a3c3f5a8f0 | 150 | SLOW_DECAY = 0, |
nucleosam | 0:00a3c3f5a8f0 | 151 | FAST_DECAY = 1, |
nucleosam | 0:00a3c3f5a8f0 | 152 | UNKNOW_DECAY = ((uint8_t)0xFF) |
nucleosam | 0:00a3c3f5a8f0 | 153 | } motorDecayMode_t; |
nucleosam | 0:00a3c3f5a8f0 | 154 | /** |
nucleosam | 0:00a3c3f5a8f0 | 155 | * @} |
nucleosam | 0:00a3c3f5a8f0 | 156 | */ |
nucleosam | 0:00a3c3f5a8f0 | 157 | |
nucleosam | 0:00a3c3f5a8f0 | 158 | /** @defgroup Stop_mode Stop mode |
nucleosam | 0:00a3c3f5a8f0 | 159 | * @{ |
nucleosam | 0:00a3c3f5a8f0 | 160 | */ |
nucleosam | 0:00a3c3f5a8f0 | 161 | /// Stop mode |
nucleosam | 0:00a3c3f5a8f0 | 162 | typedef enum |
nucleosam | 0:00a3c3f5a8f0 | 163 | { |
nucleosam | 0:00a3c3f5a8f0 | 164 | HOLD_MODE = 0, |
nucleosam | 0:00a3c3f5a8f0 | 165 | HIZ_MODE = 1, |
nucleosam | 0:00a3c3f5a8f0 | 166 | STANDBY_MODE = 2, |
nucleosam | 0:00a3c3f5a8f0 | 167 | UNKNOW_STOP_MODE = ((uint8_t)0xFF) |
nucleosam | 0:00a3c3f5a8f0 | 168 | } motorStopMode_t; |
nucleosam | 0:00a3c3f5a8f0 | 169 | /** |
nucleosam | 0:00a3c3f5a8f0 | 170 | * @} |
nucleosam | 0:00a3c3f5a8f0 | 171 | */ |
nucleosam | 0:00a3c3f5a8f0 | 172 | |
nucleosam | 0:00a3c3f5a8f0 | 173 | /** @defgroup Torque_mode Torque mode |
nucleosam | 0:00a3c3f5a8f0 | 174 | * @{ |
nucleosam | 0:00a3c3f5a8f0 | 175 | */ |
nucleosam | 0:00a3c3f5a8f0 | 176 | /// Torque mode |
nucleosam | 0:00a3c3f5a8f0 | 177 | typedef enum |
nucleosam | 0:00a3c3f5a8f0 | 178 | { |
nucleosam | 0:00a3c3f5a8f0 | 179 | ACC_TORQUE = 0, |
nucleosam | 0:00a3c3f5a8f0 | 180 | DEC_TORQUE = 1, |
nucleosam | 0:00a3c3f5a8f0 | 181 | RUN_TORQUE = 2, |
nucleosam | 0:00a3c3f5a8f0 | 182 | HOLD_TORQUE = 3, |
nucleosam | 0:00a3c3f5a8f0 | 183 | CURRENT_TORQUE = 4, |
nucleosam | 0:00a3c3f5a8f0 | 184 | UNKNOW_TORQUE = ((uint8_t)0xFF) |
nucleosam | 0:00a3c3f5a8f0 | 185 | } motorTorqueMode_t; |
nucleosam | 0:00a3c3f5a8f0 | 186 | /** |
nucleosam | 0:00a3c3f5a8f0 | 187 | * @} |
nucleosam | 0:00a3c3f5a8f0 | 188 | */ |
nucleosam | 0:00a3c3f5a8f0 | 189 | |
nucleosam | 0:00a3c3f5a8f0 | 190 | /** @defgroup Dual_Full_Bridge_Configuration Dual Full Bridge Configuration |
nucleosam | 0:00a3c3f5a8f0 | 191 | * @{ |
nucleosam | 0:00a3c3f5a8f0 | 192 | */ |
nucleosam | 0:00a3c3f5a8f0 | 193 | ///Dual full bridge configurations for brush DC motors |
nucleosam | 0:00a3c3f5a8f0 | 194 | typedef enum { |
nucleosam | 0:00a3c3f5a8f0 | 195 | PARALLELING_NONE___1_BIDIR_MOTOR_BRIDGE_A__1_BIDIR_MOTOR_BRIDGE_B = 0, |
nucleosam | 0:00a3c3f5a8f0 | 196 | PARALLELING_NONE___1_BIDIR_MOTOR_BRIDGE_A__2_UNDIR_MOTOR_BRIDGE_B = 1, |
nucleosam | 0:00a3c3f5a8f0 | 197 | PARALLELING_NONE___2_UNDIR_MOTOR_BRIDGE_A__1_BIDIR_MOTOR_BRIDGE_B = 2, |
nucleosam | 0:00a3c3f5a8f0 | 198 | PARALLELING_NONE___2_UNDIR_MOTOR_BRIDGE_A__2_UNDIR_MOTOR_BRIDGE_B = 3, |
nucleosam | 0:00a3c3f5a8f0 | 199 | PARALLELING_IN1A_IN2A__1_UNDIR_MOTOR_BRIDGE_A__1_BIDIR_MOTOR_BRIDGE_B = 4, |
nucleosam | 0:00a3c3f5a8f0 | 200 | PARALLELING_IN1A_IN2A__1_UNDIR_MOTOR_BRIDGE_A__2_UNDIR_MOTOR_BRIDGE_B = 5, |
nucleosam | 0:00a3c3f5a8f0 | 201 | PARALLELING_IN1B_IN2B__1_BIDIR_MOTOR_BRIDGE_A__1_UNDIR_MOTOR_BRIDGE_B = 6, |
nucleosam | 0:00a3c3f5a8f0 | 202 | PARALLELING_IN1B_IN2B__2_UNDIR_MOTOR_BRIDGE_A__1_UNDIR_MOTOR_BRIDGE_B = 7, |
nucleosam | 0:00a3c3f5a8f0 | 203 | PARALLELING_IN1A_IN2A__IN1B_IN2B__1_UNDIR_MOTOR_BRIDGE_A__1_UNDIR_MOTOR_BRIDGE_B = 8, |
nucleosam | 0:00a3c3f5a8f0 | 204 | PARALLELING_IN1A_IN2A__IN1B_IN2B__1_BIDIR_MOTOR = 9, |
nucleosam | 0:00a3c3f5a8f0 | 205 | PARALLELING_IN1A_IN1B__IN2A_IN2B__1_UNDIR_MOTOR_BRIDGE_1A__1_UNDIR_MOTOR_BRIDGE_2A = 10, |
nucleosam | 0:00a3c3f5a8f0 | 206 | PARALLELING_IN1A_IN1B__IN2A_IN2B__1_BIDIR_MOTOR = 11, |
nucleosam | 0:00a3c3f5a8f0 | 207 | PARALLELING_ALL_WITH_IN1A___1_UNDIR_MOTOR = 12, |
nucleosam | 0:00a3c3f5a8f0 | 208 | PARALLELING_END_ENUM = 13 |
nucleosam | 0:00a3c3f5a8f0 | 209 | } dualFullBridgeConfig_t; |
nucleosam | 0:00a3c3f5a8f0 | 210 | /** |
nucleosam | 0:00a3c3f5a8f0 | 211 | * @} |
nucleosam | 0:00a3c3f5a8f0 | 212 | */ |
nucleosam | 0:00a3c3f5a8f0 | 213 | |
nucleosam | 0:00a3c3f5a8f0 | 214 | /** @defgroup Motor_Driver_Structure Motor Driver Structure |
nucleosam | 0:00a3c3f5a8f0 | 215 | * @{ |
nucleosam | 0:00a3c3f5a8f0 | 216 | */ |
nucleosam | 0:00a3c3f5a8f0 | 217 | /** |
nucleosam | 0:00a3c3f5a8f0 | 218 | * @brief MOTOR driver virtual table structure definition. |
nucleosam | 0:00a3c3f5a8f0 | 219 | */ |
nucleosam | 0:00a3c3f5a8f0 | 220 | typedef struct |
nucleosam | 0:00a3c3f5a8f0 | 221 | { |
nucleosam | 0:00a3c3f5a8f0 | 222 | /* ACTION ----------------------------------------------------------------* |
nucleosam | 0:00a3c3f5a8f0 | 223 | * Declare here the component's generic functions. * |
nucleosam | 0:00a3c3f5a8f0 | 224 | * Tag this group of functions with the " Generic " C-style comment. * |
nucleosam | 0:00a3c3f5a8f0 | 225 | * A component's interface has to define at least the two generic * |
nucleosam | 0:00a3c3f5a8f0 | 226 | * functions provided here below within the "Example" section, as the * |
nucleosam | 0:00a3c3f5a8f0 | 227 | * first and second functions of its Virtual Table. They have to be * |
nucleosam | 0:00a3c3f5a8f0 | 228 | * specified exactly in the given way. * |
nucleosam | 0:00a3c3f5a8f0 | 229 | * * |
nucleosam | 0:00a3c3f5a8f0 | 230 | * Example: * |
nucleosam | 0:00a3c3f5a8f0 | 231 | * Status_t (*Init) (void *handle, void *init); * |
nucleosam | 0:00a3c3f5a8f0 | 232 | * Status_t (*ReadID) (void *handle, uint8_t *id); * |
nucleosam | 0:00a3c3f5a8f0 | 233 | *------------------------------------------------------------------------*/ |
nucleosam | 0:00a3c3f5a8f0 | 234 | /* Generic */ |
nucleosam | 0:00a3c3f5a8f0 | 235 | Status_t (*Init)(void *handle, void *init); |
nucleosam | 0:00a3c3f5a8f0 | 236 | Status_t (*ReadID)(void *handle, uint8_t *id); |
nucleosam | 0:00a3c3f5a8f0 | 237 | /* ACTION ----------------------------------------------------------------* |
nucleosam | 0:00a3c3f5a8f0 | 238 | * Declare here the component's interrupts related functions. * |
nucleosam | 0:00a3c3f5a8f0 | 239 | * Tag this group of functions with the " Interrupts " C-style comment. * |
nucleosam | 0:00a3c3f5a8f0 | 240 | * Do not specify any function if not required. * |
nucleosam | 0:00a3c3f5a8f0 | 241 | * * |
nucleosam | 0:00a3c3f5a8f0 | 242 | * Example: * |
nucleosam | 0:00a3c3f5a8f0 | 243 | * void (*ConfigIT) (void *handle, int a); * |
nucleosam | 0:00a3c3f5a8f0 | 244 | *------------------------------------------------------------------------*/ |
nucleosam | 0:00a3c3f5a8f0 | 245 | /* Interrupts */ |
nucleosam | 0:00a3c3f5a8f0 | 246 | /// Function pointer to AttachErrorHandler |
nucleosam | 0:00a3c3f5a8f0 | 247 | void (*AttachErrorHandler)(void *handle, void (*callback)(void *handle, uint16_t error)); |
nucleosam | 0:00a3c3f5a8f0 | 248 | /// Function pointer to AttachFlagInterrupt |
nucleosam | 0:00a3c3f5a8f0 | 249 | void (*AttachFlagInterrupt)(void *handle, void (*callback)(void *handle)); |
nucleosam | 0:00a3c3f5a8f0 | 250 | /// Function pointer to AttachBusyInterrupt |
nucleosam | 0:00a3c3f5a8f0 | 251 | void (*AttachBusyInterrupt)(void *handle, void (*callback)(void *handle)); |
nucleosam | 0:00a3c3f5a8f0 | 252 | /// Function pointer to FlagInterruptHandler |
nucleosam | 0:00a3c3f5a8f0 | 253 | void (*FlagInterruptHandler)(void *handle); |
nucleosam | 0:00a3c3f5a8f0 | 254 | /* ACTION ----------------------------------------------------------------* |
nucleosam | 0:00a3c3f5a8f0 | 255 | * Declare here the component's specific functions. * |
nucleosam | 0:00a3c3f5a8f0 | 256 | * Tag this group of functions with the " Specific " C-style comment. * |
nucleosam | 0:00a3c3f5a8f0 | 257 | * Do not specify any function if not required. * |
nucleosam | 0:00a3c3f5a8f0 | 258 | * * |
nucleosam | 0:00a3c3f5a8f0 | 259 | * Example: * |
nucleosam | 0:00a3c3f5a8f0 | 260 | * Status_t (*GetValue) (void *handle, float *f); * |
nucleosam | 0:00a3c3f5a8f0 | 261 | *------------------------------------------------------------------------*/ |
nucleosam | 0:00a3c3f5a8f0 | 262 | /* Specific */ |
nucleosam | 0:00a3c3f5a8f0 | 263 | /// Function pointer to GetAcceleration |
nucleosam | 0:00a3c3f5a8f0 | 264 | uint16_t (*GetAcceleration)(void *handle); |
nucleosam | 0:00a3c3f5a8f0 | 265 | /// Function pointer to GetCurrentSpeed |
nucleosam | 0:00a3c3f5a8f0 | 266 | uint16_t (*GetCurrentSpeed)(void *handle); |
nucleosam | 0:00a3c3f5a8f0 | 267 | /// Function pointer to GetDeceleration |
nucleosam | 0:00a3c3f5a8f0 | 268 | uint16_t (*GetDeceleration)(void *handle); |
nucleosam | 0:00a3c3f5a8f0 | 269 | /// Function pointer to GetDeviceState |
nucleosam | 0:00a3c3f5a8f0 | 270 | motorState_t(*GetDeviceState)(void *handle); |
nucleosam | 0:00a3c3f5a8f0 | 271 | /// Function pointer to GetFwVersion |
nucleosam | 0:00a3c3f5a8f0 | 272 | uint8_t (*GetFwVersion)(void *handle); |
nucleosam | 0:00a3c3f5a8f0 | 273 | /// Function pointer to GetMark |
nucleosam | 0:00a3c3f5a8f0 | 274 | int32_t (*GetMark)(void *handle); |
nucleosam | 0:00a3c3f5a8f0 | 275 | /// Function pointer to GetMaxSpeed |
nucleosam | 0:00a3c3f5a8f0 | 276 | uint16_t (*GetMaxSpeed)(void *handle); |
nucleosam | 0:00a3c3f5a8f0 | 277 | /// Function pointer to GetMinSpeed |
nucleosam | 0:00a3c3f5a8f0 | 278 | uint16_t (*GetMinSpeed)(void *handle); |
nucleosam | 0:00a3c3f5a8f0 | 279 | /// Function pointer to GetPosition |
nucleosam | 0:00a3c3f5a8f0 | 280 | int32_t (*GetPosition)(void *handle); |
nucleosam | 0:00a3c3f5a8f0 | 281 | /// Function pointer to GoHome |
nucleosam | 0:00a3c3f5a8f0 | 282 | void (*GoHome)(void *handle); |
nucleosam | 0:00a3c3f5a8f0 | 283 | /// Function pointer to GoMark |
nucleosam | 0:00a3c3f5a8f0 | 284 | void (*GoMark)(void *handle); |
nucleosam | 0:00a3c3f5a8f0 | 285 | /// Function pointer to GoTo |
nucleosam | 0:00a3c3f5a8f0 | 286 | void (*GoTo)(void *handle, int32_t targetPosition); |
nucleosam | 0:00a3c3f5a8f0 | 287 | /// Function pointer to HardStop |
nucleosam | 0:00a3c3f5a8f0 | 288 | void (*HardStop)(void *handle); |
nucleosam | 0:00a3c3f5a8f0 | 289 | /// Function pointer to Move |
nucleosam | 0:00a3c3f5a8f0 | 290 | void (*Move)(void *handle, motorDir_t direction, uint32_t stepCount); |
nucleosam | 0:00a3c3f5a8f0 | 291 | /// Function pointer to ResetAllDevices |
nucleosam | 0:00a3c3f5a8f0 | 292 | //void (*ResetAllDevices)(void *handle); |
nucleosam | 0:00a3c3f5a8f0 | 293 | /// Function pointer to Run |
nucleosam | 0:00a3c3f5a8f0 | 294 | void (*Run)(void *handle, motorDir_t direction); |
nucleosam | 0:00a3c3f5a8f0 | 295 | /// Function pointer to SetAcceleration |
nucleosam | 0:00a3c3f5a8f0 | 296 | bool (*SetAcceleration)(void *handle, uint16_t newAcc); |
nucleosam | 0:00a3c3f5a8f0 | 297 | /// Function pointer to SetDeceleration |
nucleosam | 0:00a3c3f5a8f0 | 298 | bool (*SetDeceleration)(void *handle, uint16_t newDec); |
nucleosam | 0:00a3c3f5a8f0 | 299 | /// Function pointer to SetHome |
nucleosam | 0:00a3c3f5a8f0 | 300 | void (*SetHome)(void *handle); |
nucleosam | 0:00a3c3f5a8f0 | 301 | /// Function pointer to SetMark |
nucleosam | 0:00a3c3f5a8f0 | 302 | void (*SetMark)(void *handle); |
nucleosam | 0:00a3c3f5a8f0 | 303 | /// Function pointer to SetMaxSpeed |
nucleosam | 0:00a3c3f5a8f0 | 304 | bool (*SetMaxSpeed)(void *handle, uint16_t newMaxSpeed); |
nucleosam | 0:00a3c3f5a8f0 | 305 | /// Function pointer to SetMinSpeed |
nucleosam | 0:00a3c3f5a8f0 | 306 | bool (*SetMinSpeed)(void *handle, uint16_t newMinSpeed); |
nucleosam | 0:00a3c3f5a8f0 | 307 | /// Function pointer to SoftStop |
nucleosam | 0:00a3c3f5a8f0 | 308 | bool (*SoftStop)(void *handle); |
nucleosam | 0:00a3c3f5a8f0 | 309 | /// Function pointer to StepClockHandler |
nucleosam | 0:00a3c3f5a8f0 | 310 | void (*StepClockHandler)(void *handle); |
nucleosam | 0:00a3c3f5a8f0 | 311 | /// Function pointer to WaitWhileActive |
nucleosam | 0:00a3c3f5a8f0 | 312 | void (*WaitWhileActive)(void *handle); |
nucleosam | 0:00a3c3f5a8f0 | 313 | /// Function pointer to CmdDisable |
nucleosam | 0:00a3c3f5a8f0 | 314 | void (*CmdDisable)(void *handle); |
nucleosam | 0:00a3c3f5a8f0 | 315 | /// Function pointer to CmdEnable |
nucleosam | 0:00a3c3f5a8f0 | 316 | void (*CmdEnable)(void *handle); |
nucleosam | 0:00a3c3f5a8f0 | 317 | /// Function pointer to CmdGetParam |
nucleosam | 0:00a3c3f5a8f0 | 318 | uint32_t (*CmdGetParam)(void *handle, uint32_t param); |
nucleosam | 0:00a3c3f5a8f0 | 319 | /// Function pointer to CmdGetStatus |
nucleosam | 0:00a3c3f5a8f0 | 320 | uint16_t (*CmdGetStatus)(void *handle); |
nucleosam | 0:00a3c3f5a8f0 | 321 | /// Function pointer to CmdNop |
nucleosam | 0:00a3c3f5a8f0 | 322 | void (*CmdNop)(void *handle); |
nucleosam | 0:00a3c3f5a8f0 | 323 | /// Function pointer to CmdSetParam |
nucleosam | 0:00a3c3f5a8f0 | 324 | void (*CmdSetParam)(void *handle, uint32_t param, uint32_t value); |
nucleosam | 0:00a3c3f5a8f0 | 325 | /// Function pointer to ReadStatusRegister |
nucleosam | 0:00a3c3f5a8f0 | 326 | uint16_t (*ReadStatusRegister)(void *handle); |
nucleosam | 0:00a3c3f5a8f0 | 327 | /// Function pointer to ReleaseReset |
nucleosam | 0:00a3c3f5a8f0 | 328 | void (*ReleaseReset)(void *handle); |
nucleosam | 0:00a3c3f5a8f0 | 329 | /// Function pointer to Reset |
nucleosam | 0:00a3c3f5a8f0 | 330 | void (*Reset)(void *handle); |
nucleosam | 0:00a3c3f5a8f0 | 331 | /// Function pointer to SelectStepMode |
nucleosam | 0:00a3c3f5a8f0 | 332 | void (*SelectStepMode)(void *handle, motorStepMode_t); |
nucleosam | 0:00a3c3f5a8f0 | 333 | /// Function pointer to SetDirection |
nucleosam | 0:00a3c3f5a8f0 | 334 | void (*SetDirection)(void *handle, motorDir_t direction); |
nucleosam | 0:00a3c3f5a8f0 | 335 | /// Function pointer to CmdGoToDir |
nucleosam | 0:00a3c3f5a8f0 | 336 | void (*CmdGoToDir)(void *handle, motorDir_t direction, int32_t targetPosition); |
nucleosam | 0:00a3c3f5a8f0 | 337 | /// Function pointer to CheckBusyHw |
nucleosam | 0:00a3c3f5a8f0 | 338 | uint8_t (*CheckBusyHw)(void *handle); |
nucleosam | 0:00a3c3f5a8f0 | 339 | /// Function pointer to CheckStatusHw |
nucleosam | 0:00a3c3f5a8f0 | 340 | uint8_t (*CheckStatusHw)(void *handle); |
nucleosam | 0:00a3c3f5a8f0 | 341 | /// Function pointer to CmdGoUntil |
nucleosam | 0:00a3c3f5a8f0 | 342 | void (*CmdGoUntil)(void *handle, motorAction_t action, motorDir_t direction, uint32_t targetPosition); |
nucleosam | 0:00a3c3f5a8f0 | 343 | /// Function pointer to CmdHardHiZ |
nucleosam | 0:00a3c3f5a8f0 | 344 | void (*CmdHardHiZ)(void *handle); |
nucleosam | 0:00a3c3f5a8f0 | 345 | /// Function pointer to CmdReleaseSw |
nucleosam | 0:00a3c3f5a8f0 | 346 | void (*CmdReleaseSw)(void *handle, motorAction_t action, motorDir_t direction); |
nucleosam | 0:00a3c3f5a8f0 | 347 | /// Function pointer to CmdResetDevice |
nucleosam | 0:00a3c3f5a8f0 | 348 | void (*CmdResetDevice)(void *handle); |
nucleosam | 0:00a3c3f5a8f0 | 349 | /// Function pointer to CmdResetPos |
nucleosam | 0:00a3c3f5a8f0 | 350 | void (*CmdResetPos)(void *handle); |
nucleosam | 0:00a3c3f5a8f0 | 351 | /// Function pointer to CmdRun |
nucleosam | 0:00a3c3f5a8f0 | 352 | void (*CmdRun)(void *handle, motorDir_t direction, uint32_t targetPosition); |
nucleosam | 0:00a3c3f5a8f0 | 353 | /// Function pointer to CmdSoftHiZ |
nucleosam | 0:00a3c3f5a8f0 | 354 | void (*CmdSoftHiZ)(void *handle); |
nucleosam | 0:00a3c3f5a8f0 | 355 | /// Function pointer to CmdStepClock |
nucleosam | 0:00a3c3f5a8f0 | 356 | void (*CmdStepClock)(void *handle, motorDir_t direction); |
nucleosam | 0:00a3c3f5a8f0 | 357 | /// Function pointer to FetchAndClearAllStatus |
nucleosam | 0:00a3c3f5a8f0 | 358 | void (*FetchAndClearAllStatus)(void *handle); |
nucleosam | 0:00a3c3f5a8f0 | 359 | /// Function pointer to GetFetchedStatus |
nucleosam | 0:00a3c3f5a8f0 | 360 | uint16_t (*GetFetchedStatus)(void *handle); |
nucleosam | 0:00a3c3f5a8f0 | 361 | /// Function pointer to GetNbDevices |
nucleosam | 0:00a3c3f5a8f0 | 362 | uint8_t (*GetNbDevices)(void *handle); |
nucleosam | 0:00a3c3f5a8f0 | 363 | /// Function pointer to IsDeviceBusy |
nucleosam | 0:00a3c3f5a8f0 | 364 | bool (*IsDeviceBusy)(void *handle); |
nucleosam | 0:00a3c3f5a8f0 | 365 | /// Function pointer to SendQueuedCommands |
nucleosam | 0:00a3c3f5a8f0 | 366 | void (*SendQueuedCommands)(void *handle); |
nucleosam | 0:00a3c3f5a8f0 | 367 | /// Function pointer to QueueCommands |
nucleosam | 0:00a3c3f5a8f0 | 368 | void (*QueueCommands)(void *handle, uint8_t command, int32_t value); |
nucleosam | 0:00a3c3f5a8f0 | 369 | /// Function pointer to WaitForAllDevicesNotBusy |
nucleosam | 0:00a3c3f5a8f0 | 370 | void (*WaitForAllDevicesNotBusy)(void *handle); |
nucleosam | 0:00a3c3f5a8f0 | 371 | /// Function pointer to ErrorHandler |
nucleosam | 0:00a3c3f5a8f0 | 372 | void (*ErrorHandler)(void *handle, uint16_t error); |
nucleosam | 0:00a3c3f5a8f0 | 373 | /// Function pointer to BusyInterruptHandler |
nucleosam | 0:00a3c3f5a8f0 | 374 | void (*BusyInterruptHandler)(void *handle); |
nucleosam | 0:00a3c3f5a8f0 | 375 | /// Function pointer to CmdSoftStop |
nucleosam | 0:00a3c3f5a8f0 | 376 | void (*CmdSoftStop)(void *handle); |
nucleosam | 0:00a3c3f5a8f0 | 377 | /// Function pointer to StartStepClock |
nucleosam | 0:00a3c3f5a8f0 | 378 | void (*StartStepClock)(void *handle, uint16_t newFreq); |
nucleosam | 0:00a3c3f5a8f0 | 379 | /// Function pointer to StopStepClock |
nucleosam | 0:00a3c3f5a8f0 | 380 | void (*StopStepClock)(void *handle); |
nucleosam | 0:00a3c3f5a8f0 | 381 | /// Function pointer to SetDualFullBridgeConfig |
nucleosam | 0:00a3c3f5a8f0 | 382 | void (*SetDualFullBridgeConfig)(void *handle, uint8_t config); |
nucleosam | 0:00a3c3f5a8f0 | 383 | /// Function pointer to GetBridgeInputPwmFreq |
nucleosam | 0:00a3c3f5a8f0 | 384 | uint32_t (*GetBridgeInputPwmFreq)(void *handle); |
nucleosam | 0:00a3c3f5a8f0 | 385 | /// Function pointer to SetBridgeInputPwmFreq |
nucleosam | 0:00a3c3f5a8f0 | 386 | void (*SetBridgeInputPwmFreq)(void *handle, uint32_t newFreq); |
nucleosam | 0:00a3c3f5a8f0 | 387 | /// Function pointer to SetStopMode |
nucleosam | 0:00a3c3f5a8f0 | 388 | void (*SetStopMode)(void *handle, motorStopMode_t stopMode); |
nucleosam | 0:00a3c3f5a8f0 | 389 | /// Function pointer to GetStopMode |
nucleosam | 0:00a3c3f5a8f0 | 390 | motorStopMode_t (*GetStopMode)(void *handle); |
nucleosam | 0:00a3c3f5a8f0 | 391 | /// Function pointer to SetDecayMode |
nucleosam | 0:00a3c3f5a8f0 | 392 | void (*SetDecayMode)(void *handle, motorDecayMode_t decayMode); |
nucleosam | 0:00a3c3f5a8f0 | 393 | /// Function pointer to GetDecayMode |
nucleosam | 0:00a3c3f5a8f0 | 394 | motorDecayMode_t (*GetDecayMode)(void *handle); |
nucleosam | 0:00a3c3f5a8f0 | 395 | /// Function pointer to GetStepMode |
nucleosam | 0:00a3c3f5a8f0 | 396 | motorStepMode_t (*GetStepMode)(void *handle); |
nucleosam | 0:00a3c3f5a8f0 | 397 | /// Function pointer to GetDirection |
nucleosam | 0:00a3c3f5a8f0 | 398 | motorDir_t (*GetDirection)(void *handle); |
nucleosam | 0:00a3c3f5a8f0 | 399 | /// Function pointer to ExitDeviceFromReset |
nucleosam | 0:00a3c3f5a8f0 | 400 | void (*ExitDeviceFromReset)(void *handle); |
nucleosam | 0:00a3c3f5a8f0 | 401 | /// Function pointer to SetTorque |
nucleosam | 0:00a3c3f5a8f0 | 402 | void (*SetTorque)(void *handle, motorTorqueMode_t torqueMode, uint8_t torqueValue); |
nucleosam | 0:00a3c3f5a8f0 | 403 | /// Function pointer to GetTorque |
nucleosam | 0:00a3c3f5a8f0 | 404 | uint8_t (*GetTorque)(void *handle, motorTorqueMode_t torqueMode); |
nucleosam | 0:00a3c3f5a8f0 | 405 | /// Function pointer to SetVRefFreq |
nucleosam | 0:00a3c3f5a8f0 | 406 | void (*SetRefFreq)(void *handle, uint32_t newFreq); |
nucleosam | 0:00a3c3f5a8f0 | 407 | /// Function pointer to GetVRefFreq |
nucleosam | 0:00a3c3f5a8f0 | 408 | uint32_t (*GetRefFreq)(void *handle); |
nucleosam | 0:00a3c3f5a8f0 | 409 | /// Function pointer to SetVRefDc |
nucleosam | 0:00a3c3f5a8f0 | 410 | void (*SetRefDc)(void *handle, uint8_t newDc); |
nucleosam | 0:00a3c3f5a8f0 | 411 | /// Function pointer to GetVRefDc |
nucleosam | 0:00a3c3f5a8f0 | 412 | uint8_t (*GetRefDc)(void *handle); |
nucleosam | 0:00a3c3f5a8f0 | 413 | /// Function pointer to SetNbDevices |
nucleosam | 0:00a3c3f5a8f0 | 414 | bool (*SetNbDevices)(void *handle, uint8_t nbDevices); |
nucleosam | 0:00a3c3f5a8f0 | 415 | /// Function pointer to set a parameter |
nucleosam | 0:00a3c3f5a8f0 | 416 | bool (*SetAnalogValue)(void *handle, uint32_t param, float value); |
nucleosam | 0:00a3c3f5a8f0 | 417 | /// Function pointer to get a parameter |
nucleosam | 0:00a3c3f5a8f0 | 418 | float (*GetAnalogValue)(void *handle, uint32_t param); |
nucleosam | 0:00a3c3f5a8f0 | 419 | } MOTOR_VTable_t; |
nucleosam | 0:00a3c3f5a8f0 | 420 | /** |
nucleosam | 0:00a3c3f5a8f0 | 421 | * @} |
nucleosam | 0:00a3c3f5a8f0 | 422 | */ |
nucleosam | 0:00a3c3f5a8f0 | 423 | |
nucleosam | 0:00a3c3f5a8f0 | 424 | /** |
nucleosam | 0:00a3c3f5a8f0 | 425 | * @} |
nucleosam | 0:00a3c3f5a8f0 | 426 | */ |
nucleosam | 0:00a3c3f5a8f0 | 427 | |
nucleosam | 0:00a3c3f5a8f0 | 428 | /** |
nucleosam | 0:00a3c3f5a8f0 | 429 | * @} |
nucleosam | 0:00a3c3f5a8f0 | 430 | */ |
nucleosam | 0:00a3c3f5a8f0 | 431 | |
nucleosam | 0:00a3c3f5a8f0 | 432 | /** |
nucleosam | 0:00a3c3f5a8f0 | 433 | * @} |
nucleosam | 0:00a3c3f5a8f0 | 434 | */ |
nucleosam | 0:00a3c3f5a8f0 | 435 | |
nucleosam | 0:00a3c3f5a8f0 | 436 | /** |
nucleosam | 0:00a3c3f5a8f0 | 437 | * @} |
nucleosam | 0:00a3c3f5a8f0 | 438 | */ |
nucleosam | 0:00a3c3f5a8f0 | 439 | |
nucleosam | 0:00a3c3f5a8f0 | 440 | #ifdef __cplusplus |
nucleosam | 0:00a3c3f5a8f0 | 441 | } |
nucleosam | 0:00a3c3f5a8f0 | 442 | #endif |
nucleosam | 0:00a3c3f5a8f0 | 443 | |
nucleosam | 0:00a3c3f5a8f0 | 444 | #endif /* __MOTOR_H */ |
nucleosam | 0:00a3c3f5a8f0 | 445 | |
nucleosam | 0:00a3c3f5a8f0 | 446 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |