Library to handle the X_NUCLEO_IHM02A1 Motor Control Expansion Board based on the L6470 component.

Dependencies:   X_NUCLEO_COMMON ST_INTERFACES

Dependents:   HelloWorld_IHM02A1 ConcorsoFinal HelloWorld_IHM02A1_mbedOS HelloWorld_IHM02A1-Serialinterpreter ... more

Fork of X_NUCLEO_IHM02A1 by ST Expansion SW Team

Motor Control Library

Introduction

Library to handle the X-NUCLEO-IHM02A1 Motor Control Expansion Board based on the the L6470 component.

Daisy-Chain Configuration

The two L6470 components mounted on this board are connected in daisy-chain configuration. This board can be stacked up to four times so that the eight L6470 components will be connected two-by-two in daisy-chain configuration.

Concerning the SSEL pin of the SPI communication, each expansion board must be in one of the following configuration:

  • SB_23 resistor connected only: SSEL on pin A2;
  • SB_7 resistor connected only: SSEL on pin D2;
  • SB_8 resistor connected only: SSEL on pin D10;
  • SB_9 resistor connected only: SSEL on pin D5.

Arduino Connector Compatibility Warning

X-NUCLEO-IHM02A1 is Arduino compatible with one exception: instead of using D13 pin to drive the SPI clock, it uses D3 pin, hence the default configuration for this library is with the SPI clock on D3 pin.

To be fully Arduino compatible the following patch is required:

  • to remove the SB34 resistor;
  • to solder the SB12 resistor.

Alternatively, you can route the Nucleo board’s D13 pin directly to the expansion board’s D3 pin with a wire. In case you patch your expansion board or route the pin, the SPI clock will be driven on D13 pin rather than on D3 pin, and you have also to initialize the sclk PinName variable with D13 rather than D3. This patch is known to be required, for example, on the following boards: NUCLEO-F103RB, NUCLEO-F302RB, NUCLEO-F411RE, and NUCLEO-F429ZI.

If you use D13 pin for the SPI clock, please be aware that on STM32 Nucleo boards you may not drive the LED, otherwise you will get a conflict: the LED on STM32 Nucleo boards is connected to the D13 pin.

Example Applications

Files at this revision

API Documentation at this revision

Comitter:
davide.aliprandi@st.com
Date:
Fri Mar 10 11:09:21 2017 +0100
Parent:
21:1b7f3e002688
Child:
23:cf489f2ab072
Commit message:
Aligning to ARM mbed coding style.

Changed in this revision

BSP/XNucleoIhm02a1.cpp Show annotated file Show diff for this revision Revisions of this file
BSP/XNucleoIhm02a1.h Show annotated file Show diff for this revision Revisions of this file
BSP/x_nucleo_ihm02a1_class.cpp Show diff for this revision Revisions of this file
BSP/x_nucleo_ihm02a1_class.h Show diff for this revision Revisions of this file
Components/Common/component.h Show diff for this revision Revisions of this file
Components/Common/component_def.h Show annotated file Show diff for this revision Revisions of this file
Components/Common/microstepping_motor.h Show diff for this revision Revisions of this file
Components/Common/microstepping_motor_def.h Show annotated file Show diff for this revision Revisions of this file
Components/l6470/L6470.cpp Show annotated file Show diff for this revision Revisions of this file
Components/l6470/L6470_def.h Show annotated file Show diff for this revision Revisions of this file
Components/l6470/l6470.h Show annotated file Show diff for this revision Revisions of this file
Components/l6470/l6470_class.cpp Show diff for this revision Revisions of this file
Components/l6470/l6470_class.h Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BSP/XNucleoIhm02a1.cpp	Fri Mar 10 11:09:21 2017 +0100
@@ -0,0 +1,220 @@
+/**
+ ******************************************************************************
+ * @file    XNucleoIhm02a1.cpp
+ * @author  AST / Software Platforms and Cloud
+ * @version V1.0
+ * @date    November 3rd, 2015
+ * @brief   Implementation file for the X_NUCLEO_IHM02A1 expansion board.
+ ******************************************************************************
+ * @attention
+ *
+ * <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:
+ *   1. Redistributions of source code must retain the above copyright notice,
+ *      this list of conditions and the following disclaimer.
+ *   2. Redistributions in binary form must reproduce the above copyright notice,
+ *      this list of conditions and the following disclaimer in the documentation
+ *      and/or other materials provided with the distribution.
+ *   3. Neither the name of STMicroelectronics nor the names of its contributors
+ *      may be used to endorse or promote products derived from this software
+ *      without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ******************************************************************************
+ */
+
+
+/* Generated with STM32CubeTOO -----------------------------------------------*/
+
+
+/* Includes ------------------------------------------------------------------*/
+
+/* ACTION 1 ------------------------------------------------------------------*
+ * Include here platform specific header files.                               *
+ *----------------------------------------------------------------------------*/
+#include "mbed.h"
+#include "DevSPI.h"
+/* ACTION 2 ------------------------------------------------------------------*
+ * Include here expansion board specific header files.                        *
+ *----------------------------------------------------------------------------*/
+#include "XNucleoIhm02a1.h"
+
+
+/* Variables -----------------------------------------------------------------*/
+
+/* Number of expansion boards. */
+uint8_t XNucleoIhm02a1::number_of_boards = 0;
+
+
+/* Methods -------------------------------------------------------------------*/
+
+/**
+ * @brief Constructor.
+ * @param init_0        pointer to the initialization structure of the first motor.
+ * @param init_1        pointer to the initialization structure of the second motor.
+ * @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.
+ */
+XNucleoIhm02a1::XNucleoIhm02a1(L6470_init_t *init_0, L6470_init_t *init_1, PinName flag_irq, PinName busy_irq, PinName standby_reset, PinName ssel, DevSPI *spi) : dev_spi(spi)
+{
+    /* Checking stackability. */
+    if (!(number_of_boards < EXPBRD_MOUNTED_NR_MAX)) {
+        error("Instantiation of the X_NUCLEO_IHM02A1 expansion board failed: it can be stacked up to %d times.\r\n", EXPBRD_MOUNTED_NR_MAX);
+    }
+    instance_id = number_of_boards++;
+
+    /* SPI communication. */
+    if (dev_spi == NULL) {
+        dev_spi = new DevSPI(X_NUCLEO_IHM02A1_PIN_SPI_MOSI, X_NUCLEO_IHM02A1_PIN_SPI_MISO, X_NUCLEO_IHM02A1_PIN_SPI_SCLK);
+    }
+
+    /* Instantiating the components. */
+    /* ACTION 3 --------------------------------------------------------------*
+     * Instantiate here the expansion board's components.                     *
+     *                                                                        *
+     * Example:                                                               *
+     *   component_1 = new COMPONENT_1(ssel, *dev_spi);                       *
+     *   component_2 = new COMPONENT_2(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);
+
+    /* Initializing the components. */
+    init_components[0] = init_0;
+    init_components[1] = init_1;
+    if (!Init()) {
+        error("Initialization of the X_NUCLEO_IHM02A1 expansion board failed.\r\n");
+    }
+}
+
+/**
+ * @brief Constructor.
+ * @param init_0        pointer to the initialization structure of the first motor.
+ * @param init_1        pointer to the initialization structure of the second motor.
+ * @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.
+ * @param miso          pin name of the MISO pin of the SPI device to be used for communication.
+ * @param sclk          pin name of the SCLK pin of the SPI device to be used for communication.
+ */
+XNucleoIhm02a1::XNucleoIhm02a1(L6470_init_t *init_0, L6470_init_t *init_1, PinName flag_irq, PinName busy_irq, PinName standby_reset, PinName ssel, PinName mosi, PinName miso, PinName sclk)
+{
+    /* Checking stackability. */
+    if (!(number_of_boards < EXPBRD_MOUNTED_NR_MAX)) {
+        error("Instantiation of the X_NUCLEO_IHM02A1 expansion board failed: it can be stacked up to %d times.\r\n", EXPBRD_MOUNTED_NR_MAX);
+    }
+    instance_id = number_of_boards++;
+
+    /* SPI communication. */
+    dev_spi = new DevSPI(mosi, miso, sclk);
+
+    /* Instantiating the components. */
+    /* ACTION 3 --------------------------------------------------------------*
+     * Instantiate here the expansion board's components.                     *
+     *                                                                        *
+     * Example:                                                               *
+     *   component_1 = new COMPONENT_1(ssel, *dev_spi);                       *
+     *   component_2 = new COMPONENT_2(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);
+
+    /* Initializing the components. */
+    init_components[0] = init_0;
+    init_components[1] = init_1;
+    if (!Init()) {
+        error("Initialization of the X_NUCLEO_IHM02A1 expansion board failed.\r\n");
+    }
+}
+
+/**
+ * @brief Initializing the X_NUCLEO_IHM02A1 board.
+ * @retval true if initialization is successful, false otherwise.
+ */
+bool XNucleoIhm02a1::init(void)
+{
+    /* Initializing the components. */
+    /* ACTION 4 --------------------------------------------------------------*
+     * Initialize here the expansion board's components.                      *
+     *                                                                        *
+     * Example:                                                               *
+     *   return (init_COMPONENT_1() && init_COMPONENT_2());                   *
+     *------------------------------------------------------------------------*/
+    return (init_L6470_0() && init_L6470_1());
+}
+
+/* ACTION 5 ------------------------------------------------------------------*
+ * Implement here an initialization method for each expansion board's         *
+ * component.                                                                 *
+ *                                                                            *
+ * Example:                                                                   *
+ *   bool ExpansionBoard::init_COMPONENT_1(void)                              *
+ *   {                                                                        *
+ *     // Verifying identity.                                                 *
+ *     uint8_t id = 0;                                                        *
+ *     int ret = component_1->read_id(&id);                                   *
+ *     if ((ret != COMPONENT_OK) || (id != I_AM_COMPONENT_1))                 *
+ *     {                                                                      *
+ *       delete component_1;                                                  *
+ *       component_1 = NULL;                                                  *
+ *       return true;                                                         *
+ *     }                                                                      *
+ *                                                                            *
+ *     // Configuration.                                                      *
+ *     COMPONENT_init_t init;                                                 *
+ *     init.property_1 = COMPONENT_1_PROPERY_1_INIT;                          *
+ *     init.property_N = COMPONENT_1_PROPERY_N_INIT;                          *
+ *                                                                            *
+ *     // Initialization.                                                     *
+ *     if (component_1->init(&init) != COMPONENT_OK)                          *
+ *       return false;                                                        *
+ *                                                                            *
+ *     return true;                                                           *
+ *   }                                                                        *
+ *----------------------------------------------------------------------------*/
+/**
+ * @brief  Initialize the L6470 component.
+ * @retval true if initialization is successful, false otherwise.
+ */
+bool XNucleoIhm02a1::init_L6470_0(void)
+{
+    /* Initialization. */
+    if (l6470_0->init((void *) init_components[0]) != COMPONENT_OK) {
+        return false;
+    }
+
+    return true;
+}
+
+/**
+ * @brief  Initialize the L6470 component.
+ * @retval true if initialization is successful, false otherwise.
+ */
+bool XNucleoIhm02a1::init_L6470_1(void)
+{
+    /* Initialization. */
+    if (l6470_1->init((void *) init_components[1]) != COMPONENT_OK) {
+        return false;
+    }
+
+    return true;
+}
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BSP/XNucleoIhm02a1.h	Fri Mar 10 11:09:21 2017 +0100
@@ -0,0 +1,224 @@
+/**
+ ******************************************************************************
+ * @file    XNucleoIhm02a1.h
+ * @author  AST / Software Platforms and Cloud
+ * @version V1.0
+ * @date    November 3rd, 2015
+ * @brief   Class header file for the X-NUCLEO-IHM02A1 expansion board.
+ ******************************************************************************
+ * @attention
+ *
+ * <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:
+ *   1. Redistributions of source code must retain the above copyright notice,
+ *      this list of conditions and the following disclaimer.
+ *   2. Redistributions in binary form must reproduce the above copyright notice,
+ *      this list of conditions and the following disclaimer in the documentation
+ *      and/or other materials provided with the distribution.
+ *   3. Neither the name of STMicroelectronics nor the names of its contributors
+ *      may be used to endorse or promote products derived from this software
+ *      without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ******************************************************************************
+ */
+
+
+/* Generated with STM32CubeTOO -----------------------------------------------*/
+
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+
+#ifndef __X_NUCLEO_IHM02A1_CLASS_H
+#define __X_NUCLEO_IHM02A1_CLASS_H
+
+
+/* Includes ------------------------------------------------------------------*/
+
+/* ACTION 1 ------------------------------------------------------------------*
+ * Include here platform specific header files.                               *
+ *----------------------------------------------------------------------------*/
+#include "mbed.h"
+#include "DevSPI.h"
+/* ACTION 2 ------------------------------------------------------------------*
+ * Include here expansion board configuration's header files.                 *
+ *----------------------------------------------------------------------------*/
+#include "x_nucleo_ihm02a1_config.h"
+/* ACTION 3 ------------------------------------------------------------------*
+ * Include here expansion board's components' header files.                   *
+ *                                                                            *
+ * Example:                                                                   *
+ *   #include "COMPONENT_1.h"                                                 *
+ *   #include "COMPONENT_2.h"                                                 *
+ *----------------------------------------------------------------------------*/
+#include "L6470.h"
+
+
+/* Classes -------------------------------------------------------------------*/
+
+/** Class representing a X-NUCLEO-IHM02A1 board.
+ */
+class XNucleoIhm02a1
+{
+public:
+
+    /*** Constructor, Destructor, and Initialization Methods ***/
+
+    /**
+     * @brief Constructor.
+     * @param init_0        pointer to the initialization structure of the first motor.
+     * @param init_1        pointer to the initialization structure of the second motor.
+     * @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.
+     */
+    XNucleoIhm02a1(L6470_init_t *init_0, L6470_init_t *init_1, PinName flag_irq, PinName busy_irq, PinName standby_reset, PinName ssel, DevSPI *spi);
+
+    /**
+     * @brief Constructor.
+     * @param init_0        pointer to the initialization structure of the first motor.
+     * @param init_1        pointer to the initialization structure of the second motor.
+     * @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.
+     * @param miso          pin name of the MISO pin of the SPI device to be used for communication.
+     * @param sclk          pin name of the SCLK pin of the SPI device to be used for communication.
+     */
+    XNucleoIhm02a1(L6470_init_t *init_0, L6470_init_t *init_1, PinName flag_irq, PinName busy_irq, PinName standby_reset, PinName ssel, PinName mosi, PinName miso, PinName sclk);
+
+    /**
+     * @brief Destructor.
+     */
+    ~XNucleoIhm02a1(void) {}
+
+    /**
+     * @brief Initializing the X-NUCLEO-IHM02A1 board.
+     * @retval true if initialization is successful, false otherwise.
+     */
+    bool init(void);
+
+
+    /*** Other Public Expansion Board Related Methods ***/
+
+    /**
+     * @brief  Getting the array of components.
+     * @param  None.
+     * @retval The array of components.
+     */
+    L6470 **get_components(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* perform_prepared_actions(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]->get_prepared_action() == L6470::PREPARED_SET_MARK) {
+                components[m]->prepare_set_mark((uint32_t) components[m]->get_position());
+            }
+        }
+        
+        /* Performing the prepared actions and getting back raw data. */
+        uint8_t *raw_data = components[0]->perform_prepared_actions();
+
+        /* Processing raw data. */
+        for (int m = 0; m < L6470DAISYCHAINSIZE; m++) {
+            results[m] = components[m]->get_result(raw_data);
+        }
+
+        /* Returning results. */
+        return results;
+    }
+
+
+    /*** Public Expansion Board Related Attributes ***/
+
+    /* ACTION 4 --------------------------------------------------------------*
+     * Declare here a public attribute for each expansion board's component.  *
+     * You will have to call these attributes' public methods within your     *
+     * main program.                                                          *
+     *                                                                        *
+     *   Example:                                                             *
+     *     COMPONENT_1 *component_1;                                          *
+     *     COMPONENT_2 *component_2;                                          *
+     *------------------------------------------------------------------------*/
+    L6470 *l6470_0;
+    L6470 *l6470_1;
+
+
+protected:
+
+    /*** Protected Expansion Board Related Initialization Methods ***/
+
+    /* ACTION 5 --------------------------------------------------------------*
+     * Declare here a protected initialization method for each expansion      *
+     * board's component.                                                     *
+     *                                                                        *
+     * Example:                                                               *
+     *   bool init_COMPONENT_1(void);                                         *
+     *   bool init_COMPONENT_2(void);                                         *
+     *------------------------------------------------------------------------*/
+    bool init_L6470_0(void);
+    bool init_L6470_1(void);
+
+
+    /*** Component's Instance Variables ***/
+
+    /* IO Device. */
+    DevSPI *dev_spi;
+
+    /* Components. */
+    L6470 *components[L6470DAISYCHAINSIZE];
+    
+    /* Components' initialization. */
+    L6470_init_t *init_components[L6470DAISYCHAINSIZE];
+
+    /* Results of prepared actions. */
+    uint32_t results[L6470DAISYCHAINSIZE];
+
+    /* ACTION 6 --------------------------------------------------------------*
+     * Declare here the component's static and non-static data, one variable  *
+     * per line.                                                              *
+     *                                                                        *
+     * Example:                                                               *
+     *   int instance_id;                                                     *
+     *   static int number_of_instances;                                      *
+     *------------------------------------------------------------------------*/
+    /* Data. */
+    uint8_t instance_id;
+
+    /* Static data. */
+    static uint8_t number_of_boards;
+};
+
+#endif /* __X_NUCLEO_IHM02A1_CLASS_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
--- a/BSP/x_nucleo_ihm02a1_class.cpp	Wed Mar 01 17:52:33 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,220 +0,0 @@
-/**
- ******************************************************************************
- * @file    x_nucleo_ihm02a1_class.cpp
- * @author  AST / Software Platforms and Cloud
- * @version V1.0
- * @date    November 3rd, 2015
- * @brief   Implementation file for the X_NUCLEO_IHM02A1 expansion board.
- ******************************************************************************
- * @attention
- *
- * <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:
- *   1. Redistributions of source code must retain the above copyright notice,
- *      this list of conditions and the following disclaimer.
- *   2. Redistributions in binary form must reproduce the above copyright notice,
- *      this list of conditions and the following disclaimer in the documentation
- *      and/or other materials provided with the distribution.
- *   3. Neither the name of STMicroelectronics nor the names of its contributors
- *      may be used to endorse or promote products derived from this software
- *      without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- ******************************************************************************
- */
-
-
-/* Generated with STM32CubeTOO -----------------------------------------------*/
-
-
-/* Includes ------------------------------------------------------------------*/
-
-/* ACTION 1 ------------------------------------------------------------------*
- * Include here platform specific header files.                               *
- *----------------------------------------------------------------------------*/
-#include "mbed.h"
-#include "DevSPI.h"
-/* ACTION 2 ------------------------------------------------------------------*
- * Include here expansion board specific header files.                        *
- *----------------------------------------------------------------------------*/
-#include "x_nucleo_ihm02a1_class.h"
-
-
-/* Variables -----------------------------------------------------------------*/
-
-/* Number of expansion boards. */
-uint8_t X_NUCLEO_IHM02A1::number_of_boards = 0;
-
-
-/* Methods -------------------------------------------------------------------*/
-
-/**
- * @brief Constructor.
- * @param init_0        pointer to the initialization structure of the first motor.
- * @param init_1        pointer to the initialization structure of the second motor.
- * @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(L6470_Init_t *init_0, L6470_Init_t *init_1, PinName flag_irq, PinName busy_irq, PinName standby_reset, PinName ssel, DevSPI *spi) : dev_spi(spi)
-{
-    /* Checking stackability. */
-    if (!(number_of_boards < EXPBRD_MOUNTED_NR_MAX)) {
-        error("Instantiation of the X_NUCLEO_IHM02A1 expansion board failed: it can be stacked up to %d times.\r\n", EXPBRD_MOUNTED_NR_MAX);
-    }
-    X_NUCLEO_IHM02A1_Id = number_of_boards++;
-
-    /* SPI communication. */
-    if (dev_spi == NULL) {
-        dev_spi = new DevSPI(X_NUCLEO_IHM02A1_PIN_SPI_MOSI, X_NUCLEO_IHM02A1_PIN_SPI_MISO, X_NUCLEO_IHM02A1_PIN_SPI_SCLK);
-    }
-
-    /* Instantiating the components. */
-    /* ACTION 3 --------------------------------------------------------------*
-     * Instantiate here the expansion board's components.                     *
-     *                                                                        *
-     * Example:                                                               *
-     *   component_1 = new COMPONENT_1(ssel, *dev_spi);                       *
-     *   component_2 = new COMPONENT_2(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);
-
-    /* Initializing the components. */
-    init_components[0] = init_0;
-    init_components[1] = init_1;
-    if (!Init()) {
-        error("Initialization of the X_NUCLEO_IHM02A1 expansion board failed.\r\n");
-    }
-}
-
-/**
- * @brief Constructor.
- * @param init_0        pointer to the initialization structure of the first motor.
- * @param init_1        pointer to the initialization structure of the second motor.
- * @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.
- * @param miso          pin name of the MISO pin of the SPI device to be used for communication.
- * @param sclk          pin name of the SCLK pin of the SPI device to be used for communication.
- */
-X_NUCLEO_IHM02A1::X_NUCLEO_IHM02A1(L6470_Init_t *init_0, L6470_Init_t *init_1, PinName flag_irq, PinName busy_irq, PinName standby_reset, PinName ssel, PinName mosi, PinName miso, PinName sclk)
-{
-    /* Checking stackability. */
-    if (!(number_of_boards < EXPBRD_MOUNTED_NR_MAX)) {
-        error("Instantiation of the X_NUCLEO_IHM02A1 expansion board failed: it can be stacked up to %d times.\r\n", EXPBRD_MOUNTED_NR_MAX);
-    }
-    X_NUCLEO_IHM02A1_Id = number_of_boards++;
-
-    /* SPI communication. */
-    dev_spi = new DevSPI(mosi, miso, sclk);
-
-    /* Instantiating the components. */
-    /* ACTION 3 --------------------------------------------------------------*
-     * Instantiate here the expansion board's components.                     *
-     *                                                                        *
-     * Example:                                                               *
-     *   component_1 = new COMPONENT_1(ssel, *dev_spi);                       *
-     *   component_2 = new COMPONENT_2(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);
-
-    /* Initializing the components. */
-    init_components[0] = init_0;
-    init_components[1] = init_1;
-    if (!Init()) {
-        error("Initialization of the X_NUCLEO_IHM02A1 expansion board failed.\r\n");
-    }
-}
-
-/**
- * @brief Initializing the X_NUCLEO_IHM02A1 board.
- * @retval true if initialization is successful, false otherwise.
- */
-bool X_NUCLEO_IHM02A1::Init(void)
-{
-    /* Initializing the components. */
-    /* ACTION 4 --------------------------------------------------------------*
-     * Initialize here the expansion board's components.                      *
-     *                                                                        *
-     * Example:                                                               *
-     *   return (Init_COMPONENT_1() && Init_COMPONENT_2());                   *
-     *------------------------------------------------------------------------*/
-    return (Init_L6470_0() && Init_L6470_1());
-}
-
-/* ACTION 5 ------------------------------------------------------------------*
- * Implement here an initialization method for each expansion board's         *
- * component.                                                                 *
- *                                                                            *
- * Example:                                                                   *
- *   bool EXPANSION_BOARD::Init_COMPONENT_1(void)                             *
- *   {                                                                        *
- *     // Verifying identity.                                                 *
- *     uint8_t id = 0;                                                        *
- *     int ret = component_1->ReadID(&id);                                    *
- *     if ((ret != COMPONENT_OK) || (id != I_AM_COMPONENT_1))                 *
- *     {                                                                      *
- *       delete component_1;                                                  *
- *       component_1 = NULL;                                                  *
- *       return true;                                                         *
- *     }                                                                      *
- *                                                                            *
- *     // Configuration.                                                      *
- *     COMPONENT_Init_t InitStructure;                                        *
- *     InitStructure.Property_1 = COMPONENT_1_PROPERY_1_INIT;                 *
- *     InitStructure.Property_N = COMPONENT_1_PROPERY_N_INIT;                 *
- *                                                                            *
- *     // Initialization.                                                     *
- *     if (component_1->Init(&InitStructure) != COMPONENT_OK)                 *
- *       return false;                                                        *
- *                                                                            *
- *     return true;                                                           *
- *   }                                                                        *
- *----------------------------------------------------------------------------*/
-/**
- * @brief  Initialize the L6470 component.
- * @retval true if initialization is successful, false otherwise.
- */
-bool X_NUCLEO_IHM02A1::Init_L6470_0(void)
-{
-    /* Initialization. */
-    if (l6470_0->Init((void *) init_components[0]) != COMPONENT_OK) {
-        return false;
-    }
-
-    return true;
-}
-
-/**
- * @brief  Initialize the L6470 component.
- * @retval true if initialization is successful, false otherwise.
- */
-bool X_NUCLEO_IHM02A1::Init_L6470_1(void)
-{
-    /* Initialization. */
-    if (l6470_1->Init((void *) init_components[1]) != COMPONENT_OK) {
-        return false;
-    }
-
-    return true;
-}
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 
--- a/BSP/x_nucleo_ihm02a1_class.h	Wed Mar 01 17:52:33 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,224 +0,0 @@
-/**
- ******************************************************************************
- * @file    x_nucleo_ihm02a1_class.h
- * @author  AST / Software Platforms and Cloud
- * @version V1.0
- * @date    November 3rd, 2015
- * @brief   Class header file for the X_NUCLEO_IHM02A1 expansion board.
- ******************************************************************************
- * @attention
- *
- * <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:
- *   1. Redistributions of source code must retain the above copyright notice,
- *      this list of conditions and the following disclaimer.
- *   2. Redistributions in binary form must reproduce the above copyright notice,
- *      this list of conditions and the following disclaimer in the documentation
- *      and/or other materials provided with the distribution.
- *   3. Neither the name of STMicroelectronics nor the names of its contributors
- *      may be used to endorse or promote products derived from this software
- *      without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- ******************************************************************************
- */
-
-
-/* Generated with STM32CubeTOO -----------------------------------------------*/
-
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-
-#ifndef __X_NUCLEO_IHM02A1_CLASS_H
-#define __X_NUCLEO_IHM02A1_CLASS_H
-
-
-/* Includes ------------------------------------------------------------------*/
-
-/* ACTION 1 ------------------------------------------------------------------*
- * Include here platform specific header files.                               *
- *----------------------------------------------------------------------------*/
-#include "mbed.h"
-#include "DevSPI.h"
-/* ACTION 2 ------------------------------------------------------------------*
- * Include here expansion board configuration's header files.                 *
- *----------------------------------------------------------------------------*/
-#include "x_nucleo_ihm02a1_config.h"
-/* ACTION 3 ------------------------------------------------------------------*
- * Include here expansion board's components' header files.                   *
- *                                                                            *
- * Example:                                                                   *
- *   #include "component_1_class.h"                                           *
- *   #include "component_2_class.h"                                           *
- *----------------------------------------------------------------------------*/
-#include "l6470_class.h"
-
-
-/* Classes -------------------------------------------------------------------*/
-
-/** Class representing a X_NUCLEO_IHM02A1 board.
- */
-class X_NUCLEO_IHM02A1
-{
-public:
-
-    /*** Constructor, Destructor, and Initialization Methods ***/
-
-    /**
-     * @brief Constructor.
-     * @param init_0        pointer to the initialization structure of the first motor.
-     * @param init_1        pointer to the initialization structure of the second motor.
-     * @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(L6470_Init_t *init_0, L6470_Init_t *init_1, PinName flag_irq, PinName busy_irq, PinName standby_reset, PinName ssel, DevSPI *spi);
-
-    /**
-     * @brief Constructor.
-     * @param init_0        pointer to the initialization structure of the first motor.
-     * @param init_1        pointer to the initialization structure of the second motor.
-     * @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.
-     * @param miso          pin name of the MISO pin of the SPI device to be used for communication.
-     * @param sclk          pin name of the SCLK pin of the SPI device to be used for communication.
-     */
-    X_NUCLEO_IHM02A1(L6470_Init_t *init_0, L6470_Init_t *init_1, PinName flag_irq, PinName busy_irq, PinName standby_reset, PinName ssel, PinName mosi, PinName miso, PinName sclk);
-
-    /**
-     * @brief Destructor.
-     */
-    ~X_NUCLEO_IHM02A1(void) {}
-
-    /**
-     * @brief Initializing the X_NUCLEO_IHM02A1 board.
-     * @retval true if initialization is successful, false otherwise.
-     */
-    bool Init(void);
-
-
-    /*** Other Public Expansion Board Related Methods ***/
-
-    /**
-     * @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 ***/
-
-    /* ACTION 4 --------------------------------------------------------------*
-     * Declare here a public attribute for each expansion board's component.  *
-     * You will have to call these attributes' public methods within your     *
-     * main program.                                                          *
-     *                                                                        *
-     *   Example:                                                             *
-     *     COMPONENT_1 *component_1;                                          *
-     *     COMPONENT_2 *component_2;                                          *
-     *------------------------------------------------------------------------*/
-    L6470 *l6470_0;
-    L6470 *l6470_1;
-
-
-protected:
-
-    /*** Protected Expansion Board Related Initialization Methods ***/
-
-    /* ACTION 5 --------------------------------------------------------------*
-     * Declare here a protected initialization method for each expansion      *
-     * board's component.                                                     *
-     *                                                                        *
-     * Example:                                                               *
-     *   bool Init_COMPONENT_1(void);                                         *
-     *   bool Init_COMPONENT_2(void);                                         *
-     *------------------------------------------------------------------------*/
-    bool Init_L6470_0(void);
-    bool Init_L6470_1(void);
-
-
-    /*** Component's Instance Variables ***/
-
-    /* IO Device. */
-    DevSPI *dev_spi;
-
-    /* Components. */
-    L6470 *components[L6470DAISYCHAINSIZE];
-    
-    /* Components' initialization. */
-    L6470_Init_t *init_components[L6470DAISYCHAINSIZE];
-
-    /* Results of prepared actions. */
-    uint32_t results[L6470DAISYCHAINSIZE];
-
-    /* ACTION 6 --------------------------------------------------------------*
-     * Declare here the component's static and non-static data, one variable  *
-     * per line.                                                              *
-     *                                                                        *
-     * Example:                                                               *
-     *   int instance_id;                                                     *
-     *   static int number_of_instances;                                      *
-     *------------------------------------------------------------------------*/
-    /* Data. */
-    uint8_t X_NUCLEO_IHM02A1_Id;
-
-    /* Static data. */
-    static uint8_t number_of_boards;
-};
-
-#endif /* __X_NUCLEO_IHM02A1_CLASS_H */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
--- a/Components/Common/component.h	Wed Mar 01 17:52:33 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-/**
- ******************************************************************************
- * @file    component.h
- * @author  AST
- * @version V1.0.0
- * @date    1 April 2015
- * @brief   Generic header file containing a generic component's definitions
- *          and I/O functions.
- ******************************************************************************
- * @attention
- *
- * <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:
- *   1. Redistributions of source code must retain the above copyright notice,
- *      this list of conditions and the following disclaimer.
- *   2. Redistributions in binary form must reproduce the above copyright notice,
- *      this list of conditions and the following disclaimer in the documentation
- *      and/or other materials provided with the distribution.
- *   3. Neither the name of STMicroelectronics nor the names of its contributors
- *      may be used to endorse or promote products derived from this software
- *      without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- ******************************************************************************
- */
-
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-
-#ifndef __COMPONENT_H
-#define __COMPONENT_H
-
-
-/* Types ---------------------------------------------------------------------*/
-
-/**
- * @brief  Component's Context structure definition.
- */
-typedef struct
-{  
-    /* Identity. */
-    uint8_t who_am_i;
-
-    /* ACTION ----------------------------------------------------------------*/
-    /* There should be only a unique identifier for each component, which     */
-    /* should be the "who_am_i" parameter, hence this parameter is optional.  */
-    /* -----------------------------------------------------------------------*/
-    /* Type. */
-    uint8_t type;
-
-    /* Configuration. */
-    uint8_t address;
-
-    /* Pointer to the Data. */
-    void *pData;
-
-    /* Pointer to the Virtual Table. */
-    void *pVTable;
-
-    /* ACTION ----------------------------------------------------------------*/
-    /* There should be only a unique virtual table for each component, which  */
-    /* should be the "pVTable" parameter, hence this parameter is optional.   */
-    /* -----------------------------------------------------------------------*/
-    /* Pointer to the Extended Virtual Table. */
-    void *pExtVTable;
-} Handle_t;
-
-/**
- * @brief  Component's Status enumerator definition.
- */
-typedef enum
-{
-    COMPONENT_OK = 0,
-    COMPONENT_ERROR,
-    COMPONENT_TIMEOUT,
-    COMPONENT_NOT_IMPLEMENTED
-} Status_t;
-
-#endif /* __COMPONENT_H */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Components/Common/component_def.h	Fri Mar 10 11:09:21 2017 +0100
@@ -0,0 +1,93 @@
+/**
+ ******************************************************************************
+ * @file    component_def.h
+ * @author  AST
+ * @version V1.0.0
+ * @date    1 April 2015
+ * @brief   Generic header file containing a generic component's definitions
+ *          and I/O functions.
+ ******************************************************************************
+ * @attention
+ *
+ * <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:
+ *   1. Redistributions of source code must retain the above copyright notice,
+ *      this list of conditions and the following disclaimer.
+ *   2. Redistributions in binary form must reproduce the above copyright notice,
+ *      this list of conditions and the following disclaimer in the documentation
+ *      and/or other materials provided with the distribution.
+ *   3. Neither the name of STMicroelectronics nor the names of its contributors
+ *      may be used to endorse or promote products derived from this software
+ *      without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ******************************************************************************
+ */
+
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+
+#ifndef __COMPONENT_H
+#define __COMPONENT_H
+
+
+/* Types ---------------------------------------------------------------------*/
+
+/**
+ * @brief  Component's Context structure definition.
+ */
+typedef struct
+{  
+    /* Identity. */
+    uint8_t who_am_i;
+
+    /* ACTION ----------------------------------------------------------------*/
+    /* There should be only a unique identifier for each component, which     */
+    /* should be the "who_am_i" parameter, hence this parameter is optional.  */
+    /* -----------------------------------------------------------------------*/
+    /* Type. */
+    uint8_t type;
+
+    /* Configuration. */
+    uint8_t address;
+
+    /* Pointer to the Data. */
+    void *p_data;
+
+    /* Pointer to the Virtual Table. */
+    void *p_vt;
+
+    /* ACTION ----------------------------------------------------------------*/
+    /* There should be only a unique virtual table for each component, which  */
+    /* should be the "p_vt" parameter, hence this parameter is optional.      */
+    /* -----------------------------------------------------------------------*/
+    /* Pointer to the Extended Virtual Table. */
+    void *p_ext_vt;
+} handle_t;
+
+/**
+ * @brief  Component's Status enumerator definition.
+ */
+typedef enum
+{
+    COMPONENT_OK = 0,
+    COMPONENT_ERROR,
+    COMPONENT_TIMEOUT,
+    COMPONENT_NOT_IMPLEMENTED
+} status_t;
+
+#endif /* __COMPONENT_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
--- a/Components/Common/microstepping_motor.h	Wed Mar 01 17:52:33 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,484 +0,0 @@
-/**
- ******************************************************************************
- * @file    microstepping_motor.h
- * @author  IPD SYSTEM LAB & TECH MKTG
- * @version V0.0.1
- * @date    04-June-2015
- * @brief   This file contains all the functions prototypes for the microstepping
- *          motor driver with motion engine.   
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *   1. Redistributions of source code must retain the above copyright notice,
- *      this list of conditions and the following disclaimer.
- *   2. Redistributions in binary form must reproduce the above copyright notice,
- *      this list of conditions and the following disclaimer in the documentation
- *      and/or other materials provided with the distribution.
- *   3. Neither the name of STMicroelectronics nor the names of its contributors
- *      may be used to endorse or promote products derived from this software
- *      without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- ******************************************************************************
- */ 
-
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-
-#ifndef __MICROSTEPPINGMOTOR_H
-#define __MICROSTEPPINGMOTOR_H
-
-#ifdef __cplusplus
- extern "C" {
-#endif 
-
-
-/* Includes ------------------------------------------------------------------*/
-
-#include <stdint.h>
-#include "component.h"
-   
-
-/* Types ---------------------------------------------------------------------*/
-
-/** @addtogroup BSP
-  * @{
-  */
-
-/** @addtogroup Components
-  * @{
-  */ 
-
-/** @defgroup MicrosteppingMotorDriver
-  * @{
-  */
-    
-/** @defgroup StepperMotorExportedTypes
-  * @{
-  */
-
-/**
-  * @brief The L6470 Registers Identifiers.
-  */
-typedef enum {
-  L6470_ABS_POS_ID = 0,         //!< Current position
-  L6470_EL_POS_ID,              //!< Electrical position
-  L6470_MARK_ID,                //!< Mark position
-  L6470_SPEED_ID,               //!< Current speed
-  L6470_ACC_ID,                 //!< Acceleration
-  L6470_DEC_ID,                 //!< Deceleration
-  L6470_MAX_SPEED_ID,           //!< Maximum speed
-  L6470_MIN_SPEED_ID,           //!< Minimum speed
-  L6470_FS_SPD_ID,              //!< Full-step speed
-  L6470_KVAL_HOLD_ID,           //!< Holding KVAL
-  L6470_KVAL_RUN_ID,            //!< Constant speed KVAL
-  L6470_KVAL_ACC_ID,            //!< Acceleration starting KVAL
-  L6470_KVAL_DEC_ID,            //!< Deceleration starting KVAL
-  L6470_INT_SPEED_ID,           //!< Intersect speed
-  L6470_ST_SLP_ID,              //!< Start slope
-  L6470_FN_SLP_ACC_ID,          //!< Acceleration final slope
-  L6470_FN_SLP_DEC_ID,          //!< Deceleration final slope
-  L6470_K_THERM_ID,             //!< Thermal compensation factor
-  L6470_ADC_OUT_ID,             //!< ADC output, (the reset value is according to startup conditions)
-  L6470_OCD_TH_ID,              //!< OCD threshold
-  L6470_STALL_TH_ID,            //!< STALL threshold
-  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)  
-} eL6470_RegId_t;
-
-/**
-  * @brief The L6470 Application Commands Identifiers.
-  */
-typedef enum {
-  L6470_NOP_ID = 0,             //!< Nothing
-  L6470_SETPARAM_ID,            //!< Writes VALUE in PARAM register
-  L6470_GETPARAM_ID,            //!< Returns the stored value in PARAM register
-  L6470_RUN_ID,                 //!< Sets the target speed and the motor direction
-  L6470_STEPCLOCK_ID,           //!< Puts the device into Step-clock mode and imposes DIR direction
-  L6470_MOVE_ID,                //!< Makes N_STEP (micro)steps in DIR direction (Not performable when motor is running)
-  L6470_GOTO_ID,                //!< Brings motor into ABS_POS position (minimum path)
-  L6470_GOTODIR_ID,             //!< Brings motor into ABS_POS position forcing DIR direction
-  L6470_GOUNTIL_ID,             //!< Performs a motion in DIR direction with speed SPD until SW is closed, the ACT action is executed then a SoftStop takes place
-  L6470_RELEASESW_ID,           //!< Performs a motion in DIR direction at minimum speed until the SW is released (open), the ACT action is executed then a HardStop takes place
-  L6470_GOHOME_ID,              //!< Brings the motor into HOME position
-  L6470_GOMARK_ID,              //!< Brings the motor into MARK position
-  L6470_RESETPOS_ID,            //!< Resets the ABS_POS register (set HOME position)
-  L6470_RESETDEVICE_ID,         //!< Device is reset to power-up conditions
-  L6470_SOFTSTOP_ID,            //!< Stops motor with a deceleration phase
-  L6470_HARDSTOP_ID,            //!< Stops motor immediately
-  L6470_SOFTHIZ_ID,             //!< Puts the bridges into high impedance status after a deceleration phase
-  L6470_HARDHIZ_ID,             //!< Puts the bridges into high impedance status immediately
-  L6470_GETSTATUS_ID            //!< Returns the STATUS register value
-} eL6470_AppCmdId_t;
-
-/**
-  * @brief The L6470 Status Register Flag identifiers.
-  */
-typedef enum {
-  HiZ_ID = 0,                       //!< HiZ flag identifier inside the L6470 Status Register
-  BUSY_ID,                          //!< BUSY flag identifier inside the L6470 Status Register
-  SW_F_ID,                          //!< SW_F flag identifier inside the L6470 Status Register
-  SW_EVN_ID,                        //!< SW_EVN flag identifier inside the L6470 Status Register
-  DIR_ID,                           //!< DIR flag identifier inside the L6470 Status Register
-  MOT_STATUS_ID,                    //!< MOT_STATUS flag identifier inside the L6470 Status Register
-  NOTPERF_CMD_ID,                   //!< NOTPERF_CMD flag identifier inside the L6470 Status Register
-  WRONG_CMD_ID,                     //!< WRONG_CMD flag identifier inside the L6470 Status Register
-  UVLO_ID,                          //!< UVLO flag identifier inside the L6470 Status Register
-  TH_WRN_ID,                        //!< TH_WRN flag identifier inside the L6470 Status Register
-  TH_SD_ID,                         //!< TH_SD flag identifier inside the L6470 Status Register
-  OCD_ID,                           //!< OCD flag identifier inside the L6470 Status Register
-  STEP_LOSS_A_ID,                   //!< STEP_LOSS_A flag identifier inside the L6470 Status Register
-  STEP_LOSS_B_ID,                   //!< STEP_LOSS_B flag identifier inside the L6470 Status Register
-  SCK_MOD_ID                        //!< SCK_MOD flag identifier inside the L6470 Status Register
-} eL6470_StatusRegisterFlagId_t;
-
-/**
-  * @brief The L6470 Direction identifiers.
-  */
-typedef enum {
-  L6470_DIR_REV_ID = 0,             //!< Reverse direction
-  L6470_DIR_FWD_ID                  //!< Forward direction
-} eL6470_DirId_t;
-
-/**
-  * @brief The L6470 Action identifiers about ABS_POS register.
-  */
-typedef enum {
-  L6470_ACT_RST_ID = 0,             //!< ABS_POS register is reset
-  L6470_ACT_CPY_ID                  //!< ABS_POS register value is copied into the MARK register
-} eL6470_ActId_t;
-
-/**
-  * @brief The L6470 Status Register Flag states.
-  */
-typedef enum {
-  ZERO_F = 0,                       //!< The flag is '0'
-  ONE_F = !ZERO_F                   //!< The flag is '1'
-} eFlagStatus_t;
-
-/**
-  * @brief The L6470 Motor Directions.
-  */
-typedef enum {
-  REVERSE_F = 0,                    //!< Reverse motor direction
-  FORWARD_F = !REVERSE_F            //!< Forward motor direction
-} eMotorDirection_t;
-
-/**
-  * @brief The L6470 Motor Status.
-  */
-typedef enum {
-  STOPPED_F = 0,                    //!< Stopped
-  ACCELERATION_F = 1,               //!< Acceleration
-  DECELERATION_F = 2,               //!< Deceleration
-  CONSTANTSPEED_F = 3               //!< Constant speed
-} eMotorStatus_t;
-
-/**
-  * @brief  The possible stepping modes for L6470.
-  */
-typedef enum
-{
-  FULL_STEP       = 0x00,   //!< Full-step
-  HALF_STEP       = 0x01,   //!< Half-step
-  MICROSTEP_1_4   = 0x02,   //!< 1/4 microstep
-  MICROSTEP_1_8   = 0x03,   //!< 1/8 microstep
-  MICROSTEP_1_16  = 0x04,   //!< 1/16 microstep
-  MICROSTEP_1_32  = 0x05,   //!< 1/32 microstep
-  MICROSTEP_1_64  = 0x06,   //!< 1/64 microstep
-  MICROSTEP_1_128 = 0x07    //!< 1/128 microstep
-} eMotorStepMode_t;
-
-/**
-  * @brief  The identifiers for the possible L6470 alarm conditions.
-  */
-typedef enum
-{
-  L6470_OVERCURRENT                       = 0x01, //!< Overcurrent
-  L6470_THERMAL_SHUTDOWN                  = 0x02, //!< Thermal shutdown
-  L6470_THERMAL_WARNING                   = 0x04, //!< Thermal warning
-  L6470_UNDERVOLTAGE                      = 0x08, //!< Undervoltage
-  L6470_STALL_DETECTION_A                 = 0x10, //!< Stall detection (Bridge A)
-  L6470_STALL_DETECTION_B                 = 0x20, //!< Stall detection (Bridge B)
-  L6470_SWITCH_TURN_ON_EVENT              = 0x40, //!< Switch turn-on event
-  L6470_WRONG_OR_NON_PERFORMABLE_COMMAND  = 0x80  //!< Wrong or non-performable command
-} eL6470_AlarmCondition_t;
-
-/**
-  * @brief The L6470 STEP_MODE Register (see L6470 DataSheet for more details).
-  */
-typedef struct {
-  uint8_t STEP_SEL: 3;              //!< Step mode
-  uint8_t WRT: 1;                   //!< When the register is written, this bit should be set to 0.
-  uint8_t SYNC_SEL: 3;              //!< Synchronization selection
-  uint8_t SYNC_EN: 1;               //!< Synchronization enable
-} sL6470_StepModeRegister_t;
-
-/**
-  * @brief The L6470 ALARM_EN Register (see L6470 DataSheet for more details).
-  */
-typedef struct {
-  uint8_t OCD_EN: 1;                //!< Overcurrent
-  uint8_t TH_SD_EN: 1;              //!< Thermal shutdown
-  uint8_t TH_WRN_EN: 1;             //!< Thermal warning
-  uint8_t UVLO_EN: 1;               //!< Undervoltage
-  uint8_t STEP_LOSS_A_EN: 1;        //!< Stall detection (Bridge A)
-  uint8_t STEP_LOSS_B_EN: 1;        //!< Stall detection (Bridge B)
-  uint8_t SW_EVN_EN: 1;             //!< Switch turn-on event
-  uint8_t WRONG_NOTPERF_CMD_EN: 1;  //!< Wrong or non-performable command
-} sL6470_AlarmEnRegister_t;
-
-/**
-  * @brief The L6470 CONFIG Register (see L6470 DataSheet for more details).
-  */
-typedef struct {
-  uint8_t OSC_SEL: 3;               //!< Oscillator Selection
-  uint8_t EXT_CLK: 1;               //!< External Clock
-  uint8_t SW_MODE: 1;               //!< Switch mode
-  uint8_t EN_VSCOMP: 1;             //!< Motor supply voltage compensation
-  uint8_t RESERVED: 1;              //!< RESERVED
-  uint8_t OC_SD: 1;                 //!< Overcurrent event
-  uint8_t POW_SR: 2;                //!< Output slew rate
-  uint8_t F_PWM_DEC: 3;             //!< Multiplication factor
-  uint8_t F_PWM_INT: 3;             //!< Integer division factor
-} sL6470_ConfigRegister_t;
-
-/**
-  * @brief The L6470 STATUS Register (see L6470 DataSheet for more details).
-  */
-typedef struct {
-  uint8_t HiZ: 1;                   //!< The bridges are in high impedance state (the flag is active high)
-  uint8_t BUSY: 1;                  //!< BUSY pin status (the flag is active low)
-  uint8_t SW_F: 1;                  //!< SW input status (the flag is low for open and high for closed)
-  uint8_t SW_EVN: 1;                //!< Switch turn-on event (the flag is active high)
-  uint8_t DIR: 1;                   //!< The current motor direction (1 as forward, 0 as reverse)
-  uint8_t MOT_STATUS: 2;            //!< The current motor status (0 as stopped, 1 as acceleration, 2 as deceleration, 3 as constant speed)
-  uint8_t NOTPERF_CMD: 1;           //!< The command received by SPI cannot be performed (the flag is active high)
-  uint8_t WRONG_CMD: 1;             //!< The command received by SPI does not exist at all (the flag is active high)
-  uint8_t UVLO: 1;                  //!< Undervoltage lockout or reset events (the flag is active low)
-  uint8_t TH_WRN: 1;                //!< Thermal warning event (the flag is active low)
-  uint8_t TH_SD: 1;                 //!< Thermal shutdown event (the flag is active low)
-  uint8_t OCD: 1;                   //!< Overcurrent detection event (the flag is active low)
-  uint8_t STEP_LOSS_A: 1;           //!< Stall detection on bridge A (the flag is active low)
-  uint8_t STEP_LOSS_B: 1;           //!< Stall detection on bridge B (the flag is active low)
-  uint8_t SCK_MOD: 1;               //!< Step-clock mode (the flag is active high)
-} sL6470_StatusRegister_t;
-
-/**
-  * @brief Stepper Motor Registers
-  */
-typedef struct
-{
-  uint32_t  ABS_POS;                //!< CurrentPosition Register
-  uint16_t  EL_POS;                 //!< ElectricalPosition Register
-  uint32_t  MARK;                   //!< MarkPosition Register
-  uint32_t  SPEED;                  //!< CurrentSpeed Register
-  uint16_t  ACC;                    //!< Acceleration Register
-  uint16_t  DEC;                    //!< Deceleration Register
-  uint16_t  MAX_SPEED;              //!< MaximumSpeed Register
-  uint16_t  MIN_SPEED;              //!< MinimumSpeed Register
-  uint16_t  FS_SPD;                 //!< FullStepSpeed Register
-  uint8_t   KVAL_HOLD;              //!< HoldingKval Register
-  uint8_t   KVAL_RUN;               //!< ConstantSpeedKval Register
-  uint8_t   KVAL_ACC;               //!< AccelerationStartingKval Register
-  uint8_t   KVAL_DEC;               //!< DecelerationStartingKval Register
-  uint16_t  INT_SPEED;              //!< IntersectSpeed Register
-  uint8_t   ST_SLP;                 //!< StartSlope Register
-  uint8_t   FN_SLP_ACC;             //!< AccelerationFinalSlope Register
-  uint8_t   FN_SLP_DEC;             //!< DecelerationFinalSlope Register
-  uint8_t   K_THERM;                //!< ThermalCompensationFactor Register
-  uint8_t   ADC_OUT;                //!< AdcOutput Register
-  uint8_t   OCD_TH;                 //!< OcdThreshold Register
-  uint8_t   STALL_TH;               //!< StallThreshold Register
-  uint8_t   STEP_MODE;              //!< StepMode Register
-  uint8_t   ALARM_EN;               //!< AlarmEnable Register
-  uint16_t  CONFIG;                 //!< Config Register
-  uint16_t  STATUS;                 //!< Status Register
-} StepperMotorRegister_t;
-
-/** 
- * @brief  MICROSTEPPING_MOTOR driver virtual table structure definition.
- */
-typedef struct
-{
-  /* ACTION ----------------------------------------------------------------*
-   * Declare here the component's generic functions.                        *
-   * Tag this group of functions with the " Generic " C-style comment.      *
-   * A component's interface has to define at least the two generic         *
-   * functions provided here below within the "Example" section, as the     *
-   * first and second functions of its Virtual Table. They have to be       *
-   * specified exactly in the given way.                                    *
-   *                                                                        *
-   * Example:                                                               *
-   *   Status_t (*Init)   (void *handle, void *init);                       *
-   *   Status_t (*ReadID) (void *handle, uint8_t *id);                      *
-   *------------------------------------------------------------------------*/
-  /* Generic */
-  Status_t (*Init)(void *handle, void *init);
-  Status_t (*ReadID)(void *handle, uint8_t *id);
-  
-  /* ACTION ----------------------------------------------------------------*
-   * Declare here the component's specific functions.                       *
-   * Tag this group of functions with the " Specific " C-style comment.     *
-   * Do not specify any function if not required.                           *
-   *                                                                        *
-   * Example:                                                               *
-   *   Status_t (*GetValue) (void *handle, float *f);                       *
-   *------------------------------------------------------------------------*/
-  /* Specific */
-  void     (*SetParam)(void *handle, eL6470_RegId_t L6470_RegId, uint32_t Value);
-  uint32_t (*GetParam)(void *handle, eL6470_RegId_t L6470_RegId);
-  void     (*Run)(void *handle, eL6470_DirId_t L6470_DirId, uint32_t Speed);
-  void     (*StepClock)(void *handle, eL6470_DirId_t L6470_DirId);
-  void     (*Move)(void *handle, eL6470_DirId_t L6470_DirId, uint32_t N_Step);
-  void     (*GoTo)(void *handle, uint32_t AbsPos);
-  void     (*GoToDir)(void *handle, eL6470_DirId_t L6470_DirId, uint32_t AbsPos);
-  void     (*GoUntil)(void *handle, eL6470_ActId_t L6470_ActId, eL6470_DirId_t L6470_DirId, uint32_t Speed);
-  void     (*ReleaseSW)(void *handle, eL6470_ActId_t L6470_ActId, eL6470_DirId_t L6470_DirId);
-  void     (*GoHome)(void *handle);
-  void     (*GoMark)(void *handle);
-  void     (*ResetPos)(void *handle);
-  void     (*ResetDevice)(void *handle);
-  void     (*SoftStop)(void *handle);
-  void     (*HardStop)(void *handle);
-  void     (*SoftHiZ)(void *handle);
-  void     (*HardHiZ)(void *handle);
-  uint16_t (*GetStatus)(void *handle);
-  void     (*PrepareSetParam)(void *handle, eL6470_RegId_t L6470_RegId, uint32_t Value);
-  void     (*PrepareGetParam)(void *handle, eL6470_RegId_t L6470_RegId);
-  void     (*PrepareRun)(void *handle, eL6470_DirId_t L6470_DirId, uint32_t Speed);
-  void     (*PrepareStepClock)(void *handle, eL6470_DirId_t L6470_DirId);
-  void     (*PrepareMove)(void *handle, eL6470_DirId_t L6470_DirId, uint32_t N_Step);
-  void     (*PrepareGoTo)(void *handle, uint32_t AbsPos);
-  void     (*PrepareGoToDir)(void *handle, eL6470_DirId_t L6470_DirId, uint32_t AbsPos);
-  void     (*PrepareGoUntil)(void *handle, eL6470_ActId_t L6470_ActId, eL6470_DirId_t L6470_DirId, uint32_t Speed);
-  void     (*PrepareReleaseSW)(void *handle, eL6470_ActId_t L6470_ActId, eL6470_DirId_t L6470_DirId);
-  void     (*PrepareGoHome)(void *handle);
-  void     (*PrepareGoMark)(void *handle);
-  void     (*PrepareResetPos)(void *handle);
-  void     (*PrepareResetDevice)(void *handle);
-  void     (*PrepareSoftStop)(void *handle);
-  void     (*PrepareHardStop)(void *handle);
-  void     (*PrepareSoftHiZ)(void *handle);
-  void     (*PrepareHardHiZ)(void *handle);
-  void     (*PrepareGetStatus)(void *handle);
-  uint8_t  (*CheckStatusRegisterFlag)(void *handle, uint8_t L6470_StatusRegisterFlagId);
-  uint8_t* (*PerformPreparedApplicationCommand)(void *handle);
-  uint8_t* (*GetRegisterName)(void *handle, uint8_t id);
-  int32_t  (*AbsPos_2_Position)(void *handle, uint32_t AbsPos);
-  uint32_t (*Position_2_AbsPos)(void *handle, int32_t Position);
-  float    (*Speed_2_Step_s)(void *handle, uint32_t Speed);
-  uint32_t (*Step_s_2_Speed)(void *handle, float Step_s);
-  float    (*Acc_2_Step_s2)(void *handle, uint16_t Acc);
-  uint16_t (*Step_s2_2_Acc)(void *handle, float Step_s2);
-  float    (*Dec_2_Step_s2)(void *handle, uint16_t Dec);
-  uint16_t (*Step_s2_2_Dec)(void *handle, float Step_s2);
-  float    (*MaxSpeed_2_Step_s)(void *handle, uint16_t MaxSpeed);
-  uint16_t (*Step_s_2_MaxSpeed)(void *handle, float Step_s);
-  float    (*MinSpeed_2_Step_s)(void *handle, uint16_t MinSpeed);
-  uint16_t (*Step_s_2_MinSpeed)(void *handle, float Step_s);
-  float    (*FsSpd_2_Step_s)(void *handle, uint16_t FsSpd);
-  uint16_t (*Step_s_2_FsSpd)(void *handle, float Step_s);
-  float    (*IntSpeed_2_Step_s)(void *handle, uint16_t IntSpeed);
-  uint16_t (*Step_s_2_IntSpeed)(void *handle, float Step_s);
-  float    (*StSlp_2_s_Step)(void *handle, uint8_t StSlp);
-  uint8_t  (*s_Step_2_StSlp)(void *handle, float s_Step);
-  float    (*FnSlpAcc_2_s_Step)(void *handle, uint8_t FnSlpAcc);
-  uint8_t  (*s_Step_2_FnSlpAcc)(void *handle, float s_Step);
-  float    (*FnSlpDec_2_s_Step)(void *handle, uint8_t FnSlpDec);
-  uint8_t  (*s_Step_2_FnSlpDec)(void *handle, float s_Step);
-  float    (*OcdTh_2_mA)(void *handle, uint8_t OcdTh);
-  uint8_t  (*mA_2_OcdTh)(void *handle, float mA);
-  float    (*StallTh_2_mA)(void *handle, uint8_t StallTh);
-  uint8_t  (*mA_2_StallTh)(void *handle, float mA);
-  uint32_t (*ExtractReturnedData)(void *handle, uint8_t* pL6470_DaisyChainSpiRxStruct, uint8_t LengthByte);
-} MICROSTEPPING_MOTOR_VTable_t;
-
-/**
-  * @brief Stepper Motor Board Driver Structure
-  */
-typedef struct
-{
-  void     (*SetParam)(uint8_t, uint8_t, eL6470_RegId_t, uint32_t);
-  uint32_t (*GetParam)(uint8_t, uint8_t, eL6470_RegId_t);
-  void     (*Run)(uint8_t, uint8_t, eL6470_DirId_t, uint32_t);
-  void     (*StepClock)(uint8_t, uint8_t, eL6470_DirId_t);
-  void     (*Move)(uint8_t, uint8_t, eL6470_DirId_t, uint32_t);
-  void     (*GoTo)(uint8_t, uint8_t L6470_Id, uint32_t AbsPos);
-  void     (*GoToDir)(uint8_t, uint8_t, eL6470_DirId_t, uint32_t);
-  void     (*GoUntil)(uint8_t, uint8_t, eL6470_ActId_t, eL6470_DirId_t, uint32_t);
-  void     (*ReleaseSW)(uint8_t, uint8_t, eL6470_ActId_t, eL6470_DirId_t);
-  void     (*GoHome)(uint8_t, uint8_t);
-  void     (*GoMark)(uint8_t, uint8_t);
-  void     (*ResetPos)(uint8_t, uint8_t);
-  void     (*ResetDevice)(uint8_t, uint8_t);
-  void     (*SoftStop)(uint8_t, uint8_t);
-  void     (*HardStop)(uint8_t, uint8_t);
-  void     (*SoftHiZ)(uint8_t, uint8_t);
-  void     (*HardHiZ)(uint8_t, uint8_t);
-  uint16_t (*GetStatus)(uint8_t, uint8_t);
-  uint8_t  (*CheckStatusRegisterFlag)(uint8_t, uint8_t, uint8_t);
-  uint8_t* (*PerformPreparedApplicationCommand)(uint8_t);
-} MICROSTEPPING_MOTOR_EB_VTable_t;
-
-/**
-  * @brief  Stepper Motor Handle Structure
-  */
-typedef struct __StepperMotorDriver_HandleTypeDef
-{
-  uint8_t DaisyChainPosition;
-  void (*Config)(void*);
-  MICROSTEPPING_MOTOR_VTable_t *Command;
-} StepperMotorDriverHandle_t;
-
-/**
-  * @brief  Stepper Motor Handle Structure  
-  */ 
-typedef struct __StepperMotorBoard_HandleTypeDef
-{
-  uint8_t StackedPosition;
-  void (*Config)(void*);
-  MICROSTEPPING_MOTOR_EB_VTable_t *Command;
-  StepperMotorDriverHandle_t *StepperMotorDriverHandle[2];
-  uint8_t (*Select)(uint8_t);
-} StepperMotorBoardHandle_t;
-
-/**
-  * @}
-  */    /* StepperMotorExportedTypes */
-
-/**
-  * @}
-  */    /* MicrosteppingMotorDriver */
-  
-/**
-  * @}
-  */    /* Components */
-
-/**
-  * @}
-  */    /* BSP */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __MICROSTEPPINGMOTOR_H */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Components/Common/microstepping_motor_def.h	Fri Mar 10 11:09:21 2017 +0100
@@ -0,0 +1,484 @@
+/**
+ ******************************************************************************
+ * @file    microstepping_motor_def.h
+ * @author  IPD SYSTEM LAB & TECH MKTG
+ * @version V0.0.1
+ * @date    04-June-2015
+ * @brief   This file contains all the functions prototypes for the microstepping
+ *          motor driver with motion engine.   
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *   1. Redistributions of source code must retain the above copyright notice,
+ *      this list of conditions and the following disclaimer.
+ *   2. Redistributions in binary form must reproduce the above copyright notice,
+ *      this list of conditions and the following disclaimer in the documentation
+ *      and/or other materials provided with the distribution.
+ *   3. Neither the name of STMicroelectronics nor the names of its contributors
+ *      may be used to endorse or promote products derived from this software
+ *      without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ******************************************************************************
+ */ 
+
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+
+#ifndef __MICROSTEPPINGMOTOR_H
+#define __MICROSTEPPINGMOTOR_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif 
+
+
+/* Includes ------------------------------------------------------------------*/
+
+#include <stdint.h>
+#include "component_def.h"
+   
+
+/* Types ---------------------------------------------------------------------*/
+
+/** @addtogroup BSP
+  * @{
+  */
+
+/** @addtogroup Components
+  * @{
+  */ 
+
+/** @defgroup MicrosteppingMotorDriver
+  * @{
+  */
+    
+/** @defgroup StepperMotorExportedTypes
+  * @{
+  */
+
+/**
+  * @brief The L6470 Registers Identifiers.
+  */
+typedef enum {
+  L6470_ABS_POS_ID = 0,         //!< Current position
+  L6470_EL_POS_ID,              //!< Electrical position
+  L6470_MARK_ID,                //!< Mark position
+  L6470_SPEED_ID,               //!< Current speed
+  L6470_ACC_ID,                 //!< Acceleration
+  L6470_DEC_ID,                 //!< Deceleration
+  L6470_MAX_SPEED_ID,           //!< Maximum speed
+  L6470_MIN_SPEED_ID,           //!< Minimum speed
+  L6470_FS_SPD_ID,              //!< Full-step speed
+  L6470_KVAL_HOLD_ID,           //!< Holding KVAL
+  L6470_KVAL_RUN_ID,            //!< Constant speed KVAL
+  L6470_KVAL_ACC_ID,            //!< Acceleration starting KVAL
+  L6470_KVAL_DEC_ID,            //!< Deceleration starting KVAL
+  L6470_INT_SPEED_ID,           //!< Intersect speed
+  L6470_ST_SLP_ID,              //!< Start slope
+  L6470_FN_SLP_ACC_ID,          //!< Acceleration final slope
+  L6470_FN_SLP_DEC_ID,          //!< Deceleration final slope
+  L6470_K_THERM_ID,             //!< Thermal compensation factor
+  L6470_ADC_OUT_ID,             //!< ADC output, (the reset value is according to startup conditions)
+  L6470_OCD_TH_ID,              //!< OCD threshold
+  L6470_STALL_TH_ID,            //!< STALL threshold
+  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)  
+} eL6470_RegId_t;
+
+/**
+  * @brief The L6470 Application Commands Identifiers.
+  */
+typedef enum {
+  L6470_NOP_ID = 0,             //!< Nothing
+  L6470_SETPARAM_ID,            //!< Writes VALUE in PARAM register
+  L6470_GETPARAM_ID,            //!< Returns the stored value in PARAM register
+  L6470_RUN_ID,                 //!< Sets the target speed and the motor direction
+  L6470_STEPCLOCK_ID,           //!< Puts the device into Step-clock mode and imposes DIR direction
+  L6470_MOVE_ID,                //!< Makes N_STEP (micro)steps in DIR direction (Not performable when motor is running)
+  L6470_GOTO_ID,                //!< Brings motor into ABS_POS position (minimum path)
+  L6470_GOTODIR_ID,             //!< Brings motor into ABS_POS position forcing DIR direction
+  L6470_GOUNTIL_ID,             //!< Performs a motion in DIR direction with speed SPD until SW is closed, the ACT action is executed then a SoftStop takes place
+  L6470_RELEASESW_ID,           //!< Performs a motion in DIR direction at minimum speed until the SW is released (open), the ACT action is executed then a HardStop takes place
+  L6470_GOHOME_ID,              //!< Brings the motor into HOME position
+  L6470_GOMARK_ID,              //!< Brings the motor into MARK position
+  L6470_RESETPOS_ID,            //!< Resets the ABS_POS register (set HOME position)
+  L6470_RESETDEVICE_ID,         //!< Device is reset to power-up conditions
+  L6470_SOFTSTOP_ID,            //!< Stops motor with a deceleration phase
+  L6470_HARDSTOP_ID,            //!< Stops motor immediately
+  L6470_SOFTHIZ_ID,             //!< Puts the bridges into high impedance status after a deceleration phase
+  L6470_HARDHIZ_ID,             //!< Puts the bridges into high impedance status immediately
+  L6470_GETSTATUS_ID            //!< Returns the STATUS register value
+} eL6470_AppCmdId_t;
+
+/**
+  * @brief The L6470 Status Register Flag identifiers.
+  */
+typedef enum {
+  HiZ_ID = 0,                       //!< HiZ flag identifier inside the L6470 Status Register
+  BUSY_ID,                          //!< BUSY flag identifier inside the L6470 Status Register
+  SW_F_ID,                          //!< SW_F flag identifier inside the L6470 Status Register
+  SW_EVN_ID,                        //!< SW_EVN flag identifier inside the L6470 Status Register
+  DIR_ID,                           //!< DIR flag identifier inside the L6470 Status Register
+  MOT_STATUS_ID,                    //!< MOT_STATUS flag identifier inside the L6470 Status Register
+  NOTPERF_CMD_ID,                   //!< NOTPERF_CMD flag identifier inside the L6470 Status Register
+  WRONG_CMD_ID,                     //!< WRONG_CMD flag identifier inside the L6470 Status Register
+  UVLO_ID,                          //!< UVLO flag identifier inside the L6470 Status Register
+  TH_WRN_ID,                        //!< TH_WRN flag identifier inside the L6470 Status Register
+  TH_SD_ID,                         //!< TH_SD flag identifier inside the L6470 Status Register
+  OCD_ID,                           //!< OCD flag identifier inside the L6470 Status Register
+  STEP_LOSS_A_ID,                   //!< STEP_LOSS_A flag identifier inside the L6470 Status Register
+  STEP_LOSS_B_ID,                   //!< STEP_LOSS_B flag identifier inside the L6470 Status Register
+  SCK_MOD_ID                        //!< SCK_MOD flag identifier inside the L6470 Status Register
+} eL6470_StatusRegisterFlagId_t;
+
+/**
+  * @brief The L6470 Direction identifiers.
+  */
+typedef enum {
+  L6470_DIR_REV_ID = 0,             //!< Reverse direction
+  L6470_DIR_FWD_ID                  //!< Forward direction
+} eL6470_DirId_t;
+
+/**
+  * @brief The L6470 Action identifiers about ABS_POS register.
+  */
+typedef enum {
+  L6470_ACT_RST_ID = 0,             //!< ABS_POS register is reset
+  L6470_ACT_CPY_ID                  //!< ABS_POS register value is copied into the MARK register
+} eL6470_ActId_t;
+
+/**
+  * @brief The L6470 Status Register Flag states.
+  */
+typedef enum {
+  ZERO_F = 0,                       //!< The flag is '0'
+  ONE_F = !ZERO_F                   //!< The flag is '1'
+} eFlagStatus_t;
+
+/**
+  * @brief The L6470 Motor Directions.
+  */
+typedef enum {
+  REVERSE_F = 0,                    //!< Reverse motor direction
+  FORWARD_F = !REVERSE_F            //!< Forward motor direction
+} eMotorDirection_t;
+
+/**
+  * @brief The L6470 Motor Status.
+  */
+typedef enum {
+  STOPPED_F = 0,                    //!< Stopped
+  ACCELERATION_F = 1,               //!< Acceleration
+  DECELERATION_F = 2,               //!< Deceleration
+  CONSTANTSPEED_F = 3               //!< Constant speed
+} eMotorStatus_t;
+
+/**
+  * @brief  The possible stepping modes for L6470.
+  */
+typedef enum
+{
+  FULL_STEP       = 0x00,   //!< Full-step
+  HALF_STEP       = 0x01,   //!< Half-step
+  MICROSTEP_1_4   = 0x02,   //!< 1/4 microstep
+  MICROSTEP_1_8   = 0x03,   //!< 1/8 microstep
+  MICROSTEP_1_16  = 0x04,   //!< 1/16 microstep
+  MICROSTEP_1_32  = 0x05,   //!< 1/32 microstep
+  MICROSTEP_1_64  = 0x06,   //!< 1/64 microstep
+  MICROSTEP_1_128 = 0x07    //!< 1/128 microstep
+} eMotorStepMode_t;
+
+/**
+  * @brief  The identifiers for the possible L6470 alarm conditions.
+  */
+typedef enum
+{
+  L6470_OVERCURRENT                       = 0x01, //!< Overcurrent
+  L6470_THERMAL_SHUTDOWN                  = 0x02, //!< Thermal shutdown
+  L6470_THERMAL_WARNING                   = 0x04, //!< Thermal warning
+  L6470_UNDERVOLTAGE                      = 0x08, //!< Undervoltage
+  L6470_STALL_DETECTION_A                 = 0x10, //!< Stall detection (Bridge A)
+  L6470_STALL_DETECTION_B                 = 0x20, //!< Stall detection (Bridge B)
+  L6470_SWITCH_TURN_ON_EVENT              = 0x40, //!< Switch turn-on event
+  L6470_WRONG_OR_NON_PERFORMABLE_COMMAND  = 0x80  //!< Wrong or non-performable command
+} eL6470_AlarmCondition_t;
+
+/**
+  * @brief The L6470 STEP_MODE Register (see L6470 DataSheet for more details).
+  */
+typedef struct {
+  uint8_t STEP_SEL: 3;              //!< Step mode
+  uint8_t WRT: 1;                   //!< When the register is written, this bit should be set to 0.
+  uint8_t SYNC_SEL: 3;              //!< Synchronization selection
+  uint8_t SYNC_EN: 1;               //!< Synchronization enable
+} sL6470_StepModeRegister_t;
+
+/**
+  * @brief The L6470 ALARM_EN Register (see L6470 DataSheet for more details).
+  */
+typedef struct {
+  uint8_t OCD_EN: 1;                //!< Overcurrent
+  uint8_t TH_SD_EN: 1;              //!< Thermal shutdown
+  uint8_t TH_WRN_EN: 1;             //!< Thermal warning
+  uint8_t UVLO_EN: 1;               //!< Undervoltage
+  uint8_t STEP_LOSS_A_EN: 1;        //!< Stall detection (Bridge A)
+  uint8_t STEP_LOSS_B_EN: 1;        //!< Stall detection (Bridge B)
+  uint8_t SW_EVN_EN: 1;             //!< Switch turn-on event
+  uint8_t WRONG_NOTPERF_CMD_EN: 1;  //!< Wrong or non-performable command
+} sL6470_AlarmEnRegister_t;
+
+/**
+  * @brief The L6470 CONFIG Register (see L6470 DataSheet for more details).
+  */
+typedef struct {
+  uint8_t OSC_SEL: 3;               //!< Oscillator Selection
+  uint8_t EXT_CLK: 1;               //!< External Clock
+  uint8_t SW_MODE: 1;               //!< Switch mode
+  uint8_t EN_VSCOMP: 1;             //!< Motor supply voltage compensation
+  uint8_t RESERVED: 1;              //!< RESERVED
+  uint8_t OC_SD: 1;                 //!< Overcurrent event
+  uint8_t POW_SR: 2;                //!< Output slew rate
+  uint8_t F_PWM_DEC: 3;             //!< Multiplication factor
+  uint8_t F_PWM_INT: 3;             //!< Integer division factor
+} sL6470_ConfigRegister_t;
+
+/**
+  * @brief The L6470 STATUS Register (see L6470 DataSheet for more details).
+  */
+typedef struct {
+  uint8_t HiZ: 1;                   //!< The bridges are in high impedance state (the flag is active high)
+  uint8_t BUSY: 1;                  //!< BUSY pin status (the flag is active low)
+  uint8_t SW_F: 1;                  //!< SW input status (the flag is low for open and high for closed)
+  uint8_t SW_EVN: 1;                //!< Switch turn-on event (the flag is active high)
+  uint8_t DIR: 1;                   //!< The current motor direction (1 as forward, 0 as reverse)
+  uint8_t MOT_STATUS: 2;            //!< The current motor status (0 as stopped, 1 as acceleration, 2 as deceleration, 3 as constant speed)
+  uint8_t NOTPERF_CMD: 1;           //!< The command received by SPI cannot be performed (the flag is active high)
+  uint8_t WRONG_CMD: 1;             //!< The command received by SPI does not exist at all (the flag is active high)
+  uint8_t UVLO: 1;                  //!< Undervoltage lockout or reset events (the flag is active low)
+  uint8_t TH_WRN: 1;                //!< Thermal warning event (the flag is active low)
+  uint8_t TH_SD: 1;                 //!< Thermal shutdown event (the flag is active low)
+  uint8_t OCD: 1;                   //!< Overcurrent detection event (the flag is active low)
+  uint8_t STEP_LOSS_A: 1;           //!< Stall detection on bridge A (the flag is active low)
+  uint8_t STEP_LOSS_B: 1;           //!< Stall detection on bridge B (the flag is active low)
+  uint8_t SCK_MOD: 1;               //!< Step-clock mode (the flag is active high)
+} sL6470_StatusRegister_t;
+
+/**
+  * @brief Stepper Motor Registers
+  */
+typedef struct
+{
+  uint32_t  ABS_POS;                //!< CurrentPosition Register
+  uint16_t  EL_POS;                 //!< ElectricalPosition Register
+  uint32_t  MARK;                   //!< MarkPosition Register
+  uint32_t  SPEED;                  //!< CurrentSpeed Register
+  uint16_t  ACC;                    //!< Acceleration Register
+  uint16_t  DEC;                    //!< Deceleration Register
+  uint16_t  MAX_SPEED;              //!< MaximumSpeed Register
+  uint16_t  MIN_SPEED;              //!< MinimumSpeed Register
+  uint16_t  FS_SPD;                 //!< FullStepSpeed Register
+  uint8_t   KVAL_HOLD;              //!< HoldingKval Register
+  uint8_t   KVAL_RUN;               //!< ConstantSpeedKval Register
+  uint8_t   KVAL_ACC;               //!< AccelerationStartingKval Register
+  uint8_t   KVAL_DEC;               //!< DecelerationStartingKval Register
+  uint16_t  INT_SPEED;              //!< IntersectSpeed Register
+  uint8_t   ST_SLP;                 //!< StartSlope Register
+  uint8_t   FN_SLP_ACC;             //!< AccelerationFinalSlope Register
+  uint8_t   FN_SLP_DEC;             //!< DecelerationFinalSlope Register
+  uint8_t   K_THERM;                //!< ThermalCompensationFactor Register
+  uint8_t   ADC_OUT;                //!< AdcOutput Register
+  uint8_t   OCD_TH;                 //!< OcdThreshold Register
+  uint8_t   STALL_TH;               //!< StallThreshold Register
+  uint8_t   STEP_MODE;              //!< StepMode Register
+  uint8_t   ALARM_EN;               //!< AlarmEnable Register
+  uint16_t  CONFIG;                 //!< Config Register
+  uint16_t  STATUS;                 //!< Status Register
+} StepperMotorRegister_t;
+
+/** 
+ * @brief  MICROSTEPPING_MOTOR driver virtual table structure definition.
+ */
+typedef struct
+{
+  /* ACTION ----------------------------------------------------------------*
+   * Declare here the component's generic functions.                        *
+   * Tag this group of functions with the " Generic " C-style comment.      *
+   * A component's interface has to define at least the two generic         *
+   * functions provided here below within the "Example" section, as the     *
+   * first and second functions of its Virtual Table. They have to be       *
+   * specified exactly in the given way.                                    *
+   *                                                                        *
+   * Example:                                                               *
+   *   status_t (*Init)   (void *handle, void *init);                       *
+   *   status_t (*ReadID) (void *handle, uint8_t *id);                      *
+   *------------------------------------------------------------------------*/
+  /* Generic */
+  status_t (*Init)(void *handle, void *init);
+  status_t (*ReadID)(void *handle, uint8_t *id);
+  
+  /* ACTION ----------------------------------------------------------------*
+   * Declare here the component's specific functions.                       *
+   * Tag this group of functions with the " Specific " C-style comment.     *
+   * Do not specify any function if not required.                           *
+   *                                                                        *
+   * Example:                                                               *
+   *   status_t (*GetValue) (void *handle, float *f);                       *
+   *------------------------------------------------------------------------*/
+  /* Specific */
+  void     (*SetParam)(void *handle, eL6470_RegId_t L6470_RegId, uint32_t Value);
+  uint32_t (*GetParam)(void *handle, eL6470_RegId_t L6470_RegId);
+  void     (*Run)(void *handle, eL6470_DirId_t L6470_DirId, uint32_t Speed);
+  void     (*StepClock)(void *handle, eL6470_DirId_t L6470_DirId);
+  void     (*Move)(void *handle, eL6470_DirId_t L6470_DirId, uint32_t N_Step);
+  void     (*GoTo)(void *handle, uint32_t AbsPos);
+  void     (*GoToDir)(void *handle, eL6470_DirId_t L6470_DirId, uint32_t AbsPos);
+  void     (*GoUntil)(void *handle, eL6470_ActId_t L6470_ActId, eL6470_DirId_t L6470_DirId, uint32_t Speed);
+  void     (*ReleaseSW)(void *handle, eL6470_ActId_t L6470_ActId, eL6470_DirId_t L6470_DirId);
+  void     (*GoHome)(void *handle);
+  void     (*GoMark)(void *handle);
+  void     (*ResetPos)(void *handle);
+  void     (*ResetDevice)(void *handle);
+  void     (*SoftStop)(void *handle);
+  void     (*HardStop)(void *handle);
+  void     (*SoftHiZ)(void *handle);
+  void     (*HardHiZ)(void *handle);
+  uint16_t (*GetStatus)(void *handle);
+  void     (*PrepareSetParam)(void *handle, eL6470_RegId_t L6470_RegId, uint32_t Value);
+  void     (*PrepareGetParam)(void *handle, eL6470_RegId_t L6470_RegId);
+  void     (*PrepareRun)(void *handle, eL6470_DirId_t L6470_DirId, uint32_t Speed);
+  void     (*PrepareStepClock)(void *handle, eL6470_DirId_t L6470_DirId);
+  void     (*PrepareMove)(void *handle, eL6470_DirId_t L6470_DirId, uint32_t N_Step);
+  void     (*PrepareGoTo)(void *handle, uint32_t AbsPos);
+  void     (*PrepareGoToDir)(void *handle, eL6470_DirId_t L6470_DirId, uint32_t AbsPos);
+  void     (*PrepareGoUntil)(void *handle, eL6470_ActId_t L6470_ActId, eL6470_DirId_t L6470_DirId, uint32_t Speed);
+  void     (*PrepareReleaseSW)(void *handle, eL6470_ActId_t L6470_ActId, eL6470_DirId_t L6470_DirId);
+  void     (*PrepareGoHome)(void *handle);
+  void     (*PrepareGoMark)(void *handle);
+  void     (*PrepareResetPos)(void *handle);
+  void     (*PrepareResetDevice)(void *handle);
+  void     (*PrepareSoftStop)(void *handle);
+  void     (*PrepareHardStop)(void *handle);
+  void     (*PrepareSoftHiZ)(void *handle);
+  void     (*PrepareHardHiZ)(void *handle);
+  void     (*PrepareGetStatus)(void *handle);
+  uint8_t  (*CheckStatusRegisterFlag)(void *handle, uint8_t L6470_StatusRegisterFlagId);
+  uint8_t* (*PerformPreparedApplicationCommand)(void *handle);
+  uint8_t* (*GetRegisterName)(void *handle, uint8_t id);
+  int32_t  (*AbsPos_2_Position)(void *handle, uint32_t AbsPos);
+  uint32_t (*Position_2_AbsPos)(void *handle, int32_t Position);
+  float    (*Speed_2_Step_s)(void *handle, uint32_t Speed);
+  uint32_t (*Step_s_2_Speed)(void *handle, float Step_s);
+  float    (*Acc_2_Step_s2)(void *handle, uint16_t Acc);
+  uint16_t (*Step_s2_2_Acc)(void *handle, float Step_s2);
+  float    (*Dec_2_Step_s2)(void *handle, uint16_t Dec);
+  uint16_t (*Step_s2_2_Dec)(void *handle, float Step_s2);
+  float    (*MaxSpeed_2_Step_s)(void *handle, uint16_t MaxSpeed);
+  uint16_t (*Step_s_2_MaxSpeed)(void *handle, float Step_s);
+  float    (*MinSpeed_2_Step_s)(void *handle, uint16_t MinSpeed);
+  uint16_t (*Step_s_2_MinSpeed)(void *handle, float Step_s);
+  float    (*FsSpd_2_Step_s)(void *handle, uint16_t FsSpd);
+  uint16_t (*Step_s_2_FsSpd)(void *handle, float Step_s);
+  float    (*IntSpeed_2_Step_s)(void *handle, uint16_t IntSpeed);
+  uint16_t (*Step_s_2_IntSpeed)(void *handle, float Step_s);
+  float    (*StSlp_2_s_Step)(void *handle, uint8_t StSlp);
+  uint8_t  (*s_Step_2_StSlp)(void *handle, float s_Step);
+  float    (*FnSlpAcc_2_s_Step)(void *handle, uint8_t FnSlpAcc);
+  uint8_t  (*s_Step_2_FnSlpAcc)(void *handle, float s_Step);
+  float    (*FnSlpDec_2_s_Step)(void *handle, uint8_t FnSlpDec);
+  uint8_t  (*s_Step_2_FnSlpDec)(void *handle, float s_Step);
+  float    (*OcdTh_2_mA)(void *handle, uint8_t OcdTh);
+  uint8_t  (*mA_2_OcdTh)(void *handle, float mA);
+  float    (*StallTh_2_mA)(void *handle, uint8_t StallTh);
+  uint8_t  (*mA_2_StallTh)(void *handle, float mA);
+  uint32_t (*ExtractReturnedData)(void *handle, uint8_t* pL6470_DaisyChainSpiRxStruct, uint8_t LengthByte);
+} MICROSTEPPING_MOTOR_VTable_t;
+
+/**
+  * @brief Stepper Motor Board Driver Structure
+  */
+typedef struct
+{
+  void     (*SetParam)(uint8_t, uint8_t, eL6470_RegId_t, uint32_t);
+  uint32_t (*GetParam)(uint8_t, uint8_t, eL6470_RegId_t);
+  void     (*Run)(uint8_t, uint8_t, eL6470_DirId_t, uint32_t);
+  void     (*StepClock)(uint8_t, uint8_t, eL6470_DirId_t);
+  void     (*Move)(uint8_t, uint8_t, eL6470_DirId_t, uint32_t);
+  void     (*GoTo)(uint8_t, uint8_t L6470_Id, uint32_t AbsPos);
+  void     (*GoToDir)(uint8_t, uint8_t, eL6470_DirId_t, uint32_t);
+  void     (*GoUntil)(uint8_t, uint8_t, eL6470_ActId_t, eL6470_DirId_t, uint32_t);
+  void     (*ReleaseSW)(uint8_t, uint8_t, eL6470_ActId_t, eL6470_DirId_t);
+  void     (*GoHome)(uint8_t, uint8_t);
+  void     (*GoMark)(uint8_t, uint8_t);
+  void     (*ResetPos)(uint8_t, uint8_t);
+  void     (*ResetDevice)(uint8_t, uint8_t);
+  void     (*SoftStop)(uint8_t, uint8_t);
+  void     (*HardStop)(uint8_t, uint8_t);
+  void     (*SoftHiZ)(uint8_t, uint8_t);
+  void     (*HardHiZ)(uint8_t, uint8_t);
+  uint16_t (*GetStatus)(uint8_t, uint8_t);
+  uint8_t  (*CheckStatusRegisterFlag)(uint8_t, uint8_t, uint8_t);
+  uint8_t* (*PerformPreparedApplicationCommand)(uint8_t);
+} MICROSTEPPING_MOTOR_EB_VTable_t;
+
+/**
+  * @brief  Stepper Motor Handle Structure
+  */
+typedef struct __StepperMotorDriver_HandleTypeDef
+{
+  uint8_t DaisyChainPosition;
+  void (*Config)(void*);
+  MICROSTEPPING_MOTOR_VTable_t *Command;
+} StepperMotorDriverHandle_t;
+
+/**
+  * @brief  Stepper Motor Handle Structure  
+  */ 
+typedef struct __StepperMotorBoard_HandleTypeDef
+{
+  uint8_t StackedPosition;
+  void (*Config)(void*);
+  MICROSTEPPING_MOTOR_EB_VTable_t *Command;
+  StepperMotorDriverHandle_t *StepperMotorDriverHandle[2];
+  uint8_t (*Select)(uint8_t);
+} StepperMotorBoardHandle_t;
+
+/**
+  * @}
+  */    /* StepperMotorExportedTypes */
+
+/**
+  * @}
+  */    /* MicrosteppingMotorDriver */
+  
+/**
+  * @}
+  */    /* Components */
+
+/**
+  * @}
+  */    /* BSP */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __MICROSTEPPINGMOTOR_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Components/l6470/L6470.cpp	Fri Mar 10 11:09:21 2017 +0100
@@ -0,0 +1,1460 @@
+/**
+ ******************************************************************************
+ * @file       l6470_class.cpp
+ * @date       01/10/2014 12:00:00
+ * @brief      This file provides set of firmware functions to manage the
+ *             L6470.
+ ******************************************************************************
+ *
+ * COPYRIGHT(c) 2014 STMicroelectronics
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *   1. Redistributions of source code must retain the above copyright notice,
+ *      this list of conditions and the following disclaimer.
+ *   2. Redistributions in binary form must reproduce the above copyright notice,
+ *      this list of conditions and the following disclaimer in the documentation
+ *      and/or other materials provided with the distribution.
+ *   3. Neither the name of STMicroelectronics nor the names of its contributors
+ *      may be used to endorse or promote products derived from this software
+ *      without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ******************************************************************************
+ */
+
+
+/* Generated with STM32CubeTOO -----------------------------------------------*/
+
+
+/* Revision ------------------------------------------------------------------*/
+/*
+    Repository:       http://svn.x-nucleodev.codex.cro.st.com/svnroot/X-NucleoDev
+    Branch/Trunk/Tag: trunk
+    Based on:         X-CUBE-SPN2/trunk/Drivers/BSP/Components/L6470/L6470.c
+    Revision:         0
+*/
+
+
+/* Includes ------------------------------------------------------------------*/
+
+#include "l6470.h"
+
+
+/* Variables -----------------------------------------------------------------*/
+
+/* Number of instantiated devices on an expansion board. */
+uint8_t L6470::number_of_devices = 0;
+
+/* SPI Transmission for Daisy-Chain Configuration. */
+eFlagStatus_t L6470::L6470_DaisyChain_HalfPrepared;
+sL6470_AppCmdPkg_t L6470::L6470_AppCmdPkg[L6470DAISYCHAINSIZE];
+uint8_t L6470::L6470_DaisyChainSpiTxStruct[L6470MAXSPICMDBYTESIZE][L6470DAISYCHAINSIZE];
+uint8_t L6470::L6470_DaisyChainSpiRxStruct[L6470MAXSPICMDBYTESIZE][L6470DAISYCHAINSIZE];
+
+/**
+  * @brief Array whose elements are a structure in which store information about
+  *        the L6470 Registers (the address, the names, the length in bits, the
+  *        reset value)
+  */
+const sL6470_Register_t L6470::_L6470_Register[L6470REGIDSIZE] = {
+  {0x01 , "ABS_POS",   22, 3, 0x000000},  //!< Current position
+  {0x02 , "EL_POS",     9, 2, 0x000},     //!< Electrical position
+  {0x03 , "MARK",      22, 3, 0x000000},  //!< Mark position
+  {0x04 , "SPEED",     20, 3, 0x0000},    //!< Current speed
+  {0x05 , "ACC",       12, 2, 0x08A},     //!< Acceleration
+  {0x06 , "DEC",       12, 2, 0x08A},     //!< Deceleration
+  {0x07 , "MAX_SPEED", 10, 2, 0x041},     //!< Maximum speed
+  {0x08 , "MIN_SPEED", 13, 2, 0x000},     //!< Minimum speed
+  {0x15 , "FS_SPD",    10, 2, 0x027},     //!< Full-step speed
+  {0x09 , "KVAL_HOLD",  8, 1, 0x29},      //!< Holding KVAL
+  {0x0A , "KVAL_RUN",   8, 1, 0x29},      //!< Constant speed KVAL
+  {0x0B , "KVAL_ACC",   8, 1, 0x29},      //!< Acceleration starting KVAL
+  {0x0C , "KVAL_DEC",   8, 1, 0x29},      //!< Deceleration starting KVAL
+  {0x0D , "INT_SPEED", 14, 2, 0x0408},    //!< Intersect speed
+  {0x0E , "ST_SLP",     8, 1, 0x19},      //!< Start slope
+  {0x0F , "FN_SLP_ACC", 8, 1, 0x29},      //!< Acceleration final slope
+  {0x10 , "FN_SLP_DEC", 8, 1, 0x29},      //!< Deceleration final slope
+  {0x11 , "K_THERM",    4, 1, 0x0},       //!< Thermal compensation factor
+  {0x12 , "ADC_OUT",    5, 1, 0x00},      //!< ADC output, (the reset value is according to startup conditions)
+  {0x13 , "OCD_TH",     4, 1, 0x8},       //!< OCD threshold
+  {0x14 , "STALL_TH",   7, 1, 0x40},      //!< STALL threshold
+  {0x16 , "STEP_MODE",  8, 1, 0x7},       //!< Step mode
+  {0x17 , "ALARM_EN",   8, 1, 0xFF},      //!< Alarm enable
+  {0x18 , "CONFIG",    16, 2, 0x2E88},    //!< IC configuration
+  {0x19 , "STATUS",    16, 2, 0x0000}     //!< Status, (the reset value is according to startup conditions)
+};
+
+/**
+  * @brief Array whose elements are a structure in which store information about
+  *        the L6470 Application Commands (the mnemonic name, the number of
+  *        needed parameters, the related funtion to call)
+  */
+const sL6470_ApplicationCommand_t L6470::_L6470_ApplicationCommand[L6470APPCMDIDSIZE] =  {
+  {"NOP",         0x00, 0},
+  {"SETPARAM",    0x00, 2},
+  {"GETPARAM",    0x20, 1},
+  {"RUN",         0x50, 2},
+  {"STEPCLOCK",   0x58, 1},
+  {"MOVE",        0x40, 2},
+  {"GOTO",        0x60, 1},
+  {"GOTO_DIR",    0x68, 2},
+  {"GOUNTIL",     0x82, 3},
+  {"RELEASESW",   0x92, 2},
+  {"GOHOME",      0x70, 0},
+  {"GOMARK",      0x78, 0},
+  {"RESETPOS",    0xD8, 0},
+  {"RESETDEVICE", 0xC0, 0},
+  {"SOFTSTOP",    0xB0, 0},
+  {"HARDSTOP",    0xB8, 0},
+  {"SOFTHIZ",     0xA0, 0},
+  {"HARDHIZ",     0xA8, 0},
+  {"GETSTATUS",   0xD0, 0}
+};
+
+/**
+  * @brief The mnemonic names for the L6470 direction
+  */
+const sL6470_Direction_t L6470::_L6470_Direction[L6470DIRIDSIZE] = {
+  {"REV", 0x00},  //!< Reverse direction
+  {"FWD", 0x01}   //!< Forward direction
+};
+
+/**
+  * @brief Action taken about ABS_POS register
+  */
+const sL6470_ACT_t L6470::_L6470_ACT[L6470ACTIDSIZE] = {
+  {"RST", 0x00},  //!< ABS_POS register is reset
+  {"CPY", 0x01}   //!< ABS_POS register value is copied into the MARK register
+};
+
+/* End of L6470_Private_Constants */
+
+/**
+  * @defgroup   L6470_Private_Variables
+  * @brief      L6470 Private Variables.
+  * @{
+  */
+
+/* End of L6470_Private_Variables */
+
+
+/**
+  * @addtogroup L6470_Private_Functions
+  * @{
+  */
+
+
+/* Methods -------------------------------------------------------------------*/
+
+/**
+  * @brief  Reset the structure used to store the identifier of the L6470
+  *         application command and its the needed parameters.
+  * @param  pL6470_AppCmdPkg   The structure to be reset.
+  */
+void L6470::L6470_ResetAppCmdPkg(sL6470_AppCmdPkg_t* pL6470_AppCmdPkg)
+{
+  uint8_t id;
+  
+  for(id=0; id<L6470DAISYCHAINSIZE; id++)
+  {
+    (pL6470_AppCmdPkg+id)->L6470_AppCmdId=(eL6470_AppCmdId_t)0;
+    (pL6470_AppCmdPkg+id)->p1=0;
+    (pL6470_AppCmdPkg+id)->p2=0;
+    (pL6470_AppCmdPkg+id)->p3=0;
+  }
+}
+
+/**
+  * @brief  Fill the structure used to store the identifier of the L6470
+  *         application command and its the needed parameters.
+  * @param  L6470_Id          The identifier of the L6470 target inside the daisy chain.
+  * @param  pL6470_AppCmdPkg  The structure to be filled.
+  * @param  L6470_AppCmdId    The identifier of the L6470 application command to be sent.
+  * @param  p1                The 1st parameter (if it is not needed it will be not considered).
+  * @param  p2                The 2nd parameter (if it is not needed it will be not considered).
+  * @param  p3                The 3rd parameter (if it is not needed it will be not considered).
+  */
+void L6470::L6470_FillAppCmdPkg(sL6470_AppCmdPkg_t* pL6470_AppCmdPkg, eL6470_AppCmdId_t L6470_AppCmdId, uint32_t p1, uint32_t p2, uint32_t p3)
+{
+  (pL6470_AppCmdPkg+L6470_Id)->L6470_AppCmdId = L6470_AppCmdId;
+  (pL6470_AppCmdPkg+L6470_Id)->p1 = p1;
+  (pL6470_AppCmdPkg+L6470_Id)->p2 = p2;
+  (pL6470_AppCmdPkg+L6470_Id)->p3 = p3;
+}
+
+/**
+  * @brief  This function will fill the column of the L6470_AppCmdPkg related
+  *         the L6470 to be addressed inside the daisy chain.
+  *
+  * @param  L6470_Id          The identifier of the L6470 target inside the daisy chain.
+  * @param  pL6470_AppCmdPkg  Pointer to the sL6470_AppCmdPkg_t to be filled.
+  * @param  L6470_AppCmdId    The identifier of the L6470 application command to be sent.
+  * @param  p1                The 1st parameter (if it is not needed it will be not considered).
+  * @param  p2                The 2nd parameter (if it is not needed it will be not considered).
+  * @param  p3                The 3rd parameter (if it is not needed it will be not considered).
+  */
+void L6470::L6470_PrepareAppCmdPkg(sL6470_AppCmdPkg_t* pL6470_AppCmdPkg, eL6470_AppCmdId_t L6470_AppCmdId, uint32_t p1, uint32_t p2, uint32_t p3)
+{
+  if(!L6470_DaisyChain_HalfPrepared)
+  {
+    L6470_DaisyChain_HalfPrepared = ONE_F; /* To avoid to delete the previous entered command */
+    L6470_ResetAppCmdPkg(pL6470_AppCmdPkg);
+  }
+  
+  L6470_FillAppCmdPkg(pL6470_AppCmdPkg, L6470_AppCmdId, p1, p2, p3);
+}
+
+/**
+  * @brief  This function will translate the data inside the L6470_AppCmdPkg into
+  *         the right data to be sent via SPI to the L6470 daisy chain.
+  *
+  * @param  pL6470_AppCmdPkg              Pointer to the sL6470_AppCmdPkg_t to be filled.
+  * @param  pL6470_DaisyChainSpiTxStruct  Pointer to the structure used by SPI to send the commands.
+  */
+void L6470::L6470_PrepareDaisyChainCommand(sL6470_AppCmdPkg_t* pL6470_AppCmdPkg, uint8_t* pL6470_DaisyChainSpiTxStruct)
+{
+  uint8_t PkgId;
+  uint8_t PARAMLengthBytes; /* The number of bytes related to the numeric value for the addressed register */
+  uint8_t spibyte;
+  
+  /* Reset the structure used to send the command to the L6470 Daisy Chain through the SPI */
+  uint8_t i = 0;
+  for(spibyte=0;spibyte<L6470MAXSPICMDBYTESIZE;spibyte++)
+    for(PkgId=0; PkgId<L6470DAISYCHAINSIZE; PkgId++)
+      *(pL6470_DaisyChainSpiTxStruct+(i++)) = 0x00;
+
+  for(PkgId=0; PkgId<L6470DAISYCHAINSIZE; PkgId++)
+  {
+    /* Build the 1st bytes to transmit with the binary code of the command */
+    *(pL6470_DaisyChainSpiTxStruct+((0*L6470DAISYCHAINSIZE)+PkgId)) = (L6470_ApplicationCommand[(pL6470_AppCmdPkg+PkgId)->L6470_AppCmdId].BinaryCode);
+    
+    /* Perform the related L6470_AppCmdId */
+    switch((pL6470_AppCmdPkg+PkgId)->L6470_AppCmdId)
+    {
+    case L6470_NOP_ID:
+      break;
+    case L6470_SETPARAM_ID:
+      /* Build the 1st bytes to transmit (PARAM) */
+      *(pL6470_DaisyChainSpiTxStruct+((0*L6470DAISYCHAINSIZE)+PkgId)) |= (L6470_Register[((pL6470_AppCmdPkg+PkgId)->p1)].Address);
+      
+      /* The length, in byte, of this register (PARAM) is... */
+      PARAMLengthBytes = L6470_Register[((pL6470_AppCmdPkg+PkgId)->p1)].LengthByte;
+      
+      /* Build the others bytes to transmit (VALUE) */
+      for (spibyte=1; spibyte<(PARAMLengthBytes+1); spibyte++)
+      {
+        *(pL6470_DaisyChainSpiTxStruct+((spibyte*L6470DAISYCHAINSIZE)+PkgId)) = (uint8_t)(((pL6470_AppCmdPkg+PkgId)->p2) >> (8*(PARAMLengthBytes-spibyte)));
+      }
+      break;
+    case L6470_GETPARAM_ID:
+      /* Build the 1st bytes to transmit (PARAM) */
+      *(pL6470_DaisyChainSpiTxStruct+((0*L6470DAISYCHAINSIZE)+PkgId)) |= (L6470_Register[((pL6470_AppCmdPkg+PkgId)->p1)].Address);
+      break;
+    case L6470_RUN_ID:
+      /* Build the 1st bytes to transmit (DIR) */
+      *(pL6470_DaisyChainSpiTxStruct+((0*L6470DAISYCHAINSIZE)+PkgId)) |= (L6470_Direction[((pL6470_AppCmdPkg+PkgId)->p1)].BinaryCode);
+      
+      /* Build the others bytes to transmit (SPD) */
+      for (spibyte=1; spibyte<(3+1); spibyte++)
+      {
+        *(pL6470_DaisyChainSpiTxStruct+((spibyte*L6470DAISYCHAINSIZE)+PkgId)) = (uint8_t)(((pL6470_AppCmdPkg+PkgId)->p2) >> (8*(3-spibyte)));
+      }
+      break;
+    case L6470_STEPCLOCK_ID:
+      /* Build the 1st bytes to transmit (DIR) */
+      *(pL6470_DaisyChainSpiTxStruct+((0*L6470DAISYCHAINSIZE)+PkgId)) |= (L6470_Direction[((pL6470_AppCmdPkg+PkgId)->p1)].BinaryCode);
+      break;
+    case L6470_MOVE_ID:
+      /* Build the 1st bytes to transmit (DIR) */
+      *(pL6470_DaisyChainSpiTxStruct+((0*L6470DAISYCHAINSIZE)+PkgId)) |= (L6470_Direction[((pL6470_AppCmdPkg+PkgId)->p1)].BinaryCode);
+      
+      /* Build the others bytes to transmit (N_STEP) */
+      for (spibyte=1; spibyte<(3+1); spibyte++)
+      {
+        *(pL6470_DaisyChainSpiTxStruct+((spibyte*L6470DAISYCHAINSIZE)+PkgId)) = (uint8_t)(((pL6470_AppCmdPkg+PkgId)->p2) >> (8*(3-spibyte)));
+      }      
+      break;
+    case L6470_GOTO_ID:
+      /* Build the others bytes to transmit (ABS_POS) */
+      for (spibyte=1; spibyte<(3+1); spibyte++)
+      {
+        *(pL6470_DaisyChainSpiTxStruct+((spibyte*L6470DAISYCHAINSIZE)+PkgId)) = (uint8_t)(((pL6470_AppCmdPkg+PkgId)->p1) >> (8*(3-spibyte)));
+      }
+      break;
+    case L6470_GOTODIR_ID:
+      /* Build the 1st bytes to transmit (DIR) */
+      *(pL6470_DaisyChainSpiTxStruct+((0*L6470DAISYCHAINSIZE)+PkgId)) |= (L6470_Direction[((pL6470_AppCmdPkg+PkgId)->p1)].BinaryCode);
+      
+      /* Build the others bytes to transmit (ABS_POS) */
+      for (spibyte=1; spibyte<(3+1); spibyte++)
+      {
+        *(pL6470_DaisyChainSpiTxStruct+((spibyte*L6470DAISYCHAINSIZE)+PkgId)) = (uint8_t)(((pL6470_AppCmdPkg+PkgId)->p2) >> (8*(3-spibyte)));
+      }
+      break;
+    case L6470_GOUNTIL_ID:
+      /* Build the 1st bytes to transmit (ACT) */
+      *(pL6470_DaisyChainSpiTxStruct+((0*L6470DAISYCHAINSIZE)+PkgId)) |= ((L6470_ACT[((pL6470_AppCmdPkg+PkgId)->p1)].BinaryCode)<<3);
+      /* Build the 1st bytes to transmit (DIR) */
+      *(pL6470_DaisyChainSpiTxStruct+((0*L6470DAISYCHAINSIZE)+PkgId)) |= (L6470_Direction[((pL6470_AppCmdPkg+PkgId)->p2)].BinaryCode);
+      
+      /* Build the others bytes to transmit (SPD) */
+      for (spibyte=1; spibyte<(3+1); spibyte++)
+      {
+        *(pL6470_DaisyChainSpiTxStruct+((spibyte*L6470DAISYCHAINSIZE)+PkgId)) = (uint8_t)(((pL6470_AppCmdPkg+PkgId)->p3) >> (8*(3-spibyte)));
+      }
+      break;
+    case L6470_RELEASESW_ID:
+      /* Build the 1st bytes to transmit (ACT) */
+      *(pL6470_DaisyChainSpiTxStruct+((0*L6470DAISYCHAINSIZE)+PkgId)) |= ((L6470_ACT[((pL6470_AppCmdPkg+PkgId)->p1)].BinaryCode)<<3);
+      /* Build the 1st bytes to transmit (DIR) */
+      *(pL6470_DaisyChainSpiTxStruct+((0*L6470DAISYCHAINSIZE)+PkgId)) |= (L6470_Direction[((pL6470_AppCmdPkg+PkgId)->p2)].BinaryCode);
+      break;
+    case L6470_GOHOME_ID:
+      break;
+    case L6470_GOMARK_ID:
+      break;
+    case L6470_RESETPOS_ID:
+      break;
+    case L6470_RESETDEVICE_ID:
+      break;
+    case L6470_SOFTSTOP_ID:
+      break;
+    case L6470_HARDSTOP_ID:
+      break;
+    case L6470_SOFTHIZ_ID:
+      break;
+    case L6470_HARDHIZ_ID:
+      break;
+    case L6470_GETSTATUS_ID:
+      break;
+    }
+  }
+}
+
+/* End of L6470_Private_Functions */
+
+/**
+  * @addtogroup L6470_Exported_Functions
+  * @{
+  */
+
+/**
+  * @addtogroup L6470_Conversion_Functions
+  * @brief      The following functions act just on one driver inside the L6470
+  *             daisy chain. The command is immediately sent.
+  * @{
+  */
+
+ /**
+  * @brief  Convert the absolute position as 2's complement format into the signed number.
+  * 
+  * @param  AbsPos      The absolute position in the range from [-(2^21)] to [+(2^21)-1].
+  * @retval Position    The position as signed number.
+  */
+int32_t L6470::L6470_AbsPos_2_Position(uint32_t AbsPos)
+{
+  if (AbsPos > L6470_MAX_POSITION)
+    return (AbsPos - (L6470_POSITION_RANGE + 1));
+  else
+    return AbsPos;
+}
+
+/**
+  * @brief  Convert the position as signed number into absolute position as 2's complement format.
+  * 
+  * @param  Position    The position as signed number.
+  * @retval AbsPos      The absolute position in the range from [-(2^21)] to [+(2^21)-1].
+  */
+uint32_t L6470::L6470_Position_2_AbsPos(int32_t Position)
+{
+  if ((Position >= 0) && (Position <= L6470_MAX_POSITION))
+    return Position;
+  else
+  {
+    if ((Position >= L6470_MIN_POSITION) && (Position < 0))
+      return (Position + (L6470_POSITION_RANGE + 1));
+    else
+      return (L6470_POSITION_RANGE + 1);        // OVF
+  }
+}
+
+/**
+  * @brief  Convert the SPEED register value into step/s.
+  * 
+  * @param  Speed       The SPEED register value.
+  * @retval step/s      The speed as step/s.
+  */
+float L6470::L6470_Speed_2_Step_s(uint32_t Speed)
+{
+  return (Speed * ((float)14.9012e-3));
+}
+
+/**
+  * @brief  Convert the speed as step/s into a right value for SPEED register.
+  * 
+  * @param  step/s      The speed as step/s.
+  * @retval Speed       The SPEED register value.
+  */
+uint32_t L6470::L6470_Step_s_2_Speed(float Step_s)
+{
+  if (Step_s <= (L6470_MAX_SPEED * ((float)14.9012e-3)))
+    return (uint32_t)(Step_s / ((float)14.9012e-3));
+  else
+    return 0;   // Warning
+}
+
+/**
+  * @brief  Convert the ACC register value into step/(s^2).
+  * 
+  * @param  Acc         The ACC register value.
+  * @retval step/(s^2)  The acceleration as step/(s^2).
+  */
+float L6470::L6470_Acc_2_Step_s2(uint16_t Acc)
+{
+  if (Acc <= L6470_MAX_ACC)
+    return (Acc * ((float)1.4552e1));
+  else
+    return 0;   // Warning
+}
+
+/**
+  * @brief  Convert the acceleartion as step/(s^2) into a right value for ACC register.
+  * 
+  * @param  step/(s^2)  The acceleration as step/(s^2).
+  * @retval Acc         The ACC register value.
+  */
+uint16_t L6470::L6470_Step_s2_2_Acc(float Step_s2)
+{
+  if (Step_s2 <= (L6470_MAX_ACC * ((float)1.4552e1)))
+    return (uint16_t)(Step_s2 / ((float)1.4552e1));
+  else
+    return 0;   // Warning
+}
+
+/**
+  * @brief  Convert the DEC register value into step/(s^2).
+  * 
+  * @param  Dec         The DEC register value.
+  * @retval step/(s^2)  The deceleration as step/(s^2).
+  */
+float L6470::L6470_Dec_2_Step_s2(uint16_t Dec)
+{
+  if (Dec <= L6470_MAX_DEC)
+    return (Dec * ((float)1.4552e1));
+  else
+    return 0;   // Warning
+}
+
+/**
+  * @brief  Convert the deceleration as step/(s^2) into a right value for DEC register.
+  * 
+  * @param  step/(s^2)  The deceleration as step/(s^2).
+  * @retval Dec         The DEC register value.
+  */
+uint16_t L6470::L6470_Step_s2_2_Dec(float Step_s2)
+{
+  if (Step_s2 <= (L6470_MAX_DEC * ((float)1.4552e1)))
+    return (uint16_t)(Step_s2 / ((float)1.4552e1));
+  else
+    return 0;   // Warning
+}
+
+/**
+  * @brief  Convert the MAX_SPEED register value into step/s.
+  * 
+  * @param  MaxSpeed    The MAX_SPEED register value.
+  * @retval step/s      The max speed as step/s.
+  */
+float L6470::L6470_MaxSpeed_2_Step_s(uint16_t MaxSpeed)
+{
+  if (MaxSpeed <= L6470_MAX_MAX_SPEED)
+    return (MaxSpeed * ((float)15.2588));
+  else
+    return 0;   // Warning
+}
+
+/**
+  * @brief  Convert the max speed as step/s into a right value for MAX_SPEED register.
+  * 
+  * @param  step/s      The max speed as step/s.
+  * @retval MaxSpeed    The MAX_SPEED register value.
+  */
+uint16_t L6470::L6470_Step_s_2_MaxSpeed(float Step_s)
+{
+  if (Step_s <= (L6470_MAX_MAX_SPEED * ((float)15.2588)))
+    return (uint16_t)(Step_s / ((float)15.2588));
+  else
+    return 0;   // Warning
+}
+
+/**
+  * @brief  Convert the MIN_SPEED register value into step/s.
+  * 
+  * @param  MinSpeed    The MIN_SPEED register value.
+  * @retval step/s      The min speed as step/s.
+  */
+float L6470::L6470_MinSpeed_2_Step_s(uint16_t MinSpeed)
+{
+  if (MinSpeed <= L6470_MAX_MIN_SPEED)
+    return (MinSpeed * ((float)238.4186e-3));
+  else
+    return 0;   // Warning
+}
+
+/**
+  * @brief  Convert the min speed as step/s into a right value for MIN_SPEED register.
+  * 
+  * @param  step/s      The min speed as step/s.
+  * @retval MinSpeed    The MIN_SPEED register value.
+  */
+uint16_t L6470::L6470_Step_s_2_MinSpeed(float Step_s)
+{
+  if (Step_s <= (L6470_MAX_MIN_SPEED * ((float)238.4186e-3)))
+    return (uint16_t)(Step_s / ((float)238.4186e-3));
+  else
+    return 0;   // Warning
+}
+
+/**
+  * @brief  Convert the FS_SPD register value into step/s.
+  * 
+  * @param  FsSpd       The FS_SPD register value.
+  * @retval step/s      The full-step speed as step/s.
+  */
+float L6470::L6470_FsSpd_2_Step_s(uint16_t FsSpd)
+{
+  if (FsSpd <= L6470_MAX_FS_SPD)
+    return ((FsSpd+0.5) * ((float)15.25));
+  else
+    return 0;   // Warning
+}
+
+/**
+  * @brief  Convert the full-step speed as step/s into a right value for FS_SPD register.
+  * 
+  * @param  step/s      The full-step speed as step/s.
+  * @retval FsSpd       The FS_SPD register value.
+  */
+uint16_t L6470::L6470_Step_s_2_FsSpd(float Step_s)
+{
+  if (Step_s <= ((L6470_MAX_FS_SPD+0.5) * ((float)15.25)))
+    return (uint16_t)((float)(Step_s / ((float)15.25)) - (float)0.5);
+  else
+    return 0;   // Warning
+}
+
+/**
+  * @brief  Convert the INT_SPEED register value into step/s.
+  * 
+  * @param  IntSpeed    The INT_SPEED register value.
+  * @retval step/s      The intersect speed as step/s.
+  */
+float L6470::L6470_IntSpeed_2_Step_s(uint16_t IntSpeed)
+{
+  if (IntSpeed <= L6470_MAX_INT_SPEED)
+    return (IntSpeed * ((float)59.6046e-3));
+  else
+    return 0;   // Warning
+}
+
+/**
+  * @brief  Convert the intersect speed as step/s into a right value for INT_SPEED register.
+  * 
+  * @param  step/s      The full-step speed as step/s.
+  * @retval FsSpd       The FS_SPD register value.
+  */
+uint16_t L6470::L6470_Step_s_2_IntSpeed(float Step_s)
+{
+  if (Step_s <= (L6470_MAX_INT_SPEED * ((float)59.6046e-3)))
+    return (uint16_t)(Step_s / ((float)59.6046e-3));
+  else
+    return 0;   // Warning
+}
+
+/**
+  * @brief  Convert the ST_SLP register value into s/step.
+  * 
+  * @param  StartSlope  The ST_SLP register value.
+  * @retval s/step      The start slope as s/step.
+  */
+float L6470::L6470_StSlp_2_s_Step(uint8_t StSlp)
+{
+//  if (StSlp <= L6470_MAX_ST_SLP)
+    return (StSlp * ((float)1.5686e-5));
+//  else
+//    return 0;   // Warning
+}
+
+/**
+  * @brief  Convert the intersect speed as step/s into a right value for INT_SPEED register.
+  * 
+  * @param  step/s      The full-step speed as step/s.
+  * @retval FsSpd       The FS_SPD register value.
+  */
+uint8_t L6470::L6470_s_Step_2_StSlp(float s_Step)
+{
+  if (s_Step <= (L6470_MAX_ST_SLP * ((float)1.5686e-5)))
+    return (uint8_t)(s_Step / ((float)1.5686e-5));
+  else
+    return 0;   // Warning
+}
+
+/**
+  * @brief  Convert the INT_SPEED register value into step/s.
+  * 
+  * @param  IntSpeed    The INT_SPEED register value.
+  * @retval step/s      The intersect speed as step/s.
+  */
+float L6470::L6470_FnSlpAcc_2_s_Step(uint8_t FnSlpAcc)
+{
+//  if (FnSlpAcc <= L6470_MAX_FN_SLP_ACC)
+    return (FnSlpAcc * ((float)1.5686e-5));
+//  else
+//    return 0;   // Warning
+}
+
+/**
+  * @brief  Convert the intersect speed as step/s into a right value for INT_SPEED register.
+  * 
+  * @param  step/s      The full-step speed as step/s.
+  * @retval FsSpd       The FS_SPD register value.
+  */
+uint8_t L6470::L6470_s_Step_2_FnSlpAcc(float s_Step)
+{
+  if (s_Step <= (L6470_MAX_FN_SLP_ACC * ((float)1.5686e-5)))
+    return (uint8_t)(s_Step / ((float)1.5686e-5));
+  else
+    return 0;   // Warning
+}
+
+/**
+  * @brief  Convert the INT_SPEED register value into step/s.
+  * 
+  * @param  IntSpeed    The INT_SPEED register value.
+  * @retval step/s      The intersect speed as step/s.
+  */
+float L6470::L6470_FnSlpDec_2_s_Step(uint8_t FnSlpDec)
+{
+//  if (FnSlpDec <= L6470_MAX_FN_SLP_DEC)
+    return (FnSlpDec * ((float)1.5686e-5));
+//  else
+//    return 0;   // Warning
+}
+
+/**
+  * @brief  Convert the intersect speed as step/s into a right value for INT_SPEED register.
+  * 
+  * @param  step/s      The full-step speed as step/s.
+  * @retval FsSpd       The FS_SPD register value.
+  */
+uint8_t L6470::L6470_s_Step_2_FnSlpDec(float s_Step)
+{
+  if (s_Step <= (L6470_MAX_FN_SLP_DEC * ((float)1.5686e-5)))
+    return (uint8_t)(s_Step / ((float)1.5686e-5));
+  else
+    return 0;   // Warning
+}
+
+/**
+  * @brief  Convert the OCD_TH register value into mA.
+  * 
+  * @param  OcdTh       The OCD_TH register value.
+  * @retval mA          The overcurrent threshold as mA.
+  */
+float L6470::L6470_OcdTh_2_mA(uint8_t OcdTh)
+{
+  if (OcdTh <= L6470_MAX_OCD_TH)
+    return ((OcdTh+1) * ((float)375));
+  else
+    return 0;   // Warning
+}
+
+/**
+  * @brief  Convert the overcurrent threshold as mA into a right value for OCD_TH register.
+  * 
+  * @param  mA          The overcurrent threshold as mA.
+  * @retval OcdTh       The OCD_TH register value.
+  */
+uint8_t L6470::L6470_mA_2_OcdTh(float mA)
+{
+  float result, decimal;
+  
+  if (mA <= ((L6470_MAX_OCD_TH+1) * ((float)375)))
+  {
+    result = (mA / ((float)375));
+    decimal = result - (uint8_t)result;
+    
+    if (decimal < (float)0.5)
+      return ((uint8_t)result - 1);
+    else
+      return ((uint8_t)result);    
+  }
+  else
+    return 0;   // Warning
+}
+
+/**
+  * @brief  Convert the STALL_TH register value into mA.
+  * 
+  * @param  StallTh     The STALL_TH register value.
+  * @retval mA          The stall detection threshold as mA.
+  */
+float L6470::L6470_StallTh_2_mA(uint8_t StallTh)
+{
+  if (StallTh <= L6470_MAX_STALL_TH)
+    return ((StallTh+1) * ((float)31.25));
+  else
+    return 0;   // Warning
+}
+
+/**
+  * @brief  Convert the stall detection threshold as mA into a right value for STALL_TH register.
+  * 
+  * @param  mA          The stall detection threshold as mA.
+  * @retval StallTh     The STALL_TH register value.
+  */
+uint8_t L6470::L6470_mA_2_StallTh(float mA)
+{
+  float result, decimal;
+  
+  if (mA <= ((L6470_MAX_STALL_TH+1) * ((float)31.25)))
+  {
+    result = (mA / ((float)31.25));
+    decimal = result - (uint8_t)result;
+    
+    if (decimal < (float)0.5)
+      return ((uint8_t)result - 1);
+    else
+      return ((uint8_t)result);    
+  }
+  else
+    return 0;   // Warning
+}
+
+/* End of L6470_Conversion_Functions */
+
+/**
+  * @addtogroup L6470_AppCMDs
+  * @{
+  */
+
+/**
+  * @brief  SetParam command sets the register value equal to a new value.
+  * 
+  * @param  L6470_RegId   The identifier of the L6470 register to be addressed.
+  * @param  Value         The new value.
+  */
+void L6470::L6470_SetParam(eL6470_RegId_t L6470_RegId, uint32_t Value)
+{
+  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_SETPARAM_ID, L6470_RegId, Value, 0);
+  L6470_PrepareDaisyChainCommand(L6470_AppCmdPkg, (uint8_t*)L6470_DaisyChainSpiTxStruct);
+  L6470_DaisyChainCommand((uint8_t*)L6470_DaisyChainSpiTxStruct, (uint8_t*)L6470_DaisyChainSpiRxStruct);
+}
+
+/**
+  * @brief  GetParam command reads the register value.
+  * 
+  * @param  L6470_RegId   The identifier of the L6470 register to be addressed.
+  * 
+  * @retval ReceivedValue The register value.
+  */
+uint32_t L6470::L6470_GetParam(eL6470_RegId_t L6470_RegId)
+{
+  uint8_t ValueLengthByte;
+  uint32_t ReceivedValue;
+
+  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_GETPARAM_ID, L6470_RegId, 0, 0);
+  L6470_PrepareDaisyChainCommand(L6470_AppCmdPkg, (uint8_t*)L6470_DaisyChainSpiTxStruct);
+  L6470_DaisyChainCommand((uint8_t*)L6470_DaisyChainSpiTxStruct, (uint8_t*)L6470_DaisyChainSpiRxStruct);
+  
+  ValueLengthByte = L6470_Register[L6470_RegId].LengthByte;
+  
+  ReceivedValue = L6470_ExtractReturnedData((uint8_t*)L6470_DaisyChainSpiRxStruct, ValueLengthByte);
+  
+  return ReceivedValue;
+}
+
+/**
+  * @brief  Run command produces a motion at fixed speed.
+  * 
+  * @param  L6470_DirId   The identifier of the L6470 motion direction.
+  * @param  Speed         The speed value as (([step/s] * 250e-9) / 2^-28)
+  */
+void L6470::L6470_Run(eL6470_DirId_t L6470_DirId, uint32_t Speed)
+{
+  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_RUN_ID, L6470_DirId, Speed, 0);
+  L6470_PrepareDaisyChainCommand(L6470_AppCmdPkg, (uint8_t*)L6470_DaisyChainSpiTxStruct);
+  L6470_DaisyChainCommand((uint8_t*)L6470_DaisyChainSpiTxStruct, (uint8_t*)L6470_DaisyChainSpiRxStruct);
+}
+
+/**
+  * @brief  StepClock command switches the device in Step-clock mode.
+  * 
+  * @param  L6470_DirId   The identifier of the L6470 motion direction.
+  */
+void L6470::L6470_StepClock(eL6470_DirId_t L6470_DirId)
+{
+  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_STEPCLOCK_ID, L6470_DirId, 0, 0);
+  L6470_PrepareDaisyChainCommand(L6470_AppCmdPkg, (uint8_t*)L6470_DaisyChainSpiTxStruct);
+  L6470_DaisyChainCommand((uint8_t*)L6470_DaisyChainSpiTxStruct, (uint8_t*)L6470_DaisyChainSpiRxStruct);
+}
+
+/**
+  * @brief  Move command produces a motion of N_STEP microsteps.
+  * 
+  * @param  L6470_DirId   The identifier of the L6470 motion direction.
+  * @param  N_Step        The number of microsteps.
+  */
+void L6470::L6470_Move(eL6470_DirId_t L6470_DirId, uint32_t N_Step)
+{
+  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_MOVE_ID, L6470_DirId, N_Step, 0);
+  L6470_PrepareDaisyChainCommand(L6470_AppCmdPkg, (uint8_t*)L6470_DaisyChainSpiTxStruct);
+  L6470_DaisyChainCommand((uint8_t*)L6470_DaisyChainSpiTxStruct, (uint8_t*)L6470_DaisyChainSpiRxStruct);
+}
+
+/**
+  * @brief  GoTo command produces a motion to ABS_POS absolute position through the shortest path.
+  * 
+  * @param  AbsPos        The target absolute position.
+  */
+void L6470::L6470_GoTo(uint32_t AbsPos)
+{
+  if (AbsPos <= L6470_POSITION_RANGE)
+  {
+    L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_GOTO_ID, AbsPos, 0, 0);
+    L6470_PrepareDaisyChainCommand(L6470_AppCmdPkg, (uint8_t*)L6470_DaisyChainSpiTxStruct);
+    L6470_DaisyChainCommand((uint8_t*)L6470_DaisyChainSpiTxStruct, (uint8_t*)L6470_DaisyChainSpiRxStruct);
+  }
+}
+
+/**
+  * @brief  GoTo_DIR command produces a motion to ABS_POS absolute position imposing a direction.
+  * 
+  * @param  L6470_DirId   The identifier of the L6470 motion direction.
+  * @param  AbsPos        The target absolute position.
+  */
+void L6470::L6470_GoToDir(eL6470_DirId_t L6470_DirId, uint32_t AbsPos)
+{
+  if (AbsPos <= L6470_POSITION_RANGE)
+  {
+    L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_GOTODIR_ID, L6470_DirId, AbsPos, 0);
+    L6470_PrepareDaisyChainCommand(L6470_AppCmdPkg, (uint8_t*)L6470_DaisyChainSpiTxStruct);
+    L6470_DaisyChainCommand((uint8_t*)L6470_DaisyChainSpiTxStruct, (uint8_t*)L6470_DaisyChainSpiRxStruct);
+  }
+}
+
+/**
+  * @brief  GoUntil command produces a motion at fixed speed imposing a direction
+  *         until an external switch turn-on event occurs.
+  * 
+  * @param  L6470_ActId   The identifier of the L6470 action about the absolute position.
+  * @param  L6470_DirId   The identifier of the L6470 motion direction.
+  * @param  Speed         The speed value as (([step/s] * 250e-9) / 2^-28)
+  */
+void L6470::L6470_GoUntil(eL6470_ActId_t L6470_ActId, eL6470_DirId_t L6470_DirId, uint32_t Speed)
+{
+  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_GOUNTIL_ID, L6470_ActId, L6470_DirId, Speed);
+  L6470_PrepareDaisyChainCommand(L6470_AppCmdPkg, (uint8_t*)L6470_DaisyChainSpiTxStruct);
+  L6470_DaisyChainCommand((uint8_t*)L6470_DaisyChainSpiTxStruct, (uint8_t*)L6470_DaisyChainSpiRxStruct);
+}
+
+/**
+  * @brief  ReleaseSW command produces a motion at minimum speed imposing a direction
+  *         until SW is released.
+  * 
+  * @param  L6470_ActId   The identifier of the L6470 action about the absolute position.
+  * @param  L6470_DirId   The identifier of the L6470 motion direction.
+  */
+void L6470::L6470_ReleaseSW(eL6470_ActId_t L6470_ActId, eL6470_DirId_t L6470_DirId)
+{
+  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_RELEASESW_ID, L6470_ActId, L6470_DirId, 0);
+  L6470_PrepareDaisyChainCommand(L6470_AppCmdPkg, (uint8_t*)L6470_DaisyChainSpiTxStruct);
+  L6470_DaisyChainCommand((uint8_t*)L6470_DaisyChainSpiTxStruct, (uint8_t*)L6470_DaisyChainSpiRxStruct);
+}
+
+/**
+  * @brief  GoHome command produces a motion to the HOME position (zero position)
+  *         via the shortest path.
+  * 
+  */
+void L6470::L6470_GoHome(void)
+{
+  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_GOHOME_ID, 0, 0, 0);
+  L6470_PrepareDaisyChainCommand(L6470_AppCmdPkg, (uint8_t*)L6470_DaisyChainSpiTxStruct);
+  L6470_DaisyChainCommand((uint8_t*)L6470_DaisyChainSpiTxStruct, (uint8_t*)L6470_DaisyChainSpiRxStruct);
+}
+
+/**
+  * @brief  GoMark command produces a motion to the MARK position performing the
+  *         minimum path.
+  * 
+  */
+void L6470::L6470_GoMark(void)
+{
+  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_GOMARK_ID, 0, 0, 0);
+  L6470_PrepareDaisyChainCommand(L6470_AppCmdPkg, (uint8_t*)L6470_DaisyChainSpiTxStruct);
+  L6470_DaisyChainCommand((uint8_t*)L6470_DaisyChainSpiTxStruct, (uint8_t*)L6470_DaisyChainSpiRxStruct);
+}
+
+/**
+  * @brief  ResetPos command resets the ABS_POS register to zero.
+  * 
+  */
+void L6470::L6470_ResetPos(void)
+{
+  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_RESETPOS_ID, 0, 0, 0);
+  L6470_PrepareDaisyChainCommand(L6470_AppCmdPkg, (uint8_t*)L6470_DaisyChainSpiTxStruct);
+  L6470_DaisyChainCommand((uint8_t*)L6470_DaisyChainSpiTxStruct, (uint8_t*)L6470_DaisyChainSpiRxStruct);
+}
+
+/**
+  * @brief  ResetDevice command resets the device to power-up conditions.
+  * 
+  */
+void L6470::L6470_ResetDevice(void)
+{
+  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_RESETDEVICE_ID, 0, 0, 0);
+  L6470_PrepareDaisyChainCommand(L6470_AppCmdPkg, (uint8_t*)L6470_DaisyChainSpiTxStruct);
+  L6470_DaisyChainCommand((uint8_t*)L6470_DaisyChainSpiTxStruct, (uint8_t*)L6470_DaisyChainSpiRxStruct);
+}
+
+/**
+  * @brief  SoftStop command causes an immediate deceleration to zero speed and
+  *         a consequent motor stop; the deceleration value used is the one stored
+  *         in the DEC register.
+  * 
+  */
+void L6470::L6470_SoftStop(void)
+{
+  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_SOFTSTOP_ID, 0, 0, 0);
+  L6470_PrepareDaisyChainCommand(L6470_AppCmdPkg, (uint8_t*)L6470_DaisyChainSpiTxStruct);
+  L6470_DaisyChainCommand((uint8_t*)L6470_DaisyChainSpiTxStruct, (uint8_t*)L6470_DaisyChainSpiRxStruct);
+}
+
+/**
+  * @brief  HardStop command causes an immediate motor stop with infinite deceleration.
+  * 
+  */
+void L6470::L6470_HardStop(void)
+{
+  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_HARDSTOP_ID, 0, 0, 0);
+  L6470_PrepareDaisyChainCommand(L6470_AppCmdPkg, (uint8_t*)L6470_DaisyChainSpiTxStruct);
+  L6470_DaisyChainCommand((uint8_t*)L6470_DaisyChainSpiTxStruct, (uint8_t*)L6470_DaisyChainSpiRxStruct);
+}
+
+/**
+  * @brief  SoftHiZ command disables the power bridges (high impedance state)
+  *         after a deceleration to zero; the deceleration value used is the one
+  *         stored in the DEC register.
+  * 
+  */
+void L6470::L6470_SoftHiZ(void)
+{
+  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_SOFTHIZ_ID, 0, 0, 0);
+  L6470_PrepareDaisyChainCommand(L6470_AppCmdPkg, (uint8_t*)L6470_DaisyChainSpiTxStruct);
+  L6470_DaisyChainCommand((uint8_t*)L6470_DaisyChainSpiTxStruct, (uint8_t*)L6470_DaisyChainSpiRxStruct);
+}
+
+/**
+  * @brief  HardHiZ command immediately disables the power bridges (high impedance state).
+  * 
+  */
+void L6470::L6470_HardHiZ(void)
+{
+  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_HARDHIZ_ID, 0, 0, 0);
+  L6470_PrepareDaisyChainCommand(L6470_AppCmdPkg, (uint8_t*)L6470_DaisyChainSpiTxStruct);
+  L6470_DaisyChainCommand((uint8_t*)L6470_DaisyChainSpiTxStruct, (uint8_t*)L6470_DaisyChainSpiRxStruct);
+}
+
+/**
+  * @brief  GetStatus command returns the STATUS register value.
+  * 
+  * 
+  * @retval ReceivedValue The register value.
+  */
+uint16_t L6470::L6470_GetStatus(void)
+{
+  uint16_t ReceivedValue;
+
+  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_GETSTATUS_ID, 0, 0, 0);
+  L6470_PrepareDaisyChainCommand(L6470_AppCmdPkg, (uint8_t*)L6470_DaisyChainSpiTxStruct);
+  L6470_DaisyChainCommand((uint8_t*)L6470_DaisyChainSpiTxStruct, (uint8_t*)L6470_DaisyChainSpiRxStruct);
+  
+  ReceivedValue = (uint16_t)L6470_ExtractReturnedData((uint8_t*)L6470_DaisyChainSpiRxStruct, 2);
+  
+  return ReceivedValue;
+}
+
+/* End of L6470_AppCMDs */
+
+/**
+  * @addtogroup L6470_AppCMDs_ToBePrepared
+  * @{
+  */
+
+/**
+  * @brief  Prepare to send @ref L6470_SetParam command.
+  *
+  * @param  L6470_RegId   The identifier of the L6470 register to be addressed.
+  * @param  Value         The new value.
+  *
+  * @note   This function will properly fill the right column of the L6470_AppCmdPkg.
+  * @note   The commad will be sent by @ref L6470_PerformPreparedApplicationCommand.
+  */
+void L6470::L6470_PrepareSetParam(eL6470_RegId_t L6470_RegId, uint32_t Value)
+{
+  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_SETPARAM_ID, L6470_RegId, Value, 0);
+}
+
+/**
+  * @brief  Prepare to send @ref L6470_GetParam command.
+  *
+  * @param  L6470_Id      The L6470 identifier inside the daisy chain.
+  * @param  L6470_RegId   The identifier of the L6470 register to be addressed.
+  *
+  * @retval ReceivedValue The register value.
+  *
+  * @note   This function will properly fill the right column of the L6470_AppCmdPkg.
+  * @note   The commad will be sent by @ref L6470_PerformPreparedApplicationCommand.
+  */
+void L6470::L6470_PrepareGetParam(eL6470_RegId_t L6470_RegId)
+{
+  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_GETPARAM_ID, L6470_RegId, 0, 0);
+}
+
+/**
+  * @brief  Prepare to send @ref L6470_Run command.
+  * 
+  * @param  L6470_DirId   The identifier of the L6470 motion direction.
+  * @param  Speed         The speed value as (([step/s] * 250e-9) / 2^-28)
+  *
+  * @note   This function will properly fill the right column of the L6470_AppCmdPkg.
+  * @note   The commad will be sent by @ref L6470_PerformPreparedApplicationCommand.
+  */
+void L6470::L6470_PrepareRun(eL6470_DirId_t L6470_DirId, uint32_t Speed)
+{
+  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_RUN_ID, L6470_DirId, Speed, 0);
+}
+
+/**
+  * @brief  Prepare to send @ref L6470_StepClock command.
+  * 
+  * @param  L6470_DirId   The identifier of the L6470 motion direction.
+  *
+  * @note   This function will properly fill the right column of the L6470_AppCmdPkg.
+  * @note   The commad will be sent by @ref L6470_PerformPreparedApplicationCommand.
+  */
+void L6470::L6470_PrepareStepClock(eL6470_DirId_t L6470_DirId)
+{
+  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_STEPCLOCK_ID, L6470_DirId, 0, 0);
+}
+
+/**
+  * @brief  Prepare to send @ref L6470_Move command.
+  * 
+  * @param  L6470_DirId   The identifier of the L6470 motion direction.
+  * @param  N_Step        The number of microsteps.
+  *
+  * @note   This function will properly fill the right column of the L6470_AppCmdPkg.
+  * @note   The commad will be sent by @ref L6470_PerformPreparedApplicationCommand.
+  */
+void L6470::L6470_PrepareMove(eL6470_DirId_t L6470_DirId, uint32_t N_Step)
+{
+  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_MOVE_ID, L6470_DirId, N_Step, 0);
+}
+
+/**
+  * @brief  Prepare to send @ref L6470_GoTo command.
+  * 
+  * @param  AbsPos        The target absolute position.
+  *
+  * @note   This function will properly fill the right column of the L6470_AppCmdPkg.
+  * @note   The commad will be sent by @ref L6470_PerformPreparedApplicationCommand.
+  */
+void L6470::L6470_PrepareGoTo(uint32_t AbsPos)
+{
+  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_GOTO_ID, AbsPos, 0, 0);
+}
+
+/**
+  * @brief  Prepare to send @ref L6470_GoToDIR command.
+  * 
+  * @param  L6470_DirId   The identifier of the L6470 motion direction.
+  * @param  AbsPos        The target absolute position.
+  *
+  * @note   This function will properly fill the right column of the L6470_AppCmdPkg.
+  * @note   The commad will be sent by @ref L6470_PerformPreparedApplicationCommand.
+  */
+void L6470::L6470_PrepareGoToDir(eL6470_DirId_t L6470_DirId, uint32_t AbsPos)
+{
+  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_GOTODIR_ID, L6470_DirId, AbsPos, 0);
+}
+
+/**
+  * @brief  Prepare to send @ref L6470_GoUntil command.
+  * 
+  * @param  L6470_ActId   The identifier of the L6470 action about the absolute position.
+  * @param  L6470_DirId   The identifier of the L6470 motion direction.
+  * @param  Speed         The speed value as (([step/s] * 250e-9) / 2^-28)
+  *
+  * @note   This function will properly fill the right column of the L6470_AppCmdPkg.
+  * @note   The commad will be sent by @ref L6470_PerformPreparedApplicationCommand.
+  */
+void L6470::L6470_PrepareGoUntil(eL6470_ActId_t L6470_ActId, eL6470_DirId_t L6470_DirId, uint32_t Speed)
+{
+  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_GOUNTIL_ID, L6470_ActId, L6470_DirId, Speed);
+}
+
+/**
+  * @brief  Prepare to send @ref L6470_ReleaseSW.
+  * 
+  * @param  L6470_ActId   The identifier of the L6470 action about the absolute position.
+  * @param  L6470_DirId   The identifier of the L6470 motion direction.
+  *
+  * @note   This function will properly fill the right column of the L6470_AppCmdPkg.
+  * @note   The commad will be sent by @ref L6470_PerformPreparedApplicationCommand.
+  */
+void L6470::L6470_PrepareReleaseSW(eL6470_ActId_t L6470_ActId, eL6470_DirId_t L6470_DirId)
+{
+  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_RELEASESW_ID, L6470_ActId, L6470_DirId, 0);
+}
+
+/**
+  * @brief  Prepare to send @ref L6470_GoHome command.
+  * 
+  *
+  * @note   This function will properly fill the right column of the L6470_AppCmdPkg.
+  * @note   The commad will be sent by @ref L6470_PerformPreparedApplicationCommand.
+  */
+void L6470::L6470_PrepareGoHome(void)
+{
+  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_GOHOME_ID, 0, 0, 0);
+}
+
+/**
+  * @brief  Prepare to send @ref L6470_GoMark command.
+  * 
+  *
+  * @note   This function will properly fill the right column of the L6470_AppCmdPkg.
+  * @note   The commad will be sent by @ref L6470_PerformPreparedApplicationCommand.
+  */
+void L6470::L6470_PrepareGoMark(void)
+{
+  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_GOMARK_ID, 0, 0, 0);
+}
+
+/**
+  * @brief  Prepare to send @ref L6470_ResetPos command.
+  * 
+  *
+  * @note   This function will properly fill the right column of the L6470_AppCmdPkg.
+  * @note   The commad will be sent by @ref L6470_PerformPreparedApplicationCommand.
+  */
+void L6470::L6470_PrepareResetPos(void)
+{
+  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_RESETPOS_ID, 0, 0, 0);
+}
+
+/**
+  * @brief  Prepare to send @ref L6470_ResetDevice command.
+  * 
+  *
+  * @note   This function will properly fill the right column of the L6470_AppCmdPkg.
+  * @note   The commad will be sent by @ref L6470_PerformPreparedApplicationCommand.
+  */
+void L6470::L6470_PrepareResetDevice(void)
+{
+  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_RESETDEVICE_ID, 0, 0, 0);
+}
+
+/**
+  * @brief  Prepare to send @ref L6470_SoftStop command.
+  * 
+  *
+  * @note   This function will properly fill the right column of the L6470_AppCmdPkg.
+  * @note   The commad will be sent by @ref L6470_PerformPreparedApplicationCommand.
+  */
+void L6470::L6470_PrepareSoftStop(void)
+{
+  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_SOFTSTOP_ID, 0, 0, 0);
+}
+
+/**
+  * @brief  Prepare to send @ref L6470_HardStop command.
+  * 
+  *
+  * @note   This function will properly fill the right column of the L6470_AppCmdPkg.
+  * @note   The commad will be sent by @ref L6470_PerformPreparedApplicationCommand.
+  */
+void L6470::L6470_PrepareHardStop(void)
+{
+  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_HARDSTOP_ID, 0, 0, 0);
+}
+
+/**
+  * @brief  Prepare to send @ref L6470_SoftHiZ command.
+  * 
+  *
+  * @note   This function will properly fill the right column of the L6470_AppCmdPkg.
+  * @note   The commad will be sent by @ref L6470_PerformPreparedApplicationCommand.
+  */
+void L6470::L6470_PrepareSoftHiZ(void)
+{
+  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_SOFTHIZ_ID, 0, 0, 0);
+}
+
+/**
+  * @brief  Prepare to send @ref L6470_HardHiZ command.
+  * 
+  *
+  * @note   This function will properly fill the right column of the L6470_AppCmdPkg.
+  * @note   The commad will be sent by @ref L6470_PerformPreparedApplicationCommand.
+  */
+void L6470::L6470_PrepareHardHiZ(void)
+{
+  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_HARDHIZ_ID, 0, 0, 0);
+}
+
+/**
+  * @brief  Prepare to send @ref L6470_GetStatus command.
+  * 
+  *
+  * @note   This function will properly fill the right column of the L6470_AppCmdPkg.
+  * @note   The commad will be sent by @ref L6470_PerformPreparedApplicationCommand.
+  */
+void L6470::L6470_PrepareGetStatus(void)
+{
+  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_GETSTATUS_ID, 0, 0, 0);
+}
+
+/* End of L6470_AppCMDs_ToBePrepared */
+
+/**
+  * @brief  Send via SPI the command stored inside the L6470_AppCmdPkg to the
+  *         L6470 daisy chain.
+  * 
+  * @retval (uint8_t*)data->L6470_DaisyChainSpiRxStruct  The pointer to the structure
+  *         containing returned values from each L6470 of the daisy chain for each
+  *         sent SPI data.
+  */
+uint8_t* L6470::L6470_PerformPreparedApplicationCommand(void)
+{
+  L6470_PrepareDaisyChainCommand(L6470_AppCmdPkg, (uint8_t*)L6470_DaisyChainSpiTxStruct);
+  L6470_DaisyChainCommand((uint8_t*)L6470_DaisyChainSpiTxStruct, (uint8_t*)L6470_DaisyChainSpiRxStruct);
+  
+  return (uint8_t*)(L6470_DaisyChainSpiRxStruct);
+}
+
+/**
+  * @brief  Send command to the L6470 daisy chain via SPI
+  * @param  pL6470_DaisyChainSpiTxStruct  Pointer to the matrix array of bytes to be sent to the daisy chain L6470
+  * @param  pL6470_DaisyChainSpiRxStruct  Pointer to the matrix array of bytes to be received from the daisy chain L6470
+  */
+void L6470::L6470_DaisyChainCommand(uint8_t* pL6470_DaisyChainSpiTxStruct, uint8_t* pL6470_DaisyChainSpiRxStruct)
+{
+  uint8_t spibyte;
+  
+  L6470_DaisyChain_HalfPrepared = ZERO_F;
+  
+  /* Send all command bytes via SPI */
+  for(spibyte=0; spibyte < L6470MAXSPICMDBYTESIZE; spibyte++)
+  {
+    /* Send the command via SPI */
+    L6470_SPI_Communication((pL6470_DaisyChainSpiTxStruct+(spibyte * L6470DAISYCHAINSIZE)), (pL6470_DaisyChainSpiRxStruct+(spibyte * L6470DAISYCHAINSIZE)), L6470DAISYCHAINSIZE, 10);
+    
+    //_DELAY(TDISCS);
+    uint8_t delay_cnt;
+    for (delay_cnt=0; delay_cnt<20; delay_cnt++) __NOP();   //!<Simply deselect time delay for SPI nCS
+  }
+}
+
+/**
+  * @brief    Extracts the data returned by the L6470 from the matrix that
+  *           contains the received SPI data.
+  * @param    L6470_Id  The identifier of the L6470 target inside the daisy chain.
+  * @param    pL6470_DaisyChainSpiRxStruct  uint8_t-pointer to the matrix that
+  *           contains the received data by SPI from the L6470 daisy chain.
+  * @param    LengthByte  The number of bytes about the received value.
+  */
+uint32_t L6470::L6470_ExtractReturnedData(uint8_t* pL6470_DaisyChainSpiRxStruct, uint8_t LengthByte)
+{
+  uint32_t value;
+  uint8_t i;
+
+  value = 0x000000;
+  for (i=1; i<=(L6470MAXSPICMDBYTESIZE-1); i++)
+  {
+    value |= (*(pL6470_DaisyChainSpiRxStruct+(i*L6470DAISYCHAINSIZE)+L6470_Id))<<((LengthByte-i)*8);
+  }
+
+  return value;
+}
+
+/**
+  * @brief  Check the state of a flag inside the L6470 STATUS register.
+  *
+  * @param  L6470_Id  The identifier of the L6470 target inside the daisy chain.
+  * @param  L6470_StatusRegisterFlagId  The identifier of the L6470 STATUS flag to be checked.
+  *
+  * @retval state The flag state.
+  */
+
+uint8_t L6470::L6470_CheckStatusRegisterFlag(uint8_t L6470_StatusRegisterFlagId)
+{
+  uint8_t state = 0;
+
+  *((uint16_t*)pL6470_StatusRegister) = L6470_GetParam(L6470_STATUS_ID);
+  
+  switch(L6470_StatusRegisterFlagId)
+  {
+    case HiZ_ID:
+      state = pL6470_StatusRegister->HiZ;
+      break;
+    case BUSY_ID:
+      state = pL6470_StatusRegister->BUSY;
+      break;
+    case SW_F_ID:
+      state = pL6470_StatusRegister->SW_F;
+      break;
+    case SW_EVN_ID:
+      state = pL6470_StatusRegister->SW_EVN;
+      break;
+    case DIR_ID:
+      state = pL6470_StatusRegister->DIR;
+      break;
+    case MOT_STATUS_ID:
+      state = pL6470_StatusRegister->MOT_STATUS;
+      break;
+    case NOTPERF_CMD_ID:
+      state = pL6470_StatusRegister->NOTPERF_CMD;
+      break;
+    case WRONG_CMD_ID:
+      state = pL6470_StatusRegister->WRONG_CMD;
+      break;
+    case UVLO_ID:
+      state = pL6470_StatusRegister->UVLO;
+      break;
+    case TH_WRN_ID:
+      state = pL6470_StatusRegister->TH_WRN;
+      break;
+    case TH_SD_ID:
+      state = pL6470_StatusRegister->TH_SD;
+      break;
+    case OCD_ID:
+      state = pL6470_StatusRegister->OCD;
+      break;
+    case STEP_LOSS_A_ID:
+      state = pL6470_StatusRegister->STEP_LOSS_A;
+      break;
+    case STEP_LOSS_B_ID:
+      state = pL6470_StatusRegister->STEP_LOSS_B;
+      break;
+    case SCK_MOD_ID:
+      state = pL6470_StatusRegister->SCK_MOD;
+      break;
+  }
+  
+  return state;
+}
+
+/**
+  * @brief  Return the mnemonic name for the L6470 register.
+  * @param  id  The identifier of the L6470 register.
+  */
+uint8_t *L6470::L6470_GetRegisterName(uint8_t id)
+{
+  if (id < L6470REGIDSIZE)
+  {
+    return (uint8_t*)L6470_Register[id].Name;
+  }
+  else
+  {
+    return NULL;
+  }
+}
+
+/**
+  * @brief  Configures the L6470 registers.
+  * @param  init The pointer to the initialization structure.
+  */
+status_t L6470::L6470_Config(void *init)
+{
+  /* Disable the L6470. */
+  L6470_DISABLE();
+
+  /* Enable the L6470. */
+  L6470_ENABLE();
+
+  /* Reset devices. */
+  ResetDevice();
+
+  /* Reset Status Register flags. */
+  GetStatus();
+
+  /* Prepare the 'Register' field of StepperMotorDriverHandle */
+  L6470_init_t *MotorParameterData = (L6470_init_t *) init;
+  StepperMotorRegister.ACC = L6470_Step_s2_2_Acc(MotorParameterData->acc);
+  StepperMotorRegister.DEC = L6470_Step_s2_2_Dec(MotorParameterData->dec);
+  StepperMotorRegister.MAX_SPEED = L6470_Step_s_2_MaxSpeed(MotorParameterData->maxspeed);
+  StepperMotorRegister.MIN_SPEED = L6470_Step_s_2_MinSpeed(MotorParameterData->minspeed);
+  StepperMotorRegister.FS_SPD = L6470_Step_s_2_FsSpd(MotorParameterData->fsspd);
+  StepperMotorRegister.KVAL_HOLD = (uint8_t)((float)((float)(MotorParameterData->kvalhold * 256) / (MotorParameterData->motorvoltage)));
+  StepperMotorRegister.KVAL_RUN = (uint8_t)((float)((float)(MotorParameterData->kvalrun * 256) / (MotorParameterData->motorvoltage)));
+  StepperMotorRegister.KVAL_ACC = (uint8_t)((float)((float)(MotorParameterData->kvalacc * 256) / (MotorParameterData->motorvoltage)));
+  StepperMotorRegister.KVAL_DEC = (uint8_t)((float)((float)(MotorParameterData->kvaldec * 256) / (MotorParameterData->motorvoltage)));
+  StepperMotorRegister.INT_SPEED = L6470_Step_s_2_IntSpeed(MotorParameterData->intspeed);
+  StepperMotorRegister.ST_SLP = L6470_s_Step_2_StSlp(MotorParameterData->stslp);
+  StepperMotorRegister.FN_SLP_ACC = L6470_s_Step_2_FnSlpAcc(MotorParameterData->fnslpacc);
+  StepperMotorRegister.FN_SLP_DEC = L6470_s_Step_2_FnSlpDec(MotorParameterData->fnslpdec);
+  StepperMotorRegister.K_THERM = MotorParameterData->kterm;
+  StepperMotorRegister.OCD_TH = L6470_mA_2_OcdTh(MotorParameterData->ocdth);
+  StepperMotorRegister.STALL_TH = L6470_mA_2_StallTh(MotorParameterData->stallth);
+  StepperMotorRegister.ALARM_EN = MotorParameterData->alarmen;
+  StepperMotorRegister.CONFIG = MotorParameterData->config;
+  StepperMotorRegister.STEP_MODE = MotorParameterData->step_sel;
+
+  /* Write the L6470 registers with the prepared data */
+  L6470_SetParam(L6470_ACC_ID, StepperMotorRegister.ACC);
+  L6470_SetParam(L6470_DEC_ID, StepperMotorRegister.DEC);
+  L6470_SetParam(L6470_MAX_SPEED_ID, StepperMotorRegister.MAX_SPEED);
+  L6470_SetParam(L6470_MIN_SPEED_ID, StepperMotorRegister.MIN_SPEED);
+  L6470_SetParam(L6470_FS_SPD_ID, StepperMotorRegister.FS_SPD);
+  L6470_SetParam(L6470_KVAL_HOLD_ID, StepperMotorRegister.KVAL_HOLD);
+  L6470_SetParam(L6470_KVAL_RUN_ID, StepperMotorRegister.KVAL_RUN);
+  L6470_SetParam(L6470_KVAL_ACC_ID, StepperMotorRegister.KVAL_ACC);
+  L6470_SetParam(L6470_KVAL_DEC_ID, StepperMotorRegister.KVAL_DEC);
+  L6470_SetParam(L6470_INT_SPEED_ID, StepperMotorRegister.INT_SPEED);
+  L6470_SetParam(L6470_ST_SLP_ID, StepperMotorRegister.ST_SLP);
+  L6470_SetParam(L6470_FN_SLP_ACC_ID, StepperMotorRegister.FN_SLP_ACC);
+  L6470_SetParam(L6470_FN_SLP_DEC_ID, StepperMotorRegister.FN_SLP_DEC);
+  L6470_SetParam(L6470_K_THERM_ID, StepperMotorRegister.K_THERM);
+  L6470_SetParam(L6470_OCD_TH_ID, StepperMotorRegister.OCD_TH);
+  L6470_SetParam(L6470_STALL_TH_ID, StepperMotorRegister.STALL_TH);
+  L6470_SetParam(L6470_ALARM_EN_ID, StepperMotorRegister.ALARM_EN);
+  L6470_SetParam(L6470_CONFIG_ID, StepperMotorRegister.CONFIG);
+  if (!SetStepMode((StepperMotor::step_mode_t) StepperMotorRegister.STEP_MODE))
+    return COMPONENT_ERROR;
+  
+  return COMPONENT_OK;
+}
+
+/* End of L6470_Exported_Functions */
+
+/* End of L6470 */
+
+/* End of Components */
+
+/* End of BSP */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Components/l6470/L6470_def.h	Fri Mar 10 11:09:21 2017 +0100
@@ -0,0 +1,315 @@
+/**
+ ******************************************************************************
+ * @file       L6470_def.h
+ * @date       01/10/2014 12:00:00
+ * @brief      This file contains definitions, exported variables and function
+ *             prototypes related to the L6470.
+ ******************************************************************************
+ *
+ * COPYRIGHT(c) 2014 STMicroelectronics
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *   1. Redistributions of source code must retain the above copyright notice,
+ *      this list of conditions and the following disclaimer.
+ *   2. Redistributions in binary form must reproduce the above copyright notice,
+ *      this list of conditions and the following disclaimer in the documentation
+ *      and/or other materials provided with the distribution.
+ *   3. Neither the name of STMicroelectronics nor the names of its contributors
+ *      may be used to endorse or promote products derived from this software
+ *      without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ******************************************************************************
+ */
+
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+
+#ifndef __L6470_H
+#define __L6470_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+
+/* Includes ------------------------------------------------------------------*/
+
+#include "../Common/microstepping_motor_def.h"
+
+
+/* Definitions ---------------------------------------------------------------*/
+
+/** @addtogroup BSP
+ * @{
+ */
+
+/** @addtogroup Components
+ * @{
+ */  
+  
+/** @addtogroup L6470
+ * @{
+ */
+  
+/** @defgroup L6470_Exported_Defines L6470_Exported_Defines
+ * @{
+ */  
+
+/**
+  * @defgroup   L6470_Exported_Constants
+  * @brief      L6470 Exported Constants.
+  * @{
+  */
+
+/**
+  * @defgroup   L6470_Register_Max_Values
+  * @brief      Maximum values for L6470 registers.
+  * @{
+  */
+
+#define L6470_MAX_POSITION          (0x1FFFFF)          //!< Max position
+#define L6470_MIN_POSITION          (-(0x200000))       //!< Min position
+#define L6470_POSITION_RANGE        ((uint32_t)(L6470_MAX_POSITION - L6470_MIN_POSITION))   //!< Position range
+#define L6470_MAX_SPEED             (0xFFFFF)           //!< max value of SPEED
+#define L6470_MAX_ACC               (0xFFF)             //!< max value of ACC
+#define L6470_MAX_DEC               (0xFFF)             //!< max value of DEC
+#define L6470_MAX_MAX_SPEED         (0x3FF)             //!< max value of MAX_SPEED
+#define L6470_MAX_MIN_SPEED         (0xFFF)             //!< max value of MIN_SPEED
+#define L6470_MAX_FS_SPD            (0x3FF)             //!< max value of FS_SPD
+#define L6470_MAX_INT_SPEED         (0x3FFF)            //!< max value of INT_SPEED
+#define L6470_MAX_ST_SLP            (0xFF)              //!< max value of ST_SLP
+#define L6470_MAX_FN_SLP_ACC        (0xFF)              //!< max value of FN_SLP_ACC
+#define L6470_MAX_FN_SLP_DEC        (0xFF)              //!< max value of FN_SLP_DEC
+#define L6470_MAX_OCD_TH            (0xF)               //!< max value of OCD_TH
+#define L6470_MAX_STALL_TH          (0x7F)              //!< max value of STALL_TH
+
+/**
+  * @}
+  */ /* End of L6470_Register_Max_Values */
+
+#define L6470REGIDSIZE          25                  //!< Max number of identifiers of L6470 Registers
+#define L6470APPCMDIDSIZE       19                  //!< Max number of identifiers of L6470 Application Commands
+#define L6470DIRIDSIZE           2                  //!< Max number of identifiers of L6470 directions
+#define L6470ACTIDSIZE           2                  //!< Max number of identifiers of actions to perform about ABS_POS register
+#define L6470MAXSPICMDBYTESIZE   4                  //!< Max number of byte to send via SPI to perform an application command
+#define L6470DAISYCHAINSIZE      2                  //!< Max number of identifiers of L6470 in daisy chain configuration
+
+#define L6470_MAX_SPEED_VALUE   ((float)15610)      //!< max value for the speed in step/s
+#define L6470_MAX_ACC_VALUE     ((float)59590)      //!< max value for the acceleration in step/s^2
+#define L6470_MAX_DEC_VALUE     ((float)59590)      //!< max value for the acceleration in step/s^2
+#define L6470_MAX_DEC_VALUE     ((float)59590)      //!< max value for the acceleration in step/s^2
+
+#define OCD_TH_STEP             ((float)375)      //!< Minimum step for OCD_TH register in mAmpere
+#define STALL_TH_STEP           ((float)31.25)    //!< Minimum step for STALL_TH register in mAmpere
+
+#define L6470_ACC_CONV          ((float)0.068719)   //!< Conversion factor for acceleration value from step/s^2 to the right value
+#define L6470_DEC_CONV          ((float)0.068719)   //!< Conversion factor for deceleration value from step/s^2 to the right value
+#define L6470_MAXSPEED_CONV     ((float)0.065536)   //!< Conversion factor for max speed value from step/s to the right value
+#define L6470_MINSPEED_CONV     ((float)4.194304)   //!< Conversion factor for min speed value from step/s to the right value
+#define L6470_SPEED_CONV        ((float)67.108864)  //!< Conversion factor for speed value from step/s to the right value
+
+
+/* Types ---------------------------------------------------------------------*/
+
+/**
+  * @addtogroup BSP
+  * @{
+  */
+
+/**
+  * @addtogroup Components
+  * @{
+  */
+
+/**
+  * @defgroup L6470
+  * @brief    Tools to manage the L6470 Stepper Motor Driver.
+  * @{
+  */
+
+/**
+  * @defgroup   L6470_Exported_Types
+  * @brief      L6470 Exported Types.
+  * @{
+  */
+
+/**
+  * @brief  The structure to store some features of the L6470 Registers.
+  */
+typedef struct {
+  uint8_t Address;                  //!< Register Address
+  uint8_t Name[12];                 //!< Register Name
+  uint8_t LengthBit;                //!< Register Length in bits
+  uint8_t LengthByte;               //!< Register Length in bytes
+  uint32_t ResetValue;              //!< Register Reset Value
+} sL6470_Register_t;
+
+/**
+  * @brief  The structure to store some features of the L6470 Application Commands.
+  */
+typedef struct {
+  uint8_t Mnemonic[12];             //!< AppCmd Mnemonic
+  uint8_t BinaryCode;               //!< AppCmd Binary Code
+  uint8_t NrOfParameters;           //!< AppCmd number of needed parameters
+} sL6470_ApplicationCommand_t;
+
+/**
+  * @brief  The structure to store some features about the L6470 Motor Direction.
+  */
+typedef struct {
+  uint8_t Mnemonic[8];              //!< L6470 Direction Mnemonic
+  uint8_t BinaryCode;               //!< L6470 Direction Binary Code
+} sL6470_Direction_t;
+
+/**
+  * @brief  The structure to store some features about the action taken with the L6470 ABS_POS register.
+  */
+typedef struct {
+  uint8_t Mnemonic[4];              //!< ACT Mnemonic
+  uint8_t BinaryCode;               //!< ACT Binary Code
+} sL6470_ACT_t;
+
+/**
+  * @brief  The structure used to store the identifier of the L6470 application
+  *         command and its the needed parameters.
+  * @note   The data stored into this structure will be used to fill the matrix
+  *         used by SPI to send the command to the L6470.
+  */
+typedef struct {
+  eL6470_AppCmdId_t L6470_AppCmdId; //!< The identifier of the actual L6470 Application Command
+  uint32_t p1;                      //!< The 1st parameter if needed
+  uint32_t p2;                      //!< The 2nd parameter if needed
+  uint32_t p3;                      //!< The 3rd parameter if needed
+} sL6470_AppCmdPkg_t;
+
+/**
+  * @}
+  */ /* End of L6470_Exported_Types */
+
+/** 
+ * @brief  L6470 driver initialization structure definition.
+ */
+/* ACTION --------------------------------------------------------------------*
+ * Declare here the component's initialization structure, if any, one         *
+ * variable per line without initialization.                                  *
+ *                                                                            *
+ * Example:                                                                   *
+ *   typedef struct                                                           *
+ *   {                                                                        *
+ *     int frequency;                                                         *
+ *     int update_mode;                                                       *
+ *   } COMPONENT_Init_t;                                                      *
+ *----------------------------------------------------------------------------*/
+typedef struct
+{
+  float     motorvoltage;           //!< motor supply voltage in V
+  float     fullstepsperrevolution; //!< min number of steps per revolution for the motor
+  float     phasecurrent;           //!< max motor phase voltage in A
+  float     phasevoltage;           //!< max motor phase voltage in V
+  float     speed;                  //!< motor initial speed [step/s]
+  float     acc;                    //!< motor acceleration [step/s^2] (comment for infinite acceleration mode)
+  float     dec;                    //!< motor deceleration [step/s^2] (comment for infinite deceleration mode)
+  float     maxspeed;               //!< motor maximum speed [step/s]
+  float     minspeed;               //!< motor minimum speed [step/s]
+  float     fsspd;                  //!< motor full-step speed threshold [step/s]
+  float     kvalhold;               //!< holding kval [V]
+  float     kvalrun;                //!< constant speed kval [V]
+  float     kvalacc;                //!< acceleration starting kval [V]
+  float     kvaldec;                //!< deceleration starting kval [V]
+  float     intspeed;               //!< intersect speed for bemf compensation curve slope changing [step/s]
+  float     stslp;                  //!< start slope [s/step]
+  float     fnslpacc;               //!< acceleration final slope [s/step]
+  float     fnslpdec;               //!< deceleration final slope [s/step]
+  uint8_t   kterm;                  //!< thermal compensation factor (range [0, 15])
+  float     ocdth;                  //!< ocd threshold [ma] (range [375 ma, 6000 ma])
+  float     stallth;                //!< stall threshold [ma] (range [31.25 ma, 4000 ma])
+  uint8_t   step_sel;               //!< step mode selection
+  uint8_t   alarmen;                //!< alarm conditions enable
+  uint16_t  config;                 //!< ic configuration
+} L6470_init_t;
+
+/** 
+ * @brief  L6470 driver data structure definition.
+ */ 
+/* ACTION --------------------------------------------------------------------*
+ * Declare here the structure of component's data, if any, one variable per   *
+ * line without initialization.                                               *
+ *                                                                            *
+ * Example:                                                                   *
+ *   typedef struct                                                           *
+ *   {                                                                        *
+ *       int T0_out;                                                          *
+ *       int T1_out;                                                          *
+ *       float T0_degC;                                                       *
+ *       float T1_degC;                                                       *
+ *   } COMPONENT_Data_t;                                                      *
+ *----------------------------------------------------------------------------*/
+typedef struct
+{
+  uint8_t L6470_Id;                                                                  //!< The L6470 identifier inside the daisy chain
+  sL6470_Register_t *L6470_Register; //[L6470REGIDSIZE];                             //!< Array whose elements are a structure in which store information about the L6470 Registers (the address, the names, the length in bits, the reset value)
+  sL6470_ApplicationCommand_t *L6470_ApplicationCommand; //[L6470APPCMDIDSIZE];      //!< Array whose elements are a structure in which store information about the L6470 Application Commands (the mnemonic name, the number of needed parameters, the related funtion to call)
+  sL6470_Direction_t *L6470_Direction; //[L6470DIRIDSIZE];                           //!< The mnemonic names for the L6470 direction
+  sL6470_ACT_t *L6470_ACT; //[L6470ACTIDSIZE];                                       //!< Action taken about ABS_POS register
+  sL6470_AppCmdPkg_t L6470_AppCmdPkg[L6470DAISYCHAINSIZE];                           //!< To store the identifier of the actual L6470 application command and its the needed parameters
+  uint8_t L6470_DaisyChainSpiTxStruct[L6470MAXSPICMDBYTESIZE][L6470DAISYCHAINSIZE];  //!< To store the matrix that contains the command data that are going to be sent by SPI to the L6470 daisy chain
+  uint8_t L6470_DaisyChainSpiRxStruct[L6470MAXSPICMDBYTESIZE][L6470DAISYCHAINSIZE];  //!< To store the matrix that contains the received data by SPI from the L6470 daisy chain
+  eFlagStatus_t L6470_DaisyChain_HalfPrepared; /* = ZERO_F; */                       //!< Boolean variable used when more than one L6470 into the daisy chain is going to be addressed for commanding
+  sL6470_StatusRegister_t L6470_StatusRegister;                                      //!< To store the received L6470_StatusRegister
+  sL6470_StatusRegister_t *pL6470_StatusRegister; /* = &L6470_StatusRegister; */     //!< Pointer to the L6470_StatusRegister variable
+} L6470_Data_t;
+
+
+/* Functions -----------------------------------------------------------------*/
+
+/** @addtogroup BSP
+ * @{
+ */
+
+/** @addtogroup Components
+ * @{
+ */
+
+/** @addtogroup L6470
+ * @{
+ */
+
+/** @defgroup L6470_Imported_Functions L6470_Imported_Functions
+ * @{
+ */
+
+/* ACTION --------------------------------------------------------------------*
+ * Declare here extern platform-dependent APIs you might need (e.g.: I/O and  *
+ * interrupt related functions), and implement them in a glue-logic file on   *
+ * the target environment, for example within the "x_nucleo_board.c" file.    *
+ * E.g.:                                                                      *
+ *   extern status_t COMPONENT_IO_Init (void *handle);                        *
+ *   extern status_t COMPONENT_IO_Read (handle, buf, regadd, bytes);          *
+ *   extern status_t COMPONENT_IO_Write(handle, buf, regadd, bytes);          *
+ *   extern void     COMPONENT_IO_ITConfig(void);                             *
+ *----------------------------------------------------------------------------*/
+extern void L6470_DISABLE(void);
+extern void L6470_ENABLE(void);
+extern void L6470_nCS_LOW(void);
+extern void L6470_nCS_HIGH(void);
+extern void L6470_SPI_Communication(uint8_t *pTxData, uint8_t *pRxData, uint16_t Size, uint32_t Timeout);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __L6470_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
--- a/Components/l6470/l6470.h	Wed Mar 01 17:52:33 2017 +0000
+++ b/Components/l6470/l6470.h	Fri Mar 10 11:09:21 2017 +0100
@@ -1,9 +1,10 @@
 /**
  ******************************************************************************
- * @file       L6470.h
- * @date       01/10/2014 12:00:00
- * @brief      This file contains definitions, exported variables and function
- *             prototypes related to the L6470.
+ * @file    l6470.h
+ * @author  Davide Aliprandi, STMicroelectronics
+ * @version V1.0.0
+ * @date    November 12th, 2015
+ * @brief   This file contains the class of an L6470 Motor Control component.
  ******************************************************************************
  *
  * COPYRIGHT(c) 2014 STMicroelectronics
@@ -34,282 +35,1550 @@
  */
 
 
+/* Generated with STM32CubeTOO -----------------------------------------------*/
+
+
+/* Revision ------------------------------------------------------------------*/
+/*
+    Repository:       http://svn.x-nucleodev.codex.cro.st.com/svnroot/X-NucleoDev
+    Branch/Trunk/Tag: trunk
+    Based on:         X-CUBE-SPN2/trunk/Drivers/BSP/Components/L6470/L6470.h
+    Revision:         0
+*/
+
+
 /* Define to prevent recursive inclusion -------------------------------------*/
 
-#ifndef __L6470_H
-#define __L6470_H
-
-#ifdef __cplusplus
- extern "C" {
-#endif
+#ifndef __L6470_CLASS_H
+#define __L6470_CLASS_H
 
 
 /* Includes ------------------------------------------------------------------*/
 
-#include "../Common/microstepping_motor.h"
+/* ACTION 1 ------------------------------------------------------------------*
+ * Include here platform specific header files.                               *
+ *----------------------------------------------------------------------------*/
+#include "mbed.h"
+#include "DevSPI.h"
+/* ACTION 2 ------------------------------------------------------------------*
+ * Include here component specific header files.                              *
+ *----------------------------------------------------------------------------*/
+#include "l6470_def.h"
+/* ACTION 3 ------------------------------------------------------------------*
+ * Include here interface specific header files.                              *
+ *                                                                            *
+ * Example:                                                                   *
+ *   #include "HumiditySensor.h"                                              *
+ *   #include "TemperatureSensor.h"                                           *
+ *----------------------------------------------------------------------------*/
+#include "StepperMotor.h"
 
 
-/* Definitions ---------------------------------------------------------------*/
-
-/** @addtogroup BSP
- * @{
- */
-
-/** @addtogroup Components
- * @{
- */  
-  
-/** @addtogroup L6470
- * @{
- */
-  
-/** @defgroup L6470_Exported_Defines L6470_Exported_Defines
- * @{
- */  
-
-/**
-  * @defgroup   L6470_Exported_Constants
-  * @brief      L6470 Exported Constants.
-  * @{
-  */
-
-/**
-  * @defgroup   L6470_Register_Max_Values
-  * @brief      Maximum values for L6470 registers.
-  * @{
-  */
-
-#define L6470_MAX_POSITION          (0x1FFFFF)          //!< Max position
-#define L6470_MIN_POSITION          (-(0x200000))       //!< Min position
-#define L6470_POSITION_RANGE        ((uint32_t)(L6470_MAX_POSITION - L6470_MIN_POSITION))   //!< Position range
-#define L6470_MAX_SPEED             (0xFFFFF)           //!< max value of SPEED
-#define L6470_MAX_ACC               (0xFFF)             //!< max value of ACC
-#define L6470_MAX_DEC               (0xFFF)             //!< max value of DEC
-#define L6470_MAX_MAX_SPEED         (0x3FF)             //!< max value of MAX_SPEED
-#define L6470_MAX_MIN_SPEED         (0xFFF)             //!< max value of MIN_SPEED
-#define L6470_MAX_FS_SPD            (0x3FF)             //!< max value of FS_SPD
-#define L6470_MAX_INT_SPEED         (0x3FFF)            //!< max value of INT_SPEED
-#define L6470_MAX_ST_SLP            (0xFF)              //!< max value of ST_SLP
-#define L6470_MAX_FN_SLP_ACC        (0xFF)              //!< max value of FN_SLP_ACC
-#define L6470_MAX_FN_SLP_DEC        (0xFF)              //!< max value of FN_SLP_DEC
-#define L6470_MAX_OCD_TH            (0xF)               //!< max value of OCD_TH
-#define L6470_MAX_STALL_TH          (0x7F)              //!< max value of STALL_TH
-
-/**
-  * @}
-  */ /* End of L6470_Register_Max_Values */
-
-#define L6470REGIDSIZE          25                  //!< Max number of identifiers of L6470 Registers
-#define L6470APPCMDIDSIZE       19                  //!< Max number of identifiers of L6470 Application Commands
-#define L6470DIRIDSIZE           2                  //!< Max number of identifiers of L6470 directions
-#define L6470ACTIDSIZE           2                  //!< Max number of identifiers of actions to perform about ABS_POS register
-#define L6470MAXSPICMDBYTESIZE   4                  //!< Max number of byte to send via SPI to perform an application command
-#define L6470DAISYCHAINSIZE      2                  //!< Max number of identifiers of L6470 in daisy chain configuration
-
-#define L6470_MAX_SPEED_VALUE   ((float)15610)      //!< max value for the speed in step/s
-#define L6470_MAX_ACC_VALUE     ((float)59590)      //!< max value for the acceleration in step/s^2
-#define L6470_MAX_DEC_VALUE     ((float)59590)      //!< max value for the acceleration in step/s^2
-#define L6470_MAX_DEC_VALUE     ((float)59590)      //!< max value for the acceleration in step/s^2
-
-#define OCD_TH_STEP             ((float)375)      //!< Minimum step for OCD_TH register in mAmpere
-#define STALL_TH_STEP           ((float)31.25)    //!< Minimum step for STALL_TH register in mAmpere
-
-#define L6470_ACC_CONV          ((float)0.068719)   //!< Conversion factor for acceleration value from step/s^2 to the right value
-#define L6470_DEC_CONV          ((float)0.068719)   //!< Conversion factor for deceleration value from step/s^2 to the right value
-#define L6470_MAXSPEED_CONV     ((float)0.065536)   //!< Conversion factor for max speed value from step/s to the right value
-#define L6470_MINSPEED_CONV     ((float)4.194304)   //!< Conversion factor for min speed value from step/s to the right value
-#define L6470_SPEED_CONV        ((float)67.108864)  //!< Conversion factor for speed value from step/s to the right value
-
-
-/* Types ---------------------------------------------------------------------*/
-
-/**
-  * @addtogroup BSP
-  * @{
-  */
-
-/**
-  * @addtogroup Components
-  * @{
-  */
-
-/**
-  * @defgroup L6470
-  * @brief    Tools to manage the L6470 Stepper Motor Driver.
-  * @{
-  */
-
-/**
-  * @defgroup   L6470_Exported_Types
-  * @brief      L6470 Exported Types.
-  * @{
-  */
-
-/**
-  * @brief  The structure to store some features of the L6470 Registers.
-  */
-typedef struct {
-  uint8_t Address;                  //!< Register Address
-  uint8_t Name[12];                 //!< Register Name
-  uint8_t LengthBit;                //!< Register Length in bits
-  uint8_t LengthByte;               //!< Register Length in bytes
-  uint32_t ResetValue;              //!< Register Reset Value
-} sL6470_Register_t;
-
-/**
-  * @brief  The structure to store some features of the L6470 Application Commands.
-  */
-typedef struct {
-  uint8_t Mnemonic[12];             //!< AppCmd Mnemonic
-  uint8_t BinaryCode;               //!< AppCmd Binary Code
-  uint8_t NrOfParameters;           //!< AppCmd number of needed parameters
-} sL6470_ApplicationCommand_t;
-
-/**
-  * @brief  The structure to store some features about the L6470 Motor Direction.
-  */
-typedef struct {
-  uint8_t Mnemonic[8];              //!< L6470 Direction Mnemonic
-  uint8_t BinaryCode;               //!< L6470 Direction Binary Code
-} sL6470_Direction_t;
+/* Classes -------------------------------------------------------------------*/
 
 /**
-  * @brief  The structure to store some features about the action taken with the L6470 ABS_POS register.
-  */
-typedef struct {
-  uint8_t Mnemonic[4];              //!< ACT Mnemonic
-  uint8_t BinaryCode;               //!< ACT Binary Code
-} sL6470_ACT_t;
-
-/**
-  * @brief  The structure used to store the identifier of the L6470 application
-  *         command and its the needed parameters.
-  * @note   The data stored into this structure will be used to fill the matrix
-  *         used by SPI to send the command to the L6470.
-  */
-typedef struct {
-  eL6470_AppCmdId_t L6470_AppCmdId; //!< The identifier of the actual L6470 Application Command
-  uint32_t p1;                      //!< The 1st parameter if needed
-  uint32_t p2;                      //!< The 2nd parameter if needed
-  uint32_t p3;                      //!< The 3rd parameter if needed
-} sL6470_AppCmdPkg_t;
-
-/**
-  * @}
-  */ /* End of L6470_Exported_Types */
-
-/** 
- * @brief  L6470 driver initialization structure definition.
+ * @brief Class representing a L6470 component.
  */
-/* ACTION --------------------------------------------------------------------*
- * Declare here the component's initialization structure, if any, one         *
- * variable per line without initialization.                                  *
- *                                                                            *
- * Example:                                                                   *
- *   typedef struct                                                           *
- *   {                                                                        *
- *     int frequency;                                                         *
- *     int update_mode;                                                       *
- *   } COMPONENT_Init_t;                                                      *
- *----------------------------------------------------------------------------*/
-typedef struct
+class L6470 : public StepperMotor
 {
-  float     motorvoltage;           //!< motor supply voltage in V
-  float     fullstepsperrevolution; //!< min number of steps per revolution for the motor
-  float     phasecurrent;           //!< max motor phase voltage in A
-  float     phasevoltage;           //!< max motor phase voltage in V
-  float     speed;                  //!< motor initial speed [step/s]
-  float     acc;                    //!< motor acceleration [step/s^2] (comment for infinite acceleration mode)
-  float     dec;                    //!< motor deceleration [step/s^2] (comment for infinite deceleration mode)
-  float     maxspeed;               //!< motor maximum speed [step/s]
-  float     minspeed;               //!< motor minimum speed [step/s]
-  float     fsspd;                  //!< motor full-step speed threshold [step/s]
-  float     kvalhold;               //!< holding kval [V]
-  float     kvalrun;                //!< constant speed kval [V]
-  float     kvalacc;                //!< acceleration starting kval [V]
-  float     kvaldec;                //!< deceleration starting kval [V]
-  float     intspeed;               //!< intersect speed for bemf compensation curve slope changing [step/s]
-  float     stslp;                  //!< start slope [s/step]
-  float     fnslpacc;               //!< acceleration final slope [s/step]
-  float     fnslpdec;               //!< deceleration final slope [s/step]
-  uint8_t   kterm;                  //!< thermal compensation factor (range [0, 15])
-  float     ocdth;                  //!< ocd threshold [ma] (range [375 ma, 6000 ma])
-  float     stallth;                //!< stall threshold [ma] (range [31.25 ma, 4000 ma])
-  uint8_t   step_sel;               //!< step mode selection
-  uint8_t   alarmen;                //!< alarm conditions enable
-  uint16_t  config;                 //!< ic configuration
-} L6470_Init_t;
+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  L6470 driver data structure definition.
- */ 
-/* ACTION --------------------------------------------------------------------*
- * Declare here the structure of component's data, if any, one variable per   *
- * line without initialization.                                               *
- *                                                                            *
- * Example:                                                                   *
- *   typedef struct                                                           *
- *   {                                                                        *
- *       int T0_out;                                                          *
- *       int T1_out;                                                          *
- *       float T0_degC;                                                       *
- *       float T1_degC;                                                       *
- *   } COMPONENT_Data_t;                                                      *
- *----------------------------------------------------------------------------*/
-typedef struct
-{
-  uint8_t L6470_Id;                                                                  //!< The L6470 identifier inside the daisy chain
-  sL6470_Register_t *L6470_Register; //[L6470REGIDSIZE];                             //!< Array whose elements are a structure in which store information about the L6470 Registers (the address, the names, the length in bits, the reset value)
-  sL6470_ApplicationCommand_t *L6470_ApplicationCommand; //[L6470APPCMDIDSIZE];      //!< Array whose elements are a structure in which store information about the L6470 Application Commands (the mnemonic name, the number of needed parameters, the related funtion to call)
-  sL6470_Direction_t *L6470_Direction; //[L6470DIRIDSIZE];                           //!< The mnemonic names for the L6470 direction
-  sL6470_ACT_t *L6470_ACT; //[L6470ACTIDSIZE];                                       //!< Action taken about ABS_POS register
-  sL6470_AppCmdPkg_t L6470_AppCmdPkg[L6470DAISYCHAINSIZE];                           //!< To store the identifier of the actual L6470 application command and its the needed parameters
-  uint8_t L6470_DaisyChainSpiTxStruct[L6470MAXSPICMDBYTESIZE][L6470DAISYCHAINSIZE];  //!< To store the matrix that contains the command data that are going to be sent by SPI to the L6470 daisy chain
-  uint8_t L6470_DaisyChainSpiRxStruct[L6470MAXSPICMDBYTESIZE][L6470DAISYCHAINSIZE];  //!< To store the matrix that contains the received data by SPI from the L6470 daisy chain
-  eFlagStatus_t L6470_DaisyChain_HalfPrepared; /* = ZERO_F; */                       //!< Boolean variable used when more than one L6470 into the daisy chain is going to be addressed for commanding
-  sL6470_StatusRegister_t L6470_StatusRegister;                                      //!< To store the received L6470_StatusRegister
-  sL6470_StatusRegister_t *pL6470_StatusRegister; /* = &L6470_StatusRegister; */     //!< Pointer to the L6470_StatusRegister variable
-} L6470_Data_t;
+    /**
+     * @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 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 *
+         * line.                                                              *
+         *                                                                    *
+         * Example:                                                           *
+         *   measure = 0;                                                     *
+         *   instance_id = number_of_instances++;                             *
+         *--------------------------------------------------------------------*/
+        L6470_Register = &_L6470_Register[0];
+        L6470_ApplicationCommand = &_L6470_ApplicationCommand[0];
+        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));
+        memset(L6470_DaisyChainSpiTxStruct, 0, L6470MAXSPICMDBYTESIZE * L6470DAISYCHAINSIZE * sizeof(uint8_t));
+        memset(L6470_DaisyChainSpiRxStruct, 0, L6470MAXSPICMDBYTESIZE * L6470DAISYCHAINSIZE * sizeof(uint8_t));
+    }
+
+    /**
+     * @brief Destructor.
+     */
+    virtual ~L6470(void) {}
 
 
-/* Functions -----------------------------------------------------------------*/
+    /*** Public Component Related Methods ***/
+
+    /* ACTION 5 --------------------------------------------------------------*
+     * Implement here the component's public methods, as wrappers of the C    *
+     * component's functions.                                                 *
+     * They should be:                                                        *
+     *   + Methods with the same name of the C component's virtual table's    *
+     *     functions (1);                                                     *
+     *   + Methods with the same name of the C component's extended virtual   *
+     *     table's functions, if any (2).                                     *
+     *                                                                        *
+     * Example:                                                               *
+     *   virtual int get_value(float *p_data) //(1)                           *
+     *   {                                                                    *
+     *     return COMPONENT_get_value(float *pf_data);                        *
+     *   }                                                                    *
+     *                                                                        *
+     *   virtual int enable_feature(void) //(2)                               *
+     *   {                                                                    *
+     *     return COMPONENT_enable_feature();                                 *
+     *   }                                                                    *
+     *------------------------------------------------------------------------*/
+    /**
+     * @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((void *) 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 read_id(uint8_t *id)
+    {
+        return (int) 0;
+    }
+
+    /**
+     * @brief  Getting the status.
+     * @param  None.
+     * @retval The status.
+     */
+    virtual unsigned int get_status(void)
+    {
+        return (unsigned int) L6470_GetStatus();
+    }
+
+    /**
+     * @brief  Getting a parameter.
+     * @param  parameter A parameter's register address.
+     * @retval The parameter's value.
+     * @note   The parameter can be one of the following:
+     *           + L6470_ABS_POS_ID
+     *           + L6470_EL_POS_ID
+     *           + L6470_MARK_ID
+     *           + L6470_SPEED_ID
+     *           + L6470_ACC_ID
+     *           + L6470_DEC_ID
+     *           + L6470_MAX_SPEED_ID
+     *           + L6470_MIN_SPEED_ID
+     *           + L6470_FS_SPD_ID
+     *           + L6470_KVAL_HOLD_ID
+     *           + L6470_KVAL_RUN_ID
+     *           + L6470_KVAL_ACC_ID
+     *           + L6470_KVAL_DEC_ID
+     *           + L6470_INT_SPEED_ID
+     *           + L6470_ST_SLP_ID
+     *           + L6470_FN_SLP_ACC_ID
+     *           + L6470_FN_SLP_DEC_ID
+     *           + L6470_K_THERM_ID
+     *           + L6470_ADC_OUT_ID
+     *           + L6470_OCD_TH_ID
+     *           + L6470_STALL_TH_ID
+     *           + L6470_STEP_MODE_ID
+     *           + L6470_ALARM_EN_ID
+     *           + L6470_CONFIG_ID
+     *           + L6470_STATUS_ID
+     */
+    virtual unsigned int get_parameter(unsigned int parameter)
+    {
+        return (unsigned int) L6470_GetParam((eL6470_RegId_t) parameter);
+    }
+
+    /**
+     * @brief  Getting the position.
+     * @param  None.
+     * @retval The position.
+     */
+    virtual signed int get_position(void)
+    {
+        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 get_mark(void)
+    {
+        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 get_speed(void)
+    {
+        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 get_max_speed(void)
+    {
+        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 get_min_speed(void)
+    {
+        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 get_acceleration(void)
+    {
+        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 get_deceleration(void)
+    {
+        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 get_direction(void)
+    {
+        return (direction_t) (L6470_CheckStatusRegisterFlag((eL6470_StatusRegisterFlagId_t) DIR_ID) == 1 ? StepperMotor::FWD : StepperMotor::BWD);
+    }
 
-/** @addtogroup BSP
- * @{
- */
+    /**
+     * @brief   Setting a parameter.
+     * @param   parameter A parameter's register address.
+     * @param   value The parameter's value.
+     * @retval  None.
+     * @note    The parameter can be one of the following:
+     *           + L6470_ABS_POS_ID
+     *           + L6470_EL_POS_ID
+     *           + L6470_MARK_ID
+     *           + L6470_SPEED_ID
+     *           + L6470_ACC_ID
+     *           + L6470_DEC_ID
+     *           + L6470_MAX_SPEED_ID
+     *           + L6470_MIN_SPEED_ID
+     *           + L6470_FS_SPD_ID
+     *           + L6470_KVAL_HOLD_ID
+     *           + L6470_KVAL_RUN_ID
+     *           + L6470_KVAL_ACC_ID
+     *           + L6470_KVAL_DEC_ID
+     *           + L6470_INT_SPEED_ID
+     *           + L6470_ST_SLP_ID
+     *           + L6470_FN_SLP_ACC_ID
+     *           + L6470_FN_SLP_DEC_ID
+     *           + L6470_K_THERM_ID
+     *           + L6470_ADC_OUT_ID
+     *           + L6470_OCD_TH_ID
+     *           + L6470_STALL_TH_ID
+     *           + L6470_STEP_MODE_ID
+     *           + L6470_ALARM_EN_ID
+     *           + L6470_CONFIG_ID
+     *           + L6470_STATUS_ID
+     * @warning Some registers can only be written in particular conditions (see L6470's datasheet).
+     *          Any attempt to write one of those registers when the conditions are not satisfied
+     *          causes the command to be ignored and the NOTPERF_CMD flag to rise at the end of the
+     *          last argument byte. Any attempt to set an inexistent register (wrong address value)
+     *          causes the command to be ignored and the WRONG_CMD flag to rise.
+     *          For example, setting some parameters requires first to disable the power bridge;
+     *          this can be done through the soft_hiz() method.
+     *          They are the following:
+     *           + L6470_ABS_POS_ID
+     *           + L6470_EL_POS_ID
+     *           + L6470_SPEED_ID
+     *           + L6470_ACC_ID
+     *           + L6470_DEC_ID
+     *           + L6470_MAX_SPEED_ID
+     *           + L6470_MIN_SPEED_ID
+     *           + L6470_INT_SPEED_ID
+     *           + L6470_ST_SLP_ID
+     *           + L6470_FN_SLP_ACC_ID
+     *           + L6470_FN_SLP_DEC_ID
+     *           + L6470_ADC_OUT_ID
+     *           + L6470_STEP_MODE_ID
+     *           + L6470_CONFIG_ID
+     *           + L6470_STATUS_ID
+     */
+    virtual void set_parameter(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 set_home(void)
+    {
+        L6470_ResetPos();
+    }
+
+    /**
+     * @brief  Setting the current position to be the marked position.
+     * @param  None.
+     * @retval None.
+     */
+    virtual void set_mark(void)
+    {
+        L6470_SetParam((eL6470_RegId_t) L6470_MARK_ID, (uint32_t) L6470_GetParam((eL6470_RegId_t) L6470_ABS_POS_ID));
+    }
+
+    /**
+     * @brief  Setting the current position to be the marked position.
+     * @param  position The given position.
+     * @retval None.
+     */
+    virtual void set_mark(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 "true" in case of success, "false" otherwise.
+     */
+    virtual bool set_max_speed(unsigned int speed)
+    {
+        L6470_SetParam((eL6470_RegId_t) L6470_MAX_SPEED_ID, (uint32_t) L6470_Step_s_2_MaxSpeed((float) speed));
+        return true;
+    }
+
+    /**
+     * @brief  Setting the minimum speed in pps.
+     * @param  speed The minimum speed in pps.
+     * @retval "true" in case of success, "false" otherwise.
+     */
+    virtual bool set_min_speed(unsigned int speed)
+    {
+        L6470_SetParam((eL6470_RegId_t) L6470_MIN_SPEED_ID, (uint32_t) L6470_Step_s_2_MinSpeed((float) speed));
+        return true;
+    }
+
+    /**
+     * @brief  Setting the acceleration in pps^2.
+     * @param  acceleration The acceleration in pps^2.
+     * @retval "true" in case of success, "false" otherwise.
+     */
+    virtual bool set_acceleration(unsigned int acceleration)
+    {
+        L6470_SetParam((eL6470_RegId_t) L6470_ACC_ID, (uint32_t) L6470_Step_s2_2_Acc((float) acceleration));
+        return true;
+    }
+
+    /**
+     * @brief  Setting the deceleration in pps^2.
+     * @param  deceleration The deceleration in pps^2.
+     * @retval "true" in case of success, "false" otherwise.
+     */
+    virtual bool set_deceleration(unsigned int deceleration)
+    {
+        L6470_SetParam((eL6470_RegId_t) L6470_DEC_ID, (uint32_t) L6470_Step_s2_2_Dec((float) deceleration));
+        return true;
+    }
+
+    /**
+     * @brief   Setting the Step Mode.
+     * @param   step_mode The Step Mode.
+     * @retval "true" in case of success, "false" otherwise.
+     * @warning Setting the step mode implies first disabling the power bridge through
+     *          the soft_hiz() method.
+     * @warning Every time step mode is changed, the values of the home
+     *          and mark positions lose meaning and are reset.
+     */
+    virtual bool set_step_mode(step_mode_t step_mode)
+    {
+        if ((eMotorStepMode_t) step_mode > MICROSTEP_1_128) {
+            return false;
+        }
+        soft_hiz();
+        L6470_SetParam((eL6470_RegId_t) L6470_STEP_MODE_ID, (eMotorStepMode_t) step_mode);
+        return true;
+    }
+
+    /**
+     * @brief  Going to a specified position through the shortest path.
+     * @param  position The desired position.
+     * @retval None.
+     */
+    virtual void go_to(signed int 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 go_to(signed int position, direction_t direction)
+    {
+        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 go_home(void)
+    {
+        L6470_GoHome();
+    }
 
-/** @addtogroup Components
- * @{
- */
+    /**
+     * @brief  Going to the marked position.
+     * @param  None.
+     * @retval None.
+     */
+    virtual void go_mark(void)
+    {
+        L6470_GoMark();
+    }
+
+    /**
+     * @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 go_until(eL6470_ActId_t action, direction_t direction, 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) 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 soft_stop(void)
+    {
+        L6470_SoftStop();
+    }
+
+    /**
+     * @brief  Stopping the motor through an immediate infinite deceleration.
+     * @param  None.
+     * @retval None.
+     */
+    virtual void hard_stop(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 soft_hiz(void)
+    {
+        L6470_soft_hiz();
+    }
+
+    /**
+     * @brief  Disabling the power bridge immediately.
+     * @param  None.
+     * @retval None.
+     */
+    virtual void hard_hiz(void)
+    {
+        L6470_HardHiZ();
+    }
+
+    /**
+     * @brief  Waiting while the motor is active.
+     * @param  None.
+     * @retval None.
+     */
+    virtual void wait_while_active(void)
+    {
+        while (L6470_CheckStatusRegisterFlag(BUSY_ID) == 0);
+    }
+
+    /**
+     * @brief   Switching to step-clock mode.
+     * @param   direction The direction of rotation.
+     * @retval  None.
+     * @warning Setting the step-clock mode implies first disabling the power bridge through
+     *          the soft_hiz() method.
+     */
+    virtual void step_clock(direction_t direction)
+    {
+        soft_hiz();
+        L6470_StepClock((eL6470_DirId_t) (direction == StepperMotor::FWD ? L6470_DIR_FWD_ID : L6470_DIR_REV_ID));
+    }
+
+    /**
+      * @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 release_sw(eL6470_ActId_t action, direction_t direction)
+    {
+        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 reset_device(void)
+    {
+        L6470_ResetDevice();
+    }
+
+    /**
+     * @brief  Preparing the command to get the status.
+     * @param  None.
+     * @retval None.
+     * @note   The command will be sent by issuing "perform_action()".
+     */
+    virtual void prepare_get_status(void)
+    {
+        L6470_PrepareGetStatus();
+        prepared_action = PREPARED_NO_ACTION;
+    }
 
-/** @addtogroup L6470
- * @{
- */
+    /**
+     * @brief  Preparing the command to get a parameter.
+     * @param  parameter A parameter's register address.
+     * @retval None.
+     * @note   The command will be sent by issuing "perform_action()".
+     *         The parameter can be one of the following:
+     *           + L6470_ABS_POS_ID
+     *           + L6470_EL_POS_ID
+     *           + L6470_MARK_ID
+     *           + L6470_SPEED_ID
+     *           + L6470_ACC_ID
+     *           + L6470_DEC_ID
+     *           + L6470_MAX_SPEED_ID
+     *           + L6470_MIN_SPEED_ID
+     *           + L6470_FS_SPD_ID
+     *           + L6470_KVAL_HOLD_ID
+     *           + L6470_KVAL_RUN_ID
+     *           + L6470_KVAL_ACC_ID
+     *           + L6470_KVAL_DEC_ID
+     *           + L6470_INT_SPEED_ID
+     *           + L6470_ST_SLP_ID
+     *           + L6470_FN_SLP_ACC_ID
+     *           + L6470_FN_SLP_DEC_ID
+     *           + L6470_K_THERM_ID
+     *           + L6470_ADC_OUT_ID
+     *           + L6470_OCD_TH_ID
+     *           + L6470_STALL_TH_ID
+     *           + L6470_STEP_MODE_ID
+     *           + L6470_ALARM_EN_ID
+     *           + L6470_CONFIG_ID
+     *           + L6470_STATUS_ID
+     */
+    virtual void prepare_get_parameter(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 "perform_action()".
+     */
+    virtual void prepare_get_position(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 "perform_action()".
+     */
+    virtual void prepare_get_mark(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 "perform_action()".
+     */
+    virtual void prepare_get_speed(void)
+    {
+        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 "perform_action()".
+     */
+    virtual void prepare_get_max_speed(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 "perform_action()".
+     */
+    virtual void prepare_get_min_speed(void)
+    {
+        L6470_PrepareGetParam((eL6470_RegId_t) L6470_MIN_SPEED_ID);
+        prepared_action = PREPARED_GET_MIN_SPEED;
+    }
 
-/** @defgroup L6470_Imported_Functions L6470_Imported_Functions
- * @{
- */
+    /**
+     * @brief  Preparing the command to get the acceleration in pps^2.
+     * @param  None.
+     * @retval None.
+     * @note   The command will be sent by issuing "perform_action()".
+     */
+    virtual void prepare_get_acceleration(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 "perform_action()".
+     */
+    virtual void prepare_get_deceleration(void)
+    {
+        L6470_PrepareGetParam((eL6470_RegId_t) L6470_DEC_ID);
+        prepared_action = PREPARED_GET_DECELERATION;
+    }
+
+    /**
+     * @brief  Preparing the command to get the direction of rotation.
+     * @param  None.
+     * @retval None.
+     * @note   The command will be sent by issuing "perform_action()".
+     */
+    virtual void prepare_get_direction(void)
+    {
+        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 A parameter's register address.
+     * @param  value The parameter's value.
+     * @retval None.
+     * @note   The command will be sent by issuing "perform_action()".
+     *         The parameter can be one of the following:
+     *           + L6470_ABS_POS_ID
+     *           + L6470_EL_POS_ID
+     *           + L6470_MARK_ID
+     *           + L6470_SPEED_ID
+     *           + L6470_ACC_ID
+     *           + L6470_DEC_ID
+     *           + L6470_MAX_SPEED_ID
+     *           + L6470_MIN_SPEED_ID
+     *           + L6470_FS_SPD_ID
+     *           + L6470_KVAL_HOLD_ID
+     *           + L6470_KVAL_RUN_ID
+     *           + L6470_KVAL_ACC_ID
+     *           + L6470_KVAL_DEC_ID
+     *           + L6470_INT_SPEED_ID
+     *           + L6470_ST_SLP_ID
+     *           + L6470_FN_SLP_ACC_ID
+     *           + L6470_FN_SLP_DEC_ID
+     *           + L6470_K_THERM_ID
+     *           + L6470_ADC_OUT_ID
+     *           + L6470_OCD_TH_ID
+     *           + L6470_STALL_TH_ID
+     *           + L6470_STEP_MODE_ID
+     *           + L6470_ALARM_EN_ID
+     *           + L6470_CONFIG_ID
+     *           + L6470_STATUS_ID
+     * @warning Some registers can only be written in particular conditions (see L6470's datasheet).
+     *          Any attempt to write one of those registers when the conditions are not satisfied
+     *          causes the command to be ignored and the NOTPERF_CMD flag to rise at the end of the
+     *          last argument byte. Any attempt to set an inexistent register (wrong address value)
+     *          causes the command to be ignored and the WRONG_CMD flag to rise.
+     *          For example, setting some parameters requires first to disable the power bridge;
+     *          this can be done through the soft_hiz() method.
+     *          They are the following:
+     *           + L6470_ABS_POS_ID
+     *           + L6470_EL_POS_ID
+     *           + L6470_SPEED_ID
+     *           + L6470_ACC_ID
+     *           + L6470_DEC_ID
+     *           + L6470_MAX_SPEED_ID
+     *           + L6470_MIN_SPEED_ID
+     *           + L6470_INT_SPEED_ID
+     *           + L6470_ST_SLP_ID
+     *           + L6470_FN_SLP_ACC_ID
+     *           + L6470_FN_SLP_DEC_ID
+     *           + L6470_ADC_OUT_ID
+     *           + L6470_STEP_MODE_ID
+     *           + L6470_CONFIG_ID
+     *           + L6470_STATUS_ID
+     */
+    virtual void prepare_set_parameter(unsigned int parameter, unsigned int value)
+    {
+        L6470_PrepareSetParam((eL6470_RegId_t) parameter, (uint32_t) value);
+        prepared_action = PREPARED_NO_ACTION;
+    }
 
-/* ACTION --------------------------------------------------------------------*
- * Declare here extern platform-dependent APIs you might need (e.g.: I/O and  *
- * interrupt related functions), and implement them in a glue-logic file on   *
- * the target environment, for example within the "x_nucleo_board.c" file.    *
- * E.g.:                                                                      *
- *   extern Status_t COMPONENT_IO_Init (void *handle);                        *
- *   extern Status_t COMPONENT_IO_Read (handle, buf, regadd, bytes);          *
- *   extern Status_t COMPONENT_IO_Write(handle, buf, regadd, bytes);          *
- *   extern void     COMPONENT_IO_ITConfig(void);                             *
- *----------------------------------------------------------------------------*/
-extern void L6470_DISABLE(void);
-extern void L6470_ENABLE(void);
-extern void L6470_nCS_LOW(void);
-extern void L6470_nCS_HIGH(void);
-extern void L6470_SPI_Communication(uint8_t *pTxData, uint8_t *pRxData, uint16_t Size, uint32_t Timeout);
+    /**
+     * @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 "perform_action()".
+     */
+    virtual void prepare_set_home(void)
+    {
+        L6470_PrepareResetPos();
+        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 "perform_action()".
+     */
+    virtual void prepare_set_mark(void)
+    {
+        /*
+           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 "perform_action()".
+     */
+    virtual void prepare_set_mark(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 "perform_action()".
+     */
+    virtual void prepare_set_speed(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 "perform_action()".
+     */
+    virtual void prepare_set_max_speed(unsigned int 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 "perform_action()".
+     */
+    virtual void prepare_set_min_speed(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 "perform_action()".
+     */
+    virtual void prepare_set_acceleration(unsigned int acceleration)
+    {
+        L6470_PrepareSetParam((eL6470_RegId_t) L6470_ACC_ID, (uint32_t) L6470_Step_s2_2_Acc((float) acceleration));
+        prepared_action = PREPARED_NO_ACTION;
+    }
+
+    /**
+     * @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 "perform_action()".
+     */
+    virtual void prepare_set_deceleration(unsigned int deceleration)
+    {
+        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 "perform_action()".
+     */
+    virtual void prepare_go_to(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 "perform_action()".
+     */
+    virtual void prepare_go_to(signed int position, direction_t direction)
+    {
+        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 "perform_action()".
+     */
+    virtual void prepare_go_home(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 "perform_action()".
+     */
+    virtual void prepare_go_mark(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 "perform_action()".
+     *         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 prepare_go_until(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) 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 "perform_action()".
+     */
+    virtual void prepare_run(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 "perform_action()".
+     */
+    virtual void prepare_run(direction_t direction, 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 "perform_action()".
+     */
+    virtual void prepare_move(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 "perform_action()".
+     */
+    virtual void prepare_soft_stop(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 "perform_action()".
+     */
+    virtual void prepare_hard_stop(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 "perform_action()".
+     */
+    virtual void prepare_soft_hiz(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 "perform_action()".
+     */
+    virtual void prepare_hard_hiz(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.
+     * @warning Setting the step-clock mode requires an explicit action by the user to first
+     *          disable the power bridge through the soft_hiz() method.
+     * @note    The command will be sent by issuing "perform_action()".
+     */
+    virtual void prepare_step_clock(direction_t direction)
+    {
+        L6470_PrepareStepClock((eL6470_DirId_t) (direction == StepperMotor::FWD ? L6470_DIR_FWD_ID : L6470_DIR_REV_ID));
+        prepared_action = PREPARED_NO_ACTION;
+    }
+
+    /**
+      * @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 "perform_action()".
+      *         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 prepare_release_sw(eL6470_ActId_t action, direction_t direction)
+    {
+        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 "perform_action()".
+      */
+    virtual void prepare_reset_device(void)
+    {
+        L6470_PrepareResetDevice();
+        prepared_action = PREPARED_NO_ACTION;
+    }
+
+    /**
+      * @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* perform_prepared_actions(void)
+    {
+        return L6470_PerformPreparedApplicationCommand();
+    }
+
+    /**
+      * @brief    Getting the prepared action.
+      * @param    None
+      * @retval   The prepared action.
+      */
+    prepared_action_t get_prepared_action(void)
+    {
+        return prepared_action;
+    }
+
+    /**
+      * @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 get_result(uint8_t *raw_data)
+    {
+        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));
+
+            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);
 
-#ifdef __cplusplus
-}
-#endif
+            default:
+            case PREPARED_NO_ACTION:
+                return 0;
+        }
+    }
+
+
+    /*** Public Interrupt Related Methods ***/
+
+    /* ACTION 6 --------------------------------------------------------------*
+     * Implement here interrupt related methods, if any.                      *
+     * Note that interrupt handling is platform dependent, e.g.:              *
+     *   + mbed:                                                              *
+     *     InterruptIn feature_irq(pin); //Interrupt object.                  *
+     *     feature_irq.rise(callback);   //Attach a callback.                 *
+     *     feature_irq.mode(PullNone);   //Set interrupt mode.                *
+     *     feature_irq.enable_irq();     //Enable interrupt.                  *
+     *     feature_irq.disable_irq();    //Disable interrupt.                 *
+     *   + Arduino:                                                           *
+     *     attachInterrupt(pin, callback, RISING); //Attach a callback.       *
+     *     detachInterrupt(pin);                   //Detach a callback.       *
+     *                                                                        *
+     * Example (mbed):                                                        *
+     *   void attach_feature_irq(void (*fptr) (void))                         *
+     *   {                                                                    *
+     *     feature_irq.rise(fptr);                                            *
+     *   }                                                                    *
+     *                                                                        *
+     *   void enable_feature_irq(void)                                        *
+     *   {                                                                    *
+     *     feature_irq.enable_irq();                                          *
+     *   }                                                                    *
+     *                                                                        *
+     *   void disable_feature_irq(void)                                       *
+     *   {                                                                    *
+     *     feature_irq.disable_irq();                                         *
+     *   }                                                                    *
+     *------------------------------------------------------------------------*/
+    /**
+     * @brief  Attaching an interrupt handler to the FLAG interrupt.
+     * @param  fptr An interrupt handler.
+     * @retval None.
+     */
+    void attach_flag_irq(void (*fptr)(void))
+    {
+        flag_irq.fall(fptr);
+    }
+    
+    /**
+     * @brief  Enabling the FLAG interrupt handling.
+     * @param  None.
+     * @retval None.
+     */
+    void enable_flag_irq(void)
+    {
+        flag_irq.enable_irq();
+    }
+    
+    /**
+     * @brief  Disabling the FLAG interrupt handling.
+     * @param  None.
+     * @retval None.
+     */
+    void disable_flag_irq(void)
+    {
+        flag_irq.disable_irq();
+    }
+
+    /**
+     * @brief  Attaching an interrupt handler to the BUSY interrupt.
+     * @param  fptr An interrupt handler.
+     * @retval None.
+     */
+    void attach_busy_irq(void (*fptr)(void))
+    {
+        busy_irq.fall(fptr);
+    }
+    
+    /**
+     * @brief  Enabling the BUSY interrupt handling.
+     * @param  None.
+     * @retval None.
+     */
+    void enable_busy_irq(void)
+    {
+        busy_irq.enable_irq();
+    }
+
+    /**
+     * @brief  Disabling the BUSY interrupt handling.
+     * @param  None.
+     * @retval None.
+     */
+    void disable_busy_irq(void)
+    {
+        busy_irq.disable_irq();
+    }
+
+
+protected:
+
+    /*** Protected Component Related Methods ***/
 
-#endif /* __L6470_H */
+    /* ACTION 7 --------------------------------------------------------------*
+     * Declare here the component's specific methods.                         *
+     * They should be:                                                        *
+     *   + Methods with the same name of the C component's virtual table's    *
+     *     functions (1);                                                     *
+     *   + Methods with the same name of the C component's extended virtual   *
+     *     table's functions, if any (2);                                     *
+     *   + Helper methods, if any, like functions declared in the component's *
+     *     source files but not pointed by the component's virtual table (3). *
+     *                                                                        *
+     * Example:                                                               *
+     *   status_t COMPONENT_get_value(float *f);   //(1)                      *
+     *   status_t COMPONENT_enable_feature(void);  //(2)                      *
+     *   status_t COMPONENT_compute_average(void); //(3)                      *
+     *------------------------------------------------------------------------*/
+    int32_t  L6470_AbsPos_2_Position(uint32_t AbsPos);
+    uint32_t L6470_Position_2_AbsPos(int32_t Position);
+    float    L6470_Speed_2_Step_s(uint32_t Speed);
+    uint32_t L6470_Step_s_2_Speed(float Step_s);
+    float    L6470_Acc_2_Step_s2(uint16_t Acc);
+    uint16_t L6470_Step_s2_2_Acc(float Step_s2);
+    float    L6470_Dec_2_Step_s2(uint16_t Dec);
+    uint16_t L6470_Step_s2_2_Dec(float Step_s2);
+    float    L6470_MaxSpeed_2_Step_s(uint16_t MaxSpeed);
+    uint16_t L6470_Step_s_2_MaxSpeed(float Step_s);
+    float    L6470_MinSpeed_2_Step_s(uint16_t MinSpeed);
+    uint16_t L6470_Step_s_2_MinSpeed(float Step_s);
+    float    L6470_FsSpd_2_Step_s(uint16_t FsSpd);
+    uint16_t L6470_Step_s_2_FsSpd(float Step_s);
+    float    L6470_IntSpeed_2_Step_s(uint16_t IntSpeed);
+    uint16_t L6470_Step_s_2_IntSpeed(float Step_s);
+    float    L6470_StSlp_2_s_Step(uint8_t StSlp);
+    uint8_t  L6470_s_Step_2_StSlp(float s_Step);
+    float    L6470_FnSlpAcc_2_s_Step(uint8_t FnSlpAcc);
+    uint8_t  L6470_s_Step_2_FnSlpAcc(float s_Step);
+    float    L6470_FnSlpDec_2_s_Step(uint8_t FnSlpDec);
+    uint8_t  L6470_s_Step_2_FnSlpDec(float s_Step);
+    float    L6470_OcdTh_2_mA(uint8_t OcdTh);
+    uint8_t  L6470_mA_2_OcdTh(float mA);
+    float    L6470_StallTh_2_mA(uint8_t StallTh);
+    uint8_t  L6470_mA_2_StallTh(float mA);
+    status_t L6470_Config(void *init);
+    void     L6470_SetParam(eL6470_RegId_t L6470_RegId, uint32_t Value);
+    uint32_t L6470_GetParam(eL6470_RegId_t L6470_RegId);
+    void     L6470_Run(eL6470_DirId_t L6470_DirId, uint32_t Speed);
+    void     L6470_StepClock(eL6470_DirId_t L6470_DirId);
+    void     L6470_Move(eL6470_DirId_t L6470_DirId, uint32_t N_Step);
+    void     L6470_GoTo(uint32_t AbsPos);
+    void     L6470_GoToDir(eL6470_DirId_t L6470_DirId, uint32_t AbsPos);
+    void     L6470_GoUntil(eL6470_ActId_t L6470_ActId, eL6470_DirId_t L6470_DirId, uint32_t Speed);
+    void     L6470_ReleaseSW(eL6470_ActId_t L6470_ActId, eL6470_DirId_t L6470_DirId);
+    void     L6470_GoHome(void);
+    void     L6470_GoMark(void);
+    void     L6470_ResetPos(void);
+    void     L6470_ResetDevice(void);
+    void     L6470_SoftStop(void);
+    void     L6470_HardStop(void);
+    void     L6470_soft_hiz(void);
+    void     L6470_HardHiZ(void);
+    uint16_t L6470_GetStatus(void);
+    void     L6470_PrepareSetParam(eL6470_RegId_t L6470_RegId, uint32_t Value);
+    void     L6470_PrepareGetParam(eL6470_RegId_t L6470_RegId);
+    void     L6470_PrepareRun(eL6470_DirId_t L6470_DirId, uint32_t Speed);
+    void     L6470_PrepareStepClock(eL6470_DirId_t L6470_DirId);
+    void     L6470_PrepareMove(eL6470_DirId_t L6470_DirId, uint32_t N_Step);
+    void     L6470_PrepareGoTo(uint32_t AbsPos);
+    void     L6470_PrepareGoToDir(eL6470_DirId_t L6470_DirId, uint32_t AbsPos);
+    void     L6470_PrepareGoUntil(eL6470_ActId_t L6470_ActId, eL6470_DirId_t L6470_DirId, uint32_t Speed);
+    void     L6470_PrepareReleaseSW(eL6470_ActId_t L6470_ActId, eL6470_DirId_t L6470_DirId);
+    void     L6470_PrepareGoHome(void);
+    void     L6470_PrepareGoMark(void);
+    void     L6470_PrepareResetPos(void);
+    void     L6470_PrepareResetDevice(void);
+    void     L6470_PrepareSoftStop(void);
+    void     L6470_PrepareHardStop(void);
+    void     L6470_Preparesoft_hiz(void);
+    void     L6470_PrepareHardHiZ(void);
+    void     L6470_PrepareGetStatus(void);
+    uint8_t* L6470_PerformPreparedApplicationCommand(void);
+    void     L6470_DaisyChainCommand(uint8_t* pL6470_DaisyChainSpiTxStruct, uint8_t* pL6470_DaisyChainSpiRxStruct);
+    uint32_t L6470_ExtractReturnedData(uint8_t* pL6470_DaisyChainSpiRxStruct, uint8_t LengthByte);
+    uint8_t  L6470_CheckStatusRegisterFlag(uint8_t L6470_StatusRegisterFlagId);
+    uint8_t* L6470_GetRegisterName(uint8_t id);
+    void     L6470_ResetAppCmdPkg(sL6470_AppCmdPkg_t* pL6470_AppCmdPkg);
+    void     L6470_FillAppCmdPkg(sL6470_AppCmdPkg_t* pL6470_AppCmdPkg, eL6470_AppCmdId_t L6470_AppCmdId, uint32_t p1, uint32_t p2, uint32_t p3);
+    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 ***/
+
+    /**
+     * @brief      Utility function to read data from L6470.
+     * @param[out] pBuffer pointer to the buffer to read data into.
+     * @param[in]  NumBytesToRead number of bytes to read.
+     * @retval     COMPONENT_OK in case of success, COMPONENT_ERROR otherwise.
+     */
+    status_t Read(uint8_t* pBuffer, uint16_t NumBytesToRead)
+    {
+        if (dev_spi.spi_read(pBuffer, ssel, NumBytesToRead) != 0) {
+            return COMPONENT_ERROR;
+        }
+        return COMPONENT_OK;
+    }
+    
+    /**
+     * @brief      Utility function to write data to L6470.
+     * @param[in]  pBuffer pointer to the buffer of data to send.
+     * @param[in]  NumBytesToWrite number of bytes to write.
+     * @retval     COMPONENT_OK in case of success, COMPONENT_ERROR otherwise.
+     */
+    status_t Write(uint8_t* pBuffer, uint16_t NumBytesToWrite)
+    {
+        if (dev_spi.spi_write(pBuffer, ssel, NumBytesToWrite) != 0) {
+            return COMPONENT_ERROR;
+        }
+        return COMPONENT_OK;
+    }
+
+    /**
+     * @brief      Utility function to read and write data from/to L6470 at the same time.
+     * @param[out] pBufferToRead pointer to the buffer to read data into.
+     * @param[in]  pBufferToWrite pointer to the buffer of data to send.
+     * @param[in]  NumBytes number of bytes to read and write.
+     * @retval     COMPONENT_OK in case of success, COMPONENT_ERROR otherwise.
+     */
+    status_t ReadWrite(uint8_t* pBufferToRead, uint8_t* pBufferToWrite, uint16_t NumBytes)
+    {
+        if (dev_spi.spi_read_write(pBufferToRead, pBufferToWrite, ssel, NumBytes) != 0) {
+            return COMPONENT_ERROR;
+        }
+        return COMPONENT_OK;
+    }
+
+    /* ACTION 8 --------------------------------------------------------------*
+     * Implement here other I/O methods beyond those already implemented      *
+     * above, which are declared extern within the component's header file.   *
+     *------------------------------------------------------------------------*/
+    /*
+     * Puts the device in standby mode.
+     */
+    void L6470_ENABLE(void)
+    {
+        standby_reset = 1;
+    }
+
+    /*
+     * Puts the device in reset mode.
+     */
+    void L6470_DISABLE(void)
+    {
+        standby_reset = 0;
+    }
+
+    /*
+     * Write and read bytes to/from the component through the SPI at the same time.
+     */
+    void L6470_SPI_Communication(uint8_t *pTxData, uint8_t *pRxData, uint16_t Size, uint32_t Timeout)
+    {
+        ReadWrite(pRxData, pTxData, Size);
+    }
+
+
+    /*** Component's Instance Variables ***/
+
+    /* ACTION 9 --------------------------------------------------------------*
+     * Declare here interrupt related variables, if needed.                   *
+     * Note that interrupt handling is platform dependent, see                *
+     * "Interrupt Related Methods" above.                                     *
+     *                                                                        *
+     * Example:                                                               *
+     *   + mbed:                                                              *
+     *     InterruptIn feature_irq;                                           *
+     *------------------------------------------------------------------------*/
+    /* 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;
+
+    /* 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:                                                               *
+     *   float measure;                                                       *
+     *   int instance_id;                                                     *
+     *   static int number_of_instances;                                      *
+     *------------------------------------------------------------------------*/
+    /* Data. */
+    uint8_t L6470_Id;
+    const sL6470_Register_t *L6470_Register;
+    const sL6470_ApplicationCommand_t *L6470_ApplicationCommand;
+    const sL6470_Direction_t *L6470_Direction;
+    const sL6470_ACT_t *L6470_ACT;
+    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;
+    static const sL6470_Register_t _L6470_Register[L6470REGIDSIZE];
+    static const sL6470_ApplicationCommand_t _L6470_ApplicationCommand[L6470APPCMDIDSIZE];
+    static const sL6470_Direction_t _L6470_Direction[L6470DIRIDSIZE];
+    static const sL6470_ACT_t _L6470_ACT[L6470ACTIDSIZE];
+    static eFlagStatus_t L6470_DaisyChain_HalfPrepared;
+    static sL6470_AppCmdPkg_t L6470_AppCmdPkg[L6470DAISYCHAINSIZE];
+    static uint8_t L6470_DaisyChainSpiTxStruct[L6470MAXSPICMDBYTESIZE][L6470DAISYCHAINSIZE];
+    static uint8_t L6470_DaisyChainSpiRxStruct[L6470MAXSPICMDBYTESIZE][L6470DAISYCHAINSIZE];
+};
+
+#endif /* __L6470_CLASS_H */
 
 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
--- a/Components/l6470/l6470_class.cpp	Wed Mar 01 17:52:33 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1460 +0,0 @@
-/**
- ******************************************************************************
- * @file       l6470_class.cpp
- * @date       01/10/2014 12:00:00
- * @brief      This file provides set of firmware functions to manage the
- *             L6470.
- ******************************************************************************
- *
- * COPYRIGHT(c) 2014 STMicroelectronics
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *   1. Redistributions of source code must retain the above copyright notice,
- *      this list of conditions and the following disclaimer.
- *   2. Redistributions in binary form must reproduce the above copyright notice,
- *      this list of conditions and the following disclaimer in the documentation
- *      and/or other materials provided with the distribution.
- *   3. Neither the name of STMicroelectronics nor the names of its contributors
- *      may be used to endorse or promote products derived from this software
- *      without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- ******************************************************************************
- */
-
-
-/* Generated with STM32CubeTOO -----------------------------------------------*/
-
-
-/* Revision ------------------------------------------------------------------*/
-/*
-    Repository:       http://svn.x-nucleodev.codex.cro.st.com/svnroot/X-NucleoDev
-    Branch/Trunk/Tag: trunk
-    Based on:         X-CUBE-SPN2/trunk/Drivers/BSP/Components/L6470/L6470.c
-    Revision:         0
-*/
-
-
-/* Includes ------------------------------------------------------------------*/
-
-#include "l6470_class.h"
-
-
-/* Variables -----------------------------------------------------------------*/
-
-/* Number of instantiated devices on an expansion board. */
-uint8_t L6470::number_of_devices = 0;
-
-/* SPI Transmission for Daisy-Chain Configuration. */
-eFlagStatus_t L6470::L6470_DaisyChain_HalfPrepared;
-sL6470_AppCmdPkg_t L6470::L6470_AppCmdPkg[L6470DAISYCHAINSIZE];
-uint8_t L6470::L6470_DaisyChainSpiTxStruct[L6470MAXSPICMDBYTESIZE][L6470DAISYCHAINSIZE];
-uint8_t L6470::L6470_DaisyChainSpiRxStruct[L6470MAXSPICMDBYTESIZE][L6470DAISYCHAINSIZE];
-
-/**
-  * @brief Array whose elements are a structure in which store information about
-  *        the L6470 Registers (the address, the names, the length in bits, the
-  *        reset value)
-  */
-const sL6470_Register_t L6470::_L6470_Register[L6470REGIDSIZE] = {
-  {0x01 , "ABS_POS",   22, 3, 0x000000},  //!< Current position
-  {0x02 , "EL_POS",     9, 2, 0x000},     //!< Electrical position
-  {0x03 , "MARK",      22, 3, 0x000000},  //!< Mark position
-  {0x04 , "SPEED",     20, 3, 0x0000},    //!< Current speed
-  {0x05 , "ACC",       12, 2, 0x08A},     //!< Acceleration
-  {0x06 , "DEC",       12, 2, 0x08A},     //!< Deceleration
-  {0x07 , "MAX_SPEED", 10, 2, 0x041},     //!< Maximum speed
-  {0x08 , "MIN_SPEED", 13, 2, 0x000},     //!< Minimum speed
-  {0x15 , "FS_SPD",    10, 2, 0x027},     //!< Full-step speed
-  {0x09 , "KVAL_HOLD",  8, 1, 0x29},      //!< Holding KVAL
-  {0x0A , "KVAL_RUN",   8, 1, 0x29},      //!< Constant speed KVAL
-  {0x0B , "KVAL_ACC",   8, 1, 0x29},      //!< Acceleration starting KVAL
-  {0x0C , "KVAL_DEC",   8, 1, 0x29},      //!< Deceleration starting KVAL
-  {0x0D , "INT_SPEED", 14, 2, 0x0408},    //!< Intersect speed
-  {0x0E , "ST_SLP",     8, 1, 0x19},      //!< Start slope
-  {0x0F , "FN_SLP_ACC", 8, 1, 0x29},      //!< Acceleration final slope
-  {0x10 , "FN_SLP_DEC", 8, 1, 0x29},      //!< Deceleration final slope
-  {0x11 , "K_THERM",    4, 1, 0x0},       //!< Thermal compensation factor
-  {0x12 , "ADC_OUT",    5, 1, 0x00},      //!< ADC output, (the reset value is according to startup conditions)
-  {0x13 , "OCD_TH",     4, 1, 0x8},       //!< OCD threshold
-  {0x14 , "STALL_TH",   7, 1, 0x40},      //!< STALL threshold
-  {0x16 , "STEP_MODE",  8, 1, 0x7},       //!< Step mode
-  {0x17 , "ALARM_EN",   8, 1, 0xFF},      //!< Alarm enable
-  {0x18 , "CONFIG",    16, 2, 0x2E88},    //!< IC configuration
-  {0x19 , "STATUS",    16, 2, 0x0000}     //!< Status, (the reset value is according to startup conditions)
-};
-
-/**
-  * @brief Array whose elements are a structure in which store information about
-  *        the L6470 Application Commands (the mnemonic name, the number of
-  *        needed parameters, the related funtion to call)
-  */
-const sL6470_ApplicationCommand_t L6470::_L6470_ApplicationCommand[L6470APPCMDIDSIZE] =  {
-  {"NOP",         0x00, 0},
-  {"SETPARAM",    0x00, 2},
-  {"GETPARAM",    0x20, 1},
-  {"RUN",         0x50, 2},
-  {"STEPCLOCK",   0x58, 1},
-  {"MOVE",        0x40, 2},
-  {"GOTO",        0x60, 1},
-  {"GOTO_DIR",    0x68, 2},
-  {"GOUNTIL",     0x82, 3},
-  {"RELEASESW",   0x92, 2},
-  {"GOHOME",      0x70, 0},
-  {"GOMARK",      0x78, 0},
-  {"RESETPOS",    0xD8, 0},
-  {"RESETDEVICE", 0xC0, 0},
-  {"SOFTSTOP",    0xB0, 0},
-  {"HARDSTOP",    0xB8, 0},
-  {"SOFTHIZ",     0xA0, 0},
-  {"HARDHIZ",     0xA8, 0},
-  {"GETSTATUS",   0xD0, 0}
-};
-
-/**
-  * @brief The mnemonic names for the L6470 direction
-  */
-const sL6470_Direction_t L6470::_L6470_Direction[L6470DIRIDSIZE] = {
-  {"REV", 0x00},  //!< Reverse direction
-  {"FWD", 0x01}   //!< Forward direction
-};
-
-/**
-  * @brief Action taken about ABS_POS register
-  */
-const sL6470_ACT_t L6470::_L6470_ACT[L6470ACTIDSIZE] = {
-  {"RST", 0x00},  //!< ABS_POS register is reset
-  {"CPY", 0x01}   //!< ABS_POS register value is copied into the MARK register
-};
-
-/* End of L6470_Private_Constants */
-
-/**
-  * @defgroup   L6470_Private_Variables
-  * @brief      L6470 Private Variables.
-  * @{
-  */
-
-/* End of L6470_Private_Variables */
-
-
-/**
-  * @addtogroup L6470_Private_Functions
-  * @{
-  */
-
-
-/* Methods -------------------------------------------------------------------*/
-
-/**
-  * @brief  Reset the structure used to store the identifier of the L6470
-  *         application command and its the needed parameters.
-  * @param  pL6470_AppCmdPkg   The structure to be reset.
-  */
-void L6470::L6470_ResetAppCmdPkg(sL6470_AppCmdPkg_t* pL6470_AppCmdPkg)
-{
-  uint8_t id;
-  
-  for(id=0; id<L6470DAISYCHAINSIZE; id++)
-  {
-    (pL6470_AppCmdPkg+id)->L6470_AppCmdId=(eL6470_AppCmdId_t)0;
-    (pL6470_AppCmdPkg+id)->p1=0;
-    (pL6470_AppCmdPkg+id)->p2=0;
-    (pL6470_AppCmdPkg+id)->p3=0;
-  }
-}
-
-/**
-  * @brief  Fill the structure used to store the identifier of the L6470
-  *         application command and its the needed parameters.
-  * @param  L6470_Id          The identifier of the L6470 target inside the daisy chain.
-  * @param  pL6470_AppCmdPkg  The structure to be filled.
-  * @param  L6470_AppCmdId    The identifier of the L6470 application command to be sent.
-  * @param  p1                The 1st parameter (if it is not needed it will be not considered).
-  * @param  p2                The 2nd parameter (if it is not needed it will be not considered).
-  * @param  p3                The 3rd parameter (if it is not needed it will be not considered).
-  */
-void L6470::L6470_FillAppCmdPkg(sL6470_AppCmdPkg_t* pL6470_AppCmdPkg, eL6470_AppCmdId_t L6470_AppCmdId, uint32_t p1, uint32_t p2, uint32_t p3)
-{
-  (pL6470_AppCmdPkg+L6470_Id)->L6470_AppCmdId = L6470_AppCmdId;
-  (pL6470_AppCmdPkg+L6470_Id)->p1 = p1;
-  (pL6470_AppCmdPkg+L6470_Id)->p2 = p2;
-  (pL6470_AppCmdPkg+L6470_Id)->p3 = p3;
-}
-
-/**
-  * @brief  This function will fill the column of the L6470_AppCmdPkg related
-  *         the L6470 to be addressed inside the daisy chain.
-  *
-  * @param  L6470_Id          The identifier of the L6470 target inside the daisy chain.
-  * @param  pL6470_AppCmdPkg  Pointer to the sL6470_AppCmdPkg_t to be filled.
-  * @param  L6470_AppCmdId    The identifier of the L6470 application command to be sent.
-  * @param  p1                The 1st parameter (if it is not needed it will be not considered).
-  * @param  p2                The 2nd parameter (if it is not needed it will be not considered).
-  * @param  p3                The 3rd parameter (if it is not needed it will be not considered).
-  */
-void L6470::L6470_PrepareAppCmdPkg(sL6470_AppCmdPkg_t* pL6470_AppCmdPkg, eL6470_AppCmdId_t L6470_AppCmdId, uint32_t p1, uint32_t p2, uint32_t p3)
-{
-  if(!L6470_DaisyChain_HalfPrepared)
-  {
-    L6470_DaisyChain_HalfPrepared = ONE_F; /* To avoid to delete the previous entered command */
-    L6470_ResetAppCmdPkg(pL6470_AppCmdPkg);
-  }
-  
-  L6470_FillAppCmdPkg(pL6470_AppCmdPkg, L6470_AppCmdId, p1, p2, p3);
-}
-
-/**
-  * @brief  This function will translate the data inside the L6470_AppCmdPkg into
-  *         the right data to be sent via SPI to the L6470 daisy chain.
-  *
-  * @param  pL6470_AppCmdPkg              Pointer to the sL6470_AppCmdPkg_t to be filled.
-  * @param  pL6470_DaisyChainSpiTxStruct  Pointer to the structure used by SPI to send the commands.
-  */
-void L6470::L6470_PrepareDaisyChainCommand(sL6470_AppCmdPkg_t* pL6470_AppCmdPkg, uint8_t* pL6470_DaisyChainSpiTxStruct)
-{
-  uint8_t PkgId;
-  uint8_t PARAMLengthBytes; /* The number of bytes related to the numeric value for the addressed register */
-  uint8_t spibyte;
-  
-  /* Reset the structure used to send the command to the L6470 Daisy Chain through the SPI */
-  uint8_t i = 0;
-  for(spibyte=0;spibyte<L6470MAXSPICMDBYTESIZE;spibyte++)
-    for(PkgId=0; PkgId<L6470DAISYCHAINSIZE; PkgId++)
-      *(pL6470_DaisyChainSpiTxStruct+(i++)) = 0x00;
-
-  for(PkgId=0; PkgId<L6470DAISYCHAINSIZE; PkgId++)
-  {
-    /* Build the 1st bytes to transmit with the binary code of the command */
-    *(pL6470_DaisyChainSpiTxStruct+((0*L6470DAISYCHAINSIZE)+PkgId)) = (L6470_ApplicationCommand[(pL6470_AppCmdPkg+PkgId)->L6470_AppCmdId].BinaryCode);
-    
-    /* Perform the related L6470_AppCmdId */
-    switch((pL6470_AppCmdPkg+PkgId)->L6470_AppCmdId)
-    {
-    case L6470_NOP_ID:
-      break;
-    case L6470_SETPARAM_ID:
-      /* Build the 1st bytes to transmit (PARAM) */
-      *(pL6470_DaisyChainSpiTxStruct+((0*L6470DAISYCHAINSIZE)+PkgId)) |= (L6470_Register[((pL6470_AppCmdPkg+PkgId)->p1)].Address);
-      
-      /* The length, in byte, of this register (PARAM) is... */
-      PARAMLengthBytes = L6470_Register[((pL6470_AppCmdPkg+PkgId)->p1)].LengthByte;
-      
-      /* Build the others bytes to transmit (VALUE) */
-      for (spibyte=1; spibyte<(PARAMLengthBytes+1); spibyte++)
-      {
-        *(pL6470_DaisyChainSpiTxStruct+((spibyte*L6470DAISYCHAINSIZE)+PkgId)) = (uint8_t)(((pL6470_AppCmdPkg+PkgId)->p2) >> (8*(PARAMLengthBytes-spibyte)));
-      }
-      break;
-    case L6470_GETPARAM_ID:
-      /* Build the 1st bytes to transmit (PARAM) */
-      *(pL6470_DaisyChainSpiTxStruct+((0*L6470DAISYCHAINSIZE)+PkgId)) |= (L6470_Register[((pL6470_AppCmdPkg+PkgId)->p1)].Address);
-      break;
-    case L6470_RUN_ID:
-      /* Build the 1st bytes to transmit (DIR) */
-      *(pL6470_DaisyChainSpiTxStruct+((0*L6470DAISYCHAINSIZE)+PkgId)) |= (L6470_Direction[((pL6470_AppCmdPkg+PkgId)->p1)].BinaryCode);
-      
-      /* Build the others bytes to transmit (SPD) */
-      for (spibyte=1; spibyte<(3+1); spibyte++)
-      {
-        *(pL6470_DaisyChainSpiTxStruct+((spibyte*L6470DAISYCHAINSIZE)+PkgId)) = (uint8_t)(((pL6470_AppCmdPkg+PkgId)->p2) >> (8*(3-spibyte)));
-      }
-      break;
-    case L6470_STEPCLOCK_ID:
-      /* Build the 1st bytes to transmit (DIR) */
-      *(pL6470_DaisyChainSpiTxStruct+((0*L6470DAISYCHAINSIZE)+PkgId)) |= (L6470_Direction[((pL6470_AppCmdPkg+PkgId)->p1)].BinaryCode);
-      break;
-    case L6470_MOVE_ID:
-      /* Build the 1st bytes to transmit (DIR) */
-      *(pL6470_DaisyChainSpiTxStruct+((0*L6470DAISYCHAINSIZE)+PkgId)) |= (L6470_Direction[((pL6470_AppCmdPkg+PkgId)->p1)].BinaryCode);
-      
-      /* Build the others bytes to transmit (N_STEP) */
-      for (spibyte=1; spibyte<(3+1); spibyte++)
-      {
-        *(pL6470_DaisyChainSpiTxStruct+((spibyte*L6470DAISYCHAINSIZE)+PkgId)) = (uint8_t)(((pL6470_AppCmdPkg+PkgId)->p2) >> (8*(3-spibyte)));
-      }      
-      break;
-    case L6470_GOTO_ID:
-      /* Build the others bytes to transmit (ABS_POS) */
-      for (spibyte=1; spibyte<(3+1); spibyte++)
-      {
-        *(pL6470_DaisyChainSpiTxStruct+((spibyte*L6470DAISYCHAINSIZE)+PkgId)) = (uint8_t)(((pL6470_AppCmdPkg+PkgId)->p1) >> (8*(3-spibyte)));
-      }
-      break;
-    case L6470_GOTODIR_ID:
-      /* Build the 1st bytes to transmit (DIR) */
-      *(pL6470_DaisyChainSpiTxStruct+((0*L6470DAISYCHAINSIZE)+PkgId)) |= (L6470_Direction[((pL6470_AppCmdPkg+PkgId)->p1)].BinaryCode);
-      
-      /* Build the others bytes to transmit (ABS_POS) */
-      for (spibyte=1; spibyte<(3+1); spibyte++)
-      {
-        *(pL6470_DaisyChainSpiTxStruct+((spibyte*L6470DAISYCHAINSIZE)+PkgId)) = (uint8_t)(((pL6470_AppCmdPkg+PkgId)->p2) >> (8*(3-spibyte)));
-      }
-      break;
-    case L6470_GOUNTIL_ID:
-      /* Build the 1st bytes to transmit (ACT) */
-      *(pL6470_DaisyChainSpiTxStruct+((0*L6470DAISYCHAINSIZE)+PkgId)) |= ((L6470_ACT[((pL6470_AppCmdPkg+PkgId)->p1)].BinaryCode)<<3);
-      /* Build the 1st bytes to transmit (DIR) */
-      *(pL6470_DaisyChainSpiTxStruct+((0*L6470DAISYCHAINSIZE)+PkgId)) |= (L6470_Direction[((pL6470_AppCmdPkg+PkgId)->p2)].BinaryCode);
-      
-      /* Build the others bytes to transmit (SPD) */
-      for (spibyte=1; spibyte<(3+1); spibyte++)
-      {
-        *(pL6470_DaisyChainSpiTxStruct+((spibyte*L6470DAISYCHAINSIZE)+PkgId)) = (uint8_t)(((pL6470_AppCmdPkg+PkgId)->p3) >> (8*(3-spibyte)));
-      }
-      break;
-    case L6470_RELEASESW_ID:
-      /* Build the 1st bytes to transmit (ACT) */
-      *(pL6470_DaisyChainSpiTxStruct+((0*L6470DAISYCHAINSIZE)+PkgId)) |= ((L6470_ACT[((pL6470_AppCmdPkg+PkgId)->p1)].BinaryCode)<<3);
-      /* Build the 1st bytes to transmit (DIR) */
-      *(pL6470_DaisyChainSpiTxStruct+((0*L6470DAISYCHAINSIZE)+PkgId)) |= (L6470_Direction[((pL6470_AppCmdPkg+PkgId)->p2)].BinaryCode);
-      break;
-    case L6470_GOHOME_ID:
-      break;
-    case L6470_GOMARK_ID:
-      break;
-    case L6470_RESETPOS_ID:
-      break;
-    case L6470_RESETDEVICE_ID:
-      break;
-    case L6470_SOFTSTOP_ID:
-      break;
-    case L6470_HARDSTOP_ID:
-      break;
-    case L6470_SOFTHIZ_ID:
-      break;
-    case L6470_HARDHIZ_ID:
-      break;
-    case L6470_GETSTATUS_ID:
-      break;
-    }
-  }
-}
-
-/* End of L6470_Private_Functions */
-
-/**
-  * @addtogroup L6470_Exported_Functions
-  * @{
-  */
-
-/**
-  * @addtogroup L6470_Conversion_Functions
-  * @brief      The following functions act just on one driver inside the L6470
-  *             daisy chain. The command is immediately sent.
-  * @{
-  */
-
- /**
-  * @brief  Convert the absolute position as 2's complement format into the signed number.
-  * 
-  * @param  AbsPos      The absolute position in the range from [-(2^21)] to [+(2^21)-1].
-  * @retval Position    The position as signed number.
-  */
-int32_t L6470::L6470_AbsPos_2_Position(uint32_t AbsPos)
-{
-  if (AbsPos > L6470_MAX_POSITION)
-    return (AbsPos - (L6470_POSITION_RANGE + 1));
-  else
-    return AbsPos;
-}
-
-/**
-  * @brief  Convert the position as signed number into absolute position as 2's complement format.
-  * 
-  * @param  Position    The position as signed number.
-  * @retval AbsPos      The absolute position in the range from [-(2^21)] to [+(2^21)-1].
-  */
-uint32_t L6470::L6470_Position_2_AbsPos(int32_t Position)
-{
-  if ((Position >= 0) && (Position <= L6470_MAX_POSITION))
-    return Position;
-  else
-  {
-    if ((Position >= L6470_MIN_POSITION) && (Position < 0))
-      return (Position + (L6470_POSITION_RANGE + 1));
-    else
-      return (L6470_POSITION_RANGE + 1);        // OVF
-  }
-}
-
-/**
-  * @brief  Convert the SPEED register value into step/s.
-  * 
-  * @param  Speed       The SPEED register value.
-  * @retval step/s      The speed as step/s.
-  */
-float L6470::L6470_Speed_2_Step_s(uint32_t Speed)
-{
-  return (Speed * ((float)14.9012e-3));
-}
-
-/**
-  * @brief  Convert the speed as step/s into a right value for SPEED register.
-  * 
-  * @param  step/s      The speed as step/s.
-  * @retval Speed       The SPEED register value.
-  */
-uint32_t L6470::L6470_Step_s_2_Speed(float Step_s)
-{
-  if (Step_s <= (L6470_MAX_SPEED * ((float)14.9012e-3)))
-    return (uint32_t)(Step_s / ((float)14.9012e-3));
-  else
-    return 0;   // Warning
-}
-
-/**
-  * @brief  Convert the ACC register value into step/(s^2).
-  * 
-  * @param  Acc         The ACC register value.
-  * @retval step/(s^2)  The acceleration as step/(s^2).
-  */
-float L6470::L6470_Acc_2_Step_s2(uint16_t Acc)
-{
-  if (Acc <= L6470_MAX_ACC)
-    return (Acc * ((float)1.4552e1));
-  else
-    return 0;   // Warning
-}
-
-/**
-  * @brief  Convert the acceleartion as step/(s^2) into a right value for ACC register.
-  * 
-  * @param  step/(s^2)  The acceleration as step/(s^2).
-  * @retval Acc         The ACC register value.
-  */
-uint16_t L6470::L6470_Step_s2_2_Acc(float Step_s2)
-{
-  if (Step_s2 <= (L6470_MAX_ACC * ((float)1.4552e1)))
-    return (uint16_t)(Step_s2 / ((float)1.4552e1));
-  else
-    return 0;   // Warning
-}
-
-/**
-  * @brief  Convert the DEC register value into step/(s^2).
-  * 
-  * @param  Dec         The DEC register value.
-  * @retval step/(s^2)  The deceleration as step/(s^2).
-  */
-float L6470::L6470_Dec_2_Step_s2(uint16_t Dec)
-{
-  if (Dec <= L6470_MAX_DEC)
-    return (Dec * ((float)1.4552e1));
-  else
-    return 0;   // Warning
-}
-
-/**
-  * @brief  Convert the deceleration as step/(s^2) into a right value for DEC register.
-  * 
-  * @param  step/(s^2)  The deceleration as step/(s^2).
-  * @retval Dec         The DEC register value.
-  */
-uint16_t L6470::L6470_Step_s2_2_Dec(float Step_s2)
-{
-  if (Step_s2 <= (L6470_MAX_DEC * ((float)1.4552e1)))
-    return (uint16_t)(Step_s2 / ((float)1.4552e1));
-  else
-    return 0;   // Warning
-}
-
-/**
-  * @brief  Convert the MAX_SPEED register value into step/s.
-  * 
-  * @param  MaxSpeed    The MAX_SPEED register value.
-  * @retval step/s      The max speed as step/s.
-  */
-float L6470::L6470_MaxSpeed_2_Step_s(uint16_t MaxSpeed)
-{
-  if (MaxSpeed <= L6470_MAX_MAX_SPEED)
-    return (MaxSpeed * ((float)15.2588));
-  else
-    return 0;   // Warning
-}
-
-/**
-  * @brief  Convert the max speed as step/s into a right value for MAX_SPEED register.
-  * 
-  * @param  step/s      The max speed as step/s.
-  * @retval MaxSpeed    The MAX_SPEED register value.
-  */
-uint16_t L6470::L6470_Step_s_2_MaxSpeed(float Step_s)
-{
-  if (Step_s <= (L6470_MAX_MAX_SPEED * ((float)15.2588)))
-    return (uint16_t)(Step_s / ((float)15.2588));
-  else
-    return 0;   // Warning
-}
-
-/**
-  * @brief  Convert the MIN_SPEED register value into step/s.
-  * 
-  * @param  MinSpeed    The MIN_SPEED register value.
-  * @retval step/s      The min speed as step/s.
-  */
-float L6470::L6470_MinSpeed_2_Step_s(uint16_t MinSpeed)
-{
-  if (MinSpeed <= L6470_MAX_MIN_SPEED)
-    return (MinSpeed * ((float)238.4186e-3));
-  else
-    return 0;   // Warning
-}
-
-/**
-  * @brief  Convert the min speed as step/s into a right value for MIN_SPEED register.
-  * 
-  * @param  step/s      The min speed as step/s.
-  * @retval MinSpeed    The MIN_SPEED register value.
-  */
-uint16_t L6470::L6470_Step_s_2_MinSpeed(float Step_s)
-{
-  if (Step_s <= (L6470_MAX_MIN_SPEED * ((float)238.4186e-3)))
-    return (uint16_t)(Step_s / ((float)238.4186e-3));
-  else
-    return 0;   // Warning
-}
-
-/**
-  * @brief  Convert the FS_SPD register value into step/s.
-  * 
-  * @param  FsSpd       The FS_SPD register value.
-  * @retval step/s      The full-step speed as step/s.
-  */
-float L6470::L6470_FsSpd_2_Step_s(uint16_t FsSpd)
-{
-  if (FsSpd <= L6470_MAX_FS_SPD)
-    return ((FsSpd+0.5) * ((float)15.25));
-  else
-    return 0;   // Warning
-}
-
-/**
-  * @brief  Convert the full-step speed as step/s into a right value for FS_SPD register.
-  * 
-  * @param  step/s      The full-step speed as step/s.
-  * @retval FsSpd       The FS_SPD register value.
-  */
-uint16_t L6470::L6470_Step_s_2_FsSpd(float Step_s)
-{
-  if (Step_s <= ((L6470_MAX_FS_SPD+0.5) * ((float)15.25)))
-    return (uint16_t)((float)(Step_s / ((float)15.25)) - (float)0.5);
-  else
-    return 0;   // Warning
-}
-
-/**
-  * @brief  Convert the INT_SPEED register value into step/s.
-  * 
-  * @param  IntSpeed    The INT_SPEED register value.
-  * @retval step/s      The intersect speed as step/s.
-  */
-float L6470::L6470_IntSpeed_2_Step_s(uint16_t IntSpeed)
-{
-  if (IntSpeed <= L6470_MAX_INT_SPEED)
-    return (IntSpeed * ((float)59.6046e-3));
-  else
-    return 0;   // Warning
-}
-
-/**
-  * @brief  Convert the intersect speed as step/s into a right value for INT_SPEED register.
-  * 
-  * @param  step/s      The full-step speed as step/s.
-  * @retval FsSpd       The FS_SPD register value.
-  */
-uint16_t L6470::L6470_Step_s_2_IntSpeed(float Step_s)
-{
-  if (Step_s <= (L6470_MAX_INT_SPEED * ((float)59.6046e-3)))
-    return (uint16_t)(Step_s / ((float)59.6046e-3));
-  else
-    return 0;   // Warning
-}
-
-/**
-  * @brief  Convert the ST_SLP register value into s/step.
-  * 
-  * @param  StartSlope  The ST_SLP register value.
-  * @retval s/step      The start slope as s/step.
-  */
-float L6470::L6470_StSlp_2_s_Step(uint8_t StSlp)
-{
-//  if (StSlp <= L6470_MAX_ST_SLP)
-    return (StSlp * ((float)1.5686e-5));
-//  else
-//    return 0;   // Warning
-}
-
-/**
-  * @brief  Convert the intersect speed as step/s into a right value for INT_SPEED register.
-  * 
-  * @param  step/s      The full-step speed as step/s.
-  * @retval FsSpd       The FS_SPD register value.
-  */
-uint8_t L6470::L6470_s_Step_2_StSlp(float s_Step)
-{
-  if (s_Step <= (L6470_MAX_ST_SLP * ((float)1.5686e-5)))
-    return (uint8_t)(s_Step / ((float)1.5686e-5));
-  else
-    return 0;   // Warning
-}
-
-/**
-  * @brief  Convert the INT_SPEED register value into step/s.
-  * 
-  * @param  IntSpeed    The INT_SPEED register value.
-  * @retval step/s      The intersect speed as step/s.
-  */
-float L6470::L6470_FnSlpAcc_2_s_Step(uint8_t FnSlpAcc)
-{
-//  if (FnSlpAcc <= L6470_MAX_FN_SLP_ACC)
-    return (FnSlpAcc * ((float)1.5686e-5));
-//  else
-//    return 0;   // Warning
-}
-
-/**
-  * @brief  Convert the intersect speed as step/s into a right value for INT_SPEED register.
-  * 
-  * @param  step/s      The full-step speed as step/s.
-  * @retval FsSpd       The FS_SPD register value.
-  */
-uint8_t L6470::L6470_s_Step_2_FnSlpAcc(float s_Step)
-{
-  if (s_Step <= (L6470_MAX_FN_SLP_ACC * ((float)1.5686e-5)))
-    return (uint8_t)(s_Step / ((float)1.5686e-5));
-  else
-    return 0;   // Warning
-}
-
-/**
-  * @brief  Convert the INT_SPEED register value into step/s.
-  * 
-  * @param  IntSpeed    The INT_SPEED register value.
-  * @retval step/s      The intersect speed as step/s.
-  */
-float L6470::L6470_FnSlpDec_2_s_Step(uint8_t FnSlpDec)
-{
-//  if (FnSlpDec <= L6470_MAX_FN_SLP_DEC)
-    return (FnSlpDec * ((float)1.5686e-5));
-//  else
-//    return 0;   // Warning
-}
-
-/**
-  * @brief  Convert the intersect speed as step/s into a right value for INT_SPEED register.
-  * 
-  * @param  step/s      The full-step speed as step/s.
-  * @retval FsSpd       The FS_SPD register value.
-  */
-uint8_t L6470::L6470_s_Step_2_FnSlpDec(float s_Step)
-{
-  if (s_Step <= (L6470_MAX_FN_SLP_DEC * ((float)1.5686e-5)))
-    return (uint8_t)(s_Step / ((float)1.5686e-5));
-  else
-    return 0;   // Warning
-}
-
-/**
-  * @brief  Convert the OCD_TH register value into mA.
-  * 
-  * @param  OcdTh       The OCD_TH register value.
-  * @retval mA          The overcurrent threshold as mA.
-  */
-float L6470::L6470_OcdTh_2_mA(uint8_t OcdTh)
-{
-  if (OcdTh <= L6470_MAX_OCD_TH)
-    return ((OcdTh+1) * ((float)375));
-  else
-    return 0;   // Warning
-}
-
-/**
-  * @brief  Convert the overcurrent threshold as mA into a right value for OCD_TH register.
-  * 
-  * @param  mA          The overcurrent threshold as mA.
-  * @retval OcdTh       The OCD_TH register value.
-  */
-uint8_t L6470::L6470_mA_2_OcdTh(float mA)
-{
-  float result, decimal;
-  
-  if (mA <= ((L6470_MAX_OCD_TH+1) * ((float)375)))
-  {
-    result = (mA / ((float)375));
-    decimal = result - (uint8_t)result;
-    
-    if (decimal < (float)0.5)
-      return ((uint8_t)result - 1);
-    else
-      return ((uint8_t)result);    
-  }
-  else
-    return 0;   // Warning
-}
-
-/**
-  * @brief  Convert the STALL_TH register value into mA.
-  * 
-  * @param  StallTh     The STALL_TH register value.
-  * @retval mA          The stall detection threshold as mA.
-  */
-float L6470::L6470_StallTh_2_mA(uint8_t StallTh)
-{
-  if (StallTh <= L6470_MAX_STALL_TH)
-    return ((StallTh+1) * ((float)31.25));
-  else
-    return 0;   // Warning
-}
-
-/**
-  * @brief  Convert the stall detection threshold as mA into a right value for STALL_TH register.
-  * 
-  * @param  mA          The stall detection threshold as mA.
-  * @retval StallTh     The STALL_TH register value.
-  */
-uint8_t L6470::L6470_mA_2_StallTh(float mA)
-{
-  float result, decimal;
-  
-  if (mA <= ((L6470_MAX_STALL_TH+1) * ((float)31.25)))
-  {
-    result = (mA / ((float)31.25));
-    decimal = result - (uint8_t)result;
-    
-    if (decimal < (float)0.5)
-      return ((uint8_t)result - 1);
-    else
-      return ((uint8_t)result);    
-  }
-  else
-    return 0;   // Warning
-}
-
-/* End of L6470_Conversion_Functions */
-
-/**
-  * @addtogroup L6470_AppCMDs
-  * @{
-  */
-
-/**
-  * @brief  SetParam command sets the register value equal to a new value.
-  * 
-  * @param  L6470_RegId   The identifier of the L6470 register to be addressed.
-  * @param  Value         The new value.
-  */
-void L6470::L6470_SetParam(eL6470_RegId_t L6470_RegId, uint32_t Value)
-{
-  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_SETPARAM_ID, L6470_RegId, Value, 0);
-  L6470_PrepareDaisyChainCommand(L6470_AppCmdPkg, (uint8_t*)L6470_DaisyChainSpiTxStruct);
-  L6470_DaisyChainCommand((uint8_t*)L6470_DaisyChainSpiTxStruct, (uint8_t*)L6470_DaisyChainSpiRxStruct);
-}
-
-/**
-  * @brief  GetParam command reads the register value.
-  * 
-  * @param  L6470_RegId   The identifier of the L6470 register to be addressed.
-  * 
-  * @retval ReceivedValue The register value.
-  */
-uint32_t L6470::L6470_GetParam(eL6470_RegId_t L6470_RegId)
-{
-  uint8_t ValueLengthByte;
-  uint32_t ReceivedValue;
-
-  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_GETPARAM_ID, L6470_RegId, 0, 0);
-  L6470_PrepareDaisyChainCommand(L6470_AppCmdPkg, (uint8_t*)L6470_DaisyChainSpiTxStruct);
-  L6470_DaisyChainCommand((uint8_t*)L6470_DaisyChainSpiTxStruct, (uint8_t*)L6470_DaisyChainSpiRxStruct);
-  
-  ValueLengthByte = L6470_Register[L6470_RegId].LengthByte;
-  
-  ReceivedValue = L6470_ExtractReturnedData((uint8_t*)L6470_DaisyChainSpiRxStruct, ValueLengthByte);
-  
-  return ReceivedValue;
-}
-
-/**
-  * @brief  Run command produces a motion at fixed speed.
-  * 
-  * @param  L6470_DirId   The identifier of the L6470 motion direction.
-  * @param  Speed         The speed value as (([step/s] * 250e-9) / 2^-28)
-  */
-void L6470::L6470_Run(eL6470_DirId_t L6470_DirId, uint32_t Speed)
-{
-  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_RUN_ID, L6470_DirId, Speed, 0);
-  L6470_PrepareDaisyChainCommand(L6470_AppCmdPkg, (uint8_t*)L6470_DaisyChainSpiTxStruct);
-  L6470_DaisyChainCommand((uint8_t*)L6470_DaisyChainSpiTxStruct, (uint8_t*)L6470_DaisyChainSpiRxStruct);
-}
-
-/**
-  * @brief  StepClock command switches the device in Step-clock mode.
-  * 
-  * @param  L6470_DirId   The identifier of the L6470 motion direction.
-  */
-void L6470::L6470_StepClock(eL6470_DirId_t L6470_DirId)
-{
-  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_STEPCLOCK_ID, L6470_DirId, 0, 0);
-  L6470_PrepareDaisyChainCommand(L6470_AppCmdPkg, (uint8_t*)L6470_DaisyChainSpiTxStruct);
-  L6470_DaisyChainCommand((uint8_t*)L6470_DaisyChainSpiTxStruct, (uint8_t*)L6470_DaisyChainSpiRxStruct);
-}
-
-/**
-  * @brief  Move command produces a motion of N_STEP microsteps.
-  * 
-  * @param  L6470_DirId   The identifier of the L6470 motion direction.
-  * @param  N_Step        The number of microsteps.
-  */
-void L6470::L6470_Move(eL6470_DirId_t L6470_DirId, uint32_t N_Step)
-{
-  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_MOVE_ID, L6470_DirId, N_Step, 0);
-  L6470_PrepareDaisyChainCommand(L6470_AppCmdPkg, (uint8_t*)L6470_DaisyChainSpiTxStruct);
-  L6470_DaisyChainCommand((uint8_t*)L6470_DaisyChainSpiTxStruct, (uint8_t*)L6470_DaisyChainSpiRxStruct);
-}
-
-/**
-  * @brief  GoTo command produces a motion to ABS_POS absolute position through the shortest path.
-  * 
-  * @param  AbsPos        The target absolute position.
-  */
-void L6470::L6470_GoTo(uint32_t AbsPos)
-{
-  if (AbsPos <= L6470_POSITION_RANGE)
-  {
-    L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_GOTO_ID, AbsPos, 0, 0);
-    L6470_PrepareDaisyChainCommand(L6470_AppCmdPkg, (uint8_t*)L6470_DaisyChainSpiTxStruct);
-    L6470_DaisyChainCommand((uint8_t*)L6470_DaisyChainSpiTxStruct, (uint8_t*)L6470_DaisyChainSpiRxStruct);
-  }
-}
-
-/**
-  * @brief  GoTo_DIR command produces a motion to ABS_POS absolute position imposing a direction.
-  * 
-  * @param  L6470_DirId   The identifier of the L6470 motion direction.
-  * @param  AbsPos        The target absolute position.
-  */
-void L6470::L6470_GoToDir(eL6470_DirId_t L6470_DirId, uint32_t AbsPos)
-{
-  if (AbsPos <= L6470_POSITION_RANGE)
-  {
-    L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_GOTODIR_ID, L6470_DirId, AbsPos, 0);
-    L6470_PrepareDaisyChainCommand(L6470_AppCmdPkg, (uint8_t*)L6470_DaisyChainSpiTxStruct);
-    L6470_DaisyChainCommand((uint8_t*)L6470_DaisyChainSpiTxStruct, (uint8_t*)L6470_DaisyChainSpiRxStruct);
-  }
-}
-
-/**
-  * @brief  GoUntil command produces a motion at fixed speed imposing a direction
-  *         until an external switch turn-on event occurs.
-  * 
-  * @param  L6470_ActId   The identifier of the L6470 action about the absolute position.
-  * @param  L6470_DirId   The identifier of the L6470 motion direction.
-  * @param  Speed         The speed value as (([step/s] * 250e-9) / 2^-28)
-  */
-void L6470::L6470_GoUntil(eL6470_ActId_t L6470_ActId, eL6470_DirId_t L6470_DirId, uint32_t Speed)
-{
-  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_GOUNTIL_ID, L6470_ActId, L6470_DirId, Speed);
-  L6470_PrepareDaisyChainCommand(L6470_AppCmdPkg, (uint8_t*)L6470_DaisyChainSpiTxStruct);
-  L6470_DaisyChainCommand((uint8_t*)L6470_DaisyChainSpiTxStruct, (uint8_t*)L6470_DaisyChainSpiRxStruct);
-}
-
-/**
-  * @brief  ReleaseSW command produces a motion at minimum speed imposing a direction
-  *         until SW is released.
-  * 
-  * @param  L6470_ActId   The identifier of the L6470 action about the absolute position.
-  * @param  L6470_DirId   The identifier of the L6470 motion direction.
-  */
-void L6470::L6470_ReleaseSW(eL6470_ActId_t L6470_ActId, eL6470_DirId_t L6470_DirId)
-{
-  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_RELEASESW_ID, L6470_ActId, L6470_DirId, 0);
-  L6470_PrepareDaisyChainCommand(L6470_AppCmdPkg, (uint8_t*)L6470_DaisyChainSpiTxStruct);
-  L6470_DaisyChainCommand((uint8_t*)L6470_DaisyChainSpiTxStruct, (uint8_t*)L6470_DaisyChainSpiRxStruct);
-}
-
-/**
-  * @brief  GoHome command produces a motion to the HOME position (zero position)
-  *         via the shortest path.
-  * 
-  */
-void L6470::L6470_GoHome(void)
-{
-  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_GOHOME_ID, 0, 0, 0);
-  L6470_PrepareDaisyChainCommand(L6470_AppCmdPkg, (uint8_t*)L6470_DaisyChainSpiTxStruct);
-  L6470_DaisyChainCommand((uint8_t*)L6470_DaisyChainSpiTxStruct, (uint8_t*)L6470_DaisyChainSpiRxStruct);
-}
-
-/**
-  * @brief  GoMark command produces a motion to the MARK position performing the
-  *         minimum path.
-  * 
-  */
-void L6470::L6470_GoMark(void)
-{
-  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_GOMARK_ID, 0, 0, 0);
-  L6470_PrepareDaisyChainCommand(L6470_AppCmdPkg, (uint8_t*)L6470_DaisyChainSpiTxStruct);
-  L6470_DaisyChainCommand((uint8_t*)L6470_DaisyChainSpiTxStruct, (uint8_t*)L6470_DaisyChainSpiRxStruct);
-}
-
-/**
-  * @brief  ResetPos command resets the ABS_POS register to zero.
-  * 
-  */
-void L6470::L6470_ResetPos(void)
-{
-  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_RESETPOS_ID, 0, 0, 0);
-  L6470_PrepareDaisyChainCommand(L6470_AppCmdPkg, (uint8_t*)L6470_DaisyChainSpiTxStruct);
-  L6470_DaisyChainCommand((uint8_t*)L6470_DaisyChainSpiTxStruct, (uint8_t*)L6470_DaisyChainSpiRxStruct);
-}
-
-/**
-  * @brief  ResetDevice command resets the device to power-up conditions.
-  * 
-  */
-void L6470::L6470_ResetDevice(void)
-{
-  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_RESETDEVICE_ID, 0, 0, 0);
-  L6470_PrepareDaisyChainCommand(L6470_AppCmdPkg, (uint8_t*)L6470_DaisyChainSpiTxStruct);
-  L6470_DaisyChainCommand((uint8_t*)L6470_DaisyChainSpiTxStruct, (uint8_t*)L6470_DaisyChainSpiRxStruct);
-}
-
-/**
-  * @brief  SoftStop command causes an immediate deceleration to zero speed and
-  *         a consequent motor stop; the deceleration value used is the one stored
-  *         in the DEC register.
-  * 
-  */
-void L6470::L6470_SoftStop(void)
-{
-  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_SOFTSTOP_ID, 0, 0, 0);
-  L6470_PrepareDaisyChainCommand(L6470_AppCmdPkg, (uint8_t*)L6470_DaisyChainSpiTxStruct);
-  L6470_DaisyChainCommand((uint8_t*)L6470_DaisyChainSpiTxStruct, (uint8_t*)L6470_DaisyChainSpiRxStruct);
-}
-
-/**
-  * @brief  HardStop command causes an immediate motor stop with infinite deceleration.
-  * 
-  */
-void L6470::L6470_HardStop(void)
-{
-  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_HARDSTOP_ID, 0, 0, 0);
-  L6470_PrepareDaisyChainCommand(L6470_AppCmdPkg, (uint8_t*)L6470_DaisyChainSpiTxStruct);
-  L6470_DaisyChainCommand((uint8_t*)L6470_DaisyChainSpiTxStruct, (uint8_t*)L6470_DaisyChainSpiRxStruct);
-}
-
-/**
-  * @brief  SoftHiZ command disables the power bridges (high impedance state)
-  *         after a deceleration to zero; the deceleration value used is the one
-  *         stored in the DEC register.
-  * 
-  */
-void L6470::L6470_SoftHiZ(void)
-{
-  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_SOFTHIZ_ID, 0, 0, 0);
-  L6470_PrepareDaisyChainCommand(L6470_AppCmdPkg, (uint8_t*)L6470_DaisyChainSpiTxStruct);
-  L6470_DaisyChainCommand((uint8_t*)L6470_DaisyChainSpiTxStruct, (uint8_t*)L6470_DaisyChainSpiRxStruct);
-}
-
-/**
-  * @brief  HardHiZ command immediately disables the power bridges (high impedance state).
-  * 
-  */
-void L6470::L6470_HardHiZ(void)
-{
-  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_HARDHIZ_ID, 0, 0, 0);
-  L6470_PrepareDaisyChainCommand(L6470_AppCmdPkg, (uint8_t*)L6470_DaisyChainSpiTxStruct);
-  L6470_DaisyChainCommand((uint8_t*)L6470_DaisyChainSpiTxStruct, (uint8_t*)L6470_DaisyChainSpiRxStruct);
-}
-
-/**
-  * @brief  GetStatus command returns the STATUS register value.
-  * 
-  * 
-  * @retval ReceivedValue The register value.
-  */
-uint16_t L6470::L6470_GetStatus(void)
-{
-  uint16_t ReceivedValue;
-
-  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_GETSTATUS_ID, 0, 0, 0);
-  L6470_PrepareDaisyChainCommand(L6470_AppCmdPkg, (uint8_t*)L6470_DaisyChainSpiTxStruct);
-  L6470_DaisyChainCommand((uint8_t*)L6470_DaisyChainSpiTxStruct, (uint8_t*)L6470_DaisyChainSpiRxStruct);
-  
-  ReceivedValue = (uint16_t)L6470_ExtractReturnedData((uint8_t*)L6470_DaisyChainSpiRxStruct, 2);
-  
-  return ReceivedValue;
-}
-
-/* End of L6470_AppCMDs */
-
-/**
-  * @addtogroup L6470_AppCMDs_ToBePrepared
-  * @{
-  */
-
-/**
-  * @brief  Prepare to send @ref L6470_SetParam command.
-  *
-  * @param  L6470_RegId   The identifier of the L6470 register to be addressed.
-  * @param  Value         The new value.
-  *
-  * @note   This function will properly fill the right column of the L6470_AppCmdPkg.
-  * @note   The commad will be sent by @ref L6470_PerformPreparedApplicationCommand.
-  */
-void L6470::L6470_PrepareSetParam(eL6470_RegId_t L6470_RegId, uint32_t Value)
-{
-  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_SETPARAM_ID, L6470_RegId, Value, 0);
-}
-
-/**
-  * @brief  Prepare to send @ref L6470_GetParam command.
-  *
-  * @param  L6470_Id      The L6470 identifier inside the daisy chain.
-  * @param  L6470_RegId   The identifier of the L6470 register to be addressed.
-  *
-  * @retval ReceivedValue The register value.
-  *
-  * @note   This function will properly fill the right column of the L6470_AppCmdPkg.
-  * @note   The commad will be sent by @ref L6470_PerformPreparedApplicationCommand.
-  */
-void L6470::L6470_PrepareGetParam(eL6470_RegId_t L6470_RegId)
-{
-  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_GETPARAM_ID, L6470_RegId, 0, 0);
-}
-
-/**
-  * @brief  Prepare to send @ref L6470_Run command.
-  * 
-  * @param  L6470_DirId   The identifier of the L6470 motion direction.
-  * @param  Speed         The speed value as (([step/s] * 250e-9) / 2^-28)
-  *
-  * @note   This function will properly fill the right column of the L6470_AppCmdPkg.
-  * @note   The commad will be sent by @ref L6470_PerformPreparedApplicationCommand.
-  */
-void L6470::L6470_PrepareRun(eL6470_DirId_t L6470_DirId, uint32_t Speed)
-{
-  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_RUN_ID, L6470_DirId, Speed, 0);
-}
-
-/**
-  * @brief  Prepare to send @ref L6470_StepClock command.
-  * 
-  * @param  L6470_DirId   The identifier of the L6470 motion direction.
-  *
-  * @note   This function will properly fill the right column of the L6470_AppCmdPkg.
-  * @note   The commad will be sent by @ref L6470_PerformPreparedApplicationCommand.
-  */
-void L6470::L6470_PrepareStepClock(eL6470_DirId_t L6470_DirId)
-{
-  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_STEPCLOCK_ID, L6470_DirId, 0, 0);
-}
-
-/**
-  * @brief  Prepare to send @ref L6470_Move command.
-  * 
-  * @param  L6470_DirId   The identifier of the L6470 motion direction.
-  * @param  N_Step        The number of microsteps.
-  *
-  * @note   This function will properly fill the right column of the L6470_AppCmdPkg.
-  * @note   The commad will be sent by @ref L6470_PerformPreparedApplicationCommand.
-  */
-void L6470::L6470_PrepareMove(eL6470_DirId_t L6470_DirId, uint32_t N_Step)
-{
-  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_MOVE_ID, L6470_DirId, N_Step, 0);
-}
-
-/**
-  * @brief  Prepare to send @ref L6470_GoTo command.
-  * 
-  * @param  AbsPos        The target absolute position.
-  *
-  * @note   This function will properly fill the right column of the L6470_AppCmdPkg.
-  * @note   The commad will be sent by @ref L6470_PerformPreparedApplicationCommand.
-  */
-void L6470::L6470_PrepareGoTo(uint32_t AbsPos)
-{
-  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_GOTO_ID, AbsPos, 0, 0);
-}
-
-/**
-  * @brief  Prepare to send @ref L6470_GoToDIR command.
-  * 
-  * @param  L6470_DirId   The identifier of the L6470 motion direction.
-  * @param  AbsPos        The target absolute position.
-  *
-  * @note   This function will properly fill the right column of the L6470_AppCmdPkg.
-  * @note   The commad will be sent by @ref L6470_PerformPreparedApplicationCommand.
-  */
-void L6470::L6470_PrepareGoToDir(eL6470_DirId_t L6470_DirId, uint32_t AbsPos)
-{
-  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_GOTODIR_ID, L6470_DirId, AbsPos, 0);
-}
-
-/**
-  * @brief  Prepare to send @ref L6470_GoUntil command.
-  * 
-  * @param  L6470_ActId   The identifier of the L6470 action about the absolute position.
-  * @param  L6470_DirId   The identifier of the L6470 motion direction.
-  * @param  Speed         The speed value as (([step/s] * 250e-9) / 2^-28)
-  *
-  * @note   This function will properly fill the right column of the L6470_AppCmdPkg.
-  * @note   The commad will be sent by @ref L6470_PerformPreparedApplicationCommand.
-  */
-void L6470::L6470_PrepareGoUntil(eL6470_ActId_t L6470_ActId, eL6470_DirId_t L6470_DirId, uint32_t Speed)
-{
-  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_GOUNTIL_ID, L6470_ActId, L6470_DirId, Speed);
-}
-
-/**
-  * @brief  Prepare to send @ref L6470_ReleaseSW.
-  * 
-  * @param  L6470_ActId   The identifier of the L6470 action about the absolute position.
-  * @param  L6470_DirId   The identifier of the L6470 motion direction.
-  *
-  * @note   This function will properly fill the right column of the L6470_AppCmdPkg.
-  * @note   The commad will be sent by @ref L6470_PerformPreparedApplicationCommand.
-  */
-void L6470::L6470_PrepareReleaseSW(eL6470_ActId_t L6470_ActId, eL6470_DirId_t L6470_DirId)
-{
-  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_RELEASESW_ID, L6470_ActId, L6470_DirId, 0);
-}
-
-/**
-  * @brief  Prepare to send @ref L6470_GoHome command.
-  * 
-  *
-  * @note   This function will properly fill the right column of the L6470_AppCmdPkg.
-  * @note   The commad will be sent by @ref L6470_PerformPreparedApplicationCommand.
-  */
-void L6470::L6470_PrepareGoHome(void)
-{
-  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_GOHOME_ID, 0, 0, 0);
-}
-
-/**
-  * @brief  Prepare to send @ref L6470_GoMark command.
-  * 
-  *
-  * @note   This function will properly fill the right column of the L6470_AppCmdPkg.
-  * @note   The commad will be sent by @ref L6470_PerformPreparedApplicationCommand.
-  */
-void L6470::L6470_PrepareGoMark(void)
-{
-  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_GOMARK_ID, 0, 0, 0);
-}
-
-/**
-  * @brief  Prepare to send @ref L6470_ResetPos command.
-  * 
-  *
-  * @note   This function will properly fill the right column of the L6470_AppCmdPkg.
-  * @note   The commad will be sent by @ref L6470_PerformPreparedApplicationCommand.
-  */
-void L6470::L6470_PrepareResetPos(void)
-{
-  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_RESETPOS_ID, 0, 0, 0);
-}
-
-/**
-  * @brief  Prepare to send @ref L6470_ResetDevice command.
-  * 
-  *
-  * @note   This function will properly fill the right column of the L6470_AppCmdPkg.
-  * @note   The commad will be sent by @ref L6470_PerformPreparedApplicationCommand.
-  */
-void L6470::L6470_PrepareResetDevice(void)
-{
-  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_RESETDEVICE_ID, 0, 0, 0);
-}
-
-/**
-  * @brief  Prepare to send @ref L6470_SoftStop command.
-  * 
-  *
-  * @note   This function will properly fill the right column of the L6470_AppCmdPkg.
-  * @note   The commad will be sent by @ref L6470_PerformPreparedApplicationCommand.
-  */
-void L6470::L6470_PrepareSoftStop(void)
-{
-  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_SOFTSTOP_ID, 0, 0, 0);
-}
-
-/**
-  * @brief  Prepare to send @ref L6470_HardStop command.
-  * 
-  *
-  * @note   This function will properly fill the right column of the L6470_AppCmdPkg.
-  * @note   The commad will be sent by @ref L6470_PerformPreparedApplicationCommand.
-  */
-void L6470::L6470_PrepareHardStop(void)
-{
-  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_HARDSTOP_ID, 0, 0, 0);
-}
-
-/**
-  * @brief  Prepare to send @ref L6470_SoftHiZ command.
-  * 
-  *
-  * @note   This function will properly fill the right column of the L6470_AppCmdPkg.
-  * @note   The commad will be sent by @ref L6470_PerformPreparedApplicationCommand.
-  */
-void L6470::L6470_PrepareSoftHiZ(void)
-{
-  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_SOFTHIZ_ID, 0, 0, 0);
-}
-
-/**
-  * @brief  Prepare to send @ref L6470_HardHiZ command.
-  * 
-  *
-  * @note   This function will properly fill the right column of the L6470_AppCmdPkg.
-  * @note   The commad will be sent by @ref L6470_PerformPreparedApplicationCommand.
-  */
-void L6470::L6470_PrepareHardHiZ(void)
-{
-  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_HARDHIZ_ID, 0, 0, 0);
-}
-
-/**
-  * @brief  Prepare to send @ref L6470_GetStatus command.
-  * 
-  *
-  * @note   This function will properly fill the right column of the L6470_AppCmdPkg.
-  * @note   The commad will be sent by @ref L6470_PerformPreparedApplicationCommand.
-  */
-void L6470::L6470_PrepareGetStatus(void)
-{
-  L6470_PrepareAppCmdPkg(L6470_AppCmdPkg, L6470_GETSTATUS_ID, 0, 0, 0);
-}
-
-/* End of L6470_AppCMDs_ToBePrepared */
-
-/**
-  * @brief  Send via SPI the command stored inside the L6470_AppCmdPkg to the
-  *         L6470 daisy chain.
-  * 
-  * @retval (uint8_t*)data->L6470_DaisyChainSpiRxStruct  The pointer to the structure
-  *         containing returned values from each L6470 of the daisy chain for each
-  *         sent SPI data.
-  */
-uint8_t* L6470::L6470_PerformPreparedApplicationCommand(void)
-{
-  L6470_PrepareDaisyChainCommand(L6470_AppCmdPkg, (uint8_t*)L6470_DaisyChainSpiTxStruct);
-  L6470_DaisyChainCommand((uint8_t*)L6470_DaisyChainSpiTxStruct, (uint8_t*)L6470_DaisyChainSpiRxStruct);
-  
-  return (uint8_t*)(L6470_DaisyChainSpiRxStruct);
-}
-
-/**
-  * @brief  Send command to the L6470 daisy chain via SPI
-  * @param  pL6470_DaisyChainSpiTxStruct  Pointer to the matrix array of bytes to be sent to the daisy chain L6470
-  * @param  pL6470_DaisyChainSpiRxStruct  Pointer to the matrix array of bytes to be received from the daisy chain L6470
-  */
-void L6470::L6470_DaisyChainCommand(uint8_t* pL6470_DaisyChainSpiTxStruct, uint8_t* pL6470_DaisyChainSpiRxStruct)
-{
-  uint8_t spibyte;
-  
-  L6470_DaisyChain_HalfPrepared = ZERO_F;
-  
-  /* Send all command bytes via SPI */
-  for(spibyte=0; spibyte < L6470MAXSPICMDBYTESIZE; spibyte++)
-  {
-    /* Send the command via SPI */
-    L6470_SPI_Communication((pL6470_DaisyChainSpiTxStruct+(spibyte * L6470DAISYCHAINSIZE)), (pL6470_DaisyChainSpiRxStruct+(spibyte * L6470DAISYCHAINSIZE)), L6470DAISYCHAINSIZE, 10);
-    
-    //_DELAY(TDISCS);
-    uint8_t delay_cnt;
-    for (delay_cnt=0; delay_cnt<20; delay_cnt++) __NOP();   //!<Simply deselect time delay for SPI nCS
-  }
-}
-
-/**
-  * @brief    Extracts the data returned by the L6470 from the matrix that
-  *           contains the received SPI data.
-  * @param    L6470_Id  The identifier of the L6470 target inside the daisy chain.
-  * @param    pL6470_DaisyChainSpiRxStruct  uint8_t-pointer to the matrix that
-  *           contains the received data by SPI from the L6470 daisy chain.
-  * @param    LengthByte  The number of bytes about the received value.
-  */
-uint32_t L6470::L6470_ExtractReturnedData(uint8_t* pL6470_DaisyChainSpiRxStruct, uint8_t LengthByte)
-{
-  uint32_t value;
-  uint8_t i;
-
-  value = 0x000000;
-  for (i=1; i<=(L6470MAXSPICMDBYTESIZE-1); i++)
-  {
-    value |= (*(pL6470_DaisyChainSpiRxStruct+(i*L6470DAISYCHAINSIZE)+L6470_Id))<<((LengthByte-i)*8);
-  }
-
-  return value;
-}
-
-/**
-  * @brief  Check the state of a flag inside the L6470 STATUS register.
-  *
-  * @param  L6470_Id  The identifier of the L6470 target inside the daisy chain.
-  * @param  L6470_StatusRegisterFlagId  The identifier of the L6470 STATUS flag to be checked.
-  *
-  * @retval state The flag state.
-  */
-
-uint8_t L6470::L6470_CheckStatusRegisterFlag(uint8_t L6470_StatusRegisterFlagId)
-{
-  uint8_t state = 0;
-
-  *((uint16_t*)pL6470_StatusRegister) = L6470_GetParam(L6470_STATUS_ID);
-  
-  switch(L6470_StatusRegisterFlagId)
-  {
-    case HiZ_ID:
-      state = pL6470_StatusRegister->HiZ;
-      break;
-    case BUSY_ID:
-      state = pL6470_StatusRegister->BUSY;
-      break;
-    case SW_F_ID:
-      state = pL6470_StatusRegister->SW_F;
-      break;
-    case SW_EVN_ID:
-      state = pL6470_StatusRegister->SW_EVN;
-      break;
-    case DIR_ID:
-      state = pL6470_StatusRegister->DIR;
-      break;
-    case MOT_STATUS_ID:
-      state = pL6470_StatusRegister->MOT_STATUS;
-      break;
-    case NOTPERF_CMD_ID:
-      state = pL6470_StatusRegister->NOTPERF_CMD;
-      break;
-    case WRONG_CMD_ID:
-      state = pL6470_StatusRegister->WRONG_CMD;
-      break;
-    case UVLO_ID:
-      state = pL6470_StatusRegister->UVLO;
-      break;
-    case TH_WRN_ID:
-      state = pL6470_StatusRegister->TH_WRN;
-      break;
-    case TH_SD_ID:
-      state = pL6470_StatusRegister->TH_SD;
-      break;
-    case OCD_ID:
-      state = pL6470_StatusRegister->OCD;
-      break;
-    case STEP_LOSS_A_ID:
-      state = pL6470_StatusRegister->STEP_LOSS_A;
-      break;
-    case STEP_LOSS_B_ID:
-      state = pL6470_StatusRegister->STEP_LOSS_B;
-      break;
-    case SCK_MOD_ID:
-      state = pL6470_StatusRegister->SCK_MOD;
-      break;
-  }
-  
-  return state;
-}
-
-/**
-  * @brief  Return the mnemonic name for the L6470 register.
-  * @param  id  The identifier of the L6470 register.
-  */
-uint8_t *L6470::L6470_GetRegisterName(uint8_t id)
-{
-  if (id < L6470REGIDSIZE)
-  {
-    return (uint8_t*)L6470_Register[id].Name;
-  }
-  else
-  {
-    return NULL;
-  }
-}
-
-/**
-  * @brief  Configures the L6470 registers.
-  * @param  init The pointer to the initialization structure.
-  */
-Status_t L6470::L6470_Config(void *init)
-{
-  /* Disable the L6470. */
-  L6470_DISABLE();
-
-  /* Enable the L6470. */
-  L6470_ENABLE();
-
-  /* Reset devices. */
-  ResetDevice();
-
-  /* Reset Status Register flags. */
-  GetStatus();
-
-  /* Prepare the 'Register' field of StepperMotorDriverHandle */
-  L6470_Init_t *MotorParameterData = (L6470_Init_t *) init;
-  StepperMotorRegister.ACC = L6470_Step_s2_2_Acc(MotorParameterData->acc);
-  StepperMotorRegister.DEC = L6470_Step_s2_2_Dec(MotorParameterData->dec);
-  StepperMotorRegister.MAX_SPEED = L6470_Step_s_2_MaxSpeed(MotorParameterData->maxspeed);
-  StepperMotorRegister.MIN_SPEED = L6470_Step_s_2_MinSpeed(MotorParameterData->minspeed);
-  StepperMotorRegister.FS_SPD = L6470_Step_s_2_FsSpd(MotorParameterData->fsspd);
-  StepperMotorRegister.KVAL_HOLD = (uint8_t)((float)((float)(MotorParameterData->kvalhold * 256) / (MotorParameterData->motorvoltage)));
-  StepperMotorRegister.KVAL_RUN = (uint8_t)((float)((float)(MotorParameterData->kvalrun * 256) / (MotorParameterData->motorvoltage)));
-  StepperMotorRegister.KVAL_ACC = (uint8_t)((float)((float)(MotorParameterData->kvalacc * 256) / (MotorParameterData->motorvoltage)));
-  StepperMotorRegister.KVAL_DEC = (uint8_t)((float)((float)(MotorParameterData->kvaldec * 256) / (MotorParameterData->motorvoltage)));
-  StepperMotorRegister.INT_SPEED = L6470_Step_s_2_IntSpeed(MotorParameterData->intspeed);
-  StepperMotorRegister.ST_SLP = L6470_s_Step_2_StSlp(MotorParameterData->stslp);
-  StepperMotorRegister.FN_SLP_ACC = L6470_s_Step_2_FnSlpAcc(MotorParameterData->fnslpacc);
-  StepperMotorRegister.FN_SLP_DEC = L6470_s_Step_2_FnSlpDec(MotorParameterData->fnslpdec);
-  StepperMotorRegister.K_THERM = MotorParameterData->kterm;
-  StepperMotorRegister.OCD_TH = L6470_mA_2_OcdTh(MotorParameterData->ocdth);
-  StepperMotorRegister.STALL_TH = L6470_mA_2_StallTh(MotorParameterData->stallth);
-  StepperMotorRegister.ALARM_EN = MotorParameterData->alarmen;
-  StepperMotorRegister.CONFIG = MotorParameterData->config;
-  StepperMotorRegister.STEP_MODE = MotorParameterData->step_sel;
-
-  /* Write the L6470 registers with the prepared data */
-  L6470_SetParam(L6470_ACC_ID, StepperMotorRegister.ACC);
-  L6470_SetParam(L6470_DEC_ID, StepperMotorRegister.DEC);
-  L6470_SetParam(L6470_MAX_SPEED_ID, StepperMotorRegister.MAX_SPEED);
-  L6470_SetParam(L6470_MIN_SPEED_ID, StepperMotorRegister.MIN_SPEED);
-  L6470_SetParam(L6470_FS_SPD_ID, StepperMotorRegister.FS_SPD);
-  L6470_SetParam(L6470_KVAL_HOLD_ID, StepperMotorRegister.KVAL_HOLD);
-  L6470_SetParam(L6470_KVAL_RUN_ID, StepperMotorRegister.KVAL_RUN);
-  L6470_SetParam(L6470_KVAL_ACC_ID, StepperMotorRegister.KVAL_ACC);
-  L6470_SetParam(L6470_KVAL_DEC_ID, StepperMotorRegister.KVAL_DEC);
-  L6470_SetParam(L6470_INT_SPEED_ID, StepperMotorRegister.INT_SPEED);
-  L6470_SetParam(L6470_ST_SLP_ID, StepperMotorRegister.ST_SLP);
-  L6470_SetParam(L6470_FN_SLP_ACC_ID, StepperMotorRegister.FN_SLP_ACC);
-  L6470_SetParam(L6470_FN_SLP_DEC_ID, StepperMotorRegister.FN_SLP_DEC);
-  L6470_SetParam(L6470_K_THERM_ID, StepperMotorRegister.K_THERM);
-  L6470_SetParam(L6470_OCD_TH_ID, StepperMotorRegister.OCD_TH);
-  L6470_SetParam(L6470_STALL_TH_ID, StepperMotorRegister.STALL_TH);
-  L6470_SetParam(L6470_ALARM_EN_ID, StepperMotorRegister.ALARM_EN);
-  L6470_SetParam(L6470_CONFIG_ID, StepperMotorRegister.CONFIG);
-  if (!SetStepMode((StepperMotor::step_mode_t) StepperMotorRegister.STEP_MODE))
-    return COMPONENT_ERROR;
-  
-  return COMPONENT_OK;
-}
-
-/* End of L6470_Exported_Functions */
-
-/* End of L6470 */
-
-/* End of Components */
-
-/* End of BSP */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
--- a/Components/l6470/l6470_class.h	Wed Mar 01 17:52:33 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1584 +0,0 @@
-/**
- ******************************************************************************
- * @file    l6470_class.h
- * @author  Davide Aliprandi, STMicroelectronics
- * @version V1.0.0
- * @date    November 12th, 2015
- * @brief   This file contains the class of an L6470 Motor Control component.
- ******************************************************************************
- *
- * COPYRIGHT(c) 2014 STMicroelectronics
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *   1. Redistributions of source code must retain the above copyright notice,
- *      this list of conditions and the following disclaimer.
- *   2. Redistributions in binary form must reproduce the above copyright notice,
- *      this list of conditions and the following disclaimer in the documentation
- *      and/or other materials provided with the distribution.
- *   3. Neither the name of STMicroelectronics nor the names of its contributors
- *      may be used to endorse or promote products derived from this software
- *      without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- ******************************************************************************
- */
-
-
-/* Generated with STM32CubeTOO -----------------------------------------------*/
-
-
-/* Revision ------------------------------------------------------------------*/
-/*
-    Repository:       http://svn.x-nucleodev.codex.cro.st.com/svnroot/X-NucleoDev
-    Branch/Trunk/Tag: trunk
-    Based on:         X-CUBE-SPN2/trunk/Drivers/BSP/Components/L6470/L6470.h
-    Revision:         0
-*/
-
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-
-#ifndef __L6470_CLASS_H
-#define __L6470_CLASS_H
-
-
-/* Includes ------------------------------------------------------------------*/
-
-/* ACTION 1 ------------------------------------------------------------------*
- * Include here platform specific header files.                               *
- *----------------------------------------------------------------------------*/
-#include "mbed.h"
-#include "DevSPI.h"
-/* ACTION 2 ------------------------------------------------------------------*
- * Include here component specific header files.                              *
- *----------------------------------------------------------------------------*/
-#include "l6470.h"
-/* ACTION 3 ------------------------------------------------------------------*
- * Include here interface specific header files.                              *
- *                                                                            *
- * Example:                                                                   *
- *   #include "HumiditySensor.h"                                              *
- *   #include "TemperatureSensor.h"                                           *
- *----------------------------------------------------------------------------*/
-#include "StepperMotor.h"
-
-
-/* Classes -------------------------------------------------------------------*/
-
-/**
- * @brief Class representing a L6470 component.
- */
-class L6470 : public StepperMotor
-{
-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 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 *
-         * line.                                                              *
-         *                                                                    *
-         * Example:                                                           *
-         *   measure = 0;                                                     *
-         *   instance_id = number_of_instances++;                             *
-         *--------------------------------------------------------------------*/
-        L6470_Register = &_L6470_Register[0];
-        L6470_ApplicationCommand = &_L6470_ApplicationCommand[0];
-        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));
-        memset(L6470_DaisyChainSpiTxStruct, 0, L6470MAXSPICMDBYTESIZE * L6470DAISYCHAINSIZE * sizeof(uint8_t));
-        memset(L6470_DaisyChainSpiRxStruct, 0, L6470MAXSPICMDBYTESIZE * L6470DAISYCHAINSIZE * sizeof(uint8_t));
-    }
-
-    /**
-     * @brief Destructor.
-     */
-    virtual ~L6470(void) {}
-
-
-    /*** Public Component Related Methods ***/
-
-    /* ACTION 5 --------------------------------------------------------------*
-     * Implement here the component's public methods, as wrappers of the C    *
-     * component's functions.                                                 *
-     * They should be:                                                        *
-     *   + Methods with the same name of the C component's virtual table's    *
-     *     functions (1);                                                     *
-     *   + Methods with the same name of the C component's extended virtual   *
-     *     table's functions, if any (2).                                     *
-     *                                                                        *
-     * Example:                                                               *
-     *   virtual int GetValue(float *f)  //(1)                                *
-     *   {                                                                    *
-     *     return COMPONENT_GetValue(float *f);                               *
-     *   }                                                                    *
-     *                                                                        *
-     *   virtual int EnableFeature(void) //(2)                                *
-     *   {                                                                    *
-     *     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((void *) 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 A parameter's register address.
-     * @retval The parameter's value.
-     * @note   The parameter can be one of the following:
-     *           + L6470_ABS_POS_ID
-     *           + L6470_EL_POS_ID
-     *           + L6470_MARK_ID
-     *           + L6470_SPEED_ID
-     *           + L6470_ACC_ID
-     *           + L6470_DEC_ID
-     *           + L6470_MAX_SPEED_ID
-     *           + L6470_MIN_SPEED_ID
-     *           + L6470_FS_SPD_ID
-     *           + L6470_KVAL_HOLD_ID
-     *           + L6470_KVAL_RUN_ID
-     *           + L6470_KVAL_ACC_ID
-     *           + L6470_KVAL_DEC_ID
-     *           + L6470_INT_SPEED_ID
-     *           + L6470_ST_SLP_ID
-     *           + L6470_FN_SLP_ACC_ID
-     *           + L6470_FN_SLP_DEC_ID
-     *           + L6470_K_THERM_ID
-     *           + L6470_ADC_OUT_ID
-     *           + L6470_OCD_TH_ID
-     *           + L6470_STALL_TH_ID
-     *           + L6470_STEP_MODE_ID
-     *           + L6470_ALARM_EN_ID
-     *           + L6470_CONFIG_ID
-     *           + L6470_STATUS_ID
-     */
-    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_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_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 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 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 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 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 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 A parameter's register address.
-     * @param   value The parameter's value.
-     * @retval  None.
-     * @note    The parameter can be one of the following:
-     *           + L6470_ABS_POS_ID
-     *           + L6470_EL_POS_ID
-     *           + L6470_MARK_ID
-     *           + L6470_SPEED_ID
-     *           + L6470_ACC_ID
-     *           + L6470_DEC_ID
-     *           + L6470_MAX_SPEED_ID
-     *           + L6470_MIN_SPEED_ID
-     *           + L6470_FS_SPD_ID
-     *           + L6470_KVAL_HOLD_ID
-     *           + L6470_KVAL_RUN_ID
-     *           + L6470_KVAL_ACC_ID
-     *           + L6470_KVAL_DEC_ID
-     *           + L6470_INT_SPEED_ID
-     *           + L6470_ST_SLP_ID
-     *           + L6470_FN_SLP_ACC_ID
-     *           + L6470_FN_SLP_DEC_ID
-     *           + L6470_K_THERM_ID
-     *           + L6470_ADC_OUT_ID
-     *           + L6470_OCD_TH_ID
-     *           + L6470_STALL_TH_ID
-     *           + L6470_STEP_MODE_ID
-     *           + L6470_ALARM_EN_ID
-     *           + L6470_CONFIG_ID
-     *           + L6470_STATUS_ID
-     * @warning Some registers can only be written in particular conditions (see L6470's datasheet).
-     *          Any attempt to write one of those registers when the conditions are not satisfied
-     *          causes the command to be ignored and the NOTPERF_CMD flag to rise at the end of the
-     *          last argument byte. Any attempt to set an inexistent register (wrong address value)
-     *          causes the command to be ignored and the WRONG_CMD flag to rise.
-     *          For example, setting some parameters requires first to disable the power bridge;
-     *          this can be done through the SoftHiZ() method.
-     *          They are the following:
-     *           + L6470_ABS_POS_ID
-     *           + L6470_EL_POS_ID
-     *           + L6470_SPEED_ID
-     *           + L6470_ACC_ID
-     *           + L6470_DEC_ID
-     *           + L6470_MAX_SPEED_ID
-     *           + L6470_MIN_SPEED_ID
-     *           + L6470_INT_SPEED_ID
-     *           + L6470_ST_SLP_ID
-     *           + L6470_FN_SLP_ACC_ID
-     *           + L6470_FN_SLP_DEC_ID
-     *           + L6470_ADC_OUT_ID
-     *           + L6470_STEP_MODE_ID
-     *           + L6470_CONFIG_ID
-     *           + L6470_STATUS_ID
-     */
-    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();
-    }
-
-    /**
-     * @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));
-    }
-
-    /**
-     * @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 "true" in case of success, "false" otherwise.
-     */
-    virtual bool SetMaxSpeed(unsigned int speed)
-    {
-        L6470_SetParam((eL6470_RegId_t) L6470_MAX_SPEED_ID, (uint32_t) L6470_Step_s_2_MaxSpeed((float) speed));
-        return true;
-    }
-
-    /**
-     * @brief  Setting the minimum speed in pps.
-     * @param  speed The minimum speed in pps.
-     * @retval "true" in case of success, "false" otherwise.
-     */
-    virtual bool SetMinSpeed(unsigned int speed)
-    {
-        L6470_SetParam((eL6470_RegId_t) L6470_MIN_SPEED_ID, (uint32_t) L6470_Step_s_2_MinSpeed((float) speed));
-        return true;
-    }
-
-    /**
-     * @brief  Setting the acceleration in pps^2.
-     * @param  acceleration The acceleration in pps^2.
-     * @retval "true" in case of success, "false" otherwise.
-     */
-    virtual bool SetAcceleration(unsigned int acceleration)
-    {
-        L6470_SetParam((eL6470_RegId_t) L6470_ACC_ID, (uint32_t) L6470_Step_s2_2_Acc((float) acceleration));
-        return true;
-    }
-
-    /**
-     * @brief  Setting the deceleration in pps^2.
-     * @param  deceleration The deceleration in pps^2.
-     * @retval "true" in case of success, "false" otherwise.
-     */
-    virtual bool SetDeceleration(unsigned int deceleration)
-    {
-        L6470_SetParam((eL6470_RegId_t) L6470_DEC_ID, (uint32_t) L6470_Step_s2_2_Dec((float) deceleration));
-        return true;
-    }
-
-    /**
-     * @brief   Setting the Step Mode.
-     * @param   step_mode The Step Mode.
-     * @retval "true" in case of success, "false" otherwise.
-     * @warning Setting the step mode implies first disabling the power bridge through
-     *          the SoftHiZ() method.
-     * @warning Every time step mode is changed, the values of the home
-     *          and mark positions lose meaning and are reset.
-     */
-    virtual bool SetStepMode(step_mode_t step_mode)
-    {
-        if ((eMotorStepMode_t) step_mode > MICROSTEP_1_128) {
-            return false;
-        }
-        SoftHiZ();
-        L6470_SetParam((eL6470_RegId_t) L6470_STEP_MODE_ID, (eMotorStepMode_t) step_mode);
-        return true;
-    }
-
-    /**
-     * @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) 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), (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();
-    }
-
-    /**
-     * @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) 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) 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);
-    }
-
-    /**
-     * @brief   Switching to step-clock mode.
-     * @param   direction The direction of rotation.
-     * @retval  None.
-     * @warning Setting the step-clock mode implies first disabling the power bridge through
-     *          the SoftHiZ() method.
-     */
-    virtual void StepClock(direction_t direction)
-    {
-        SoftHiZ();
-        L6470_StepClock((eL6470_DirId_t) (direction == StepperMotor::FWD ? L6470_DIR_FWD_ID : L6470_DIR_REV_ID));
-    }
-
-    /**
-      * @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) 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 A parameter's register address.
-     * @retval None.
-     * @note   The command will be sent by issuing "PerformAction()".
-     *         The parameter can be one of the following:
-     *           + L6470_ABS_POS_ID
-     *           + L6470_EL_POS_ID
-     *           + L6470_MARK_ID
-     *           + L6470_SPEED_ID
-     *           + L6470_ACC_ID
-     *           + L6470_DEC_ID
-     *           + L6470_MAX_SPEED_ID
-     *           + L6470_MIN_SPEED_ID
-     *           + L6470_FS_SPD_ID
-     *           + L6470_KVAL_HOLD_ID
-     *           + L6470_KVAL_RUN_ID
-     *           + L6470_KVAL_ACC_ID
-     *           + L6470_KVAL_DEC_ID
-     *           + L6470_INT_SPEED_ID
-     *           + L6470_ST_SLP_ID
-     *           + L6470_FN_SLP_ACC_ID
-     *           + L6470_FN_SLP_DEC_ID
-     *           + L6470_K_THERM_ID
-     *           + L6470_ADC_OUT_ID
-     *           + L6470_OCD_TH_ID
-     *           + L6470_STALL_TH_ID
-     *           + L6470_STEP_MODE_ID
-     *           + L6470_ALARM_EN_ID
-     *           + L6470_CONFIG_ID
-     *           + L6470_STATUS_ID
-     */
-    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_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;
-    }
-
-    /**
-     * @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)
-    {
-        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 A parameter's register address.
-     * @param  value The parameter's value.
-     * @retval None.
-     * @note   The command will be sent by issuing "PerformAction()".
-     *         The parameter can be one of the following:
-     *           + L6470_ABS_POS_ID
-     *           + L6470_EL_POS_ID
-     *           + L6470_MARK_ID
-     *           + L6470_SPEED_ID
-     *           + L6470_ACC_ID
-     *           + L6470_DEC_ID
-     *           + L6470_MAX_SPEED_ID
-     *           + L6470_MIN_SPEED_ID
-     *           + L6470_FS_SPD_ID
-     *           + L6470_KVAL_HOLD_ID
-     *           + L6470_KVAL_RUN_ID
-     *           + L6470_KVAL_ACC_ID
-     *           + L6470_KVAL_DEC_ID
-     *           + L6470_INT_SPEED_ID
-     *           + L6470_ST_SLP_ID
-     *           + L6470_FN_SLP_ACC_ID
-     *           + L6470_FN_SLP_DEC_ID
-     *           + L6470_K_THERM_ID
-     *           + L6470_ADC_OUT_ID
-     *           + L6470_OCD_TH_ID
-     *           + L6470_STALL_TH_ID
-     *           + L6470_STEP_MODE_ID
-     *           + L6470_ALARM_EN_ID
-     *           + L6470_CONFIG_ID
-     *           + L6470_STATUS_ID
-     * @warning Some registers can only be written in particular conditions (see L6470's datasheet).
-     *          Any attempt to write one of those registers when the conditions are not satisfied
-     *          causes the command to be ignored and the NOTPERF_CMD flag to rise at the end of the
-     *          last argument byte. Any attempt to set an inexistent register (wrong address value)
-     *          causes the command to be ignored and the WRONG_CMD flag to rise.
-     *          For example, setting some parameters requires first to disable the power bridge;
-     *          this can be done through the SoftHiZ() method.
-     *          They are the following:
-     *           + L6470_ABS_POS_ID
-     *           + L6470_EL_POS_ID
-     *           + L6470_SPEED_ID
-     *           + L6470_ACC_ID
-     *           + L6470_DEC_ID
-     *           + L6470_MAX_SPEED_ID
-     *           + L6470_MIN_SPEED_ID
-     *           + L6470_INT_SPEED_ID
-     *           + L6470_ST_SLP_ID
-     *           + L6470_FN_SLP_ACC_ID
-     *           + L6470_FN_SLP_DEC_ID
-     *           + L6470_ADC_OUT_ID
-     *           + L6470_STEP_MODE_ID
-     *           + L6470_CONFIG_ID
-     *           + L6470_STATUS_ID
-     */
-    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();
-        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)
-    {
-        /*
-           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) 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) L6470_Step_s2_2_Acc((float) acceleration));
-        prepared_action = PREPARED_NO_ACTION;
-    }
-
-    /**
-     * @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_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), (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) 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) 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.
-     * @warning Setting the step-clock mode requires an explicit action by the user to first
-     *          disable the power bridge through the SoftHiZ() method.
-     * @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;
-    }
-
-    /**
-      * @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_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;
-    }
-
-    /**
-      * @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)
-    {
-        return L6470_PerformPreparedApplicationCommand();
-    }
-
-    /**
-      * @brief    Getting the prepared action.
-      * @param    None
-      * @retval   The prepared action.
-      */
-    prepared_action_t GetPreparedAction(void)
-    {
-        return prepared_action;
-    }
-
-    /**
-      * @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)
-    {
-        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));
-
-            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;
-        }
-    }
-
-
-    /*** Public Interrupt Related Methods ***/
-
-    /* ACTION 6 --------------------------------------------------------------*
-     * Implement here interrupt related methods, if any.                      *
-     * Note that interrupt handling is platform dependent, e.g.:              *
-     *   + mbed:                                                              *
-     *     InterruptIn feature_irq(pin);           //Interrupt object.        *
-     *     feature_irq.fall(callback);             //Attach a callback.       *
-     *     feature_irq.mode(PullNone);             //Set interrupt mode.      *
-     *     feature_irq.enable_irq();               //Enable interrupt.        *
-     *     feature_irq.disable_irq();              //Disable interrupt.       *
-     *   + Arduino:                                                           *
-     *     attachInterrupt(pin, callback, RISING); //Attach a callback.       *
-     *     detachInterrupt(pin);                   //Detach a callback.       *
-     *                                                                        *
-     * Example (mbed):                                                        *
-     *   void AttachFeatureIRQ(void (*fptr) (void))                           *
-     *   {                                                                    *
-     *     feature_irq.fall(fptr);                                            *
-     *   }                                                                    *
-     *                                                                        *
-     *   void EnableFeatureIRQ(void)                                          *
-     *   {                                                                    *
-     *     feature_irq.enable_irq();                                          *
-     *   }                                                                    *
-     *                                                                        *
-     *   void DisableFeatureIRQ(void)                                         *
-     *   {                                                                    *
-     *     feature_irq.disable_irq();                                         *
-     *   }                                                                    *
-     *------------------------------------------------------------------------*/
-    /**
-     * @brief  Attaching an interrupt handler to the FLAG interrupt.
-     * @param  fptr An interrupt handler.
-     * @retval None.
-     */
-    void AttachFlagIRQ(void (*fptr)(void))
-    {
-        flag_irq.fall(fptr);
-    }
-    
-    /**
-     * @brief  Enabling the FLAG interrupt handling.
-     * @param  None.
-     * @retval None.
-     */
-    void EnableFlagIRQ(void)
-    {
-        flag_irq.enable_irq();
-    }
-    
-    /**
-     * @brief  Disabling the FLAG interrupt handling.
-     * @param  None.
-     * @retval None.
-     */
-    void DisableFlagIRQ(void)
-    {
-        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.fall(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:
-
-    /*** Protected Component Related Methods ***/
-
-    /* ACTION 7 --------------------------------------------------------------*
-     * Declare here the component's specific methods.                         *
-     * They should be:                                                        *
-     *   + Methods with the same name of the C component's virtual table's    *
-     *     functions (1);                                                     *
-     *   + Methods with the same name of the C component's extended virtual   *
-     *     table's functions, if any (2);                                     *
-     *   + Helper methods, if any, like functions declared in the component's *
-     *     source files but not pointed by the component's virtual table (3). *
-     *                                                                        *
-     * Example:                                                               *
-     *   Status_t COMPONENT_GetValue(float *f);   //(1)                       *
-     *   Status_t COMPONENT_EnableFeature(void);  //(2)                       *
-     *   Status_t COMPONENT_ComputeAverage(void); //(3)                       *
-     *------------------------------------------------------------------------*/
-    int32_t  L6470_AbsPos_2_Position(uint32_t AbsPos);
-    uint32_t L6470_Position_2_AbsPos(int32_t Position);
-    float    L6470_Speed_2_Step_s(uint32_t Speed);
-    uint32_t L6470_Step_s_2_Speed(float Step_s);
-    float    L6470_Acc_2_Step_s2(uint16_t Acc);
-    uint16_t L6470_Step_s2_2_Acc(float Step_s2);
-    float    L6470_Dec_2_Step_s2(uint16_t Dec);
-    uint16_t L6470_Step_s2_2_Dec(float Step_s2);
-    float    L6470_MaxSpeed_2_Step_s(uint16_t MaxSpeed);
-    uint16_t L6470_Step_s_2_MaxSpeed(float Step_s);
-    float    L6470_MinSpeed_2_Step_s(uint16_t MinSpeed);
-    uint16_t L6470_Step_s_2_MinSpeed(float Step_s);
-    float    L6470_FsSpd_2_Step_s(uint16_t FsSpd);
-    uint16_t L6470_Step_s_2_FsSpd(float Step_s);
-    float    L6470_IntSpeed_2_Step_s(uint16_t IntSpeed);
-    uint16_t L6470_Step_s_2_IntSpeed(float Step_s);
-    float    L6470_StSlp_2_s_Step(uint8_t StSlp);
-    uint8_t  L6470_s_Step_2_StSlp(float s_Step);
-    float    L6470_FnSlpAcc_2_s_Step(uint8_t FnSlpAcc);
-    uint8_t  L6470_s_Step_2_FnSlpAcc(float s_Step);
-    float    L6470_FnSlpDec_2_s_Step(uint8_t FnSlpDec);
-    uint8_t  L6470_s_Step_2_FnSlpDec(float s_Step);
-    float    L6470_OcdTh_2_mA(uint8_t OcdTh);
-    uint8_t  L6470_mA_2_OcdTh(float mA);
-    float    L6470_StallTh_2_mA(uint8_t StallTh);
-    uint8_t  L6470_mA_2_StallTh(float mA);
-    Status_t L6470_Config(void *init);
-    void     L6470_SetParam(eL6470_RegId_t L6470_RegId, uint32_t Value);
-    uint32_t L6470_GetParam(eL6470_RegId_t L6470_RegId);
-    void     L6470_Run(eL6470_DirId_t L6470_DirId, uint32_t Speed);
-    void     L6470_StepClock(eL6470_DirId_t L6470_DirId);
-    void     L6470_Move(eL6470_DirId_t L6470_DirId, uint32_t N_Step);
-    void     L6470_GoTo(uint32_t AbsPos);
-    void     L6470_GoToDir(eL6470_DirId_t L6470_DirId, uint32_t AbsPos);
-    void     L6470_GoUntil(eL6470_ActId_t L6470_ActId, eL6470_DirId_t L6470_DirId, uint32_t Speed);
-    void     L6470_ReleaseSW(eL6470_ActId_t L6470_ActId, eL6470_DirId_t L6470_DirId);
-    void     L6470_GoHome(void);
-    void     L6470_GoMark(void);
-    void     L6470_ResetPos(void);
-    void     L6470_ResetDevice(void);
-    void     L6470_SoftStop(void);
-    void     L6470_HardStop(void);
-    void     L6470_SoftHiZ(void);
-    void     L6470_HardHiZ(void);
-    uint16_t L6470_GetStatus(void);
-    void     L6470_PrepareSetParam(eL6470_RegId_t L6470_RegId, uint32_t Value);
-    void     L6470_PrepareGetParam(eL6470_RegId_t L6470_RegId);
-    void     L6470_PrepareRun(eL6470_DirId_t L6470_DirId, uint32_t Speed);
-    void     L6470_PrepareStepClock(eL6470_DirId_t L6470_DirId);
-    void     L6470_PrepareMove(eL6470_DirId_t L6470_DirId, uint32_t N_Step);
-    void     L6470_PrepareGoTo(uint32_t AbsPos);
-    void     L6470_PrepareGoToDir(eL6470_DirId_t L6470_DirId, uint32_t AbsPos);
-    void     L6470_PrepareGoUntil(eL6470_ActId_t L6470_ActId, eL6470_DirId_t L6470_DirId, uint32_t Speed);
-    void     L6470_PrepareReleaseSW(eL6470_ActId_t L6470_ActId, eL6470_DirId_t L6470_DirId);
-    void     L6470_PrepareGoHome(void);
-    void     L6470_PrepareGoMark(void);
-    void     L6470_PrepareResetPos(void);
-    void     L6470_PrepareResetDevice(void);
-    void     L6470_PrepareSoftStop(void);
-    void     L6470_PrepareHardStop(void);
-    void     L6470_PrepareSoftHiZ(void);
-    void     L6470_PrepareHardHiZ(void);
-    void     L6470_PrepareGetStatus(void);
-    uint8_t* L6470_PerformPreparedApplicationCommand(void);
-    void     L6470_DaisyChainCommand(uint8_t* pL6470_DaisyChainSpiTxStruct, uint8_t* pL6470_DaisyChainSpiRxStruct);
-    uint32_t L6470_ExtractReturnedData(uint8_t* pL6470_DaisyChainSpiRxStruct, uint8_t LengthByte);
-    uint8_t  L6470_CheckStatusRegisterFlag(uint8_t L6470_StatusRegisterFlagId);
-    uint8_t* L6470_GetRegisterName(uint8_t id);
-    void     L6470_ResetAppCmdPkg(sL6470_AppCmdPkg_t* pL6470_AppCmdPkg);
-    void     L6470_FillAppCmdPkg(sL6470_AppCmdPkg_t* pL6470_AppCmdPkg, eL6470_AppCmdId_t L6470_AppCmdId, uint32_t p1, uint32_t p2, uint32_t p3);
-    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 ***/
-
-    /**
-     * @brief      Utility function to read data from L6470.
-     * @param[out] pBuffer pointer to the buffer to read data into.
-     * @param[in]  NumBytesToRead number of bytes to read.
-     * @retval     COMPONENT_OK in case of success, COMPONENT_ERROR otherwise.
-     */
-    Status_t Read(uint8_t* pBuffer, uint16_t NumBytesToRead)
-    {
-        if (dev_spi.spi_read(pBuffer, ssel, NumBytesToRead) != 0) {
-            return COMPONENT_ERROR;
-        }
-        return COMPONENT_OK;
-    }
-    
-    /**
-     * @brief      Utility function to write data to L6470.
-     * @param[in]  pBuffer pointer to the buffer of data to send.
-     * @param[in]  NumBytesToWrite number of bytes to write.
-     * @retval     COMPONENT_OK in case of success, COMPONENT_ERROR otherwise.
-     */
-    Status_t Write(uint8_t* pBuffer, uint16_t NumBytesToWrite)
-    {
-        if (dev_spi.spi_write(pBuffer, ssel, NumBytesToWrite) != 0) {
-            return COMPONENT_ERROR;
-        }
-        return COMPONENT_OK;
-    }
-
-    /**
-     * @brief      Utility function to read and write data from/to L6470 at the same time.
-     * @param[out] pBufferToRead pointer to the buffer to read data into.
-     * @param[in]  pBufferToWrite pointer to the buffer of data to send.
-     * @param[in]  NumBytes number of bytes to read and write.
-     * @retval     COMPONENT_OK in case of success, COMPONENT_ERROR otherwise.
-     */
-    Status_t ReadWrite(uint8_t* pBufferToRead, uint8_t* pBufferToWrite, uint16_t NumBytes)
-    {
-        if (dev_spi.spi_read_write(pBufferToRead, pBufferToWrite, ssel, NumBytes) != 0) {
-            return COMPONENT_ERROR;
-        }
-        return COMPONENT_OK;
-    }
-
-    /* ACTION 8 --------------------------------------------------------------*
-     * Implement here other I/O methods beyond those already implemented      *
-     * above, which are declared extern within the component's header file.   *
-     *------------------------------------------------------------------------*/
-    /*
-     * Puts the device in standby mode.
-     */
-    void L6470_ENABLE(void)
-    {
-        standby_reset = 1;
-    }
-
-    /*
-     * Puts the device in reset mode.
-     */
-    void L6470_DISABLE(void)
-    {
-        standby_reset = 0;
-    }
-
-    /*
-     * Write and read bytes to/from the component through the SPI at the same time.
-     */
-    void L6470_SPI_Communication(uint8_t *pTxData, uint8_t *pRxData, uint16_t Size, uint32_t Timeout)
-    {
-        ReadWrite(pRxData, pTxData, Size);
-    }
-
-
-    /*** Component's Instance Variables ***/
-
-    /* ACTION 9 --------------------------------------------------------------*
-     * Declare here interrupt related variables, if needed.                   *
-     * Note that interrupt handling is platform dependent, see                *
-     * "Interrupt Related Methods" above.                                     *
-     *                                                                        *
-     * Example:                                                               *
-     *   + mbed:                                                              *
-     *     InterruptIn feature_irq;                                           *
-     *------------------------------------------------------------------------*/
-    /* 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;
-
-    /* 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:                                                               *
-     *   float measure;                                                       *
-     *   int instance_id;                                                     *
-     *   static int number_of_instances;                                      *
-     *------------------------------------------------------------------------*/
-    /* Data. */
-    uint8_t L6470_Id;
-    const sL6470_Register_t *L6470_Register;
-    const sL6470_ApplicationCommand_t *L6470_ApplicationCommand;
-    const sL6470_Direction_t *L6470_Direction;
-    const sL6470_ACT_t *L6470_ACT;
-    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;
-    static const sL6470_Register_t _L6470_Register[L6470REGIDSIZE];
-    static const sL6470_ApplicationCommand_t _L6470_ApplicationCommand[L6470APPCMDIDSIZE];
-    static const sL6470_Direction_t _L6470_Direction[L6470DIRIDSIZE];
-    static const sL6470_ACT_t _L6470_ACT[L6470ACTIDSIZE];
-    static eFlagStatus_t L6470_DaisyChain_HalfPrepared;
-    static sL6470_AppCmdPkg_t L6470_AppCmdPkg[L6470DAISYCHAINSIZE];
-    static uint8_t L6470_DaisyChainSpiTxStruct[L6470MAXSPICMDBYTESIZE][L6470DAISYCHAINSIZE];
-    static uint8_t L6470_DaisyChainSpiRxStruct[L6470MAXSPICMDBYTESIZE][L6470DAISYCHAINSIZE];
-};
-
-#endif /* __L6470_CLASS_H */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/