ST Expansion SW Team / X_NUCLEO_IHM14A1

Dependencies:   ST_INTERFACES

Dependents:   HelloWorld_IHM14A1

Fork of X_NUCLEO_IHM14A1 by Davide Aliprandi

Committer:
Davidroid
Date:
Fri Apr 27 17:02:08 2018 +0000
Revision:
1:bc265521eb00
Child:
2:4fd08b67958c
Populate

Who changed what in which revision?

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