ST / X_NUCLEO_PLC01A1

Dependents:   HelloWorld_PLC01A1

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers PLCInput.h Source File

PLCInput.h

Go to the documentation of this file.
00001 /**
00002  ******************************************************************************
00003  * @file    PLCInput.h
00004  * @author  AST/CL
00005  * @version V1.0.0
00006  * @date    Feb 4th, 2016
00007  * @brief   This file contains the abstract class describing the interface of a
00008  *          PLC input component.
00009  ******************************************************************************
00010  * @attention
00011  *
00012  * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
00013  *
00014  * Redistribution and use in source and binary forms, with or without modification,
00015  * are permitted provided that the following conditions are met:
00016  *   1. Redistributions of source code must retain the above copyright notice,
00017  *      this list of conditions and the following disclaimer.
00018  *   2. Redistributions in binary form must reproduce the above copyright notice,
00019  *      this list of conditions and the following disclaimer in the documentation
00020  *      and/or other materials provided with the distribution.
00021  *   3. Neither the name of STMicroelectronics nor the names of its contributors
00022  *      may be used to endorse or promote products derived from this software
00023  *      without specific prior written permission.
00024  *
00025  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00026  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00027  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00028  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
00029  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00030  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00031  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00032  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00033  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00034  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00035  *
00036  ******************************************************************************
00037  */
00038 
00039 
00040 /* Define to prevent from recursive inclusion --------------------------------*/
00041 
00042 #ifndef __PLCINPUT_CLASS_H
00043 #define __PLCINPUT_CLASS_H
00044 
00045 
00046 /* Includes ------------------------------------------------------------------*/
00047 
00048 #include <Component.h>
00049 
00050 
00051 /* Classes  ------------------------------------------------------------------*/
00052 
00053 /** An abstract class for PLCInput component.
00054  */
00055 class PLCInput : public Component
00056 {
00057 public:
00058 
00059     /**
00060      * @brief   Get Read Status
00061      * @param   None
00062      * @retval  Status
00063      */
00064     virtual uint8_t get_read_status(void) = 0;
00065 
00066     /**
00067      * @brief   Set Read Status
00068      * @param   Status
00069      * @retval  None
00070      */
00071     virtual void set_read_status(uint8_t status) = 0;
00072 
00073     /**
00074      * @brief   Get Input Status
00075      * @param   None
00076      * @retval  Channels status corresponding to 8 inputs
00077      */
00078      virtual uint8_t get_input_data(void) = 0;
00079 
00080     /**
00081      * @brief   Over Temperature Alarm bit
00082      * @param   None
00083      * @retval  Overtemperature bit, 1 in case of alarm
00084      */
00085      virtual uint8_t over_temp_alarm(void) = 0;
00086 
00087     /**
00088      * @brief   Parity Check bits
00089      * @param   None
00090      * @retval  Parity bits for diagnosing inconsistency in data transmission
00091      */
00092      virtual uint8_t check_parity(void) = 0;
00093 
00094     /**
00095      * @brief   Under Voltage Alarm bit
00096      * @param   None
00097      * @retval  Under voltage alarm bit, 1 in case of alarm
00098      */
00099      virtual uint8_t under_volt_alarm(void) = 0;
00100 
00101     /**
00102      * @brief   Get input information from input channels component
00103      * @param   RX buffer
00104      * @retval  None
00105      */
00106      virtual void dig_inp_array_get_input(uint8_t *inputArray) = 0;
00107      
00108      /**
00109       * @brief  Auxiliary method to enable or disable SPI CS pin.
00110       * @param  l flag to enable or disable SPI CS pin
00111       */
00112      virtual void set_input_spi(uint8_t l) = 0;
00113 
00114     /**
00115      * @brief Destructor.
00116      */
00117     virtual ~PLCInput() {};
00118 };
00119 
00120 #endif /* __PLCINPUT_CLASS_H */
00121 
00122 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/