Library to handle the X-NUCLEO-PLC01A1 Programmable Logic Controller Expansion Board based on the VNI8200XP (solid state relay) and CLT01-38SQ7 (octal digital termination array) components.

Dependents:   HelloWorld_PLC01A1

Programmable Logic Controller Library

Library to handle the X-NUCLEO-PLC01A1 Programmable Logic Controller Expansion Board based on the VNI8200XP (solid state relay) and CLT01-38SQ7 (octal digital termination array) components.

Information

For further details on VNI8200XP (Octal high side smart power solid state relay with serial/parallel selectable interface on chip) please refer to ST's web site.

For further details on CLT01-38SQ7 (High speed digital input current limiter) please refer to ST's web site.

SPI configuration

Pin D3 and D13 providing the SPI serial clock are short-circuited in the X-NUCLEO-PLC01A1 Expansion Board.

Please be aware that you may not drive the base board LED if it is connected to pin D13 (as it happens on STM32 Nucleo boards) or D3, otherwise you will get a conflict.

Platform compatibility

  • STM32 NUCLEO boards have been tested with the default configuration provided by the HelloWorld_PLC01A1 example.

return DSPI_HAL_ReadData(spi_address[obj->instance]);

X-NUCLEO-PLC01A1 board powering and startup

The following steps must be followed to run the X-NUCLEO-PLC01A1:

  1. Plug the X-NUCLEO-PLC01A1 onto a base board
  2. Connect the base board to a PC via a standard Type A / mini (or micro) B USB cable
  3. Download the firmware on the MCU hosted on the base board
  4. Supply 24 V to the X-NUCLEO-PLC01A1 board through the J8 connector
  5. The HelloWorld_PLC01A1 demonstration firmware is ready to run: connect any of the 8 inputs on the J8 connector to see the corresponding output on the J10 connector capable of driving a load (i.e. short-circuit input “x” with the 24 V and connect the corresponding output “x” to a load).

Files at this revision

API Documentation at this revision

Comitter:
Davidroid
Date:
Thu Jul 13 16:43:31 2017 +0000
Parent:
4:e97bbb97aa43
Child:
6:de3fc5f5f065
Commit message:
Aligning to ARM mbed coding style.

Changed in this revision

BSP/XNucleoPLC01A1.cpp Show annotated file Show diff for this revision Revisions of this file
BSP/XNucleoPLC01A1.h Show annotated file Show diff for this revision Revisions of this file
BSP/x_nucleo_plc01a1_class.cpp Show diff for this revision Revisions of this file
BSP/x_nucleo_plc01a1_class.h Show diff for this revision Revisions of this file
BSP/x_nucleo_plc01a1_config.h Show diff for this revision Revisions of this file
Components/CLT01_38SQ7/CLT01_38S.cpp Show annotated file Show diff for this revision Revisions of this file
Components/CLT01_38SQ7/CLT01_38S.h Show annotated file Show diff for this revision Revisions of this file
Components/CLT01_38SQ7/CLT01_38S_class.cpp Show diff for this revision Revisions of this file
Components/CLT01_38SQ7/CLT01_38S_class.h Show diff for this revision Revisions of this file
Components/Common/component.h Show diff for this revision Revisions of this file
Components/Common/component_def.h Show annotated file Show diff for this revision Revisions of this file
Components/Common/plc.h Show diff for this revision Revisions of this file
Components/Interfaces/Component.h Show annotated file Show diff for this revision Revisions of this file
Components/Interfaces/Component_class.h Show diff for this revision Revisions of this file
Components/Interfaces/PLCInput.h Show annotated file Show diff for this revision Revisions of this file
Components/Interfaces/PLCInput_class.h Show diff for this revision Revisions of this file
Components/Interfaces/PLCOutput.h Show annotated file Show diff for this revision Revisions of this file
Components/Interfaces/PLCOutput_class.h Show diff for this revision Revisions of this file
Components/VNI8200XP/VNI8200XP.cpp Show annotated file Show diff for this revision Revisions of this file
Components/VNI8200XP/VNI8200XP.h Show annotated file Show diff for this revision Revisions of this file
Components/VNI8200XP/VNI8200XP_class.cpp Show diff for this revision Revisions of this file
Components/VNI8200XP/VNI8200XP_class.h Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BSP/XNucleoPLC01A1.cpp	Thu Jul 13 16:43:31 2017 +0000
@@ -0,0 +1,292 @@
+/**
+ ******************************************************************************
+ * @file    XNucleoPLC01A1.cpp
+ * @author  AST/CL
+ * @version V1.1.0
+ * @date    February 23rd, 2016
+ * @brief   Implementation file for the X_NUCLEO_PLC01A1 expansion board.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *   1. Redistributions of source code must retain the above copyright notice,
+ *      this list of conditions and the following disclaimer.
+ *   2. Redistributions in binary form must reproduce the above copyright notice,
+ *      this list of conditions and the following disclaimer in the documentation
+ *      and/or other materials provided with the distribution.
+ *   3. Neither the name of STMicroelectronics nor the names of its contributors
+ *      may be used to endorse or promote products derived from this software
+ *      without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ******************************************************************************
+ */
+ 
+ 
+/* Includes ------------------------------------------------------------------*/
+
+/* ACTION 1 ------------------------------------------------------------------*
+ * Include here platform specific header files.                               *
+ *----------------------------------------------------------------------------*/
+#include "mbed.h"
+/* ACTION 2 ------------------------------------------------------------------*
+ * Include here expansion board specific header files.                        *
+ *----------------------------------------------------------------------------*/
+#include "XNucleoPLC01A1.h"
+
+
+/**
+  * @brief      Mirrors input data  
+  * @param      Input channel state buffer
+  * @retval     Input buffer state
+  */
+uint8_t XNucleoPLC01A1::signal_mirror(uint8_t In_Array)
+{
+  return(In_Array);
+}
+
+void XNucleoPLC01A1::handle_freeze_to(void)
+{
+    freezeTo = true;
+}
+
+/**
+  * @brief      Freeze selected output for a given time
+  * @param      Output channels to be freezed
+  * @param      Duration of freeze
+  * @retval     Output value
+  */
+uint8_t XNucleoPLC01A1::output_freeze(uint8_t N_Channel, uint16_t msec)
+{
+  if (freezeTo) {
+      timeout.detach();
+      return(0x00);
+  } else if(!attached) {
+      attached = true;
+      timeout.attach(this, &XNucleoPLC01A1::handle_freeze_to, msec/1000);
+  }
+  
+  return N_Channel;
+}
+
+/**
+  * @brief      Regroup output buffer according to out_Array  
+  * @param      Regroup array
+  * @retval     Value
+  */
+uint8_t XNucleoPLC01A1::output_regroup(uint8_t Out_Array)
+{
+  return(Out_Array);
+}
+
+/**
+  * @brief      Sum all the inputs at high state 
+  * @param      Input channel state data
+  * @retval     Value corresponding to the sum of inputs at high
+  */
+uint8_t XNucleoPLC01A1::input_sum(uint8_t* Buffer, uint8_t In_Array)
+{
+  
+  uint8_t inputChannelsOn = 0;
+  uint8_t count = 0;
+  *Buffer = In_Array;
+
+  for(count = 0; count<8; count++)
+  {
+    if ((In_Array & 0x01) == 0x01) {
+      inputChannelsOn++;
+    }
+    
+    In_Array = In_Array >> 1;
+  }
+  
+  return inputChannelsOn;
+  
+}
+
+/**
+  * @brief      Set the output channels on/off 
+  * @param      Output to set
+  * @retval     Output value 
+  */
+uint8_t XNucleoPLC01A1::set_output(uint8_t Out_Array)
+{
+  return(Out_Array); 
+}
+
+/**
+  * @brief      AND Inputs for selected output channels
+  * @param      Input channels state
+  * @param      Outputs to be AND with inputs
+  * @retval     Result of AND operation
+  */
+uint8_t XNucleoPLC01A1::inputs_and(uint8_t In_Array, uint8_t Out_Channel)
+{
+  uint8_t outArray = 0;
+  outArray = In_Array & Out_Channel;
+  
+  return outArray;
+}
+
+/**
+  * @brief      OR Inputs for selected output channels
+  * @param      Input channels state
+  * @param      Outputs to be OR with inputs
+  * @retval     Result of OR operation
+  */
+uint8_t XNucleoPLC01A1::inputs_or(uint8_t In_Array, uint8_t Out_Channel)
+{
+  uint8_t outArray = 0;
+  outArray = In_Array | Out_Channel;
+  
+  return outArray;
+}
+
+/**
+  * @brief      NOT Inputs
+  * @param      Input channels state
+  * @retval     Result of OR operation
+  */
+uint8_t XNucleoPLC01A1::inputs_not(uint8_t In_Array)
+{
+  uint8_t outArray = 0;
+  In_Array = ~(In_Array);
+  outArray = In_Array;
+  
+  return outArray;
+}
+
+/**
+  * @brief      XOR Inputs for selected output channels
+  * @param      Input channels state
+  * @param      Outputs to be XOR with inputs
+  * @retval     Result of XOR operation
+  */
+uint8_t XNucleoPLC01A1::inputs_xor(uint8_t In_Array, uint8_t Out_Channel)
+{
+  uint8_t outArray = 0;
+  outArray = In_Array ^ Out_Channel;
+  
+  return outArray;
+}
+
+/**
+  * @brief      Calculate and set parity bits for Ssrelay transmission
+  * @param      Output value buffer
+  * @retval     None
+  */
+void XNucleoPLC01A1::output_parity_bits(uint8_t* Buffer)
+{
+  uint8_t Parity_Cal0 = 0x00;
+  uint8_t Parity_Cal1 = 0x00;
+  uint8_t Parity_Cal2 = 0x00;
+  uint8_t Parity_Cal3 = 0x00;
+  uint8_t Parity_Cal4 = 0x00;
+  uint8_t Parity_Cal5 = 0x00;
+  uint8_t Parity_Cal6 = 0x00;
+  uint8_t Parity_Cal7 = 0x00;
+  uint8_t nP0 = 0x00;
+  uint8_t P0 = 0x00;
+  uint8_t P1 = 0x00;
+  uint8_t P2 = 0x00;
+
+  Parity_Cal0 = Buffer[1] & 0x80;
+  Parity_Cal0 = Parity_Cal0>>7;
+  
+  Parity_Cal1 = Buffer[1] & 0x40;
+  Parity_Cal1 = Parity_Cal1>>6;
+  
+  Parity_Cal2 = Buffer[1] & 0x20;
+  Parity_Cal2 = Parity_Cal2>>5;
+  
+  Parity_Cal3 = Buffer[1] & 0x10;
+  Parity_Cal3 = Parity_Cal3>>4;
+  
+  Parity_Cal4 = Buffer[1] & 0x08;
+  Parity_Cal4 = Parity_Cal4>>3;
+  
+  Parity_Cal5 = Buffer[1] & 0x04;
+  Parity_Cal5 = Parity_Cal5>>2;
+  
+  Parity_Cal6 = Buffer[1] & 0x02;
+  Parity_Cal6 = Parity_Cal6>>1;
+  
+  Parity_Cal7 = Buffer[1] & 0x01;
+ 
+  
+  /* Caluculate parity bits based on output data */
+  P2 = ((Parity_Cal7^Parity_Cal5)^Parity_Cal3)^Parity_Cal1;
+  if (P2 == 0x01) {
+    P2 = 0x08;
+  } else {
+    P2 = 0x00;
+  }
+ 
+  P1 = ((Parity_Cal6^Parity_Cal4)^Parity_Cal2)^Parity_Cal0;
+  if (P1 == 0x01) {
+    P1 = 0x04;
+  } else {
+    P1 = 0x00;
+  }
+  
+  P0 = ((((((Parity_Cal7^Parity_Cal6)^Parity_Cal5)^Parity_Cal4)^Parity_Cal3)
+         ^Parity_Cal2)^Parity_Cal1)^Parity_Cal0;
+  if (P0 == 0x01) {
+    P0 = 0X02;
+  } else {
+    P0 = 0x00;
+  }
+  
+  nP0 = 0x00;
+  if (P0 == 0x02) {
+    nP0 = 0x00;
+  } else {
+    nP0 = 0x01;
+  }
+  
+  /* Set Ssrelay_TxBuffer parity bits field */
+  Buffer[0] = P2|P1|P0|nP0;
+}
+
+/**
+  * @brief      Toggle selected output for given frequency
+  * @param      Output channels to be toggled
+  * @retval     None
+  */
+void XNucleoPLC01A1::output_cycling(void)
+{
+  if (!attached) {
+    attached = true;
+    ticker.attach(this, &XNucleoPLC01A1::toggle_output, 0.3);
+  }
+}
+
+void XNucleoPLC01A1::toggle_output(void)
+{
+  /* Reset & set CS1 to refresh VNI watchdog */
+  plcIn.set_input_spi(0);
+  plcIn.set_input_spi(1);
+
+  outBuff[1] = ~(outBuff[1]);
+
+  /* Parity bits calculation */
+  output_parity_bits(outBuff);
+
+  /* Transmit data to VNI on SPI */
+  plcOut.ssrelay_set_output(outBuff);
+}
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BSP/XNucleoPLC01A1.h	Thu Jul 13 16:43:31 2017 +0000
@@ -0,0 +1,217 @@
+/**
+ ******************************************************************************
+ * @file    XNucleoPLC01A1.h
+ * @author  AST/CL
+ * @version V1.1.0
+ * @date    February 23rd, 2016
+ * @brief   Class header file for the X_NUCLEO_PLC01A1 expansion board.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *   1. Redistributions of source code must retain the above copyright notice,
+ *      this list of conditions and the following disclaimer.
+ *   2. Redistributions in binary form must reproduce the above copyright notice,
+ *      this list of conditions and the following disclaimer in the documentation
+ *      and/or other materials provided with the distribution.
+ *   3. Neither the name of STMicroelectronics nor the names of its contributors
+ *      may be used to endorse or promote products derived from this software
+ *      without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ******************************************************************************
+ */
+
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+
+#ifndef __X_NUCLEO_PLC01A1_CLASS_H
+#define __X_NUCLEO_PLC01A1_CLASS_H
+
+
+/* Includes ------------------------------------------------------------------*/
+
+/* ACTION 1 ------------------------------------------------------------------*
+ * Include here platform specific header files.                               *
+ *----------------------------------------------------------------------------*/
+#include "mbed.h"
+/* ACTION 2 ------------------------------------------------------------------*
+ * Include here expansion board configuration's header files.                 *
+ *----------------------------------------------------------------------------*/
+#include "x_nucleo_plc01a1_config.h"
+/* ACTION 3 ------------------------------------------------------------------*
+ * Include here expansion board's components' header files.                   *
+ *                                                                            *
+ * Example:                                                                   *
+ *   #include "COMPONENT_1.h"                                                 *
+ *   #include "COMPONENT_2.h"                                                 *
+ *----------------------------------------------------------------------------*/
+#include "CLT01_38S.h"
+#include "VNI8200XP.h"
+
+
+/* Classes  ------------------------------------------------------------------*/
+
+class XNucleoPLC01A1
+{
+public:
+
+    /*** Constructor and Destructor Methods ***/
+
+    /**
+     * @brief Constructor.
+     * @param input_ssel    pin name of the SSEL pin of the SPI device to be used for communication with Input Channels component
+     * @param output_ssel   pin name of the SSEL pin of the SPI device to be used for communication with Output Channels component
+     * @param spi           SPI device to be used for communication.
+     */
+    XNucleoPLC01A1(PinName input_ssel, PinName output_ssel, PinName out_en, SPI &spi) : plcIn(input_ssel, spi), plcOut(out_en, output_ssel, spi), freezeTo(false), attached(false)
+    {
+        if (plcIn.init() != COMPONENT_OK)
+            exit(EXIT_FAILURE);
+
+        if (plcOut.init() != COMPONENT_OK)
+            exit(EXIT_FAILURE);
+
+        outBuff[0] = 0;
+        outBuff[1] = 0;        
+    }
+    
+    /**
+     * @brief Destructor.
+     */
+    virtual ~XNucleoPLC01A1(void) {}
+
+    /*
+     * Accessors to PLC input channels component. Please refer to "PLCInput.h".
+     * All PLCInput related unctionality requires going through this accessor.
+     */
+    const PLCInput& plc_input() const {
+        return plcIn;
+    }
+    PLCInput& plc_input() {
+        return plcIn;
+    }
+
+    /*
+     * Accessors to PLC output channels component. Please refer to "PLCOutput.h".
+     * All PLCOutput related functionality requires going through this accessor.
+     */
+    const PLCOutput& plc_output() const {
+        return plcOut;
+    }
+    PLCOutput& plc_output() {
+        return plcOut;
+    }
+
+    /*
+     * @brief      Mirrors input data
+     * @param      Input channel state buffer
+     * @retval     Input buffer state
+     */
+    uint8_t signal_mirror(uint8_t In_Array);
+
+    /*
+     * @brief      Freeze selected output for a given time
+     * @param      Output channels to be freezed
+     * @param      Duration of freeze
+     * @retval     Output value
+     */
+    uint8_t output_freeze(uint8_t N_Channel, uint16_t msec);
+    
+    /*
+     * @brief      Regroup output buffer according to out_Array
+     * @param      Regroup array
+     * @retval     Value
+     */
+    uint8_t output_regroup(uint8_t Out_Array);
+    
+    /*
+     * @brief      Sum all the inputs at high state
+     * @param      Input channel state data
+     * @retval     Value corresponding to the sum of inputs at high
+     */
+    uint8_t input_sum(uint8_t* Buffer, uint8_t In_Array);
+
+    /*
+     * @brief      Set the output channels on/off
+     * @param      Output to set
+     * @retval     Output value
+     */
+    uint8_t set_output(uint8_t Out_Array);
+
+    /*
+     * @brief      AND Inputs for selected output channels
+     * @param      Input channels state
+     * @param      Outputs to be AND with inputs
+     * @retval     Result of AND operation
+     */
+    uint8_t inputs_and(uint8_t In_Array, uint8_t Out_Channel);
+
+    /*
+     * @brief      OR Inputs for selected output channels
+     * @param      Input channels state
+     * @param      Outputs to be OR with inputs
+     * @retval     Result of OR operation
+     */
+    uint8_t inputs_or(uint8_t In_Array, uint8_t Out_Channel);
+    
+    /*
+     * @brief      NOT Inputs
+     * @param      Input channels state
+     * @retval     Result of OR operation
+     */
+    uint8_t inputs_not(uint8_t In_Array);
+
+    /*
+     * @brief      XOR Inputs for selected output channels
+     * @param      Input channels state
+     * @param      Outputs to be XOR with inputs
+     * @retval     Result of XOR operation
+     */
+    uint8_t inputs_xor(uint8_t In_Array, uint8_t Out_Channel);
+
+    /*
+     * @brief      Calculate and set parity bits for Ssrelay transmission
+     * @param      Output value buffer
+     * @retval     None
+     */
+    void output_parity_bits(uint8_t* Buffer);
+
+    /*
+     * @brief      Toggle selected output for given frequency
+     * @param      Output channels to be toggled
+     * @retval     None
+     */
+    void output_cycling(void);
+
+protected:
+    void handle_freeze_to(void);
+    void toggle_output(void);
+
+    CLT01_38S plcIn;
+    VNI8200XP plcOut;
+
+    Timeout timeout;
+    bool freezeTo;
+    bool attached;
+    
+    Ticker ticker;
+    uint8_t outBuff[2];
+};
+
+#endif /* __X_NUCLEO_PLC01A1_CLASS_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 
--- a/BSP/x_nucleo_plc01a1_class.cpp	Wed Feb 24 10:52:31 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,287 +0,0 @@
-/**
- ******************************************************************************
- * @file    x_nucleo_plc01a1_class.cpp
- * @author  AST/CL
- * @version V1.1.0
- * @date    February 23rd, 2016
- * @brief   Implementation file for the X_NUCLEO_PLC01A1 expansion board.
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *   1. Redistributions of source code must retain the above copyright notice,
- *      this list of conditions and the following disclaimer.
- *   2. Redistributions in binary form must reproduce the above copyright notice,
- *      this list of conditions and the following disclaimer in the documentation
- *      and/or other materials provided with the distribution.
- *   3. Neither the name of STMicroelectronics nor the names of its contributors
- *      may be used to endorse or promote products derived from this software
- *      without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- ******************************************************************************
- */
- 
- 
-/* Includes ------------------------------------------------------------------*/
-
-/* ACTION 1 ------------------------------------------------------------------*
- * Include here platform specific header files.                               *
- *----------------------------------------------------------------------------*/
-#include "mbed.h"
-/* ACTION 2 ------------------------------------------------------------------*
- * Include here expansion board specific header files.                        *
- *----------------------------------------------------------------------------*/
-#include "x_nucleo_plc01a1_class.h"
-
-
-/**
-  * @brief      Mirrors input data  
-  * @param      Input channel state buffer
-  * @retval     Input buffer state
-  */
-uint8_t X_NUCLEO_PLC01A1::signalMirror(uint8_t In_Array)
-{
-  return(In_Array);
-}
-
-void X_NUCLEO_PLC01A1::handleFreezeTo(void)
-{
-    freezeTo = true;
-}
-
-/**
-  * @brief      Freeze selected output for a given time
-  * @param      Output channels to be freezed
-  * @param      Duration of freeze
-  * @retval     Output value
-  */
-uint8_t X_NUCLEO_PLC01A1::outputFreeze(uint8_t N_Channel, uint16_t msec)
-{
-  if(freezeTo) {
-      timeout.detach();
-      return(0x00);
-  } else if(!attached) {
-      attached = true;
-      timeout.attach(this, &X_NUCLEO_PLC01A1::handleFreezeTo, msec/1000);
-  }
-  
-  return N_Channel;
-}
-
-/**
-  * @brief      Regroup output buffer according to out_Array  
-  * @param      Regroup array
-  * @retval     Value
-  */
-uint8_t X_NUCLEO_PLC01A1::outputRegroup(uint8_t Out_Array)
-{
-  return(Out_Array);
-}
-
-/**
-  * @brief      Sum all the inputs at high state 
-  * @param      Input channel state data
-  * @retval     Value corresponding to the sum of inputs at high
-  */
-uint8_t X_NUCLEO_PLC01A1::inputSum(uint8_t* Buffer, uint8_t In_Array)
-{
-  
-  uint8_t inputChannelsOn = 0;
-  uint8_t count = 0;
-  *Buffer = In_Array;
-
-  for(count = 0; count<8; count++)
-  {
-    if((In_Array & 0x01) == 0x01)
-      inputChannelsOn++;
-    
-    In_Array = In_Array >> 1;
-  }
-  
-  return inputChannelsOn;
-  
-}
-
-/**
-  * @brief      Set the output channels on/off 
-  * @param      Output to set
-  * @retval     Output value 
-  */
-uint8_t X_NUCLEO_PLC01A1::setOutput(uint8_t Out_Array)
-{
-  return(Out_Array); 
-}
-
-/**
-  * @brief      AND Inputs for selected output channels
-  * @param      Input channels state
-  * @param      Outputs to be AND with inputs
-  * @retval     Result of AND operation
-  */
-uint8_t X_NUCLEO_PLC01A1::inputsAND(uint8_t In_Array, uint8_t Out_Channel)
-{
-  uint8_t outArray = 0;
-  outArray = In_Array & Out_Channel;
-  
-  return outArray;
-}
-
-/**
-  * @brief      OR Inputs for selected output channels
-  * @param      Input channels state
-  * @param      Outputs to be OR with inputs
-  * @retval     Result of OR operation
-  */
-uint8_t X_NUCLEO_PLC01A1::inputsOR(uint8_t In_Array, uint8_t Out_Channel)
-{
-  uint8_t outArray = 0;
-  outArray = In_Array | Out_Channel;
-  
-  return outArray;
-}
-
-/**
-  * @brief      NOT Inputs
-  * @param      Input channels state
-  * @retval     Result of OR operation
-  */
-uint8_t X_NUCLEO_PLC01A1::inputsNOT(uint8_t In_Array)
-{
-  uint8_t outArray = 0;
-  In_Array = ~(In_Array);
-  outArray = In_Array;
-  
-  return outArray;
-}
-
-/**
-  * @brief      XOR Inputs for selected output channels
-  * @param      Input channels state
-  * @param      Outputs to be XOR with inputs
-  * @retval     Result of XOR operation
-  */
-uint8_t X_NUCLEO_PLC01A1::inputsXOR(uint8_t In_Array, uint8_t Out_Channel)
-{
-  uint8_t outArray = 0;
-  outArray = In_Array ^ Out_Channel;
-  
-  return outArray;
-}
-
-/**
-  * @brief      Calculate and set parity bits for Ssrelay transmission
-  * @param      Output value buffer
-  * @retval     None
-  */
-void X_NUCLEO_PLC01A1::outputParityBits(uint8_t* Buffer)
-{
-  uint8_t Parity_Cal0 = 0x00;
-  uint8_t Parity_Cal1 = 0x00;
-  uint8_t Parity_Cal2 = 0x00;
-  uint8_t Parity_Cal3 = 0x00;
-  uint8_t Parity_Cal4 = 0x00;
-  uint8_t Parity_Cal5 = 0x00;
-  uint8_t Parity_Cal6 = 0x00;
-  uint8_t Parity_Cal7 = 0x00;
-  uint8_t nP0 = 0x00;
-  uint8_t P0 = 0x00;
-  uint8_t P1 = 0x00;
-  uint8_t P2 = 0x00;
-
-  Parity_Cal0 = Buffer[1] & 0x80;
-  Parity_Cal0 = Parity_Cal0>>7;
-  
-  Parity_Cal1 = Buffer[1] & 0x40;
-  Parity_Cal1 = Parity_Cal1>>6;
-  
-  Parity_Cal2 = Buffer[1] & 0x20;
-  Parity_Cal2 = Parity_Cal2>>5;
-  
-  Parity_Cal3 = Buffer[1] & 0x10;
-  Parity_Cal3 = Parity_Cal3>>4;
-  
-  Parity_Cal4 = Buffer[1] & 0x08;
-  Parity_Cal4 = Parity_Cal4>>3;
-  
-  Parity_Cal5 = Buffer[1] & 0x04;
-  Parity_Cal5 = Parity_Cal5>>2;
-  
-  Parity_Cal6 = Buffer[1] & 0x02;
-  Parity_Cal6 = Parity_Cal6>>1;
-  
-  Parity_Cal7 = Buffer[1] & 0x01;
- 
-  
-  /* Caluculate parity bits based on output data */
-  P2 = ((Parity_Cal7^Parity_Cal5)^Parity_Cal3)^Parity_Cal1;
-  if(P2 == 0x01) 
-    P2 = 0x08;
-  else
-    P2 = 0x00;
- 
-  P1 = ((Parity_Cal6^Parity_Cal4)^Parity_Cal2)^Parity_Cal0;
-  if(P1 == 0x01)
-    P1 = 0x04;
-  else
-    P1 = 0x00;
-  
-  P0 = ((((((Parity_Cal7^Parity_Cal6)^Parity_Cal5)^Parity_Cal4)^Parity_Cal3)
-         ^Parity_Cal2)^Parity_Cal1)^Parity_Cal0;
-  if(P0 == 0x01)
-    P0 = 0X02;
-  else
-    P0 = 0x00;
-  
-  nP0 = 0x00;
-  if(P0 == 0x02)
-    nP0 = 0x00;
-  else
-    nP0 = 0x01;
-  
-  /* Set Ssrelay_TxBuffer parity bits field */
-  Buffer[0] = P2|P1|P0|nP0;
-}
-
-/**
-  * @brief      Toggle selected output for given frequency
-  * @param      Output channels to be toggled
-  * @retval     None
-  */
-void X_NUCLEO_PLC01A1::outputCycling(void)
-{
-    if(!attached) {
-          attached = true;
-          ticker.attach(this, &X_NUCLEO_PLC01A1::toggleOutput, 0.3);
-    }
-}
-
-void X_NUCLEO_PLC01A1::toggleOutput(void)
-{
-  /* Reset & set CS1 to refresh VNI watchdog */
-  plcIn.setInputSPI(0);
-  plcIn.setInputSPI(1);
-
-  outBuff[1] = ~(outBuff[1]);
-
-  /* Parity bits calculation */
-  outputParityBits(outBuff);
-
-  /* Transmit data to VNI on SPI */
-  plcOut.Ssrelay_SetOutput(outBuff);
-}
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 
--- a/BSP/x_nucleo_plc01a1_class.h	Wed Feb 24 10:52:31 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,209 +0,0 @@
-/**
- ******************************************************************************
- * @file    x_nucleo_plc01a1_class.h
- * @author  AST/CL
- * @version V1.1.0
- * @date    February 23rd, 2016
- * @brief   Class header file for the X_NUCLEO_PLC01A1 expansion board.
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *   1. Redistributions of source code must retain the above copyright notice,
- *      this list of conditions and the following disclaimer.
- *   2. Redistributions in binary form must reproduce the above copyright notice,
- *      this list of conditions and the following disclaimer in the documentation
- *      and/or other materials provided with the distribution.
- *   3. Neither the name of STMicroelectronics nor the names of its contributors
- *      may be used to endorse or promote products derived from this software
- *      without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- ******************************************************************************
- */
-
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-
-#ifndef __X_NUCLEO_PLC01A1_CLASS_H
-#define __X_NUCLEO_PLC01A1_CLASS_H
-
-
-/* Includes ------------------------------------------------------------------*/
-
-/* ACTION 1 ------------------------------------------------------------------*
- * Include here platform specific header files.                               *
- *----------------------------------------------------------------------------*/
-#include "mbed.h"
-/* ACTION 2 ------------------------------------------------------------------*
- * Include here expansion board configuration's header files.                 *
- *----------------------------------------------------------------------------*/
-#include "x_nucleo_plc01a1_config.h"
-/* ACTION 3 ------------------------------------------------------------------*
- * Include here expansion board's components' header files.                   *
- *                                                                            *
- * Example:                                                                   *
- *   #include "component_1_class.h"                                           *
- *   #include "component_2_class.h"                                           *
- *----------------------------------------------------------------------------*/
-#include "CLT01_38S_class.h"
-#include "VNI8200XP_class.h"
-
-
-/* Classes  ------------------------------------------------------------------*/
-
-class X_NUCLEO_PLC01A1
-{
-public:
-
-    /*** Constructor and Destructor Methods ***/
-
-    /**
-     * @brief Constructor.
-     * @param input_ssel    pin name of the SSEL pin of the SPI device to be used for communication with Input Channels component
-     * @param output_ssel   pin name of the SSEL pin of the SPI device to be used for communication with Output Channels component
-     * @param spi           SPI device to be used for communication.
-     */
-    X_NUCLEO_PLC01A1(PinName input_ssel, PinName output_ssel, PinName out_en, SPI &spi) : plcIn(input_ssel, spi), plcOut(out_en, output_ssel, spi), freezeTo(false), attached(false)
-    {
-        if (plcIn.Init() != COMPONENT_OK)
-            exit(EXIT_FAILURE);
-
-        if (plcOut.Init() != COMPONENT_OK)
-            exit(EXIT_FAILURE);
-
-        outBuff[0] = 0;
-        outBuff[1] = 0;        
-    }
-    
-    /**
-     * @brief Destructor.
-     */
-    virtual ~X_NUCLEO_PLC01A1(void) {}
-
-    /*
-     * Accessors to X_NUCLEO_PLC01A1 input channels component. Please refer to PLCInput_class.h. All PLCInput related
-     * functionality requires going through this accessor.
-     */
-    const PLCInput& plcInput() const { return plcIn; }
-    PLCInput& plcInput()  { return plcIn; }
-
-    /*
-     * Accessors to X_NUCLEO_PLC01A1 output channels component. Please refer to PLCOutput_class.h. All PLCOutput related
-     * functionality requires going through this accessor.
-     */
-    const PLCOutput& plcOutput() const { return plcOut; }
-    PLCOutput& plcOutput()  { return plcOut; }
-
-    /*
-     * @brief      Mirrors input data
-     * @param      Input channel state buffer
-     * @retval     Input buffer state
-     */
-    uint8_t signalMirror(uint8_t In_Array);
-
-    /*
-     * @brief      Freeze selected output for a given time
-     * @param      Output channels to be freezed
-     * @param      Duration of freeze
-     * @retval     Output value
-     */
-    uint8_t outputFreeze(uint8_t N_Channel, uint16_t msec);
-    
-    /*
-     * @brief      Regroup output buffer according to out_Array
-     * @param      Regroup array
-     * @retval     Value
-     */
-    uint8_t outputRegroup(uint8_t Out_Array);
-    
-    /*
-     * @brief      Sum all the inputs at high state
-     * @param      Input channel state data
-     * @retval     Value corresponding to the sum of inputs at high
-     */
-    uint8_t inputSum(uint8_t* Buffer, uint8_t In_Array);
-
-    /*
-     * @brief      Set the output channels on/off
-     * @param      Output to set
-     * @retval     Output value
-     */
-    uint8_t setOutput(uint8_t Out_Array);
-
-    /*
-     * @brief      AND Inputs for selected output channels
-     * @param      Input channels state
-     * @param      Outputs to be AND with inputs
-     * @retval     Result of AND operation
-     */
-    uint8_t inputsAND(uint8_t In_Array, uint8_t Out_Channel);
-
-    /*
-     * @brief      OR Inputs for selected output channels
-     * @param      Input channels state
-     * @param      Outputs to be OR with inputs
-     * @retval     Result of OR operation
-     */
-    uint8_t inputsOR(uint8_t In_Array, uint8_t Out_Channel);
-    
-    /*
-     * @brief      NOT Inputs
-     * @param      Input channels state
-     * @retval     Result of OR operation
-     */
-    uint8_t inputsNOT(uint8_t In_Array);
-
-    /*
-     * @brief      XOR Inputs for selected output channels
-     * @param      Input channels state
-     * @param      Outputs to be XOR with inputs
-     * @retval     Result of XOR operation
-     */
-    uint8_t inputsXOR(uint8_t In_Array, uint8_t Out_Channel);
-
-    /*
-     * @brief      Calculate and set parity bits for Ssrelay transmission
-     * @param      Output value buffer
-     * @retval     None
-     */
-    void outputParityBits(uint8_t* Buffer);
-
-    /*
-     * @brief      Toggle selected output for given frequency
-     * @param      Output channels to be toggled
-     * @retval     None
-     */
-    void outputCycling(void);
-
-protected:
-    void handleFreezeTo(void);
-    void toggleOutput(void);
-
-    CLT01_38S plcIn;
-    VNI8200XP plcOut;
-
-    Timeout timeout;
-    bool freezeTo;
-    bool attached;
-    
-    Ticker ticker;
-    uint8_t outBuff[2];
-};
-
-#endif /* __X_NUCLEO_PLC01A1_CLASS_H */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 
--- a/BSP/x_nucleo_plc01a1_config.h	Wed Feb 24 10:52:31 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +0,0 @@
-/**
- ******************************************************************************
- * @file    x_nucleo_plc01a1_config.h
- * @author  AST / Software Platforms and Cloud
- * @version V1.0
- * @date    November 3rd, 2015
- * @brief   Configuration header file for the X_NUCLEO_PLC01A1 expansion board.
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *   1. Redistributions of source code must retain the above copyright notice,
- *      this list of conditions and the following disclaimer.
- *   2. Redistributions in binary form must reproduce the above copyright notice,
- *      this list of conditions and the following disclaimer in the documentation
- *      and/or other materials provided with the distribution.
- *   3. Neither the name of STMicroelectronics nor the names of its contributors
- *      may be used to endorse or promote products derived from this software
- *      without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- ******************************************************************************
- */
-
-
-/* Generated with STM32CubeTOO -----------------------------------------------*/
-
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-
-#ifndef __X_NUCLEO_PLC01A1_CONFIG_H
-#define __X_NUCLEO_PLC01A1_CONFIG_H
-
-
-/* Definitions ---------------------------------------------------------------*/
-
-/* ACTION --------------------------------------------------------------------*
- * Specify here a configuration for I/O and interrupts' pins.                 *
- *                                                                            *
- * Example:                                                                   *
- *   // I2C.                                                                  *
- *   #define EXPANSION_BOARD_PIN_I2C_SCL  (D15)                               *
- *   #define EXPANSION_BOARD_PIN_I2C_SDA  (D14)                               *
- *                                                                            *
- *   // SPI.                                                                  *
- *   #define EXPANSION_BOARD_PIN_SPI_MOSI (D11)                               *
- *   #define EXPANSION_BOARD_PIN_SPI_MISO (D12)                               *
- *   #define EXPANSION_BOARD_PIN_SPI_SCLK (D13)                               *
- *                                                                            *
- *   // Interrupts.                                                           *
- *   #define EXPANSION_BOARD_PIN_INT_1    (A2)                                *
- *----------------------------------------------------------------------------*/
-/* I2C. */
-#define X_NUCLEO_PLC01A1_PIN_I2C_SCL  (D15)
-#define X_NUCLEO_PLC01A1_PIN_I2C_SDA  (D14)
-
-/* Output channels enable pin. */
-#define X_NUCLEO_PLC01A1_PIN_OUT_EN (D6)
-
-/* SPI. */
-#define X_NUCLEO_PLC01A1_PIN_SPI_CS1 (D9)
-#define X_NUCLEO_PLC01A1_PIN_SPI_CS2 (D10)
-
-#define X_NUCLEO_PLC01A1_PIN_SPI_MOSI (D11)
-#define X_NUCLEO_PLC01A1_PIN_SPI_MISO (D12)
-#define X_NUCLEO_PLC01A1_PIN_SPI_SCLK (D13)
-
-#define X_NUCLEO_PLC01A1_PIN_SPI_BITS (16)
-
-/* Interrupts. */
-#define X_NUCLEO_PLC01A1_PIN_INT_1    (A2)
-
-/* Maximum number of mounted "X-NUCLEO-PLC01A1" Expansion Boards. */
-#define EXPBRD_MOUNTED_NR_MAX         (4)
-
-#endif /* __X_NUCLEO_PLC01A1_CONFIG_H */
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Components/CLT01_38SQ7/CLT01_38S.cpp	Thu Jul 13 16:43:31 2017 +0000
@@ -0,0 +1,222 @@
+/**
+  ******************************************************************************
+  * @file    CLT01_38S_class.cpp
+  * @author  System Lab Noida
+  * @version V1.0.0
+  * @date    08-July-2015
+  * @brief   PLC_CLT01-38SQ7
+  * This file provides firmware functions for how  to manage I/O from CLT01-38SQ7
+  ==============================================================================    
+ 
+           
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * Redistribution and use in source and binary forms, with or without modification,
+  * are permitted provided that the following conditions are met:
+  *   1. Redistributions of source code must retain the above copyright notice,
+  *      this list of conditions and the following disclaimer.
+  *   2. Redistributions in binary form must reproduce the above copyright notice,
+  *      this list of conditions and the following disclaimer in the documentation
+  *      and/or other materials provided with the distribution.
+  *   3. Neither the name of STMicroelectronics nor the names of its contributors
+  *      may be used to endorse or promote products derived from this software
+  *      without specific prior written permission.
+  *
+  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+  *
+  ******************************************************************************  
+  */
+  
+  /* Includes ------------------------------------------------------------------*/
+#include "plc.h"
+
+#include "CLT01_38S.h"
+    
+/** @addtogroup Drivers     Drivers
+  * @{
+  * @brief Demo Driver Layer
+  */    
+  
+/** @addtogroup BSP     BSP
+  * @{
+  */    
+    
+/** @addtogroup Components     Components
+  * @{
+  */
+
+/** @defgroup CLT01_38S    CLT01_38S
+  * @{ 
+  * @brief Digital Input Driver Layer
+  */
+
+/** @defgroup CLT01_38S_Private_variables     CLT01 38S Private variables
+  * @{
+  * @brief Digital Input Private variables
+  */
+
+/* Number of components */
+uint8_t CLT01_38S::number_of_plc_input_components = 0;
+
+
+/** @defgroup CLT01_38S_Exported_Functions     CLT01 38S Exported Functions
+  * @{
+  * @brief Digital Input exported Function 
+  */
+
+/**********************************************************
+ * @brief Starts the CLT01_38S library
+ * @param  init Initialization structure.
+ * @retval COMPONENT_OK in case of success.
+ **********************************************************/
+status_t CLT01_38S::CLT01_38S_Init(void *init)
+{
+    OTA_Buffer = 0x00;
+    CLT_PARITY_Buffer = 0x00;
+    UVA_Buffer = 0x00;
+    CLT_INPUT_STATUS_Buffer = 0x00;
+    FLAG_CLT_READ = 0;
+    
+    /* Unselect the CLT chip at startup to avoid FAULT */
+    ssel = 1;
+
+    return COMPONENT_OK;
+}
+
+/**********************************************************
+ * @brief Read id
+ * @param id pointer to the identifier to be read.
+ * @retval COMPONENT_OK in case of success.
+ **********************************************************/
+status_t CLT01_38S::CLT01_38S_ReadID(uint8_t *id)
+{
+  *id = plc_input_component_instance;
+
+  return COMPONENT_OK;
+}
+
+/**********************************************************
+ * @brief      CLT Read Status
+ * @param      None
+ * @retval     Status
+ **********************************************************/
+uint8_t CLT01_38S::CLT01_38S_GetReadStatus(void)
+{
+  return FLAG_CLT_READ;
+}
+
+/**********************************************************
+ * @brief      Set CLT Read Status
+ * @param      Status
+ * @retval     None
+ **********************************************************/
+void CLT01_38S::CLT01_38S_SetReadStatus(uint8_t status)
+{
+  FLAG_CLT_READ = status;
+}
+
+/**********************************************************
+ * @brief      INPUT status
+ * @param      None
+ * @retval     Channels status corresponding to 8 inputs 
+ **********************************************************/
+uint8_t CLT01_38S::CLT01_38S_GetInputData(void)
+{
+  CLT_INPUT_STATUS_Buffer = spi_rx_buff[1];
+  
+  return CLT_INPUT_STATUS_Buffer;
+}
+
+/**********************************************************
+ * @brief      CLT Over_Temprature_Alarm
+ * @param      None
+ * @retval     Overtemperature bit, COMPONENT_ERROR in case of alarm
+ **********************************************************/
+status_t CLT01_38S::CLT01_38S_OverTempAlarm(void)
+{
+  OTA_Buffer = spi_rx_buff[0];
+  OTA_Buffer = OTA_Buffer & (0x40);
+ 
+  if(OTA_Buffer == 0x40) {
+    return COMPONENT_OK;
+  } else {
+    return COMPONENT_ERROR;
+  }
+}
+
+/**********************************************************
+ * @brief      CLT Parity_Check_bits
+ * @param      None
+ * @retval     Parity bits for diagnosing inconsistency in data transmission 
+ **********************************************************/
+uint8_t CLT01_38S::CLT01_38S_CheckParity(void)
+{
+  CLT_PARITY_Buffer = spi_rx_buff[0];
+  CLT_PARITY_Buffer = CLT_PARITY_Buffer & (0x3C);
+  CLT_PARITY_Buffer = CLT_PARITY_Buffer >> 2;
+  return CLT_PARITY_Buffer; 
+}
+
+/**********************************************************
+ * @brief      CLT Under_Voltage_Alarm_bit
+ * @param      None
+ * @retval     Under voltage alarm bit, COMPONENT_ERROR in case of alarm
+ **********************************************************/
+status_t CLT01_38S::CLT01_38S_UnderVoltAlarm(void)
+{
+  UVA_Buffer = spi_rx_buff[0];
+  UVA_Buffer = UVA_Buffer & (0x80);
+  
+  if(UVA_Buffer == 0x80) {
+    return COMPONENT_OK;
+  } else{ 
+    return COMPONENT_ERROR; 
+  }
+}
+
+/**********************************************************
+ * @brief  Get input information from input channels component 
+ * @param  rxBuff
+ * @retval None
+ **********************************************************/
+void CLT01_38S::CLT01_38S_DigInpArray_GetInput(uint8_t *inputArray)
+{
+  if(CLT01_38S_SpiReadBytes(spi_tx_buff, spi_rx_buff) != 0) {
+    /* Aborting the program */
+    exit(EXIT_FAILURE);
+  }
+  inputArray[0] = spi_rx_buff[0];
+  inputArray[1] = spi_rx_buff[1];
+}
+
+/**
+  * @} //end CLT01_38S Exported Functions
+  */
+
+/**
+  * @}  //end CLT01_38S Device Driver
+  */
+/**
+  * @}  //end Components
+   */
+/**
+  * @}  //close group  BSP
+  */
+
+/**
+  * @}  //close group  Drivers
+  */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Components/CLT01_38SQ7/CLT01_38S.h	Thu Jul 13 16:43:31 2017 +0000
@@ -0,0 +1,379 @@
+/**
+ ******************************************************************************
+ * @file    CLT01_38S.h
+ * @author  AST/CL
+ * @version V1.0.0
+ * @date    Feb 4th, 2016
+ * @brief   This file contains the class of an CLT01_38SQ7 PLC component.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *   1. Redistributions of source code must retain the above copyright notice,
+ *      this list of conditions and the following disclaimer.
+ *   2. Redistributions in binary form must reproduce the above copyright notice,
+ *      this list of conditions and the following disclaimer in the documentation
+ *      and/or other materials provided with the distribution.
+ *   3. Neither the name of STMicroelectronics nor the names of its contributors
+ *      may be used to endorse or promote products derived from this software
+ *      without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ******************************************************************************
+ */
+
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+
+#ifndef __CLT01_38S_CLASS_H
+#define __CLT01_38S_CLASS_H
+
+
+/* Includes ------------------------------------------------------------------*/
+
+/* ACTION 1 ------------------------------------------------------------------*
+ * Include here platform specific header files.                               *
+ *----------------------------------------------------------------------------*/        
+#include "mbed.h"
+
+/* ACTION 2 ------------------------------------------------------------------*
+ * Include here component specific header files.                              *
+ *----------------------------------------------------------------------------*/
+ #include "../Common/plc.h"
+
+/* ACTION 3 ------------------------------------------------------------------*
+ * Include here interface specific header files.                              *
+ *                                                                            *
+ * Example:                                                                   *
+ *   #include "../Interfaces/PLCInput.h"                                      *
+ *----------------------------------------------------------------------------*/
+#include "../Interfaces/PLCInput.h"
+
+
+/* Classes -------------------------------------------------------------------*/
+
+/**
+ * @brief Class representing an CLT01_38S component.
+ */
+class CLT01_38S : public PLCInput
+{
+public:
+
+    /*** Constructor and Destructor Methods ***/
+
+    /**
+     * @brief Constructor.
+     * @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.
+     */
+    CLT01_38S(PinName input_ssel, SPI &spi) : PLCInput(), ssel(input_ssel), dev_spi(spi)
+    {
+        /* Checking stackability. */
+        if (!(number_of_plc_input_components < MAX_NUMBER_OF_PLC_INPUT_COMPONENTS)) {
+            error("Instantiation of the CLT01_38S component failed: it can be stacked up to %d times.\r\n", MAX_NUMBER_OF_PLC_INPUT_COMPONENTS);
+        }
+
+        plc_input_component_instance = number_of_plc_input_components++;
+        memset(spi_tx_buff, 0, NB_BYTES * sizeof(uint8_t));
+        memset(spi_rx_buff, 0, NB_BYTES * sizeof(uint8_t));
+    }
+    
+    /**
+     * @brief Destructor.
+     */
+    virtual ~CLT01_38S(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 get_value(float *pData) //(1)                            *
+     *   {                                                                    *
+     *     return COMPONENT_get_value(float *pfData);                         *
+     *   }                                                                    *
+     *                                                                        *
+     *   virtual int enable_feature(void) //(2)                               *
+     *   {                                                                    *
+     *     return COMPONENT_enable_feature();                                 *
+     *   }                                                                    *
+     *------------------------------------------------------------------------*/
+    /**
+     * @brief  Initializing the component in 1/16 Microstepping mode.
+     * @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) CLT01_38S_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) CLT01_38S_ReadID((uint8_t *) id);
+    }
+
+    /**
+     * @brief  Set Read Status
+     * @param  None
+     * @retval Status
+     */
+    virtual uint8_t get_read_status(void)
+    {
+        return (uint8_t) CLT01_38S_GetReadStatus();
+    }
+
+    /**
+     * @brief   Set Read Status
+     * @param   Status
+     * @retval  None
+     */
+    virtual void set_read_status(uint8_t status)
+    {
+        CLT01_38S_SetReadStatus(status);
+    }
+
+    /**
+     * @brief   Get Input Status
+     * @param   None
+     * @retval  Channels status corresponding to 8 inputs
+     */
+    virtual uint8_t get_input_data(void)
+    {
+        return (uint8_t) CLT01_38S_GetInputData();
+    }
+
+    /**
+     * @brief   Over Temperature Alarm bit
+     * @param   None
+     * @retval  Overtemperature bit, 1 in case of alarm
+     */
+    virtual uint8_t over_temp_alarm(void)
+    {
+        return (uint8_t) CLT01_38S_OverTempAlarm();
+    }
+
+    /**
+     * @brief   Parity Check bits
+     * @param   None
+     * @retval  Parity bits for diagnosing inconsistency in data transmission
+     */
+    virtual uint8_t check_parity(void)
+    {
+        return (uint8_t) CLT01_38S_CheckParity();
+    }
+
+    /**
+     * @brief   Under Voltage Alarm bit
+     * @param   None
+     * @retval  Under voltage alarm bit, 1 in case of alarm
+     */
+    virtual uint8_t under_volt_alarm(void)
+    {
+        return (uint8_t) CLT01_38S_UnderVoltAlarm();
+    }
+
+    /**
+     * @brief   Get input information from output channels component
+     * @param   TX buffer
+     * @param   RX buffer
+     * @retval  None
+     */
+    virtual void dig_inp_array_get_input(uint8_t *inputArray)
+    {
+        CLT01_38S_DigInpArray_GetInput(inputArray);
+    }
+
+    /* Auxiliary method to enable or disable SPI CS pin */
+    virtual void set_input_spi(uint8_t l)
+    {
+        ssel = l;
+    }
+
+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_Init(void *init);                                 *
+     *------------------------------------------------------------------------*/
+    status_t CLT01_38S_Init(void *init);
+    status_t CLT01_38S_ReadID(uint8_t *id);
+    uint8_t CLT01_38S_GetReadStatus(void);
+    void CLT01_38S_SetReadStatus(uint8_t status);
+    uint8_t CLT01_38S_GetInputData(void);
+    status_t CLT01_38S_OverTempAlarm(void);
+    uint8_t CLT01_38S_CheckParity(void);
+    status_t CLT01_38S_UnderVoltAlarm(void);
+    void CLT01_38S_DigInpArray_GetInput(uint8_t *inputArray);
+    
+    /*** Component's I/O Methods ***/
+
+    /**
+     * @brief      Utility function to read and write data from/to CLT01_38S at the same time.
+     * @param[out] pBufferToRead pointer to the buffer to read data into.
+     * @param[in]  pBufferToWrite pointer to the buffer of data to send.
+     * @param[in]  NumValues number of values 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 NumValues)
+    {
+        (void) NumValues;
+        uint16_t dataToRead;
+        uint16_t dataToWrite;
+
+        // Converts two uint8_t words into one of uint16_t
+        dataToWrite = convertFrom8To16(pBufferToWrite);
+        
+        // Select the chip.
+        ssel = 0;
+
+        dataToRead = dev_spi.write(dataToWrite);
+
+        // Unselect the chip.
+        ssel = 1;
+
+        // Converts one uint16_t word into two uint8_t
+        convertFrom16To8(dataToRead, pBufferToRead);
+
+        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 CLT01_38S_Delay(uint32_t delay)
+    {
+        wait_ms(delay);
+    }
+
+    /**
+     * @brief      Writing and reading bytes to/from the component through the SPI at the same time.
+     * @param[in]  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 CLT01_38S_SpiReadBytes(uint8_t *pByteToTransmit, uint8_t *pReceivedByte)
+    {
+        return (uint8_t) (ReadWrite(pReceivedByte, pByteToTransmit, BUFFERSIZE) == 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;                                           *
+     *------------------------------------------------------------------------*/
+
+    /* ACTION 10 -------------------------------------------------------------*
+     * Declare here other pin related variables, if needed.                   *
+     *                                                                        *
+     * Example:                                                               *
+     *   + mbed:                                                              *
+     *     PwmOut pwm;                                                        *
+     *------------------------------------------------------------------------*/
+
+    /* ACTION 11 -------------------------------------------------------------*
+     * Declare here communication related variables, if needed.               *
+     *                                                                        *
+     * Example:                                                               *
+     *   + mbed:                                                              *
+     *     DigitalOut ssel;                                                   *
+     *     SPI &dev_spi;                                                      *
+     *------------------------------------------------------------------------*/
+    /* Configuration. */
+    DigitalOut ssel;
+
+    /* IO Device. */
+    SPI &dev_spi;
+
+    /* ACTION 12 -------------------------------------------------------------*
+     * Declare here identity related variables, if needed.                    *
+     * Note that there should be only a unique identifier for each component, *
+     * which should be the "who_am_i" parameter.                              *
+     *------------------------------------------------------------------------*/
+    /* Identity */
+    uint8_t who_am_i;
+
+    /* ACTION 13 -------------------------------------------------------------*
+     * Declare here the component's static and non-static data, one variable  *
+     * per line.                                                              *
+     *                                                                        *
+     * Example:                                                               *
+     *   float measure;                                                       *
+     *   int instance_id;                                                     *
+     *   static int number_of_instances;                                      *
+     *------------------------------------------------------------------------*/
+    /* Data. */
+    uint8_t plc_input_component_instance;
+
+    uint8_t OTA_Buffer;
+    uint8_t CLT_PARITY_Buffer;
+    uint8_t UVA_Buffer;
+    uint8_t CLT_INPUT_STATUS_Buffer;
+    uint8_t FLAG_CLT_READ;
+
+    /* Static data. */
+    static uint8_t number_of_plc_input_components;
+
+    /* Digital Input Array buffers for SPI communication */
+    uint8_t spi_tx_buff[NB_BYTES];
+    uint8_t spi_rx_buff[NB_BYTES];
+
+
+public:
+
+    /* Static data. */
+};
+
+#endif // __CLT01_38S_CLASS_H
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
\ No newline at end of file
--- a/Components/CLT01_38SQ7/CLT01_38S_class.cpp	Wed Feb 24 10:52:31 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,221 +0,0 @@
-/**
-  ******************************************************************************
-  * @file    CLT01_38S_class.cpp
-  * @author  System Lab Noida
-  * @version V1.0.0
-  * @date    08-July-2015
-  * @brief   PLC_CLT01-38SQ7
-  * This file provides firmware functions for how  to manage I/O from CLT01-38SQ7
-  ==============================================================================    
- 
-           
-  ******************************************************************************
-  * @attention
-  *
-  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
-  *
-  * Redistribution and use in source and binary forms, with or without modification,
-  * are permitted provided that the following conditions are met:
-  *   1. Redistributions of source code must retain the above copyright notice,
-  *      this list of conditions and the following disclaimer.
-  *   2. Redistributions in binary form must reproduce the above copyright notice,
-  *      this list of conditions and the following disclaimer in the documentation
-  *      and/or other materials provided with the distribution.
-  *   3. Neither the name of STMicroelectronics nor the names of its contributors
-  *      may be used to endorse or promote products derived from this software
-  *      without specific prior written permission.
-  *
-  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-  *
-  ******************************************************************************  
-  */
-  
-  /* Includes ------------------------------------------------------------------*/
-#include "plc.h"
-
-#include "CLT01_38S_class.h"
-    
-/** @addtogroup Drivers     Drivers
-  * @{
-  * @brief Demo Driver Layer
-  */    
-  
-/** @addtogroup BSP     BSP
-  * @{
-  */    
-    
-/** @addtogroup Components     Components
-  * @{
-  */
-
-/** @defgroup CLT01_38S    CLT01_38S
-  * @{ 
-  * @brief Digital Input Driver Layer
-  */
-
-/** @defgroup CLT01_38S_Private_variables     CLT01 38S Private variables
-  * @{
-  * @brief Digital Input Private variables
-  */
-
-/* Number of components */
-uint8_t CLT01_38S::number_of_plc_input_components = 0;
-
-
-/** @defgroup CLT01_38S_Exported_Functions     CLT01 38S Exported Functions
-  * @{
-  * @brief Digital Input exported Function 
-  */
-
-/**********************************************************
- * @brief Starts the CLT01_38S library
- * @param  init Initialization structure.
- * @retval COMPONENT_OK in case of success.
- **********************************************************/
-DrvStatusTypeDef CLT01_38S::CLT01_38S_Init(void *init)
-{
-    OTA_Buffer = 0x00;
-    CLT_PARITY_Buffer = 0x00;
-    UVA_Buffer = 0x00;
-    CLT_INPUT_STATUS_Buffer = 0x00;
-    FLAG_CLT_READ = 0;
-    
-    /* Unselect the CLT chip at startup to avoid FAULT */
-    ssel = 1;
-
-    return COMPONENT_OK;
-}
-
-/**********************************************************
- * @brief Read id
- * @param id pointer to the identifier to be read.
- * @retval COMPONENT_OK in case of success.
- **********************************************************/
-DrvStatusTypeDef CLT01_38S::CLT01_38S_ReadID(uint8_t *id)
-{
-  *id = plc_input_component_instance;
-
-  return COMPONENT_OK;
-}
-
-/**********************************************************
- * @brief      CLT Read Status
- * @param      None
- * @retval     Status
- **********************************************************/
-uint8_t CLT01_38S::CLT01_38S_GetReadStatus(void)
-{
-  return FLAG_CLT_READ;
-}
-
-/**********************************************************
- * @brief      Set CLT Read Status
- * @param      Status
- * @retval     None
- **********************************************************/
-void CLT01_38S::CLT01_38S_SetReadStatus(uint8_t status)
-{
-  FLAG_CLT_READ = status;
-}
-
-/**********************************************************
- * @brief      INPUT status
- * @param      None
- * @retval     Channels status corresponding to 8 inputs 
- **********************************************************/
-uint8_t CLT01_38S::CLT01_38S_GetInputData(void)
-{
-  CLT_INPUT_STATUS_Buffer = spi_rx_buff[1];
-  
-  return CLT_INPUT_STATUS_Buffer;
-}
-
-/**********************************************************
- * @brief      CLT Over_Temprature_Alarm
- * @param      None
- * @retval     Overtemperature bit, COMPONENT_ERROR in case of alarm
- **********************************************************/
-DrvStatusTypeDef CLT01_38S::CLT01_38S_OverTempAlarm(void)
-{
-  OTA_Buffer = spi_rx_buff[0];
-  OTA_Buffer = OTA_Buffer & (0x40);
- 
-  if(OTA_Buffer == 0x40)
-    return COMPONENT_OK;
-  else
-    return COMPONENT_ERROR;
-}
-
-/**********************************************************
- * @brief      CLT Parity_Check_bits
- * @param      None
- * @retval     Parity bits for diagnosing inconsistency in data transmission 
- **********************************************************/
-uint8_t CLT01_38S::CLT01_38S_CheckParity(void)
-{
-  CLT_PARITY_Buffer = spi_rx_buff[0];
-  CLT_PARITY_Buffer = CLT_PARITY_Buffer & (0x3C);
-  CLT_PARITY_Buffer = CLT_PARITY_Buffer >> 2;
-  return CLT_PARITY_Buffer; 
-}
-
-/**********************************************************
- * @brief      CLT Under_Voltage_Alarm_bit
- * @param      None
- * @retval     Under voltage alarm bit, COMPONENT_ERROR in case of alarm
- **********************************************************/
-DrvStatusTypeDef CLT01_38S::CLT01_38S_UnderVoltAlarm(void)
-{
-  UVA_Buffer = spi_rx_buff[0];
-  UVA_Buffer = UVA_Buffer & (0x80);
-  
-  if(UVA_Buffer == 0x80)
-    return COMPONENT_OK;
-  else
-    return COMPONENT_ERROR; 
-}
-
-/**********************************************************
- * @brief  Get input information from input channels component 
- * @param  rxBuff
- * @retval None
- **********************************************************/
-void CLT01_38S::CLT01_38S_DigInpArray_GetInput(uint8_t *inputArray)
-{
-  if(CLT01_38S_SpiReadBytes(spi_tx_buff, spi_rx_buff) != 0)
-  {
-      /* Aborting the program */
-      exit(EXIT_FAILURE);
-  }
-  inputArray[0] = spi_rx_buff[0];
-  inputArray[1] = spi_rx_buff[1];
-}
-
-/**
-  * @} //end CLT01_38S Exported Functions
-  */
-
-/**
-  * @}  //end CLT01_38S Device Driver
-  */
-/**
-  * @}  //end Components
-   */
-/**
-  * @}  //close group  BSP
-  */
-
-/**
-  * @}  //close group  Drivers
-  */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/  
\ No newline at end of file
--- a/Components/CLT01_38SQ7/CLT01_38S_class.h	Wed Feb 24 10:52:31 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,378 +0,0 @@
-/**
- ******************************************************************************
- * @file    CLT01_38S_class.h
- * @author  AST/CL
- * @version V1.0.0
- * @date    Feb 4th, 2016
- * @brief   This file contains the class of an CLT01_38SQ7 PLC component.
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *   1. Redistributions of source code must retain the above copyright notice,
- *      this list of conditions and the following disclaimer.
- *   2. Redistributions in binary form must reproduce the above copyright notice,
- *      this list of conditions and the following disclaimer in the documentation
- *      and/or other materials provided with the distribution.
- *   3. Neither the name of STMicroelectronics nor the names of its contributors
- *      may be used to endorse or promote products derived from this software
- *      without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- ******************************************************************************
- */
-
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-
-#ifndef __CLT01_38S_CLASS_H
-#define __CLT01_38S_CLASS_H
-
-
-/* Includes ------------------------------------------------------------------*/
-
-/* ACTION 1 ------------------------------------------------------------------*
- * Include here platform specific header files.                               *
- *----------------------------------------------------------------------------*/        
-#include "mbed.h"
-
-/* ACTION 2 ------------------------------------------------------------------*
- * Include here component specific header files.                              *
- *----------------------------------------------------------------------------*/
- #include "../Common/plc.h"
-
-/* ACTION 3 ------------------------------------------------------------------*
- * Include here interface specific header files.                              *
- *                                                                            *
- * Example:                                                                   *
- *   #include "../Interfaces/PLCInput.h"                                      *
- *----------------------------------------------------------------------------*/
-#include "../Interfaces/PLCInput_class.h"
-
-
-/* Classes -------------------------------------------------------------------*/
-
-/**
- * @brief Class representing an CLT01_38S component.
- */
-class CLT01_38S : public PLCInput
-{
-public:
-
-    /*** Constructor and Destructor Methods ***/
-
-    /**
-     * @brief Constructor.
-     * @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.
-     */
-    CLT01_38S(PinName input_ssel, SPI &spi) : PLCInput(), ssel(input_ssel), dev_spi(spi)
-    {
-        /* Checking stackability. */
-        if (!(number_of_plc_input_components < MAX_NUMBER_OF_PLC_INPUT_COMPONENTS))
-            error("Instantiation of the CLT01_38S component failed: it can be stacked up to %d times.\r\n", MAX_NUMBER_OF_PLC_INPUT_COMPONENTS);
-
-        plc_input_component_instance = number_of_plc_input_components++;
-        memset(spi_tx_buff, 0, NB_BYTES * sizeof(uint8_t));
-        memset(spi_rx_buff, 0, NB_BYTES * sizeof(uint8_t));
-    }
-    
-    /**
-     * @brief Destructor.
-     */
-    virtual ~CLT01_38S(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  Initializing the component in 1/16 Microstepping mode.
-     * @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) CLT01_38S_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 ReadID(uint8_t *id = NULL)
-    {
-        return (int) CLT01_38S_ReadID((uint8_t *) id);
-    }
-
-    /**
-     * @brief  Set Read Status
-     * @param  None
-     * @retval Status
-     */
-    virtual uint8_t GetReadStatus(void)
-    {
-        return (uint8_t) CLT01_38S_GetReadStatus();
-    }
-
-    /**
-     * @brief   Set Read Status
-     * @param   Status
-     * @retval  None
-     */
-    virtual void SetReadStatus(uint8_t status)
-    {
-        CLT01_38S_SetReadStatus(status);
-    }
-
-    /**
-     * @brief   Get Input Status
-     * @param   None
-     * @retval  Channels status corresponding to 8 inputs
-     */
-    virtual uint8_t GetInputData(void)
-    {
-        return (uint8_t) CLT01_38S_GetInputData();
-    }
-
-    /**
-     * @brief   Over Temperature Alarm bit
-     * @param   None
-     * @retval  Overtemperature bit, 1 in case of alarm
-     */
-    virtual uint8_t OverTempAlarm(void)
-    {
-        return (uint8_t) CLT01_38S_OverTempAlarm();
-    }
-
-    /**
-     * @brief   Parity Check bits
-     * @param   None
-     * @retval  Parity bits for diagnosing inconsistency in data transmission
-     */
-    virtual uint8_t CheckParity(void)
-    {
-        return (uint8_t) CLT01_38S_CheckParity();
-    }
-
-    /**
-     * @brief   Under Voltage Alarm bit
-     * @param   None
-     * @retval  Under voltage alarm bit, 1 in case of alarm
-     */
-    virtual uint8_t UnderVoltAlarm(void)
-    {
-        return (uint8_t) CLT01_38S_UnderVoltAlarm();
-    }
-
-    /**
-     * @brief   Get input information from output channels component
-     * @param   TX buffer
-     * @param   RX buffer
-     * @retval  None
-     */
-    virtual void DigInpArray_GetInput(uint8_t *inputArray)
-    {
-        CLT01_38S_DigInpArray_GetInput(inputArray);
-    }
-
-    /* Auxiliary method to enable or disable SPI CS pin */
-    virtual void setInputSPI(uint8_t l)
-    {
-        ssel = l;
-    }
-
-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:                                                               *
-     *   DrvStatusTypeDef COMPONENT_Init(void *init);                         *
-     *------------------------------------------------------------------------*/
-    DrvStatusTypeDef CLT01_38S_Init(void *init);
-    DrvStatusTypeDef CLT01_38S_ReadID(uint8_t *id);
-    uint8_t CLT01_38S_GetReadStatus(void);
-    void CLT01_38S_SetReadStatus(uint8_t status);
-    uint8_t CLT01_38S_GetInputData(void);
-    DrvStatusTypeDef CLT01_38S_OverTempAlarm(void);
-    uint8_t CLT01_38S_CheckParity(void);
-    DrvStatusTypeDef CLT01_38S_UnderVoltAlarm(void);
-    void CLT01_38S_DigInpArray_GetInput(uint8_t *inputArray);
-    
-    /*** Component's I/O Methods ***/
-
-    /**
-     * @brief      Utility function to read and write data from/to CLT01_38S at the same time.
-     * @param[out] pBufferToRead pointer to the buffer to read data into.
-     * @param[in]  pBufferToWrite pointer to the buffer of data to send.
-     * @param[in]  NumValues number of values to read and write.
-     * @retval     COMPONENT_OK in case of success, COMPONENT_ERROR otherwise.
-     */
-    DrvStatusTypeDef ReadWrite(uint8_t* pBufferToRead, uint8_t* pBufferToWrite, uint16_t NumValues)
-    {
-        (void) NumValues;
-        uint16_t dataToRead;
-        uint16_t dataToWrite;
-
-        // Converts two uint8_t words into one of uint16_t
-        dataToWrite = convertFrom8To16(pBufferToWrite);
-        
-        // Select the chip.
-        ssel = 0;
-
-        dataToRead = dev_spi.write(dataToWrite);
-
-        // Unselect the chip.
-        ssel = 1;
-
-        // Converts one uint16_t word into two uint8_t
-        convertFrom16To8(dataToRead, pBufferToRead);
-
-        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 CLT01_38S_Delay(uint32_t delay)
-    {
-        wait_ms(delay);
-    }
-
-    /**
-     * @brief      Writing and reading bytes to/from the component through the SPI at the same time.
-     * @param[in]  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 CLT01_38S_SpiReadBytes(uint8_t *pByteToTransmit, uint8_t *pReceivedByte)
-    {
-        return (uint8_t) (ReadWrite(pReceivedByte, pByteToTransmit, BUFFERSIZE) == 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;                                           *
-     *------------------------------------------------------------------------*/
-
-    /* ACTION 10 -------------------------------------------------------------*
-     * Declare here other pin related variables, if needed.                   *
-     *                                                                        *
-     * Example:                                                               *
-     *   + mbed:                                                              *
-     *     PwmOut pwm;                                                        *
-     *------------------------------------------------------------------------*/
-
-    /* ACTION 11 -------------------------------------------------------------*
-     * Declare here communication related variables, if needed.               *
-     *                                                                        *
-     * Example:                                                               *
-     *   + mbed:                                                              *
-     *     DigitalOut ssel;                                                   *
-     *     SPI &dev_spi;                                                   *
-     *------------------------------------------------------------------------*/
-    /* Configuration. */
-    DigitalOut ssel;
-
-    /* IO Device. */
-    SPI &dev_spi;
-
-    /* ACTION 12 -------------------------------------------------------------*
-     * Declare here identity related variables, if needed.                    *
-     * Note that there should be only a unique identifier for each component, *
-     * which should be the "who_am_i" parameter.                              *
-     *------------------------------------------------------------------------*/
-    /* Identity */
-    uint8_t who_am_i;
-
-    /* ACTION 13 -------------------------------------------------------------*
-     * Declare here the component's static and non-static data, one variable  *
-     * per line.                                                              *
-     *                                                                        *
-     * Example:                                                               *
-     *   float measure;                                                       *
-     *   int instance_id;                                                     *
-     *   static int number_of_instances;                                      *
-     *------------------------------------------------------------------------*/
-    /* Data. */
-    uint8_t plc_input_component_instance;
-
-    uint8_t OTA_Buffer;
-    uint8_t CLT_PARITY_Buffer;
-    uint8_t UVA_Buffer;
-    uint8_t CLT_INPUT_STATUS_Buffer;
-    uint8_t FLAG_CLT_READ;
-
-    /* Static data. */
-    static uint8_t number_of_plc_input_components;
-
-    /* Digital Input Array buffers for SPI communication */
-    uint8_t spi_tx_buff[NB_BYTES];
-    uint8_t spi_rx_buff[NB_BYTES];
-
-
-public:
-
-    /* Static data. */
-};
-
-#endif // __CLT01_38S_CLASS_H
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
\ No newline at end of file
--- a/Components/Common/component.h	Wed Feb 24 10:52:31 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-/**
- ******************************************************************************
- * @file    component.h
- * @author  AST
- * @version V1.0.0
- * @date    1 April 2015
- * @brief   Generic header file containing a generic component's definitions
- *          and I/O functions.
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *   1. Redistributions of source code must retain the above copyright notice,
- *      this list of conditions and the following disclaimer.
- *   2. Redistributions in binary form must reproduce the above copyright notice,
- *      this list of conditions and the following disclaimer in the documentation
- *      and/or other materials provided with the distribution.
- *   3. Neither the name of STMicroelectronics nor the names of its contributors
- *      may be used to endorse or promote products derived from this software
- *      without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- ******************************************************************************
- */
-
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-
-#ifndef __COMPONENT_H
-#define __COMPONENT_H
-
-
-/* Types ---------------------------------------------------------------------*/
-
-/**
- * @brief  Component's Context structure definition.
- */
-typedef struct
-{  
-    /* Identity. */
-    uint8_t who_am_i;
-
-    /* ACTION ----------------------------------------------------------------*/
-    /* There should be only a unique identifier for each component, which     */
-    /* should be the "who_am_i" parameter, hence this parameter is optional.  */
-    /* -----------------------------------------------------------------------*/
-    /* Type. */
-    uint8_t type;
-
-    /* Configuration. */
-    uint8_t address;
-
-    /* Pointer to the Data. */
-    void *pData;
-
-    /* Pointer to the Virtual Table. */
-    void *pVTable;
-
-    /* ACTION ----------------------------------------------------------------*/
-    /* There should be only a unique virtual table for each component, which  */
-    /* should be the "pVTable" parameter, hence this parameter is optional.   */
-    /* -----------------------------------------------------------------------*/
-    /* Pointer to the Extended Virtual Table. */
-    void *pExtVTable;
-} DrvContextTypeDef;;
-
-/**
- * @brief  Component's Status enumerator definition.
- */
-typedef enum
-{
-    COMPONENT_OK = 0,
-    COMPONENT_ERROR,
-    COMPONENT_TIMEOUT,
-    COMPONENT_NOT_IMPLEMENTED
-} DrvStatusTypeDef;
-
-#endif /* __COMPONENT_H */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Components/Common/component_def.h	Thu Jul 13 16:43:31 2017 +0000
@@ -0,0 +1,93 @@
+/**
+ ******************************************************************************
+ * @file    component_def.h
+ * @author  AST
+ * @version V1.0.0
+ * @date    1 April 2015
+ * @brief   Generic header file containing a generic component's definitions
+ *          and I/O functions.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *   1. Redistributions of source code must retain the above copyright notice,
+ *      this list of conditions and the following disclaimer.
+ *   2. Redistributions in binary form must reproduce the above copyright notice,
+ *      this list of conditions and the following disclaimer in the documentation
+ *      and/or other materials provided with the distribution.
+ *   3. Neither the name of STMicroelectronics nor the names of its contributors
+ *      may be used to endorse or promote products derived from this software
+ *      without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ******************************************************************************
+ */
+
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+
+#ifndef __COMPONENT_H
+#define __COMPONENT_H
+
+
+/* Types ---------------------------------------------------------------------*/
+
+/**
+ * @brief  Component's Context structure definition.
+ */
+typedef struct
+{  
+    /* Identity. */
+    uint8_t who_am_i;
+
+    /* ACTION ----------------------------------------------------------------*/
+    /* There should be only a unique identifier for each component, which     */
+    /* should be the "who_am_i" parameter, hence this parameter is optional.  */
+    /* -----------------------------------------------------------------------*/
+    /* Type. */
+    uint8_t type;
+
+    /* Configuration. */
+    uint8_t address;
+
+    /* Pointer to the Data. */
+    void *p_data;
+
+    /* Pointer to the Virtual Table. */
+    void *p_vt;
+
+    /* ACTION ----------------------------------------------------------------*/
+    /* There should be only a unique virtual table for each component, which  */
+    /* should be the "p_vt" parameter, hence this parameter is optional.      */
+    /* -----------------------------------------------------------------------*/
+    /* Pointer to the Extended Virtual Table. */
+    void *p_ext_vt;
+} handle_t;
+
+/**
+ * @brief  Component's Status enumerator definition.
+ */
+typedef enum
+{
+    COMPONENT_OK = 0,
+    COMPONENT_ERROR,
+    COMPONENT_TIMEOUT,
+    COMPONENT_NOT_IMPLEMENTED
+} status_t;
+
+#endif /* __COMPONENT_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
--- a/Components/Common/plc.h	Wed Feb 24 10:52:31 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,175 +0,0 @@
-/**
- ******************************************************************************
- * @file    plc.h
- * @author  System Lab Noida
- * @version V1.0.0
- * @date    08-July-2015
- * @brief   This header file contains the functions prototypes for the
- *          plc driver.
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *   1. Redistributions of source code must retain the above copyright notice,
- *      this list of conditions and the following disclaimer.
- *   2. Redistributions in binary form must reproduce the above copyright notice,
- *      this list of conditions and the following disclaimer in the documentation
- *      and/or other materials provided with the distribution.
- *   3. Neither the name of STMicroelectronics nor the names of its contributors
- *      may be used to endorse or promote products derived from this software
- *      without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- ******************************************************************************
- */
-
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-
-#ifndef __PLC_H
-#define __PLC_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* Includes ------------------------------------------------------------------*/
-
-#include <stdint.h>
-#include "component.h"
-
-
-/* Definitions ---------------------------------------------------------------*/
-
-/** @addtogroup BSP
-  * @{
-  */
-
-/** @addtogroup Components
-  * @{
-  */
-
-/** @addtogroup PLC
-  * @{
-  */
-
-/** @defgroup PLC_Exported_Constants
-  * @{
-  */
-#define MAX_NUMBER_OF_PLC_INPUT_COMPONENTS 1
-#define MAX_NUMBER_OF_PLC_OUTPUT_COMPONENTS 1
-
-#define NB_BYTES 2
-#define BUFFERSIZE 1
-
-
-/* Types ---------------------------------------------------------------------*/
-
-/** @defgroup PLC_Exported_Types
-  * @{
-  */
-
-/** @defgroup PLC_Exported_variables     plc Exported variables
-  * @{
-  * @brief Exported variables 
-  */
-
-/**
- * @brief  SSRELAY driver structure definition
- */
-typedef struct
-{
-  void (*SetChannels) (uint8_t Out_array);
-  uint8_t (*ManageFault)(void);
-  uint8_t (*CheckDCDCStatus)(void);
-  uint8_t (*TemperatureWarning)(void);
-  uint8_t (*CheckParity)(void);
-  uint8_t (*CheckPowerGood)(void);
-  uint8_t (*CheckCommError)(void);
-  void (*Ssrelay_SetOutput)(uint8_t *TxBuff, uint8_t *RxBuff);
-} SSRELAY_DrvTypeDef;
-
-
-/**
- * @brief  DIGITALINPUTARRAY driver structure definition
- */
-typedef struct
-{
-  uint8_t (*GetReadStatus)(void);
-  void (*SetReadStatus)(uint8_t status);
-  uint8_t (*GetInputData)(void);
-  uint8_t (*OverTempAlarm)(void);
-  uint8_t (*CheckParity)(void);
-  uint8_t (*UnderVoltAlarm)(void);
-  void (*DigInpArray_GetInput)(uint8_t *TxBuff, uint8_t *RxBuff);       
-} DIGITALINPUTARRAY_DrvTypeDef;
-    
-
-/* Functions -----------------------------------------------------------------*/
-
-/**
- * @brief      Converts two uint8_t words into one of uint16_t
- * @param[in]  ptr pointer to the buffer of data to be converted.
- * @retval     16-bit data.
- */
-inline uint16_t convertFrom8To16(uint8_t *ptr)
-{
-    uint16_t data16 = 0x0000;
-    
-    data16 = *ptr;
-    data16 |= *(++ptr) << 8;
-    
-    return data16;
-}
-
-/**
- * @brief      Converts one uint16_t word into two uint8_t
- * @param[in]  ptr pointer to the buffer of uint8_t words.
- * @param[in]  16-bit data.
- * @retval     none.
- */
-inline void convertFrom16To8(uint16_t data16, uint8_t *ptr)
-{
-    *(ptr) = data16 & 0x00FF;
-    *(++ptr) = (data16 >> 8) & 0x00FF;
-}
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-#ifdef   __cplusplus
-}
-#endif
-
-#endif /* __PLC_H */
-/**
-  * @} // end   plc Exported Function
-  */
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Components/Interfaces/Component.h	Thu Jul 13 16:43:31 2017 +0000
@@ -0,0 +1,81 @@
+/**
+ ******************************************************************************
+ * @file    Component.h
+ * @author  AST
+ * @version V1.0.0
+ * @date    April 13th, 2015
+ * @brief   This file contains the abstract class describing the interface of a
+ *          generic component.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *   1. Redistributions of source code must retain the above copyright notice,
+ *      this list of conditions and the following disclaimer.
+ *   2. Redistributions in binary form must reproduce the above copyright notice,
+ *      this list of conditions and the following disclaimer in the documentation
+ *      and/or other materials provided with the distribution.
+ *   3. Neither the name of STMicroelectronics nor the names of its contributors
+ *      may be used to endorse or promote products derived from this software
+ *      without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ******************************************************************************
+ */
+
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+
+#ifndef __COMPONENT_CLASS_H
+#define __COMPONENT_CLASS_H
+
+
+/* Includes ------------------------------------------------------------------*/
+
+#include <stdint.h>
+
+
+/* Classes  ------------------------------------------------------------------*/
+
+/**
+ * An abstract class for Generic components.
+ */
+class Component {
+public:
+
+    /**
+     * @brief     Initializing the component.
+     * @param[in] init pointer to device specific initalization structure.
+     * @retval    "0" in case of success, an error code otherwise.
+     */
+    virtual int init(void *init) = 0;
+
+    /**
+     * @brief      Getting the ID of the component.
+     * @param[out] 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) = 0;
+
+    /**
+     * @brief Destructor.
+     */
+    virtual ~Component() {};
+};
+
+#endif /* __COMPONENT_CLASS_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
--- a/Components/Interfaces/Component_class.h	Wed Feb 24 10:52:31 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/**
- ******************************************************************************
- * @file    Component_class.h
- * @author  AST/CL
- * @version V1.0.0
- * @date    Feb 4th, 2016
- * @brief   This file contains the abstract class describing the interface of a
- *          generic component.
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *   1. Redistributions of source code must retain the above copyright notice,
- *      this list of conditions and the following disclaimer.
- *   2. Redistributions in binary form must reproduce the above copyright notice,
- *      this list of conditions and the following disclaimer in the documentation
- *      and/or other materials provided with the distribution.
- *   3. Neither the name of STMicroelectronics nor the names of its contributors
- *      may be used to endorse or promote products derived from this software
- *      without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- ******************************************************************************
- */
-
-
-/* Define to prevent from recursive inclusion --------------------------------*/
-
-#ifndef __COMPONENT_CLASS_H
-#define __COMPONENT_CLASS_H
-
-
-/* Includes ------------------------------------------------------------------*/
-
-#include <stdint.h>
-
-
-/* Classes  ------------------------------------------------------------------*/
-
-/** An abstract class for Generic components.
- */
-class Component
-{
-public:
-    /**
-     * @brief  Initializing the component.
-     * @param  init Pointer to device specific initalization structure.
-     * @retval "0" in case of success, an error code otherwise.
-     */
-    virtual int Init(void *init) = 0;
-
-    /**
-     * @brief  Getting the ID of the component.
-     * @param  id Pointer to an allocated variable to store the ID into.
-     * @retval "0" in case of success, an error code otherwise.
-     */
-    virtual int ReadID(uint8_t *id) = 0;
-};
-
-#endif /* __COMPONENT_CLASS_H */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Components/Interfaces/PLCInput.h	Thu Jul 13 16:43:31 2017 +0000
@@ -0,0 +1,122 @@
+/**
+ ******************************************************************************
+ * @file    PLCInput.h
+ * @author  AST/CL
+ * @version V1.0.0
+ * @date    Feb 4th, 2016
+ * @brief   This file contains the abstract class describing the interface of a
+ *          PLC input component.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *   1. Redistributions of source code must retain the above copyright notice,
+ *      this list of conditions and the following disclaimer.
+ *   2. Redistributions in binary form must reproduce the above copyright notice,
+ *      this list of conditions and the following disclaimer in the documentation
+ *      and/or other materials provided with the distribution.
+ *   3. Neither the name of STMicroelectronics nor the names of its contributors
+ *      may be used to endorse or promote products derived from this software
+ *      without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ******************************************************************************
+ */
+
+
+/* Define to prevent from recursive inclusion --------------------------------*/
+
+#ifndef __PLCINPUT_CLASS_H
+#define __PLCINPUT_CLASS_H
+
+
+/* Includes ------------------------------------------------------------------*/
+
+#include <Component.h>
+
+
+/* Classes  ------------------------------------------------------------------*/
+
+/** An abstract class for PLCInput component.
+ */
+class PLCInput : public Component
+{
+public:
+
+    /**
+     * @brief   Get Read Status
+     * @param   None
+     * @retval  Status
+     */
+    virtual uint8_t get_read_status(void) = 0;
+
+    /**
+     * @brief   Set Read Status
+     * @param   Status
+     * @retval  None
+     */
+    virtual void set_read_status(uint8_t status) = 0;
+
+    /**
+     * @brief   Get Input Status
+     * @param   None
+     * @retval  Channels status corresponding to 8 inputs
+     */
+     virtual uint8_t get_input_data(void) = 0;
+
+    /**
+     * @brief   Over Temperature Alarm bit
+     * @param   None
+     * @retval  Overtemperature bit, 1 in case of alarm
+     */
+     virtual uint8_t over_temp_alarm(void) = 0;
+
+    /**
+     * @brief   Parity Check bits
+     * @param   None
+     * @retval  Parity bits for diagnosing inconsistency in data transmission
+     */
+     virtual uint8_t check_parity(void) = 0;
+
+    /**
+     * @brief   Under Voltage Alarm bit
+     * @param   None
+     * @retval  Under voltage alarm bit, 1 in case of alarm
+     */
+     virtual uint8_t under_volt_alarm(void) = 0;
+
+    /**
+     * @brief   Get input information from input channels component
+     * @param   RX buffer
+     * @retval  None
+     */
+     virtual void dig_inp_array_get_input(uint8_t *inputArray) = 0;
+     
+     /**
+      * @brief  Auxiliary method to enable or disable SPI CS pin.
+      * @param  l flag to enable or disable SPI CS pin
+      */
+     virtual void set_input_spi(uint8_t l) = 0;
+
+    /**
+     * @brief Destructor.
+     */
+    virtual ~PLCInput() {};
+};
+
+#endif /* __PLCINPUT_CLASS_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 
--- a/Components/Interfaces/PLCInput_class.h	Wed Feb 24 10:52:31 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,114 +0,0 @@
-/**
- ******************************************************************************
- * @file    PLCInput_class.h
- * @author  AST/CL
- * @version V1.0.0
- * @date    Feb 4th, 2016
- * @brief   This file contains the abstract class describing the interface of a
- *          PLC input component.
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *   1. Redistributions of source code must retain the above copyright notice,
- *      this list of conditions and the following disclaimer.
- *   2. Redistributions in binary form must reproduce the above copyright notice,
- *      this list of conditions and the following disclaimer in the documentation
- *      and/or other materials provided with the distribution.
- *   3. Neither the name of STMicroelectronics nor the names of its contributors
- *      may be used to endorse or promote products derived from this software
- *      without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- ******************************************************************************
- */
-
-
-/* Define to prevent from recursive inclusion --------------------------------*/
-
-#ifndef __PLCINPUT_CLASS_H
-#define __PLCINPUT_CLASS_H
-
-
-/* Includes ------------------------------------------------------------------*/
-
-#include <Component_class.h>
-
-
-/* Classes  ------------------------------------------------------------------*/
-
-/** An abstract class for PLCInput component.
- */
-class PLCInput : public Component
-{
-public:
-
-    /**
-     * @brief   Get Read Status
-     * @param   None
-     * @retval  Status
-     */
-    virtual uint8_t GetReadStatus(void) = 0;
-
-    /**
-     * @brief   Set Read Status
-     * @param   Status
-     * @retval  None
-     */
-    virtual void SetReadStatus(uint8_t status) = 0;
-
-    /**
-     * @brief   Get Input Status
-     * @param   None
-     * @retval  Channels status corresponding to 8 inputs
-     */
-     virtual uint8_t GetInputData(void) = 0;
-
-    /**
-     * @brief   Over Temperature Alarm bit
-     * @param   None
-     * @retval  Overtemperature bit, 1 in case of alarm
-     */
-     virtual uint8_t OverTempAlarm(void) = 0;
-
-    /**
-     * @brief   Parity Check bits
-     * @param   None
-     * @retval  Parity bits for diagnosing inconsistency in data transmission
-     */
-     virtual uint8_t CheckParity(void) = 0;
-
-    /**
-     * @brief   Under Voltage Alarm bit
-     * @param   None
-     * @retval  Under voltage alarm bit, 1 in case of alarm
-     */
-     virtual uint8_t UnderVoltAlarm(void) = 0;
-
-    /**
-     * @brief   Get input information from input channels component
-     * @param   RX buffer
-     * @retval  None
-     */
-     virtual void DigInpArray_GetInput(uint8_t *inputArray) = 0;
-     
-     /* Auxiliary method to enable or disable SPI CS pin */
-     virtual void setInputSPI(uint8_t l) = 0;
-};
-
-#endif /* __PLCINPUT_CLASS_H */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Components/Interfaces/PLCOutput.h	Thu Jul 13 16:43:31 2017 +0000
@@ -0,0 +1,123 @@
+/**
+ ******************************************************************************
+ * @file    PLCOutput.h
+ * @author  AST/CL
+ * @version V1.0.0
+ * @date    Feb 4th, 2016
+ * @brief   This file contains the abstract class describing the interface of a
+ *          PLC output component.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *   1. Redistributions of source code must retain the above copyright notice,
+ *      this list of conditions and the following disclaimer.
+ *   2. Redistributions in binary form must reproduce the above copyright notice,
+ *      this list of conditions and the following disclaimer in the documentation
+ *      and/or other materials provided with the distribution.
+ *   3. Neither the name of STMicroelectronics nor the names of its contributors
+ *      may be used to endorse or promote products derived from this software
+ *      without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ******************************************************************************
+ */
+
+
+/* Define to prevent from recursive inclusion --------------------------------*/
+
+#ifndef __PLCOUTPUT_CLASS_H
+#define __PLCOUTPUT_CLASS_H
+
+
+/* Includes ------------------------------------------------------------------*/
+
+#include <Component.h>
+
+
+/* Classes  ------------------------------------------------------------------*/
+
+/** An abstract class for PLCOutut component.
+ */
+class PLCOutput : public Component
+{
+public:
+
+    /**
+     * @brief   Set output channels state
+     * @param   Output channel data
+     * @retval  None
+     */
+    virtual void set_channels(uint8_t Out_array) = 0;
+
+    /**
+     * @brief   Get output fault status
+     * @param   None
+     * @retval  Output channel fault data
+     */
+    virtual uint8_t manage_fault(void) = 0;
+
+    /**
+     * @brief   Get DC-DC status of the output channels component
+     * @param   None
+     * @retval  Feedback status, 1 if OK else 0
+     */
+     virtual uint8_t check_dcdc_status(void) = 0;
+
+    /**
+     * @brief   Get temperature warning status
+     * @param   None
+     * @retval  Temperature warning status, 1 if over temperature
+     */
+     virtual uint8_t temperature_warning(void) = 0;
+
+    /**
+     * @brief   Get parity check status
+     * @param   None
+     * @retval  Parity check flag
+     */
+     virtual uint8_t check_parity(void) = 0;
+
+    /**
+     * @brief   Get power supply status
+     * @param   None
+     * @retval  Power good bit, 1 in case of power good
+     */
+     virtual uint8_t check_power_good(void) = 0;
+
+    /**
+     * @brief   Get parity bits for input data
+     * @param   None
+     * @retval  Parity bits
+     */
+     virtual uint8_t check_comm_error(void) = 0;
+
+    /**
+     * @brief   Set output for output channels component
+     * @param   TX buffer
+     * @retval  None
+     */
+     virtual void ssrelay_set_output(uint8_t *outputArray) = 0;
+
+    /**
+     * @brief Destructor.
+     */
+    virtual ~PLCOutput() {};
+};
+
+#endif /* __PLCOUTPUT_CLASS_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 
--- a/Components/Interfaces/PLCOutput_class.h	Wed Feb 24 10:52:31 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,118 +0,0 @@
-/**
- ******************************************************************************
- * @file    PLCOutput_class.h
- * @author  AST/CL
- * @version V1.0.0
- * @date    Feb 4th, 2016
- * @brief   This file contains the abstract class describing the interface of a
- *          PLC output component.
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *   1. Redistributions of source code must retain the above copyright notice,
- *      this list of conditions and the following disclaimer.
- *   2. Redistributions in binary form must reproduce the above copyright notice,
- *      this list of conditions and the following disclaimer in the documentation
- *      and/or other materials provided with the distribution.
- *   3. Neither the name of STMicroelectronics nor the names of its contributors
- *      may be used to endorse or promote products derived from this software
- *      without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- ******************************************************************************
- */
-
-
-/* Define to prevent from recursive inclusion --------------------------------*/
-
-#ifndef __PLCOUTPUT_CLASS_H
-#define __PLCOUTPUT_CLASS_H
-
-
-/* Includes ------------------------------------------------------------------*/
-
-#include <Component_class.h>
-
-
-/* Classes  ------------------------------------------------------------------*/
-
-/** An abstract class for PLCOutut component.
- */
-class PLCOutput : public Component
-{
-public:
-
-    /**
-     * @brief   Set output channels state
-     * @param   Output channel data
-     * @retval  None
-     */
-    virtual void SetChannels(uint8_t Out_array) = 0;
-
-    /**
-     * @brief   Get output fault status
-     * @param   None
-     * @retval  Output channel fault data
-     */
-    virtual uint8_t ManageFault(void) = 0;
-
-    /**
-     * @brief   Get DC-DC status of the output channels component
-     * @param   None
-     * @retval  Feedback status, 1 if OK else 0
-     */
-     virtual uint8_t CheckDCDCStatus(void) = 0;
-
-    /**
-     * @brief   Get temperature warning status
-     * @param   None
-     * @retval  Temperature warning status, 1 if over temperature
-     */
-     virtual uint8_t TemperatureWarning(void) = 0;
-
-    /**
-     * @brief   Get parity check status
-     * @param   None
-     * @retval  Parity check flag
-     */
-     virtual uint8_t CheckParity(void) = 0;
-
-    /**
-     * @brief   Get power supply status
-     * @param   None
-     * @retval  Power good bit, 1 in case of power good
-     */
-     virtual uint8_t CheckPowerGood(void) = 0;
-
-    /**
-     * @brief   Get parity bits for input data
-     * @param   None
-     * @retval  Parity bits
-     */
-     virtual uint8_t CheckCommError(void) = 0;
-
-    /**
-     * @brief   Set output for output channels component
-     * @param   TX buffer
-     * @retval  None
-     */
-     virtual void Ssrelay_SetOutput(uint8_t *outputArray) = 0;
-};
-
-#endif /* __PLCOUTPUT_CLASS_H */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Components/VNI8200XP/VNI8200XP.cpp	Thu Jul 13 16:43:31 2017 +0000
@@ -0,0 +1,246 @@
+/**
+  ******************************************************************************
+  * @file    VNI8200XP.cpp
+  * @author  System Lab Noida
+  * @version V1.0.0
+  * @date    08-July-2015
+  * @brief   PLC_CLT01-38SQ7
+  * This file provides firmware functions for how  to manage I/O from VNI8200XP
+  ==============================================================================    
+ 
+           
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * Redistribution and use in source and binary forms, with or without modification,
+  * are permitted provided that the following conditions are met:
+  *   1. Redistributions of source code must retain the above copyright notice,
+  *      this list of conditions and the following disclaimer.
+  *   2. Redistributions in binary form must reproduce the above copyright notice,
+  *      this list of conditions and the following disclaimer in the documentation
+  *      and/or other materials provided with the distribution.
+  *   3. Neither the name of STMicroelectronics nor the names of its contributors
+  *      may be used to endorse or promote products derived from this software
+  *      without specific prior written permission.
+  *
+  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+  *
+  ******************************************************************************  
+  */
+  
+  /* Includes ------------------------------------------------------------------*/
+#include "plc.h"
+
+#include "VNI8200XP.h"
+    
+/** @addtogroup Drivers     Drivers
+  * @{
+  * @brief Demo Driver Layer
+  */    
+  
+/** @addtogroup BSP     BSP
+  * @{
+  */    
+    
+/** @addtogroup Components     Components
+  * @{
+  */
+
+/** @defgroup VNI8200XP    VNI8200XP
+  * @{ 
+  * @brief Digital Output Driver Layer
+  */
+
+/** @defgroup VNI8200XP_Private_variables     VNI8200XP Private variables
+  * @{
+  * @brief Digital Output Private variables
+  */
+
+/* Number of components */
+uint8_t VNI8200XP::number_of_plc_output_components = 0;
+
+
+/** @defgroup VNI8200XP_Exported_Functions     VNI8200XP Exported Functions
+  * @{
+  * @brief Digital Input exported Function 
+  */
+
+/**********************************************************
+ * @brief Starts the VNI8200XP library
+ * @param  init Initialization structure.
+ * @retval COMPONENT_OK in case of success.
+ **********************************************************/
+status_t VNI8200XP::VNI8200XP_Init(void *init)
+{
+    VNI_PARITY_Buffer = 0x00;
+    VNI_FAULT_Buffer = 0x00;
+    VNI_FB_OK = 0x00;
+    VNI_TEMP_WARNING = 0x00;
+    VNI_PARITY_CHECK = 0x00;
+    VNI_POWER_GOOD = 0x00;
+    VNI_PARITY_FALL_Buffer = 0x00;
+
+    /* Unselect the Ssrelay chip at startup to avoid FAULT */
+    ssel = 1;
+
+    /* Enable Ssrelay Outputs */
+    out_en = 1;
+
+    return COMPONENT_OK;
+}
+
+/**********************************************************
+ * @brief Read id
+ * @param id pointer to the identifier to be read.
+ * @retval COMPONENT_OK in case of success.
+ **********************************************************/
+status_t VNI8200XP::VNI8200XP_ReadID(uint8_t *id)
+{
+  *id = plc_output_component_instance;
+
+  return COMPONENT_OK;
+}
+
+/**********************************************************
+  * @brief      Set output channels state
+  * @param      Out_array, output channel data 
+  * @retval     None
+ **********************************************************/
+void VNI8200XP::VNI8200XP_SetChannels(uint8_t Out_array)
+{
+  spi_tx_buff[1] = Out_array;
+}
+
+/**********************************************************
+  * @brief      Get output fault status
+  * @param      None
+  * @retval     Output channel fault data
+ **********************************************************/
+uint8_t VNI8200XP::VNI8200XP_ManageFault(void)
+{
+  VNI_FAULT_Buffer = spi_rx_buff[1];
+  return VNI_FAULT_Buffer;
+}
+
+/**********************************************************
+  * @brief      Get VNI8200XP DC-DC status
+  * @param      None
+  * @retval     Feedback status, COMPONENT_OK if OK
+ **********************************************************/
+status_t VNI8200XP::VNI8200XP_CheckDCDCStatus(void)
+{
+  VNI_FB_OK = spi_rx_buff[0];
+  VNI_FB_OK = VNI_FB_OK & 0x80;
+  if(VNI_FB_OK == 0x80) {
+    return COMPONENT_ERROR;
+  } else {
+    return COMPONENT_OK;
+  }
+}
+
+/**********************************************************
+  * @brief      Get temperature warning status
+  * @param      None
+  * @retval     Temperature warning status, COMPONENT_ERROR if over temperature
+ **********************************************************/
+status_t VNI8200XP::VNI8200XP_TemperatureWarning(void)
+{
+  VNI_TEMP_WARNING = spi_rx_buff[0];
+  VNI_TEMP_WARNING = VNI_TEMP_WARNING & 0x40;
+  if(VNI_TEMP_WARNING == 0x40) {
+    return COMPONENT_ERROR;
+  } else {
+    return COMPONENT_OK;
+  }
+}
+
+/**********************************************************
+  * @brief      Get parity check status
+  * @param      None
+  * @retval     Parity check flag, COMPONENT_ERROR if 0x20
+ **********************************************************/
+status_t VNI8200XP::VNI8200XP_CheckParity(void)
+{
+  VNI_PARITY_CHECK = spi_rx_buff[0];
+  VNI_PARITY_CHECK = VNI_PARITY_CHECK & 0x20;
+  if(VNI_PARITY_CHECK == 0x20) {
+    return COMPONENT_ERROR;
+  } else {
+    return COMPONENT_OK;
+  }
+}
+
+/**********************************************************
+  * @brief      Get power supply status
+  * @param      None
+  * @retval     Power good bit, COMPONENT_OK in case of power good
+ **********************************************************/
+status_t VNI8200XP::VNI8200XP_CheckPowerGood(void)
+{
+  VNI_POWER_GOOD = spi_rx_buff[0];
+  VNI_POWER_GOOD = VNI_POWER_GOOD & 0x10;
+  if(VNI_POWER_GOOD == 0x10) {
+    return COMPONENT_OK;
+  } else {
+    return COMPONENT_ERROR;
+  }
+}
+
+/**********************************************************
+  * @brief      Get parity bits for input data from VNI
+  * @param      None
+  * @retval     Parity bits from VNI
+ **********************************************************/
+uint8_t VNI8200XP::VNI8200XP_CheckCommError(void)
+{
+    VNI_PARITY_FALL_Buffer = spi_rx_buff[0];
+    VNI_PARITY_FALL_Buffer = VNI_PARITY_FALL_Buffer & 0x0F;
+    return VNI_PARITY_FALL_Buffer;
+}
+
+/**********************************************************
+ * @brief  Set output channels component 
+ * @param  txBuff
+ * @retval None
+ **********************************************************/
+void VNI8200XP::VNI8200XP_Ssrelay_SetOutput(uint8_t *outputArray)
+{
+  spi_tx_buff[0] = outputArray[0];
+  spi_tx_buff[1] = outputArray[1];
+
+  if(VNI8200XP_SpiWriteBytes(spi_tx_buff, spi_rx_buff) != 0) {
+      /* Aborting the program */
+      exit(EXIT_FAILURE);
+  }
+}
+
+/**
+  * @} //end VNI8200XP Exported Functions
+  */
+
+/**
+  * @}  //end VNI8200XP Device Driver
+  */
+/**
+  * @}  //end Components
+   */
+/**
+  * @}  //close group  BSP
+  */
+
+/**
+  * @}  //close group  Drivers
+  */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Components/VNI8200XP/VNI8200XP.h	Thu Jul 13 16:43:31 2017 +0000
@@ -0,0 +1,400 @@
+/**
+ ******************************************************************************
+ * @file    VNI8200XP.h
+ * @author  AST/CL
+ * @version V1.0.0
+ * @date    Feb 5th, 2016
+ * @brief   This file contains the class of an VNI8200XP PLC component.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *   1. Redistributions of source code must retain the above copyright notice,
+ *      this list of conditions and the following disclaimer.
+ *   2. Redistributions in binary form must reproduce the above copyright notice,
+ *      this list of conditions and the following disclaimer in the documentation
+ *      and/or other materials provided with the distribution.
+ *   3. Neither the name of STMicroelectronics nor the names of its contributors
+ *      may be used to endorse or promote products derived from this software
+ *      without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ******************************************************************************
+ */
+
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+
+#ifndef __VNI8200XP_CLASS_H
+#define __VNI8200XP_CLASS_H
+
+
+/* Includes ------------------------------------------------------------------*/
+
+/* ACTION 1 ------------------------------------------------------------------*
+ * Include here platform specific header files.                               *
+ *----------------------------------------------------------------------------*/        
+#include "mbed.h"
+
+/* ACTION 2 ------------------------------------------------------------------*
+ * Include here component specific header files.                              *
+ *----------------------------------------------------------------------------*/
+ #include "../Common/plc.h"
+
+/* ACTION 3 ------------------------------------------------------------------*
+ * Include here interface specific header files.                              *
+ *                                                                            *
+ * Example:                                                                   *
+ *   #include "../Interfaces/PLCOutput_class.h"                               *
+ *----------------------------------------------------------------------------*/
+#include "../Interfaces/PLCOutput.h"
+
+
+/* Classes -------------------------------------------------------------------*/
+
+/**
+ * @brief Class representing an VNI8200XP component.
+ */
+class VNI8200XP : public PLCOutput
+{
+public:
+
+    /*** Constructor and Destructor Methods ***/
+
+    /**
+     * @brief Constructor.
+     * @param out_en        pin name of the OUTPUT ENABLE pin used for communication.
+     * @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.
+     */
+    VNI8200XP(PinName output_en, PinName output_ssel, SPI &spi) : PLCOutput(), out_en(output_en), ssel(output_ssel), dev_spi(spi)
+    {
+        /* Checking stackability. */
+        if (!(number_of_plc_output_components < MAX_NUMBER_OF_PLC_OUTPUT_COMPONENTS)) {
+            error("Instantiation of the VNI8200XP component failed: it can be stacked up to %d times.\r\n", MAX_NUMBER_OF_PLC_OUTPUT_COMPONENTS);
+        }
+
+        plc_output_component_instance = number_of_plc_output_components++;
+        memset(spi_tx_buff, 0, NB_BYTES * sizeof(uint8_t));
+        memset(spi_rx_buff, 0, NB_BYTES * sizeof(uint8_t));
+    }
+    
+    /**
+     * @brief Destructor.
+     */
+    virtual ~VNI8200XP(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 get_value(float *pData) //(1)                            *
+     *   {                                                                    *
+     *     return COMPONENT_get_value(float *pfData);                         *
+     *   }                                                                    *
+     *                                                                        *
+     *   virtual int enable_feature(void) //(2)                               *
+     *   {                                                                    *
+     *     return COMPONENT_enable_feature();                                 *
+     *   }                                                                    *
+     *------------------------------------------------------------------------*/
+    /**
+     * @brief  Initializing the component in 1/16 Microstepping mode.
+     * @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) VNI8200XP_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) VNI8200XP_ReadID((uint8_t *) id);
+    }
+
+    /**
+     * @brief   Set output channels state
+     * @param   Output channel data
+     * @retval  None
+     */
+    virtual void set_channels(uint8_t Out_array)
+    {
+        VNI8200XP_SetChannels(Out_array);
+    }
+
+    /**
+     * @brief   Get output fault status
+     * @param   None
+     * @retval  Output channel fault data
+     */
+    virtual uint8_t manage_fault(void)
+    {
+        return (uint8_t) VNI8200XP_ManageFault();
+    }
+
+    /**
+     * @brief   Get DC-DC status of the output channels component
+     * @param   None
+     * @retval  Feedback status, 1 if OK else 0
+     */
+    virtual uint8_t check_dcdc_status(void)
+    {
+         return (uint8_t) VNI8200XP_CheckDCDCStatus();
+    }   
+
+    /**
+     * @brief   Get temperature warning status
+     * @param   None
+     * @retval  Temperature warning status, 1 if over temperature
+     */
+    virtual uint8_t temperature_warning(void)
+    {
+        return (uint8_t) VNI8200XP_TemperatureWarning();
+    }
+
+    /**
+     * @brief   Get parity check status
+     * @param   None
+     * @retval  Parity check flag
+     */
+    virtual uint8_t check_parity(void)
+    {
+        return (uint8_t) VNI8200XP_CheckParity();
+    }
+
+    /**
+     * @brief   Get power supply status
+     * @param   None
+     * @retval  Power good bit, 1 in case of power good
+     */
+    virtual uint8_t check_power_good(void)
+    {
+        return (uint8_t) VNI8200XP_CheckPowerGood();
+    }
+
+    /**
+     * @brief   Get parity bits for input data
+     * @param   None
+     * @retval  Parity bits
+     */
+    virtual uint8_t check_comm_error(void)
+    {
+        return (uint8_t) VNI8200XP_CheckCommError();
+    }
+
+    /**
+     * @brief   Set output for output channels component
+     * @param   TX buffer
+     * @param   RX buffer
+     * @retval  None
+     */
+    virtual void ssrelay_set_output(uint8_t *outputArray)
+    {
+        VNI8200XP_Ssrelay_SetOutput(outputArray);
+    }
+
+    /* Auxiliary method to enable or disable SPI CS pin */
+    virtual void set_output_spi(uint8_t l)
+    {
+        ssel = l;
+    }
+
+    /* Auxiliary method to enable or disable Out_En pin */
+    virtual void set_output_en(uint8_t l)
+    {
+        out_en = l;
+    }
+
+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_Init(void *init);                                 *
+     *------------------------------------------------------------------------*/
+    status_t VNI8200XP_Init(void *init);
+    status_t VNI8200XP_ReadID(uint8_t *id);
+    void VNI8200XP_SetChannels(uint8_t Out_array);
+    uint8_t VNI8200XP_ManageFault(void);
+    status_t VNI8200XP_CheckDCDCStatus(void);
+    status_t VNI8200XP_TemperatureWarning(void);
+    status_t VNI8200XP_CheckParity(void);
+    status_t VNI8200XP_CheckPowerGood(void);
+    uint8_t VNI8200XP_CheckCommError(void);
+    void VNI8200XP_Ssrelay_SetOutput(uint8_t *outputArray);
+    
+    /*** Component's I/O Methods ***/
+
+    /**
+     * @brief      Utility function to read and write data from/to VNI8200XP at the same time.
+     * @param[out] pBufferToRead pointer to the buffer to read data into.
+     * @param[in]  pBufferToWrite pointer to the buffer of data to send.
+     * @param[in]  NumValues number of values 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 NumValues)
+    {
+        (void) NumValues;
+        uint16_t dataToRead;
+        uint16_t dataToWrite;
+
+        // Converts two uint8_t words into one of uint16_t
+        dataToWrite = convertFrom8To16(pBufferToWrite);
+        
+        // Select the chip.
+        ssel = 0;
+
+        dataToRead = dev_spi.write(dataToWrite);
+
+        // Unselect the chip.
+        ssel = 1;
+
+        // Converts one uint16_t word into two uint8_t
+        convertFrom16To8(dataToRead, pBufferToRead);
+
+        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 VNI8200XP_Delay(uint32_t delay)
+    {
+        wait_ms(delay);
+    }
+
+    /**
+     * @brief      Writing and reading bytes to/from the component through the SPI at the same time.
+     * @param[in]  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 VNI8200XP_SpiWriteBytes(uint8_t *pByteToTransmit, uint8_t *pReceivedByte)
+    {
+        return (uint8_t) (ReadWrite(pReceivedByte, pByteToTransmit, BUFFERSIZE) == 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;                                           *
+     *------------------------------------------------------------------------*/
+
+    /* ACTION 10 -------------------------------------------------------------*
+     * Declare here other pin related variables, if needed.                   *
+     *                                                                        *
+     * Example:                                                               *
+     *   + mbed:                                                              *
+     *     PwmOut pwm;                                                        *
+     *------------------------------------------------------------------------*/
+
+    /* ACTION 11 -------------------------------------------------------------*
+     * Declare here communication related variables, if needed.               *
+     *                                                                        *
+     * Example:                                                               *
+     *   + mbed:                                                              *
+     *     DigitalOut ssel;                                                   *
+     *     SPI &dev_spi;                                                      *
+     *------------------------------------------------------------------------*/
+    /* Configuration. */
+    DigitalOut out_en;
+    DigitalOut ssel;
+
+    /* IO Device. */
+    SPI &dev_spi;
+
+    /* ACTION 12 -------------------------------------------------------------*
+     * Declare here identity related variables, if needed.                    *
+     * Note that there should be only a unique identifier for each component, *
+     * which should be the "who_am_i" parameter.                              *
+     *------------------------------------------------------------------------*/
+    /* Identity */
+    uint8_t who_am_i;
+
+    /* ACTION 13 -------------------------------------------------------------*
+     * Declare here the component's static and non-static data, one variable  *
+     * per line.                                                              *
+     *                                                                        *
+     * Example:                                                               *
+     *   float measure;                                                       *
+     *   int instance_id;                                                     *
+     *   static int number_of_instances;                                      *
+     *------------------------------------------------------------------------*/
+    /* Data. */
+    uint8_t plc_output_component_instance;
+
+    uint8_t VNI_PARITY_Buffer;
+    uint8_t VNI_FAULT_Buffer;
+    uint8_t VNI_FB_OK;
+    uint8_t VNI_TEMP_WARNING;
+    uint8_t VNI_PARITY_CHECK;
+    uint8_t VNI_POWER_GOOD;
+    uint8_t VNI_PARITY_FALL_Buffer;
+
+    /* Static data. */
+    static uint8_t number_of_plc_output_components;
+
+    /* Ssrelay Array buffers for SPI communication */
+    uint8_t spi_tx_buff[NB_BYTES];
+    uint8_t spi_rx_buff[NB_BYTES];
+
+
+public:
+
+    /* Static data. */
+};
+
+#endif // __VNI8200XP_CLASS_H
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
\ No newline at end of file
--- a/Components/VNI8200XP/VNI8200XP_class.cpp	Wed Feb 24 10:52:31 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,243 +0,0 @@
-/**
-  ******************************************************************************
-  * @file    VNI8200XP_class.cpp
-  * @author  System Lab Noida
-  * @version V1.0.0
-  * @date    08-July-2015
-  * @brief   PLC_CLT01-38SQ7
-  * This file provides firmware functions for how  to manage I/O from VNI8200XP
-  ==============================================================================    
- 
-           
-  ******************************************************************************
-  * @attention
-  *
-  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
-  *
-  * Redistribution and use in source and binary forms, with or without modification,
-  * are permitted provided that the following conditions are met:
-  *   1. Redistributions of source code must retain the above copyright notice,
-  *      this list of conditions and the following disclaimer.
-  *   2. Redistributions in binary form must reproduce the above copyright notice,
-  *      this list of conditions and the following disclaimer in the documentation
-  *      and/or other materials provided with the distribution.
-  *   3. Neither the name of STMicroelectronics nor the names of its contributors
-  *      may be used to endorse or promote products derived from this software
-  *      without specific prior written permission.
-  *
-  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-  *
-  ******************************************************************************  
-  */
-  
-  /* Includes ------------------------------------------------------------------*/
-#include "plc.h"
-
-#include "VNI8200XP_class.h"
-    
-/** @addtogroup Drivers     Drivers
-  * @{
-  * @brief Demo Driver Layer
-  */    
-  
-/** @addtogroup BSP     BSP
-  * @{
-  */    
-    
-/** @addtogroup Components     Components
-  * @{
-  */
-
-/** @defgroup VNI8200XP    VNI8200XP
-  * @{ 
-  * @brief Digital Output Driver Layer
-  */
-
-/** @defgroup VNI8200XP_Private_variables     VNI8200XP Private variables
-  * @{
-  * @brief Digital Output Private variables
-  */
-
-/* Number of components */
-uint8_t VNI8200XP::number_of_plc_output_components = 0;
-
-
-/** @defgroup VNI8200XP_Exported_Functions     VNI8200XP Exported Functions
-  * @{
-  * @brief Digital Input exported Function 
-  */
-
-/**********************************************************
- * @brief Starts the VNI8200XP library
- * @param  init Initialization structure.
- * @retval COMPONENT_OK in case of success.
- **********************************************************/
-DrvStatusTypeDef VNI8200XP::VNI8200XP_Init(void *init)
-{
-    VNI_PARITY_Buffer = 0x00;
-    VNI_FAULT_Buffer = 0x00;
-    VNI_FB_OK = 0x00;
-    VNI_TEMP_WARNING = 0x00;
-    VNI_PARITY_CHECK = 0x00;
-    VNI_POWER_GOOD = 0x00;
-    VNI_PARITY_FALL_Buffer = 0x00;
-
-    /* Unselect the Ssrelay chip at startup to avoid FAULT */
-    ssel = 1;
-
-    /* Enable Ssrelay Outputs */
-    out_en = 1;
-
-    return COMPONENT_OK;
-}
-
-/**********************************************************
- * @brief Read id
- * @param id pointer to the identifier to be read.
- * @retval COMPONENT_OK in case of success.
- **********************************************************/
-DrvStatusTypeDef VNI8200XP::VNI8200XP_ReadID(uint8_t *id)
-{
-  *id = plc_output_component_instance;
-
-  return COMPONENT_OK;
-}
-
-/**********************************************************
-  * @brief      Set output channels state
-  * @param      Out_array, output channel data 
-  * @retval     None
- **********************************************************/
-void VNI8200XP::VNI8200XP_SetChannels(uint8_t Out_array)
-{
-  spi_tx_buff[1] = Out_array;
-}
-
-/**********************************************************
-  * @brief      Get output fault status
-  * @param      None
-  * @retval     Output channel fault data
- **********************************************************/
-uint8_t VNI8200XP::VNI8200XP_ManageFault(void)
-{
-  VNI_FAULT_Buffer = spi_rx_buff[1];
-  return VNI_FAULT_Buffer;
-}
-
-/**********************************************************
-  * @brief      Get VNI8200XP DC-DC status
-  * @param      None
-  * @retval     Feedback status, COMPONENT_OK if OK
- **********************************************************/
-DrvStatusTypeDef VNI8200XP::VNI8200XP_CheckDCDCStatus(void)
-{
-  VNI_FB_OK = spi_rx_buff[0];
-  VNI_FB_OK = VNI_FB_OK & 0x80;
-  if(VNI_FB_OK == 0x80)
-    return COMPONENT_ERROR;
-  else
-    return COMPONENT_OK;
-}
-
-/**********************************************************
-  * @brief      Get temperature warning status
-  * @param      None
-  * @retval     Temperature warning status, COMPONENT_ERROR if over temperature
- **********************************************************/
-DrvStatusTypeDef VNI8200XP::VNI8200XP_TemperatureWarning(void)
-{
-  VNI_TEMP_WARNING = spi_rx_buff[0];
-  VNI_TEMP_WARNING = VNI_TEMP_WARNING & 0x40;
-  if(VNI_TEMP_WARNING == 0x40)
-    return COMPONENT_ERROR;
-  else
-    return COMPONENT_OK;
-}
-
-/**********************************************************
-  * @brief      Get parity check status
-  * @param      None
-  * @retval     Parity check flag, COMPONENT_ERROR if 0x20
- **********************************************************/
-DrvStatusTypeDef VNI8200XP::VNI8200XP_CheckParity(void)
-{
-  VNI_PARITY_CHECK = spi_rx_buff[0];
-  VNI_PARITY_CHECK = VNI_PARITY_CHECK & 0x20;
-  if(VNI_PARITY_CHECK == 0x20)
-    return COMPONENT_ERROR;
-  else
-    return COMPONENT_OK;
-}
-
-/**********************************************************
-  * @brief      Get power supply status
-  * @param      None
-  * @retval     Power good bit, COMPONENT_OK in case of power good
- **********************************************************/
-DrvStatusTypeDef VNI8200XP::VNI8200XP_CheckPowerGood(void)
-{
-  VNI_POWER_GOOD = spi_rx_buff[0];
-  VNI_POWER_GOOD = VNI_POWER_GOOD & 0x10;
-  if(VNI_POWER_GOOD == 0x10)
-    return COMPONENT_OK;
-  else
-    return COMPONENT_ERROR;
-}
-
-/**********************************************************
-  * @brief      Get parity bits for input data from VNI
-  * @param      None
-  * @retval     Parity bits from VNI
- **********************************************************/
-uint8_t VNI8200XP::VNI8200XP_CheckCommError(void)
-{
-    VNI_PARITY_FALL_Buffer = spi_rx_buff[0];
-    VNI_PARITY_FALL_Buffer = VNI_PARITY_FALL_Buffer & 0x0F;
-    return VNI_PARITY_FALL_Buffer;
-}
-
-/**********************************************************
- * @brief  Set output channels component 
- * @param  txBuff
- * @retval None
- **********************************************************/
-void VNI8200XP::VNI8200XP_Ssrelay_SetOutput(uint8_t *outputArray)
-{
-  spi_tx_buff[0] = outputArray[0];
-  spi_tx_buff[1] = outputArray[1];
-
-  if(VNI8200XP_SpiWriteBytes(spi_tx_buff, spi_rx_buff) != 0)
-  {
-      /* Aborting the program */
-      exit(EXIT_FAILURE);
-  }
-}
-
-/**
-  * @} //end VNI8200XP Exported Functions
-  */
-
-/**
-  * @}  //end VNI8200XP Device Driver
-  */
-/**
-  * @}  //end Components
-   */
-/**
-  * @}  //close group  BSP
-  */
-
-/**
-  * @}  //close group  Drivers
-  */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/  
--- a/Components/VNI8200XP/VNI8200XP_class.h	Wed Feb 24 10:52:31 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,399 +0,0 @@
-/**
- ******************************************************************************
- * @file    VNI8200XP_class.h
- * @author  AST/CL
- * @version V1.0.0
- * @date    Feb 5th, 2016
- * @brief   This file contains the class of an VNI8200XP PLC component.
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *   1. Redistributions of source code must retain the above copyright notice,
- *      this list of conditions and the following disclaimer.
- *   2. Redistributions in binary form must reproduce the above copyright notice,
- *      this list of conditions and the following disclaimer in the documentation
- *      and/or other materials provided with the distribution.
- *   3. Neither the name of STMicroelectronics nor the names of its contributors
- *      may be used to endorse or promote products derived from this software
- *      without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- ******************************************************************************
- */
-
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-
-#ifndef __VNI8200XP_CLASS_H
-#define __VNI8200XP_CLASS_H
-
-
-/* Includes ------------------------------------------------------------------*/
-
-/* ACTION 1 ------------------------------------------------------------------*
- * Include here platform specific header files.                               *
- *----------------------------------------------------------------------------*/        
-#include "mbed.h"
-
-/* ACTION 2 ------------------------------------------------------------------*
- * Include here component specific header files.                              *
- *----------------------------------------------------------------------------*/
- #include "../Common/plc.h"
-
-/* ACTION 3 ------------------------------------------------------------------*
- * Include here interface specific header files.                              *
- *                                                                            *
- * Example:                                                                   *
- *   #include "../Interfaces/PLCOutput_class.h"                               *
- *----------------------------------------------------------------------------*/
-#include "../Interfaces/PLCOutput_class.h"
-
-
-/* Classes -------------------------------------------------------------------*/
-
-/**
- * @brief Class representing an VNI8200XP component.
- */
-class VNI8200XP : public PLCOutput
-{
-public:
-
-    /*** Constructor and Destructor Methods ***/
-
-    /**
-     * @brief Constructor.
-     * @param out_en        pin name of the OUTPUT ENABLE pin used for communication.
-     * @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.
-     */
-    VNI8200XP(PinName output_en, PinName output_ssel, SPI &spi) : PLCOutput(), out_en(output_en), ssel(output_ssel), dev_spi(spi)
-    {
-        /* Checking stackability. */
-        if (!(number_of_plc_output_components < MAX_NUMBER_OF_PLC_OUTPUT_COMPONENTS))
-            error("Instantiation of the VNI8200XP component failed: it can be stacked up to %d times.\r\n", MAX_NUMBER_OF_PLC_OUTPUT_COMPONENTS);
-
-        plc_output_component_instance = number_of_plc_output_components++;
-        memset(spi_tx_buff, 0, NB_BYTES * sizeof(uint8_t));
-        memset(spi_rx_buff, 0, NB_BYTES * sizeof(uint8_t));
-    }
-    
-    /**
-     * @brief Destructor.
-     */
-    virtual ~VNI8200XP(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  Initializing the component in 1/16 Microstepping mode.
-     * @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) VNI8200XP_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 ReadID(uint8_t *id = NULL)
-    {
-        return (int) VNI8200XP_ReadID((uint8_t *) id);
-    }
-
-    /**
-     * @brief   Set output channels state
-     * @param   Output channel data
-     * @retval  None
-     */
-    virtual void SetChannels(uint8_t Out_array)
-    {
-        VNI8200XP_SetChannels(Out_array);
-    }
-
-    /**
-     * @brief   Get output fault status
-     * @param   None
-     * @retval  Output channel fault data
-     */
-    virtual uint8_t ManageFault(void)
-    {
-        return (uint8_t) VNI8200XP_ManageFault();
-    }
-
-    /**
-     * @brief   Get DC-DC status of the output channels component
-     * @param   None
-     * @retval  Feedback status, 1 if OK else 0
-     */
-    virtual uint8_t CheckDCDCStatus(void)
-    {
-         return (uint8_t) VNI8200XP_CheckDCDCStatus();
-    }   
-
-    /**
-     * @brief   Get temperature warning status
-     * @param   None
-     * @retval  Temperature warning status, 1 if over temperature
-     */
-    virtual uint8_t TemperatureWarning(void)
-    {
-        return (uint8_t) VNI8200XP_TemperatureWarning();
-    }
-
-    /**
-     * @brief   Get parity check status
-     * @param   None
-     * @retval  Parity check flag
-     */
-    virtual uint8_t CheckParity(void)
-    {
-        return (uint8_t) VNI8200XP_CheckParity();
-    }
-
-    /**
-     * @brief   Get power supply status
-     * @param   None
-     * @retval  Power good bit, 1 in case of power good
-     */
-    virtual uint8_t CheckPowerGood(void)
-    {
-        return (uint8_t) VNI8200XP_CheckPowerGood();
-    }
-
-    /**
-     * @brief   Get parity bits for input data
-     * @param   None
-     * @retval  Parity bits
-     */
-    virtual uint8_t CheckCommError(void)
-    {
-        return (uint8_t) VNI8200XP_CheckCommError();
-    }
-
-    /**
-     * @brief   Set output for output channels component
-     * @param   TX buffer
-     * @param   RX buffer
-     * @retval  None
-     */
-    virtual void Ssrelay_SetOutput(uint8_t *outputArray)
-    {
-        VNI8200XP_Ssrelay_SetOutput(outputArray);
-    }
-
-    /* Auxiliary method to enable or disable SPI CS pin */
-    virtual void setOutputSPI(uint8_t l)
-    {
-        ssel = l;
-    }
-
-    /* Auxiliary method to enable or disable Out_En pin */
-    virtual void setOutputEn(uint8_t l)
-    {
-        out_en = l;
-    }
-
-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:                                                               *
-     *   DrvStatusTypeDef COMPONENT_Init(void *init);                         *
-     *------------------------------------------------------------------------*/
-    DrvStatusTypeDef VNI8200XP_Init(void *init);
-    DrvStatusTypeDef VNI8200XP_ReadID(uint8_t *id);
-    void VNI8200XP_SetChannels(uint8_t Out_array);
-    uint8_t VNI8200XP_ManageFault(void);
-    DrvStatusTypeDef VNI8200XP_CheckDCDCStatus(void);
-    DrvStatusTypeDef VNI8200XP_TemperatureWarning(void);
-    DrvStatusTypeDef VNI8200XP_CheckParity(void);
-    DrvStatusTypeDef VNI8200XP_CheckPowerGood(void);
-    uint8_t VNI8200XP_CheckCommError(void);
-    void VNI8200XP_Ssrelay_SetOutput(uint8_t *outputArray);
-    
-    /*** Component's I/O Methods ***/
-
-    /**
-     * @brief      Utility function to read and write data from/to VNI8200XP at the same time.
-     * @param[out] pBufferToRead pointer to the buffer to read data into.
-     * @param[in]  pBufferToWrite pointer to the buffer of data to send.
-     * @param[in]  NumValues number of values to read and write.
-     * @retval     COMPONENT_OK in case of success, COMPONENT_ERROR otherwise.
-     */
-    DrvStatusTypeDef ReadWrite(uint8_t* pBufferToRead, uint8_t* pBufferToWrite, uint16_t NumValues)
-    {
-        (void) NumValues;
-        uint16_t dataToRead;
-        uint16_t dataToWrite;
-
-        // Converts two uint8_t words into one of uint16_t
-        dataToWrite = convertFrom8To16(pBufferToWrite);
-        
-        // Select the chip.
-        ssel = 0;
-
-        dataToRead = dev_spi.write(dataToWrite);
-
-        // Unselect the chip.
-        ssel = 1;
-
-        // Converts one uint16_t word into two uint8_t
-        convertFrom16To8(dataToRead, pBufferToRead);
-
-        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 VNI8200XP_Delay(uint32_t delay)
-    {
-        wait_ms(delay);
-    }
-
-    /**
-     * @brief      Writing and reading bytes to/from the component through the SPI at the same time.
-     * @param[in]  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 VNI8200XP_SpiWriteBytes(uint8_t *pByteToTransmit, uint8_t *pReceivedByte)
-    {
-        return (uint8_t) (ReadWrite(pReceivedByte, pByteToTransmit, BUFFERSIZE) == 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;                                           *
-     *------------------------------------------------------------------------*/
-
-    /* ACTION 10 -------------------------------------------------------------*
-     * Declare here other pin related variables, if needed.                   *
-     *                                                                        *
-     * Example:                                                               *
-     *   + mbed:                                                              *
-     *     PwmOut pwm;                                                        *
-     *------------------------------------------------------------------------*/
-
-    /* ACTION 11 -------------------------------------------------------------*
-     * Declare here communication related variables, if needed.               *
-     *                                                                        *
-     * Example:                                                               *
-     *   + mbed:                                                              *
-     *     DigitalOut ssel;                                                   *
-     *     SPI &dev_spi;                                                   *
-     *------------------------------------------------------------------------*/
-    /* Configuration. */
-    DigitalOut out_en;
-    DigitalOut ssel;
-
-    /* IO Device. */
-    SPI &dev_spi;
-
-    /* ACTION 12 -------------------------------------------------------------*
-     * Declare here identity related variables, if needed.                    *
-     * Note that there should be only a unique identifier for each component, *
-     * which should be the "who_am_i" parameter.                              *
-     *------------------------------------------------------------------------*/
-    /* Identity */
-    uint8_t who_am_i;
-
-    /* ACTION 13 -------------------------------------------------------------*
-     * Declare here the component's static and non-static data, one variable  *
-     * per line.                                                              *
-     *                                                                        *
-     * Example:                                                               *
-     *   float measure;                                                       *
-     *   int instance_id;                                                     *
-     *   static int number_of_instances;                                      *
-     *------------------------------------------------------------------------*/
-    /* Data. */
-    uint8_t plc_output_component_instance;
-
-    uint8_t VNI_PARITY_Buffer;
-    uint8_t VNI_FAULT_Buffer;
-    uint8_t VNI_FB_OK;
-    uint8_t VNI_TEMP_WARNING;
-    uint8_t VNI_PARITY_CHECK;
-    uint8_t VNI_POWER_GOOD;
-    uint8_t VNI_PARITY_FALL_Buffer;
-
-    /* Static data. */
-    static uint8_t number_of_plc_output_components;
-
-    /* Ssrelay Array buffers for SPI communication */
-    uint8_t spi_tx_buff[NB_BYTES];
-    uint8_t spi_rx_buff[NB_BYTES];
-
-
-public:
-
-    /* Static data. */
-};
-
-#endif // __VNI8200XP_CLASS_H
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
\ No newline at end of file