Library used to control ST Nucleo Evaluation board IHM04A1, based on L6206 motor control driver.

Dependencies:   ST_INTERFACES

Dependents:   HelloWorld_IHM04A1 RoboCane_Motore arm_dcmotor_can arm_linear_can_2 ... more

Fork of X_NUCLEO_IHM04A1 by ST Expansion SW Team

Motor Control Library

Library to handle the X-NUCLEO-IHM04A1 Motor Control Expansion Board based on the L6206 component.

It allows a complete management of the L6206 by providing a complete APIs.

The key features of the library are :

  • Configuration of the L6206 (bridges inputs and enabling signals, bridges paralleling)
  • FLAG interrupts handling (overcurrent and thermal alarms reporting)
  • Handling of up to two bidirectional Brush DC motors or up to 4 unidirectional Brush DC motors depending of the bridges paralleling configuration
  • Nucleo and expansion board configuration (GPIOs, PWMs, IRQs…)

To use the L6206 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 “l6206_target_config.h”, in order to program the PWMs frequency of the bridges inputs, the bridges paralleling configuration, the number and the type (bidirectional or unidirectional) of brush DC motors.

Once the initialization is done, the user can modify the driver parameters by calling specific functions to change the bridges paralleling configuration, types and 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-IHM04A1 expansion board with the NUCLEO-F429ZI requires adopting the following patch:

  • to connect with a wire the PB_4 Nucleo pin to the IN1A expansion board pin;
  • to connect with a wire the PC_7 Nucleo pin to the IN2A expansion board pin;
  • to connect with a wire the PA_15 Nucleo pin to the IN1B expansion board pin;
  • to connect with a wire the PB_3 Nucleo pin to the IN2B expansion board pin.


Board configuration for HelloWorld_IHM04A1 example

/media/uploads/brdirais/drive4brushdcmotor_ihm04a1.png

Committer:
brdirais
Date:
Tue May 03 11:16:57 2016 +0000
Revision:
0:2cb6ce8e07bd
Initial version of X-NUCLEO-IHM04A1 library

Who changed what in which revision?

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