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

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