Álvaro de Rada / X_NUCLEO_PLC01A1
Committer:
Davidroid
Date:
Thu Jul 13 16:43:31 2017 +0000
Revision:
5:0845d4141a01
Aligning to ARM mbed coding style.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Davidroid 5:0845d4141a01 1 /**
Davidroid 5:0845d4141a01 2 ******************************************************************************
Davidroid 5:0845d4141a01 3 * @file VNI8200XP.h
Davidroid 5:0845d4141a01 4 * @author AST/CL
Davidroid 5:0845d4141a01 5 * @version V1.0.0
Davidroid 5:0845d4141a01 6 * @date Feb 5th, 2016
Davidroid 5:0845d4141a01 7 * @brief This file contains the class of an VNI8200XP PLC component.
Davidroid 5:0845d4141a01 8 ******************************************************************************
Davidroid 5:0845d4141a01 9 * @attention
Davidroid 5:0845d4141a01 10 *
Davidroid 5:0845d4141a01 11 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
Davidroid 5:0845d4141a01 12 *
Davidroid 5:0845d4141a01 13 * Redistribution and use in source and binary forms, with or without modification,
Davidroid 5:0845d4141a01 14 * are permitted provided that the following conditions are met:
Davidroid 5:0845d4141a01 15 * 1. Redistributions of source code must retain the above copyright notice,
Davidroid 5:0845d4141a01 16 * this list of conditions and the following disclaimer.
Davidroid 5:0845d4141a01 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
Davidroid 5:0845d4141a01 18 * this list of conditions and the following disclaimer in the documentation
Davidroid 5:0845d4141a01 19 * and/or other materials provided with the distribution.
Davidroid 5:0845d4141a01 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Davidroid 5:0845d4141a01 21 * may be used to endorse or promote products derived from this software
Davidroid 5:0845d4141a01 22 * without specific prior written permission.
Davidroid 5:0845d4141a01 23 *
Davidroid 5:0845d4141a01 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Davidroid 5:0845d4141a01 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Davidroid 5:0845d4141a01 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Davidroid 5:0845d4141a01 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Davidroid 5:0845d4141a01 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Davidroid 5:0845d4141a01 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Davidroid 5:0845d4141a01 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Davidroid 5:0845d4141a01 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Davidroid 5:0845d4141a01 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Davidroid 5:0845d4141a01 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Davidroid 5:0845d4141a01 34 *
Davidroid 5:0845d4141a01 35 ******************************************************************************
Davidroid 5:0845d4141a01 36 */
Davidroid 5:0845d4141a01 37
Davidroid 5:0845d4141a01 38
Davidroid 5:0845d4141a01 39 /* Define to prevent recursive inclusion -------------------------------------*/
Davidroid 5:0845d4141a01 40
Davidroid 5:0845d4141a01 41 #ifndef __VNI8200XP_CLASS_H
Davidroid 5:0845d4141a01 42 #define __VNI8200XP_CLASS_H
Davidroid 5:0845d4141a01 43
Davidroid 5:0845d4141a01 44
Davidroid 5:0845d4141a01 45 /* Includes ------------------------------------------------------------------*/
Davidroid 5:0845d4141a01 46
Davidroid 5:0845d4141a01 47 /* ACTION 1 ------------------------------------------------------------------*
Davidroid 5:0845d4141a01 48 * Include here platform specific header files. *
Davidroid 5:0845d4141a01 49 *----------------------------------------------------------------------------*/
Davidroid 5:0845d4141a01 50 #include "mbed.h"
Davidroid 5:0845d4141a01 51
Davidroid 5:0845d4141a01 52 /* ACTION 2 ------------------------------------------------------------------*
Davidroid 5:0845d4141a01 53 * Include here component specific header files. *
Davidroid 5:0845d4141a01 54 *----------------------------------------------------------------------------*/
Davidroid 5:0845d4141a01 55 #include "../Common/plc.h"
Davidroid 5:0845d4141a01 56
Davidroid 5:0845d4141a01 57 /* ACTION 3 ------------------------------------------------------------------*
Davidroid 5:0845d4141a01 58 * Include here interface specific header files. *
Davidroid 5:0845d4141a01 59 * *
Davidroid 5:0845d4141a01 60 * Example: *
Davidroid 5:0845d4141a01 61 * #include "../Interfaces/PLCOutput_class.h" *
Davidroid 5:0845d4141a01 62 *----------------------------------------------------------------------------*/
Davidroid 5:0845d4141a01 63 #include "../Interfaces/PLCOutput.h"
Davidroid 5:0845d4141a01 64
Davidroid 5:0845d4141a01 65
Davidroid 5:0845d4141a01 66 /* Classes -------------------------------------------------------------------*/
Davidroid 5:0845d4141a01 67
Davidroid 5:0845d4141a01 68 /**
Davidroid 5:0845d4141a01 69 * @brief Class representing an VNI8200XP component.
Davidroid 5:0845d4141a01 70 */
Davidroid 5:0845d4141a01 71 class VNI8200XP : public PLCOutput
Davidroid 5:0845d4141a01 72 {
Davidroid 5:0845d4141a01 73 public:
Davidroid 5:0845d4141a01 74
Davidroid 5:0845d4141a01 75 /*** Constructor and Destructor Methods ***/
Davidroid 5:0845d4141a01 76
Davidroid 5:0845d4141a01 77 /**
Davidroid 5:0845d4141a01 78 * @brief Constructor.
Davidroid 5:0845d4141a01 79 * @param out_en pin name of the OUTPUT ENABLE pin used for communication.
Davidroid 5:0845d4141a01 80 * @param ssel pin name of the SSEL pin of the SPI device to be used for communication.
Davidroid 5:0845d4141a01 81 * @param spi SPI device to be used for communication.
Davidroid 5:0845d4141a01 82 */
Davidroid 5:0845d4141a01 83 VNI8200XP(PinName output_en, PinName output_ssel, SPI &spi) : PLCOutput(), out_en(output_en), ssel(output_ssel), dev_spi(spi)
Davidroid 5:0845d4141a01 84 {
Davidroid 5:0845d4141a01 85 /* Checking stackability. */
Davidroid 5:0845d4141a01 86 if (!(number_of_plc_output_components < MAX_NUMBER_OF_PLC_OUTPUT_COMPONENTS)) {
Davidroid 5:0845d4141a01 87 error("Instantiation of the VNI8200XP component failed: it can be stacked up to %d times.\r\n", MAX_NUMBER_OF_PLC_OUTPUT_COMPONENTS);
Davidroid 5:0845d4141a01 88 }
Davidroid 5:0845d4141a01 89
Davidroid 5:0845d4141a01 90 plc_output_component_instance = number_of_plc_output_components++;
Davidroid 5:0845d4141a01 91 memset(spi_tx_buff, 0, NB_BYTES * sizeof(uint8_t));
Davidroid 5:0845d4141a01 92 memset(spi_rx_buff, 0, NB_BYTES * sizeof(uint8_t));
Davidroid 5:0845d4141a01 93 }
Davidroid 5:0845d4141a01 94
Davidroid 5:0845d4141a01 95 /**
Davidroid 5:0845d4141a01 96 * @brief Destructor.
Davidroid 5:0845d4141a01 97 */
Davidroid 5:0845d4141a01 98 virtual ~VNI8200XP(void) {}
Davidroid 5:0845d4141a01 99
Davidroid 5:0845d4141a01 100
Davidroid 5:0845d4141a01 101 /*** Public Component Related Methods ***/
Davidroid 5:0845d4141a01 102
Davidroid 5:0845d4141a01 103 /* ACTION 5 --------------------------------------------------------------*
Davidroid 5:0845d4141a01 104 * Implement here the component's public methods, as wrappers of the C *
Davidroid 5:0845d4141a01 105 * component's functions. *
Davidroid 5:0845d4141a01 106 * They should be: *
Davidroid 5:0845d4141a01 107 * + Methods with the same name of the C component's virtual table's *
Davidroid 5:0845d4141a01 108 * functions (1); *
Davidroid 5:0845d4141a01 109 * + Methods with the same name of the C component's extended virtual *
Davidroid 5:0845d4141a01 110 * table's functions, if any (2). *
Davidroid 5:0845d4141a01 111 * *
Davidroid 5:0845d4141a01 112 * Example: *
Davidroid 5:0845d4141a01 113 * virtual int get_value(float *pData) //(1) *
Davidroid 5:0845d4141a01 114 * { *
Davidroid 5:0845d4141a01 115 * return COMPONENT_get_value(float *pfData); *
Davidroid 5:0845d4141a01 116 * } *
Davidroid 5:0845d4141a01 117 * *
Davidroid 5:0845d4141a01 118 * virtual int enable_feature(void) //(2) *
Davidroid 5:0845d4141a01 119 * { *
Davidroid 5:0845d4141a01 120 * return COMPONENT_enable_feature(); *
Davidroid 5:0845d4141a01 121 * } *
Davidroid 5:0845d4141a01 122 *------------------------------------------------------------------------*/
Davidroid 5:0845d4141a01 123 /**
Davidroid 5:0845d4141a01 124 * @brief Initializing the component in 1/16 Microstepping mode.
Davidroid 5:0845d4141a01 125 * @param init Pointer to device specific initalization structure.
Davidroid 5:0845d4141a01 126 * @retval "0" in case of success, an error code otherwise.
Davidroid 5:0845d4141a01 127 */
Davidroid 5:0845d4141a01 128 virtual int init(void *init = NULL)
Davidroid 5:0845d4141a01 129 {
Davidroid 5:0845d4141a01 130 return (int) VNI8200XP_Init((void *) init);
Davidroid 5:0845d4141a01 131 }
Davidroid 5:0845d4141a01 132
Davidroid 5:0845d4141a01 133 /**
Davidroid 5:0845d4141a01 134 * @brief Getting the ID of the component.
Davidroid 5:0845d4141a01 135 * @param id Pointer to an allocated variable to store the ID into.
Davidroid 5:0845d4141a01 136 * @retval "0" in case of success, an error code otherwise.
Davidroid 5:0845d4141a01 137 */
Davidroid 5:0845d4141a01 138 virtual int read_id(uint8_t *id = NULL)
Davidroid 5:0845d4141a01 139 {
Davidroid 5:0845d4141a01 140 return (int) VNI8200XP_ReadID((uint8_t *) id);
Davidroid 5:0845d4141a01 141 }
Davidroid 5:0845d4141a01 142
Davidroid 5:0845d4141a01 143 /**
Davidroid 5:0845d4141a01 144 * @brief Set output channels state
Davidroid 5:0845d4141a01 145 * @param Output channel data
Davidroid 5:0845d4141a01 146 * @retval None
Davidroid 5:0845d4141a01 147 */
Davidroid 5:0845d4141a01 148 virtual void set_channels(uint8_t Out_array)
Davidroid 5:0845d4141a01 149 {
Davidroid 5:0845d4141a01 150 VNI8200XP_SetChannels(Out_array);
Davidroid 5:0845d4141a01 151 }
Davidroid 5:0845d4141a01 152
Davidroid 5:0845d4141a01 153 /**
Davidroid 5:0845d4141a01 154 * @brief Get output fault status
Davidroid 5:0845d4141a01 155 * @param None
Davidroid 5:0845d4141a01 156 * @retval Output channel fault data
Davidroid 5:0845d4141a01 157 */
Davidroid 5:0845d4141a01 158 virtual uint8_t manage_fault(void)
Davidroid 5:0845d4141a01 159 {
Davidroid 5:0845d4141a01 160 return (uint8_t) VNI8200XP_ManageFault();
Davidroid 5:0845d4141a01 161 }
Davidroid 5:0845d4141a01 162
Davidroid 5:0845d4141a01 163 /**
Davidroid 5:0845d4141a01 164 * @brief Get DC-DC status of the output channels component
Davidroid 5:0845d4141a01 165 * @param None
Davidroid 5:0845d4141a01 166 * @retval Feedback status, 1 if OK else 0
Davidroid 5:0845d4141a01 167 */
Davidroid 5:0845d4141a01 168 virtual uint8_t check_dcdc_status(void)
Davidroid 5:0845d4141a01 169 {
Davidroid 5:0845d4141a01 170 return (uint8_t) VNI8200XP_CheckDCDCStatus();
Davidroid 5:0845d4141a01 171 }
Davidroid 5:0845d4141a01 172
Davidroid 5:0845d4141a01 173 /**
Davidroid 5:0845d4141a01 174 * @brief Get temperature warning status
Davidroid 5:0845d4141a01 175 * @param None
Davidroid 5:0845d4141a01 176 * @retval Temperature warning status, 1 if over temperature
Davidroid 5:0845d4141a01 177 */
Davidroid 5:0845d4141a01 178 virtual uint8_t temperature_warning(void)
Davidroid 5:0845d4141a01 179 {
Davidroid 5:0845d4141a01 180 return (uint8_t) VNI8200XP_TemperatureWarning();
Davidroid 5:0845d4141a01 181 }
Davidroid 5:0845d4141a01 182
Davidroid 5:0845d4141a01 183 /**
Davidroid 5:0845d4141a01 184 * @brief Get parity check status
Davidroid 5:0845d4141a01 185 * @param None
Davidroid 5:0845d4141a01 186 * @retval Parity check flag
Davidroid 5:0845d4141a01 187 */
Davidroid 5:0845d4141a01 188 virtual uint8_t check_parity(void)
Davidroid 5:0845d4141a01 189 {
Davidroid 5:0845d4141a01 190 return (uint8_t) VNI8200XP_CheckParity();
Davidroid 5:0845d4141a01 191 }
Davidroid 5:0845d4141a01 192
Davidroid 5:0845d4141a01 193 /**
Davidroid 5:0845d4141a01 194 * @brief Get power supply status
Davidroid 5:0845d4141a01 195 * @param None
Davidroid 5:0845d4141a01 196 * @retval Power good bit, 1 in case of power good
Davidroid 5:0845d4141a01 197 */
Davidroid 5:0845d4141a01 198 virtual uint8_t check_power_good(void)
Davidroid 5:0845d4141a01 199 {
Davidroid 5:0845d4141a01 200 return (uint8_t) VNI8200XP_CheckPowerGood();
Davidroid 5:0845d4141a01 201 }
Davidroid 5:0845d4141a01 202
Davidroid 5:0845d4141a01 203 /**
Davidroid 5:0845d4141a01 204 * @brief Get parity bits for input data
Davidroid 5:0845d4141a01 205 * @param None
Davidroid 5:0845d4141a01 206 * @retval Parity bits
Davidroid 5:0845d4141a01 207 */
Davidroid 5:0845d4141a01 208 virtual uint8_t check_comm_error(void)
Davidroid 5:0845d4141a01 209 {
Davidroid 5:0845d4141a01 210 return (uint8_t) VNI8200XP_CheckCommError();
Davidroid 5:0845d4141a01 211 }
Davidroid 5:0845d4141a01 212
Davidroid 5:0845d4141a01 213 /**
Davidroid 5:0845d4141a01 214 * @brief Set output for output channels component
Davidroid 5:0845d4141a01 215 * @param TX buffer
Davidroid 5:0845d4141a01 216 * @param RX buffer
Davidroid 5:0845d4141a01 217 * @retval None
Davidroid 5:0845d4141a01 218 */
Davidroid 5:0845d4141a01 219 virtual void ssrelay_set_output(uint8_t *outputArray)
Davidroid 5:0845d4141a01 220 {
Davidroid 5:0845d4141a01 221 VNI8200XP_Ssrelay_SetOutput(outputArray);
Davidroid 5:0845d4141a01 222 }
Davidroid 5:0845d4141a01 223
Davidroid 5:0845d4141a01 224 /* Auxiliary method to enable or disable SPI CS pin */
Davidroid 5:0845d4141a01 225 virtual void set_output_spi(uint8_t l)
Davidroid 5:0845d4141a01 226 {
Davidroid 5:0845d4141a01 227 ssel = l;
Davidroid 5:0845d4141a01 228 }
Davidroid 5:0845d4141a01 229
Davidroid 5:0845d4141a01 230 /* Auxiliary method to enable or disable Out_En pin */
Davidroid 5:0845d4141a01 231 virtual void set_output_en(uint8_t l)
Davidroid 5:0845d4141a01 232 {
Davidroid 5:0845d4141a01 233 out_en = l;
Davidroid 5:0845d4141a01 234 }
Davidroid 5:0845d4141a01 235
Davidroid 5:0845d4141a01 236 protected:
Davidroid 5:0845d4141a01 237
Davidroid 5:0845d4141a01 238 /*** Protected Component Related Methods ***/
Davidroid 5:0845d4141a01 239
Davidroid 5:0845d4141a01 240 /* ACTION 7 --------------------------------------------------------------*
Davidroid 5:0845d4141a01 241 * Declare here the component's specific methods. *
Davidroid 5:0845d4141a01 242 * They should be: *
Davidroid 5:0845d4141a01 243 * + Methods with the same name of the C component's virtual table's *
Davidroid 5:0845d4141a01 244 * functions (1); *
Davidroid 5:0845d4141a01 245 * + Methods with the same name of the C component's extended virtual *
Davidroid 5:0845d4141a01 246 * table's functions, if any (2); *
Davidroid 5:0845d4141a01 247 * + Helper methods, if any, like functions declared in the component's *
Davidroid 5:0845d4141a01 248 * source files but not pointed by the component's virtual table (3). *
Davidroid 5:0845d4141a01 249 * *
Davidroid 5:0845d4141a01 250 * Example: *
Davidroid 5:0845d4141a01 251 * status_t COMPONENT_Init(void *init); *
Davidroid 5:0845d4141a01 252 *------------------------------------------------------------------------*/
Davidroid 5:0845d4141a01 253 status_t VNI8200XP_Init(void *init);
Davidroid 5:0845d4141a01 254 status_t VNI8200XP_ReadID(uint8_t *id);
Davidroid 5:0845d4141a01 255 void VNI8200XP_SetChannels(uint8_t Out_array);
Davidroid 5:0845d4141a01 256 uint8_t VNI8200XP_ManageFault(void);
Davidroid 5:0845d4141a01 257 status_t VNI8200XP_CheckDCDCStatus(void);
Davidroid 5:0845d4141a01 258 status_t VNI8200XP_TemperatureWarning(void);
Davidroid 5:0845d4141a01 259 status_t VNI8200XP_CheckParity(void);
Davidroid 5:0845d4141a01 260 status_t VNI8200XP_CheckPowerGood(void);
Davidroid 5:0845d4141a01 261 uint8_t VNI8200XP_CheckCommError(void);
Davidroid 5:0845d4141a01 262 void VNI8200XP_Ssrelay_SetOutput(uint8_t *outputArray);
Davidroid 5:0845d4141a01 263
Davidroid 5:0845d4141a01 264 /*** Component's I/O Methods ***/
Davidroid 5:0845d4141a01 265
Davidroid 5:0845d4141a01 266 /**
Davidroid 5:0845d4141a01 267 * @brief Utility function to read and write data from/to VNI8200XP at the same time.
Davidroid 5:0845d4141a01 268 * @param[out] pBufferToRead pointer to the buffer to read data into.
Davidroid 5:0845d4141a01 269 * @param[in] pBufferToWrite pointer to the buffer of data to send.
Davidroid 5:0845d4141a01 270 * @param[in] NumValues number of values to read and write.
Davidroid 5:0845d4141a01 271 * @retval COMPONENT_OK in case of success, COMPONENT_ERROR otherwise.
Davidroid 5:0845d4141a01 272 */
Davidroid 5:0845d4141a01 273 status_t ReadWrite(uint8_t* pBufferToRead, uint8_t* pBufferToWrite, uint16_t NumValues)
Davidroid 5:0845d4141a01 274 {
Davidroid 5:0845d4141a01 275 (void) NumValues;
Davidroid 5:0845d4141a01 276 uint16_t dataToRead;
Davidroid 5:0845d4141a01 277 uint16_t dataToWrite;
Davidroid 5:0845d4141a01 278
Davidroid 5:0845d4141a01 279 // Converts two uint8_t words into one of uint16_t
Davidroid 5:0845d4141a01 280 dataToWrite = convertFrom8To16(pBufferToWrite);
Davidroid 5:0845d4141a01 281
Davidroid 5:0845d4141a01 282 // Select the chip.
Davidroid 5:0845d4141a01 283 ssel = 0;
Davidroid 5:0845d4141a01 284
Davidroid 5:0845d4141a01 285 dataToRead = dev_spi.write(dataToWrite);
Davidroid 5:0845d4141a01 286
Davidroid 5:0845d4141a01 287 // Unselect the chip.
Davidroid 5:0845d4141a01 288 ssel = 1;
Davidroid 5:0845d4141a01 289
Davidroid 5:0845d4141a01 290 // Converts one uint16_t word into two uint8_t
Davidroid 5:0845d4141a01 291 convertFrom16To8(dataToRead, pBufferToRead);
Davidroid 5:0845d4141a01 292
Davidroid 5:0845d4141a01 293 return COMPONENT_OK;
Davidroid 5:0845d4141a01 294 }
Davidroid 5:0845d4141a01 295
Davidroid 5:0845d4141a01 296 /* ACTION 8 --------------------------------------------------------------*
Davidroid 5:0845d4141a01 297 * Implement here other I/O methods beyond those already implemented *
Davidroid 5:0845d4141a01 298 * above, which are declared extern within the component's header file. *
Davidroid 5:0845d4141a01 299 *------------------------------------------------------------------------*/
Davidroid 5:0845d4141a01 300 /**
Davidroid 5:0845d4141a01 301 * @brief Making the CPU wait.
Davidroid 5:0845d4141a01 302 * @param None.
Davidroid 5:0845d4141a01 303 * @retval None.
Davidroid 5:0845d4141a01 304 */
Davidroid 5:0845d4141a01 305 void VNI8200XP_Delay(uint32_t delay)
Davidroid 5:0845d4141a01 306 {
Davidroid 5:0845d4141a01 307 wait_ms(delay);
Davidroid 5:0845d4141a01 308 }
Davidroid 5:0845d4141a01 309
Davidroid 5:0845d4141a01 310 /**
Davidroid 5:0845d4141a01 311 * @brief Writing and reading bytes to/from the component through the SPI at the same time.
Davidroid 5:0845d4141a01 312 * @param[in] pByteToTransmit pointer to the buffer of data to send.
Davidroid 5:0845d4141a01 313 * @param[out] pReceivedByte pointer to the buffer to read data into.
Davidroid 5:0845d4141a01 314 * @retval "0" in case of success, "1" otherwise.
Davidroid 5:0845d4141a01 315 */
Davidroid 5:0845d4141a01 316 uint8_t VNI8200XP_SpiWriteBytes(uint8_t *pByteToTransmit, uint8_t *pReceivedByte)
Davidroid 5:0845d4141a01 317 {
Davidroid 5:0845d4141a01 318 return (uint8_t) (ReadWrite(pReceivedByte, pByteToTransmit, BUFFERSIZE) == COMPONENT_OK ? 0 : 1);
Davidroid 5:0845d4141a01 319 }
Davidroid 5:0845d4141a01 320
Davidroid 5:0845d4141a01 321
Davidroid 5:0845d4141a01 322 /*** Component's Instance Variables ***/
Davidroid 5:0845d4141a01 323
Davidroid 5:0845d4141a01 324 /* ACTION 9 --------------------------------------------------------------*
Davidroid 5:0845d4141a01 325 * Declare here interrupt related variables, if needed. *
Davidroid 5:0845d4141a01 326 * Note that interrupt handling is platform dependent, see *
Davidroid 5:0845d4141a01 327 * "Interrupt Related Methods" above. *
Davidroid 5:0845d4141a01 328 * *
Davidroid 5:0845d4141a01 329 * Example: *
Davidroid 5:0845d4141a01 330 * + mbed: *
Davidroid 5:0845d4141a01 331 * InterruptIn feature_irq; *
Davidroid 5:0845d4141a01 332 *------------------------------------------------------------------------*/
Davidroid 5:0845d4141a01 333
Davidroid 5:0845d4141a01 334 /* ACTION 10 -------------------------------------------------------------*
Davidroid 5:0845d4141a01 335 * Declare here other pin related variables, if needed. *
Davidroid 5:0845d4141a01 336 * *
Davidroid 5:0845d4141a01 337 * Example: *
Davidroid 5:0845d4141a01 338 * + mbed: *
Davidroid 5:0845d4141a01 339 * PwmOut pwm; *
Davidroid 5:0845d4141a01 340 *------------------------------------------------------------------------*/
Davidroid 5:0845d4141a01 341
Davidroid 5:0845d4141a01 342 /* ACTION 11 -------------------------------------------------------------*
Davidroid 5:0845d4141a01 343 * Declare here communication related variables, if needed. *
Davidroid 5:0845d4141a01 344 * *
Davidroid 5:0845d4141a01 345 * Example: *
Davidroid 5:0845d4141a01 346 * + mbed: *
Davidroid 5:0845d4141a01 347 * DigitalOut ssel; *
Davidroid 5:0845d4141a01 348 * SPI &dev_spi; *
Davidroid 5:0845d4141a01 349 *------------------------------------------------------------------------*/
Davidroid 5:0845d4141a01 350 /* Configuration. */
Davidroid 5:0845d4141a01 351 DigitalOut out_en;
Davidroid 5:0845d4141a01 352 DigitalOut ssel;
Davidroid 5:0845d4141a01 353
Davidroid 5:0845d4141a01 354 /* IO Device. */
Davidroid 5:0845d4141a01 355 SPI &dev_spi;
Davidroid 5:0845d4141a01 356
Davidroid 5:0845d4141a01 357 /* ACTION 12 -------------------------------------------------------------*
Davidroid 5:0845d4141a01 358 * Declare here identity related variables, if needed. *
Davidroid 5:0845d4141a01 359 * Note that there should be only a unique identifier for each component, *
Davidroid 5:0845d4141a01 360 * which should be the "who_am_i" parameter. *
Davidroid 5:0845d4141a01 361 *------------------------------------------------------------------------*/
Davidroid 5:0845d4141a01 362 /* Identity */
Davidroid 5:0845d4141a01 363 uint8_t who_am_i;
Davidroid 5:0845d4141a01 364
Davidroid 5:0845d4141a01 365 /* ACTION 13 -------------------------------------------------------------*
Davidroid 5:0845d4141a01 366 * Declare here the component's static and non-static data, one variable *
Davidroid 5:0845d4141a01 367 * per line. *
Davidroid 5:0845d4141a01 368 * *
Davidroid 5:0845d4141a01 369 * Example: *
Davidroid 5:0845d4141a01 370 * float measure; *
Davidroid 5:0845d4141a01 371 * int instance_id; *
Davidroid 5:0845d4141a01 372 * static int number_of_instances; *
Davidroid 5:0845d4141a01 373 *------------------------------------------------------------------------*/
Davidroid 5:0845d4141a01 374 /* Data. */
Davidroid 5:0845d4141a01 375 uint8_t plc_output_component_instance;
Davidroid 5:0845d4141a01 376
Davidroid 5:0845d4141a01 377 uint8_t VNI_PARITY_Buffer;
Davidroid 5:0845d4141a01 378 uint8_t VNI_FAULT_Buffer;
Davidroid 5:0845d4141a01 379 uint8_t VNI_FB_OK;
Davidroid 5:0845d4141a01 380 uint8_t VNI_TEMP_WARNING;
Davidroid 5:0845d4141a01 381 uint8_t VNI_PARITY_CHECK;
Davidroid 5:0845d4141a01 382 uint8_t VNI_POWER_GOOD;
Davidroid 5:0845d4141a01 383 uint8_t VNI_PARITY_FALL_Buffer;
Davidroid 5:0845d4141a01 384
Davidroid 5:0845d4141a01 385 /* Static data. */
Davidroid 5:0845d4141a01 386 static uint8_t number_of_plc_output_components;
Davidroid 5:0845d4141a01 387
Davidroid 5:0845d4141a01 388 /* Ssrelay Array buffers for SPI communication */
Davidroid 5:0845d4141a01 389 uint8_t spi_tx_buff[NB_BYTES];
Davidroid 5:0845d4141a01 390 uint8_t spi_rx_buff[NB_BYTES];
Davidroid 5:0845d4141a01 391
Davidroid 5:0845d4141a01 392
Davidroid 5:0845d4141a01 393 public:
Davidroid 5:0845d4141a01 394
Davidroid 5:0845d4141a01 395 /* Static data. */
Davidroid 5:0845d4141a01 396 };
Davidroid 5:0845d4141a01 397
Davidroid 5:0845d4141a01 398 #endif // __VNI8200XP_CLASS_H
Davidroid 5:0845d4141a01 399
Davidroid 5:0845d4141a01 400 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/