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);
Components/Interfaces/PowerSwitch.h@7:10e489682b80, 2017-05-09 (annotated)
- Committer:
- Davidroid
- Date:
- Tue May 09 09:37:03 2017 +0000
- Revision:
- 7:10e489682b80
- Parent:
- 6:c313d3a5c61a
Aligned to ARM mbed coding style.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
grussian | 0:c175921ca7c3 | 1 | /** |
grussian | 0:c175921ca7c3 | 2 | ****************************************************************************** |
grussian | 0:c175921ca7c3 | 3 | * @file PowerSwitch.h |
grussian | 5:b683e69b181c | 4 | * @author ADG |
grussian | 0:c175921ca7c3 | 5 | * @version V1.0.1 |
grussian | 5:b683e69b181c | 6 | * @date 01-July-2016 |
grussian | 0:c175921ca7c3 | 7 | * @brief This file contains the abstract class describing in general |
grussian | 0:c175921ca7c3 | 8 | * the interfaces of a generic intelligent power switch (IPS) |
grussian | 0:c175921ca7c3 | 9 | ****************************************************************************** |
grussian | 0:c175921ca7c3 | 10 | * @attention |
grussian | 0:c175921ca7c3 | 11 | * |
grussian | 6:c313d3a5c61a | 12 | * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> |
grussian | 0:c175921ca7c3 | 13 | * |
grussian | 0:c175921ca7c3 | 14 | * Redistribution and use in source and binary forms, with or without modification, |
grussian | 0:c175921ca7c3 | 15 | * are permitted provided that the following conditions are met: |
grussian | 0:c175921ca7c3 | 16 | * 1. Redistributions of source code must retain the above copyright notice, |
grussian | 0:c175921ca7c3 | 17 | * this list of conditions and the following disclaimer. |
grussian | 0:c175921ca7c3 | 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
grussian | 0:c175921ca7c3 | 19 | * this list of conditions and the following disclaimer in the documentation |
grussian | 0:c175921ca7c3 | 20 | * and/or other materials provided with the distribution. |
grussian | 0:c175921ca7c3 | 21 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
grussian | 0:c175921ca7c3 | 22 | * may be used to endorse or promote products derived from this software |
grussian | 0:c175921ca7c3 | 23 | * without specific prior written permission. |
grussian | 0:c175921ca7c3 | 24 | * |
grussian | 0:c175921ca7c3 | 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
grussian | 0:c175921ca7c3 | 26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
grussian | 0:c175921ca7c3 | 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
grussian | 0:c175921ca7c3 | 28 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
grussian | 0:c175921ca7c3 | 29 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
grussian | 0:c175921ca7c3 | 30 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
grussian | 0:c175921ca7c3 | 31 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
grussian | 0:c175921ca7c3 | 32 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
grussian | 0:c175921ca7c3 | 33 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
grussian | 0:c175921ca7c3 | 34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
grussian | 0:c175921ca7c3 | 35 | * |
grussian | 0:c175921ca7c3 | 36 | ****************************************************************************** |
grussian | 0:c175921ca7c3 | 37 | */ |
grussian | 3:9edf6b8f3b2f | 38 | |
grussian | 0:c175921ca7c3 | 39 | /* Define to prevent from recursive inclusion --------------------------------*/ |
grussian | 0:c175921ca7c3 | 40 | #ifndef __GENERIC_IPS_CLASS_H |
grussian | 0:c175921ca7c3 | 41 | #define __GENERIC_IPS_CLASS_H |
grussian | 3:9edf6b8f3b2f | 42 | |
grussian | 0:c175921ca7c3 | 43 | /* Includes ------------------------------------------------------------------*/ |
grussian | 0:c175921ca7c3 | 44 | #include <stdint.h> |
Davidroid | 7:10e489682b80 | 45 | #include <Component.h> |
grussian | 3:9edf6b8f3b2f | 46 | |
grussian | 0:c175921ca7c3 | 47 | /* Classes ------------------------------------------------------------------*/ |
grussian | 0:c175921ca7c3 | 48 | /** An abstract class for Generic Power Switch |
grussian | 0:c175921ca7c3 | 49 | */ |
grussian | 2:06d0eb54630a | 50 | class PowerSwitch : public Component |
grussian | 0:c175921ca7c3 | 51 | { |
grussian | 3:9edf6b8f3b2f | 52 | public: |
grussian | 3:9edf6b8f3b2f | 53 | /* Provide Ch current w/o checking status of convertion */ |
Davidroid | 7:10e489682b80 | 54 | virtual float get_current(int Ch) = 0; |
Davidroid | 7:10e489682b80 | 55 | |
Davidroid | 7:10e489682b80 | 56 | /** |
Davidroid | 7:10e489682b80 | 57 | * @brief Destructor. |
Davidroid | 7:10e489682b80 | 58 | */ |
Davidroid | 7:10e489682b80 | 59 | virtual ~PowerSwitch() {}; |
grussian | 0:c175921ca7c3 | 60 | }; |
grussian | 3:9edf6b8f3b2f | 61 | |
grussian | 0:c175921ca7c3 | 62 | #endif /* __GENERIC_IPS_CLASS_H */ |
grussian | 3:9edf6b8f3b2f | 63 | |
grussian | 3:9edf6b8f3b2f | 64 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
grussian | 3:9edf6b8f3b2f | 65 | |
grussian | 3:9edf6b8f3b2f | 66 |