Personal fork of the library for direct control instead of library control
Dependents: Thesis_Rotating_Platform
Fork of X_NUCLEO_IHM01A1 by
StepperMotor_class.h
00001 /** 00002 ****************************************************************************** 00003 * @file StepperMotor_class.h 00004 * @author Davide Aliprandi, STMicroelectronics 00005 * @version V1.0.0 00006 * @date November 12th, 2015 00007 * @brief This file contains the abstract class describing the interface of a 00008 * stepper-motor component. 00009 ****************************************************************************** 00010 * @attention 00011 * 00012 * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> 00013 * 00014 * Redistribution and use in source and binary forms, with or without modification, 00015 * are permitted provided that the following conditions are met: 00016 * 1. Redistributions of source code must retain the above copyright notice, 00017 * this list of conditions and the following disclaimer. 00018 * 2. Redistributions in binary form must reproduce the above copyright notice, 00019 * this list of conditions and the following disclaimer in the documentation 00020 * and/or other materials provided with the distribution. 00021 * 3. Neither the name of STMicroelectronics nor the names of its contributors 00022 * may be used to endorse or promote products derived from this software 00023 * without specific prior written permission. 00024 * 00025 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00026 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00027 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00028 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 00029 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00030 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00031 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00032 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00033 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00034 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00035 * 00036 ****************************************************************************** 00037 */ 00038 00039 00040 /* Define to prevent from recursive inclusion --------------------------------*/ 00041 00042 #ifndef __STEPPERMOTOR_CLASS_H 00043 #define __STEPPERMOTOR_CLASS_H 00044 00045 00046 /* Includes ------------------------------------------------------------------*/ 00047 00048 #include <Component_class.h> 00049 00050 00051 /* Classes ------------------------------------------------------------------*/ 00052 00053 /** An abstract class for StepperMotor components. 00054 */ 00055 class StepperMotor : public Component 00056 { 00057 public: 00058 /** 00059 * @brief Rotation modes. 00060 */ 00061 typedef enum 00062 { 00063 BWD = 0, /* Backward. */ 00064 FWD = 1 /* Forward. */ 00065 } direction_t; 00066 00067 /** 00068 * @brief Getting the status. 00069 * @param None. 00070 * @retval The status. 00071 */ 00072 virtual unsigned int GetStatus(void) = 0; 00073 00074 /** 00075 * @brief Getting a parameter. 00076 * @param parameter The parameter's identifier (or its register address). 00077 * @retval The parameter's value. 00078 */ 00079 virtual float GetParameter(unsigned int parameter) = 0; 00080 00081 /** 00082 * @brief Getting the position. 00083 * @param None. 00084 * @retval The position. 00085 */ 00086 virtual signed int GetPosition(void) = 0; 00087 00088 /** 00089 * @brief Getting the marked position. 00090 * @param None. 00091 * @retval The marked position. 00092 */ 00093 virtual signed int GetMark(void) = 0; 00094 00095 /** 00096 * @brief Getting the current speed in pps. 00097 * @param None. 00098 * @retval The current speed in pps. 00099 */ 00100 virtual unsigned int GetSpeed(void) = 0; 00101 00102 /** 00103 * @brief Getting the maximum speed in pps. 00104 * @param None. 00105 * @retval The maximum speed in pps. 00106 */ 00107 virtual unsigned int GetMaxSpeed(void) = 0; 00108 00109 /** 00110 * @brief Getting the minimum speed in pps. 00111 * @param None. 00112 * @retval The minimum speed in pps. 00113 */ 00114 virtual unsigned int GetMinSpeed(void) = 0; 00115 00116 /** 00117 * @brief Getting the acceleration in pps^2. 00118 * @param None. 00119 * @retval The acceleration in pps^2. 00120 */ 00121 virtual unsigned int GetAcceleration(void) = 0; 00122 00123 /** 00124 * @brief Getting the deceleration in pps^2. 00125 * @param None. 00126 * @retval The deceleration in pps^2. 00127 */ 00128 virtual unsigned int GetDeceleration(void) = 0; 00129 00130 /** 00131 * @brief Getting the direction of rotation. 00132 * @param None. 00133 * @retval The direction of rotation. 00134 */ 00135 virtual direction_t GetDirection(void) = 0; 00136 00137 /** 00138 * @brief Setting a parameter. 00139 * @param parameter The parameter's identifier (or its register address). 00140 * @param value The parameter's value. 00141 * @retval None. 00142 */ 00143 virtual void SetParameter(unsigned int parameter, float value) = 0; 00144 00145 /** 00146 * @brief Setting the current position to be the home position. 00147 * @param None. 00148 * @retval None. 00149 */ 00150 virtual void SetHome(void) = 0; 00151 00152 /** 00153 * @brief Setting the current position to be the marked position. 00154 * @param None. 00155 * @retval None. 00156 */ 00157 virtual void SetMark(void) = 0; 00158 00159 /** 00160 * @brief Setting the maximum speed in pps. 00161 * @param speed The maximum speed in pps. 00162 * @retval None. 00163 */ 00164 virtual void SetMaxSpeed(unsigned int speed) = 0; 00165 00166 /** 00167 * @brief Setting the minimum speed in pps. 00168 * @param speed The minimum speed in pps. 00169 * @retval None. 00170 */ 00171 virtual void SetMinSpeed(unsigned int speed) = 0; 00172 00173 /** 00174 * @brief Setting the acceleration in pps^2. 00175 * @param acceleration The acceleration in pps^2. 00176 * @retval None. 00177 */ 00178 virtual void SetAcceleration(unsigned int acceleration) = 0; 00179 00180 /** 00181 * @brief Setting the deceleration in pps^2. 00182 * @param deceleration The deceleration in pps^2. 00183 * @retval None. 00184 */ 00185 virtual void SetDeceleration(unsigned int deceleration) = 0; 00186 00187 /** 00188 * @brief Going to a specified position. 00189 * @param position The desired position. 00190 * @retval None. 00191 */ 00192 virtual void GoTo(signed int position) = 0; 00193 00194 /** 00195 * @brief Going to the home position. 00196 * @param None. 00197 * @retval None. 00198 */ 00199 virtual void GoHome(void) = 0; 00200 00201 /** 00202 * @brief Going to the marked position. 00203 * @param None. 00204 * @retval None. 00205 */ 00206 virtual void GoMark(void) = 0; 00207 00208 /** 00209 * @brief Running the motor towards a specified direction. 00210 * @param direction The direction of rotation. 00211 * @retval None. 00212 */ 00213 virtual void Run(direction_t direction) = 0; 00214 00215 /** 00216 * @brief Moving the motor towards a specified direction for a certain number of steps. 00217 * @param direction The direction of rotation. 00218 * @param steps The desired number of steps. 00219 * @retval None. 00220 */ 00221 virtual void Move(direction_t direction, unsigned int steps) = 0; 00222 00223 /** 00224 * @brief Stopping the motor through an immediate deceleration up to zero speed. 00225 * @param None. 00226 * @retval None. 00227 */ 00228 virtual void SoftStop(void) = 0; 00229 00230 /** 00231 * @brief Stopping the motor through an immediate infinite deceleration. 00232 * @param None. 00233 * @retval None. 00234 */ 00235 virtual void HardStop(void) = 0; 00236 00237 /** 00238 * @brief Disabling the power bridge after performing a deceleration to zero. 00239 * @param None. 00240 * @retval None. 00241 */ 00242 virtual void SoftHiZ(void) = 0; 00243 00244 /** 00245 * @brief Disabling the power bridge immediately. 00246 * @param None. 00247 * @retval None. 00248 */ 00249 virtual void HardHiZ(void) = 0; 00250 00251 /** 00252 * @brief Waiting while the motor is active. 00253 * @param None. 00254 * @retval None. 00255 */ 00256 virtual void WaitWhileActive(void) = 0; 00257 }; 00258 00259 #endif /* __STEPPERMOTOR_CLASS_H */ 00260 00261 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Generated on Fri Jul 15 2022 12:57:41 by 1.7.2