Firmware to manage X-Nucleo-IPS02A1 (24V) Intelligent Power Switch.
Dependents: HelloWorld_IPS02A1
Fork of X_NUCLEO_IPS02A1 by
X_NUCLEO_IPS02A1 24V Intelligent Power Switch (IPS) Nucleo Expansion Board Firmware Package
Introduction
This firmware package includes Components Device Drivers and Board Support Package for STMicroelectronics X-NUCLEO-IPS02A1 IPS Expansion Board.
Firmware Library
Class X_NUCLEO_IPS02A1 is intended to represent the Intelligent Power Switch expansion board with the same name.
The expansion board is basically featuring by one IP:
- vps2535h vertical power switch.
It is intentionally implemented as a singleton because only one X-NUCLEO-IPS02A1 at a time might be deployed in a HW component stack. In order to get the singleton instance you have to call class method `Instance()`, e.g.:
// IPS expansion board singleton instance static X_NUCLEO_IPS02A1 *ips_expansion_board = X_NUCLEO_IPS02A1::Instance();
How to use the firmware package
The basic operations to deal with the firmware pkg and use the IPS are the following :
1) instantiate the X_NUCLEO by calling class method `Instance()`:
// Sensors expansion board singleton instance static X_NUCLEO_IPS02A1 *sensors_expansion_board = X_NUCLEO_IPS02A1::Instance();
2) Switch-on or Switch-off loads output (Channel 1 or Channel 2) by setting or clearing associated digital input :
ips_expansion_board.vps2535h.Fr_Stby = 1; // set Fr_Stby pin
ips_expansion_board.vps2535h.In_1 = 1; // switch-on Channel 1
ips_expansion_board.vps2535h.In_2 = 0; // switch-off Channle 2
3) Read Current circulating on Channel 1 or Channel 2 and print on the Terminal
Multisense_Signal= ips_expansion_board.GetCurrent(CHANNEL_1);
printf("Current Ch1 = %2.3fA \n\r", Multisense_Signal);
Multisense_Signal= ips_expansion_board.GetCurrent(CHANNEL_2);
printf("Current Ch2 = %2.3fA \n\r", Multisense_Signal);
Revision 7:10e489682b80, committed 2017-05-09
- Comitter:
- Davidroid
- Date:
- Tue May 09 09:37:03 2017 +0000
- Parent:
- 6:c313d3a5c61a
- Child:
- 8:73df2d2b721c
- Commit message:
- Aligned to ARM mbed coding style.
Changed in this revision
--- a/Components/Common/IPS.h Thu Jul 28 16:42:52 2016 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,135 +0,0 @@
-/**
- *******************************************************************************
- * @file IPS.c
- * @author ADG
- * @version V1.0.1
- * @date 01-July-2016
- * @brief IPS (Intelligent Power Switch) module driver common interface.
- *
- *******************************************************************************
- * @attention
- *
- * <h2><center>© 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 __IPS_H
-#define __IPS_H
-
-#include <stdint.h>
-
-
-/* Exported types ------------------------------------------------------------*/
-
-/**
- * @brief IPS Init Structure definition
- */
-
-typedef struct
-{
- uint32_t Init; /* Inserted for sake of generality */
-}IPS_InitTypeDef;
-
-/**
- * @brief IPS State structures definition
- */
-typedef enum
-{
- IPS_SUCCESS = 0x00, /*!< No error */
- IPS_FAIL = 0x01, /*!< Error */
- IPS_WRONG_CHANNEL = 0x02, /*!< Wrong IPS channel selected */
- }IPS_StatusTypeDef;
-
-/**
- * @brief IPS I/O error type structures definition
- */
- typedef enum
-{
- IPS_IO_SUCCESS = 0x00, /*!< No error */
- IPS_IO_FAIL = 0x01, /*!< Error */
- IPS_ADC_INIT_FAILED = 0x02, /*!< ADC Init failed */
- IPS_ADC_CAL_FAILED = 0x03, /*!< ADC Calibration failed */
- IPS_ADC_CONF_CH_FAILED = 0x04, /*!< ADC Configure Channel failed */
- IPS_ADC_START_FAILED = 0x05, /*!< ADC Start Conversion failed */
- IPS_ADC_STOP_FAILED = 0x06, /*!< ADC Stop Conversion failed */
- IPS_ADC_STATE_FAILED = 0x07, /*!< ADC Get State failed */
- IPS_ADC_POLL_FAILED = 0x08 /*!< ADC Poll for conversion failed */
-}IO_ErrorType;
-
-/**
- * @brief IPS handle Structure definition
- */
-typedef struct
-{
- uint8_t ipsChannel; /* IPS channel to get sense measurement*/
- IPS_StatusTypeDef Status; /* IPS Status */
- IO_ErrorType IO_Status; /* IO Status */
- float SenseRawValue; /* V-Sense raw value */
- float GNDSenseRawValue; /* GND Value */
- float TemperatureValue; /* Chip Temperature */
- float VccValue; /* Vcc Value */
- float IValue; /* Current Value */
-}IPS_HandleTypeDef;
-
-/**
- * @brief IPS component id enumerator definition
- */
-typedef enum
-{
- IPS_NONE_COMPONENT = 0,
- ISP_VPS2535H_COMPONENT = 1
-} IPS_ComponentTypeDef;
-
-/**
- * @brief IPS driver extended structure definition
- */
-typedef struct
-{
- IPS_ComponentTypeDef
- id; /* This id must be unique for each component belonging to this class that wants to extend common class */
- void *pData; /* This pointer is specific for each component */
-} IPS_DrvExtTypeDef;
-
-/**
- * @brief Intelligent Power Switch driver structure definition
- */
-typedef struct
-{
- IPS_StatusTypeDef (*Init)(IPS_HandleTypeDef *);
- IPS_StatusTypeDef (*Close)(void);
- IPS_StatusTypeDef (*ConfigureMuxChannel)(uint8_t, uint8_t);
- IPS_StatusTypeDef (*GetSenseChannelDiagnostic)(IPS_HandleTypeDef *);
- IPS_StatusTypeDef (*GetTemperatureChipSense)(IPS_HandleTypeDef *);
- IPS_StatusTypeDef (*GetVccSense)(IPS_HandleTypeDef *hips);
- IPS_StatusTypeDef (*GetCurrentSense)(IPS_HandleTypeDef *hips);
- IPS_DrvExtTypeDef *extData;
-}IPS_DrvTypeDef;
-
-#endif /* __IPS_H */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Components/Common/IPS_def.h Tue May 09 09:37:03 2017 +0000
@@ -0,0 +1,135 @@
+/**
+ *******************************************************************************
+ * @file IPS.c
+ * @author ADG
+ * @version V1.0.1
+ * @date 01-July-2016
+ * @brief IPS (Intelligent Power Switch) module driver common interface.
+ *
+ *******************************************************************************
+ * @attention
+ *
+ * <h2><center>© 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 __IPS_H
+#define __IPS_H
+
+#include <stdint.h>
+
+
+/* Exported types ------------------------------------------------------------*/
+
+/**
+ * @brief IPS Init Structure definition
+ */
+
+typedef struct
+{
+ uint32_t Init; /* Inserted for sake of generality */
+}IPS_InitTypeDef;
+
+/**
+ * @brief IPS State structures definition
+ */
+typedef enum
+{
+ IPS_SUCCESS = 0x00, /*!< No error */
+ IPS_FAIL = 0x01, /*!< Error */
+ IPS_WRONG_CHANNEL = 0x02, /*!< Wrong IPS channel selected */
+ }IPS_StatusTypeDef;
+
+/**
+ * @brief IPS I/O error type structures definition
+ */
+ typedef enum
+{
+ IPS_IO_SUCCESS = 0x00, /*!< No error */
+ IPS_IO_FAIL = 0x01, /*!< Error */
+ IPS_ADC_INIT_FAILED = 0x02, /*!< ADC Init failed */
+ IPS_ADC_CAL_FAILED = 0x03, /*!< ADC Calibration failed */
+ IPS_ADC_CONF_CH_FAILED = 0x04, /*!< ADC Configure Channel failed */
+ IPS_ADC_START_FAILED = 0x05, /*!< ADC Start Conversion failed */
+ IPS_ADC_STOP_FAILED = 0x06, /*!< ADC Stop Conversion failed */
+ IPS_ADC_STATE_FAILED = 0x07, /*!< ADC Get State failed */
+ IPS_ADC_POLL_FAILED = 0x08 /*!< ADC Poll for conversion failed */
+}IO_ErrorType;
+
+/**
+ * @brief IPS handle Structure definition
+ */
+typedef struct
+{
+ uint8_t ipsChannel; /* IPS channel to get sense measurement*/
+ IPS_StatusTypeDef Status; /* IPS Status */
+ IO_ErrorType IO_Status; /* IO Status */
+ float SenseRawValue; /* V-Sense raw value */
+ float GNDSenseRawValue; /* GND Value */
+ float TemperatureValue; /* Chip Temperature */
+ float VccValue; /* Vcc Value */
+ float IValue; /* Current Value */
+}IPS_HandleTypeDef;
+
+/**
+ * @brief IPS component id enumerator definition
+ */
+typedef enum
+{
+ IPS_NONE_COMPONENT = 0,
+ ISP_VPS2535H_COMPONENT = 1
+} IPS_ComponentTypeDef;
+
+/**
+ * @brief IPS driver extended structure definition
+ */
+typedef struct
+{
+ IPS_ComponentTypeDef
+ id; /* This id must be unique for each component belonging to this class that wants to extend common class */
+ void *pData; /* This pointer is specific for each component */
+} IPS_DrvExtTypeDef;
+
+/**
+ * @brief Intelligent Power Switch driver structure definition
+ */
+typedef struct
+{
+ IPS_StatusTypeDef (*Init)(IPS_HandleTypeDef *);
+ IPS_StatusTypeDef (*Close)(void);
+ IPS_StatusTypeDef (*ConfigureMuxChannel)(uint8_t, uint8_t);
+ IPS_StatusTypeDef (*GetSenseChannelDiagnostic)(IPS_HandleTypeDef *);
+ IPS_StatusTypeDef (*GetTemperatureChipSense)(IPS_HandleTypeDef *);
+ IPS_StatusTypeDef (*GetVccSense)(IPS_HandleTypeDef *hips);
+ IPS_StatusTypeDef (*GetCurrentSense)(IPS_HandleTypeDef *hips);
+ IPS_DrvExtTypeDef *extData;
+}IPS_DrvTypeDef;
+
+#endif /* __IPS_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Components/Interfaces/Component.h Tue May 09 09:37:03 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>© 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 Thu Jul 28 16:42:52 2016 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/**
- ******************************************************************************
- * @file Component_class.h
- * @author ADG
- * @version V1.0.1
- * @date 01-July-2016
- * @brief This file contains the abstract class describing the interface of a
- * generic component.
- ******************************************************************************
- * @attention
- *
- * <h2><center>© 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****/
--- a/Components/Interfaces/PowerSwitch.h Thu Jul 28 16:42:52 2016 +0000
+++ b/Components/Interfaces/PowerSwitch.h Tue May 09 09:37:03 2017 +0000
@@ -42,7 +42,7 @@
/* Includes ------------------------------------------------------------------*/
#include <stdint.h>
-#include <Component_class.h>
+#include <Component.h>
/* Classes ------------------------------------------------------------------*/
/** An abstract class for Generic Power Switch
@@ -51,7 +51,12 @@
{
public:
/* Provide Ch current w/o checking status of convertion */
- virtual float GetCurrent(int Ch) = 0;
+ virtual float get_current(int Ch) = 0;
+
+ /**
+ * @brief Destructor.
+ */
+ virtual ~PowerSwitch() {};
};
#endif /* __GENERIC_IPS_CLASS_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Components/VPS2535H/VPS2535H.cpp Tue May 09 09:37:03 2017 +0000
@@ -0,0 +1,154 @@
+/**
+ ******************************************************************************
+ * @file VPS2535H.cpp
+ * @author ADG
+ * @version V1.0.1
+ * @date 01-July-2016
+ * @brief implementatio for VPS2535H driver class
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3. Neither the name of STMicroelectronics nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ******************************************************************************
+*/
+
+
+/* Includes ------------------------------------------------------------------*/
+#include "VPS2535H.h"
+
+
+/* Methods -------------------------------------------------------------------*/
+
+/**
+ * @brief Set VPS2535H Initialization
+ * @param VPS2535H handel structure
+ * @retval IPS_SUCCESS
+ */
+int VPS2535H::init(void *init_struct) {
+ VPS2535H_init();
+ return IPS_SUCCESS;
+}
+
+/**
+ * @brief Close VPS2535H
+ * @param none
+ * @retval IPS_SUCCESS
+ */
+int VPS2535H::close(void) {
+ VPS2535H_close();
+ return IPS_SUCCESS;
+}
+
+/* Module Interface */
+/**
+ * @brief Initializes the VPS2535H device
+ * @param none
+ * @retval VPS2535H status
+ */
+IPS_StatusTypeDef VPS2535H::VPS2535H_init() {
+ Fr_Stby = 1;
+ return IPS_SUCCESS;
+}
+
+/**
+ * @brief Close (Deinitialize) the VPS2535H device and used peripheral.
+ * @param None
+ * @retval VPS2535H status
+ */
+IPS_StatusTypeDef VPS2535H::VPS2535H_close(){
+ Fr_Stby = 1;
+ return IPS_SUCCESS;
+}
+
+/**
+ * @brief GetSense function gets the value of the Sense power switch output pin
+ * (for either Ch1 or Ch2) upon IO conversion. It just reads from sense pin
+ * @param hips: pointer to a VPS2535H_HandleTypeDef structure that contains
+ * the configuration information for the specified VPS2535H module.
+ * Value got from V-sense output is stored in hips->SenseValue
+ * field. Status of the operation is stored in hips->Status and
+ * hips->Status fields
+ * @retval IPS_StatusTypeDef status
+ */
+IPS_StatusTypeDef VPS2535H::VPS2535H_get_sense_channel_diagnostic(IPS_HandleTypeDef *hips){
+ hips->SenseRawValue = 0; //if channel is wrong Sense value is 0
+ hips->GNDSenseRawValue = 0; // VPS2535H doesn't require GND measurement compensation
+ hips-> Status =IPS_WRONG_CHANNEL;
+ hips->IO_Status = IPS_IO_FAIL;
+ if (hips ->ipsChannel == CHANNEL_1)
+ hips->SenseRawValue = CurrentSense1.read() * V_REF * ((R_D1+R_D2)/(R_D2));
+ if (hips ->ipsChannel == CHANNEL_2)
+ hips->SenseRawValue = CurrentSense2.read() * V_REF * ((R_D1+R_D2)/(R_D2));
+
+ hips->IO_Status = IPS_IO_SUCCESS;
+ hips->Status =IPS_SUCCESS;
+ return hips-> Status;
+}
+
+/**
+ * @brief GetSecureCurrentSense function gets the I-sense switch output pin
+ * upon ADC conversion.
+ * @param hips: pointer to a IPS_HandleTypeDef structure that contains
+ * the configuration information for the specified VPS2535H module.
+ * Value got from V-sense output is stored in hips->SenseValue
+ * field.
+ * Status of the operation is stored in hips->Status fields
+ * @retval IPS status
+ */
+IPS_StatusTypeDef VPS2535H::VPS2535H_get_secure_current_sense(IPS_HandleTypeDef *hips){
+
+ if ((hips ->ipsChannel != CHANNEL_1) && (hips ->ipsChannel != CHANNEL_2)) {
+ hips->Status = IPS_WRONG_CHANNEL;
+ return IPS_WRONG_CHANNEL;
+ }
+
+ /* Get sense feedback */
+ if ((VPS2535H_get_sense_channel_diagnostic(hips) == IPS_SUCCESS) && (hips->Status == IPS_SUCCESS)) {
+ hips->IValue= K*hips->SenseRawValue/R_SENSE;
+ return IPS_SUCCESS;
+ }
+ else
+ return IPS_FAIL; // see hips->Status
+}
+
+/**
+ * @brief GetCurrent function gets the I-sense switch output pin
+ * @param Ch: Channel number. Possible value are CHANNEL_1 or CHANNEL_2
+ * @retval Current Value
+ */
+float VPS2535H::get_current(int Ch) {
+
+ if (Ch == CHANNEL_1) {
+ return (K*CurrentSense1.read()* ((R_D1+R_D2)/(R_D2)) * V_REF/R_SENSE);
+ }
+ if (Ch == CHANNEL_2) {
+ return (K*CurrentSense2.read()* ((R_D1+R_D2)/(R_D2)) * V_REF/R_SENSE);
+ }
+ return 0;
+}
+
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Components/VPS2535H/VPS2535H.h Tue May 09 09:37:03 2017 +0000
@@ -0,0 +1,126 @@
+/**
+ *******************************************************************************
+ * @file VPS2535H.h
+ * @author ADG
+ * @version V1.0.1
+ * @date 01-July-2016
+ * @brief vps2535h module driver.
+ * This file provides firmware functions to manage the following
+ * functionalities of the vps2535h power switch:
+ * + Initialization and de-initialization functions
+ * + Diagnostic Sense Pin Configuration
+ * + Get Sense Diagnostic Values
+ *******************************************************************************
+ * @attention
+ *
+ * <h2><center>© 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 __VPS2535H_CLASS_H
+#define __VPS2535H_CLASS_H
+
+
+/* Includes ------------------------------------------------------------------*/
+
+#include "mbed.h"
+#include "PowerSwitch.h"
+#include "VPS2535H_def.h"
+
+
+/* Classes -------------------------------------------------------------------*/
+
+/** Class representing a VPS2535H power switch component
+ */
+
+class VPS2535H : public PowerSwitch {
+
+public:
+ DigitalOut In_1,In_2,Fr_Stby;
+
+ /** Constructor
+ * @param[in] input Pin for the power switch
+ * @param[out] sense1 and sense2, outputs from Ch1 and Ch2
+ * @param[in] vref, reference voltage
+ * @param[in] rsense, sense resistor ouside of chip
+ * @param[in] rd1, upper partitor resistor (=R6 in schematic) to protect ADC
+ * @param[in] rd1, lower partitor resistor (=R7 in schematic) to protect ADC
+ */
+ VPS2535H(PinName in1, PinName in2, PinName frStdby,
+ PinName sense1, PinName sense2, float vref,float rsense,float rd1,float rd2):
+ PowerSwitch(),
+ In_1 (in1),
+ In_2 (in2),
+ Fr_Stby(frStdby),
+ V_REF(vref),
+ R_SENSE(rsense),
+ R_D1(rd1),
+ R_D2(rd2),
+ CurrentSense1(sense1),
+ CurrentSense2(sense2)
+ {
+ In_1 = In_2 = Fr_Stby = 0;
+ }
+
+ /** Destructor
+ */
+ virtual ~VPS2535H() {}
+
+ /*** Interface Methods ***/
+ virtual int init(void *init_struct);
+ virtual int close(void);
+
+ /* Getting the ID of the component */
+ virtual int read_id(uint8_t *id) { return (int) 235; }
+
+ /* Provide Ch current w/o checking status of convertion */
+ virtual float get_current(int Ch);
+
+ /* Provide Ch current Value with status of convertion */
+ IPS_StatusTypeDef VPS2535H_get_secure_current_sense(IPS_HandleTypeDef *hips);
+
+
+protected:
+ IPS_StatusTypeDef VPS2535H_close(void);
+ IPS_StatusTypeDef VPS2535H_init(void);
+ IPS_StatusTypeDef VPS2535H_get_sense_channel_diagnostic(IPS_HandleTypeDef *);
+
+private:
+ const float V_REF; // Reference voltage for V-sense measurement
+ const float R_SENSE; // R-sense value depending on resistor connected to V-sense output
+ const float R_D1; // R_D1 upper divisor partitor resistor (=R6 in schematic)
+ const float R_D2; // R_D2 lower divisor partitor resistor (=R7 in schematic)
+ AnalogIn CurrentSense1; // V-Sense Output from Ch1
+ AnalogIn CurrentSense2; // V-Sense Output from Ch2
+};
+#endif /* __VPS2535H_CLASS_H */
+
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
+
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Components/VPS2535H/VPS2535H_def.h Tue May 09 09:37:03 2017 +0000 @@ -0,0 +1,77 @@ +/** + ******************************************************************************* + * @file VPS2535H_def.h + * @author ADG + * @version V1.0.1 + * @date 01-July-2016 + * @brief VPS235H1 module driver. + * This file provides firmware functions to manage the following + * functionalities of the VPS235H1 power switch: + * + Initialization and de-initialization functions + * + Diagnostic Sense Pin Configuration + * + Get Sense Diagnostic Values + ******************************************************************************* + * @attention + * + * <h2><center>© 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 __VPS2535H_H +#define __VPS2535H_H + + +/* Includes ------------------------------------------------------------------*/ + +#include "IPS_def.h" + + +/* Definitions ---------------------------------------------------------------*/ + +/* Number of channels */ +#define NUM_CHANNELS 2 + +/* Channel 0 */ +#define CHANNEL_1 1 +/* Channel 1 */ +#define CHANNEL_2 2 + +/* V-Sense Temperature Typical value at 25 degree */ +#define V_SENSE_TC_TYPICAL 2.070 + +/* Vcc transfer function */ +#define VCC_TRANSFER_FUNCT(sense) ((sense)*4) +/* Current K factor */ +#define K 3500 + + +#endif /* __VPS2535H_H */ + + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
--- a/Components/vps2535h/vps2535h.h Thu Jul 28 16:42:52 2016 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -/** - ******************************************************************************* - * @file vps2535h.h - * @author ADG - * @version V1.0.1 - * @date 01-July-2016 - * @brief VPS235H1 module driver. - * This file provides firmware functions to manage the following - * functionalities of the VPS235H1 power switch: - * + Initialization and de-initialization functions - * + Diagnostic Sense Pin Configuration - * + Get Sense Diagnostic Values - ******************************************************************************* - * @attention - * - * <h2><center>© 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 __VPS2535H_H -#define __VPS2535H_H - -/* Number of channels */ -#define NUM_CHANNELS 2 - -/* Channel 0 */ -#define CHANNEL_1 1 -/* Channel 1 */ -#define CHANNEL_2 2 - -/* V-Sense Temperature Typical value at 25 degree */ -#define V_SENSE_TC_TYPICAL 2.070 - -/* Vcc transfer function */ -#define VCC_TRANSFER_FUNCT(sense) ((sense)*4) -/* Current K factor */ -#define K 3500 - - - -#endif /* __VPS2535H_H */ - - - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ - - - -
--- a/Components/vps2535h/vps2535h_class.cpp Thu Jul 28 16:42:52 2016 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,159 +0,0 @@
-/**
- ******************************************************************************
- * @file vps2535h.cpp
- * @author ADG
- * @version V1.0.1
- * @date 01-July-2016
- * @brief implementatio for VPS2535H driver class
- ******************************************************************************
- * @attention
- *
- * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. Neither the name of STMicroelectronics nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- ******************************************************************************
-*/
-
-/* Includes ------------------------------------------------------------------*/
-#include "vps2535h_class.h"
-#include "vps2535h.h"
-
-
-/* Methods -------------------------------------------------------------------*/
-/**
- * @brief Set VPS2535H Initialization
- * @param VPS2535H handel structure
- * @retval IPS_SUCCESS
- */
-
-int VPS2535H :: Init(void *init_struct) {
- VPS2535H_Init();
- return IPS_SUCCESS;
-
- }
-
-/**
- * @brief Close VPS2535H
- * @param none
- * @retval IPS_SUCCESS
- */
-
-int VPS2535H :: Close(void) {
- VPS2535H_Close();
- return IPS_SUCCESS;
- }
-
-
-/* Module Interface */
-/**
- * @brief Initializes the VPS2535H device
- * @param none
- * @retval VPS2535H status
- */
-IPS_StatusTypeDef VPS2535H :: VPS2535H_Init(){
- Fr_Stby = 1;
- return IPS_SUCCESS;
-}
-
-/**
- * @brief Close (Deinitialize) the VPS2535H device and used peripheral.
- * @param None
- * @retval VPS2535H status
- */
-IPS_StatusTypeDef VPS2535H :: VPS2535H_Close(){
- Fr_Stby = 1;
- return IPS_SUCCESS;
-}
-
-
-/**
- * @brief GetSense function gets the value of the Sense power switch output pin
- * (for either Ch1 or Ch2) upon IO conversion. It just reads from sense pin
- * @param hips: pointer to a VPS2535H_HandleTypeDef structure that contains
- * the configuration information for the specified VPS2535H module.
- * Value got from V-sense output is stored in hips->SenseValue
- * field. Status of the operation is stored in hips->Status and
- * hips->Status fields
- * @retval IPS_StatusTypeDef status
- */
-IPS_StatusTypeDef VPS2535H :: VPS2535H_GetSenseChannelDiagnostic(IPS_HandleTypeDef *hips){
- hips->SenseRawValue = 0; //if channel is wrong Sense value is 0
- hips->GNDSenseRawValue = 0; // VPS2535H doesn't require GND measurement compensation
- hips-> Status =IPS_WRONG_CHANNEL;
- hips->IO_Status = IPS_IO_FAIL;
- if (hips ->ipsChannel == CHANNEL_1)
- hips->SenseRawValue = CurrentSense1.read() * V_REF * ((R_D1+R_D2)/(R_D2));
- if (hips ->ipsChannel == CHANNEL_2)
- hips->SenseRawValue = CurrentSense2.read() * V_REF * ((R_D1+R_D2)/(R_D2));
-
- hips->IO_Status = IPS_IO_SUCCESS;
- hips->Status =IPS_SUCCESS;
- return hips-> Status;
-}
-
-
-/**
- * @brief GetSecureCurrentSense function gets the I-sense switch output pin
- * upon ADC conversion.
- * @param hips: pointer to a IPS_HandleTypeDef structure that contains
- * the configuration information for the specified VPS2535H module.
- * Value got from V-sense output is stored in hips->SenseValue
- * field.
- * Status of the operation is stored in hips->Status fields
- * @retval IPS status
- */
-IPS_StatusTypeDef VPS2535H :: VPS2535H_GetSecureCurrentSense(IPS_HandleTypeDef *hips){
-
- if ((hips ->ipsChannel != CHANNEL_1) && (hips ->ipsChannel != CHANNEL_2) ){
- hips->Status = IPS_WRONG_CHANNEL;
- return IPS_WRONG_CHANNEL;
- }
-
- /* Get sense feedback */
- if ((VPS2535H_GetSenseChannelDiagnostic(hips) == IPS_SUCCESS) && (hips->Status == IPS_SUCCESS)){
- hips->IValue= K*hips->SenseRawValue/R_SENSE;
- return IPS_SUCCESS;
- }
- else
- return IPS_FAIL; // see hips->Status
-}
-
-/**
- * @brief GetCurrent function gets the I-sense switch output pin
- * @param Ch: Channel number. Possible value are CHANNEL_1 or CHANNEL_2
- * @retval Current Value
- */
-float VPS2535H :: GetCurrent(int Ch){
-
- if (Ch == CHANNEL_1)
- return (K*CurrentSense1.read()* ((R_D1+R_D2)/(R_D2)) * V_REF/R_SENSE);
- if (Ch == CHANNEL_2)
- return (K*CurrentSense2.read()* ((R_D1+R_D2)/(R_D2)) * V_REF/R_SENSE);
- return 0;
-}
-
-
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
-
--- a/Components/vps2535h/vps2535h_class.h Thu Jul 28 16:42:52 2016 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,123 +0,0 @@
-/**
- *******************************************************************************
- * @file vps2535h_class.h
- * @author ADG
- * @version V1.0.1
- * @date 01-July-2016
- * @brief vps2535h module driver.
- * This file provides firmware functions to manage the following
- * functionalities of the vps2535h power switch:
- * + Initialization and de-initialization functions
- * + Diagnostic Sense Pin Configuration
- * + Get Sense Diagnostic Values
- *******************************************************************************
- * @attention
- *
- * <h2><center>© 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 __VPS2535H_CLASS_H
-#define __VPS2535H_CLASS_H
-
-/* Includes ------------------------------------------------------------------*/
-#include "mbed.h"
-#include "PowerSwitch.h"
-#include "IPS.h"
-#include "vps2535h.h"
-
-
-/* Classes -------------------------------------------------------------------*/
-/** Class representing a VPS2535H power switch component
- */
-
-class VPS2535H : public PowerSwitch {
-
-public:
- DigitalOut In_1,In_2,Fr_Stby;
-
- /** Constructor
- * @param[in] input Pin for the power switch
- * @param[out] sense1 and sense2, outputs from Ch1 and Ch2
- * @param[in] vref, reference voltage
- * @param[in] rsense, sense resistor ouside of chip
- * @param[in] rd1, upper partitor resistor (=R6 in schematic) to protect ADC
- * @param[in] rd1, lower partitor resistor (=R7 in schematic) to protect ADC
- */
- VPS2535H(PinName in1, PinName in2, PinName frStdby,
- PinName sense1, PinName sense2, float vref,float rsense,float rd1,float rd2):
- PowerSwitch(),
- In_1 (in1),
- In_2 (in2),
- Fr_Stby(frStdby),
- V_REF(vref),
- R_SENSE(rsense),
- R_D1(rd1),
- R_D2(rd2),
- CurrentSense1(sense1),
- CurrentSense2(sense2)
- {
- In_1 = In_2 = Fr_Stby = 0;
- }
-
- /** Destructor
- */
- virtual ~VPS2535H() {}
-
- /*** Interface Methods ***/
- virtual int Init(void *init_struct);
- virtual int Close(void);
- /* Getting the ID of the component */
- virtual int ReadID(uint8_t *id) { return (int) 235; }
- /* Provide Ch current w/o checking status of convertion */
- virtual float GetCurrent(int Ch);
- /* Provide Ch current Value with status of convertion */
- IPS_StatusTypeDef VPS2535H_GetSecureCurrentSense(IPS_HandleTypeDef *hips);
- /**
- * @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.
- */
-
-protected:
- /*** Methods ***/
- IPS_StatusTypeDef VPS2535H_Close(void);
- IPS_StatusTypeDef VPS2535H_Init(void);
- IPS_StatusTypeDef VPS2535H_GetSenseChannelDiagnostic(IPS_HandleTypeDef *);
-
-private:
- const float V_REF; // Reference voltage for V-sense measurement
- const float R_SENSE; // R-sense value depending on resistor connected to V-sense output
- const float R_D1; // R_D1 upper divisor partitor resistor (=R6 in schematic)
- const float R_D2; // R_D2 lower divisor partitor resistor (=R7 in schematic)
- AnalogIn CurrentSense1; // V-Sense Output from Ch1
- AnalogIn CurrentSense2; // V-Sense Output from Ch2
-};
-#endif /* __VPS2535H_CLASS_H */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
-
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XNucleoIPS02A1.cpp Tue May 09 09:37:03 2017 +0000
@@ -0,0 +1,113 @@
+/**
+ ******************************************************************************
+ * @file XNucleoIPS02A1.cpp
+ * @author ADG
+ * @version V1.0.1
+ * @date 01-July-2016
+ * @brief Implementation file for the XNucleoIPS02A1 singleton class
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3. Neither the name of STMicroelectronics nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ******************************************************************************
+*/
+
+/* Includes ------------------------------------------------------------------*/
+
+#include "mbed.h"
+#include "XNucleoIPS02A1.h"
+
+
+/* Static variables ----------------------------------------------------------*/
+
+XNucleoIPS02A1* XNucleoIPS02A1::_instance = NULL;
+
+
+/* Methods -------------------------------------------------------------------*/
+
+/**
+ * @brief Constructor
+ * @return a pointer to the initialized singleton instance of class X_NUCLEO_IPS02A1
+ * @param[in] in1, input1 Pin for the power switch
+ * @param[in] in2, input1 Pin for the power switch
+ * @param[in] frstdby ,stand-by Pin
+ * @param[in] sense1 and sense2, outputs from Ch1 and Ch2
+ * @param[in] vref, reference voltage
+ * @param[in] rsense, sense resistor ouside of chip
+ * @param[in] rd1, upper partitor resistor (=R6 in schematic) to protect ADC
+ * @param[in] rd1, lower partitor resistor (=R7 in schematic) to protect ADC
+ */
+
+XNucleoIPS02A1::XNucleoIPS02A1(PinName in1, PinName in2, PinName frstdby,
+ PinName sense1, PinName sense2, float vref, float rsense, float rd1, float rd2) :
+ vps2535h( *(new VPS2535H(in1, in2, frstdby, sense1, sense2, vref,rsense,rd1,rd2)))
+{
+}
+
+/**
+ * @brief Get singleton instance
+ * @return a pointer to the initialized singleton instance of class XNucleoIPS02A1
+ * @param[in] none
+ */
+XNucleoIPS02A1 &XNucleoIPS02A1::instance(PinName in1, PinName in2, PinName frstdby,
+ PinName sense1, PinName sense2, float vref, float rsense, float rd1, float rd2) {
+ if (_instance == NULL) {
+ _instance = new XNucleoIPS02A1(in1,in2,frstdby,sense1,sense2,vref,rsense,rd1,rd2);
+
+ if (_instance != NULL) {
+ bool ret = _instance->init();
+ if (!ret) {
+ error("Failed to init X_NUCLEO_IPS02A1 expansion board!\n");
+ }
+ }
+ }
+
+ return (*_instance);
+}
+
+/**
+ * @brief Initialize the singleton's power switch
+ * @retval true if initialization successful,
+ * @retval false otherwise
+ */
+bool XNucleoIPS02A1::init_VPS2535H(void) {
+ vps2535h.init(NULL);
+ return true;
+}
+
+
+/**
+ * @brief get current measurement from singleton's power switch
+ * @retval *hips contain status of the operation
+ * param[in] Channel number: CHANNEL_1 or CHANNEL_2
+ */
+float XNucleoIPS02A1::get_current(int ch){
+ return vps2535h.get_current(ch);
+}
+
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XNucleoIPS02A1.h Tue May 09 09:37:03 2017 +0000
@@ -0,0 +1,126 @@
+/**
+ *******************************************************************************
+ * @file XNucleoIPS02A1.h
+ * @author ADG
+ * @version V1.0.1
+ * @date 01-July-2016
+ * @brief Header file for the X-NUCLEO-IPS02A1 expansion board
+ *******************************************************************************
+ * @attention
+ *
+ * <h2><center>© 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_IPS02A1_H
+#define __X_NUCLEO_IPS02A1_H
+
+
+/* Includes ------------------------------------------------------------------*/
+
+#include "VPS2535H.h"
+
+
+/* Classes -------------------------------------------------------------------*/
+
+/** Class X_NUCLEO_IPS02A1 is intended to represent the intelligent power switch
+ * Nucleo Expansion Board with the same name.
+ *
+ * The expansion board is featuring basically of:\n
+ * -# a VPS2535H power switch\n
+ *
+ * It is intentionally implemented as a singleton because only one
+ * XNucleoIPS02A1 at a time might be deployed in a HW component stack.\n
+ * In order to get the singleton instance you have to call class method `Instance()`,
+ * e.g.:
+ * @code
+ * // Intelligent Power Switch expansion board singleton instance
+ * static XNucleoIPS02A1 *<TODO>_expansion_board = XNucleoIPS02A1::instance();
+ * @endcode
+ */
+
+class XNucleoIPS02A1
+{
+ public:
+ /**
+ * @brief Get singleton instance
+ * @return a pointer to the initialized singleton instance of class X_NUCLEO_IPS02A1
+ * @param[in] none
+ */
+ static XNucleoIPS02A1& instance (PinName in1, PinName in2, PinName frstdby,
+ PinName sense1, PinName sense2, float vref, float rsense, float rd1, float rd2);
+
+ /**
+ * @brief get current measurement from singleton's power switch
+ * @retval *hips contain status of the operation
+ * param[in] Channel number: CHANNEL_1 or CHANNEL_2
+ */
+ float get_current(int ch);
+
+ /**
+ * Power switch.
+ */
+ VPS2535H &vps2535h;
+
+
+protected:
+ /**
+ * Constructor.
+ */
+ XNucleoIPS02A1(PinName in1, PinName in2, PinName frstdby,
+ PinName sense1, PinName sense2, float vref,float rsense,float rd1,float rd2);
+
+ /**
+ * @brief Initialize the singleton's power switch to default settings
+ * @retval true if initialization successful,
+ * @retval false otherwise
+ */
+ bool init(void) {
+ return (init_VPS2535H());
+ }
+
+ /**
+ * @brief Initialize the singleton's power switch
+ * @retval true if initialization successful,
+ * @retval false otherwise
+ */
+ bool init_VPS2535H(void);
+
+
+ private:
+ /**
+ * Singleton instance of class XNucleoIPS02A1.
+ */
+ static XNucleoIPS02A1 *_instance;
+};
+
+#endif /* __X_NUCLEO_IPS02A1_H */
+
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
--- a/x_nucleo_ips02a1.cpp Thu Jul 28 16:42:52 2016 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,114 +0,0 @@
-/**
- ******************************************************************************
- * @file x_nucleo_ips02A1.cpp
- * @author ADG
- * @version V1.0.1
- * @date 01-July-2016
- * @brief Implementation file for the X_NUCLEO_IPS02A1 singleton class
- ******************************************************************************
- * @attention
- *
- * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. Neither the name of STMicroelectronics nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- ******************************************************************************
-*/
-
-/* Includes ------------------------------------------------------------------*/
-#include "mbed.h"
-#include "x_nucleo_ips02a1.h"
-
-/* Static variables ----------------------------------------------------------*/
-X_NUCLEO_IPS02A1* X_NUCLEO_IPS02A1::_instance = NULL;
-
-
-/* Methods -------------------------------------------------------------------*/
-/**
- * @brief Constructor
- * @return a pointer to the initialized singleton instance of class X_NUCLEO_IPS02A1
- * @param[in] in1, input1 Pin for the power switch
- * @param[in] in2, input1 Pin for the power switch
- * @param[in] frstdby ,stand-by Pin
- * @param[in] sense1 and sense2, outputs from Ch1 and Ch2
- * @param[in] vref, reference voltage
- * @param[in] rsense, sense resistor ouside of chip
- * @param[in] rd1, upper partitor resistor (=R6 in schematic) to protect ADC
- * @param[in] rd1, lower partitor resistor (=R7 in schematic) to protect ADC
- */
-
-X_NUCLEO_IPS02A1::X_NUCLEO_IPS02A1(PinName in1, PinName in2, PinName frstdby,
- PinName sense1, PinName sense2, float vref,float rsense,float rd1,float rd2) : vps2535h( *(new VPS2535H(in1, in2, frstdby,
- sense1, sense2, vref,rsense,rd1,rd2)) )
-
-{
-}
-
-
-/**
- * @brief Get singleton instance
- * @return a pointer to the initialized singleton instance of class X_NUCLEO_IPS02A1
- * @param[in] none
- */
- X_NUCLEO_IPS02A1& X_NUCLEO_IPS02A1::Instance(PinName in1, PinName in2, PinName frstdby,
- PinName sense1, PinName sense2, float vref,float rsense,float rd1,float rd2) {
- if(_instance == NULL) {
- _instance = new X_NUCLEO_IPS02A1(in1,in2,frstdby,
- sense1,sense2,vref,rsense,rd1,rd2);
-
- if(_instance != NULL) {
- bool ret = _instance->Init();
- if(!ret) {
- error("Failed to init X_NUCLEO_IPS02A1 expansion board!\n");
- }
- }
- }
-
- return (*_instance);
-}
-
-/**
- * @brief Initialize the singleton's power switch
- * @retval true if initialization successful,
- * @retval false otherwise
- */
-bool X_NUCLEO_IPS02A1::Init_VPS2535H(void) {
- vps2535h.Init(NULL);
- return true;
-}
-
-
-/**
- * @brief get current measurement from singleton's power switch
- * @retval *hips contain status of the operation
- * param[in] Channel number: CHANNEL_1 or CHANNEL_2
- */
-float X_NUCLEO_IPS02A1:: GetCurrent(int Ch){
-
- return vps2535h.GetCurrent(Ch);
-
-}
-
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
-
--- a/x_nucleo_ips02a1.h Thu Jul 28 16:42:52 2016 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-/**
- *******************************************************************************
- * @file x_nucleo_ips02a1.h
- * @author ADG
- * @version V1.0.1
- * @date 01-July-2016
- * @brief Header file for class X_NUCLEO_IPS02A1 representing a X-NUCLEO-IPS02A1
- * expansion board
- *******************************************************************************
- * @attention
- *
- * <h2><center>© 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_IPS02A1_H
-#define __X_NUCLEO_IPS02A1_H
-
-
-/* Includes ------------------------------------------------------------------*/
-#include "vps2535h_class.h"
-
-/* Classes -------------------------------------------------------------------*/
-/** Class X_NUCLEO_IPS02A1 is intended to represent the intelligent power switch
- * Nucleo Expansion Board with the same name.
- *
- * The expansion board is featuring basically of:\n
- * -# a VPS2535H power switch\n
- *
- * It is intentionally implemented as a singleton because only one
- * X_NUCLEO_IPS02A1 at a time might be deployed in a HW component stack.\n
- * In order to get the singleton instance you have to call class method `Instance()`,
- * e.g.:
- * @code
- * // Intelligent Power Switch expansion board singleton instance
- * static X_NUCLEO_IPS02A1 *<TODO>_expansion_board = X_NUCLEO_IPS02A1::Instance();
- * @endcode
- */
-
-class X_NUCLEO_IPS02A1
-{
- protected:
- X_NUCLEO_IPS02A1(PinName in1, PinName in2, PinName frstdby,
- PinName sense1, PinName sense2, float vref,float rsense,float rd1,float rd2);
-
- /**
- * @brief Initialize the singleton's power swicth to default settings
- * @retval true if initialization successful,
- * @retval false otherwise
- */
- bool Init(void) {
- return (Init_VPS2535H());
- }
-
- bool Init_VPS2535H(void);
-
- public:
- static X_NUCLEO_IPS02A1& Instance (PinName in1, PinName in2, PinName frstdby,
- PinName sense1, PinName sense2, float vref,float rsense,float rd1,float rd2);
- float GetCurrent(int Ch);
-
-
- VPS2535H &vps2535h;
- private:
- static X_NUCLEO_IPS02A1 *_instance;
-
-};
-
-
-
-
-#endif /* __X_NUCLEO_IPS02A1_H */
-
-
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
-
-

X-NUCLEO-IPS02A1 - 24V Intelligent power switch expansion board