mbed library sources

Dependents:   frdm_kl05z_gpio_test

Fork of mbed-src by mbed official

Committer:
shaoziyang
Date:
Sat Sep 13 14:25:46 2014 +0000
Revision:
323:9e901b0a5aa1
Parent:
237:f3da66175598
test with CLOCK_SETUP = 0

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 237:f3da66175598 1 /**
mbed_official 237:f3da66175598 2 ******************************************************************************
mbed_official 237:f3da66175598 3 * @file stm32f3xx_hal_adc.c
mbed_official 237:f3da66175598 4 * @author MCD Application conversion
mbed_official 237:f3da66175598 5 * @version V1.0.1
mbed_official 237:f3da66175598 6 * @date 18-June-2014
mbed_official 237:f3da66175598 7 * @brief This file provides firmware functions to manage the following
mbed_official 237:f3da66175598 8 * functionalities of the Analog to Digital Convertor (ADC)
mbed_official 237:f3da66175598 9 * peripheral:
mbed_official 237:f3da66175598 10 * + Initialization and de-initialization functions
mbed_official 237:f3da66175598 11 * ++ Initialization and Configuration of ADC
mbed_official 237:f3da66175598 12 * + Operation functions
mbed_official 237:f3da66175598 13 * ++ Start, stop, get result of conversions of regular and injected
mbed_official 237:f3da66175598 14 * groups, using 3 possible modes: polling, interruption or DMA.
mbed_official 237:f3da66175598 15 * + Control functions
mbed_official 237:f3da66175598 16 * ++ Analog Watchdog configuration
mbed_official 237:f3da66175598 17 * ++ Channels configuration on regular group
mbed_official 237:f3da66175598 18 * + State functions
mbed_official 237:f3da66175598 19 * ++ ADC state machine management
mbed_official 237:f3da66175598 20 * ++ Interrupts and flags management
mbed_official 237:f3da66175598 21 *
mbed_official 237:f3da66175598 22 @verbatim
mbed_official 237:f3da66175598 23 ==============================================================================
mbed_official 237:f3da66175598 24 ##### ADC specific features #####
mbed_official 237:f3da66175598 25 ==============================================================================
mbed_official 237:f3da66175598 26 [..]
mbed_official 237:f3da66175598 27 (#) 12-bit, 10-bit, 8-bit or 6-bit configurable resolution (available only on
mbed_official 237:f3da66175598 28 STM32F30xxC devices).
mbed_official 237:f3da66175598 29
mbed_official 237:f3da66175598 30 (#) Interrupt generation at the end of regular conversion, end of injected
mbed_official 237:f3da66175598 31 conversion, and in case of analog watchdog or overrun events.
mbed_official 237:f3da66175598 32
mbed_official 237:f3da66175598 33 (#) Single and continuous conversion modes.
mbed_official 237:f3da66175598 34
mbed_official 237:f3da66175598 35 (#) Scan mode for automatic conversion of channel 0 to channel 'n'.
mbed_official 237:f3da66175598 36
mbed_official 237:f3da66175598 37 (#) Data alignment with in-built data coherency.
mbed_official 237:f3da66175598 38
mbed_official 237:f3da66175598 39 (#) Channel-wise programmable sampling time.
mbed_official 237:f3da66175598 40
mbed_official 237:f3da66175598 41 (#) ADC conversion Regular or Injected groups.
mbed_official 237:f3da66175598 42
mbed_official 237:f3da66175598 43 (#) External trigger (timer or EXTI) with configurable polarity for both
mbed_official 237:f3da66175598 44 regular and injected groups.
mbed_official 237:f3da66175598 45
mbed_official 237:f3da66175598 46 (#) DMA request generation for transfer of conversions data of regular group.
mbed_official 237:f3da66175598 47
mbed_official 237:f3da66175598 48 (#) Multimode Dual mode (available on devices with 2 ADCs or more).
mbed_official 237:f3da66175598 49
mbed_official 237:f3da66175598 50 (#) Configurable DMA data storage in Multimode Dual mode (available on devices
mbed_official 237:f3da66175598 51 with 2 DCs or more).
mbed_official 237:f3da66175598 52
mbed_official 237:f3da66175598 53 (#) Configurable delay between conversions in Dual interleaved mode (available
mbed_official 237:f3da66175598 54 on devices with 2 DCs or more).
mbed_official 237:f3da66175598 55
mbed_official 237:f3da66175598 56 (#) ADC calibration
mbed_official 237:f3da66175598 57
mbed_official 237:f3da66175598 58 (#) ADC channels selectable single/differential input (available only on
mbed_official 237:f3da66175598 59 STM32F30xxC devices)
mbed_official 237:f3da66175598 60
mbed_official 237:f3da66175598 61 (#) ADC Injected sequencer&channels configuration context queue (available
mbed_official 237:f3da66175598 62 only on STM32F30xxC devices)
mbed_official 237:f3da66175598 63
mbed_official 237:f3da66175598 64 (#) ADC offset on injected and regular groups (offset on regular group
mbed_official 237:f3da66175598 65 available only on STM32F30xxC devices)
mbed_official 237:f3da66175598 66
mbed_official 237:f3da66175598 67 (#) ADC supply requirements: 2.4 V to 3.6 V at full speed and down to 1.8 V at
mbed_official 237:f3da66175598 68 slower speed.
mbed_official 237:f3da66175598 69
mbed_official 237:f3da66175598 70 (#) ADC input range: from Vref– (connected to Vssa) to Vref+ (connected to
mbed_official 237:f3da66175598 71 Vdda or to an external voltage reference).
mbed_official 237:f3da66175598 72
mbed_official 237:f3da66175598 73
mbed_official 237:f3da66175598 74 ##### How to use this driver #####
mbed_official 237:f3da66175598 75 ==============================================================================
mbed_official 237:f3da66175598 76 [..]
mbed_official 237:f3da66175598 77
mbed_official 237:f3da66175598 78 (#) Enable the ADC interface
mbed_official 237:f3da66175598 79 As prerequisite, into HAL_ADC_MspInit(), ADC clock must be configured
mbed_official 237:f3da66175598 80 at RCC top level: clock source and clock prescaler.
mbed_official 237:f3da66175598 81
mbed_official 237:f3da66175598 82 For STM32F30x/STM32F33x devices:
mbed_official 237:f3da66175598 83 Two possible clock sources: synchronous clock derived from AHB clock
mbed_official 237:f3da66175598 84 or asynchronous clock derived from ADC dedicated PLL 72MHz.
mbed_official 237:f3da66175598 85
mbed_official 237:f3da66175598 86 For example, in case of device with a single ADC:
mbed_official 237:f3da66175598 87 __ADC1_CLK_ENABLE() (mandatory)
mbed_official 237:f3da66175598 88 __HAL_RCC_ADC1_CONFIG(RCC_ADC1PLLCLK_DIV1); (optional)
mbed_official 237:f3da66175598 89
mbed_official 237:f3da66175598 90 For example, in case of device with several ADCs:
mbed_official 237:f3da66175598 91 if((hadc->Instance == ADC1) || (hadc->Instance == ADC2))
mbed_official 237:f3da66175598 92 {
mbed_official 237:f3da66175598 93 __ADC12_CLK_ENABLE() (mandatory)
mbed_official 237:f3da66175598 94 __HAL_RCC_ADC12_CONFIG(RCC_ADC12PLLCLK_DIV1); (optional)
mbed_official 237:f3da66175598 95 }
mbed_official 237:f3da66175598 96 else
mbed_official 237:f3da66175598 97 {
mbed_official 237:f3da66175598 98 __ADC34_CLK_ENABLE() (mandatory)
mbed_official 237:f3da66175598 99 __HAL_RCC_ADC34_CONFIG(RCC_ADC34PLLCLK_DIV1); (optional)
mbed_official 237:f3da66175598 100 }
mbed_official 237:f3da66175598 101
mbed_official 237:f3da66175598 102 For STM32F37x devices:
mbed_official 237:f3da66175598 103 Only one clock source: APB2 clock.
mbed_official 237:f3da66175598 104 Example:
mbed_official 237:f3da66175598 105 __HAL_RCC_ADC1_CONFIG(RCC_ADC1PCLK2_DIV2);
mbed_official 237:f3da66175598 106
mbed_official 237:f3da66175598 107 (#) ADC pins configuration
mbed_official 237:f3da66175598 108 (++) Enable the clock for the ADC GPIOs using the following function:
mbed_official 237:f3da66175598 109 __GPIOx_CLK_ENABLE();
mbed_official 237:f3da66175598 110 (++) Configure these ADC pins in analog mode using HAL_GPIO_Init();
mbed_official 237:f3da66175598 111
mbed_official 237:f3da66175598 112 (#) Configure the ADC parameters (conversion resolution, data alignment,
mbed_official 237:f3da66175598 113 continuous mode, ...) using the HAL_ADC_Init() function.
mbed_official 237:f3da66175598 114
mbed_official 237:f3da66175598 115 (#) Activate the ADC peripheral using one of the start functions:
mbed_official 237:f3da66175598 116 HAL_ADC_Start(), HAL_ADC_Start_IT(), HAL_ADC_Start_DMA()
mbed_official 237:f3da66175598 117 HAL_ADCEx_InjectedStart(), HAL_ADCEx_InjectedStart_IT() or
mbed_official 237:f3da66175598 118 HAL_ADC_MultiModeStart_DMA().
mbed_official 237:f3da66175598 119
mbed_official 237:f3da66175598 120 *** Channels to regular group configuration ***
mbed_official 237:f3da66175598 121 ============================================
mbed_official 237:f3da66175598 122 [..]
mbed_official 237:f3da66175598 123 (+) To configure the ADC regular group features, use
mbed_official 237:f3da66175598 124 HAL_ADC_Init() and HAL_ADC_ConfigChannel() functions.
mbed_official 237:f3da66175598 125 (+) To activate the continuous mode, use the HAL_ADC_Init() function.
mbed_official 237:f3da66175598 126 (+) To read the ADC converted values, use the HAL_ADC_GetValue() function.
mbed_official 237:f3da66175598 127
mbed_official 237:f3da66175598 128 *** Multimode ADCs configuration ***
mbed_official 237:f3da66175598 129 ======================================================
mbed_official 237:f3da66175598 130 [..]
mbed_official 237:f3da66175598 131 (+) Multimode feature is available on devices with 2 ADCs or more.
mbed_official 237:f3da66175598 132 (+) Refer to "Channels to regular group" description to
mbed_official 237:f3da66175598 133 configure the ADC1 and ADC2 regular groups.
mbed_official 237:f3da66175598 134 (+) Select the Multi mode ADC features (dual mode
mbed_official 237:f3da66175598 135 simultaneous, interleaved, ...) and configure the DMA mode using
mbed_official 237:f3da66175598 136 HAL_ADCEx_MultiModeConfigChannel() functions.
mbed_official 237:f3da66175598 137 (+) Read the ADCs converted values using the HAL_ADCEx_MultiModeGetValue()
mbed_official 237:f3da66175598 138 function.
mbed_official 237:f3da66175598 139
mbed_official 237:f3da66175598 140 *** DMA for regular configuration ***
mbed_official 237:f3da66175598 141 =============================================================
mbed_official 237:f3da66175598 142 [..]
mbed_official 237:f3da66175598 143 (+) To enable the DMA mode for regular group, use the
mbed_official 237:f3da66175598 144 HAL_ADC_Start_DMA() function.
mbed_official 237:f3da66175598 145 (+) To enable the generation of DMA requests continuously at the end of
mbed_official 237:f3da66175598 146 the last DMA transfer, use the HAL_ADC_Init() function.
mbed_official 237:f3da66175598 147
mbed_official 237:f3da66175598 148 *** Channels to injected group configuration ***
mbed_official 237:f3da66175598 149 =============================================
mbed_official 237:f3da66175598 150 [..]
mbed_official 237:f3da66175598 151 (+) To configure the ADC Injected channels group features, use
mbed_official 237:f3da66175598 152 HAL_ADCEx_InjectedConfigChannel() functions.
mbed_official 237:f3da66175598 153 (+) To activate the continuous mode, use the HAL_ADC_Init() function.
mbed_official 237:f3da66175598 154 (+) To read the ADC converted values, use the HAL_ADCEx_InjectedGetValue()
mbed_official 237:f3da66175598 155 function.
mbed_official 237:f3da66175598 156
mbed_official 237:f3da66175598 157 @endverbatim
mbed_official 237:f3da66175598 158 ******************************************************************************
mbed_official 237:f3da66175598 159 * @attention
mbed_official 237:f3da66175598 160 *
mbed_official 237:f3da66175598 161 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
mbed_official 237:f3da66175598 162 *
mbed_official 237:f3da66175598 163 * Redistribution and use in source and binary forms, with or without modification,
mbed_official 237:f3da66175598 164 * are permitted provided that the following conditions are met:
mbed_official 237:f3da66175598 165 * 1. Redistributions of source code must retain the above copyright notice,
mbed_official 237:f3da66175598 166 * this list of conditions and the following disclaimer.
mbed_official 237:f3da66175598 167 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbed_official 237:f3da66175598 168 * this list of conditions and the following disclaimer in the documentation
mbed_official 237:f3da66175598 169 * and/or other materials provided with the distribution.
mbed_official 237:f3da66175598 170 * 3. Neither the name of STMicroelectronics nor the names of its contributors
mbed_official 237:f3da66175598 171 * may be used to endorse or promote products derived from this software
mbed_official 237:f3da66175598 172 * without specific prior written permission.
mbed_official 237:f3da66175598 173 *
mbed_official 237:f3da66175598 174 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
mbed_official 237:f3da66175598 175 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
mbed_official 237:f3da66175598 176 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
mbed_official 237:f3da66175598 177 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
mbed_official 237:f3da66175598 178 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
mbed_official 237:f3da66175598 179 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
mbed_official 237:f3da66175598 180 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
mbed_official 237:f3da66175598 181 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
mbed_official 237:f3da66175598 182 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
mbed_official 237:f3da66175598 183 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mbed_official 237:f3da66175598 184 *
mbed_official 237:f3da66175598 185 ******************************************************************************
mbed_official 237:f3da66175598 186 */
mbed_official 237:f3da66175598 187
mbed_official 237:f3da66175598 188 /* Includes ------------------------------------------------------------------*/
mbed_official 237:f3da66175598 189 #include "stm32f3xx_hal.h"
mbed_official 237:f3da66175598 190
mbed_official 237:f3da66175598 191 /** @addtogroup STM32F3xx_HAL_Driver
mbed_official 237:f3da66175598 192 * @{
mbed_official 237:f3da66175598 193 */
mbed_official 237:f3da66175598 194
mbed_official 237:f3da66175598 195 /** @defgroup ADC
mbed_official 237:f3da66175598 196 * @brief ADC driver modules
mbed_official 237:f3da66175598 197 * @{
mbed_official 237:f3da66175598 198 */
mbed_official 237:f3da66175598 199
mbed_official 237:f3da66175598 200 #ifdef HAL_ADC_MODULE_ENABLED
mbed_official 237:f3da66175598 201
mbed_official 237:f3da66175598 202 /* Private typedef -----------------------------------------------------------*/
mbed_official 237:f3da66175598 203 /* Private define ------------------------------------------------------------*/
mbed_official 237:f3da66175598 204 /* Private macro -------------------------------------------------------------*/
mbed_official 237:f3da66175598 205 /* Private variables ---------------------------------------------------------*/
mbed_official 237:f3da66175598 206 /* Private function prototypes -----------------------------------------------*/
mbed_official 237:f3da66175598 207 /* Private functions ---------------------------------------------------------*/
mbed_official 237:f3da66175598 208
mbed_official 237:f3da66175598 209 /** @defgroup ADC_Private_Functions
mbed_official 237:f3da66175598 210 * @{
mbed_official 237:f3da66175598 211 */
mbed_official 237:f3da66175598 212
mbed_official 237:f3da66175598 213 /** @defgroup ADC_Group1 Initialization/de-initialization functions
mbed_official 237:f3da66175598 214 * @brief Initialization and Configuration functions
mbed_official 237:f3da66175598 215 *
mbed_official 237:f3da66175598 216 @verbatim
mbed_official 237:f3da66175598 217 ===============================================================================
mbed_official 237:f3da66175598 218 ##### Initialization and de-initialization functions #####
mbed_official 237:f3da66175598 219 ===============================================================================
mbed_official 237:f3da66175598 220 [..] This section provides functions allowing to:
mbed_official 237:f3da66175598 221 (+) Initialize and configure the ADC.
mbed_official 237:f3da66175598 222 (+) De-initialize the ADC.
mbed_official 237:f3da66175598 223
mbed_official 237:f3da66175598 224 @endverbatim
mbed_official 237:f3da66175598 225 * @{
mbed_official 237:f3da66175598 226 */
mbed_official 237:f3da66175598 227
mbed_official 237:f3da66175598 228 /**
mbed_official 237:f3da66175598 229 * @brief Initializes the ADC peripheral and regular group according to
mbed_official 237:f3da66175598 230 * parameters specified in structure "ADC_InitTypeDef".
mbed_official 237:f3da66175598 231 * @note As prerequisite, ADC clock must be configured at RCC top level
mbed_official 237:f3da66175598 232 * depending on both possible clock sources: PLL clock or AHB clock.
mbed_official 237:f3da66175598 233 * See commented example code below that can be copied and uncommented
mbed_official 237:f3da66175598 234 * into HAL_ADC_MspInit().
mbed_official 237:f3da66175598 235 * @note Possibility to update parameters on the fly:
mbed_official 237:f3da66175598 236 * This function initializes the ADC MSP (HAL_ADC_MspInit()) only when
mbed_official 237:f3da66175598 237 * coming from ADC state reset. Following calls to this function can
mbed_official 237:f3da66175598 238 * be used to reconfigure some parameters of ADC_InitTypeDef
mbed_official 237:f3da66175598 239 * structure on the fly, without modifying MSP configuration. If ADC
mbed_official 237:f3da66175598 240 * MSP has to be modified again, HAL_ADC_DeInit() must be called
mbed_official 237:f3da66175598 241 * before HAL_ADC_Init().
mbed_official 237:f3da66175598 242 * The setting of these parameters is conditioned to ADC state.
mbed_official 237:f3da66175598 243 * For parameters constraints, see comments of structure
mbed_official 237:f3da66175598 244 * "ADC_InitTypeDef".
mbed_official 237:f3da66175598 245 * @note This function configures the ADC within 2 scopes: scope of entire
mbed_official 237:f3da66175598 246 * ADC and scope of regular group. For parameters details, see comments
mbed_official 237:f3da66175598 247 * of structure "ADC_InitTypeDef".
mbed_official 237:f3da66175598 248 * @note For devices with several ADCs: parameters related to common ADC
mbed_official 237:f3da66175598 249 * registers (ADC clock mode) are set only if all ADCs sharing the
mbed_official 237:f3da66175598 250 * same common group are disabled.
mbed_official 237:f3da66175598 251 * If this is not the case, these common parameters setting are
mbed_official 237:f3da66175598 252 * bypassed without error reporting: it can be the intended behaviour in
mbed_official 237:f3da66175598 253 * case of update of a parameter of ADC_InitTypeDef on the fly,
mbed_official 237:f3da66175598 254 * without disabling the other ADCs sharing the same common group.
mbed_official 237:f3da66175598 255 * @param hadc: ADC handle
mbed_official 237:f3da66175598 256 * @retval HAL status
mbed_official 237:f3da66175598 257 */
mbed_official 237:f3da66175598 258 __weak HAL_StatusTypeDef HAL_ADC_Init(ADC_HandleTypeDef* hadc)
mbed_official 237:f3da66175598 259 {
mbed_official 237:f3da66175598 260 /* Note : This function is defined into this file for library reference. */
mbed_official 237:f3da66175598 261 /* Function content is located into file stm32f3xx_hal_adc_ex.c */
mbed_official 237:f3da66175598 262
mbed_official 237:f3da66175598 263 /* Return function status */
mbed_official 237:f3da66175598 264 return HAL_OK;
mbed_official 237:f3da66175598 265 }
mbed_official 237:f3da66175598 266
mbed_official 237:f3da66175598 267 /**
mbed_official 237:f3da66175598 268 * @brief Deinitialize the ADC peripheral registers to their default reset
mbed_official 237:f3da66175598 269 * values, with deinitialization of the ADC MSP.
mbed_official 237:f3da66175598 270 * @note For devices with several ADCs: reset of ADC common registers is done
mbed_official 237:f3da66175598 271 * only if all ADCs sharing the same common group are disabled.
mbed_official 237:f3da66175598 272 * If this is not the case, reset of these common parameters reset is
mbed_official 237:f3da66175598 273 * bypassed without error reporting: it can be the intended behaviour in
mbed_official 237:f3da66175598 274 * case of reset of a single ADC while the other ADCs sharing the same
mbed_official 237:f3da66175598 275 * common group is still running.
mbed_official 237:f3da66175598 276 * @note For devices with several ADCs: Global reset of all ADCs sharing a
mbed_official 237:f3da66175598 277 * common group is possible.
mbed_official 237:f3da66175598 278 * As this function is intended to reset a single ADC, to not impact
mbed_official 237:f3da66175598 279 * other ADCs, instructions for global reset of multiple ADCs have been
mbed_official 237:f3da66175598 280 * let commented below.
mbed_official 237:f3da66175598 281 * If needed, the example code can be copied and uncommented into
mbed_official 237:f3da66175598 282 * function HAL_ADC_MspDeInit().
mbed_official 237:f3da66175598 283 * @param hadc: ADC handle
mbed_official 237:f3da66175598 284 * @retval HAL status
mbed_official 237:f3da66175598 285 */
mbed_official 237:f3da66175598 286 __weak HAL_StatusTypeDef HAL_ADC_DeInit(ADC_HandleTypeDef* hadc)
mbed_official 237:f3da66175598 287 {
mbed_official 237:f3da66175598 288 /* Note : This function is defined into this file for library reference. */
mbed_official 237:f3da66175598 289 /* Function content is located into file stm32f3xx_hal_adc_ex.c */
mbed_official 237:f3da66175598 290
mbed_official 237:f3da66175598 291 /* Return function status */
mbed_official 237:f3da66175598 292 return HAL_OK;
mbed_official 237:f3da66175598 293 }
mbed_official 237:f3da66175598 294
mbed_official 237:f3da66175598 295 /**
mbed_official 237:f3da66175598 296 * @brief Initializes the ADC MSP.
mbed_official 237:f3da66175598 297 * @param hadc: ADC handle
mbed_official 237:f3da66175598 298 * @retval None
mbed_official 237:f3da66175598 299 */
mbed_official 237:f3da66175598 300 __weak void HAL_ADC_MspInit(ADC_HandleTypeDef* hadc)
mbed_official 237:f3da66175598 301 {
mbed_official 237:f3da66175598 302 /* NOTE : This function should not be modified. When the callback is needed,
mbed_official 237:f3da66175598 303 function HAL_ADC_MspInit must be implemented in the user file.
mbed_official 237:f3da66175598 304 */
mbed_official 237:f3da66175598 305 }
mbed_official 237:f3da66175598 306
mbed_official 237:f3da66175598 307 /**
mbed_official 237:f3da66175598 308 * @brief DeInitializes the ADC MSP.
mbed_official 237:f3da66175598 309 * @param hadc: ADC handle
mbed_official 237:f3da66175598 310 * @retval None
mbed_official 237:f3da66175598 311 */
mbed_official 237:f3da66175598 312 __weak void HAL_ADC_MspDeInit(ADC_HandleTypeDef* hadc)
mbed_official 237:f3da66175598 313 {
mbed_official 237:f3da66175598 314 /* NOTE : This function should not be modified. When the callback is needed,
mbed_official 237:f3da66175598 315 function HAL_ADC_MspDeInit must be implemented in the user file.
mbed_official 237:f3da66175598 316 */
mbed_official 237:f3da66175598 317 }
mbed_official 237:f3da66175598 318
mbed_official 237:f3da66175598 319 /**
mbed_official 237:f3da66175598 320 * @}
mbed_official 237:f3da66175598 321 */
mbed_official 237:f3da66175598 322
mbed_official 237:f3da66175598 323 /** @defgroup ADC_Group2 IO operation functions
mbed_official 237:f3da66175598 324 * @brief IO operation functions
mbed_official 237:f3da66175598 325 *
mbed_official 237:f3da66175598 326 @verbatim
mbed_official 237:f3da66175598 327 ===============================================================================
mbed_official 237:f3da66175598 328 ##### IO operation functions #####
mbed_official 237:f3da66175598 329 ===============================================================================
mbed_official 237:f3da66175598 330 [..] This section provides functions allowing to:
mbed_official 237:f3da66175598 331 (+) Start conversion of regular group.
mbed_official 237:f3da66175598 332 (+) Stop conversion of regular group.
mbed_official 237:f3da66175598 333 (+) Poll for conversion complete on regular group.
mbed_official 237:f3da66175598 334 (+) Poll for conversion event.
mbed_official 237:f3da66175598 335 (+) Get result of regular channel conversion.
mbed_official 237:f3da66175598 336 (+) Start conversion of regular group and enable interruptions.
mbed_official 237:f3da66175598 337 (+) Stop conversion of regular group and disable interruptions.
mbed_official 237:f3da66175598 338 (+) Handle ADC interrupt request
mbed_official 237:f3da66175598 339 (+) Start conversion of regular group and enable DMA transfer.
mbed_official 237:f3da66175598 340 (+) Stop conversion of regular group and disable ADC DMA transfer.
mbed_official 237:f3da66175598 341
mbed_official 237:f3da66175598 342 @endverbatim
mbed_official 237:f3da66175598 343 * @{
mbed_official 237:f3da66175598 344 */
mbed_official 237:f3da66175598 345 /**
mbed_official 237:f3da66175598 346 * @brief Enables ADC, starts conversion of regular group.
mbed_official 237:f3da66175598 347 * Interruptions enabled in this function: None.
mbed_official 237:f3da66175598 348 * @note: Case of multimode enabled (for devices with several ADCs): This
mbed_official 237:f3da66175598 349 * function must be called for ADC slave first, then ADC master.
mbed_official 237:f3da66175598 350 * For ADC slave, ADC is enabled only (conversion is not started).
mbed_official 237:f3da66175598 351 * For ADC master, ADC is enabled and multimode conversion is started.
mbed_official 237:f3da66175598 352 * @param hadc: ADC handle
mbed_official 237:f3da66175598 353 * @retval HAL status
mbed_official 237:f3da66175598 354 */
mbed_official 237:f3da66175598 355 __weak HAL_StatusTypeDef HAL_ADC_Start(ADC_HandleTypeDef* hadc)
mbed_official 237:f3da66175598 356 {
mbed_official 237:f3da66175598 357 /* Return function status */
mbed_official 237:f3da66175598 358 return HAL_OK;
mbed_official 237:f3da66175598 359 }
mbed_official 237:f3da66175598 360
mbed_official 237:f3da66175598 361 /**
mbed_official 237:f3da66175598 362 * @brief Stop ADC conversion of regular group (and injected group in
mbed_official 237:f3da66175598 363 * case of auto_injection mode), disable ADC peripheral.
mbed_official 237:f3da66175598 364 * @note: ADC peripheral disable is forcing interruption of potential
mbed_official 237:f3da66175598 365 * conversion on injected group. If injected group is under use, it
mbed_official 237:f3da66175598 366 * should be preliminarily stopped using HAL_ADCEx_InjectedStop function.
mbed_official 237:f3da66175598 367 * @note: Case of multimode enabled (for devices with several ADCs): This
mbed_official 237:f3da66175598 368 * function must be called for ADC master first, then ADC slave.
mbed_official 237:f3da66175598 369 * For ADC master, converson is stopped and ADC is disabled.
mbed_official 237:f3da66175598 370 * For ADC slave, ADC is disabled only (conversion stop of ADC master
mbed_official 237:f3da66175598 371 * has already stopped conversion of ADC slave).
mbed_official 237:f3da66175598 372 * @param hadc: ADC handle
mbed_official 237:f3da66175598 373 * @retval HAL status.
mbed_official 237:f3da66175598 374 */
mbed_official 237:f3da66175598 375 __weak HAL_StatusTypeDef HAL_ADC_Stop(ADC_HandleTypeDef* hadc)
mbed_official 237:f3da66175598 376 {
mbed_official 237:f3da66175598 377 /* Note : This function is defined into this file for library reference. */
mbed_official 237:f3da66175598 378 /* Function content is located into file stm32f3xx_hal_adc_ex.c */
mbed_official 237:f3da66175598 379
mbed_official 237:f3da66175598 380 /* Return function status */
mbed_official 237:f3da66175598 381 return HAL_OK;
mbed_official 237:f3da66175598 382 }
mbed_official 237:f3da66175598 383
mbed_official 237:f3da66175598 384 /**
mbed_official 237:f3da66175598 385 * @brief Wait for regular group conversion to be completed.
mbed_official 237:f3da66175598 386 * @param hadc: ADC handle
mbed_official 237:f3da66175598 387 * @param Timeout: Timeout value in millisecond.
mbed_official 237:f3da66175598 388 * @retval HAL status
mbed_official 237:f3da66175598 389 */
mbed_official 237:f3da66175598 390 __weak HAL_StatusTypeDef HAL_ADC_PollForConversion(ADC_HandleTypeDef* hadc, uint32_t Timeout)
mbed_official 237:f3da66175598 391 {
mbed_official 237:f3da66175598 392 /* Note : This function is defined into this file for library reference. */
mbed_official 237:f3da66175598 393 /* Function content is located into file stm32f3xx_hal_adc_ex.c */
mbed_official 237:f3da66175598 394
mbed_official 237:f3da66175598 395 /* Return function status */
mbed_official 237:f3da66175598 396 return HAL_OK;
mbed_official 237:f3da66175598 397 }
mbed_official 237:f3da66175598 398
mbed_official 237:f3da66175598 399 /**
mbed_official 237:f3da66175598 400 * @brief Poll for conversion event.
mbed_official 237:f3da66175598 401 * @param hadc: ADC handle
mbed_official 237:f3da66175598 402 * @param EventType: the ADC event type.
mbed_official 237:f3da66175598 403 * This parameter can be one of the following values:
mbed_official 237:f3da66175598 404 * @arg AWD_EVENT: ADC Analog watchdog 1 event (main analog watchdog, present on all STM32 devices)
mbed_official 237:f3da66175598 405 * @arg AWD2_EVENT: ADC Analog watchdog 2 event (additional analog watchdog, present only on STM32F3 devices)
mbed_official 237:f3da66175598 406 * @arg AWD3_EVENT: ADC Analog watchdog 3 event (additional analog watchdog, present only on STM32F3 devices)
mbed_official 237:f3da66175598 407 * @arg OVR_EVENT: ADC Overrun event
mbed_official 237:f3da66175598 408 * @arg JQOVF_EVENT: ADC Injected context queue overflow event
mbed_official 237:f3da66175598 409 * @param Timeout: Timeout value in millisecond.
mbed_official 237:f3da66175598 410 * @retval HAL status
mbed_official 237:f3da66175598 411 */
mbed_official 237:f3da66175598 412 __weak HAL_StatusTypeDef HAL_ADC_PollForEvent(ADC_HandleTypeDef* hadc, uint32_t EventType, uint32_t Timeout)
mbed_official 237:f3da66175598 413 {
mbed_official 237:f3da66175598 414 /* Note : This function is defined into this file for library reference. */
mbed_official 237:f3da66175598 415 /* Function content is located into file stm32f3xx_hal_adc_ex.c */
mbed_official 237:f3da66175598 416
mbed_official 237:f3da66175598 417 /* Return function status */
mbed_official 237:f3da66175598 418 return HAL_OK;
mbed_official 237:f3da66175598 419 }
mbed_official 237:f3da66175598 420
mbed_official 237:f3da66175598 421 /**
mbed_official 237:f3da66175598 422 * @brief Enables ADC, starts conversion of regular group with interruption.
mbed_official 237:f3da66175598 423 * Interruptions enabled in this function: EOC (end of conversion),
mbed_official 237:f3da66175598 424 * overrun (if available).
mbed_official 237:f3da66175598 425 * Each of these interruptions has its dedicated callback function.
mbed_official 237:f3da66175598 426 * @note: Case of multimode enabled (for devices with several ADCs): This
mbed_official 237:f3da66175598 427 * function must be called for ADC slave first, then ADC master.
mbed_official 237:f3da66175598 428 * For ADC slave, ADC is enabled only (conversion is not started).
mbed_official 237:f3da66175598 429 * For ADC master, ADC is enabled and multimode conversion is started.
mbed_official 237:f3da66175598 430 * @param hadc: ADC handle
mbed_official 237:f3da66175598 431 * @retval HAL status
mbed_official 237:f3da66175598 432 */
mbed_official 237:f3da66175598 433 __weak HAL_StatusTypeDef HAL_ADC_Start_IT(ADC_HandleTypeDef* hadc)
mbed_official 237:f3da66175598 434 {
mbed_official 237:f3da66175598 435 /* Note : This function is defined into this file for library reference. */
mbed_official 237:f3da66175598 436 /* Function content is located into file stm32f3xx_hal_adc_ex.c */
mbed_official 237:f3da66175598 437
mbed_official 237:f3da66175598 438 /* Return function status */
mbed_official 237:f3da66175598 439 return HAL_OK;
mbed_official 237:f3da66175598 440 }
mbed_official 237:f3da66175598 441
mbed_official 237:f3da66175598 442 /**
mbed_official 237:f3da66175598 443 * @brief Stop ADC conversion of regular group (and injected group in
mbed_official 237:f3da66175598 444 * case of auto_injection mode), disable interruption of
mbed_official 237:f3da66175598 445 * end-of-conversion, disable ADC peripheral.
mbed_official 237:f3da66175598 446 * @note: ADC peripheral disable is forcing interruption of potential
mbed_official 237:f3da66175598 447 * conversion on injected group. If injected group is under use, it
mbed_official 237:f3da66175598 448 * should be preliminarily stopped using HAL_ADCEx_InjectedStop function.
mbed_official 237:f3da66175598 449 * @note: Case of multimode enabled (for devices with several ADCs): This
mbed_official 237:f3da66175598 450 * function must be called for ADC master first, then ADC slave.
mbed_official 237:f3da66175598 451 * For ADC master, conversion is stopped and ADC is disabled.
mbed_official 237:f3da66175598 452 * For ADC slave, ADC is disabled only (conversion stop of ADC master
mbed_official 237:f3da66175598 453 * has already stopped conversion of ADC slave).
mbed_official 237:f3da66175598 454 * @param hadc: ADC handle
mbed_official 237:f3da66175598 455 * @retval HAL status.
mbed_official 237:f3da66175598 456 */
mbed_official 237:f3da66175598 457 __weak HAL_StatusTypeDef HAL_ADC_Stop_IT(ADC_HandleTypeDef* hadc)
mbed_official 237:f3da66175598 458 {
mbed_official 237:f3da66175598 459 /* Note : This function is defined into this file for library reference. */
mbed_official 237:f3da66175598 460 /* Function content is located into file stm32f3xx_hal_adc_ex.c */
mbed_official 237:f3da66175598 461
mbed_official 237:f3da66175598 462 /* Return function status */
mbed_official 237:f3da66175598 463 return HAL_OK;
mbed_official 237:f3da66175598 464 }
mbed_official 237:f3da66175598 465
mbed_official 237:f3da66175598 466 /**
mbed_official 237:f3da66175598 467 * @brief Enables ADC, starts conversion of regular group and transfers result
mbed_official 237:f3da66175598 468 * through DMA.
mbed_official 237:f3da66175598 469 * Interruptions enabled in this function:
mbed_official 237:f3da66175598 470 * overrun (if available), DMA half transfer, DMA transfer complete.
mbed_official 237:f3da66175598 471 * Each of these interruptions has its dedicated callback function.
mbed_official 237:f3da66175598 472 * @note: Case of multimode enabled (for devices with several ADCs): This
mbed_official 237:f3da66175598 473 * function is for single-ADC mode only. For multimode, use the
mbed_official 237:f3da66175598 474 * dedicated MultimodeStart function.
mbed_official 237:f3da66175598 475 * @param hadc: ADC handle
mbed_official 237:f3da66175598 476 * @param pData: The destination Buffer address.
mbed_official 237:f3da66175598 477 * @param Length: The length of data to be transferred from ADC peripheral to memory.
mbed_official 237:f3da66175598 478 * @retval None
mbed_official 237:f3da66175598 479 */
mbed_official 237:f3da66175598 480 __weak HAL_StatusTypeDef HAL_ADC_Start_DMA(ADC_HandleTypeDef* hadc, uint32_t* pData, uint32_t Length)
mbed_official 237:f3da66175598 481 {
mbed_official 237:f3da66175598 482 /* Note : This function is defined into this file for library reference. */
mbed_official 237:f3da66175598 483 /* Function content is located into file stm32f3xx_hal_adc_ex.c */
mbed_official 237:f3da66175598 484
mbed_official 237:f3da66175598 485 /* Return function status */
mbed_official 237:f3da66175598 486 return HAL_OK;
mbed_official 237:f3da66175598 487 }
mbed_official 237:f3da66175598 488
mbed_official 237:f3da66175598 489 /**
mbed_official 237:f3da66175598 490 * @brief Stop ADC conversion of regular group (and injected group in
mbed_official 237:f3da66175598 491 * case of auto_injection mode), disable ADC DMA transfer, disable
mbed_official 237:f3da66175598 492 * ADC peripheral.
mbed_official 237:f3da66175598 493 * @note: ADC peripheral disable is forcing interruption of potential
mbed_official 237:f3da66175598 494 * conversion on injected group. If injected group is under use, it
mbed_official 237:f3da66175598 495 * should be preliminarily stopped using HAL_ADCEx_InjectedStop function.
mbed_official 237:f3da66175598 496 * @note: Case of multimode enabled (for devices with several ADCs): This
mbed_official 237:f3da66175598 497 * function is for single-ADC mode only. For multimode, use the
mbed_official 237:f3da66175598 498 * dedicated MultimodeStop function.
mbed_official 237:f3da66175598 499 * @param hadc: ADC handle
mbed_official 237:f3da66175598 500 * @retval HAL status.
mbed_official 237:f3da66175598 501 */
mbed_official 237:f3da66175598 502 __weak HAL_StatusTypeDef HAL_ADC_Stop_DMA(ADC_HandleTypeDef* hadc)
mbed_official 237:f3da66175598 503 {
mbed_official 237:f3da66175598 504 /* Note : This function is defined into this file for library reference. */
mbed_official 237:f3da66175598 505 /* Function content is located into file stm32f3xx_hal_adc_ex.c */
mbed_official 237:f3da66175598 506
mbed_official 237:f3da66175598 507 /* Return function status */
mbed_official 237:f3da66175598 508 return HAL_OK;
mbed_official 237:f3da66175598 509 }
mbed_official 237:f3da66175598 510
mbed_official 237:f3da66175598 511 /**
mbed_official 237:f3da66175598 512 * @brief Get ADC regular group conversion result.
mbed_official 237:f3da66175598 513 * @param hadc: ADC handle
mbed_official 237:f3da66175598 514 * @retval Converted value
mbed_official 237:f3da66175598 515 */
mbed_official 237:f3da66175598 516 __weak uint32_t HAL_ADC_GetValue(ADC_HandleTypeDef* hadc)
mbed_official 237:f3da66175598 517 {
mbed_official 237:f3da66175598 518 /* Note : This function is defined into this file for library reference. */
mbed_official 237:f3da66175598 519 /* Function content is located into file stm32f3xx_hal_adc_ex.c */
mbed_official 237:f3da66175598 520
mbed_official 237:f3da66175598 521 /* Return ADC converted value */
mbed_official 237:f3da66175598 522 return hadc->Instance->DR;
mbed_official 237:f3da66175598 523 }
mbed_official 237:f3da66175598 524
mbed_official 237:f3da66175598 525 /**
mbed_official 237:f3da66175598 526 * @brief Handles ADC interrupt request.
mbed_official 237:f3da66175598 527 * @param hadc: ADC handle
mbed_official 237:f3da66175598 528 * @retval None
mbed_official 237:f3da66175598 529 */
mbed_official 237:f3da66175598 530 __weak void HAL_ADC_IRQHandler(ADC_HandleTypeDef* hadc)
mbed_official 237:f3da66175598 531 {
mbed_official 237:f3da66175598 532 /* Note : This function is defined into this file for library reference. */
mbed_official 237:f3da66175598 533 /* Function content is located into file stm32f3xx_hal_adc_ex.c */
mbed_official 237:f3da66175598 534 }
mbed_official 237:f3da66175598 535
mbed_official 237:f3da66175598 536 /**
mbed_official 237:f3da66175598 537 * @brief Conversion complete callback in non blocking mode
mbed_official 237:f3da66175598 538 * @param hadc: ADC handle
mbed_official 237:f3da66175598 539 * @retval None
mbed_official 237:f3da66175598 540 */
mbed_official 237:f3da66175598 541 __weak void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc)
mbed_official 237:f3da66175598 542 {
mbed_official 237:f3da66175598 543 /* NOTE : This function should not be modified. When the callback is needed,
mbed_official 237:f3da66175598 544 function HAL_ADC_ConvCpltCallback must be implemented in the user file.
mbed_official 237:f3da66175598 545 */
mbed_official 237:f3da66175598 546 }
mbed_official 237:f3da66175598 547
mbed_official 237:f3da66175598 548 /**
mbed_official 237:f3da66175598 549 * @brief Conversion DMA half-transfer callback in non blocking mode
mbed_official 237:f3da66175598 550 * @param hadc: ADC handle
mbed_official 237:f3da66175598 551 * @retval None
mbed_official 237:f3da66175598 552 */
mbed_official 237:f3da66175598 553 __weak void HAL_ADC_ConvHalfCpltCallback(ADC_HandleTypeDef* hadc)
mbed_official 237:f3da66175598 554 {
mbed_official 237:f3da66175598 555 /* NOTE : This function should not be modified. When the callback is needed,
mbed_official 237:f3da66175598 556 function HAL_ADC_ConvHalfCpltCallback must be implemented in the user file.
mbed_official 237:f3da66175598 557 */
mbed_official 237:f3da66175598 558 }
mbed_official 237:f3da66175598 559
mbed_official 237:f3da66175598 560 /**
mbed_official 237:f3da66175598 561 * @brief Analog watchdog callback in non blocking mode.
mbed_official 237:f3da66175598 562 * @note: In case of several analog watchdog enabled, if needed to know
mbed_official 237:f3da66175598 563 which one triggered and on which ADCx, check Analog Watchdog flag
mbed_official 237:f3da66175598 564 ADC_FLAG_AWD1/2/3 into HAL_ADC_LevelOutOfWindowCallback() function.
mbed_official 237:f3da66175598 565 For example:"if (__HAL_ADC_GET_FLAG(hadc1, ADC_FLAG_AWD1) != RESET)"
mbed_official 237:f3da66175598 566 * @param hadc: ADC handle
mbed_official 237:f3da66175598 567 * @retval None
mbed_official 237:f3da66175598 568 */
mbed_official 237:f3da66175598 569 __weak void HAL_ADC_LevelOutOfWindowCallback(ADC_HandleTypeDef* hadc)
mbed_official 237:f3da66175598 570 {
mbed_official 237:f3da66175598 571 /* NOTE : This function should not be modified. When the callback is needed,
mbed_official 237:f3da66175598 572 function HAL_ADC_LevelOoutOfWindowCallback must be implemented in the user file.
mbed_official 237:f3da66175598 573 */
mbed_official 237:f3da66175598 574 }
mbed_official 237:f3da66175598 575
mbed_official 237:f3da66175598 576 /**
mbed_official 237:f3da66175598 577 * @brief ADC error callback in non blocking mode
mbed_official 237:f3da66175598 578 * (ADC conversion with interruption or transfer by DMA)
mbed_official 237:f3da66175598 579 * @param hadc: ADC handle
mbed_official 237:f3da66175598 580 * @retval None
mbed_official 237:f3da66175598 581 */
mbed_official 237:f3da66175598 582 __weak void HAL_ADC_ErrorCallback(ADC_HandleTypeDef *hadc)
mbed_official 237:f3da66175598 583 {
mbed_official 237:f3da66175598 584 /* NOTE : This function should not be modified. When the callback is needed,
mbed_official 237:f3da66175598 585 function HAL_ADC_ErrorCallback must be implemented in the user file.
mbed_official 237:f3da66175598 586 */
mbed_official 237:f3da66175598 587 }
mbed_official 237:f3da66175598 588
mbed_official 237:f3da66175598 589 /**
mbed_official 237:f3da66175598 590 * @}
mbed_official 237:f3da66175598 591 */
mbed_official 237:f3da66175598 592
mbed_official 237:f3da66175598 593 /** @defgroup ADC_Group3 Peripheral Control functions
mbed_official 237:f3da66175598 594 * @brief Peripheral Control functions
mbed_official 237:f3da66175598 595 *
mbed_official 237:f3da66175598 596 @verbatim
mbed_official 237:f3da66175598 597 ===============================================================================
mbed_official 237:f3da66175598 598 ##### Peripheral Control functions #####
mbed_official 237:f3da66175598 599 ===============================================================================
mbed_official 237:f3da66175598 600 [..] This section provides functions allowing to:
mbed_official 237:f3da66175598 601 (+) Configure channels on regular group
mbed_official 237:f3da66175598 602 (+) Configure the analog watchdog
mbed_official 237:f3da66175598 603
mbed_official 237:f3da66175598 604 @endverbatim
mbed_official 237:f3da66175598 605 * @{
mbed_official 237:f3da66175598 606 */
mbed_official 237:f3da66175598 607
mbed_official 237:f3da66175598 608 /**
mbed_official 237:f3da66175598 609 * @brief Configures the the selected channel to be linked to the regular
mbed_official 237:f3da66175598 610 * group.
mbed_official 237:f3da66175598 611 * @note In case of usage of internal measurement channels:
mbed_official 237:f3da66175598 612 * Vbat/VrefInt/TempSensor.
mbed_official 237:f3da66175598 613 * The recommended sampling time is at least:
mbed_official 237:f3da66175598 614 * - For devices STM32F37x: 17.1us for temperature sensor
mbed_official 237:f3da66175598 615 * - For the other STM32F3 devices: 2.2us for each of channels
mbed_official 237:f3da66175598 616 * Vbat/VrefInt/TempSensor.
mbed_official 237:f3da66175598 617 * These internal paths can be be disabled using function
mbed_official 237:f3da66175598 618 * HAL_ADC_DeInit().
mbed_official 237:f3da66175598 619 * @note Possibility to update parameters on the fly:
mbed_official 237:f3da66175598 620 * This function initializes channel into regular group, following
mbed_official 237:f3da66175598 621 * calls to this function can be used to reconfigure some parameters
mbed_official 237:f3da66175598 622 * of structure "ADC_ChannelConfTypeDef" on the fly, without reseting
mbed_official 237:f3da66175598 623 * the ADC.
mbed_official 237:f3da66175598 624 * The setting of these parameters is conditioned to ADC state.
mbed_official 237:f3da66175598 625 * For parameters constraints, see comments of structure
mbed_official 237:f3da66175598 626 * "ADC_ChannelConfTypeDef".
mbed_official 237:f3da66175598 627 * @param hadc: ADC handle
mbed_official 237:f3da66175598 628 * @param sConfig: Structure of ADC channel for regular group.
mbed_official 237:f3da66175598 629 * @retval HAL status
mbed_official 237:f3da66175598 630 */
mbed_official 237:f3da66175598 631 __weak HAL_StatusTypeDef HAL_ADC_ConfigChannel(ADC_HandleTypeDef* hadc, ADC_ChannelConfTypeDef* sConfig)
mbed_official 237:f3da66175598 632 {
mbed_official 237:f3da66175598 633 /* Note : This function is defined into this file for library reference. */
mbed_official 237:f3da66175598 634 /* Function content is located into file stm32f3xx_hal_adc_ex.c */
mbed_official 237:f3da66175598 635
mbed_official 237:f3da66175598 636 /* Return function status */
mbed_official 237:f3da66175598 637 return HAL_OK;
mbed_official 237:f3da66175598 638 }
mbed_official 237:f3da66175598 639
mbed_official 237:f3da66175598 640 /**
mbed_official 237:f3da66175598 641 * @brief Configures the analog watchdog.
mbed_official 237:f3da66175598 642 * @note Possibility to update parameters on the fly:
mbed_official 237:f3da66175598 643 * This function initializes the selected analog watchdog, following
mbed_official 237:f3da66175598 644 * calls to this function can be used to reconfigure some parameters
mbed_official 237:f3da66175598 645 * of structure "ADC_AnalogWDGConfTypeDef" on the fly, without reseting
mbed_official 237:f3da66175598 646 * the ADC.
mbed_official 237:f3da66175598 647 * The setting of these parameters is conditioned to ADC state.
mbed_official 237:f3da66175598 648 * For parameters constraints, see comments of structure
mbed_official 237:f3da66175598 649 * "ADC_AnalogWDGConfTypeDef".
mbed_official 237:f3da66175598 650 * @param hadc: ADC handle
mbed_official 237:f3da66175598 651 * @param AnalogWDGConfig: Structure of ADC analog watchdog configuration
mbed_official 237:f3da66175598 652 * @retval HAL status
mbed_official 237:f3da66175598 653 */
mbed_official 237:f3da66175598 654 __weak HAL_StatusTypeDef HAL_ADC_AnalogWDGConfig(ADC_HandleTypeDef* hadc, ADC_AnalogWDGConfTypeDef* AnalogWDGConfig)
mbed_official 237:f3da66175598 655 {
mbed_official 237:f3da66175598 656 /* Note : This function is defined into this file for library reference. */
mbed_official 237:f3da66175598 657 /* Function content is located into file stm32f3xx_hal_adc_ex.c */
mbed_official 237:f3da66175598 658
mbed_official 237:f3da66175598 659 /* Return function status */
mbed_official 237:f3da66175598 660 return HAL_OK;
mbed_official 237:f3da66175598 661 }
mbed_official 237:f3da66175598 662
mbed_official 237:f3da66175598 663 /**
mbed_official 237:f3da66175598 664 * @}
mbed_official 237:f3da66175598 665 */
mbed_official 237:f3da66175598 666
mbed_official 237:f3da66175598 667 /** @defgroup ADC_Group4 ADC Peripheral State functions
mbed_official 237:f3da66175598 668 * @brief ADC Peripheral State functions
mbed_official 237:f3da66175598 669 *
mbed_official 237:f3da66175598 670 @verbatim
mbed_official 237:f3da66175598 671 ===============================================================================
mbed_official 237:f3da66175598 672 ##### Peripheral state and errors functions #####
mbed_official 237:f3da66175598 673 ===============================================================================
mbed_official 237:f3da66175598 674 [..]
mbed_official 237:f3da66175598 675 This subsection provides functions to get in run-time the status of the
mbed_official 237:f3da66175598 676 peripheral.
mbed_official 237:f3da66175598 677 (+) Check the ADC state
mbed_official 237:f3da66175598 678 (+) Check the ADC error code
mbed_official 237:f3da66175598 679
mbed_official 237:f3da66175598 680 @endverbatim
mbed_official 237:f3da66175598 681 * @{
mbed_official 237:f3da66175598 682 */
mbed_official 237:f3da66175598 683
mbed_official 237:f3da66175598 684 /**
mbed_official 237:f3da66175598 685 * @brief return the ADC state
mbed_official 237:f3da66175598 686 * @param hadc: ADC handle
mbed_official 237:f3da66175598 687 * @retval HAL state
mbed_official 237:f3da66175598 688 */
mbed_official 237:f3da66175598 689 HAL_ADC_StateTypeDef HAL_ADC_GetState(ADC_HandleTypeDef* hadc)
mbed_official 237:f3da66175598 690 {
mbed_official 237:f3da66175598 691 /* Check the parameters */
mbed_official 237:f3da66175598 692 assert_param(IS_ADC_ALL_INSTANCE(hadc->Instance));
mbed_official 237:f3da66175598 693
mbed_official 237:f3da66175598 694 /* Return ADC state */
mbed_official 237:f3da66175598 695 return hadc->State;
mbed_official 237:f3da66175598 696 }
mbed_official 237:f3da66175598 697
mbed_official 237:f3da66175598 698 /**
mbed_official 237:f3da66175598 699 * @brief Return the ADC error code
mbed_official 237:f3da66175598 700 * @param hadc: ADC handle
mbed_official 237:f3da66175598 701 * @retval ADC Error Code
mbed_official 237:f3da66175598 702 */
mbed_official 237:f3da66175598 703 uint32_t HAL_ADC_GetError(ADC_HandleTypeDef *hadc)
mbed_official 237:f3da66175598 704 {
mbed_official 237:f3da66175598 705 return hadc->ErrorCode;
mbed_official 237:f3da66175598 706 }
mbed_official 237:f3da66175598 707
mbed_official 237:f3da66175598 708 /**
mbed_official 237:f3da66175598 709 * @}
mbed_official 237:f3da66175598 710 */
mbed_official 237:f3da66175598 711
mbed_official 237:f3da66175598 712 /**
mbed_official 237:f3da66175598 713 * @}
mbed_official 237:f3da66175598 714 */
mbed_official 237:f3da66175598 715
mbed_official 237:f3da66175598 716 #endif /* HAL_ADC_MODULE_ENABLED */
mbed_official 237:f3da66175598 717 /**
mbed_official 237:f3da66175598 718 * @}
mbed_official 237:f3da66175598 719 */
mbed_official 237:f3da66175598 720
mbed_official 237:f3da66175598 721 /**
mbed_official 237:f3da66175598 722 * @}
mbed_official 237:f3da66175598 723 */
mbed_official 237:f3da66175598 724
mbed_official 237:f3da66175598 725 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/