Library used to control ST Nucleo Evaluation board IHM12A1, based on STSPIN240 low voltage dual brush DC motor control driver.

Dependencies:   ST_INTERFACES

Dependents:   motori prova_motore SchedamotoriIHM12A1 prova_motore_duck ... more

Fork of X-NUCLEO-IHM12A1 by ST Expansion SW Team

Brush DC Motor Control Library

Library to handle the X-NUCLEO-IHM12A1 Motor Control Expansion Board based on the STSPIN240 component.

It allows a complete management of the STSPIN240, a low voltage dual brush DC driver, by providing a complete APIs.

The key features of the library are :

  • Configuration of the STSPIN240 (bridges input and enabling signals)
  • Flag interrupt handling (overcurrent and thermal alarms reporting)
  • Handling of up to two bidirectional Brush DC motors
  • Nucleo and expansion board configuration (GPIOs, PWMs, IRQs…)

To use the STSPIN240 driver library, the user first has to call its initialization method which:

  • Setups the required GPIOs to handle the bridges enable pins, the FLAG interrupt which reports overcurrent detection or thermal protection.
  • Loads the driver parameters with initial values configured by the user or with their predefined values from “stspin240_250_target_config.h”, in order to program the PWMs frequency of the bridges inputs, the number of brush DC motors.

Once the initialization is done, the user can modify the driver parameters by calling specific functions to change the numbers of motors or the PWMs frequency.

The user can also write callback functions and attach them to:

  • The flag interrupt handler depending on the actions he wants to perform when an overcurrent or a thermal alarm is reported.
  • The Error handler which is called by the library when it reports an error.

Then, the user can drive the different brush DC motors by requesting to run in a specified direction and by changing the maximal speed. When a motor is requested to run, the corresponding bridge is automatically enabled.

A motion command can be stopped at any moment:

  • Either by a hard stop which immediately stops the motor.
  • Or by a hardHiz command which immediately stops the motor and disables the bridge which is used by the motor.

The library also provides functions to disable or enable the bridges independently from the run or stop commands.

Arduino Connector Compatibility Warning

Using the X-NUCLEO-IHM12A1 expansion board with the NUCLEO-F429ZI requires adopting the following patch:

  • to connect with a wire the PB_3 Nucleo pin to the PWMB expansion board pin.


Board configuration for HelloWorld_IHM12A1 example

/media/uploads/Manu_L/x_nucleo_ihm12a1.jpg

Committer:
Manu_L
Date:
Thu Apr 28 14:03:11 2016 +0000
Revision:
0:13bc901c90aa
X-NUCLEO-IHM12A1 (STSPIN240) Library creation

Who changed what in which revision?

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