Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: HelloWorld_IPS02A1
Fork of X_NUCLEO_IPS02A1 by
XNucleoIPS02A1.h
00001 /** 00002 ******************************************************************************* 00003 * @file XNucleoIPS02A1.h 00004 * @author ADG 00005 * @version V1.0.1 00006 * @date 01-July-2016 00007 * @brief Header file for the X-NUCLEO-IPS02A1 expansion board 00008 ******************************************************************************* 00009 * @attention 00010 * 00011 * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> 00012 * 00013 * Redistribution and use in source and binary forms, with or without modification, 00014 * are permitted provided that the following conditions are met: 00015 * 1. Redistributions of source code must retain the above copyright notice, 00016 * this list of conditions and the following disclaimer. 00017 * 2. Redistributions in binary form must reproduce the above copyright notice, 00018 * this list of conditions and the following disclaimer in the documentation 00019 * and/or other materials provided with the distribution. 00020 * 3. Neither the name of STMicroelectronics nor the names of its contributors 00021 * may be used to endorse or promote products derived from this software 00022 * without specific prior written permission. 00023 * 00024 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00025 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00026 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00027 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 00028 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00029 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00030 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00031 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00032 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00033 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00034 * 00035 ****************************************************************************** 00036 */ 00037 00038 00039 /* Define to prevent recursive inclusion -------------------------------------*/ 00040 00041 #ifndef __X_NUCLEO_IPS02A1_H 00042 #define __X_NUCLEO_IPS02A1_H 00043 00044 00045 /* Includes ------------------------------------------------------------------*/ 00046 00047 #include "VPS2535H.h" 00048 00049 00050 /* Classes -------------------------------------------------------------------*/ 00051 00052 /** Class X_NUCLEO_IPS02A1 is intended to represent the intelligent power switch 00053 * Nucleo Expansion Board with the same name. 00054 * 00055 * The expansion board is featuring basically of:\n 00056 * -# a VPS2535H power switch\n 00057 * 00058 * It is intentionally implemented as a singleton because only one 00059 * XNucleoIPS02A1 at a time might be deployed in a HW component stack.\n 00060 * In order to get the singleton instance you have to call class method `Instance()`, 00061 * e.g.: 00062 * @code 00063 * // Intelligent Power Switch expansion board singleton instance 00064 * static XNucleoIPS02A1 *<TODO>_expansion_board = XNucleoIPS02A1::instance(); 00065 * @endcode 00066 */ 00067 00068 class XNucleoIPS02A1 00069 { 00070 public: 00071 /** 00072 * @brief Get singleton instance 00073 * @return a pointer to the initialized singleton instance of class X_NUCLEO_IPS02A1 00074 * @param[in] none 00075 */ 00076 static XNucleoIPS02A1& instance (PinName in1, PinName in2, PinName frstdby, 00077 PinName sense1, PinName sense2, float vref, float rsense, float rd1, float rd2); 00078 00079 /** 00080 * @brief get current measurement from singleton's power switch 00081 * @retval *hips contain status of the operation 00082 * param[in] Channel number: CHANNEL_1 or CHANNEL_2 00083 */ 00084 float get_current(int ch); 00085 00086 /** 00087 * Power switch. 00088 */ 00089 VPS2535H &vps2535h; 00090 00091 00092 protected: 00093 /** 00094 * Constructor. 00095 */ 00096 XNucleoIPS02A1(PinName in1, PinName in2, PinName frstdby, 00097 PinName sense1, PinName sense2, float vref,float rsense,float rd1,float rd2); 00098 00099 /** 00100 * @brief Initialize the singleton's power switch to default settings 00101 * @retval true if initialization successful, 00102 * @retval false otherwise 00103 */ 00104 bool init(void) { 00105 return (init_VPS2535H()); 00106 } 00107 00108 /** 00109 * @brief Initialize the singleton's power switch 00110 * @retval true if initialization successful, 00111 * @retval false otherwise 00112 */ 00113 bool init_VPS2535H(void); 00114 00115 00116 private: 00117 /** 00118 * Singleton instance of class XNucleoIPS02A1. 00119 */ 00120 static XNucleoIPS02A1 *_instance; 00121 }; 00122 00123 #endif /* __X_NUCLEO_IPS02A1_H */ 00124 00125 00126 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Generated on Sat Jul 16 2022 04:19:39 by
1.7.2

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