mbed library sources
Fork of mbed-src by
targets/cmsis/TARGET_STM/TARGET_NUCLEO_L152RE/stm32l1xx_opamp.c@76:aeb1df146756, 2014-01-27 (annotated)
- Committer:
- mbed_official
- Date:
- Mon Jan 27 14:30:07 2014 +0000
- Revision:
- 76:aeb1df146756
- Child:
- 80:66393a7b209d
Synchronized with git revision a31ec9c5f7bcb5c8a1b2eced103f6a1dfa921abd
Full URL: https://github.com/mbedmicro/mbed/commit/a31ec9c5f7bcb5c8a1b2eced103f6a1dfa921abd/
Add NUCLEO_L152RE
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 76:aeb1df146756 | 1 | /** |
mbed_official | 76:aeb1df146756 | 2 | ****************************************************************************** |
mbed_official | 76:aeb1df146756 | 3 | * @file stm32l1xx_opamp.c |
mbed_official | 76:aeb1df146756 | 4 | * @author MCD Application Team |
mbed_official | 76:aeb1df146756 | 5 | * @version V1.2.0 |
mbed_official | 76:aeb1df146756 | 6 | * @date 22-February-2013 |
mbed_official | 76:aeb1df146756 | 7 | * @brief This file provides firmware functions to manage the following |
mbed_official | 76:aeb1df146756 | 8 | * functionalities of the operational amplifiers (opamp) peripheral: |
mbed_official | 76:aeb1df146756 | 9 | * + Initialization and configuration |
mbed_official | 76:aeb1df146756 | 10 | * + Calibration management |
mbed_official | 76:aeb1df146756 | 11 | * |
mbed_official | 76:aeb1df146756 | 12 | * @verbatim |
mbed_official | 76:aeb1df146756 | 13 | ============================================================================== |
mbed_official | 76:aeb1df146756 | 14 | ##### How to use this driver ##### |
mbed_official | 76:aeb1df146756 | 15 | ============================================================================== |
mbed_official | 76:aeb1df146756 | 16 | [..] The device integrates three independent rail-to-rail operational amplifiers |
mbed_official | 76:aeb1df146756 | 17 | OPAMP1, OPAMP2 and OPAMP3: |
mbed_official | 76:aeb1df146756 | 18 | (+) Internal connections to the ADC. |
mbed_official | 76:aeb1df146756 | 19 | (+) Internal connections to the DAC. |
mbed_official | 76:aeb1df146756 | 20 | (+) Internal connection to COMP1 (only OPAMP3). |
mbed_official | 76:aeb1df146756 | 21 | (+) Internal connection for unity gain (voltage follower) configuration. |
mbed_official | 76:aeb1df146756 | 22 | (+) Calibration capability. |
mbed_official | 76:aeb1df146756 | 23 | (+) Selectable gain-bandwidth (2MHz in normal mode, 500KHz in low power mode). |
mbed_official | 76:aeb1df146756 | 24 | [..] |
mbed_official | 76:aeb1df146756 | 25 | (#) COMP AHB clock must be enabled to get write access |
mbed_official | 76:aeb1df146756 | 26 | to OPAMP registers using |
mbed_official | 76:aeb1df146756 | 27 | (#) RCC_APB1PeriphClockCmd(RCC_APB1Periph_COMP, ENABLE) |
mbed_official | 76:aeb1df146756 | 28 | |
mbed_official | 76:aeb1df146756 | 29 | (#) Configure the corresponding GPIO to OPAMPx INP, OPAMPx_INN (if used) |
mbed_official | 76:aeb1df146756 | 30 | and OPAMPx_OUT in analog mode. |
mbed_official | 76:aeb1df146756 | 31 | |
mbed_official | 76:aeb1df146756 | 32 | (#) Configure (close/open) the OPAMP switches using OPAMP_SwitchCmd() |
mbed_official | 76:aeb1df146756 | 33 | |
mbed_official | 76:aeb1df146756 | 34 | (#) Enable the OPAMP peripheral using OPAMP_Cmd() |
mbed_official | 76:aeb1df146756 | 35 | |
mbed_official | 76:aeb1df146756 | 36 | -@- In order to use OPAMP outputs as ADC inputs, the opamps must be enabled |
mbed_official | 76:aeb1df146756 | 37 | and the ADC must use the OPAMP output channel number: |
mbed_official | 76:aeb1df146756 | 38 | (+@) OPAMP1 output is connected to ADC channel 3. |
mbed_official | 76:aeb1df146756 | 39 | (+@) OPAMP2 output is connected to ADC channel 8. |
mbed_official | 76:aeb1df146756 | 40 | (+@) OPAMP3 output is connected to ADC channel 13 (SW1 switch must be closed). |
mbed_official | 76:aeb1df146756 | 41 | |
mbed_official | 76:aeb1df146756 | 42 | * @endverbatim |
mbed_official | 76:aeb1df146756 | 43 | * |
mbed_official | 76:aeb1df146756 | 44 | ****************************************************************************** |
mbed_official | 76:aeb1df146756 | 45 | * @attention |
mbed_official | 76:aeb1df146756 | 46 | * |
mbed_official | 76:aeb1df146756 | 47 | * <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2> |
mbed_official | 76:aeb1df146756 | 48 | * |
mbed_official | 76:aeb1df146756 | 49 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); |
mbed_official | 76:aeb1df146756 | 50 | * You may not use this file except in compliance with the License. |
mbed_official | 76:aeb1df146756 | 51 | * You may obtain a copy of the License at: |
mbed_official | 76:aeb1df146756 | 52 | * |
mbed_official | 76:aeb1df146756 | 53 | * http://www.st.com/software_license_agreement_liberty_v2 |
mbed_official | 76:aeb1df146756 | 54 | * |
mbed_official | 76:aeb1df146756 | 55 | * Unless required by applicable law or agreed to in writing, software |
mbed_official | 76:aeb1df146756 | 56 | * distributed under the License is distributed on an "AS IS" BASIS, |
mbed_official | 76:aeb1df146756 | 57 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
mbed_official | 76:aeb1df146756 | 58 | * See the License for the specific language governing permissions and |
mbed_official | 76:aeb1df146756 | 59 | * limitations under the License. |
mbed_official | 76:aeb1df146756 | 60 | * |
mbed_official | 76:aeb1df146756 | 61 | ****************************************************************************** |
mbed_official | 76:aeb1df146756 | 62 | */ |
mbed_official | 76:aeb1df146756 | 63 | |
mbed_official | 76:aeb1df146756 | 64 | /* Includes ------------------------------------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 65 | #include "stm32l1xx_opamp.h" |
mbed_official | 76:aeb1df146756 | 66 | |
mbed_official | 76:aeb1df146756 | 67 | |
mbed_official | 76:aeb1df146756 | 68 | /** @addtogroup STM32L1xx_StdPeriph_Driver |
mbed_official | 76:aeb1df146756 | 69 | * @{ |
mbed_official | 76:aeb1df146756 | 70 | */ |
mbed_official | 76:aeb1df146756 | 71 | |
mbed_official | 76:aeb1df146756 | 72 | /** @defgroup OPAMP |
mbed_official | 76:aeb1df146756 | 73 | * @brief OPAMP driver modules |
mbed_official | 76:aeb1df146756 | 74 | * @{ |
mbed_official | 76:aeb1df146756 | 75 | */ |
mbed_official | 76:aeb1df146756 | 76 | |
mbed_official | 76:aeb1df146756 | 77 | /* Private typedef -----------------------------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 78 | /* Private define ------------------------------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 79 | /* Private macro -------------------------------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 80 | /* Private variables ---------------------------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 81 | /* Private function prototypes -----------------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 82 | /* Private functions ---------------------------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 83 | |
mbed_official | 76:aeb1df146756 | 84 | /** @defgroup OPAMP_Private_Functions |
mbed_official | 76:aeb1df146756 | 85 | * @{ |
mbed_official | 76:aeb1df146756 | 86 | */ |
mbed_official | 76:aeb1df146756 | 87 | |
mbed_official | 76:aeb1df146756 | 88 | /** @defgroup OPAMP_Group1 Initialization and configuration |
mbed_official | 76:aeb1df146756 | 89 | * @brief Initialization and configuration |
mbed_official | 76:aeb1df146756 | 90 | * |
mbed_official | 76:aeb1df146756 | 91 | @verbatim |
mbed_official | 76:aeb1df146756 | 92 | =============================================================================== |
mbed_official | 76:aeb1df146756 | 93 | ##### Initialization and configuration ##### |
mbed_official | 76:aeb1df146756 | 94 | =============================================================================== |
mbed_official | 76:aeb1df146756 | 95 | |
mbed_official | 76:aeb1df146756 | 96 | @endverbatim |
mbed_official | 76:aeb1df146756 | 97 | * @{ |
mbed_official | 76:aeb1df146756 | 98 | */ |
mbed_official | 76:aeb1df146756 | 99 | |
mbed_official | 76:aeb1df146756 | 100 | /** |
mbed_official | 76:aeb1df146756 | 101 | * @brief Deinitialize the OPAMPs register to its default reset value. |
mbed_official | 76:aeb1df146756 | 102 | * @note At startup, OTR and LPOTR registers are set to factory programmed values. |
mbed_official | 76:aeb1df146756 | 103 | * @param None. |
mbed_official | 76:aeb1df146756 | 104 | * @retval None. |
mbed_official | 76:aeb1df146756 | 105 | */ |
mbed_official | 76:aeb1df146756 | 106 | void OPAMP_DeInit(void) |
mbed_official | 76:aeb1df146756 | 107 | { |
mbed_official | 76:aeb1df146756 | 108 | /*!< Set OPAMP_CSR register to reset value */ |
mbed_official | 76:aeb1df146756 | 109 | OPAMP->CSR = 0x00010101; |
mbed_official | 76:aeb1df146756 | 110 | /*!< Set OPAMP_OTR register to reset value */ |
mbed_official | 76:aeb1df146756 | 111 | OPAMP->OTR = (uint32_t)(* (uint32_t*)FLASH_R_BASE + 0x00000038); |
mbed_official | 76:aeb1df146756 | 112 | /*!< Set OPAMP_LPOTR register to reset value */ |
mbed_official | 76:aeb1df146756 | 113 | OPAMP->LPOTR = (uint32_t)(* (uint32_t*)FLASH_R_BASE + 0x0000003C); |
mbed_official | 76:aeb1df146756 | 114 | } |
mbed_official | 76:aeb1df146756 | 115 | |
mbed_official | 76:aeb1df146756 | 116 | /** |
mbed_official | 76:aeb1df146756 | 117 | * @brief Close or Open the OPAMP switches. |
mbed_official | 76:aeb1df146756 | 118 | * @param OPAMP_OPAMPxSwitchy: selects the OPAMPx switch. |
mbed_official | 76:aeb1df146756 | 119 | * This parameter can be any combinations of the following values: |
mbed_official | 76:aeb1df146756 | 120 | * @arg OPAMP_OPAMP1Switch3: used to connect internally OPAMP1 output to |
mbed_official | 76:aeb1df146756 | 121 | * OPAMP1 negative input (internal follower) |
mbed_official | 76:aeb1df146756 | 122 | * @arg OPAMP_OPAMP1Switch4: used to connect PA2 to OPAMP1 negative input |
mbed_official | 76:aeb1df146756 | 123 | * @arg OPAMP_OPAMP1Switch5: used to connect PA1 to OPAMP1 positive input |
mbed_official | 76:aeb1df146756 | 124 | * @arg OPAMP_OPAMP1Switch6: used to connect DAC_OUT1 to OPAMP1 positive input |
mbed_official | 76:aeb1df146756 | 125 | * @arg OPAMP_OPAMP1SwitchANA: used to meet 1 nA input leakage |
mbed_official | 76:aeb1df146756 | 126 | * @arg OPAMP_OPAMP2Switch3: used to connect internally OPAMP2 output to |
mbed_official | 76:aeb1df146756 | 127 | * OPAMP2 negative input (internal follower) |
mbed_official | 76:aeb1df146756 | 128 | * @arg OPAMP_OPAMP2Switch4: used to connect PA7 to OPAMP2 negative input |
mbed_official | 76:aeb1df146756 | 129 | * @arg OPAMP_OPAMP2Switch5: used to connect PA6 to OPAMP2 positive input |
mbed_official | 76:aeb1df146756 | 130 | * @arg OPAMP_OPAMP2Switch6: used to connect DAC_OUT1 to OPAMP2 positive input |
mbed_official | 76:aeb1df146756 | 131 | * @arg OPAMP_OPAMP2Switch7: used to connect DAC_OUT2 to OPAMP2 positive input |
mbed_official | 76:aeb1df146756 | 132 | * @arg OPAMP_OPAMP2SwitchANA: used to meet 1 nA input leakage |
mbed_official | 76:aeb1df146756 | 133 | * @arg OPAMP_OPAMP3Switch3: used to connect internally OPAMP3 output to |
mbed_official | 76:aeb1df146756 | 134 | * OPAMP3 negative input (internal follower) |
mbed_official | 76:aeb1df146756 | 135 | * @arg OPAMP_OPAMP3Switch4: used to connect PC2 to OPAMP3 negative input |
mbed_official | 76:aeb1df146756 | 136 | * @arg OPAMP_OPAMP3Switch5: used to connect PC1 to OPAMP3 positive input |
mbed_official | 76:aeb1df146756 | 137 | * @arg OPAMP_OPAMP3Switch6: used to connect DAC_OUT1 to OPAMP3 positive input |
mbed_official | 76:aeb1df146756 | 138 | * @arg OPAMP_OPAMP3SwitchANA: used to meet 1 nA input leakage on negative input |
mbed_official | 76:aeb1df146756 | 139 | * |
mbed_official | 76:aeb1df146756 | 140 | * @param NewState: New state of the OPAMP switch. |
mbed_official | 76:aeb1df146756 | 141 | * This parameter can be: |
mbed_official | 76:aeb1df146756 | 142 | * ENABLE to close the OPAMP switch |
mbed_official | 76:aeb1df146756 | 143 | * or DISABLE to open the OPAMP switch |
mbed_official | 76:aeb1df146756 | 144 | * @note OPAMP_OPAMP2Switch6 and OPAMP_OPAMP2Switch7 mustn't be closed together. |
mbed_official | 76:aeb1df146756 | 145 | * @retval None |
mbed_official | 76:aeb1df146756 | 146 | */ |
mbed_official | 76:aeb1df146756 | 147 | void OPAMP_SwitchCmd(uint32_t OPAMP_OPAMPxSwitchy, FunctionalState NewState) |
mbed_official | 76:aeb1df146756 | 148 | { |
mbed_official | 76:aeb1df146756 | 149 | /* Check the parameter */ |
mbed_official | 76:aeb1df146756 | 150 | assert_param(IS_OPAMP_SWITCH(OPAMP_OPAMPxSwitchy)); |
mbed_official | 76:aeb1df146756 | 151 | assert_param(IS_FUNCTIONAL_STATE(NewState)); |
mbed_official | 76:aeb1df146756 | 152 | |
mbed_official | 76:aeb1df146756 | 153 | if (NewState != DISABLE) |
mbed_official | 76:aeb1df146756 | 154 | { |
mbed_official | 76:aeb1df146756 | 155 | /* Close the selected switches */ |
mbed_official | 76:aeb1df146756 | 156 | OPAMP->CSR |= (uint32_t) OPAMP_OPAMPxSwitchy; |
mbed_official | 76:aeb1df146756 | 157 | } |
mbed_official | 76:aeb1df146756 | 158 | else |
mbed_official | 76:aeb1df146756 | 159 | { |
mbed_official | 76:aeb1df146756 | 160 | /* Open the selected switches */ |
mbed_official | 76:aeb1df146756 | 161 | OPAMP->CSR &= (~(uint32_t)OPAMP_OPAMPxSwitchy); |
mbed_official | 76:aeb1df146756 | 162 | } |
mbed_official | 76:aeb1df146756 | 163 | } |
mbed_official | 76:aeb1df146756 | 164 | |
mbed_official | 76:aeb1df146756 | 165 | /** |
mbed_official | 76:aeb1df146756 | 166 | * @brief Enable or disable the OPAMP peripheral. |
mbed_official | 76:aeb1df146756 | 167 | * @param OPAMP_Selection: the selected OPAMP. |
mbed_official | 76:aeb1df146756 | 168 | * This parameter can be one of the following values: |
mbed_official | 76:aeb1df146756 | 169 | * @arg OPAMP_Selection_OPAMP1: OPAMP1 is selected |
mbed_official | 76:aeb1df146756 | 170 | * @arg OPAMP_Selection_OPAMP2: OPAMP2 is selected |
mbed_official | 76:aeb1df146756 | 171 | * @arg OPAMP_Selection_OPAMP3: OPAMP3 is selected |
mbed_official | 76:aeb1df146756 | 172 | * @param NewState: new state of the selected OPAMP peripheral. |
mbed_official | 76:aeb1df146756 | 173 | * This parameter can be: ENABLE or DISABLE. |
mbed_official | 76:aeb1df146756 | 174 | * @retval None |
mbed_official | 76:aeb1df146756 | 175 | */ |
mbed_official | 76:aeb1df146756 | 176 | void OPAMP_Cmd(uint32_t OPAMP_Selection, FunctionalState NewState) |
mbed_official | 76:aeb1df146756 | 177 | { |
mbed_official | 76:aeb1df146756 | 178 | /* Check the parameter */ |
mbed_official | 76:aeb1df146756 | 179 | assert_param(IS_OPAMP_ALL_PERIPH(OPAMP_Selection)); |
mbed_official | 76:aeb1df146756 | 180 | assert_param(IS_FUNCTIONAL_STATE(NewState)); |
mbed_official | 76:aeb1df146756 | 181 | |
mbed_official | 76:aeb1df146756 | 182 | if (NewState != DISABLE) |
mbed_official | 76:aeb1df146756 | 183 | { |
mbed_official | 76:aeb1df146756 | 184 | /* Enable the selected OPAMP */ |
mbed_official | 76:aeb1df146756 | 185 | OPAMP->CSR &= (~(uint32_t) OPAMP_Selection); |
mbed_official | 76:aeb1df146756 | 186 | } |
mbed_official | 76:aeb1df146756 | 187 | else |
mbed_official | 76:aeb1df146756 | 188 | { |
mbed_official | 76:aeb1df146756 | 189 | /* Disable the selected OPAMP */ |
mbed_official | 76:aeb1df146756 | 190 | OPAMP->CSR |= (uint32_t) OPAMP_Selection; |
mbed_official | 76:aeb1df146756 | 191 | } |
mbed_official | 76:aeb1df146756 | 192 | } |
mbed_official | 76:aeb1df146756 | 193 | |
mbed_official | 76:aeb1df146756 | 194 | /** |
mbed_official | 76:aeb1df146756 | 195 | * @brief Enable or disable the low power mode for OPAMP peripheral. |
mbed_official | 76:aeb1df146756 | 196 | * @param OPAMP_Selection: the selected OPAMP. |
mbed_official | 76:aeb1df146756 | 197 | * This parameter can be one of the following values: |
mbed_official | 76:aeb1df146756 | 198 | * @arg OPAMP_Selection_OPAMP1: OPAMP1 selected |
mbed_official | 76:aeb1df146756 | 199 | * @arg OPAMP_Selection_OPAMP2: OPAMP2 selected |
mbed_official | 76:aeb1df146756 | 200 | * @arg OPAMP_Selection_OPAMP3: OPAMP3 selected |
mbed_official | 76:aeb1df146756 | 201 | * @param NewState: new low power state of the selected OPAMP peripheral. |
mbed_official | 76:aeb1df146756 | 202 | * This parameter can be: ENABLE or DISABLE. |
mbed_official | 76:aeb1df146756 | 203 | * @retval None |
mbed_official | 76:aeb1df146756 | 204 | */ |
mbed_official | 76:aeb1df146756 | 205 | void OPAMP_LowPowerCmd(uint32_t OPAMP_Selection, FunctionalState NewState) |
mbed_official | 76:aeb1df146756 | 206 | { |
mbed_official | 76:aeb1df146756 | 207 | /* Check the parameter */ |
mbed_official | 76:aeb1df146756 | 208 | assert_param(IS_OPAMP_ALL_PERIPH(OPAMP_Selection)); |
mbed_official | 76:aeb1df146756 | 209 | assert_param(IS_FUNCTIONAL_STATE(NewState)); |
mbed_official | 76:aeb1df146756 | 210 | |
mbed_official | 76:aeb1df146756 | 211 | if (NewState != DISABLE) |
mbed_official | 76:aeb1df146756 | 212 | { |
mbed_official | 76:aeb1df146756 | 213 | /* Set the selected OPAMP in low power mode */ |
mbed_official | 76:aeb1df146756 | 214 | OPAMP->CSR |= (uint32_t) (OPAMP_Selection << 7); |
mbed_official | 76:aeb1df146756 | 215 | } |
mbed_official | 76:aeb1df146756 | 216 | else |
mbed_official | 76:aeb1df146756 | 217 | { |
mbed_official | 76:aeb1df146756 | 218 | /* Disable the low power mode for the selected OPAMP */ |
mbed_official | 76:aeb1df146756 | 219 | OPAMP->CSR &= (~(uint32_t) (OPAMP_Selection << 7)); |
mbed_official | 76:aeb1df146756 | 220 | } |
mbed_official | 76:aeb1df146756 | 221 | } |
mbed_official | 76:aeb1df146756 | 222 | |
mbed_official | 76:aeb1df146756 | 223 | /** |
mbed_official | 76:aeb1df146756 | 224 | * @brief Select the OPAMP power range. |
mbed_official | 76:aeb1df146756 | 225 | * @note The OPAMP power range selection must be performed while OPAMPs are powered down. |
mbed_official | 76:aeb1df146756 | 226 | * @param OPAMP_Range: the selected OPAMP power range. |
mbed_official | 76:aeb1df146756 | 227 | * This parameter can be one of the following values: |
mbed_official | 76:aeb1df146756 | 228 | * @arg OPAMP_PowerRange_Low: Low power range is selected (VDDA is lower than 2.4V). |
mbed_official | 76:aeb1df146756 | 229 | * @arg OPAMP_PowerRange_High: High power range is selected (VDDA is higher than 2.4V). |
mbed_official | 76:aeb1df146756 | 230 | * @retval None |
mbed_official | 76:aeb1df146756 | 231 | */ |
mbed_official | 76:aeb1df146756 | 232 | void OPAMP_PowerRangeSelect(uint32_t OPAMP_PowerRange) |
mbed_official | 76:aeb1df146756 | 233 | { |
mbed_official | 76:aeb1df146756 | 234 | /* Check the parameter */ |
mbed_official | 76:aeb1df146756 | 235 | assert_param(IS_OPAMP_RANGE(OPAMP_PowerRange)); |
mbed_official | 76:aeb1df146756 | 236 | |
mbed_official | 76:aeb1df146756 | 237 | /* Reset the OPAMP range bit */ |
mbed_official | 76:aeb1df146756 | 238 | OPAMP->CSR &= (~(uint32_t) (OPAMP_CSR_AOP_RANGE)); |
mbed_official | 76:aeb1df146756 | 239 | |
mbed_official | 76:aeb1df146756 | 240 | /* Select the OPAMP power range */ |
mbed_official | 76:aeb1df146756 | 241 | OPAMP->CSR |= OPAMP_PowerRange; |
mbed_official | 76:aeb1df146756 | 242 | } |
mbed_official | 76:aeb1df146756 | 243 | |
mbed_official | 76:aeb1df146756 | 244 | /** |
mbed_official | 76:aeb1df146756 | 245 | * @} |
mbed_official | 76:aeb1df146756 | 246 | */ |
mbed_official | 76:aeb1df146756 | 247 | |
mbed_official | 76:aeb1df146756 | 248 | /** @defgroup OPAMP_Group2 Calibration functions |
mbed_official | 76:aeb1df146756 | 249 | * @brief Calibration functions |
mbed_official | 76:aeb1df146756 | 250 | * |
mbed_official | 76:aeb1df146756 | 251 | @verbatim |
mbed_official | 76:aeb1df146756 | 252 | =============================================================================== |
mbed_official | 76:aeb1df146756 | 253 | ##### Calibration functions ##### |
mbed_official | 76:aeb1df146756 | 254 | =============================================================================== |
mbed_official | 76:aeb1df146756 | 255 | |
mbed_official | 76:aeb1df146756 | 256 | @endverbatim |
mbed_official | 76:aeb1df146756 | 257 | * @{ |
mbed_official | 76:aeb1df146756 | 258 | */ |
mbed_official | 76:aeb1df146756 | 259 | |
mbed_official | 76:aeb1df146756 | 260 | /** |
mbed_official | 76:aeb1df146756 | 261 | * @brief Select the trimming mode. |
mbed_official | 76:aeb1df146756 | 262 | * @param OffsetTrimming: the selected offset trimming mode. |
mbed_official | 76:aeb1df146756 | 263 | * This parameter can be one of the following values: |
mbed_official | 76:aeb1df146756 | 264 | * @arg OffsetTrimming_Factory: factory trimming values are used for offset |
mbed_official | 76:aeb1df146756 | 265 | * calibration. |
mbed_official | 76:aeb1df146756 | 266 | * @arg OffsetTrimming_User: user trimming values are used for offset |
mbed_official | 76:aeb1df146756 | 267 | * calibration. |
mbed_official | 76:aeb1df146756 | 268 | * @note When OffsetTrimming_User is selected, use OPAMP_OffsetTrimConfig() |
mbed_official | 76:aeb1df146756 | 269 | * function or OPAMP_OffsetTrimLowPowerConfig() function to adjust |
mbed_official | 76:aeb1df146756 | 270 | * trimming value. |
mbed_official | 76:aeb1df146756 | 271 | * @retval None |
mbed_official | 76:aeb1df146756 | 272 | */ |
mbed_official | 76:aeb1df146756 | 273 | void OPAMP_OffsetTrimmingModeSelect(uint32_t OPAMP_Trimming) |
mbed_official | 76:aeb1df146756 | 274 | { |
mbed_official | 76:aeb1df146756 | 275 | /* Check the parameter */ |
mbed_official | 76:aeb1df146756 | 276 | assert_param(IS_OPAMP_TRIMMING(OPAMP_Trimming)); |
mbed_official | 76:aeb1df146756 | 277 | |
mbed_official | 76:aeb1df146756 | 278 | /* Reset the OPAMP_OTR range bit */ |
mbed_official | 76:aeb1df146756 | 279 | OPAMP->CSR &= (~(uint32_t) (OPAMP_OTR_OT_USER)); |
mbed_official | 76:aeb1df146756 | 280 | |
mbed_official | 76:aeb1df146756 | 281 | /* Select the OPAMP offset trimming */ |
mbed_official | 76:aeb1df146756 | 282 | OPAMP->CSR |= OPAMP_Trimming; |
mbed_official | 76:aeb1df146756 | 283 | |
mbed_official | 76:aeb1df146756 | 284 | } |
mbed_official | 76:aeb1df146756 | 285 | |
mbed_official | 76:aeb1df146756 | 286 | /** |
mbed_official | 76:aeb1df146756 | 287 | * @brief Configure the trimming value of OPAMPs in normal mode. |
mbed_official | 76:aeb1df146756 | 288 | * @param OPAMP_Selection: the selected OPAMP. |
mbed_official | 76:aeb1df146756 | 289 | * This parameter can be one of the following values: |
mbed_official | 76:aeb1df146756 | 290 | * @arg OPAMP_Selection_OPAMP1: OPAMP1 is selected to configure the trimming value. |
mbed_official | 76:aeb1df146756 | 291 | * @arg OPAMP_Selection_OPAMP2: OPAMP2 is selected to configure the trimming value. |
mbed_official | 76:aeb1df146756 | 292 | * @arg OPAMP_Selection_OPAMP3: OPAMP3 is selected to configure the trimming value. |
mbed_official | 76:aeb1df146756 | 293 | * @param OPAMP_Input: the selected OPAMP input. |
mbed_official | 76:aeb1df146756 | 294 | * This parameter can be one of the following values: |
mbed_official | 76:aeb1df146756 | 295 | * @arg OPAMP_Input_NMOS: NMOS input is selected to configure the trimming value. |
mbed_official | 76:aeb1df146756 | 296 | * @arg OPAMP_Input_PMOS: PMOS input is selected to configure the trimming value. |
mbed_official | 76:aeb1df146756 | 297 | * @param OPAMP_TrimValue: the trimming value. This parameter can be any value lower |
mbed_official | 76:aeb1df146756 | 298 | * or equal to 0x0000001F. |
mbed_official | 76:aeb1df146756 | 299 | * @retval None |
mbed_official | 76:aeb1df146756 | 300 | */ |
mbed_official | 76:aeb1df146756 | 301 | void OPAMP_OffsetTrimConfig(uint32_t OPAMP_Selection, uint32_t OPAMP_Input, uint32_t OPAMP_TrimValue) |
mbed_official | 76:aeb1df146756 | 302 | { |
mbed_official | 76:aeb1df146756 | 303 | uint32_t tmpreg = 0; |
mbed_official | 76:aeb1df146756 | 304 | |
mbed_official | 76:aeb1df146756 | 305 | /* Check the parameter */ |
mbed_official | 76:aeb1df146756 | 306 | assert_param(IS_OPAMP_ALL_PERIPH(OPAMP_Selection)); |
mbed_official | 76:aeb1df146756 | 307 | assert_param(IS_OPAMP_INPUT(OPAMP_Input)); |
mbed_official | 76:aeb1df146756 | 308 | assert_param(IS_OPAMP_TRIMMINGVALUE(OPAMP_TrimValue)); |
mbed_official | 76:aeb1df146756 | 309 | |
mbed_official | 76:aeb1df146756 | 310 | /* Get the OPAMP_OTR value */ |
mbed_official | 76:aeb1df146756 | 311 | tmpreg = OPAMP->OTR; |
mbed_official | 76:aeb1df146756 | 312 | |
mbed_official | 76:aeb1df146756 | 313 | if(OPAMP_Selection == OPAMP_Selection_OPAMP1) |
mbed_official | 76:aeb1df146756 | 314 | { |
mbed_official | 76:aeb1df146756 | 315 | /* Reset the OPAMP inputs selection */ |
mbed_official | 76:aeb1df146756 | 316 | tmpreg &= (uint32_t)~(OPAMP_CSR_OPA1CAL_L | OPAMP_CSR_OPA1CAL_H); |
mbed_official | 76:aeb1df146756 | 317 | /* Select the OPAMP input */ |
mbed_official | 76:aeb1df146756 | 318 | tmpreg |= OPAMP_Input; |
mbed_official | 76:aeb1df146756 | 319 | |
mbed_official | 76:aeb1df146756 | 320 | if(OPAMP_Input == OPAMP_Input_PMOS) |
mbed_official | 76:aeb1df146756 | 321 | { |
mbed_official | 76:aeb1df146756 | 322 | /* Reset the trimming value corresponding to OPAMP1 PMOS input */ |
mbed_official | 76:aeb1df146756 | 323 | tmpreg &= (0xFFFFFFE0); |
mbed_official | 76:aeb1df146756 | 324 | /* Set the new trimming value corresponding to OPAMP1 PMOS input */ |
mbed_official | 76:aeb1df146756 | 325 | tmpreg |= (OPAMP_TrimValue); |
mbed_official | 76:aeb1df146756 | 326 | } |
mbed_official | 76:aeb1df146756 | 327 | else |
mbed_official | 76:aeb1df146756 | 328 | { |
mbed_official | 76:aeb1df146756 | 329 | /* Reset the trimming value corresponding to OPAMP1 NMOS input */ |
mbed_official | 76:aeb1df146756 | 330 | tmpreg &= (0xFFFFFC1F); |
mbed_official | 76:aeb1df146756 | 331 | /* Set the new trimming value corresponding to OPAMP1 NMOS input */ |
mbed_official | 76:aeb1df146756 | 332 | tmpreg |= (OPAMP_TrimValue<<5); |
mbed_official | 76:aeb1df146756 | 333 | } |
mbed_official | 76:aeb1df146756 | 334 | } |
mbed_official | 76:aeb1df146756 | 335 | else if (OPAMP_Selection == OPAMP_Selection_OPAMP2) |
mbed_official | 76:aeb1df146756 | 336 | { |
mbed_official | 76:aeb1df146756 | 337 | /* Reset the OPAMP inputs selection */ |
mbed_official | 76:aeb1df146756 | 338 | tmpreg &= (uint32_t)~(OPAMP_CSR_OPA2CAL_L | OPAMP_CSR_OPA2CAL_H); |
mbed_official | 76:aeb1df146756 | 339 | /* Select the OPAMP input */ |
mbed_official | 76:aeb1df146756 | 340 | tmpreg |= (uint32_t)(OPAMP_Input<<8); |
mbed_official | 76:aeb1df146756 | 341 | |
mbed_official | 76:aeb1df146756 | 342 | if(OPAMP_Input == OPAMP_Input_PMOS) |
mbed_official | 76:aeb1df146756 | 343 | { |
mbed_official | 76:aeb1df146756 | 344 | /* Reset the trimming value corresponding to OPAMP2 PMOS input */ |
mbed_official | 76:aeb1df146756 | 345 | tmpreg &= (0xFFFF83FF); |
mbed_official | 76:aeb1df146756 | 346 | /* Set the new trimming value corresponding to OPAMP2 PMOS input */ |
mbed_official | 76:aeb1df146756 | 347 | tmpreg |= (OPAMP_TrimValue<<10); |
mbed_official | 76:aeb1df146756 | 348 | } |
mbed_official | 76:aeb1df146756 | 349 | else |
mbed_official | 76:aeb1df146756 | 350 | { |
mbed_official | 76:aeb1df146756 | 351 | /* Reset the trimming value corresponding to OPAMP2 NMOS input */ |
mbed_official | 76:aeb1df146756 | 352 | tmpreg &= (0xFFF07FFF); |
mbed_official | 76:aeb1df146756 | 353 | /* Set the new trimming value corresponding to OPAMP2 NMOS input */ |
mbed_official | 76:aeb1df146756 | 354 | tmpreg |= (OPAMP_TrimValue<<15); |
mbed_official | 76:aeb1df146756 | 355 | } |
mbed_official | 76:aeb1df146756 | 356 | } |
mbed_official | 76:aeb1df146756 | 357 | else |
mbed_official | 76:aeb1df146756 | 358 | { |
mbed_official | 76:aeb1df146756 | 359 | /* Reset the OPAMP inputs selection */ |
mbed_official | 76:aeb1df146756 | 360 | tmpreg &= (uint32_t)~(OPAMP_CSR_OPA3CAL_L | OPAMP_CSR_OPA3CAL_H); |
mbed_official | 76:aeb1df146756 | 361 | /* Select the OPAMP input */ |
mbed_official | 76:aeb1df146756 | 362 | tmpreg |= (uint32_t)(OPAMP_Input<<16); |
mbed_official | 76:aeb1df146756 | 363 | |
mbed_official | 76:aeb1df146756 | 364 | if(OPAMP_Input == OPAMP_Input_PMOS) |
mbed_official | 76:aeb1df146756 | 365 | { |
mbed_official | 76:aeb1df146756 | 366 | /* Reset the trimming value corresponding to OPAMP3 PMOS input */ |
mbed_official | 76:aeb1df146756 | 367 | tmpreg &= (0xFE0FFFFF); |
mbed_official | 76:aeb1df146756 | 368 | /* Set the new trimming value corresponding to OPAMP3 PMOS input */ |
mbed_official | 76:aeb1df146756 | 369 | tmpreg |= (OPAMP_TrimValue<<20); |
mbed_official | 76:aeb1df146756 | 370 | } |
mbed_official | 76:aeb1df146756 | 371 | else |
mbed_official | 76:aeb1df146756 | 372 | { |
mbed_official | 76:aeb1df146756 | 373 | /* Reset the trimming value corresponding to OPAMP3 NMOS input */ |
mbed_official | 76:aeb1df146756 | 374 | tmpreg &= (0xC1FFFFFF); |
mbed_official | 76:aeb1df146756 | 375 | /* Set the new trimming value corresponding to OPAMP3 NMOS input */ |
mbed_official | 76:aeb1df146756 | 376 | tmpreg |= (OPAMP_TrimValue<<25); |
mbed_official | 76:aeb1df146756 | 377 | } |
mbed_official | 76:aeb1df146756 | 378 | } |
mbed_official | 76:aeb1df146756 | 379 | |
mbed_official | 76:aeb1df146756 | 380 | /* Set the OPAMP_OTR register */ |
mbed_official | 76:aeb1df146756 | 381 | OPAMP->OTR = tmpreg; |
mbed_official | 76:aeb1df146756 | 382 | } |
mbed_official | 76:aeb1df146756 | 383 | |
mbed_official | 76:aeb1df146756 | 384 | /** |
mbed_official | 76:aeb1df146756 | 385 | * @brief Configure the trimming value of OPAMPs in low power mode. |
mbed_official | 76:aeb1df146756 | 386 | * @param OPAMP_Selection: the selected OPAMP. |
mbed_official | 76:aeb1df146756 | 387 | * This parameter can be one of the following values: |
mbed_official | 76:aeb1df146756 | 388 | * @arg OPAMP_Selection_OPAMP1: OPAMP1 is selected to configure the trimming value. |
mbed_official | 76:aeb1df146756 | 389 | * @arg OPAMP_Selection_OPAMP2: OPAMP2 is selected to configure the trimming value. |
mbed_official | 76:aeb1df146756 | 390 | * @arg OPAMP_Selection_OPAMP3: OPAMP3 is selected to configure the trimming value. |
mbed_official | 76:aeb1df146756 | 391 | * @param OPAMP_Input: the selected OPAMP input. |
mbed_official | 76:aeb1df146756 | 392 | * This parameter can be one of the following values: |
mbed_official | 76:aeb1df146756 | 393 | * @arg OPAMP_Input_NMOS: NMOS input is selected to configure the trimming value. |
mbed_official | 76:aeb1df146756 | 394 | * @arg OPAMP_Input_PMOS: PMOS input is selected to configure the trimming value. |
mbed_official | 76:aeb1df146756 | 395 | * @param OPAMP_TrimValue: the trimming value. |
mbed_official | 76:aeb1df146756 | 396 | * This parameter can be any value lower or equal to 0x0000001F. |
mbed_official | 76:aeb1df146756 | 397 | * @retval None |
mbed_official | 76:aeb1df146756 | 398 | */ |
mbed_official | 76:aeb1df146756 | 399 | void OPAMP_OffsetTrimLowPowerConfig(uint32_t OPAMP_Selection, uint32_t OPAMP_Input, uint32_t OPAMP_TrimValue) |
mbed_official | 76:aeb1df146756 | 400 | { |
mbed_official | 76:aeb1df146756 | 401 | uint32_t tmpreg = 0; |
mbed_official | 76:aeb1df146756 | 402 | |
mbed_official | 76:aeb1df146756 | 403 | /* Check the parameter */ |
mbed_official | 76:aeb1df146756 | 404 | assert_param(IS_OPAMP_ALL_PERIPH(OPAMP_Selection)); |
mbed_official | 76:aeb1df146756 | 405 | assert_param(IS_OPAMP_INPUT(OPAMP_Input)); |
mbed_official | 76:aeb1df146756 | 406 | assert_param(IS_OPAMP_TRIMMINGVALUE(OPAMP_TrimValue)); |
mbed_official | 76:aeb1df146756 | 407 | |
mbed_official | 76:aeb1df146756 | 408 | /* Get the OPAMP_LPOTR value */ |
mbed_official | 76:aeb1df146756 | 409 | tmpreg = OPAMP->LPOTR; |
mbed_official | 76:aeb1df146756 | 410 | |
mbed_official | 76:aeb1df146756 | 411 | if(OPAMP_Selection == OPAMP_Selection_OPAMP1) |
mbed_official | 76:aeb1df146756 | 412 | { |
mbed_official | 76:aeb1df146756 | 413 | /* Reset the OPAMP inputs selection */ |
mbed_official | 76:aeb1df146756 | 414 | tmpreg &= (uint32_t)~(OPAMP_CSR_OPA1CAL_L | OPAMP_CSR_OPA1CAL_H); |
mbed_official | 76:aeb1df146756 | 415 | /* Select the OPAMP input */ |
mbed_official | 76:aeb1df146756 | 416 | tmpreg |= OPAMP_Input; |
mbed_official | 76:aeb1df146756 | 417 | |
mbed_official | 76:aeb1df146756 | 418 | if(OPAMP_Input == OPAMP_Input_PMOS) |
mbed_official | 76:aeb1df146756 | 419 | { |
mbed_official | 76:aeb1df146756 | 420 | /* Reset the trimming value corresponding to OPAMP1 PMOS input */ |
mbed_official | 76:aeb1df146756 | 421 | tmpreg &= (0xFFFFFFE0); |
mbed_official | 76:aeb1df146756 | 422 | /* Set the new trimming value corresponding to OPAMP1 PMOS input */ |
mbed_official | 76:aeb1df146756 | 423 | tmpreg |= (OPAMP_TrimValue); |
mbed_official | 76:aeb1df146756 | 424 | } |
mbed_official | 76:aeb1df146756 | 425 | else |
mbed_official | 76:aeb1df146756 | 426 | { |
mbed_official | 76:aeb1df146756 | 427 | /* Reset the trimming value corresponding to OPAMP1 NMOS input */ |
mbed_official | 76:aeb1df146756 | 428 | tmpreg &= (0xFFFFFC1F); |
mbed_official | 76:aeb1df146756 | 429 | /* Set the new trimming value corresponding to OPAMP1 NMOS input */ |
mbed_official | 76:aeb1df146756 | 430 | tmpreg |= (OPAMP_TrimValue<<5); |
mbed_official | 76:aeb1df146756 | 431 | } |
mbed_official | 76:aeb1df146756 | 432 | } |
mbed_official | 76:aeb1df146756 | 433 | else if (OPAMP_Selection == OPAMP_Selection_OPAMP2) |
mbed_official | 76:aeb1df146756 | 434 | { |
mbed_official | 76:aeb1df146756 | 435 | /* Reset the OPAMP inputs selection */ |
mbed_official | 76:aeb1df146756 | 436 | tmpreg &= (uint32_t)~(OPAMP_CSR_OPA2CAL_L | OPAMP_CSR_OPA2CAL_H); |
mbed_official | 76:aeb1df146756 | 437 | /* Select the OPAMP input */ |
mbed_official | 76:aeb1df146756 | 438 | tmpreg |= (uint32_t)(OPAMP_Input<<8); |
mbed_official | 76:aeb1df146756 | 439 | |
mbed_official | 76:aeb1df146756 | 440 | if(OPAMP_Input == OPAMP_Input_PMOS) |
mbed_official | 76:aeb1df146756 | 441 | { |
mbed_official | 76:aeb1df146756 | 442 | /* Reset the trimming value corresponding to OPAMP2 PMOS input */ |
mbed_official | 76:aeb1df146756 | 443 | tmpreg &= (0xFFFF83FF); |
mbed_official | 76:aeb1df146756 | 444 | /* Set the new trimming value corresponding to OPAMP2 PMOS input */ |
mbed_official | 76:aeb1df146756 | 445 | tmpreg |= (OPAMP_TrimValue<<10); |
mbed_official | 76:aeb1df146756 | 446 | } |
mbed_official | 76:aeb1df146756 | 447 | else |
mbed_official | 76:aeb1df146756 | 448 | { |
mbed_official | 76:aeb1df146756 | 449 | /* Reset the trimming value corresponding to OPAMP2 NMOS input */ |
mbed_official | 76:aeb1df146756 | 450 | tmpreg &= (0xFFF07FFF); |
mbed_official | 76:aeb1df146756 | 451 | /* Set the new trimming value corresponding to OPAMP2 NMOS input */ |
mbed_official | 76:aeb1df146756 | 452 | tmpreg |= (OPAMP_TrimValue<<15); |
mbed_official | 76:aeb1df146756 | 453 | } |
mbed_official | 76:aeb1df146756 | 454 | } |
mbed_official | 76:aeb1df146756 | 455 | else |
mbed_official | 76:aeb1df146756 | 456 | { |
mbed_official | 76:aeb1df146756 | 457 | /* Reset the OPAMP inputs selection */ |
mbed_official | 76:aeb1df146756 | 458 | tmpreg &= (uint32_t)~(OPAMP_CSR_OPA3CAL_L | OPAMP_CSR_OPA3CAL_H); |
mbed_official | 76:aeb1df146756 | 459 | /* Select the OPAMP input */ |
mbed_official | 76:aeb1df146756 | 460 | tmpreg |= (uint32_t)(OPAMP_Input<<16); |
mbed_official | 76:aeb1df146756 | 461 | |
mbed_official | 76:aeb1df146756 | 462 | if(OPAMP_Input == OPAMP_Input_PMOS) |
mbed_official | 76:aeb1df146756 | 463 | { |
mbed_official | 76:aeb1df146756 | 464 | /* Reset the trimming value corresponding to OPAMP3 PMOS input */ |
mbed_official | 76:aeb1df146756 | 465 | tmpreg &= (0xFE0FFFFF); |
mbed_official | 76:aeb1df146756 | 466 | /* Set the new trimming value corresponding to OPAMP3 PMOS input */ |
mbed_official | 76:aeb1df146756 | 467 | tmpreg |= (OPAMP_TrimValue<<20); |
mbed_official | 76:aeb1df146756 | 468 | } |
mbed_official | 76:aeb1df146756 | 469 | else |
mbed_official | 76:aeb1df146756 | 470 | { |
mbed_official | 76:aeb1df146756 | 471 | /* Reset the trimming value corresponding to OPAMP3 NMOS input */ |
mbed_official | 76:aeb1df146756 | 472 | tmpreg &= (0xC1FFFFFF); |
mbed_official | 76:aeb1df146756 | 473 | /* Set the new trimming value corresponding to OPAMP3 NMOS input */ |
mbed_official | 76:aeb1df146756 | 474 | tmpreg |= (OPAMP_TrimValue<<25); |
mbed_official | 76:aeb1df146756 | 475 | } |
mbed_official | 76:aeb1df146756 | 476 | } |
mbed_official | 76:aeb1df146756 | 477 | |
mbed_official | 76:aeb1df146756 | 478 | /* Set the OPAMP_LPOTR register */ |
mbed_official | 76:aeb1df146756 | 479 | OPAMP->LPOTR = tmpreg; |
mbed_official | 76:aeb1df146756 | 480 | } |
mbed_official | 76:aeb1df146756 | 481 | |
mbed_official | 76:aeb1df146756 | 482 | /** |
mbed_official | 76:aeb1df146756 | 483 | * @brief Checks whether the specified OPAMP calibration flag is set or not. |
mbed_official | 76:aeb1df146756 | 484 | * @note User should wait until calibration flag change the value when changing |
mbed_official | 76:aeb1df146756 | 485 | * the trimming value. |
mbed_official | 76:aeb1df146756 | 486 | * @param OPAMP_Selection: the selected OPAMP. |
mbed_official | 76:aeb1df146756 | 487 | * This parameter can be one of the following values: |
mbed_official | 76:aeb1df146756 | 488 | * @arg OPAMP_Selection_OPAMP1: OPAMP1 is selected. |
mbed_official | 76:aeb1df146756 | 489 | * @arg OPAMP_Selection_OPAMP2: OPAMP2 is selected. |
mbed_official | 76:aeb1df146756 | 490 | * @arg OPAMP_Selection_OPAMP3: OPAMP3 is selected. |
mbed_official | 76:aeb1df146756 | 491 | * @retval The new state of the OPAMP calibration flag (SET or RESET). |
mbed_official | 76:aeb1df146756 | 492 | */ |
mbed_official | 76:aeb1df146756 | 493 | FlagStatus OPAMP_GetFlagStatus(uint32_t OPAMP_Selection) |
mbed_official | 76:aeb1df146756 | 494 | { |
mbed_official | 76:aeb1df146756 | 495 | FlagStatus bitstatus = RESET; |
mbed_official | 76:aeb1df146756 | 496 | uint32_t tmpreg = 0; |
mbed_official | 76:aeb1df146756 | 497 | |
mbed_official | 76:aeb1df146756 | 498 | /* Check the parameter */ |
mbed_official | 76:aeb1df146756 | 499 | assert_param(IS_OPAMP_ALL_PERIPH(OPAMP_Selection)); |
mbed_official | 76:aeb1df146756 | 500 | |
mbed_official | 76:aeb1df146756 | 501 | /* Get the CSR register value */ |
mbed_official | 76:aeb1df146756 | 502 | tmpreg = OPAMP->CSR; |
mbed_official | 76:aeb1df146756 | 503 | |
mbed_official | 76:aeb1df146756 | 504 | /* Check if OPAMP1 is selected */ |
mbed_official | 76:aeb1df146756 | 505 | if(OPAMP_Selection == OPAMP_Selection_OPAMP1) |
mbed_official | 76:aeb1df146756 | 506 | { |
mbed_official | 76:aeb1df146756 | 507 | /* Check OPAMP1 CAL bit status */ |
mbed_official | 76:aeb1df146756 | 508 | if ((tmpreg & OPAMP_CSR_OPA1CALOUT) != (uint32_t)RESET) |
mbed_official | 76:aeb1df146756 | 509 | { |
mbed_official | 76:aeb1df146756 | 510 | bitstatus = SET; |
mbed_official | 76:aeb1df146756 | 511 | } |
mbed_official | 76:aeb1df146756 | 512 | else |
mbed_official | 76:aeb1df146756 | 513 | { |
mbed_official | 76:aeb1df146756 | 514 | bitstatus = RESET; |
mbed_official | 76:aeb1df146756 | 515 | } |
mbed_official | 76:aeb1df146756 | 516 | } |
mbed_official | 76:aeb1df146756 | 517 | /* Check if OPAMP2 is selected */ |
mbed_official | 76:aeb1df146756 | 518 | else if(OPAMP_Selection == OPAMP_Selection_OPAMP2) |
mbed_official | 76:aeb1df146756 | 519 | { |
mbed_official | 76:aeb1df146756 | 520 | /* Check OPAMP2 CAL bit status */ |
mbed_official | 76:aeb1df146756 | 521 | if ((tmpreg & OPAMP_CSR_OPA2CALOUT) != (uint32_t)RESET) |
mbed_official | 76:aeb1df146756 | 522 | { |
mbed_official | 76:aeb1df146756 | 523 | bitstatus = SET; |
mbed_official | 76:aeb1df146756 | 524 | } |
mbed_official | 76:aeb1df146756 | 525 | else |
mbed_official | 76:aeb1df146756 | 526 | { |
mbed_official | 76:aeb1df146756 | 527 | bitstatus = RESET; |
mbed_official | 76:aeb1df146756 | 528 | } |
mbed_official | 76:aeb1df146756 | 529 | } |
mbed_official | 76:aeb1df146756 | 530 | else |
mbed_official | 76:aeb1df146756 | 531 | { |
mbed_official | 76:aeb1df146756 | 532 | /* Check OPAMP3 CAL bit status */ |
mbed_official | 76:aeb1df146756 | 533 | if ((tmpreg & OPAMP_CSR_OPA3CALOUT) != (uint32_t)RESET) |
mbed_official | 76:aeb1df146756 | 534 | { |
mbed_official | 76:aeb1df146756 | 535 | bitstatus = SET; |
mbed_official | 76:aeb1df146756 | 536 | } |
mbed_official | 76:aeb1df146756 | 537 | else |
mbed_official | 76:aeb1df146756 | 538 | { |
mbed_official | 76:aeb1df146756 | 539 | bitstatus = RESET; |
mbed_official | 76:aeb1df146756 | 540 | } |
mbed_official | 76:aeb1df146756 | 541 | } |
mbed_official | 76:aeb1df146756 | 542 | return bitstatus; |
mbed_official | 76:aeb1df146756 | 543 | } |
mbed_official | 76:aeb1df146756 | 544 | |
mbed_official | 76:aeb1df146756 | 545 | /** |
mbed_official | 76:aeb1df146756 | 546 | * @} |
mbed_official | 76:aeb1df146756 | 547 | */ |
mbed_official | 76:aeb1df146756 | 548 | |
mbed_official | 76:aeb1df146756 | 549 | /** |
mbed_official | 76:aeb1df146756 | 550 | * @} |
mbed_official | 76:aeb1df146756 | 551 | */ |
mbed_official | 76:aeb1df146756 | 552 | |
mbed_official | 76:aeb1df146756 | 553 | /** |
mbed_official | 76:aeb1df146756 | 554 | * @} |
mbed_official | 76:aeb1df146756 | 555 | */ |
mbed_official | 76:aeb1df146756 | 556 | |
mbed_official | 76:aeb1df146756 | 557 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |