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/Component.h@8:73df2d2b721c, 2017-07-13 (annotated)
- Committer:
- Davidroid
- Date:
- Thu Jul 13 16:12:04 2017 +0000
- Revision:
- 8:73df2d2b721c
- Parent:
- 7:10e489682b80
Aligning to ARM mbed coding style.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Davidroid | 7:10e489682b80 | 1 | /** |
Davidroid | 7:10e489682b80 | 2 | ****************************************************************************** |
Davidroid | 7:10e489682b80 | 3 | * @file Component.h |
Davidroid | 7:10e489682b80 | 4 | * @author AST |
Davidroid | 7:10e489682b80 | 5 | * @version V1.0.0 |
Davidroid | 7:10e489682b80 | 6 | * @date April 13th, 2015 |
Davidroid | 7:10e489682b80 | 7 | * @brief This file contains the abstract class describing the interface of a |
Davidroid | 7:10e489682b80 | 8 | * generic component. |
Davidroid | 7:10e489682b80 | 9 | ****************************************************************************** |
Davidroid | 7:10e489682b80 | 10 | * @attention |
Davidroid | 7:10e489682b80 | 11 | * |
Davidroid | 7:10e489682b80 | 12 | * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> |
Davidroid | 7:10e489682b80 | 13 | * |
Davidroid | 7:10e489682b80 | 14 | * Redistribution and use in source and binary forms, with or without modification, |
Davidroid | 7:10e489682b80 | 15 | * are permitted provided that the following conditions are met: |
Davidroid | 7:10e489682b80 | 16 | * 1. Redistributions of source code must retain the above copyright notice, |
Davidroid | 7:10e489682b80 | 17 | * this list of conditions and the following disclaimer. |
Davidroid | 7:10e489682b80 | 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
Davidroid | 7:10e489682b80 | 19 | * this list of conditions and the following disclaimer in the documentation |
Davidroid | 7:10e489682b80 | 20 | * and/or other materials provided with the distribution. |
Davidroid | 7:10e489682b80 | 21 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
Davidroid | 7:10e489682b80 | 22 | * may be used to endorse or promote products derived from this software |
Davidroid | 7:10e489682b80 | 23 | * without specific prior written permission. |
Davidroid | 7:10e489682b80 | 24 | * |
Davidroid | 7:10e489682b80 | 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
Davidroid | 7:10e489682b80 | 26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
Davidroid | 7:10e489682b80 | 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
Davidroid | 7:10e489682b80 | 28 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
Davidroid | 7:10e489682b80 | 29 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
Davidroid | 7:10e489682b80 | 30 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
Davidroid | 7:10e489682b80 | 31 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
Davidroid | 7:10e489682b80 | 32 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
Davidroid | 7:10e489682b80 | 33 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
Davidroid | 7:10e489682b80 | 34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Davidroid | 7:10e489682b80 | 35 | * |
Davidroid | 7:10e489682b80 | 36 | ****************************************************************************** |
Davidroid | 7:10e489682b80 | 37 | */ |
Davidroid | 7:10e489682b80 | 38 | |
Davidroid | 7:10e489682b80 | 39 | |
Davidroid | 7:10e489682b80 | 40 | /* Define to prevent recursive inclusion -------------------------------------*/ |
Davidroid | 7:10e489682b80 | 41 | |
Davidroid | 7:10e489682b80 | 42 | #ifndef __COMPONENT_CLASS_H |
Davidroid | 7:10e489682b80 | 43 | #define __COMPONENT_CLASS_H |
Davidroid | 7:10e489682b80 | 44 | |
Davidroid | 7:10e489682b80 | 45 | |
Davidroid | 7:10e489682b80 | 46 | /* Includes ------------------------------------------------------------------*/ |
Davidroid | 7:10e489682b80 | 47 | |
Davidroid | 7:10e489682b80 | 48 | #include <stdint.h> |
Davidroid | 7:10e489682b80 | 49 | |
Davidroid | 7:10e489682b80 | 50 | |
Davidroid | 7:10e489682b80 | 51 | /* Classes ------------------------------------------------------------------*/ |
Davidroid | 7:10e489682b80 | 52 | |
Davidroid | 7:10e489682b80 | 53 | /** |
Davidroid | 7:10e489682b80 | 54 | * An abstract class for Generic components. |
Davidroid | 7:10e489682b80 | 55 | */ |
Davidroid | 7:10e489682b80 | 56 | class Component { |
Davidroid | 7:10e489682b80 | 57 | public: |
Davidroid | 7:10e489682b80 | 58 | |
Davidroid | 7:10e489682b80 | 59 | /** |
Davidroid | 7:10e489682b80 | 60 | * @brief Initializing the component. |
Davidroid | 7:10e489682b80 | 61 | * @param[in] init pointer to device specific initalization structure. |
Davidroid | 7:10e489682b80 | 62 | * @retval "0" in case of success, an error code otherwise. |
Davidroid | 7:10e489682b80 | 63 | */ |
Davidroid | 7:10e489682b80 | 64 | virtual int init(void *init) = 0; |
Davidroid | 7:10e489682b80 | 65 | |
Davidroid | 7:10e489682b80 | 66 | /** |
Davidroid | 7:10e489682b80 | 67 | * @brief Getting the ID of the component. |
Davidroid | 7:10e489682b80 | 68 | * @param[out] id pointer to an allocated variable to store the ID into. |
Davidroid | 7:10e489682b80 | 69 | * @retval "0" in case of success, an error code otherwise. |
Davidroid | 7:10e489682b80 | 70 | */ |
Davidroid | 7:10e489682b80 | 71 | virtual int read_id(uint8_t *id) = 0; |
Davidroid | 7:10e489682b80 | 72 | |
Davidroid | 7:10e489682b80 | 73 | /** |
Davidroid | 7:10e489682b80 | 74 | * @brief Destructor. |
Davidroid | 7:10e489682b80 | 75 | */ |
Davidroid | 7:10e489682b80 | 76 | virtual ~Component() {}; |
Davidroid | 7:10e489682b80 | 77 | }; |
Davidroid | 7:10e489682b80 | 78 | |
Davidroid | 7:10e489682b80 | 79 | #endif /* __COMPONENT_CLASS_H */ |
Davidroid | 7:10e489682b80 | 80 | |
Davidroid | 7:10e489682b80 | 81 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |