Controlls of IHM01A1 by Joystick shield

Dependencies:   ST_INTERFACES X_NUCLEO_COMMON

Fork of X_NUCLEO_IHM01A1 by ST

Committer:
afm76
Date:
Tue Apr 10 02:14:46 2018 +0000
Revision:
36:0c5fb58ed18a
Parent:
33:8daea0279301
Joystick_S_Controller

Who changed what in which revision?

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