my fork

Dependents:   Nucleo_blueNRG

Fork of mbed by mbed official

Committer:
filartrix
Date:
Wed Apr 08 14:12:53 2015 +0000
Revision:
97:4298809c7c9e
Parent:
96:487b796308b0
First reale BlueNRG module for nucleo 401 board

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bogdanm 84:0b3ab51c8877 1 /**
bogdanm 84:0b3ab51c8877 2 ******************************************************************************
bogdanm 84:0b3ab51c8877 3 * @file stm32l0xx_hal_adc.h
bogdanm 84:0b3ab51c8877 4 * @author MCD Application Team
Kojto 96:487b796308b0 5 * @version V1.2.0
Kojto 96:487b796308b0 6 * @date 06-February-2015
bogdanm 84:0b3ab51c8877 7 * @brief This file contains all the functions prototypes for the ADC firmware
bogdanm 84:0b3ab51c8877 8 * library.
bogdanm 84:0b3ab51c8877 9 ******************************************************************************
bogdanm 84:0b3ab51c8877 10 * @attention
bogdanm 84:0b3ab51c8877 11 *
Kojto 96:487b796308b0 12 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
bogdanm 84:0b3ab51c8877 13 *
bogdanm 84:0b3ab51c8877 14 * Redistribution and use in source and binary forms, with or without modification,
bogdanm 84:0b3ab51c8877 15 * are permitted provided that the following conditions are met:
bogdanm 84:0b3ab51c8877 16 * 1. Redistributions of source code must retain the above copyright notice,
bogdanm 84:0b3ab51c8877 17 * this list of conditions and the following disclaimer.
bogdanm 84:0b3ab51c8877 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
bogdanm 84:0b3ab51c8877 19 * this list of conditions and the following disclaimer in the documentation
bogdanm 84:0b3ab51c8877 20 * and/or other materials provided with the distribution.
bogdanm 84:0b3ab51c8877 21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
bogdanm 84:0b3ab51c8877 22 * may be used to endorse or promote products derived from this software
bogdanm 84:0b3ab51c8877 23 * without specific prior written permission.
bogdanm 84:0b3ab51c8877 24 *
bogdanm 84:0b3ab51c8877 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
bogdanm 84:0b3ab51c8877 26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
bogdanm 84:0b3ab51c8877 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
bogdanm 84:0b3ab51c8877 28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
bogdanm 84:0b3ab51c8877 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
bogdanm 84:0b3ab51c8877 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
bogdanm 84:0b3ab51c8877 31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
bogdanm 84:0b3ab51c8877 32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
bogdanm 84:0b3ab51c8877 33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
bogdanm 84:0b3ab51c8877 34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
bogdanm 84:0b3ab51c8877 35 *
bogdanm 84:0b3ab51c8877 36 ******************************************************************************
bogdanm 84:0b3ab51c8877 37 */
bogdanm 84:0b3ab51c8877 38
bogdanm 84:0b3ab51c8877 39 /* Define to prevent recursive inclusion -------------------------------------*/
bogdanm 84:0b3ab51c8877 40 #ifndef __STM32L0xx_ADC_H
bogdanm 84:0b3ab51c8877 41 #define __STM32L0xx_ADC_H
bogdanm 84:0b3ab51c8877 42
bogdanm 84:0b3ab51c8877 43 #ifdef __cplusplus
bogdanm 84:0b3ab51c8877 44 extern "C" {
bogdanm 84:0b3ab51c8877 45 #endif
bogdanm 84:0b3ab51c8877 46
bogdanm 84:0b3ab51c8877 47 /* Includes ------------------------------------------------------------------*/
bogdanm 84:0b3ab51c8877 48 #include "stm32l0xx_hal_def.h"
bogdanm 84:0b3ab51c8877 49
bogdanm 84:0b3ab51c8877 50 /** @addtogroup STM32L0xx_HAL_Driver
bogdanm 84:0b3ab51c8877 51 * @{
bogdanm 84:0b3ab51c8877 52 */
bogdanm 84:0b3ab51c8877 53
bogdanm 84:0b3ab51c8877 54 /** @addtogroup ADC
bogdanm 84:0b3ab51c8877 55 * @{
bogdanm 84:0b3ab51c8877 56 */
bogdanm 84:0b3ab51c8877 57
bogdanm 84:0b3ab51c8877 58 /* Exported types ------------------------------------------------------------*/
bogdanm 84:0b3ab51c8877 59 /**
bogdanm 84:0b3ab51c8877 60 * @brief HAL State structures definition
bogdanm 84:0b3ab51c8877 61 */
bogdanm 84:0b3ab51c8877 62 typedef enum
bogdanm 84:0b3ab51c8877 63 {
bogdanm 84:0b3ab51c8877 64 HAL_ADC_STATE_RESET = 0x00, /*!< ADC not yet initialized or disabled */
bogdanm 84:0b3ab51c8877 65 HAL_ADC_STATE_READY = 0x01, /*!< ADC peripheral ready for use */
bogdanm 84:0b3ab51c8877 66 HAL_ADC_STATE_BUSY = 0x02, /*!< An internal process is ongoing */
bogdanm 84:0b3ab51c8877 67 HAL_ADC_STATE_BUSY_REG = 0x12, /*!< Regular conversion is ongoing */
bogdanm 84:0b3ab51c8877 68 HAL_ADC_STATE_TIMEOUT = 0x03, /*!< Timeout state */
bogdanm 84:0b3ab51c8877 69 HAL_ADC_STATE_ERROR = 0x04, /*!< ADC state error */
bogdanm 84:0b3ab51c8877 70 HAL_ADC_STATE_EOC = 0x05, /*!< Conversion is completed */
bogdanm 84:0b3ab51c8877 71 HAL_ADC_STATE_AWD = 0x06, /*!< ADC state analog watchdog */
bogdanm 84:0b3ab51c8877 72 }HAL_ADC_StateTypeDef;
bogdanm 84:0b3ab51c8877 73
bogdanm 84:0b3ab51c8877 74
bogdanm 84:0b3ab51c8877 75 /**
bogdanm 84:0b3ab51c8877 76 * @brief ADC Oversampler structure definition
bogdanm 84:0b3ab51c8877 77 */
bogdanm 84:0b3ab51c8877 78 typedef struct
bogdanm 84:0b3ab51c8877 79 {
bogdanm 84:0b3ab51c8877 80 uint32_t Ratio; /*!< Configures the oversampling ratio.
bogdanm 84:0b3ab51c8877 81 This parameter can be a value of @ref ADC_Oversampling_Ratio */
bogdanm 84:0b3ab51c8877 82 uint32_t RightBitShift; /*!< Configures the division coefficient for the Oversampler.
bogdanm 84:0b3ab51c8877 83 This parameter can be a value of @ref ADC_Right_Bit_Shift */
bogdanm 84:0b3ab51c8877 84 uint32_t TriggeredMode; /*!< Selects the regular triggered oversampling mode
bogdanm 84:0b3ab51c8877 85 This parameter can be a value of @ref ADC_Triggered_Oversampling_Mode */
bogdanm 84:0b3ab51c8877 86
bogdanm 84:0b3ab51c8877 87 }ADC_OversamplingTypeDef;
bogdanm 84:0b3ab51c8877 88
bogdanm 84:0b3ab51c8877 89 /**
bogdanm 84:0b3ab51c8877 90 * @brief ADC Init structure definition
bogdanm 84:0b3ab51c8877 91 * @note The setting of these parameters with function HAL_ADC_Init() is conditioned by the ADC state.
bogdanm 84:0b3ab51c8877 92 * If ADC is not in the appropriate state to modify some parameters, these parameters setting is bypassed
bogdanm 84:0b3ab51c8877 93 * without error reporting (as it can be the expected behaviour in case of intended action to update antother parameter (which fullfills the ADC state condition) on the fly).
bogdanm 84:0b3ab51c8877 94 */
bogdanm 84:0b3ab51c8877 95 typedef struct
bogdanm 84:0b3ab51c8877 96 {
bogdanm 84:0b3ab51c8877 97 uint32_t OversamplingMode; /*!< Specifies whether the oversampling feature is enabled or disabled
bogdanm 84:0b3ab51c8877 98 This parameter can be set to ENABLE or DISABLE.
bogdanm 84:0b3ab51c8877 99 Note: This parameter can be modified only if there is no conversion is ongoing. */
bogdanm 84:0b3ab51c8877 100 ADC_OversamplingTypeDef Oversample; /*!< Specifies the Oversampling parameters
bogdanm 84:0b3ab51c8877 101 Note: This parameter can be modified only if there is no conversion is ongoing. */
bogdanm 84:0b3ab51c8877 102 uint32_t ClockPrescaler; /*!< Selects the ADC clock frequency.
bogdanm 84:0b3ab51c8877 103 This parameter can be a value of @ref ADC_ClockPrescaler
bogdanm 84:0b3ab51c8877 104 Note: This parameter can be modified only if ADC is disabled. */
bogdanm 84:0b3ab51c8877 105 uint32_t Resolution; /*!< Configures the ADC resolution mode.
bogdanm 84:0b3ab51c8877 106 This parameter can be a value of @ref ADC_Resolution
bogdanm 84:0b3ab51c8877 107 Note: This parameter can be modified only if ADC is disabled. */
bogdanm 84:0b3ab51c8877 108 uint32_t SamplingTime; /*!< The sample time value to be set for all channels.
bogdanm 92:4fc01daae5a5 109 This parameter can be a value of @ref ADC_sampling_times
bogdanm 92:4fc01daae5a5 110 Note: This parameter can be modified only if there is no conversion ongoing. */
Kojto 96:487b796308b0 111 uint32_t ScanConvMode; /*!< The scan sequence direction.
Kojto 96:487b796308b0 112 This parameter can be a value of @ref ADC_Scan_mode
bogdanm 84:0b3ab51c8877 113 Note: This parameter can be modified only if there is no conversion is ongoing. */
bogdanm 84:0b3ab51c8877 114 uint32_t DataAlign; /*!< Specifies whether the ADC data alignment is left or right.
bogdanm 92:4fc01daae5a5 115 This parameter can be a value of @ref ADC_data_align
bogdanm 84:0b3ab51c8877 116 Note: This parameter can be modified only if there is no conversion is ongoing. */
bogdanm 84:0b3ab51c8877 117 uint32_t ContinuousConvMode; /*!< Specifies whether the conversion is performed in Continuous or Single mode.
bogdanm 84:0b3ab51c8877 118 This parameter can be set to ENABLE or DISABLE.
bogdanm 84:0b3ab51c8877 119 Note: This parameter can be modified only if there is no conversion is ongoing. */
bogdanm 84:0b3ab51c8877 120 uint32_t DiscontinuousConvMode; /*!< Specifies whether the conversion is performed
bogdanm 84:0b3ab51c8877 121 in Complete-sequence/Discontinuous-sequence.
bogdanm 84:0b3ab51c8877 122 Discontinuous mode can be enabled only if continuous mode is disabled.
bogdanm 84:0b3ab51c8877 123 This parameter can be set to ENABLE or DISABLE.
bogdanm 84:0b3ab51c8877 124 Note: This parameter can be modified only if there is no conversion is ongoing. */
bogdanm 84:0b3ab51c8877 125 uint32_t ExternalTrigConvEdge; /*!< Select the external trigger edge and enable the trigger.
Kojto 96:487b796308b0 126 This parameter can be a value of @ref ADC_Regular_External_Trigger_Source_Edge
bogdanm 84:0b3ab51c8877 127 Note: This parameter can be modified only if there is no conversion is ongoing. */
bogdanm 84:0b3ab51c8877 128 uint32_t ExternalTrigConv; /*!< Select the external event used to trigger the start of conversion.
bogdanm 92:4fc01daae5a5 129 This parameter can be a value of @ref ADC_External_trigger_Source
bogdanm 84:0b3ab51c8877 130 Note: This parameter can be modified only if there is no conversion is ongoing. */
bogdanm 84:0b3ab51c8877 131 uint32_t DMAContinuousRequests; /*!< Specifies whether the DMA requests are performed in one shot mode (DMA transfer stop when number of conversions is reached)
bogdanm 84:0b3ab51c8877 132 or in Continuous mode (DMA transfer unlimited, whatever number of conversions).
bogdanm 84:0b3ab51c8877 133 Note: In continuous mode, DMA must be configured in circular mode. Otherwise an overrun will be triggered when DMA buffer max pointer is reached.
bogdanm 84:0b3ab51c8877 134 This parameter can be set to ENABLE or DISABLE.
bogdanm 84:0b3ab51c8877 135 Note: This parameter can be modified only if there is no conversion is ongoing. */
bogdanm 84:0b3ab51c8877 136 uint32_t EOCSelection; /*!< Specifies what EOC (End Of Conversion) flag is used for conversion polling and interruption:
bogdanm 84:0b3ab51c8877 137 end of single channel conversion or end of channels conversions sequence.
bogdanm 92:4fc01daae5a5 138 This parameter can be a value of @ref ADC_EOCSelection */
bogdanm 84:0b3ab51c8877 139 uint32_t Overrun; /*!< Select the behaviour in case of overrun: data preserved or overwritten
bogdanm 84:0b3ab51c8877 140 This parameter has an effect on regular channels only, including in DMA mode.
bogdanm 92:4fc01daae5a5 141 This parameter can be a value of @ref ADC_Overrun
bogdanm 84:0b3ab51c8877 142 Note: This parameter can be modified only if there is no conversion is ongoing. */
bogdanm 84:0b3ab51c8877 143 uint32_t LowPowerAutoWait; /*!< Specifies the usage of dynamic low power Auto Delay: new conversion start only
bogdanm 84:0b3ab51c8877 144 when the previous conversion (for regular channel) is completed.
bogdanm 84:0b3ab51c8877 145 This avoids risk of overrun for low frequency application.
bogdanm 84:0b3ab51c8877 146 This parameter can be set to ENABLE or DISABLE.
bogdanm 84:0b3ab51c8877 147 Note: This parameter can be modified only if there is no conversion is ongoing. */
bogdanm 84:0b3ab51c8877 148 uint32_t LowPowerFrequencyMode; /*!< When selecting an analog ADC clock frequency lower than 2.8MHz,
bogdanm 84:0b3ab51c8877 149 it is mandatory to first enable the Low Frequency Mode.
bogdanm 84:0b3ab51c8877 150 This parameter can be set to ENABLE or DISABLE.
bogdanm 84:0b3ab51c8877 151 Note: This parameter can be modified only if there is no conversion is ongoing. */
Kojto 96:487b796308b0 152 uint32_t LowPowerAutoPowerOff; /*!< When setting the AutoOff feature, the ADC is always powered off when not converting and automatically
bogdanm 84:0b3ab51c8877 153 wakes-up when a conversion is started (by software or hardware trigger).
bogdanm 84:0b3ab51c8877 154 This parameter can be set to ENABLE or DISABLE.
bogdanm 84:0b3ab51c8877 155 Note: This parameter can be modified only if there is no conversion is ongoing. */
bogdanm 84:0b3ab51c8877 156 }ADC_InitTypeDef;
bogdanm 84:0b3ab51c8877 157
bogdanm 84:0b3ab51c8877 158 /**
bogdanm 84:0b3ab51c8877 159 * @brief ADC handle Structure definition
bogdanm 84:0b3ab51c8877 160 */
bogdanm 84:0b3ab51c8877 161 typedef struct __ADC_HandleTypeDef
bogdanm 84:0b3ab51c8877 162 {
bogdanm 84:0b3ab51c8877 163 ADC_TypeDef *Instance; /*!< Register base address */
bogdanm 84:0b3ab51c8877 164
bogdanm 84:0b3ab51c8877 165 ADC_InitTypeDef Init; /*!< ADC required parameters */
bogdanm 84:0b3ab51c8877 166
bogdanm 84:0b3ab51c8877 167 DMA_HandleTypeDef *DMA_Handle; /*!< Pointer DMA Handler */
bogdanm 84:0b3ab51c8877 168
bogdanm 84:0b3ab51c8877 169 HAL_LockTypeDef Lock; /*!< ADC locking object */
bogdanm 84:0b3ab51c8877 170
bogdanm 84:0b3ab51c8877 171 __IO HAL_ADC_StateTypeDef State; /*!< ADC communication state */
bogdanm 84:0b3ab51c8877 172
bogdanm 84:0b3ab51c8877 173 __IO uint32_t ErrorCode; /*!< ADC Error code */
bogdanm 84:0b3ab51c8877 174 }ADC_HandleTypeDef;
bogdanm 84:0b3ab51c8877 175
bogdanm 84:0b3ab51c8877 176 /**
bogdanm 84:0b3ab51c8877 177 * @brief ADC Configuration regular Channel structure definition
bogdanm 84:0b3ab51c8877 178 */
bogdanm 84:0b3ab51c8877 179 typedef struct
bogdanm 84:0b3ab51c8877 180 {
bogdanm 84:0b3ab51c8877 181 uint32_t Channel; /*!< the ADC channel to configure
bogdanm 84:0b3ab51c8877 182 This parameter can be a value of @ref ADC_channels */
bogdanm 84:0b3ab51c8877 183 }ADC_ChannelConfTypeDef;
bogdanm 84:0b3ab51c8877 184
bogdanm 84:0b3ab51c8877 185
bogdanm 84:0b3ab51c8877 186 /**
bogdanm 84:0b3ab51c8877 187 * @brief ADC Configuration analog watchdog definition
bogdanm 84:0b3ab51c8877 188 */
bogdanm 84:0b3ab51c8877 189 typedef struct
bogdanm 84:0b3ab51c8877 190 {
bogdanm 84:0b3ab51c8877 191 uint32_t WatchdogMode; /*!< Configures the ADC analog watchdog mode: single/all channels.
bogdanm 92:4fc01daae5a5 192 This parameter can be a value of @ref ADC_analog_watchdog_mode */
bogdanm 84:0b3ab51c8877 193 uint32_t Channel; /*!< Selects which ADC channel to monitor by analog watchdog.
bogdanm 84:0b3ab51c8877 194 This parameter has an effect only if watchdog mode is configured on single channel (parameter WatchdogMode)
bogdanm 92:4fc01daae5a5 195 This parameter can be a value of @ref ADC_channels */
bogdanm 84:0b3ab51c8877 196 uint32_t ITMode; /*!< Specifies whether the analog watchdog is configured in interrupt or polling mode.
bogdanm 84:0b3ab51c8877 197 This parameter can be set to ENABLE or DISABLE */
bogdanm 84:0b3ab51c8877 198 uint32_t HighThreshold; /*!< Configures the ADC analog watchdog High threshold value.
bogdanm 84:0b3ab51c8877 199 Depending of ADC resolution selected (12, 10, 8 or 6 bits),
bogdanm 84:0b3ab51c8877 200 this parameter must be a number between Min_Data = 0x000 and Max_Data = 0xFFF, 0x3FF, 0xFF or 0x3F respectively. */
bogdanm 84:0b3ab51c8877 201 uint32_t LowThreshold; /*!< Configures the ADC analog watchdog High threshold value.
bogdanm 84:0b3ab51c8877 202 Depending of ADC resolution selected (12, 10, 8 or 6 bits),
bogdanm 84:0b3ab51c8877 203 this parameter must be a number between Min_Data = 0x000 and Max_Data = 0xFFF, 0x3FF, 0xFF or 0x3F respectively. */
bogdanm 84:0b3ab51c8877 204 }ADC_AnalogWDGConfTypeDef;
bogdanm 84:0b3ab51c8877 205
bogdanm 84:0b3ab51c8877 206
bogdanm 84:0b3ab51c8877 207 /* Exported constants --------------------------------------------------------*/
bogdanm 84:0b3ab51c8877 208
bogdanm 84:0b3ab51c8877 209 /** @defgroup ADC_Exported_Constants
bogdanm 84:0b3ab51c8877 210 * @{
bogdanm 84:0b3ab51c8877 211 */
bogdanm 84:0b3ab51c8877 212
bogdanm 84:0b3ab51c8877 213 /** @defgroup ADC_Error_Code
bogdanm 84:0b3ab51c8877 214 * @{
bogdanm 84:0b3ab51c8877 215 */
bogdanm 84:0b3ab51c8877 216 #define HAL_ADC_ERROR_NONE ((uint32_t)0x00) /*!< No error */
bogdanm 84:0b3ab51c8877 217 #define HAL_ADC_ERROR_INTERNAL ((uint32_t)0x01) /*!< ADC IP internal error: if problem of clocking,
bogdanm 84:0b3ab51c8877 218 enable/disable, erroneous state */
Kojto 96:487b796308b0 219 #define HAL_ADC_ERROR_OVR ((uint32_t)0x02) /*!< OVR error */
Kojto 96:487b796308b0 220 #define HAL_ADC_ERROR_DMA ((uint32_t)0x03) /*!< DMA transfer error */
bogdanm 84:0b3ab51c8877 221 /**
bogdanm 84:0b3ab51c8877 222 * @}
bogdanm 84:0b3ab51c8877 223 */
bogdanm 84:0b3ab51c8877 224
bogdanm 84:0b3ab51c8877 225 /** @defgroup ADC_TimeOut_Values
bogdanm 84:0b3ab51c8877 226 * @{
bogdanm 84:0b3ab51c8877 227 */
bogdanm 84:0b3ab51c8877 228
bogdanm 84:0b3ab51c8877 229 /* Fixed timeout values for ADC calibration, enable settling time, disable */
bogdanm 84:0b3ab51c8877 230 /* settling time. */
bogdanm 84:0b3ab51c8877 231 /* Values defined to be higher than worst cases: low clocks freq, */
bogdanm 84:0b3ab51c8877 232 /* maximum prescalers. */
bogdanm 84:0b3ab51c8877 233 /* Unit: ms */
bogdanm 84:0b3ab51c8877 234 #define ADC_ENABLE_TIMEOUT 10
bogdanm 84:0b3ab51c8877 235 #define ADC_DISABLE_TIMEOUT 10
bogdanm 84:0b3ab51c8877 236 #define ADC_STOP_CONVERSION_TIMEOUT 10
bogdanm 84:0b3ab51c8877 237
bogdanm 84:0b3ab51c8877 238 /* Delay of 10us fixed to worst case: maximum CPU frequency 180MHz to have */
bogdanm 84:0b3ab51c8877 239 /* the minimum number of CPU cycles to fulfill this delay */
bogdanm 84:0b3ab51c8877 240 #define ADC_DELAY_10US_MIN_CPU_CYCLES 1800
bogdanm 84:0b3ab51c8877 241 /**
bogdanm 84:0b3ab51c8877 242 * @}
bogdanm 84:0b3ab51c8877 243 */
bogdanm 84:0b3ab51c8877 244
bogdanm 84:0b3ab51c8877 245 /** @defgroup ADC_ClockPrescaler
bogdanm 84:0b3ab51c8877 246 * @{
bogdanm 84:0b3ab51c8877 247 */
bogdanm 84:0b3ab51c8877 248 #define ADC_CLOCK_ASYNC_DIV1 ((uint32_t)0x00000000) /*!< ADC Asynchronous clock mode divided by 1 */
bogdanm 84:0b3ab51c8877 249 #define ADC_CLOCK_ASYNC_DIV2 (ADC_CCR_PRESC_0) /*!< ADC Asynchronous clock mode divided by 2 */
bogdanm 84:0b3ab51c8877 250 #define ADC_CLOCK_ASYNC_DIV4 (ADC_CCR_PRESC_1) /*!< ADC Asynchronous clock mode divided by 2 */
bogdanm 84:0b3ab51c8877 251 #define ADC_CLOCK_ASYNC_DIV6 (ADC_CCR_PRESC_1 | ADC_CCR_PRESC_0) /*!< ADC Asynchronous clock mode divided by 2 */
bogdanm 84:0b3ab51c8877 252 #define ADC_CLOCK_ASYNC_DIV8 (ADC_CCR_PRESC_2) /*!< ADC Asynchronous clock mode divided by 2 */
bogdanm 84:0b3ab51c8877 253 #define ADC_CLOCK_ASYNC_DIV10 (ADC_CCR_PRESC_2 | ADC_CCR_PRESC_0) /*!< ADC Asynchronous clock mode divided by 2 */
bogdanm 84:0b3ab51c8877 254 #define ADC_CLOCK_ASYNC_DIV12 (ADC_CCR_PRESC_2 | ADC_CCR_PRESC_1) /*!< ADC Asynchronous clock mode divided by 2 */
bogdanm 84:0b3ab51c8877 255 #define ADC_CLOCK_ASYNC_DIV16 (ADC_CCR_PRESC_2 | ADC_CCR_PRESC_1 | ADC_CCR_PRESC_0) /*!< ADC Asynchronous clock mode divided by 2 */
bogdanm 84:0b3ab51c8877 256 #define ADC_CLOCK_ASYNC_DIV32 (ADC_CCR_PRESC_3) /*!< ADC Asynchronous clock mode divided by 2 */
bogdanm 84:0b3ab51c8877 257 #define ADC_CLOCK_ASYNC_DIV64 (ADC_CCR_PRESC_3 | ADC_CCR_PRESC_0) /*!< ADC Asynchronous clock mode divided by 2 */
bogdanm 84:0b3ab51c8877 258 #define ADC_CLOCK_ASYNC_DIV128 (ADC_CCR_PRESC_3 | ADC_CCR_PRESC_1) /*!< ADC Asynchronous clock mode divided by 2 */
bogdanm 84:0b3ab51c8877 259 #define ADC_CLOCK_ASYNC_DIV256 (ADC_CCR_PRESC_3 | ADC_CCR_PRESC_1 | ADC_CCR_PRESC_0) /*!< ADC Asynchronous clock mode divided by 2 */
bogdanm 84:0b3ab51c8877 260
Kojto 96:487b796308b0 261 #define ADC_CLOCK_SYNC_PCLK_DIV1 ((uint32_t)ADC_CFGR2_CKMODE_0) /*!< Synchronous clock mode divided by 1
Kojto 96:487b796308b0 262 This configuration must be enabled only if PCLK has a 50%
Kojto 96:487b796308b0 263 duty clock cycle (APB prescaler configured inside the RCC must be bypassed and the system clock
Kojto 96:487b796308b0 264 must by 50% duty cycle)*/
Kojto 96:487b796308b0 265 #define ADC_CLOCK_SYNC_PCLK_DIV2 ((uint32_t)ADC_CFGR2_CKMODE_1) /*!< Synchronous clock mode divided by 2 */
Kojto 96:487b796308b0 266 #define ADC_CLOCK_SYNC_PCLK_DIV4 ((uint32_t)ADC_CFGR2_CKMODE) /*!< Synchronous clock mode divided by 4 */
bogdanm 84:0b3ab51c8877 267
bogdanm 84:0b3ab51c8877 268 #define IS_ADC_CLOCKPRESCALER(ADC_CLOCK) (((ADC_CLOCK) == ADC_CLOCK_ASYNC_DIV1) ||\
Kojto 96:487b796308b0 269 ((ADC_CLOCK) == ADC_CLOCK_SYNC_PCLK_DIV1) ||\
Kojto 96:487b796308b0 270 ((ADC_CLOCK) == ADC_CLOCK_SYNC_PCLK_DIV2) ||\
Kojto 96:487b796308b0 271 ((ADC_CLOCK) == ADC_CLOCK_SYNC_PCLK_DIV4) ||\
bogdanm 84:0b3ab51c8877 272 ((ADC_CLOCK) == ADC_CLOCK_ASYNC_DIV1 ) ||\
bogdanm 84:0b3ab51c8877 273 ((ADC_CLOCK) == ADC_CLOCK_ASYNC_DIV2 ) ||\
bogdanm 84:0b3ab51c8877 274 ((ADC_CLOCK) == ADC_CLOCK_ASYNC_DIV4 ) ||\
bogdanm 84:0b3ab51c8877 275 ((ADC_CLOCK) == ADC_CLOCK_ASYNC_DIV6 ) ||\
bogdanm 84:0b3ab51c8877 276 ((ADC_CLOCK) == ADC_CLOCK_ASYNC_DIV8 ) ||\
bogdanm 84:0b3ab51c8877 277 ((ADC_CLOCK) == ADC_CLOCK_ASYNC_DIV10 ) ||\
bogdanm 84:0b3ab51c8877 278 ((ADC_CLOCK) == ADC_CLOCK_ASYNC_DIV12 ) ||\
bogdanm 84:0b3ab51c8877 279 ((ADC_CLOCK) == ADC_CLOCK_ASYNC_DIV16 ) ||\
bogdanm 84:0b3ab51c8877 280 ((ADC_CLOCK) == ADC_CLOCK_ASYNC_DIV32 ) ||\
bogdanm 84:0b3ab51c8877 281 ((ADC_CLOCK) == ADC_CLOCK_ASYNC_DIV64 ) ||\
bogdanm 84:0b3ab51c8877 282 ((ADC_CLOCK) == ADC_CLOCK_ASYNC_DIV128 ) ||\
bogdanm 84:0b3ab51c8877 283 ((ADC_CLOCK) == ADC_CLOCK_ASYNC_DIV256))
bogdanm 84:0b3ab51c8877 284 /**
bogdanm 84:0b3ab51c8877 285 * @}
bogdanm 84:0b3ab51c8877 286 */
bogdanm 84:0b3ab51c8877 287
bogdanm 84:0b3ab51c8877 288 /** @defgroup ADC_Resolution
bogdanm 84:0b3ab51c8877 289 * @{
bogdanm 84:0b3ab51c8877 290 */
Kojto 96:487b796308b0 291 #define ADC_RESOLUTION_12B ((uint32_t)0x00000000) /*!< ADC 12-bit resolution */
Kojto 96:487b796308b0 292 #define ADC_RESOLUTION_10B ((uint32_t)ADC_CFGR1_RES_0) /*!< ADC 10-bit resolution */
Kojto 96:487b796308b0 293 #define ADC_RESOLUTION_8B ((uint32_t)ADC_CFGR1_RES_1) /*!< ADC 8-bit resolution */
Kojto 96:487b796308b0 294 #define ADC_RESOLUTION_6B ((uint32_t)ADC_CFGR1_RES) /*!< ADC 6-bit resolution */
bogdanm 84:0b3ab51c8877 295
Kojto 96:487b796308b0 296 #define IS_ADC_RESOLUTION(RESOLUTION) (((RESOLUTION) == ADC_RESOLUTION_12B) || \
Kojto 96:487b796308b0 297 ((RESOLUTION) == ADC_RESOLUTION_10B) || \
Kojto 96:487b796308b0 298 ((RESOLUTION) == ADC_RESOLUTION_8B) || \
Kojto 96:487b796308b0 299 ((RESOLUTION) == ADC_RESOLUTION_6B))
bogdanm 84:0b3ab51c8877 300
Kojto 96:487b796308b0 301 #define IS_ADC_RESOLUTION_8_6_BITS(RESOLUTION) (((RESOLUTION) == ADC_RESOLUTION_8B) || \
Kojto 96:487b796308b0 302 ((RESOLUTION) == ADC_RESOLUTION_6B))
bogdanm 84:0b3ab51c8877 303 /**
bogdanm 84:0b3ab51c8877 304 * @}
bogdanm 84:0b3ab51c8877 305 */
bogdanm 84:0b3ab51c8877 306
bogdanm 84:0b3ab51c8877 307 /** @defgroup ADC_data_align
bogdanm 84:0b3ab51c8877 308 * @{
bogdanm 84:0b3ab51c8877 309 */
bogdanm 84:0b3ab51c8877 310 #define ADC_DATAALIGN_RIGHT ((uint32_t)0x00000000)
bogdanm 84:0b3ab51c8877 311 #define ADC_DATAALIGN_LEFT ((uint32_t)ADC_CFGR1_ALIGN)
bogdanm 84:0b3ab51c8877 312
bogdanm 84:0b3ab51c8877 313 #define IS_ADC_DATA_ALIGN(ALIGN) (((ALIGN) == ADC_DATAALIGN_RIGHT) || \
bogdanm 84:0b3ab51c8877 314 ((ALIGN) == ADC_DATAALIGN_LEFT))
bogdanm 84:0b3ab51c8877 315 /**
bogdanm 84:0b3ab51c8877 316 * @}
bogdanm 84:0b3ab51c8877 317 */
bogdanm 84:0b3ab51c8877 318
Kojto 96:487b796308b0 319 /** @defgroup ADC_Regular_External_Trigger_Source_Edge ADC External Trigger Source Edge for Regular Group
bogdanm 84:0b3ab51c8877 320 * @{
bogdanm 84:0b3ab51c8877 321 */
Kojto 96:487b796308b0 322 #define ADC_EXTERNALTRIGCONVEDGE_NONE ((uint32_t)0x00000000)
Kojto 96:487b796308b0 323 #define ADC_EXTERNALTRIGCONVEDGE_RISING ((uint32_t)ADC_CFGR1_EXTEN_0)
Kojto 96:487b796308b0 324 #define ADC_EXTERNALTRIGCONVEDGE_FALLING ((uint32_t)ADC_CFGR1_EXTEN_1)
Kojto 96:487b796308b0 325 #define ADC_EXTERNALTRIGCONVEDGE_RISINGFALLING ((uint32_t)ADC_CFGR1_EXTEN)
bogdanm 84:0b3ab51c8877 326
Kojto 96:487b796308b0 327 #define IS_ADC_EXTTRIG_EDGE(EDGE) (((EDGE) == ADC_EXTERNALTRIGCONVEDGE_NONE) || \
Kojto 96:487b796308b0 328 ((EDGE) == ADC_EXTERNALTRIGCONVEDGE_RISING) || \
Kojto 96:487b796308b0 329 ((EDGE) == ADC_EXTERNALTRIGCONVEDGE_FALLING) || \
Kojto 96:487b796308b0 330 ((EDGE) == ADC_EXTERNALTRIGCONVEDGE_RISINGFALLING))
bogdanm 84:0b3ab51c8877 331 /**
bogdanm 84:0b3ab51c8877 332 * @}
bogdanm 84:0b3ab51c8877 333 */
bogdanm 84:0b3ab51c8877 334
bogdanm 84:0b3ab51c8877 335 /** @defgroup ADC_External_trigger_Source
bogdanm 84:0b3ab51c8877 336 * @{
bogdanm 84:0b3ab51c8877 337 */
Kojto 96:487b796308b0 338 #define ADC_EXTERNALTRIGCONV_T6_TRGO ((uint32_t)0x00000000)
Kojto 96:487b796308b0 339 #define ADC_EXTERNALTRIGCONV_T21_CC2 ADC_CFGR1_EXTSEL_0
Kojto 96:487b796308b0 340 #define ADC_EXTERNALTRIGCONV_T2_TRGO ADC_CFGR1_EXTSEL_1
Kojto 96:487b796308b0 341 #define ADC_EXTERNALTRIGCONV_T2_CC4 ((uint32_t)0x000000C0)
Kojto 96:487b796308b0 342 #define ADC_EXTERNALTRIGCONV_T22_TRGO ADC_CFGR1_EXTSEL_2
Kojto 96:487b796308b0 343 #define ADC_EXTERNALTRIGCONV_EXT_IT11 ADC_CFGR1_EXTSEL
bogdanm 84:0b3ab51c8877 344
Kojto 96:487b796308b0 345 #define IS_ADC_EXTERNAL_TRIG_CONV(CONV) (((CONV) == ADC_EXTERNALTRIGCONV_T6_TRGO ) || \
Kojto 96:487b796308b0 346 ((CONV) == ADC_EXTERNALTRIGCONV_T21_CC2 ) || \
Kojto 96:487b796308b0 347 ((CONV) == ADC_EXTERNALTRIGCONV_T2_TRGO ) || \
Kojto 96:487b796308b0 348 ((CONV) == ADC_EXTERNALTRIGCONV_T2_CC4 ) || \
Kojto 96:487b796308b0 349 ((CONV) == ADC_EXTERNALTRIGCONV_T22_TRGO ) || \
Kojto 96:487b796308b0 350 ((CONV) == ADC_EXTERNALTRIGCONV_EXT_IT11 ))
bogdanm 84:0b3ab51c8877 351
bogdanm 84:0b3ab51c8877 352 /**
bogdanm 84:0b3ab51c8877 353 * @}
bogdanm 84:0b3ab51c8877 354 */
bogdanm 84:0b3ab51c8877 355
bogdanm 84:0b3ab51c8877 356 /** @defgroup ADC_EOCSelection
bogdanm 84:0b3ab51c8877 357 * @{
bogdanm 84:0b3ab51c8877 358 */
Kojto 96:487b796308b0 359 #define ADC_EOC_SINGLE_CONV ((uint32_t) ADC_ISR_EOC)
Kojto 96:487b796308b0 360 #define ADC_EOC_SEQ_CONV ((uint32_t) ADC_ISR_EOS)
Kojto 96:487b796308b0 361 #define ADC_EOC_SINGLE_SEQ_CONV ((uint32_t)(ADC_ISR_EOC | ADC_ISR_EOS)) /*!< reserved for future use */
bogdanm 84:0b3ab51c8877 362
Kojto 96:487b796308b0 363 #define IS_ADC_EOC_SELECTION(EOC_SELECTION) (((EOC_SELECTION) == ADC_EOC_SINGLE_CONV) || \
Kojto 96:487b796308b0 364 ((EOC_SELECTION) == ADC_EOC_SEQ_CONV) || \
Kojto 96:487b796308b0 365 ((EOC_SELECTION) == ADC_EOC_SINGLE_SEQ_CONV))
bogdanm 84:0b3ab51c8877 366 /**
bogdanm 84:0b3ab51c8877 367 * @}
bogdanm 84:0b3ab51c8877 368 */
bogdanm 84:0b3ab51c8877 369
bogdanm 84:0b3ab51c8877 370 /** @defgroup ADC_Overrun
bogdanm 84:0b3ab51c8877 371 * @{
bogdanm 84:0b3ab51c8877 372 */
Kojto 96:487b796308b0 373 #define ADC_OVR_DATA_PRESERVED ((uint32_t)0x00000000)
Kojto 96:487b796308b0 374 #define ADC_OVR_DATA_OVERWRITTEN ((uint32_t)ADC_CFGR1_OVRMOD)
bogdanm 84:0b3ab51c8877 375
Kojto 96:487b796308b0 376 #define IS_ADC_OVERRUN(OVR) (((OVR) == ADC_OVR_DATA_PRESERVED) || \
Kojto 96:487b796308b0 377 ((OVR) == ADC_OVR_DATA_OVERWRITTEN))
bogdanm 84:0b3ab51c8877 378 /**
bogdanm 84:0b3ab51c8877 379 * @}
bogdanm 84:0b3ab51c8877 380 */
bogdanm 84:0b3ab51c8877 381
bogdanm 84:0b3ab51c8877 382 /** @defgroup ADC_channels
bogdanm 84:0b3ab51c8877 383 * @{
bogdanm 84:0b3ab51c8877 384 */
bogdanm 84:0b3ab51c8877 385 #define ADC_CHANNEL_0 ((uint32_t)(ADC_CHSELR_CHSEL0))
bogdanm 84:0b3ab51c8877 386 #define ADC_CHANNEL_1 ((uint32_t)(ADC_CHSELR_CHSEL1) | ADC_CFGR1_AWDCH_0)
bogdanm 84:0b3ab51c8877 387 #define ADC_CHANNEL_2 ((uint32_t)(ADC_CHSELR_CHSEL2) | ADC_CFGR1_AWDCH_1)
bogdanm 84:0b3ab51c8877 388 #define ADC_CHANNEL_3 ((uint32_t)(ADC_CHSELR_CHSEL3)| ADC_CFGR1_AWDCH_1 | ADC_CFGR1_AWDCH_0)
bogdanm 84:0b3ab51c8877 389 #define ADC_CHANNEL_4 ((uint32_t)(ADC_CHSELR_CHSEL4)| ADC_CFGR1_AWDCH_2)
bogdanm 84:0b3ab51c8877 390 #define ADC_CHANNEL_5 ((uint32_t)(ADC_CHSELR_CHSEL5)| ADC_CFGR1_AWDCH_2| ADC_CFGR1_AWDCH_0)
bogdanm 84:0b3ab51c8877 391 #define ADC_CHANNEL_6 ((uint32_t)(ADC_CHSELR_CHSEL6)| ADC_CFGR1_AWDCH_2| ADC_CFGR1_AWDCH_1)
bogdanm 84:0b3ab51c8877 392 #define ADC_CHANNEL_7 ((uint32_t)(ADC_CHSELR_CHSEL7)| ADC_CFGR1_AWDCH_2| ADC_CFGR1_AWDCH_1 | ADC_CFGR1_AWDCH_0)
bogdanm 84:0b3ab51c8877 393 #define ADC_CHANNEL_8 ((uint32_t)(ADC_CHSELR_CHSEL8)| ADC_CFGR1_AWDCH_3)
bogdanm 84:0b3ab51c8877 394 #define ADC_CHANNEL_9 ((uint32_t)(ADC_CHSELR_CHSEL9)| ADC_CFGR1_AWDCH_3| ADC_CFGR1_AWDCH_0)
bogdanm 84:0b3ab51c8877 395 #define ADC_CHANNEL_10 ((uint32_t)(ADC_CHSELR_CHSEL10)| ADC_CFGR1_AWDCH_3| ADC_CFGR1_AWDCH_1)
bogdanm 84:0b3ab51c8877 396 #define ADC_CHANNEL_11 ((uint32_t)(ADC_CHSELR_CHSEL11)| ADC_CFGR1_AWDCH_3| ADC_CFGR1_AWDCH_1| ADC_CFGR1_AWDCH_0)
bogdanm 84:0b3ab51c8877 397 #define ADC_CHANNEL_12 ((uint32_t)(ADC_CHSELR_CHSEL12)| ADC_CFGR1_AWDCH_3| ADC_CFGR1_AWDCH_2)
bogdanm 84:0b3ab51c8877 398 #define ADC_CHANNEL_13 ((uint32_t)(ADC_CHSELR_CHSEL13)| ADC_CFGR1_AWDCH_3| ADC_CFGR1_AWDCH_2| ADC_CFGR1_AWDCH_0)
bogdanm 84:0b3ab51c8877 399 #define ADC_CHANNEL_14 ((uint32_t)(ADC_CHSELR_CHSEL14)| ADC_CFGR1_AWDCH_3| ADC_CFGR1_AWDCH_2| ADC_CFGR1_AWDCH_1)
bogdanm 84:0b3ab51c8877 400 #define ADC_CHANNEL_15 ((uint32_t)(ADC_CHSELR_CHSEL15)| ADC_CFGR1_AWDCH_3| ADC_CFGR1_AWDCH_2| ADC_CFGR1_AWDCH_1| ADC_CFGR1_AWDCH_0)
bogdanm 84:0b3ab51c8877 401 #define ADC_CHANNEL_16 ((uint32_t)(ADC_CHSELR_CHSEL16)| ADC_CFGR1_AWDCH_4)
bogdanm 84:0b3ab51c8877 402 #define ADC_CHANNEL_17 ((uint32_t)(ADC_CHSELR_CHSEL17)| ADC_CFGR1_AWDCH_4| ADC_CFGR1_AWDCH_0)
bogdanm 84:0b3ab51c8877 403 #define ADC_CHANNEL_18 ((uint32_t)(ADC_CHSELR_CHSEL18)| ADC_CFGR1_AWDCH_4| ADC_CFGR1_AWDCH_1)
bogdanm 84:0b3ab51c8877 404
bogdanm 84:0b3ab51c8877 405 /* Internal channels */
bogdanm 92:4fc01daae5a5 406 #define ADC_CHANNEL_VLCD ADC_CHANNEL_16
bogdanm 84:0b3ab51c8877 407 #define ADC_CHANNEL_VREFINT ADC_CHANNEL_17
bogdanm 92:4fc01daae5a5 408 #define ADC_CHANNEL_TEMPSENSOR ADC_CHANNEL_18
bogdanm 84:0b3ab51c8877 409
bogdanm 84:0b3ab51c8877 410
bogdanm 84:0b3ab51c8877 411 #define IS_ADC_CHANNEL(CHANNEL) (((CHANNEL) == ADC_CHANNEL_0) || \
bogdanm 84:0b3ab51c8877 412 ((CHANNEL) == ADC_CHANNEL_1) || \
bogdanm 84:0b3ab51c8877 413 ((CHANNEL) == ADC_CHANNEL_2) || \
bogdanm 84:0b3ab51c8877 414 ((CHANNEL) == ADC_CHANNEL_3) || \
bogdanm 84:0b3ab51c8877 415 ((CHANNEL) == ADC_CHANNEL_4) || \
bogdanm 84:0b3ab51c8877 416 ((CHANNEL) == ADC_CHANNEL_5) || \
bogdanm 84:0b3ab51c8877 417 ((CHANNEL) == ADC_CHANNEL_6) || \
bogdanm 84:0b3ab51c8877 418 ((CHANNEL) == ADC_CHANNEL_7) || \
bogdanm 84:0b3ab51c8877 419 ((CHANNEL) == ADC_CHANNEL_8) || \
bogdanm 84:0b3ab51c8877 420 ((CHANNEL) == ADC_CHANNEL_9) || \
bogdanm 84:0b3ab51c8877 421 ((CHANNEL) == ADC_CHANNEL_10) || \
bogdanm 84:0b3ab51c8877 422 ((CHANNEL) == ADC_CHANNEL_11) || \
bogdanm 84:0b3ab51c8877 423 ((CHANNEL) == ADC_CHANNEL_12) || \
bogdanm 84:0b3ab51c8877 424 ((CHANNEL) == ADC_CHANNEL_13) || \
bogdanm 84:0b3ab51c8877 425 ((CHANNEL) == ADC_CHANNEL_14) || \
bogdanm 84:0b3ab51c8877 426 ((CHANNEL) == ADC_CHANNEL_15) || \
bogdanm 84:0b3ab51c8877 427 ((CHANNEL) == ADC_CHANNEL_TEMPSENSOR) || \
bogdanm 84:0b3ab51c8877 428 ((CHANNEL) == ADC_CHANNEL_VREFINT) || \
bogdanm 84:0b3ab51c8877 429 ((CHANNEL) == ADC_CHANNEL_VLCD))
bogdanm 84:0b3ab51c8877 430
bogdanm 84:0b3ab51c8877 431 /**
bogdanm 84:0b3ab51c8877 432 * @}
bogdanm 84:0b3ab51c8877 433 */
bogdanm 84:0b3ab51c8877 434
bogdanm 84:0b3ab51c8877 435 /** @defgroup ADC_Channel_AWD_Masks
bogdanm 84:0b3ab51c8877 436 * @{
bogdanm 84:0b3ab51c8877 437 */
bogdanm 84:0b3ab51c8877 438 #define ADC_CHANNEL_MASK ((uint32_t)0x0007FFFF)
bogdanm 84:0b3ab51c8877 439 #define ADC_CHANNEL_AWD_MASK ((uint32_t)0x7C000000)
bogdanm 84:0b3ab51c8877 440 /**
bogdanm 84:0b3ab51c8877 441 * @}
bogdanm 84:0b3ab51c8877 442 */
bogdanm 84:0b3ab51c8877 443
bogdanm 84:0b3ab51c8877 444
bogdanm 84:0b3ab51c8877 445 /** @defgroup ADC_sampling_times
bogdanm 84:0b3ab51c8877 446 * @{
bogdanm 84:0b3ab51c8877 447 */
bogdanm 84:0b3ab51c8877 448
bogdanm 84:0b3ab51c8877 449 #define ADC_SAMPLETIME_1CYCLE_5 ((uint32_t)0x00000000) /*!< ADC sampling time 1.5 cycle */
bogdanm 84:0b3ab51c8877 450 #define ADC_SAMPLETIME_7CYCLES_5 ((uint32_t)ADC_SMPR_SMPR_0) /*!< ADC sampling time 7.5 CYCLES */
bogdanm 84:0b3ab51c8877 451 #define ADC_SAMPLETIME_13CYCLES_5 ((uint32_t)ADC_SMPR_SMPR_1) /*!< ADC sampling time 13.5 CYCLES */
bogdanm 84:0b3ab51c8877 452 #define ADC_SAMPLETIME_28CYCLES_5 ((uint32_t)(ADC_SMPR_SMPR_1 | ADC_SMPR_SMPR_0)) /*!< ADC sampling time 28.5 CYCLES */
bogdanm 84:0b3ab51c8877 453 #define ADC_SAMPLETIME_41CYCLES_5 ((uint32_t)ADC_SMPR_SMPR_2) /*!< ADC sampling time 41.5 CYCLES */
bogdanm 84:0b3ab51c8877 454 #define ADC_SAMPLETIME_55CYCLES_5 ((uint32_t)(ADC_SMPR_SMPR_2 | ADC_SMPR_SMPR_0)) /*!< ADC sampling time 55.5 CYCLES */
bogdanm 84:0b3ab51c8877 455 #define ADC_SAMPLETIME_71CYCLES_5 ((uint32_t)(ADC_SMPR_SMPR_2 | ADC_SMPR_SMPR_1)) /*!< ADC sampling time 71.5 CYCLES */
bogdanm 84:0b3ab51c8877 456 #define ADC_SAMPLETIME_239CYCLES_5 ((uint32_t)ADC_SMPR_SMPR) /*!< ADC sampling time 239.5 CYCLES */
bogdanm 84:0b3ab51c8877 457
bogdanm 84:0b3ab51c8877 458 #define IS_ADC_SAMPLE_TIME(TIME) (((TIME) == ADC_SAMPLETIME_1CYCLE_5 ) || \
bogdanm 84:0b3ab51c8877 459 ((TIME) == ADC_SAMPLETIME_7CYCLES_5 ) || \
bogdanm 84:0b3ab51c8877 460 ((TIME) == ADC_SAMPLETIME_13CYCLES_5 ) || \
bogdanm 84:0b3ab51c8877 461 ((TIME) == ADC_SAMPLETIME_28CYCLES_5 ) || \
bogdanm 84:0b3ab51c8877 462 ((TIME) == ADC_SAMPLETIME_41CYCLES_5 ) || \
bogdanm 84:0b3ab51c8877 463 ((TIME) == ADC_SAMPLETIME_55CYCLES_5 ) || \
bogdanm 84:0b3ab51c8877 464 ((TIME) == ADC_SAMPLETIME_71CYCLES_5 ) || \
bogdanm 84:0b3ab51c8877 465 ((TIME) == ADC_SAMPLETIME_239CYCLES_5))
bogdanm 84:0b3ab51c8877 466 /**
bogdanm 84:0b3ab51c8877 467 * @}
bogdanm 84:0b3ab51c8877 468 */
bogdanm 84:0b3ab51c8877 469
Kojto 96:487b796308b0 470
Kojto 96:487b796308b0 471 /** @defgroup ADC_Scan_mode ADC Scan mode
bogdanm 84:0b3ab51c8877 472 * @{
Kojto 96:487b796308b0 473 */
Kojto 96:487b796308b0 474 /* Note: Scan mode values must be compatible with other STM32 devices having */
Kojto 96:487b796308b0 475 /* a configurable sequencer. */
Kojto 96:487b796308b0 476 /* Scan direction setting values are defined by taking in account */
Kojto 96:487b796308b0 477 /* already defined values for other STM32 devices: */
Kojto 96:487b796308b0 478 /* ADC_SCAN_DISABLE ((uint32_t)0x00000000) */
Kojto 96:487b796308b0 479 /* ADC_SCAN_ENABLE ((uint32_t)0x00000001) */
Kojto 96:487b796308b0 480 /* Scan direction forward is considered as default setting equivalent */
Kojto 96:487b796308b0 481 /* to scan enable. */
Kojto 96:487b796308b0 482 /* Scan direction backward is considered as additional setting. */
Kojto 96:487b796308b0 483 /* In case of migration from another STM32 device, the user will be */
Kojto 96:487b796308b0 484 /* warned of change of setting choices with assert check. */
Kojto 96:487b796308b0 485 #define ADC_SCAN_DIRECTION_FORWARD ((uint32_t)0x00000001) /*!< Scan direction forward: from channel 0 to channel 18 */
Kojto 96:487b796308b0 486 #define ADC_SCAN_DIRECTION_BACKWARD ((uint32_t)0x00000002) /*!< Scan direction backward: from channel 18 to channel 0 */
bogdanm 84:0b3ab51c8877 487
Kojto 96:487b796308b0 488 #define ADC_SCAN_ENABLE ADC_SCAN_DIRECTION_FORWARD /* For compatibility with other STM32 devices */
bogdanm 84:0b3ab51c8877 489
Kojto 96:487b796308b0 490 #define IS_ADC_SCAN_MODE(SCAN_MODE) (((SCAN_MODE) == ADC_SCAN_DIRECTION_FORWARD) || \
Kojto 96:487b796308b0 491 ((SCAN_MODE) == ADC_SCAN_DIRECTION_BACKWARD))
Kojto 96:487b796308b0 492
bogdanm 84:0b3ab51c8877 493 /**
bogdanm 84:0b3ab51c8877 494 * @}
bogdanm 84:0b3ab51c8877 495 */
bogdanm 84:0b3ab51c8877 496
bogdanm 84:0b3ab51c8877 497 /** @defgroup ADC_Oversampling_Ratio
bogdanm 84:0b3ab51c8877 498 * @{
bogdanm 84:0b3ab51c8877 499 */
bogdanm 84:0b3ab51c8877 500
bogdanm 84:0b3ab51c8877 501 #define ADC_OVERSAMPLING_RATIO_2 ((uint32_t)0x00000000) /*!< ADC Oversampling ratio 2x */
bogdanm 84:0b3ab51c8877 502 #define ADC_OVERSAMPLING_RATIO_4 ((uint32_t)0x00000004) /*!< ADC Oversampling ratio 4x */
bogdanm 84:0b3ab51c8877 503 #define ADC_OVERSAMPLING_RATIO_8 ((uint32_t)0x00000008) /*!< ADC Oversampling ratio 8x */
bogdanm 84:0b3ab51c8877 504 #define ADC_OVERSAMPLING_RATIO_16 ((uint32_t)0x0000000C) /*!< ADC Oversampling ratio 16x */
bogdanm 84:0b3ab51c8877 505 #define ADC_OVERSAMPLING_RATIO_32 ((uint32_t)0x00000010) /*!< ADC Oversampling ratio 32x */
bogdanm 84:0b3ab51c8877 506 #define ADC_OVERSAMPLING_RATIO_64 ((uint32_t)0x00000014) /*!< ADC Oversampling ratio 64x */
bogdanm 84:0b3ab51c8877 507 #define ADC_OVERSAMPLING_RATIO_128 ((uint32_t)0x00000018) /*!< ADC Oversampling ratio 128x */
bogdanm 84:0b3ab51c8877 508 #define ADC_OVERSAMPLING_RATIO_256 ((uint32_t)0x0000001C) /*!< ADC Oversampling ratio 256x */
bogdanm 84:0b3ab51c8877 509 #define IS_ADC_OVERSAMPLING_RATIO(RATIO) (((RATIO) == ADC_OVERSAMPLING_RATIO_2 ) || \
bogdanm 84:0b3ab51c8877 510 ((RATIO) == ADC_OVERSAMPLING_RATIO_4 ) || \
bogdanm 84:0b3ab51c8877 511 ((RATIO) == ADC_OVERSAMPLING_RATIO_8 ) || \
bogdanm 84:0b3ab51c8877 512 ((RATIO) == ADC_OVERSAMPLING_RATIO_16 ) || \
bogdanm 84:0b3ab51c8877 513 ((RATIO) == ADC_OVERSAMPLING_RATIO_32 ) || \
bogdanm 84:0b3ab51c8877 514 ((RATIO) == ADC_OVERSAMPLING_RATIO_64 ) || \
bogdanm 84:0b3ab51c8877 515 ((RATIO) == ADC_OVERSAMPLING_RATIO_128 ) || \
bogdanm 84:0b3ab51c8877 516 ((RATIO) == ADC_OVERSAMPLING_RATIO_256 ))
bogdanm 84:0b3ab51c8877 517 /**
bogdanm 84:0b3ab51c8877 518 * @}
bogdanm 84:0b3ab51c8877 519 */
bogdanm 84:0b3ab51c8877 520
bogdanm 84:0b3ab51c8877 521 /** @defgroup ADC_Right_Bit_Shift
bogdanm 84:0b3ab51c8877 522 * @{
bogdanm 84:0b3ab51c8877 523 */
bogdanm 84:0b3ab51c8877 524 #define ADC_RIGHTBITSHIFT_NONE ((uint32_t)0x00000000) /*!< ADC No bit shift for oversampling */
bogdanm 84:0b3ab51c8877 525 #define ADC_RIGHTBITSHIFT_1 ((uint32_t)0x00000020) /*!< ADC 1 bit shift for oversampling */
bogdanm 84:0b3ab51c8877 526 #define ADC_RIGHTBITSHIFT_2 ((uint32_t)0x00000040) /*!< ADC 2 bits shift for oversampling */
bogdanm 84:0b3ab51c8877 527 #define ADC_RIGHTBITSHIFT_3 ((uint32_t)0x00000060) /*!< ADC 3 bits shift for oversampling */
bogdanm 84:0b3ab51c8877 528 #define ADC_RIGHTBITSHIFT_4 ((uint32_t)0x00000080) /*!< ADC 4 bits shift for oversampling */
bogdanm 84:0b3ab51c8877 529 #define ADC_RIGHTBITSHIFT_5 ((uint32_t)0x000000A0) /*!< ADC 5 bits shift for oversampling */
bogdanm 84:0b3ab51c8877 530 #define ADC_RIGHTBITSHIFT_6 ((uint32_t)0x000000C0) /*!< ADC 6 bits shift for oversampling */
bogdanm 84:0b3ab51c8877 531 #define ADC_RIGHTBITSHIFT_7 ((uint32_t)0x000000E0) /*!< ADC 7 bits shift for oversampling */
bogdanm 84:0b3ab51c8877 532 #define ADC_RIGHTBITSHIFT_8 ((uint32_t)0x00000100) /*!< ADC 8 bits shift for oversampling */
bogdanm 84:0b3ab51c8877 533 #define IS_ADC_RIGHT_BIT_SHIFT(SHIFT) (((SHIFT) == ADC_RIGHTBITSHIFT_NONE) || \
bogdanm 84:0b3ab51c8877 534 ((SHIFT) == ADC_RIGHTBITSHIFT_1 ) || \
bogdanm 84:0b3ab51c8877 535 ((SHIFT) == ADC_RIGHTBITSHIFT_2 ) || \
bogdanm 84:0b3ab51c8877 536 ((SHIFT) == ADC_RIGHTBITSHIFT_3 ) || \
bogdanm 84:0b3ab51c8877 537 ((SHIFT) == ADC_RIGHTBITSHIFT_4 ) || \
bogdanm 84:0b3ab51c8877 538 ((SHIFT) == ADC_RIGHTBITSHIFT_5 ) || \
bogdanm 84:0b3ab51c8877 539 ((SHIFT) == ADC_RIGHTBITSHIFT_6 ) || \
bogdanm 84:0b3ab51c8877 540 ((SHIFT) == ADC_RIGHTBITSHIFT_7 ) || \
bogdanm 84:0b3ab51c8877 541 ((SHIFT) == ADC_RIGHTBITSHIFT_8 ))
bogdanm 84:0b3ab51c8877 542 /**
bogdanm 84:0b3ab51c8877 543 * @}
bogdanm 84:0b3ab51c8877 544 */
bogdanm 84:0b3ab51c8877 545
bogdanm 84:0b3ab51c8877 546 /** @defgroup ADC_Triggered_Oversampling_Mode
bogdanm 84:0b3ab51c8877 547 * @{
bogdanm 84:0b3ab51c8877 548 */
bogdanm 84:0b3ab51c8877 549 #define ADC_TRIGGEREDMODE_SINGLE_TRIGGER ((uint32_t)0x00000000) /*!< ADC No bit shift for oversampling */
bogdanm 84:0b3ab51c8877 550 #define ADC_TRIGGEREDMODE_MULTI_TRIGGER ((uint32_t)0x00000200) /*!< ADC No bit shift for oversampling */
bogdanm 84:0b3ab51c8877 551 #define IS_ADC_TRIGGERED_OVERSAMPLING_MODE(MODE) (((MODE) == ADC_TRIGGEREDMODE_SINGLE_TRIGGER) || \
bogdanm 84:0b3ab51c8877 552 ((MODE) == ADC_TRIGGEREDMODE_MULTI_TRIGGER) )
bogdanm 84:0b3ab51c8877 553 /**
bogdanm 84:0b3ab51c8877 554 * @}
bogdanm 84:0b3ab51c8877 555 */
bogdanm 84:0b3ab51c8877 556
bogdanm 84:0b3ab51c8877 557 /** @defgroup ADC_analog_watchdog_mode
bogdanm 84:0b3ab51c8877 558 * @{
bogdanm 84:0b3ab51c8877 559 */
bogdanm 84:0b3ab51c8877 560 #define ADC_ANALOGWATCHDOG_NONE ((uint32_t) 0x00000000)
bogdanm 84:0b3ab51c8877 561 #define ADC_ANALOGWATCHDOG_SINGLE_REG ((uint32_t)(ADC_CFGR1_AWDSGL | ADC_CFGR1_AWDEN))
bogdanm 84:0b3ab51c8877 562 #define ADC_ANALOGWATCHDOG_ALL_REG ((uint32_t) ADC_CFGR1_AWDEN)
bogdanm 84:0b3ab51c8877 563
bogdanm 84:0b3ab51c8877 564
bogdanm 84:0b3ab51c8877 565 #define IS_ADC_ANALOG_WATCHDOG_MODE(WATCHDOG) (((WATCHDOG) == ADC_ANALOGWATCHDOG_NONE ) || \
bogdanm 84:0b3ab51c8877 566 ((WATCHDOG) == ADC_ANALOGWATCHDOG_SINGLE_REG) || \
bogdanm 84:0b3ab51c8877 567 ((WATCHDOG) == ADC_ANALOGWATCHDOG_ALL_REG ))
bogdanm 84:0b3ab51c8877 568 /**
bogdanm 84:0b3ab51c8877 569 * @}
bogdanm 84:0b3ab51c8877 570 */
bogdanm 84:0b3ab51c8877 571
bogdanm 84:0b3ab51c8877 572 /** @defgroup ADC_conversion_type
bogdanm 84:0b3ab51c8877 573 * @{
bogdanm 84:0b3ab51c8877 574 */
Kojto 96:487b796308b0 575 #define ADC_REGULAR_GROUP ((uint32_t)(ADC_FLAG_EOC | ADC_FLAG_EOS))
Kojto 96:487b796308b0 576 #define IS_ADC_CONVERSION_GROUP(CONVERSION) ((CONVERSION) == ADC_REGULAR_GROUP)
bogdanm 84:0b3ab51c8877 577 /**
bogdanm 84:0b3ab51c8877 578 * @}
bogdanm 84:0b3ab51c8877 579 */
bogdanm 84:0b3ab51c8877 580
bogdanm 84:0b3ab51c8877 581 /** @defgroup ADC_Event_type
bogdanm 84:0b3ab51c8877 582 * @{
bogdanm 84:0b3ab51c8877 583 */
Kojto 96:487b796308b0 584 #define ADC_AWD_EVENT ((uint32_t)ADC_FLAG_AWD)
Kojto 96:487b796308b0 585 #define ADC_OVR_EVENT ((uint32_t)ADC_FLAG_OVR)
bogdanm 84:0b3ab51c8877 586
Kojto 96:487b796308b0 587 #define IS_ADC_EVENT_TYPE(EVENT) (((EVENT) == ADC_AWD_EVENT) || \
Kojto 96:487b796308b0 588 ((EVENT) == ADC_OVR_EVENT))
bogdanm 84:0b3ab51c8877 589 /**
bogdanm 84:0b3ab51c8877 590 * @}
bogdanm 84:0b3ab51c8877 591 */
bogdanm 84:0b3ab51c8877 592
bogdanm 84:0b3ab51c8877 593 /** @defgroup ADC_interrupts_definition
bogdanm 84:0b3ab51c8877 594 * @{
bogdanm 84:0b3ab51c8877 595 */
bogdanm 84:0b3ab51c8877 596 #define ADC_IT_RDY ADC_IER_ADRDYIE /*!< ADC Ready (ADRDY) interrupt source */
bogdanm 84:0b3ab51c8877 597 #define ADC_IT_EOSMP ADC_IER_EOSMPIE /*!< ADC End of Sampling interrupt source */
bogdanm 84:0b3ab51c8877 598 #define ADC_IT_EOC ADC_IER_EOCIE /*!< ADC End of Regular Conversion interrupt source */
bogdanm 84:0b3ab51c8877 599 #define ADC_IT_EOS ADC_IER_EOSEQIE /*!< ADC End of Regular sequence of Conversions interrupt source */
bogdanm 84:0b3ab51c8877 600 #define ADC_IT_OVR ADC_IER_OVRIE /*!< ADC overrun interrupt source */
bogdanm 84:0b3ab51c8877 601 #define ADC_IT_AWD ADC_IER_AWDIE /*!< ADC Analog watchdog 1 interrupt source */
bogdanm 84:0b3ab51c8877 602 #define ADC_IT_EOCAL ADC_IER_EOCALIE /*!< ADC End of Calibration interrupt source */
bogdanm 84:0b3ab51c8877 603
bogdanm 84:0b3ab51c8877 604 /* Check of single flag */
bogdanm 84:0b3ab51c8877 605 #define IS_ADC_IT(IT) (((IT) == ADC_IT_AWD) || ((IT) == ADC_IT_RDY) || \
bogdanm 84:0b3ab51c8877 606 ((IT) == ADC_IT_EOSMP) || ((IT) == ADC_IT_EOC) || \
bogdanm 84:0b3ab51c8877 607 ((IT) == ADC_IT_EOS) || ((IT) == ADC_IT_OVR))
bogdanm 84:0b3ab51c8877 608 /**
bogdanm 84:0b3ab51c8877 609 * @}
bogdanm 84:0b3ab51c8877 610 */
bogdanm 84:0b3ab51c8877 611
bogdanm 84:0b3ab51c8877 612
bogdanm 84:0b3ab51c8877 613
bogdanm 84:0b3ab51c8877 614 /** @defgroup ADC_flags_definition
bogdanm 84:0b3ab51c8877 615 * @{
bogdanm 84:0b3ab51c8877 616 */
bogdanm 84:0b3ab51c8877 617 #define ADC_FLAG_RDY ADC_ISR_ADRDY /*!< ADC Ready (ADRDY) flag */
bogdanm 84:0b3ab51c8877 618 #define ADC_FLAG_EOSMP ADC_ISR_EOSMP /*!< ADC End of Sampling flag */
bogdanm 84:0b3ab51c8877 619 #define ADC_FLAG_EOC ADC_ISR_EOC /*!< ADC End of Regular Conversion flag */
bogdanm 84:0b3ab51c8877 620 #define ADC_FLAG_EOS ADC_ISR_EOSEQ /*!< ADC End of Regular sequence of Conversions flag */
bogdanm 84:0b3ab51c8877 621 #define ADC_FLAG_OVR ADC_ISR_OVR /*!< ADC overrun flag */
bogdanm 84:0b3ab51c8877 622 #define ADC_FLAG_AWD ADC_ISR_AWD /*!< ADC Analog watchdog flag */
bogdanm 84:0b3ab51c8877 623 #define ADC_FLAG_EOCAL ADC_ISR_EOCAL /*!< ADC Enf Of Calibration flag */
bogdanm 84:0b3ab51c8877 624
bogdanm 84:0b3ab51c8877 625
bogdanm 84:0b3ab51c8877 626 #define ADC_FLAG_ALL (ADC_FLAG_RDY | ADC_FLAG_EOSMP | ADC_FLAG_EOC | ADC_FLAG_EOS | \
bogdanm 84:0b3ab51c8877 627 ADC_FLAG_OVR | ADC_FLAG_AWD | ADC_FLAG_EOCAL)
bogdanm 84:0b3ab51c8877 628
bogdanm 84:0b3ab51c8877 629 /* Check of single flag */
bogdanm 84:0b3ab51c8877 630 #define IS_ADC_FLAG(FLAG) (((FLAG) == ADC_FLAG_RDY) || ((FLAG) == ADC_FLAG_EOSMP) || \
bogdanm 84:0b3ab51c8877 631 ((FLAG) == ADC_FLAG_EOC) || ((FLAG) == ADC_FLAG_EOS) || \
bogdanm 84:0b3ab51c8877 632 ((FLAG) == ADC_FLAG_OVR) || ((FLAG) == ADC_FLAG_AWD) || \
bogdanm 84:0b3ab51c8877 633 ((FLAG) == ADC_FLAG_EOCAL))
bogdanm 84:0b3ab51c8877 634 /**
bogdanm 84:0b3ab51c8877 635 * @}
bogdanm 84:0b3ab51c8877 636 */
bogdanm 84:0b3ab51c8877 637
bogdanm 84:0b3ab51c8877 638
bogdanm 84:0b3ab51c8877 639 /** @defgroup ADC_range_verification
bogdanm 84:0b3ab51c8877 640 * in function of ADC resolution selected (12, 10, 8 or 6 bits)
bogdanm 84:0b3ab51c8877 641 * @{
bogdanm 84:0b3ab51c8877 642 */
bogdanm 84:0b3ab51c8877 643 #define IS_ADC_RANGE(RESOLUTION, ADC_VALUE) \
Kojto 96:487b796308b0 644 ((((RESOLUTION) == ADC_RESOLUTION_12B) && ((ADC_VALUE) <= ((uint32_t)0x0FFF))) || \
Kojto 96:487b796308b0 645 (((RESOLUTION) == ADC_RESOLUTION_10B) && ((ADC_VALUE) <= ((uint32_t)0x03FF))) || \
Kojto 96:487b796308b0 646 (((RESOLUTION) == ADC_RESOLUTION_8B) && ((ADC_VALUE) <= ((uint32_t)0x00FF))) || \
Kojto 96:487b796308b0 647 (((RESOLUTION) == ADC_RESOLUTION_6B) && ((ADC_VALUE) <= ((uint32_t)0x003F))))
bogdanm 84:0b3ab51c8877 648 /**
bogdanm 84:0b3ab51c8877 649 * @}
bogdanm 84:0b3ab51c8877 650 */
bogdanm 84:0b3ab51c8877 651
bogdanm 92:4fc01daae5a5 652 /** @defgroup ADC_regular_nb_conv_verification
bogdanm 84:0b3ab51c8877 653 * @{
bogdanm 84:0b3ab51c8877 654 */
bogdanm 84:0b3ab51c8877 655 #define IS_ADC_REGULAR_NB_CONV(LENGTH) (((LENGTH) >= ((uint32_t)1)) && ((LENGTH) <= ((uint32_t)16)))
bogdanm 84:0b3ab51c8877 656 /**
bogdanm 84:0b3ab51c8877 657 * @}
bogdanm 84:0b3ab51c8877 658 */
bogdanm 84:0b3ab51c8877 659
bogdanm 84:0b3ab51c8877 660 /**
bogdanm 84:0b3ab51c8877 661 * @}
bogdanm 84:0b3ab51c8877 662 */
bogdanm 84:0b3ab51c8877 663 /* Exported macro ------------------------------------------------------------*/
bogdanm 84:0b3ab51c8877 664
bogdanm 84:0b3ab51c8877 665 /** @defgroup ADC_Exported_Macro
bogdanm 84:0b3ab51c8877 666 * @{
bogdanm 84:0b3ab51c8877 667 */
bogdanm 84:0b3ab51c8877 668 /** @brief Reset ADC handle state
bogdanm 84:0b3ab51c8877 669 * @param __HANDLE__: ADC handle
bogdanm 84:0b3ab51c8877 670 * @retval None
bogdanm 84:0b3ab51c8877 671 */
bogdanm 84:0b3ab51c8877 672 #define __HAL_ADC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_ADC_STATE_RESET)
bogdanm 84:0b3ab51c8877 673
bogdanm 84:0b3ab51c8877 674 /**
bogdanm 84:0b3ab51c8877 675 * @brief Enable the ADC peripheral
bogdanm 84:0b3ab51c8877 676 * @param __HANDLE__: ADC handle
bogdanm 84:0b3ab51c8877 677 * @retval None
bogdanm 84:0b3ab51c8877 678 */
bogdanm 84:0b3ab51c8877 679 #define __HAL_ADC_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= ADC_CR_ADEN)
bogdanm 84:0b3ab51c8877 680
bogdanm 84:0b3ab51c8877 681 /**
bogdanm 84:0b3ab51c8877 682 * @brief Verification of hardware constraints before ADC can be enabled
bogdanm 84:0b3ab51c8877 683 * @param __HANDLE__: ADC handle
bogdanm 84:0b3ab51c8877 684 * @retval SET (ADC can be enabled) or RESET (ADC cannot be enabled)
bogdanm 84:0b3ab51c8877 685 */
Kojto 96:487b796308b0 686 #define ADC_ENABLING_CONDITIONS(__HANDLE__) \
bogdanm 84:0b3ab51c8877 687 (( ( ((__HANDLE__)->Instance->CR) & \
bogdanm 84:0b3ab51c8877 688 (ADC_CR_ADCAL | ADC_CR_ADSTP | ADC_CR_ADSTART | \
bogdanm 84:0b3ab51c8877 689 ADC_CR_ADDIS | ADC_CR_ADEN ) \
bogdanm 84:0b3ab51c8877 690 ) == RESET \
bogdanm 84:0b3ab51c8877 691 ) ? SET : RESET)
bogdanm 84:0b3ab51c8877 692
bogdanm 84:0b3ab51c8877 693 /**
bogdanm 84:0b3ab51c8877 694 * @brief Disable the ADC peripheral
bogdanm 84:0b3ab51c8877 695 * @param __HANDLE__: ADC handle
bogdanm 84:0b3ab51c8877 696 * @retval None
bogdanm 84:0b3ab51c8877 697 */
bogdanm 84:0b3ab51c8877 698 #define __HAL_ADC_DISABLE(__HANDLE__) \
bogdanm 84:0b3ab51c8877 699 do{ \
bogdanm 84:0b3ab51c8877 700 (__HANDLE__)->Instance->CR |= ADC_CR_ADDIS; \
bogdanm 84:0b3ab51c8877 701 __HAL_ADC_CLEAR_FLAG((__HANDLE__), (ADC_FLAG_EOSMP | ADC_FLAG_RDY)); \
bogdanm 84:0b3ab51c8877 702 } while(0)
bogdanm 84:0b3ab51c8877 703
bogdanm 84:0b3ab51c8877 704 /**
bogdanm 84:0b3ab51c8877 705 * @brief Verification of hardware constraints before ADC can be disabled
bogdanm 84:0b3ab51c8877 706 * @param __HANDLE__: ADC handle
bogdanm 84:0b3ab51c8877 707 * @retval SET (ADC can be disabled) or RESET (ADC cannot be disabled)
bogdanm 84:0b3ab51c8877 708 */
Kojto 96:487b796308b0 709 #define ADC_DISABLING_CONDITIONS(__HANDLE__) \
bogdanm 84:0b3ab51c8877 710 (( ( ((__HANDLE__)->Instance->CR) & \
bogdanm 84:0b3ab51c8877 711 (ADC_CR_ADSTART | ADC_CR_ADEN)) == ADC_CR_ADEN \
bogdanm 84:0b3ab51c8877 712 ) ? SET : RESET)
bogdanm 84:0b3ab51c8877 713
bogdanm 84:0b3ab51c8877 714 /**
bogdanm 84:0b3ab51c8877 715 * @brief Verification of ADC state: enabled or disabled
bogdanm 84:0b3ab51c8877 716 * @param __HANDLE__: ADC handle
bogdanm 84:0b3ab51c8877 717 * @retval SET (ADC enabled) or RESET (ADC disabled)
bogdanm 84:0b3ab51c8877 718 */
Kojto 96:487b796308b0 719 #define ADC_IS_ENABLE(__HANDLE__) \
bogdanm 84:0b3ab51c8877 720 (( ((((__HANDLE__)->Instance->CR) & (ADC_CR_ADEN | ADC_CR_ADDIS)) == ADC_CR_ADEN) && \
bogdanm 84:0b3ab51c8877 721 ((((__HANDLE__)->Instance->ISR) & ADC_FLAG_RDY) == ADC_FLAG_RDY) \
bogdanm 84:0b3ab51c8877 722 ) ? SET : RESET)
bogdanm 84:0b3ab51c8877 723
bogdanm 84:0b3ab51c8877 724 /**
bogdanm 84:0b3ab51c8877 725 * @brief Returns resolution bits in CFGR register: RES[1:0]. Return value among parameter to @ref ADC_Resolution.
bogdanm 84:0b3ab51c8877 726 * @param __HANDLE__: ADC handle
bogdanm 84:0b3ab51c8877 727 * @retval None
bogdanm 84:0b3ab51c8877 728 */
Kojto 96:487b796308b0 729 #define ADC_GET_RESOLUTION(__HANDLE__) (((__HANDLE__)->Instance->CFGR1) & ADC_CFGR1_RES)
bogdanm 84:0b3ab51c8877 730
bogdanm 84:0b3ab51c8877 731 /**
bogdanm 84:0b3ab51c8877 732 * @brief Check if no conversion is ongoing on regular groups
bogdanm 84:0b3ab51c8877 733 * @param __HANDLE__: ADC handle
bogdanm 84:0b3ab51c8877 734 * @retval SET (conversion is on going) or RESET (no conversion is on going)
bogdanm 84:0b3ab51c8877 735 */
Kojto 96:487b796308b0 736 #define ADC_IS_CONVERSION_ONGOING(__HANDLE__) \
bogdanm 84:0b3ab51c8877 737 (( (((__HANDLE__)->Instance->CR) & (ADC_CR_ADSTART)) == RESET ) ? RESET : SET)
bogdanm 84:0b3ab51c8877 738
bogdanm 84:0b3ab51c8877 739 /**
bogdanm 84:0b3ab51c8877 740 * @brief Enable ADC continuous conversion mode.
bogdanm 84:0b3ab51c8877 741 * @param _CONTINUOUS_MODE_: Continuous mode.
bogdanm 84:0b3ab51c8877 742 * @retval None
bogdanm 84:0b3ab51c8877 743 */
Kojto 96:487b796308b0 744 #define ADC_CONTINUOUS(_CONTINUOUS_MODE_) ((_CONTINUOUS_MODE_) << 13)
Kojto 96:487b796308b0 745
Kojto 96:487b796308b0 746 /**
Kojto 96:487b796308b0 747 * @brief Enable ADC scan mode to convert multiple ranks with sequencer.
Kojto 96:487b796308b0 748 * @param _SCAN_MODE_: Scan conversion mode.
Kojto 96:487b796308b0 749 * @retval None
Kojto 96:487b796308b0 750 */
Kojto 96:487b796308b0 751 #define ADC_SCANDIR(_SCAN_MODE_) \
Kojto 96:487b796308b0 752 ( ( (_SCAN_MODE_) == (ADC_SCAN_DIRECTION_BACKWARD) \
Kojto 96:487b796308b0 753 )? (ADC_CFGR1_SCANDIR) : (0x00000000) \
Kojto 96:487b796308b0 754 )
bogdanm 84:0b3ab51c8877 755
bogdanm 84:0b3ab51c8877 756 /**
bogdanm 84:0b3ab51c8877 757 * @brief Configures the number of discontinuous conversions for the regular group channels.
bogdanm 84:0b3ab51c8877 758 * @param _NBR_DISCONTINUOUS_CONV_: Number of discontinuous conversions.
bogdanm 84:0b3ab51c8877 759 * @retval None
bogdanm 84:0b3ab51c8877 760 */
bogdanm 84:0b3ab51c8877 761 #define __HAL_ADC_CFGR1_DISCONTINUOUS_NUM(_NBR_DISCONTINUOUS_CONV_) (((_NBR_DISCONTINUOUS_CONV_) - 1) << 17)
bogdanm 84:0b3ab51c8877 762
bogdanm 84:0b3ab51c8877 763 /**
bogdanm 84:0b3ab51c8877 764 * @brief Enable the ADC DMA continuous request.
bogdanm 84:0b3ab51c8877 765 * @param _DMAContReq_MODE_: DMA continuous request mode.
bogdanm 84:0b3ab51c8877 766 * @retval None
bogdanm 84:0b3ab51c8877 767 */
Kojto 96:487b796308b0 768 #define ADC_DMACONTREQ(_DMAContReq_MODE_) ((_DMAContReq_MODE_) << 1)
bogdanm 84:0b3ab51c8877 769
bogdanm 84:0b3ab51c8877 770 /**
bogdanm 84:0b3ab51c8877 771 * @brief Enable the ADC Auto Delay.
bogdanm 84:0b3ab51c8877 772 * @param _AutoDelay_: Auto delay bit enable or disable.
bogdanm 84:0b3ab51c8877 773 * @retval None
bogdanm 84:0b3ab51c8877 774 */
bogdanm 84:0b3ab51c8877 775 #define __HAL_ADC_CFGR1_AutoDelay(_AutoDelay_) ((_AutoDelay_) << 14)
bogdanm 84:0b3ab51c8877 776
bogdanm 84:0b3ab51c8877 777 /**
Kojto 96:487b796308b0 778 * @brief Enable the ADC LowPowerAutoPowerOff.
bogdanm 84:0b3ab51c8877 779 * @param _AUTOFF_: AutoOff bit enable or disable.
bogdanm 84:0b3ab51c8877 780 * @retval None
bogdanm 84:0b3ab51c8877 781 */
bogdanm 84:0b3ab51c8877 782 #define __HAL_ADC_CFGR1_AUTOFF(_AUTOFF_) ((_AUTOFF_) << 15)
bogdanm 84:0b3ab51c8877 783
bogdanm 84:0b3ab51c8877 784 /**
bogdanm 84:0b3ab51c8877 785 * @brief Configure the analog watchdog high threshold into registers TR1, TR2 or TR3.
bogdanm 84:0b3ab51c8877 786 * @param _Threshold_: Threshold value
bogdanm 84:0b3ab51c8877 787 * @retval None
bogdanm 84:0b3ab51c8877 788 */
Kojto 96:487b796308b0 789 #define ADC_TRX_HIGHTHRESHOLD(_Threshold_) ((_Threshold_) << 16)
bogdanm 84:0b3ab51c8877 790
bogdanm 84:0b3ab51c8877 791 /**
bogdanm 84:0b3ab51c8877 792 * @brief Enable the ADC Low Frequency mode.
bogdanm 84:0b3ab51c8877 793 * @param _LOW_FREQUENCY_MODE_: Low Frequency mode.
bogdanm 84:0b3ab51c8877 794 * @retval None
bogdanm 84:0b3ab51c8877 795 */
bogdanm 84:0b3ab51c8877 796 #define __HAL_ADC_CCR_LOWFREQUENCY(_LOW_FREQUENCY_MODE_) ((_LOW_FREQUENCY_MODE_) << 25)
bogdanm 84:0b3ab51c8877 797
bogdanm 84:0b3ab51c8877 798 /**
bogdanm 84:0b3ab51c8877 799 * @brief Shift the offset in function of the selected ADC resolution.
bogdanm 84:0b3ab51c8877 800 * Offset has to be left-aligned on bit 11, the LSB (right bits) are set to 0
bogdanm 84:0b3ab51c8877 801 * If resolution 12 bits, no shift.
bogdanm 84:0b3ab51c8877 802 * If resolution 10 bits, shift of 2 ranks on the right.
bogdanm 84:0b3ab51c8877 803 * If resolution 8 bits, shift of 4 ranks on the right.
bogdanm 84:0b3ab51c8877 804 * If resolution 6 bits, shift of 6 ranks on the right.
bogdanm 84:0b3ab51c8877 805 * therefore, shift = (12 - resolution) = 12 - (12- (((RES[1:0]) >> 3)*2))
bogdanm 84:0b3ab51c8877 806 * @param __HANDLE__: ADC handle.
bogdanm 84:0b3ab51c8877 807 * @param _Offset_: Value to be shifted
bogdanm 84:0b3ab51c8877 808 * @retval None
bogdanm 84:0b3ab51c8877 809 */
Kojto 96:487b796308b0 810 #define ADC_OFFSET_SHIFT_RESOLUTION(__HANDLE__, _Offset_) \
bogdanm 84:0b3ab51c8877 811 ((_Offset_) << ((((__HANDLE__)->Instance->CFGR & ADC_CFGR1_RES) >> 3)*2))
bogdanm 84:0b3ab51c8877 812
bogdanm 84:0b3ab51c8877 813 /**
bogdanm 84:0b3ab51c8877 814 * @brief Shift the AWD1 threshold in function of the selected ADC resolution.
bogdanm 84:0b3ab51c8877 815 * Thresholds have to be left-aligned on bit 11, the LSB (right bits) are set to 0
bogdanm 84:0b3ab51c8877 816 * If resolution 12 bits, no shift.
bogdanm 84:0b3ab51c8877 817 * If resolution 10 bits, shift of 2 ranks on the right.
bogdanm 84:0b3ab51c8877 818 * If resolution 8 bits, shift of 4 ranks on the right.
bogdanm 84:0b3ab51c8877 819 * If resolution 6 bits, shift of 6 ranks on the right.
bogdanm 84:0b3ab51c8877 820 * therefore, shift = (12 - resolution) = 12 - (12- (((RES[1:0]) >> 3)*2))
bogdanm 84:0b3ab51c8877 821 * @param __HANDLE__: ADC handle.
bogdanm 84:0b3ab51c8877 822 * @param _Threshold_: Value to be shifted
bogdanm 84:0b3ab51c8877 823 * @retval None
bogdanm 84:0b3ab51c8877 824 */
Kojto 96:487b796308b0 825 #define ADC_AWD1THRESHOLD_SHIFT_RESOLUTION(__HANDLE__, _Threshold_) \
bogdanm 84:0b3ab51c8877 826 ((_Threshold_) << ((((__HANDLE__)->Instance->CFGR1 & ADC_CFGR1_RES) >> 3)*2))
bogdanm 84:0b3ab51c8877 827
bogdanm 84:0b3ab51c8877 828 /**
bogdanm 84:0b3ab51c8877 829 * @brief Shift the value on the left, less significant are set to 0.
bogdanm 84:0b3ab51c8877 830 * @param _Value_: Value to be shifted
bogdanm 84:0b3ab51c8877 831 * @param _Shift_: Number of shift to be done
bogdanm 84:0b3ab51c8877 832 * @retval None
bogdanm 84:0b3ab51c8877 833 */
bogdanm 84:0b3ab51c8877 834 #define __HAL_ADC_Value_Shift_left(_Value_, _Shift_) ((_Value_) << (_Shift_))
bogdanm 84:0b3ab51c8877 835
bogdanm 84:0b3ab51c8877 836
bogdanm 84:0b3ab51c8877 837 /**
bogdanm 84:0b3ab51c8877 838 * @brief Enable the ADC end of conversion interrupt.
bogdanm 84:0b3ab51c8877 839 * @param __HANDLE__: ADC handle.
bogdanm 84:0b3ab51c8877 840 * @param __INTERRUPT__: ADC Interrupt.
bogdanm 84:0b3ab51c8877 841 * @retval None
bogdanm 84:0b3ab51c8877 842 */
bogdanm 84:0b3ab51c8877 843 #define __HAL_ADC_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->IER) |= (__INTERRUPT__))
bogdanm 84:0b3ab51c8877 844
bogdanm 84:0b3ab51c8877 845 /**
bogdanm 84:0b3ab51c8877 846 * @brief Disable the ADC end of conversion interrupt.
bogdanm 84:0b3ab51c8877 847 * @param __HANDLE__: ADC handle.
bogdanm 84:0b3ab51c8877 848 * @param __INTERRUPT__: ADC interrupt.
bogdanm 84:0b3ab51c8877 849 * @retval None
bogdanm 84:0b3ab51c8877 850 */
bogdanm 84:0b3ab51c8877 851 #define __HAL_ADC_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->IER) &= ~(__INTERRUPT__))
bogdanm 84:0b3ab51c8877 852
bogdanm 84:0b3ab51c8877 853 /** @brief Checks if the specified ADC interrupt source is enabled or disabled.
bogdanm 84:0b3ab51c8877 854 * @param __HANDLE__: specifies the ADC Handle.
bogdanm 84:0b3ab51c8877 855 * @param __INTERRUPT__: specifies the ADC interrupt source to check.
bogdanm 84:0b3ab51c8877 856 * @retval The new state of __IT__ (TRUE or FALSE).
bogdanm 84:0b3ab51c8877 857 */
bogdanm 84:0b3ab51c8877 858 #define __HAL_ADC_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->IER & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET)
bogdanm 84:0b3ab51c8877 859
bogdanm 84:0b3ab51c8877 860 /**
bogdanm 84:0b3ab51c8877 861 * @brief Clear the ADC's pending flags
bogdanm 84:0b3ab51c8877 862 * @param __HANDLE__: ADC handle.
bogdanm 84:0b3ab51c8877 863 * @param __FLAG__: ADC flag.
bogdanm 84:0b3ab51c8877 864 * @retval None
bogdanm 84:0b3ab51c8877 865 */
bogdanm 84:0b3ab51c8877 866 /* Note: bit cleared bit by writing 1 */
bogdanm 92:4fc01daae5a5 867 #define __HAL_ADC_CLEAR_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->ISR) = (__FLAG__))
bogdanm 84:0b3ab51c8877 868
bogdanm 84:0b3ab51c8877 869 /**
bogdanm 84:0b3ab51c8877 870 * @brief Get the selected ADC's flag status.
bogdanm 84:0b3ab51c8877 871 * @param __HANDLE__: ADC handle.
bogdanm 84:0b3ab51c8877 872 * @param __FLAG__: ADC flag.
bogdanm 84:0b3ab51c8877 873 * @retval None
bogdanm 84:0b3ab51c8877 874 */
bogdanm 84:0b3ab51c8877 875 #define __HAL_ADC_GET_FLAG(__HANDLE__, __FLAG__) ((((__HANDLE__)->Instance->ISR) & (__FLAG__)) == (__FLAG__))
bogdanm 84:0b3ab51c8877 876
bogdanm 84:0b3ab51c8877 877
bogdanm 84:0b3ab51c8877 878
bogdanm 84:0b3ab51c8877 879 /**
bogdanm 84:0b3ab51c8877 880 * @brief Configuration of ADC clock & prescaler: clock source PCLK or Asynchronous with selectable prescaler
bogdanm 84:0b3ab51c8877 881 * @param __HANDLE__: ADC handle
bogdanm 84:0b3ab51c8877 882 * @retval None
bogdanm 84:0b3ab51c8877 883 */
bogdanm 84:0b3ab51c8877 884
bogdanm 84:0b3ab51c8877 885 #define __HAL_ADC_CLOCK_PRESCALER(__HANDLE__) \
bogdanm 84:0b3ab51c8877 886 do{ \
Kojto 96:487b796308b0 887 if ((((__HANDLE__)->Init.ClockPrescaler) == ADC_CLOCK_SYNC_PCLK_DIV1) || \
Kojto 96:487b796308b0 888 (((__HANDLE__)->Init.ClockPrescaler) == ADC_CLOCK_SYNC_PCLK_DIV2) || \
Kojto 96:487b796308b0 889 (((__HANDLE__)->Init.ClockPrescaler) == ADC_CLOCK_SYNC_PCLK_DIV4)) \
bogdanm 84:0b3ab51c8877 890 { \
bogdanm 84:0b3ab51c8877 891 (__HANDLE__)->Instance->CFGR2 &= ~(ADC_CFGR2_CKMODE); \
bogdanm 84:0b3ab51c8877 892 (__HANDLE__)->Instance->CFGR2 |= (__HANDLE__)->Init.ClockPrescaler; \
bogdanm 84:0b3ab51c8877 893 } \
bogdanm 84:0b3ab51c8877 894 else \
bogdanm 84:0b3ab51c8877 895 { \
bogdanm 84:0b3ab51c8877 896 /* CKMOD bits must be reset */ \
bogdanm 84:0b3ab51c8877 897 (__HANDLE__)->Instance->CFGR2 &= ~(ADC_CFGR2_CKMODE); \
bogdanm 84:0b3ab51c8877 898 ADC->CCR &= ~(ADC_CCR_PRESC); \
bogdanm 84:0b3ab51c8877 899 ADC->CCR |= (__HANDLE__)->Init.ClockPrescaler; \
bogdanm 84:0b3ab51c8877 900 } \
bogdanm 84:0b3ab51c8877 901 } while(0)
bogdanm 84:0b3ab51c8877 902
bogdanm 84:0b3ab51c8877 903 /**
bogdanm 84:0b3ab51c8877 904 * @}
bogdanm 84:0b3ab51c8877 905 */
bogdanm 84:0b3ab51c8877 906
bogdanm 84:0b3ab51c8877 907 /* Include ADC HAL Extension module */
bogdanm 84:0b3ab51c8877 908 #include "stm32l0xx_hal_adc_ex.h"
bogdanm 84:0b3ab51c8877 909
bogdanm 84:0b3ab51c8877 910 /* Exported functions --------------------------------------------------------*/
bogdanm 84:0b3ab51c8877 911 /* Initialization and de-initialization functions **********************************/
bogdanm 84:0b3ab51c8877 912 HAL_StatusTypeDef HAL_ADC_Init(ADC_HandleTypeDef* hadc);
bogdanm 84:0b3ab51c8877 913 HAL_StatusTypeDef HAL_ADC_DeInit(ADC_HandleTypeDef *hadc);
bogdanm 84:0b3ab51c8877 914 void HAL_ADC_MspInit(ADC_HandleTypeDef* hadc);
bogdanm 84:0b3ab51c8877 915 void HAL_ADC_MspDeInit(ADC_HandleTypeDef* hadc);
bogdanm 84:0b3ab51c8877 916
bogdanm 84:0b3ab51c8877 917 /* IO operation functions *****************************************************/
bogdanm 84:0b3ab51c8877 918 /* Blocking mode: Polling */
bogdanm 84:0b3ab51c8877 919 HAL_StatusTypeDef HAL_ADC_Start(ADC_HandleTypeDef* hadc);
bogdanm 84:0b3ab51c8877 920 HAL_StatusTypeDef HAL_ADC_Stop(ADC_HandleTypeDef* hadc);
bogdanm 84:0b3ab51c8877 921 HAL_StatusTypeDef HAL_ADC_PollForConversion(ADC_HandleTypeDef* hadc, uint32_t Timeout);
bogdanm 84:0b3ab51c8877 922 HAL_StatusTypeDef HAL_ADC_PollForEvent(ADC_HandleTypeDef* hadc, uint32_t EventType, uint32_t Timeout);
bogdanm 84:0b3ab51c8877 923
bogdanm 84:0b3ab51c8877 924 /* Non-blocking mode: Interruption */
bogdanm 84:0b3ab51c8877 925 HAL_StatusTypeDef HAL_ADC_Start_IT(ADC_HandleTypeDef* hadc);
bogdanm 84:0b3ab51c8877 926 HAL_StatusTypeDef HAL_ADC_Stop_IT(ADC_HandleTypeDef* hadc);
bogdanm 84:0b3ab51c8877 927
bogdanm 84:0b3ab51c8877 928 /* Non-blocking mode: DMA */
bogdanm 84:0b3ab51c8877 929 HAL_StatusTypeDef HAL_ADC_Start_DMA(ADC_HandleTypeDef* hadc, uint32_t* pData, uint32_t Length);
bogdanm 84:0b3ab51c8877 930 HAL_StatusTypeDef HAL_ADC_Stop_DMA(ADC_HandleTypeDef* hadc);
bogdanm 84:0b3ab51c8877 931
bogdanm 84:0b3ab51c8877 932 /* ADC retrieve conversion value intended to be used with polling or interruption */
bogdanm 84:0b3ab51c8877 933 uint32_t HAL_ADC_GetValue(ADC_HandleTypeDef* hadc);
bogdanm 84:0b3ab51c8877 934
bogdanm 84:0b3ab51c8877 935 /* ADC IRQHandler and Callbacks used in non-blocking modes (Interruption and DMA) */
bogdanm 84:0b3ab51c8877 936 void HAL_ADC_IRQHandler(ADC_HandleTypeDef* hadc);
bogdanm 84:0b3ab51c8877 937 void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc);
bogdanm 84:0b3ab51c8877 938 void HAL_ADC_ConvHalfCpltCallback(ADC_HandleTypeDef* hadc);
bogdanm 84:0b3ab51c8877 939 void HAL_ADC_LevelOutOfWindowCallback(ADC_HandleTypeDef* hadc);
bogdanm 84:0b3ab51c8877 940 void HAL_ADC_ErrorCallback(ADC_HandleTypeDef *hadc);
bogdanm 84:0b3ab51c8877 941
bogdanm 84:0b3ab51c8877 942 /* Peripheral Control functions ***********************************************/
bogdanm 84:0b3ab51c8877 943 HAL_StatusTypeDef HAL_ADC_ConfigChannel(ADC_HandleTypeDef* hadc, ADC_ChannelConfTypeDef* sConfig);
bogdanm 84:0b3ab51c8877 944 HAL_StatusTypeDef HAL_ADC_AnalogWDGConfig(ADC_HandleTypeDef* hadc, ADC_AnalogWDGConfTypeDef* AnalogWDGConfig);
bogdanm 84:0b3ab51c8877 945
bogdanm 84:0b3ab51c8877 946 /* Peripheral State functions *************************************************/
bogdanm 84:0b3ab51c8877 947 HAL_ADC_StateTypeDef HAL_ADC_GetState(ADC_HandleTypeDef* hadc);
bogdanm 84:0b3ab51c8877 948 uint32_t HAL_ADC_GetError(ADC_HandleTypeDef *hadc);
bogdanm 84:0b3ab51c8877 949
bogdanm 84:0b3ab51c8877 950
bogdanm 84:0b3ab51c8877 951 /**
bogdanm 84:0b3ab51c8877 952 * @}
bogdanm 84:0b3ab51c8877 953 */
bogdanm 84:0b3ab51c8877 954
bogdanm 84:0b3ab51c8877 955 /**
bogdanm 84:0b3ab51c8877 956 * @}
bogdanm 84:0b3ab51c8877 957 */
bogdanm 84:0b3ab51c8877 958
bogdanm 84:0b3ab51c8877 959 #ifdef __cplusplus
bogdanm 84:0b3ab51c8877 960 }
bogdanm 84:0b3ab51c8877 961 #endif
bogdanm 84:0b3ab51c8877 962
bogdanm 84:0b3ab51c8877 963 #endif /*__STM32L0xx_ADC_H */
bogdanm 84:0b3ab51c8877 964
bogdanm 84:0b3ab51c8877 965
bogdanm 84:0b3ab51c8877 966 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/