my fork
Fork of mbed by
TARGET_NUCLEO_L152RE/stm32l1xx_hal_opamp_ex.h@90:cb3d968589d8, 2014-10-28 (annotated)
- Committer:
- Kojto
- Date:
- Tue Oct 28 16:40:41 2014 +0000
- Revision:
- 90:cb3d968589d8
Release 90 of the mbed library
Changes:
- Freescale KSDK update (v1.0)
- K22 - new target addition
- KL43Z - new target addition
- Nucleo F091RC - new target addition
- Nucleo L152RE - STM32Cube driver
- Nordic - Softdevice v7.1.0
- Nvic files - BSD License
- LPC824 - various HAL fixes
- Nucleo F411RE - CMSIS - IAR files
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Kojto | 90:cb3d968589d8 | 1 | /** |
Kojto | 90:cb3d968589d8 | 2 | ****************************************************************************** |
Kojto | 90:cb3d968589d8 | 3 | * @file stm32l1xx_hal_opamp_ex.h |
Kojto | 90:cb3d968589d8 | 4 | * @author MCD Application Team |
Kojto | 90:cb3d968589d8 | 5 | * @version V1.0.0 |
Kojto | 90:cb3d968589d8 | 6 | * @date 5-September-2014 |
Kojto | 90:cb3d968589d8 | 7 | * @brief Header file of OPAMP HAL Extension module. |
Kojto | 90:cb3d968589d8 | 8 | ****************************************************************************** |
Kojto | 90:cb3d968589d8 | 9 | * @attention |
Kojto | 90:cb3d968589d8 | 10 | * |
Kojto | 90:cb3d968589d8 | 11 | * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> |
Kojto | 90:cb3d968589d8 | 12 | * |
Kojto | 90:cb3d968589d8 | 13 | * Redistribution and use in source and binary forms, with or without modification, |
Kojto | 90:cb3d968589d8 | 14 | * are permitted provided that the following conditions are met: |
Kojto | 90:cb3d968589d8 | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
Kojto | 90:cb3d968589d8 | 16 | * this list of conditions and the following disclaimer. |
Kojto | 90:cb3d968589d8 | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
Kojto | 90:cb3d968589d8 | 18 | * this list of conditions and the following disclaimer in the documentation |
Kojto | 90:cb3d968589d8 | 19 | * and/or other materials provided with the distribution. |
Kojto | 90:cb3d968589d8 | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
Kojto | 90:cb3d968589d8 | 21 | * may be used to endorse or promote products derived from this software |
Kojto | 90:cb3d968589d8 | 22 | * without specific prior written permission. |
Kojto | 90:cb3d968589d8 | 23 | * |
Kojto | 90:cb3d968589d8 | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
Kojto | 90:cb3d968589d8 | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
Kojto | 90:cb3d968589d8 | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
Kojto | 90:cb3d968589d8 | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
Kojto | 90:cb3d968589d8 | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
Kojto | 90:cb3d968589d8 | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
Kojto | 90:cb3d968589d8 | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
Kojto | 90:cb3d968589d8 | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
Kojto | 90:cb3d968589d8 | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
Kojto | 90:cb3d968589d8 | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Kojto | 90:cb3d968589d8 | 34 | * |
Kojto | 90:cb3d968589d8 | 35 | ****************************************************************************** |
Kojto | 90:cb3d968589d8 | 36 | */ |
Kojto | 90:cb3d968589d8 | 37 | |
Kojto | 90:cb3d968589d8 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
Kojto | 90:cb3d968589d8 | 39 | #ifndef __STM32L1xx_HAL_OPAMP_EX_H |
Kojto | 90:cb3d968589d8 | 40 | #define __STM32L1xx_HAL_OPAMP_EX_H |
Kojto | 90:cb3d968589d8 | 41 | |
Kojto | 90:cb3d968589d8 | 42 | #ifdef __cplusplus |
Kojto | 90:cb3d968589d8 | 43 | extern "C" { |
Kojto | 90:cb3d968589d8 | 44 | #endif |
Kojto | 90:cb3d968589d8 | 45 | |
Kojto | 90:cb3d968589d8 | 46 | #if defined (STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined (STM32L151xE) || defined (STM32L152xE) || defined (STM32L162xE) || defined (STM32L162xC) || defined (STM32L152xC) || defined (STM32L151xC) |
Kojto | 90:cb3d968589d8 | 47 | |
Kojto | 90:cb3d968589d8 | 48 | /* Includes ------------------------------------------------------------------*/ |
Kojto | 90:cb3d968589d8 | 49 | #include "stm32l1xx_hal_def.h" |
Kojto | 90:cb3d968589d8 | 50 | |
Kojto | 90:cb3d968589d8 | 51 | /** @addtogroup STM32L1xx_HAL_Driver |
Kojto | 90:cb3d968589d8 | 52 | * @{ |
Kojto | 90:cb3d968589d8 | 53 | */ |
Kojto | 90:cb3d968589d8 | 54 | |
Kojto | 90:cb3d968589d8 | 55 | /** @addtogroup OPAMPEx |
Kojto | 90:cb3d968589d8 | 56 | * @{ |
Kojto | 90:cb3d968589d8 | 57 | */ |
Kojto | 90:cb3d968589d8 | 58 | |
Kojto | 90:cb3d968589d8 | 59 | |
Kojto | 90:cb3d968589d8 | 60 | |
Kojto | 90:cb3d968589d8 | 61 | /* Exported types ------------------------------------------------------------*/ |
Kojto | 90:cb3d968589d8 | 62 | /* Exported constants ---------------------------------------------------------*/ |
Kojto | 90:cb3d968589d8 | 63 | /** @defgroup OPAMPEx_Exported_Constants OPAMPEx Exported Constants |
Kojto | 90:cb3d968589d8 | 64 | * @{ |
Kojto | 90:cb3d968589d8 | 65 | */ |
Kojto | 90:cb3d968589d8 | 66 | #if defined (STM32L151xD) || defined (STM32L152xD) || defined (STM32L162xD) |
Kojto | 90:cb3d968589d8 | 67 | #define OPAMP_CSR_OPAXPD_ALL \ |
Kojto | 90:cb3d968589d8 | 68 | (OPAMP_CSR_OPA1PD | OPAMP_CSR_OPA2PD | OPAMP_CSR_OPA3PD) |
Kojto | 90:cb3d968589d8 | 69 | |
Kojto | 90:cb3d968589d8 | 70 | #define OPAMP_CSR_OPAXCAL_L_ALL \ |
Kojto | 90:cb3d968589d8 | 71 | (OPAMP_CSR_OPA1CAL_L | OPAMP_CSR_OPA2CAL_L | OPAMP_CSR_OPA3CAL_L) |
Kojto | 90:cb3d968589d8 | 72 | |
Kojto | 90:cb3d968589d8 | 73 | #define OPAMP_CSR_OPAXCAL_H_ALL \ |
Kojto | 90:cb3d968589d8 | 74 | (OPAMP_CSR_OPA1CAL_H | OPAMP_CSR_OPA2CAL_H | OPAMP_CSR_OPA3CAL_H) |
Kojto | 90:cb3d968589d8 | 75 | |
Kojto | 90:cb3d968589d8 | 76 | #define OPAMP_CSR_ALL_SWITCHES_ALL_OPAMPS \ |
Kojto | 90:cb3d968589d8 | 77 | (OPAMP_CSR_S3SEL1 | OPAMP_CSR_S4SEL1 | OPAMP_CSR_S5SEL1 | OPAMP_CSR_S6SEL1 | \ |
Kojto | 90:cb3d968589d8 | 78 | OPAMP_CSR_ANAWSEL1 | \ |
Kojto | 90:cb3d968589d8 | 79 | OPAMP_CSR_S3SEL2 | OPAMP_CSR_S4SEL2 | OPAMP_CSR_S5SEL2 | OPAMP_CSR_S6SEL2 | \ |
Kojto | 90:cb3d968589d8 | 80 | OPAMP_CSR_ANAWSEL2 | OPAMP_CSR_S7SEL2 | \ |
Kojto | 90:cb3d968589d8 | 81 | OPAMP_CSR_S3SEL3 | OPAMP_CSR_S4SEL3 | OPAMP_CSR_S5SEL3 | OPAMP_CSR_S6SEL3 | \ |
Kojto | 90:cb3d968589d8 | 82 | OPAMP_CSR_ANAWSEL3 ) |
Kojto | 90:cb3d968589d8 | 83 | #else |
Kojto | 90:cb3d968589d8 | 84 | #define OPAMP_CSR_OPAXPD_ALL \ |
Kojto | 90:cb3d968589d8 | 85 | (OPAMP_CSR_OPA1PD | OPAMP_CSR_OPA2PD) |
Kojto | 90:cb3d968589d8 | 86 | |
Kojto | 90:cb3d968589d8 | 87 | #define OPAMP_CSR_OPAXCAL_L_ALL \ |
Kojto | 90:cb3d968589d8 | 88 | (OPAMP_CSR_OPA1CAL_L | OPAMP_CSR_OPA2CAL_L) |
Kojto | 90:cb3d968589d8 | 89 | |
Kojto | 90:cb3d968589d8 | 90 | #define OPAMP_CSR_OPAXCAL_H_ALL \ |
Kojto | 90:cb3d968589d8 | 91 | (OPAMP_CSR_OPA1CAL_H | OPAMP_CSR_OPA2CAL_H) |
Kojto | 90:cb3d968589d8 | 92 | |
Kojto | 90:cb3d968589d8 | 93 | #define OPAMP_CSR_ALL_SWITCHES_ALL_OPAMPS \ |
Kojto | 90:cb3d968589d8 | 94 | (OPAMP_CSR_S3SEL1 | OPAMP_CSR_S4SEL1 | OPAMP_CSR_S5SEL1 | OPAMP_CSR_S6SEL1 | \ |
Kojto | 90:cb3d968589d8 | 95 | OPAMP_CSR_ANAWSEL1 | \ |
Kojto | 90:cb3d968589d8 | 96 | OPAMP_CSR_S3SEL2 | OPAMP_CSR_S4SEL2 | OPAMP_CSR_S5SEL2 | OPAMP_CSR_S6SEL2 | \ |
Kojto | 90:cb3d968589d8 | 97 | OPAMP_CSR_ANAWSEL2 | OPAMP_CSR_S7SEL2 ) |
Kojto | 90:cb3d968589d8 | 98 | #endif /* STM32L151xD || STM32L152xD || STM32L162xD */ |
Kojto | 90:cb3d968589d8 | 99 | |
Kojto | 90:cb3d968589d8 | 100 | /** |
Kojto | 90:cb3d968589d8 | 101 | * @} |
Kojto | 90:cb3d968589d8 | 102 | */ |
Kojto | 90:cb3d968589d8 | 103 | |
Kojto | 90:cb3d968589d8 | 104 | /* Exported macro ------------------------------------------------------------*/ |
Kojto | 90:cb3d968589d8 | 105 | |
Kojto | 90:cb3d968589d8 | 106 | /** @defgroup OPAMPEx_Exported_Macro OPAMPEx Exported Macro |
Kojto | 90:cb3d968589d8 | 107 | * @{ |
Kojto | 90:cb3d968589d8 | 108 | */ |
Kojto | 90:cb3d968589d8 | 109 | |
Kojto | 90:cb3d968589d8 | 110 | #if defined (STM32L151xD) || defined (STM32L152xD) || defined (STM32L162xD) |
Kojto | 90:cb3d968589d8 | 111 | /** |
Kojto | 90:cb3d968589d8 | 112 | * @brief Enable internal analog switch SW1 to connect OPAMP3 ouput to ADC |
Kojto | 90:cb3d968589d8 | 113 | * switch matrix (ADC channel VCOMP, channel 26) and COMP1 non-inverting input |
Kojto | 90:cb3d968589d8 | 114 | * (OPAMP3 available on STM32L1 devices Cat.4 only). |
Kojto | 90:cb3d968589d8 | 115 | * @retval None |
Kojto | 90:cb3d968589d8 | 116 | */ |
Kojto | 90:cb3d968589d8 | 117 | #define __HAL_OPAMP_OPAMP3OUT_CONNECT_ADC_COMP1() __HAL_RI_SWITCH_COMP1_SW1_CLOSE() |
Kojto | 90:cb3d968589d8 | 118 | |
Kojto | 90:cb3d968589d8 | 119 | /** |
Kojto | 90:cb3d968589d8 | 120 | * @brief Disable internal analog switch SW1 to disconnect OPAMP3 ouput from |
Kojto | 90:cb3d968589d8 | 121 | * ADC switch matrix (ADC channel VCOMP, channel 26) and COMP1 non-inverting |
Kojto | 90:cb3d968589d8 | 122 | * input. |
Kojto | 90:cb3d968589d8 | 123 | * @retval None |
Kojto | 90:cb3d968589d8 | 124 | */ |
Kojto | 90:cb3d968589d8 | 125 | #define __HAL_OPAMP_OPAMP3OUT_DISCONNECT_ADC_COMP1() __HAL_RI_SWITCH_COMP1_SW1_OPEN() |
Kojto | 90:cb3d968589d8 | 126 | #endif /* STM32L151xD || STM32L152xD || STM32L162xD */ |
Kojto | 90:cb3d968589d8 | 127 | |
Kojto | 90:cb3d968589d8 | 128 | /** |
Kojto | 90:cb3d968589d8 | 129 | * @} |
Kojto | 90:cb3d968589d8 | 130 | */ |
Kojto | 90:cb3d968589d8 | 131 | |
Kojto | 90:cb3d968589d8 | 132 | /* Private macro -------------------------------------------------------------*/ |
Kojto | 90:cb3d968589d8 | 133 | |
Kojto | 90:cb3d968589d8 | 134 | /** @defgroup OPAMPEx_Private_Macro OPAMPEx Private Macro |
Kojto | 90:cb3d968589d8 | 135 | * @{ |
Kojto | 90:cb3d968589d8 | 136 | */ |
Kojto | 90:cb3d968589d8 | 137 | |
Kojto | 90:cb3d968589d8 | 138 | #if defined (STM32L151xD) || defined (STM32L152xD) || defined (STM32L162xD) |
Kojto | 90:cb3d968589d8 | 139 | /** |
Kojto | 90:cb3d968589d8 | 140 | * @brief Get the OPAMP instance in decimal number for further |
Kojto | 90:cb3d968589d8 | 141 | * processing needs by HAL OPAMP driver functions. |
Kojto | 90:cb3d968589d8 | 142 | * @param __HANDLE__: OPAMP handle |
Kojto | 90:cb3d968589d8 | 143 | * @retval "0" for OPAMP1, "1" for OPAMP2, "2" for OPAMP3 |
Kojto | 90:cb3d968589d8 | 144 | */ |
Kojto | 90:cb3d968589d8 | 145 | #define __OPAMP_INSTANCE_DECIMAL__(__HANDLE__) \ |
Kojto | 90:cb3d968589d8 | 146 | ( ( ((__HANDLE__)->Instance == OPAMP1) \ |
Kojto | 90:cb3d968589d8 | 147 | )? \ |
Kojto | 90:cb3d968589d8 | 148 | ((uint32_t)0) \ |
Kojto | 90:cb3d968589d8 | 149 | : \ |
Kojto | 90:cb3d968589d8 | 150 | ( ( ((__HANDLE__)->Instance == OPAMP2) \ |
Kojto | 90:cb3d968589d8 | 151 | )? \ |
Kojto | 90:cb3d968589d8 | 152 | ((uint32_t)1) \ |
Kojto | 90:cb3d968589d8 | 153 | : \ |
Kojto | 90:cb3d968589d8 | 154 | ((uint32_t)2) \ |
Kojto | 90:cb3d968589d8 | 155 | ) \ |
Kojto | 90:cb3d968589d8 | 156 | ) |
Kojto | 90:cb3d968589d8 | 157 | #else |
Kojto | 90:cb3d968589d8 | 158 | /** |
Kojto | 90:cb3d968589d8 | 159 | * @brief Get the OPAMP instance in decimal number for further |
Kojto | 90:cb3d968589d8 | 160 | * processing needs by HAL OPAMP driver functions. |
Kojto | 90:cb3d968589d8 | 161 | * @param __HANDLE__: OPAMP handle |
Kojto | 90:cb3d968589d8 | 162 | * @retval "0" for OPAMP1, "1" for OPAMP2 |
Kojto | 90:cb3d968589d8 | 163 | */ |
Kojto | 90:cb3d968589d8 | 164 | #define __OPAMP_INSTANCE_DECIMAL__(__HANDLE__) \ |
Kojto | 90:cb3d968589d8 | 165 | ( ( ((__HANDLE__)->Instance == OPAMP1) \ |
Kojto | 90:cb3d968589d8 | 166 | )? \ |
Kojto | 90:cb3d968589d8 | 167 | ((uint32_t)0) \ |
Kojto | 90:cb3d968589d8 | 168 | : \ |
Kojto | 90:cb3d968589d8 | 169 | ((uint32_t)1) \ |
Kojto | 90:cb3d968589d8 | 170 | ) |
Kojto | 90:cb3d968589d8 | 171 | #endif /* STM32L151xD || STM32L152xD || STM32L162xD */ |
Kojto | 90:cb3d968589d8 | 172 | |
Kojto | 90:cb3d968589d8 | 173 | /** |
Kojto | 90:cb3d968589d8 | 174 | * @} |
Kojto | 90:cb3d968589d8 | 175 | */ |
Kojto | 90:cb3d968589d8 | 176 | |
Kojto | 90:cb3d968589d8 | 177 | /* Exported functions --------------------------------------------------------*/ |
Kojto | 90:cb3d968589d8 | 178 | /** @addtogroup OPAMPEx_Exported_Functions |
Kojto | 90:cb3d968589d8 | 179 | * @{ |
Kojto | 90:cb3d968589d8 | 180 | */ |
Kojto | 90:cb3d968589d8 | 181 | |
Kojto | 90:cb3d968589d8 | 182 | /* I/O operation functions *****************************************************/ |
Kojto | 90:cb3d968589d8 | 183 | /** @defgroup OPAMPEx_Exported_Functions_Group1 Extended IO operation functions |
Kojto | 90:cb3d968589d8 | 184 | * @{ |
Kojto | 90:cb3d968589d8 | 185 | */ |
Kojto | 90:cb3d968589d8 | 186 | #if defined (STM32L151xD) || defined (STM32L152xD) || defined (STM32L162xD) |
Kojto | 90:cb3d968589d8 | 187 | HAL_StatusTypeDef HAL_OPAMPEx_SelfCalibrateAll(OPAMP_HandleTypeDef *hopamp1, OPAMP_HandleTypeDef *hopamp2, OPAMP_HandleTypeDef *hopamp3); |
Kojto | 90:cb3d968589d8 | 188 | #else |
Kojto | 90:cb3d968589d8 | 189 | HAL_StatusTypeDef HAL_OPAMPEx_SelfCalibrateAll(OPAMP_HandleTypeDef *hopamp1, OPAMP_HandleTypeDef *hopamp2); |
Kojto | 90:cb3d968589d8 | 190 | #endif /* STM32L151xD || STM32L152xD || STM32L162xD */ |
Kojto | 90:cb3d968589d8 | 191 | /** |
Kojto | 90:cb3d968589d8 | 192 | * @} |
Kojto | 90:cb3d968589d8 | 193 | */ |
Kojto | 90:cb3d968589d8 | 194 | /* Peripheral Control functions ************************************************/ |
Kojto | 90:cb3d968589d8 | 195 | /** @addtogroup OPAMPEx_Exported_Functions_Group2 |
Kojto | 90:cb3d968589d8 | 196 | * @{ |
Kojto | 90:cb3d968589d8 | 197 | */ |
Kojto | 90:cb3d968589d8 | 198 | HAL_StatusTypeDef HAL_OPAMPEx_Unlock(OPAMP_HandleTypeDef *hopamp); |
Kojto | 90:cb3d968589d8 | 199 | |
Kojto | 90:cb3d968589d8 | 200 | /** |
Kojto | 90:cb3d968589d8 | 201 | * @} |
Kojto | 90:cb3d968589d8 | 202 | */ |
Kojto | 90:cb3d968589d8 | 203 | |
Kojto | 90:cb3d968589d8 | 204 | /** |
Kojto | 90:cb3d968589d8 | 205 | * @} |
Kojto | 90:cb3d968589d8 | 206 | */ |
Kojto | 90:cb3d968589d8 | 207 | |
Kojto | 90:cb3d968589d8 | 208 | /** |
Kojto | 90:cb3d968589d8 | 209 | * @} |
Kojto | 90:cb3d968589d8 | 210 | */ |
Kojto | 90:cb3d968589d8 | 211 | |
Kojto | 90:cb3d968589d8 | 212 | /** |
Kojto | 90:cb3d968589d8 | 213 | * @} |
Kojto | 90:cb3d968589d8 | 214 | */ |
Kojto | 90:cb3d968589d8 | 215 | |
Kojto | 90:cb3d968589d8 | 216 | #endif /* STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L152xE || STM32L162xE || STM32L162xC || STM32L152xC || STM32L151xC */ |
Kojto | 90:cb3d968589d8 | 217 | |
Kojto | 90:cb3d968589d8 | 218 | #ifdef __cplusplus |
Kojto | 90:cb3d968589d8 | 219 | } |
Kojto | 90:cb3d968589d8 | 220 | #endif |
Kojto | 90:cb3d968589d8 | 221 | |
Kojto | 90:cb3d968589d8 | 222 | |
Kojto | 90:cb3d968589d8 | 223 | #endif /* __STM32L1xx_HAL_OPAMP_EX_H */ |
Kojto | 90:cb3d968589d8 | 224 | |
Kojto | 90:cb3d968589d8 | 225 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |