Expansion SW library to control high power stepper motor(s) using IHM03A1 expansion board(s) with Powerstep01 driver.

Dependencies:   X_NUCLEO_COMMON ST_INTERFACES

Dependents:   IHM03A1_ExampleFor1Motor HelloWorld_IHM03A1 IHM03A1_ExampleFor3Motors KYPHOS_Stepper_Motor_Control

Fork of X_NUCLEO_IHM03A1 by ST Expansion SW Team

Motor Control Library

Library to handle the X-NUCLEO-IHM03A1 Motor Control Expansion Board based on the Powerstep01 component.

It features the:

  • read and write of Powerstep01 registers
  • Nucleo and expansion board configuration (GPIOs, PWMs, IRQs, etc.)
  • Powerstep01 application commands handling
  • FLAG and BUSY interrupt handling (alarm reporting)
  • Daisy chain handling

The API allows to easily:

  • perform various positioning, moves and stops
  • get/set or monitor the motor positions
  • set home position and mark another position
  • get/set minimum and maximum speed
  • get current speed
  • get/set acceleration and deceleration
  • get/set the step mode (up to 1/128)
  • get/set the control method
  • get/set parameters for voltage mode driving
  • get/set parameters for current mode driving
  • get/set parameters for gate driving
  • configure various protections such as overcurrent detection
  • enable/disable alarms
  • handle step-clock
  • get system status

Daisy-Chain Configuration

The IHM03A1 board can be stacked up to three times so that the Powerstep01 components will be connected in daisy-chain configuration. For this purpose, some resistors must be correctly connected on the boards as depicted here below:

/media/uploads/nucleosam/driving1steppermotor.png /media/uploads/nucleosam/driving2steppermotors.png /media/uploads/nucleosam/driving3steppermotors.png

Platform compatibility

Compatible platforms have been tested with the default configuration provided by the HelloWorld_IHM03A1 example.

Files at this revision

API Documentation at this revision

Comitter:
Davidroid
Date:
Fri Mar 24 10:24:39 2017 +0000
Parent:
4:f48e8d87553e
Child:
6:7af3838de91a
Commit message:
Typo fixed.

Changed in this revision

Components/PowerStep01/PowerStep01.cpp Show annotated file Show diff for this revision Revisions of this file
Components/PowerStep01/PowerStep01.h Show annotated file Show diff for this revision Revisions of this file
Components/PowerStep01/PowerStep01_config.h Show annotated file Show diff for this revision Revisions of this file
Components/PowerStep01/PowerStep01_def.h Show annotated file Show diff for this revision Revisions of this file
Components/powerstep01/PowerStep01.cpp Show diff for this revision Revisions of this file
Components/powerstep01/PowerStep01_config.h Show diff for this revision Revisions of this file
Components/powerstep01/PowerStep01_def.h Show diff for this revision Revisions of this file
Components/powerstep01/powerstep01.h Show diff for this revision Revisions of this file
X_NUCLEO_COMMON.lib Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Components/PowerStep01/PowerStep01.cpp	Fri Mar 24 10:24:39 2017 +0000
@@ -0,0 +1,1593 @@
+/**
+ ******************************************************************************
+ * @file    PowerStep01.cpp
+ * @author  IPC Rennes
+ * @version V1.0.0
+ * @date    March 18th, 2016
+ * @brief   Powerstep01 motor driver (Microstepping controller with power MOSFETs)
+ * @note    (C) COPYRIGHT 2016 STMicroelectronics
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT(c) 2016 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.
+ *
+ ******************************************************************************
+ */
+
+/* Includes ------------------------------------------------------------------*/
+#include "PowerStep01.h"
+
+/* Definitions ---------------------------------------------------------------*/
+
+/* Error of bad SPI transaction. */
+#define POWERSTEP01_ERROR_1        (POWERSTEP01_ERROR_BASE|0x0001)
+
+/* Variables  ----------------------------------------------------------------*/
+
+/* Number of devices. */
+uint8_t PowerStep01::numberOfDevices = 0;
+
+/* ISR flags used to restart an interrupted SPI transfer when an error is reported. */
+bool PowerStep01::spiPreemptionByIsr = FALSE;
+bool PowerStep01::isrFlag = FALSE;
+
+/* SPI Transmission for Daisy-Chain Configuration. */
+uint8_t PowerStep01::spiTxBursts[POWERSTEP01_CMD_ARG_MAX_NB_BYTES][MAX_NUMBER_OF_DEVICES];
+uint8_t PowerStep01::spiRxBursts[POWERSTEP01_CMD_ARG_MAX_NB_BYTES][MAX_NUMBER_OF_DEVICES];
+
+
+/* Methods -------------------------------------------------------------------*/
+
+/**********************************************************
+ * @brief Starts the Powerstep01 library
+ * @param[in] pInit pointer to the initialization data
+ * @retval COMPONENT_OK in case of success.
+ **********************************************************/
+status_t PowerStep01::Powerstep01_Init(void* pInit)
+{ 
+  
+  /* configure the step clock */
+  Powerstep01_Board_StepClockInit();
+  
+  /* Standby-reset deactivation */
+  Powerstep01_Board_ReleaseReset();
+  
+  /* Let a delay after reset */
+  Powerstep01_Board_Delay(1);
+
+  if (pInit == 0)
+  {
+    // Set all registers to their predefined values 
+    // from powerstep01_target_config.h 
+    Powerstep01_SetRegisterToPredefinedValues();
+  }
+  else
+  {
+    Powerstep01_SetDeviceParamsToGivenValues((powerstep01_init_u_t*) pInit);
+  }
+  
+  // Put the Powerstep01 in HiZ state
+  Powerstep01_CmdHardHiZ();
+  
+  Powerstep01_FetchAndClearAllStatus();
+
+  return COMPONENT_OK;
+}
+
+/**********************************************************
+ * @brief Read id
+ * @param[in] id pointer to the identifier to be read.
+ * @retval COMPONENT_OK in case of success.
+ **********************************************************/
+status_t PowerStep01::Powerstep01_ReadID(uint8_t *id)
+{
+  *id = deviceInstance;
+
+  return COMPONENT_OK;
+}
+
+/**********************************************************
+ * @brief  Attaches a user callback to the error Handler.
+ * The call back will be then called each time the library 
+ * detects an error
+ * @param[in] callback Name of the callback to attach 
+ * to the error Hanlder
+ * @retval None
+ **********************************************************/
+void PowerStep01::Powerstep01_AttachErrorHandler(void (*callback)(uint16_t error))
+{
+  errorHandlerCallback = (void (*)(uint16_t error)) callback;
+}
+
+/**********************************************************
+ * @brief  Issues the get_status command to the Powerstep01 device
+ * @retval Status Register value
+ * @note Once the get_status command is performed, the flags of the
+ * status register are reset. 
+ * This is not the case when the status register is read with the
+ * GetParam command (via the functions Powerstep01_ReadStatusRegister
+ * or Powerstep01_CmdGetParam).
+ **********************************************************/
+uint16_t PowerStep01::Powerstep01_CmdGetStatus(void)
+{
+  uint16_t status = 0;
+  uint32_t loop;
+  uint8_t spiIndex = numberOfDevices - deviceInstance - 1;
+  bool itDisable = FALSE;  
+ 
+  do
+  {
+    spiPreemptionByIsr = FALSE;
+    if (itDisable)
+    {
+      /* re-enable Powerstep01_Board_EnableIrq if disable in previous iteration */
+      Powerstep01_Board_EnableIrq();
+      itDisable = FALSE;
+    }    
+    for (loop = 0; loop < numberOfDevices; loop++)
+    {
+       spiTxBursts[0][loop] = POWERSTEP01_NOP;
+       spiTxBursts[1][loop] = POWERSTEP01_NOP;
+       spiTxBursts[2][loop] = POWERSTEP01_NOP;
+       spiTxBursts[3][loop] = POWERSTEP01_NOP;
+       spiRxBursts[0][loop] = 0;
+       spiRxBursts[1][loop] = 0;
+       spiRxBursts[2][loop] = 0;
+       spiRxBursts[3][loop] = 0;       
+    }
+    spiTxBursts[0][spiIndex] = POWERSTEP01_GET_STATUS;
+    /* Disable interruption before checking */
+    /* pre-emption by ISR and SPI transfers*/
+    Powerstep01_Board_DisableIrq();
+    itDisable = TRUE;
+  } while (spiPreemptionByIsr); // check pre-emption by ISR  
+  for (loop = 0; loop < POWERSTEP01_CMD_ARG_NB_BYTES_GET_STATUS + POWERSTEP01_RSP_NB_BYTES_GET_STATUS; loop++)
+  {
+     Powerstep01_WriteBytes(&spiTxBursts[loop][0], &spiRxBursts[loop][0]);
+  }
+  status = (spiRxBursts[1][spiIndex] << 8) | (spiRxBursts[2][spiIndex]);
+  /* re-enable Powerstep01_Board_EnableIrq after SPI transfers*/
+  Powerstep01_Board_EnableIrq();  
+
+  return (status);
+}
+
+/**********************************************************
+ * @brief  Requests the motor to move to the home position (ABS_POSITION = 0)
+ * @retval None
+ **********************************************************/
+void PowerStep01::Powerstep01_CmdGoHome(void)
+{
+  Powerstep01_SendCommand(POWERSTEP01_GO_HOME, 0);
+} 
+
+/**********************************************************
+ * @brief  Requests the motor to move to the mark position 
+ * @retval None
+ **********************************************************/
+void PowerStep01::Powerstep01_CmdGoMark(void)
+{
+    Powerstep01_SendCommand(POWERSTEP01_GO_MARK, 0); 
+}
+
+/**********************************************************
+ * @brief  Requests the motor to move to the specified position 
+ * @param[in] targetPosition absolute position in steps
+ * @retval None
+ **********************************************************/
+void PowerStep01::Powerstep01_CmdGoTo(int32_t targetPosition)
+{
+  Powerstep01_SendCommand(POWERSTEP01_GO_TO, targetPosition);
+}
+
+/******************************************************//**
+ * @brief Issues PowerStep01 Go To Dir command
+ * @param[in] direction movement direction
+ * @param[in] abs_pos absolute position where requested to move
+ * @retval None
+ *********************************************************/
+void PowerStep01::Powerstep01_CmdGoToDir(motorDir_t direction,
+                                         int32_t abs_pos)
+{
+  Powerstep01_SendCommand((uint8_t)POWERSTEP01_GO_TO_DIR|
+                          (uint8_t)direction, abs_pos);  
+}
+
+/******************************************************//**
+ * @brief Issues PowerStep01 Go Until command
+ * @param[in] action ACTION_RESET or ACTION_COPY
+ * @param[in] direction movement direction
+ * @param[in] speed in steps/tick
+ * @retval None
+ *********************************************************/
+void PowerStep01::Powerstep01_CmdGoUntil(motorAction_t action,
+                            motorDir_t direction,
+                            uint32_t speed)
+{
+  Powerstep01_SendCommand(
+    (uint8_t)POWERSTEP01_GO_UNTIL|(uint8_t)action|(uint8_t)direction,
+    speed);
+}
+
+/**********************************************************
+ * @brief Immediatly stops the motor and disable the power bridge
+ * @retval None
+ * @note The hard_hiz command immediately disables the power bridges
+ * (high impedance state) and raises the HiZ flag. 
+ * When the motor is stopped, a hard_hiz command forces the bridges 
+ * to enter high impedance state.
+ * This command can be given anytime and is immediately executed.
+ *********************************************************/
+void PowerStep01::Powerstep01_CmdHardHiZ(void)
+{
+  Powerstep01_SendCommand(POWERSTEP01_HARD_HIZ, 0);    
+}
+
+/**********************************************************
+ * @brief  Immediatly stops the motor and disable the power bridge
+ * @retval None
+ * @note The hard_stop command causes an immediate motor stop with
+ * infinite deceleration.
+ * When the motor is in high impedance state, a hard_stop command
+ * forces the bridges to exit high impedance state; no motion is performed.
+ * This command can be given anytime and is immediately executed.
+ * This command keeps the BUSY flag low until the motor is stopped.
+ **********************************************************/
+void PowerStep01::Powerstep01_CmdHardStop(void) 
+{
+  Powerstep01_SendCommand(POWERSTEP01_HARD_STOP, 0);
+}
+
+/**********************************************************
+ * @brief  Moves the motor of the specified number of steps
+ * @param[in] direction FORWARD or BACKWARD
+ * @param[in] stepCount Number of steps to perform
+ * @retval None
+ **********************************************************/
+void PowerStep01::Powerstep01_CmdMove(motorDir_t direction,
+                                      uint32_t stepCount)
+{
+  Powerstep01_SendCommand((uint8_t)POWERSTEP01_MOVE|(uint8_t)direction,
+    stepCount);
+}
+
+/**********************************************************
+ * @brief  Issues the Nop command to the Powerstep01 device
+ * @retval None
+ **********************************************************/
+void PowerStep01::Powerstep01_CmdNop(void)
+{
+  Powerstep01_SendCommand(POWERSTEP01_NOP, 0);
+}
+
+/******************************************************//**
+ * @brief Issues PowerStep01 Release SW command
+ * @param[in] action type of action to undertake when the SW
+ * input is forced high
+ * @param[in] direction movement direction
+ * @retval None
+ *********************************************************/
+void PowerStep01::Powerstep01_CmdReleaseSw(motorAction_t action,
+                                           motorDir_t direction)
+{
+   Powerstep01_SendCommand((uint8_t)POWERSTEP01_RELEASE_SW|
+                           (uint8_t)action|
+                           (uint8_t)direction,
+                           0);
+}
+
+/******************************************************//**
+ * @brief Issues PowerStep01 Reset Device command
+ * @param[in] deviceId (from 0 to MAX_NUMBER_OF_DEVICES-1 )
+ * @retval None
+ *********************************************************/
+void PowerStep01::Powerstep01_CmdResetDevice(void)
+{
+  Powerstep01_SendCommand(POWERSTEP01_RESET_DEVICE, 0);         
+}
+
+/******************************************************//**
+ * @brief Issues PowerStep01 Reset Pos command
+ * @param[in] deviceId (from 0 to MAX_NUMBER_OF_DEVICES-1 )
+ * @retval None
+ *********************************************************/
+void PowerStep01::Powerstep01_CmdResetPos(void)
+{
+  Powerstep01_SendCommand(POWERSTEP01_RESET_POS, 0);       
+}
+
+/**********************************************************
+ * @brief  Runs the motor. It will accelerate from the min 
+ * speed up to the max speed by using the device acceleration.
+ * @param[in] direction FORWARD or BACKWARD
+ * @param[in] speed in steps/s
+ * @retval None
+ **********************************************************/
+void PowerStep01::Powerstep01_CmdRun(motorDir_t direction, uint32_t speed)
+{
+  Powerstep01_SendCommand((uint8_t)POWERSTEP01_RUN|(uint8_t)direction, speed);
+}
+
+/**********************************************************
+ * @brief Stops the motor by using the device deceleration
+ * and disables the power bridges
+ * @retval None
+ * @note The soft_hiz 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.
+ * When bridges are disabled, the HiZ flag is raised.
+ * When the motor is stopped, a soft_hiz command forces the bridges
+ * to enter high impedance state.
+ * This command can be given anytime and is immediately executed.
+ * This command keeps the BUSY flag low until the motor is stopped.
+ *********************************************************/
+void PowerStep01::Powerstep01_CmdSoftHiZ(void)
+{
+  Powerstep01_SendCommand(POWERSTEP01_SOFT_HIZ, 0);           
+}
+
+/**********************************************************
+ * @brief  Stops the motor by using the device deceleration
+ * @retval None
+ * @note The soft_stop 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.
+ * When the motor is in high impedance state, a soft_stop
+ * command forces the bridges to exit from high impedance state.
+ * No motion is performed.
+ * This command can be given anytime and is immediately executed.
+ * This command keeps the BUSY flag low until the motor is stopped.
+ **********************************************************/
+void PowerStep01::Powerstep01_CmdSoftStop(void)
+{   
+  Powerstep01_SendCommand(POWERSTEP01_SOFT_STOP, 0);
+}
+
+/******************************************************//**
+ * @brief Issues PowerStep01 Step Clock command
+ * @param[in] direction Movement direction (FORWARD, BACKWARD)
+ * @retval None
+ *********************************************************/
+void PowerStep01::Powerstep01_CmdStepClock(motorDir_t direction)
+{
+  Powerstep01_SendCommand((uint8_t)POWERSTEP01_STEP_CLOCK|(uint8_t)direction,
+                          0);  
+}
+
+/**********************************************************
+ * @brief Error handler which calls the user callback (if defined)
+ * @param[in] error Number of the error
+ * @retval None
+ **********************************************************/
+void PowerStep01::Powerstep01_ErrorHandler(uint16_t error)
+{
+  if (errorHandlerCallback != 0)
+  {
+    (void) errorHandlerCallback(error);
+  }
+  else   
+  {
+    /* Aborting the program. */
+    exit(EXIT_FAILURE);
+  }
+}
+
+/******************************************************//**
+ * @brief Fetch and clear status flags of all devices 
+ * by issuing a GET_STATUS command simultaneously  
+ * to all devices.
+ * Then, the fetched status of each device can be retrieved
+ * by using the Powerstep01_GetFetchedStatus function
+ * provided there is no other calls to functions which 
+ * use the SPI in between.
+ * @retval None
+ *********************************************************/
+void PowerStep01::Powerstep01_FetchAndClearAllStatus(void)
+{
+  uint8_t loop;
+
+  for (loop = 0; loop < numberOfDevices; loop++)
+  {
+     spiTxBursts[0][loop] = POWERSTEP01_GET_STATUS;
+     spiTxBursts[1][loop] = POWERSTEP01_NOP;
+     spiTxBursts[2][loop] = POWERSTEP01_NOP;
+     spiTxBursts[3][loop] = POWERSTEP01_NOP;
+     spiRxBursts[0][loop] = 0;
+     spiRxBursts[1][loop] = 0;
+     spiRxBursts[2][loop] = 0;
+     spiRxBursts[3][loop] = 0;
+  }
+  for (loop = 0; 
+       loop < POWERSTEP01_CMD_ARG_NB_BYTES_GET_STATUS + 
+              POWERSTEP01_RSP_NB_BYTES_GET_STATUS; 
+       loop++)
+  {
+     Powerstep01_WriteBytes(&spiTxBursts[loop][0], &spiRxBursts[loop][0]);
+  }
+}
+
+/******************************************************//**
+ * @brief Get the value of the STATUS register which was 
+ * fetched by using Powerstep01_FetchAndClearAllStatus.
+ * The fetched values are available  as long as there
+ * no other calls to functions which use the SPI.
+ * @retval Last fetched value of the STATUS register
+ *********************************************************/
+uint16_t PowerStep01::Powerstep01_GetFetchedStatus(void)
+{
+  uint16_t status = 0;
+  if (numberOfDevices > deviceInstance)
+  {
+    uint8_t spiIndex = numberOfDevices - deviceInstance - 1;
+    status = (spiRxBursts[1][spiIndex] << 8) | (spiRxBursts[2][spiIndex]);
+  }
+  return (status);
+}
+
+/**********************************************************
+ * @brief Returns the FW version of the library
+ * @retval POWERSTEP01_FW_VERSION
+ **********************************************************/
+uint32_t PowerStep01::Powerstep01_GetFwVersion(void)
+{
+  return (POWERSTEP01_FW_VERSION);
+}
+
+/**********************************************************
+ * @brief  Returns the mark position  device
+ * @retval Mark register value converted in a 32b signed integer 
+ **********************************************************/
+int32_t PowerStep01::Powerstep01_GetMark(void)
+{
+  return Powerstep01_ConvertPosition(Powerstep01_CmdGetParam(POWERSTEP01_MARK));
+}
+
+/**********************************************************
+ * @brief  Returns the ABS_POSITION device
+ * @retval ABS_POSITION register value converted in a 32b signed integer
+ **********************************************************/
+int32_t PowerStep01::Powerstep01_GetPosition(void)
+{
+  return Powerstep01_ConvertPosition(
+    Powerstep01_CmdGetParam(POWERSTEP01_ABS_POS));
+}
+
+/**********************************************************
+ * @brief Checks if the device is busy
+ * by reading the Busy flag bit of its status Register
+ * This operation clears the status register
+ * @retval true if device is busy, false zero
+ *********************************************************/
+bool PowerStep01::Powerstep01_IsDeviceBusy(void)
+{
+  if(!(Powerstep01_CmdGetStatus() & POWERSTEP01_STATUS_BUSY)) 
+  {
+    return TRUE;
+  }
+  else 
+  {
+    return FALSE;
+  }
+}
+
+/**********************************************************
+ * @brief  Reads the Status Register value
+ * @retval Status register value
+ * @note The status register flags are not cleared 
+ * at the difference with Powerstep01_CmdGetStatus()
+ **********************************************************/
+uint16_t PowerStep01::Powerstep01_ReadStatusRegister(void)
+{
+  return (Powerstep01_CmdGetParam(POWERSTEP01_STATUS));
+}
+
+/**********************************************************
+ * @brief  Set the stepping mode 
+ * @param[in] stepMode from full step to 1/128 microstep
+ * as specified in enum motorStepMode_t
+ * @retval None
+ **********************************************************/
+bool PowerStep01::Powerstep01_SelectStepMode(motorStepMode_t stepMode)
+{
+  uint8_t stepModeRegister;
+  powerstep01_StepSel_t powerstep01StepMode;
+
+  switch (stepMode)
+  {
+    case STEP_MODE_FULL:
+      powerstep01StepMode = POWERSTEP01_STEP_SEL_1;
+      break;
+    case STEP_MODE_HALF:
+      powerstep01StepMode = POWERSTEP01_STEP_SEL_1_2;
+      break;    
+    case STEP_MODE_1_4:
+      powerstep01StepMode = POWERSTEP01_STEP_SEL_1_4;
+      break;        
+    case STEP_MODE_1_8:
+      powerstep01StepMode = POWERSTEP01_STEP_SEL_1_8;
+      break;
+    case STEP_MODE_1_16:
+      powerstep01StepMode = POWERSTEP01_STEP_SEL_1_16;
+      break;        
+    case STEP_MODE_1_32:
+      powerstep01StepMode = POWERSTEP01_STEP_SEL_1_32;
+      break;
+    case STEP_MODE_1_64:
+      powerstep01StepMode = POWERSTEP01_STEP_SEL_1_64;
+      break;
+    case STEP_MODE_1_128:
+      powerstep01StepMode = POWERSTEP01_STEP_SEL_1_128;
+      break;
+    default:
+      return false;
+  }
+  
+  /* Set the powerstep01 in HiZ state */
+  Powerstep01_CmdHardHiZ();  
+  
+  /* Read Step mode register and clear STEP_SEL field */
+  stepModeRegister = (uint8_t)(0xF8 & Powerstep01_CmdGetParam(POWERSTEP01_STEP_MODE)) ;
+  
+  /* Apply new step mode */
+  Powerstep01_CmdSetParam(POWERSTEP01_STEP_MODE, stepModeRegister | (uint8_t)powerstep01StepMode);
+
+  /* Reset abs pos register */
+  Powerstep01_CmdResetPos();
+
+  return true;
+}
+
+/**********************************************************
+ * @brief  Set current position to be the Home position (ABS pos set to 0)
+ * @retval None
+ **********************************************************/
+void PowerStep01::Powerstep01_SetHome(void)
+{
+  Powerstep01_CmdSetParam(POWERSTEP01_ABS_POS, 0);
+}
+
+/**********************************************************
+ * @brief  Sets current position to be the Mark position 
+ * @retval None
+ **********************************************************/
+void PowerStep01::Powerstep01_SetMark(void)
+{
+  Powerstep01_CmdSetParam(POWERSTEP01_MARK,
+    Powerstep01_CmdGetParam(POWERSTEP01_ABS_POS));
+}                                                  
+
+/**********************************************************
+ * @brief  Locks until the device state becomes Inactive
+ * @retval None
+ **********************************************************/
+void PowerStep01::Powerstep01_WaitWhileActive(void)
+{
+  /* Wait while motor is running */
+  while (Powerstep01_IsDeviceBusy() != 0);
+}
+
+/**
+ * @brief To and from register parameter conversion functions
+ */
+
+/**********************************************************
+ * @brief  Converts the ABS_POSITION register value to a 32b signed integer
+ * @param[in] abs_position_reg value of the ABS_POSITION register
+ * @retval operation_result 32b signed integer corresponding to the absolute position 
+ **********************************************************/
+int32_t PowerStep01::Powerstep01_ConvertPosition(uint32_t abs_position_reg)
+{
+  int32_t operation_result;
+
+  if (abs_position_reg & POWERSTEP01_ABS_POS_SIGN_BIT_MASK) 
+  {
+    /* Negative register value */
+    abs_position_reg = ~abs_position_reg;
+    abs_position_reg += 1;
+
+    operation_result = (int32_t) (abs_position_reg & POWERSTEP01_ABS_POS_VALUE_MASK);
+    operation_result = -operation_result;
+  } 
+  else 
+  {
+    operation_result = (int32_t) abs_position_reg;
+  }
+  return operation_result;
+}
+
+/**
+ * @brief Functions to initialize the registers
+ */
+
+/**********************************************************
+ * @brief Set the parameters of the device to values of initPrm structure
+ * @param[in] initPrm structure containing values to initialize the device
+ * parameters
+ * @retval None.
+ **********************************************************/
+void PowerStep01::Powerstep01_SetDeviceParamsToGivenValues(
+  powerstep01_init_u_t *initPrm)
+{
+  Powerstep01_CmdSetParam(POWERSTEP01_ABS_POS, 0);
+  Powerstep01_CmdSetParam(POWERSTEP01_EL_POS, 0);
+  Powerstep01_CmdSetParam(POWERSTEP01_MARK, 0);
+  Powerstep01_CmdSetParam(POWERSTEP01_ACC,
+    acc_dec_steps_s2_to_reg_val(initPrm->cm.cp.acceleration));
+  Powerstep01_CmdSetParam(POWERSTEP01_DEC,
+    acc_dec_steps_s2_to_reg_val(initPrm->cm.cp.deceleration));
+  Powerstep01_CmdSetParam(POWERSTEP01_MAX_SPEED,
+    max_spd_steps_s_to_reg_val(initPrm->cm.cp.maxSpeed));
+  Powerstep01_CmdSetParam(POWERSTEP01_MIN_SPEED,
+    initPrm->cm.cp.lowSpeedOptimization|
+    max_spd_steps_s_to_reg_val(initPrm->cm.cp.minSpeed));
+  Powerstep01_CmdSetParam(POWERSTEP01_FS_SPD,
+    initPrm->cm.cp.boostMode|
+    fs_spd_steps_s_to_reg_val(initPrm->cm.cp.fullStepSpeed));
+  Powerstep01_CmdSetParam(POWERSTEP01_OCD_TH,
+    stall_ocd_th_to_reg_val(initPrm->cm.cp.ocdThreshold));
+  Powerstep01_CmdSetParam(POWERSTEP01_STEP_MODE,
+    (uint8_t)initPrm->cm.cp.syncClockSelection|
+    (uint8_t)initPrm->cm.cp.cmVmSelection|
+    (uint8_t)(uint8_t)initPrm->cm.cp.stepMode);
+  Powerstep01_CmdSetParam(POWERSTEP01_ALARM_EN,
+    initPrm->cm.cp.alarmsSelection);
+  Powerstep01_CmdSetParam(POWERSTEP01_GATECFG1,
+    (uint16_t)initPrm->cm.cp.iGate|
+    (uint16_t)initPrm->cm.cp.tcc|
+    (uint16_t)initPrm->cm.cp.tBoost|
+    (uint16_t)initPrm->cm.cp.wdEn);
+  Powerstep01_CmdSetParam(POWERSTEP01_GATECFG2,
+    (uint16_t)initPrm->cm.cp.tBlank|
+    (uint16_t)initPrm->cm.cp.tdt);  
+  if (initPrm->cm.cp.cmVmSelection == POWERSTEP01_CM_VM_VOLTAGE)
+  {
+    //Voltage mode
+    Powerstep01_CmdSetParam(POWERSTEP01_INT_SPD,
+      int_spd_steps_s_to_reg_val(
+        initPrm->vm.intersectSpeed));
+    Powerstep01_CmdSetParam(POWERSTEP01_K_THERM,
+      k_therm_comp_to_reg_val(
+        initPrm->vm.thermalCompensationFactor)); 
+    Powerstep01_CmdSetParam(POWERSTEP01_STALL_TH,
+      stall_ocd_th_to_reg_val(
+        initPrm->vm.stallThreshold));
+    Powerstep01_CmdSetParam(POWERSTEP01_KVAL_HOLD,
+      k_val_perc_to_reg_val(
+        initPrm->vm.kvalHold));
+    Powerstep01_CmdSetParam(POWERSTEP01_KVAL_RUN,
+      k_val_perc_to_reg_val(
+        initPrm->vm.kvalRun));
+    Powerstep01_CmdSetParam(POWERSTEP01_KVAL_ACC,
+      k_val_perc_to_reg_val(
+        initPrm->vm.kvalAcc));
+    Powerstep01_CmdSetParam(POWERSTEP01_KVAL_DEC,
+      k_val_perc_to_reg_val(
+        initPrm->vm.kvalDec));
+    Powerstep01_CmdSetParam(POWERSTEP01_ST_SLP,
+      bemf_slope_perc_to_reg_val(
+        initPrm->vm.startSlope));
+    Powerstep01_CmdSetParam(POWERSTEP01_FN_SLP_ACC,
+      bemf_slope_perc_to_reg_val(
+        initPrm->vm.accelerationFinalSlope));
+    Powerstep01_CmdSetParam(POWERSTEP01_FN_SLP_DEC,
+      bemf_slope_perc_to_reg_val(
+        initPrm->vm.decelerationFinalSlope));
+    Powerstep01_CmdSetParam(POWERSTEP01_CONFIG,
+      (uint16_t)initPrm->vm.oscClkSel| 
+      (uint16_t)initPrm->vm.swMode | 
+      (uint16_t)initPrm->vm.enVsComp| 
+      (uint16_t)initPrm->vm.ocSd| 
+      (uint16_t)initPrm->vm.uvloVal| 
+      (uint16_t)initPrm->vm.vccVal| 
+      (uint16_t)initPrm->vm.fPwmInt| 
+      (uint16_t)initPrm->vm.fPwmDec);
+  }
+  else
+  {
+    // Current mode
+        Powerstep01_CmdSetParam(POWERSTEP01_TVAL_HOLD,
+          t_val_ref_voltage_to_reg_val(
+            initPrm->cm.tvalHold));
+        Powerstep01_CmdSetParam(POWERSTEP01_TVAL_RUN,
+          t_val_ref_voltage_to_reg_val(
+            initPrm->cm.tvalRun));
+        Powerstep01_CmdSetParam(POWERSTEP01_TVAL_ACC,
+          t_val_ref_voltage_to_reg_val(
+            initPrm->cm.tvalAcc));
+        Powerstep01_CmdSetParam(POWERSTEP01_TVAL_DEC,
+          t_val_ref_voltage_to_reg_val(
+            initPrm->cm.tvalDec));
+        Powerstep01_CmdSetParam(POWERSTEP01_T_FAST,
+          (uint8_t)initPrm->cm.toffFast|
+          (uint8_t)initPrm->cm.fastStep);
+        Powerstep01_CmdSetParam(POWERSTEP01_TON_MIN,
+          t_min_time_to_reg_val(
+            initPrm->cm.tonMin));
+        Powerstep01_CmdSetParam(POWERSTEP01_TOFF_MIN,
+          t_min_time_to_reg_val(
+            initPrm->cm.toffMin));       
+        Powerstep01_CmdSetParam(POWERSTEP01_CONFIG,
+          (uint16_t)initPrm->cm.oscClkSel| 
+          (uint16_t)initPrm->cm.swMode| 
+          (uint16_t)initPrm->cm.tqReg| 
+          (uint16_t)initPrm->cm.ocSd| 
+          (uint16_t)initPrm->cm.uvloVal| 
+          (uint16_t)initPrm->cm.vccVal|
+          (uint16_t)initPrm->cm.tsw|
+          (uint16_t)initPrm->cm.predEn);
+  }
+}
+
+/**********************************************************
+ * @brief Sets the registers of the Powerstep01 to their predefined values 
+ * from powerstep01_target_config.h
+ * @retval None
+ **********************************************************/
+void PowerStep01::Powerstep01_SetRegisterToPredefinedValues(void)
+{
+  powerstep01_CmVm_t cmVm;
+  
+  Powerstep01_CmdSetParam(
+    POWERSTEP01_ABS_POS,
+    0);
+  Powerstep01_CmdSetParam(
+    POWERSTEP01_EL_POS,
+    0);
+  Powerstep01_CmdSetParam(
+    POWERSTEP01_MARK,
+    0);
+  switch (deviceInstance)
+  {
+    case 0:
+      cmVm = POWERSTEP01_CONF_PARAM_CM_VM_DEVICE_0;
+      Powerstep01_CmdSetParam(POWERSTEP01_ACC,
+        acc_dec_steps_s2_to_reg_val(
+          POWERSTEP01_CONF_PARAM_ACC_DEVICE_0));
+      Powerstep01_CmdSetParam(POWERSTEP01_DEC,
+        acc_dec_steps_s2_to_reg_val(
+          POWERSTEP01_CONF_PARAM_DEC_DEVICE_0));
+      Powerstep01_CmdSetParam(POWERSTEP01_MAX_SPEED,
+        max_spd_steps_s_to_reg_val(
+          POWERSTEP01_CONF_PARAM_MAX_SPEED_DEVICE_0));
+      Powerstep01_CmdSetParam(POWERSTEP01_MIN_SPEED,
+        POWERSTEP01_CONF_PARAM_LSPD_BIT_DEVICE_0|
+        min_spd_steps_s_to_reg_val(
+          POWERSTEP01_CONF_PARAM_MIN_SPEED_DEVICE_0));
+      Powerstep01_CmdSetParam(POWERSTEP01_FS_SPD,
+        POWERSTEP01_CONF_PARAM_BOOST_MODE_DEVICE_0|
+        fs_spd_steps_s_to_reg_val(
+          POWERSTEP01_CONF_PARAM_FS_SPD_DEVICE_0)); 
+      Powerstep01_CmdSetParam(POWERSTEP01_OCD_TH,
+        (uint8_t)POWERSTEP01_CONF_PARAM_OCD_TH_DEVICE_0);
+      Powerstep01_CmdSetParam(POWERSTEP01_STEP_MODE,
+        (uint8_t)POWERSTEP01_CONF_PARAM_SYNC_MODE_DEVICE_0 |
+        (uint8_t)POWERSTEP01_CONF_PARAM_CM_VM_DEVICE_0|
+        (uint8_t)POWERSTEP01_CONF_PARAM_STEP_MODE_DEVICE_0);
+      Powerstep01_CmdSetParam(POWERSTEP01_ALARM_EN,
+        POWERSTEP01_CONF_PARAM_ALARM_EN_DEVICE_0);
+      Powerstep01_CmdSetParam(POWERSTEP01_GATECFG1,
+        (uint16_t)POWERSTEP01_CONF_PARAM_IGATE_DEVICE_0 | 
+        (uint16_t)POWERSTEP01_CONF_PARAM_TCC_DEVICE_0   | 
+        (uint16_t)POWERSTEP01_CONF_PARAM_TBOOST_DEVICE_0|
+        (uint16_t)POWERSTEP01_CONF_PARAM_WD_EN_DEVICE_0);
+      Powerstep01_CmdSetParam(POWERSTEP01_GATECFG2,
+        (uint16_t)POWERSTEP01_CONF_PARAM_TBLANK_DEVICE_0 | 
+        (uint16_t)POWERSTEP01_CONF_PARAM_TDT_DEVICE_0);
+      // Voltage mode
+      if (cmVm == POWERSTEP01_CM_VM_VOLTAGE)
+      {
+        Powerstep01_CmdSetParam(POWERSTEP01_INT_SPD,
+          int_spd_steps_s_to_reg_val(
+            POWERSTEP01_CONF_PARAM_INT_SPD_DEVICE_0));
+        Powerstep01_CmdSetParam(POWERSTEP01_K_THERM,
+          k_therm_comp_to_reg_val(
+            POWERSTEP01_CONF_PARAM_K_THERM_DEVICE_0));
+        Powerstep01_CmdSetParam(POWERSTEP01_STALL_TH,
+          stall_ocd_th_to_reg_val(
+            POWERSTEP01_CONF_PARAM_STALL_TH_DEVICE_0));
+        Powerstep01_CmdSetParam(POWERSTEP01_KVAL_HOLD,
+          k_val_perc_to_reg_val(
+            POWERSTEP01_CONF_PARAM_KVAL_HOLD_DEVICE_0));
+        Powerstep01_CmdSetParam(POWERSTEP01_KVAL_RUN,
+          k_val_perc_to_reg_val(
+            POWERSTEP01_CONF_PARAM_KVAL_RUN_DEVICE_0));
+        Powerstep01_CmdSetParam(POWERSTEP01_KVAL_ACC,
+          k_val_perc_to_reg_val(
+            POWERSTEP01_CONF_PARAM_KVAL_ACC_DEVICE_0));
+        Powerstep01_CmdSetParam(POWERSTEP01_KVAL_DEC,
+          k_val_perc_to_reg_val(
+            POWERSTEP01_CONF_PARAM_KVAL_DEC_DEVICE_0));
+        Powerstep01_CmdSetParam(POWERSTEP01_ST_SLP,
+          bemf_slope_perc_to_reg_val(
+            POWERSTEP01_CONF_PARAM_ST_SLP_DEVICE_0));
+        Powerstep01_CmdSetParam(POWERSTEP01_FN_SLP_ACC,
+          bemf_slope_perc_to_reg_val(
+            POWERSTEP01_CONF_PARAM_FN_SLP_ACC_DEVICE_0));  
+        Powerstep01_CmdSetParam(POWERSTEP01_FN_SLP_DEC,
+          bemf_slope_perc_to_reg_val(
+            POWERSTEP01_CONF_PARAM_FN_SLP_DEC_DEVICE_0));
+        Powerstep01_CmdSetParam(POWERSTEP01_CONFIG,
+          (uint16_t)POWERSTEP01_CONF_PARAM_CLOCK_SETTING_DEVICE_0 | 
+          (uint16_t)POWERSTEP01_CONF_PARAM_SW_MODE_DEVICE_0       | 
+          (uint16_t)POWERSTEP01_CONF_PARAM_VS_COMP_DEVICE_0       | 
+          (uint16_t)POWERSTEP01_CONF_PARAM_OC_SD_DEVICE_0         | 
+          (uint16_t)POWERSTEP01_CONF_PARAM_UVLOVAL_DEVICE_0       | 
+          (uint16_t)POWERSTEP01_CONF_PARAM_VCCVAL_DEVICE_0        | 
+          (uint16_t)POWERSTEP01_CONF_PARAM_PWM_DIV_DEVICE_0       | 
+          (uint16_t)POWERSTEP01_CONF_PARAM_PWM_MUL_DEVICE_0);
+      }
+      else
+      {
+        // Current mode
+        Powerstep01_CmdSetParam(POWERSTEP01_TVAL_HOLD,
+          t_val_ref_voltage_to_reg_val(
+            POWERSTEP01_CONF_PARAM_TVAL_HOLD_DEVICE_0));
+        Powerstep01_CmdSetParam(POWERSTEP01_TVAL_RUN,
+          t_val_ref_voltage_to_reg_val(
+            POWERSTEP01_CONF_PARAM_TVAL_RUN_DEVICE_0));
+        Powerstep01_CmdSetParam(POWERSTEP01_TVAL_ACC,
+          t_val_ref_voltage_to_reg_val(
+            POWERSTEP01_CONF_PARAM_TVAL_ACC_DEVICE_0));
+        Powerstep01_CmdSetParam(POWERSTEP01_TVAL_DEC,
+          t_val_ref_voltage_to_reg_val(
+            POWERSTEP01_CONF_PARAM_TVAL_DEC_DEVICE_0));
+        Powerstep01_CmdSetParam(POWERSTEP01_T_FAST,
+          (uint8_t)POWERSTEP01_CONF_PARAM_TOFF_FAST_DEVICE_0 |
+          (uint8_t)POWERSTEP01_CONF_PARAM_FAST_STEP_DEVICE_0);
+        Powerstep01_CmdSetParam(POWERSTEP01_TON_MIN,
+          t_min_time_to_reg_val(
+            POWERSTEP01_CONF_PARAM_TON_MIN_DEVICE_0));
+        Powerstep01_CmdSetParam(POWERSTEP01_TOFF_MIN,
+          t_min_time_to_reg_val(
+            POWERSTEP01_CONF_PARAM_TOFF_MIN_DEVICE_0));
+        Powerstep01_CmdSetParam(POWERSTEP01_CONFIG,
+          (uint16_t)POWERSTEP01_CONF_PARAM_CLOCK_SETTING_DEVICE_0 | 
+          (uint16_t)POWERSTEP01_CONF_PARAM_SW_MODE_DEVICE_0       | 
+          (uint16_t)POWERSTEP01_CONF_PARAM_TQ_REG_DEVICE_0        | 
+          (uint16_t)POWERSTEP01_CONF_PARAM_OC_SD_DEVICE_0         | 
+          (uint16_t)POWERSTEP01_CONF_PARAM_UVLOVAL_DEVICE_0       | 
+          (uint16_t)POWERSTEP01_CONF_PARAM_VCCVAL_DEVICE_0        | 
+          (uint16_t)POWERSTEP01_CONF_PARAM_TSW_DEVICE_0           |
+          (uint16_t)POWERSTEP01_CONF_PARAM_PRED_DEVICE_0);          
+      }
+      break;
+#if (MAX_NUMBER_OF_DEVICES > 1)
+   case 1:
+      cmVm = POWERSTEP01_CONF_PARAM_CM_VM_DEVICE_1;
+      Powerstep01_CmdSetParam(POWERSTEP01_ACC,
+        acc_dec_steps_s2_to_reg_val(
+          POWERSTEP01_CONF_PARAM_ACC_DEVICE_1));
+      Powerstep01_CmdSetParam(POWERSTEP01_DEC,
+        acc_dec_steps_s2_to_reg_val(
+          POWERSTEP01_CONF_PARAM_DEC_DEVICE_1));
+      Powerstep01_CmdSetParam(POWERSTEP01_MAX_SPEED,
+        max_spd_steps_s_to_reg_val(
+          POWERSTEP01_CONF_PARAM_MAX_SPEED_DEVICE_1));
+      Powerstep01_CmdSetParam(POWERSTEP01_MIN_SPEED,
+        POWERSTEP01_CONF_PARAM_LSPD_BIT_DEVICE_1|
+        min_spd_steps_s_to_reg_val(
+          POWERSTEP01_CONF_PARAM_MIN_SPEED_DEVICE_1));
+      Powerstep01_CmdSetParam(POWERSTEP01_FS_SPD,
+        POWERSTEP01_CONF_PARAM_BOOST_MODE_DEVICE_1|
+        fs_spd_steps_s_to_reg_val(
+          POWERSTEP01_CONF_PARAM_FS_SPD_DEVICE_1)); 
+      Powerstep01_CmdSetParam(POWERSTEP01_OCD_TH,
+        (uint8_t)POWERSTEP01_CONF_PARAM_OCD_TH_DEVICE_1);
+      Powerstep01_CmdSetParam(POWERSTEP01_STEP_MODE,
+        (uint8_t)POWERSTEP01_CONF_PARAM_SYNC_MODE_DEVICE_1 |
+        (uint8_t)POWERSTEP01_CONF_PARAM_CM_VM_DEVICE_1|
+        (uint8_t)POWERSTEP01_CONF_PARAM_STEP_MODE_DEVICE_1);
+      Powerstep01_CmdSetParam(POWERSTEP01_ALARM_EN,
+        POWERSTEP01_CONF_PARAM_ALARM_EN_DEVICE_1);
+      Powerstep01_CmdSetParam(POWERSTEP01_GATECFG1,
+        (uint16_t)POWERSTEP01_CONF_PARAM_IGATE_DEVICE_1 | 
+        (uint16_t)POWERSTEP01_CONF_PARAM_TCC_DEVICE_1   | 
+        (uint16_t)POWERSTEP01_CONF_PARAM_TBOOST_DEVICE_1|
+        (uint16_t)POWERSTEP01_CONF_PARAM_WD_EN_DEVICE_1);
+      Powerstep01_CmdSetParam(POWERSTEP01_GATECFG2,
+        (uint16_t)POWERSTEP01_CONF_PARAM_TBLANK_DEVICE_1 | 
+        (uint16_t)POWERSTEP01_CONF_PARAM_TDT_DEVICE_1);
+      // Voltage mode
+      if (cmVm == POWERSTEP01_CM_VM_VOLTAGE)
+      {
+        Powerstep01_CmdSetParam(POWERSTEP01_INT_SPD,
+          int_spd_steps_s_to_reg_val(
+            POWERSTEP01_CONF_PARAM_INT_SPD_DEVICE_1));
+        Powerstep01_CmdSetParam(POWERSTEP01_K_THERM,
+          k_therm_comp_to_reg_val(
+            POWERSTEP01_CONF_PARAM_K_THERM_DEVICE_1));
+        Powerstep01_CmdSetParam(POWERSTEP01_STALL_TH,
+          stall_ocd_th_to_reg_val(
+            POWERSTEP01_CONF_PARAM_STALL_TH_DEVICE_1));
+        Powerstep01_CmdSetParam(POWERSTEP01_KVAL_HOLD,
+          k_val_perc_to_reg_val(
+            POWERSTEP01_CONF_PARAM_KVAL_HOLD_DEVICE_1));
+        Powerstep01_CmdSetParam(POWERSTEP01_KVAL_RUN,
+          k_val_perc_to_reg_val(
+            POWERSTEP01_CONF_PARAM_KVAL_RUN_DEVICE_1));
+        Powerstep01_CmdSetParam(POWERSTEP01_KVAL_ACC,
+          k_val_perc_to_reg_val(
+            POWERSTEP01_CONF_PARAM_KVAL_ACC_DEVICE_1));
+        Powerstep01_CmdSetParam(POWERSTEP01_KVAL_DEC,
+          k_val_perc_to_reg_val(
+            POWERSTEP01_CONF_PARAM_KVAL_DEC_DEVICE_1));
+        Powerstep01_CmdSetParam(POWERSTEP01_ST_SLP,
+          bemf_slope_perc_to_reg_val(
+            POWERSTEP01_CONF_PARAM_ST_SLP_DEVICE_1));
+        Powerstep01_CmdSetParam(POWERSTEP01_FN_SLP_ACC,
+          bemf_slope_perc_to_reg_val(
+            POWERSTEP01_CONF_PARAM_FN_SLP_ACC_DEVICE_1));  
+        Powerstep01_CmdSetParam(POWERSTEP01_FN_SLP_DEC,
+          bemf_slope_perc_to_reg_val(
+            POWERSTEP01_CONF_PARAM_FN_SLP_DEC_DEVICE_1));
+        Powerstep01_CmdSetParam(POWERSTEP01_CONFIG,
+          (uint16_t)POWERSTEP01_CONF_PARAM_CLOCK_SETTING_DEVICE_1 | 
+          (uint16_t)POWERSTEP01_CONF_PARAM_SW_MODE_DEVICE_1       | 
+          (uint16_t)POWERSTEP01_CONF_PARAM_VS_COMP_DEVICE_1       | 
+          (uint16_t)POWERSTEP01_CONF_PARAM_OC_SD_DEVICE_1         | 
+          (uint16_t)POWERSTEP01_CONF_PARAM_UVLOVAL_DEVICE_1       | 
+          (uint16_t)POWERSTEP01_CONF_PARAM_VCCVAL_DEVICE_1        | 
+          (uint16_t)POWERSTEP01_CONF_PARAM_PWM_DIV_DEVICE_1       | 
+          (uint16_t)POWERSTEP01_CONF_PARAM_PWM_MUL_DEVICE_1);
+      }
+      else
+      {
+        // Current mode
+        Powerstep01_CmdSetParam(POWERSTEP01_TVAL_HOLD,
+          t_val_ref_voltage_to_reg_val(
+            POWERSTEP01_CONF_PARAM_TVAL_HOLD_DEVICE_1));
+        Powerstep01_CmdSetParam(POWERSTEP01_TVAL_RUN,
+          t_val_ref_voltage_to_reg_val(
+            POWERSTEP01_CONF_PARAM_TVAL_RUN_DEVICE_1));
+        Powerstep01_CmdSetParam(POWERSTEP01_TVAL_ACC,
+          t_val_ref_voltage_to_reg_val(
+            POWERSTEP01_CONF_PARAM_TVAL_ACC_DEVICE_1));
+        Powerstep01_CmdSetParam(POWERSTEP01_TVAL_DEC,
+          t_val_ref_voltage_to_reg_val(
+            POWERSTEP01_CONF_PARAM_TVAL_DEC_DEVICE_1));
+        Powerstep01_CmdSetParam(POWERSTEP01_T_FAST,
+          (uint8_t)POWERSTEP01_CONF_PARAM_TOFF_FAST_DEVICE_1 |
+          (uint8_t)POWERSTEP01_CONF_PARAM_FAST_STEP_DEVICE_1);
+        Powerstep01_CmdSetParam(POWERSTEP01_TON_MIN,
+          t_min_time_to_reg_val(
+            POWERSTEP01_CONF_PARAM_TON_MIN_DEVICE_1));
+        Powerstep01_CmdSetParam(POWERSTEP01_TOFF_MIN,
+          t_min_time_to_reg_val(
+            POWERSTEP01_CONF_PARAM_TOFF_MIN_DEVICE_1));
+        Powerstep01_CmdSetParam(POWERSTEP01_CONFIG,
+          (uint16_t)POWERSTEP01_CONF_PARAM_CLOCK_SETTING_DEVICE_1 | 
+          (uint16_t)POWERSTEP01_CONF_PARAM_SW_MODE_DEVICE_1       | 
+          (uint16_t)POWERSTEP01_CONF_PARAM_TQ_REG_DEVICE_1        | 
+          (uint16_t)POWERSTEP01_CONF_PARAM_OC_SD_DEVICE_1         | 
+          (uint16_t)POWERSTEP01_CONF_PARAM_UVLOVAL_DEVICE_1       | 
+          (uint16_t)POWERSTEP01_CONF_PARAM_VCCVAL_DEVICE_1        | 
+          (uint16_t)POWERSTEP01_CONF_PARAM_TSW_DEVICE_1           |
+          (uint16_t)POWERSTEP01_CONF_PARAM_PRED_DEVICE_1);          
+      }
+      break;     
+#endif
+#if (MAX_NUMBER_OF_DEVICES > 2)
+   case 2:
+      cmVm = POWERSTEP01_CONF_PARAM_CM_VM_DEVICE_2;
+      Powerstep01_CmdSetParam(POWERSTEP01_ACC,
+        acc_dec_steps_s2_to_reg_val(
+          POWERSTEP01_CONF_PARAM_ACC_DEVICE_2));
+      Powerstep01_CmdSetParam(POWERSTEP01_DEC,
+        acc_dec_steps_s2_to_reg_val(
+          POWERSTEP01_CONF_PARAM_DEC_DEVICE_2));
+      Powerstep01_CmdSetParam(POWERSTEP01_MAX_SPEED,
+        max_spd_steps_s_to_reg_val(
+          POWERSTEP01_CONF_PARAM_MAX_SPEED_DEVICE_2));
+      Powerstep01_CmdSetParam(POWERSTEP01_MIN_SPEED,
+        POWERSTEP01_CONF_PARAM_LSPD_BIT_DEVICE_2|
+        min_spd_steps_s_to_reg_val(
+          POWERSTEP01_CONF_PARAM_MIN_SPEED_DEVICE_2));
+      Powerstep01_CmdSetParam(POWERSTEP01_FS_SPD,
+        POWERSTEP01_CONF_PARAM_BOOST_MODE_DEVICE_2|
+        fs_spd_steps_s_to_reg_val(
+          POWERSTEP01_CONF_PARAM_FS_SPD_DEVICE_2)); 
+      Powerstep01_CmdSetParam(POWERSTEP01_OCD_TH,
+        (uint8_t)POWERSTEP01_CONF_PARAM_OCD_TH_DEVICE_2);
+      Powerstep01_CmdSetParam(POWERSTEP01_STEP_MODE,
+        (uint8_t)POWERSTEP01_CONF_PARAM_SYNC_MODE_DEVICE_2 |
+        (uint8_t)POWERSTEP01_CONF_PARAM_CM_VM_DEVICE_2|
+        (uint8_t)POWERSTEP01_CONF_PARAM_STEP_MODE_DEVICE_2);
+      Powerstep01_CmdSetParam(POWERSTEP01_ALARM_EN,
+        POWERSTEP01_CONF_PARAM_ALARM_EN_DEVICE_2);
+      Powerstep01_CmdSetParam(POWERSTEP01_GATECFG1,
+        (uint16_t)POWERSTEP01_CONF_PARAM_IGATE_DEVICE_2 | 
+        (uint16_t)POWERSTEP01_CONF_PARAM_TCC_DEVICE_2   | 
+        (uint16_t)POWERSTEP01_CONF_PARAM_TBOOST_DEVICE_2|
+        (uint16_t)POWERSTEP01_CONF_PARAM_WD_EN_DEVICE_2);
+      Powerstep01_CmdSetParam(POWERSTEP01_GATECFG2,
+        (uint16_t)POWERSTEP01_CONF_PARAM_TBLANK_DEVICE_2 | 
+        (uint16_t)POWERSTEP01_CONF_PARAM_TDT_DEVICE_2);
+      // Voltage mode
+      if (cmVm == POWERSTEP01_CM_VM_VOLTAGE)
+      {
+        Powerstep01_CmdSetParam(POWERSTEP01_INT_SPD,
+          int_spd_steps_s_to_reg_val(
+            POWERSTEP01_CONF_PARAM_INT_SPD_DEVICE_2));
+        Powerstep01_CmdSetParam(POWERSTEP01_K_THERM,
+          k_therm_comp_to_reg_val(
+            POWERSTEP01_CONF_PARAM_K_THERM_DEVICE_2));
+        Powerstep01_CmdSetParam(POWERSTEP01_STALL_TH,
+          stall_ocd_th_to_reg_val(
+            POWERSTEP01_CONF_PARAM_STALL_TH_DEVICE_2));
+        Powerstep01_CmdSetParam(POWERSTEP01_KVAL_HOLD,
+          k_val_perc_to_reg_val(
+            POWERSTEP01_CONF_PARAM_KVAL_HOLD_DEVICE_2));
+        Powerstep01_CmdSetParam(POWERSTEP01_KVAL_RUN,
+          k_val_perc_to_reg_val(
+            POWERSTEP01_CONF_PARAM_KVAL_RUN_DEVICE_2));
+        Powerstep01_CmdSetParam(POWERSTEP01_KVAL_ACC,
+          k_val_perc_to_reg_val(
+            POWERSTEP01_CONF_PARAM_KVAL_ACC_DEVICE_2));
+        Powerstep01_CmdSetParam(POWERSTEP01_KVAL_DEC,
+          k_val_perc_to_reg_val(
+            POWERSTEP01_CONF_PARAM_KVAL_DEC_DEVICE_2));
+        Powerstep01_CmdSetParam(POWERSTEP01_ST_SLP,
+          bemf_slope_perc_to_reg_val(
+            POWERSTEP01_CONF_PARAM_ST_SLP_DEVICE_2));
+        Powerstep01_CmdSetParam(POWERSTEP01_FN_SLP_ACC,
+          bemf_slope_perc_to_reg_val(
+            POWERSTEP01_CONF_PARAM_FN_SLP_ACC_DEVICE_2));  
+        Powerstep01_CmdSetParam(POWERSTEP01_FN_SLP_DEC,
+          bemf_slope_perc_to_reg_val(
+            POWERSTEP01_CONF_PARAM_FN_SLP_DEC_DEVICE_2));
+        Powerstep01_CmdSetParam(POWERSTEP01_CONFIG,
+          (uint16_t)POWERSTEP01_CONF_PARAM_CLOCK_SETTING_DEVICE_2 | 
+          (uint16_t)POWERSTEP01_CONF_PARAM_SW_MODE_DEVICE_2       | 
+          (uint16_t)POWERSTEP01_CONF_PARAM_VS_COMP_DEVICE_2       | 
+          (uint16_t)POWERSTEP01_CONF_PARAM_OC_SD_DEVICE_2         | 
+          (uint16_t)POWERSTEP01_CONF_PARAM_UVLOVAL_DEVICE_2       | 
+          (uint16_t)POWERSTEP01_CONF_PARAM_VCCVAL_DEVICE_2        | 
+          (uint16_t)POWERSTEP01_CONF_PARAM_PWM_DIV_DEVICE_2       | 
+          (uint16_t)POWERSTEP01_CONF_PARAM_PWM_MUL_DEVICE_2);
+      }
+      else
+      {
+        // Current mode
+        Powerstep01_CmdSetParam(POWERSTEP01_TVAL_HOLD,
+          t_val_ref_voltage_to_reg_val(
+            POWERSTEP01_CONF_PARAM_TVAL_HOLD_DEVICE_2));
+        Powerstep01_CmdSetParam(POWERSTEP01_TVAL_RUN,
+          t_val_ref_voltage_to_reg_val(
+            POWERSTEP01_CONF_PARAM_TVAL_RUN_DEVICE_2));
+        Powerstep01_CmdSetParam(POWERSTEP01_TVAL_ACC,
+          t_val_ref_voltage_to_reg_val(
+            POWERSTEP01_CONF_PARAM_TVAL_ACC_DEVICE_2));
+        Powerstep01_CmdSetParam(POWERSTEP01_TVAL_DEC,
+          t_val_ref_voltage_to_reg_val(
+            POWERSTEP01_CONF_PARAM_TVAL_DEC_DEVICE_2));
+        Powerstep01_CmdSetParam(POWERSTEP01_T_FAST,
+          (uint8_t)POWERSTEP01_CONF_PARAM_TOFF_FAST_DEVICE_2 |
+          (uint8_t)POWERSTEP01_CONF_PARAM_FAST_STEP_DEVICE_2);
+        Powerstep01_CmdSetParam(POWERSTEP01_TON_MIN,
+          t_min_time_to_reg_val(
+            POWERSTEP01_CONF_PARAM_TON_MIN_DEVICE_2));
+        Powerstep01_CmdSetParam(POWERSTEP01_TOFF_MIN,
+          t_min_time_to_reg_val(
+            POWERSTEP01_CONF_PARAM_TOFF_MIN_DEVICE_2));
+        Powerstep01_CmdSetParam(POWERSTEP01_CONFIG,
+          (uint16_t)POWERSTEP01_CONF_PARAM_CLOCK_SETTING_DEVICE_2 | 
+          (uint16_t)POWERSTEP01_CONF_PARAM_SW_MODE_DEVICE_2       | 
+          (uint16_t)POWERSTEP01_CONF_PARAM_TQ_REG_DEVICE_2        | 
+          (uint16_t)POWERSTEP01_CONF_PARAM_OC_SD_DEVICE_2         | 
+          (uint16_t)POWERSTEP01_CONF_PARAM_UVLOVAL_DEVICE_2       | 
+          (uint16_t)POWERSTEP01_CONF_PARAM_VCCVAL_DEVICE_2        | 
+          (uint16_t)POWERSTEP01_CONF_PARAM_TSW_DEVICE_2           |
+          (uint16_t)POWERSTEP01_CONF_PARAM_PRED_DEVICE_2);          
+      }
+      break;
+#endif
+    default: ;
+  }
+}
+
+/**
+  * @brief Functions to get and set parameters using digital or analog values
+  */
+
+/**********************************************************
+ * @brief  Issues the GetParam command to the Powerstep01 device
+ * @param[in] parameter Register adress (POWERSTEP01_ABS_POS,
+ * POWERSTEP01_MARK,...)
+ * @retval Register value
+ **********************************************************/
+uint32_t PowerStep01::Powerstep01_CmdGetParam(powerstep01_Registers_t param)
+{
+
+  uint32_t spiRxData;
+  uint32_t loop;
+  uint8_t maxArgumentNbBytes = 0;
+  uint8_t spiIndex = numberOfDevices - deviceInstance - 1;
+  bool itDisable = FALSE;
+  
+  do
+  {
+    spiPreemptionByIsr = FALSE;
+    if (itDisable)
+    {
+      /* re-enable Powerstep01_Board_EnableIrq if disable in previous iteration */
+      Powerstep01_Board_EnableIrq();
+      itDisable = FALSE;
+    }
+    for (loop = 0; loop < numberOfDevices; loop++)
+    {
+      spiTxBursts[0][loop] = POWERSTEP01_NOP;
+      spiTxBursts[1][loop] = POWERSTEP01_NOP;
+      spiTxBursts[2][loop] = POWERSTEP01_NOP;
+      spiTxBursts[3][loop] = POWERSTEP01_NOP;
+      spiRxBursts[0][loop] = 0;
+      spiRxBursts[1][loop] = 0;
+      spiRxBursts[2][loop] = 0;
+      spiRxBursts[3][loop] = 0;    
+    }
+    switch (param)
+    {
+      case POWERSTEP01_ABS_POS: 
+      case POWERSTEP01_MARK:
+      case POWERSTEP01_SPEED:
+        spiTxBursts[0][spiIndex] = ((uint8_t)POWERSTEP01_GET_PARAM )| (param);
+        maxArgumentNbBytes = 3;
+        break;
+      case POWERSTEP01_EL_POS:
+      case POWERSTEP01_ACC:
+      case POWERSTEP01_DEC:
+      case POWERSTEP01_MAX_SPEED:
+      case POWERSTEP01_MIN_SPEED:
+      case POWERSTEP01_FS_SPD:
+      case POWERSTEP01_INT_SPD:
+      case POWERSTEP01_CONFIG:
+      case POWERSTEP01_GATECFG1:
+      case POWERSTEP01_STATUS:
+        spiTxBursts[1][spiIndex] = ((uint8_t)POWERSTEP01_GET_PARAM )| (param);
+        maxArgumentNbBytes = 2;
+        break;
+    default:
+        spiTxBursts[2][spiIndex] = ((uint8_t)POWERSTEP01_GET_PARAM )| (param);
+        maxArgumentNbBytes = 1;
+    }
+    /* Disable interruption before checking */
+    /* pre-emption by ISR and SPI transfers*/
+    Powerstep01_Board_DisableIrq();
+    itDisable = TRUE;
+  } while (spiPreemptionByIsr); // check pre-emption by ISR
+  for (loop = POWERSTEP01_CMD_ARG_MAX_NB_BYTES-1-maxArgumentNbBytes;
+       loop < POWERSTEP01_CMD_ARG_MAX_NB_BYTES;
+       loop++)
+  {
+     Powerstep01_WriteBytes(&spiTxBursts[loop][0],
+                           &spiRxBursts[loop][0]);
+  }
+  spiRxData = ((uint32_t)spiRxBursts[1][spiIndex] << 16)|
+               (spiRxBursts[2][spiIndex] << 8) |
+               (spiRxBursts[3][spiIndex]);    
+  /* re-enable Powerstep01_Board_EnableIrq after SPI transfers*/
+  Powerstep01_Board_EnableIrq();
+  return (spiRxData);
+}
+
+/**********************************************************
+ * @brief  Issues the SetParam command to the PowerStep01 device
+ * @param[in] parameter Register adress (POWERSTEP01_ABS_POS,
+ * POWERSTEP01_MARK,...)
+ * @param[in] value Value to set in the register
+ * @retval None
+ **********************************************************/
+void PowerStep01::Powerstep01_CmdSetParam(powerstep01_Registers_t param,
+  uint32_t value)
+{
+  uint32_t loop;
+  uint8_t maxArgumentNbBytes = 0;
+  uint8_t spiIndex = numberOfDevices - deviceInstance - 1;
+  bool itDisable = FALSE;
+  
+  do
+  {
+    spiPreemptionByIsr = FALSE;
+    if (itDisable)
+    {
+      /* re-enable Powerstep01_Board_EnableIrq if disable in previous iteration */
+      Powerstep01_Board_EnableIrq();
+      itDisable = FALSE;
+    }  
+    for (loop = 0;loop < numberOfDevices; loop++)
+    {
+      spiTxBursts[0][loop] = POWERSTEP01_NOP;
+      spiTxBursts[1][loop] = POWERSTEP01_NOP;
+      spiTxBursts[2][loop] = POWERSTEP01_NOP;
+      spiTxBursts[3][loop] = POWERSTEP01_NOP;
+    }
+    switch (param)
+    {
+      case POWERSTEP01_ABS_POS: ;
+      case POWERSTEP01_MARK:
+        spiTxBursts[0][spiIndex] = ((uint8_t)POWERSTEP01_SET_PARAM )| (param);
+        spiTxBursts[1][spiIndex] = (uint8_t)(value >> 16);
+        spiTxBursts[2][spiIndex] = (uint8_t)(value >> 8);
+        maxArgumentNbBytes = 3;
+        break;
+      case POWERSTEP01_EL_POS:
+      case POWERSTEP01_ACC:
+      case POWERSTEP01_DEC:
+      case POWERSTEP01_MAX_SPEED:
+      case POWERSTEP01_MIN_SPEED:
+      case POWERSTEP01_FS_SPD:
+      case POWERSTEP01_INT_SPD:
+      case POWERSTEP01_CONFIG:
+      case POWERSTEP01_GATECFG1:
+        spiTxBursts[1][spiIndex] = ((uint8_t)POWERSTEP01_SET_PARAM )| (param);
+        spiTxBursts[2][spiIndex] = (uint8_t)(value >> 8);
+        maxArgumentNbBytes = 2;
+        break;
+      default:
+        spiTxBursts[2][spiIndex] = ((uint8_t)POWERSTEP01_SET_PARAM )| (param);
+        maxArgumentNbBytes = 1;
+    }
+    spiTxBursts[3][spiIndex] = (uint8_t)(value);
+    /* Disable interruption before checking */
+    /* pre-emption by ISR and SPI transfers*/
+    Powerstep01_Board_DisableIrq();
+    itDisable = TRUE;
+  } while (spiPreemptionByIsr); // check pre-emption by ISR  
+  /* SPI transfer */
+  for (loop = POWERSTEP01_CMD_ARG_MAX_NB_BYTES - 1 - maxArgumentNbBytes;
+       loop < POWERSTEP01_CMD_ARG_MAX_NB_BYTES;
+       loop++)
+  {
+    Powerstep01_WriteBytes(&spiTxBursts[loop][0],&spiRxBursts[loop][0]);
+  }
+  /* re-enable Powerstep01_Board_EnableIrq after SPI transfers*/
+  Powerstep01_Board_EnableIrq();
+}
+
+/**********************************************************
+ * @brief Issues PowerStep01 Get Parameter command and convert the result to
+ * float value
+ * @param[in] param PowerStep01 register address
+ * @retval The parameter's float value.
+ *********************************************************/
+float PowerStep01::Powerstep01_GetAnalogValue(powerstep01_Registers_t param)
+{
+  bool voltageMode = ((POWERSTEP01_CM_VM_CURRENT&Powerstep01_CmdGetParam(POWERSTEP01_STEP_MODE))==0);
+  uint32_t registerValue = Powerstep01_CmdGetParam((powerstep01_Registers_t) param);
+  float value;
+  switch (param)
+  {
+    case POWERSTEP01_ABS_POS:
+    case POWERSTEP01_MARK:
+      value = (float) Powerstep01_ConvertPosition(registerValue);
+      break;
+    case POWERSTEP01_ACC:
+    case POWERSTEP01_DEC:
+      value = acc_dec_reg_val_to_steps_s2(registerValue);
+      break;
+    case POWERSTEP01_SPEED:
+      value = speed_reg_val_to_steps_s(registerValue);
+      break;
+    case POWERSTEP01_MAX_SPEED:
+      value = max_spd_reg_val_to_steps_s(registerValue);
+      break;
+    case POWERSTEP01_MIN_SPEED:
+      registerValue &= POWERSTEP01_MIN_SPEED_MASK;
+      value = min_spd_reg_val_to_steps_s(registerValue);
+      break;      
+    case POWERSTEP01_FS_SPD:
+      registerValue &= POWERSTEP01_FS_SPD_MASK;
+      value = fs_spd_reg_val_to_steps_s(registerValue);
+      break;
+    case POWERSTEP01_INT_SPD:
+      value = int_spd_reg_val_to_steps_s(registerValue);
+      break;
+    case POWERSTEP01_K_THERM:
+      value = k_therm_reg_val_to_comp(registerValue);
+      break;
+    case POWERSTEP01_OCD_TH:
+    case POWERSTEP01_STALL_TH:
+      value = stall_ocd_reg_val_to_th(registerValue);
+      break;
+    case POWERSTEP01_KVAL_HOLD:  //POWERSTEP01_TVAL_HOLD
+    case POWERSTEP01_KVAL_RUN:   //POWERSTEP01_TVAL_RUN
+    case POWERSTEP01_KVAL_ACC:   //POWERSTEP01_TVAL_ACC
+    case POWERSTEP01_KVAL_DEC:   //POWERSTEP01_TVAL_DEC
+      if (voltageMode!=FALSE)  value = k_val_reg_val_to_perc(registerValue);
+      else value = k_val_reg_val_to_perc(registerValue);     
+      break;
+    case POWERSTEP01_ST_SLP:
+      if (voltageMode==FALSE) 
+      {
+        break;
+      }      
+    case POWERSTEP01_FN_SLP_ACC: //POWERSTEP01_TON_MIN
+    case POWERSTEP01_FN_SLP_DEC: //POWERSTEP01_TOFF_MIN
+      if (voltageMode!=FALSE) value = bemf_slope_reg_val_to_perc(registerValue);
+      else value = t_min_reg_val_to_time(registerValue);
+      break;
+    default:
+      value = (float) registerValue;
+  }
+  return value;
+}
+
+/******************************************************//**
+ * @brief Put commands in queue before synchronous sending
+ * done by calling Powerstep01_SendQueuedCommands.
+ * Any call to functions that use the SPI between the calls of 
+ * Powerstep01_QueueCommands and Powerstep01_SendQueuedCommands 
+ * will corrupt the queue.
+ * A command for each device of the daisy chain must be 
+ * specified before calling Powerstep01_SendQueuedCommands.
+ * @param[in] command Command to queue (all Powerstep01 commmands 
+ * except POWERSTEP01_SET_PARAM, POWERSTEP01_GET_PARAM, 
+ * POWERSTEP01_GET_STATUS)
+ * @param[in] value argument of the command to queue
+ * @retval None
+ *********************************************************/
+void PowerStep01::Powerstep01_QueueCommands(uint8_t command, int32_t value)
+{
+  if (numberOfDevices > deviceInstance)
+  {
+    uint8_t spiIndex = numberOfDevices - deviceInstance - 1;
+    
+    switch (command & DAISY_CHAIN_COMMAND_MASK)
+    {
+      case POWERSTEP01_RUN: ;
+      case POWERSTEP01_MOVE: ;
+      case POWERSTEP01_GO_TO: ;
+      case POWERSTEP01_GO_TO_DIR: ;
+      case POWERSTEP01_GO_UNTIL: ;
+      case POWERSTEP01_GO_UNTIL_ACT_CPY:
+       spiTxBursts[0][spiIndex] = command;
+       spiTxBursts[1][spiIndex] = (uint8_t)(value >> 16);
+       spiTxBursts[2][spiIndex] = (uint8_t)(value >> 8);
+       spiTxBursts[3][spiIndex] = (uint8_t)(value);
+       break;
+      default:
+       spiTxBursts[0][spiIndex] = POWERSTEP01_NOP;
+       spiTxBursts[1][spiIndex] = POWERSTEP01_NOP;
+       spiTxBursts[2][spiIndex] = POWERSTEP01_NOP;
+       spiTxBursts[3][spiIndex] = command;
+    }
+  }
+}
+
+/**********************************************************
+ * @brief  Sends a command to the device via the SPI
+ * @param[in] command Command to send (all Powerstep01 commmands 
+ * except POWERSTEP01_SET_PARAM, POWERSTEP01_GET_PARAM, 
+ * POWERSTEP01_GET_STATUS)
+ * @param[in] value arguments to send on 32 bits
+ * @retval None
+ **********************************************************/
+void PowerStep01::Powerstep01_SendCommand(uint8_t command, uint32_t value)
+{
+  uint32_t loop;
+  uint8_t maxArgumentNbBytes = 0;
+  bool itDisable = FALSE;
+  uint8_t spiIndex = numberOfDevices - deviceInstance - 1;
+  
+  do
+  {
+    spiPreemptionByIsr = FALSE;
+    if (itDisable)
+    {
+      /* re-enable Powerstep01_Board_EnableIrq if disable in previous iteration */
+      Powerstep01_Board_EnableIrq();
+      itDisable = FALSE;
+    }    
+    for (loop = 0; loop < numberOfDevices; loop++)
+    {
+        spiTxBursts[0][loop] = POWERSTEP01_NOP;
+        spiTxBursts[1][loop] = POWERSTEP01_NOP;
+        spiTxBursts[2][loop] = POWERSTEP01_NOP;
+        spiTxBursts[3][loop] = POWERSTEP01_NOP;   
+    }
+    switch (command & DAISY_CHAIN_COMMAND_MASK)
+    {
+      case POWERSTEP01_GO_TO:
+      case POWERSTEP01_GO_TO_DIR:
+        value = value & POWERSTEP01_ABS_POS_VALUE_MASK;
+      case POWERSTEP01_RUN:
+      case POWERSTEP01_MOVE:
+      case POWERSTEP01_GO_UNTIL:
+      case POWERSTEP01_GO_UNTIL_ACT_CPY:
+        spiTxBursts[0][spiIndex] = command;
+        spiTxBursts[1][spiIndex] = (uint8_t)(value >> 16);
+        spiTxBursts[2][spiIndex] = (uint8_t)(value >> 8);
+        spiTxBursts[3][spiIndex] = (uint8_t)(value);
+        maxArgumentNbBytes = 3;
+        break;
+    default:
+        spiTxBursts[0][spiIndex] = POWERSTEP01_NOP;
+        spiTxBursts[1][spiIndex] = POWERSTEP01_NOP;
+        spiTxBursts[2][spiIndex] = POWERSTEP01_NOP;
+        spiTxBursts[3][spiIndex] = command;
+    }
+    /* Disable interruption before checking */
+    /* pre-emption by ISR and SPI transfers*/
+    Powerstep01_Board_DisableIrq();
+    itDisable = TRUE;
+  } while (spiPreemptionByIsr); // check pre-emption by ISR
+  for (loop = POWERSTEP01_CMD_ARG_MAX_NB_BYTES - 1 - maxArgumentNbBytes; 
+       loop < POWERSTEP01_CMD_ARG_MAX_NB_BYTES; 
+       loop++)
+  {
+     Powerstep01_WriteBytes(&spiTxBursts[loop][0], &spiRxBursts[loop][0]);
+  }
+  /* re-enable Powerstep01_Board_EnableIrq after SPI transfers*/
+  Powerstep01_Board_EnableIrq();
+}
+
+/******************************************************//**
+ * @brief Sends commands stored previously in the queue by 
+ * Powerstep01_QueueCommands
+ * @retval None
+ *********************************************************/
+void PowerStep01::Powerstep01_SendQueuedCommands(void)
+{
+  uint8_t loop;
+  
+  for (loop = 0; 
+       loop < POWERSTEP01_CMD_ARG_MAX_NB_BYTES; 
+       loop++)
+  {
+     Powerstep01_WriteBytes(&spiTxBursts[loop][0], &spiRxBursts[loop][0]);
+  }
+}
+
+/**********************************************************
+ * @brief Issues the SetParam command to the PowerStep01
+ * @param[in] param PowerStep01 Register address
+ * @param[in] value Float value to convert and set into the register
+ * @retval TRUE if param is valid, FALSE otherwise
+ *********************************************************/
+bool PowerStep01::Powerstep01_SetAnalogValue(powerstep01_Registers_t param, float value)
+{
+  uint32_t registerValue;
+  bool result = TRUE;
+  bool voltageMode = ((POWERSTEP01_CM_VM_CURRENT&Powerstep01_CmdGetParam(POWERSTEP01_STEP_MODE))==0);
+  if ((value < 0)&&((param != POWERSTEP01_ABS_POS)&&(param != POWERSTEP01_MARK)))
+  {
+    result = FALSE;
+  }
+  switch (param)
+  {
+    case POWERSTEP01_EL_POS:
+      if ((value > (POWERSTEP01_ELPOS_STEP_MASK|POWERSTEP01_ELPOS_MICROSTEP_MASK))||
+          ((value!=0)&&(value < (1<<(7-(POWERSTEP01_STEP_MODE_STEP_SEL&Powerstep01_CmdGetParam(POWERSTEP01_STEP_MODE))))))) result = FALSE;
+      else registerValue = ((uint32_t) value)&(POWERSTEP01_ELPOS_STEP_MASK|POWERSTEP01_ELPOS_MICROSTEP_MASK);
+      break;        
+    case POWERSTEP01_ABS_POS:
+    case POWERSTEP01_MARK:
+      if (value < 0)
+      {
+        value=-value;
+        if (((uint32_t)value)<=(POWERSTEP01_MAX_POSITION+1))
+          registerValue = (POWERSTEP01_ABS_POS_VALUE_MASK+1-(uint32_t)value)&POWERSTEP01_ABS_POS_VALUE_MASK;
+        else result = FALSE;  
+      }
+      else
+      {
+        if (((uint32_t)value)<=POWERSTEP01_MAX_POSITION)
+          registerValue = ((uint32_t) value)&POWERSTEP01_ABS_POS_VALUE_MASK;
+        else result = FALSE; 
+      }
+      break;
+    case POWERSTEP01_ACC:
+    case POWERSTEP01_DEC:
+      if (value > POWERSTEP01_ACC_DEC_MAX_VALUE) result = FALSE;
+      else registerValue = acc_dec_steps_s2_to_reg_val(value);
+      break;
+    case POWERSTEP01_MAX_SPEED:
+      if (value > POWERSTEP01_MAX_SPEED_MAX_VALUE) result = FALSE;
+      else registerValue = max_spd_steps_s_to_reg_val(value);
+      break;
+    case POWERSTEP01_MIN_SPEED:
+      if (value > POWERSTEP01_MIN_SPEED_MAX_VALUE) result = FALSE;
+      else registerValue = (POWERSTEP01_LSPD_OPT&Powerstep01_CmdGetParam(param))|min_spd_steps_s_to_reg_val(value);
+      break;      
+    case POWERSTEP01_FS_SPD:
+      if (value > POWERSTEP01_FS_SPD_MAX_VALUE) result = FALSE;
+      else registerValue = (POWERSTEP01_BOOST_MODE&Powerstep01_CmdGetParam(param))|fs_spd_steps_s_to_reg_val(value);
+      break;
+    case POWERSTEP01_INT_SPD:
+      if (value > POWERSTEP01_INT_SPD_MAX_VALUE) result = FALSE;
+      else registerValue = int_spd_steps_s_to_reg_val(value);
+      break;
+    case POWERSTEP01_K_THERM:
+      if ((value < POWERSTEP01_K_THERM_MIN_VALUE)||
+          (value > POWERSTEP01_K_THERM_MAX_VALUE)) result = FALSE;
+      else registerValue = k_therm_comp_to_reg_val(value);
+      break;
+    case POWERSTEP01_OCD_TH:
+    case POWERSTEP01_STALL_TH:
+      if (value > POWERSTEP01_STALL_OCD_TH_MAX_VALUE) result = FALSE;
+      else registerValue = stall_ocd_th_to_reg_val(value);
+      break;
+    case POWERSTEP01_KVAL_HOLD:  //POWERSTEP01_TVAL_HOLD
+    case POWERSTEP01_KVAL_RUN:   //POWERSTEP01_TVAL_RUN
+    case POWERSTEP01_KVAL_ACC:   //POWERSTEP01_TVAL_ACC
+    case POWERSTEP01_KVAL_DEC:   //POWERSTEP01_TVAL_DEC
+      if (voltageMode==FALSE)
+      {
+        if (value > POWERSTEP01_TVAL_MAX_VALUE) result = FALSE;
+        else registerValue = t_val_ref_voltage_to_reg_val(value);
+      }
+      else
+      {
+        if (value > POWERSTEP01_KVAL_MAX_VALUE) result = FALSE;
+        else registerValue = k_val_perc_to_reg_val(value);
+      }
+      break;
+    case POWERSTEP01_ST_SLP:
+      if (voltageMode==FALSE) 
+      {
+        result = FALSE;
+        break;
+      }
+    case POWERSTEP01_FN_SLP_ACC: //POWERSTEP01_TON_MIN
+    case POWERSTEP01_FN_SLP_DEC: //POWERSTEP01_TOFF_MIN
+      if (voltageMode==FALSE)
+      {
+        if (value>POWERSTEP01_TOFF_TON_MIN_MAX_VALUE) result = FALSE;
+        else registerValue = t_min_time_to_reg_val(value);
+      }
+      else
+      {
+        if (value > POWERSTEP01_SLP_MAX_VALUE) result = FALSE;
+        else registerValue = bemf_slope_perc_to_reg_val(value);
+      }
+      break;
+    default:
+      result = FALSE;
+  }
+  if (result!=FALSE)
+  {
+    Powerstep01_CmdSetParam(param, registerValue);
+  }
+  return result;
+}
+
+/**********************************************************
+ * @brief Write and receive a byte via SPI
+ * @param[in] pByteToTransmit pointer to the byte to transmit
+ * @param[in] pReceivedByte pointer to the received byte
+ * @retval None
+ *********************************************************/
+void PowerStep01::Powerstep01_WriteBytes(uint8_t *pByteToTransmit, uint8_t *pReceivedByte)
+{
+  if (Powerstep01_Board_SpiWriteBytes(pByteToTransmit, pReceivedByte) != 0)
+  {
+    Powerstep01_ErrorHandler(POWERSTEP01_ERROR_1);
+  }
+  if (isrFlag)
+  {
+    spiPreemptionByIsr = TRUE;
+  }
+}
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Components/PowerStep01/PowerStep01.h	Fri Mar 24 10:24:39 2017 +0000
@@ -0,0 +1,1495 @@
+/**
+ ******************************************************************************
+ * @file    PowerStep01.h
+ * @author  IPC Rennes
+ * @version V1.0.1
+ * @date    September 13th, 2016
+ * @brief   This file contains the class of a Powerstep01 Motor Control component.
+ * @note    (C) COPYRIGHT 2016 STMicroelectronics
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT(c) 2016 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 __POWERSTEP01_CLASS_H
+#define __POWERSTEP01_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 "PowerStep01_def.h"
+/* ACTION 3 ------------------------------------------------------------------*
+ * Include here interface specific header files.                              *
+ *                                                                            *
+ * Example:                                                                   *
+ *   #include "HumiditySensor.h"                                              *
+ *   #include "TemperatureSensor.h"                                           *
+ *----------------------------------------------------------------------------*/
+#include "StepperMotor.h"
+
+
+/* Classes -------------------------------------------------------------------*/
+
+/**
+ * @brief Class representing a Powerstep01 component.
+ */
+class PowerStep01 : public StepperMotor
+{
+public:
+
+    /*** 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 pwm           pin name of the PWM 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.
+     */
+    PowerStep01(PinName flag_irq, PinName busy_irq, PinName standby_reset, PinName pwm, PinName ssel, DevSPI &spi) : StepperMotor(), flag_irq(flag_irq), busy_irq(busy_irq), standby_reset(standby_reset), pwm(pwm), ssel(ssel), dev_spi(spi)
+    {
+        /* Checking stackability. */
+        if (!(numberOfDevices < MAX_NUMBER_OF_DEVICES))
+            error("Instantiation of the PowerStep01 component failed: it can be stacked up to %d times.\r\n", MAX_NUMBER_OF_DEVICES);
+
+        /* ACTION 4 ----------------------------------------------------------*
+         * Initialize here the component's member variables, one variable per *
+         * line.                                                              *
+         *                                                                    *
+         * Example:                                                           *
+         *   measure = 0;                                                     *
+         *   instance_id = number_of_instances++;                             *
+         *--------------------------------------------------------------------*/
+        errorHandlerCallback = 0;
+        deviceInstance = numberOfDevices++;
+        memset(spiTxBursts, 0, POWERSTEP01_CMD_ARG_MAX_NB_BYTES * MAX_NUMBER_OF_DEVICES * sizeof(uint8_t));
+        memset(spiRxBursts, 0, POWERSTEP01_CMD_ARG_MAX_NB_BYTES * MAX_NUMBER_OF_DEVICES * sizeof(uint8_t));
+    }
+    
+    /**
+     * @brief Destructor.
+     */
+    virtual ~PowerStep01(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 *pData) //(1)                             *
+     *   {                                                                    *
+     *     return COMPONENT_GetValue(float *pfData);                          *
+     *   }                                                                    *
+     *                                                                        *
+     *   virtual int EnableFeature(void) //(2)                                *
+     *   {                                                                    *
+     *     return COMPONENT_EnableFeature();                                  *
+     *   }                                                                    *
+     *------------------------------------------------------------------------*/
+
+    /**
+     * @brief Public functions inherited from the Component Class
+     */
+
+    /**
+     * @brief  Initialize 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 = NULL)
+    {
+        return (int) Powerstep01_Init((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 = NULL)
+    {
+        return (int) Powerstep01_ReadID((uint8_t *) id);
+    }
+
+    /**
+     * @brief Public functions inherited from the StepperMotor Class
+     */
+
+    /**
+     * @brief  Getting the value of the Status Register.
+     * @param  None.
+     * @retval None.
+     * @note   The Status Register's flags are cleared, contrary to read_status_register().
+     */
+    virtual unsigned int get_status(void)
+    {
+        return (unsigned int) Powerstep01_CmdGetStatus();
+    }
+
+    /**
+     * @brief  Getting the position.
+     * @param  None.
+     * @retval The position.
+     */
+    virtual signed int get_position(void)
+    {
+        return (signed int)Powerstep01_GetPosition();
+    }
+
+    /**
+     * @brief  Getting the marked position.
+     * @param  None.
+     * @retval The marked position.
+     */
+    virtual signed int get_mark(void)
+    {
+        return (signed int)Powerstep01_GetMark();
+    }
+
+    /**
+     * @brief  Getting the current speed in step/s.
+     * @param  None.
+     * @retval The current speed in step/s.
+     */
+    virtual unsigned int get_speed(void)
+    {
+        return (unsigned int)round(Powerstep01_GetAnalogValue(POWERSTEP01_SPEED));
+    }
+
+    /**
+     * @brief  Getting the maximum speed in step/s.
+     * @param  None.
+     * @retval The maximum speed in step/s.
+     */
+    virtual unsigned int get_max_speed(void)
+    {
+        return (unsigned int)round(Powerstep01_GetAnalogValue(POWERSTEP01_MAX_SPEED));
+    }
+
+    /**
+     * @brief  Getting the minimum speed in step/s.
+     * @param  None.
+     * @retval The minimum speed in step/s.
+     */
+    virtual unsigned int get_min_speed(void)
+    {
+        return (unsigned int)round(Powerstep01_GetAnalogValue(POWERSTEP01_MIN_SPEED));
+    }
+
+    /**
+     * @brief  Getting the acceleration in step/s^2.
+     * @param  None.
+     * @retval The acceleration in step/s^2.
+     */
+    virtual unsigned int get_acceleration(void)
+    {
+        return (unsigned int)round(Powerstep01_GetAnalogValue(POWERSTEP01_ACC));
+    }
+
+    /**
+     * @brief  Getting the deceleration in step/s^2.
+     * @param  None.
+     * @retval The deceleration in step/s^2.
+     */
+    virtual unsigned int get_deceleration(void)
+    {
+        return (unsigned int)round(Powerstep01_GetAnalogValue(POWERSTEP01_DEC));
+    }
+    
+    /**
+     * @brief  Getting the direction of rotation.
+     * @param  None.
+     * @retval The direction of rotation.
+     */
+    virtual direction_t get_direction(void)
+    {
+        if ((POWERSTEP01_STATUS_DIR&Powerstep01_ReadStatusRegister())!=0)
+        {
+            return FWD;
+        }
+        else
+        {
+            return BWD;
+        }
+    }
+    
+    /**
+     * @brief  Setting the current position to be the home position.
+     * @param  None.
+     * @retval None.
+     */
+    virtual void set_home(void)
+    {
+        Powerstep01_SetHome();
+    }
+
+    /**
+     * @brief  Setting the current position to be the marked position.
+     * @param  None.
+     * @retval None.
+     */
+    virtual void set_mark(void)
+    {
+        Powerstep01_SetMark();
+    }
+
+    /**
+     * @brief  Setting the maximum speed in steps/s.
+     * @param  speed The maximum speed in steps/s.
+     * @retval TRUE if value is valid, FALSE otherwise.
+     */
+    virtual bool set_max_speed(unsigned int speed)
+    {
+        return Powerstep01_SetAnalogValue(POWERSTEP01_MAX_SPEED, (float)speed);
+    }
+
+    /**
+     * @brief  Setting the minimum speed in steps/s.
+     * @param  speed The minimum speed in steps/s.
+     * @retval TRUE if value is valid, FALSE otherwise.
+     */
+    virtual bool set_min_speed(unsigned int speed)
+    {
+        return Powerstep01_SetAnalogValue(POWERSTEP01_MIN_SPEED, (float)speed);
+    }
+
+    /**
+     * @brief  Setting the acceleration in steps/s^2.
+     * @param  acceleration The acceleration in steps/s^2.
+     * @retval None.
+     */
+    virtual bool set_acceleration(unsigned int acceleration)
+    {
+        return Powerstep01_SetAnalogValue(POWERSTEP01_ACC, (float)acceleration);
+    }
+
+    /**
+     * @brief  Setting the deceleration in steps/s^2.
+     * @param  deceleration The deceleration in steps/s^2.
+     * @retval None.
+     */
+    virtual bool set_deceleration(unsigned int deceleration)
+    {
+        return Powerstep01_SetAnalogValue(POWERSTEP01_DEC, (float)deceleration);
+    }
+
+    /**
+     * @brief  Setting the Step Mode.
+     * @param  step_mode The Step Mode.
+     * @retval None.
+     * @note   step_mode can be one of the following:
+     *           + STEP_MODE_FULL
+     *           + STEP_MODE_HALF
+     *           + STEP_MODE_1_4
+     *           + STEP_MODE_1_8
+     *           + STEP_MODE_1_16
+     *           + STEP_MODE_1_32
+     *           + STEP_MODE_1_64
+     *           + STEP_MODE_1_128
+     */
+    virtual bool set_step_mode(step_mode_t step_mode)
+    {
+        return Powerstep01_SelectStepMode((motorStepMode_t) step_mode);
+    }
+
+    /**
+     * @brief  Going to a specified position.
+     * @param  position The desired position.
+     * @retval None.
+     */
+    virtual void go_to(signed int position)
+    {
+        Powerstep01_CmdGoTo((int32_t)position);
+    }
+
+    virtual void go_to(direction_t direction, signed int position)
+    {
+        Powerstep01_CmdGoToDir((motorDir_t) (direction == StepperMotor::FWD ? FORWARD : BACKWARD),(int32_t)position);
+    }
+
+    /**
+     * @brief  Going to the home position.
+     * @param  None.
+     * @retval None.
+     */
+    virtual void go_home(void)
+    {
+        Powerstep01_CmdGoHome();
+    }
+
+    /**
+     * @brief  Going to the marked position.
+     * @param  None.
+     * @retval None.
+     */
+    virtual void go_mark(void)
+    {
+        Powerstep01_CmdGoMark();
+    }
+
+    /**
+     * @brief  Running the motor towards a specified direction.
+     * @param  direction The direction of rotation.
+     * @retval None.
+     */
+    virtual void run(direction_t direction)
+    {
+        Powerstep01_CmdRun((motorDir_t) (direction == StepperMotor::FWD ? FORWARD : BACKWARD), Powerstep01_CmdGetParam((powerstep01_Registers_t) POWERSTEP01_MAX_SPEED));
+    }
+
+    /**
+     * @brief  Moving the motor towards a specified direction for a certain number of steps.
+     * @param  direction The direction of rotation.
+     * @param  steps The desired number of steps.
+     * @retval None.
+     */
+    virtual void move(direction_t direction, unsigned int steps)
+    {
+        Powerstep01_CmdMove((motorDir_t) (direction == StepperMotor::FWD ? FORWARD : BACKWARD), (uint32_t)steps);
+    }
+
+    /**
+     * @brief  Stopping the motor through an immediate deceleration up to zero speed.
+     * @param  None.
+     * @retval None.
+     */
+    virtual void soft_stop(void)
+    {
+        Powerstep01_CmdSoftStop();
+    }
+
+    /**
+     * @brief  Stopping the motor through an immediate infinite deceleration.
+     * @param  None.
+     * @retval None.
+     */
+    virtual void hard_stop(void)
+    {
+        Powerstep01_CmdHardStop();
+    }
+
+    /**
+     * @brief  Disabling the power bridge after performing a deceleration to zero.
+     * @param  None.
+     * @retval None.
+     */
+    virtual void soft_hiz(void)
+    {
+        Powerstep01_CmdSoftHiZ();
+    }
+
+    /**
+     * @brief  Disabling the power bridge immediately.
+     * @param  None.
+     * @retval None.
+     */
+    virtual void hard_hiz(void)
+    {
+        Powerstep01_CmdHardHiZ();
+    }
+
+    /**
+     * @brief  Waiting while the motor is active.
+     * @param  None.
+     * @retval None.
+     */
+    virtual void wait_while_active(void)
+    {
+        Powerstep01_WaitWhileActive();
+    }  
+
+    /**
+     * @brief Public functions NOT inherited
+     */
+     
+    /**
+     * @brief  Attaching an error handler.
+     * @param  fptr An error handler.
+     * @retval None.
+     */
+    virtual void attach_error_handler(void (*fptr)(uint16_t error))
+    {
+        Powerstep01_AttachErrorHandler((void (*)(uint16_t error)) fptr);
+    }
+    
+    /**
+     * @brief  Checks if the device is busy by reading the busy pin position.
+     * @param  None.
+     * @retval One if the device his busy (low logic level on busy output),
+     * otherwise zero
+     */
+    virtual int check_busy_hw(void)
+    {
+        if (busy_irq!=0) return 0x01;
+        else return 0x00;
+    }
+
+    /**
+     * @brief  Checks if the device has an alarm flag set by reading the flag pin position.
+     * @param  None.
+     * @retval One if the device has an alarm flag set (low logic level on flag output),
+     * otherwise zero
+     */
+    virtual unsigned int check_status_hw(void)
+    {
+        if (flag_irq!=0) return 0x01;
+        else return 0x00;
+    }
+    
+    /**
+     * @brief Fetch and clear status flags of all devices 
+     * by issuing a GET_STATUS command simultaneously  
+     * to all devices.
+     * Then, the fetched status of each device can be retrieved
+     * by using the Powerstep01_GetFetchedStatus function
+     * provided there is no other calls to functions which 
+     * use the SPI in between.
+     * @retval None
+     */
+    virtual void fetch_and_clear_all_status(void)
+    {
+        Powerstep01_FetchAndClearAllStatus();
+    }
+
+    /**
+     * @brief  Getting a parameter float value.
+     * @param  parameter A parameter's register adress.
+     * @retval The parameter's float value.
+     *         parameter can be one of the following:
+     *           + POWERSTEP01_ABS_POS
+     *           + POWERSTEP01_MARK
+     *           + POWERSTEP01_ACC
+     *           + POWERSTEP01_DEC
+     *           + POWERSTEP01_SPEED     
+     *           + POWERSTEP01_MAX_SPEED
+     *           + POWERSTEP01_MIN_SPEED
+     *           + POWERSTEP01_FS_SPD
+     *           (voltage mode) + POWERSTEP01_INT_SPD
+     *           (voltage mode) + POWERSTEP01_K_THERM
+     *           + POWERSTEP01_OCD_TH
+     *           (voltage mode) + POWERSTEP01_STALL_TH
+     *           (voltage mode) + POWERSTEP01_KVAL_HOLD : value in %
+     *           (current mode) + POWERSTEP01_TVAL_HOLD : value in mV
+     *           (voltage mode) + POWERSTEP01_KVAL_RUN  : value in %
+     *           (current mode) + POWERSTEP01_TVAL_RUN  : value in mV
+     *           (voltage mode) + POWERSTEP01_KVAL_ACC  : value in %
+     *           (current mode) + POWERSTEP01_TVAL_ACC  : value in mV
+     *           (voltage mode) + POWERSTEP01_KVAL_DEC  : value in %
+     *           (current mode) + POWERSTEP01_TVAL_DEC  : value in mV
+     *           (voltage mode) + POWERSTEP01_ST_SLP
+     *           (voltage mode) + POWERSTEP01_FN_SLP_ACC
+     *           (voltage mode) + POWERSTEP01_FN_SLP_DEC
+     */
+    virtual float get_analog_value(unsigned int parameter)
+    {
+      return Powerstep01_GetAnalogValue((powerstep01_Registers_t)parameter);
+    }
+
+    /**
+     * @brief Get the value of the STATUS register which was 
+     * fetched by using Powerstep01_FetchAndClearAllStatus.
+     * The fetched values are available  as long as there
+     * no other calls to functions which use the SPI.
+     * @retval Last fetched value of the STATUS register.
+     */ 
+    virtual uint16_t get_fetched_status(void)
+    {
+        return Powerstep01_GetFetchedStatus();
+    }
+
+    /**
+     * @brief  Getting the version of the firmware.
+     * @param  None.
+     * @retval The version of the firmware.
+     */
+    virtual unsigned int get_fw_version(void)
+    {
+        return (unsigned int) Powerstep01_GetFwVersion();
+    }
+
+    /**
+     * @brief  Getting a parameter register value.
+     * @param  parameter A parameter's register adress.
+     * @retval The parameter's register value.
+     *         parameter can be one of the following:
+     *           + POWERSTEP01_ABS_POS
+     *           + POWERSTEP01_EL_POS
+     *           + POWERSTEP01_MARK
+     *           + POWERSTEP01_SPEED
+     *           + POWERSTEP01_ACC
+     *           + POWERSTEP01_DEC
+     *           + POWERSTEP01_MAX_SPEED
+     *           + POWERSTEP01_MIN_SPEED
+     *           (voltage mode) + POWERSTEP01_KVAL_HOLD : value in %
+     *           (current mode) + POWERSTEP01_TVAL_HOLD : value in mV
+     *           (voltage mode) + POWERSTEP01_KVAL_RUN  : value in %
+     *           (current mode) + POWERSTEP01_TVAL_RUN  : value in mV
+     *           (voltage mode) + POWERSTEP01_KVAL_ACC  : value in %
+     *           (current mode) + POWERSTEP01_TVAL_ACC  : value in mV
+     *           (voltage mode) + POWERSTEP01_KVAL_DEC  : value in %
+     *           (current mode) + POWERSTEP01_TVAL_DEC  : value in mV
+     *           (voltage mode) + POWERSTEP01_INT_SPD
+     *           (voltage mode) + POWERSTEP01_ST_SLP
+     *           (current mode) + POWERSTEP01_T_FAST
+     *           (voltage mode) + POWERSTEP01_FN_SLP_ACC
+     *           (current mode) + POWERSTEP01_TON_MIN
+     *           (voltage mode) + POWERSTEP01_FN_SLP_DEC
+     *           (current mode) + POWERSTEP01_TOFF_MIN
+     *           (voltage mode) + POWERSTEP01_K_THERM
+     *           + POWERSTEP01_ADC_OUT
+     *           + POWERSTEP01_OCD_TH
+     *           (voltage mode) + POWERSTEP01_STALL_TH
+     *           + POWERSTEP01_FS_SPD
+     *           + POWERSTEP01_STEP_MODE
+     *           + POWERSTEP01_ALARM_EN
+     *           + POWERSTEP01_GATECFG1
+     *           + POWERSTEP01_GATECFG2
+     *           + POWERSTEP01_CONFIG
+     *           + POWERSTEP01_STATUS
+     */
+    virtual unsigned int get_raw_parameter(unsigned int parameter)
+    {
+      return (unsigned int) Powerstep01_CmdGetParam((powerstep01_Registers_t)parameter);
+    }
+    
+    /**
+     * @brief  Issues PowerStep01 Go Until command.
+     * @param  action type of action to undertake when the SW
+     * input is forced high (ACTION_RESET or ACTION_COPY).
+     * @param  direction The direction of rotation.
+     * @param  speed in steps/s.
+     * @retval One if the device has an alarm flag set (low logic level on flag output),
+     * otherwise zero
+     */    
+    virtual void go_until(motorAction_t action, direction_t direction, float speed)
+    {
+        Powerstep01_CmdGoUntil(action,
+                               (motorDir_t) (direction == StepperMotor::FWD ? FORWARD : BACKWARD),
+                               speed_steps_s_to_reg_val(speed));
+    }
+    
+    /**
+     * @brief Checks if the device is busy
+     * by reading the Busy flag bit ot its status Register
+     * This operation clears the status register
+     * @retval true if device is busy, false zero  
+     */
+    virtual bool is_device_busy(void)
+    {
+        return Powerstep01_IsDeviceBusy();
+    }
+
+    /**
+     * @brief Put commands in queue before synchronous sending
+     * done by calling send_queued_commands.
+     * Any call to functions that use the SPI between the calls of 
+     * queue_commands and send_queued_commands 
+     * will corrupt the queue.
+     * A command for each device of the daisy chain must be 
+     * specified before calling send_queued_commands.
+     * @param command Command to queue (all Powerstep01 commmands 
+     * except POWERSTEP01_SET_PARAM, POWERSTEP01_GET_PARAM, 
+     * POWERSTEP01_GET_STATUS).
+     * @param value argument of the command to queue.
+     * @retval None.
+     */
+    virtual void queue_commands(uint8_t command, int32_t value)
+    {
+        Powerstep01_QueueCommands(command, value);
+    }
+    
+    /**
+     * @brief  Reading the Status Register.
+     * @param  None.
+     * @retval None.
+     * @note   The Status Register's flags are not cleared, contrary to get_status().
+     */
+    virtual uint16_t read_status_register(void)
+    {
+        return Powerstep01_ReadStatusRegister();
+    }
+    
+    /**
+     * @brief  Issues PowerStep01 Release SW command.
+     * @param  action type of action to undertake when the SW
+     * input is forced high (ACTION_RESET or ACTION_COPY).
+     * @param  direction The direction of rotation.
+     * @param  speed in steps/s.
+     * @retval One if the device has an alarm flag set (low logic level on flag output),
+     * otherwise zero
+     */  
+    virtual void release_sw(motorAction_t action, direction_t direction)
+    {
+        Powerstep01_CmdReleaseSw(action,
+                                 (motorDir_t) (direction == StepperMotor::FWD ? FORWARD : BACKWARD));
+    }
+    
+    /**
+     * @brief  Issues PowerStep01 Reset Device command.
+     * @param  None.
+     * @retval None.
+     */
+    virtual void reset_command(void)
+    {
+        Powerstep01_CmdResetDevice();
+    }
+
+    /**
+     * @brief  Issues PowerStep01 ResetPos command.
+     * @param  None.
+     * @retval None.
+     * @note   Same effect as set_home().
+     */
+    virtual void reset_position(void)
+    {
+        Powerstep01_CmdResetPos();
+    }
+
+    /**
+     * @brief  Running the motor towards a specified direction.
+     * @param  direction The direction of rotation.
+     * @param  speed in steps/s.
+     * @retval None.
+     */
+    virtual void run(direction_t direction, float speed)
+    {
+        Powerstep01_CmdRun((motorDir_t) (direction == StepperMotor::FWD ? FORWARD : BACKWARD), speed_steps_s_to_reg_val(speed));
+    }
+        
+    /**
+     * @brief Sends commands stored previously in the queue by queue_commands.
+     * @param  None.
+     * @retval None.
+     */ 
+    virtual void send_queued_commands(void)
+    {
+        Powerstep01_SendQueuedCommands();
+    }
+    
+    /**
+     * @brief  Setting a parameter with an input float value.
+     * @param  param Register adress.
+     * @param  value Float value to convert and set into the register.
+     * @retval TRUE if param and value are valid, FALSE otherwise
+     * @note   parameter can be one of the following:
+     *           + POWERSTEP01_EL_POS
+     *           + POWERSTEP01_ABS_POS
+     *           + POWERSTEP01_MARK
+     *           + POWERSTEP01_ACC
+     *           + POWERSTEP01_DEC
+     *           + POWERSTEP01_MAX_SPEED
+     *           + POWERSTEP01_MIN_SPEED
+     *           + POWERSTEP01_FS_SPD
+     *           + POWERSTEP01_INT_SPD
+     *           + POWERSTEP01_K_THERM
+     *           + POWERSTEP01_OCD_TH
+     *           + POWERSTEP01_STALL_TH
+     *           + POWERSTEP01_KVAL_HOLD
+     *           + POWERSTEP01_KVAL_RUN
+     *           + POWERSTEP01_KVAL_ACC
+     *           + POWERSTEP01_KVAL_DEC
+     *           + POWERSTEP01_ST_SLP
+     *           + POWERSTEP01_FN_SLP_ACC
+     *           + POWERSTEP01_FN_SLP_DEC
+     *           + POWERSTEP01_TVAL_HOLD
+     *           + POWERSTEP01_TVAL_RUN
+     *           + POWERSTEP01_TVAL_ACC
+     *           + POWERSTEP01_TVAL_DEC
+     *           + POWERSTEP01_TON_MIN
+     *           + POWERSTEP01_TOFF_MIN
+     */
+    virtual bool set_analog_value(unsigned int param, float value)
+    {
+      return Powerstep01_SetAnalogValue((powerstep01_Registers_t)param, value);
+    }
+    
+    /**
+     * @brief  Setting a parameter.
+     * @param  parameter A parameter's register adress.
+     * @param  value The parameter's value.
+     * @retval None.
+     *         parameter can be one of the following:
+     *           + POWERSTEP01_ABS_POS
+     *           + POWERSTEP01_EL_POS
+     *           + POWERSTEP01_MARK
+     *           + POWERSTEP01_ACC
+     *           + POWERSTEP01_DEC
+     *           + POWERSTEP01_MAX_SPEED
+     *           + POWERSTEP01_MIN_SPEED
+     *           (voltage mode) + POWERSTEP01_KVAL_HOLD : value in %
+     *           (current mode) + POWERSTEP01_TVAL_HOLD : value in mV
+     *           (voltage mode) + POWERSTEP01_KVAL_RUN  : value in %
+     *           (current mode) + POWERSTEP01_TVAL_RUN  : value in mV
+     *           (voltage mode) + POWERSTEP01_KVAL_ACC  : value in %
+     *           (current mode) + POWERSTEP01_TVAL_ACC  : value in mV
+     *           (voltage mode) + POWERSTEP01_KVAL_DEC  : value in %
+     *           (current mode) + POWERSTEP01_TVAL_DEC  : value in mV
+     *           (voltage mode) + POWERSTEP01_INT_SPD
+     *           (voltage mode) + POWERSTEP01_ST_SLP
+     *           (current mode) + POWERSTEP01_T_FAST
+     *           (voltage mode) + POWERSTEP01_FN_SLP_ACC
+     *           (current mode) + POWERSTEP01_TON_MIN
+     *           (voltage mode) + POWERSTEP01_FN_SLP_DEC
+     *           (current mode) + POWERSTEP01_TOFF_MIN
+     *           (voltage mode) + POWERSTEP01_K_THERM
+     *           + POWERSTEP01_ADC_OUT
+     *           + POWERSTEP01_OCD_TH
+     *           (voltage mode) + POWERSTEP01_STALL_TH
+     *           + POWERSTEP01_FS_SPD
+     *           + POWERSTEP01_STEP_MODE
+     *           + POWERSTEP01_ALARM_EN
+     *           + POWERSTEP01_GATECFG1
+     *           + POWERSTEP01_GATECFG2
+     *           + POWERSTEP01_CONFIG
+     */
+    virtual void set_raw_parameter(unsigned int parameter, unsigned int value)
+    {
+        Powerstep01_CmdSetParam((powerstep01_Registers_t)parameter, (uint32_t)value);
+    }
+    
+    /**
+     * @brief  Enable the step clock mode.
+     * @param  frequency the frequency of PWM.
+     * @retval None.
+     */
+    virtual void step_clock_mode_enable(direction_t direction)
+    {
+        Powerstep01_CmdStepClock((motorDir_t) (direction == StepperMotor::FWD ? FORWARD : BACKWARD));
+    }
+    
+    /**
+     * @brief  Setting the frequency of PWM.
+     *         The frequency controls directly the speed of the device.
+     * @param  frequency the frequency of PWM.
+     * @retval None.
+     */
+    virtual void step_clock_start(uint16_t frequency)
+    {
+        /* Computing the period of PWM. */
+        double period = 1.0f / frequency;
+        
+        /* Setting the period and the duty-cycle of PWM. */
+        pwm.period(period);
+        pwm.write(0.5f);
+    }
+
+    /**
+     * @brief  Stopping the PWM.
+     * @param  None.
+     * @retval None.
+     */
+    virtual void step_clock_stop(void)
+    {
+        pwm.write(0.0f);
+    }
+    
+    /**
+     * @brief Public static functions
+     */    
+
+    static uint8_t get_nb_devices(void)
+    {
+        return numberOfDevices;
+    }
+
+    /**
+     * @brief To and from register parameter conversion functions
+     */
+     
+    /**********************************************************
+     * @brief Convert the float formatted acceleration or
+     * deceleration into respectively an ACC or DEC register value
+     * @param[in] steps_s2 the acceleration or deceleration as
+     * steps/s^2, range 14.55 to 59590 steps/s^2
+     * @retval The acceleration or deceleration as steps/tick^2
+     **********************************************************/
+    static uint16_t acc_dec_steps_s2_to_reg_val(float steps_s2)
+    {
+        return ((uint16_t)(((float)(steps_s2)*0.068719476736f)+0.5f));
+    }
+    
+    /**********************************************************
+     * @brief Convert the ACC or DEC register value into step/s^2
+     * @param[in] regVal The ACC or DEC register value
+     * @retval The speed as steps/s
+     **********************************************************/
+    static float acc_dec_reg_val_to_steps_s2(uint32_t regVal)
+    {
+        return (((float)(regVal))*14.5519152283f);
+    }
+    
+    /**********************************************************
+     * @brief Converts BEMF compensation slope to values for ST_SLP,
+     * FN_SLP_ACC or FN_SLP_DEC register
+     * @param[in] percentage BEMF compensation slope percentage,
+     * range 0 to 0.4% (0.004) s/step
+     * @retval value for ST_SLP, FN_SLP_ACC or FN_SLP_DEC register
+     **********************************************************/
+    static uint8_t bemf_slope_perc_to_reg_val(float percentage)
+    {
+        return ((uint8_t)(((float)(percentage)*637.5f)+0.5f));
+    }
+    
+    /**********************************************************
+     * @brief Converts values from ST_SLP, FN_SLP_ACC or
+     * FN_SLP_DEC register to BEMF compensation slope percentage
+     * @param[in] regVal The ST_SLP, FN_SLP_ACC or FN_SLP_DEC
+     * register value
+     * @retval BEMF compensation slope percentage
+     **********************************************************/
+    static float bemf_slope_reg_val_to_perc(uint32_t regVal)
+    {
+        return (((float)(regVal))*0.00156862745098f);
+    }
+          
+    /**********************************************************
+     * @brief Convert the float formatted speed into a FS_SPD 
+     * register value
+     * @param[in] steps_s the speed as steps/s, range 15.25 to 15610 steps/s
+     * @retval The speed as steps/tick
+     **********************************************************/
+    static uint16_t fs_spd_steps_s_to_reg_val(float steps_s)
+    {
+        return ((uint16_t)((float)(steps_s)*0.065536f));
+    }
+    
+    /**********************************************************
+     * @brief Convert the FS_SPD register value into step/s
+     * @param[in] regVal The FS_SPD register value
+     * @retval The full Step speed as steps/s
+     **********************************************************/
+    static float fs_spd_reg_val_to_steps_s(uint32_t regVal)
+    {
+        return (((float)regVal+0.999f)*15.258789f);
+    }
+    
+    /**********************************************************
+     * @brief Convert the float formatted speed into a INT_SPEED 
+     * register value
+     * @param[in] steps_s the speed as steps/s, range 0 to 976.5 steps/s
+     * @retval The intersect speed as steps/tick
+     **********************************************************/
+    static uint16_t int_spd_steps_s_to_reg_val(float steps_s)
+    {
+        return ((uint16_t)(((float)(steps_s)*16.777216f)+0.5f));
+    }
+    
+    /**********************************************************
+     * @brief Convert the INT_SPEED register value into step/s
+     * @param[in] regVal The INT_SPEED register value
+     * @retval The speed as steps/s
+     **********************************************************/
+    static float int_spd_reg_val_to_steps_s(uint32_t regVal)
+    {
+        return (((float)(regVal))*0.0596045f);
+    }
+    
+    /**********************************************************
+     * @brief Convert the float formatted thermal compensation
+     * factor into a K_THERM register value
+     * @param[in] compFactor the float formatted thermal 
+     * compensation factor, range 1 to 1.46875
+     * @retval value for K_THERM register
+     **********************************************************/
+    static uint8_t k_therm_comp_to_reg_val(float compFactor)
+    {
+        return ((uint8_t)((((float)(compFactor)-1.0f)*32.0f)+0.5f));
+    }
+    
+    /**********************************************************
+     * @brief Convert the K_THERM register value into a float 
+     * formatted thermal compensation factor
+     * @param[in] regVal The K_THERM register value
+     * @retval The float formatted thermal compensation factor
+     **********************************************************/
+    static float k_therm_reg_val_to_comp(uint32_t regVal)
+    {
+        return (((float)(regVal))*0.03125f+1);
+    }
+    
+    /**********************************************************
+     * @brief Converts voltage in percentage to values for KVAL_RUN,
+     * KVAL_HOLD, KVAL_ACC or KVAL_DEC register
+     * @param[in] percentage percentage of the power supply voltage
+     * applied to the motor windings, range 0.4% to 99.6%
+     * @retval value for KVAL_RUN, KVAL_HOLD, KVAL_ACC or
+     * KVAL_DEC register
+     * @note The voltage applied is sinusoidal
+     **********************************************************/
+    static uint8_t k_val_perc_to_reg_val(float percentage)
+    {
+        return ((uint8_t)(((float)(percentage)*2.56f)+0.5f));
+    }
+    
+    /**********************************************************
+     * @brief Converts values from KVAL_RUN, KVAL_HOLD, KVAL_ACC
+     * or KVAL_DEC register to percentage
+     * @param[in] regVal The KVAL_RUN, KVAL_HOLD, KVAL_ACC
+     * or KVAL_DEC register value
+     * @retval percentage of the power supply voltage applied to
+     * the motor windings
+     * @note The voltage applied is sinusoidal
+     **********************************************************/
+    static float k_val_reg_val_to_perc(uint32_t regVal)
+    {
+        return (((float)(regVal))*0.390625f);
+    }
+    
+    /**********************************************************
+     * @brief Convert the float formatted speed into a MAX_SPEED 
+     * register value
+     * @param[in] steps_s the speed as steps/s, range 15.25 to 15610 steps/s
+     * @retval The speed as steps/tick
+     **********************************************************/
+    static uint16_t max_spd_steps_s_to_reg_val(float steps_s)
+    {
+        return ((uint16_t)(((float)(steps_s)*0.065536f)+0.5f));
+    }
+    
+    /**********************************************************
+     * @brief Convert the MAX_SPEED register value into step/s
+     * @param[in] regVal The MAX_SPEED register value
+     * @retval The speed as steps/s
+     **********************************************************/
+    static float max_spd_reg_val_to_steps_s(uint32_t regVal)
+    {
+        return (((float)(regVal))*15.258789f);
+    }
+    
+    /**********************************************************
+     * @brief Convert the float formatted speed into a MIN_SPEED 
+     * register value
+     * @param[in] steps_s the speed as steps/s, range 0 to 976.3 steps/s
+     * @retval The speed as steps/tick
+     **********************************************************/
+    static uint16_t min_spd_steps_s_to_reg_val(float steps_s)
+    {
+        return ((uint16_t)(((float)(steps_s)*4.194304f)+0.5f));
+    }
+    
+    /**********************************************************
+     * @brief Convert the MIN_SPEED register value into step/s
+     * @param[in] regVal The MIN_SPEED register value
+     * @retval The speed as steps/s
+     **********************************************************/
+    static float min_spd_reg_val_to_steps_s(uint32_t regVal)
+    {
+        return (((float)(regVal))*0.238418579f);
+    }
+    
+    /**********************************************************
+     * @brief Convert the float formatted speed into a SPEED 
+     * register value
+     * @param[in] steps_s the speed as steps/s, range 0 to 15625 steps/s
+     * @retval The speed as steps/tick
+     **********************************************************/
+    static uint32_t speed_steps_s_to_reg_val(float steps_s)
+    {
+        return ((uint32_t)(((float)(steps_s)*67.108864f)+0.5f));
+    }
+    
+    /**********************************************************
+     * @brief Convert the SPEED register value into step/s
+     * @param[in] regVal The SPEED register value
+     * @retval The speed as steps/s
+     **********************************************************/
+    static float speed_reg_val_to_steps_s(uint32_t regVal)
+    {
+        return (((float)(regVal))*0.01490116119f);
+    }
+    
+    /**********************************************************
+     * @brief Converts STALL or OCD Threshold voltage in mV to 
+     * values for STALL_TH or OCD_TH register
+     * @param[in] mV voltage in mV, range 31.25mV to 1000mV
+     * @retval value for STALL_TH or OCD_TH register
+     **********************************************************/
+    static uint8_t stall_ocd_th_to_reg_val(float mV)
+    {
+        return ((uint8_t)((((float)(mV)-31.25f)*0.032f)+0.5f));
+    }
+    
+    /**********************************************************
+     * @brief Converts values from STALL_TH or OCD_TH register 
+     * to mV
+     * @param[in] regVal The STALL_TH or OCD_TH register value
+     * @retval voltage in mV
+     **********************************************************/
+    static float stall_ocd_reg_val_to_th(uint32_t regVal)
+    {
+        return (((float)(regVal+1))*31.25f);
+    }
+    
+    /**********************************************************
+     * @brief Converts voltage in mV to values for TVAL_RUN,
+     * TVAL_HOLD, TVAL_ACC or TVAL_DEC register
+     * @param[in] voltage_mV voltage in mV, range 7.8mV to 1000mV
+     * @retval value for TVAL_RUN, TVAL_HOLD, TVAL_ACC or
+     * TVAL_DEC register
+     * @note The voltage corresponds to a peak output current
+     * accross the external sense power resistor
+     **********************************************************/
+    static uint8_t t_val_ref_voltage_to_reg_val(float voltage_mV)
+    {
+        return ((uint8_t)((((float)(voltage_mV)-7.8125f)*0.128f)+0.5f));
+    }
+    
+    /**********************************************************
+     * @brief Converts values from TVAL_RUN, TVAL_HOLD, TVAL_ACC
+     * or TVAL_DEC register to mV
+     * @param[in] regVal The TVAL_RUN, TVAL_HOLD, TVAL_ACC
+     * or TVAL_DEC register value
+     * @retval voltage in mV
+     * @note The voltage corresponds to a peak output current
+     * accross the external sense power resistor
+     **********************************************************/
+    static float t_val_reg_val_to_ref_voltage(uint32_t regVal)
+    {
+        return (((float)(regVal+1))*7.8125f);
+    }
+    
+    /**********************************************************
+     * @brief Convert time in us to values for TON_MIN register
+     * @param[in] tmin_us time in us, range 0.5us to 64us
+     * @retval value for TON_MIN register
+     **********************************************************/
+    static uint8_t t_min_time_to_reg_val(float tmin_us)
+    {
+        return ((uint8_t)((((float)(tmin_us)-0.5f)*2.0f)+0.5f));
+    }
+    
+    /**********************************************************
+     * @brief Convert values for TON_MIN or TOFF_MIN register to time in us
+     * @param[in] regVal The TON_MIN or TOFF_MIN register value
+     * @retval time in us
+     **********************************************************/
+    static float t_min_reg_val_to_time(uint32_t regVal)
+    {
+        return (((float)(regVal+1))*0.5f);
+    }
+    
+    /*** 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 ***/
+
+    /* 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)                      *
+     *------------------------------------------------------------------------*/
+    status_t Powerstep01_Init(void *init);
+    status_t Powerstep01_ReadID(uint8_t *id);
+    void Powerstep01_AttachErrorHandler(void (*callback)(uint16_t error));
+    uint8_t Powerstep01_CheckBusyHw(void);
+    uint8_t Powerstep01_CheckStatusHw(void);
+    uint16_t Powerstep01_CmdGetStatus(void);
+    void Powerstep01_CmdGoHome(void);
+    void Powerstep01_CmdGoMark(void);
+    void Powerstep01_CmdGoTo(int32_t targetPosition);
+    void Powerstep01_CmdGoToDir(motorDir_t direction, int32_t targetPosition);
+    void Powerstep01_CmdGoUntil(motorAction_t action, motorDir_t direction, uint32_t speed);
+    void Powerstep01_CmdHardHiZ(void);
+    void Powerstep01_CmdHardStop(void);
+    void Powerstep01_CmdMove(motorDir_t direction, uint32_t stepCount);
+    void Powerstep01_CmdNop(void);
+    void Powerstep01_CmdReleaseSw(motorAction_t action, motorDir_t direction);
+    void Powerstep01_CmdResetDevice(void);
+    void Powerstep01_CmdResetPos(void);
+    void Powerstep01_CmdRun(motorDir_t direction, uint32_t speed);
+    void Powerstep01_CmdSoftHiZ(void);
+    void Powerstep01_CmdSoftStop(void);
+    void Powerstep01_CmdStepClock(motorDir_t direction);
+    void Powerstep01_ErrorHandler(uint16_t error);
+    void Powerstep01_FetchAndClearAllStatus(void); 
+    uint16_t Powerstep01_GetFetchedStatus(void);
+    uint32_t Powerstep01_GetFwVersion(void);
+    int32_t Powerstep01_GetMark(void);
+    int32_t Powerstep01_GetPosition(void);
+    bool Powerstep01_IsDeviceBusy(void);
+    uint16_t Powerstep01_ReadStatusRegister(void);
+    bool Powerstep01_SelectStepMode(motorStepMode_t stepMode);
+    void Powerstep01_SetHome(void);
+    void Powerstep01_SetMark(void);
+    void Powerstep01_WaitForAllDevicesNotBusy(void);
+    void Powerstep01_WaitWhileActive(void);
+
+    /**
+     * @brief To and from register parameter conversion functions
+     */
+    int32_t Powerstep01_ConvertPosition(uint32_t abs_position_reg);
+
+    /**
+     * @brief Functions to initialize the registers
+     */
+    void Powerstep01_SetDeviceParamsToGivenValues(powerstep01_init_u_t *initPrm);
+    void Powerstep01_SetRegisterToPredefinedValues(void);
+    
+    /**
+     * @brief Functions to get and set parameters using digital or analog values
+     */
+    uint32_t Powerstep01_CmdGetParam(powerstep01_Registers_t param);
+    void Powerstep01_CmdSetParam(powerstep01_Registers_t param, uint32_t value);
+    float Powerstep01_GetAnalogValue(powerstep01_Registers_t param);
+    void Powerstep01_QueueCommands(uint8_t command, int32_t value);
+    void Powerstep01_SendCommand(uint8_t command, uint32_t value);
+    void Powerstep01_SendQueuedCommands(void);
+    bool Powerstep01_SetAnalogValue(powerstep01_Registers_t param, float value);
+    void Powerstep01_WriteBytes(uint8_t *pByteToTransmit, uint8_t *pReceivedByte);    
+    
+    /**
+     * @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 Powerstep01.
+     * @param[out] pBuffer pointer to the buffer to read data into.
+     * @param  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 Powerstep01.
+     * @param  pBuffer pointer to the buffer of data to send.
+     * @param  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 Powerstep01 at the same time.
+     * @param[out] pBufferToRead pointer to the buffer to read data into.
+     * @param  pBufferToWrite pointer to the buffer of data to send.
+     * @param  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.   *
+     *------------------------------------------------------------------------*/
+    /**
+     * @brief  Making the CPU wait.
+     * @param  None.
+     * @retval None.
+     */
+    void Powerstep01_Board_Delay(uint32_t delay)
+    {
+        wait_ms(delay);
+    }
+
+    /**
+     * @brief  Enabling interrupts.
+     * @param  None.
+     * @retval None.
+     */
+    void Powerstep01_Board_EnableIrq(void)
+    {
+        __enable_irq();
+    }
+
+    /**
+     * @brief  Disabling interrupts.
+     * @param  None.
+     * @retval None.
+     */
+    void Powerstep01_Board_DisableIrq(void)
+    {
+        __disable_irq();
+    }
+
+    /**
+     * @brief  Initialising the PWM.
+     * @param  None.
+     * @retval None.
+     */
+    void Powerstep01_Board_StepClockInit(void) {}
+
+    /**
+     * @brief  Exit the device from reset mode.
+     * @param  None.
+     * @retval None.
+     */
+    void Powerstep01_Board_ReleaseReset(void)
+    {
+        standby_reset = 1;
+    }
+
+    /**
+     * @brief  Put the device in reset mode.
+     * @param  None.
+     * @retval None.
+     */
+    void Powerstep01_Board_reset(void)
+    {
+        standby_reset = 0;
+    }
+
+    /**
+     * @brief      Writing and reading bytes to/from the component through the SPI at the same time.
+     * @param  pByteToTransmit pointer to the buffer of data to send.
+     * @param[out] pReceivedByte pointer to the buffer to read data into.
+     * @retval     "0" in case of success, "1" otherwise.
+     */
+    uint8_t Powerstep01_Board_SpiWriteBytes(uint8_t *pByteToTransmit, uint8_t *pReceivedByte)
+    {
+        return (uint8_t) (ReadWrite(pReceivedByte, pByteToTransmit, numberOfDevices) == COMPONENT_OK ? 0 : 1);
+    }
+
+
+    /*** 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;
+
+    /* Pulse Width Modulation pin. */
+    PwmOut pwm;
+
+    /* 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. */
+    void (*errorHandlerCallback)(uint16_t error);
+    uint8_t deviceInstance;
+
+    /* Static data. */
+    static uint8_t numberOfDevices;
+    static uint8_t spiTxBursts[POWERSTEP01_CMD_ARG_MAX_NB_BYTES][MAX_NUMBER_OF_DEVICES];
+    static uint8_t spiRxBursts[POWERSTEP01_CMD_ARG_MAX_NB_BYTES][MAX_NUMBER_OF_DEVICES];
+
+
+public:
+
+    /* Static data. */
+    static bool spiPreemptionByIsr;
+    static bool isrFlag;
+    
+};
+
+#endif // __POWERSTEP01_CLASS_H
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Components/PowerStep01/PowerStep01_config.h	Fri Mar 24 10:24:39 2017 +0000
@@ -0,0 +1,703 @@
+/**
+ ******************************************************************************
+ * @file    PowerStep01_config.h
+ * @author  IPC Rennes
+ * @version V1.2.0
+ * @date    March 18th, 2016
+ * @brief   Predefines values for the Powerstep01 registers
+ * and for the devices parameters
+ * @note    (C) COPYRIGHT 2016 STMicroelectronics
+ ******************************************************************************
+ * @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 __POWERSTEP01_CONFIG_H
+#define __POWERSTEP01_CONFIG_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif 
+
+/* Definitions ---------------------------------------------------------------*/
+
+/** @addtogroup PowerStep01
+  * @{
+  */
+
+/** @addtogroup Powerstep01_Exported_Defines
+  * @{
+  */
+
+/** @defgroup Predefined_Powerstep01_Registers_Values Predefined Powerstep01 Registers Values
+  * @{
+  */
+
+/// The maximum number of devices in the daisy chain
+#define MAX_NUMBER_OF_DEVICES                 (3)
+
+/****************************************************************************/
+/* Device 0                                                                 */
+/****************************************************************************/
+  
+/**************************** Speed Profile *********************************/
+/// Register : ACC
+/// Acceleration rate in step/s2, range 14.55 to 59590 steps/s^2 
+#define POWERSTEP01_CONF_PARAM_ACC_DEVICE_0 (582)
+
+/// Register : DEC
+/// Deceleration rate in step/s2, range 14.55 to 59590 steps/s^2
+#define POWERSTEP01_CONF_PARAM_DEC_DEVICE_0 (582)
+
+///Register : MAX_SPEED
+/// Maximum speed in step/s, range 15.25 to 15610 steps/s
+#define POWERSTEP01_CONF_PARAM_MAX_SPEED_DEVICE_0 (488)
+
+/// Register : MIN_SPEED 
+/// Minimum speed in step/s, range 0 to 976.3 steps/s
+#define POWERSTEP01_CONF_PARAM_MIN_SPEED_DEVICE_0 (0)
+
+/// Register : FS_SPD 
+/// Full step speed in step/s, range 7.63 to 15625 steps/s
+#define POWERSTEP01_CONF_PARAM_FS_SPD_DEVICE_0 (244.16)
+
+/// Register : FS_SPD - field : BOOST_MODE 
+/// Boost of the amplitude square wave, enum powerstep01_BoostMode_t
+#define POWERSTEP01_CONF_PARAM_BOOST_MODE_DEVICE_0 (POWERSTEP01_BOOST_MODE_OFF)
+
+
+/************************ Voltage mode parameters  **************************/
+/// Register : KVAL_ACC 
+/// Acceleration duty cycle (torque) in %, range 0 to 99.6%
+#define POWERSTEP01_CONF_PARAM_KVAL_ACC_DEVICE_0 (16.02)
+
+/// Register : KVAL_DEC 
+/// Deceleration duty cycle (torque) in %, range 0 to 99.6%
+#define POWERSTEP01_CONF_PARAM_KVAL_DEC_DEVICE_0 (16.02)
+
+/// Register : KVAL_RUN 
+/// run duty cycle (torque) in %, range 0 to 99.6%
+#define POWERSTEP01_CONF_PARAM_KVAL_RUN_DEVICE_0 (16.02)
+
+/// Register : KVAL_HOLD 
+/// Hold duty cycle (torque) in %, range 0 to 99.6%
+#define POWERSTEP01_CONF_PARAM_KVAL_HOLD_DEVICE_0 (16.02)
+
+/// Register : CONFIG - field : EN_VSCOMP 
+/// Motor Supply Voltage Compensation enabling , enum powerstep01_ConfigEnVscomp_t
+#define POWERSTEP01_CONF_PARAM_VS_COMP_DEVICE_0 (POWERSTEP01_CONFIG_VS_COMP_DISABLE)
+
+/// Register : MIN_SPEED - field : LSPD_OPT 
+/// Low speed optimization bit, enum powerstep01_LspdOpt_t
+#define POWERSTEP01_CONF_PARAM_LSPD_BIT_DEVICE_0 (POWERSTEP01_LSPD_OPT_OFF)
+
+/// Register : K_THERM 
+/// Thermal compensation param, range 1 to 1.46875
+#define POWERSTEP01_CONF_PARAM_K_THERM_DEVICE_0 (1)
+
+/// Register : INT_SPEED 
+/// Intersect speed settings for BEMF compensation in steps/s, range 0 to 3906 steps/s
+#define POWERSTEP01_CONF_PARAM_INT_SPD_DEVICE_0 (61.512)
+
+/// Register : ST_SLP 
+/// BEMF start slope settings for BEMF compensation in % step/s, range 0 to 0.4% s/step
+#define POWERSTEP01_CONF_PARAM_ST_SLP_DEVICE_0 (0.03815)
+
+/// Register : FN_SLP_ACC 
+/// BEMF final acc slope settings for BEMF compensation in % step/s, range 0 to 0.4% s/step
+#define POWERSTEP01_CONF_PARAM_FN_SLP_ACC_DEVICE_0 (0.06256)
+
+/// Register : FN_SLP_DEC 
+/// BEMF final dec slope settings for BEMF compensation in % step/s, range 0 to 0.4% s/step
+#define POWERSTEP01_CONF_PARAM_FN_SLP_DEC_DEVICE_0 (0.06256)
+
+/// Register : CONFIG - field : F_PWM_INT 
+/// PWM Frequency Integer division, enum powerstep01_ConfigFPwmInt_t
+#define POWERSTEP01_CONF_PARAM_PWM_DIV_DEVICE_0 (POWERSTEP01_CONFIG_PWM_DIV_2)
+
+/// Register : CONFIG - field : F_PWM_DEC 
+/// PWM Frequency Integer Multiplier, enum powerstep01_ConfigFPwmDec_t
+#define POWERSTEP01_CONF_PARAM_PWM_MUL_DEVICE_0 (POWERSTEP01_CONFIG_PWM_MUL_1)
+
+/******************** Advance current control parameters  *********************/
+
+/// Register : TVAL_ACC 
+/// Acceleration torque in mV, range from 7.8mV to 1000 mV 
+#define POWERSTEP01_CONF_PARAM_TVAL_ACC_DEVICE_0  (328.12)
+
+/// Register : TVAL_DEC 
+/// Deceleration torque in mV, range from 7.8mV to 1000 mV 
+#define POWERSTEP01_CONF_PARAM_TVAL_DEC_DEVICE_0  (328.12)
+
+/// Register : TVAL_RUN 
+/// Running torque in mV, range from 7.8mV to 1000 mV 
+#define POWERSTEP01_CONF_PARAM_TVAL_RUN_DEVICE_0  (328.12)
+
+/// Register : TVAL_HOLD 
+/// Holding torque in mV, range from 7.8mV to 1000 mV 
+#define POWERSTEP01_CONF_PARAM_TVAL_HOLD_DEVICE_0 (328.12) 
+
+/// Register : CONFIG - field : EN_TQREG 
+/// External torque regulation enabling , enum powerstep01_ConfigEnTqReg_t 
+#define POWERSTEP01_CONF_PARAM_TQ_REG_DEVICE_0 (POWERSTEP01_CONFIG_TQ_REG_TVAL_USED)  
+
+/// Register : CONFIG - field : PRED_EN 
+/// Predictive current enabling , enum powerstep01_ConfigPredEn_t  
+#define POWERSTEP01_CONF_PARAM_PRED_DEVICE_0 (POWERSTEP01_CONFIG_PRED_DISABLE)  
+
+///  Register : TON_MIN 
+///  Minimum on-time in us, range 0.5us to 64us 
+#define POWERSTEP01_CONF_PARAM_TON_MIN_DEVICE_0 (3.0)
+
+/// Register : TOFF_MIN 
+///  Minimum off-time in us, range 0.5us to 64us 
+#define POWERSTEP01_CONF_PARAM_TOFF_MIN_DEVICE_0 (21.0)
+
+/// Register : T_FAST - field: TOFF_FAST 
+/// Maximum fast decay time , enum powerstep01_ToffFast_t
+#define POWERSTEP01_CONF_PARAM_TOFF_FAST_DEVICE_0  (POWERSTEP01_TOFF_FAST_8us)
+
+/// Register : T_FAST - field: FAST_STEP 
+///  Maximum fall step time , enum powerstep01_FastStep_t
+#define POWERSTEP01_CONF_PARAM_FAST_STEP_DEVICE_0  (POWERSTEP01_FAST_STEP_12us)
+
+/// Register : CONFIG - field : TSW 
+/// Switching period, enum powerstep01_ConfigTsw_t
+#define POWERSTEP01_CONF_PARAM_TSW_DEVICE_0 (POWERSTEP01_CONFIG_TSW_048us)  
+
+/****************************** Gate Driving **********************************/
+
+/// Register : GATECFG1 - field : IGATE 
+/// Gate sink/source current via enum powerstep01_Igate_t 
+#define POWERSTEP01_CONF_PARAM_IGATE_DEVICE_0      (POWERSTEP01_IGATE_64mA)
+
+/// Register : CONFIG - field : VCCVAL 
+/// VCC Val, enum powerstep01_ConfigVccVal_t 
+#define POWERSTEP01_CONF_PARAM_VCCVAL_DEVICE_0 (POWERSTEP01_CONFIG_VCCVAL_15V)
+
+/// Register : CONFIG - field : UVLOVAL 
+/// UVLO Threshold via powerstep01_ConfigUvLoVal_t 
+#define POWERSTEP01_CONF_PARAM_UVLOVAL_DEVICE_0    (POWERSTEP01_CONFIG_UVLOVAL_LOW)
+
+/// Register : GATECFG1 - field : TBOOST 
+/// Duration of the overboost phase during gate turn-off via enum powerstep01_Tboost_t 
+#define POWERSTEP01_CONF_PARAM_TBOOST_DEVICE_0     (POWERSTEP01_TBOOST_0ns)
+
+/// Register : GATECFG1 - field : TCC 
+/// Controlled current time via enum powerstep01_Tcc_t
+#define POWERSTEP01_CONF_PARAM_TCC_DEVICE_0        (POWERSTEP01_TCC_500ns)
+
+/// Duration of the blanking time via enum powerstep01_TBlank_t 
+#define POWERSTEP01_CONF_PARAM_TBLANK_DEVICE_0     (POWERSTEP01_TBLANK_375ns)
+
+/// Register : GATECFG2 - field : TDT 
+/// Duration of the dead time via enum powerstep01_Tdt_t
+#define POWERSTEP01_CONF_PARAM_TDT_DEVICE_0        (POWERSTEP01_TDT_125ns)
+
+/******************************* Others *************************************/
+
+/// Register : OCD_TH 
+/// Overcurrent threshold settings via enum powerstep01_OcdTh_t
+#define POWERSTEP01_CONF_PARAM_OCD_TH_DEVICE_0 (POWERSTEP01_OCD_TH_281_25mV)
+
+/// Register : CONFIG - field : OC_SD 
+/// Over current shutwdown enabling, enum powerstep01_ConfigOcSd_t 
+#define POWERSTEP01_CONF_PARAM_OC_SD_DEVICE_0 (POWERSTEP01_CONFIG_OC_SD_DISABLE)
+
+/// Register : STALL_TH 
+/// Stall threshold settings in mV, range 31.25mV to 1000mV 
+#define POWERSTEP01_CONF_PARAM_STALL_TH_DEVICE_0 (531.25)
+
+/// Register : ALARM_EN 
+/// Alarm settings via bitmap enum powerstep01_AlarmEn_t 
+#define POWERSTEP01_CONF_PARAM_ALARM_EN_DEVICE_0 (POWERSTEP01_ALARM_EN_OVERCURRENT | \
+                                                  POWERSTEP01_ALARM_EN_THERMAL_SHUTDOWN |  \
+                                                  POWERSTEP01_ALARM_EN_THERMAL_WARNING |  \
+                                                  POWERSTEP01_ALARM_EN_UVLO |  \
+                                                  POWERSTEP01_ALARM_EN_STALL_DETECTION |  \
+                                                  POWERSTEP01_ALARM_EN_SW_TURN_ON | \
+                                                  POWERSTEP01_ALARM_EN_WRONG_NPERF_CMD)
+
+/// Register : CONFIG - field : SW_MODE 
+/// External switch hard stop interrupt mode, enum powerstep01_ConfigSwMode_t 
+#define POWERSTEP01_CONF_PARAM_SW_MODE_DEVICE_0 (POWERSTEP01_CONFIG_SW_HARD_STOP)
+
+/// Register : STEP_MODE - field : STEP_MODE 
+/// Step mode settings via enum motorStepMode_t 
+#define POWERSTEP01_CONF_PARAM_STEP_MODE_DEVICE_0 (STEP_MODE_1_16)
+
+/// Register : STEP_MODE - field : CM_VM 
+/// Current mode or Voltage mode via enum powerstep01_CmVm_t 
+#define POWERSTEP01_CONF_PARAM_CM_VM_DEVICE_0 (POWERSTEP01_CM_VM_CURRENT)
+
+/// Register : STEP_MODE - Field : SYNC_MODE and SYNC_EN 
+/// Synch. Mode settings via enum powerstep01_SyncSel_t 
+#define POWERSTEP01_CONF_PARAM_SYNC_MODE_DEVICE_0 (POWERSTEP01_SYNC_SEL_DISABLED)
+
+/// Register : CONFIG - field : OSC_CLK_SEL 
+/// Clock setting , enum powerstep01_ConfigOscMgmt_t 
+#define POWERSTEP01_CONF_PARAM_CLOCK_SETTING_DEVICE_0 (POWERSTEP01_CONFIG_INT_16MHZ_OSCOUT_2MHZ)
+
+/// Register : GATECFG1 - field : WD_EN 
+/// External clock watchdog, enum powerstep01_WdEn_t
+#define POWERSTEP01_CONF_PARAM_WD_EN_DEVICE_0 (POWERSTEP01_WD_EN_DISABLE)
+
+/****************************************************************************/
+/* Device 1                                                                 */
+/****************************************************************************/
+  
+/**************************** Speed Profile *********************************/
+/// Register : ACC
+/// Acceleration rate in step/s2, range 14.55 to 59590 steps/s^2 
+#define POWERSTEP01_CONF_PARAM_ACC_DEVICE_1 (2008.16)
+
+/// Register : DEC
+/// Deceleration rate in step/s2, range 14.55 to 59590 steps/s^2
+#define POWERSTEP01_CONF_PARAM_DEC_DEVICE_1 (2008.16)
+
+///Register : MAX_SPEED
+/// Maximum speed in step/s, range 15.25 to 15610 steps/s
+#define POWERSTEP01_CONF_PARAM_MAX_SPEED_DEVICE_1 (991.82)
+
+/// Register : MIN_SPEED 
+/// Minimum speed in step/s, range 0 to 976.3 steps/s
+#define POWERSTEP01_CONF_PARAM_MIN_SPEED_DEVICE_1 (0)
+
+/// Register : FS_SPD 
+/// Full step speed in step/s, range 7.63 to 15625 steps/s
+#define POWERSTEP01_CONF_PARAM_FS_SPD_DEVICE_1 (595.09)
+
+/// Register : FS_SPD - field : BOOST_MODE 
+/// Boost of the amplitude square wave, enum powerstep01_BoostMode_t
+#define POWERSTEP01_CONF_PARAM_BOOST_MODE_DEVICE_1 (POWERSTEP01_BOOST_MODE_OFF)
+
+
+/************************ Voltage mode parameters  **************************/
+/// Register : KVAL_ACC 
+/// Acceleration duty cycle (torque) in %, range 0 to 99.6%
+#define POWERSTEP01_CONF_PARAM_KVAL_ACC_DEVICE_1 (16.02)
+
+/// Register : KVAL_DEC 
+/// Deceleration duty cycle (torque) in %, range 0 to 99.6%
+#define POWERSTEP01_CONF_PARAM_KVAL_DEC_DEVICE_1 (16.02)
+
+/// Register : KVAL_RUN 
+/// run duty cycle (torque) in %, range 0 to 99.6%
+#define POWERSTEP01_CONF_PARAM_KVAL_RUN_DEVICE_1 (16.02)
+
+/// Register : KVAL_HOLD 
+/// Hold duty cycle (torque) in %, range 0 to 99.6%
+#define POWERSTEP01_CONF_PARAM_KVAL_HOLD_DEVICE_1 (16.02)
+
+/// Register : CONFIG - field : EN_VSCOMP 
+/// Motor Supply Voltage Compensation enabling , enum powerstep01_ConfigEnVscomp_t
+#define POWERSTEP01_CONF_PARAM_VS_COMP_DEVICE_1 (POWERSTEP01_CONFIG_VS_COMP_DISABLE)
+
+/// Register : MIN_SPEED - field : LSPD_OPT 
+/// Low speed optimization bit, enum powerstep01_LspdOpt_t
+#define POWERSTEP01_CONF_PARAM_LSPD_BIT_DEVICE_1 (POWERSTEP01_LSPD_OPT_OFF)
+
+/// Register : K_THERM 
+/// Thermal compensation param, range 1 to 1.46875
+#define POWERSTEP01_CONF_PARAM_K_THERM_DEVICE_1 (1)
+
+/// Register : INT_SPEED 
+/// Intersect speed settings for BEMF compensation in steps/s, range 0 to 3906 steps/s
+#define POWERSTEP01_CONF_PARAM_INT_SPD_DEVICE_1 (61.512)
+
+/// Register : ST_SLP 
+/// BEMF start slope settings for BEMF compensation in % step/s, range 0 to 0.4% s/step
+#define POWERSTEP01_CONF_PARAM_ST_SLP_DEVICE_1 (0.03815)
+
+/// Register : FN_SLP_ACC 
+/// BEMF final acc slope settings for BEMF compensation in % step/s, range 0 to 0.4% s/step
+#define POWERSTEP01_CONF_PARAM_FN_SLP_ACC_DEVICE_1 (0.06256)
+
+/// Register : FN_SLP_DEC 
+/// BEMF final dec slope settings for BEMF compensation in % step/s, range 0 to 0.4% s/step
+#define POWERSTEP01_CONF_PARAM_FN_SLP_DEC_DEVICE_1 (0.06256)
+
+/// Register : CONFIG - field : F_PWM_INT 
+/// PWM Frequency Integer division, enum powerstep01_ConfigFPwmInt_t
+#define POWERSTEP01_CONF_PARAM_PWM_DIV_DEVICE_1 (POWERSTEP01_CONFIG_PWM_DIV_2)
+
+/// Register : CONFIG - field : F_PWM_DEC 
+/// PWM Frequency Integer Multiplier, enum powerstep01_ConfigFPwmDec_t
+#define POWERSTEP01_CONF_PARAM_PWM_MUL_DEVICE_1 (POWERSTEP01_CONFIG_PWM_MUL_1)
+
+/******************** Advance current control parameters  *********************/
+
+/// Register : TVAL_ACC 
+/// Acceleration torque in mV, range from 7.8mV to 1000 mV 
+#define POWERSTEP01_CONF_PARAM_TVAL_ACC_DEVICE_1  (328.12)
+
+/// Register : TVAL_DEC 
+/// Deceleration torque in mV, range from 7.8mV to 1000 mV 
+#define POWERSTEP01_CONF_PARAM_TVAL_DEC_DEVICE_1  (328.12)
+
+/// Register : TVAL_RUN 
+/// Running torque in mV, range from 7.8mV to 1000 mV 
+#define POWERSTEP01_CONF_PARAM_TVAL_RUN_DEVICE_1  (328.12)
+
+/// Register : TVAL_HOLD 
+/// Holding torque in mV, range from 7.8mV to 1000 mV 
+#define POWERSTEP01_CONF_PARAM_TVAL_HOLD_DEVICE_1 (328.12) 
+
+/// Register : CONFIG - field : EN_TQREG 
+/// External torque regulation enabling , enum powerstep01_ConfigEnTqReg_t 
+#define POWERSTEP01_CONF_PARAM_TQ_REG_DEVICE_1 (POWERSTEP01_CONFIG_TQ_REG_TVAL_USED)  
+
+/// Register : CONFIG - field : PRED_EN 
+/// Predictive current enabling , enum powerstep01_ConfigPredEn_t  
+#define POWERSTEP01_CONF_PARAM_PRED_DEVICE_1 (POWERSTEP01_CONFIG_PRED_DISABLE)  
+
+///  Register : TON_MIN 
+///  Minimum on-time in us, range 0.5us to 64us 
+#define POWERSTEP01_CONF_PARAM_TON_MIN_DEVICE_1 (3.0)
+
+/// Register : TOFF_MIN 
+///  Minimum off-time in us, range 0.5us to 64us 
+#define POWERSTEP01_CONF_PARAM_TOFF_MIN_DEVICE_1 (21.0)
+
+/// Register : T_FAST - field: TOFF_FAST 
+/// Maximum fast decay time , enum powerstep01_ToffFast_t
+#define POWERSTEP01_CONF_PARAM_TOFF_FAST_DEVICE_1  (POWERSTEP01_TOFF_FAST_8us)
+
+/// Register : T_FAST - field: FAST_STEP 
+///  Maximum fall step time , enum powerstep01_FastStep_t
+#define POWERSTEP01_CONF_PARAM_FAST_STEP_DEVICE_1  (POWERSTEP01_FAST_STEP_12us)
+
+/// Register : CONFIG - field : TSW 
+/// Switching period, enum powerstep01_ConfigTsw_t
+#define POWERSTEP01_CONF_PARAM_TSW_DEVICE_1 (POWERSTEP01_CONFIG_TSW_048us)  
+
+/****************************** Gate Driving **********************************/
+
+/// Register : GATECFG1 - field : IGATE 
+/// Gate sink/source current via enum powerstep01_Igate_t 
+#define POWERSTEP01_CONF_PARAM_IGATE_DEVICE_1      (POWERSTEP01_IGATE_64mA)
+
+/// Register : CONFIG - field : VCCVAL 
+/// VCC Val, enum powerstep01_ConfigVccVal_t 
+#define POWERSTEP01_CONF_PARAM_VCCVAL_DEVICE_1 (POWERSTEP01_CONFIG_VCCVAL_15V)
+
+/// Register : CONFIG - field : UVLOVAL 
+/// UVLO Threshold via powerstep01_ConfigUvLoVal_t 
+#define POWERSTEP01_CONF_PARAM_UVLOVAL_DEVICE_1    (POWERSTEP01_CONFIG_UVLOVAL_LOW)
+
+/// Register : GATECFG1 - field : TBOOST 
+/// Duration of the overboost phase during gate turn-off via enum powerstep01_Tboost_t 
+#define POWERSTEP01_CONF_PARAM_TBOOST_DEVICE_1     (POWERSTEP01_TBOOST_0ns)
+
+/// Register : GATECFG1 - field : TCC 
+/// Controlled current time via enum powerstep01_Tcc_t
+#define POWERSTEP01_CONF_PARAM_TCC_DEVICE_1        (POWERSTEP01_TCC_500ns)
+
+/// Duration of the blanking time via enum powerstep01_TBlank_t 
+#define POWERSTEP01_CONF_PARAM_TBLANK_DEVICE_1     (POWERSTEP01_TBLANK_375ns)
+
+/// Register : GATECFG2 - field : TDT 
+/// Duration of the dead time via enum powerstep01_Tdt_t
+#define POWERSTEP01_CONF_PARAM_TDT_DEVICE_1        (POWERSTEP01_TDT_125ns)
+
+/******************************* Others *************************************/
+
+/// Register : OCD_TH 
+/// Overcurrent threshold settings via enum powerstep01_OcdTh_t
+#define POWERSTEP01_CONF_PARAM_OCD_TH_DEVICE_1 (POWERSTEP01_OCD_TH_281_25mV)
+
+/// Register : CONFIG - field : OC_SD 
+/// Over current shutwdown enabling, enum powerstep01_ConfigOcSd_t 
+#define POWERSTEP01_CONF_PARAM_OC_SD_DEVICE_1 (POWERSTEP01_CONFIG_OC_SD_DISABLE)
+
+/// Register : STALL_TH 
+/// Stall threshold settings in mV, range 31.25mV to 1000mV 
+#define POWERSTEP01_CONF_PARAM_STALL_TH_DEVICE_1 (531.25)
+
+/// Register : ALARM_EN 
+/// Alarm settings via bitmap enum powerstep01_AlarmEn_t 
+#define POWERSTEP01_CONF_PARAM_ALARM_EN_DEVICE_1 (POWERSTEP01_ALARM_EN_OVERCURRENT | \
+                                                  POWERSTEP01_ALARM_EN_THERMAL_SHUTDOWN |  \
+                                                  POWERSTEP01_ALARM_EN_THERMAL_WARNING |  \
+                                                  POWERSTEP01_ALARM_EN_UVLO |  \
+                                                  POWERSTEP01_ALARM_EN_STALL_DETECTION |  \
+                                                  POWERSTEP01_ALARM_EN_SW_TURN_ON | \
+                                                  POWERSTEP01_ALARM_EN_WRONG_NPERF_CMD)
+
+/// Register : CONFIG - field : SW_MODE 
+/// External switch hard stop interrupt mode, enum powerstep01_ConfigSwMode_t 
+#define POWERSTEP01_CONF_PARAM_SW_MODE_DEVICE_1 (POWERSTEP01_CONFIG_SW_HARD_STOP)
+
+/// Register : STEP_MODE - field : STEP_MODE 
+/// Step mode settings via enum powerstep01_StepSel_t 
+#define POWERSTEP01_CONF_PARAM_STEP_MODE_DEVICE_1 (STEP_MODE_1_16)
+
+/// Register : STEP_MODE - field : CM_VM 
+/// Current mode or Voltage mode via enum powerstep01_CmVm_t 
+#define POWERSTEP01_CONF_PARAM_CM_VM_DEVICE_1 (POWERSTEP01_CM_VM_CURRENT)
+
+/// Register : STEP_MODE - Field : SYNC_MODE and SYNC_EN 
+/// Synch. Mode settings via enum powerstep01_SyncSel_t 
+#define POWERSTEP01_CONF_PARAM_SYNC_MODE_DEVICE_1 (POWERSTEP01_SYNC_SEL_DISABLED)
+
+/// Register : CONFIG - field : OSC_CLK_SEL 
+/// Clock setting , enum powerstep01_ConfigOscMgmt_t 
+#define POWERSTEP01_CONF_PARAM_CLOCK_SETTING_DEVICE_1 (POWERSTEP01_CONFIG_INT_16MHZ_OSCOUT_2MHZ)
+
+/// Register : GATECFG1 - field : WD_EN 
+/// External clock watchdog, enum powerstep01_WdEn_t
+#define POWERSTEP01_CONF_PARAM_WD_EN_DEVICE_1 (POWERSTEP01_WD_EN_DISABLE)
+
+/****************************************************************************/
+/* Device 2                                                                 */
+/****************************************************************************/
+  
+/**************************** Speed Profile *********************************/
+/// Register : ACC
+/// Acceleration rate in step/s2, range 14.55 to 59590 steps/s^2 
+#define POWERSTEP01_CONF_PARAM_ACC_DEVICE_2 (2008.16)
+
+/// Register : DEC
+/// Deceleration rate in step/s2, range 14.55 to 59590 steps/s^2
+#define POWERSTEP01_CONF_PARAM_DEC_DEVICE_2 (2008.16)
+
+///Register : MAX_SPEED
+/// Maximum speed in step/s, range 15.25 to 15610 steps/s
+#define POWERSTEP01_CONF_PARAM_MAX_SPEED_DEVICE_2 (991.82)
+
+/// Register : MIN_SPEED 
+/// Minimum speed in step/s, range 0 to 976.3 steps/s
+#define POWERSTEP01_CONF_PARAM_MIN_SPEED_DEVICE_2 (0)
+
+/// Register : FS_SPD 
+/// Full step speed in step/s, range 7.63 to 15625 steps/s
+#define POWERSTEP01_CONF_PARAM_FS_SPD_DEVICE_2 (595.09)
+
+/// Register : FS_SPD - field : BOOST_MODE 
+/// Boost of the amplitude square wave, enum powerstep01_BoostMode_t
+#define POWERSTEP01_CONF_PARAM_BOOST_MODE_DEVICE_2 (POWERSTEP01_BOOST_MODE_OFF)
+
+
+/************************ Voltage mode parameters  **************************/
+/// Register : KVAL_ACC 
+/// Acceleration duty cycle (torque) in %, range 0 to 99.6%
+#define POWERSTEP01_CONF_PARAM_KVAL_ACC_DEVICE_2 (16.02)
+
+/// Register : KVAL_DEC 
+/// Deceleration duty cycle (torque) in %, range 0 to 99.6%
+#define POWERSTEP01_CONF_PARAM_KVAL_DEC_DEVICE_2 (16.02)
+
+/// Register : KVAL_RUN 
+/// run duty cycle (torque) in %, range 0 to 99.6%
+#define POWERSTEP01_CONF_PARAM_KVAL_RUN_DEVICE_2 (16.02)
+
+/// Register : KVAL_HOLD 
+/// Hold duty cycle (torque) in %, range 0 to 99.6%
+#define POWERSTEP01_CONF_PARAM_KVAL_HOLD_DEVICE_2 (16.02)
+
+/// Register : CONFIG - field : EN_VSCOMP 
+/// Motor Supply Voltage Compensation enabling , enum powerstep01_ConfigEnVscomp_t
+#define POWERSTEP01_CONF_PARAM_VS_COMP_DEVICE_2 (POWERSTEP01_CONFIG_VS_COMP_DISABLE)
+
+/// Register : MIN_SPEED - field : LSPD_OPT 
+/// Low speed optimization bit, enum powerstep01_LspdOpt_t
+#define POWERSTEP01_CONF_PARAM_LSPD_BIT_DEVICE_2 (POWERSTEP01_LSPD_OPT_OFF)
+
+/// Register : K_THERM 
+/// Thermal compensation param, range 1 to 1.46875
+#define POWERSTEP01_CONF_PARAM_K_THERM_DEVICE_2 (1)
+
+/// Register : INT_SPEED 
+/// Intersect speed settings for BEMF compensation in steps/s, range 0 to 3906 steps/s
+#define POWERSTEP01_CONF_PARAM_INT_SPD_DEVICE_2 (61.512)
+
+/// Register : ST_SLP 
+/// BEMF start slope settings for BEMF compensation in % step/s, range 0 to 0.4% s/step
+#define POWERSTEP01_CONF_PARAM_ST_SLP_DEVICE_2 (0.03815)
+
+/// Register : FN_SLP_ACC 
+/// BEMF final acc slope settings for BEMF compensation in % step/s, range 0 to 0.4% s/step
+#define POWERSTEP01_CONF_PARAM_FN_SLP_ACC_DEVICE_2 (0.06256)
+
+/// Register : FN_SLP_DEC 
+/// BEMF final dec slope settings for BEMF compensation in % step/s, range 0 to 0.4% s/step
+#define POWERSTEP01_CONF_PARAM_FN_SLP_DEC_DEVICE_2 (0.06256)
+
+/// Register : CONFIG - field : F_PWM_INT 
+/// PWM Frequency Integer division, enum powerstep01_ConfigFPwmInt_t
+#define POWERSTEP01_CONF_PARAM_PWM_DIV_DEVICE_2 (POWERSTEP01_CONFIG_PWM_DIV_2)
+
+/// Register : CONFIG - field : F_PWM_DEC 
+/// PWM Frequency Integer Multiplier, enum powerstep01_ConfigFPwmDec_t
+#define POWERSTEP01_CONF_PARAM_PWM_MUL_DEVICE_2 (POWERSTEP01_CONFIG_PWM_MUL_1)
+
+/******************** Advance current control parameters  *********************/
+
+/// Register : TVAL_ACC 
+/// Acceleration torque in mV, range from 7.8mV to 1000 mV 
+#define POWERSTEP01_CONF_PARAM_TVAL_ACC_DEVICE_2  (328.12)
+
+/// Register : TVAL_DEC 
+/// Deceleration torque in mV, range from 7.8mV to 1000 mV 
+#define POWERSTEP01_CONF_PARAM_TVAL_DEC_DEVICE_2  (328.12)
+
+/// Register : TVAL_RUN 
+/// Running torque in mV, range from 7.8mV to 1000 mV 
+#define POWERSTEP01_CONF_PARAM_TVAL_RUN_DEVICE_2  (328.12)
+
+/// Register : TVAL_HOLD 
+/// Holding torque in mV, range from 7.8mV to 1000 mV 
+#define POWERSTEP01_CONF_PARAM_TVAL_HOLD_DEVICE_2 (328.12) 
+
+/// Register : CONFIG - field : EN_TQREG 
+/// External torque regulation enabling , enum powerstep01_ConfigEnTqReg_t 
+#define POWERSTEP01_CONF_PARAM_TQ_REG_DEVICE_2 (POWERSTEP01_CONFIG_TQ_REG_TVAL_USED)  
+
+/// Register : CONFIG - field : PRED_EN 
+/// Predictive current enabling , enum powerstep01_ConfigPredEn_t  
+#define POWERSTEP01_CONF_PARAM_PRED_DEVICE_2 (POWERSTEP01_CONFIG_PRED_DISABLE)  
+
+///  Register : TON_MIN 
+///  Minimum on-time in us, range 0.5us to 64us 
+#define POWERSTEP01_CONF_PARAM_TON_MIN_DEVICE_2 (3.0)
+
+/// Register : TOFF_MIN 
+///  Minimum off-time in us, range 0.5us to 64us 
+#define POWERSTEP01_CONF_PARAM_TOFF_MIN_DEVICE_2 (21.0)
+
+/// Register : T_FAST - field: TOFF_FAST 
+/// Maximum fast decay time , enum powerstep01_ToffFast_t
+#define POWERSTEP01_CONF_PARAM_TOFF_FAST_DEVICE_2  (POWERSTEP01_TOFF_FAST_8us)
+
+/// Register : T_FAST - field: FAST_STEP 
+///  Maximum fall step time , enum powerstep01_FastStep_t
+#define POWERSTEP01_CONF_PARAM_FAST_STEP_DEVICE_2  (POWERSTEP01_FAST_STEP_12us)
+
+/// Register : CONFIG - field : TSW 
+/// Switching period, enum powerstep01_ConfigTsw_t
+#define POWERSTEP01_CONF_PARAM_TSW_DEVICE_2 (POWERSTEP01_CONFIG_TSW_048us)  
+
+/****************************** Gate Driving **********************************/
+
+/// Register : GATECFG1 - field : IGATE 
+/// Gate sink/source current via enum powerstep01_Igate_t 
+#define POWERSTEP01_CONF_PARAM_IGATE_DEVICE_2      (POWERSTEP01_IGATE_64mA)
+
+/// Register : CONFIG - field : VCCVAL 
+/// VCC Val, enum powerstep01_ConfigVccVal_t 
+#define POWERSTEP01_CONF_PARAM_VCCVAL_DEVICE_2 (POWERSTEP01_CONFIG_VCCVAL_15V)
+
+/// Register : CONFIG - field : UVLOVAL 
+/// UVLO Threshold via powerstep01_ConfigUvLoVal_t 
+#define POWERSTEP01_CONF_PARAM_UVLOVAL_DEVICE_2    (POWERSTEP01_CONFIG_UVLOVAL_LOW)
+
+/// Register : GATECFG1 - field : TBOOST 
+/// Duration of the overboost phase during gate turn-off via enum powerstep01_Tboost_t 
+#define POWERSTEP01_CONF_PARAM_TBOOST_DEVICE_2     (POWERSTEP01_TBOOST_0ns)
+
+/// Register : GATECFG1 - field : TCC 
+/// Controlled current time via enum powerstep01_Tcc_t
+#define POWERSTEP01_CONF_PARAM_TCC_DEVICE_2        (POWERSTEP01_TCC_500ns)
+
+/// Duration of the blanking time via enum powerstep01_TBlank_t 
+#define POWERSTEP01_CONF_PARAM_TBLANK_DEVICE_2     (POWERSTEP01_TBLANK_375ns)
+
+/// Register : GATECFG2 - field : TDT 
+/// Duration of the dead time via enum powerstep01_Tdt_t
+#define POWERSTEP01_CONF_PARAM_TDT_DEVICE_2        (POWERSTEP01_TDT_125ns)
+
+/******************************* Others *************************************/
+
+/// Register : OCD_TH 
+/// Overcurrent threshold settings via enum powerstep01_OcdTh_t
+#define POWERSTEP01_CONF_PARAM_OCD_TH_DEVICE_2 (POWERSTEP01_OCD_TH_281_25mV)
+
+/// Register : CONFIG - field : OC_SD 
+/// Over current shutwdown enabling, enum powerstep01_ConfigOcSd_t 
+#define POWERSTEP01_CONF_PARAM_OC_SD_DEVICE_2 (POWERSTEP01_CONFIG_OC_SD_DISABLE)
+
+/// Register : STALL_TH 
+/// Stall threshold settings in mV, range 31.25mV to 1000mV 
+#define POWERSTEP01_CONF_PARAM_STALL_TH_DEVICE_2 (531.25)
+
+/// Register : ALARM_EN 
+/// Alarm settings via bitmap enum powerstep01_AlarmEn_t 
+#define POWERSTEP01_CONF_PARAM_ALARM_EN_DEVICE_2 (POWERSTEP01_ALARM_EN_OVERCURRENT | \
+                                                  POWERSTEP01_ALARM_EN_THERMAL_SHUTDOWN |  \
+                                                  POWERSTEP01_ALARM_EN_THERMAL_WARNING |  \
+                                                  POWERSTEP01_ALARM_EN_UVLO |  \
+                                                  POWERSTEP01_ALARM_EN_STALL_DETECTION |  \
+                                                  POWERSTEP01_ALARM_EN_SW_TURN_ON | \
+                                                  POWERSTEP01_ALARM_EN_WRONG_NPERF_CMD)
+
+/// Register : CONFIG - field : SW_MODE 
+/// External switch hard stop interrupt mode, enum powerstep01_ConfigSwMode_t 
+#define POWERSTEP01_CONF_PARAM_SW_MODE_DEVICE_2 (POWERSTEP01_CONFIG_SW_HARD_STOP)
+
+/// Register : STEP_MODE - field : STEP_MODE 
+/// Step mode settings via enum powerstep01_StepSel_t 
+#define POWERSTEP01_CONF_PARAM_STEP_MODE_DEVICE_2 (STEP_MODE_1_16)
+
+/// Register : STEP_MODE - field : CM_VM 
+/// Current mode or Voltage mode via enum powerstep01_CmVm_t 
+#define POWERSTEP01_CONF_PARAM_CM_VM_DEVICE_2 (POWERSTEP01_CM_VM_CURRENT)
+
+/// Register : STEP_MODE - Field : SYNC_MODE and SYNC_EN 
+/// Synch. Mode settings via enum powerstep01_SyncSel_t 
+#define POWERSTEP01_CONF_PARAM_SYNC_MODE_DEVICE_2 (POWERSTEP01_SYNC_SEL_DISABLED)
+
+/// Register : CONFIG - field : OSC_CLK_SEL 
+/// Clock setting , enum powerstep01_ConfigOscMgmt_t 
+#define POWERSTEP01_CONF_PARAM_CLOCK_SETTING_DEVICE_2 (POWERSTEP01_CONFIG_INT_16MHZ_OSCOUT_2MHZ)
+
+/// Register : GATECFG1 - field : WD_EN 
+/// External clock watchdog, enum powerstep01_WdEn_t
+#define POWERSTEP01_CONF_PARAM_WD_EN_DEVICE_2 (POWERSTEP01_WD_EN_DISABLE)
+
+/**
+  * @}
+  */
+  
+/**
+  * @}
+  */
+  
+/**
+  * @}
+  */
+
+#ifdef __cplusplus
+  }
+#endif
+
+#endif /* __POWERSTEP01_CONFIG_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Components/PowerStep01/PowerStep01_def.h	Fri Mar 24 10:24:39 2017 +0000
@@ -0,0 +1,964 @@
+/**
+ ******************************************************************************
+  * @file    PowerStep01.h 
+  * @author  IPC Rennes
+  * @version V1.2.0
+  * @date    January 25th, 2016
+  * @brief   Header for Powerstep01 motor driver (Microstepping controller with power MOSFETs)
+  * @note    (C) COPYRIGHT 2016 STMicroelectronics
+ ******************************************************************************
+ * @attention
+ *
+  * <h2><center>&copy; COPYRIGHT(c) 2016 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 _POWERSTEP01_H_INCLUDED
+#define _POWERSTEP01_H_INCLUDED
+
+#ifdef __cplusplus
+ extern "C" {
+#endif 
+
+/* Includes ------------------------------------------------------------------*/
+#include "PowerStep01_config.h"
+#include "stdint.h"
+#include "motor_def.h"
+
+/* Definitions ---------------------------------------------------------------*/
+
+/** @addtogroup Components
+ * @{
+ */  
+
+/** @defgroup PowerStep01 PowerStep01
+ * @{
+ */
+
+/** @defgroup Powerstep01_Exported_Defines Powerstep01_Exported_Defines
+ * @{
+ */
+/// Current FW major version
+#define POWERSTEP01_FW_MAJOR_VERSION (uint8_t)(1)
+/// Current FW minor version
+#define POWERSTEP01_FW_MINOR_VERSION (uint8_t)(2)
+/// Current FW patch version
+#define POWERSTEP01_FW_PATCH_VERSION (uint8_t)(0)
+/// Current FW version
+#define POWERSTEP01_FW_VERSION (uint32_t)((POWERSTEP01_FW_MAJOR_VERSION<<16)|\
+                                          (POWERSTEP01_FW_MINOR_VERSION<<8)|\
+                                          (POWERSTEP01_FW_PATCH_VERSION))
+
+/// Powerstep01 max number of bytes of command & arguments to set a parameter
+#define POWERSTEP01_CMD_ARG_MAX_NB_BYTES              (4)
+
+/// Powerstep01 command + argument bytes number for NOP command
+#define POWERSTEP01_CMD_ARG_NB_BYTES_NOP              (1)
+/// Powerstep01 command + argument bytes number for RUN command
+#define POWERSTEP01_CMD_ARG_NB_BYTES_RUN              (4)
+/// Powerstep01 command + argument bytes number for STEP_CLOCK command
+#define POWERSTEP01_CMD_ARG_NB_BYTES_STEP_CLOCK       (1)
+/// Powerstep01 command + argument bytes number for MOVE command
+#define POWERSTEP01_CMD_ARG_NB_BYTES_MOVE             (4)
+/// Powerstep01 command + argument bytes number for GO_TO command
+#define POWERSTEP01_CMD_ARG_NB_BYTES_GO_TO            (4)
+/// Powerstep01 command + argument bytes number for GO_TO_DIR command
+#define POWERSTEP01_CMD_ARG_NB_BYTES_GO_TO_DIR        (4)
+/// Powerstep01 command + argument bytes number for GO_UNTIL command
+#define POWERSTEP01_CMD_ARG_NB_BYTES_GO_UNTIL         (4)
+/// Powerstep01 command + argument bytes number for RELEASE_SW command
+#define POWERSTEP01_CMD_ARG_NB_BYTES_RELEASE_SW       (1)
+/// Powerstep01 command + argument bytes number for GO_HOME command
+#define POWERSTEP01_CMD_ARG_NB_BYTES_GO_HOME          (1)
+/// Powerstep01 command + argument bytes number for GO_MARK command
+#define POWERSTEP01_CMD_ARG_NB_BYTES_GO_MARK          (1)
+/// Powerstep01 command + argument bytes number for RESET_POS command
+#define POWERSTEP01_CMD_ARG_NB_BYTES_RESET_POS        (1)
+/// Powerstep01 command + argument bytes number for RESET_DEVICE command
+#define POWERSTEP01_CMD_ARG_NB_BYTES_RESET_DEVICE     (1)
+/// Powerstep01 command + argument bytes number for NOP command
+#define POWERSTEP01_CMD_ARG_NB_BYTES_SOFT_STOP        (1)
+/// Powerstep01 command + argument bytes number for HARD_STOP command
+#define POWERSTEP01_CMD_ARG_NB_BYTES_HARD_STOP        (1)
+/// Powerstep01 command + argument bytes number for SOFT_HIZ command
+#define POWERSTEP01_CMD_ARG_NB_BYTES_SOFT_HIZ         (1)
+/// Powerstep01 command + argument bytes number for ARD_HIZ command
+#define POWERSTEP01_CMD_ARG_NB_BYTES_HARD_HIZ         (1)
+/// Powerstep01 command + argument bytes number for GET_STATUS command
+#define POWERSTEP01_CMD_ARG_NB_BYTES_GET_STATUS       (1)
+
+/// Powerstep01 response bytes number 
+#define POWERSTEP01_RSP_NB_BYTES_GET_STATUS           (2)    
+
+/// Daisy chain command mask
+#define DAISY_CHAIN_COMMAND_MASK (0xFA)
+
+/// powerSTEP01 max absolute position
+#define POWERSTEP01_MAX_POSITION (int32_t)(0x001FFFFF)
+
+/// powerSTEP01 min absolute position
+#define POWERSTEP01_MIN_POSITION (int32_t)(0xFFE00000)
+    
+/// powerSTEP01 error base number
+#define POWERSTEP01_ERROR_BASE              (0xB000)
+
+/// powerSTEP01 acceleration and deceleration max value
+#define POWERSTEP01_ACC_DEC_MAX_VALUE       (float)(59590)
+/// powerSTEP01 max speed max value
+#define POWERSTEP01_MAX_SPEED_MAX_VALUE     (float)(15610)
+/// powerSTEP01 min speed max value
+#define POWERSTEP01_MIN_SPEED_MAX_VALUE     (float)(976.3)
+/// powerSTEP01 full step speed max value
+#define POWERSTEP01_FS_SPD_MAX_VALUE        (float)(15625)
+/// powerSTEP01 intersect speed max value
+#define POWERSTEP01_INT_SPD_MAX_VALUE       (float)(976.5)
+/// powerSTEP01 thermal compensation max value
+#define POWERSTEP01_K_THERM_MAX_VALUE       (float)(1.46875)
+/// powerSTEP01 thermal compensation min value
+#define POWERSTEP01_K_THERM_MIN_VALUE       (float)(1)
+/// powerSTEP01 thermal compensation max value
+#define POWERSTEP01_STALL_OCD_TH_MAX_VALUE  (float)(1000)
+/// powerSTEP01 thermal compensation max value
+#define POWERSTEP01_K_THERM_MAX_VALUE       (float)(1.46875)
+/// powerSTEP01 voltage amplitude regulation max value
+#define POWERSTEP01_KVAL_MAX_VALUE          (float)(255/256)
+/// powerSTEP01 BEMF compensation curve slope max value
+#define POWERSTEP01_SLP_MAX_VALUE           (float)(0.4)
+/// powerSTEP01 torque regulation DAC reference voltage max value
+#define POWERSTEP01_TVAL_MAX_VALUE          (float)(1000)
+/// powerSTEP01 minimum off and on time max value
+#define POWERSTEP01_TOFF_TON_MIN_MAX_VALUE  (float)(64)
+    
+///Shift of the low speed optimization bit in MIN_SPEED register
+#define POWERSTEP01_LSPD_OPT_SHIFT            (12)
+///Shift of the boost mode bit in FS_SPD register
+#define POWERSTEP01_BOOST_MODE_SHIFT          (10)
+///Maximum fast decay time (TOFF_FAST) unit
+#define POWERSTEP01_TOFF_FAST_UNIT_US         (2)
+///Shift of the maximum fast decay time (TOFF_FAST) in T_FAST register
+#define POWERSTEP01_TOFF_FAST_SHIFT           (4)
+///Maximum fall step time (FAST_STEP) unit
+#define POWERSTEP01_FAST_STEP_UNIT_US         (2)
+///Shift of the maximum fall step time (FAST_STEP) in T_FAST register
+#define POWERSTEP01_FAST_STEP_SHIFT           (0)
+///Duration unit of constant current phase during gate turn-on and turn-off (TCC)
+#define POWERSTEP01_TCC_UNIT_NS               (125)
+///Shift of TCC field in GATECFG1 register
+#define POWERSTEP01_TCC_SHIFT                 (0)
+///Shift of IGATE field in GATECFG1 register
+#define POWERSTEP01_IGATE_SHIFT               (5)
+///Shift of TBOOST field in GATECFG1 register
+#define POWERSTEP01_TBOOST_SHIFT              (8)
+///Duration unit of the blanking of the current sensing comparators (TBLANK)
+#define POWERSTEP01_TBLANK_UNIT_NS            (125)
+///Shift of TBLANK field in GATECFG2 register
+#define POWERSTEP01_TBLANK_SHIFT              (5)
+///Deadtime duration unit between gate turn-off and opposite gate turn-on (TDT)
+#define POWERSTEP01_TDT_UNIT_NS               (125)
+///Shift of TDT field in GATECFG2 register
+#define POWERSTEP01_TDT_SHIFT                 (0)
+///Shift of F_PWM_INT field in CONFIG register for voltage mode
+#define POWERSTEP01_CONFIG_PWM_DIV_SHIFT      (13)
+///Shift of F_PWM_DEC field in CONFIG register for voltage mode
+#define POWERSTEP01_CONFIG_PWM_MUL_SHIFT      (10)
+///Target switching period (TSW) unit
+#define POWERSTEP01_CONFIG_TSW_UNIT_US        (4)
+///Shift of TSW field in CONFIG register for current mode
+#define POWERSTEP01_CONFIG_TSW_SHIFT          (10)
+///Shift of MOT_STATUS field in STATUS register
+#define POWERSTEP01_STATUS_MOT_STATUS_SHIFT   (5)
+/**
+  * @}
+  */
+
+/* Types ---------------------------------------------------------------------*/
+
+/** @defgroup Powerstep01_Exported_Types Powerstep01 Exported Types
+  * @{
+  */
+/// masks for ABS_POS register of PowerStep01
+typedef enum {
+  POWERSTEP01_ABS_POS_VALUE_MASK        = ((uint32_t)0x003FFFFF),
+  POWERSTEP01_ABS_POS_SIGN_BIT_MASK     = ((uint32_t)0x00200000)
+} powerstep01_AbsPosMasks_t;
+
+/// masks for EL_POS register of PowerStep01
+typedef enum {
+  POWERSTEP01_ELPOS_STEP_MASK       = ((uint16_t)0x180),
+  POWERSTEP01_ELPOS_MICROSTEP_MASK  = ((uint16_t)0x07F)
+} powerstep01_ElPosMasks_t;
+
+/// masks for MIN_SPEED register of PowerStep01
+typedef enum {
+  POWERSTEP01_LSPD_OPT        = ((uint16_t)((0x1)<<POWERSTEP01_LSPD_OPT_SHIFT)),
+  POWERSTEP01_MIN_SPEED_MASK  = ((uint16_t)0x0FFF)
+} powerstep01_MinSpeedMasks_t;
+
+/// Low speed optimization (MIN_SPEED register of PowerStep01)
+typedef enum {
+  POWERSTEP01_LSPD_OPT_OFF    = ((uint16_t)0x0000),
+  POWERSTEP01_LSPD_OPT_ON     = ((uint16_t)POWERSTEP01_LSPD_OPT)
+} powerstep01_LspdOpt_t;
+
+/// masks for FS_SPD register of PowerStep01
+typedef enum {
+  POWERSTEP01_BOOST_MODE   = ((uint16_t)((0x1)<<POWERSTEP01_BOOST_MODE_SHIFT)),
+  POWERSTEP01_FS_SPD_MASK  = ((uint16_t)0x03FF)
+} powerstep01_FsSpdMasks_t;
+
+/// Full step boost (FS_SPD register of PowerStep01)
+typedef enum {
+  POWERSTEP01_BOOST_MODE_OFF    = ((uint16_t)0x0000),
+  POWERSTEP01_BOOST_MODE_ON     = ((uint16_t)POWERSTEP01_BOOST_MODE)
+} powerstep01_BoostMode_t;
+
+/// masks for T_FAST register of PowerStep01
+typedef enum {
+  POWERSTEP01_FAST_STEP_MASK  = ((uint16_t) ((0xF)<<POWERSTEP01_FAST_STEP_SHIFT)),
+  POWERSTEP01_TOFF_FAST_MASK  = ((uint16_t) ((0xF)<<POWERSTEP01_TOFF_FAST_SHIFT))
+} powerstep01_TFastMasks_t;
+
+/// Maximum fall step times (T_FAST register of PowerStep01)
+typedef enum {
+  POWERSTEP01_FAST_STEP_2us     = (((uint8_t)0x00)<<POWERSTEP01_FAST_STEP_SHIFT),
+  POWERSTEP01_FAST_STEP_4us     = (((uint8_t)0x01)<<POWERSTEP01_FAST_STEP_SHIFT),
+  POWERSTEP01_FAST_STEP_6us     = (((uint8_t)0x02)<<POWERSTEP01_FAST_STEP_SHIFT),
+  POWERSTEP01_FAST_STEP_8us     = (((uint8_t)0x03)<<POWERSTEP01_FAST_STEP_SHIFT),
+  POWERSTEP01_FAST_STEP_10us    = (((uint8_t)0x04)<<POWERSTEP01_FAST_STEP_SHIFT),
+  POWERSTEP01_FAST_STEP_12us    = (((uint8_t)0x05)<<POWERSTEP01_FAST_STEP_SHIFT),
+  POWERSTEP01_FAST_STEP_14us    = (((uint8_t)0x06)<<POWERSTEP01_FAST_STEP_SHIFT),
+  POWERSTEP01_FAST_STEP_16us    = (((uint8_t)0x07)<<POWERSTEP01_FAST_STEP_SHIFT),
+  POWERSTEP01_FAST_STEP_18us    = (((uint8_t)0x08)<<POWERSTEP01_FAST_STEP_SHIFT),
+  POWERSTEP01_FAST_STEP_20us    = (((uint8_t)0x09)<<POWERSTEP01_FAST_STEP_SHIFT),
+  POWERSTEP01_FAST_STEP_22us    = (((uint8_t)0x0A)<<POWERSTEP01_FAST_STEP_SHIFT),
+  POWERSTEP01_FAST_STEP_24s     = (((uint8_t)0x0B)<<POWERSTEP01_FAST_STEP_SHIFT),
+  POWERSTEP01_FAST_STEP_26us    = (((uint8_t)0x0C)<<POWERSTEP01_FAST_STEP_SHIFT),
+  POWERSTEP01_FAST_STEP_28us    = (((uint8_t)0x0D)<<POWERSTEP01_FAST_STEP_SHIFT),
+  POWERSTEP01_FAST_STEP_30us    = (((uint8_t)0x0E)<<POWERSTEP01_FAST_STEP_SHIFT),
+  POWERSTEP01_FAST_STEP_32us    = (((uint8_t)0x0F)<<POWERSTEP01_FAST_STEP_SHIFT)
+} powerstep01_FastStep_t;
+
+/// Maximum fast decay times (T_FAST register of PowerStep01)
+typedef enum {
+  POWERSTEP01_TOFF_FAST_2us     = (((uint8_t)0x00)<<POWERSTEP01_TOFF_FAST_SHIFT),
+  POWERSTEP01_TOFF_FAST_4us     = (((uint8_t)0x01)<<POWERSTEP01_TOFF_FAST_SHIFT),
+  POWERSTEP01_TOFF_FAST_6us     = (((uint8_t)0x02)<<POWERSTEP01_TOFF_FAST_SHIFT),
+  POWERSTEP01_TOFF_FAST_8us     = (((uint8_t)0x03)<<POWERSTEP01_TOFF_FAST_SHIFT),
+  POWERSTEP01_TOFF_FAST_10us    = (((uint8_t)0x04)<<POWERSTEP01_TOFF_FAST_SHIFT),
+  POWERSTEP01_TOFF_FAST_12us    = (((uint8_t)0x05)<<POWERSTEP01_TOFF_FAST_SHIFT),
+  POWERSTEP01_TOFF_FAST_14us    = (((uint8_t)0x06)<<POWERSTEP01_TOFF_FAST_SHIFT),
+  POWERSTEP01_TOFF_FAST_16us    = (((uint8_t)0x07)<<POWERSTEP01_TOFF_FAST_SHIFT),
+  POWERSTEP01_TOFF_FAST_18us    = (((uint8_t)0x08)<<POWERSTEP01_TOFF_FAST_SHIFT),
+  POWERSTEP01_TOFF_FAST_20us    = (((uint8_t)0x09)<<POWERSTEP01_TOFF_FAST_SHIFT),
+  POWERSTEP01_TOFF_FAST_22us    = (((uint8_t)0x0A)<<POWERSTEP01_TOFF_FAST_SHIFT),
+  POWERSTEP01_TOFF_FAST_24us    = (((uint8_t)0x0B)<<POWERSTEP01_TOFF_FAST_SHIFT),
+  POWERSTEP01_TOFF_FAST_26us    = (((uint8_t)0x0C)<<POWERSTEP01_TOFF_FAST_SHIFT),
+  POWERSTEP01_TOFF_FAST_28us    = (((uint8_t)0x0D)<<POWERSTEP01_TOFF_FAST_SHIFT),
+  POWERSTEP01_TOFF_FAST_30us    = (((uint8_t)0x0E)<<POWERSTEP01_TOFF_FAST_SHIFT),
+  POWERSTEP01_TOFF_FAST_32us    = (((uint8_t)0x0F)<<POWERSTEP01_TOFF_FAST_SHIFT)
+} powerstep01_ToffFast_t;
+
+/// Overcurrent threshold options (OCD register of PowerStep01)
+typedef enum {
+  POWERSTEP01_OCD_TH_31_25mV    = ((uint8_t)0x00),
+  POWERSTEP01_OCD_TH_62_5mV     = ((uint8_t)0x01),
+  POWERSTEP01_OCD_TH_93_75mV    = ((uint8_t)0x02),
+  POWERSTEP01_OCD_TH_125mV      = ((uint8_t)0x03),
+  POWERSTEP01_OCD_TH_156_25mV   = ((uint8_t)0x04),
+  POWERSTEP01_OCD_TH_187_50mV   = ((uint8_t)0x05),
+  POWERSTEP01_OCD_TH_218_75mV   = ((uint8_t)0x06),
+  POWERSTEP01_OCD_TH_250mV      = ((uint8_t)0x07),
+  POWERSTEP01_OCD_TH_281_25mV   = ((uint8_t)0x08),
+  POWERSTEP01_OCD_TH_312_5mV    = ((uint8_t)0x09),
+  POWERSTEP01_OCD_TH_343_75mV   = ((uint8_t)0x0A),
+  POWERSTEP01_OCD_TH_375mV      = ((uint8_t)0x0B),
+  POWERSTEP01_OCD_TH_406_25mV   = ((uint8_t)0x0C),
+  POWERSTEP01_OCD_TH_437_5mV    = ((uint8_t)0x0D),
+  POWERSTEP01_OCD_TH_468_75mV   = ((uint8_t)0x0E),
+  POWERSTEP01_OCD_TH_500mV      = ((uint8_t)0x0F),
+  POWERSTEP01_OCD_TH_531_25mV   = ((uint8_t)0x10),
+  POWERSTEP01_OCD_TH_562_5mV    = ((uint8_t)0x11),
+  POWERSTEP01_OCD_TH_593_75mV   = ((uint8_t)0x12),
+  POWERSTEP01_OCD_TH_625mV      = ((uint8_t)0x13),
+  POWERSTEP01_OCD_TH_656_25mV   = ((uint8_t)0x14),
+  POWERSTEP01_OCD_TH_687_5mV    = ((uint8_t)0x15),
+  POWERSTEP01_OCD_TH_718_75mV   = ((uint8_t)0x16),
+  POWERSTEP01_OCD_TH_750mV      = ((uint8_t)0x17),
+  POWERSTEP01_OCD_TH_781_25mV   = ((uint8_t)0x18),
+  POWERSTEP01_OCD_TH_812_5mV    = ((uint8_t)0x19),
+  POWERSTEP01_OCD_TH_843_75mV   = ((uint8_t)0x1A),
+  POWERSTEP01_OCD_TH_875mV      = ((uint8_t)0x1B),
+  POWERSTEP01_OCD_TH_906_25mV   = ((uint8_t)0x1C),
+  POWERSTEP01_OCD_TH_937_75mV   = ((uint8_t)0x1D),
+  POWERSTEP01_OCD_TH_968_75mV   = ((uint8_t)0x1E),
+  POWERSTEP01_OCD_TH_1V         = ((uint8_t)0x1F)        
+} powerstep01_OcdTh_t;
+
+/// masks for STEP_MODE register of PowerStep01
+typedef enum {
+  POWERSTEP01_STEP_MODE_STEP_SEL    = ((uint8_t)0x07),
+  POWERSTEP01_STEP_MODE_CM_VM       = ((uint8_t)0x08),
+  POWERSTEP01_STEP_MODE_SYNC_SEL    = ((uint8_t)0x70),
+  POWERSTEP01_STEP_MODE_SYNC_EN     = ((uint8_t)0x80)
+} powerstep01_StepModeMasks_t;
+
+/// Voltage or Current mode selection (CM_VM field of STEP_MODE register of PowerStep01)
+typedef enum {
+  POWERSTEP01_CM_VM_VOLTAGE    = ((uint8_t)0x00),
+  POWERSTEP01_CM_VM_CURRENT    = ((uint8_t)0x08)
+} powerstep01_CmVm_t;
+
+/// Stepping options (field STEP_SEL of STEP_MODE register of PowerStep01)
+typedef enum {
+  POWERSTEP01_STEP_SEL_1      = ((uint8_t)0x00),
+  POWERSTEP01_STEP_SEL_1_2    = ((uint8_t)0x01),
+  POWERSTEP01_STEP_SEL_1_4    = ((uint8_t)0x02),
+  POWERSTEP01_STEP_SEL_1_8    = ((uint8_t)0x03),
+  POWERSTEP01_STEP_SEL_1_16   = ((uint8_t)0x04),
+  POWERSTEP01_STEP_SEL_1_32   = ((uint8_t)0x05),
+  POWERSTEP01_STEP_SEL_1_64   = ((uint8_t)0x06),
+  POWERSTEP01_STEP_SEL_1_128  = ((uint8_t)0x07)
+} powerstep01_StepSel_t;
+
+/// Powerstep01 Sync Output frequency enabling bitw
+#define POWERSTEP01_SYNC_EN   ((0x1) << 7)
+
+/// SYNC_SEL options (STEP_MODE register of PowerStep01)
+typedef enum {
+  POWERSTEP01_SYNC_SEL_DISABLED   = ((uint8_t)0x00),
+  POWERSTEP01_SYNC_SEL_1_2        = ((uint8_t)(POWERSTEP01_SYNC_EN|0x00)),
+  POWERSTEP01_SYNC_SEL_1          = ((uint8_t)(POWERSTEP01_SYNC_EN|0x10)),
+  POWERSTEP01_SYNC_SEL_2          = ((uint8_t)(POWERSTEP01_SYNC_EN|0x20)),
+  POWERSTEP01_SYNC_SEL_4          = ((uint8_t)(POWERSTEP01_SYNC_EN|0x30)),
+  POWERSTEP01_SYNC_SEL_8          = ((uint8_t)(POWERSTEP01_SYNC_EN|0x40)),
+  POWERSTEP01_SYNC_SEL_16         = ((uint8_t)(POWERSTEP01_SYNC_EN|0x50)),
+  POWERSTEP01_SYNC_SEL_32         = ((uint8_t)(POWERSTEP01_SYNC_EN|0x60)),
+  POWERSTEP01_SYNC_SEL_64         = ((uint8_t)(POWERSTEP01_SYNC_EN|0x70))
+} powerstep01_SyncSel_t;
+
+/// Alarms conditions (ALARM_EN register of PowerStep01)
+typedef enum {
+  POWERSTEP01_ALARM_EN_OVERCURRENT        = ((uint8_t)0x01),
+  POWERSTEP01_ALARM_EN_THERMAL_SHUTDOWN   = ((uint8_t)0x02),
+  POWERSTEP01_ALARM_EN_THERMAL_WARNING    = ((uint8_t)0x04),
+  POWERSTEP01_ALARM_EN_UVLO               = ((uint8_t)0x08),
+  POWERSTEP01_ALARM_EN_ADC_UVLO           = ((uint8_t)0x10),
+  POWERSTEP01_ALARM_EN_STALL_DETECTION    = ((uint8_t)0x20),
+  POWERSTEP01_ALARM_EN_SW_TURN_ON         = ((uint8_t)0x40),
+  POWERSTEP01_ALARM_EN_WRONG_NPERF_CMD    = ((uint8_t)0x80)
+} powerstep01_AlarmEn_t;
+
+
+/// masks for GATECFG1 register of PowerStep01
+typedef enum {
+  POWERSTEP01_GATECFG1_TCC_MASK    = ((uint16_t)0x001F),
+  POWERSTEP01_GATECFG1_IGATE_MASK  = ((uint16_t)0x00E0),
+  POWERSTEP01_GATECFG1_TBOOST_MASK = ((uint16_t)0x0700),
+  POWERSTEP01_GATECFG1_WD_EN       = ((uint16_t)0x0800)
+} powerstep01_GateCfg1Masks_t;
+
+/// Control current Time (field TCC of GATECFG1 register of PowerStep01)
+typedef enum {
+  POWERSTEP01_TCC_125ns       = (((uint8_t)0x00)<<POWERSTEP01_TCC_SHIFT),
+  POWERSTEP01_TCC_250ns       = (((uint8_t)0x01)<<POWERSTEP01_TCC_SHIFT),
+  POWERSTEP01_TCC_375ns       = (((uint8_t)0x02)<<POWERSTEP01_TCC_SHIFT),
+  POWERSTEP01_TCC_500ns       = (((uint8_t)0x03)<<POWERSTEP01_TCC_SHIFT),
+  POWERSTEP01_TCC_625ns       = (((uint8_t)0x04)<<POWERSTEP01_TCC_SHIFT),
+  POWERSTEP01_TCC_750ns       = (((uint8_t)0x05)<<POWERSTEP01_TCC_SHIFT),
+  POWERSTEP01_TCC_875ns       = (((uint8_t)0x06)<<POWERSTEP01_TCC_SHIFT),
+  POWERSTEP01_TCC_1000ns      = (((uint8_t)0x07)<<POWERSTEP01_TCC_SHIFT),
+  POWERSTEP01_TCC_1125ns      = (((uint8_t)0x08)<<POWERSTEP01_TCC_SHIFT),
+  POWERSTEP01_TCC_1250ns      = (((uint8_t)0x09)<<POWERSTEP01_TCC_SHIFT),
+  POWERSTEP01_TCC_1375ns      = (((uint8_t)0x0A)<<POWERSTEP01_TCC_SHIFT),
+  POWERSTEP01_TCC_1500ns      = (((uint8_t)0x0B)<<POWERSTEP01_TCC_SHIFT),
+  POWERSTEP01_TCC_1625ns      = (((uint8_t)0x0C)<<POWERSTEP01_TCC_SHIFT),
+  POWERSTEP01_TCC_1750ns      = (((uint8_t)0x0D)<<POWERSTEP01_TCC_SHIFT),
+  POWERSTEP01_TCC_1875ns      = (((uint8_t)0x0E)<<POWERSTEP01_TCC_SHIFT),
+  POWERSTEP01_TCC_2000ns      = (((uint8_t)0x0F)<<POWERSTEP01_TCC_SHIFT),
+  POWERSTEP01_TCC_2125ns      = (((uint8_t)0x10)<<POWERSTEP01_TCC_SHIFT),
+  POWERSTEP01_TCC_2250ns      = (((uint8_t)0x11)<<POWERSTEP01_TCC_SHIFT),
+  POWERSTEP01_TCC_2375ns      = (((uint8_t)0x12)<<POWERSTEP01_TCC_SHIFT),
+  POWERSTEP01_TCC_2500ns      = (((uint8_t)0x13)<<POWERSTEP01_TCC_SHIFT),
+  POWERSTEP01_TCC_2625ns      = (((uint8_t)0x14)<<POWERSTEP01_TCC_SHIFT),
+  POWERSTEP01_TCC_2750ns      = (((uint8_t)0x15)<<POWERSTEP01_TCC_SHIFT),
+  POWERSTEP01_TCC_2875ns      = (((uint8_t)0x16)<<POWERSTEP01_TCC_SHIFT),
+  POWERSTEP01_TCC_3000ns      = (((uint8_t)0x17)<<POWERSTEP01_TCC_SHIFT),
+  POWERSTEP01_TCC_3125ns      = (((uint8_t)0x18)<<POWERSTEP01_TCC_SHIFT),
+  POWERSTEP01_TCC_3250ns      = (((uint8_t)0x19)<<POWERSTEP01_TCC_SHIFT),
+  POWERSTEP01_TCC_3375ns      = (((uint8_t)0x1A)<<POWERSTEP01_TCC_SHIFT),
+  POWERSTEP01_TCC_3500ns      = (((uint8_t)0x1B)<<POWERSTEP01_TCC_SHIFT),
+  POWERSTEP01_TCC_3625ns      = (((uint8_t)0x1C)<<POWERSTEP01_TCC_SHIFT),
+  POWERSTEP01_TCC_3750ns      = (((uint8_t)0x1D)<<POWERSTEP01_TCC_SHIFT),
+  POWERSTEP01_TCC_3750ns_bis  = (((uint8_t)0x1E)<<POWERSTEP01_TCC_SHIFT),
+  POWERSTEP01_TCC_3750ns_ter  = (((uint8_t)0x1F)<<POWERSTEP01_TCC_SHIFT)
+} powerstep01_Tcc_t;
+
+/// Igate options (GATECFG1 register of PowerStep01)
+typedef enum {
+  POWERSTEP01_IGATE_4mA     = (((uint8_t)0x00)<<POWERSTEP01_IGATE_SHIFT),
+  POWERSTEP01_IGATE_4mA_Bis = (((uint8_t)0x01)<<POWERSTEP01_IGATE_SHIFT),
+  POWERSTEP01_IGATE_8mA     = (((uint8_t)0x02)<<POWERSTEP01_IGATE_SHIFT),
+  POWERSTEP01_IGATE_16mA    = (((uint8_t)0x03)<<POWERSTEP01_IGATE_SHIFT),
+  POWERSTEP01_IGATE_24mA    = (((uint8_t)0x04)<<POWERSTEP01_IGATE_SHIFT),
+  POWERSTEP01_IGATE_32mA    = (((uint8_t)0x05)<<POWERSTEP01_IGATE_SHIFT),
+  POWERSTEP01_IGATE_64mA    = (((uint8_t)0x06)<<POWERSTEP01_IGATE_SHIFT),
+  POWERSTEP01_IGATE_96mA    = (((uint8_t)0x07)<<POWERSTEP01_IGATE_SHIFT),
+} powerstep01_Igate_t;
+
+/// Turn off boost time (TBOOST field of GATECFG1 register of PowerStep01)
+typedef enum {
+  POWERSTEP01_TBOOST_0ns                = (((uint8_t)0x00)<<POWERSTEP01_TBOOST_SHIFT),
+  POWERSTEP01_TBOOST_62_5__83_3__125ns  = (((uint8_t)0x01)<<POWERSTEP01_TBOOST_SHIFT),
+  POWERSTEP01_TBOOST_125ns              = (((uint8_t)0x02)<<POWERSTEP01_TBOOST_SHIFT),
+  POWERSTEP01_TBOOST_250ns              = (((uint8_t)0x03)<<POWERSTEP01_TBOOST_SHIFT),
+  POWERSTEP01_TBOOST_375ns              = (((uint8_t)0x04)<<POWERSTEP01_TBOOST_SHIFT),
+  POWERSTEP01_TBOOST_500ns              = (((uint8_t)0x05)<<POWERSTEP01_TBOOST_SHIFT),
+  POWERSTEP01_TBOOST_750ns              = (((uint8_t)0x06)<<POWERSTEP01_TBOOST_SHIFT),
+  POWERSTEP01_TBOOST_1000ns             = (((uint8_t)0x07)<<POWERSTEP01_TBOOST_SHIFT),
+} powerstep01_Tboost_t;
+
+/// External clock watchdog (WD_EN field of GATECFG1 register of PowerStep01)
+typedef enum {
+  POWERSTEP01_WD_EN_DISABLE   = ((uint16_t)0x0000),
+  POWERSTEP01_WD_EN_ENABLE    = ((uint16_t) ((0x1) << 11))
+} powerstep01_WdEn_t;
+
+
+/// masks for GATECFG2 register of PowerStep01
+typedef enum {
+  POWERSTEP01_GATECFG2_TDT      = ((uint8_t)0x1F),
+  POWERSTEP01_GATECFG2_TBLANK   = ((uint8_t)0xE0)
+} powerstep01_GateCfg2Masks_t;
+
+/// Blanking time (TBLANK field of GATECFG2 register of PowerStep01)
+typedef enum {
+  POWERSTEP01_TBLANK_125ns    = (((uint8_t)0x00)<<POWERSTEP01_TBLANK_SHIFT),
+  POWERSTEP01_TBLANK_250ns    = (((uint8_t)0x01)<<POWERSTEP01_TBLANK_SHIFT),
+  POWERSTEP01_TBLANK_375ns    = (((uint8_t)0x02)<<POWERSTEP01_TBLANK_SHIFT),
+  POWERSTEP01_TBLANK_500ns    = (((uint8_t)0x03)<<POWERSTEP01_TBLANK_SHIFT),
+  POWERSTEP01_TBLANK_625ns    = (((uint8_t)0x04)<<POWERSTEP01_TBLANK_SHIFT),
+  POWERSTEP01_TBLANK_750ns    = (((uint8_t)0x05)<<POWERSTEP01_TBLANK_SHIFT),
+  POWERSTEP01_TBLANK_875ns    = (((uint8_t)0x06)<<POWERSTEP01_TBLANK_SHIFT),
+  POWERSTEP01_TBLANK_1000ns   = (((uint8_t)0x07)<<POWERSTEP01_TBLANK_SHIFT),
+} powerstep01_TBlank_t;
+
+/// Dead time (TDT field of GATECFG2 register of PowerStep01)
+typedef enum {
+  POWERSTEP01_TDT_125ns   = (((uint8_t)0x00)<<POWERSTEP01_TDT_SHIFT),
+  POWERSTEP01_TDT_250ns   = (((uint8_t)0x01)<<POWERSTEP01_TDT_SHIFT),
+  POWERSTEP01_TDT_375ns   = (((uint8_t)0x02)<<POWERSTEP01_TDT_SHIFT),
+  POWERSTEP01_TDT_500ns   = (((uint8_t)0x03)<<POWERSTEP01_TDT_SHIFT),
+  POWERSTEP01_TDT_625ns   = (((uint8_t)0x04)<<POWERSTEP01_TDT_SHIFT),
+  POWERSTEP01_TDT_750ns   = (((uint8_t)0x05)<<POWERSTEP01_TDT_SHIFT),
+  POWERSTEP01_TDT_875ns   = (((uint8_t)0x06)<<POWERSTEP01_TDT_SHIFT),
+  POWERSTEP01_TDT_1000ns  = (((uint8_t)0x07)<<POWERSTEP01_TDT_SHIFT),
+  POWERSTEP01_TDT_1125ns  = (((uint8_t)0x08)<<POWERSTEP01_TDT_SHIFT),
+  POWERSTEP01_TDT_1250ns  = (((uint8_t)0x09)<<POWERSTEP01_TDT_SHIFT),
+  POWERSTEP01_TDT_1375ns  = (((uint8_t)0x0A)<<POWERSTEP01_TDT_SHIFT),
+  POWERSTEP01_TDT_1500ns  = (((uint8_t)0x0B)<<POWERSTEP01_TDT_SHIFT),
+  POWERSTEP01_TDT_1625ns  = (((uint8_t)0x0C)<<POWERSTEP01_TDT_SHIFT),
+  POWERSTEP01_TDT_1750ns  = (((uint8_t)0x0D)<<POWERSTEP01_TDT_SHIFT),
+  POWERSTEP01_TDT_1875ns  = (((uint8_t)0x0E)<<POWERSTEP01_TDT_SHIFT),
+  POWERSTEP01_TDT_2000ns  = (((uint8_t)0x0F)<<POWERSTEP01_TDT_SHIFT),
+  POWERSTEP01_TDT_2125ns  = (((uint8_t)0x10)<<POWERSTEP01_TDT_SHIFT),
+  POWERSTEP01_TDT_2250ns  = (((uint8_t)0x11)<<POWERSTEP01_TDT_SHIFT),
+  POWERSTEP01_TDT_2375ns  = (((uint8_t)0x12)<<POWERSTEP01_TDT_SHIFT),
+  POWERSTEP01_TDT_2500ns  = (((uint8_t)0x13)<<POWERSTEP01_TDT_SHIFT),
+  POWERSTEP01_TDT_2625ns  = (((uint8_t)0x14)<<POWERSTEP01_TDT_SHIFT),
+  POWERSTEP01_TDT_2750ns  = (((uint8_t)0x15)<<POWERSTEP01_TDT_SHIFT),
+  POWERSTEP01_TDT_2875ns  = (((uint8_t)0x16)<<POWERSTEP01_TDT_SHIFT),
+  POWERSTEP01_TDT_3000ns  = (((uint8_t)0x17)<<POWERSTEP01_TDT_SHIFT),
+  POWERSTEP01_TDT_3125ns  = (((uint8_t)0x18)<<POWERSTEP01_TDT_SHIFT),
+  POWERSTEP01_TDT_3250ns  = (((uint8_t)0x19)<<POWERSTEP01_TDT_SHIFT),
+  POWERSTEP01_TDT_3375ns  = (((uint8_t)0x1A)<<POWERSTEP01_TDT_SHIFT),
+  POWERSTEP01_TDT_3500ns  = (((uint8_t)0x1B)<<POWERSTEP01_TDT_SHIFT),
+  POWERSTEP01_TDT_3625ns  = (((uint8_t)0x1C)<<POWERSTEP01_TDT_SHIFT),
+  POWERSTEP01_TDT_3750ns  = (((uint8_t)0x1D)<<POWERSTEP01_TDT_SHIFT),
+  POWERSTEP01_TDT_3875ns  = (((uint8_t)0x1E)<<POWERSTEP01_TDT_SHIFT),
+  POWERSTEP01_TDT_4000ns  = (((uint8_t)0x1F)<<POWERSTEP01_TDT_SHIFT)
+} powerstep01_Tdt_t;
+
+/// Masks for CONFIG register of Powerstep01 
+typedef enum {
+  POWERSTEP01_CONFIG_OSC_SEL      = ((uint16_t)0x0007),
+  POWERSTEP01_CONFIG_EXT_CLK      = ((uint16_t)0x0008),
+  POWERSTEP01_CONFIG_SW_MODE      = ((uint16_t)0x0010),
+  POWERSTEP01_CONFIG_OC_SD        = ((uint16_t)0x0080),
+  POWERSTEP01_CONFIG_UVLOVAL      = ((uint16_t)0x0100),
+  POWERSTEP01_CONFIG_VCCVAL       = ((uint16_t)0x0200),
+  // Masks specific for voltage mode
+  POWERSTEP01_CONFIG_EN_VSCOMP    = ((uint16_t)0x0020),
+  POWERSTEP01_CONFIG_F_PWM_DEC    = ((uint16_t)0x1C00),
+  POWERSTEP01_CONFIG_F_PWM_INT    = ((uint16_t)0xE000),
+  // Masks specific for current mode
+  POWERSTEP01_CONFIG_TSW          = ((uint16_t)0x7C00),
+  POWERSTEP01_CONFIG_PRED_EN      = ((uint16_t)0x8000)  
+} powerstep01_ConfigMasks_t;
+
+/// Masks for CONFIG register of Powerstep01  (specific for current mode)
+#define POWERSTEP01_CONFIG_EN_TQREG (POWERSTEP01_CONFIG_EN_VSCOMP) 
+
+/// Oscillator management (EXT_CLK and OSC_SEL fields of CONFIG register of Powerstep01)
+typedef enum {
+  POWERSTEP01_CONFIG_INT_16MHZ               = ((uint16_t)0x0000),
+  POWERSTEP01_CONFIG_INT_16MHZ_OSCOUT_2MHZ   = ((uint16_t)0x0008),
+  POWERSTEP01_CONFIG_INT_16MHZ_OSCOUT_4MHZ   = ((uint16_t)0x0009),
+  POWERSTEP01_CONFIG_INT_16MHZ_OSCOUT_8MHZ   = ((uint16_t)0x000A),
+  POWERSTEP01_CONFIG_INT_16MHZ_OSCOUT_16MHZ  = ((uint16_t)0x000B),
+  POWERSTEP01_CONFIG_EXT_8MHZ_XTAL_DRIVE     = ((uint16_t)0x0004),
+  POWERSTEP01_CONFIG_EXT_16MHZ_XTAL_DRIVE    = ((uint16_t)0x0005),
+  POWERSTEP01_CONFIG_EXT_24MHZ_XTAL_DRIVE    = ((uint16_t)0x0006),
+  POWERSTEP01_CONFIG_EXT_32MHZ_XTAL_DRIVE    = ((uint16_t)0x0007),
+  POWERSTEP01_CONFIG_EXT_8MHZ_OSCOUT_INVERT  = ((uint16_t)0x000C),
+  POWERSTEP01_CONFIG_EXT_16MHZ_OSCOUT_INVERT = ((uint16_t)0x000D),
+  POWERSTEP01_CONFIG_EXT_24MHZ_OSCOUT_INVERT = ((uint16_t)0x000E),
+  POWERSTEP01_CONFIG_EXT_32MHZ_OSCOUT_INVERT = ((uint16_t)0x000F)
+} powerstep01_ConfigOscMgmt_t;
+
+/// Oscillator management (EXT_CLK and OSC_SEL fields of CONFIG register of Powerstep01)
+typedef enum {
+  POWERSTEP01_CONFIG_SW_HARD_STOP = ((uint16_t)0x0000),
+  POWERSTEP01_CONFIG_SW_USER      = ((uint16_t)0x0010)
+} powerstep01_ConfigSwMode_t;
+
+/// Voltage supply compensation enabling for voltage mode (EN_VSCOMP field of CONFIG register of Powerstep01)
+typedef enum {
+  POWERSTEP01_CONFIG_VS_COMP_DISABLE  = ((uint16_t)0x0000),
+  POWERSTEP01_CONFIG_VS_COMP_ENABLE   = ((uint16_t)0x0020)
+} powerstep01_ConfigEnVscomp_t;
+
+/// External torque regulation enabling (EN_TQREG field of CONFIG register of Powerstep01)
+typedef enum {
+  POWERSTEP01_CONFIG_TQ_REG_TVAL_USED = ((uint16_t)0x0000),
+  POWERSTEP01_CONFIG_TQ_REG_ADC_OUT   = ((uint16_t)0x0020)
+} powerstep01_ConfigEnTqReg_t;
+
+/// Overcurrent shutdown (OC_SD field of CONFIG register of Powerstep01)
+typedef enum {
+  POWERSTEP01_CONFIG_OC_SD_DISABLE  = ((uint16_t)0x0000),
+  POWERSTEP01_CONFIG_OC_SD_ENABLE   = ((uint16_t)0x0080)
+} powerstep01_ConfigOcSd_t;
+
+/// UVLO thresholds (UVLOVAL field of CONFIG register of Powerstep01)
+typedef enum {
+  POWERSTEP01_CONFIG_UVLOVAL_LOW      = ((uint16_t)0x0000),
+  POWERSTEP01_CONFIG_UVLOVAL_HIGH     = ((uint16_t)0x0100),
+} powerstep01_ConfigUvLoVal_t;
+
+/// Vcc voltage  (VCCVAL field of CONFIG register of Powerstep01)
+typedef enum {
+  POWERSTEP01_CONFIG_VCCVAL_7_5V    = ((uint16_t)0x0000),
+  POWERSTEP01_CONFIG_VCCVAL_15V     = ((uint16_t)0x0200)
+} powerstep01_ConfigVccVal_t;
+
+/// PWM frequency division factor (F_PWM_INT field of CONFIG register of Powerstep01)
+typedef enum {
+  POWERSTEP01_CONFIG_PWM_DIV_1    = (((uint16_t)0x00)<<POWERSTEP01_CONFIG_PWM_DIV_SHIFT),
+  POWERSTEP01_CONFIG_PWM_DIV_2    = (((uint16_t)0x01)<<POWERSTEP01_CONFIG_PWM_DIV_SHIFT),
+  POWERSTEP01_CONFIG_PWM_DIV_3    = (((uint16_t)0x02)<<POWERSTEP01_CONFIG_PWM_DIV_SHIFT),
+  POWERSTEP01_CONFIG_PWM_DIV_4    = (((uint16_t)0x03)<<POWERSTEP01_CONFIG_PWM_DIV_SHIFT),
+  POWERSTEP01_CONFIG_PWM_DIV_5    = (((uint16_t)0x04)<<POWERSTEP01_CONFIG_PWM_DIV_SHIFT),
+  POWERSTEP01_CONFIG_PWM_DIV_6    = (((uint16_t)0x05)<<POWERSTEP01_CONFIG_PWM_DIV_SHIFT),
+  POWERSTEP01_CONFIG_PWM_DIV_7    = (((uint16_t)0x06)<<POWERSTEP01_CONFIG_PWM_DIV_SHIFT)
+} powerstep01_ConfigFPwmInt_t;
+
+/// PWM frequency multiplication factor (F_PWM_DEC field of CONFIG register of Powerstep01)
+typedef enum {
+  POWERSTEP01_CONFIG_PWM_MUL_0_625  = (((uint16_t)0x00)<<POWERSTEP01_CONFIG_PWM_MUL_SHIFT),
+  POWERSTEP01_CONFIG_PWM_MUL_0_75   = (((uint16_t)0x01)<<POWERSTEP01_CONFIG_PWM_MUL_SHIFT),
+  POWERSTEP01_CONFIG_PWM_MUL_0_875  = (((uint16_t)0x02)<<POWERSTEP01_CONFIG_PWM_MUL_SHIFT),
+  POWERSTEP01_CONFIG_PWM_MUL_1      = (((uint16_t)0x03)<<POWERSTEP01_CONFIG_PWM_MUL_SHIFT),
+  POWERSTEP01_CONFIG_PWM_MUL_1_25   = (((uint16_t)0x04)<<POWERSTEP01_CONFIG_PWM_MUL_SHIFT),
+  POWERSTEP01_CONFIG_PWM_MUL_1_5    = (((uint16_t)0x05)<<POWERSTEP01_CONFIG_PWM_MUL_SHIFT),
+  POWERSTEP01_CONFIG_PWM_MUL_1_75   = (((uint16_t)0x06)<<POWERSTEP01_CONFIG_PWM_MUL_SHIFT),
+  POWERSTEP01_CONFIG_PWM_MUL_2      = (((uint16_t)0x07)<<POWERSTEP01_CONFIG_PWM_MUL_SHIFT)
+} powerstep01_ConfigFPwmDec_t;
+
+/// Switching period  (TSW field of CONFIG register of Powerstep01)
+typedef enum {
+  POWERSTEP01_CONFIG_TSW_004us    =(((uint16_t)0x01)<<POWERSTEP01_CONFIG_TSW_SHIFT),
+  POWERSTEP01_CONFIG_TSW_008us    =(((uint16_t)0x02)<<POWERSTEP01_CONFIG_TSW_SHIFT),
+  POWERSTEP01_CONFIG_TSW_012us    =(((uint16_t)0x03)<<POWERSTEP01_CONFIG_TSW_SHIFT),
+  POWERSTEP01_CONFIG_TSW_016us    =(((uint16_t)0x04)<<POWERSTEP01_CONFIG_TSW_SHIFT),
+  POWERSTEP01_CONFIG_TSW_020us    =(((uint16_t)0x05)<<POWERSTEP01_CONFIG_TSW_SHIFT),
+  POWERSTEP01_CONFIG_TSW_024us    =(((uint16_t)0x06)<<POWERSTEP01_CONFIG_TSW_SHIFT),
+  POWERSTEP01_CONFIG_TSW_028us    =(((uint16_t)0x07)<<POWERSTEP01_CONFIG_TSW_SHIFT),
+  POWERSTEP01_CONFIG_TSW_032us    =(((uint16_t)0x08)<<POWERSTEP01_CONFIG_TSW_SHIFT),
+  POWERSTEP01_CONFIG_TSW_036us    =(((uint16_t)0x09)<<POWERSTEP01_CONFIG_TSW_SHIFT),
+  POWERSTEP01_CONFIG_TSW_040us    =(((uint16_t)0x0A)<<POWERSTEP01_CONFIG_TSW_SHIFT),
+  POWERSTEP01_CONFIG_TSW_044us    =(((uint16_t)0x0B)<<POWERSTEP01_CONFIG_TSW_SHIFT),
+  POWERSTEP01_CONFIG_TSW_048us    =(((uint16_t)0x0C)<<POWERSTEP01_CONFIG_TSW_SHIFT),
+  POWERSTEP01_CONFIG_TSW_052us    =(((uint16_t)0x0D)<<POWERSTEP01_CONFIG_TSW_SHIFT),
+  POWERSTEP01_CONFIG_TSW_056us    =(((uint16_t)0x0E)<<POWERSTEP01_CONFIG_TSW_SHIFT),
+  POWERSTEP01_CONFIG_TSW_060us    =(((uint16_t)0x0F)<<POWERSTEP01_CONFIG_TSW_SHIFT),
+  POWERSTEP01_CONFIG_TSW_064us    =(((uint16_t)0x10)<<POWERSTEP01_CONFIG_TSW_SHIFT),
+  POWERSTEP01_CONFIG_TSW_068us    =(((uint16_t)0x11)<<POWERSTEP01_CONFIG_TSW_SHIFT),
+  POWERSTEP01_CONFIG_TSW_072us    =(((uint16_t)0x12)<<POWERSTEP01_CONFIG_TSW_SHIFT),
+  POWERSTEP01_CONFIG_TSW_076us    =(((uint16_t)0x13)<<POWERSTEP01_CONFIG_TSW_SHIFT),
+  POWERSTEP01_CONFIG_TSW_080us    =(((uint16_t)0x14)<<POWERSTEP01_CONFIG_TSW_SHIFT),
+  POWERSTEP01_CONFIG_TSW_084us    =(((uint16_t)0x15)<<POWERSTEP01_CONFIG_TSW_SHIFT),
+  POWERSTEP01_CONFIG_TSW_088us    =(((uint16_t)0x16)<<POWERSTEP01_CONFIG_TSW_SHIFT),
+  POWERSTEP01_CONFIG_TSW_092us    =(((uint16_t)0x17)<<POWERSTEP01_CONFIG_TSW_SHIFT),
+  POWERSTEP01_CONFIG_TSW_096us    =(((uint16_t)0x18)<<POWERSTEP01_CONFIG_TSW_SHIFT),
+  POWERSTEP01_CONFIG_TSW_100us    =(((uint16_t)0x19)<<POWERSTEP01_CONFIG_TSW_SHIFT),
+  POWERSTEP01_CONFIG_TSW_104us    =(((uint16_t)0x1A)<<POWERSTEP01_CONFIG_TSW_SHIFT),
+  POWERSTEP01_CONFIG_TSW_108us    =(((uint16_t)0x1B)<<POWERSTEP01_CONFIG_TSW_SHIFT),
+  POWERSTEP01_CONFIG_TSW_112us    =(((uint16_t)0x1C)<<POWERSTEP01_CONFIG_TSW_SHIFT),
+  POWERSTEP01_CONFIG_TSW_116us    =(((uint16_t)0x1D)<<POWERSTEP01_CONFIG_TSW_SHIFT),
+  POWERSTEP01_CONFIG_TSW_120us    =(((uint16_t)0x1E)<<POWERSTEP01_CONFIG_TSW_SHIFT),
+  POWERSTEP01_CONFIG_TSW_124us    =(((uint16_t)0x1F)<<POWERSTEP01_CONFIG_TSW_SHIFT)        
+} powerstep01_ConfigTsw_t;
+
+/// Voltage supply compensation enabling for current mode(EN_PRED field of CONFIG register of Powerstep01)
+typedef enum {
+  POWERSTEP01_CONFIG_PRED_DISABLE =((uint16_t)0x0000),
+  POWERSTEP01_CONFIG_PRED_ENABLE  =((uint16_t)0x8000)
+} powerstep01_ConfigPredEn_t;
+
+/// Bit mask for STATUS Register of PowerStep01²
+typedef enum {
+  POWERSTEP01_STATUS_HIZ          = (((uint16_t)0x0001)),
+  POWERSTEP01_STATUS_BUSY         = (((uint16_t)0x0002)),
+  POWERSTEP01_STATUS_SW_F         = (((uint16_t)0x0004)),
+  POWERSTEP01_STATUS_SW_EVN       = (((uint16_t)0x0008)),
+  POWERSTEP01_STATUS_DIR          = (((uint16_t)0x0010)),
+  POWERSTEP01_STATUS_MOT_STATUS   = (((uint16_t)0x0060)),
+  POWERSTEP01_STATUS_CMD_ERROR    = (((uint16_t)0x0080)),
+  POWERSTEP01_STATUS_STCK_MOD     = (((uint16_t)0x0100)),
+  POWERSTEP01_STATUS_UVLO         = (((uint16_t)0x0200)),
+  POWERSTEP01_STATUS_UVLO_ADC     = (((uint16_t)0x0400)),
+  POWERSTEP01_STATUS_TH_STATUS    = (((uint16_t)0x1800)),
+  POWERSTEP01_STATUS_OCD          = (((uint16_t)0x2000)),
+  POWERSTEP01_STATUS_STALL_A      = (((uint16_t)0x4000)),
+  POWERSTEP01_STATUS_STALL_B      = (((uint16_t)0x8000))
+} powerstep01_StatusMasks_t;
+
+/// Motor state (MOT_STATUS filed of STATUS register of PowerStep01)
+typedef enum {
+  POWERSTEP01_STATUS_MOT_STATUS_STOPPED       = (((uint16_t)0x0000)<<POWERSTEP01_STATUS_MOT_STATUS_SHIFT),
+  POWERSTEP01_STATUS_MOT_STATUS_ACCELERATION  = (((uint16_t)0x0001)<<POWERSTEP01_STATUS_MOT_STATUS_SHIFT),
+  POWERSTEP01_STATUS_MOT_STATUS_DECELERATION  = (((uint16_t)0x0002)<<POWERSTEP01_STATUS_MOT_STATUS_SHIFT),
+  POWERSTEP01_STATUS_MOT_STATUS_CONST_SPD     = (((uint16_t)0x0003)<<POWERSTEP01_STATUS_MOT_STATUS_SHIFT)
+} powerstep01_Status_t;
+
+/// Powerstep01 internal register addresses
+typedef enum {
+  POWERSTEP01_ABS_POS     = ((uint8_t)0x01),
+  POWERSTEP01_EL_POS      = ((uint8_t)0x02),
+  POWERSTEP01_MARK        = ((uint8_t)0x03), 
+  POWERSTEP01_SPEED       = ((uint8_t)0x04),
+  POWERSTEP01_ACC         = ((uint8_t)0x05),
+  POWERSTEP01_DEC         = ((uint8_t)0x06),
+  POWERSTEP01_MAX_SPEED   = ((uint8_t)0x07),
+  POWERSTEP01_MIN_SPEED   = ((uint8_t)0x08),
+  POWERSTEP01_FS_SPD      = ((uint8_t)0x15),
+  POWERSTEP01_KVAL_HOLD   = ((uint8_t)0x09),
+  POWERSTEP01_KVAL_RUN    = ((uint8_t)0x0A),
+  POWERSTEP01_KVAL_ACC    = ((uint8_t)0x0B),
+  POWERSTEP01_KVAL_DEC    = ((uint8_t)0x0C),
+  POWERSTEP01_INT_SPD     = ((uint8_t)0x0D),
+  POWERSTEP01_ST_SLP      = ((uint8_t)0x0E),
+  POWERSTEP01_FN_SLP_ACC  = ((uint8_t)0x0F),
+  POWERSTEP01_FN_SLP_DEC  = ((uint8_t)0x10),
+  POWERSTEP01_K_THERM     = ((uint8_t)0x11),
+  POWERSTEP01_ADC_OUT     = ((uint8_t)0x12),
+  POWERSTEP01_OCD_TH      = ((uint8_t)0x13),
+  POWERSTEP01_STALL_TH    = ((uint8_t)0x14),
+  POWERSTEP01_STEP_MODE   = ((uint8_t)0x16),
+  POWERSTEP01_ALARM_EN    = ((uint8_t)0x17),
+  POWERSTEP01_GATECFG1    = ((uint8_t)0x18),
+  POWERSTEP01_GATECFG2    = ((uint8_t)0x19),
+  POWERSTEP01_CONFIG      = ((uint8_t)0x1A),
+  POWERSTEP01_STATUS      = ((uint8_t)0x1B)
+} powerstep01_Registers_t;
+
+/// Powerstep01 address of register TVAL_HOLD (Current mode only)
+#define   POWERSTEP01_TVAL_HOLD  (POWERSTEP01_KVAL_HOLD )   
+/// Powerstep01 address of register TVAL_RUN (Current mode only)
+#define   POWERSTEP01_TVAL_RUN   (POWERSTEP01_KVAL_RUN)   
+/// Powerstep01 address of register TVAL_HOLD (Current mode only)
+#define   POWERSTEP01_TVAL_ACC   (POWERSTEP01_KVAL_ACC)   
+/// Powerstep01 address of register TVAL_DEC (Current mode only)
+#define   POWERSTEP01_TVAL_DEC   (POWERSTEP01_KVAL_DEC)   
+/// Powerstep01 address of register T_FAST  (Current mode only)
+#define   POWERSTEP01_T_FAST     (POWERSTEP01_ST_SLP)   
+/// Powerstep01 address of register TON_MIN  (Current mode only)
+#define   POWERSTEP01_TON_MIN    (POWERSTEP01_FN_SLP_ACC)
+/// Powerstep01 address of register TOFF_MIN (Current mode only)
+#define   POWERSTEP01_TOFF_MIN   (POWERSTEP01_FN_SLP_DEC)
+
+/// Powerstep01 application commands
+typedef enum {
+  POWERSTEP01_NOP               = ((uint8_t)0x00),
+  POWERSTEP01_SET_PARAM         = ((uint8_t)0x00),
+  POWERSTEP01_GET_PARAM         = ((uint8_t)0x20),
+  POWERSTEP01_RUN               = ((uint8_t)0x50),
+  POWERSTEP01_STEP_CLOCK        = ((uint8_t)0x58),
+  POWERSTEP01_MOVE              = ((uint8_t)0x40),
+  POWERSTEP01_GO_TO             = ((uint8_t)0x60),
+  POWERSTEP01_GO_TO_DIR         = ((uint8_t)0x68),
+  POWERSTEP01_GO_UNTIL          = ((uint8_t)0x82),
+  POWERSTEP01_GO_UNTIL_ACT_CPY  = ((uint8_t)0x8A),
+  POWERSTEP01_RELEASE_SW        = ((uint8_t)0x92),
+  POWERSTEP01_GO_HOME           = ((uint8_t)0x70),
+  POWERSTEP01_GO_MARK           = ((uint8_t)0x78),
+  POWERSTEP01_RESET_POS         = ((uint8_t)0xD8),
+  POWERSTEP01_RESET_DEVICE      = ((uint8_t)0xC0),
+  POWERSTEP01_SOFT_STOP         = ((uint8_t)0xB0),
+  POWERSTEP01_HARD_STOP         = ((uint8_t)0xB8),
+  POWERSTEP01_SOFT_HIZ          = ((uint8_t)0xA0),
+  POWERSTEP01_HARD_HIZ          = ((uint8_t)0xA8),
+  POWERSTEP01_GET_STATUS        = ((uint8_t)0xD0),
+  POWERSTEP01_RESERVED_CMD1     = ((uint8_t)0xEB),
+  POWERSTEP01_RESERVED_CMD2     = ((uint8_t)0xF8)
+} powerstep01_Commands_t;
+
+/** @defgroup Motor_Driver_Initialization_Structure Motor Driver Initialization Structure
+  * @{
+  */
+/* 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;                                                      *
+ *----------------------------------------------------------------------------*/
+///Initialization parameters structure common to current and voltage modes
+typedef struct
+{
+  ///Current or voltage mode selection
+  powerstep01_CmVm_t cmVmSelection;
+  ///Acceleration 
+  float acceleration;
+  ///Deceleration
+  float deceleration;
+  ///Maximum speed
+  float maxSpeed;
+  ///Minimum speed
+  float minSpeed;
+  ///Low speed optimization bit
+  powerstep01_LspdOpt_t lowSpeedOptimization;
+  ///Full step speed
+  float fullStepSpeed;
+  ///Boost mode bit
+  powerstep01_BoostMode_t boostMode;
+  ///Over current detection threshold
+  float ocdThreshold;
+  ///Step mode
+  motorStepMode_t stepMode;
+  ///Sync clock selection
+  powerstep01_SyncSel_t syncClockSelection;
+  ///Alarm selection
+  uint8_t alarmsSelection;
+  ///Sink or source current used by gate driving circuitry
+  powerstep01_Igate_t iGate;
+  ///Duration of the overboost phase during gate turn-off
+  powerstep01_Tboost_t tBoost;
+  ///Duration of constant current phase during gate turn-on and turn-off
+  powerstep01_Tcc_t tcc;
+  ///Clock source monitoring enable bit
+  powerstep01_WdEn_t wdEn;
+  ///Duration of the blanking of the current sensing comparators
+  powerstep01_TBlank_t tBlank;
+  ///Deadtime duration between gate turn-off and opposite gate turn-on
+  powerstep01_Tdt_t tdt;  
+} commonParameters_t;
+
+///Initialization parameters structure for voltage mode
+typedef struct
+{
+  ///Parameters common to current and voltage modes
+  commonParameters_t cp;
+  ///Voltage amplitude regulation when the motor is stopped
+  float kvalHold;
+  ///Voltage amplitude regulation when the motor is running at constant speed
+  float kvalRun;
+  ///Voltage amplitude regulation during motor acceleration
+  float kvalAcc;
+  ///Voltage amplitude regulation during motor deceleration
+  float kvalDec;
+  ///Speed value at which the BEMF compensation curve changes slope  
+  float intersectSpeed;
+  ///BEMF compensation curve slope when speed is lower than intersect speed
+  float startSlope;
+  ///BEMF compensation curve slope when speed is greater than intersect speed during acceleration
+  float accelerationFinalSlope;
+  ///BEMF compensation curve slope when speed is greater than intersect speed during deceleration
+  float decelerationFinalSlope;
+  ///Winding resistance thermal drift compensation coefficient
+  float thermalCompensationFactor;
+  ///Stall detection threshold
+  float stallThreshold;
+  ///System clock source management
+  powerstep01_ConfigOscMgmt_t oscClkSel;
+  ///External switch to act as hard_stop interrupt or not
+  powerstep01_ConfigSwMode_t swMode;
+  ///Motor supply voltage compensation enable bit
+  powerstep01_ConfigEnVscomp_t enVsComp;
+  ///Overcurrent event causes or not the bridges to turn-off
+  powerstep01_ConfigOcSd_t ocSd;
+  ///UVLO protection thresholds
+  powerstep01_ConfigUvLoVal_t uvloVal;
+  ///Internal VCC regulator output voltage
+  powerstep01_ConfigVccVal_t vccVal;
+  ///Integer division factor of PWM frequency generation
+  powerstep01_ConfigFPwmInt_t fPwmInt;
+  ///Multiplication factor of PWM frequency generation
+  powerstep01_ConfigFPwmDec_t fPwmDec;
+} powerstep01_VoltageMode_init_t;
+
+///Initialization parameters structure for current mode
+typedef struct
+{
+  ///Parameters common to current and voltage modes
+  commonParameters_t cp;
+  ///Torque regulation DAC reference voltage when motor is stopped
+  float tvalHold;
+  ///Torque regulation DAC reference voltage when motor is runnig at constant speed
+  float tvalRun;
+  ///Torque regulation DAC reference voltage during motor acceleration
+  float tvalAcc;
+  ///Torque regulation DAC reference voltage during motor deceleration
+  float tvalDec;
+  ///Maximum fast decay time
+  powerstep01_ToffFast_t toffFast;
+  ///Maximum fall step time
+  powerstep01_FastStep_t fastStep;
+  ///Minimum on-time
+  float tonMin;
+  ///Minimum off-time
+  float toffMin;
+  ///System clock source management
+  powerstep01_ConfigOscMgmt_t oscClkSel;
+  ///External switch to act as hard_stop interrupt or not
+  powerstep01_ConfigSwMode_t swMode;
+  ///Peak current is adjusted through the ADCIN input or not
+  powerstep01_ConfigEnTqReg_t tqReg;
+  ///Motor supply voltage compensation enable bit
+  powerstep01_ConfigEnVscomp_t enVsComp;
+  ///Overcurrent event causes or not the bridges to turn-off
+  powerstep01_ConfigOcSd_t ocSd;
+  ///UVLO protection thresholds
+  powerstep01_ConfigUvLoVal_t uvloVal;
+  ///Internal VCC regulator output voltage
+  powerstep01_ConfigVccVal_t vccVal;
+  ///target switching period
+  powerstep01_ConfigTsw_t tsw;
+  ///predictive current control method enable bit
+  powerstep01_ConfigPredEn_t predEn;
+
+} powerstep01_CurrentMode_init_t;
+
+///Union of current and volatge modes initialization parameters structures
+typedef union powerstep01_init_u powerstep01_init_u_t;
+union powerstep01_init_u
+{
+  ///Initialization parameters structure for current mode
+  powerstep01_CurrentMode_init_t cm;
+  ///Initialization parameters structure for voltage mode
+  powerstep01_VoltageMode_init_t vm;
+};
+/**
+  * @}
+  */
+  
+/** 
+ * @brief  Powerstep01 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;                                                      *
+ *----------------------------------------------------------------------------*/
+
+/**
+  * @}
+  */
+
+/* Functions -----------------------------------------------------------------*/
+
+/** @defgroup Powerstep01_Board_Linked_Functions Powerstep01 Board Linked 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);                             *
+ *----------------------------------------------------------------------------*/
+///Delay of the requested number of milliseconds
+extern void Powerstep01_Board_Delay(void *handle, uint32_t delay);
+///Enable Irq
+extern void Powerstep01_Board_EnableIrq(void *handle);
+///Disable Irq
+extern void Powerstep01_Board_DisableIrq(void *handle);
+///init the timer for the step clock
+extern void Powerstep01_Board_StepClockInit(void *handle);
+///Set the Powerstep01 reset pin (high logic level)
+extern void Powerstep01_Board_ReleaseReset(void *handle);           
+///Reset the Powerstep01 reset pin (low logic level)
+extern void Powerstep01_Board_Reset(void *handle);                  
+///Write bytes to the Powerstep01s via SPI
+extern uint8_t Powerstep01_Board_SpiWriteBytes(void *handle, uint8_t *pByteToTransmit, uint8_t *pReceivedByte);
+
+
+/**
+  * @}
+  */
+
+  /**
+  * @}
+  */
+
+  /**
+  * @}
+  */
+
+#ifdef __cplusplus
+  }
+#endif
+
+#endif /* #ifndef _POWERSTEP01_H_INCLUDED */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
--- a/Components/powerstep01/PowerStep01.cpp	Fri Mar 24 10:58:48 2017 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1593 +0,0 @@
-/**
- ******************************************************************************
- * @file    PowerStep01.cpp
- * @author  IPC Rennes
- * @version V1.0.0
- * @date    March 18th, 2016
- * @brief   Powerstep01 motor driver (Microstepping controller with power MOSFETs)
- * @note    (C) COPYRIGHT 2016 STMicroelectronics
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; COPYRIGHT(c) 2016 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.
- *
- ******************************************************************************
- */
-
-/* Includes ------------------------------------------------------------------*/
-#include "PowerStep01.h"
-
-/* Definitions ---------------------------------------------------------------*/
-
-/* Error of bad SPI transaction. */
-#define POWERSTEP01_ERROR_1        (POWERSTEP01_ERROR_BASE|0x0001)
-
-/* Variables  ----------------------------------------------------------------*/
-
-/* Number of devices. */
-uint8_t PowerStep01::numberOfDevices = 0;
-
-/* ISR flags used to restart an interrupted SPI transfer when an error is reported. */
-bool PowerStep01::spiPreemptionByIsr = FALSE;
-bool PowerStep01::isrFlag = FALSE;
-
-/* SPI Transmission for Daisy-Chain Configuration. */
-uint8_t PowerStep01::spiTxBursts[POWERSTEP01_CMD_ARG_MAX_NB_BYTES][MAX_NUMBER_OF_DEVICES];
-uint8_t PowerStep01::spiRxBursts[POWERSTEP01_CMD_ARG_MAX_NB_BYTES][MAX_NUMBER_OF_DEVICES];
-
-
-/* Methods -------------------------------------------------------------------*/
-
-/**********************************************************
- * @brief Starts the Powerstep01 library
- * @param[in] pInit pointer to the initialization data
- * @retval COMPONENT_OK in case of success.
- **********************************************************/
-status_t PowerStep01::Powerstep01_Init(void* pInit)
-{ 
-  
-  /* configure the step clock */
-  Powerstep01_Board_StepClockInit();
-  
-  /* Standby-reset deactivation */
-  Powerstep01_Board_ReleaseReset();
-  
-  /* Let a delay after reset */
-  Powerstep01_Board_Delay(1);
-
-  if (pInit == 0)
-  {
-    // Set all registers to their predefined values 
-    // from powerstep01_target_config.h 
-    Powerstep01_SetRegisterToPredefinedValues();
-  }
-  else
-  {
-    Powerstep01_SetDeviceParamsToGivenValues((powerstep01_init_u_t*) pInit);
-  }
-  
-  // Put the Powerstep01 in HiZ state
-  Powerstep01_CmdHardHiZ();
-  
-  Powerstep01_FetchAndClearAllStatus();
-
-  return COMPONENT_OK;
-}
-
-/**********************************************************
- * @brief Read id
- * @param[in] id pointer to the identifier to be read.
- * @retval COMPONENT_OK in case of success.
- **********************************************************/
-status_t PowerStep01::Powerstep01_ReadID(uint8_t *id)
-{
-  *id = deviceInstance;
-
-  return COMPONENT_OK;
-}
-
-/**********************************************************
- * @brief  Attaches a user callback to the error Handler.
- * The call back will be then called each time the library 
- * detects an error
- * @param[in] callback Name of the callback to attach 
- * to the error Hanlder
- * @retval None
- **********************************************************/
-void PowerStep01::Powerstep01_AttachErrorHandler(void (*callback)(uint16_t error))
-{
-  errorHandlerCallback = (void (*)(uint16_t error)) callback;
-}
-
-/**********************************************************
- * @brief  Issues the get_status command to the Powerstep01 device
- * @retval Status Register value
- * @note Once the get_status command is performed, the flags of the
- * status register are reset. 
- * This is not the case when the status register is read with the
- * GetParam command (via the functions Powerstep01_ReadStatusRegister
- * or Powerstep01_CmdGetParam).
- **********************************************************/
-uint16_t PowerStep01::Powerstep01_CmdGetStatus(void)
-{
-  uint16_t status = 0;
-  uint32_t loop;
-  uint8_t spiIndex = numberOfDevices - deviceInstance - 1;
-  bool itDisable = FALSE;  
- 
-  do
-  {
-    spiPreemptionByIsr = FALSE;
-    if (itDisable)
-    {
-      /* re-enable Powerstep01_Board_EnableIrq if disable in previous iteration */
-      Powerstep01_Board_EnableIrq();
-      itDisable = FALSE;
-    }    
-    for (loop = 0; loop < numberOfDevices; loop++)
-    {
-       spiTxBursts[0][loop] = POWERSTEP01_NOP;
-       spiTxBursts[1][loop] = POWERSTEP01_NOP;
-       spiTxBursts[2][loop] = POWERSTEP01_NOP;
-       spiTxBursts[3][loop] = POWERSTEP01_NOP;
-       spiRxBursts[0][loop] = 0;
-       spiRxBursts[1][loop] = 0;
-       spiRxBursts[2][loop] = 0;
-       spiRxBursts[3][loop] = 0;       
-    }
-    spiTxBursts[0][spiIndex] = POWERSTEP01_GET_STATUS;
-    /* Disable interruption before checking */
-    /* pre-emption by ISR and SPI transfers*/
-    Powerstep01_Board_DisableIrq();
-    itDisable = TRUE;
-  } while (spiPreemptionByIsr); // check pre-emption by ISR  
-  for (loop = 0; loop < POWERSTEP01_CMD_ARG_NB_BYTES_GET_STATUS + POWERSTEP01_RSP_NB_BYTES_GET_STATUS; loop++)
-  {
-     Powerstep01_WriteBytes(&spiTxBursts[loop][0], &spiRxBursts[loop][0]);
-  }
-  status = (spiRxBursts[1][spiIndex] << 8) | (spiRxBursts[2][spiIndex]);
-  /* re-enable Powerstep01_Board_EnableIrq after SPI transfers*/
-  Powerstep01_Board_EnableIrq();  
-
-  return (status);
-}
-
-/**********************************************************
- * @brief  Requests the motor to move to the home position (ABS_POSITION = 0)
- * @retval None
- **********************************************************/
-void PowerStep01::Powerstep01_CmdGoHome(void)
-{
-  Powerstep01_SendCommand(POWERSTEP01_GO_HOME, 0);
-} 
-
-/**********************************************************
- * @brief  Requests the motor to move to the mark position 
- * @retval None
- **********************************************************/
-void PowerStep01::Powerstep01_CmdGoMark(void)
-{
-    Powerstep01_SendCommand(POWERSTEP01_GO_MARK, 0); 
-}
-
-/**********************************************************
- * @brief  Requests the motor to move to the specified position 
- * @param[in] targetPosition absolute position in steps
- * @retval None
- **********************************************************/
-void PowerStep01::Powerstep01_CmdGoTo(int32_t targetPosition)
-{
-  Powerstep01_SendCommand(POWERSTEP01_GO_TO, targetPosition);
-}
-
-/******************************************************//**
- * @brief Issues PowerStep01 Go To Dir command
- * @param[in] direction movement direction
- * @param[in] abs_pos absolute position where requested to move
- * @retval None
- *********************************************************/
-void PowerStep01::Powerstep01_CmdGoToDir(motorDir_t direction,
-                                         int32_t abs_pos)
-{
-  Powerstep01_SendCommand((uint8_t)POWERSTEP01_GO_TO_DIR|
-                          (uint8_t)direction, abs_pos);  
-}
-
-/******************************************************//**
- * @brief Issues PowerStep01 Go Until command
- * @param[in] action ACTION_RESET or ACTION_COPY
- * @param[in] direction movement direction
- * @param[in] speed in steps/tick
- * @retval None
- *********************************************************/
-void PowerStep01::Powerstep01_CmdGoUntil(motorAction_t action,
-                            motorDir_t direction,
-                            uint32_t speed)
-{
-  Powerstep01_SendCommand(
-    (uint8_t)POWERSTEP01_GO_UNTIL|(uint8_t)action|(uint8_t)direction,
-    speed);
-}
-
-/**********************************************************
- * @brief Immediatly stops the motor and disable the power bridge
- * @retval None
- * @note The hard_hiz command immediately disables the power bridges
- * (high impedance state) and raises the HiZ flag. 
- * When the motor is stopped, a hard_hiz command forces the bridges 
- * to enter high impedance state.
- * This command can be given anytime and is immediately executed.
- *********************************************************/
-void PowerStep01::Powerstep01_CmdHardHiZ(void)
-{
-  Powerstep01_SendCommand(POWERSTEP01_HARD_HIZ, 0);    
-}
-
-/**********************************************************
- * @brief  Immediatly stops the motor and disable the power bridge
- * @retval None
- * @note The hard_stop command causes an immediate motor stop with
- * infinite deceleration.
- * When the motor is in high impedance state, a hard_stop command
- * forces the bridges to exit high impedance state; no motion is performed.
- * This command can be given anytime and is immediately executed.
- * This command keeps the BUSY flag low until the motor is stopped.
- **********************************************************/
-void PowerStep01::Powerstep01_CmdHardStop(void) 
-{
-  Powerstep01_SendCommand(POWERSTEP01_HARD_STOP, 0);
-}
-
-/**********************************************************
- * @brief  Moves the motor of the specified number of steps
- * @param[in] direction FORWARD or BACKWARD
- * @param[in] stepCount Number of steps to perform
- * @retval None
- **********************************************************/
-void PowerStep01::Powerstep01_CmdMove(motorDir_t direction,
-                                      uint32_t stepCount)
-{
-  Powerstep01_SendCommand((uint8_t)POWERSTEP01_MOVE|(uint8_t)direction,
-    stepCount);
-}
-
-/**********************************************************
- * @brief  Issues the Nop command to the Powerstep01 device
- * @retval None
- **********************************************************/
-void PowerStep01::Powerstep01_CmdNop(void)
-{
-  Powerstep01_SendCommand(POWERSTEP01_NOP, 0);
-}
-
-/******************************************************//**
- * @brief Issues PowerStep01 Release SW command
- * @param[in] action type of action to undertake when the SW
- * input is forced high
- * @param[in] direction movement direction
- * @retval None
- *********************************************************/
-void PowerStep01::Powerstep01_CmdReleaseSw(motorAction_t action,
-                                           motorDir_t direction)
-{
-   Powerstep01_SendCommand((uint8_t)POWERSTEP01_RELEASE_SW|
-                           (uint8_t)action|
-                           (uint8_t)direction,
-                           0);
-}
-
-/******************************************************//**
- * @brief Issues PowerStep01 Reset Device command
- * @param[in] deviceId (from 0 to MAX_NUMBER_OF_DEVICES-1 )
- * @retval None
- *********************************************************/
-void PowerStep01::Powerstep01_CmdResetDevice(void)
-{
-  Powerstep01_SendCommand(POWERSTEP01_RESET_DEVICE, 0);         
-}
-
-/******************************************************//**
- * @brief Issues PowerStep01 Reset Pos command
- * @param[in] deviceId (from 0 to MAX_NUMBER_OF_DEVICES-1 )
- * @retval None
- *********************************************************/
-void PowerStep01::Powerstep01_CmdResetPos(void)
-{
-  Powerstep01_SendCommand(POWERSTEP01_RESET_POS, 0);       
-}
-
-/**********************************************************
- * @brief  Runs the motor. It will accelerate from the min 
- * speed up to the max speed by using the device acceleration.
- * @param[in] direction FORWARD or BACKWARD
- * @param[in] speed in steps/s
- * @retval None
- **********************************************************/
-void PowerStep01::Powerstep01_CmdRun(motorDir_t direction, uint32_t speed)
-{
-  Powerstep01_SendCommand((uint8_t)POWERSTEP01_RUN|(uint8_t)direction, speed);
-}
-
-/**********************************************************
- * @brief Stops the motor by using the device deceleration
- * and disables the power bridges
- * @retval None
- * @note The soft_hiz 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.
- * When bridges are disabled, the HiZ flag is raised.
- * When the motor is stopped, a soft_hiz command forces the bridges
- * to enter high impedance state.
- * This command can be given anytime and is immediately executed.
- * This command keeps the BUSY flag low until the motor is stopped.
- *********************************************************/
-void PowerStep01::Powerstep01_CmdSoftHiZ(void)
-{
-  Powerstep01_SendCommand(POWERSTEP01_SOFT_HIZ, 0);           
-}
-
-/**********************************************************
- * @brief  Stops the motor by using the device deceleration
- * @retval None
- * @note The soft_stop 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.
- * When the motor is in high impedance state, a soft_stop
- * command forces the bridges to exit from high impedance state.
- * No motion is performed.
- * This command can be given anytime and is immediately executed.
- * This command keeps the BUSY flag low until the motor is stopped.
- **********************************************************/
-void PowerStep01::Powerstep01_CmdSoftStop(void)
-{   
-  Powerstep01_SendCommand(POWERSTEP01_SOFT_STOP, 0);
-}
-
-/******************************************************//**
- * @brief Issues PowerStep01 Step Clock command
- * @param[in] direction Movement direction (FORWARD, BACKWARD)
- * @retval None
- *********************************************************/
-void PowerStep01::Powerstep01_CmdStepClock(motorDir_t direction)
-{
-  Powerstep01_SendCommand((uint8_t)POWERSTEP01_STEP_CLOCK|(uint8_t)direction,
-                          0);  
-}
-
-/**********************************************************
- * @brief Error handler which calls the user callback (if defined)
- * @param[in] error Number of the error
- * @retval None
- **********************************************************/
-void PowerStep01::Powerstep01_ErrorHandler(uint16_t error)
-{
-  if (errorHandlerCallback != 0)
-  {
-    (void) errorHandlerCallback(error);
-  }
-  else   
-  {
-    /* Aborting the program. */
-    exit(EXIT_FAILURE);
-  }
-}
-
-/******************************************************//**
- * @brief Fetch and clear status flags of all devices 
- * by issuing a GET_STATUS command simultaneously  
- * to all devices.
- * Then, the fetched status of each device can be retrieved
- * by using the Powerstep01_GetFetchedStatus function
- * provided there is no other calls to functions which 
- * use the SPI in between.
- * @retval None
- *********************************************************/
-void PowerStep01::Powerstep01_FetchAndClearAllStatus(void)
-{
-  uint8_t loop;
-
-  for (loop = 0; loop < numberOfDevices; loop++)
-  {
-     spiTxBursts[0][loop] = POWERSTEP01_GET_STATUS;
-     spiTxBursts[1][loop] = POWERSTEP01_NOP;
-     spiTxBursts[2][loop] = POWERSTEP01_NOP;
-     spiTxBursts[3][loop] = POWERSTEP01_NOP;
-     spiRxBursts[0][loop] = 0;
-     spiRxBursts[1][loop] = 0;
-     spiRxBursts[2][loop] = 0;
-     spiRxBursts[3][loop] = 0;
-  }
-  for (loop = 0; 
-       loop < POWERSTEP01_CMD_ARG_NB_BYTES_GET_STATUS + 
-              POWERSTEP01_RSP_NB_BYTES_GET_STATUS; 
-       loop++)
-  {
-     Powerstep01_WriteBytes(&spiTxBursts[loop][0], &spiRxBursts[loop][0]);
-  }
-}
-
-/******************************************************//**
- * @brief Get the value of the STATUS register which was 
- * fetched by using Powerstep01_FetchAndClearAllStatus.
- * The fetched values are available  as long as there
- * no other calls to functions which use the SPI.
- * @retval Last fetched value of the STATUS register
- *********************************************************/
-uint16_t PowerStep01::Powerstep01_GetFetchedStatus(void)
-{
-  uint16_t status = 0;
-  if (numberOfDevices > deviceInstance)
-  {
-    uint8_t spiIndex = numberOfDevices - deviceInstance - 1;
-    status = (spiRxBursts[1][spiIndex] << 8) | (spiRxBursts[2][spiIndex]);
-  }
-  return (status);
-}
-
-/**********************************************************
- * @brief Returns the FW version of the library
- * @retval POWERSTEP01_FW_VERSION
- **********************************************************/
-uint32_t PowerStep01::Powerstep01_GetFwVersion(void)
-{
-  return (POWERSTEP01_FW_VERSION);
-}
-
-/**********************************************************
- * @brief  Returns the mark position  device
- * @retval Mark register value converted in a 32b signed integer 
- **********************************************************/
-int32_t PowerStep01::Powerstep01_GetMark(void)
-{
-  return Powerstep01_ConvertPosition(Powerstep01_CmdGetParam(POWERSTEP01_MARK));
-}
-
-/**********************************************************
- * @brief  Returns the ABS_POSITION device
- * @retval ABS_POSITION register value converted in a 32b signed integer
- **********************************************************/
-int32_t PowerStep01::Powerstep01_GetPosition(void)
-{
-  return Powerstep01_ConvertPosition(
-    Powerstep01_CmdGetParam(POWERSTEP01_ABS_POS));
-}
-
-/**********************************************************
- * @brief Checks if the device is busy
- * by reading the Busy flag bit of its status Register
- * This operation clears the status register
- * @retval true if device is busy, false zero
- *********************************************************/
-bool PowerStep01::Powerstep01_IsDeviceBusy(void)
-{
-  if(!(Powerstep01_CmdGetStatus() & POWERSTEP01_STATUS_BUSY)) 
-  {
-    return TRUE;
-  }
-  else 
-  {
-    return FALSE;
-  }
-}
-
-/**********************************************************
- * @brief  Reads the Status Register value
- * @retval Status register value
- * @note The status register flags are not cleared 
- * at the difference with Powerstep01_CmdGetStatus()
- **********************************************************/
-uint16_t PowerStep01::Powerstep01_ReadStatusRegister(void)
-{
-  return (Powerstep01_CmdGetParam(POWERSTEP01_STATUS));
-}
-
-/**********************************************************
- * @brief  Set the stepping mode 
- * @param[in] stepMode from full step to 1/128 microstep
- * as specified in enum motorStepMode_t
- * @retval None
- **********************************************************/
-bool PowerStep01::Powerstep01_SelectStepMode(motorStepMode_t stepMode)
-{
-  uint8_t stepModeRegister;
-  powerstep01_StepSel_t powerstep01StepMode;
-
-  switch (stepMode)
-  {
-    case STEP_MODE_FULL:
-      powerstep01StepMode = POWERSTEP01_STEP_SEL_1;
-      break;
-    case STEP_MODE_HALF:
-      powerstep01StepMode = POWERSTEP01_STEP_SEL_1_2;
-      break;    
-    case STEP_MODE_1_4:
-      powerstep01StepMode = POWERSTEP01_STEP_SEL_1_4;
-      break;        
-    case STEP_MODE_1_8:
-      powerstep01StepMode = POWERSTEP01_STEP_SEL_1_8;
-      break;
-    case STEP_MODE_1_16:
-      powerstep01StepMode = POWERSTEP01_STEP_SEL_1_16;
-      break;        
-    case STEP_MODE_1_32:
-      powerstep01StepMode = POWERSTEP01_STEP_SEL_1_32;
-      break;
-    case STEP_MODE_1_64:
-      powerstep01StepMode = POWERSTEP01_STEP_SEL_1_64;
-      break;
-    case STEP_MODE_1_128:
-      powerstep01StepMode = POWERSTEP01_STEP_SEL_1_128;
-      break;
-    default:
-      return false;
-  }
-  
-  /* Set the powerstep01 in HiZ state */
-  Powerstep01_CmdHardHiZ();  
-  
-  /* Read Step mode register and clear STEP_SEL field */
-  stepModeRegister = (uint8_t)(0xF8 & Powerstep01_CmdGetParam(POWERSTEP01_STEP_MODE)) ;
-  
-  /* Apply new step mode */
-  Powerstep01_CmdSetParam(POWERSTEP01_STEP_MODE, stepModeRegister | (uint8_t)powerstep01StepMode);
-
-  /* Reset abs pos register */
-  Powerstep01_CmdResetPos();
-
-  return true;
-}
-
-/**********************************************************
- * @brief  Set current position to be the Home position (ABS pos set to 0)
- * @retval None
- **********************************************************/
-void PowerStep01::Powerstep01_SetHome(void)
-{
-  Powerstep01_CmdSetParam(POWERSTEP01_ABS_POS, 0);
-}
-
-/**********************************************************
- * @brief  Sets current position to be the Mark position 
- * @retval None
- **********************************************************/
-void PowerStep01::Powerstep01_SetMark(void)
-{
-  Powerstep01_CmdSetParam(POWERSTEP01_MARK,
-    Powerstep01_CmdGetParam(POWERSTEP01_ABS_POS));
-}                                                  
-
-/**********************************************************
- * @brief  Locks until the device state becomes Inactive
- * @retval None
- **********************************************************/
-void PowerStep01::Powerstep01_WaitWhileActive(void)
-{
-  /* Wait while motor is running */
-  while (Powerstep01_IsDeviceBusy() != 0);
-}
-
-/**
- * @brief To and from register parameter conversion functions
- */
-
-/**********************************************************
- * @brief  Converts the ABS_POSITION register value to a 32b signed integer
- * @param[in] abs_position_reg value of the ABS_POSITION register
- * @retval operation_result 32b signed integer corresponding to the absolute position 
- **********************************************************/
-int32_t PowerStep01::Powerstep01_ConvertPosition(uint32_t abs_position_reg)
-{
-  int32_t operation_result;
-
-  if (abs_position_reg & POWERSTEP01_ABS_POS_SIGN_BIT_MASK) 
-  {
-    /* Negative register value */
-    abs_position_reg = ~abs_position_reg;
-    abs_position_reg += 1;
-
-    operation_result = (int32_t) (abs_position_reg & POWERSTEP01_ABS_POS_VALUE_MASK);
-    operation_result = -operation_result;
-  } 
-  else 
-  {
-    operation_result = (int32_t) abs_position_reg;
-  }
-  return operation_result;
-}
-
-/**
- * @brief Functions to initialize the registers
- */
-
-/**********************************************************
- * @brief Set the parameters of the device to values of initPrm structure
- * @param[in] initPrm structure containing values to initialize the device
- * parameters
- * @retval None.
- **********************************************************/
-void PowerStep01::Powerstep01_SetDeviceParamsToGivenValues(
-  powerstep01_init_u_t *initPrm)
-{
-  Powerstep01_CmdSetParam(POWERSTEP01_ABS_POS, 0);
-  Powerstep01_CmdSetParam(POWERSTEP01_EL_POS, 0);
-  Powerstep01_CmdSetParam(POWERSTEP01_MARK, 0);
-  Powerstep01_CmdSetParam(POWERSTEP01_ACC,
-    acc_dec_steps_s2_to_reg_val(initPrm->cm.cp.acceleration));
-  Powerstep01_CmdSetParam(POWERSTEP01_DEC,
-    acc_dec_steps_s2_to_reg_val(initPrm->cm.cp.deceleration));
-  Powerstep01_CmdSetParam(POWERSTEP01_MAX_SPEED,
-    max_spd_steps_s_to_reg_val(initPrm->cm.cp.maxSpeed));
-  Powerstep01_CmdSetParam(POWERSTEP01_MIN_SPEED,
-    initPrm->cm.cp.lowSpeedOptimization|
-    max_spd_steps_s_to_reg_val(initPrm->cm.cp.minSpeed));
-  Powerstep01_CmdSetParam(POWERSTEP01_FS_SPD,
-    initPrm->cm.cp.boostMode|
-    fs_spd_steps_s_to_reg_val(initPrm->cm.cp.fullStepSpeed));
-  Powerstep01_CmdSetParam(POWERSTEP01_OCD_TH,
-    stall_ocd_th_to_reg_val(initPrm->cm.cp.ocdThreshold));
-  Powerstep01_CmdSetParam(POWERSTEP01_STEP_MODE,
-    (uint8_t)initPrm->cm.cp.syncClockSelection|
-    (uint8_t)initPrm->cm.cp.cmVmSelection|
-    (uint8_t)(uint8_t)initPrm->cm.cp.stepMode);
-  Powerstep01_CmdSetParam(POWERSTEP01_ALARM_EN,
-    initPrm->cm.cp.alarmsSelection);
-  Powerstep01_CmdSetParam(POWERSTEP01_GATECFG1,
-    (uint16_t)initPrm->cm.cp.iGate|
-    (uint16_t)initPrm->cm.cp.tcc|
-    (uint16_t)initPrm->cm.cp.tBoost|
-    (uint16_t)initPrm->cm.cp.wdEn);
-  Powerstep01_CmdSetParam(POWERSTEP01_GATECFG2,
-    (uint16_t)initPrm->cm.cp.tBlank|
-    (uint16_t)initPrm->cm.cp.tdt);  
-  if (initPrm->cm.cp.cmVmSelection == POWERSTEP01_CM_VM_VOLTAGE)
-  {
-    //Voltage mode
-    Powerstep01_CmdSetParam(POWERSTEP01_INT_SPD,
-      int_spd_steps_s_to_reg_val(
-        initPrm->vm.intersectSpeed));
-    Powerstep01_CmdSetParam(POWERSTEP01_K_THERM,
-      k_therm_comp_to_reg_val(
-        initPrm->vm.thermalCompensationFactor)); 
-    Powerstep01_CmdSetParam(POWERSTEP01_STALL_TH,
-      stall_ocd_th_to_reg_val(
-        initPrm->vm.stallThreshold));
-    Powerstep01_CmdSetParam(POWERSTEP01_KVAL_HOLD,
-      k_val_perc_to_reg_val(
-        initPrm->vm.kvalHold));
-    Powerstep01_CmdSetParam(POWERSTEP01_KVAL_RUN,
-      k_val_perc_to_reg_val(
-        initPrm->vm.kvalRun));
-    Powerstep01_CmdSetParam(POWERSTEP01_KVAL_ACC,
-      k_val_perc_to_reg_val(
-        initPrm->vm.kvalAcc));
-    Powerstep01_CmdSetParam(POWERSTEP01_KVAL_DEC,
-      k_val_perc_to_reg_val(
-        initPrm->vm.kvalDec));
-    Powerstep01_CmdSetParam(POWERSTEP01_ST_SLP,
-      bemf_slope_perc_to_reg_val(
-        initPrm->vm.startSlope));
-    Powerstep01_CmdSetParam(POWERSTEP01_FN_SLP_ACC,
-      bemf_slope_perc_to_reg_val(
-        initPrm->vm.accelerationFinalSlope));
-    Powerstep01_CmdSetParam(POWERSTEP01_FN_SLP_DEC,
-      bemf_slope_perc_to_reg_val(
-        initPrm->vm.decelerationFinalSlope));
-    Powerstep01_CmdSetParam(POWERSTEP01_CONFIG,
-      (uint16_t)initPrm->vm.oscClkSel| 
-      (uint16_t)initPrm->vm.swMode | 
-      (uint16_t)initPrm->vm.enVsComp| 
-      (uint16_t)initPrm->vm.ocSd| 
-      (uint16_t)initPrm->vm.uvloVal| 
-      (uint16_t)initPrm->vm.vccVal| 
-      (uint16_t)initPrm->vm.fPwmInt| 
-      (uint16_t)initPrm->vm.fPwmDec);
-  }
-  else
-  {
-    // Current mode
-        Powerstep01_CmdSetParam(POWERSTEP01_TVAL_HOLD,
-          t_val_ref_voltage_to_reg_val(
-            initPrm->cm.tvalHold));
-        Powerstep01_CmdSetParam(POWERSTEP01_TVAL_RUN,
-          t_val_ref_voltage_to_reg_val(
-            initPrm->cm.tvalRun));
-        Powerstep01_CmdSetParam(POWERSTEP01_TVAL_ACC,
-          t_val_ref_voltage_to_reg_val(
-            initPrm->cm.tvalAcc));
-        Powerstep01_CmdSetParam(POWERSTEP01_TVAL_DEC,
-          t_val_ref_voltage_to_reg_val(
-            initPrm->cm.tvalDec));
-        Powerstep01_CmdSetParam(POWERSTEP01_T_FAST,
-          (uint8_t)initPrm->cm.toffFast|
-          (uint8_t)initPrm->cm.fastStep);
-        Powerstep01_CmdSetParam(POWERSTEP01_TON_MIN,
-          t_min_time_to_reg_val(
-            initPrm->cm.tonMin));
-        Powerstep01_CmdSetParam(POWERSTEP01_TOFF_MIN,
-          t_min_time_to_reg_val(
-            initPrm->cm.toffMin));       
-        Powerstep01_CmdSetParam(POWERSTEP01_CONFIG,
-          (uint16_t)initPrm->cm.oscClkSel| 
-          (uint16_t)initPrm->cm.swMode| 
-          (uint16_t)initPrm->cm.tqReg| 
-          (uint16_t)initPrm->cm.ocSd| 
-          (uint16_t)initPrm->cm.uvloVal| 
-          (uint16_t)initPrm->cm.vccVal|
-          (uint16_t)initPrm->cm.tsw|
-          (uint16_t)initPrm->cm.predEn);
-  }
-}
-
-/**********************************************************
- * @brief Sets the registers of the Powerstep01 to their predefined values 
- * from powerstep01_target_config.h
- * @retval None
- **********************************************************/
-void PowerStep01::Powerstep01_SetRegisterToPredefinedValues(void)
-{
-  powerstep01_CmVm_t cmVm;
-  
-  Powerstep01_CmdSetParam(
-    POWERSTEP01_ABS_POS,
-    0);
-  Powerstep01_CmdSetParam(
-    POWERSTEP01_EL_POS,
-    0);
-  Powerstep01_CmdSetParam(
-    POWERSTEP01_MARK,
-    0);
-  switch (deviceInstance)
-  {
-    case 0:
-      cmVm = POWERSTEP01_CONF_PARAM_CM_VM_DEVICE_0;
-      Powerstep01_CmdSetParam(POWERSTEP01_ACC,
-        acc_dec_steps_s2_to_reg_val(
-          POWERSTEP01_CONF_PARAM_ACC_DEVICE_0));
-      Powerstep01_CmdSetParam(POWERSTEP01_DEC,
-        acc_dec_steps_s2_to_reg_val(
-          POWERSTEP01_CONF_PARAM_DEC_DEVICE_0));
-      Powerstep01_CmdSetParam(POWERSTEP01_MAX_SPEED,
-        max_spd_steps_s_to_reg_val(
-          POWERSTEP01_CONF_PARAM_MAX_SPEED_DEVICE_0));
-      Powerstep01_CmdSetParam(POWERSTEP01_MIN_SPEED,
-        POWERSTEP01_CONF_PARAM_LSPD_BIT_DEVICE_0|
-        min_spd_steps_s_to_reg_val(
-          POWERSTEP01_CONF_PARAM_MIN_SPEED_DEVICE_0));
-      Powerstep01_CmdSetParam(POWERSTEP01_FS_SPD,
-        POWERSTEP01_CONF_PARAM_BOOST_MODE_DEVICE_0|
-        fs_spd_steps_s_to_reg_val(
-          POWERSTEP01_CONF_PARAM_FS_SPD_DEVICE_0)); 
-      Powerstep01_CmdSetParam(POWERSTEP01_OCD_TH,
-        (uint8_t)POWERSTEP01_CONF_PARAM_OCD_TH_DEVICE_0);
-      Powerstep01_CmdSetParam(POWERSTEP01_STEP_MODE,
-        (uint8_t)POWERSTEP01_CONF_PARAM_SYNC_MODE_DEVICE_0 |
-        (uint8_t)POWERSTEP01_CONF_PARAM_CM_VM_DEVICE_0|
-        (uint8_t)POWERSTEP01_CONF_PARAM_STEP_MODE_DEVICE_0);
-      Powerstep01_CmdSetParam(POWERSTEP01_ALARM_EN,
-        POWERSTEP01_CONF_PARAM_ALARM_EN_DEVICE_0);
-      Powerstep01_CmdSetParam(POWERSTEP01_GATECFG1,
-        (uint16_t)POWERSTEP01_CONF_PARAM_IGATE_DEVICE_0 | 
-        (uint16_t)POWERSTEP01_CONF_PARAM_TCC_DEVICE_0   | 
-        (uint16_t)POWERSTEP01_CONF_PARAM_TBOOST_DEVICE_0|
-        (uint16_t)POWERSTEP01_CONF_PARAM_WD_EN_DEVICE_0);
-      Powerstep01_CmdSetParam(POWERSTEP01_GATECFG2,
-        (uint16_t)POWERSTEP01_CONF_PARAM_TBLANK_DEVICE_0 | 
-        (uint16_t)POWERSTEP01_CONF_PARAM_TDT_DEVICE_0);
-      // Voltage mode
-      if (cmVm == POWERSTEP01_CM_VM_VOLTAGE)
-      {
-        Powerstep01_CmdSetParam(POWERSTEP01_INT_SPD,
-          int_spd_steps_s_to_reg_val(
-            POWERSTEP01_CONF_PARAM_INT_SPD_DEVICE_0));
-        Powerstep01_CmdSetParam(POWERSTEP01_K_THERM,
-          k_therm_comp_to_reg_val(
-            POWERSTEP01_CONF_PARAM_K_THERM_DEVICE_0));
-        Powerstep01_CmdSetParam(POWERSTEP01_STALL_TH,
-          stall_ocd_th_to_reg_val(
-            POWERSTEP01_CONF_PARAM_STALL_TH_DEVICE_0));
-        Powerstep01_CmdSetParam(POWERSTEP01_KVAL_HOLD,
-          k_val_perc_to_reg_val(
-            POWERSTEP01_CONF_PARAM_KVAL_HOLD_DEVICE_0));
-        Powerstep01_CmdSetParam(POWERSTEP01_KVAL_RUN,
-          k_val_perc_to_reg_val(
-            POWERSTEP01_CONF_PARAM_KVAL_RUN_DEVICE_0));
-        Powerstep01_CmdSetParam(POWERSTEP01_KVAL_ACC,
-          k_val_perc_to_reg_val(
-            POWERSTEP01_CONF_PARAM_KVAL_ACC_DEVICE_0));
-        Powerstep01_CmdSetParam(POWERSTEP01_KVAL_DEC,
-          k_val_perc_to_reg_val(
-            POWERSTEP01_CONF_PARAM_KVAL_DEC_DEVICE_0));
-        Powerstep01_CmdSetParam(POWERSTEP01_ST_SLP,
-          bemf_slope_perc_to_reg_val(
-            POWERSTEP01_CONF_PARAM_ST_SLP_DEVICE_0));
-        Powerstep01_CmdSetParam(POWERSTEP01_FN_SLP_ACC,
-          bemf_slope_perc_to_reg_val(
-            POWERSTEP01_CONF_PARAM_FN_SLP_ACC_DEVICE_0));  
-        Powerstep01_CmdSetParam(POWERSTEP01_FN_SLP_DEC,
-          bemf_slope_perc_to_reg_val(
-            POWERSTEP01_CONF_PARAM_FN_SLP_DEC_DEVICE_0));
-        Powerstep01_CmdSetParam(POWERSTEP01_CONFIG,
-          (uint16_t)POWERSTEP01_CONF_PARAM_CLOCK_SETTING_DEVICE_0 | 
-          (uint16_t)POWERSTEP01_CONF_PARAM_SW_MODE_DEVICE_0       | 
-          (uint16_t)POWERSTEP01_CONF_PARAM_VS_COMP_DEVICE_0       | 
-          (uint16_t)POWERSTEP01_CONF_PARAM_OC_SD_DEVICE_0         | 
-          (uint16_t)POWERSTEP01_CONF_PARAM_UVLOVAL_DEVICE_0       | 
-          (uint16_t)POWERSTEP01_CONF_PARAM_VCCVAL_DEVICE_0        | 
-          (uint16_t)POWERSTEP01_CONF_PARAM_PWM_DIV_DEVICE_0       | 
-          (uint16_t)POWERSTEP01_CONF_PARAM_PWM_MUL_DEVICE_0);
-      }
-      else
-      {
-        // Current mode
-        Powerstep01_CmdSetParam(POWERSTEP01_TVAL_HOLD,
-          t_val_ref_voltage_to_reg_val(
-            POWERSTEP01_CONF_PARAM_TVAL_HOLD_DEVICE_0));
-        Powerstep01_CmdSetParam(POWERSTEP01_TVAL_RUN,
-          t_val_ref_voltage_to_reg_val(
-            POWERSTEP01_CONF_PARAM_TVAL_RUN_DEVICE_0));
-        Powerstep01_CmdSetParam(POWERSTEP01_TVAL_ACC,
-          t_val_ref_voltage_to_reg_val(
-            POWERSTEP01_CONF_PARAM_TVAL_ACC_DEVICE_0));
-        Powerstep01_CmdSetParam(POWERSTEP01_TVAL_DEC,
-          t_val_ref_voltage_to_reg_val(
-            POWERSTEP01_CONF_PARAM_TVAL_DEC_DEVICE_0));
-        Powerstep01_CmdSetParam(POWERSTEP01_T_FAST,
-          (uint8_t)POWERSTEP01_CONF_PARAM_TOFF_FAST_DEVICE_0 |
-          (uint8_t)POWERSTEP01_CONF_PARAM_FAST_STEP_DEVICE_0);
-        Powerstep01_CmdSetParam(POWERSTEP01_TON_MIN,
-          t_min_time_to_reg_val(
-            POWERSTEP01_CONF_PARAM_TON_MIN_DEVICE_0));
-        Powerstep01_CmdSetParam(POWERSTEP01_TOFF_MIN,
-          t_min_time_to_reg_val(
-            POWERSTEP01_CONF_PARAM_TOFF_MIN_DEVICE_0));
-        Powerstep01_CmdSetParam(POWERSTEP01_CONFIG,
-          (uint16_t)POWERSTEP01_CONF_PARAM_CLOCK_SETTING_DEVICE_0 | 
-          (uint16_t)POWERSTEP01_CONF_PARAM_SW_MODE_DEVICE_0       | 
-          (uint16_t)POWERSTEP01_CONF_PARAM_TQ_REG_DEVICE_0        | 
-          (uint16_t)POWERSTEP01_CONF_PARAM_OC_SD_DEVICE_0         | 
-          (uint16_t)POWERSTEP01_CONF_PARAM_UVLOVAL_DEVICE_0       | 
-          (uint16_t)POWERSTEP01_CONF_PARAM_VCCVAL_DEVICE_0        | 
-          (uint16_t)POWERSTEP01_CONF_PARAM_TSW_DEVICE_0           |
-          (uint16_t)POWERSTEP01_CONF_PARAM_PRED_DEVICE_0);          
-      }
-      break;
-#if (MAX_NUMBER_OF_DEVICES > 1)
-   case 1:
-      cmVm = POWERSTEP01_CONF_PARAM_CM_VM_DEVICE_1;
-      Powerstep01_CmdSetParam(POWERSTEP01_ACC,
-        acc_dec_steps_s2_to_reg_val(
-          POWERSTEP01_CONF_PARAM_ACC_DEVICE_1));
-      Powerstep01_CmdSetParam(POWERSTEP01_DEC,
-        acc_dec_steps_s2_to_reg_val(
-          POWERSTEP01_CONF_PARAM_DEC_DEVICE_1));
-      Powerstep01_CmdSetParam(POWERSTEP01_MAX_SPEED,
-        max_spd_steps_s_to_reg_val(
-          POWERSTEP01_CONF_PARAM_MAX_SPEED_DEVICE_1));
-      Powerstep01_CmdSetParam(POWERSTEP01_MIN_SPEED,
-        POWERSTEP01_CONF_PARAM_LSPD_BIT_DEVICE_1|
-        min_spd_steps_s_to_reg_val(
-          POWERSTEP01_CONF_PARAM_MIN_SPEED_DEVICE_1));
-      Powerstep01_CmdSetParam(POWERSTEP01_FS_SPD,
-        POWERSTEP01_CONF_PARAM_BOOST_MODE_DEVICE_1|
-        fs_spd_steps_s_to_reg_val(
-          POWERSTEP01_CONF_PARAM_FS_SPD_DEVICE_1)); 
-      Powerstep01_CmdSetParam(POWERSTEP01_OCD_TH,
-        (uint8_t)POWERSTEP01_CONF_PARAM_OCD_TH_DEVICE_1);
-      Powerstep01_CmdSetParam(POWERSTEP01_STEP_MODE,
-        (uint8_t)POWERSTEP01_CONF_PARAM_SYNC_MODE_DEVICE_1 |
-        (uint8_t)POWERSTEP01_CONF_PARAM_CM_VM_DEVICE_1|
-        (uint8_t)POWERSTEP01_CONF_PARAM_STEP_MODE_DEVICE_1);
-      Powerstep01_CmdSetParam(POWERSTEP01_ALARM_EN,
-        POWERSTEP01_CONF_PARAM_ALARM_EN_DEVICE_1);
-      Powerstep01_CmdSetParam(POWERSTEP01_GATECFG1,
-        (uint16_t)POWERSTEP01_CONF_PARAM_IGATE_DEVICE_1 | 
-        (uint16_t)POWERSTEP01_CONF_PARAM_TCC_DEVICE_1   | 
-        (uint16_t)POWERSTEP01_CONF_PARAM_TBOOST_DEVICE_1|
-        (uint16_t)POWERSTEP01_CONF_PARAM_WD_EN_DEVICE_1);
-      Powerstep01_CmdSetParam(POWERSTEP01_GATECFG2,
-        (uint16_t)POWERSTEP01_CONF_PARAM_TBLANK_DEVICE_1 | 
-        (uint16_t)POWERSTEP01_CONF_PARAM_TDT_DEVICE_1);
-      // Voltage mode
-      if (cmVm == POWERSTEP01_CM_VM_VOLTAGE)
-      {
-        Powerstep01_CmdSetParam(POWERSTEP01_INT_SPD,
-          int_spd_steps_s_to_reg_val(
-            POWERSTEP01_CONF_PARAM_INT_SPD_DEVICE_1));
-        Powerstep01_CmdSetParam(POWERSTEP01_K_THERM,
-          k_therm_comp_to_reg_val(
-            POWERSTEP01_CONF_PARAM_K_THERM_DEVICE_1));
-        Powerstep01_CmdSetParam(POWERSTEP01_STALL_TH,
-          stall_ocd_th_to_reg_val(
-            POWERSTEP01_CONF_PARAM_STALL_TH_DEVICE_1));
-        Powerstep01_CmdSetParam(POWERSTEP01_KVAL_HOLD,
-          k_val_perc_to_reg_val(
-            POWERSTEP01_CONF_PARAM_KVAL_HOLD_DEVICE_1));
-        Powerstep01_CmdSetParam(POWERSTEP01_KVAL_RUN,
-          k_val_perc_to_reg_val(
-            POWERSTEP01_CONF_PARAM_KVAL_RUN_DEVICE_1));
-        Powerstep01_CmdSetParam(POWERSTEP01_KVAL_ACC,
-          k_val_perc_to_reg_val(
-            POWERSTEP01_CONF_PARAM_KVAL_ACC_DEVICE_1));
-        Powerstep01_CmdSetParam(POWERSTEP01_KVAL_DEC,
-          k_val_perc_to_reg_val(
-            POWERSTEP01_CONF_PARAM_KVAL_DEC_DEVICE_1));
-        Powerstep01_CmdSetParam(POWERSTEP01_ST_SLP,
-          bemf_slope_perc_to_reg_val(
-            POWERSTEP01_CONF_PARAM_ST_SLP_DEVICE_1));
-        Powerstep01_CmdSetParam(POWERSTEP01_FN_SLP_ACC,
-          bemf_slope_perc_to_reg_val(
-            POWERSTEP01_CONF_PARAM_FN_SLP_ACC_DEVICE_1));  
-        Powerstep01_CmdSetParam(POWERSTEP01_FN_SLP_DEC,
-          bemf_slope_perc_to_reg_val(
-            POWERSTEP01_CONF_PARAM_FN_SLP_DEC_DEVICE_1));
-        Powerstep01_CmdSetParam(POWERSTEP01_CONFIG,
-          (uint16_t)POWERSTEP01_CONF_PARAM_CLOCK_SETTING_DEVICE_1 | 
-          (uint16_t)POWERSTEP01_CONF_PARAM_SW_MODE_DEVICE_1       | 
-          (uint16_t)POWERSTEP01_CONF_PARAM_VS_COMP_DEVICE_1       | 
-          (uint16_t)POWERSTEP01_CONF_PARAM_OC_SD_DEVICE_1         | 
-          (uint16_t)POWERSTEP01_CONF_PARAM_UVLOVAL_DEVICE_1       | 
-          (uint16_t)POWERSTEP01_CONF_PARAM_VCCVAL_DEVICE_1        | 
-          (uint16_t)POWERSTEP01_CONF_PARAM_PWM_DIV_DEVICE_1       | 
-          (uint16_t)POWERSTEP01_CONF_PARAM_PWM_MUL_DEVICE_1);
-      }
-      else
-      {
-        // Current mode
-        Powerstep01_CmdSetParam(POWERSTEP01_TVAL_HOLD,
-          t_val_ref_voltage_to_reg_val(
-            POWERSTEP01_CONF_PARAM_TVAL_HOLD_DEVICE_1));
-        Powerstep01_CmdSetParam(POWERSTEP01_TVAL_RUN,
-          t_val_ref_voltage_to_reg_val(
-            POWERSTEP01_CONF_PARAM_TVAL_RUN_DEVICE_1));
-        Powerstep01_CmdSetParam(POWERSTEP01_TVAL_ACC,
-          t_val_ref_voltage_to_reg_val(
-            POWERSTEP01_CONF_PARAM_TVAL_ACC_DEVICE_1));
-        Powerstep01_CmdSetParam(POWERSTEP01_TVAL_DEC,
-          t_val_ref_voltage_to_reg_val(
-            POWERSTEP01_CONF_PARAM_TVAL_DEC_DEVICE_1));
-        Powerstep01_CmdSetParam(POWERSTEP01_T_FAST,
-          (uint8_t)POWERSTEP01_CONF_PARAM_TOFF_FAST_DEVICE_1 |
-          (uint8_t)POWERSTEP01_CONF_PARAM_FAST_STEP_DEVICE_1);
-        Powerstep01_CmdSetParam(POWERSTEP01_TON_MIN,
-          t_min_time_to_reg_val(
-            POWERSTEP01_CONF_PARAM_TON_MIN_DEVICE_1));
-        Powerstep01_CmdSetParam(POWERSTEP01_TOFF_MIN,
-          t_min_time_to_reg_val(
-            POWERSTEP01_CONF_PARAM_TOFF_MIN_DEVICE_1));
-        Powerstep01_CmdSetParam(POWERSTEP01_CONFIG,
-          (uint16_t)POWERSTEP01_CONF_PARAM_CLOCK_SETTING_DEVICE_1 | 
-          (uint16_t)POWERSTEP01_CONF_PARAM_SW_MODE_DEVICE_1       | 
-          (uint16_t)POWERSTEP01_CONF_PARAM_TQ_REG_DEVICE_1        | 
-          (uint16_t)POWERSTEP01_CONF_PARAM_OC_SD_DEVICE_1         | 
-          (uint16_t)POWERSTEP01_CONF_PARAM_UVLOVAL_DEVICE_1       | 
-          (uint16_t)POWERSTEP01_CONF_PARAM_VCCVAL_DEVICE_1        | 
-          (uint16_t)POWERSTEP01_CONF_PARAM_TSW_DEVICE_1           |
-          (uint16_t)POWERSTEP01_CONF_PARAM_PRED_DEVICE_1);          
-      }
-      break;     
-#endif
-#if (MAX_NUMBER_OF_DEVICES > 2)
-   case 2:
-      cmVm = POWERSTEP01_CONF_PARAM_CM_VM_DEVICE_2;
-      Powerstep01_CmdSetParam(POWERSTEP01_ACC,
-        acc_dec_steps_s2_to_reg_val(
-          POWERSTEP01_CONF_PARAM_ACC_DEVICE_2));
-      Powerstep01_CmdSetParam(POWERSTEP01_DEC,
-        acc_dec_steps_s2_to_reg_val(
-          POWERSTEP01_CONF_PARAM_DEC_DEVICE_2));
-      Powerstep01_CmdSetParam(POWERSTEP01_MAX_SPEED,
-        max_spd_steps_s_to_reg_val(
-          POWERSTEP01_CONF_PARAM_MAX_SPEED_DEVICE_2));
-      Powerstep01_CmdSetParam(POWERSTEP01_MIN_SPEED,
-        POWERSTEP01_CONF_PARAM_LSPD_BIT_DEVICE_2|
-        min_spd_steps_s_to_reg_val(
-          POWERSTEP01_CONF_PARAM_MIN_SPEED_DEVICE_2));
-      Powerstep01_CmdSetParam(POWERSTEP01_FS_SPD,
-        POWERSTEP01_CONF_PARAM_BOOST_MODE_DEVICE_2|
-        fs_spd_steps_s_to_reg_val(
-          POWERSTEP01_CONF_PARAM_FS_SPD_DEVICE_2)); 
-      Powerstep01_CmdSetParam(POWERSTEP01_OCD_TH,
-        (uint8_t)POWERSTEP01_CONF_PARAM_OCD_TH_DEVICE_2);
-      Powerstep01_CmdSetParam(POWERSTEP01_STEP_MODE,
-        (uint8_t)POWERSTEP01_CONF_PARAM_SYNC_MODE_DEVICE_2 |
-        (uint8_t)POWERSTEP01_CONF_PARAM_CM_VM_DEVICE_2|
-        (uint8_t)POWERSTEP01_CONF_PARAM_STEP_MODE_DEVICE_2);
-      Powerstep01_CmdSetParam(POWERSTEP01_ALARM_EN,
-        POWERSTEP01_CONF_PARAM_ALARM_EN_DEVICE_2);
-      Powerstep01_CmdSetParam(POWERSTEP01_GATECFG1,
-        (uint16_t)POWERSTEP01_CONF_PARAM_IGATE_DEVICE_2 | 
-        (uint16_t)POWERSTEP01_CONF_PARAM_TCC_DEVICE_2   | 
-        (uint16_t)POWERSTEP01_CONF_PARAM_TBOOST_DEVICE_2|
-        (uint16_t)POWERSTEP01_CONF_PARAM_WD_EN_DEVICE_2);
-      Powerstep01_CmdSetParam(POWERSTEP01_GATECFG2,
-        (uint16_t)POWERSTEP01_CONF_PARAM_TBLANK_DEVICE_2 | 
-        (uint16_t)POWERSTEP01_CONF_PARAM_TDT_DEVICE_2);
-      // Voltage mode
-      if (cmVm == POWERSTEP01_CM_VM_VOLTAGE)
-      {
-        Powerstep01_CmdSetParam(POWERSTEP01_INT_SPD,
-          int_spd_steps_s_to_reg_val(
-            POWERSTEP01_CONF_PARAM_INT_SPD_DEVICE_2));
-        Powerstep01_CmdSetParam(POWERSTEP01_K_THERM,
-          k_therm_comp_to_reg_val(
-            POWERSTEP01_CONF_PARAM_K_THERM_DEVICE_2));
-        Powerstep01_CmdSetParam(POWERSTEP01_STALL_TH,
-          stall_ocd_th_to_reg_val(
-            POWERSTEP01_CONF_PARAM_STALL_TH_DEVICE_2));
-        Powerstep01_CmdSetParam(POWERSTEP01_KVAL_HOLD,
-          k_val_perc_to_reg_val(
-            POWERSTEP01_CONF_PARAM_KVAL_HOLD_DEVICE_2));
-        Powerstep01_CmdSetParam(POWERSTEP01_KVAL_RUN,
-          k_val_perc_to_reg_val(
-            POWERSTEP01_CONF_PARAM_KVAL_RUN_DEVICE_2));
-        Powerstep01_CmdSetParam(POWERSTEP01_KVAL_ACC,
-          k_val_perc_to_reg_val(
-            POWERSTEP01_CONF_PARAM_KVAL_ACC_DEVICE_2));
-        Powerstep01_CmdSetParam(POWERSTEP01_KVAL_DEC,
-          k_val_perc_to_reg_val(
-            POWERSTEP01_CONF_PARAM_KVAL_DEC_DEVICE_2));
-        Powerstep01_CmdSetParam(POWERSTEP01_ST_SLP,
-          bemf_slope_perc_to_reg_val(
-            POWERSTEP01_CONF_PARAM_ST_SLP_DEVICE_2));
-        Powerstep01_CmdSetParam(POWERSTEP01_FN_SLP_ACC,
-          bemf_slope_perc_to_reg_val(
-            POWERSTEP01_CONF_PARAM_FN_SLP_ACC_DEVICE_2));  
-        Powerstep01_CmdSetParam(POWERSTEP01_FN_SLP_DEC,
-          bemf_slope_perc_to_reg_val(
-            POWERSTEP01_CONF_PARAM_FN_SLP_DEC_DEVICE_2));
-        Powerstep01_CmdSetParam(POWERSTEP01_CONFIG,
-          (uint16_t)POWERSTEP01_CONF_PARAM_CLOCK_SETTING_DEVICE_2 | 
-          (uint16_t)POWERSTEP01_CONF_PARAM_SW_MODE_DEVICE_2       | 
-          (uint16_t)POWERSTEP01_CONF_PARAM_VS_COMP_DEVICE_2       | 
-          (uint16_t)POWERSTEP01_CONF_PARAM_OC_SD_DEVICE_2         | 
-          (uint16_t)POWERSTEP01_CONF_PARAM_UVLOVAL_DEVICE_2       | 
-          (uint16_t)POWERSTEP01_CONF_PARAM_VCCVAL_DEVICE_2        | 
-          (uint16_t)POWERSTEP01_CONF_PARAM_PWM_DIV_DEVICE_2       | 
-          (uint16_t)POWERSTEP01_CONF_PARAM_PWM_MUL_DEVICE_2);
-      }
-      else
-      {
-        // Current mode
-        Powerstep01_CmdSetParam(POWERSTEP01_TVAL_HOLD,
-          t_val_ref_voltage_to_reg_val(
-            POWERSTEP01_CONF_PARAM_TVAL_HOLD_DEVICE_2));
-        Powerstep01_CmdSetParam(POWERSTEP01_TVAL_RUN,
-          t_val_ref_voltage_to_reg_val(
-            POWERSTEP01_CONF_PARAM_TVAL_RUN_DEVICE_2));
-        Powerstep01_CmdSetParam(POWERSTEP01_TVAL_ACC,
-          t_val_ref_voltage_to_reg_val(
-            POWERSTEP01_CONF_PARAM_TVAL_ACC_DEVICE_2));
-        Powerstep01_CmdSetParam(POWERSTEP01_TVAL_DEC,
-          t_val_ref_voltage_to_reg_val(
-            POWERSTEP01_CONF_PARAM_TVAL_DEC_DEVICE_2));
-        Powerstep01_CmdSetParam(POWERSTEP01_T_FAST,
-          (uint8_t)POWERSTEP01_CONF_PARAM_TOFF_FAST_DEVICE_2 |
-          (uint8_t)POWERSTEP01_CONF_PARAM_FAST_STEP_DEVICE_2);
-        Powerstep01_CmdSetParam(POWERSTEP01_TON_MIN,
-          t_min_time_to_reg_val(
-            POWERSTEP01_CONF_PARAM_TON_MIN_DEVICE_2));
-        Powerstep01_CmdSetParam(POWERSTEP01_TOFF_MIN,
-          t_min_time_to_reg_val(
-            POWERSTEP01_CONF_PARAM_TOFF_MIN_DEVICE_2));
-        Powerstep01_CmdSetParam(POWERSTEP01_CONFIG,
-          (uint16_t)POWERSTEP01_CONF_PARAM_CLOCK_SETTING_DEVICE_2 | 
-          (uint16_t)POWERSTEP01_CONF_PARAM_SW_MODE_DEVICE_2       | 
-          (uint16_t)POWERSTEP01_CONF_PARAM_TQ_REG_DEVICE_2        | 
-          (uint16_t)POWERSTEP01_CONF_PARAM_OC_SD_DEVICE_2         | 
-          (uint16_t)POWERSTEP01_CONF_PARAM_UVLOVAL_DEVICE_2       | 
-          (uint16_t)POWERSTEP01_CONF_PARAM_VCCVAL_DEVICE_2        | 
-          (uint16_t)POWERSTEP01_CONF_PARAM_TSW_DEVICE_2           |
-          (uint16_t)POWERSTEP01_CONF_PARAM_PRED_DEVICE_2);          
-      }
-      break;
-#endif
-    default: ;
-  }
-}
-
-/**
-  * @brief Functions to get and set parameters using digital or analog values
-  */
-
-/**********************************************************
- * @brief  Issues the GetParam command to the Powerstep01 device
- * @param[in] parameter Register adress (POWERSTEP01_ABS_POS,
- * POWERSTEP01_MARK,...)
- * @retval Register value
- **********************************************************/
-uint32_t PowerStep01::Powerstep01_CmdGetParam(powerstep01_Registers_t param)
-{
-
-  uint32_t spiRxData;
-  uint32_t loop;
-  uint8_t maxArgumentNbBytes = 0;
-  uint8_t spiIndex = numberOfDevices - deviceInstance - 1;
-  bool itDisable = FALSE;
-  
-  do
-  {
-    spiPreemptionByIsr = FALSE;
-    if (itDisable)
-    {
-      /* re-enable Powerstep01_Board_EnableIrq if disable in previous iteration */
-      Powerstep01_Board_EnableIrq();
-      itDisable = FALSE;
-    }
-    for (loop = 0; loop < numberOfDevices; loop++)
-    {
-      spiTxBursts[0][loop] = POWERSTEP01_NOP;
-      spiTxBursts[1][loop] = POWERSTEP01_NOP;
-      spiTxBursts[2][loop] = POWERSTEP01_NOP;
-      spiTxBursts[3][loop] = POWERSTEP01_NOP;
-      spiRxBursts[0][loop] = 0;
-      spiRxBursts[1][loop] = 0;
-      spiRxBursts[2][loop] = 0;
-      spiRxBursts[3][loop] = 0;    
-    }
-    switch (param)
-    {
-      case POWERSTEP01_ABS_POS: 
-      case POWERSTEP01_MARK:
-      case POWERSTEP01_SPEED:
-        spiTxBursts[0][spiIndex] = ((uint8_t)POWERSTEP01_GET_PARAM )| (param);
-        maxArgumentNbBytes = 3;
-        break;
-      case POWERSTEP01_EL_POS:
-      case POWERSTEP01_ACC:
-      case POWERSTEP01_DEC:
-      case POWERSTEP01_MAX_SPEED:
-      case POWERSTEP01_MIN_SPEED:
-      case POWERSTEP01_FS_SPD:
-      case POWERSTEP01_INT_SPD:
-      case POWERSTEP01_CONFIG:
-      case POWERSTEP01_GATECFG1:
-      case POWERSTEP01_STATUS:
-        spiTxBursts[1][spiIndex] = ((uint8_t)POWERSTEP01_GET_PARAM )| (param);
-        maxArgumentNbBytes = 2;
-        break;
-    default:
-        spiTxBursts[2][spiIndex] = ((uint8_t)POWERSTEP01_GET_PARAM )| (param);
-        maxArgumentNbBytes = 1;
-    }
-    /* Disable interruption before checking */
-    /* pre-emption by ISR and SPI transfers*/
-    Powerstep01_Board_DisableIrq();
-    itDisable = TRUE;
-  } while (spiPreemptionByIsr); // check pre-emption by ISR
-  for (loop = POWERSTEP01_CMD_ARG_MAX_NB_BYTES-1-maxArgumentNbBytes;
-       loop < POWERSTEP01_CMD_ARG_MAX_NB_BYTES;
-       loop++)
-  {
-     Powerstep01_WriteBytes(&spiTxBursts[loop][0],
-                           &spiRxBursts[loop][0]);
-  }
-  spiRxData = ((uint32_t)spiRxBursts[1][spiIndex] << 16)|
-               (spiRxBursts[2][spiIndex] << 8) |
-               (spiRxBursts[3][spiIndex]);    
-  /* re-enable Powerstep01_Board_EnableIrq after SPI transfers*/
-  Powerstep01_Board_EnableIrq();
-  return (spiRxData);
-}
-
-/**********************************************************
- * @brief  Issues the SetParam command to the PowerStep01 device
- * @param[in] parameter Register adress (POWERSTEP01_ABS_POS,
- * POWERSTEP01_MARK,...)
- * @param[in] value Value to set in the register
- * @retval None
- **********************************************************/
-void PowerStep01::Powerstep01_CmdSetParam(powerstep01_Registers_t param,
-  uint32_t value)
-{
-  uint32_t loop;
-  uint8_t maxArgumentNbBytes = 0;
-  uint8_t spiIndex = numberOfDevices - deviceInstance - 1;
-  bool itDisable = FALSE;
-  
-  do
-  {
-    spiPreemptionByIsr = FALSE;
-    if (itDisable)
-    {
-      /* re-enable Powerstep01_Board_EnableIrq if disable in previous iteration */
-      Powerstep01_Board_EnableIrq();
-      itDisable = FALSE;
-    }  
-    for (loop = 0;loop < numberOfDevices; loop++)
-    {
-      spiTxBursts[0][loop] = POWERSTEP01_NOP;
-      spiTxBursts[1][loop] = POWERSTEP01_NOP;
-      spiTxBursts[2][loop] = POWERSTEP01_NOP;
-      spiTxBursts[3][loop] = POWERSTEP01_NOP;
-    }
-    switch (param)
-    {
-      case POWERSTEP01_ABS_POS: ;
-      case POWERSTEP01_MARK:
-        spiTxBursts[0][spiIndex] = ((uint8_t)POWERSTEP01_SET_PARAM )| (param);
-        spiTxBursts[1][spiIndex] = (uint8_t)(value >> 16);
-        spiTxBursts[2][spiIndex] = (uint8_t)(value >> 8);
-        maxArgumentNbBytes = 3;
-        break;
-      case POWERSTEP01_EL_POS:
-      case POWERSTEP01_ACC:
-      case POWERSTEP01_DEC:
-      case POWERSTEP01_MAX_SPEED:
-      case POWERSTEP01_MIN_SPEED:
-      case POWERSTEP01_FS_SPD:
-      case POWERSTEP01_INT_SPD:
-      case POWERSTEP01_CONFIG:
-      case POWERSTEP01_GATECFG1:
-        spiTxBursts[1][spiIndex] = ((uint8_t)POWERSTEP01_SET_PARAM )| (param);
-        spiTxBursts[2][spiIndex] = (uint8_t)(value >> 8);
-        maxArgumentNbBytes = 2;
-        break;
-      default:
-        spiTxBursts[2][spiIndex] = ((uint8_t)POWERSTEP01_SET_PARAM )| (param);
-        maxArgumentNbBytes = 1;
-    }
-    spiTxBursts[3][spiIndex] = (uint8_t)(value);
-    /* Disable interruption before checking */
-    /* pre-emption by ISR and SPI transfers*/
-    Powerstep01_Board_DisableIrq();
-    itDisable = TRUE;
-  } while (spiPreemptionByIsr); // check pre-emption by ISR  
-  /* SPI transfer */
-  for (loop = POWERSTEP01_CMD_ARG_MAX_NB_BYTES - 1 - maxArgumentNbBytes;
-       loop < POWERSTEP01_CMD_ARG_MAX_NB_BYTES;
-       loop++)
-  {
-    Powerstep01_WriteBytes(&spiTxBursts[loop][0],&spiRxBursts[loop][0]);
-  }
-  /* re-enable Powerstep01_Board_EnableIrq after SPI transfers*/
-  Powerstep01_Board_EnableIrq();
-}
-
-/**********************************************************
- * @brief Issues PowerStep01 Get Parameter command and convert the result to
- * float value
- * @param[in] param PowerStep01 register address
- * @retval The parameter's float value.
- *********************************************************/
-float PowerStep01::Powerstep01_GetAnalogValue(powerstep01_Registers_t param)
-{
-  bool voltageMode = ((POWERSTEP01_CM_VM_CURRENT&Powerstep01_CmdGetParam(POWERSTEP01_STEP_MODE))==0);
-  uint32_t registerValue = Powerstep01_CmdGetParam((powerstep01_Registers_t) param);
-  float value;
-  switch (param)
-  {
-    case POWERSTEP01_ABS_POS:
-    case POWERSTEP01_MARK:
-      value = (float) Powerstep01_ConvertPosition(registerValue);
-      break;
-    case POWERSTEP01_ACC:
-    case POWERSTEP01_DEC:
-      value = acc_dec_reg_val_to_steps_s2(registerValue);
-      break;
-    case POWERSTEP01_SPEED:
-      value = speed_reg_val_to_steps_s(registerValue);
-      break;
-    case POWERSTEP01_MAX_SPEED:
-      value = max_spd_reg_val_to_steps_s(registerValue);
-      break;
-    case POWERSTEP01_MIN_SPEED:
-      registerValue &= POWERSTEP01_MIN_SPEED_MASK;
-      value = min_spd_reg_val_to_steps_s(registerValue);
-      break;      
-    case POWERSTEP01_FS_SPD:
-      registerValue &= POWERSTEP01_FS_SPD_MASK;
-      value = fs_spd_reg_val_to_steps_s(registerValue);
-      break;
-    case POWERSTEP01_INT_SPD:
-      value = int_spd_reg_val_to_steps_s(registerValue);
-      break;
-    case POWERSTEP01_K_THERM:
-      value = k_therm_reg_val_to_comp(registerValue);
-      break;
-    case POWERSTEP01_OCD_TH:
-    case POWERSTEP01_STALL_TH:
-      value = stall_ocd_reg_val_to_th(registerValue);
-      break;
-    case POWERSTEP01_KVAL_HOLD:  //POWERSTEP01_TVAL_HOLD
-    case POWERSTEP01_KVAL_RUN:   //POWERSTEP01_TVAL_RUN
-    case POWERSTEP01_KVAL_ACC:   //POWERSTEP01_TVAL_ACC
-    case POWERSTEP01_KVAL_DEC:   //POWERSTEP01_TVAL_DEC
-      if (voltageMode!=FALSE)  value = k_val_reg_val_to_perc(registerValue);
-      else value = k_val_reg_val_to_perc(registerValue);     
-      break;
-    case POWERSTEP01_ST_SLP:
-      if (voltageMode==FALSE) 
-      {
-        break;
-      }      
-    case POWERSTEP01_FN_SLP_ACC: //POWERSTEP01_TON_MIN
-    case POWERSTEP01_FN_SLP_DEC: //POWERSTEP01_TOFF_MIN
-      if (voltageMode!=FALSE) value = bemf_slope_reg_val_to_perc(registerValue);
-      else value = t_min_reg_val_to_time(registerValue);
-      break;
-    default:
-      value = (float) registerValue;
-  }
-  return value;
-}
-
-/******************************************************//**
- * @brief Put commands in queue before synchronous sending
- * done by calling Powerstep01_SendQueuedCommands.
- * Any call to functions that use the SPI between the calls of 
- * Powerstep01_QueueCommands and Powerstep01_SendQueuedCommands 
- * will corrupt the queue.
- * A command for each device of the daisy chain must be 
- * specified before calling Powerstep01_SendQueuedCommands.
- * @param[in] command Command to queue (all Powerstep01 commmands 
- * except POWERSTEP01_SET_PARAM, POWERSTEP01_GET_PARAM, 
- * POWERSTEP01_GET_STATUS)
- * @param[in] value argument of the command to queue
- * @retval None
- *********************************************************/
-void PowerStep01::Powerstep01_QueueCommands(uint8_t command, int32_t value)
-{
-  if (numberOfDevices > deviceInstance)
-  {
-    uint8_t spiIndex = numberOfDevices - deviceInstance - 1;
-    
-    switch (command & DAISY_CHAIN_COMMAND_MASK)
-    {
-      case POWERSTEP01_RUN: ;
-      case POWERSTEP01_MOVE: ;
-      case POWERSTEP01_GO_TO: ;
-      case POWERSTEP01_GO_TO_DIR: ;
-      case POWERSTEP01_GO_UNTIL: ;
-      case POWERSTEP01_GO_UNTIL_ACT_CPY:
-       spiTxBursts[0][spiIndex] = command;
-       spiTxBursts[1][spiIndex] = (uint8_t)(value >> 16);
-       spiTxBursts[2][spiIndex] = (uint8_t)(value >> 8);
-       spiTxBursts[3][spiIndex] = (uint8_t)(value);
-       break;
-      default:
-       spiTxBursts[0][spiIndex] = POWERSTEP01_NOP;
-       spiTxBursts[1][spiIndex] = POWERSTEP01_NOP;
-       spiTxBursts[2][spiIndex] = POWERSTEP01_NOP;
-       spiTxBursts[3][spiIndex] = command;
-    }
-  }
-}
-
-/**********************************************************
- * @brief  Sends a command to the device via the SPI
- * @param[in] command Command to send (all Powerstep01 commmands 
- * except POWERSTEP01_SET_PARAM, POWERSTEP01_GET_PARAM, 
- * POWERSTEP01_GET_STATUS)
- * @param[in] value arguments to send on 32 bits
- * @retval None
- **********************************************************/
-void PowerStep01::Powerstep01_SendCommand(uint8_t command, uint32_t value)
-{
-  uint32_t loop;
-  uint8_t maxArgumentNbBytes = 0;
-  bool itDisable = FALSE;
-  uint8_t spiIndex = numberOfDevices - deviceInstance - 1;
-  
-  do
-  {
-    spiPreemptionByIsr = FALSE;
-    if (itDisable)
-    {
-      /* re-enable Powerstep01_Board_EnableIrq if disable in previous iteration */
-      Powerstep01_Board_EnableIrq();
-      itDisable = FALSE;
-    }    
-    for (loop = 0; loop < numberOfDevices; loop++)
-    {
-        spiTxBursts[0][loop] = POWERSTEP01_NOP;
-        spiTxBursts[1][loop] = POWERSTEP01_NOP;
-        spiTxBursts[2][loop] = POWERSTEP01_NOP;
-        spiTxBursts[3][loop] = POWERSTEP01_NOP;   
-    }
-    switch (command & DAISY_CHAIN_COMMAND_MASK)
-    {
-      case POWERSTEP01_GO_TO:
-      case POWERSTEP01_GO_TO_DIR:
-        value = value & POWERSTEP01_ABS_POS_VALUE_MASK;
-      case POWERSTEP01_RUN:
-      case POWERSTEP01_MOVE:
-      case POWERSTEP01_GO_UNTIL:
-      case POWERSTEP01_GO_UNTIL_ACT_CPY:
-        spiTxBursts[0][spiIndex] = command;
-        spiTxBursts[1][spiIndex] = (uint8_t)(value >> 16);
-        spiTxBursts[2][spiIndex] = (uint8_t)(value >> 8);
-        spiTxBursts[3][spiIndex] = (uint8_t)(value);
-        maxArgumentNbBytes = 3;
-        break;
-    default:
-        spiTxBursts[0][spiIndex] = POWERSTEP01_NOP;
-        spiTxBursts[1][spiIndex] = POWERSTEP01_NOP;
-        spiTxBursts[2][spiIndex] = POWERSTEP01_NOP;
-        spiTxBursts[3][spiIndex] = command;
-    }
-    /* Disable interruption before checking */
-    /* pre-emption by ISR and SPI transfers*/
-    Powerstep01_Board_DisableIrq();
-    itDisable = TRUE;
-  } while (spiPreemptionByIsr); // check pre-emption by ISR
-  for (loop = POWERSTEP01_CMD_ARG_MAX_NB_BYTES - 1 - maxArgumentNbBytes; 
-       loop < POWERSTEP01_CMD_ARG_MAX_NB_BYTES; 
-       loop++)
-  {
-     Powerstep01_WriteBytes(&spiTxBursts[loop][0], &spiRxBursts[loop][0]);
-  }
-  /* re-enable Powerstep01_Board_EnableIrq after SPI transfers*/
-  Powerstep01_Board_EnableIrq();
-}
-
-/******************************************************//**
- * @brief Sends commands stored previously in the queue by 
- * Powerstep01_QueueCommands
- * @retval None
- *********************************************************/
-void PowerStep01::Powerstep01_SendQueuedCommands(void)
-{
-  uint8_t loop;
-  
-  for (loop = 0; 
-       loop < POWERSTEP01_CMD_ARG_MAX_NB_BYTES; 
-       loop++)
-  {
-     Powerstep01_WriteBytes(&spiTxBursts[loop][0], &spiRxBursts[loop][0]);
-  }
-}
-
-/**********************************************************
- * @brief Issues the SetParam command to the PowerStep01
- * @param[in] param PowerStep01 Register address
- * @param[in] value Float value to convert and set into the register
- * @retval TRUE if param is valid, FALSE otherwise
- *********************************************************/
-bool PowerStep01::Powerstep01_SetAnalogValue(powerstep01_Registers_t param, float value)
-{
-  uint32_t registerValue;
-  bool result = TRUE;
-  bool voltageMode = ((POWERSTEP01_CM_VM_CURRENT&Powerstep01_CmdGetParam(POWERSTEP01_STEP_MODE))==0);
-  if ((value < 0)&&((param != POWERSTEP01_ABS_POS)&&(param != POWERSTEP01_MARK)))
-  {
-    result = FALSE;
-  }
-  switch (param)
-  {
-    case POWERSTEP01_EL_POS:
-      if ((value > (POWERSTEP01_ELPOS_STEP_MASK|POWERSTEP01_ELPOS_MICROSTEP_MASK))||
-          ((value!=0)&&(value < (1<<(7-(POWERSTEP01_STEP_MODE_STEP_SEL&Powerstep01_CmdGetParam(POWERSTEP01_STEP_MODE))))))) result = FALSE;
-      else registerValue = ((uint32_t) value)&(POWERSTEP01_ELPOS_STEP_MASK|POWERSTEP01_ELPOS_MICROSTEP_MASK);
-      break;        
-    case POWERSTEP01_ABS_POS:
-    case POWERSTEP01_MARK:
-      if (value < 0)
-      {
-        value=-value;
-        if (((uint32_t)value)<=(POWERSTEP01_MAX_POSITION+1))
-          registerValue = (POWERSTEP01_ABS_POS_VALUE_MASK+1-(uint32_t)value)&POWERSTEP01_ABS_POS_VALUE_MASK;
-        else result = FALSE;  
-      }
-      else
-      {
-        if (((uint32_t)value)<=POWERSTEP01_MAX_POSITION)
-          registerValue = ((uint32_t) value)&POWERSTEP01_ABS_POS_VALUE_MASK;
-        else result = FALSE; 
-      }
-      break;
-    case POWERSTEP01_ACC:
-    case POWERSTEP01_DEC:
-      if (value > POWERSTEP01_ACC_DEC_MAX_VALUE) result = FALSE;
-      else registerValue = acc_dec_steps_s2_to_reg_val(value);
-      break;
-    case POWERSTEP01_MAX_SPEED:
-      if (value > POWERSTEP01_MAX_SPEED_MAX_VALUE) result = FALSE;
-      else registerValue = max_spd_steps_s_to_reg_val(value);
-      break;
-    case POWERSTEP01_MIN_SPEED:
-      if (value > POWERSTEP01_MIN_SPEED_MAX_VALUE) result = FALSE;
-      else registerValue = (POWERSTEP01_LSPD_OPT&Powerstep01_CmdGetParam(param))|min_spd_steps_s_to_reg_val(value);
-      break;      
-    case POWERSTEP01_FS_SPD:
-      if (value > POWERSTEP01_FS_SPD_MAX_VALUE) result = FALSE;
-      else registerValue = (POWERSTEP01_BOOST_MODE&Powerstep01_CmdGetParam(param))|fs_spd_steps_s_to_reg_val(value);
-      break;
-    case POWERSTEP01_INT_SPD:
-      if (value > POWERSTEP01_INT_SPD_MAX_VALUE) result = FALSE;
-      else registerValue = int_spd_steps_s_to_reg_val(value);
-      break;
-    case POWERSTEP01_K_THERM:
-      if ((value < POWERSTEP01_K_THERM_MIN_VALUE)||
-          (value > POWERSTEP01_K_THERM_MAX_VALUE)) result = FALSE;
-      else registerValue = k_therm_comp_to_reg_val(value);
-      break;
-    case POWERSTEP01_OCD_TH:
-    case POWERSTEP01_STALL_TH:
-      if (value > POWERSTEP01_STALL_OCD_TH_MAX_VALUE) result = FALSE;
-      else registerValue = stall_ocd_th_to_reg_val(value);
-      break;
-    case POWERSTEP01_KVAL_HOLD:  //POWERSTEP01_TVAL_HOLD
-    case POWERSTEP01_KVAL_RUN:   //POWERSTEP01_TVAL_RUN
-    case POWERSTEP01_KVAL_ACC:   //POWERSTEP01_TVAL_ACC
-    case POWERSTEP01_KVAL_DEC:   //POWERSTEP01_TVAL_DEC
-      if (voltageMode==FALSE)
-      {
-        if (value > POWERSTEP01_TVAL_MAX_VALUE) result = FALSE;
-        else registerValue = t_val_ref_voltage_to_reg_val(value);
-      }
-      else
-      {
-        if (value > POWERSTEP01_KVAL_MAX_VALUE) result = FALSE;
-        else registerValue = k_val_perc_to_reg_val(value);
-      }
-      break;
-    case POWERSTEP01_ST_SLP:
-      if (voltageMode==FALSE) 
-      {
-        result = FALSE;
-        break;
-      }
-    case POWERSTEP01_FN_SLP_ACC: //POWERSTEP01_TON_MIN
-    case POWERSTEP01_FN_SLP_DEC: //POWERSTEP01_TOFF_MIN
-      if (voltageMode==FALSE)
-      {
-        if (value>POWERSTEP01_TOFF_TON_MIN_MAX_VALUE) result = FALSE;
-        else registerValue = t_min_time_to_reg_val(value);
-      }
-      else
-      {
-        if (value > POWERSTEP01_SLP_MAX_VALUE) result = FALSE;
-        else registerValue = bemf_slope_perc_to_reg_val(value);
-      }
-      break;
-    default:
-      result = FALSE;
-  }
-  if (result!=FALSE)
-  {
-    Powerstep01_CmdSetParam(param, registerValue);
-  }
-  return result;
-}
-
-/**********************************************************
- * @brief Write and receive a byte via SPI
- * @param[in] pByteToTransmit pointer to the byte to transmit
- * @param[in] pReceivedByte pointer to the received byte
- * @retval None
- *********************************************************/
-void PowerStep01::Powerstep01_WriteBytes(uint8_t *pByteToTransmit, uint8_t *pReceivedByte)
-{
-  if (Powerstep01_Board_SpiWriteBytes(pByteToTransmit, pReceivedByte) != 0)
-  {
-    Powerstep01_ErrorHandler(POWERSTEP01_ERROR_1);
-  }
-  if (isrFlag)
-  {
-    spiPreemptionByIsr = TRUE;
-  }
-}
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
--- a/Components/powerstep01/PowerStep01_config.h	Fri Mar 24 10:58:48 2017 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,703 +0,0 @@
-/**
- ******************************************************************************
- * @file    PowerStep01_config.h
- * @author  IPC Rennes
- * @version V1.2.0
- * @date    March 18th, 2016
- * @brief   Predefines values for the Powerstep01 registers
- * and for the devices parameters
- * @note    (C) COPYRIGHT 2016 STMicroelectronics
- ******************************************************************************
- * @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 __POWERSTEP01_CONFIG_H
-#define __POWERSTEP01_CONFIG_H
-
-#ifdef __cplusplus
- extern "C" {
-#endif 
-
-/* Definitions ---------------------------------------------------------------*/
-
-/** @addtogroup PowerStep01
-  * @{
-  */
-
-/** @addtogroup Powerstep01_Exported_Defines
-  * @{
-  */
-
-/** @defgroup Predefined_Powerstep01_Registers_Values Predefined Powerstep01 Registers Values
-  * @{
-  */
-
-/// The maximum number of devices in the daisy chain
-#define MAX_NUMBER_OF_DEVICES                 (3)
-
-/****************************************************************************/
-/* Device 0                                                                 */
-/****************************************************************************/
-  
-/**************************** Speed Profile *********************************/
-/// Register : ACC
-/// Acceleration rate in step/s2, range 14.55 to 59590 steps/s^2 
-#define POWERSTEP01_CONF_PARAM_ACC_DEVICE_0 (582)
-
-/// Register : DEC
-/// Deceleration rate in step/s2, range 14.55 to 59590 steps/s^2
-#define POWERSTEP01_CONF_PARAM_DEC_DEVICE_0 (582)
-
-///Register : MAX_SPEED
-/// Maximum speed in step/s, range 15.25 to 15610 steps/s
-#define POWERSTEP01_CONF_PARAM_MAX_SPEED_DEVICE_0 (488)
-
-/// Register : MIN_SPEED 
-/// Minimum speed in step/s, range 0 to 976.3 steps/s
-#define POWERSTEP01_CONF_PARAM_MIN_SPEED_DEVICE_0 (0)
-
-/// Register : FS_SPD 
-/// Full step speed in step/s, range 7.63 to 15625 steps/s
-#define POWERSTEP01_CONF_PARAM_FS_SPD_DEVICE_0 (244.16)
-
-/// Register : FS_SPD - field : BOOST_MODE 
-/// Boost of the amplitude square wave, enum powerstep01_BoostMode_t
-#define POWERSTEP01_CONF_PARAM_BOOST_MODE_DEVICE_0 (POWERSTEP01_BOOST_MODE_OFF)
-
-
-/************************ Voltage mode parameters  **************************/
-/// Register : KVAL_ACC 
-/// Acceleration duty cycle (torque) in %, range 0 to 99.6%
-#define POWERSTEP01_CONF_PARAM_KVAL_ACC_DEVICE_0 (16.02)
-
-/// Register : KVAL_DEC 
-/// Deceleration duty cycle (torque) in %, range 0 to 99.6%
-#define POWERSTEP01_CONF_PARAM_KVAL_DEC_DEVICE_0 (16.02)
-
-/// Register : KVAL_RUN 
-/// run duty cycle (torque) in %, range 0 to 99.6%
-#define POWERSTEP01_CONF_PARAM_KVAL_RUN_DEVICE_0 (16.02)
-
-/// Register : KVAL_HOLD 
-/// Hold duty cycle (torque) in %, range 0 to 99.6%
-#define POWERSTEP01_CONF_PARAM_KVAL_HOLD_DEVICE_0 (16.02)
-
-/// Register : CONFIG - field : EN_VSCOMP 
-/// Motor Supply Voltage Compensation enabling , enum powerstep01_ConfigEnVscomp_t
-#define POWERSTEP01_CONF_PARAM_VS_COMP_DEVICE_0 (POWERSTEP01_CONFIG_VS_COMP_DISABLE)
-
-/// Register : MIN_SPEED - field : LSPD_OPT 
-/// Low speed optimization bit, enum powerstep01_LspdOpt_t
-#define POWERSTEP01_CONF_PARAM_LSPD_BIT_DEVICE_0 (POWERSTEP01_LSPD_OPT_OFF)
-
-/// Register : K_THERM 
-/// Thermal compensation param, range 1 to 1.46875
-#define POWERSTEP01_CONF_PARAM_K_THERM_DEVICE_0 (1)
-
-/// Register : INT_SPEED 
-/// Intersect speed settings for BEMF compensation in steps/s, range 0 to 3906 steps/s
-#define POWERSTEP01_CONF_PARAM_INT_SPD_DEVICE_0 (61.512)
-
-/// Register : ST_SLP 
-/// BEMF start slope settings for BEMF compensation in % step/s, range 0 to 0.4% s/step
-#define POWERSTEP01_CONF_PARAM_ST_SLP_DEVICE_0 (0.03815)
-
-/// Register : FN_SLP_ACC 
-/// BEMF final acc slope settings for BEMF compensation in % step/s, range 0 to 0.4% s/step
-#define POWERSTEP01_CONF_PARAM_FN_SLP_ACC_DEVICE_0 (0.06256)
-
-/// Register : FN_SLP_DEC 
-/// BEMF final dec slope settings for BEMF compensation in % step/s, range 0 to 0.4% s/step
-#define POWERSTEP01_CONF_PARAM_FN_SLP_DEC_DEVICE_0 (0.06256)
-
-/// Register : CONFIG - field : F_PWM_INT 
-/// PWM Frequency Integer division, enum powerstep01_ConfigFPwmInt_t
-#define POWERSTEP01_CONF_PARAM_PWM_DIV_DEVICE_0 (POWERSTEP01_CONFIG_PWM_DIV_2)
-
-/// Register : CONFIG - field : F_PWM_DEC 
-/// PWM Frequency Integer Multiplier, enum powerstep01_ConfigFPwmDec_t
-#define POWERSTEP01_CONF_PARAM_PWM_MUL_DEVICE_0 (POWERSTEP01_CONFIG_PWM_MUL_1)
-
-/******************** Advance current control parameters  *********************/
-
-/// Register : TVAL_ACC 
-/// Acceleration torque in mV, range from 7.8mV to 1000 mV 
-#define POWERSTEP01_CONF_PARAM_TVAL_ACC_DEVICE_0  (328.12)
-
-/// Register : TVAL_DEC 
-/// Deceleration torque in mV, range from 7.8mV to 1000 mV 
-#define POWERSTEP01_CONF_PARAM_TVAL_DEC_DEVICE_0  (328.12)
-
-/// Register : TVAL_RUN 
-/// Running torque in mV, range from 7.8mV to 1000 mV 
-#define POWERSTEP01_CONF_PARAM_TVAL_RUN_DEVICE_0  (328.12)
-
-/// Register : TVAL_HOLD 
-/// Holding torque in mV, range from 7.8mV to 1000 mV 
-#define POWERSTEP01_CONF_PARAM_TVAL_HOLD_DEVICE_0 (328.12) 
-
-/// Register : CONFIG - field : EN_TQREG 
-/// External torque regulation enabling , enum powerstep01_ConfigEnTqReg_t 
-#define POWERSTEP01_CONF_PARAM_TQ_REG_DEVICE_0 (POWERSTEP01_CONFIG_TQ_REG_TVAL_USED)  
-
-/// Register : CONFIG - field : PRED_EN 
-/// Predictive current enabling , enum powerstep01_ConfigPredEn_t  
-#define POWERSTEP01_CONF_PARAM_PRED_DEVICE_0 (POWERSTEP01_CONFIG_PRED_DISABLE)  
-
-///  Register : TON_MIN 
-///  Minimum on-time in us, range 0.5us to 64us 
-#define POWERSTEP01_CONF_PARAM_TON_MIN_DEVICE_0 (3.0)
-
-/// Register : TOFF_MIN 
-///  Minimum off-time in us, range 0.5us to 64us 
-#define POWERSTEP01_CONF_PARAM_TOFF_MIN_DEVICE_0 (21.0)
-
-/// Register : T_FAST - field: TOFF_FAST 
-/// Maximum fast decay time , enum powerstep01_ToffFast_t
-#define POWERSTEP01_CONF_PARAM_TOFF_FAST_DEVICE_0  (POWERSTEP01_TOFF_FAST_8us)
-
-/// Register : T_FAST - field: FAST_STEP 
-///  Maximum fall step time , enum powerstep01_FastStep_t
-#define POWERSTEP01_CONF_PARAM_FAST_STEP_DEVICE_0  (POWERSTEP01_FAST_STEP_12us)
-
-/// Register : CONFIG - field : TSW 
-/// Switching period, enum powerstep01_ConfigTsw_t
-#define POWERSTEP01_CONF_PARAM_TSW_DEVICE_0 (POWERSTEP01_CONFIG_TSW_048us)  
-
-/****************************** Gate Driving **********************************/
-
-/// Register : GATECFG1 - field : IGATE 
-/// Gate sink/source current via enum powerstep01_Igate_t 
-#define POWERSTEP01_CONF_PARAM_IGATE_DEVICE_0      (POWERSTEP01_IGATE_64mA)
-
-/// Register : CONFIG - field : VCCVAL 
-/// VCC Val, enum powerstep01_ConfigVccVal_t 
-#define POWERSTEP01_CONF_PARAM_VCCVAL_DEVICE_0 (POWERSTEP01_CONFIG_VCCVAL_15V)
-
-/// Register : CONFIG - field : UVLOVAL 
-/// UVLO Threshold via powerstep01_ConfigUvLoVal_t 
-#define POWERSTEP01_CONF_PARAM_UVLOVAL_DEVICE_0    (POWERSTEP01_CONFIG_UVLOVAL_LOW)
-
-/// Register : GATECFG1 - field : TBOOST 
-/// Duration of the overboost phase during gate turn-off via enum powerstep01_Tboost_t 
-#define POWERSTEP01_CONF_PARAM_TBOOST_DEVICE_0     (POWERSTEP01_TBOOST_0ns)
-
-/// Register : GATECFG1 - field : TCC 
-/// Controlled current time via enum powerstep01_Tcc_t
-#define POWERSTEP01_CONF_PARAM_TCC_DEVICE_0        (POWERSTEP01_TCC_500ns)
-
-/// Duration of the blanking time via enum powerstep01_TBlank_t 
-#define POWERSTEP01_CONF_PARAM_TBLANK_DEVICE_0     (POWERSTEP01_TBLANK_375ns)
-
-/// Register : GATECFG2 - field : TDT 
-/// Duration of the dead time via enum powerstep01_Tdt_t
-#define POWERSTEP01_CONF_PARAM_TDT_DEVICE_0        (POWERSTEP01_TDT_125ns)
-
-/******************************* Others *************************************/
-
-/// Register : OCD_TH 
-/// Overcurrent threshold settings via enum powerstep01_OcdTh_t
-#define POWERSTEP01_CONF_PARAM_OCD_TH_DEVICE_0 (POWERSTEP01_OCD_TH_281_25mV)
-
-/// Register : CONFIG - field : OC_SD 
-/// Over current shutwdown enabling, enum powerstep01_ConfigOcSd_t 
-#define POWERSTEP01_CONF_PARAM_OC_SD_DEVICE_0 (POWERSTEP01_CONFIG_OC_SD_DISABLE)
-
-/// Register : STALL_TH 
-/// Stall threshold settings in mV, range 31.25mV to 1000mV 
-#define POWERSTEP01_CONF_PARAM_STALL_TH_DEVICE_0 (531.25)
-
-/// Register : ALARM_EN 
-/// Alarm settings via bitmap enum powerstep01_AlarmEn_t 
-#define POWERSTEP01_CONF_PARAM_ALARM_EN_DEVICE_0 (POWERSTEP01_ALARM_EN_OVERCURRENT | \
-                                                  POWERSTEP01_ALARM_EN_THERMAL_SHUTDOWN |  \
-                                                  POWERSTEP01_ALARM_EN_THERMAL_WARNING |  \
-                                                  POWERSTEP01_ALARM_EN_UVLO |  \
-                                                  POWERSTEP01_ALARM_EN_STALL_DETECTION |  \
-                                                  POWERSTEP01_ALARM_EN_SW_TURN_ON | \
-                                                  POWERSTEP01_ALARM_EN_WRONG_NPERF_CMD)
-
-/// Register : CONFIG - field : SW_MODE 
-/// External switch hard stop interrupt mode, enum powerstep01_ConfigSwMode_t 
-#define POWERSTEP01_CONF_PARAM_SW_MODE_DEVICE_0 (POWERSTEP01_CONFIG_SW_HARD_STOP)
-
-/// Register : STEP_MODE - field : STEP_MODE 
-/// Step mode settings via enum motorStepMode_t 
-#define POWERSTEP01_CONF_PARAM_STEP_MODE_DEVICE_0 (STEP_MODE_1_16)
-
-/// Register : STEP_MODE - field : CM_VM 
-/// Current mode or Voltage mode via enum powerstep01_CmVm_t 
-#define POWERSTEP01_CONF_PARAM_CM_VM_DEVICE_0 (POWERSTEP01_CM_VM_CURRENT)
-
-/// Register : STEP_MODE - Field : SYNC_MODE and SYNC_EN 
-/// Synch. Mode settings via enum powerstep01_SyncSel_t 
-#define POWERSTEP01_CONF_PARAM_SYNC_MODE_DEVICE_0 (POWERSTEP01_SYNC_SEL_DISABLED)
-
-/// Register : CONFIG - field : OSC_CLK_SEL 
-/// Clock setting , enum powerstep01_ConfigOscMgmt_t 
-#define POWERSTEP01_CONF_PARAM_CLOCK_SETTING_DEVICE_0 (POWERSTEP01_CONFIG_INT_16MHZ_OSCOUT_2MHZ)
-
-/// Register : GATECFG1 - field : WD_EN 
-/// External clock watchdog, enum powerstep01_WdEn_t
-#define POWERSTEP01_CONF_PARAM_WD_EN_DEVICE_0 (POWERSTEP01_WD_EN_DISABLE)
-
-/****************************************************************************/
-/* Device 1                                                                 */
-/****************************************************************************/
-  
-/**************************** Speed Profile *********************************/
-/// Register : ACC
-/// Acceleration rate in step/s2, range 14.55 to 59590 steps/s^2 
-#define POWERSTEP01_CONF_PARAM_ACC_DEVICE_1 (2008.16)
-
-/// Register : DEC
-/// Deceleration rate in step/s2, range 14.55 to 59590 steps/s^2
-#define POWERSTEP01_CONF_PARAM_DEC_DEVICE_1 (2008.16)
-
-///Register : MAX_SPEED
-/// Maximum speed in step/s, range 15.25 to 15610 steps/s
-#define POWERSTEP01_CONF_PARAM_MAX_SPEED_DEVICE_1 (991.82)
-
-/// Register : MIN_SPEED 
-/// Minimum speed in step/s, range 0 to 976.3 steps/s
-#define POWERSTEP01_CONF_PARAM_MIN_SPEED_DEVICE_1 (0)
-
-/// Register : FS_SPD 
-/// Full step speed in step/s, range 7.63 to 15625 steps/s
-#define POWERSTEP01_CONF_PARAM_FS_SPD_DEVICE_1 (595.09)
-
-/// Register : FS_SPD - field : BOOST_MODE 
-/// Boost of the amplitude square wave, enum powerstep01_BoostMode_t
-#define POWERSTEP01_CONF_PARAM_BOOST_MODE_DEVICE_1 (POWERSTEP01_BOOST_MODE_OFF)
-
-
-/************************ Voltage mode parameters  **************************/
-/// Register : KVAL_ACC 
-/// Acceleration duty cycle (torque) in %, range 0 to 99.6%
-#define POWERSTEP01_CONF_PARAM_KVAL_ACC_DEVICE_1 (16.02)
-
-/// Register : KVAL_DEC 
-/// Deceleration duty cycle (torque) in %, range 0 to 99.6%
-#define POWERSTEP01_CONF_PARAM_KVAL_DEC_DEVICE_1 (16.02)
-
-/// Register : KVAL_RUN 
-/// run duty cycle (torque) in %, range 0 to 99.6%
-#define POWERSTEP01_CONF_PARAM_KVAL_RUN_DEVICE_1 (16.02)
-
-/// Register : KVAL_HOLD 
-/// Hold duty cycle (torque) in %, range 0 to 99.6%
-#define POWERSTEP01_CONF_PARAM_KVAL_HOLD_DEVICE_1 (16.02)
-
-/// Register : CONFIG - field : EN_VSCOMP 
-/// Motor Supply Voltage Compensation enabling , enum powerstep01_ConfigEnVscomp_t
-#define POWERSTEP01_CONF_PARAM_VS_COMP_DEVICE_1 (POWERSTEP01_CONFIG_VS_COMP_DISABLE)
-
-/// Register : MIN_SPEED - field : LSPD_OPT 
-/// Low speed optimization bit, enum powerstep01_LspdOpt_t
-#define POWERSTEP01_CONF_PARAM_LSPD_BIT_DEVICE_1 (POWERSTEP01_LSPD_OPT_OFF)
-
-/// Register : K_THERM 
-/// Thermal compensation param, range 1 to 1.46875
-#define POWERSTEP01_CONF_PARAM_K_THERM_DEVICE_1 (1)
-
-/// Register : INT_SPEED 
-/// Intersect speed settings for BEMF compensation in steps/s, range 0 to 3906 steps/s
-#define POWERSTEP01_CONF_PARAM_INT_SPD_DEVICE_1 (61.512)
-
-/// Register : ST_SLP 
-/// BEMF start slope settings for BEMF compensation in % step/s, range 0 to 0.4% s/step
-#define POWERSTEP01_CONF_PARAM_ST_SLP_DEVICE_1 (0.03815)
-
-/// Register : FN_SLP_ACC 
-/// BEMF final acc slope settings for BEMF compensation in % step/s, range 0 to 0.4% s/step
-#define POWERSTEP01_CONF_PARAM_FN_SLP_ACC_DEVICE_1 (0.06256)
-
-/// Register : FN_SLP_DEC 
-/// BEMF final dec slope settings for BEMF compensation in % step/s, range 0 to 0.4% s/step
-#define POWERSTEP01_CONF_PARAM_FN_SLP_DEC_DEVICE_1 (0.06256)
-
-/// Register : CONFIG - field : F_PWM_INT 
-/// PWM Frequency Integer division, enum powerstep01_ConfigFPwmInt_t
-#define POWERSTEP01_CONF_PARAM_PWM_DIV_DEVICE_1 (POWERSTEP01_CONFIG_PWM_DIV_2)
-
-/// Register : CONFIG - field : F_PWM_DEC 
-/// PWM Frequency Integer Multiplier, enum powerstep01_ConfigFPwmDec_t
-#define POWERSTEP01_CONF_PARAM_PWM_MUL_DEVICE_1 (POWERSTEP01_CONFIG_PWM_MUL_1)
-
-/******************** Advance current control parameters  *********************/
-
-/// Register : TVAL_ACC 
-/// Acceleration torque in mV, range from 7.8mV to 1000 mV 
-#define POWERSTEP01_CONF_PARAM_TVAL_ACC_DEVICE_1  (328.12)
-
-/// Register : TVAL_DEC 
-/// Deceleration torque in mV, range from 7.8mV to 1000 mV 
-#define POWERSTEP01_CONF_PARAM_TVAL_DEC_DEVICE_1  (328.12)
-
-/// Register : TVAL_RUN 
-/// Running torque in mV, range from 7.8mV to 1000 mV 
-#define POWERSTEP01_CONF_PARAM_TVAL_RUN_DEVICE_1  (328.12)
-
-/// Register : TVAL_HOLD 
-/// Holding torque in mV, range from 7.8mV to 1000 mV 
-#define POWERSTEP01_CONF_PARAM_TVAL_HOLD_DEVICE_1 (328.12) 
-
-/// Register : CONFIG - field : EN_TQREG 
-/// External torque regulation enabling , enum powerstep01_ConfigEnTqReg_t 
-#define POWERSTEP01_CONF_PARAM_TQ_REG_DEVICE_1 (POWERSTEP01_CONFIG_TQ_REG_TVAL_USED)  
-
-/// Register : CONFIG - field : PRED_EN 
-/// Predictive current enabling , enum powerstep01_ConfigPredEn_t  
-#define POWERSTEP01_CONF_PARAM_PRED_DEVICE_1 (POWERSTEP01_CONFIG_PRED_DISABLE)  
-
-///  Register : TON_MIN 
-///  Minimum on-time in us, range 0.5us to 64us 
-#define POWERSTEP01_CONF_PARAM_TON_MIN_DEVICE_1 (3.0)
-
-/// Register : TOFF_MIN 
-///  Minimum off-time in us, range 0.5us to 64us 
-#define POWERSTEP01_CONF_PARAM_TOFF_MIN_DEVICE_1 (21.0)
-
-/// Register : T_FAST - field: TOFF_FAST 
-/// Maximum fast decay time , enum powerstep01_ToffFast_t
-#define POWERSTEP01_CONF_PARAM_TOFF_FAST_DEVICE_1  (POWERSTEP01_TOFF_FAST_8us)
-
-/// Register : T_FAST - field: FAST_STEP 
-///  Maximum fall step time , enum powerstep01_FastStep_t
-#define POWERSTEP01_CONF_PARAM_FAST_STEP_DEVICE_1  (POWERSTEP01_FAST_STEP_12us)
-
-/// Register : CONFIG - field : TSW 
-/// Switching period, enum powerstep01_ConfigTsw_t
-#define POWERSTEP01_CONF_PARAM_TSW_DEVICE_1 (POWERSTEP01_CONFIG_TSW_048us)  
-
-/****************************** Gate Driving **********************************/
-
-/// Register : GATECFG1 - field : IGATE 
-/// Gate sink/source current via enum powerstep01_Igate_t 
-#define POWERSTEP01_CONF_PARAM_IGATE_DEVICE_1      (POWERSTEP01_IGATE_64mA)
-
-/// Register : CONFIG - field : VCCVAL 
-/// VCC Val, enum powerstep01_ConfigVccVal_t 
-#define POWERSTEP01_CONF_PARAM_VCCVAL_DEVICE_1 (POWERSTEP01_CONFIG_VCCVAL_15V)
-
-/// Register : CONFIG - field : UVLOVAL 
-/// UVLO Threshold via powerstep01_ConfigUvLoVal_t 
-#define POWERSTEP01_CONF_PARAM_UVLOVAL_DEVICE_1    (POWERSTEP01_CONFIG_UVLOVAL_LOW)
-
-/// Register : GATECFG1 - field : TBOOST 
-/// Duration of the overboost phase during gate turn-off via enum powerstep01_Tboost_t 
-#define POWERSTEP01_CONF_PARAM_TBOOST_DEVICE_1     (POWERSTEP01_TBOOST_0ns)
-
-/// Register : GATECFG1 - field : TCC 
-/// Controlled current time via enum powerstep01_Tcc_t
-#define POWERSTEP01_CONF_PARAM_TCC_DEVICE_1        (POWERSTEP01_TCC_500ns)
-
-/// Duration of the blanking time via enum powerstep01_TBlank_t 
-#define POWERSTEP01_CONF_PARAM_TBLANK_DEVICE_1     (POWERSTEP01_TBLANK_375ns)
-
-/// Register : GATECFG2 - field : TDT 
-/// Duration of the dead time via enum powerstep01_Tdt_t
-#define POWERSTEP01_CONF_PARAM_TDT_DEVICE_1        (POWERSTEP01_TDT_125ns)
-
-/******************************* Others *************************************/
-
-/// Register : OCD_TH 
-/// Overcurrent threshold settings via enum powerstep01_OcdTh_t
-#define POWERSTEP01_CONF_PARAM_OCD_TH_DEVICE_1 (POWERSTEP01_OCD_TH_281_25mV)
-
-/// Register : CONFIG - field : OC_SD 
-/// Over current shutwdown enabling, enum powerstep01_ConfigOcSd_t 
-#define POWERSTEP01_CONF_PARAM_OC_SD_DEVICE_1 (POWERSTEP01_CONFIG_OC_SD_DISABLE)
-
-/// Register : STALL_TH 
-/// Stall threshold settings in mV, range 31.25mV to 1000mV 
-#define POWERSTEP01_CONF_PARAM_STALL_TH_DEVICE_1 (531.25)
-
-/// Register : ALARM_EN 
-/// Alarm settings via bitmap enum powerstep01_AlarmEn_t 
-#define POWERSTEP01_CONF_PARAM_ALARM_EN_DEVICE_1 (POWERSTEP01_ALARM_EN_OVERCURRENT | \
-                                                  POWERSTEP01_ALARM_EN_THERMAL_SHUTDOWN |  \
-                                                  POWERSTEP01_ALARM_EN_THERMAL_WARNING |  \
-                                                  POWERSTEP01_ALARM_EN_UVLO |  \
-                                                  POWERSTEP01_ALARM_EN_STALL_DETECTION |  \
-                                                  POWERSTEP01_ALARM_EN_SW_TURN_ON | \
-                                                  POWERSTEP01_ALARM_EN_WRONG_NPERF_CMD)
-
-/// Register : CONFIG - field : SW_MODE 
-/// External switch hard stop interrupt mode, enum powerstep01_ConfigSwMode_t 
-#define POWERSTEP01_CONF_PARAM_SW_MODE_DEVICE_1 (POWERSTEP01_CONFIG_SW_HARD_STOP)
-
-/// Register : STEP_MODE - field : STEP_MODE 
-/// Step mode settings via enum powerstep01_StepSel_t 
-#define POWERSTEP01_CONF_PARAM_STEP_MODE_DEVICE_1 (STEP_MODE_1_16)
-
-/// Register : STEP_MODE - field : CM_VM 
-/// Current mode or Voltage mode via enum powerstep01_CmVm_t 
-#define POWERSTEP01_CONF_PARAM_CM_VM_DEVICE_1 (POWERSTEP01_CM_VM_CURRENT)
-
-/// Register : STEP_MODE - Field : SYNC_MODE and SYNC_EN 
-/// Synch. Mode settings via enum powerstep01_SyncSel_t 
-#define POWERSTEP01_CONF_PARAM_SYNC_MODE_DEVICE_1 (POWERSTEP01_SYNC_SEL_DISABLED)
-
-/// Register : CONFIG - field : OSC_CLK_SEL 
-/// Clock setting , enum powerstep01_ConfigOscMgmt_t 
-#define POWERSTEP01_CONF_PARAM_CLOCK_SETTING_DEVICE_1 (POWERSTEP01_CONFIG_INT_16MHZ_OSCOUT_2MHZ)
-
-/// Register : GATECFG1 - field : WD_EN 
-/// External clock watchdog, enum powerstep01_WdEn_t
-#define POWERSTEP01_CONF_PARAM_WD_EN_DEVICE_1 (POWERSTEP01_WD_EN_DISABLE)
-
-/****************************************************************************/
-/* Device 2                                                                 */
-/****************************************************************************/
-  
-/**************************** Speed Profile *********************************/
-/// Register : ACC
-/// Acceleration rate in step/s2, range 14.55 to 59590 steps/s^2 
-#define POWERSTEP01_CONF_PARAM_ACC_DEVICE_2 (2008.16)
-
-/// Register : DEC
-/// Deceleration rate in step/s2, range 14.55 to 59590 steps/s^2
-#define POWERSTEP01_CONF_PARAM_DEC_DEVICE_2 (2008.16)
-
-///Register : MAX_SPEED
-/// Maximum speed in step/s, range 15.25 to 15610 steps/s
-#define POWERSTEP01_CONF_PARAM_MAX_SPEED_DEVICE_2 (991.82)
-
-/// Register : MIN_SPEED 
-/// Minimum speed in step/s, range 0 to 976.3 steps/s
-#define POWERSTEP01_CONF_PARAM_MIN_SPEED_DEVICE_2 (0)
-
-/// Register : FS_SPD 
-/// Full step speed in step/s, range 7.63 to 15625 steps/s
-#define POWERSTEP01_CONF_PARAM_FS_SPD_DEVICE_2 (595.09)
-
-/// Register : FS_SPD - field : BOOST_MODE 
-/// Boost of the amplitude square wave, enum powerstep01_BoostMode_t
-#define POWERSTEP01_CONF_PARAM_BOOST_MODE_DEVICE_2 (POWERSTEP01_BOOST_MODE_OFF)
-
-
-/************************ Voltage mode parameters  **************************/
-/// Register : KVAL_ACC 
-/// Acceleration duty cycle (torque) in %, range 0 to 99.6%
-#define POWERSTEP01_CONF_PARAM_KVAL_ACC_DEVICE_2 (16.02)
-
-/// Register : KVAL_DEC 
-/// Deceleration duty cycle (torque) in %, range 0 to 99.6%
-#define POWERSTEP01_CONF_PARAM_KVAL_DEC_DEVICE_2 (16.02)
-
-/// Register : KVAL_RUN 
-/// run duty cycle (torque) in %, range 0 to 99.6%
-#define POWERSTEP01_CONF_PARAM_KVAL_RUN_DEVICE_2 (16.02)
-
-/// Register : KVAL_HOLD 
-/// Hold duty cycle (torque) in %, range 0 to 99.6%
-#define POWERSTEP01_CONF_PARAM_KVAL_HOLD_DEVICE_2 (16.02)
-
-/// Register : CONFIG - field : EN_VSCOMP 
-/// Motor Supply Voltage Compensation enabling , enum powerstep01_ConfigEnVscomp_t
-#define POWERSTEP01_CONF_PARAM_VS_COMP_DEVICE_2 (POWERSTEP01_CONFIG_VS_COMP_DISABLE)
-
-/// Register : MIN_SPEED - field : LSPD_OPT 
-/// Low speed optimization bit, enum powerstep01_LspdOpt_t
-#define POWERSTEP01_CONF_PARAM_LSPD_BIT_DEVICE_2 (POWERSTEP01_LSPD_OPT_OFF)
-
-/// Register : K_THERM 
-/// Thermal compensation param, range 1 to 1.46875
-#define POWERSTEP01_CONF_PARAM_K_THERM_DEVICE_2 (1)
-
-/// Register : INT_SPEED 
-/// Intersect speed settings for BEMF compensation in steps/s, range 0 to 3906 steps/s
-#define POWERSTEP01_CONF_PARAM_INT_SPD_DEVICE_2 (61.512)
-
-/// Register : ST_SLP 
-/// BEMF start slope settings for BEMF compensation in % step/s, range 0 to 0.4% s/step
-#define POWERSTEP01_CONF_PARAM_ST_SLP_DEVICE_2 (0.03815)
-
-/// Register : FN_SLP_ACC 
-/// BEMF final acc slope settings for BEMF compensation in % step/s, range 0 to 0.4% s/step
-#define POWERSTEP01_CONF_PARAM_FN_SLP_ACC_DEVICE_2 (0.06256)
-
-/// Register : FN_SLP_DEC 
-/// BEMF final dec slope settings for BEMF compensation in % step/s, range 0 to 0.4% s/step
-#define POWERSTEP01_CONF_PARAM_FN_SLP_DEC_DEVICE_2 (0.06256)
-
-/// Register : CONFIG - field : F_PWM_INT 
-/// PWM Frequency Integer division, enum powerstep01_ConfigFPwmInt_t
-#define POWERSTEP01_CONF_PARAM_PWM_DIV_DEVICE_2 (POWERSTEP01_CONFIG_PWM_DIV_2)
-
-/// Register : CONFIG - field : F_PWM_DEC 
-/// PWM Frequency Integer Multiplier, enum powerstep01_ConfigFPwmDec_t
-#define POWERSTEP01_CONF_PARAM_PWM_MUL_DEVICE_2 (POWERSTEP01_CONFIG_PWM_MUL_1)
-
-/******************** Advance current control parameters  *********************/
-
-/// Register : TVAL_ACC 
-/// Acceleration torque in mV, range from 7.8mV to 1000 mV 
-#define POWERSTEP01_CONF_PARAM_TVAL_ACC_DEVICE_2  (328.12)
-
-/// Register : TVAL_DEC 
-/// Deceleration torque in mV, range from 7.8mV to 1000 mV 
-#define POWERSTEP01_CONF_PARAM_TVAL_DEC_DEVICE_2  (328.12)
-
-/// Register : TVAL_RUN 
-/// Running torque in mV, range from 7.8mV to 1000 mV 
-#define POWERSTEP01_CONF_PARAM_TVAL_RUN_DEVICE_2  (328.12)
-
-/// Register : TVAL_HOLD 
-/// Holding torque in mV, range from 7.8mV to 1000 mV 
-#define POWERSTEP01_CONF_PARAM_TVAL_HOLD_DEVICE_2 (328.12) 
-
-/// Register : CONFIG - field : EN_TQREG 
-/// External torque regulation enabling , enum powerstep01_ConfigEnTqReg_t 
-#define POWERSTEP01_CONF_PARAM_TQ_REG_DEVICE_2 (POWERSTEP01_CONFIG_TQ_REG_TVAL_USED)  
-
-/// Register : CONFIG - field : PRED_EN 
-/// Predictive current enabling , enum powerstep01_ConfigPredEn_t  
-#define POWERSTEP01_CONF_PARAM_PRED_DEVICE_2 (POWERSTEP01_CONFIG_PRED_DISABLE)  
-
-///  Register : TON_MIN 
-///  Minimum on-time in us, range 0.5us to 64us 
-#define POWERSTEP01_CONF_PARAM_TON_MIN_DEVICE_2 (3.0)
-
-/// Register : TOFF_MIN 
-///  Minimum off-time in us, range 0.5us to 64us 
-#define POWERSTEP01_CONF_PARAM_TOFF_MIN_DEVICE_2 (21.0)
-
-/// Register : T_FAST - field: TOFF_FAST 
-/// Maximum fast decay time , enum powerstep01_ToffFast_t
-#define POWERSTEP01_CONF_PARAM_TOFF_FAST_DEVICE_2  (POWERSTEP01_TOFF_FAST_8us)
-
-/// Register : T_FAST - field: FAST_STEP 
-///  Maximum fall step time , enum powerstep01_FastStep_t
-#define POWERSTEP01_CONF_PARAM_FAST_STEP_DEVICE_2  (POWERSTEP01_FAST_STEP_12us)
-
-/// Register : CONFIG - field : TSW 
-/// Switching period, enum powerstep01_ConfigTsw_t
-#define POWERSTEP01_CONF_PARAM_TSW_DEVICE_2 (POWERSTEP01_CONFIG_TSW_048us)  
-
-/****************************** Gate Driving **********************************/
-
-/// Register : GATECFG1 - field : IGATE 
-/// Gate sink/source current via enum powerstep01_Igate_t 
-#define POWERSTEP01_CONF_PARAM_IGATE_DEVICE_2      (POWERSTEP01_IGATE_64mA)
-
-/// Register : CONFIG - field : VCCVAL 
-/// VCC Val, enum powerstep01_ConfigVccVal_t 
-#define POWERSTEP01_CONF_PARAM_VCCVAL_DEVICE_2 (POWERSTEP01_CONFIG_VCCVAL_15V)
-
-/// Register : CONFIG - field : UVLOVAL 
-/// UVLO Threshold via powerstep01_ConfigUvLoVal_t 
-#define POWERSTEP01_CONF_PARAM_UVLOVAL_DEVICE_2    (POWERSTEP01_CONFIG_UVLOVAL_LOW)
-
-/// Register : GATECFG1 - field : TBOOST 
-/// Duration of the overboost phase during gate turn-off via enum powerstep01_Tboost_t 
-#define POWERSTEP01_CONF_PARAM_TBOOST_DEVICE_2     (POWERSTEP01_TBOOST_0ns)
-
-/// Register : GATECFG1 - field : TCC 
-/// Controlled current time via enum powerstep01_Tcc_t
-#define POWERSTEP01_CONF_PARAM_TCC_DEVICE_2        (POWERSTEP01_TCC_500ns)
-
-/// Duration of the blanking time via enum powerstep01_TBlank_t 
-#define POWERSTEP01_CONF_PARAM_TBLANK_DEVICE_2     (POWERSTEP01_TBLANK_375ns)
-
-/// Register : GATECFG2 - field : TDT 
-/// Duration of the dead time via enum powerstep01_Tdt_t
-#define POWERSTEP01_CONF_PARAM_TDT_DEVICE_2        (POWERSTEP01_TDT_125ns)
-
-/******************************* Others *************************************/
-
-/// Register : OCD_TH 
-/// Overcurrent threshold settings via enum powerstep01_OcdTh_t
-#define POWERSTEP01_CONF_PARAM_OCD_TH_DEVICE_2 (POWERSTEP01_OCD_TH_281_25mV)
-
-/// Register : CONFIG - field : OC_SD 
-/// Over current shutwdown enabling, enum powerstep01_ConfigOcSd_t 
-#define POWERSTEP01_CONF_PARAM_OC_SD_DEVICE_2 (POWERSTEP01_CONFIG_OC_SD_DISABLE)
-
-/// Register : STALL_TH 
-/// Stall threshold settings in mV, range 31.25mV to 1000mV 
-#define POWERSTEP01_CONF_PARAM_STALL_TH_DEVICE_2 (531.25)
-
-/// Register : ALARM_EN 
-/// Alarm settings via bitmap enum powerstep01_AlarmEn_t 
-#define POWERSTEP01_CONF_PARAM_ALARM_EN_DEVICE_2 (POWERSTEP01_ALARM_EN_OVERCURRENT | \
-                                                  POWERSTEP01_ALARM_EN_THERMAL_SHUTDOWN |  \
-                                                  POWERSTEP01_ALARM_EN_THERMAL_WARNING |  \
-                                                  POWERSTEP01_ALARM_EN_UVLO |  \
-                                                  POWERSTEP01_ALARM_EN_STALL_DETECTION |  \
-                                                  POWERSTEP01_ALARM_EN_SW_TURN_ON | \
-                                                  POWERSTEP01_ALARM_EN_WRONG_NPERF_CMD)
-
-/// Register : CONFIG - field : SW_MODE 
-/// External switch hard stop interrupt mode, enum powerstep01_ConfigSwMode_t 
-#define POWERSTEP01_CONF_PARAM_SW_MODE_DEVICE_2 (POWERSTEP01_CONFIG_SW_HARD_STOP)
-
-/// Register : STEP_MODE - field : STEP_MODE 
-/// Step mode settings via enum powerstep01_StepSel_t 
-#define POWERSTEP01_CONF_PARAM_STEP_MODE_DEVICE_2 (STEP_MODE_1_16)
-
-/// Register : STEP_MODE - field : CM_VM 
-/// Current mode or Voltage mode via enum powerstep01_CmVm_t 
-#define POWERSTEP01_CONF_PARAM_CM_VM_DEVICE_2 (POWERSTEP01_CM_VM_CURRENT)
-
-/// Register : STEP_MODE - Field : SYNC_MODE and SYNC_EN 
-/// Synch. Mode settings via enum powerstep01_SyncSel_t 
-#define POWERSTEP01_CONF_PARAM_SYNC_MODE_DEVICE_2 (POWERSTEP01_SYNC_SEL_DISABLED)
-
-/// Register : CONFIG - field : OSC_CLK_SEL 
-/// Clock setting , enum powerstep01_ConfigOscMgmt_t 
-#define POWERSTEP01_CONF_PARAM_CLOCK_SETTING_DEVICE_2 (POWERSTEP01_CONFIG_INT_16MHZ_OSCOUT_2MHZ)
-
-/// Register : GATECFG1 - field : WD_EN 
-/// External clock watchdog, enum powerstep01_WdEn_t
-#define POWERSTEP01_CONF_PARAM_WD_EN_DEVICE_2 (POWERSTEP01_WD_EN_DISABLE)
-
-/**
-  * @}
-  */
-  
-/**
-  * @}
-  */
-  
-/**
-  * @}
-  */
-
-#ifdef __cplusplus
-  }
-#endif
-
-#endif /* __POWERSTEP01_CONFIG_H */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
--- a/Components/powerstep01/PowerStep01_def.h	Fri Mar 24 10:58:48 2017 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,964 +0,0 @@
-/**
- ******************************************************************************
-  * @file    PowerStep01.h 
-  * @author  IPC Rennes
-  * @version V1.2.0
-  * @date    January 25th, 2016
-  * @brief   Header for Powerstep01 motor driver (Microstepping controller with power MOSFETs)
-  * @note    (C) COPYRIGHT 2016 STMicroelectronics
- ******************************************************************************
- * @attention
- *
-  * <h2><center>&copy; COPYRIGHT(c) 2016 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 _POWERSTEP01_H_INCLUDED
-#define _POWERSTEP01_H_INCLUDED
-
-#ifdef __cplusplus
- extern "C" {
-#endif 
-
-/* Includes ------------------------------------------------------------------*/
-#include "PowerStep01_config.h"
-#include "stdint.h"
-#include "motor_def.h"
-
-/* Definitions ---------------------------------------------------------------*/
-
-/** @addtogroup Components
- * @{
- */  
-
-/** @defgroup PowerStep01 PowerStep01
- * @{
- */
-
-/** @defgroup Powerstep01_Exported_Defines Powerstep01_Exported_Defines
- * @{
- */
-/// Current FW major version
-#define POWERSTEP01_FW_MAJOR_VERSION (uint8_t)(1)
-/// Current FW minor version
-#define POWERSTEP01_FW_MINOR_VERSION (uint8_t)(2)
-/// Current FW patch version
-#define POWERSTEP01_FW_PATCH_VERSION (uint8_t)(0)
-/// Current FW version
-#define POWERSTEP01_FW_VERSION (uint32_t)((POWERSTEP01_FW_MAJOR_VERSION<<16)|\
-                                          (POWERSTEP01_FW_MINOR_VERSION<<8)|\
-                                          (POWERSTEP01_FW_PATCH_VERSION))
-
-/// Powerstep01 max number of bytes of command & arguments to set a parameter
-#define POWERSTEP01_CMD_ARG_MAX_NB_BYTES              (4)
-
-/// Powerstep01 command + argument bytes number for NOP command
-#define POWERSTEP01_CMD_ARG_NB_BYTES_NOP              (1)
-/// Powerstep01 command + argument bytes number for RUN command
-#define POWERSTEP01_CMD_ARG_NB_BYTES_RUN              (4)
-/// Powerstep01 command + argument bytes number for STEP_CLOCK command
-#define POWERSTEP01_CMD_ARG_NB_BYTES_STEP_CLOCK       (1)
-/// Powerstep01 command + argument bytes number for MOVE command
-#define POWERSTEP01_CMD_ARG_NB_BYTES_MOVE             (4)
-/// Powerstep01 command + argument bytes number for GO_TO command
-#define POWERSTEP01_CMD_ARG_NB_BYTES_GO_TO            (4)
-/// Powerstep01 command + argument bytes number for GO_TO_DIR command
-#define POWERSTEP01_CMD_ARG_NB_BYTES_GO_TO_DIR        (4)
-/// Powerstep01 command + argument bytes number for GO_UNTIL command
-#define POWERSTEP01_CMD_ARG_NB_BYTES_GO_UNTIL         (4)
-/// Powerstep01 command + argument bytes number for RELEASE_SW command
-#define POWERSTEP01_CMD_ARG_NB_BYTES_RELEASE_SW       (1)
-/// Powerstep01 command + argument bytes number for GO_HOME command
-#define POWERSTEP01_CMD_ARG_NB_BYTES_GO_HOME          (1)
-/// Powerstep01 command + argument bytes number for GO_MARK command
-#define POWERSTEP01_CMD_ARG_NB_BYTES_GO_MARK          (1)
-/// Powerstep01 command + argument bytes number for RESET_POS command
-#define POWERSTEP01_CMD_ARG_NB_BYTES_RESET_POS        (1)
-/// Powerstep01 command + argument bytes number for RESET_DEVICE command
-#define POWERSTEP01_CMD_ARG_NB_BYTES_RESET_DEVICE     (1)
-/// Powerstep01 command + argument bytes number for NOP command
-#define POWERSTEP01_CMD_ARG_NB_BYTES_SOFT_STOP        (1)
-/// Powerstep01 command + argument bytes number for HARD_STOP command
-#define POWERSTEP01_CMD_ARG_NB_BYTES_HARD_STOP        (1)
-/// Powerstep01 command + argument bytes number for SOFT_HIZ command
-#define POWERSTEP01_CMD_ARG_NB_BYTES_SOFT_HIZ         (1)
-/// Powerstep01 command + argument bytes number for ARD_HIZ command
-#define POWERSTEP01_CMD_ARG_NB_BYTES_HARD_HIZ         (1)
-/// Powerstep01 command + argument bytes number for GET_STATUS command
-#define POWERSTEP01_CMD_ARG_NB_BYTES_GET_STATUS       (1)
-
-/// Powerstep01 response bytes number 
-#define POWERSTEP01_RSP_NB_BYTES_GET_STATUS           (2)    
-
-/// Daisy chain command mask
-#define DAISY_CHAIN_COMMAND_MASK (0xFA)
-
-/// powerSTEP01 max absolute position
-#define POWERSTEP01_MAX_POSITION (int32_t)(0x001FFFFF)
-
-/// powerSTEP01 min absolute position
-#define POWERSTEP01_MIN_POSITION (int32_t)(0xFFE00000)
-    
-/// powerSTEP01 error base number
-#define POWERSTEP01_ERROR_BASE              (0xB000)
-
-/// powerSTEP01 acceleration and deceleration max value
-#define POWERSTEP01_ACC_DEC_MAX_VALUE       (float)(59590)
-/// powerSTEP01 max speed max value
-#define POWERSTEP01_MAX_SPEED_MAX_VALUE     (float)(15610)
-/// powerSTEP01 min speed max value
-#define POWERSTEP01_MIN_SPEED_MAX_VALUE     (float)(976.3)
-/// powerSTEP01 full step speed max value
-#define POWERSTEP01_FS_SPD_MAX_VALUE        (float)(15625)
-/// powerSTEP01 intersect speed max value
-#define POWERSTEP01_INT_SPD_MAX_VALUE       (float)(976.5)
-/// powerSTEP01 thermal compensation max value
-#define POWERSTEP01_K_THERM_MAX_VALUE       (float)(1.46875)
-/// powerSTEP01 thermal compensation min value
-#define POWERSTEP01_K_THERM_MIN_VALUE       (float)(1)
-/// powerSTEP01 thermal compensation max value
-#define POWERSTEP01_STALL_OCD_TH_MAX_VALUE  (float)(1000)
-/// powerSTEP01 thermal compensation max value
-#define POWERSTEP01_K_THERM_MAX_VALUE       (float)(1.46875)
-/// powerSTEP01 voltage amplitude regulation max value
-#define POWERSTEP01_KVAL_MAX_VALUE          (float)(255/256)
-/// powerSTEP01 BEMF compensation curve slope max value
-#define POWERSTEP01_SLP_MAX_VALUE           (float)(0.4)
-/// powerSTEP01 torque regulation DAC reference voltage max value
-#define POWERSTEP01_TVAL_MAX_VALUE          (float)(1000)
-/// powerSTEP01 minimum off and on time max value
-#define POWERSTEP01_TOFF_TON_MIN_MAX_VALUE  (float)(64)
-    
-///Shift of the low speed optimization bit in MIN_SPEED register
-#define POWERSTEP01_LSPD_OPT_SHIFT            (12)
-///Shift of the boost mode bit in FS_SPD register
-#define POWERSTEP01_BOOST_MODE_SHIFT          (10)
-///Maximum fast decay time (TOFF_FAST) unit
-#define POWERSTEP01_TOFF_FAST_UNIT_US         (2)
-///Shift of the maximum fast decay time (TOFF_FAST) in T_FAST register
-#define POWERSTEP01_TOFF_FAST_SHIFT           (4)
-///Maximum fall step time (FAST_STEP) unit
-#define POWERSTEP01_FAST_STEP_UNIT_US         (2)
-///Shift of the maximum fall step time (FAST_STEP) in T_FAST register
-#define POWERSTEP01_FAST_STEP_SHIFT           (0)
-///Duration unit of constant current phase during gate turn-on and turn-off (TCC)
-#define POWERSTEP01_TCC_UNIT_NS               (125)
-///Shift of TCC field in GATECFG1 register
-#define POWERSTEP01_TCC_SHIFT                 (0)
-///Shift of IGATE field in GATECFG1 register
-#define POWERSTEP01_IGATE_SHIFT               (5)
-///Shift of TBOOST field in GATECFG1 register
-#define POWERSTEP01_TBOOST_SHIFT              (8)
-///Duration unit of the blanking of the current sensing comparators (TBLANK)
-#define POWERSTEP01_TBLANK_UNIT_NS            (125)
-///Shift of TBLANK field in GATECFG2 register
-#define POWERSTEP01_TBLANK_SHIFT              (5)
-///Deadtime duration unit between gate turn-off and opposite gate turn-on (TDT)
-#define POWERSTEP01_TDT_UNIT_NS               (125)
-///Shift of TDT field in GATECFG2 register
-#define POWERSTEP01_TDT_SHIFT                 (0)
-///Shift of F_PWM_INT field in CONFIG register for voltage mode
-#define POWERSTEP01_CONFIG_PWM_DIV_SHIFT      (13)
-///Shift of F_PWM_DEC field in CONFIG register for voltage mode
-#define POWERSTEP01_CONFIG_PWM_MUL_SHIFT      (10)
-///Target switching period (TSW) unit
-#define POWERSTEP01_CONFIG_TSW_UNIT_US        (4)
-///Shift of TSW field in CONFIG register for current mode
-#define POWERSTEP01_CONFIG_TSW_SHIFT          (10)
-///Shift of MOT_STATUS field in STATUS register
-#define POWERSTEP01_STATUS_MOT_STATUS_SHIFT   (5)
-/**
-  * @}
-  */
-
-/* Types ---------------------------------------------------------------------*/
-
-/** @defgroup Powerstep01_Exported_Types Powerstep01 Exported Types
-  * @{
-  */
-/// masks for ABS_POS register of PowerStep01
-typedef enum {
-  POWERSTEP01_ABS_POS_VALUE_MASK        = ((uint32_t)0x003FFFFF),
-  POWERSTEP01_ABS_POS_SIGN_BIT_MASK     = ((uint32_t)0x00200000)
-} powerstep01_AbsPosMasks_t;
-
-/// masks for EL_POS register of PowerStep01
-typedef enum {
-  POWERSTEP01_ELPOS_STEP_MASK       = ((uint16_t)0x180),
-  POWERSTEP01_ELPOS_MICROSTEP_MASK  = ((uint16_t)0x07F)
-} powerstep01_ElPosMasks_t;
-
-/// masks for MIN_SPEED register of PowerStep01
-typedef enum {
-  POWERSTEP01_LSPD_OPT        = ((uint16_t)((0x1)<<POWERSTEP01_LSPD_OPT_SHIFT)),
-  POWERSTEP01_MIN_SPEED_MASK  = ((uint16_t)0x0FFF)
-} powerstep01_MinSpeedMasks_t;
-
-/// Low speed optimization (MIN_SPEED register of PowerStep01)
-typedef enum {
-  POWERSTEP01_LSPD_OPT_OFF    = ((uint16_t)0x0000),
-  POWERSTEP01_LSPD_OPT_ON     = ((uint16_t)POWERSTEP01_LSPD_OPT)
-} powerstep01_LspdOpt_t;
-
-/// masks for FS_SPD register of PowerStep01
-typedef enum {
-  POWERSTEP01_BOOST_MODE   = ((uint16_t)((0x1)<<POWERSTEP01_BOOST_MODE_SHIFT)),
-  POWERSTEP01_FS_SPD_MASK  = ((uint16_t)0x03FF)
-} powerstep01_FsSpdMasks_t;
-
-/// Full step boost (FS_SPD register of PowerStep01)
-typedef enum {
-  POWERSTEP01_BOOST_MODE_OFF    = ((uint16_t)0x0000),
-  POWERSTEP01_BOOST_MODE_ON     = ((uint16_t)POWERSTEP01_BOOST_MODE)
-} powerstep01_BoostMode_t;
-
-/// masks for T_FAST register of PowerStep01
-typedef enum {
-  POWERSTEP01_FAST_STEP_MASK  = ((uint16_t) ((0xF)<<POWERSTEP01_FAST_STEP_SHIFT)),
-  POWERSTEP01_TOFF_FAST_MASK  = ((uint16_t) ((0xF)<<POWERSTEP01_TOFF_FAST_SHIFT))
-} powerstep01_TFastMasks_t;
-
-/// Maximum fall step times (T_FAST register of PowerStep01)
-typedef enum {
-  POWERSTEP01_FAST_STEP_2us     = (((uint8_t)0x00)<<POWERSTEP01_FAST_STEP_SHIFT),
-  POWERSTEP01_FAST_STEP_4us     = (((uint8_t)0x01)<<POWERSTEP01_FAST_STEP_SHIFT),
-  POWERSTEP01_FAST_STEP_6us     = (((uint8_t)0x02)<<POWERSTEP01_FAST_STEP_SHIFT),
-  POWERSTEP01_FAST_STEP_8us     = (((uint8_t)0x03)<<POWERSTEP01_FAST_STEP_SHIFT),
-  POWERSTEP01_FAST_STEP_10us    = (((uint8_t)0x04)<<POWERSTEP01_FAST_STEP_SHIFT),
-  POWERSTEP01_FAST_STEP_12us    = (((uint8_t)0x05)<<POWERSTEP01_FAST_STEP_SHIFT),
-  POWERSTEP01_FAST_STEP_14us    = (((uint8_t)0x06)<<POWERSTEP01_FAST_STEP_SHIFT),
-  POWERSTEP01_FAST_STEP_16us    = (((uint8_t)0x07)<<POWERSTEP01_FAST_STEP_SHIFT),
-  POWERSTEP01_FAST_STEP_18us    = (((uint8_t)0x08)<<POWERSTEP01_FAST_STEP_SHIFT),
-  POWERSTEP01_FAST_STEP_20us    = (((uint8_t)0x09)<<POWERSTEP01_FAST_STEP_SHIFT),
-  POWERSTEP01_FAST_STEP_22us    = (((uint8_t)0x0A)<<POWERSTEP01_FAST_STEP_SHIFT),
-  POWERSTEP01_FAST_STEP_24s     = (((uint8_t)0x0B)<<POWERSTEP01_FAST_STEP_SHIFT),
-  POWERSTEP01_FAST_STEP_26us    = (((uint8_t)0x0C)<<POWERSTEP01_FAST_STEP_SHIFT),
-  POWERSTEP01_FAST_STEP_28us    = (((uint8_t)0x0D)<<POWERSTEP01_FAST_STEP_SHIFT),
-  POWERSTEP01_FAST_STEP_30us    = (((uint8_t)0x0E)<<POWERSTEP01_FAST_STEP_SHIFT),
-  POWERSTEP01_FAST_STEP_32us    = (((uint8_t)0x0F)<<POWERSTEP01_FAST_STEP_SHIFT)
-} powerstep01_FastStep_t;
-
-/// Maximum fast decay times (T_FAST register of PowerStep01)
-typedef enum {
-  POWERSTEP01_TOFF_FAST_2us     = (((uint8_t)0x00)<<POWERSTEP01_TOFF_FAST_SHIFT),
-  POWERSTEP01_TOFF_FAST_4us     = (((uint8_t)0x01)<<POWERSTEP01_TOFF_FAST_SHIFT),
-  POWERSTEP01_TOFF_FAST_6us     = (((uint8_t)0x02)<<POWERSTEP01_TOFF_FAST_SHIFT),
-  POWERSTEP01_TOFF_FAST_8us     = (((uint8_t)0x03)<<POWERSTEP01_TOFF_FAST_SHIFT),
-  POWERSTEP01_TOFF_FAST_10us    = (((uint8_t)0x04)<<POWERSTEP01_TOFF_FAST_SHIFT),
-  POWERSTEP01_TOFF_FAST_12us    = (((uint8_t)0x05)<<POWERSTEP01_TOFF_FAST_SHIFT),
-  POWERSTEP01_TOFF_FAST_14us    = (((uint8_t)0x06)<<POWERSTEP01_TOFF_FAST_SHIFT),
-  POWERSTEP01_TOFF_FAST_16us    = (((uint8_t)0x07)<<POWERSTEP01_TOFF_FAST_SHIFT),
-  POWERSTEP01_TOFF_FAST_18us    = (((uint8_t)0x08)<<POWERSTEP01_TOFF_FAST_SHIFT),
-  POWERSTEP01_TOFF_FAST_20us    = (((uint8_t)0x09)<<POWERSTEP01_TOFF_FAST_SHIFT),
-  POWERSTEP01_TOFF_FAST_22us    = (((uint8_t)0x0A)<<POWERSTEP01_TOFF_FAST_SHIFT),
-  POWERSTEP01_TOFF_FAST_24us    = (((uint8_t)0x0B)<<POWERSTEP01_TOFF_FAST_SHIFT),
-  POWERSTEP01_TOFF_FAST_26us    = (((uint8_t)0x0C)<<POWERSTEP01_TOFF_FAST_SHIFT),
-  POWERSTEP01_TOFF_FAST_28us    = (((uint8_t)0x0D)<<POWERSTEP01_TOFF_FAST_SHIFT),
-  POWERSTEP01_TOFF_FAST_30us    = (((uint8_t)0x0E)<<POWERSTEP01_TOFF_FAST_SHIFT),
-  POWERSTEP01_TOFF_FAST_32us    = (((uint8_t)0x0F)<<POWERSTEP01_TOFF_FAST_SHIFT)
-} powerstep01_ToffFast_t;
-
-/// Overcurrent threshold options (OCD register of PowerStep01)
-typedef enum {
-  POWERSTEP01_OCD_TH_31_25mV    = ((uint8_t)0x00),
-  POWERSTEP01_OCD_TH_62_5mV     = ((uint8_t)0x01),
-  POWERSTEP01_OCD_TH_93_75mV    = ((uint8_t)0x02),
-  POWERSTEP01_OCD_TH_125mV      = ((uint8_t)0x03),
-  POWERSTEP01_OCD_TH_156_25mV   = ((uint8_t)0x04),
-  POWERSTEP01_OCD_TH_187_50mV   = ((uint8_t)0x05),
-  POWERSTEP01_OCD_TH_218_75mV   = ((uint8_t)0x06),
-  POWERSTEP01_OCD_TH_250mV      = ((uint8_t)0x07),
-  POWERSTEP01_OCD_TH_281_25mV   = ((uint8_t)0x08),
-  POWERSTEP01_OCD_TH_312_5mV    = ((uint8_t)0x09),
-  POWERSTEP01_OCD_TH_343_75mV   = ((uint8_t)0x0A),
-  POWERSTEP01_OCD_TH_375mV      = ((uint8_t)0x0B),
-  POWERSTEP01_OCD_TH_406_25mV   = ((uint8_t)0x0C),
-  POWERSTEP01_OCD_TH_437_5mV    = ((uint8_t)0x0D),
-  POWERSTEP01_OCD_TH_468_75mV   = ((uint8_t)0x0E),
-  POWERSTEP01_OCD_TH_500mV      = ((uint8_t)0x0F),
-  POWERSTEP01_OCD_TH_531_25mV   = ((uint8_t)0x10),
-  POWERSTEP01_OCD_TH_562_5mV    = ((uint8_t)0x11),
-  POWERSTEP01_OCD_TH_593_75mV   = ((uint8_t)0x12),
-  POWERSTEP01_OCD_TH_625mV      = ((uint8_t)0x13),
-  POWERSTEP01_OCD_TH_656_25mV   = ((uint8_t)0x14),
-  POWERSTEP01_OCD_TH_687_5mV    = ((uint8_t)0x15),
-  POWERSTEP01_OCD_TH_718_75mV   = ((uint8_t)0x16),
-  POWERSTEP01_OCD_TH_750mV      = ((uint8_t)0x17),
-  POWERSTEP01_OCD_TH_781_25mV   = ((uint8_t)0x18),
-  POWERSTEP01_OCD_TH_812_5mV    = ((uint8_t)0x19),
-  POWERSTEP01_OCD_TH_843_75mV   = ((uint8_t)0x1A),
-  POWERSTEP01_OCD_TH_875mV      = ((uint8_t)0x1B),
-  POWERSTEP01_OCD_TH_906_25mV   = ((uint8_t)0x1C),
-  POWERSTEP01_OCD_TH_937_75mV   = ((uint8_t)0x1D),
-  POWERSTEP01_OCD_TH_968_75mV   = ((uint8_t)0x1E),
-  POWERSTEP01_OCD_TH_1V         = ((uint8_t)0x1F)        
-} powerstep01_OcdTh_t;
-
-/// masks for STEP_MODE register of PowerStep01
-typedef enum {
-  POWERSTEP01_STEP_MODE_STEP_SEL    = ((uint8_t)0x07),
-  POWERSTEP01_STEP_MODE_CM_VM       = ((uint8_t)0x08),
-  POWERSTEP01_STEP_MODE_SYNC_SEL    = ((uint8_t)0x70),
-  POWERSTEP01_STEP_MODE_SYNC_EN     = ((uint8_t)0x80)
-} powerstep01_StepModeMasks_t;
-
-/// Voltage or Current mode selection (CM_VM field of STEP_MODE register of PowerStep01)
-typedef enum {
-  POWERSTEP01_CM_VM_VOLTAGE    = ((uint8_t)0x00),
-  POWERSTEP01_CM_VM_CURRENT    = ((uint8_t)0x08)
-} powerstep01_CmVm_t;
-
-/// Stepping options (field STEP_SEL of STEP_MODE register of PowerStep01)
-typedef enum {
-  POWERSTEP01_STEP_SEL_1      = ((uint8_t)0x00),
-  POWERSTEP01_STEP_SEL_1_2    = ((uint8_t)0x01),
-  POWERSTEP01_STEP_SEL_1_4    = ((uint8_t)0x02),
-  POWERSTEP01_STEP_SEL_1_8    = ((uint8_t)0x03),
-  POWERSTEP01_STEP_SEL_1_16   = ((uint8_t)0x04),
-  POWERSTEP01_STEP_SEL_1_32   = ((uint8_t)0x05),
-  POWERSTEP01_STEP_SEL_1_64   = ((uint8_t)0x06),
-  POWERSTEP01_STEP_SEL_1_128  = ((uint8_t)0x07)
-} powerstep01_StepSel_t;
-
-/// Powerstep01 Sync Output frequency enabling bitw
-#define POWERSTEP01_SYNC_EN   ((0x1) << 7)
-
-/// SYNC_SEL options (STEP_MODE register of PowerStep01)
-typedef enum {
-  POWERSTEP01_SYNC_SEL_DISABLED   = ((uint8_t)0x00),
-  POWERSTEP01_SYNC_SEL_1_2        = ((uint8_t)(POWERSTEP01_SYNC_EN|0x00)),
-  POWERSTEP01_SYNC_SEL_1          = ((uint8_t)(POWERSTEP01_SYNC_EN|0x10)),
-  POWERSTEP01_SYNC_SEL_2          = ((uint8_t)(POWERSTEP01_SYNC_EN|0x20)),
-  POWERSTEP01_SYNC_SEL_4          = ((uint8_t)(POWERSTEP01_SYNC_EN|0x30)),
-  POWERSTEP01_SYNC_SEL_8          = ((uint8_t)(POWERSTEP01_SYNC_EN|0x40)),
-  POWERSTEP01_SYNC_SEL_16         = ((uint8_t)(POWERSTEP01_SYNC_EN|0x50)),
-  POWERSTEP01_SYNC_SEL_32         = ((uint8_t)(POWERSTEP01_SYNC_EN|0x60)),
-  POWERSTEP01_SYNC_SEL_64         = ((uint8_t)(POWERSTEP01_SYNC_EN|0x70))
-} powerstep01_SyncSel_t;
-
-/// Alarms conditions (ALARM_EN register of PowerStep01)
-typedef enum {
-  POWERSTEP01_ALARM_EN_OVERCURRENT        = ((uint8_t)0x01),
-  POWERSTEP01_ALARM_EN_THERMAL_SHUTDOWN   = ((uint8_t)0x02),
-  POWERSTEP01_ALARM_EN_THERMAL_WARNING    = ((uint8_t)0x04),
-  POWERSTEP01_ALARM_EN_UVLO               = ((uint8_t)0x08),
-  POWERSTEP01_ALARM_EN_ADC_UVLO           = ((uint8_t)0x10),
-  POWERSTEP01_ALARM_EN_STALL_DETECTION    = ((uint8_t)0x20),
-  POWERSTEP01_ALARM_EN_SW_TURN_ON         = ((uint8_t)0x40),
-  POWERSTEP01_ALARM_EN_WRONG_NPERF_CMD    = ((uint8_t)0x80)
-} powerstep01_AlarmEn_t;
-
-
-/// masks for GATECFG1 register of PowerStep01
-typedef enum {
-  POWERSTEP01_GATECFG1_TCC_MASK    = ((uint16_t)0x001F),
-  POWERSTEP01_GATECFG1_IGATE_MASK  = ((uint16_t)0x00E0),
-  POWERSTEP01_GATECFG1_TBOOST_MASK = ((uint16_t)0x0700),
-  POWERSTEP01_GATECFG1_WD_EN       = ((uint16_t)0x0800)
-} powerstep01_GateCfg1Masks_t;
-
-/// Control current Time (field TCC of GATECFG1 register of PowerStep01)
-typedef enum {
-  POWERSTEP01_TCC_125ns       = (((uint8_t)0x00)<<POWERSTEP01_TCC_SHIFT),
-  POWERSTEP01_TCC_250ns       = (((uint8_t)0x01)<<POWERSTEP01_TCC_SHIFT),
-  POWERSTEP01_TCC_375ns       = (((uint8_t)0x02)<<POWERSTEP01_TCC_SHIFT),
-  POWERSTEP01_TCC_500ns       = (((uint8_t)0x03)<<POWERSTEP01_TCC_SHIFT),
-  POWERSTEP01_TCC_625ns       = (((uint8_t)0x04)<<POWERSTEP01_TCC_SHIFT),
-  POWERSTEP01_TCC_750ns       = (((uint8_t)0x05)<<POWERSTEP01_TCC_SHIFT),
-  POWERSTEP01_TCC_875ns       = (((uint8_t)0x06)<<POWERSTEP01_TCC_SHIFT),
-  POWERSTEP01_TCC_1000ns      = (((uint8_t)0x07)<<POWERSTEP01_TCC_SHIFT),
-  POWERSTEP01_TCC_1125ns      = (((uint8_t)0x08)<<POWERSTEP01_TCC_SHIFT),
-  POWERSTEP01_TCC_1250ns      = (((uint8_t)0x09)<<POWERSTEP01_TCC_SHIFT),
-  POWERSTEP01_TCC_1375ns      = (((uint8_t)0x0A)<<POWERSTEP01_TCC_SHIFT),
-  POWERSTEP01_TCC_1500ns      = (((uint8_t)0x0B)<<POWERSTEP01_TCC_SHIFT),
-  POWERSTEP01_TCC_1625ns      = (((uint8_t)0x0C)<<POWERSTEP01_TCC_SHIFT),
-  POWERSTEP01_TCC_1750ns      = (((uint8_t)0x0D)<<POWERSTEP01_TCC_SHIFT),
-  POWERSTEP01_TCC_1875ns      = (((uint8_t)0x0E)<<POWERSTEP01_TCC_SHIFT),
-  POWERSTEP01_TCC_2000ns      = (((uint8_t)0x0F)<<POWERSTEP01_TCC_SHIFT),
-  POWERSTEP01_TCC_2125ns      = (((uint8_t)0x10)<<POWERSTEP01_TCC_SHIFT),
-  POWERSTEP01_TCC_2250ns      = (((uint8_t)0x11)<<POWERSTEP01_TCC_SHIFT),
-  POWERSTEP01_TCC_2375ns      = (((uint8_t)0x12)<<POWERSTEP01_TCC_SHIFT),
-  POWERSTEP01_TCC_2500ns      = (((uint8_t)0x13)<<POWERSTEP01_TCC_SHIFT),
-  POWERSTEP01_TCC_2625ns      = (((uint8_t)0x14)<<POWERSTEP01_TCC_SHIFT),
-  POWERSTEP01_TCC_2750ns      = (((uint8_t)0x15)<<POWERSTEP01_TCC_SHIFT),
-  POWERSTEP01_TCC_2875ns      = (((uint8_t)0x16)<<POWERSTEP01_TCC_SHIFT),
-  POWERSTEP01_TCC_3000ns      = (((uint8_t)0x17)<<POWERSTEP01_TCC_SHIFT),
-  POWERSTEP01_TCC_3125ns      = (((uint8_t)0x18)<<POWERSTEP01_TCC_SHIFT),
-  POWERSTEP01_TCC_3250ns      = (((uint8_t)0x19)<<POWERSTEP01_TCC_SHIFT),
-  POWERSTEP01_TCC_3375ns      = (((uint8_t)0x1A)<<POWERSTEP01_TCC_SHIFT),
-  POWERSTEP01_TCC_3500ns      = (((uint8_t)0x1B)<<POWERSTEP01_TCC_SHIFT),
-  POWERSTEP01_TCC_3625ns      = (((uint8_t)0x1C)<<POWERSTEP01_TCC_SHIFT),
-  POWERSTEP01_TCC_3750ns      = (((uint8_t)0x1D)<<POWERSTEP01_TCC_SHIFT),
-  POWERSTEP01_TCC_3750ns_bis  = (((uint8_t)0x1E)<<POWERSTEP01_TCC_SHIFT),
-  POWERSTEP01_TCC_3750ns_ter  = (((uint8_t)0x1F)<<POWERSTEP01_TCC_SHIFT)
-} powerstep01_Tcc_t;
-
-/// Igate options (GATECFG1 register of PowerStep01)
-typedef enum {
-  POWERSTEP01_IGATE_4mA     = (((uint8_t)0x00)<<POWERSTEP01_IGATE_SHIFT),
-  POWERSTEP01_IGATE_4mA_Bis = (((uint8_t)0x01)<<POWERSTEP01_IGATE_SHIFT),
-  POWERSTEP01_IGATE_8mA     = (((uint8_t)0x02)<<POWERSTEP01_IGATE_SHIFT),
-  POWERSTEP01_IGATE_16mA    = (((uint8_t)0x03)<<POWERSTEP01_IGATE_SHIFT),
-  POWERSTEP01_IGATE_24mA    = (((uint8_t)0x04)<<POWERSTEP01_IGATE_SHIFT),
-  POWERSTEP01_IGATE_32mA    = (((uint8_t)0x05)<<POWERSTEP01_IGATE_SHIFT),
-  POWERSTEP01_IGATE_64mA    = (((uint8_t)0x06)<<POWERSTEP01_IGATE_SHIFT),
-  POWERSTEP01_IGATE_96mA    = (((uint8_t)0x07)<<POWERSTEP01_IGATE_SHIFT),
-} powerstep01_Igate_t;
-
-/// Turn off boost time (TBOOST field of GATECFG1 register of PowerStep01)
-typedef enum {
-  POWERSTEP01_TBOOST_0ns                = (((uint8_t)0x00)<<POWERSTEP01_TBOOST_SHIFT),
-  POWERSTEP01_TBOOST_62_5__83_3__125ns  = (((uint8_t)0x01)<<POWERSTEP01_TBOOST_SHIFT),
-  POWERSTEP01_TBOOST_125ns              = (((uint8_t)0x02)<<POWERSTEP01_TBOOST_SHIFT),
-  POWERSTEP01_TBOOST_250ns              = (((uint8_t)0x03)<<POWERSTEP01_TBOOST_SHIFT),
-  POWERSTEP01_TBOOST_375ns              = (((uint8_t)0x04)<<POWERSTEP01_TBOOST_SHIFT),
-  POWERSTEP01_TBOOST_500ns              = (((uint8_t)0x05)<<POWERSTEP01_TBOOST_SHIFT),
-  POWERSTEP01_TBOOST_750ns              = (((uint8_t)0x06)<<POWERSTEP01_TBOOST_SHIFT),
-  POWERSTEP01_TBOOST_1000ns             = (((uint8_t)0x07)<<POWERSTEP01_TBOOST_SHIFT),
-} powerstep01_Tboost_t;
-
-/// External clock watchdog (WD_EN field of GATECFG1 register of PowerStep01)
-typedef enum {
-  POWERSTEP01_WD_EN_DISABLE   = ((uint16_t)0x0000),
-  POWERSTEP01_WD_EN_ENABLE    = ((uint16_t) ((0x1) << 11))
-} powerstep01_WdEn_t;
-
-
-/// masks for GATECFG2 register of PowerStep01
-typedef enum {
-  POWERSTEP01_GATECFG2_TDT      = ((uint8_t)0x1F),
-  POWERSTEP01_GATECFG2_TBLANK   = ((uint8_t)0xE0)
-} powerstep01_GateCfg2Masks_t;
-
-/// Blanking time (TBLANK field of GATECFG2 register of PowerStep01)
-typedef enum {
-  POWERSTEP01_TBLANK_125ns    = (((uint8_t)0x00)<<POWERSTEP01_TBLANK_SHIFT),
-  POWERSTEP01_TBLANK_250ns    = (((uint8_t)0x01)<<POWERSTEP01_TBLANK_SHIFT),
-  POWERSTEP01_TBLANK_375ns    = (((uint8_t)0x02)<<POWERSTEP01_TBLANK_SHIFT),
-  POWERSTEP01_TBLANK_500ns    = (((uint8_t)0x03)<<POWERSTEP01_TBLANK_SHIFT),
-  POWERSTEP01_TBLANK_625ns    = (((uint8_t)0x04)<<POWERSTEP01_TBLANK_SHIFT),
-  POWERSTEP01_TBLANK_750ns    = (((uint8_t)0x05)<<POWERSTEP01_TBLANK_SHIFT),
-  POWERSTEP01_TBLANK_875ns    = (((uint8_t)0x06)<<POWERSTEP01_TBLANK_SHIFT),
-  POWERSTEP01_TBLANK_1000ns   = (((uint8_t)0x07)<<POWERSTEP01_TBLANK_SHIFT),
-} powerstep01_TBlank_t;
-
-/// Dead time (TDT field of GATECFG2 register of PowerStep01)
-typedef enum {
-  POWERSTEP01_TDT_125ns   = (((uint8_t)0x00)<<POWERSTEP01_TDT_SHIFT),
-  POWERSTEP01_TDT_250ns   = (((uint8_t)0x01)<<POWERSTEP01_TDT_SHIFT),
-  POWERSTEP01_TDT_375ns   = (((uint8_t)0x02)<<POWERSTEP01_TDT_SHIFT),
-  POWERSTEP01_TDT_500ns   = (((uint8_t)0x03)<<POWERSTEP01_TDT_SHIFT),
-  POWERSTEP01_TDT_625ns   = (((uint8_t)0x04)<<POWERSTEP01_TDT_SHIFT),
-  POWERSTEP01_TDT_750ns   = (((uint8_t)0x05)<<POWERSTEP01_TDT_SHIFT),
-  POWERSTEP01_TDT_875ns   = (((uint8_t)0x06)<<POWERSTEP01_TDT_SHIFT),
-  POWERSTEP01_TDT_1000ns  = (((uint8_t)0x07)<<POWERSTEP01_TDT_SHIFT),
-  POWERSTEP01_TDT_1125ns  = (((uint8_t)0x08)<<POWERSTEP01_TDT_SHIFT),
-  POWERSTEP01_TDT_1250ns  = (((uint8_t)0x09)<<POWERSTEP01_TDT_SHIFT),
-  POWERSTEP01_TDT_1375ns  = (((uint8_t)0x0A)<<POWERSTEP01_TDT_SHIFT),
-  POWERSTEP01_TDT_1500ns  = (((uint8_t)0x0B)<<POWERSTEP01_TDT_SHIFT),
-  POWERSTEP01_TDT_1625ns  = (((uint8_t)0x0C)<<POWERSTEP01_TDT_SHIFT),
-  POWERSTEP01_TDT_1750ns  = (((uint8_t)0x0D)<<POWERSTEP01_TDT_SHIFT),
-  POWERSTEP01_TDT_1875ns  = (((uint8_t)0x0E)<<POWERSTEP01_TDT_SHIFT),
-  POWERSTEP01_TDT_2000ns  = (((uint8_t)0x0F)<<POWERSTEP01_TDT_SHIFT),
-  POWERSTEP01_TDT_2125ns  = (((uint8_t)0x10)<<POWERSTEP01_TDT_SHIFT),
-  POWERSTEP01_TDT_2250ns  = (((uint8_t)0x11)<<POWERSTEP01_TDT_SHIFT),
-  POWERSTEP01_TDT_2375ns  = (((uint8_t)0x12)<<POWERSTEP01_TDT_SHIFT),
-  POWERSTEP01_TDT_2500ns  = (((uint8_t)0x13)<<POWERSTEP01_TDT_SHIFT),
-  POWERSTEP01_TDT_2625ns  = (((uint8_t)0x14)<<POWERSTEP01_TDT_SHIFT),
-  POWERSTEP01_TDT_2750ns  = (((uint8_t)0x15)<<POWERSTEP01_TDT_SHIFT),
-  POWERSTEP01_TDT_2875ns  = (((uint8_t)0x16)<<POWERSTEP01_TDT_SHIFT),
-  POWERSTEP01_TDT_3000ns  = (((uint8_t)0x17)<<POWERSTEP01_TDT_SHIFT),
-  POWERSTEP01_TDT_3125ns  = (((uint8_t)0x18)<<POWERSTEP01_TDT_SHIFT),
-  POWERSTEP01_TDT_3250ns  = (((uint8_t)0x19)<<POWERSTEP01_TDT_SHIFT),
-  POWERSTEP01_TDT_3375ns  = (((uint8_t)0x1A)<<POWERSTEP01_TDT_SHIFT),
-  POWERSTEP01_TDT_3500ns  = (((uint8_t)0x1B)<<POWERSTEP01_TDT_SHIFT),
-  POWERSTEP01_TDT_3625ns  = (((uint8_t)0x1C)<<POWERSTEP01_TDT_SHIFT),
-  POWERSTEP01_TDT_3750ns  = (((uint8_t)0x1D)<<POWERSTEP01_TDT_SHIFT),
-  POWERSTEP01_TDT_3875ns  = (((uint8_t)0x1E)<<POWERSTEP01_TDT_SHIFT),
-  POWERSTEP01_TDT_4000ns  = (((uint8_t)0x1F)<<POWERSTEP01_TDT_SHIFT)
-} powerstep01_Tdt_t;
-
-/// Masks for CONFIG register of Powerstep01 
-typedef enum {
-  POWERSTEP01_CONFIG_OSC_SEL      = ((uint16_t)0x0007),
-  POWERSTEP01_CONFIG_EXT_CLK      = ((uint16_t)0x0008),
-  POWERSTEP01_CONFIG_SW_MODE      = ((uint16_t)0x0010),
-  POWERSTEP01_CONFIG_OC_SD        = ((uint16_t)0x0080),
-  POWERSTEP01_CONFIG_UVLOVAL      = ((uint16_t)0x0100),
-  POWERSTEP01_CONFIG_VCCVAL       = ((uint16_t)0x0200),
-  // Masks specific for voltage mode
-  POWERSTEP01_CONFIG_EN_VSCOMP    = ((uint16_t)0x0020),
-  POWERSTEP01_CONFIG_F_PWM_DEC    = ((uint16_t)0x1C00),
-  POWERSTEP01_CONFIG_F_PWM_INT    = ((uint16_t)0xE000),
-  // Masks specific for current mode
-  POWERSTEP01_CONFIG_TSW          = ((uint16_t)0x7C00),
-  POWERSTEP01_CONFIG_PRED_EN      = ((uint16_t)0x8000)  
-} powerstep01_ConfigMasks_t;
-
-/// Masks for CONFIG register of Powerstep01  (specific for current mode)
-#define POWERSTEP01_CONFIG_EN_TQREG (POWERSTEP01_CONFIG_EN_VSCOMP) 
-
-/// Oscillator management (EXT_CLK and OSC_SEL fields of CONFIG register of Powerstep01)
-typedef enum {
-  POWERSTEP01_CONFIG_INT_16MHZ               = ((uint16_t)0x0000),
-  POWERSTEP01_CONFIG_INT_16MHZ_OSCOUT_2MHZ   = ((uint16_t)0x0008),
-  POWERSTEP01_CONFIG_INT_16MHZ_OSCOUT_4MHZ   = ((uint16_t)0x0009),
-  POWERSTEP01_CONFIG_INT_16MHZ_OSCOUT_8MHZ   = ((uint16_t)0x000A),
-  POWERSTEP01_CONFIG_INT_16MHZ_OSCOUT_16MHZ  = ((uint16_t)0x000B),
-  POWERSTEP01_CONFIG_EXT_8MHZ_XTAL_DRIVE     = ((uint16_t)0x0004),
-  POWERSTEP01_CONFIG_EXT_16MHZ_XTAL_DRIVE    = ((uint16_t)0x0005),
-  POWERSTEP01_CONFIG_EXT_24MHZ_XTAL_DRIVE    = ((uint16_t)0x0006),
-  POWERSTEP01_CONFIG_EXT_32MHZ_XTAL_DRIVE    = ((uint16_t)0x0007),
-  POWERSTEP01_CONFIG_EXT_8MHZ_OSCOUT_INVERT  = ((uint16_t)0x000C),
-  POWERSTEP01_CONFIG_EXT_16MHZ_OSCOUT_INVERT = ((uint16_t)0x000D),
-  POWERSTEP01_CONFIG_EXT_24MHZ_OSCOUT_INVERT = ((uint16_t)0x000E),
-  POWERSTEP01_CONFIG_EXT_32MHZ_OSCOUT_INVERT = ((uint16_t)0x000F)
-} powerstep01_ConfigOscMgmt_t;
-
-/// Oscillator management (EXT_CLK and OSC_SEL fields of CONFIG register of Powerstep01)
-typedef enum {
-  POWERSTEP01_CONFIG_SW_HARD_STOP = ((uint16_t)0x0000),
-  POWERSTEP01_CONFIG_SW_USER      = ((uint16_t)0x0010)
-} powerstep01_ConfigSwMode_t;
-
-/// Voltage supply compensation enabling for voltage mode (EN_VSCOMP field of CONFIG register of Powerstep01)
-typedef enum {
-  POWERSTEP01_CONFIG_VS_COMP_DISABLE  = ((uint16_t)0x0000),
-  POWERSTEP01_CONFIG_VS_COMP_ENABLE   = ((uint16_t)0x0020)
-} powerstep01_ConfigEnVscomp_t;
-
-/// External torque regulation enabling (EN_TQREG field of CONFIG register of Powerstep01)
-typedef enum {
-  POWERSTEP01_CONFIG_TQ_REG_TVAL_USED = ((uint16_t)0x0000),
-  POWERSTEP01_CONFIG_TQ_REG_ADC_OUT   = ((uint16_t)0x0020)
-} powerstep01_ConfigEnTqReg_t;
-
-/// Overcurrent shutdown (OC_SD field of CONFIG register of Powerstep01)
-typedef enum {
-  POWERSTEP01_CONFIG_OC_SD_DISABLE  = ((uint16_t)0x0000),
-  POWERSTEP01_CONFIG_OC_SD_ENABLE   = ((uint16_t)0x0080)
-} powerstep01_ConfigOcSd_t;
-
-/// UVLO thresholds (UVLOVAL field of CONFIG register of Powerstep01)
-typedef enum {
-  POWERSTEP01_CONFIG_UVLOVAL_LOW      = ((uint16_t)0x0000),
-  POWERSTEP01_CONFIG_UVLOVAL_HIGH     = ((uint16_t)0x0100),
-} powerstep01_ConfigUvLoVal_t;
-
-/// Vcc voltage  (VCCVAL field of CONFIG register of Powerstep01)
-typedef enum {
-  POWERSTEP01_CONFIG_VCCVAL_7_5V    = ((uint16_t)0x0000),
-  POWERSTEP01_CONFIG_VCCVAL_15V     = ((uint16_t)0x0200)
-} powerstep01_ConfigVccVal_t;
-
-/// PWM frequency division factor (F_PWM_INT field of CONFIG register of Powerstep01)
-typedef enum {
-  POWERSTEP01_CONFIG_PWM_DIV_1    = (((uint16_t)0x00)<<POWERSTEP01_CONFIG_PWM_DIV_SHIFT),
-  POWERSTEP01_CONFIG_PWM_DIV_2    = (((uint16_t)0x01)<<POWERSTEP01_CONFIG_PWM_DIV_SHIFT),
-  POWERSTEP01_CONFIG_PWM_DIV_3    = (((uint16_t)0x02)<<POWERSTEP01_CONFIG_PWM_DIV_SHIFT),
-  POWERSTEP01_CONFIG_PWM_DIV_4    = (((uint16_t)0x03)<<POWERSTEP01_CONFIG_PWM_DIV_SHIFT),
-  POWERSTEP01_CONFIG_PWM_DIV_5    = (((uint16_t)0x04)<<POWERSTEP01_CONFIG_PWM_DIV_SHIFT),
-  POWERSTEP01_CONFIG_PWM_DIV_6    = (((uint16_t)0x05)<<POWERSTEP01_CONFIG_PWM_DIV_SHIFT),
-  POWERSTEP01_CONFIG_PWM_DIV_7    = (((uint16_t)0x06)<<POWERSTEP01_CONFIG_PWM_DIV_SHIFT)
-} powerstep01_ConfigFPwmInt_t;
-
-/// PWM frequency multiplication factor (F_PWM_DEC field of CONFIG register of Powerstep01)
-typedef enum {
-  POWERSTEP01_CONFIG_PWM_MUL_0_625  = (((uint16_t)0x00)<<POWERSTEP01_CONFIG_PWM_MUL_SHIFT),
-  POWERSTEP01_CONFIG_PWM_MUL_0_75   = (((uint16_t)0x01)<<POWERSTEP01_CONFIG_PWM_MUL_SHIFT),
-  POWERSTEP01_CONFIG_PWM_MUL_0_875  = (((uint16_t)0x02)<<POWERSTEP01_CONFIG_PWM_MUL_SHIFT),
-  POWERSTEP01_CONFIG_PWM_MUL_1      = (((uint16_t)0x03)<<POWERSTEP01_CONFIG_PWM_MUL_SHIFT),
-  POWERSTEP01_CONFIG_PWM_MUL_1_25   = (((uint16_t)0x04)<<POWERSTEP01_CONFIG_PWM_MUL_SHIFT),
-  POWERSTEP01_CONFIG_PWM_MUL_1_5    = (((uint16_t)0x05)<<POWERSTEP01_CONFIG_PWM_MUL_SHIFT),
-  POWERSTEP01_CONFIG_PWM_MUL_1_75   = (((uint16_t)0x06)<<POWERSTEP01_CONFIG_PWM_MUL_SHIFT),
-  POWERSTEP01_CONFIG_PWM_MUL_2      = (((uint16_t)0x07)<<POWERSTEP01_CONFIG_PWM_MUL_SHIFT)
-} powerstep01_ConfigFPwmDec_t;
-
-/// Switching period  (TSW field of CONFIG register of Powerstep01)
-typedef enum {
-  POWERSTEP01_CONFIG_TSW_004us    =(((uint16_t)0x01)<<POWERSTEP01_CONFIG_TSW_SHIFT),
-  POWERSTEP01_CONFIG_TSW_008us    =(((uint16_t)0x02)<<POWERSTEP01_CONFIG_TSW_SHIFT),
-  POWERSTEP01_CONFIG_TSW_012us    =(((uint16_t)0x03)<<POWERSTEP01_CONFIG_TSW_SHIFT),
-  POWERSTEP01_CONFIG_TSW_016us    =(((uint16_t)0x04)<<POWERSTEP01_CONFIG_TSW_SHIFT),
-  POWERSTEP01_CONFIG_TSW_020us    =(((uint16_t)0x05)<<POWERSTEP01_CONFIG_TSW_SHIFT),
-  POWERSTEP01_CONFIG_TSW_024us    =(((uint16_t)0x06)<<POWERSTEP01_CONFIG_TSW_SHIFT),
-  POWERSTEP01_CONFIG_TSW_028us    =(((uint16_t)0x07)<<POWERSTEP01_CONFIG_TSW_SHIFT),
-  POWERSTEP01_CONFIG_TSW_032us    =(((uint16_t)0x08)<<POWERSTEP01_CONFIG_TSW_SHIFT),
-  POWERSTEP01_CONFIG_TSW_036us    =(((uint16_t)0x09)<<POWERSTEP01_CONFIG_TSW_SHIFT),
-  POWERSTEP01_CONFIG_TSW_040us    =(((uint16_t)0x0A)<<POWERSTEP01_CONFIG_TSW_SHIFT),
-  POWERSTEP01_CONFIG_TSW_044us    =(((uint16_t)0x0B)<<POWERSTEP01_CONFIG_TSW_SHIFT),
-  POWERSTEP01_CONFIG_TSW_048us    =(((uint16_t)0x0C)<<POWERSTEP01_CONFIG_TSW_SHIFT),
-  POWERSTEP01_CONFIG_TSW_052us    =(((uint16_t)0x0D)<<POWERSTEP01_CONFIG_TSW_SHIFT),
-  POWERSTEP01_CONFIG_TSW_056us    =(((uint16_t)0x0E)<<POWERSTEP01_CONFIG_TSW_SHIFT),
-  POWERSTEP01_CONFIG_TSW_060us    =(((uint16_t)0x0F)<<POWERSTEP01_CONFIG_TSW_SHIFT),
-  POWERSTEP01_CONFIG_TSW_064us    =(((uint16_t)0x10)<<POWERSTEP01_CONFIG_TSW_SHIFT),
-  POWERSTEP01_CONFIG_TSW_068us    =(((uint16_t)0x11)<<POWERSTEP01_CONFIG_TSW_SHIFT),
-  POWERSTEP01_CONFIG_TSW_072us    =(((uint16_t)0x12)<<POWERSTEP01_CONFIG_TSW_SHIFT),
-  POWERSTEP01_CONFIG_TSW_076us    =(((uint16_t)0x13)<<POWERSTEP01_CONFIG_TSW_SHIFT),
-  POWERSTEP01_CONFIG_TSW_080us    =(((uint16_t)0x14)<<POWERSTEP01_CONFIG_TSW_SHIFT),
-  POWERSTEP01_CONFIG_TSW_084us    =(((uint16_t)0x15)<<POWERSTEP01_CONFIG_TSW_SHIFT),
-  POWERSTEP01_CONFIG_TSW_088us    =(((uint16_t)0x16)<<POWERSTEP01_CONFIG_TSW_SHIFT),
-  POWERSTEP01_CONFIG_TSW_092us    =(((uint16_t)0x17)<<POWERSTEP01_CONFIG_TSW_SHIFT),
-  POWERSTEP01_CONFIG_TSW_096us    =(((uint16_t)0x18)<<POWERSTEP01_CONFIG_TSW_SHIFT),
-  POWERSTEP01_CONFIG_TSW_100us    =(((uint16_t)0x19)<<POWERSTEP01_CONFIG_TSW_SHIFT),
-  POWERSTEP01_CONFIG_TSW_104us    =(((uint16_t)0x1A)<<POWERSTEP01_CONFIG_TSW_SHIFT),
-  POWERSTEP01_CONFIG_TSW_108us    =(((uint16_t)0x1B)<<POWERSTEP01_CONFIG_TSW_SHIFT),
-  POWERSTEP01_CONFIG_TSW_112us    =(((uint16_t)0x1C)<<POWERSTEP01_CONFIG_TSW_SHIFT),
-  POWERSTEP01_CONFIG_TSW_116us    =(((uint16_t)0x1D)<<POWERSTEP01_CONFIG_TSW_SHIFT),
-  POWERSTEP01_CONFIG_TSW_120us    =(((uint16_t)0x1E)<<POWERSTEP01_CONFIG_TSW_SHIFT),
-  POWERSTEP01_CONFIG_TSW_124us    =(((uint16_t)0x1F)<<POWERSTEP01_CONFIG_TSW_SHIFT)        
-} powerstep01_ConfigTsw_t;
-
-/// Voltage supply compensation enabling for current mode(EN_PRED field of CONFIG register of Powerstep01)
-typedef enum {
-  POWERSTEP01_CONFIG_PRED_DISABLE =((uint16_t)0x0000),
-  POWERSTEP01_CONFIG_PRED_ENABLE  =((uint16_t)0x8000)
-} powerstep01_ConfigPredEn_t;
-
-/// Bit mask for STATUS Register of PowerStep01²
-typedef enum {
-  POWERSTEP01_STATUS_HIZ          = (((uint16_t)0x0001)),
-  POWERSTEP01_STATUS_BUSY         = (((uint16_t)0x0002)),
-  POWERSTEP01_STATUS_SW_F         = (((uint16_t)0x0004)),
-  POWERSTEP01_STATUS_SW_EVN       = (((uint16_t)0x0008)),
-  POWERSTEP01_STATUS_DIR          = (((uint16_t)0x0010)),
-  POWERSTEP01_STATUS_MOT_STATUS   = (((uint16_t)0x0060)),
-  POWERSTEP01_STATUS_CMD_ERROR    = (((uint16_t)0x0080)),
-  POWERSTEP01_STATUS_STCK_MOD     = (((uint16_t)0x0100)),
-  POWERSTEP01_STATUS_UVLO         = (((uint16_t)0x0200)),
-  POWERSTEP01_STATUS_UVLO_ADC     = (((uint16_t)0x0400)),
-  POWERSTEP01_STATUS_TH_STATUS    = (((uint16_t)0x1800)),
-  POWERSTEP01_STATUS_OCD          = (((uint16_t)0x2000)),
-  POWERSTEP01_STATUS_STALL_A      = (((uint16_t)0x4000)),
-  POWERSTEP01_STATUS_STALL_B      = (((uint16_t)0x8000))
-} powerstep01_StatusMasks_t;
-
-/// Motor state (MOT_STATUS filed of STATUS register of PowerStep01)
-typedef enum {
-  POWERSTEP01_STATUS_MOT_STATUS_STOPPED       = (((uint16_t)0x0000)<<POWERSTEP01_STATUS_MOT_STATUS_SHIFT),
-  POWERSTEP01_STATUS_MOT_STATUS_ACCELERATION  = (((uint16_t)0x0001)<<POWERSTEP01_STATUS_MOT_STATUS_SHIFT),
-  POWERSTEP01_STATUS_MOT_STATUS_DECELERATION  = (((uint16_t)0x0002)<<POWERSTEP01_STATUS_MOT_STATUS_SHIFT),
-  POWERSTEP01_STATUS_MOT_STATUS_CONST_SPD     = (((uint16_t)0x0003)<<POWERSTEP01_STATUS_MOT_STATUS_SHIFT)
-} powerstep01_Status_t;
-
-/// Powerstep01 internal register addresses
-typedef enum {
-  POWERSTEP01_ABS_POS     = ((uint8_t)0x01),
-  POWERSTEP01_EL_POS      = ((uint8_t)0x02),
-  POWERSTEP01_MARK        = ((uint8_t)0x03), 
-  POWERSTEP01_SPEED       = ((uint8_t)0x04),
-  POWERSTEP01_ACC         = ((uint8_t)0x05),
-  POWERSTEP01_DEC         = ((uint8_t)0x06),
-  POWERSTEP01_MAX_SPEED   = ((uint8_t)0x07),
-  POWERSTEP01_MIN_SPEED   = ((uint8_t)0x08),
-  POWERSTEP01_FS_SPD      = ((uint8_t)0x15),
-  POWERSTEP01_KVAL_HOLD   = ((uint8_t)0x09),
-  POWERSTEP01_KVAL_RUN    = ((uint8_t)0x0A),
-  POWERSTEP01_KVAL_ACC    = ((uint8_t)0x0B),
-  POWERSTEP01_KVAL_DEC    = ((uint8_t)0x0C),
-  POWERSTEP01_INT_SPD     = ((uint8_t)0x0D),
-  POWERSTEP01_ST_SLP      = ((uint8_t)0x0E),
-  POWERSTEP01_FN_SLP_ACC  = ((uint8_t)0x0F),
-  POWERSTEP01_FN_SLP_DEC  = ((uint8_t)0x10),
-  POWERSTEP01_K_THERM     = ((uint8_t)0x11),
-  POWERSTEP01_ADC_OUT     = ((uint8_t)0x12),
-  POWERSTEP01_OCD_TH      = ((uint8_t)0x13),
-  POWERSTEP01_STALL_TH    = ((uint8_t)0x14),
-  POWERSTEP01_STEP_MODE   = ((uint8_t)0x16),
-  POWERSTEP01_ALARM_EN    = ((uint8_t)0x17),
-  POWERSTEP01_GATECFG1    = ((uint8_t)0x18),
-  POWERSTEP01_GATECFG2    = ((uint8_t)0x19),
-  POWERSTEP01_CONFIG      = ((uint8_t)0x1A),
-  POWERSTEP01_STATUS      = ((uint8_t)0x1B)
-} powerstep01_Registers_t;
-
-/// Powerstep01 address of register TVAL_HOLD (Current mode only)
-#define   POWERSTEP01_TVAL_HOLD  (POWERSTEP01_KVAL_HOLD )   
-/// Powerstep01 address of register TVAL_RUN (Current mode only)
-#define   POWERSTEP01_TVAL_RUN   (POWERSTEP01_KVAL_RUN)   
-/// Powerstep01 address of register TVAL_HOLD (Current mode only)
-#define   POWERSTEP01_TVAL_ACC   (POWERSTEP01_KVAL_ACC)   
-/// Powerstep01 address of register TVAL_DEC (Current mode only)
-#define   POWERSTEP01_TVAL_DEC   (POWERSTEP01_KVAL_DEC)   
-/// Powerstep01 address of register T_FAST  (Current mode only)
-#define   POWERSTEP01_T_FAST     (POWERSTEP01_ST_SLP)   
-/// Powerstep01 address of register TON_MIN  (Current mode only)
-#define   POWERSTEP01_TON_MIN    (POWERSTEP01_FN_SLP_ACC)
-/// Powerstep01 address of register TOFF_MIN (Current mode only)
-#define   POWERSTEP01_TOFF_MIN   (POWERSTEP01_FN_SLP_DEC)
-
-/// Powerstep01 application commands
-typedef enum {
-  POWERSTEP01_NOP               = ((uint8_t)0x00),
-  POWERSTEP01_SET_PARAM         = ((uint8_t)0x00),
-  POWERSTEP01_GET_PARAM         = ((uint8_t)0x20),
-  POWERSTEP01_RUN               = ((uint8_t)0x50),
-  POWERSTEP01_STEP_CLOCK        = ((uint8_t)0x58),
-  POWERSTEP01_MOVE              = ((uint8_t)0x40),
-  POWERSTEP01_GO_TO             = ((uint8_t)0x60),
-  POWERSTEP01_GO_TO_DIR         = ((uint8_t)0x68),
-  POWERSTEP01_GO_UNTIL          = ((uint8_t)0x82),
-  POWERSTEP01_GO_UNTIL_ACT_CPY  = ((uint8_t)0x8A),
-  POWERSTEP01_RELEASE_SW        = ((uint8_t)0x92),
-  POWERSTEP01_GO_HOME           = ((uint8_t)0x70),
-  POWERSTEP01_GO_MARK           = ((uint8_t)0x78),
-  POWERSTEP01_RESET_POS         = ((uint8_t)0xD8),
-  POWERSTEP01_RESET_DEVICE      = ((uint8_t)0xC0),
-  POWERSTEP01_SOFT_STOP         = ((uint8_t)0xB0),
-  POWERSTEP01_HARD_STOP         = ((uint8_t)0xB8),
-  POWERSTEP01_SOFT_HIZ          = ((uint8_t)0xA0),
-  POWERSTEP01_HARD_HIZ          = ((uint8_t)0xA8),
-  POWERSTEP01_GET_STATUS        = ((uint8_t)0xD0),
-  POWERSTEP01_RESERVED_CMD1     = ((uint8_t)0xEB),
-  POWERSTEP01_RESERVED_CMD2     = ((uint8_t)0xF8)
-} powerstep01_Commands_t;
-
-/** @defgroup Motor_Driver_Initialization_Structure Motor Driver Initialization Structure
-  * @{
-  */
-/* 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;                                                      *
- *----------------------------------------------------------------------------*/
-///Initialization parameters structure common to current and voltage modes
-typedef struct
-{
-  ///Current or voltage mode selection
-  powerstep01_CmVm_t cmVmSelection;
-  ///Acceleration 
-  float acceleration;
-  ///Deceleration
-  float deceleration;
-  ///Maximum speed
-  float maxSpeed;
-  ///Minimum speed
-  float minSpeed;
-  ///Low speed optimization bit
-  powerstep01_LspdOpt_t lowSpeedOptimization;
-  ///Full step speed
-  float fullStepSpeed;
-  ///Boost mode bit
-  powerstep01_BoostMode_t boostMode;
-  ///Over current detection threshold
-  float ocdThreshold;
-  ///Step mode
-  motorStepMode_t stepMode;
-  ///Sync clock selection
-  powerstep01_SyncSel_t syncClockSelection;
-  ///Alarm selection
-  uint8_t alarmsSelection;
-  ///Sink or source current used by gate driving circuitry
-  powerstep01_Igate_t iGate;
-  ///Duration of the overboost phase during gate turn-off
-  powerstep01_Tboost_t tBoost;
-  ///Duration of constant current phase during gate turn-on and turn-off
-  powerstep01_Tcc_t tcc;
-  ///Clock source monitoring enable bit
-  powerstep01_WdEn_t wdEn;
-  ///Duration of the blanking of the current sensing comparators
-  powerstep01_TBlank_t tBlank;
-  ///Deadtime duration between gate turn-off and opposite gate turn-on
-  powerstep01_Tdt_t tdt;  
-} commonParameters_t;
-
-///Initialization parameters structure for voltage mode
-typedef struct
-{
-  ///Parameters common to current and voltage modes
-  commonParameters_t cp;
-  ///Voltage amplitude regulation when the motor is stopped
-  float kvalHold;
-  ///Voltage amplitude regulation when the motor is running at constant speed
-  float kvalRun;
-  ///Voltage amplitude regulation during motor acceleration
-  float kvalAcc;
-  ///Voltage amplitude regulation during motor deceleration
-  float kvalDec;
-  ///Speed value at which the BEMF compensation curve changes slope  
-  float intersectSpeed;
-  ///BEMF compensation curve slope when speed is lower than intersect speed
-  float startSlope;
-  ///BEMF compensation curve slope when speed is greater than intersect speed during acceleration
-  float accelerationFinalSlope;
-  ///BEMF compensation curve slope when speed is greater than intersect speed during deceleration
-  float decelerationFinalSlope;
-  ///Winding resistance thermal drift compensation coefficient
-  float thermalCompensationFactor;
-  ///Stall detection threshold
-  float stallThreshold;
-  ///System clock source management
-  powerstep01_ConfigOscMgmt_t oscClkSel;
-  ///External switch to act as hard_stop interrupt or not
-  powerstep01_ConfigSwMode_t swMode;
-  ///Motor supply voltage compensation enable bit
-  powerstep01_ConfigEnVscomp_t enVsComp;
-  ///Overcurrent event causes or not the bridges to turn-off
-  powerstep01_ConfigOcSd_t ocSd;
-  ///UVLO protection thresholds
-  powerstep01_ConfigUvLoVal_t uvloVal;
-  ///Internal VCC regulator output voltage
-  powerstep01_ConfigVccVal_t vccVal;
-  ///Integer division factor of PWM frequency generation
-  powerstep01_ConfigFPwmInt_t fPwmInt;
-  ///Multiplication factor of PWM frequency generation
-  powerstep01_ConfigFPwmDec_t fPwmDec;
-} powerstep01_VoltageMode_init_t;
-
-///Initialization parameters structure for current mode
-typedef struct
-{
-  ///Parameters common to current and voltage modes
-  commonParameters_t cp;
-  ///Torque regulation DAC reference voltage when motor is stopped
-  float tvalHold;
-  ///Torque regulation DAC reference voltage when motor is runnig at constant speed
-  float tvalRun;
-  ///Torque regulation DAC reference voltage during motor acceleration
-  float tvalAcc;
-  ///Torque regulation DAC reference voltage during motor deceleration
-  float tvalDec;
-  ///Maximum fast decay time
-  powerstep01_ToffFast_t toffFast;
-  ///Maximum fall step time
-  powerstep01_FastStep_t fastStep;
-  ///Minimum on-time
-  float tonMin;
-  ///Minimum off-time
-  float toffMin;
-  ///System clock source management
-  powerstep01_ConfigOscMgmt_t oscClkSel;
-  ///External switch to act as hard_stop interrupt or not
-  powerstep01_ConfigSwMode_t swMode;
-  ///Peak current is adjusted through the ADCIN input or not
-  powerstep01_ConfigEnTqReg_t tqReg;
-  ///Motor supply voltage compensation enable bit
-  powerstep01_ConfigEnVscomp_t enVsComp;
-  ///Overcurrent event causes or not the bridges to turn-off
-  powerstep01_ConfigOcSd_t ocSd;
-  ///UVLO protection thresholds
-  powerstep01_ConfigUvLoVal_t uvloVal;
-  ///Internal VCC regulator output voltage
-  powerstep01_ConfigVccVal_t vccVal;
-  ///target switching period
-  powerstep01_ConfigTsw_t tsw;
-  ///predictive current control method enable bit
-  powerstep01_ConfigPredEn_t predEn;
-
-} powerstep01_CurrentMode_init_t;
-
-///Union of current and volatge modes initialization parameters structures
-typedef union powerstep01_init_u powerstep01_init_u_t;
-union powerstep01_init_u
-{
-  ///Initialization parameters structure for current mode
-  powerstep01_CurrentMode_init_t cm;
-  ///Initialization parameters structure for voltage mode
-  powerstep01_VoltageMode_init_t vm;
-};
-/**
-  * @}
-  */
-  
-/** 
- * @brief  Powerstep01 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;                                                      *
- *----------------------------------------------------------------------------*/
-
-/**
-  * @}
-  */
-
-/* Functions -----------------------------------------------------------------*/
-
-/** @defgroup Powerstep01_Board_Linked_Functions Powerstep01 Board Linked 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);                             *
- *----------------------------------------------------------------------------*/
-///Delay of the requested number of milliseconds
-extern void Powerstep01_Board_Delay(void *handle, uint32_t delay);
-///Enable Irq
-extern void Powerstep01_Board_EnableIrq(void *handle);
-///Disable Irq
-extern void Powerstep01_Board_DisableIrq(void *handle);
-///init the timer for the step clock
-extern void Powerstep01_Board_StepClockInit(void *handle);
-///Set the Powerstep01 reset pin (high logic level)
-extern void Powerstep01_Board_ReleaseReset(void *handle);           
-///Reset the Powerstep01 reset pin (low logic level)
-extern void Powerstep01_Board_Reset(void *handle);                  
-///Write bytes to the Powerstep01s via SPI
-extern uint8_t Powerstep01_Board_SpiWriteBytes(void *handle, uint8_t *pByteToTransmit, uint8_t *pReceivedByte);
-
-
-/**
-  * @}
-  */
-
-  /**
-  * @}
-  */
-
-  /**
-  * @}
-  */
-
-#ifdef __cplusplus
-  }
-#endif
-
-#endif /* #ifndef _POWERSTEP01_H_INCLUDED */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
--- a/Components/powerstep01/powerstep01.h	Fri Mar 24 10:58:48 2017 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1495 +0,0 @@
-/**
- ******************************************************************************
- * @file    PowerStep01.h
- * @author  IPC Rennes
- * @version V1.0.1
- * @date    September 13th, 2016
- * @brief   This file contains the class of a Powerstep01 Motor Control component.
- * @note    (C) COPYRIGHT 2016 STMicroelectronics
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; COPYRIGHT(c) 2016 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 __POWERSTEP01_CLASS_H
-#define __POWERSTEP01_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 "PowerStep01.h"
-/* ACTION 3 ------------------------------------------------------------------*
- * Include here interface specific header files.                              *
- *                                                                            *
- * Example:                                                                   *
- *   #include "HumiditySensor.h"                                              *
- *   #include "TemperatureSensor.h"                                           *
- *----------------------------------------------------------------------------*/
-#include "StepperMotor.h"
-
-
-/* Classes -------------------------------------------------------------------*/
-
-/**
- * @brief Class representing a Powerstep01 component.
- */
-class PowerStep01 : public StepperMotor
-{
-public:
-
-    /*** 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 pwm           pin name of the PWM 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.
-     */
-    PowerStep01(PinName flag_irq, PinName busy_irq, PinName standby_reset, PinName pwm, PinName ssel, DevSPI &spi) : StepperMotor(), flag_irq(flag_irq), busy_irq(busy_irq), standby_reset(standby_reset), pwm(pwm), ssel(ssel), dev_spi(spi)
-    {
-        /* Checking stackability. */
-        if (!(numberOfDevices < MAX_NUMBER_OF_DEVICES))
-            error("Instantiation of the PowerStep01 component failed: it can be stacked up to %d times.\r\n", MAX_NUMBER_OF_DEVICES);
-
-        /* ACTION 4 ----------------------------------------------------------*
-         * Initialize here the component's member variables, one variable per *
-         * line.                                                              *
-         *                                                                    *
-         * Example:                                                           *
-         *   measure = 0;                                                     *
-         *   instance_id = number_of_instances++;                             *
-         *--------------------------------------------------------------------*/
-        errorHandlerCallback = 0;
-        deviceInstance = numberOfDevices++;
-        memset(spiTxBursts, 0, POWERSTEP01_CMD_ARG_MAX_NB_BYTES * MAX_NUMBER_OF_DEVICES * sizeof(uint8_t));
-        memset(spiRxBursts, 0, POWERSTEP01_CMD_ARG_MAX_NB_BYTES * MAX_NUMBER_OF_DEVICES * sizeof(uint8_t));
-    }
-    
-    /**
-     * @brief Destructor.
-     */
-    virtual ~PowerStep01(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 *pData) //(1)                             *
-     *   {                                                                    *
-     *     return COMPONENT_GetValue(float *pfData);                          *
-     *   }                                                                    *
-     *                                                                        *
-     *   virtual int EnableFeature(void) //(2)                                *
-     *   {                                                                    *
-     *     return COMPONENT_EnableFeature();                                  *
-     *   }                                                                    *
-     *------------------------------------------------------------------------*/
-
-    /**
-     * @brief Public functions inherited from the Component Class
-     */
-
-    /**
-     * @brief  Initialize 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 = NULL)
-    {
-        return (int) Powerstep01_Init((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 = NULL)
-    {
-        return (int) Powerstep01_ReadID((uint8_t *) id);
-    }
-
-    /**
-     * @brief Public functions inherited from the StepperMotor Class
-     */
-
-    /**
-     * @brief  Getting the value of the Status Register.
-     * @param  None.
-     * @retval None.
-     * @note   The Status Register's flags are cleared, contrary to read_status_register().
-     */
-    virtual unsigned int get_status(void)
-    {
-        return (unsigned int) Powerstep01_CmdGetStatus();
-    }
-
-    /**
-     * @brief  Getting the position.
-     * @param  None.
-     * @retval The position.
-     */
-    virtual signed int get_position(void)
-    {
-        return (signed int)Powerstep01_GetPosition();
-    }
-
-    /**
-     * @brief  Getting the marked position.
-     * @param  None.
-     * @retval The marked position.
-     */
-    virtual signed int get_mark(void)
-    {
-        return (signed int)Powerstep01_GetMark();
-    }
-
-    /**
-     * @brief  Getting the current speed in step/s.
-     * @param  None.
-     * @retval The current speed in step/s.
-     */
-    virtual unsigned int get_speed(void)
-    {
-        return (unsigned int)round(Powerstep01_GetAnalogValue(POWERSTEP01_SPEED));
-    }
-
-    /**
-     * @brief  Getting the maximum speed in step/s.
-     * @param  None.
-     * @retval The maximum speed in step/s.
-     */
-    virtual unsigned int get_max_speed(void)
-    {
-        return (unsigned int)round(Powerstep01_GetAnalogValue(POWERSTEP01_MAX_SPEED));
-    }
-
-    /**
-     * @brief  Getting the minimum speed in step/s.
-     * @param  None.
-     * @retval The minimum speed in step/s.
-     */
-    virtual unsigned int get_min_speed(void)
-    {
-        return (unsigned int)round(Powerstep01_GetAnalogValue(POWERSTEP01_MIN_SPEED));
-    }
-
-    /**
-     * @brief  Getting the acceleration in step/s^2.
-     * @param  None.
-     * @retval The acceleration in step/s^2.
-     */
-    virtual unsigned int get_acceleration(void)
-    {
-        return (unsigned int)round(Powerstep01_GetAnalogValue(POWERSTEP01_ACC));
-    }
-
-    /**
-     * @brief  Getting the deceleration in step/s^2.
-     * @param  None.
-     * @retval The deceleration in step/s^2.
-     */
-    virtual unsigned int get_deceleration(void)
-    {
-        return (unsigned int)round(Powerstep01_GetAnalogValue(POWERSTEP01_DEC));
-    }
-    
-    /**
-     * @brief  Getting the direction of rotation.
-     * @param  None.
-     * @retval The direction of rotation.
-     */
-    virtual direction_t get_direction(void)
-    {
-        if ((POWERSTEP01_STATUS_DIR&Powerstep01_ReadStatusRegister())!=0)
-        {
-            return FWD;
-        }
-        else
-        {
-            return BWD;
-        }
-    }
-    
-    /**
-     * @brief  Setting the current position to be the home position.
-     * @param  None.
-     * @retval None.
-     */
-    virtual void set_home(void)
-    {
-        Powerstep01_SetHome();
-    }
-
-    /**
-     * @brief  Setting the current position to be the marked position.
-     * @param  None.
-     * @retval None.
-     */
-    virtual void set_mark(void)
-    {
-        Powerstep01_SetMark();
-    }
-
-    /**
-     * @brief  Setting the maximum speed in steps/s.
-     * @param  speed The maximum speed in steps/s.
-     * @retval TRUE if value is valid, FALSE otherwise.
-     */
-    virtual bool set_max_speed(unsigned int speed)
-    {
-        return Powerstep01_SetAnalogValue(POWERSTEP01_MAX_SPEED, (float)speed);
-    }
-
-    /**
-     * @brief  Setting the minimum speed in steps/s.
-     * @param  speed The minimum speed in steps/s.
-     * @retval TRUE if value is valid, FALSE otherwise.
-     */
-    virtual bool set_min_speed(unsigned int speed)
-    {
-        return Powerstep01_SetAnalogValue(POWERSTEP01_MIN_SPEED, (float)speed);
-    }
-
-    /**
-     * @brief  Setting the acceleration in steps/s^2.
-     * @param  acceleration The acceleration in steps/s^2.
-     * @retval None.
-     */
-    virtual bool set_acceleration(unsigned int acceleration)
-    {
-        return Powerstep01_SetAnalogValue(POWERSTEP01_ACC, (float)acceleration);
-    }
-
-    /**
-     * @brief  Setting the deceleration in steps/s^2.
-     * @param  deceleration The deceleration in steps/s^2.
-     * @retval None.
-     */
-    virtual bool set_deceleration(unsigned int deceleration)
-    {
-        return Powerstep01_SetAnalogValue(POWERSTEP01_DEC, (float)deceleration);
-    }
-
-    /**
-     * @brief  Setting the Step Mode.
-     * @param  step_mode The Step Mode.
-     * @retval None.
-     * @note   step_mode can be one of the following:
-     *           + STEP_MODE_FULL
-     *           + STEP_MODE_HALF
-     *           + STEP_MODE_1_4
-     *           + STEP_MODE_1_8
-     *           + STEP_MODE_1_16
-     *           + STEP_MODE_1_32
-     *           + STEP_MODE_1_64
-     *           + STEP_MODE_1_128
-     */
-    virtual bool set_step_mode(step_mode_t step_mode)
-    {
-        return Powerstep01_SelectStepMode((motorStepMode_t) step_mode);
-    }
-
-    /**
-     * @brief  Going to a specified position.
-     * @param  position The desired position.
-     * @retval None.
-     */
-    virtual void go_to(signed int position)
-    {
-        Powerstep01_CmdGoTo((int32_t)position);
-    }
-
-    virtual void go_to(direction_t direction, signed int position)
-    {
-        Powerstep01_CmdGoToDir((motorDir_t) (direction == StepperMotor::FWD ? FORWARD : BACKWARD),(int32_t)position);
-    }
-
-    /**
-     * @brief  Going to the home position.
-     * @param  None.
-     * @retval None.
-     */
-    virtual void go_home(void)
-    {
-        Powerstep01_CmdGoHome();
-    }
-
-    /**
-     * @brief  Going to the marked position.
-     * @param  None.
-     * @retval None.
-     */
-    virtual void go_mark(void)
-    {
-        Powerstep01_CmdGoMark();
-    }
-
-    /**
-     * @brief  Running the motor towards a specified direction.
-     * @param  direction The direction of rotation.
-     * @retval None.
-     */
-    virtual void run(direction_t direction)
-    {
-        Powerstep01_CmdRun((motorDir_t) (direction == StepperMotor::FWD ? FORWARD : BACKWARD), Powerstep01_CmdGetParam((powerstep01_Registers_t) POWERSTEP01_MAX_SPEED));
-    }
-
-    /**
-     * @brief  Moving the motor towards a specified direction for a certain number of steps.
-     * @param  direction The direction of rotation.
-     * @param  steps The desired number of steps.
-     * @retval None.
-     */
-    virtual void move(direction_t direction, unsigned int steps)
-    {
-        Powerstep01_CmdMove((motorDir_t) (direction == StepperMotor::FWD ? FORWARD : BACKWARD), (uint32_t)steps);
-    }
-
-    /**
-     * @brief  Stopping the motor through an immediate deceleration up to zero speed.
-     * @param  None.
-     * @retval None.
-     */
-    virtual void soft_stop(void)
-    {
-        Powerstep01_CmdSoftStop();
-    }
-
-    /**
-     * @brief  Stopping the motor through an immediate infinite deceleration.
-     * @param  None.
-     * @retval None.
-     */
-    virtual void hard_stop(void)
-    {
-        Powerstep01_CmdHardStop();
-    }
-
-    /**
-     * @brief  Disabling the power bridge after performing a deceleration to zero.
-     * @param  None.
-     * @retval None.
-     */
-    virtual void soft_hiz(void)
-    {
-        Powerstep01_CmdSoftHiZ();
-    }
-
-    /**
-     * @brief  Disabling the power bridge immediately.
-     * @param  None.
-     * @retval None.
-     */
-    virtual void hard_hiz(void)
-    {
-        Powerstep01_CmdHardHiZ();
-    }
-
-    /**
-     * @brief  Waiting while the motor is active.
-     * @param  None.
-     * @retval None.
-     */
-    virtual void wait_while_active(void)
-    {
-        Powerstep01_WaitWhileActive();
-    }  
-
-    /**
-     * @brief Public functions NOT inherited
-     */
-     
-    /**
-     * @brief  Attaching an error handler.
-     * @param  fptr An error handler.
-     * @retval None.
-     */
-    virtual void attach_error_handler(void (*fptr)(uint16_t error))
-    {
-        Powerstep01_AttachErrorHandler((void (*)(uint16_t error)) fptr);
-    }
-    
-    /**
-     * @brief  Checks if the device is busy by reading the busy pin position.
-     * @param  None.
-     * @retval One if the device his busy (low logic level on busy output),
-     * otherwise zero
-     */
-    virtual int check_busy_hw(void)
-    {
-        if (busy_irq!=0) return 0x01;
-        else return 0x00;
-    }
-
-    /**
-     * @brief  Checks if the device has an alarm flag set by reading the flag pin position.
-     * @param  None.
-     * @retval One if the device has an alarm flag set (low logic level on flag output),
-     * otherwise zero
-     */
-    virtual unsigned int check_status_hw(void)
-    {
-        if (flag_irq!=0) return 0x01;
-        else return 0x00;
-    }
-    
-    /**
-     * @brief Fetch and clear status flags of all devices 
-     * by issuing a GET_STATUS command simultaneously  
-     * to all devices.
-     * Then, the fetched status of each device can be retrieved
-     * by using the Powerstep01_GetFetchedStatus function
-     * provided there is no other calls to functions which 
-     * use the SPI in between.
-     * @retval None
-     */
-    virtual void fetch_and_clear_all_status(void)
-    {
-        Powerstep01_FetchAndClearAllStatus();
-    }
-
-    /**
-     * @brief  Getting a parameter float value.
-     * @param  parameter A parameter's register adress.
-     * @retval The parameter's float value.
-     *         parameter can be one of the following:
-     *           + POWERSTEP01_ABS_POS
-     *           + POWERSTEP01_MARK
-     *           + POWERSTEP01_ACC
-     *           + POWERSTEP01_DEC
-     *           + POWERSTEP01_SPEED     
-     *           + POWERSTEP01_MAX_SPEED
-     *           + POWERSTEP01_MIN_SPEED
-     *           + POWERSTEP01_FS_SPD
-     *           (voltage mode) + POWERSTEP01_INT_SPD
-     *           (voltage mode) + POWERSTEP01_K_THERM
-     *           + POWERSTEP01_OCD_TH
-     *           (voltage mode) + POWERSTEP01_STALL_TH
-     *           (voltage mode) + POWERSTEP01_KVAL_HOLD : value in %
-     *           (current mode) + POWERSTEP01_TVAL_HOLD : value in mV
-     *           (voltage mode) + POWERSTEP01_KVAL_RUN  : value in %
-     *           (current mode) + POWERSTEP01_TVAL_RUN  : value in mV
-     *           (voltage mode) + POWERSTEP01_KVAL_ACC  : value in %
-     *           (current mode) + POWERSTEP01_TVAL_ACC  : value in mV
-     *           (voltage mode) + POWERSTEP01_KVAL_DEC  : value in %
-     *           (current mode) + POWERSTEP01_TVAL_DEC  : value in mV
-     *           (voltage mode) + POWERSTEP01_ST_SLP
-     *           (voltage mode) + POWERSTEP01_FN_SLP_ACC
-     *           (voltage mode) + POWERSTEP01_FN_SLP_DEC
-     */
-    virtual float get_analog_value(unsigned int parameter)
-    {
-      return Powerstep01_GetAnalogValue((powerstep01_Registers_t)parameter);
-    }
-
-    /**
-     * @brief Get the value of the STATUS register which was 
-     * fetched by using Powerstep01_FetchAndClearAllStatus.
-     * The fetched values are available  as long as there
-     * no other calls to functions which use the SPI.
-     * @retval Last fetched value of the STATUS register.
-     */ 
-    virtual uint16_t get_fetched_status(void)
-    {
-        return Powerstep01_GetFetchedStatus();
-    }
-
-    /**
-     * @brief  Getting the version of the firmware.
-     * @param  None.
-     * @retval The version of the firmware.
-     */
-    virtual unsigned int get_fw_version(void)
-    {
-        return (unsigned int) Powerstep01_GetFwVersion();
-    }
-
-    /**
-     * @brief  Getting a parameter register value.
-     * @param  parameter A parameter's register adress.
-     * @retval The parameter's register value.
-     *         parameter can be one of the following:
-     *           + POWERSTEP01_ABS_POS
-     *           + POWERSTEP01_EL_POS
-     *           + POWERSTEP01_MARK
-     *           + POWERSTEP01_SPEED
-     *           + POWERSTEP01_ACC
-     *           + POWERSTEP01_DEC
-     *           + POWERSTEP01_MAX_SPEED
-     *           + POWERSTEP01_MIN_SPEED
-     *           (voltage mode) + POWERSTEP01_KVAL_HOLD : value in %
-     *           (current mode) + POWERSTEP01_TVAL_HOLD : value in mV
-     *           (voltage mode) + POWERSTEP01_KVAL_RUN  : value in %
-     *           (current mode) + POWERSTEP01_TVAL_RUN  : value in mV
-     *           (voltage mode) + POWERSTEP01_KVAL_ACC  : value in %
-     *           (current mode) + POWERSTEP01_TVAL_ACC  : value in mV
-     *           (voltage mode) + POWERSTEP01_KVAL_DEC  : value in %
-     *           (current mode) + POWERSTEP01_TVAL_DEC  : value in mV
-     *           (voltage mode) + POWERSTEP01_INT_SPD
-     *           (voltage mode) + POWERSTEP01_ST_SLP
-     *           (current mode) + POWERSTEP01_T_FAST
-     *           (voltage mode) + POWERSTEP01_FN_SLP_ACC
-     *           (current mode) + POWERSTEP01_TON_MIN
-     *           (voltage mode) + POWERSTEP01_FN_SLP_DEC
-     *           (current mode) + POWERSTEP01_TOFF_MIN
-     *           (voltage mode) + POWERSTEP01_K_THERM
-     *           + POWERSTEP01_ADC_OUT
-     *           + POWERSTEP01_OCD_TH
-     *           (voltage mode) + POWERSTEP01_STALL_TH
-     *           + POWERSTEP01_FS_SPD
-     *           + POWERSTEP01_STEP_MODE
-     *           + POWERSTEP01_ALARM_EN
-     *           + POWERSTEP01_GATECFG1
-     *           + POWERSTEP01_GATECFG2
-     *           + POWERSTEP01_CONFIG
-     *           + POWERSTEP01_STATUS
-     */
-    virtual unsigned int get_raw_parameter(unsigned int parameter)
-    {
-      return (unsigned int) Powerstep01_CmdGetParam((powerstep01_Registers_t)parameter);
-    }
-    
-    /**
-     * @brief  Issues PowerStep01 Go Until command.
-     * @param  action type of action to undertake when the SW
-     * input is forced high (ACTION_RESET or ACTION_COPY).
-     * @param  direction The direction of rotation.
-     * @param  speed in steps/s.
-     * @retval One if the device has an alarm flag set (low logic level on flag output),
-     * otherwise zero
-     */    
-    virtual void go_until(motorAction_t action, direction_t direction, float speed)
-    {
-        Powerstep01_CmdGoUntil(action,
-                               (motorDir_t) (direction == StepperMotor::FWD ? FORWARD : BACKWARD),
-                               speed_steps_s_to_reg_val(speed));
-    }
-    
-    /**
-     * @brief Checks if the device is busy
-     * by reading the Busy flag bit ot its status Register
-     * This operation clears the status register
-     * @retval true if device is busy, false zero  
-     */
-    virtual bool is_device_busy(void)
-    {
-        return Powerstep01_IsDeviceBusy();
-    }
-
-    /**
-     * @brief Put commands in queue before synchronous sending
-     * done by calling send_queued_commands.
-     * Any call to functions that use the SPI between the calls of 
-     * queue_commands and send_queued_commands 
-     * will corrupt the queue.
-     * A command for each device of the daisy chain must be 
-     * specified before calling send_queued_commands.
-     * @param command Command to queue (all Powerstep01 commmands 
-     * except POWERSTEP01_SET_PARAM, POWERSTEP01_GET_PARAM, 
-     * POWERSTEP01_GET_STATUS).
-     * @param value argument of the command to queue.
-     * @retval None.
-     */
-    virtual void queue_commands(uint8_t command, int32_t value)
-    {
-        Powerstep01_QueueCommands(command, value);
-    }
-    
-    /**
-     * @brief  Reading the Status Register.
-     * @param  None.
-     * @retval None.
-     * @note   The Status Register's flags are not cleared, contrary to get_status().
-     */
-    virtual uint16_t read_status_register(void)
-    {
-        return Powerstep01_ReadStatusRegister();
-    }
-    
-    /**
-     * @brief  Issues PowerStep01 Release SW command.
-     * @param  action type of action to undertake when the SW
-     * input is forced high (ACTION_RESET or ACTION_COPY).
-     * @param  direction The direction of rotation.
-     * @param  speed in steps/s.
-     * @retval One if the device has an alarm flag set (low logic level on flag output),
-     * otherwise zero
-     */  
-    virtual void release_sw(motorAction_t action, direction_t direction)
-    {
-        Powerstep01_CmdReleaseSw(action,
-                                 (motorDir_t) (direction == StepperMotor::FWD ? FORWARD : BACKWARD));
-    }
-    
-    /**
-     * @brief  Issues PowerStep01 Reset Device command.
-     * @param  None.
-     * @retval None.
-     */
-    virtual void reset_command(void)
-    {
-        Powerstep01_CmdResetDevice();
-    }
-
-    /**
-     * @brief  Issues PowerStep01 ResetPos command.
-     * @param  None.
-     * @retval None.
-     * @note   Same effect as set_home().
-     */
-    virtual void reset_position(void)
-    {
-        Powerstep01_CmdResetPos();
-    }
-
-    /**
-     * @brief  Running the motor towards a specified direction.
-     * @param  direction The direction of rotation.
-     * @param  speed in steps/s.
-     * @retval None.
-     */
-    virtual void run(direction_t direction, float speed)
-    {
-        Powerstep01_CmdRun((motorDir_t) (direction == StepperMotor::FWD ? FORWARD : BACKWARD), speed_steps_s_to_reg_val(speed));
-    }
-        
-    /**
-     * @brief Sends commands stored previously in the queue by queue_commands.
-     * @param  None.
-     * @retval None.
-     */ 
-    virtual void send_queued_commands(void)
-    {
-        Powerstep01_SendQueuedCommands();
-    }
-    
-    /**
-     * @brief  Setting a parameter with an input float value.
-     * @param  param Register adress.
-     * @param  value Float value to convert and set into the register.
-     * @retval TRUE if param and value are valid, FALSE otherwise
-     * @note   parameter can be one of the following:
-     *           + POWERSTEP01_EL_POS
-     *           + POWERSTEP01_ABS_POS
-     *           + POWERSTEP01_MARK
-     *           + POWERSTEP01_ACC
-     *           + POWERSTEP01_DEC
-     *           + POWERSTEP01_MAX_SPEED
-     *           + POWERSTEP01_MIN_SPEED
-     *           + POWERSTEP01_FS_SPD
-     *           + POWERSTEP01_INT_SPD
-     *           + POWERSTEP01_K_THERM
-     *           + POWERSTEP01_OCD_TH
-     *           + POWERSTEP01_STALL_TH
-     *           + POWERSTEP01_KVAL_HOLD
-     *           + POWERSTEP01_KVAL_RUN
-     *           + POWERSTEP01_KVAL_ACC
-     *           + POWERSTEP01_KVAL_DEC
-     *           + POWERSTEP01_ST_SLP
-     *           + POWERSTEP01_FN_SLP_ACC
-     *           + POWERSTEP01_FN_SLP_DEC
-     *           + POWERSTEP01_TVAL_HOLD
-     *           + POWERSTEP01_TVAL_RUN
-     *           + POWERSTEP01_TVAL_ACC
-     *           + POWERSTEP01_TVAL_DEC
-     *           + POWERSTEP01_TON_MIN
-     *           + POWERSTEP01_TOFF_MIN
-     */
-    virtual bool set_analog_value(unsigned int param, float value)
-    {
-      return Powerstep01_SetAnalogValue((powerstep01_Registers_t)param, value);
-    }
-    
-    /**
-     * @brief  Setting a parameter.
-     * @param  parameter A parameter's register adress.
-     * @param  value The parameter's value.
-     * @retval None.
-     *         parameter can be one of the following:
-     *           + POWERSTEP01_ABS_POS
-     *           + POWERSTEP01_EL_POS
-     *           + POWERSTEP01_MARK
-     *           + POWERSTEP01_ACC
-     *           + POWERSTEP01_DEC
-     *           + POWERSTEP01_MAX_SPEED
-     *           + POWERSTEP01_MIN_SPEED
-     *           (voltage mode) + POWERSTEP01_KVAL_HOLD : value in %
-     *           (current mode) + POWERSTEP01_TVAL_HOLD : value in mV
-     *           (voltage mode) + POWERSTEP01_KVAL_RUN  : value in %
-     *           (current mode) + POWERSTEP01_TVAL_RUN  : value in mV
-     *           (voltage mode) + POWERSTEP01_KVAL_ACC  : value in %
-     *           (current mode) + POWERSTEP01_TVAL_ACC  : value in mV
-     *           (voltage mode) + POWERSTEP01_KVAL_DEC  : value in %
-     *           (current mode) + POWERSTEP01_TVAL_DEC  : value in mV
-     *           (voltage mode) + POWERSTEP01_INT_SPD
-     *           (voltage mode) + POWERSTEP01_ST_SLP
-     *           (current mode) + POWERSTEP01_T_FAST
-     *           (voltage mode) + POWERSTEP01_FN_SLP_ACC
-     *           (current mode) + POWERSTEP01_TON_MIN
-     *           (voltage mode) + POWERSTEP01_FN_SLP_DEC
-     *           (current mode) + POWERSTEP01_TOFF_MIN
-     *           (voltage mode) + POWERSTEP01_K_THERM
-     *           + POWERSTEP01_ADC_OUT
-     *           + POWERSTEP01_OCD_TH
-     *           (voltage mode) + POWERSTEP01_STALL_TH
-     *           + POWERSTEP01_FS_SPD
-     *           + POWERSTEP01_STEP_MODE
-     *           + POWERSTEP01_ALARM_EN
-     *           + POWERSTEP01_GATECFG1
-     *           + POWERSTEP01_GATECFG2
-     *           + POWERSTEP01_CONFIG
-     */
-    virtual void set_raw_parameter(unsigned int parameter, unsigned int value)
-    {
-        Powerstep01_CmdSetParam((powerstep01_Registers_t)parameter, (uint32_t)value);
-    }
-    
-    /**
-     * @brief  Enable the step clock mode.
-     * @param  frequency the frequency of PWM.
-     * @retval None.
-     */
-    virtual void step_clock_mode_enable(direction_t direction)
-    {
-        Powerstep01_CmdStepClock((motorDir_t) (direction == StepperMotor::FWD ? FORWARD : BACKWARD));
-    }
-    
-    /**
-     * @brief  Setting the frequency of PWM.
-     *         The frequency controls directly the speed of the device.
-     * @param  frequency the frequency of PWM.
-     * @retval None.
-     */
-    virtual void step_clock_start(uint16_t frequency)
-    {
-        /* Computing the period of PWM. */
-        double period = 1.0f / frequency;
-        
-        /* Setting the period and the duty-cycle of PWM. */
-        pwm.period(period);
-        pwm.write(0.5f);
-    }
-
-    /**
-     * @brief  Stopping the PWM.
-     * @param  None.
-     * @retval None.
-     */
-    virtual void step_clock_stop(void)
-    {
-        pwm.write(0.0f);
-    }
-    
-    /**
-     * @brief Public static functions
-     */    
-
-    static uint8_t get_nb_devices(void)
-    {
-        return numberOfDevices;
-    }
-
-    /**
-     * @brief To and from register parameter conversion functions
-     */
-     
-    /**********************************************************
-     * @brief Convert the float formatted acceleration or
-     * deceleration into respectively an ACC or DEC register value
-     * @param[in] steps_s2 the acceleration or deceleration as
-     * steps/s^2, range 14.55 to 59590 steps/s^2
-     * @retval The acceleration or deceleration as steps/tick^2
-     **********************************************************/
-    static uint16_t acc_dec_steps_s2_to_reg_val(float steps_s2)
-    {
-        return ((uint16_t)(((float)(steps_s2)*0.068719476736f)+0.5f));
-    }
-    
-    /**********************************************************
-     * @brief Convert the ACC or DEC register value into step/s^2
-     * @param[in] regVal The ACC or DEC register value
-     * @retval The speed as steps/s
-     **********************************************************/
-    static float acc_dec_reg_val_to_steps_s2(uint32_t regVal)
-    {
-        return (((float)(regVal))*14.5519152283f);
-    }
-    
-    /**********************************************************
-     * @brief Converts BEMF compensation slope to values for ST_SLP,
-     * FN_SLP_ACC or FN_SLP_DEC register
-     * @param[in] percentage BEMF compensation slope percentage,
-     * range 0 to 0.4% (0.004) s/step
-     * @retval value for ST_SLP, FN_SLP_ACC or FN_SLP_DEC register
-     **********************************************************/
-    static uint8_t bemf_slope_perc_to_reg_val(float percentage)
-    {
-        return ((uint8_t)(((float)(percentage)*637.5f)+0.5f));
-    }
-    
-    /**********************************************************
-     * @brief Converts values from ST_SLP, FN_SLP_ACC or
-     * FN_SLP_DEC register to BEMF compensation slope percentage
-     * @param[in] regVal The ST_SLP, FN_SLP_ACC or FN_SLP_DEC
-     * register value
-     * @retval BEMF compensation slope percentage
-     **********************************************************/
-    static float bemf_slope_reg_val_to_perc(uint32_t regVal)
-    {
-        return (((float)(regVal))*0.00156862745098f);
-    }
-          
-    /**********************************************************
-     * @brief Convert the float formatted speed into a FS_SPD 
-     * register value
-     * @param[in] steps_s the speed as steps/s, range 15.25 to 15610 steps/s
-     * @retval The speed as steps/tick
-     **********************************************************/
-    static uint16_t fs_spd_steps_s_to_reg_val(float steps_s)
-    {
-        return ((uint16_t)((float)(steps_s)*0.065536f));
-    }
-    
-    /**********************************************************
-     * @brief Convert the FS_SPD register value into step/s
-     * @param[in] regVal The FS_SPD register value
-     * @retval The full Step speed as steps/s
-     **********************************************************/
-    static float fs_spd_reg_val_to_steps_s(uint32_t regVal)
-    {
-        return (((float)regVal+0.999f)*15.258789f);
-    }
-    
-    /**********************************************************
-     * @brief Convert the float formatted speed into a INT_SPEED 
-     * register value
-     * @param[in] steps_s the speed as steps/s, range 0 to 976.5 steps/s
-     * @retval The intersect speed as steps/tick
-     **********************************************************/
-    static uint16_t int_spd_steps_s_to_reg_val(float steps_s)
-    {
-        return ((uint16_t)(((float)(steps_s)*16.777216f)+0.5f));
-    }
-    
-    /**********************************************************
-     * @brief Convert the INT_SPEED register value into step/s
-     * @param[in] regVal The INT_SPEED register value
-     * @retval The speed as steps/s
-     **********************************************************/
-    static float int_spd_reg_val_to_steps_s(uint32_t regVal)
-    {
-        return (((float)(regVal))*0.0596045f);
-    }
-    
-    /**********************************************************
-     * @brief Convert the float formatted thermal compensation
-     * factor into a K_THERM register value
-     * @param[in] compFactor the float formatted thermal 
-     * compensation factor, range 1 to 1.46875
-     * @retval value for K_THERM register
-     **********************************************************/
-    static uint8_t k_therm_comp_to_reg_val(float compFactor)
-    {
-        return ((uint8_t)((((float)(compFactor)-1.0f)*32.0f)+0.5f));
-    }
-    
-    /**********************************************************
-     * @brief Convert the K_THERM register value into a float 
-     * formatted thermal compensation factor
-     * @param[in] regVal The K_THERM register value
-     * @retval The float formatted thermal compensation factor
-     **********************************************************/
-    static float k_therm_reg_val_to_comp(uint32_t regVal)
-    {
-        return (((float)(regVal))*0.03125f+1);
-    }
-    
-    /**********************************************************
-     * @brief Converts voltage in percentage to values for KVAL_RUN,
-     * KVAL_HOLD, KVAL_ACC or KVAL_DEC register
-     * @param[in] percentage percentage of the power supply voltage
-     * applied to the motor windings, range 0.4% to 99.6%
-     * @retval value for KVAL_RUN, KVAL_HOLD, KVAL_ACC or
-     * KVAL_DEC register
-     * @note The voltage applied is sinusoidal
-     **********************************************************/
-    static uint8_t k_val_perc_to_reg_val(float percentage)
-    {
-        return ((uint8_t)(((float)(percentage)*2.56f)+0.5f));
-    }
-    
-    /**********************************************************
-     * @brief Converts values from KVAL_RUN, KVAL_HOLD, KVAL_ACC
-     * or KVAL_DEC register to percentage
-     * @param[in] regVal The KVAL_RUN, KVAL_HOLD, KVAL_ACC
-     * or KVAL_DEC register value
-     * @retval percentage of the power supply voltage applied to
-     * the motor windings
-     * @note The voltage applied is sinusoidal
-     **********************************************************/
-    static float k_val_reg_val_to_perc(uint32_t regVal)
-    {
-        return (((float)(regVal))*0.390625f);
-    }
-    
-    /**********************************************************
-     * @brief Convert the float formatted speed into a MAX_SPEED 
-     * register value
-     * @param[in] steps_s the speed as steps/s, range 15.25 to 15610 steps/s
-     * @retval The speed as steps/tick
-     **********************************************************/
-    static uint16_t max_spd_steps_s_to_reg_val(float steps_s)
-    {
-        return ((uint16_t)(((float)(steps_s)*0.065536f)+0.5f));
-    }
-    
-    /**********************************************************
-     * @brief Convert the MAX_SPEED register value into step/s
-     * @param[in] regVal The MAX_SPEED register value
-     * @retval The speed as steps/s
-     **********************************************************/
-    static float max_spd_reg_val_to_steps_s(uint32_t regVal)
-    {
-        return (((float)(regVal))*15.258789f);
-    }
-    
-    /**********************************************************
-     * @brief Convert the float formatted speed into a MIN_SPEED 
-     * register value
-     * @param[in] steps_s the speed as steps/s, range 0 to 976.3 steps/s
-     * @retval The speed as steps/tick
-     **********************************************************/
-    static uint16_t min_spd_steps_s_to_reg_val(float steps_s)
-    {
-        return ((uint16_t)(((float)(steps_s)*4.194304f)+0.5f));
-    }
-    
-    /**********************************************************
-     * @brief Convert the MIN_SPEED register value into step/s
-     * @param[in] regVal The MIN_SPEED register value
-     * @retval The speed as steps/s
-     **********************************************************/
-    static float min_spd_reg_val_to_steps_s(uint32_t regVal)
-    {
-        return (((float)(regVal))*0.238418579f);
-    }
-    
-    /**********************************************************
-     * @brief Convert the float formatted speed into a SPEED 
-     * register value
-     * @param[in] steps_s the speed as steps/s, range 0 to 15625 steps/s
-     * @retval The speed as steps/tick
-     **********************************************************/
-    static uint32_t speed_steps_s_to_reg_val(float steps_s)
-    {
-        return ((uint32_t)(((float)(steps_s)*67.108864f)+0.5f));
-    }
-    
-    /**********************************************************
-     * @brief Convert the SPEED register value into step/s
-     * @param[in] regVal The SPEED register value
-     * @retval The speed as steps/s
-     **********************************************************/
-    static float speed_reg_val_to_steps_s(uint32_t regVal)
-    {
-        return (((float)(regVal))*0.01490116119f);
-    }
-    
-    /**********************************************************
-     * @brief Converts STALL or OCD Threshold voltage in mV to 
-     * values for STALL_TH or OCD_TH register
-     * @param[in] mV voltage in mV, range 31.25mV to 1000mV
-     * @retval value for STALL_TH or OCD_TH register
-     **********************************************************/
-    static uint8_t stall_ocd_th_to_reg_val(float mV)
-    {
-        return ((uint8_t)((((float)(mV)-31.25f)*0.032f)+0.5f));
-    }
-    
-    /**********************************************************
-     * @brief Converts values from STALL_TH or OCD_TH register 
-     * to mV
-     * @param[in] regVal The STALL_TH or OCD_TH register value
-     * @retval voltage in mV
-     **********************************************************/
-    static float stall_ocd_reg_val_to_th(uint32_t regVal)
-    {
-        return (((float)(regVal+1))*31.25f);
-    }
-    
-    /**********************************************************
-     * @brief Converts voltage in mV to values for TVAL_RUN,
-     * TVAL_HOLD, TVAL_ACC or TVAL_DEC register
-     * @param[in] voltage_mV voltage in mV, range 7.8mV to 1000mV
-     * @retval value for TVAL_RUN, TVAL_HOLD, TVAL_ACC or
-     * TVAL_DEC register
-     * @note The voltage corresponds to a peak output current
-     * accross the external sense power resistor
-     **********************************************************/
-    static uint8_t t_val_ref_voltage_to_reg_val(float voltage_mV)
-    {
-        return ((uint8_t)((((float)(voltage_mV)-7.8125f)*0.128f)+0.5f));
-    }
-    
-    /**********************************************************
-     * @brief Converts values from TVAL_RUN, TVAL_HOLD, TVAL_ACC
-     * or TVAL_DEC register to mV
-     * @param[in] regVal The TVAL_RUN, TVAL_HOLD, TVAL_ACC
-     * or TVAL_DEC register value
-     * @retval voltage in mV
-     * @note The voltage corresponds to a peak output current
-     * accross the external sense power resistor
-     **********************************************************/
-    static float t_val_reg_val_to_ref_voltage(uint32_t regVal)
-    {
-        return (((float)(regVal+1))*7.8125f);
-    }
-    
-    /**********************************************************
-     * @brief Convert time in us to values for TON_MIN register
-     * @param[in] tmin_us time in us, range 0.5us to 64us
-     * @retval value for TON_MIN register
-     **********************************************************/
-    static uint8_t t_min_time_to_reg_val(float tmin_us)
-    {
-        return ((uint8_t)((((float)(tmin_us)-0.5f)*2.0f)+0.5f));
-    }
-    
-    /**********************************************************
-     * @brief Convert values for TON_MIN or TOFF_MIN register to time in us
-     * @param[in] regVal The TON_MIN or TOFF_MIN register value
-     * @retval time in us
-     **********************************************************/
-    static float t_min_reg_val_to_time(uint32_t regVal)
-    {
-        return (((float)(regVal+1))*0.5f);
-    }
-    
-    /*** 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 ***/
-
-    /* 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)                      *
-     *------------------------------------------------------------------------*/
-    status_t Powerstep01_Init(void *init);
-    status_t Powerstep01_ReadID(uint8_t *id);
-    void Powerstep01_AttachErrorHandler(void (*callback)(uint16_t error));
-    uint8_t Powerstep01_CheckBusyHw(void);
-    uint8_t Powerstep01_CheckStatusHw(void);
-    uint16_t Powerstep01_CmdGetStatus(void);
-    void Powerstep01_CmdGoHome(void);
-    void Powerstep01_CmdGoMark(void);
-    void Powerstep01_CmdGoTo(int32_t targetPosition);
-    void Powerstep01_CmdGoToDir(motorDir_t direction, int32_t targetPosition);
-    void Powerstep01_CmdGoUntil(motorAction_t action, motorDir_t direction, uint32_t speed);
-    void Powerstep01_CmdHardHiZ(void);
-    void Powerstep01_CmdHardStop(void);
-    void Powerstep01_CmdMove(motorDir_t direction, uint32_t stepCount);
-    void Powerstep01_CmdNop(void);
-    void Powerstep01_CmdReleaseSw(motorAction_t action, motorDir_t direction);
-    void Powerstep01_CmdResetDevice(void);
-    void Powerstep01_CmdResetPos(void);
-    void Powerstep01_CmdRun(motorDir_t direction, uint32_t speed);
-    void Powerstep01_CmdSoftHiZ(void);
-    void Powerstep01_CmdSoftStop(void);
-    void Powerstep01_CmdStepClock(motorDir_t direction);
-    void Powerstep01_ErrorHandler(uint16_t error);
-    void Powerstep01_FetchAndClearAllStatus(void); 
-    uint16_t Powerstep01_GetFetchedStatus(void);
-    uint32_t Powerstep01_GetFwVersion(void);
-    int32_t Powerstep01_GetMark(void);
-    int32_t Powerstep01_GetPosition(void);
-    bool Powerstep01_IsDeviceBusy(void);
-    uint16_t Powerstep01_ReadStatusRegister(void);
-    bool Powerstep01_SelectStepMode(motorStepMode_t stepMode);
-    void Powerstep01_SetHome(void);
-    void Powerstep01_SetMark(void);
-    void Powerstep01_WaitForAllDevicesNotBusy(void);
-    void Powerstep01_WaitWhileActive(void);
-
-    /**
-     * @brief To and from register parameter conversion functions
-     */
-    int32_t Powerstep01_ConvertPosition(uint32_t abs_position_reg);
-
-    /**
-     * @brief Functions to initialize the registers
-     */
-    void Powerstep01_SetDeviceParamsToGivenValues(powerstep01_init_u_t *initPrm);
-    void Powerstep01_SetRegisterToPredefinedValues(void);
-    
-    /**
-     * @brief Functions to get and set parameters using digital or analog values
-     */
-    uint32_t Powerstep01_CmdGetParam(powerstep01_Registers_t param);
-    void Powerstep01_CmdSetParam(powerstep01_Registers_t param, uint32_t value);
-    float Powerstep01_GetAnalogValue(powerstep01_Registers_t param);
-    void Powerstep01_QueueCommands(uint8_t command, int32_t value);
-    void Powerstep01_SendCommand(uint8_t command, uint32_t value);
-    void Powerstep01_SendQueuedCommands(void);
-    bool Powerstep01_SetAnalogValue(powerstep01_Registers_t param, float value);
-    void Powerstep01_WriteBytes(uint8_t *pByteToTransmit, uint8_t *pReceivedByte);    
-    
-    /**
-     * @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 Powerstep01.
-     * @param[out] pBuffer pointer to the buffer to read data into.
-     * @param  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 Powerstep01.
-     * @param  pBuffer pointer to the buffer of data to send.
-     * @param  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 Powerstep01 at the same time.
-     * @param[out] pBufferToRead pointer to the buffer to read data into.
-     * @param  pBufferToWrite pointer to the buffer of data to send.
-     * @param  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.   *
-     *------------------------------------------------------------------------*/
-    /**
-     * @brief  Making the CPU wait.
-     * @param  None.
-     * @retval None.
-     */
-    void Powerstep01_Board_Delay(uint32_t delay)
-    {
-        wait_ms(delay);
-    }
-
-    /**
-     * @brief  Enabling interrupts.
-     * @param  None.
-     * @retval None.
-     */
-    void Powerstep01_Board_EnableIrq(void)
-    {
-        __enable_irq();
-    }
-
-    /**
-     * @brief  Disabling interrupts.
-     * @param  None.
-     * @retval None.
-     */
-    void Powerstep01_Board_DisableIrq(void)
-    {
-        __disable_irq();
-    }
-
-    /**
-     * @brief  Initialising the PWM.
-     * @param  None.
-     * @retval None.
-     */
-    void Powerstep01_Board_StepClockInit(void) {}
-
-    /**
-     * @brief  Exit the device from reset mode.
-     * @param  None.
-     * @retval None.
-     */
-    void Powerstep01_Board_Releasereset(void)
-    {
-        standby_reset = 1;
-    }
-
-    /**
-     * @brief  Put the device in reset mode.
-     * @param  None.
-     * @retval None.
-     */
-    void Powerstep01_Board_reset(void)
-    {
-        standby_reset = 0;
-    }
-
-    /**
-     * @brief      Writing and reading bytes to/from the component through the SPI at the same time.
-     * @param  pByteToTransmit pointer to the buffer of data to send.
-     * @param[out] pReceivedByte pointer to the buffer to read data into.
-     * @retval     "0" in case of success, "1" otherwise.
-     */
-    uint8_t Powerstep01_Board_SpiWriteBytes(uint8_t *pByteToTransmit, uint8_t *pReceivedByte)
-    {
-        return (uint8_t) (ReadWrite(pReceivedByte, pByteToTransmit, numberOfDevices) == COMPONENT_OK ? 0 : 1);
-    }
-
-
-    /*** 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;
-
-    /* Pulse Width Modulation pin. */
-    PwmOut pwm;
-
-    /* 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. */
-    void (*errorHandlerCallback)(uint16_t error);
-    uint8_t deviceInstance;
-
-    /* Static data. */
-    static uint8_t numberOfDevices;
-    static uint8_t spiTxBursts[POWERSTEP01_CMD_ARG_MAX_NB_BYTES][MAX_NUMBER_OF_DEVICES];
-    static uint8_t spiRxBursts[POWERSTEP01_CMD_ARG_MAX_NB_BYTES][MAX_NUMBER_OF_DEVICES];
-
-
-public:
-
-    /* Static data. */
-    static bool spiPreemptionByIsr;
-    static bool isrFlag;
-    
-};
-
-#endif // __POWERSTEP01_CLASS_H
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
--- a/X_NUCLEO_COMMON.lib	Fri Mar 24 10:58:48 2017 +0100
+++ b/X_NUCLEO_COMMON.lib	Fri Mar 24 10:24:39 2017 +0000
@@ -1,1 +1,1 @@
-http://developer.mbed.org/teams/ST/code/X_NUCLEO_COMMON/#216930edb6b7
+http://developer.mbed.org/teams/ST/code/X_NUCLEO_COMMON/#12be3dfc15fd