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