Neri Tiziano / X_NUCLEO_IHM03A1_for

Dependencies:   X_NUCLEO_COMMON ST_INTERFACES

Revision:
4:f48e8d87553e
Parent:
1:8ce2a5d6fbf8
--- a/Components/powerstep01/powerstep01.h	Tue Sep 13 08:55:39 2016 +0000
+++ b/Components/powerstep01/powerstep01.h	Fri Mar 24 10:58:48 2017 +0100
@@ -1,15 +1,15 @@
 /**
  ******************************************************************************
-  * @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
+ * @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>
+ * <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:
@@ -36,929 +36,1460 @@
  ******************************************************************************
  */
 
+
 /* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef _POWERSTEP01_H_INCLUDED
-#define _POWERSTEP01_H_INCLUDED
 
-#ifdef __cplusplus
- extern "C" {
-#endif 
+#ifndef __POWERSTEP01_CLASS_H
+#define __POWERSTEP01_CLASS_H
+
 
 /* Includes ------------------------------------------------------------------*/
-#include "powerstep01_target_config.h"
-#include "stdint.h"
-#include "motor.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;
+/* 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"
 
 
-/// 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 HardStop 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 HardStop 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;                                                      *
- *----------------------------------------------------------------------------*/
+/* 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();
+    }
 
-/* Functions -----------------------------------------------------------------*/
+    /**
+     * @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);
+    }
 
-/** @defgroup Powerstep01_Board_Linked_Functions Powerstep01 Board Linked Functions
-  * @{
-  */  
+    /**
+     * @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();
+    }
 
-/* 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);
+    /**
+     * @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;
 
-#ifdef __cplusplus
-  }
-#endif
+    /* 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;
 
-#endif /* #ifndef _POWERSTEP01_H_INCLUDED */
+    /* 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****/