motor control
Fork of X_NUCLEO_IHM01A1 by
Components/Common/motor.h@26:7ac4b4c49276, 2016-04-02 (annotated)
- Committer:
- julientiron
- Date:
- Sat Apr 02 10:06:38 2016 +0000
- Revision:
- 26:7ac4b4c49276
- Parent:
- 22:ed3a6990a6eb
l; ;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Davidroid | 0:2887415a46cd | 1 | /** |
Davidroid | 22:ed3a6990a6eb | 2 | ****************************************************************************** |
Davidroid | 22:ed3a6990a6eb | 3 | * @file motor.h |
Davidroid | 22:ed3a6990a6eb | 4 | * @author IPC Rennes |
Davidroid | 22:ed3a6990a6eb | 5 | * @version V1.3.0 |
Davidroid | 22:ed3a6990a6eb | 6 | * @date November 12, 2014 |
Davidroid | 22:ed3a6990a6eb | 7 | * @brief This file contains all the functions prototypes for motor drivers. |
Davidroid | 22:ed3a6990a6eb | 8 | ****************************************************************************** |
Davidroid | 22:ed3a6990a6eb | 9 | * @attention |
Davidroid | 22:ed3a6990a6eb | 10 | * |
Davidroid | 22:ed3a6990a6eb | 11 | * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> |
Davidroid | 22:ed3a6990a6eb | 12 | * |
Davidroid | 22:ed3a6990a6eb | 13 | * Redistribution and use in source and binary forms, with or without modification, |
Davidroid | 22:ed3a6990a6eb | 14 | * are permitted provided that the following conditions are met: |
Davidroid | 22:ed3a6990a6eb | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
Davidroid | 22:ed3a6990a6eb | 16 | * this list of conditions and the following disclaimer. |
Davidroid | 22:ed3a6990a6eb | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
Davidroid | 22:ed3a6990a6eb | 18 | * this list of conditions and the following disclaimer in the documentation |
Davidroid | 22:ed3a6990a6eb | 19 | * and/or other materials provided with the distribution. |
Davidroid | 22:ed3a6990a6eb | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
Davidroid | 22:ed3a6990a6eb | 21 | * may be used to endorse or promote products derived from this software |
Davidroid | 22:ed3a6990a6eb | 22 | * without specific prior written permission. |
Davidroid | 22:ed3a6990a6eb | 23 | * |
Davidroid | 22:ed3a6990a6eb | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
Davidroid | 22:ed3a6990a6eb | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
Davidroid | 22:ed3a6990a6eb | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
Davidroid | 22:ed3a6990a6eb | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
Davidroid | 22:ed3a6990a6eb | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
Davidroid | 22:ed3a6990a6eb | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
Davidroid | 22:ed3a6990a6eb | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
Davidroid | 22:ed3a6990a6eb | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
Davidroid | 22:ed3a6990a6eb | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
Davidroid | 22:ed3a6990a6eb | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Davidroid | 22:ed3a6990a6eb | 34 | * |
Davidroid | 22:ed3a6990a6eb | 35 | ****************************************************************************** |
Davidroid | 22:ed3a6990a6eb | 36 | */ |
Davidroid | 22:ed3a6990a6eb | 37 | |
Davidroid | 0:2887415a46cd | 38 | |
Davidroid | 0:2887415a46cd | 39 | /* Define to prevent recursive inclusion -------------------------------------*/ |
Davidroid | 22:ed3a6990a6eb | 40 | |
Davidroid | 0:2887415a46cd | 41 | #ifndef __MOTOR_H |
Davidroid | 0:2887415a46cd | 42 | #define __MOTOR_H |
Davidroid | 0:2887415a46cd | 43 | |
Davidroid | 0:2887415a46cd | 44 | #ifdef __cplusplus |
Davidroid | 0:2887415a46cd | 45 | extern "C" { |
Davidroid | 0:2887415a46cd | 46 | #endif |
Davidroid | 0:2887415a46cd | 47 | |
Davidroid | 22:ed3a6990a6eb | 48 | |
Davidroid | 0:2887415a46cd | 49 | /* Includes ------------------------------------------------------------------*/ |
Davidroid | 22:ed3a6990a6eb | 50 | |
Davidroid | 0:2887415a46cd | 51 | #include <stdint.h> |
Davidroid | 0:2887415a46cd | 52 | #include "component.h" |
Davidroid | 0:2887415a46cd | 53 | |
Davidroid | 0:2887415a46cd | 54 | |
Davidroid | 22:ed3a6990a6eb | 55 | /* Definitions ---------------------------------------------------------------*/ |
Davidroid | 22:ed3a6990a6eb | 56 | |
Davidroid | 0:2887415a46cd | 57 | /// boolean for false condition |
Davidroid | 0:2887415a46cd | 58 | #ifndef FALSE |
Davidroid | 0:2887415a46cd | 59 | #define FALSE (0) |
Davidroid | 0:2887415a46cd | 60 | #endif |
Davidroid | 0:2887415a46cd | 61 | /// boolean for true condition |
Davidroid | 0:2887415a46cd | 62 | #ifndef TRUE |
Davidroid | 0:2887415a46cd | 63 | #define TRUE (1) |
Davidroid | 0:2887415a46cd | 64 | #endif |
Davidroid | 0:2887415a46cd | 65 | |
Davidroid | 22:ed3a6990a6eb | 66 | |
Davidroid | 22:ed3a6990a6eb | 67 | /* Types ---------------------------------------------------------------------*/ |
Davidroid | 22:ed3a6990a6eb | 68 | |
Davidroid | 22:ed3a6990a6eb | 69 | /** @addtogroup BSP |
Davidroid | 0:2887415a46cd | 70 | * @{ |
Davidroid | 0:2887415a46cd | 71 | */ |
Davidroid | 0:2887415a46cd | 72 | |
Davidroid | 22:ed3a6990a6eb | 73 | /** @addtogroup Components |
Davidroid | 22:ed3a6990a6eb | 74 | * @{ |
Davidroid | 22:ed3a6990a6eb | 75 | */ |
Davidroid | 22:ed3a6990a6eb | 76 | |
Davidroid | 22:ed3a6990a6eb | 77 | /** @addtogroup MOTOR |
Davidroid | 22:ed3a6990a6eb | 78 | * @{ |
Davidroid | 22:ed3a6990a6eb | 79 | */ |
Davidroid | 22:ed3a6990a6eb | 80 | |
Davidroid | 22:ed3a6990a6eb | 81 | /** @defgroup MOTOR_Exported_Types |
Davidroid | 22:ed3a6990a6eb | 82 | * @{ |
Davidroid | 22:ed3a6990a6eb | 83 | */ |
Davidroid | 22:ed3a6990a6eb | 84 | |
Davidroid | 0:2887415a46cd | 85 | /** @defgroup Device_Direction_Options |
Davidroid | 0:2887415a46cd | 86 | * @{ |
Davidroid | 0:2887415a46cd | 87 | */ |
Davidroid | 0:2887415a46cd | 88 | /// Direction options |
Davidroid | 0:2887415a46cd | 89 | typedef enum { |
Davidroid | 0:2887415a46cd | 90 | BACKWARD = 0, |
Davidroid | 0:2887415a46cd | 91 | FORWARD = 1 |
Davidroid | 0:2887415a46cd | 92 | } motorDir_t; |
Davidroid | 1:b38ebb8ea286 | 93 | |
Davidroid | 0:2887415a46cd | 94 | /** |
Davidroid | 0:2887415a46cd | 95 | * @} |
Davidroid | 0:2887415a46cd | 96 | */ |
Davidroid | 0:2887415a46cd | 97 | |
Davidroid | 0:2887415a46cd | 98 | /** @defgroup Device_Action_Options |
Davidroid | 0:2887415a46cd | 99 | * @{ |
Davidroid | 0:2887415a46cd | 100 | */ |
Davidroid | 0:2887415a46cd | 101 | /// Action options |
Davidroid | 0:2887415a46cd | 102 | typedef enum { |
Davidroid | 0:2887415a46cd | 103 | ACTION_RESET = ((uint8_t)0x00), |
Davidroid | 0:2887415a46cd | 104 | ACTION_COPY = ((uint8_t)0x08) |
Davidroid | 0:2887415a46cd | 105 | } motorAction_t; |
Davidroid | 0:2887415a46cd | 106 | /** |
Davidroid | 0:2887415a46cd | 107 | * @} |
Davidroid | 0:2887415a46cd | 108 | */ |
Davidroid | 0:2887415a46cd | 109 | |
Davidroid | 0:2887415a46cd | 110 | /** @defgroup Device_States |
Davidroid | 0:2887415a46cd | 111 | * @{ |
Davidroid | 0:2887415a46cd | 112 | */ |
Davidroid | 0:2887415a46cd | 113 | /// Device states |
Davidroid | 0:2887415a46cd | 114 | typedef enum { |
Davidroid | 0:2887415a46cd | 115 | ACCELERATING = 0, |
Davidroid | 0:2887415a46cd | 116 | DECELERATING = 1, |
Davidroid | 0:2887415a46cd | 117 | STEADY = 2, |
Davidroid | 0:2887415a46cd | 118 | INACTIVE= 3 |
Davidroid | 0:2887415a46cd | 119 | } motorState_t; |
Davidroid | 0:2887415a46cd | 120 | /** |
Davidroid | 0:2887415a46cd | 121 | * @} |
Davidroid | 0:2887415a46cd | 122 | */ |
Davidroid | 0:2887415a46cd | 123 | |
Davidroid | 0:2887415a46cd | 124 | /** @defgroup Device_Step_mode |
Davidroid | 0:2887415a46cd | 125 | * @{ |
Davidroid | 0:2887415a46cd | 126 | */ |
Davidroid | 0:2887415a46cd | 127 | /// Stepping options |
Davidroid | 0:2887415a46cd | 128 | typedef enum { |
Davidroid | 0:2887415a46cd | 129 | STEP_MODE_FULL = ((uint8_t)0x00), |
Davidroid | 0:2887415a46cd | 130 | STEP_MODE_HALF = ((uint8_t)0x01), |
Davidroid | 0:2887415a46cd | 131 | STEP_MODE_1_4 = ((uint8_t)0x02), |
Davidroid | 0:2887415a46cd | 132 | STEP_MODE_1_8 = ((uint8_t)0x03), |
Davidroid | 0:2887415a46cd | 133 | STEP_MODE_1_16 = ((uint8_t)0x04), |
Davidroid | 0:2887415a46cd | 134 | STEP_MODE_1_32 = ((uint8_t)0x05), |
Davidroid | 0:2887415a46cd | 135 | STEP_MODE_1_64 = ((uint8_t)0x06), |
Davidroid | 0:2887415a46cd | 136 | STEP_MODE_1_128 = ((uint8_t)0x07) |
Davidroid | 0:2887415a46cd | 137 | } motorStepMode_t; |
Davidroid | 0:2887415a46cd | 138 | /** |
Davidroid | 0:2887415a46cd | 139 | * @} |
Davidroid | 0:2887415a46cd | 140 | */ |
Davidroid | 0:2887415a46cd | 141 | |
Davidroid | 0:2887415a46cd | 142 | /** @defgroup Device_Commands |
Davidroid | 0:2887415a46cd | 143 | * @{ |
Davidroid | 0:2887415a46cd | 144 | */ |
Davidroid | 0:2887415a46cd | 145 | /// Device commands |
Davidroid | 0:2887415a46cd | 146 | typedef enum { |
Davidroid | 0:2887415a46cd | 147 | RUN_CMD, |
Davidroid | 0:2887415a46cd | 148 | MOVE_CMD, |
Davidroid | 0:2887415a46cd | 149 | SOFT_STOP_CMD, |
Davidroid | 0:2887415a46cd | 150 | NO_CMD |
Davidroid | 0:2887415a46cd | 151 | } deviceCommand_t; |
Davidroid | 0:2887415a46cd | 152 | /** |
Davidroid | 0:2887415a46cd | 153 | * @} |
Davidroid | 0:2887415a46cd | 154 | */ |
Davidroid | 0:2887415a46cd | 155 | |
Davidroid | 0:2887415a46cd | 156 | /** @defgroup Device_Parameters |
Davidroid | 0:2887415a46cd | 157 | * @{ |
Davidroid | 0:2887415a46cd | 158 | */ |
Davidroid | 0:2887415a46cd | 159 | /// Device Parameters Structure Type |
Davidroid | 0:2887415a46cd | 160 | typedef struct { |
Davidroid | 0:2887415a46cd | 161 | /// accumulator used to store speed increase smaller than 1 pps |
Davidroid | 0:2887415a46cd | 162 | volatile uint32_t accu; |
Davidroid | 0:2887415a46cd | 163 | /// Position in steps at the start of the goto or move commands |
Davidroid | 0:2887415a46cd | 164 | volatile int32_t currentPosition; |
Davidroid | 0:2887415a46cd | 165 | /// position in step at the end of the accelerating phase |
Davidroid | 0:2887415a46cd | 166 | volatile uint32_t endAccPos; |
Davidroid | 0:2887415a46cd | 167 | /// nb steps performed from the beggining of the goto or the move command |
Davidroid | 0:2887415a46cd | 168 | volatile uint32_t relativePos; |
Davidroid | 0:2887415a46cd | 169 | /// position in step at the start of the decelerating phase |
Davidroid | 0:2887415a46cd | 170 | volatile uint32_t startDecPos; |
Davidroid | 0:2887415a46cd | 171 | /// nb steps to perform for the goto or move commands |
Davidroid | 0:2887415a46cd | 172 | volatile uint32_t stepsToTake; |
Davidroid | 0:2887415a46cd | 173 | /// acceleration in pps^2 |
Davidroid | 0:2887415a46cd | 174 | volatile uint16_t acceleration; |
Davidroid | 0:2887415a46cd | 175 | /// deceleration in pps^2 |
Davidroid | 0:2887415a46cd | 176 | volatile uint16_t deceleration; |
Davidroid | 0:2887415a46cd | 177 | /// max speed in pps (speed use for goto or move command) |
Davidroid | 0:2887415a46cd | 178 | volatile uint16_t maxSpeed; |
Davidroid | 0:2887415a46cd | 179 | /// min speed in pps |
Davidroid | 0:2887415a46cd | 180 | volatile uint16_t minSpeed; |
Davidroid | 0:2887415a46cd | 181 | /// current speed in pps |
Davidroid | 0:2887415a46cd | 182 | volatile uint16_t speed; |
Davidroid | 0:2887415a46cd | 183 | /// command under execution |
Davidroid | 0:2887415a46cd | 184 | volatile deviceCommand_t commandExecuted; |
Davidroid | 0:2887415a46cd | 185 | /// FORWARD or BACKWARD direction |
Davidroid | 0:2887415a46cd | 186 | volatile motorDir_t direction; |
Davidroid | 0:2887415a46cd | 187 | /// Current State of the device |
Davidroid | 0:2887415a46cd | 188 | volatile motorState_t motionState; |
Davidroid | 0:2887415a46cd | 189 | } deviceParams_t; |
Davidroid | 0:2887415a46cd | 190 | /** |
Davidroid | 0:2887415a46cd | 191 | * @} |
Davidroid | 0:2887415a46cd | 192 | */ |
Davidroid | 0:2887415a46cd | 193 | |
Davidroid | 0:2887415a46cd | 194 | /** @defgroup Motor_Driver_Structure |
Davidroid | 0:2887415a46cd | 195 | * @{ |
Davidroid | 0:2887415a46cd | 196 | */ |
Davidroid | 22:ed3a6990a6eb | 197 | |
Davidroid | 22:ed3a6990a6eb | 198 | /** |
Davidroid | 22:ed3a6990a6eb | 199 | * @brief MOTOR driver virtual table structure definition. |
Davidroid | 22:ed3a6990a6eb | 200 | */ |
Davidroid | 0:2887415a46cd | 201 | typedef struct |
Davidroid | 0:2887415a46cd | 202 | { |
Davidroid | 0:2887415a46cd | 203 | /* ACTION ----------------------------------------------------------------* |
Davidroid | 22:ed3a6990a6eb | 204 | * Declare here the component's generic functions. * |
Davidroid | 22:ed3a6990a6eb | 205 | * Tag this group of functions with the " Generic " C-style comment. * |
Davidroid | 22:ed3a6990a6eb | 206 | * A component's interface has to define at least the two generic * |
Davidroid | 22:ed3a6990a6eb | 207 | * functions provided here below within the "Example" section, as the * |
Davidroid | 22:ed3a6990a6eb | 208 | * first and second functions of its Virtual Table. They have to be * |
Davidroid | 22:ed3a6990a6eb | 209 | * specified exactly in the given way. * |
Davidroid | 0:2887415a46cd | 210 | * * |
Davidroid | 0:2887415a46cd | 211 | * Example: * |
Davidroid | 22:ed3a6990a6eb | 212 | * Status_t (*Init) (void *handle, void *init); * |
Davidroid | 22:ed3a6990a6eb | 213 | * Status_t (*ReadID) (void *handle, uint8_t *id); * |
Davidroid | 0:2887415a46cd | 214 | *------------------------------------------------------------------------*/ |
Davidroid | 22:ed3a6990a6eb | 215 | /* Generic */ |
Davidroid | 22:ed3a6990a6eb | 216 | Status_t (*Init)(void *handle, void *init); |
Davidroid | 22:ed3a6990a6eb | 217 | Status_t (*ReadID)(void *handle, uint8_t *id); |
Davidroid | 0:2887415a46cd | 218 | |
Davidroid | 0:2887415a46cd | 219 | /* ACTION ----------------------------------------------------------------* |
Davidroid | 22:ed3a6990a6eb | 220 | * Declare here the component's interrupts related functions. * |
Davidroid | 22:ed3a6990a6eb | 221 | * Tag this group of functions with the " Interrupts " C-style comment. * |
Davidroid | 22:ed3a6990a6eb | 222 | * Do not specify any function if not required. * |
Davidroid | 0:2887415a46cd | 223 | * * |
Davidroid | 0:2887415a46cd | 224 | * Example: * |
Davidroid | 22:ed3a6990a6eb | 225 | * void (*ConfigIT) (void *handle, int a); * |
Davidroid | 0:2887415a46cd | 226 | *------------------------------------------------------------------------*/ |
Davidroid | 22:ed3a6990a6eb | 227 | /* Interrupts */ |
Davidroid | 0:2887415a46cd | 228 | /// Function pointer to AttachErrorHandler |
Davidroid | 0:2887415a46cd | 229 | void (*AttachErrorHandler)(void *handle, void (*callback)(void *handle, uint16_t error)); |
Davidroid | 0:2887415a46cd | 230 | /// Function pointer to AttachFlagInterrupt |
Davidroid | 0:2887415a46cd | 231 | void (*AttachFlagInterrupt)(void *handle, void (*callback)(void *handle)); |
Davidroid | 0:2887415a46cd | 232 | /// Function pointer to AttachBusyInterrupt |
Davidroid | 0:2887415a46cd | 233 | void (*AttachBusyInterrupt)(void *handle, void (*callback)(void *handle)); |
Davidroid | 0:2887415a46cd | 234 | /// Function pointer to FlagInterruptHandler |
Davidroid | 0:2887415a46cd | 235 | void (*FlagInterruptHandler)(void *handle); |
Davidroid | 0:2887415a46cd | 236 | |
Davidroid | 0:2887415a46cd | 237 | /* ACTION ----------------------------------------------------------------* |
Davidroid | 22:ed3a6990a6eb | 238 | * Declare here the component's specific functions. * |
Davidroid | 22:ed3a6990a6eb | 239 | * Tag this group of functions with the " Specific " C-style comment. * |
Davidroid | 22:ed3a6990a6eb | 240 | * Do not specify any function if not required. * |
Davidroid | 0:2887415a46cd | 241 | * * |
Davidroid | 0:2887415a46cd | 242 | * Example: * |
Davidroid | 22:ed3a6990a6eb | 243 | * Status_t (*GetValue) (void *handle, float *f); * |
Davidroid | 0:2887415a46cd | 244 | *------------------------------------------------------------------------*/ |
Davidroid | 22:ed3a6990a6eb | 245 | /* Specific */ |
Davidroid | 0:2887415a46cd | 246 | /// Function pointer to GetAcceleration |
Davidroid | 0:2887415a46cd | 247 | uint16_t (*GetAcceleration)(void *handle); |
Davidroid | 0:2887415a46cd | 248 | /// Function pointer to GetCurrentSpeed |
Davidroid | 0:2887415a46cd | 249 | uint16_t (*GetCurrentSpeed)(void *handle); |
Davidroid | 0:2887415a46cd | 250 | /// Function pointer to GetDeceleration |
Davidroid | 0:2887415a46cd | 251 | uint16_t (*GetDeceleration)(void *handle); |
Davidroid | 0:2887415a46cd | 252 | /// Function pointer to GetDeviceState |
Davidroid | 0:2887415a46cd | 253 | motorState_t(*GetDeviceState)(void *handle); |
Davidroid | 0:2887415a46cd | 254 | /// Function pointer to GetFwVersion |
Davidroid | 0:2887415a46cd | 255 | uint8_t (*GetFwVersion)(void *handle); |
Davidroid | 0:2887415a46cd | 256 | /// Function pointer to GetMark |
Davidroid | 0:2887415a46cd | 257 | int32_t (*GetMark)(void *handle); |
Davidroid | 0:2887415a46cd | 258 | /// Function pointer to GetMaxSpeed |
Davidroid | 0:2887415a46cd | 259 | uint16_t (*GetMaxSpeed)(void *handle); |
Davidroid | 0:2887415a46cd | 260 | /// Function pointer to GetMinSpeed |
Davidroid | 0:2887415a46cd | 261 | uint16_t (*GetMinSpeed)(void *handle); |
Davidroid | 0:2887415a46cd | 262 | /// Function pointer to GetPosition |
Davidroid | 0:2887415a46cd | 263 | int32_t (*GetPosition)(void *handle); |
Davidroid | 0:2887415a46cd | 264 | /// Function pointer to GoHome |
Davidroid | 0:2887415a46cd | 265 | void (*GoHome)(void *handle); |
Davidroid | 0:2887415a46cd | 266 | /// Function pointer to GoMark |
Davidroid | 0:2887415a46cd | 267 | void (*GoMark)(void *handle); |
Davidroid | 0:2887415a46cd | 268 | /// Function pointer to GoTo |
Davidroid | 0:2887415a46cd | 269 | void (*GoTo)(void *handle, int32_t targetPosition); |
Davidroid | 0:2887415a46cd | 270 | /// Function pointer to HardStop |
Davidroid | 0:2887415a46cd | 271 | void (*HardStop)(void *handle); |
Davidroid | 0:2887415a46cd | 272 | /// Function pointer to Move |
Davidroid | 0:2887415a46cd | 273 | void (*Move)(void *handle, motorDir_t direction, uint32_t stepCount); |
Davidroid | 0:2887415a46cd | 274 | /// Function pointer to ResetAllDevices |
Davidroid | 0:2887415a46cd | 275 | //void (*ResetAllDevices)(void *handle); |
Davidroid | 0:2887415a46cd | 276 | /// Function pointer to Run |
Davidroid | 0:2887415a46cd | 277 | void (*Run)(void *handle, motorDir_t direction); |
Davidroid | 0:2887415a46cd | 278 | /// Function pointer to SetAcceleration |
Davidroid | 22:ed3a6990a6eb | 279 | bool (*SetAcceleration)(void *handle, uint16_t newAcc); |
Davidroid | 0:2887415a46cd | 280 | /// Function pointer to SetDeceleration |
Davidroid | 22:ed3a6990a6eb | 281 | bool (*SetDeceleration)(void *handle, uint16_t newDec); |
Davidroid | 0:2887415a46cd | 282 | /// Function pointer to SetHome |
Davidroid | 0:2887415a46cd | 283 | void (*SetHome)(void *handle); |
Davidroid | 0:2887415a46cd | 284 | /// Function pointer to SetMark |
Davidroid | 0:2887415a46cd | 285 | void (*SetMark)(void *handle); |
Davidroid | 0:2887415a46cd | 286 | /// Function pointer to SetMaxSpeed |
Davidroid | 0:2887415a46cd | 287 | bool (*SetMaxSpeed)(void *handle, uint16_t newMaxSpeed); |
Davidroid | 0:2887415a46cd | 288 | /// Function pointer to SetMinSpeed |
Davidroid | 0:2887415a46cd | 289 | bool (*SetMinSpeed)(void *handle, uint16_t newMinSpeed); |
Davidroid | 0:2887415a46cd | 290 | /// Function pointer to SoftStop |
Davidroid | 0:2887415a46cd | 291 | bool (*SoftStop)(void *handle); |
Davidroid | 0:2887415a46cd | 292 | /// Function pointer to StepClockHandler |
Davidroid | 0:2887415a46cd | 293 | void (*StepClockHandler)(void *handle); |
Davidroid | 1:b38ebb8ea286 | 294 | /// Function pointer to WaitWhileActive |
Davidroid | 1:b38ebb8ea286 | 295 | void (*WaitWhileActive)(void *handle); |
Davidroid | 0:2887415a46cd | 296 | /// Function pointer to CmdDisable |
Davidroid | 0:2887415a46cd | 297 | void (*CmdDisable)(void *handle); |
Davidroid | 0:2887415a46cd | 298 | /// Function pointer to CmdEnable |
Davidroid | 0:2887415a46cd | 299 | void (*CmdEnable)(void *handle); |
Davidroid | 0:2887415a46cd | 300 | /// Function pointer to CmdGetParam |
Davidroid | 0:2887415a46cd | 301 | uint32_t (*CmdGetParam)(void *handle, uint32_t param); |
Davidroid | 0:2887415a46cd | 302 | /// Function pointer to CmdGetStatus |
Davidroid | 0:2887415a46cd | 303 | uint16_t (*CmdGetStatus)(void *handle); |
Davidroid | 0:2887415a46cd | 304 | /// Function pointer to CmdNop |
Davidroid | 0:2887415a46cd | 305 | void (*CmdNop)(void *handle); |
Davidroid | 0:2887415a46cd | 306 | /// Function pointer to CmdSetParam |
Davidroid | 0:2887415a46cd | 307 | void (*CmdSetParam)(void *handle, uint32_t param, uint32_t value); |
Davidroid | 0:2887415a46cd | 308 | /// Function pointer to ReadStatusRegister |
Davidroid | 0:2887415a46cd | 309 | uint16_t (*ReadStatusRegister)(void *handle); |
Davidroid | 0:2887415a46cd | 310 | /// Function pointer to ReleaseReset |
Davidroid | 0:2887415a46cd | 311 | void (*ReleaseReset)(void *handle); |
Davidroid | 0:2887415a46cd | 312 | /// Function pointer to Reset |
Davidroid | 0:2887415a46cd | 313 | void (*Reset)(void *handle); |
Davidroid | 0:2887415a46cd | 314 | /// Function pointer to SelectStepMode |
Davidroid | 0:2887415a46cd | 315 | void (*SelectStepMode)(void *handle, motorStepMode_t stepMod); |
Davidroid | 0:2887415a46cd | 316 | /// Function pointer to SetDirection |
Davidroid | 0:2887415a46cd | 317 | void (*SetDirection)(void *handle, motorDir_t direction); |
Davidroid | 0:2887415a46cd | 318 | /// Function pointer to CmdGoToDir |
Davidroid | 0:2887415a46cd | 319 | void (*CmdGoToDir)(void *handle, motorDir_t direction, int32_t targetPosition); |
Davidroid | 0:2887415a46cd | 320 | /// Function pointer to CheckBusyHw |
Davidroid | 0:2887415a46cd | 321 | uint8_t (*CheckBusyHw)(void *handle); |
Davidroid | 0:2887415a46cd | 322 | /// Function pointer to CheckStatusHw |
Davidroid | 0:2887415a46cd | 323 | uint8_t (*CheckStatusHw)(void *handle); |
Davidroid | 0:2887415a46cd | 324 | /// Function pointer to CmdGoUntil |
Davidroid | 0:2887415a46cd | 325 | void (*CmdGoUntil)(void *handle, motorAction_t action, motorDir_t direction, uint32_t targetPosition); |
Davidroid | 0:2887415a46cd | 326 | /// Function pointer to CmdHardHiZ |
Davidroid | 0:2887415a46cd | 327 | void (*CmdHardHiZ)(void *handle); |
Davidroid | 0:2887415a46cd | 328 | /// Function pointer to CmdReleaseSw |
Davidroid | 0:2887415a46cd | 329 | void (*CmdReleaseSw)(void *handle, motorAction_t action, motorDir_t direction); |
Davidroid | 0:2887415a46cd | 330 | /// Function pointer to CmdResetDevice |
Davidroid | 0:2887415a46cd | 331 | void (*CmdResetDevice)(void *handle); |
Davidroid | 0:2887415a46cd | 332 | /// Function pointer to CmdResetPos |
Davidroid | 0:2887415a46cd | 333 | void (*CmdResetPos)(void *handle); |
Davidroid | 0:2887415a46cd | 334 | /// Function pointer to CmdRun |
Davidroid | 0:2887415a46cd | 335 | void (*CmdRun)(void *handle, motorDir_t direction, uint32_t targetPosition); |
Davidroid | 0:2887415a46cd | 336 | /// Function pointer to CmdSoftHiZ |
Davidroid | 0:2887415a46cd | 337 | void (*CmdSoftHiZ)(void *handle); |
Davidroid | 0:2887415a46cd | 338 | /// Function pointer to CmdStepClock |
Davidroid | 0:2887415a46cd | 339 | void (*CmdStepClock)(void *handle, motorDir_t direction); |
Davidroid | 0:2887415a46cd | 340 | /// Function pointer to FetchAndClearAllStatus |
Davidroid | 0:2887415a46cd | 341 | void (*FetchAndClearAllStatus)(void *handle); |
Davidroid | 0:2887415a46cd | 342 | /// Function pointer to GetFetchedStatus |
Davidroid | 0:2887415a46cd | 343 | uint16_t (*GetFetchedStatus)(void *handle); |
Davidroid | 0:2887415a46cd | 344 | /// Function pointer to GetNbDevices |
Davidroid | 0:2887415a46cd | 345 | uint8_t (*GetNbDevices)(void *handle); |
Davidroid | 0:2887415a46cd | 346 | /// Function pointer to IsDeviceBusy |
Davidroid | 0:2887415a46cd | 347 | bool (*IsDeviceBusy)(void *handle); |
Davidroid | 0:2887415a46cd | 348 | /// Function pointer to SendQueuedCommands |
Davidroid | 0:2887415a46cd | 349 | void (*SendQueuedCommands)(void *handle); |
Davidroid | 0:2887415a46cd | 350 | /// Function pointer to QueueCommands |
Davidroid | 0:2887415a46cd | 351 | void (*QueueCommands)(void *handle, uint8_t temp, uint32_t command); |
Davidroid | 0:2887415a46cd | 352 | /// Function pointer to WaitForAllDevicesNotBusy |
Davidroid | 0:2887415a46cd | 353 | void (*WaitForAllDevicesNotBusy)(void *handle); |
Davidroid | 0:2887415a46cd | 354 | /// Function pointer to ErrorHandler |
Davidroid | 0:2887415a46cd | 355 | void (*ErrorHandler)(void *handle, uint16_t error); |
Davidroid | 0:2887415a46cd | 356 | /// Function pointer to BusyInterruptHandler |
Davidroid | 0:2887415a46cd | 357 | void (*BusyInterruptHandler)(void *handle); |
Davidroid | 0:2887415a46cd | 358 | /// Function pointer to CmdSoftStop |
Davidroid | 0:2887415a46cd | 359 | void (*CmdSoftStop)(void *handle); |
Davidroid | 22:ed3a6990a6eb | 360 | } MOTOR_VTable_t; |
Davidroid | 0:2887415a46cd | 361 | |
Davidroid | 0:2887415a46cd | 362 | #ifdef __cplusplus |
Davidroid | 0:2887415a46cd | 363 | } |
Davidroid | 0:2887415a46cd | 364 | #endif |
Davidroid | 0:2887415a46cd | 365 | |
Davidroid | 0:2887415a46cd | 366 | #endif /* __MOTOR_H */ |
Davidroid | 0:2887415a46cd | 367 | |
Davidroid | 0:2887415a46cd | 368 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |