motor board library

Dependencies:   ST_INTERFACES X_NUCLEO_COMMON

Dependents:   selfbalansingcar

Fork of X_NUCLEO_IHM02A1 by ST

Files at this revision

API Documentation at this revision

Comitter:
Davidroid
Date:
Wed Nov 25 11:59:37 2015 +0000
Parent:
0:92706998571a
Child:
2:3ed992ffeada
Commit message:
+ Implemented all the StepperMotor's APIs.

Changed in this revision

BSP/x_nucleo_ihm02a1_class.cpp Show annotated file Show diff for this revision Revisions of this file
BSP/x_nucleo_ihm02a1_class.h Show annotated file Show diff for this revision Revisions of this file
Components/Common/microstepping_motor.h Show annotated file Show diff for this revision Revisions of this file
Components/Interfaces/Component_class.h Show annotated file Show diff for this revision Revisions of this file
Components/Interfaces/StepperMotor_class.h Show annotated file Show diff for this revision Revisions of this file
Components/l6470/l6470_class.cpp Show annotated file Show diff for this revision Revisions of this file
Components/l6470/l6470_class.h Show annotated file Show diff for this revision Revisions of this file
--- a/BSP/x_nucleo_ihm02a1_class.cpp	Fri Nov 20 18:07:45 2015 +0000
+++ b/BSP/x_nucleo_ihm02a1_class.cpp	Wed Nov 25 11:59:37 2015 +0000
@@ -68,48 +68,48 @@
 {
   {
     {
-      9.0, 400, 1.7, 3.06, 300.0, 500.0, 500.0, 400.0, 0.0, 602.7, 3.06, 3.06,\
+      9.0, 400, 1.7, 3.06, 300.0, 500.0, 500.0, 992.0, 0.0, 602.7, 3.06, 3.06,\
       3.06, 3.06, 61.52, 392.1569e-6, 643.1372e-6, 643.1372e-6, 0,\
       3.06*1000*1.10, 3.06*1000*1.00, MICROSTEP_1_128, 0xFF, 0x2E88
     },
     {
-      9.0, 400, 1.7, 3.06, 300.0, 500.0, 500.0, 400.0, 0.0, 602.7, 3.06, 3.06,\
+      9.0, 400, 1.7, 3.06, 300.0, 500.0, 500.0, 992.0, 0.0, 602.7, 3.06, 3.06,\
       3.06, 3.06, 61.52, 392.1569e-6, 643.1372e-6, 643.1372e-6, 0,\
       3.06*1000*1.10, 3.06*1000*1.00, MICROSTEP_1_128, 0xFF, 0x2E88
     },
   },
   {
     {
-      9.0, 400, 1.7, 3.06, 300.0, 500.0, 500.0, 400.0, 0.0, 602.7, 3.06, 3.06,\
+      9.0, 400, 1.7, 3.06, 300.0, 500.0, 500.0, 992.0, 0.0, 602.7, 3.06, 3.06,\
       3.06, 3.06, 61.52, 392.1569e-6, 643.1372e-6, 643.1372e-6, 0,\
       3.06*1000*1.10, 3.06*1000*1.00, MICROSTEP_1_128, 0xFF, 0x2E88
     },
     {
-      9.0, 400, 1.7, 3.06, 300.0, 500.0, 500.0, 400.0, 0.0, 602.7, 3.06, 3.06,\
+      9.0, 400, 1.7, 3.06, 300.0, 500.0, 500.0, 992.0, 0.0, 602.7, 3.06, 3.06,\
       3.06, 3.06, 61.52, 392.1569e-6, 643.1372e-6, 643.1372e-6, 0,\
       3.06*1000*1.10, 3.06*1000*1.00, MICROSTEP_1_128, 0xFF, 0x2E88
     },
   },
   {
     {
-      9.0, 400, 1.7, 3.06, 300.0, 500.0, 500.0, 400.0, 0.0, 602.7, 3.06, 3.06,\
+      9.0, 400, 1.7, 3.06, 300.0, 500.0, 500.0, 992.0, 0.0, 602.7, 3.06, 3.06,\
       3.06, 3.06, 61.52, 392.1569e-6, 643.1372e-6, 643.1372e-6, 0,\
       3.06*1000*1.10, 3.06*1000*1.00, MICROSTEP_1_128, 0xFF, 0x2E88
     },
     {
-      9.0, 400, 1.7, 3.06, 300.0, 500.0, 500.0, 400.0, 0.0, 602.7, 3.06, 3.06,\
+      9.0, 400, 1.7, 3.06, 300.0, 500.0, 500.0, 992.0, 0.0, 602.7, 3.06, 3.06,\
       3.06, 3.06, 61.52, 392.1569e-6, 643.1372e-6, 643.1372e-6, 0,\
       3.06*1000*1.10, 3.06*1000*1.00, MICROSTEP_1_128, 0xFF, 0x2E88
     },
   },
   {
     {
-      9.0, 400, 1.7, 3.06, 300.0, 500.0, 500.0, 400.0, 0.0, 602.7, 3.06, 3.06,\
+      9.0, 400, 1.7, 3.06, 300.0, 500.0, 500.0, 992.0, 0.0, 602.7, 3.06, 3.06,\
       3.06, 3.06, 61.52, 392.1569e-6, 643.1372e-6, 643.1372e-6, 0,\
       3.06*1000*1.10, 3.06*1000*1.00, MICROSTEP_1_128, 0xFF, 0x2E88
     },
     {
-      9.0, 400, 1.7, 3.06, 300.0, 500.0, 500.0, 400.0, 0.0, 602.7, 3.06, 3.06,\
+      9.0, 400, 1.7, 3.06, 300.0, 500.0, 500.0, 992.0, 0.0, 602.7, 3.06, 3.06,\
       3.06, 3.06, 61.52, 392.1569e-6, 643.1372e-6, 643.1372e-6, 0,\
       3.06*1000*1.10, 3.06*1000*1.00, MICROSTEP_1_128, 0xFF, 0x2E88
     },
@@ -122,11 +122,12 @@
 /**
  * @brief Constructor.
  * @param flag_irq      pin name of the FLAG pin of the component.
+ * @param busy_irq      pin name of the BUSY pin of the component.
  * @param standby_reset pin name of the STBY\RST pin of the component.
  * @param ssel          pin name of the SSEL pin of the SPI device to be used for communication.
  * @param spi           SPI device to be used for communication.
  */
-X_NUCLEO_IHM02A1::X_NUCLEO_IHM02A1(PinName flag_irq, PinName standby_reset, PinName ssel, DevSPI *spi) : dev_spi(spi)
+X_NUCLEO_IHM02A1::X_NUCLEO_IHM02A1(PinName flag_irq, PinName busy_irq, PinName standby_reset, PinName ssel, DevSPI *spi) : dev_spi(spi)
 {
     /* Instantiating the components. */
     /* ACTION 3 --------------------------------------------------------------*
@@ -137,19 +138,20 @@
      *   component_2 = new COMPONENT_2(COMPONENT_2_SPI_SSEL, *dev_spi);       *
      *------------------------------------------------------------------------*/
     X_NUCLEO_IHM02A1_Id = number_of_boards++;
-    l6470_0 = new L6470(flag_irq, standby_reset, ssel, *dev_spi);
-    l6470_1 = new L6470(flag_irq, standby_reset, ssel, *dev_spi);
+    components[0] = l6470_0 = new L6470(flag_irq, busy_irq, standby_reset, ssel, *dev_spi);
+    components[1] = l6470_1 = new L6470(flag_irq, busy_irq, standby_reset, ssel, *dev_spi);
 }
 
 /**
  * @brief Getting a singleton instance of X_NUCLEO_IHM02A1 class.
  * @param flag_irq      pin name of the FLAG pin of the component.
+ * @param busy_irq      pin name of the BUSY pin of the component.
  * @param standby_reset pin name of the STBY\RST pin of the component.
  * @param ssel          pin name of the SSEL pin of the SPI device to be used for communication.
  * @param spi           SPI device to be used for communication.
  * @retval a singleton instance of X_NUCLEO_IHM02A1 class.
  */
-X_NUCLEO_IHM02A1 *X_NUCLEO_IHM02A1::Instance(PinName flag_irq, PinName standby_reset, PinName ssel, DevSPI *spi)
+X_NUCLEO_IHM02A1 *X_NUCLEO_IHM02A1::Instance(PinName flag_irq, PinName busy_irq, PinName standby_reset, PinName ssel, DevSPI *spi)
 {
     if (_instance == NULL)
     {
@@ -158,7 +160,7 @@
             spi = new DevSPI(X_NUCLEO_IHM02A1_PIN_SPI_MOSI, X_NUCLEO_IHM02A1_PIN_SPI_MISO, X_NUCLEO_IHM02A1_PIN_SPI_SCLK);
 
         /* Instantiating the board. */
-        _instance = new X_NUCLEO_IHM02A1(flag_irq, standby_reset, ssel, spi);
+        _instance = new X_NUCLEO_IHM02A1(flag_irq, busy_irq, standby_reset, ssel, spi);
 
         /* Initializing the components. */
         if (!_instance->Init())
@@ -171,6 +173,7 @@
 /**
  * @brief Getting a singleton instance of X_NUCLEO_IHM02A1 class.
  * @param flag_irq      pin name of the FLAG pin of the component.
+ * @param busy_irq      pin name of the BUSY pin of the component.
  * @param standby_reset pin name of the STBY\RST pin of the component.
  * @param ssel          pin name of the SSEL pin of the SPI device to be used for communication.
  * @param mosi          pin name of the MOSI pin of the SPI device to be used for communication.
@@ -178,7 +181,7 @@
  * @param sclk          pin name of the SCLK pin of the SPI device to be used for communication.
  * @retval a singleton instance of X_NUCLEO_IHM02A1 class.
  */
-X_NUCLEO_IHM02A1 *X_NUCLEO_IHM02A1::Instance(PinName flag_irq, PinName standby_reset, PinName ssel, PinName mosi, PinName miso, PinName sclk)
+X_NUCLEO_IHM02A1 *X_NUCLEO_IHM02A1::Instance(PinName flag_irq, PinName busy_irq, PinName standby_reset, PinName ssel, PinName mosi, PinName miso, PinName sclk)
 {
     if (_instance == NULL)
     {
@@ -186,7 +189,7 @@
         DevSPI *spi = new DevSPI(mosi, miso, sclk);
 
         /* Instantiating the board. */
-        _instance = new X_NUCLEO_IHM02A1(flag_irq, standby_reset, ssel, spi);
+        _instance = new X_NUCLEO_IHM02A1(flag_irq, busy_irq, standby_reset, ssel, spi);
 
         /* Initializing the components. */
         if (!_instance->Init())
--- a/BSP/x_nucleo_ihm02a1_class.h	Fri Nov 20 18:07:45 2015 +0000
+++ b/BSP/x_nucleo_ihm02a1_class.h	Wed Nov 25 11:59:37 2015 +0000
@@ -79,16 +79,18 @@
     /**
      * @brief Getting a singleton instance of X_NUCLEO_IHM02A1 class.
      * @param flag_irq      pin name of the FLAG pin of the component.
+     * @param busy_irq      pin name of the BUSY pin of the component.
      * @param standby_reset pin name of the STBY\RST pin of the component.
      * @param ssel          pin name of the SSEL pin of the SPI device to be used for communication.
      * @param spi           SPI device to be used for communication.
      * @retval a singleton instance of X_NUCLEO_IHM02A1 class.
      */
-    static X_NUCLEO_IHM02A1 *Instance(PinName flag_irq, PinName standby_reset, PinName ssel, DevSPI *spi = NULL);
+    static X_NUCLEO_IHM02A1 *Instance(PinName flag_irq, PinName busy_irq, PinName standby_reset, PinName ssel, DevSPI *spi = NULL);
 
     /**
      * @brief Getting a singleton instance of X_NUCLEO_IHM02A1 class.
      * @param flag_irq      pin name of the FLAG pin of the component.
+     * @param busy_irq      pin name of the BUSY pin of the component.
      * @param standby_reset pin name of the STBY\RST pin of the component.
      * @param ssel          pin name of the SSEL pin of the SPI device to be used for communication.
      * @param mosi          pin name of the MOSI pin of the SPI device to be used for communication.
@@ -96,7 +98,7 @@
      * @param sclk          pin name of the SCLK pin of the SPI device to be used for communication.
      * @retval a singleton instance of X_NUCLEO_IHM02A1 class.
      */
-    static X_NUCLEO_IHM02A1 *Instance(PinName flag_irq, PinName standby_reset, PinName ssel, PinName miso, PinName mosi, PinName sclk);
+    static X_NUCLEO_IHM02A1 *Instance(PinName flag_irq, PinName busy_irq, PinName standby_reset, PinName ssel, PinName miso, PinName mosi, PinName sclk);
 
     /**
      * @brief Initializing the X_NUCLEO_IHM02A1 board.
@@ -109,6 +111,47 @@
      */
     ~X_NUCLEO_IHM02A1(void) {}
 
+    /**
+     * @brief  Getting the array of components.
+     * @param  None.
+     * @retval The array of components.
+     */
+    L6470 **GetComponents(void)
+    {
+        return components;
+    }
+
+    /**
+      * @brief  Performing the actions set on the motors with calls to a number of
+      *         "Prepare<Action>()" methods, one for each motor of the daisy-chain.
+      * @param  None.
+      * @retval A pointer to the results returned by the components, i.e. an
+      *         integer value for each of them.
+      */
+    virtual uint32_t* PerformPreparedActions(void)
+    {
+        /* Performing pre-actions, if needed. */
+        for (int m = 0; m < L6470DAISYCHAINSIZE; m++)
+        {
+            /*
+               "GetPosition()" is needed by "PrepareSetMark()" at the time when the
+               prepared actions get performed.
+            */
+            if (components[m]->GetPreparedAction() == L6470::PREPARED_SET_MARK)
+                components[m]->PrepareSetMark((uint32_t) components[m]->GetPosition());
+        }
+        
+        /* Performing the prepared actions and getting back raw data. */
+        uint8_t *raw_data = components[0]->PerformPreparedActions();
+
+        /* Processing raw data. */
+        for (int m = 0; m < L6470DAISYCHAINSIZE; m++)
+            results[m] = components[m]->GetResult(raw_data);
+
+        /* Returning results. */
+        return results;
+    }
+
 
     /*** Public Expansion Board Related Attributes ***/
 
@@ -135,11 +178,12 @@
     /**
      * @brief Constructor.
      * @param flag_irq      pin name of the FLAG pin of the component.
+     * @param busy_irq      pin name of the BUSY pin of the component.
      * @param standby_reset pin name of the STBY\RST pin of the component.
      * @param ssel          pin name of the SSEL pin of the SPI device to be used for communication.
      * @param spi           SPI device to be used for communication.
      */
-    X_NUCLEO_IHM02A1(PinName flag_irq, PinName standby_reset, PinName ssel, DevSPI *spi);
+    X_NUCLEO_IHM02A1(PinName flag_irq, PinName busy_irq, PinName standby_reset, PinName ssel, DevSPI *spi);
 
 
     /*** Protected Expansion Board Related Initialization Methods ***/
@@ -164,6 +208,12 @@
     /* IO Device. */
     DevSPI *dev_spi;
 
+    /* Components. */
+    L6470 *components[L6470DAISYCHAINSIZE];
+    
+    /* Results of prepared actions. */
+    uint32_t results[L6470DAISYCHAINSIZE];
+
     /* Data. */
     /* ACTION 11 -------------------------------------------------------------*
      * Declare here the component's data, one variable per line.              *
--- a/Components/Common/microstepping_motor.h	Fri Nov 20 18:07:45 2015 +0000
+++ b/Components/Common/microstepping_motor.h	Wed Nov 25 11:59:37 2015 +0000
@@ -92,7 +92,7 @@
   L6470_STEP_MODE_ID,           //!< Step mode
   L6470_ALARM_EN_ID,            //!< Alarm enable
   L6470_CONFIG_ID,              //!< IC configuration
-  L6470_STATUS_ID               //!< Status, (the reset value is according to startup conditions)  
+  L6470_STATUS_ID               //!< Status, (the reset value is according to startup conditions)
 } eL6470_RegId_t;
 
 /**
--- a/Components/Interfaces/Component_class.h	Fri Nov 20 18:07:45 2015 +0000
+++ b/Components/Interfaces/Component_class.h	Wed Nov 25 11:59:37 2015 +0000
@@ -56,16 +56,16 @@
 {
 public:
     /**
-     * @brief       Initialization of the component.
-     * @param[out]  ptr Pointer to device specific initalization structure.
-     * @return      0 in case of success, an error code otherwise.
+     * @brief  Initializing the component.
+     * @param  init Pointer to device specific initalization structure.
+     * @retval "0" in case of success, an error code otherwise.
      */
-    virtual int Init(void *ptr) = 0;
+    virtual int Init(void *init) = 0;
 
     /**
-     * @brief       Get ID of the component.
-     * @param[out]  id Pointer to where to store the ID to.
-     * @return      0 in case of success, an error code otherwise.
+     * @brief  Getting the ID of the component.
+     * @param  id Pointer to an allocated variable to store the ID into.
+     * @retval "0" in case of success, an error code otherwise.
      */
     virtual int ReadID(uint8_t *id) = 0;
 };
--- a/Components/Interfaces/StepperMotor_class.h	Fri Nov 20 18:07:45 2015 +0000
+++ b/Components/Interfaces/StepperMotor_class.h	Wed Nov 25 11:59:37 2015 +0000
@@ -5,7 +5,7 @@
  * @version V1.0.0
  * @date    November 12th, 2015
  * @brief   This file contains the abstract class describing the interface of a
- *          steppermotor component.
+ *          stepper-motor component.
  ******************************************************************************
  * @attention
  *
@@ -63,91 +63,180 @@
     } direction_t;
 
     /**
-     * @brief Getting the status.
+     * @brief  Getting the status.
      * @param  None.
-     * @retval None.
+     * @retval The status.
      */
     virtual unsigned int GetStatus(void) = 0;
 
-   /**
+    /**
      * @brief  Getting a parameter.
-     * @param  parameter register adress.
-     * @retval a register value.
+     * @param  parameter The parameter's identifier (or its register address).
+     * @retval The parameter's value.
      */
     virtual unsigned int GetParameter(unsigned int parameter) = 0;
 
-    /* Return the current position. */
+    /**
+     * @brief  Getting the position.
+     * @param  None.
+     * @retval The position.
+     */
     virtual signed int GetPosition(void) = 0;
 
-    /* Return the mark position. */
+    /**
+     * @brief  Getting the marked position.
+     * @param  None.
+     * @retval The marked position.
+     */
     virtual signed int GetMark(void) = 0;
 
-    /* Return the current speed in pps. */
+    /**
+     * @brief  Getting the current speed in pps.
+     * @param  None.
+     * @retval The current speed in pps.
+     */
     virtual unsigned int GetSpeed(void) = 0;
 
-    /* Return the maximum speed in pps. */
+    /**
+     * @brief  Getting the maximum speed in pps.
+     * @param  None.
+     * @retval The maximum speed in pps.
+     */
     virtual unsigned int GetMaxSpeed(void) = 0;
 
-    /* Return the minimum speed in pps. */
+    /**
+     * @brief  Getting the minimum speed in pps.
+     * @param  None.
+     * @retval The minimum speed in pps.
+     */
     virtual unsigned int GetMinSpeed(void) = 0;
 
-    /* Return the acceleration in pps^2. */
+    /**
+     * @brief  Getting the acceleration in pps^2.
+     * @param  None.
+     * @retval The acceleration in pps^2.
+     */
     virtual unsigned int GetAcceleration(void) = 0;
 
-    /* Return the deceleration in pps^2. */
+    /**
+     * @brief  Getting the deceleration in pps^2.
+     * @param  None.
+     * @retval The deceleration in pps^2.
+     */
     virtual unsigned int GetDeceleration(void) = 0;
 
-    /* Get the current direction of rotation. */
+    /**
+     * @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 register adress.
-     * @param  value value to be set.
+     * @param  parameter The parameter's identifier (or its register address).
+     * @param  value The parameter's value.
      * @retval None.
      */
     virtual void SetParameter(unsigned int parameter, unsigned int value) = 0;
 
-    /* Set the current position to be the home position. */
+    /**
+     * @brief  Setting the current position to be the home position.
+     * @param  None.
+     * @retval None.
+     */
     virtual void SetHome(void) = 0;
 
-    /* Set the current position to be the mark position. */
+    /**
+     * @brief  Setting the current position to be the marked position.
+     * @param  None.
+     * @retval None.
+     */
     virtual void SetMark(void) = 0;
 
-    /* Set the maximum speed in pps. */
+    /**
+     * @brief  Setting the maximum speed in pps.
+     * @param  speed The maximum speed in pps.
+     * @retval None.
+     */
     virtual void SetMaxSpeed(unsigned int speed) = 0;
 
-    /* Set the minimum speed in pps. */
+    /**
+     * @brief  Setting the minimum speed in pps.
+     * @param  speed The minimum speed in pps.
+     * @retval None.
+     */
     virtual void SetMinSpeed(unsigned int speed) = 0;
 
-    /* Set the acceleration in pps^2. */
+    /**
+     * @brief  Setting the acceleration in pps^2.
+     * @param  acceleration The acceleration in pps^2.
+     * @retval None.
+     */
     virtual void SetAcceleration(unsigned int acceleration) = 0;
 
-    /* Set the deceleration in pps^2. */
+    /**
+     * @brief  Setting the deceleration in pps^2.
+     * @param  deceleration The deceleration in pps^2.
+     * @retval None.
+     */
     virtual void SetDeceleration(unsigned int deceleration) = 0;
 
-    /* Go to the specified position. */
+    /**
+     * @brief  Going to a specified position.
+     * @param  position The desired position.
+     * @retval None.
+     */
     virtual void GoTo(signed int position) = 0;
 
-    /* Go to the home position. */
+    /**
+     * @brief  Going to the home position.
+     * @param  None.
+     * @retval None.
+     */
     virtual void GoHome(void) = 0;
 
-    /* Go to the marked position. */
+    /**
+     * @brief  Going to the marked position.
+     * @param  None.
+     * @retval None.
+     */
     virtual void GoMark(void) = 0;
 
-    /* Run the motor towards a specified direction. */
+    /**
+     * @brief  Running the motor towards a specified direction.
+     * @param  direction The direction of rotation.
+     * @retval None.
+     */
     virtual void Run(direction_t direction) = 0;
 
-    /* Run the motor towards a specified direction for a specified number of steps. */
+    /**
+     * @brief  Moving the motor towards a specified direction for a certain number of steps.
+     * @param  direction The direction of rotation.
+     * @param  steps The desired number of steps.
+     * @retval None.
+     */
     virtual void Move(direction_t direction, unsigned int steps) = 0;
 
-    /* Stop the motor. */
+    /**
+     * @brief  Stopping the motor.
+     * @param  None.
+     * @retval None.
+     */
     virtual void SoftStop(void) = 0;
 
-    /* Stop the motor and disable the power bridge. */
+    /**
+     * @brief  Stopping the motor and disabling the power bridge.
+     * @param  None.
+     * @retval None.
+     */
     virtual void HardStop(void) = 0;
 
-    /* Wait while the motor is active. */
+    /**
+     * @brief  Waiting while the motor is active.
+     * @param  None.
+     * @retval None.
+     */
     virtual void WaitWhileActive(void) = 0;
 };
 
--- a/Components/l6470/l6470_class.cpp	Fri Nov 20 18:07:45 2015 +0000
+++ b/Components/l6470/l6470_class.cpp	Wed Nov 25 11:59:37 2015 +0000
@@ -1082,7 +1082,7 @@
   */
 void L6470::L6470_PrepareSetParam(eL6470_RegId_t L6470_RegId, uint32_t Value)
 {
-  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_SETPARAM_ID, L6470_RegId, Value, 0);
+    L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_SETPARAM_ID, L6470_RegId, Value, 0);
 }
 
 /**
@@ -1098,7 +1098,7 @@
   */
 void L6470::L6470_PrepareGetParam(eL6470_RegId_t L6470_RegId)
 {
-  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_GETPARAM_ID, L6470_RegId, 0, 0);
+    L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_GETPARAM_ID, L6470_RegId, 0, 0);
 }
 
 /**
@@ -1365,7 +1365,7 @@
   {
     value |= (*(pL6470_DaisyChainSpiRxStruct+(i*L6470DAISYCHAINSIZE)+L6470_Id))<<((LengthByte-i)*8);
   }
-  
+
   return value;
 }
 
--- a/Components/l6470/l6470_class.h	Fri Nov 20 18:07:45 2015 +0000
+++ b/Components/l6470/l6470_class.h	Wed Nov 25 11:59:37 2015 +0000
@@ -81,16 +81,37 @@
 {
 public:
 
+    /*** Public Component Related Types ***/
+
+    /**
+     * @brief Prepared Actions.
+     */
+    typedef enum
+    {
+        PREPARED_NO_ACTION = 0,
+        PREPARED_GET_POSITION,
+        PREPARED_GET_MARK,
+        PREPARED_GET_SPEED,
+        PREPARED_GET_MAX_SPEED,
+        PREPARED_GET_MIN_SPEED,
+        PREPARED_GET_ACCELERATION,
+        PREPARED_GET_DECELERATION,
+        PREPARED_GET_DIRECTION,
+        PREPARED_SET_MARK
+    } prepared_action_t;
+
+
     /*** Constructor and Destructor Methods ***/
 
     /**
      * @brief Constructor.
      * @param flag_irq      pin name of the FLAG pin of the component.
+     * @param busy_irq      pin name of the BUSY pin of the component.
      * @param standby_reset pin name of the STBY\RST pin of the component.
      * @param ssel          pin name of the SSEL pin of the SPI device to be used for communication.
      * @param spi           SPI device to be used for communication.
      */
-    L6470(PinName flag_irq, PinName standby_reset, PinName ssel, DevSPI &spi) : StepperMotor(), flag_irq(flag_irq), standby_reset(standby_reset), ssel(ssel), dev_spi(spi)
+    L6470(PinName flag_irq, PinName busy_irq, PinName standby_reset, PinName ssel, DevSPI &spi) : StepperMotor(), flag_irq(flag_irq), busy_irq(busy_irq), standby_reset(standby_reset), ssel(ssel), dev_spi(spi)
     {
         /* ACTION 4 ----------------------------------------------------------*
          * Initialize here the component's member variables, one variable per *
@@ -107,6 +128,7 @@
         L6470_Direction = &_L6470_Direction[0];
         L6470_ACT = &_L6470_ACT[0];
         pL6470_StatusRegister = &L6470_StatusRegister;
+        prepared_action = PREPARED_NO_ACTION;
         L6470_Id = number_of_devices++;
         L6470_DaisyChain_HalfPrepared = ZERO_F;
         memset(L6470_AppCmdPkg, 0, L6470DAISYCHAINSIZE * sizeof(sL6470_AppCmdPkg_t));
@@ -142,348 +164,888 @@
      *     return COMPONENT_EnableFeature();                                  *
      *   }                                                                    *
      *------------------------------------------------------------------------*/
+    /**
+     * @brief  Initializing the component.
+     * @param  init Pointer to device specific initalization structure.
+     * @retval "0" in case of success, an error code otherwise.
+     */
     virtual int Init(void *init)
     {
         return (int) L6470_Config((MICROSTEPPING_MOTOR_InitTypeDef *) init);
     }
 
+    /**
+     * @brief  Getting the ID of the component.
+     * @param  id Pointer to an allocated variable to store the ID into.
+     * @retval "0" in case of success, an error code otherwise.
+     */
     virtual int ReadID(uint8_t *id)
     {
         return (int) 0;
     }
 
+    /**
+     * @brief  Getting the status.
+     * @param  None.
+     * @retval The status.
+     */
     virtual unsigned int GetStatus(void)
     {
         return (unsigned int) L6470_GetStatus();
     }
-    
+
+    /**
+     * @brief  Getting a parameter.
+     * @param  parameter The parameter's identifier (or its register address).
+     * @retval The parameter's value.
+     */
     virtual unsigned int GetParameter(unsigned int parameter)
     {
         return (unsigned int) L6470_GetParam((eL6470_RegId_t) parameter);
     }
 
+    /**
+     * @brief  Getting the position.
+     * @param  None.
+     * @retval The position.
+     */
     virtual signed int GetPosition(void)
     {
-        return (signed int) L6470_GetParam((eL6470_RegId_t) L6470_ABS_POS_ID);
+        return (signed int) L6470_AbsPos_2_Position((uint32_t) L6470_GetParam((eL6470_RegId_t) L6470_ABS_POS_ID));
     }
 
+    /**
+     * @brief  Getting the marked position.
+     * @param  None.
+     * @retval The marked position.
+     */
     virtual signed int GetMark(void)
     {
-        return (signed int) L6470_GetParam((eL6470_RegId_t) L6470_MARK_ID);
+        return (signed int) L6470_AbsPos_2_Position((uint32_t) L6470_GetParam((eL6470_RegId_t) L6470_MARK_ID));
     }
 
+    /**
+     * @brief  Getting the current speed in pps.
+     * @param  None.
+     * @retval The current speed in pps.
+     */
     virtual unsigned int GetSpeed(void)
     {
-        return (unsigned int) L6470_GetParam((eL6470_RegId_t) L6470_SPEED_ID);
+        return round(L6470_Speed_2_Step_s((unsigned int) L6470_GetParam((eL6470_RegId_t) L6470_SPEED_ID)));
     }
 
+    /**
+     * @brief  Getting the maximum speed in pps.
+     * @param  None.
+     * @retval The maximum speed in pps.
+     */
     virtual unsigned int GetMaxSpeed(void)
     {
-        return (unsigned int) L6470_GetParam((eL6470_RegId_t) L6470_MAX_SPEED_ID);
+        return round(L6470_MaxSpeed_2_Step_s((unsigned int) L6470_GetParam((eL6470_RegId_t) L6470_MAX_SPEED_ID)));
     }
 
+    /**
+     * @brief  Getting the minimum speed in pps.
+     * @param  None.
+     * @retval The minimum speed in pps.
+     */
     virtual unsigned int GetMinSpeed(void)
     {
-        return (unsigned int) L6470_GetParam((eL6470_RegId_t) L6470_MIN_SPEED_ID);
+        return round(L6470_MinSpeed_2_Step_s((unsigned int) L6470_GetParam((eL6470_RegId_t) L6470_MIN_SPEED_ID)));
     }
 
+    /**
+     * @brief  Getting the acceleration in pps^2.
+     * @param  None.
+     * @retval The acceleration in pps^2.
+     */
     virtual unsigned int GetAcceleration(void)
     {
-        return (unsigned int) L6470_GetParam((eL6470_RegId_t) L6470_ACC_ID);
+        return round(L6470_Acc_2_Step_s2((unsigned int) L6470_GetParam((eL6470_RegId_t) L6470_ACC_ID)));
     }
 
+    /**
+     * @brief  Getting the deceleration in pps^2.
+     * @param  None.
+     * @retval The deceleration in pps^2.
+     */
     virtual unsigned int GetDeceleration(void)
     {
-        return (unsigned int) L6470_GetParam((eL6470_RegId_t) L6470_DEC_ID);
+        return round(L6470_Dec_2_Step_s2((unsigned int) L6470_GetParam((eL6470_RegId_t) L6470_DEC_ID)));
     }
 
+    /**
+     * @brief  Getting the direction of rotation.
+     * @param  None.
+     * @retval The direction of rotation.
+     */
     virtual direction_t GetDirection(void)
     {
         return (direction_t) (L6470_CheckStatusRegisterFlag((eL6470_StatusRegisterFlagId_t) DIR_ID) == 1 ? StepperMotor::FWD : StepperMotor::BWD);
     }
 
+   /**
+     * @brief  Setting a parameter.
+     * @param  parameter The parameter's identifier (or its register address).
+     * @param  value The parameter's value.
+     * @retval None.
+     */
     virtual void SetParameter(unsigned int parameter, unsigned int value)
     {
         L6470_SetParam((eL6470_RegId_t) parameter, (uint32_t) value);
     }
 
+    /**
+     * @brief  Setting the current position to be the home position.
+     * @param  None.
+     * @retval None.
+     */
     virtual void SetHome(void)
     {
         L6470_ResetPos();
-        //L6470_SetParam((eL6470_RegId_t) L6470_ABS_POS_ID, (uint32_t) 0);
     }
 
+    /**
+     * @brief  Setting the current position to be the marked position.
+     * @param  None.
+     * @retval None.
+     */
     virtual void SetMark(void)
     {
         L6470_SetParam((eL6470_RegId_t) L6470_MARK_ID, (uint32_t) L6470_GetParam((eL6470_RegId_t) L6470_ABS_POS_ID));
-        //L6470_SetParam((eL6470_RegId_t) L6470_MARK_ID, (uint32_t) 0);
     }
 
+    /**
+     * @brief  Setting the current position to be the marked position.
+     * @param  position The given position.
+     * @retval None.
+     */
+    virtual void SetMark(signed int position)
+    {
+        L6470_SetParam((eL6470_RegId_t) L6470_MARK_ID, (uint32_t) L6470_Position_2_AbsPos((int32_t) position));
+    }
+
+    /**
+     * @brief  Setting the maximum speed in pps.
+     * @param  speed The maximum speed in pps.
+     * @retval None.
+     */
     virtual void SetMaxSpeed(unsigned int speed)
     {
-        L6470_SetParam((eL6470_RegId_t) L6470_MAX_SPEED_ID, (uint32_t) speed);
+        L6470_SetParam((eL6470_RegId_t) L6470_MAX_SPEED_ID, (uint32_t) L6470_Step_s_2_MaxSpeed((float) speed));
     }
 
+    /**
+     * @brief  Setting the minimum speed in pps.
+     * @param  speed The minimum speed in pps.
+     * @retval None.
+     */
     virtual void SetMinSpeed(unsigned int speed)
     {
-        L6470_SetParam((eL6470_RegId_t) L6470_MIN_SPEED_ID, (uint32_t) speed);
+        L6470_SetParam((eL6470_RegId_t) L6470_MIN_SPEED_ID, (uint32_t) L6470_Step_s_2_MinSpeed((float) speed));
     }
 
+    /**
+     * @brief  Setting the acceleration in pps^2.
+     * @param  acceleration The acceleration in pps^2.
+     * @retval None.
+     */
     virtual void SetAcceleration(unsigned int acceleration)
     {
-        L6470_SetParam((eL6470_RegId_t) L6470_ACC_ID, (uint32_t) acceleration);
+        L6470_SetParam((eL6470_RegId_t) L6470_ACC_ID, (uint32_t) L6470_Step_s2_2_Acc((float) acceleration));
     }
 
+    /**
+     * @brief  Setting the deceleration in pps^2.
+     * @param  deceleration The deceleration in pps^2.
+     * @retval None.
+     */
     virtual void SetDeceleration(unsigned int deceleration)
     {
-        L6470_SetParam((eL6470_RegId_t) L6470_DEC_ID, (uint32_t) deceleration);
+        L6470_SetParam((eL6470_RegId_t) L6470_DEC_ID, (uint32_t) L6470_Step_s2_2_Dec((float) deceleration));
     }
 
+    /**
+     * @brief  Going to a specified position through the shortest path.
+     * @param  position The desired position.
+     * @retval None.
+     */
     virtual void GoTo(signed int position)
     {
-        L6470_GoTo((uint32_t) position);
+        L6470_GoTo((uint32_t) L6470_Position_2_AbsPos((int32_t) position));
     }
 
+    /**
+     * @brief  Going to a specified position imposing the desired direction.
+     * @param  position The desired position.
+     * @param  direction The direction of rotation.
+     * @retval None.
+     */
     virtual void GoTo(signed int position, direction_t direction)
     {
-        L6470_GoToDir((eL6470_DirId_t) (direction == StepperMotor::FWD ? L6470_DIR_FWD_ID : L6470_DIR_REV_ID), (signed int) position);
+        L6470_GoToDir((eL6470_DirId_t) (direction == StepperMotor::FWD ? L6470_DIR_FWD_ID : L6470_DIR_REV_ID), (uint32_t) L6470_Position_2_AbsPos((int32_t) position));
     }
 
+    /**
+     * @brief  Going to the home position.
+     * @param  None.
+     * @retval None.
+     */
     virtual void GoHome(void)
     {
         L6470_GoHome();
     }
 
+    /**
+     * @brief  Going to the marked position.
+     * @param  None.
+     * @retval None.
+     */
     virtual void GoMark(void)
     {
         L6470_GoMark();
     }
 
-    virtual void GoUntil(eL6470_ActId_t L6470_ActId, direction_t direction, unsigned int speed)
+    /**
+     * @brief  Running at the given speed imposing the desired direction until
+     *         an external switch turn-on event occurs.
+     * @param  action The identifier of the action about the absolute position.
+     * @param  position The desired position.
+     * @param  speed The speed value in pps.
+     * @retval None.
+     * @note   The identifier of the action about the absolute position can be
+     *         one of the following:
+     *           + L6470_ACT_RST_ID: the absolute position is reset;
+     *           + L6470_ACT_CPY_ID: the absolute position is set as the marked position.
+     */
+    virtual void GoUntil(eL6470_ActId_t action, direction_t direction, unsigned int speed)
     {
-        L6470_GoUntil((eL6470_ActId_t) L6470_ActId, (eL6470_DirId_t) (direction == StepperMotor::FWD ? L6470_DIR_FWD_ID : L6470_DIR_REV_ID), (unsigned int) speed);
+        L6470_GoUntil((eL6470_ActId_t) action, (eL6470_DirId_t) (direction == StepperMotor::FWD ? L6470_DIR_FWD_ID : L6470_DIR_REV_ID), (unsigned int) L6470_Step_s_2_Speed((float) speed));
     }
 
+    /**
+     * @brief  Running towards a specified direction.
+     * @param  direction The direction of rotation.
+     * @retval None.
+     */
     virtual void Run(direction_t direction)
     {
         L6470_Run((eL6470_DirId_t) (direction == StepperMotor::FWD ? L6470_DIR_FWD_ID : L6470_DIR_REV_ID), (unsigned int) L6470_GetParam((eL6470_RegId_t) L6470_MAX_SPEED_ID));
     }
 
+    /**
+     * @brief  Running towards a specified direction at the given speed.
+     * @param  direction The direction of rotation.
+     * @param  speed The speed value in pps.
+     * @retval None.
+     */
     virtual void Run(direction_t direction, unsigned int speed)
     {
-        L6470_Run((eL6470_DirId_t) (direction == StepperMotor::FWD ? L6470_DIR_FWD_ID : L6470_DIR_REV_ID), (unsigned int) speed);
+        L6470_Run((eL6470_DirId_t) (direction == StepperMotor::FWD ? L6470_DIR_FWD_ID : L6470_DIR_REV_ID), (unsigned int) L6470_Step_s_2_Speed((float) speed));
     }
 
+    /**
+     * @brief  Moving towards a specified direction for a certain number of steps.
+     * @param  direction The direction of rotation.
+     * @param  steps The desired number of steps.
+     * @retval None.
+     */
     virtual void Move(direction_t direction, unsigned int steps)
     {
         L6470_Move((eL6470_DirId_t) (direction == StepperMotor::FWD ? L6470_DIR_FWD_ID : L6470_DIR_REV_ID), (unsigned int) steps);
     }
 
+    /**
+     * @brief  Stopping the motor through an immediate deceleration up to zero speed.
+     *         The used deceleration value is the one stored in the "DEC" register.
+     * @param  None.
+     * @retval None.
+     */
     virtual void SoftStop(void)
     {
         L6470_SoftStop();
     }
 
+    /**
+     * @brief  Stopping the motor through an immediate infinite deceleration.
+     * @param  None.
+     * @retval None.
+     */
     virtual void HardStop(void)
     {
         L6470_HardStop();
     }
 
+    /**
+     * @brief  Disabling the power bridge after performing a deceleration to zero.
+     *         The used deceleration value is the one stored in the "DEC" register.
+     * @param  None.
+     * @retval None.
+     */
+    virtual void SoftHiZ(void)
+    {
+        L6470_SoftHiZ();
+    }
+
+    /**
+     * @brief  Disabling the power bridge immediately.
+     * @param  None.
+     * @retval None.
+     */
+    virtual void HardHiZ(void)
+    {
+        L6470_HardHiZ();
+    }
+
+    /**
+     * @brief  Waiting while the motor is active.
+     * @param  None.
+     * @retval None.
+     */
     virtual void WaitWhileActive(void)
     {
         while (L6470_CheckStatusRegisterFlag(BUSY_ID) == 0);
     }
 
-    virtual void SoftHiZ(void)
-    {
-        L6470_SoftHiZ();
-    }
-
-    virtual void HardHiZ(void)
-    {
-        L6470_HardHiZ();
-    }
-
+    /**
+      * @brief  Switching to step-clock mode.
+      * @param  direction The direction of rotation.
+      * @retval None.
+      */
     virtual void StepClock(direction_t direction)
     {
         L6470_StepClock((eL6470_DirId_t) (direction == StepperMotor::FWD ? L6470_DIR_FWD_ID : L6470_DIR_REV_ID));
     }
 
-    virtual void ReleaseSW(eL6470_ActId_t L6470_ActId, direction_t direction)
+    /**
+      * @brief  Doing a motion at minimum speed imposing a specified direction
+      *         until the SW is released.
+      * @param  action The identifier of the action about the absolute position.
+      * @param  direction The direction of rotation.
+      * @note   The identifier of the action about the absolute position can be
+      *         one of the following:
+      *           + L6470_ACT_RST_ID: the absolute position is reset;
+      *           + L6470_ACT_CPY_ID: the absolute position is set as the marked position.
+      */
+    virtual void ReleaseSW(eL6470_ActId_t action, direction_t direction)
     {
-        L6470_ReleaseSW((eL6470_ActId_t) L6470_ActId, (eL6470_DirId_t) (direction == StepperMotor::FWD ? L6470_DIR_FWD_ID : L6470_DIR_REV_ID));
+        L6470_ReleaseSW((eL6470_ActId_t) action, (eL6470_DirId_t) (direction == StepperMotor::FWD ? L6470_DIR_FWD_ID : L6470_DIR_REV_ID));
     }
 
+    /**
+      * @brief  Resetting the device to power-up conditions.
+      * @param  None.
+      * @retval None.
+      */
     virtual void ResetDevice(void)
     {
         L6470_ResetDevice();
     }
 
+    /**
+     * @brief  Preparing the command to get the status.
+     * @param  None.
+     * @retval None.
+     * @note   The command will be sent by issuing "PerformAction()".
+     */
     virtual void PrepareGetStatus(void)
     {
         L6470_PrepareGetStatus();
+        prepared_action = PREPARED_NO_ACTION;
     }
 
+    /**
+     * @brief  Preparing the command to get a parameter.
+     * @param  parameter The parameter's identifier (or its register address).
+     * @retval None.
+     * @note   The command will be sent by issuing "PerformAction()".
+     */
     virtual void PrepareGetParameter(unsigned int parameter)
     {
         L6470_PrepareGetParam((eL6470_RegId_t) parameter);
+        prepared_action = PREPARED_NO_ACTION;
     }
 
+    /**
+     * @brief  Preparing the command to get the position.
+     * @param  None.
+     * @retval None.
+     * @note   The command will be sent by issuing "PerformAction()".
+     */
     virtual void PrepareGetPosition(void)
     {
         L6470_PrepareGetParam((eL6470_RegId_t) L6470_ABS_POS_ID);
+        prepared_action = PREPARED_GET_POSITION;
     }
 
+    /**
+     * @brief  Preparing the command to get the marked position.
+     * @param  None.
+     * @retval None.
+     * @note   The command will be sent by issuing "PerformAction()".
+     */
     virtual void PrepareGetMark(void)
     {
         L6470_PrepareGetParam((eL6470_RegId_t) L6470_MARK_ID);
+        prepared_action = PREPARED_GET_MARK;
     }
 
+    /**
+     * @brief  Preparing the command to get the current speed in pps.
+     * @param  None.
+     * @retval None.
+     * @note   The command will be sent by issuing "PerformAction()".
+     */
     virtual void PrepareGetSpeed(void)
     {
-        L6470_GetParam((eL6470_RegId_t) L6470_SPEED_ID);
+        L6470_PrepareGetParam((eL6470_RegId_t) L6470_SPEED_ID);
+        prepared_action = PREPARED_GET_SPEED;
     }
 
+    /**
+     * @brief  Preparing the command to get the maximum speed in pps.
+     * @param  None.
+     * @retval None.
+     * @note   The command will be sent by issuing "PerformAction()".
+     */
     virtual void PrepareGetMaxSpeed(void)
     {
         L6470_PrepareGetParam((eL6470_RegId_t) L6470_MAX_SPEED_ID);
+        prepared_action = PREPARED_GET_MAX_SPEED;
     }
 
+    /**
+     * @brief  Preparing the command to get the minimum speed in pps.
+     * @param  None.
+     * @retval None.
+     * @note   The command will be sent by issuing "PerformAction()".
+     */
     virtual void PrepareGetMinSpeed(void)
     {
         L6470_PrepareGetParam((eL6470_RegId_t) L6470_MIN_SPEED_ID);
+        prepared_action = PREPARED_GET_MIN_SPEED;
     }
 
+    /**
+     * @brief  Preparing the command to get the acceleration in pps^2.
+     * @param  None.
+     * @retval None.
+     * @note   The command will be sent by issuing "PerformAction()".
+     */
     virtual void PrepareGetAcceleration(void)
     {
         L6470_PrepareGetParam((eL6470_RegId_t) L6470_ACC_ID);
+        prepared_action = PREPARED_GET_ACCELERATION;
     }
 
+    /**
+     * @brief  Preparing the command to get the deceleration in pps^2.
+     * @param  None.
+     * @retval None.
+     * @note   The command will be sent by issuing "PerformAction()".
+     */
     virtual void PrepareGetDeceleration(void)
     {
         L6470_PrepareGetParam((eL6470_RegId_t) L6470_DEC_ID);
+        prepared_action = PREPARED_GET_DECELERATION;
     }
 
-    virtual direction_t PrepareGetDirection(void)
+    /**
+     * @brief  Preparing the command to get the direction of rotation.
+     * @param  None.
+     * @retval None.
+     * @note   The command will be sent by issuing "PerformAction()".
+     */
+    virtual void PrepareGetDirection(void)
     {
-        return (direction_t) (L6470_CheckStatusRegisterFlag((eL6470_StatusRegisterFlagId_t) DIR_ID) == 1 ? StepperMotor::FWD : StepperMotor::BWD);
+        if (!L6470_DaisyChain_HalfPrepared)
+        {
+            /* To avoid deleting the previous entered command. */
+            L6470_DaisyChain_HalfPrepared = ONE_F;
+            /* Resetting commands. */
+            L6470_ResetAppCmdPkg(L6470_AppCmdPkg);
+        }
+        prepared_action = PREPARED_GET_DIRECTION;
     }
 
+   /**
+     * @brief  Preparing the command to set a parameter.
+     * @param  parameter The parameter's identifier (or its register address).
+     * @param  value The parameter's value.
+     * @retval None.
+     * @note   The command will be sent by issuing "PerformAction()".
+     */
     virtual void PrepareSetParameter(unsigned int parameter, unsigned int value)
     {
         L6470_PrepareSetParam((eL6470_RegId_t) parameter, (uint32_t) value);
+        prepared_action = PREPARED_NO_ACTION;
     }
 
+    /**
+     * @brief  Preparing the command to set the current position to be
+     *         the home position.
+     * @param  None.
+     * @retval None.
+     * @note   The command will be sent by issuing "PerformAction()".
+     */
     virtual void PrepareSetHome(void)
     {
         L6470_PrepareResetPos();
-        //L6470_SetParam((eL6470_RegId_t) L6470_ABS_POS_ID, (uint32_t) 0);
+        prepared_action = PREPARED_NO_ACTION;
     }
 
+    /**
+     * @brief  Preparing the command to set the current position to be
+     *         the marked position.
+     * @param  None.
+     * @retval None.
+     * @note   The command will be sent by issuing "PerformAction()".
+     */
     virtual void PrepareSetMark(void)
     {
-        uint32_t mark = L6470_GetParam((eL6470_RegId_t) L6470_ABS_POS_ID);
-        L6470_PrepareSetParam((eL6470_RegId_t) L6470_MARK_ID, mark);
+        /*
+           Set "0" now as marked position. This value will be replaced by the
+           actual position read at the time when the prepared actions will be
+           performed.
+        */
+        L6470_PrepareSetParam((eL6470_RegId_t) L6470_MARK_ID, 0);
+        prepared_action = PREPARED_SET_MARK;
     }
 
+    /**
+     * @brief  Preparing the command to set the given position to be
+     *         the marked position.
+     * @param  position The given position.
+     * @retval None.
+     * @note   The command will be sent by issuing "PerformAction()".
+     */
+    virtual void PrepareSetMark(signed int position)
+    {
+        L6470_PrepareSetParam((eL6470_RegId_t) L6470_MARK_ID, (uint32_t) L6470_Position_2_AbsPos((int32_t) position));
+        prepared_action = PREPARED_NO_ACTION;
+    }
+
+    /**
+     * @brief  Preparing the command to set the current speed in pps.
+     * @param  speed The current speed in pps.
+     * @retval None.
+     * @note   The command will be sent by issuing "PerformAction()".
+     */
+    virtual void PrepareSetSpeed(unsigned int speed)
+    {
+        L6470_PrepareSetParam((eL6470_RegId_t) L6470_SPEED_ID, (uint32_t) L6470_Step_s_2_Speed((float) speed));
+        prepared_action = PREPARED_NO_ACTION;
+    }
+
+    /**
+     * @brief  Preparing the command to set the maximum speed in pps.
+     * @param  speed The maximum speed in pps.
+     * @retval None.
+     * @note   The command will be sent by issuing "PerformAction()".
+     */
     virtual void PrepareSetMaxSpeed(unsigned int speed)
     {
-        L6470_PrepareSetParam((eL6470_RegId_t) L6470_MAX_SPEED_ID, (uint32_t) speed);
-    }
-
-    virtual void PrepareSetMinSpeed(unsigned int speed)
-    {
-        L6470_PrepareSetParam((eL6470_RegId_t) L6470_MIN_SPEED_ID, (uint32_t) speed);
+        L6470_PrepareSetParam((eL6470_RegId_t) L6470_MAX_SPEED_ID, (uint32_t) L6470_Step_s_2_MaxSpeed((float) speed));
+        prepared_action = PREPARED_NO_ACTION;
     }
 
+    /**
+     * @brief  Preparing the command to set the minimum speed in pps.
+     * @param  speed The minimum speed in pps.
+     * @retval None.
+     * @note   The command will be sent by issuing "PerformAction()".
+     */
+    virtual void PrepareSetMinSpeed(unsigned int speed)
+    {
+        L6470_PrepareSetParam((eL6470_RegId_t) L6470_MIN_SPEED_ID, (uint32_t) L6470_Step_s_2_MinSpeed((float) speed));
+        prepared_action = PREPARED_NO_ACTION;
+    }
+
+    /**
+     * @brief  Preparing the command to set the acceleration in pps^2.
+     * @param  acceleration The acceleration in pps^2.
+     * @retval None.
+     * @note   The command will be sent by issuing "PerformAction()".
+     */
     virtual void PrepareSetAcceleration(unsigned int acceleration)
     {
-        L6470_PrepareSetParam((eL6470_RegId_t) L6470_ACC_ID, (uint32_t) acceleration);
-    }
-
-    virtual void PrepareSetDeceleration(unsigned int deceleration)
-    {
-        L6470_PrepareSetParam((eL6470_RegId_t) L6470_DEC_ID, (uint32_t) deceleration);
+        L6470_PrepareSetParam((eL6470_RegId_t) L6470_ACC_ID, (uint32_t) L6470_Step_s2_2_Acc((float) acceleration));
+        prepared_action = PREPARED_NO_ACTION;
     }
 
-    virtual void PrepareGoTo(signed int position)
+    /**
+     * @brief  Preparing the command to set the deceleration in pps^2.
+     * @param  deceleration The deceleration in pps^2.
+     * @retval None.
+     * @note   The command will be sent by issuing "PerformAction()".
+     */
+    virtual void PrepareSetDeceleration(unsigned int deceleration)
     {
-        L6470_PrepareGoTo((uint32_t) position);
+        L6470_PrepareSetParam((eL6470_RegId_t) L6470_DEC_ID, (uint32_t) L6470_Step_s2_2_Dec((float) deceleration));
+        prepared_action = PREPARED_NO_ACTION;
     }
 
+    /**
+     * @brief  Preparing the command to go to a specified position.
+     * @param  position The desired position.
+     * @retval None.
+     * @note   The command will be sent by issuing "PerformAction()".
+     */
+    virtual void PrepareGoTo(signed int position)
+    {
+        L6470_PrepareGoTo((uint32_t) L6470_Position_2_AbsPos((int32_t) position));
+        prepared_action = PREPARED_NO_ACTION;
+    }
+
+    /**
+     * @brief  Preparing the command to go to a specified position
+     *         imposing the desired direction.
+     * @param  position The desired position.
+     * @param  direction The direction of rotation.
+     * @retval None.
+     * @note   The command will be sent by issuing "PerformAction()".
+     */
     virtual void PrepareGoTo(signed int position, direction_t direction)
     {
-        L6470_PrepareGoToDir((eL6470_DirId_t) (direction == StepperMotor::FWD ? L6470_DIR_FWD_ID : L6470_DIR_REV_ID), (signed int) position);
+        L6470_PrepareGoToDir((eL6470_DirId_t) (direction == StepperMotor::FWD ? L6470_DIR_FWD_ID : L6470_DIR_REV_ID), (uint32_t) L6470_Position_2_AbsPos((int32_t) position));
+        prepared_action = PREPARED_NO_ACTION;
     }
 
+    /**
+     * @brief  Preparing the command to go to the home position.
+     * @param  None.
+     * @retval None.
+     * @note   The command will be sent by issuing "PerformAction()".
+     */
     virtual void PrepareGoHome(void)
     {
         L6470_PrepareGoHome();
+        prepared_action = PREPARED_NO_ACTION;
     }
 
+    /**
+     * @brief  Preparing the command to go to the marked position.
+     * @param  None.
+     * @retval None.
+     * @note   The command will be sent by issuing "PerformAction()".
+     */
     virtual void PrepareGoMark(void)
     {
         L6470_PrepareGoMark();
+        prepared_action = PREPARED_NO_ACTION;
     }
 
+    /**
+     * @brief  Preparing the command to run at the given speed imposing the desired
+     *         direction until an external switch turn-on event occurs.
+     * @param  action The identifier of the action about the absolute position.
+     * @param  position The desired position.
+     * @param  speed The speed value in pps.
+     * @retval None.
+     * @note   The command will be sent by issuing "PerformAction()".
+     *         The identifier of the action about the absolute position can be
+     *         one of the following:
+     *           + L6470_ACT_RST_ID: the absolute position is reset;
+     *           + L6470_ACT_CPY_ID: the absolute position is set as the marked position.
+     */
     virtual void PrepareGoUntil(eL6470_ActId_t L6470_ActId, direction_t direction, unsigned int speed)
     {
-        L6470_PrepareGoUntil((eL6470_ActId_t) L6470_ActId, (eL6470_DirId_t) (direction == StepperMotor::FWD ? L6470_DIR_FWD_ID : L6470_DIR_REV_ID), (unsigned int) speed);
+        L6470_PrepareGoUntil((eL6470_ActId_t) L6470_ActId, (eL6470_DirId_t) (direction == StepperMotor::FWD ? L6470_DIR_FWD_ID : L6470_DIR_REV_ID), (unsigned int) L6470_Step_s_2_Speed((float) speed));
+        prepared_action = PREPARED_NO_ACTION;
     }
 
+    /**
+     * @brief  Preparing the command to run towards a specified direction
+     *         at the maximum speed.
+     * @param  direction The direction of rotation.
+     * @retval None.
+     * @note   The command will be sent by issuing "PerformAction()".
+     */
     virtual void PrepareRun(direction_t direction)
     {
         L6470_PrepareRun((eL6470_DirId_t) (direction == StepperMotor::FWD ? L6470_DIR_FWD_ID : L6470_DIR_REV_ID), (unsigned int) L6470_GetParam((eL6470_RegId_t) L6470_MAX_SPEED_ID));
+        prepared_action = PREPARED_NO_ACTION;
     }
 
+    /**
+     * @brief  Preparing the command to run towards a specified direction
+     *         at the given speed.
+     * @param  direction The direction of rotation.
+     * @param  speed The speed value in pps.
+     * @retval None.
+     * @note   The command will be sent by issuing "PerformAction()".
+     */
     virtual void PrepareRun(direction_t direction, unsigned int speed)
     {
-        L6470_PrepareRun((eL6470_DirId_t) (direction == StepperMotor::FWD ? L6470_DIR_FWD_ID : L6470_DIR_REV_ID), (unsigned int) speed);
+        L6470_PrepareRun((eL6470_DirId_t) (direction == StepperMotor::FWD ? L6470_DIR_FWD_ID : L6470_DIR_REV_ID), (unsigned int) L6470_Step_s_2_Speed((float) speed));
+        prepared_action = PREPARED_NO_ACTION;
     }
 
+    /**
+     * @brief  Preparing the command to move towards a specified direction
+     *         for a certain number of steps.
+     * @param  direction The direction of rotation.
+     * @param  steps The desired number of steps.
+     * @retval None.
+     * @note   The command will be sent by issuing "PerformAction()".
+     */
     virtual void PrepareMove(direction_t direction, unsigned int steps)
     {
         L6470_PrepareMove((eL6470_DirId_t) (direction == StepperMotor::FWD ? L6470_DIR_FWD_ID : L6470_DIR_REV_ID), (unsigned int) steps);
+        prepared_action = PREPARED_NO_ACTION;
     }
 
+    /**
+     * @brief  Preparing the command to stop the motor.
+     * @param  None.
+     * @retval None.
+     * @note   The command will be sent by issuing "PerformAction()".
+     */
     virtual void PrepareSoftStop(void)
     {
         L6470_PrepareSoftStop();
+        prepared_action = PREPARED_NO_ACTION;
     }
 
+    /**
+     * @brief  Preparing the command to stop the motor and disabling the power bridge.
+     * @param  None.
+     * @retval None.
+     * @note   The command will be sent by issuing "PerformAction()".
+     */
     virtual void PrepareHardStop(void)
     {
         L6470_PrepareHardStop();
+        prepared_action = PREPARED_NO_ACTION;
     }
 
+    /**
+     * @brief  Preparing the command to disable the power bridge after performing
+     *         a deceleration to zero.
+     *         The used deceleration value is the one stored in the "DEC" register.
+     * @param  None.
+     * @retval None.
+     * @note   The command will be sent by issuing "PerformAction()".
+     */
     virtual void PrepareSoftHiZ(void)
     {
         L6470_PrepareSoftHiZ();
+        prepared_action = PREPARED_NO_ACTION;
     }
 
+    /**
+     * @brief  Preparing the command to disable the power bridge immediately.
+     * @param  None.
+     * @retval None.
+     * @note   The command will be sent by issuing "PerformAction()".
+     */
     virtual void PrepareHardHiZ(void)
     {
         L6470_PrepareHardHiZ();
+        prepared_action = PREPARED_NO_ACTION;
+    }
+
+    /**
+      * @brief  Preparing the command to switch to step-clock mode.
+      * @param  direction The direction of rotation.
+      * @retval None.
+      * @note   The command will be sent by issuing "PerformAction()".
+      */
+    virtual void PrepareStepClock(direction_t direction)
+    {
+        L6470_PrepareStepClock((eL6470_DirId_t) (direction == StepperMotor::FWD ? L6470_DIR_FWD_ID : L6470_DIR_REV_ID));
+        prepared_action = PREPARED_NO_ACTION;
     }
 
-    virtual void PrepareStepClock(direction_t direction)
+    /**
+      * @brief  Preparing the command to do a motion at minimum speed
+      *         imposing a specified direction until the SW is released.
+      * @param  action The identifier of the action about the absolute position.
+      * @param  direction The direction of rotation.
+      * @retval None.
+      * @note   The command will be sent by issuing "PerformAction()".
+      *         The identifier of the action about the absolute position can be
+      *         one of the following:
+      *           + L6470_ACT_RST_ID: the absolute position is reset;
+      *           + L6470_ACT_CPY_ID: the absolute position is set as the marked position.
+      */
+    virtual void PrepareReleaseSW(eL6470_ActId_t action, direction_t direction)
     {
-        L6470_StepClock((eL6470_DirId_t) (direction == StepperMotor::FWD ? L6470_DIR_FWD_ID : L6470_DIR_REV_ID));
+        L6470_PrepareReleaseSW((eL6470_ActId_t) action, (eL6470_DirId_t) (direction == StepperMotor::FWD ? L6470_DIR_FWD_ID : L6470_DIR_REV_ID));
+        prepared_action = PREPARED_NO_ACTION;
+    }
+
+    /**
+      * @brief  Preparing the command to reset the device to power-up conditions.
+      * @param  None.
+      * @retval None.
+      * @note   The command will be sent by issuing "PerformAction()".
+      */
+    virtual void PrepareResetDevice(void)
+    {
+        L6470_PrepareResetDevice();
+        prepared_action = PREPARED_NO_ACTION;
     }
 
-    virtual void PrepareReleaseSW(eL6470_ActId_t L6470_ActId, direction_t direction)
+    /**
+      * @brief    Performing all the actions prepared on the components
+      *           of the daisy-chain.
+      * @param    None.
+      * @retval   The raw data returned by the components.
+      */
+    uint8_t* PerformPreparedActions(void)
     {
-        L6470_ReleaseSW((eL6470_ActId_t) L6470_ActId, (eL6470_DirId_t) (direction == StepperMotor::FWD ? L6470_DIR_FWD_ID : L6470_DIR_REV_ID));
+        return L6470_PerformPreparedApplicationCommand();
+    }
+
+    /**
+      * @brief    Getting the prepared action.
+      * @param    None
+      * @retval   The prepared action.
+      */
+    prepared_action_t GetPreparedAction(void)
+    {
+        return prepared_action;
     }
 
-    virtual void PrepareResetDevice(void)
+    /**
+      * @brief    Converting the raw data received by the component according to
+      *           the action performed on it.
+      * @param    raw_data The received raw data.
+      * @retval   The result of the action performed.
+      */
+    int32_t GetResult(uint8_t *raw_data)
     {
-        L6470_ResetDevice();
-    }
+        switch (prepared_action)
+        {
+            case PREPARED_GET_POSITION:
+                return L6470_AbsPos_2_Position(L6470_ExtractReturnedData(raw_data, L6470_Register[L6470_ABS_POS_ID].LengthByte));
+
+            case PREPARED_GET_MARK:
+                return L6470_AbsPos_2_Position(L6470_ExtractReturnedData(raw_data, L6470_Register[L6470_MARK_ID].LengthByte));
 
-    virtual uint8_t* PerformAction(void)
-    {
-        return (uint8_t*) L6470_PerformPreparedApplicationCommand();
+            case PREPARED_GET_SPEED:
+                return round(L6470_Speed_2_Step_s(L6470_ExtractReturnedData(raw_data, L6470_Register[L6470_SPEED_ID].LengthByte)));
+    
+            case PREPARED_GET_MAX_SPEED:
+                return round(L6470_MaxSpeed_2_Step_s(L6470_ExtractReturnedData(raw_data, L6470_Register[L6470_MAX_SPEED_ID].LengthByte)));
+    
+            case PREPARED_GET_MIN_SPEED:
+                return round(L6470_MinSpeed_2_Step_s(L6470_ExtractReturnedData(raw_data, L6470_Register[L6470_MIN_SPEED_ID].LengthByte)));
+    
+            case PREPARED_GET_ACCELERATION:
+                return round(L6470_Acc_2_Step_s2(L6470_ExtractReturnedData(raw_data, L6470_Register[L6470_ACC_ID].LengthByte)));
+    
+            case PREPARED_GET_DECELERATION:
+                return round(L6470_Dec_2_Step_s2(L6470_ExtractReturnedData(raw_data, L6470_Register[L6470_DEC_ID].LengthByte)));
+
+            case PREPARED_GET_DIRECTION:
+                return (int32_t) (direction_t) (L6470_CheckStatusRegisterFlag((eL6470_StatusRegisterFlagId_t) DIR_ID) == 1 ? StepperMotor::FWD : StepperMotor::BWD);
+
+            default:
+            case PREPARED_NO_ACTION:
+                return 0;
+        }
     }
 
 
@@ -519,8 +1081,8 @@
      *   }                                                                    *
      *------------------------------------------------------------------------*/
     /**
-     * @brief  Attaching a FLAG interrupt handler.
-     * @param  fptr an interrupt handler.
+     * @brief  Attaching an interrupt handler to the FLAG interrupt.
+     * @param  fptr An interrupt handler.
      * @retval None.
      */
     void AttachFlagIRQ(void (*fptr)(void))
@@ -529,7 +1091,7 @@
     }
     
     /**
-     * @brief  Enabling FLAG interrupt handling.
+     * @brief  Enabling the FLAG interrupt handling.
      * @param  None.
      * @retval None.
      */
@@ -539,7 +1101,7 @@
     }
     
     /**
-     * @brief  Disabling FLAG interrupt handling.
+     * @brief  Disabling the FLAG interrupt handling.
      * @param  None.
      * @retval None.
      */
@@ -548,6 +1110,36 @@
         flag_irq.disable_irq();
     }
 
+    /**
+     * @brief  Attaching an interrupt handler to the BUSY interrupt.
+     * @param  fptr An interrupt handler.
+     * @retval None.
+     */
+    void AttachBusyIRQ(void (*fptr)(void))
+    {
+        busy_irq.rise(fptr);
+    }
+    
+    /**
+     * @brief  Enabling the BUSY interrupt handling.
+     * @param  None.
+     * @retval None.
+     */
+    void EnableBusyIRQ(void)
+    {
+        busy_irq.enable_irq();
+    }
+
+    /**
+     * @brief  Disabling the BUSY interrupt handling.
+     * @param  None.
+     * @retval None.
+     */
+    void DisableBusyIRQ(void)
+    {
+        busy_irq.disable_irq();
+    }
+
 
 protected:
 
@@ -641,6 +1233,19 @@
     void     L6470_PrepareAppCmdPkg(sL6470_AppCmdPkg_t* pL6470_AppCmdPkg, eL6470_AppCmdId_t L6470_AppCmdId, uint32_t p1, uint32_t p2, uint32_t p3);
     void     L6470_PrepareDaisyChainCommand(sL6470_AppCmdPkg_t* pL6470_AppCmdPkg, uint8_t* pL6470_DaisyChainSpiTxStruct);
 
+    /**
+     * @brief  Rounding a floating point number to the nearest unsigned integer number.
+     * @param  f The floating point number.
+     * @retval The nearest unsigned integer number.
+     */
+    int round(float f)
+    {
+        if (f >= 0)
+            return (int) f + (f - (int) f < 0.5f ? 0 : 1);
+        else
+            return (int) f - (f - (int) f < -0.5f ? 1 : 0);
+    }
+
 
     /*** Component's I/O Methods ***/
 
@@ -718,49 +1323,63 @@
 
     /*** Component's Instance Variables ***/
 
-    /* Identity */
-    uint8_t who_am_i;
-
     /* ACTION 9 --------------------------------------------------------------*
-     * There should be only a unique identifier for each component, which     *
-     * should be the "who_am_i" parameter, hence this parameter is optional.  *
+     * Declare here interrupt related variables, if needed.                   *
+     * Note that interrupt handling is platform dependent, see                *
+     * "Interrupt Related Methods" above.                                     *
+     *                                                                        *
+     * Example:                                                               *
+     *   + mbed:                                                              *
+     *     InterruptIn feature_irq;                                           *
      *------------------------------------------------------------------------*/
-    /* Type. */
-    uint8_t type;
-
     /* Flag Interrupt. */
     InterruptIn flag_irq;
 
+    /* Busy Interrupt. */
+    InterruptIn busy_irq;
+
+    /* ACTION 10 -------------------------------------------------------------*
+     * Declare here other pin related variables, if needed.                   *
+     *                                                                        *
+     * Example:                                                               *
+     *   + mbed:                                                              *
+     *     DigitalOut standby_reset;                                          *
+     *------------------------------------------------------------------------*/
     /* Standby/reset pin. */
     DigitalOut standby_reset;
 
+    /* ACTION 11 -------------------------------------------------------------*
+     * Declare here communication related variables, if needed.               *
+     *                                                                        *
+     * Example:                                                               *
+     *   + mbed:                                                              *
+     *     DigitalOut ssel;                                                   *
+     *     DevSPI &dev_spi;                                                   *
+     *------------------------------------------------------------------------*/
     /* Configuration. */
     DigitalOut ssel;
 
     /* IO Device. */
     DevSPI &dev_spi;
 
-    /* Interrupts. */
-    /* ACTION 10 -------------------------------------------------------------*
-     * Put here interrupt related objects, if needed.                         *
-     * Note that interrupt handling is platform dependent, see                *
-     * "Interrupt Related Methods" above.                                     *
+    /* ACTION 12 -------------------------------------------------------------*
+     * Declare here identity related variables, if needed.                    *
+     * Note that there should be only a unique identifier for each component, *
+     * which should be the "who_am_i" parameter.                              *
+     *------------------------------------------------------------------------*/
+    /* Identity */
+    uint8_t who_am_i;
+
+    /* ACTION 13 -------------------------------------------------------------*
+     * Declare here the component's static and non-static data, one variable  *
+     * per line.                                                              *
      *                                                                        *
      * Example:                                                               *
-     *   + mbed:                                                              *
-     *     InterruptIn feature_int;                                           *
+     *   float measure;                                                       *
+     *   int instance_id;                                                     *
+     *   static int number_of_instances;                                      *
      *------------------------------------------------------------------------*/
-
     /* Data. */
-    /* ACTION 11 -------------------------------------------------------------*
-     * Declare here the component's data, one variable per line.              *
-     *                                                                        *
-     * Example:                                                               *
-     *   int T0_out;                                                          *
-     *   int T1_out;                                                          *
-     *   float T0_degC;                                                       *
-     *   float T1_degC;                                                       *
-     *------------------------------------------------------------------------*/
     uint8_t L6470_Id;
     const sL6470_Register_t *L6470_Register;
     const sL6470_ApplicationCommand_t *L6470_ApplicationCommand;
@@ -769,6 +1388,7 @@
     sL6470_StatusRegister_t L6470_StatusRegister;
     sL6470_StatusRegister_t *pL6470_StatusRegister; 
     StepperMotorRegister_t StepperMotorRegister;
+    prepared_action_t prepared_action;
 
     /* Static data. */
     static uint8_t number_of_devices;