Davide Aliprandi / X_NUCLEO_IHM03A1

Dependencies:   ST_INTERFACES X_NUCLEO_COMMON

Fork of X_NUCLEO_IHM03A1 by ST

Revision:
1:8ce2a5d6fbf8
Parent:
0:00a3c3f5a8f0
--- a/Components/Interfaces/StepperMotor_class.h	Tue Apr 05 15:18:56 2016 +0000
+++ b/Components/Interfaces/StepperMotor_class.h	Thu Apr 07 16:11:47 2016 +0000
@@ -1,15 +1,15 @@
 /**
  ******************************************************************************
  * @file    StepperMotor_class.h
- * @author  IPC Rennes
- * @version V1.2.0
- * @date    March 18th, 2016
+ * @author  Davide Aliprandi, STMicroelectronics
+ * @version V1.1.0
+ * @date    April 6th, 2016
  * @brief   This file contains the abstract class describing the interface of a
  *          stepper-motor component.
  ******************************************************************************
  * @attention
  *
- * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
+ * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
  *
  * Redistribution and use in source and binary forms, with or without modification,
  * are permitted provided that the following conditions are met:
@@ -60,17 +60,28 @@
      */
     typedef enum
     {
-      BWD = 0, /* Backward. */
-      FWD = 1  /* Forward. */
+        BWD = 0, /* Backward. */
+        FWD = 1  /* Forward. */
     } direction_t;
 
     /**
-     * @brief  Attaching an error handler.
-     * @param  fptr An error handler.
-     * @retval None.
+     * @brief Step modes.
      */
-    virtual void AttachErrorHandler(void (*fptr)(uint16_t error)) = 0;
-    
+    typedef enum
+    {
+        STEP_MODE_FULL = 0, /* Full-step. */
+        STEP_MODE_HALF,     /* Half-step. */
+        STEP_MODE_1_4,      /* 1/4 microstep. */
+        STEP_MODE_1_8,      /* 1/8 microstep. */
+        STEP_MODE_1_16,     /* 1/16 microstep. */
+        STEP_MODE_1_32,     /* 1/32 microstep. */
+        STEP_MODE_1_64,     /* 1/64 microstep. */
+        STEP_MODE_1_128,    /* 1/128 microstep. */
+        STEP_MODE_1_256,    /* 1/256 microstep. */
+        STEP_MODE_UNKNOWN,
+        STEP_MODE_WAVE      /* Full-step one-phase-on*/
+    } step_mode_t;
+
     /**
      * @brief  Getting the status.
      * @param  None.
@@ -79,20 +90,6 @@
     virtual unsigned int GetStatus(void) = 0;
 
     /**
-     * @brief  Getting a parameter in the register format
-     * @param  parameter The parameter's identifier (or its register address).
-     * @retval The parameter's value in the register format (digital value)
-     */
-    virtual unsigned int GetParameter(unsigned int parameter) = 0;
-
-    /**
-     * @brief  Getting a parameter value in float format
-     * @param  parameter The parameter's identifier (or its register address).
-     * @retval The parameter's value in float format (analog value)
-     */
-    virtual float GetAnalogValue(unsigned int parameter) = 0;
-
-    /**
      * @brief  Getting the position.
      * @param  None.
      * @retval The position.
@@ -105,7 +102,7 @@
      * @retval The marked position.
      */
     virtual signed int GetMark(void) = 0;
-    
+
     /**
      * @brief  Getting the current speed in pps.
      * @param  None.
@@ -140,29 +137,13 @@
      * @retval The deceleration in pps^2.
      */
     virtual unsigned int GetDeceleration(void) = 0;
-    
+
     /**
      * @brief  Getting the direction of rotation.
      * @param  None.
      * @retval The direction of rotation.
      */
     virtual direction_t GetDirection(void) = 0;
-    
-   /**
-     * @brief  Setting a parameter.
-     * @param  parameter The parameter's identifier (or its register address).
-     * @param  value The parameter's value in the register format (digital value)
-     * @retval None.
-     */
-    virtual void SetParameter(unsigned int parameter, unsigned int value) = 0;
-
-   /**
-     * @brief  Setting a parameter.
-     * @param  parameter The parameter's identifier (or its register address).
-     * @param  value The parameter's value in a float format (analog value)
-     * @retval None.
-     */
-    virtual bool SetAnalogValue(unsigned int parameter, float value) = 0;
 
     /**
      * @brief  Setting the current position to be the home position.
@@ -181,37 +162,37 @@
     /**
      * @brief  Setting the maximum speed in pps.
      * @param  speed The maximum speed in pps.
-     * @retval TRUE if value is valid, FALSE otherwise.
+     * @retval "true" in case of success, "false" otherwise.
      */
     virtual bool SetMaxSpeed(unsigned int speed) = 0;
 
     /**
      * @brief  Setting the minimum speed in pps.
      * @param  speed The minimum speed in pps.
-     * @retval TRUE if value is valid, FALSE otherwise.
+     * @retval "true" in case of success, "false" otherwise.
      */
     virtual bool SetMinSpeed(unsigned int speed) = 0;
 
     /**
      * @brief  Setting the acceleration in pps^2.
      * @param  acceleration The acceleration in pps^2.
-     * @retval TRUE if value is valid, FALSE otherwise.
+     * @retval "true" in case of success, "false" otherwise.
      */
-    virtual bool SetAcceleration(unsigned int speed) = 0;
+    virtual bool SetAcceleration(unsigned int acceleration) = 0;
 
     /**
      * @brief  Setting the deceleration in pps^2.
      * @param  deceleration The deceleration in pps^2.
-     * @retval TRUE if value is valid, FALSE otherwise.
+     * @retval "true" in case of success, "false" otherwise.
      */
-    virtual bool SetDeceleration(unsigned int speed) = 0;
-   
+    virtual bool SetDeceleration(unsigned int deceleration) = 0;
+
     /**
      * @brief  Setting the Step Mode.
      * @param  step_mode The Step Mode.
-     * @retval None.
+     * @retval "true" in case of success, "false" otherwise.
      */
-    virtual void SetStepMode(motorStepMode_t step_mode) = 0;
+    virtual bool SetStepMode(step_mode_t step_mode) = 0;
 
     /**
      * @brief  Going to a specified position.
@@ -283,9 +264,8 @@
      * @retval None.
      */
     virtual void WaitWhileActive(void) = 0;
-
 };
 
 #endif /* __STEPPERMOTOR_CLASS_H */
 
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/