Fork of the official mbed C/C SDK provides the software platform and libraries to build your applications for RenBED.

Dependents:   1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB

Fork of mbed by mbed official

Committer:
elijahorr
Date:
Thu Apr 14 07:28:54 2016 +0000
Revision:
121:672067c3ada4
Parent:
107:4f6c30876dfa
.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 107:4f6c30876dfa 1 /**
Kojto 107:4f6c30876dfa 2 ******************************************************************************
Kojto 107:4f6c30876dfa 3 * @file stm32l4xx_hal_adc_ex.h
Kojto 107:4f6c30876dfa 4 * @author MCD Application Team
Kojto 107:4f6c30876dfa 5 * @version V1.0.0
Kojto 107:4f6c30876dfa 6 * @date 26-June-2015
Kojto 107:4f6c30876dfa 7 * @brief Header file of ADC HAL extended module.
Kojto 107:4f6c30876dfa 8 ******************************************************************************
Kojto 107:4f6c30876dfa 9 * @attention
Kojto 107:4f6c30876dfa 10 *
Kojto 107:4f6c30876dfa 11 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
Kojto 107:4f6c30876dfa 12 *
Kojto 107:4f6c30876dfa 13 * Redistribution and use in source and binary forms, with or without modification,
Kojto 107:4f6c30876dfa 14 * are permitted provided that the following conditions are met:
Kojto 107:4f6c30876dfa 15 * 1. Redistributions of source code must retain the above copyright notice,
Kojto 107:4f6c30876dfa 16 * this list of conditions and the following disclaimer.
Kojto 107:4f6c30876dfa 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
Kojto 107:4f6c30876dfa 18 * this list of conditions and the following disclaimer in the documentation
Kojto 107:4f6c30876dfa 19 * and/or other materials provided with the distribution.
Kojto 107:4f6c30876dfa 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Kojto 107:4f6c30876dfa 21 * may be used to endorse or promote products derived from this software
Kojto 107:4f6c30876dfa 22 * without specific prior written permission.
Kojto 107:4f6c30876dfa 23 *
Kojto 107:4f6c30876dfa 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Kojto 107:4f6c30876dfa 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Kojto 107:4f6c30876dfa 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Kojto 107:4f6c30876dfa 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Kojto 107:4f6c30876dfa 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Kojto 107:4f6c30876dfa 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Kojto 107:4f6c30876dfa 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Kojto 107:4f6c30876dfa 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Kojto 107:4f6c30876dfa 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Kojto 107:4f6c30876dfa 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Kojto 107:4f6c30876dfa 34 *
Kojto 107:4f6c30876dfa 35 ******************************************************************************
Kojto 107:4f6c30876dfa 36 */
Kojto 107:4f6c30876dfa 37
Kojto 107:4f6c30876dfa 38 /* Define to prevent recursive inclusion -------------------------------------*/
Kojto 107:4f6c30876dfa 39 #ifndef __STM32L4xx_ADC_EX_H
Kojto 107:4f6c30876dfa 40 #define __STM32L4xx_ADC_EX_H
Kojto 107:4f6c30876dfa 41
Kojto 107:4f6c30876dfa 42 #ifdef __cplusplus
Kojto 107:4f6c30876dfa 43 extern "C" {
Kojto 107:4f6c30876dfa 44 #endif
Kojto 107:4f6c30876dfa 45
Kojto 107:4f6c30876dfa 46 /* Includes ------------------------------------------------------------------*/
Kojto 107:4f6c30876dfa 47 #include "stm32l4xx_hal_def.h"
Kojto 107:4f6c30876dfa 48
Kojto 107:4f6c30876dfa 49 /** @addtogroup STM32L4xx_HAL_Driver
Kojto 107:4f6c30876dfa 50 * @{
Kojto 107:4f6c30876dfa 51 */
Kojto 107:4f6c30876dfa 52
Kojto 107:4f6c30876dfa 53 /** @addtogroup ADCEx ADCEx
Kojto 107:4f6c30876dfa 54 * @{
Kojto 107:4f6c30876dfa 55 */
Kojto 107:4f6c30876dfa 56
Kojto 107:4f6c30876dfa 57 /* Exported types ------------------------------------------------------------*/
Kojto 107:4f6c30876dfa 58 /** @defgroup ADCEx_Exported_Types ADC Extended Exported Types
Kojto 107:4f6c30876dfa 59 * @{
Kojto 107:4f6c30876dfa 60 */
Kojto 107:4f6c30876dfa 61
Kojto 107:4f6c30876dfa 62 /**
Kojto 107:4f6c30876dfa 63 * @brief ADC Injected Conversion Oversampling structure definition
Kojto 107:4f6c30876dfa 64 */
Kojto 107:4f6c30876dfa 65 typedef struct
Kojto 107:4f6c30876dfa 66 {
Kojto 107:4f6c30876dfa 67 uint32_t Ratio; /*!< Configures the oversampling ratio.
Kojto 107:4f6c30876dfa 68 This parameter can be a value of @ref ADCEx_Oversampling_Ratio */
Kojto 107:4f6c30876dfa 69
Kojto 107:4f6c30876dfa 70 uint32_t RightBitShift; /*!< Configures the division coefficient for the Oversampler.
Kojto 107:4f6c30876dfa 71 This parameter can be a value of @ref ADCEx_Right_Bit_Shift */
Kojto 107:4f6c30876dfa 72 }ADC_InjOversamplingTypeDef;
Kojto 107:4f6c30876dfa 73
Kojto 107:4f6c30876dfa 74
Kojto 107:4f6c30876dfa 75
Kojto 107:4f6c30876dfa 76 /**
Kojto 107:4f6c30876dfa 77 * @brief Structure definition of ADC injected group and ADC channel for injected group
Kojto 107:4f6c30876dfa 78 * @note Parameters of this structure are shared within 2 scopes:
Kojto 107:4f6c30876dfa 79 * - Scope channel: InjectedChannel, InjectedRank, InjectedSamplingTime , InjectedSingleDiff, InjectedOffsetNumber, InjectedOffset
Kojto 107:4f6c30876dfa 80 * - Scope injected group (affects all channels of injected group): InjectedNbrOfConversion, InjectedDiscontinuousConvMode,
Kojto 107:4f6c30876dfa 81 * AutoInjectedConv, QueueInjectedContext, ExternalTrigInjecConvEdge, ExternalTrigInjecConv, InjecOversamplingMode, InjecOversampling.
Kojto 107:4f6c30876dfa 82 * @note The setting of these parameters by function HAL_ADCEx_InjectedConfigChannel() is conditioned by ADC state.
Kojto 107:4f6c30876dfa 83 * ADC state can be either:
Kojto 107:4f6c30876dfa 84 * - For all parameters: ADC disabled (this is the only possible ADC state to modify parameter 'InjectedSingleDiff')
Kojto 107:4f6c30876dfa 85 * - For parameters 'InjectedDiscontinuousConvMode', 'QueueInjectedContext', 'InjecOversampling': ADC enabled without conversion on going on injected group.
Kojto 107:4f6c30876dfa 86 * - For parameters 'InjectedSamplingTime', 'InjectedOffset', 'InjectedOffsetNumber', 'AutoInjectedConv': ADC enabled without conversion on going on regular and injected groups.
Kojto 107:4f6c30876dfa 87 * - For parameters 'InjectedChannel', 'InjectedRank', 'InjectedNbrOfConversion', 'ExternalTrigInjecConv', 'ExternalTrigInjecConvEdge': ADC enabled and while conversion on going
Kojto 107:4f6c30876dfa 88 * on regular and injected groups.
Kojto 107:4f6c30876dfa 89 * If ADC is not in the appropriate state to modify some parameters, these parameters setting is bypassed
Kojto 107:4f6c30876dfa 90 * without error reporting (as it can be the expected behaviour in case of intended action to update another parameter (which fulfills the ADC state condition) on the fly).
Kojto 107:4f6c30876dfa 91 */
Kojto 107:4f6c30876dfa 92 typedef struct
Kojto 107:4f6c30876dfa 93 {
Kojto 107:4f6c30876dfa 94 uint32_t InjectedChannel; /*!< Configure the ADC injected channel.
Kojto 107:4f6c30876dfa 95 This parameter can be a value of @ref ADC_channels
Kojto 107:4f6c30876dfa 96 Note: Depending on devices and ADC instances, some channels may not be available. Refer to device DataSheet for channels availability. */
Kojto 107:4f6c30876dfa 97 uint32_t InjectedRank; /*!< The rank in the injected group sequencer.
Kojto 107:4f6c30876dfa 98 This parameter must be a value of @ref ADCEx_injected_rank.
Kojto 107:4f6c30876dfa 99 Note: to disable a channel or change order of conversion sequencer, rank containing a previous channel setting can be overwritten by
Kojto 107:4f6c30876dfa 100 the new channel setting (or parameter number of conversions adjusted). */
Kojto 107:4f6c30876dfa 101 uint32_t InjectedSamplingTime; /*!< Sampling time value to be set for the selected channel.
Kojto 107:4f6c30876dfa 102 Unit: ADC clock cycles.
Kojto 107:4f6c30876dfa 103 Conversion time is the addition of sampling time and processing time (12.5 ADC clock cycles at ADC resolution 12 bits, 10.5 cycles at 10 bits,
Kojto 107:4f6c30876dfa 104 8.5 cycles at 8 bits, 6.5 cycles at 6 bits).
Kojto 107:4f6c30876dfa 105 This parameter can be a value of @ref ADC_sampling_times.
Kojto 107:4f6c30876dfa 106 Caution: This parameter applies to a channel that can be used in a regular and/or injected group.
Kojto 107:4f6c30876dfa 107 It overwrites the last setting.
Kojto 107:4f6c30876dfa 108 Note: In case of usage of internal measurement channels (VrefInt/Vbat/TempSensor),
Kojto 107:4f6c30876dfa 109 sampling time constraints must be respected (sampling time can be adjusted with respect to the ADC clock frequency and sampling time
Kojto 107:4f6c30876dfa 110 setting). Refer to device DataSheet for timings values. */
Kojto 107:4f6c30876dfa 111 uint32_t InjectedSingleDiff; /*!< Selection of single-ended or differential input.
Kojto 107:4f6c30876dfa 112 In differential mode: Differential measurement is between the selected channel 'i' (positive input) and channel 'i+1' (negative input).
Kojto 107:4f6c30876dfa 113 Only channel 'i' has to be configured, channel 'i+1' is configured automatically.
Kojto 107:4f6c30876dfa 114 This parameter must be a value of @ref ADCEx_SingleDifferential.
Kojto 107:4f6c30876dfa 115 Caution: This parameter applies to a channel that can be used in a regular and/or injected group.
Kojto 107:4f6c30876dfa 116 It overwrites the last setting.
Kojto 107:4f6c30876dfa 117 Note: Refer to Reference Manual to ensure the selected channel is available in differential mode.
Kojto 107:4f6c30876dfa 118 Note: When configuring a channel 'i' in differential mode, the channel 'i+1' is not usable separately.
Kojto 107:4f6c30876dfa 119 Note: This parameter must be modified when ADC is disabled (before ADC start conversion or after ADC stop conversion).
Kojto 107:4f6c30876dfa 120 If ADC is enabled, this parameter setting is bypassed without error reporting (as it can be the expected behaviour in case
Kojto 107:4f6c30876dfa 121 of another parameter update on the fly) */
Kojto 107:4f6c30876dfa 122 uint32_t InjectedOffsetNumber; /*!< Selects the offset number.
Kojto 107:4f6c30876dfa 123 This parameter can be a value of @ref ADCEx_OffsetNumber.
Kojto 107:4f6c30876dfa 124 Caution: Only one offset is allowed per channel. This parameter overwrites the last setting. */
Kojto 107:4f6c30876dfa 125 uint32_t InjectedOffset; /*!< Defines the offset to be subtracted from the raw converted data.
Kojto 107:4f6c30876dfa 126 Offset value must be a positive number.
Kojto 107:4f6c30876dfa 127 Depending of ADC resolution selected (12, 10, 8 or 6 bits), this parameter must be a number between Min_Data = 0x000 and Max_Data = 0xFFF,
Kojto 107:4f6c30876dfa 128 0x3FF, 0xFF or 0x3F respectively.
Kojto 107:4f6c30876dfa 129 Note: This parameter must be modified when no conversion is on going on both regular and injected groups (ADC disabled, or ADC enabled
Kojto 107:4f6c30876dfa 130 without continuous mode or external trigger that could launch a conversion). */
Kojto 107:4f6c30876dfa 131 uint32_t InjectedNbrOfConversion; /*!< Specifies the number of ranks that will be converted within the injected group sequencer.
Kojto 107:4f6c30876dfa 132 To use the injected group sequencer and convert several ranks, parameter 'ScanConvMode' must be enabled.
Kojto 107:4f6c30876dfa 133 This parameter must be a number between Min_Data = 1 and Max_Data = 4.
Kojto 107:4f6c30876dfa 134 Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to
Kojto 107:4f6c30876dfa 135 configure a channel on injected group can impact the configuration of other channels previously set. */
Kojto 107:4f6c30876dfa 136 uint32_t InjectedDiscontinuousConvMode; /*!< Specifies whether the conversions sequence of injected group is performed in Complete-sequence/Discontinuous-sequence (main sequence
Kojto 107:4f6c30876dfa 137 subdivided in successive parts).
Kojto 107:4f6c30876dfa 138 Discontinuous mode is used only if sequencer is enabled (parameter 'ScanConvMode'). If sequencer is disabled, this parameter is discarded.
Kojto 107:4f6c30876dfa 139 Discontinuous mode can be enabled only if continuous mode is disabled.
Kojto 107:4f6c30876dfa 140 This parameter can be set to ENABLE or DISABLE.
Kojto 107:4f6c30876dfa 141 Note: This parameter must be modified when ADC is disabled (before ADC start conversion or after ADC stop conversion).
Kojto 107:4f6c30876dfa 142 Note: For injected group, discontinuous mode converts the sequence channel by channel (only one channel at a time).
Kojto 107:4f6c30876dfa 143 Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to
Kojto 107:4f6c30876dfa 144 configure a channel on injected group can impact the configuration of other channels previously set. */
Kojto 107:4f6c30876dfa 145 uint32_t AutoInjectedConv; /*!< Enables or disables the selected ADC automatic injected group conversion after regular one
Kojto 107:4f6c30876dfa 146 This parameter can be set to ENABLE or DISABLE.
Kojto 107:4f6c30876dfa 147 Note: To use Automatic injected conversion, discontinuous mode must be disabled ('DiscontinuousConvMode' and 'InjectedDiscontinuousConvMode' set to DISABLE)
Kojto 107:4f6c30876dfa 148 Note: To use Automatic injected conversion, injected group external triggers must be disabled.
Kojto 107:4f6c30876dfa 149 Note: In case of DMA used with regular group: if DMA configured in normal mode (single shot) JAUTO will be stopped upon DMA transfer complete.
Kojto 107:4f6c30876dfa 150 To maintain JAUTO always enabled, DMA must be configured in circular mode.
Kojto 107:4f6c30876dfa 151 Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to
Kojto 107:4f6c30876dfa 152 configure a channel on injected group can impact the configuration of other channels previously set. */
Kojto 107:4f6c30876dfa 153 uint32_t QueueInjectedContext; /*!< Specifies whether the context queue feature is enabled.
Kojto 107:4f6c30876dfa 154 This parameter can be set to ENABLE or DISABLE.
Kojto 107:4f6c30876dfa 155 If context queue is enabled, injected sequencer&channels configurations are queued on up to 2 contexts. If a
Kojto 107:4f6c30876dfa 156 new injected context is set when queue is full, error is triggered by interruption and through function
Kojto 107:4f6c30876dfa 157 'HAL_ADCEx_InjectedQueueOverflowCallback'.
Kojto 107:4f6c30876dfa 158 Caution: This feature request that the sequence is fully configured before injected conversion start.
Kojto 107:4f6c30876dfa 159 Therefore, configure channels with as many calls to HAL_ADCEx_InjectedConfigChannel() as the 'InjectedNbrOfConversion' parameter.
Kojto 107:4f6c30876dfa 160 Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to
Kojto 107:4f6c30876dfa 161 configure a channel on injected group can impact the configuration of other channels previously set.
Kojto 107:4f6c30876dfa 162 Note: This parameter must be modified when ADC is disabled (before ADC start conversion or after ADC stop conversion). */
Kojto 107:4f6c30876dfa 163 uint32_t ExternalTrigInjecConv; /*!< Selects the external event used to trigger the conversion start of injected group.
Kojto 107:4f6c30876dfa 164 If set to ADC_INJECTED_SOFTWARE_START, external triggers are disabled and software trigger is used instead.
Kojto 107:4f6c30876dfa 165 This parameter can be a value of @ref ADCEx_Injected_External_Trigger_Source.
Kojto 107:4f6c30876dfa 166 Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to
Kojto 107:4f6c30876dfa 167 configure a channel on injected group can impact the configuration of other channels previously set. */
Kojto 107:4f6c30876dfa 168 uint32_t ExternalTrigInjecConvEdge; /*!< Selects the external trigger edge of injected group.
Kojto 107:4f6c30876dfa 169 This parameter can be a value of @ref ADCEx_Injected_External_Trigger_Source_Edge.
Kojto 107:4f6c30876dfa 170 If trigger edge is set to ADC_EXTERNALTRIGINJECCONV_EDGE_NONE, external triggers are disabled and software trigger is used instead.
Kojto 107:4f6c30876dfa 171 Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to
Kojto 107:4f6c30876dfa 172 configure a channel on injected group can impact the configuration of other channels previously set. */
Kojto 107:4f6c30876dfa 173
Kojto 107:4f6c30876dfa 174 uint32_t InjecOversamplingMode; /*!< Specifies whether the oversampling feature is enabled or disabled.
Kojto 107:4f6c30876dfa 175 This parameter can be set to ENABLE or DISABLE.
Kojto 107:4f6c30876dfa 176 Note: This parameter can be modified only if there is no conversion is ongoing (both ADSTART and JADSTART cleared). */
Kojto 107:4f6c30876dfa 177
Kojto 107:4f6c30876dfa 178 ADC_InjOversamplingTypeDef InjecOversampling; /*!< Specifies the Oversampling parameters.
Kojto 107:4f6c30876dfa 179 Caution: this setting overwrites the previous oversampling configuration if oversampling already enabled.
Kojto 107:4f6c30876dfa 180 Note: This parameter can be modified only if there is no conversion is ongoing (both ADSTART and JADSTART cleared). */
Kojto 107:4f6c30876dfa 181 }ADC_InjectionConfTypeDef;
Kojto 107:4f6c30876dfa 182
Kojto 107:4f6c30876dfa 183
Kojto 107:4f6c30876dfa 184 /**
Kojto 107:4f6c30876dfa 185 * @brief Structure definition of ADC multimode
Kojto 107:4f6c30876dfa 186 * @note The setting of these parameters by function HAL_ADCEx_MultiModeConfigChannel() is conditioned by ADCs state (both Master and Slave ADCs).
Kojto 107:4f6c30876dfa 187 * Both Master and Slave ADCs must be disabled.
Kojto 107:4f6c30876dfa 188 */
Kojto 107:4f6c30876dfa 189 typedef struct
Kojto 107:4f6c30876dfa 190 {
Kojto 107:4f6c30876dfa 191 uint32_t Mode; /*!< Configures the ADC to operate in independent or multimode.
Kojto 107:4f6c30876dfa 192 This parameter can be a value of @ref ADCEx_Common_mode. */
Kojto 107:4f6c30876dfa 193 uint32_t DMAAccessMode; /*!< Configures the DMA mode for multimode ADC:
Kojto 107:4f6c30876dfa 194 selection whether 2 DMA channels (each ADC uses its own DMA channel) or 1 DMA channel (one DMA channel for both ADC, DMA of ADC master)
Kojto 107:4f6c30876dfa 195 This parameter can be a value of @ref ADCEx_Direct_memory_access_mode_for_multimode. */
Kojto 107:4f6c30876dfa 196 uint32_t TwoSamplingDelay; /*!< Configures the Delay between 2 sampling phases.
Kojto 107:4f6c30876dfa 197 This parameter can be a value of @ref ADCEx_delay_between_2_sampling_phases.
Kojto 107:4f6c30876dfa 198 Delay range depends on selected resolution:
Kojto 107:4f6c30876dfa 199 from 1 to 12 clock cycles for 12 bits, from 1 to 10 clock cycles for 10 bits,
Kojto 107:4f6c30876dfa 200 from 1 to 8 clock cycles for 8 bits, from 1 to 6 clock cycles for 6 bits. */
Kojto 107:4f6c30876dfa 201 }ADC_MultiModeTypeDef;
Kojto 107:4f6c30876dfa 202
Kojto 107:4f6c30876dfa 203 /**
Kojto 107:4f6c30876dfa 204 * @}
Kojto 107:4f6c30876dfa 205 */
Kojto 107:4f6c30876dfa 206
Kojto 107:4f6c30876dfa 207 /* Exported constants --------------------------------------------------------*/
Kojto 107:4f6c30876dfa 208
Kojto 107:4f6c30876dfa 209 /** @defgroup ADCEx_Exported_Constants ADC Extended Exported Constants
Kojto 107:4f6c30876dfa 210 * @{
Kojto 107:4f6c30876dfa 211 */
Kojto 107:4f6c30876dfa 212
Kojto 107:4f6c30876dfa 213 /** @defgroup ADCEx_SingleDifferential ADC Extended Single-ended/Differential input mode
Kojto 107:4f6c30876dfa 214 * @{
Kojto 107:4f6c30876dfa 215 */
Kojto 107:4f6c30876dfa 216 #define ADC_SINGLE_ENDED ((uint32_t)0x00000000) /*!< ADC channel set in single-ended input mode */
Kojto 107:4f6c30876dfa 217 #define ADC_DIFFERENTIAL_ENDED ((uint32_t)ADC_CR_ADCALDIF) /*!< ADC channel set in differential mode */
Kojto 107:4f6c30876dfa 218 /**
Kojto 107:4f6c30876dfa 219 * @}
Kojto 107:4f6c30876dfa 220 */
Kojto 107:4f6c30876dfa 221
Kojto 107:4f6c30876dfa 222 /** @defgroup ADCEx_OffsetNumber ADC Extended Offset Number
Kojto 107:4f6c30876dfa 223 * @{
Kojto 107:4f6c30876dfa 224 */
Kojto 107:4f6c30876dfa 225 #define ADC_OFFSET_NONE ((uint32_t)0x00) /*!< No offset correction */
Kojto 107:4f6c30876dfa 226 #define ADC_OFFSET_1 ((uint32_t)0x01) /*!< Offset correction to apply to a first channel */
Kojto 107:4f6c30876dfa 227 #define ADC_OFFSET_2 ((uint32_t)0x02) /*!< Offset correction to apply to a second channel */
Kojto 107:4f6c30876dfa 228 #define ADC_OFFSET_3 ((uint32_t)0x03) /*!< Offset correction to apply to a third channel */
Kojto 107:4f6c30876dfa 229 #define ADC_OFFSET_4 ((uint32_t)0x04) /*!< Offset correction to apply to a fourth channel */
Kojto 107:4f6c30876dfa 230 /**
Kojto 107:4f6c30876dfa 231 * @}
Kojto 107:4f6c30876dfa 232 */
Kojto 107:4f6c30876dfa 233
Kojto 107:4f6c30876dfa 234 /** @defgroup ADCEx_regular_rank ADC Extended Regular Channel Rank
Kojto 107:4f6c30876dfa 235 * @{
Kojto 107:4f6c30876dfa 236 */
Kojto 107:4f6c30876dfa 237 #define ADC_REGULAR_RANK_1 ((uint32_t)0x00000001) /*!< ADC regular conversion rank 1 */
Kojto 107:4f6c30876dfa 238 #define ADC_REGULAR_RANK_2 ((uint32_t)0x00000002) /*!< ADC regular conversion rank 2 */
Kojto 107:4f6c30876dfa 239 #define ADC_REGULAR_RANK_3 ((uint32_t)0x00000003) /*!< ADC regular conversion rank 3 */
Kojto 107:4f6c30876dfa 240 #define ADC_REGULAR_RANK_4 ((uint32_t)0x00000004) /*!< ADC regular conversion rank 4 */
Kojto 107:4f6c30876dfa 241 #define ADC_REGULAR_RANK_5 ((uint32_t)0x00000005) /*!< ADC regular conversion rank 5 */
Kojto 107:4f6c30876dfa 242 #define ADC_REGULAR_RANK_6 ((uint32_t)0x00000006) /*!< ADC regular conversion rank 6 */
Kojto 107:4f6c30876dfa 243 #define ADC_REGULAR_RANK_7 ((uint32_t)0x00000007) /*!< ADC regular conversion rank 7 */
Kojto 107:4f6c30876dfa 244 #define ADC_REGULAR_RANK_8 ((uint32_t)0x00000008) /*!< ADC regular conversion rank 8 */
Kojto 107:4f6c30876dfa 245 #define ADC_REGULAR_RANK_9 ((uint32_t)0x00000009) /*!< ADC regular conversion rank 9 */
Kojto 107:4f6c30876dfa 246 #define ADC_REGULAR_RANK_10 ((uint32_t)0x0000000A) /*!< ADC regular conversion rank 10 */
Kojto 107:4f6c30876dfa 247 #define ADC_REGULAR_RANK_11 ((uint32_t)0x0000000B) /*!< ADC regular conversion rank 11 */
Kojto 107:4f6c30876dfa 248 #define ADC_REGULAR_RANK_12 ((uint32_t)0x0000000C) /*!< ADC regular conversion rank 12 */
Kojto 107:4f6c30876dfa 249 #define ADC_REGULAR_RANK_13 ((uint32_t)0x0000000D) /*!< ADC regular conversion rank 13 */
Kojto 107:4f6c30876dfa 250 #define ADC_REGULAR_RANK_14 ((uint32_t)0x0000000E) /*!< ADC regular conversion rank 14 */
Kojto 107:4f6c30876dfa 251 #define ADC_REGULAR_RANK_15 ((uint32_t)0x0000000F) /*!< ADC regular conversion rank 15 */
Kojto 107:4f6c30876dfa 252 #define ADC_REGULAR_RANK_16 ((uint32_t)0x00000010) /*!< ADC regular conversion rank 16 */
Kojto 107:4f6c30876dfa 253 /**
Kojto 107:4f6c30876dfa 254 * @}
Kojto 107:4f6c30876dfa 255 */
Kojto 107:4f6c30876dfa 256
Kojto 107:4f6c30876dfa 257 /** @defgroup ADCEx_injected_rank ADC Extended Injected Channel Rank
Kojto 107:4f6c30876dfa 258 * @{
Kojto 107:4f6c30876dfa 259 */
Kojto 107:4f6c30876dfa 260 #define ADC_INJECTED_RANK_1 ((uint32_t)0x00000001) /*!< ADC injected conversion rank 1 */
Kojto 107:4f6c30876dfa 261 #define ADC_INJECTED_RANK_2 ((uint32_t)0x00000002) /*!< ADC injected conversion rank 2 */
Kojto 107:4f6c30876dfa 262 #define ADC_INJECTED_RANK_3 ((uint32_t)0x00000003) /*!< ADC injected conversion rank 3 */
Kojto 107:4f6c30876dfa 263 #define ADC_INJECTED_RANK_4 ((uint32_t)0x00000004) /*!< ADC injected conversion rank 4 */
Kojto 107:4f6c30876dfa 264 /**injected
Kojto 107:4f6c30876dfa 265 * @}
Kojto 107:4f6c30876dfa 266 */
Kojto 107:4f6c30876dfa 267
Kojto 107:4f6c30876dfa 268 /** @defgroup ADCEx_Injected_External_Trigger_Source_Edge ADC External Trigger Source Edge for Injected Group
Kojto 107:4f6c30876dfa 269 * @{
Kojto 107:4f6c30876dfa 270 */
Kojto 107:4f6c30876dfa 271 #define ADC_EXTERNALTRIGINJECCONV_EDGE_NONE ((uint32_t)0x00000000) /*!< Injected conversions hardware trigger detection disabled */
Kojto 107:4f6c30876dfa 272 #define ADC_EXTERNALTRIGINJECCONV_EDGE_RISING ((uint32_t)ADC_JSQR_JEXTEN_0) /*!< Injected conversions hardware trigger detection on the rising edge */
Kojto 107:4f6c30876dfa 273 #define ADC_EXTERNALTRIGINJECCONV_EDGE_FALLING ((uint32_t)ADC_JSQR_JEXTEN_1) /*!< Injected conversions hardware trigger detection on the falling edge */
Kojto 107:4f6c30876dfa 274 #define ADC_EXTERNALTRIGINJECCONV_EDGE_RISINGFALLING ((uint32_t)ADC_JSQR_JEXTEN) /*!< Injected conversions hardware trigger detection on both the rising and falling edges */
Kojto 107:4f6c30876dfa 275 /**
Kojto 107:4f6c30876dfa 276 * @}
Kojto 107:4f6c30876dfa 277 */
Kojto 107:4f6c30876dfa 278
Kojto 107:4f6c30876dfa 279 /** @defgroup ADCEx_Injected_External_Trigger_Source ADC Extended External Trigger Source for Injected Group
Kojto 107:4f6c30876dfa 280 * @{
Kojto 107:4f6c30876dfa 281 */
Kojto 107:4f6c30876dfa 282 #define ADC_EXTERNALTRIGINJEC_T1_TRGO ((uint32_t)0x00000000) /*!< Event 0 triggers injected group conversion start */
Kojto 107:4f6c30876dfa 283 #define ADC_EXTERNALTRIGINJEC_T1_CC4 ((uint32_t)ADC_JSQR_JEXTSEL_0) /*!< Event 1 triggers injected group conversion start */
Kojto 107:4f6c30876dfa 284 #define ADC_EXTERNALTRIGINJEC_T2_TRGO ((uint32_t)ADC_JSQR_JEXTSEL_1) /*!< Event 2 triggers injected group conversion start */
Kojto 107:4f6c30876dfa 285 #define ADC_EXTERNALTRIGINJEC_T2_CC1 ((uint32_t)(ADC_JSQR_JEXTSEL_1 | ADC_JSQR_JEXTSEL_0)) /*!< Event 3 triggers injected group conversion start */
Kojto 107:4f6c30876dfa 286 #define ADC_EXTERNALTRIGINJEC_T3_CC4 ((uint32_t)ADC_JSQR_JEXTSEL_2) /*!< Event 4 triggers injected group conversion start */
Kojto 107:4f6c30876dfa 287 #define ADC_EXTERNALTRIGINJEC_T4_TRGO ((uint32_t)(ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_0)) /*!< Event 5 triggers injected group conversion start */
Kojto 107:4f6c30876dfa 288 #define ADC_EXTERNALTRIGINJEC_EXT_IT15 ((uint32_t)(ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_1)) /*!< Event 6 triggers injected group conversion start */
Kojto 107:4f6c30876dfa 289 #define ADC_EXTERNALTRIGINJEC_T8_CC4 ((uint32_t)(ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_1 | ADC_JSQR_JEXTSEL_0)) /*!< Event 7 triggers injected group conversion start */
Kojto 107:4f6c30876dfa 290 #define ADC_EXTERNALTRIGINJEC_T1_TRGO2 ((uint32_t)ADC_JSQR_JEXTSEL_3) /*!< Event 8 triggers injected group conversion start */
Kojto 107:4f6c30876dfa 291 #define ADC_EXTERNALTRIGINJEC_T8_TRGO ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_0)) /*!< Event 9 triggers injected group conversion start */
Kojto 107:4f6c30876dfa 292 #define ADC_EXTERNALTRIGINJEC_T8_TRGO2 ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_1)) /*!< Event 10 triggers injected group conversion start */
Kojto 107:4f6c30876dfa 293 #define ADC_EXTERNALTRIGINJEC_T3_CC3 ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_1 | ADC_JSQR_JEXTSEL_0)) /*!< Event 11 triggers injected group conversion start */
Kojto 107:4f6c30876dfa 294 #define ADC_EXTERNALTRIGINJEC_T3_TRGO ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_2)) /*!< Event 12 triggers injected group conversion start */
Kojto 107:4f6c30876dfa 295 #define ADC_EXTERNALTRIGINJEC_T3_CC1 ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_0)) /*!< Event 13 triggers injected group conversion start */
Kojto 107:4f6c30876dfa 296 #define ADC_EXTERNALTRIGINJEC_T6_TRGO ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_1)) /*!< Event 14 triggers injected group conversion start */
Kojto 107:4f6c30876dfa 297 #define ADC_EXTERNALTRIGINJEC_T15_TRGO ((uint32_t)ADC_JSQR_JEXTSEL) /*!< Event 15 triggers injected group conversion start */
Kojto 107:4f6c30876dfa 298
Kojto 107:4f6c30876dfa 299 #define ADC_INJECTED_SOFTWARE_START ((uint32_t)0x00000001) /*!< Software triggers injected group conversion start */
Kojto 107:4f6c30876dfa 300 /**
Kojto 107:4f6c30876dfa 301 * @}
Kojto 107:4f6c30876dfa 302 */
Kojto 107:4f6c30876dfa 303
Kojto 107:4f6c30876dfa 304 /** @defgroup ADCEx_Common_mode ADC Extended Dual ADC Mode
Kojto 107:4f6c30876dfa 305 * @{
Kojto 107:4f6c30876dfa 306 */
Kojto 107:4f6c30876dfa 307 #define ADC_MODE_INDEPENDENT ((uint32_t)(0x00000000)) /*!< Independent ADC conversions mode */
Kojto 107:4f6c30876dfa 308 #define ADC_DUALMODE_REGSIMULT_INJECSIMULT ((uint32_t)(ADC_CCR_DUAL_0)) /*!< Combined regular simultaneous + injected simultaneous mode */
Kojto 107:4f6c30876dfa 309 #define ADC_DUALMODE_REGSIMULT_ALTERTRIG ((uint32_t)(ADC_CCR_DUAL_1)) /*!< Combined regular simultaneous + alternate trigger mode */
Kojto 107:4f6c30876dfa 310 #define ADC_DUALMODE_REGINTERL_INJECSIMULT ((uint32_t)(ADC_CCR_DUAL_1 | ADC_CCR_DUAL_0)) /*!< Combined Interleaved mode + injected simultaneous mode */
Kojto 107:4f6c30876dfa 311 #define ADC_DUALMODE_INJECSIMULT ((uint32_t)(ADC_CCR_DUAL_2 | ADC_CCR_DUAL_0)) /*!< Injected simultaneous mode only */
Kojto 107:4f6c30876dfa 312 #define ADC_DUALMODE_REGSIMULT ((uint32_t)(ADC_CCR_DUAL_2 | ADC_CCR_DUAL_1)) /*!< Regular simultaneous mode only */
Kojto 107:4f6c30876dfa 313 #define ADC_DUALMODE_INTERL ((uint32_t)(ADC_CCR_DUAL_2 | ADC_CCR_DUAL_1 | ADC_CCR_DUAL_0)) /*!< Interleaved mode only */
Kojto 107:4f6c30876dfa 314 #define ADC_DUALMODE_ALTERTRIG ((uint32_t)(ADC_CCR_DUAL_3 | ADC_CCR_DUAL_0)) /*!< Alternate trigger mode only */
Kojto 107:4f6c30876dfa 315 /**
Kojto 107:4f6c30876dfa 316 * @}
Kojto 107:4f6c30876dfa 317 */
Kojto 107:4f6c30876dfa 318
Kojto 107:4f6c30876dfa 319
Kojto 107:4f6c30876dfa 320 /** @defgroup ADCEx_Direct_memory_access_mode_for_multimode ADC Extended DMA Mode for Dual ADC Mode
Kojto 107:4f6c30876dfa 321 * @{
Kojto 107:4f6c30876dfa 322 */
Kojto 107:4f6c30876dfa 323 #define ADC_DMAACCESSMODE_DISABLED ((uint32_t)0x00000000) /*!< DMA multimode disabled: each ADC uses its own DMA channel */
Kojto 107:4f6c30876dfa 324 #define ADC_DMAACCESSMODE_12_10_BITS ((uint32_t)ADC_CCR_MDMA_1) /*!< DMA multimode enabled (one DMA channel for both ADC, DMA of ADC master) for 12 and 10 bits resolution */
Kojto 107:4f6c30876dfa 325 #define ADC_DMAACCESSMODE_8_6_BITS ((uint32_t)ADC_CCR_MDMA) /*!< DMA multimode enabled (one DMA channel for both ADC, DMA of ADC master) for 8 and 6 bits resolution */
Kojto 107:4f6c30876dfa 326 /**
Kojto 107:4f6c30876dfa 327 * @}
Kojto 107:4f6c30876dfa 328 */
Kojto 107:4f6c30876dfa 329
Kojto 107:4f6c30876dfa 330 /** @defgroup ADCEx_delay_between_2_sampling_phases ADC Extended Delay Between 2 Sampling Phases
Kojto 107:4f6c30876dfa 331 * @{
Kojto 107:4f6c30876dfa 332 */
Kojto 107:4f6c30876dfa 333 #define ADC_TWOSAMPLINGDELAY_1CYCLE ((uint32_t)(0x00000000)) /*!< 1 ADC clock cycle delay */
Kojto 107:4f6c30876dfa 334 #define ADC_TWOSAMPLINGDELAY_2CYCLES ((uint32_t)(ADC_CCR_DELAY_0)) /*!< 2 ADC clock cycles delay */
Kojto 107:4f6c30876dfa 335 #define ADC_TWOSAMPLINGDELAY_3CYCLES ((uint32_t)(ADC_CCR_DELAY_1)) /*!< 3 ADC clock cycles delay */
Kojto 107:4f6c30876dfa 336 #define ADC_TWOSAMPLINGDELAY_4CYCLES ((uint32_t)(ADC_CCR_DELAY_1 | ADC_CCR_DELAY_0)) /*!< 4 ADC clock cycles delay */
Kojto 107:4f6c30876dfa 337 #define ADC_TWOSAMPLINGDELAY_5CYCLES ((uint32_t)(ADC_CCR_DELAY_2)) /*!< 5 ADC clock cycles delay */
Kojto 107:4f6c30876dfa 338 #define ADC_TWOSAMPLINGDELAY_6CYCLES ((uint32_t)(ADC_CCR_DELAY_2 | ADC_CCR_DELAY_0)) /*!< 6 ADC clock cycles delay */
Kojto 107:4f6c30876dfa 339 #define ADC_TWOSAMPLINGDELAY_7CYCLES ((uint32_t)(ADC_CCR_DELAY_2 | ADC_CCR_DELAY_1)) /*!< 7 ADC clock cycles delay (lower for non 12-bit resolution) */
Kojto 107:4f6c30876dfa 340 #define ADC_TWOSAMPLINGDELAY_8CYCLES ((uint32_t)(ADC_CCR_DELAY_2 | ADC_CCR_DELAY_1 | ADC_CCR_DELAY_0)) /*!< 8 ADC clock cycles delay (lower for non 12-bit resolution) */
Kojto 107:4f6c30876dfa 341 #define ADC_TWOSAMPLINGDELAY_9CYCLES ((uint32_t)(ADC_CCR_DELAY_3)) /*!< 9 ADC clock cycles delay (lower for non 12-bit resolution) */
Kojto 107:4f6c30876dfa 342 #define ADC_TWOSAMPLINGDELAY_10CYCLES ((uint32_t)(ADC_CCR_DELAY_3 | ADC_CCR_DELAY_0)) /*!< 10 ADC clock cycles delay (lower for non 12-bit resolution) */
Kojto 107:4f6c30876dfa 343 #define ADC_TWOSAMPLINGDELAY_11CYCLES ((uint32_t)(ADC_CCR_DELAY_3 | ADC_CCR_DELAY_1)) /*!< 11 ADC clock cycles delay (lower for non 12-bit resolution) */
Kojto 107:4f6c30876dfa 344 #define ADC_TWOSAMPLINGDELAY_12CYCLES ((uint32_t)(ADC_CCR_DELAY_3 | ADC_CCR_DELAY_1 | ADC_CCR_DELAY_0)) /*!< 12 ADC clock cycles delay (lower for non 12-bit resolution) */
Kojto 107:4f6c30876dfa 345 /**
Kojto 107:4f6c30876dfa 346 * @}
Kojto 107:4f6c30876dfa 347 */
Kojto 107:4f6c30876dfa 348
Kojto 107:4f6c30876dfa 349 /** @defgroup ADCEx_analog_watchdog_number ADC Extended Analog Watchdog Selection
Kojto 107:4f6c30876dfa 350 * @{
Kojto 107:4f6c30876dfa 351 */
Kojto 107:4f6c30876dfa 352 #define ADC_ANALOGWATCHDOG_1 ((uint32_t)0x00000001) /*!< Analog watchdog 1 selection */
Kojto 107:4f6c30876dfa 353 #define ADC_ANALOGWATCHDOG_2 ((uint32_t)0x00000002) /*!< Analog watchdog 2 selection */
Kojto 107:4f6c30876dfa 354 #define ADC_ANALOGWATCHDOG_3 ((uint32_t)0x00000003) /*!< Analog watchdog 3 selection */
Kojto 107:4f6c30876dfa 355 /**
Kojto 107:4f6c30876dfa 356 * @}
Kojto 107:4f6c30876dfa 357 */
Kojto 107:4f6c30876dfa 358
Kojto 107:4f6c30876dfa 359 /** @defgroup ADCEx_analog_watchdog_mode ADC Extended Analog Watchdog Mode
Kojto 107:4f6c30876dfa 360 * @{
Kojto 107:4f6c30876dfa 361 */
Kojto 107:4f6c30876dfa 362 #define ADC_ANALOGWATCHDOG_NONE ((uint32_t) 0x00000000) /*!< No analog watchdog selected */
Kojto 107:4f6c30876dfa 363 #define ADC_ANALOGWATCHDOG_SINGLE_REG ((uint32_t)(ADC_CFGR_AWD1SGL | ADC_CFGR_AWD1EN)) /*!< Analog watchdog applied to a regular group single channel */
Kojto 107:4f6c30876dfa 364 #define ADC_ANALOGWATCHDOG_SINGLE_INJEC ((uint32_t)(ADC_CFGR_AWD1SGL | ADC_CFGR_JAWD1EN)) /*!< Analog watchdog applied to an injected group single channel */
Kojto 107:4f6c30876dfa 365 #define ADC_ANALOGWATCHDOG_SINGLE_REGINJEC ((uint32_t)(ADC_CFGR_AWD1SGL | ADC_CFGR_AWD1EN | ADC_CFGR_JAWD1EN)) /*!< Analog watchdog applied to a regular and injected groups single channel */
Kojto 107:4f6c30876dfa 366 #define ADC_ANALOGWATCHDOG_ALL_REG ((uint32_t) ADC_CFGR_AWD1EN) /*!< Analog watchdog applied to regular group all channels */
Kojto 107:4f6c30876dfa 367 #define ADC_ANALOGWATCHDOG_ALL_INJEC ((uint32_t) ADC_CFGR_JAWD1EN) /*!< Analog watchdog applied to injected group all channels */
Kojto 107:4f6c30876dfa 368 #define ADC_ANALOGWATCHDOG_ALL_REGINJEC ((uint32_t)(ADC_CFGR_AWD1EN | ADC_CFGR_JAWD1EN)) /*!< Analog watchdog applied to regular and injected groups all channels */
Kojto 107:4f6c30876dfa 369 /**
Kojto 107:4f6c30876dfa 370 * @}
Kojto 107:4f6c30876dfa 371 */
Kojto 107:4f6c30876dfa 372
Kojto 107:4f6c30876dfa 373 /** @defgroup ADCEx_conversion_group ADC Extended Conversion Group
Kojto 107:4f6c30876dfa 374 * @{
Kojto 107:4f6c30876dfa 375 */
Kojto 107:4f6c30876dfa 376 #define ADC_REGULAR_GROUP ((uint32_t)(ADC_FLAG_EOC | ADC_FLAG_EOS)) /*!< ADC regular group selection */
Kojto 107:4f6c30876dfa 377 #define ADC_INJECTED_GROUP ((uint32_t)(ADC_FLAG_JEOC | ADC_FLAG_JEOS)) /*!< ADC injected group selection */
Kojto 107:4f6c30876dfa 378 #define ADC_REGULAR_INJECTED_GROUP ((uint32_t)(ADC_FLAG_EOC | ADC_FLAG_EOS | ADC_FLAG_JEOC | ADC_FLAG_JEOS)) /*!< ADC regular and injected groups selection */
Kojto 107:4f6c30876dfa 379 /**
Kojto 107:4f6c30876dfa 380 * @}
Kojto 107:4f6c30876dfa 381 */
Kojto 107:4f6c30876dfa 382
Kojto 107:4f6c30876dfa 383 /** @defgroup ADCEx_Event_type ADC Extended Event Type
Kojto 107:4f6c30876dfa 384 * @{
Kojto 107:4f6c30876dfa 385 */
Kojto 107:4f6c30876dfa 386 #define ADC_EOSMP_EVENT ((uint32_t)ADC_FLAG_EOSMP) /*!< ADC End of Sampling event */
Kojto 107:4f6c30876dfa 387 #define ADC_AWD1_EVENT ((uint32_t)ADC_FLAG_AWD1) /*!< ADC Analog watchdog 1 event (main analog watchdog) */
Kojto 107:4f6c30876dfa 388 #define ADC_AWD2_EVENT ((uint32_t)ADC_FLAG_AWD2) /*!< ADC Analog watchdog 2 event (additional analog watchdog) */
Kojto 107:4f6c30876dfa 389 #define ADC_AWD3_EVENT ((uint32_t)ADC_FLAG_AWD3) /*!< ADC Analog watchdog 3 event (additional analog watchdog) */
Kojto 107:4f6c30876dfa 390 #define ADC_OVR_EVENT ((uint32_t)ADC_FLAG_OVR) /*!< ADC overrun event */
Kojto 107:4f6c30876dfa 391 #define ADC_JQOVF_EVENT ((uint32_t)ADC_FLAG_JQOVF) /*!< ADC Injected Context Queue Overflow event */
Kojto 107:4f6c30876dfa 392
Kojto 107:4f6c30876dfa 393 #define ADC_AWD_EVENT ADC_AWD1_EVENT /*!< ADC Analog watchdog 1 event: Naming for compatibility with other STM32 devices having only one analog watchdog */
Kojto 107:4f6c30876dfa 394 /**
Kojto 107:4f6c30876dfa 395 * @}
Kojto 107:4f6c30876dfa 396 */
Kojto 107:4f6c30876dfa 397
Kojto 107:4f6c30876dfa 398 /** @defgroup ADCEx_interrupts_definition ADC Extended Interrupts Definition
Kojto 107:4f6c30876dfa 399 * @{
Kojto 107:4f6c30876dfa 400 */
Kojto 107:4f6c30876dfa 401 #define ADC_IT_RDY ADC_IER_ADRDY /*!< ADC Ready (ADRDY) interrupt source */
Kojto 107:4f6c30876dfa 402 #define ADC_IT_EOSMP ADC_IER_EOSMP /*!< ADC End of sampling interrupt source */
Kojto 107:4f6c30876dfa 403 #define ADC_IT_EOC ADC_IER_EOC /*!< ADC End of regular conversion interrupt source */
Kojto 107:4f6c30876dfa 404 #define ADC_IT_EOS ADC_IER_EOS /*!< ADC End of regular sequence of conversions interrupt source */
Kojto 107:4f6c30876dfa 405 #define ADC_IT_OVR ADC_IER_OVR /*!< ADC overrun interrupt source */
Kojto 107:4f6c30876dfa 406 #define ADC_IT_JEOC ADC_IER_JEOC /*!< ADC End of injected conversion interrupt source */
Kojto 107:4f6c30876dfa 407 #define ADC_IT_JEOS ADC_IER_JEOS /*!< ADC End of injected sequence of conversions interrupt source */
Kojto 107:4f6c30876dfa 408 #define ADC_IT_AWD1 ADC_IER_AWD1 /*!< ADC Analog watchdog 1 interrupt source (main analog watchdog) */
Kojto 107:4f6c30876dfa 409 #define ADC_IT_AWD2 ADC_IER_AWD2 /*!< ADC Analog watchdog 2 interrupt source (additional analog watchdog) */
Kojto 107:4f6c30876dfa 410 #define ADC_IT_AWD3 ADC_IER_AWD3 /*!< ADC Analog watchdog 3 interrupt source (additional analog watchdog) */
Kojto 107:4f6c30876dfa 411 #define ADC_IT_JQOVF ADC_IER_JQOVF /*!< ADC Injected Context Queue Overflow interrupt source */
Kojto 107:4f6c30876dfa 412
Kojto 107:4f6c30876dfa 413 #define ADC_IT_AWD ADC_IT_AWD1 /*!< ADC Analog watchdog 1 interrupt source: naming for compatibility with other STM32 devices having only one analog watchdog */
Kojto 107:4f6c30876dfa 414
Kojto 107:4f6c30876dfa 415 /**
Kojto 107:4f6c30876dfa 416 * @}
Kojto 107:4f6c30876dfa 417 */
Kojto 107:4f6c30876dfa 418
Kojto 107:4f6c30876dfa 419 /** @defgroup ADCEx_flags_definition ADC Extended Flags Definition
Kojto 107:4f6c30876dfa 420 * @{
Kojto 107:4f6c30876dfa 421 */
Kojto 107:4f6c30876dfa 422 #define ADC_FLAG_RDY ADC_ISR_ADRDY /*!< ADC Ready (ADRDY) flag */
Kojto 107:4f6c30876dfa 423 #define ADC_FLAG_EOSMP ADC_ISR_EOSMP /*!< ADC End of Sampling flag */
Kojto 107:4f6c30876dfa 424 #define ADC_FLAG_EOC ADC_ISR_EOC /*!< ADC End of Regular Conversion flag */
Kojto 107:4f6c30876dfa 425 #define ADC_FLAG_EOS ADC_ISR_EOS /*!< ADC End of Regular sequence of Conversions flag */
Kojto 107:4f6c30876dfa 426 #define ADC_FLAG_OVR ADC_ISR_OVR /*!< ADC overrun flag */
Kojto 107:4f6c30876dfa 427 #define ADC_FLAG_JEOC ADC_ISR_JEOC /*!< ADC End of Injected Conversion flag */
Kojto 107:4f6c30876dfa 428 #define ADC_FLAG_JEOS ADC_ISR_JEOS /*!< ADC End of Injected sequence of Conversions flag */
Kojto 107:4f6c30876dfa 429 #define ADC_FLAG_AWD1 ADC_ISR_AWD1 /*!< ADC Analog watchdog 1 flag (main analog watchdog) */
Kojto 107:4f6c30876dfa 430 #define ADC_FLAG_AWD2 ADC_ISR_AWD2 /*!< ADC Analog watchdog 2 flag (additional analog watchdog) */
Kojto 107:4f6c30876dfa 431 #define ADC_FLAG_AWD3 ADC_ISR_AWD3 /*!< ADC Analog watchdog 3 flag (additional analog watchdog) */
Kojto 107:4f6c30876dfa 432 #define ADC_FLAG_JQOVF ADC_ISR_JQOVF /*!< ADC Injected Context Queue Overflow flag */
Kojto 107:4f6c30876dfa 433
Kojto 107:4f6c30876dfa 434 #define ADC_FLAG_AWD ADC_FLAG_AWD1 /*!< ADC Analog watchdog 1 flag: Naming for compatibility with other STM32 devices having only one analog watchdog */
Kojto 107:4f6c30876dfa 435
Kojto 107:4f6c30876dfa 436 #define ADC_FLAG_ALL (ADC_FLAG_RDY | ADC_FLAG_EOSMP | ADC_FLAG_EOC | ADC_FLAG_EOS | \
Kojto 107:4f6c30876dfa 437 ADC_FLAG_JEOC | ADC_FLAG_JEOS | ADC_FLAG_OVR | ADC_FLAG_AWD1 | \
Kojto 107:4f6c30876dfa 438 ADC_FLAG_AWD2 | ADC_FLAG_AWD3 | ADC_FLAG_JQOVF) /*!< ADC all flags */
Kojto 107:4f6c30876dfa 439
Kojto 107:4f6c30876dfa 440 /* Combination of all post-conversion flags bits: EOC/EOS, JEOC/JEOS, OVR, AWDx, JQOVF */
Kojto 107:4f6c30876dfa 441 #define ADC_FLAG_POSTCONV_ALL (ADC_FLAG_EOC | ADC_FLAG_EOS | ADC_FLAG_JEOC | ADC_FLAG_JEOS | \
Kojto 107:4f6c30876dfa 442 ADC_FLAG_OVR | ADC_FLAG_AWD1 | ADC_FLAG_AWD2 | ADC_FLAG_AWD3 | \
Kojto 107:4f6c30876dfa 443 ADC_FLAG_JQOVF) /*!< ADC post-conversion all flags */
Kojto 107:4f6c30876dfa 444
Kojto 107:4f6c30876dfa 445 /**
Kojto 107:4f6c30876dfa 446 * @}
Kojto 107:4f6c30876dfa 447 */
Kojto 107:4f6c30876dfa 448
Kojto 107:4f6c30876dfa 449
Kojto 107:4f6c30876dfa 450 /** @defgroup ADCEx_injected_rank ADC Extended Injected Channel Rank
Kojto 107:4f6c30876dfa 451 * @{
Kojto 107:4f6c30876dfa 452 */
Kojto 107:4f6c30876dfa 453 #define ADC_INJECTED_RANK_1 ((uint32_t)0x00000001) /*!< ADC injected conversion rank 1 */
Kojto 107:4f6c30876dfa 454 #define ADC_INJECTED_RANK_2 ((uint32_t)0x00000002) /*!< ADC injected conversion rank 2 */
Kojto 107:4f6c30876dfa 455 #define ADC_INJECTED_RANK_3 ((uint32_t)0x00000003) /*!< ADC injected conversion rank 3 */
Kojto 107:4f6c30876dfa 456 #define ADC_INJECTED_RANK_4 ((uint32_t)0x00000004) /*!< ADC injected conversion rank 4 */
Kojto 107:4f6c30876dfa 457 /**
Kojto 107:4f6c30876dfa 458 * @}
Kojto 107:4f6c30876dfa 459 */
Kojto 107:4f6c30876dfa 460
Kojto 107:4f6c30876dfa 461
Kojto 107:4f6c30876dfa 462
Kojto 107:4f6c30876dfa 463 /** @defgroup ADCEx_Oversampling_Ratio ADC Extended Oversampling Ratio
Kojto 107:4f6c30876dfa 464 * @{
Kojto 107:4f6c30876dfa 465 */
Kojto 107:4f6c30876dfa 466
Kojto 107:4f6c30876dfa 467 #define ADC_OVERSAMPLING_RATIO_2 ((uint32_t)0x00000000) /*!< ADC Oversampling ratio 2x */
Kojto 107:4f6c30876dfa 468 #define ADC_OVERSAMPLING_RATIO_4 ((uint32_t)ADC_CFGR2_OVSR_0) /*!< ADC Oversampling ratio 4x */
Kojto 107:4f6c30876dfa 469 #define ADC_OVERSAMPLING_RATIO_8 ((uint32_t)ADC_CFGR2_OVSR_1) /*!< ADC Oversampling ratio 8x */
Kojto 107:4f6c30876dfa 470 #define ADC_OVERSAMPLING_RATIO_16 ((uint32_t)(ADC_CFGR2_OVSR_1 | ADC_CFGR2_OVSR_0)) /*!< ADC Oversampling ratio 16x */
Kojto 107:4f6c30876dfa 471 #define ADC_OVERSAMPLING_RATIO_32 ((uint32_t)ADC_CFGR2_OVSR_2) /*!< ADC Oversampling ratio 32x */
Kojto 107:4f6c30876dfa 472 #define ADC_OVERSAMPLING_RATIO_64 ((uint32_t)(ADC_CFGR2_OVSR_2 | ADC_CFGR2_OVSR_0)) /*!< ADC Oversampling ratio 64x */
Kojto 107:4f6c30876dfa 473 #define ADC_OVERSAMPLING_RATIO_128 ((uint32_t)(ADC_CFGR2_OVSR_2 | ADC_CFGR2_OVSR_1)) /*!< ADC Oversampling ratio 128x */
Kojto 107:4f6c30876dfa 474 #define ADC_OVERSAMPLING_RATIO_256 ((uint32_t)(ADC_CFGR2_OVSR)) /*!< ADC Oversampling ratio 256x */
Kojto 107:4f6c30876dfa 475 /**
Kojto 107:4f6c30876dfa 476 * @}
Kojto 107:4f6c30876dfa 477 */
Kojto 107:4f6c30876dfa 478
Kojto 107:4f6c30876dfa 479 /** @defgroup ADCEx_Right_Bit_Shift ADC Extended Oversampling Right Shift
Kojto 107:4f6c30876dfa 480 * @{
Kojto 107:4f6c30876dfa 481 */
Kojto 107:4f6c30876dfa 482 #define ADC_RIGHTBITSHIFT_NONE ((uint32_t)0x00000000) /*!< ADC No bit shift for oversampling */
Kojto 107:4f6c30876dfa 483 #define ADC_RIGHTBITSHIFT_1 ((uint32_t)ADC_CFGR2_OVSS_0) /*!< ADC 1 bit shift for oversampling */
Kojto 107:4f6c30876dfa 484 #define ADC_RIGHTBITSHIFT_2 ((uint32_t)ADC_CFGR2_OVSS_1) /*!< ADC 2 bits shift for oversampling */
Kojto 107:4f6c30876dfa 485 #define ADC_RIGHTBITSHIFT_3 ((uint32_t)(ADC_CFGR2_OVSS_1 | ADC_CFGR2_OVSS_0)) /*!< ADC 3 bits shift for oversampling */
Kojto 107:4f6c30876dfa 486 #define ADC_RIGHTBITSHIFT_4 ((uint32_t)ADC_CFGR2_OVSS_2) /*!< ADC 4 bits shift for oversampling */
Kojto 107:4f6c30876dfa 487 #define ADC_RIGHTBITSHIFT_5 ((uint32_t)(ADC_CFGR2_OVSS_2 | ADC_CFGR2_OVSS_0)) /*!< ADC 5 bits shift for oversampling */
Kojto 107:4f6c30876dfa 488 #define ADC_RIGHTBITSHIFT_6 ((uint32_t)(ADC_CFGR2_OVSS_2 | ADC_CFGR2_OVSS_1)) /*!< ADC 6 bits shift for oversampling */
Kojto 107:4f6c30876dfa 489 #define ADC_RIGHTBITSHIFT_7 ((uint32_t)(ADC_CFGR2_OVSS_2 | ADC_CFGR2_OVSS_1 | ADC_CFGR2_OVSS_0)) /*!< ADC 7 bits shift for oversampling */
Kojto 107:4f6c30876dfa 490 #define ADC_RIGHTBITSHIFT_8 ((uint32_t)ADC_CFGR2_OVSS_3) /*!< ADC 8 bits shift for oversampling */
Kojto 107:4f6c30876dfa 491 /**
Kojto 107:4f6c30876dfa 492 * @}
Kojto 107:4f6c30876dfa 493 */
Kojto 107:4f6c30876dfa 494
Kojto 107:4f6c30876dfa 495 /** @defgroup ADCEx_Triggered_Oversampling_Mode ADC Extended Triggered Regular Oversampling
Kojto 107:4f6c30876dfa 496 * @{
Kojto 107:4f6c30876dfa 497 */
Kojto 107:4f6c30876dfa 498 #define ADC_TRIGGEREDMODE_SINGLE_TRIGGER ((uint32_t)0x00000000) /*!< A single trigger for all channel oversampled conversions */
Kojto 107:4f6c30876dfa 499 #define ADC_TRIGGEREDMODE_MULTI_TRIGGER ((uint32_t)ADC_CFGR2_TROVS) /*!< A trigger for each oversampled conversion */
Kojto 107:4f6c30876dfa 500 /**
Kojto 107:4f6c30876dfa 501 * @}
Kojto 107:4f6c30876dfa 502 */
Kojto 107:4f6c30876dfa 503
Kojto 107:4f6c30876dfa 504 /** @defgroup ADCEx_Regular_Oversampling_Mode ADC Extended Regular Oversampling Continued or Resumed Mode
Kojto 107:4f6c30876dfa 505 * @{
Kojto 107:4f6c30876dfa 506 */
Kojto 107:4f6c30876dfa 507 #define ADC_REGOVERSAMPLING_CONTINUED_MODE ((uint32_t)0x00000000) /*!< Oversampling buffer maintained during injection sequence */
Kojto 107:4f6c30876dfa 508 #define ADC_REGOVERSAMPLING_RESUMED_MODE ((uint32_t)ADC_CFGR2_ROVSM) /*!< Oversampling buffer zeroed during injection sequence */
Kojto 107:4f6c30876dfa 509 /**
Kojto 107:4f6c30876dfa 510 * @}
Kojto 107:4f6c30876dfa 511 */
Kojto 107:4f6c30876dfa 512
Kojto 107:4f6c30876dfa 513 /**
Kojto 107:4f6c30876dfa 514 * @}
Kojto 107:4f6c30876dfa 515 */
Kojto 107:4f6c30876dfa 516
Kojto 107:4f6c30876dfa 517
Kojto 107:4f6c30876dfa 518
Kojto 107:4f6c30876dfa 519 /* Private macros -----------------------------------------------------------*/
Kojto 107:4f6c30876dfa 520
Kojto 107:4f6c30876dfa 521 /** @defgroup ADCEx_Private_Macro_internal_HAL_driver ADC Extended Private Macros
Kojto 107:4f6c30876dfa 522 * @{
Kojto 107:4f6c30876dfa 523 */
Kojto 107:4f6c30876dfa 524
Kojto 107:4f6c30876dfa 525 /**
Kojto 107:4f6c30876dfa 526 * @brief Test if conversion trigger of injected group is software start
Kojto 107:4f6c30876dfa 527 * or external trigger.
Kojto 107:4f6c30876dfa 528 * @param __HANDLE__: ADC handle.
Kojto 107:4f6c30876dfa 529 * @retval SET (software start) or RESET (external trigger).
Kojto 107:4f6c30876dfa 530 */
Kojto 107:4f6c30876dfa 531 #define ADC_IS_SOFTWARE_START_INJECTED(__HANDLE__) \
Kojto 107:4f6c30876dfa 532 (((__HANDLE__)->Instance->JSQR & ADC_JSQR_JEXTEN) == RESET)
Kojto 107:4f6c30876dfa 533
Kojto 107:4f6c30876dfa 534 /**
Kojto 107:4f6c30876dfa 535 * @brief Check if conversion is on going on regular or injected groups.
Kojto 107:4f6c30876dfa 536 * @param __HANDLE__: ADC handle.
Kojto 107:4f6c30876dfa 537 * @retval SET (conversion is on going) or RESET (no conversion is on going).
Kojto 107:4f6c30876dfa 538 */
Kojto 107:4f6c30876dfa 539 #define ADC_IS_CONVERSION_ONGOING_REGULAR_INJECTED(__HANDLE__) \
Kojto 107:4f6c30876dfa 540 (( (((__HANDLE__)->Instance->CR) & (ADC_CR_ADSTART | ADC_CR_JADSTART)) == RESET \
Kojto 107:4f6c30876dfa 541 ) ? RESET : SET)
Kojto 107:4f6c30876dfa 542
Kojto 107:4f6c30876dfa 543
Kojto 107:4f6c30876dfa 544 /**
Kojto 107:4f6c30876dfa 545 * @brief Check if conversion is on going on injected group.
Kojto 107:4f6c30876dfa 546 * @param __HANDLE__: ADC handle.
Kojto 107:4f6c30876dfa 547 * @retval SET (conversion is on going) or RESET (no conversion is on going).
Kojto 107:4f6c30876dfa 548 */
Kojto 107:4f6c30876dfa 549 #define ADC_IS_CONVERSION_ONGOING_INJECTED(__HANDLE__) \
Kojto 107:4f6c30876dfa 550 (( (((__HANDLE__)->Instance->CR) & ADC_CR_JADSTART) == RESET \
Kojto 107:4f6c30876dfa 551 ) ? RESET : SET)
Kojto 107:4f6c30876dfa 552
Kojto 107:4f6c30876dfa 553
Kojto 107:4f6c30876dfa 554 /**
Kojto 107:4f6c30876dfa 555 * @brief Check whether or not ADC is independent.
Kojto 107:4f6c30876dfa 556 * @param __HANDLE__: ADC handle.
Kojto 107:4f6c30876dfa 557 * @retval SET (ADC is independent) or RESET (ADC is not).
Kojto 107:4f6c30876dfa 558 */
Kojto 107:4f6c30876dfa 559 #define ADC_IS_INDEPENDENT(__HANDLE__) \
Kojto 107:4f6c30876dfa 560 ( ( ( ((__HANDLE__)->Instance) == ADC3) \
Kojto 107:4f6c30876dfa 561 )? \
Kojto 107:4f6c30876dfa 562 SET \
Kojto 107:4f6c30876dfa 563 : \
Kojto 107:4f6c30876dfa 564 RESET \
Kojto 107:4f6c30876dfa 565 )
Kojto 107:4f6c30876dfa 566
Kojto 107:4f6c30876dfa 567
Kojto 107:4f6c30876dfa 568
Kojto 107:4f6c30876dfa 569 /**
Kojto 107:4f6c30876dfa 570 * @brief Set the sample time for Channels numbers between 0 and 9.
Kojto 107:4f6c30876dfa 571 * @param __SAMPLETIME__: Sample time parameter.
Kojto 107:4f6c30876dfa 572 * @param __CHANNELNB__: Channel number.
Kojto 107:4f6c30876dfa 573 * @retval None
Kojto 107:4f6c30876dfa 574 */
Kojto 107:4f6c30876dfa 575 #define ADC_SMPR1(__SAMPLETIME__, __CHANNELNB__) ((__SAMPLETIME__) << (POSITION_VAL(ADC_SMPR1_SMP1) * (__CHANNELNB__)))
Kojto 107:4f6c30876dfa 576
Kojto 107:4f6c30876dfa 577 /**
Kojto 107:4f6c30876dfa 578 * @brief Set the sample time for Channels numbers between 10 and 18.
Kojto 107:4f6c30876dfa 579 * @param __SAMPLETIME__: Sample time parameter.
Kojto 107:4f6c30876dfa 580 * @param __CHANNELNB__: Channel number.
Kojto 107:4f6c30876dfa 581 * @retval None
Kojto 107:4f6c30876dfa 582 */
Kojto 107:4f6c30876dfa 583 #define ADC_SMPR2(__SAMPLETIME__, __CHANNELNB__) ((__SAMPLETIME__) << ((POSITION_VAL(ADC_SMPR2_SMP11) * ((__CHANNELNB__) - 10))))
Kojto 107:4f6c30876dfa 584
Kojto 107:4f6c30876dfa 585
Kojto 107:4f6c30876dfa 586 /**
Kojto 107:4f6c30876dfa 587 * @brief Set the selected regular Channel rank for rank between 1 and 4.
Kojto 107:4f6c30876dfa 588 * @param __CHANNELNB__: Channel number.
Kojto 107:4f6c30876dfa 589 * @param __RANKNB__: Rank number.
Kojto 107:4f6c30876dfa 590 * @retval None
Kojto 107:4f6c30876dfa 591 */
Kojto 107:4f6c30876dfa 592 #define ADC_SQR1_RK(__CHANNELNB__, __RANKNB__) ((__CHANNELNB__) << (POSITION_VAL(ADC_SQR1_SQ1) * (__RANKNB__)))
Kojto 107:4f6c30876dfa 593
Kojto 107:4f6c30876dfa 594 /**
Kojto 107:4f6c30876dfa 595 * @brief Set the selected regular Channel rank for rank between 5 and 9.
Kojto 107:4f6c30876dfa 596 * @param __CHANNELNB__: Channel number.
Kojto 107:4f6c30876dfa 597 * @param __RANKNB__: Rank number.
Kojto 107:4f6c30876dfa 598 * @retval None
Kojto 107:4f6c30876dfa 599 */
Kojto 107:4f6c30876dfa 600 #define ADC_SQR2_RK(__CHANNELNB__, __RANKNB__) ((__CHANNELNB__) << (POSITION_VAL(ADC_SQR2_SQ6) * ((__RANKNB__) - 5)))
Kojto 107:4f6c30876dfa 601
Kojto 107:4f6c30876dfa 602 /**
Kojto 107:4f6c30876dfa 603 * @brief Set the selected regular Channel rank for rank between 10 and 14.
Kojto 107:4f6c30876dfa 604 * @param __CHANNELNB__: Channel number.
Kojto 107:4f6c30876dfa 605 * @param __RANKNB__: Rank number.
Kojto 107:4f6c30876dfa 606 * @retval None
Kojto 107:4f6c30876dfa 607 */
Kojto 107:4f6c30876dfa 608 #define ADC_SQR3_RK(__CHANNELNB__, __RANKNB__) ((__CHANNELNB__) << (POSITION_VAL(ADC_SQR3_SQ11) * ((__RANKNB__) - 10)))
Kojto 107:4f6c30876dfa 609
Kojto 107:4f6c30876dfa 610 /**
Kojto 107:4f6c30876dfa 611 * @brief Set the selected regular Channel rank for rank between 15 and 16.
Kojto 107:4f6c30876dfa 612 * @param __CHANNELNB__: Channel number.
Kojto 107:4f6c30876dfa 613 * @param __RANKNB__: Rank number.
Kojto 107:4f6c30876dfa 614 * @retval None
Kojto 107:4f6c30876dfa 615 */
Kojto 107:4f6c30876dfa 616 #define ADC_SQR4_RK(__CHANNELNB__, __RANKNB__) ((__CHANNELNB__) << (POSITION_VAL(ADC_SQR4_SQ16) * ((__RANKNB__) - 15)))
Kojto 107:4f6c30876dfa 617
Kojto 107:4f6c30876dfa 618 /**
Kojto 107:4f6c30876dfa 619 * @brief Set the selected injected Channel rank.
Kojto 107:4f6c30876dfa 620 * @param __CHANNELNB__: Channel number.
Kojto 107:4f6c30876dfa 621 * @param __RANKNB__: Rank number.
Kojto 107:4f6c30876dfa 622 * @retval None
Kojto 107:4f6c30876dfa 623 */
Kojto 107:4f6c30876dfa 624 #define ADC_JSQR_RK(__CHANNELNB__, __RANKNB__) ((__CHANNELNB__) << ((POSITION_VAL(ADC_JSQR_JSQ1)-2) * (__RANKNB__) +2))
Kojto 107:4f6c30876dfa 625
Kojto 107:4f6c30876dfa 626
Kojto 107:4f6c30876dfa 627 /**
Kojto 107:4f6c30876dfa 628 * @brief Set the Analog Watchdog 1 channel.
Kojto 107:4f6c30876dfa 629 * @param __CHANNEL__: channel to be monitored by Analog Watchdog 1.
Kojto 107:4f6c30876dfa 630 * @retval None
Kojto 107:4f6c30876dfa 631 */
Kojto 107:4f6c30876dfa 632 #define ADC_CFGR_SET_AWD1CH(__CHANNEL__) ((__CHANNEL__) << POSITION_VAL(ADC_CFGR_AWD1CH))
Kojto 107:4f6c30876dfa 633
Kojto 107:4f6c30876dfa 634 /**
Kojto 107:4f6c30876dfa 635 * @brief Configure the channel number in Analog Watchdog 2 or 3.
Kojto 107:4f6c30876dfa 636 * @param __CHANNEL__: ADC Channel
Kojto 107:4f6c30876dfa 637 * @retval None
Kojto 107:4f6c30876dfa 638 */
Kojto 107:4f6c30876dfa 639 #define ADC_CFGR_SET_AWD23CR(__CHANNEL__) (1U << (__CHANNEL__))
Kojto 107:4f6c30876dfa 640
Kojto 107:4f6c30876dfa 641 /**
Kojto 107:4f6c30876dfa 642 * @brief Configure ADC injected context queue
Kojto 107:4f6c30876dfa 643 * @param __INJECT_CONTEXT_QUEUE_MODE__: Injected context queue mode.
Kojto 107:4f6c30876dfa 644 * @retval None
Kojto 107:4f6c30876dfa 645 */
Kojto 107:4f6c30876dfa 646 #define ADC_CFGR_INJECT_CONTEXT_QUEUE(__INJECT_CONTEXT_QUEUE_MODE__) ((__INJECT_CONTEXT_QUEUE_MODE__) << POSITION_VAL(ADC_CFGR_JQM))
Kojto 107:4f6c30876dfa 647
Kojto 107:4f6c30876dfa 648 /**
Kojto 107:4f6c30876dfa 649 * @brief Configure ADC discontinuous conversion mode for injected group
Kojto 107:4f6c30876dfa 650 * @param __INJECT_DISCONTINUOUS_MODE__: Injected discontinuous mode.
Kojto 107:4f6c30876dfa 651 * @retval None
Kojto 107:4f6c30876dfa 652 */
Kojto 107:4f6c30876dfa 653 #define ADC_CFGR_INJECT_DISCCONTINUOUS(__INJECT_DISCONTINUOUS_MODE__) ((__INJECT_DISCONTINUOUS_MODE__) << POSITION_VAL(ADC_CFGR_JDISCEN))
Kojto 107:4f6c30876dfa 654
Kojto 107:4f6c30876dfa 655 /**
Kojto 107:4f6c30876dfa 656 * @brief Configure ADC discontinuous conversion mode for regular group
Kojto 107:4f6c30876dfa 657 * @param __REG_DISCONTINUOUS_MODE__: Regular discontinuous mode.
Kojto 107:4f6c30876dfa 658 * @retval None
Kojto 107:4f6c30876dfa 659 */
Kojto 107:4f6c30876dfa 660 #define ADC_CFGR_REG_DISCONTINUOUS(__REG_DISCONTINUOUS_MODE__) ((__REG_DISCONTINUOUS_MODE__) << POSITION_VAL(ADC_CFGR_DISCEN))
Kojto 107:4f6c30876dfa 661 /**
Kojto 107:4f6c30876dfa 662 * @brief Configure the number of discontinuous conversions for regular group.
Kojto 107:4f6c30876dfa 663 * @param __NBR_DISCONTINUOUS_CONV__: Number of discontinuous conversions.
Kojto 107:4f6c30876dfa 664 * @retval None
Kojto 107:4f6c30876dfa 665 */
Kojto 107:4f6c30876dfa 666 #define ADC_CFGR_DISCONTINUOUS_NUM(__NBR_DISCONTINUOUS_CONV__) (((__NBR_DISCONTINUOUS_CONV__) - 1) << POSITION_VAL(ADC_CFGR_DISCNUM))
Kojto 107:4f6c30876dfa 667
Kojto 107:4f6c30876dfa 668 /**
Kojto 107:4f6c30876dfa 669 * @brief Configure the ADC auto delay mode.
Kojto 107:4f6c30876dfa 670 * @param __AUTOWAIT__: Auto delay bit enable or disable.
Kojto 107:4f6c30876dfa 671 * @retval None
Kojto 107:4f6c30876dfa 672 */
Kojto 107:4f6c30876dfa 673 #define ADC_CFGR_AUTOWAIT(__AUTOWAIT__) ((__AUTOWAIT__) << POSITION_VAL(ADC_CFGR_AUTDLY))
Kojto 107:4f6c30876dfa 674
Kojto 107:4f6c30876dfa 675 /**
Kojto 107:4f6c30876dfa 676 * @brief Configure ADC continuous conversion mode.
Kojto 107:4f6c30876dfa 677 * @param __CONTINUOUS_MODE__: Continuous mode.
Kojto 107:4f6c30876dfa 678 * @retval None
Kojto 107:4f6c30876dfa 679 */
Kojto 107:4f6c30876dfa 680 #define ADC_CFGR_CONTINUOUS(__CONTINUOUS_MODE__) ((__CONTINUOUS_MODE__) << POSITION_VAL(ADC_CFGR_CONT))
Kojto 107:4f6c30876dfa 681
Kojto 107:4f6c30876dfa 682 /**
Kojto 107:4f6c30876dfa 683 * @brief Configure the ADC DMA continuous request.
Kojto 107:4f6c30876dfa 684 * @param __DMACONTREQ_MODE__: DMA continuous request mode.
Kojto 107:4f6c30876dfa 685 * @retval None
Kojto 107:4f6c30876dfa 686 */
Kojto 107:4f6c30876dfa 687 #define ADC_CFGR_DMACONTREQ(__DMACONTREQ_MODE__) ((__DMACONTREQ_MODE__) << POSITION_VAL(ADC_CFGR_DMACFG))
Kojto 107:4f6c30876dfa 688
Kojto 107:4f6c30876dfa 689
Kojto 107:4f6c30876dfa 690 /**
Kojto 107:4f6c30876dfa 691 * @brief Configure the channel number into offset OFRx register.
Kojto 107:4f6c30876dfa 692 * @param __CHANNEL__: ADC Channel.
Kojto 107:4f6c30876dfa 693 * @retval None
Kojto 107:4f6c30876dfa 694 */
Kojto 107:4f6c30876dfa 695 #define ADC_OFR_CHANNEL(__CHANNEL__) ((__CHANNEL__) << POSITION_VAL(ADC_OFR1_OFFSET1_CH))
Kojto 107:4f6c30876dfa 696
Kojto 107:4f6c30876dfa 697 /**
Kojto 107:4f6c30876dfa 698 * @brief Configure the channel number into differential mode selection register.
Kojto 107:4f6c30876dfa 699 * @param __CHANNEL__: ADC Channel.
Kojto 107:4f6c30876dfa 700 * @retval None
Kojto 107:4f6c30876dfa 701 */
Kojto 107:4f6c30876dfa 702 #define ADC_DIFSEL_CHANNEL(__CHANNEL__) (1U << (__CHANNEL__))
Kojto 107:4f6c30876dfa 703
Kojto 107:4f6c30876dfa 704 /**
Kojto 107:4f6c30876dfa 705 * @brief Configure calibration factor in differential mode to be set into calibration register.
Kojto 107:4f6c30876dfa 706 * @param __CALIBRATION_FACTOR__: Calibration factor value.
Kojto 107:4f6c30876dfa 707 * @retval None
Kojto 107:4f6c30876dfa 708 */
Kojto 107:4f6c30876dfa 709 #define ADC_CALFACT_DIFF_SET(__CALIBRATION_FACTOR__) (((__CALIBRATION_FACTOR__) & (ADC_CALFACT_CALFACT_D >> POSITION_VAL(ADC_CALFACT_CALFACT_D)) ) << POSITION_VAL(ADC_CALFACT_CALFACT_D))
Kojto 107:4f6c30876dfa 710 /**
Kojto 107:4f6c30876dfa 711 * @brief Calibration factor in differential mode to be retrieved from calibration register.
Kojto 107:4f6c30876dfa 712 * @param __CALIBRATION_FACTOR__: Calibration factor value.
Kojto 107:4f6c30876dfa 713 * @retval None
Kojto 107:4f6c30876dfa 714 */
Kojto 107:4f6c30876dfa 715 #define ADC_CALFACT_DIFF_GET(__CALIBRATION_FACTOR__) ((__CALIBRATION_FACTOR__) >> POSITION_VAL(ADC_CALFACT_CALFACT_D))
Kojto 107:4f6c30876dfa 716
Kojto 107:4f6c30876dfa 717 /**
Kojto 107:4f6c30876dfa 718 * @brief Configure the analog watchdog high threshold into registers TR1, TR2 or TR3.
Kojto 107:4f6c30876dfa 719 * @param __THRESHOLD__: Threshold value.
Kojto 107:4f6c30876dfa 720 * @retval None
Kojto 107:4f6c30876dfa 721 */
Kojto 107:4f6c30876dfa 722 #define ADC_TRX_HIGHTHRESHOLD(__THRESHOLD__) ((__THRESHOLD__) << 16)
Kojto 107:4f6c30876dfa 723
Kojto 107:4f6c30876dfa 724 /**
Kojto 107:4f6c30876dfa 725 * @brief Configure the ADC DMA continuous request for ADC multimode.
Kojto 107:4f6c30876dfa 726 * @param __DMACONTREQ_MODE__: DMA continuous request mode.
Kojto 107:4f6c30876dfa 727 * @retval None
Kojto 107:4f6c30876dfa 728 */
Kojto 107:4f6c30876dfa 729 #define ADC_CCR_MULTI_DMACONTREQ(__DMACONTREQ_MODE__) ((__DMACONTREQ_MODE__) << POSITION_VAL(ADC_CCR_DMACFG))
Kojto 107:4f6c30876dfa 730
Kojto 107:4f6c30876dfa 731
Kojto 107:4f6c30876dfa 732 /**
Kojto 107:4f6c30876dfa 733 * @brief Enable the ADC peripheral.
Kojto 107:4f6c30876dfa 734 * @param __HANDLE__: ADC handle.
Kojto 107:4f6c30876dfa 735 * @retval None
Kojto 107:4f6c30876dfa 736 */
Kojto 107:4f6c30876dfa 737 #define ADC_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= ADC_CR_ADEN)
Kojto 107:4f6c30876dfa 738
Kojto 107:4f6c30876dfa 739 /**
Kojto 107:4f6c30876dfa 740 * @brief Verification of hardware constraints before ADC can be enabled.
Kojto 107:4f6c30876dfa 741 * @param __HANDLE__: ADC handle.
Kojto 107:4f6c30876dfa 742 * @retval SET (ADC can be enabled) or RESET (ADC cannot be enabled)
Kojto 107:4f6c30876dfa 743 */
Kojto 107:4f6c30876dfa 744 #define ADC_ENABLING_CONDITIONS(__HANDLE__) \
Kojto 107:4f6c30876dfa 745 (( ( ((__HANDLE__)->Instance->CR) & \
Kojto 107:4f6c30876dfa 746 (ADC_CR_ADCAL | ADC_CR_JADSTP | ADC_CR_ADSTP | ADC_CR_JADSTART | \
Kojto 107:4f6c30876dfa 747 ADC_CR_ADSTART | ADC_CR_ADDIS | ADC_CR_ADEN ) \
Kojto 107:4f6c30876dfa 748 ) == RESET \
Kojto 107:4f6c30876dfa 749 ) ? SET : RESET)
Kojto 107:4f6c30876dfa 750
Kojto 107:4f6c30876dfa 751 /**
Kojto 107:4f6c30876dfa 752 * @brief Disable the ADC peripheral.
Kojto 107:4f6c30876dfa 753 * @param __HANDLE__: ADC handle.
Kojto 107:4f6c30876dfa 754 * @retval None
Kojto 107:4f6c30876dfa 755 */
Kojto 107:4f6c30876dfa 756 #define ADC_DISABLE(__HANDLE__) \
Kojto 107:4f6c30876dfa 757 do{ \
Kojto 107:4f6c30876dfa 758 (__HANDLE__)->Instance->CR |= ADC_CR_ADDIS; \
Kojto 107:4f6c30876dfa 759 __HAL_ADC_CLEAR_FLAG((__HANDLE__), (ADC_FLAG_EOSMP | ADC_FLAG_RDY)); \
Kojto 107:4f6c30876dfa 760 } while(0)
Kojto 107:4f6c30876dfa 761
Kojto 107:4f6c30876dfa 762 /**
Kojto 107:4f6c30876dfa 763 * @brief Verification of hardware constraints before ADC can be disabled.
Kojto 107:4f6c30876dfa 764 * @param __HANDLE__: ADC handle.
Kojto 107:4f6c30876dfa 765 * @retval SET (ADC can be disabled) or RESET (ADC cannot be disabled)
Kojto 107:4f6c30876dfa 766 */
Kojto 107:4f6c30876dfa 767 #define ADC_DISABLING_CONDITIONS(__HANDLE__) \
Kojto 107:4f6c30876dfa 768 (( ( ((__HANDLE__)->Instance->CR) & \
Kojto 107:4f6c30876dfa 769 (ADC_CR_JADSTART | ADC_CR_ADSTART | ADC_CR_ADEN)) == ADC_CR_ADEN \
Kojto 107:4f6c30876dfa 770 ) ? SET : RESET)
Kojto 107:4f6c30876dfa 771
Kojto 107:4f6c30876dfa 772
Kojto 107:4f6c30876dfa 773 /**
Kojto 107:4f6c30876dfa 774 * @brief Shift the offset with respect to the selected ADC resolution.
Kojto 107:4f6c30876dfa 775 * @note Offset has to be left-aligned on bit 11, the LSB (right bits) are set to 0.
Kojto 107:4f6c30876dfa 776 * If resolution 12 bits, no shift.
Kojto 107:4f6c30876dfa 777 * If resolution 10 bits, shift of 2 ranks on the left.
Kojto 107:4f6c30876dfa 778 * If resolution 8 bits, shift of 4 ranks on the left.
Kojto 107:4f6c30876dfa 779 * If resolution 6 bits, shift of 6 ranks on the left.
Kojto 107:4f6c30876dfa 780 * Therefore, shift = (12 - resolution) = 12 - (12- (((RES[1:0]) >> 3)*2)).
Kojto 107:4f6c30876dfa 781 * @param __HANDLE__: ADC handle
Kojto 107:4f6c30876dfa 782 * @param __OFFSET__: Value to be shifted
Kojto 107:4f6c30876dfa 783 * @retval None
Kojto 107:4f6c30876dfa 784 */
Kojto 107:4f6c30876dfa 785 #define ADC_OFFSET_SHIFT_RESOLUTION(__HANDLE__, __OFFSET__) \
Kojto 107:4f6c30876dfa 786 ((__OFFSET__) << ((((__HANDLE__)->Instance->CFGR & ADC_CFGR_RES) >> 3)*2))
Kojto 107:4f6c30876dfa 787
Kojto 107:4f6c30876dfa 788
Kojto 107:4f6c30876dfa 789 /**
Kojto 107:4f6c30876dfa 790 * @brief Shift the AWD1 threshold with respect to the selected ADC resolution.
Kojto 107:4f6c30876dfa 791 * @note Thresholds have to be left-aligned on bit 11, the LSB (right bits) are set to 0.
Kojto 107:4f6c30876dfa 792 * If resolution 12 bits, no shift.
Kojto 107:4f6c30876dfa 793 * If resolution 10 bits, shift of 2 ranks on the left.
Kojto 107:4f6c30876dfa 794 * If resolution 8 bits, shift of 4 ranks on the left.
Kojto 107:4f6c30876dfa 795 * If resolution 6 bits, shift of 6 ranks on the left.
Kojto 107:4f6c30876dfa 796 * Therefore, shift = (12 - resolution) = 12 - (12- (((RES[1:0]) >> 3)*2)).
Kojto 107:4f6c30876dfa 797 * @param __HANDLE__: ADC handle
Kojto 107:4f6c30876dfa 798 * @param __THRESHOLD__: Value to be shifted
Kojto 107:4f6c30876dfa 799 * @retval None
Kojto 107:4f6c30876dfa 800 */
Kojto 107:4f6c30876dfa 801 #define ADC_AWD1THRESHOLD_SHIFT_RESOLUTION(__HANDLE__, __THRESHOLD__) \
Kojto 107:4f6c30876dfa 802 ((__THRESHOLD__) << ((((__HANDLE__)->Instance->CFGR & ADC_CFGR_RES) >> 3)*2))
Kojto 107:4f6c30876dfa 803
Kojto 107:4f6c30876dfa 804 /**
Kojto 107:4f6c30876dfa 805 * @brief Shift the AWD2 and AWD3 threshold with respect to the selected ADC resolution.
Kojto 107:4f6c30876dfa 806 * @note Thresholds have to be left-aligned on bit 7.
Kojto 107:4f6c30876dfa 807 * If resolution 12 bits, shift of 4 ranks on the right (the 4 LSB are discarded).
Kojto 107:4f6c30876dfa 808 * If resolution 10 bits, shift of 2 ranks on the right (the 2 LSB are discarded).
Kojto 107:4f6c30876dfa 809 * If resolution 8 bits, no shift.
Kojto 107:4f6c30876dfa 810 * If resolution 6 bits, shift of 2 ranks on the left (the 2 LSB are set to 0).
Kojto 107:4f6c30876dfa 811 * @param __HANDLE__: ADC handle
Kojto 107:4f6c30876dfa 812 * @param __THRESHOLD__: Value to be shifted
Kojto 107:4f6c30876dfa 813 * @retval None
Kojto 107:4f6c30876dfa 814 */
Kojto 107:4f6c30876dfa 815 #define ADC_AWD23THRESHOLD_SHIFT_RESOLUTION(__HANDLE__, __THRESHOLD__) \
Kojto 107:4f6c30876dfa 816 ( ((__HANDLE__)->Instance->CFGR & ADC_CFGR_RES) != (ADC_CFGR_RES_1 | ADC_CFGR_RES_0) ? \
Kojto 107:4f6c30876dfa 817 ((__THRESHOLD__) >> (4- ((((__HANDLE__)->Instance->CFGR & ADC_CFGR_RES) >> 3)*2))) : \
Kojto 107:4f6c30876dfa 818 (__THRESHOLD__) << 2 )
Kojto 107:4f6c30876dfa 819
Kojto 107:4f6c30876dfa 820
Kojto 107:4f6c30876dfa 821 /**
Kojto 107:4f6c30876dfa 822 * @brief Report common register to ADC1, ADC2 and ADC3.
Kojto 107:4f6c30876dfa 823 * @param __HANDLE__: ADC handle.
Kojto 107:4f6c30876dfa 824 * @retval Common control register
Kojto 107:4f6c30876dfa 825 */
Kojto 107:4f6c30876dfa 826 #define ADC_COMMON_REGISTER(__HANDLE__) (ADC123_COMMON)
Kojto 107:4f6c30876dfa 827
Kojto 107:4f6c30876dfa 828
Kojto 107:4f6c30876dfa 829 /**
Kojto 107:4f6c30876dfa 830 * @brief Report Master Instance.
Kojto 107:4f6c30876dfa 831 * @param __HANDLE__: ADC handle.
Kojto 107:4f6c30876dfa 832 * @note return same instance if ADC of input handle is independent ADC.
Kojto 107:4f6c30876dfa 833 * @retval Master Instance
Kojto 107:4f6c30876dfa 834 */
Kojto 107:4f6c30876dfa 835 #define ADC_MASTER_REGISTER(__HANDLE__) \
Kojto 107:4f6c30876dfa 836 ( ( ((((__HANDLE__)->Instance) == ADC1) || (((__HANDLE__)->Instance) == ADC3)) \
Kojto 107:4f6c30876dfa 837 )? \
Kojto 107:4f6c30876dfa 838 ((__HANDLE__)->Instance) \
Kojto 107:4f6c30876dfa 839 : \
Kojto 107:4f6c30876dfa 840 (ADC1) \
Kojto 107:4f6c30876dfa 841 )
Kojto 107:4f6c30876dfa 842
Kojto 107:4f6c30876dfa 843 /**
Kojto 107:4f6c30876dfa 844 * @brief Clear Common Control Register.
Kojto 107:4f6c30876dfa 845 * @param __HANDLE__: ADC handle.
Kojto 107:4f6c30876dfa 846 * @retval None
Kojto 107:4f6c30876dfa 847 */
Kojto 107:4f6c30876dfa 848 #define ADC_CLEAR_COMMON_CONTROL_REGISTER(__HANDLE__) CLEAR_BIT(ADC_COMMON_REGISTER(__HANDLE__)->CCR, ADC_CCR_CKMODE | \
Kojto 107:4f6c30876dfa 849 ADC_CCR_PRESC | \
Kojto 107:4f6c30876dfa 850 ADC_CCR_VBATEN | \
Kojto 107:4f6c30876dfa 851 ADC_CCR_TSEN | \
Kojto 107:4f6c30876dfa 852 ADC_CCR_VREFEN | \
Kojto 107:4f6c30876dfa 853 ADC_CCR_MDMA | \
Kojto 107:4f6c30876dfa 854 ADC_CCR_DMACFG | \
Kojto 107:4f6c30876dfa 855 ADC_CCR_DELAY | \
Kojto 107:4f6c30876dfa 856 ADC_CCR_DUAL )
Kojto 107:4f6c30876dfa 857
Kojto 107:4f6c30876dfa 858
Kojto 107:4f6c30876dfa 859 /**
Kojto 107:4f6c30876dfa 860 * @brief Check whether or not dual conversions are enabled.
Kojto 107:4f6c30876dfa 861 * @param __HANDLE__: ADC handle.
Kojto 107:4f6c30876dfa 862 * @note Return RESET if ADC of input handle is independent ADC.
Kojto 107:4f6c30876dfa 863 * @retval SET (dual regular conversions are enabled) or RESET (ADC is independent or no dual regular conversions are enabled)
Kojto 107:4f6c30876dfa 864 */
Kojto 107:4f6c30876dfa 865 #define ADC_IS_DUAL_CONVERSION_ENABLE(__HANDLE__) \
Kojto 107:4f6c30876dfa 866 ( ( ((((__HANDLE__)->Instance) == ADC1) || (((__HANDLE__)->Instance) == ADC2)) \
Kojto 107:4f6c30876dfa 867 )? \
Kojto 107:4f6c30876dfa 868 ( ((ADC123_COMMON->CCR & ADC_CCR_DUAL) != ADC_MODE_INDEPENDENT) ) \
Kojto 107:4f6c30876dfa 869 : \
Kojto 107:4f6c30876dfa 870 RESET \
Kojto 107:4f6c30876dfa 871 )
Kojto 107:4f6c30876dfa 872
Kojto 107:4f6c30876dfa 873 /**
Kojto 107:4f6c30876dfa 874 * @brief Check whether or not dual regular conversions are enabled.
Kojto 107:4f6c30876dfa 875 * @param __HANDLE__: ADC handle.
Kojto 107:4f6c30876dfa 876 * @retval SET (dual regular conversions are enabled) or RESET (ADC is independent or no dual regular conversions are enabled)
Kojto 107:4f6c30876dfa 877 */
Kojto 107:4f6c30876dfa 878 #define ADC_IS_DUAL_REGULAR_CONVERSION_ENABLE(__HANDLE__) \
Kojto 107:4f6c30876dfa 879 ( ( ((((__HANDLE__)->Instance) == ADC1) || (((__HANDLE__)->Instance) == ADC2)) \
Kojto 107:4f6c30876dfa 880 )? \
Kojto 107:4f6c30876dfa 881 ( (((ADC_COMMON_REGISTER(__HANDLE__))->CCR & ADC_CCR_DUAL) != ADC_MODE_INDEPENDENT) && \
Kojto 107:4f6c30876dfa 882 (((ADC_COMMON_REGISTER(__HANDLE__))->CCR & ADC_CCR_DUAL) != ADC_DUALMODE_INJECSIMULT) && \
Kojto 107:4f6c30876dfa 883 (((ADC_COMMON_REGISTER(__HANDLE__))->CCR & ADC_CCR_DUAL) != ADC_DUALMODE_ALTERTRIG) ) \
Kojto 107:4f6c30876dfa 884 : \
Kojto 107:4f6c30876dfa 885 RESET \
Kojto 107:4f6c30876dfa 886 )
Kojto 107:4f6c30876dfa 887
Kojto 107:4f6c30876dfa 888
Kojto 107:4f6c30876dfa 889
Kojto 107:4f6c30876dfa 890 /**
Kojto 107:4f6c30876dfa 891 * @brief Verification of condition for ADC start conversion: ADC must be in non-multimode or multimode with handle of ADC master.
Kojto 107:4f6c30876dfa 892 * @param __HANDLE__: ADC handle.
Kojto 107:4f6c30876dfa 893 * @retval SET (non-MultiMode or Master handle) or RESET (handle of Slave ADC in MultiMode)
Kojto 107:4f6c30876dfa 894 */
Kojto 107:4f6c30876dfa 895 #define ADC_NONMULTIMODE_OR_MULTIMODEMASTER(__HANDLE__) \
Kojto 107:4f6c30876dfa 896 ( ( ((__HANDLE__)->Instance == ADC1) || ((__HANDLE__)->Instance == ADC3) \
Kojto 107:4f6c30876dfa 897 )? \
Kojto 107:4f6c30876dfa 898 SET \
Kojto 107:4f6c30876dfa 899 : \
Kojto 107:4f6c30876dfa 900 ((ADC123_COMMON->CCR & ADC_CCR_DUAL) == RESET) \
Kojto 107:4f6c30876dfa 901 )
Kojto 107:4f6c30876dfa 902
Kojto 107:4f6c30876dfa 903
Kojto 107:4f6c30876dfa 904 /**
Kojto 107:4f6c30876dfa 905 * @brief Ensure ADC Instance is Independent or Master, or is not Slave ADC with dual regular conversions enabled.
Kojto 107:4f6c30876dfa 906 * @param __HANDLE__: ADC handle.
Kojto 107:4f6c30876dfa 907 * @retval SET (Independent or Master, or Slave without dual regular conversions enabled) or RESET (Slave ADC with dual regular conversions enabled)
Kojto 107:4f6c30876dfa 908 */
Kojto 107:4f6c30876dfa 909 #define ADC_INDEPENDENT_OR_NONMULTIMODEREGULAR_SLAVE(__HANDLE__) \
Kojto 107:4f6c30876dfa 910 ( ( ((__HANDLE__)->Instance == ADC1) || ((__HANDLE__)->Instance == ADC3) \
Kojto 107:4f6c30876dfa 911 )? \
Kojto 107:4f6c30876dfa 912 SET \
Kojto 107:4f6c30876dfa 913 : \
Kojto 107:4f6c30876dfa 914 ( ((ADC123_COMMON->CCR & ADC_CCR_DUAL) == ADC_MODE_INDEPENDENT) || \
Kojto 107:4f6c30876dfa 915 ((ADC123_COMMON->CCR & ADC_CCR_DUAL) == ADC_DUALMODE_INJECSIMULT) || \
Kojto 107:4f6c30876dfa 916 ((ADC123_COMMON->CCR & ADC_CCR_DUAL) == ADC_DUALMODE_ALTERTRIG) ))
Kojto 107:4f6c30876dfa 917
Kojto 107:4f6c30876dfa 918 /**
Kojto 107:4f6c30876dfa 919 * @brief Ensure ADC Instance is Independent or Master, or is not Slave ADC with dual injected conversions enabled.
Kojto 107:4f6c30876dfa 920 * @param __HANDLE__: ADC handle.
Kojto 107:4f6c30876dfa 921 * @retval SET (non-MultiMode or Master, or Slave without dual injected conversions enabled) or RESET (Slave ADC with dual injected conversions enabled)
Kojto 107:4f6c30876dfa 922 */
Kojto 107:4f6c30876dfa 923 #define ADC_INDEPENDENT_OR_NONMULTIMODEINJECTED_SLAVE(__HANDLE__) \
Kojto 107:4f6c30876dfa 924 ( ( ((__HANDLE__)->Instance == ADC1) || ((__HANDLE__)->Instance == ADC3) \
Kojto 107:4f6c30876dfa 925 )? \
Kojto 107:4f6c30876dfa 926 SET \
Kojto 107:4f6c30876dfa 927 : \
Kojto 107:4f6c30876dfa 928 ( ((ADC123_COMMON->CCR & ADC_CCR_DUAL) == ADC_MODE_INDEPENDENT) || \
Kojto 107:4f6c30876dfa 929 ((ADC123_COMMON->CCR & ADC_CCR_DUAL) == ADC_DUALMODE_REGSIMULT) || \
Kojto 107:4f6c30876dfa 930 ((ADC123_COMMON->CCR & ADC_CCR_DUAL) == ADC_DUALMODE_INTERL) ))
Kojto 107:4f6c30876dfa 931
Kojto 107:4f6c30876dfa 932 /**
Kojto 107:4f6c30876dfa 933 * @brief Verification of ADC state: enabled or disabled, directly checked on instance as input parameter.
Kojto 107:4f6c30876dfa 934 * @param __INSTANCE__: ADC instance.
Kojto 107:4f6c30876dfa 935 * @retval SET (ADC enabled) or RESET (ADC disabled)
Kojto 107:4f6c30876dfa 936 */
Kojto 107:4f6c30876dfa 937 #define ADC_INSTANCE_IS_ENABLED(__INSTANCE__) \
Kojto 107:4f6c30876dfa 938 (( ((((__INSTANCE__)->CR) & (ADC_CR_ADEN | ADC_CR_ADDIS)) == ADC_CR_ADEN) && \
Kojto 107:4f6c30876dfa 939 ((((__INSTANCE__)->ISR) & ADC_FLAG_RDY) == ADC_FLAG_RDY) \
Kojto 107:4f6c30876dfa 940 ) ? SET : RESET)
Kojto 107:4f6c30876dfa 941
Kojto 107:4f6c30876dfa 942 /**
Kojto 107:4f6c30876dfa 943 * @brief Verification of enabled/disabled status of ADCs other than that associated to the input parameter handle.
Kojto 107:4f6c30876dfa 944 * @param __HANDLE__: ADC handle.
Kojto 107:4f6c30876dfa 945 * @retval SET (at least one other ADC is enabled) or RESET (no other ADC is enabled, all other ADCs are disabled)
Kojto 107:4f6c30876dfa 946 */
Kojto 107:4f6c30876dfa 947 #define ADC_ANY_OTHER_ENABLED(__HANDLE__) \
Kojto 107:4f6c30876dfa 948 ( ( ((__HANDLE__)->Instance == ADC1) \
Kojto 107:4f6c30876dfa 949 )? \
Kojto 107:4f6c30876dfa 950 (ADC_INSTANCE_IS_ENABLED(ADC2)) || (ADC_INSTANCE_IS_ENABLED(ADC3)) \
Kojto 107:4f6c30876dfa 951 : \
Kojto 107:4f6c30876dfa 952 ( ( ((__HANDLE__)->Instance == ADC2) \
Kojto 107:4f6c30876dfa 953 )? \
Kojto 107:4f6c30876dfa 954 (ADC_INSTANCE_IS_ENABLED(ADC1)) || (ADC_INSTANCE_IS_ENABLED(ADC3)) \
Kojto 107:4f6c30876dfa 955 : \
Kojto 107:4f6c30876dfa 956 ADC_INSTANCE_IS_ENABLED(ADC1)) || (ADC_INSTANCE_IS_ENABLED(ADC2)) \
Kojto 107:4f6c30876dfa 957 ) \
Kojto 107:4f6c30876dfa 958
Kojto 107:4f6c30876dfa 959
Kojto 107:4f6c30876dfa 960
Kojto 107:4f6c30876dfa 961
Kojto 107:4f6c30876dfa 962 /**
Kojto 107:4f6c30876dfa 963 * @brief Set handle instance of the ADC slave associated to the ADC master.
Kojto 107:4f6c30876dfa 964 * @param __HANDLE_MASTER__: ADC master handle.
Kojto 107:4f6c30876dfa 965 * @param __HANDLE_SLAVE__: ADC slave handle.
Kojto 107:4f6c30876dfa 966 * @note if __HANDLE_MASTER__ is the handle of a slave ADC (ADC2) or an independent ADC (ADC3), __HANDLE_SLAVE__ instance is set to NULL.
Kojto 107:4f6c30876dfa 967 * @retval None
Kojto 107:4f6c30876dfa 968 */
Kojto 107:4f6c30876dfa 969 #define ADC_MULTI_SLAVE(__HANDLE_MASTER__, __HANDLE_SLAVE__) \
Kojto 107:4f6c30876dfa 970 ( (((__HANDLE_MASTER__)->Instance == ADC1)) ? ((__HANDLE_SLAVE__)->Instance = ADC2) : ((__HANDLE_SLAVE__)->Instance = NULL) )
Kojto 107:4f6c30876dfa 971
Kojto 107:4f6c30876dfa 972 /**
Kojto 107:4f6c30876dfa 973 * @brief Check whether or not multimode is configured in DMA mode.
Kojto 107:4f6c30876dfa 974 * @retval SET (multimode is configured in DMA mode) or RESET (DMA multimode is disabled)
Kojto 107:4f6c30876dfa 975 */
Kojto 107:4f6c30876dfa 976 #define ADC_MULTIMODE_DMA_ENABLED() \
Kojto 107:4f6c30876dfa 977 ((READ_BIT(ADC123_COMMON->CCR, ADC_CCR_MDMA) == ADC_DMAACCESSMODE_12_10_BITS) \
Kojto 107:4f6c30876dfa 978 || (READ_BIT(ADC123_COMMON->CCR, ADC_CCR_MDMA) == ADC_DMAACCESSMODE_8_6_BITS))
Kojto 107:4f6c30876dfa 979
Kojto 107:4f6c30876dfa 980 /**
Kojto 107:4f6c30876dfa 981 * @brief Verify the length of scheduled injected conversions group.
Kojto 107:4f6c30876dfa 982 * @param __LENGTH__: number of programmed conversions.
Kojto 107:4f6c30876dfa 983 * @retval SET (__LENGTH__ is within the maximum number of possible programmable injected conversions) or RESET (__LENGTH__ is null or too large)
Kojto 107:4f6c30876dfa 984 */
Kojto 107:4f6c30876dfa 985 #define IS_ADC_INJECTED_NB_CONV(__LENGTH__) (((__LENGTH__) >= ((uint32_t)1)) && ((__LENGTH__) <= ((uint32_t)4)))
Kojto 107:4f6c30876dfa 986
Kojto 107:4f6c30876dfa 987
Kojto 107:4f6c30876dfa 988 /**
Kojto 107:4f6c30876dfa 989 * @brief Calibration factor size verification (7 bits maximum).
Kojto 107:4f6c30876dfa 990 * @param __CALIBRATION_FACTOR__: Calibration factor value.
Kojto 107:4f6c30876dfa 991 * @retval SET (__CALIBRATION_FACTOR__ is within the authorized size) or RESET (__CALIBRATION_FACTOR__ is too large)
Kojto 107:4f6c30876dfa 992 */
Kojto 107:4f6c30876dfa 993 #define IS_ADC_CALFACT(__CALIBRATION_FACTOR__) ((__CALIBRATION_FACTOR__) <= ((uint32_t)0x7F))
Kojto 107:4f6c30876dfa 994
Kojto 107:4f6c30876dfa 995
Kojto 107:4f6c30876dfa 996 /**
Kojto 107:4f6c30876dfa 997 * @brief Verify the ADC channel setting.
Kojto 107:4f6c30876dfa 998 * @param __CHANNEL__: programmed ADC channel.
Kojto 107:4f6c30876dfa 999 * @retval SET (__CHANNEL__ is valid) or RESET (__CHANNEL__ is invalid)
Kojto 107:4f6c30876dfa 1000 */
Kojto 107:4f6c30876dfa 1001 #define IS_ADC_CHANNEL(__CHANNEL__) (((__CHANNEL__) == ADC_CHANNEL_0) || \
Kojto 107:4f6c30876dfa 1002 ((__CHANNEL__) == ADC_CHANNEL_1) || \
Kojto 107:4f6c30876dfa 1003 ((__CHANNEL__) == ADC_CHANNEL_2) || \
Kojto 107:4f6c30876dfa 1004 ((__CHANNEL__) == ADC_CHANNEL_3) || \
Kojto 107:4f6c30876dfa 1005 ((__CHANNEL__) == ADC_CHANNEL_4) || \
Kojto 107:4f6c30876dfa 1006 ((__CHANNEL__) == ADC_CHANNEL_5) || \
Kojto 107:4f6c30876dfa 1007 ((__CHANNEL__) == ADC_CHANNEL_6) || \
Kojto 107:4f6c30876dfa 1008 ((__CHANNEL__) == ADC_CHANNEL_7) || \
Kojto 107:4f6c30876dfa 1009 ((__CHANNEL__) == ADC_CHANNEL_8) || \
Kojto 107:4f6c30876dfa 1010 ((__CHANNEL__) == ADC_CHANNEL_9) || \
Kojto 107:4f6c30876dfa 1011 ((__CHANNEL__) == ADC_CHANNEL_10) || \
Kojto 107:4f6c30876dfa 1012 ((__CHANNEL__) == ADC_CHANNEL_11) || \
Kojto 107:4f6c30876dfa 1013 ((__CHANNEL__) == ADC_CHANNEL_12) || \
Kojto 107:4f6c30876dfa 1014 ((__CHANNEL__) == ADC_CHANNEL_13) || \
Kojto 107:4f6c30876dfa 1015 ((__CHANNEL__) == ADC_CHANNEL_14) || \
Kojto 107:4f6c30876dfa 1016 ((__CHANNEL__) == ADC_CHANNEL_15) || \
Kojto 107:4f6c30876dfa 1017 ((__CHANNEL__) == ADC_CHANNEL_16) || \
Kojto 107:4f6c30876dfa 1018 ((__CHANNEL__) == ADC_CHANNEL_TEMPSENSOR) || \
Kojto 107:4f6c30876dfa 1019 ((__CHANNEL__) == ADC_CHANNEL_VBAT) || \
Kojto 107:4f6c30876dfa 1020 ((__CHANNEL__) == ADC_CHANNEL_VREFINT) )
Kojto 107:4f6c30876dfa 1021
Kojto 107:4f6c30876dfa 1022
Kojto 107:4f6c30876dfa 1023 /**
Kojto 107:4f6c30876dfa 1024 * @brief Verify the ADC1 or ADC2 channel setting in differential mode.
Kojto 107:4f6c30876dfa 1025 * @param __CHANNEL__: programmed ADC1 or ADC2 channel.
Kojto 107:4f6c30876dfa 1026 * @retval SET (__CHANNEL__ is valid) or RESET (__CHANNEL__ is invalid)
Kojto 107:4f6c30876dfa 1027 */
Kojto 107:4f6c30876dfa 1028 #define IS_ADC12_DIFF_CHANNEL(__CHANNEL__) (((__CHANNEL__) == ADC_CHANNEL_1)|| \
Kojto 107:4f6c30876dfa 1029 ((__CHANNEL__) == ADC_CHANNEL_2) || \
Kojto 107:4f6c30876dfa 1030 ((__CHANNEL__) == ADC_CHANNEL_3) || \
Kojto 107:4f6c30876dfa 1031 ((__CHANNEL__) == ADC_CHANNEL_4) || \
Kojto 107:4f6c30876dfa 1032 ((__CHANNEL__) == ADC_CHANNEL_5) || \
Kojto 107:4f6c30876dfa 1033 ((__CHANNEL__) == ADC_CHANNEL_6) || \
Kojto 107:4f6c30876dfa 1034 ((__CHANNEL__) == ADC_CHANNEL_7) || \
Kojto 107:4f6c30876dfa 1035 ((__CHANNEL__) == ADC_CHANNEL_8) || \
Kojto 107:4f6c30876dfa 1036 ((__CHANNEL__) == ADC_CHANNEL_9) || \
Kojto 107:4f6c30876dfa 1037 ((__CHANNEL__) == ADC_CHANNEL_10) || \
Kojto 107:4f6c30876dfa 1038 ((__CHANNEL__) == ADC_CHANNEL_11) || \
Kojto 107:4f6c30876dfa 1039 ((__CHANNEL__) == ADC_CHANNEL_12) || \
Kojto 107:4f6c30876dfa 1040 ((__CHANNEL__) == ADC_CHANNEL_13) || \
Kojto 107:4f6c30876dfa 1041 ((__CHANNEL__) == ADC_CHANNEL_14) || \
Kojto 107:4f6c30876dfa 1042 ((__CHANNEL__) == ADC_CHANNEL_15) )
Kojto 107:4f6c30876dfa 1043
Kojto 107:4f6c30876dfa 1044 /**
Kojto 107:4f6c30876dfa 1045 * @brief Verify the ADC3 channel setting in differential mode.
Kojto 107:4f6c30876dfa 1046 * @param __CHANNEL__: programmed ADC3 channel.
Kojto 107:4f6c30876dfa 1047 * @retval SET (__CHANNEL__ is valid) or RESET (__CHANNEL__ is invalid)
Kojto 107:4f6c30876dfa 1048 */
Kojto 107:4f6c30876dfa 1049 #define IS_ADC3_DIFF_CHANNEL(__CHANNEL__) (((__CHANNEL__) == ADC_CHANNEL_1) || \
Kojto 107:4f6c30876dfa 1050 ((__CHANNEL__) == ADC_CHANNEL_2) || \
Kojto 107:4f6c30876dfa 1051 ((__CHANNEL__) == ADC_CHANNEL_3) || \
Kojto 107:4f6c30876dfa 1052 ((__CHANNEL__) == ADC_CHANNEL_4) || \
Kojto 107:4f6c30876dfa 1053 ((__CHANNEL__) == ADC_CHANNEL_5) || \
Kojto 107:4f6c30876dfa 1054 ((__CHANNEL__) == ADC_CHANNEL_6) || \
Kojto 107:4f6c30876dfa 1055 ((__CHANNEL__) == ADC_CHANNEL_7) || \
Kojto 107:4f6c30876dfa 1056 ((__CHANNEL__) == ADC_CHANNEL_8) || \
Kojto 107:4f6c30876dfa 1057 ((__CHANNEL__) == ADC_CHANNEL_9) || \
Kojto 107:4f6c30876dfa 1058 ((__CHANNEL__) == ADC_CHANNEL_10)|| \
Kojto 107:4f6c30876dfa 1059 ((__CHANNEL__) == ADC_CHANNEL_11) )
Kojto 107:4f6c30876dfa 1060
Kojto 107:4f6c30876dfa 1061
Kojto 107:4f6c30876dfa 1062 /**
Kojto 107:4f6c30876dfa 1063 * @brief Verify the ADC single-ended input or differential mode setting.
Kojto 107:4f6c30876dfa 1064 * @param __SING_DIFF__: programmed channel setting.
Kojto 107:4f6c30876dfa 1065 * @retval SET (__SING_DIFF__ is valid) or RESET (__SING_DIFF__ is invalid)
Kojto 107:4f6c30876dfa 1066 */
Kojto 107:4f6c30876dfa 1067 #define IS_ADC_SINGLE_DIFFERENTIAL(__SING_DIFF__) (((__SING_DIFF__) == ADC_SINGLE_ENDED) || \
Kojto 107:4f6c30876dfa 1068 ((__SING_DIFF__) == ADC_DIFFERENTIAL_ENDED) )
Kojto 107:4f6c30876dfa 1069
Kojto 107:4f6c30876dfa 1070
Kojto 107:4f6c30876dfa 1071 /**
Kojto 107:4f6c30876dfa 1072 * @brief Verify the ADC offset management setting.
Kojto 107:4f6c30876dfa 1073 * @param __OFFSET_NUMBER__: ADC offset management.
Kojto 107:4f6c30876dfa 1074 * @retval SET (__OFFSET_NUMBER__ is valid) or RESET (__OFFSET_NUMBER__ is invalid)
Kojto 107:4f6c30876dfa 1075 */
Kojto 107:4f6c30876dfa 1076 #define IS_ADC_OFFSET_NUMBER(__OFFSET_NUMBER__) (((__OFFSET_NUMBER__) == ADC_OFFSET_NONE) || \
Kojto 107:4f6c30876dfa 1077 ((__OFFSET_NUMBER__) == ADC_OFFSET_1) || \
Kojto 107:4f6c30876dfa 1078 ((__OFFSET_NUMBER__) == ADC_OFFSET_2) || \
Kojto 107:4f6c30876dfa 1079 ((__OFFSET_NUMBER__) == ADC_OFFSET_3) || \
Kojto 107:4f6c30876dfa 1080 ((__OFFSET_NUMBER__) == ADC_OFFSET_4) )
Kojto 107:4f6c30876dfa 1081
Kojto 107:4f6c30876dfa 1082 /**
Kojto 107:4f6c30876dfa 1083 * @brief Verify the ADC regular channel setting.
Kojto 107:4f6c30876dfa 1084 * @param __CHANNEL__: programmed ADC regular channel.
Kojto 107:4f6c30876dfa 1085 * @retval SET (__CHANNEL__ is valid) or RESET (__CHANNEL__ is invalid)
Kojto 107:4f6c30876dfa 1086 */
Kojto 107:4f6c30876dfa 1087 #define IS_ADC_REGULAR_RANK(__CHANNEL__) (((__CHANNEL__) == ADC_REGULAR_RANK_1 ) || \
Kojto 107:4f6c30876dfa 1088 ((__CHANNEL__) == ADC_REGULAR_RANK_2 ) || \
Kojto 107:4f6c30876dfa 1089 ((__CHANNEL__) == ADC_REGULAR_RANK_3 ) || \
Kojto 107:4f6c30876dfa 1090 ((__CHANNEL__) == ADC_REGULAR_RANK_4 ) || \
Kojto 107:4f6c30876dfa 1091 ((__CHANNEL__) == ADC_REGULAR_RANK_5 ) || \
Kojto 107:4f6c30876dfa 1092 ((__CHANNEL__) == ADC_REGULAR_RANK_6 ) || \
Kojto 107:4f6c30876dfa 1093 ((__CHANNEL__) == ADC_REGULAR_RANK_7 ) || \
Kojto 107:4f6c30876dfa 1094 ((__CHANNEL__) == ADC_REGULAR_RANK_8 ) || \
Kojto 107:4f6c30876dfa 1095 ((__CHANNEL__) == ADC_REGULAR_RANK_9 ) || \
Kojto 107:4f6c30876dfa 1096 ((__CHANNEL__) == ADC_REGULAR_RANK_10) || \
Kojto 107:4f6c30876dfa 1097 ((__CHANNEL__) == ADC_REGULAR_RANK_11) || \
Kojto 107:4f6c30876dfa 1098 ((__CHANNEL__) == ADC_REGULAR_RANK_12) || \
Kojto 107:4f6c30876dfa 1099 ((__CHANNEL__) == ADC_REGULAR_RANK_13) || \
Kojto 107:4f6c30876dfa 1100 ((__CHANNEL__) == ADC_REGULAR_RANK_14) || \
Kojto 107:4f6c30876dfa 1101 ((__CHANNEL__) == ADC_REGULAR_RANK_15) || \
Kojto 107:4f6c30876dfa 1102 ((__CHANNEL__) == ADC_REGULAR_RANK_16) )
Kojto 107:4f6c30876dfa 1103
Kojto 107:4f6c30876dfa 1104
Kojto 107:4f6c30876dfa 1105 /**
Kojto 107:4f6c30876dfa 1106 * @brief Verify the ADC injected channel setting.
Kojto 107:4f6c30876dfa 1107 * @param __CHANNEL__: programmed ADC injected channel.
Kojto 107:4f6c30876dfa 1108 * @retval SET (__CHANNEL__ is valid) or RESET (__CHANNEL__ is invalid)
Kojto 107:4f6c30876dfa 1109 */
Kojto 107:4f6c30876dfa 1110 #define IS_ADC_INJECTED_RANK(__CHANNEL__) (((__CHANNEL__) == ADC_INJECTED_RANK_1) || \
Kojto 107:4f6c30876dfa 1111 ((__CHANNEL__) == ADC_INJECTED_RANK_2) || \
Kojto 107:4f6c30876dfa 1112 ((__CHANNEL__) == ADC_INJECTED_RANK_3) || \
Kojto 107:4f6c30876dfa 1113 ((__CHANNEL__) == ADC_INJECTED_RANK_4) )
Kojto 107:4f6c30876dfa 1114
Kojto 107:4f6c30876dfa 1115 /**
Kojto 107:4f6c30876dfa 1116 * @brief Verify the ADC edge trigger setting for injected group.
Kojto 107:4f6c30876dfa 1117 * @param __EDGE__: programmed ADC edge trigger setting.
Kojto 107:4f6c30876dfa 1118 * @retval SET (__EDGE__ is a valid value) or RESET (__EDGE__ is invalid)
Kojto 107:4f6c30876dfa 1119 */
Kojto 107:4f6c30876dfa 1120 #define IS_ADC_EXTTRIGINJEC_EDGE(__EDGE__) (((__EDGE__) == ADC_EXTERNALTRIGINJECCONV_EDGE_NONE) || \
Kojto 107:4f6c30876dfa 1121 ((__EDGE__) == ADC_EXTERNALTRIGINJECCONV_EDGE_RISING) || \
Kojto 107:4f6c30876dfa 1122 ((__EDGE__) == ADC_EXTERNALTRIGINJECCONV_EDGE_FALLING) || \
Kojto 107:4f6c30876dfa 1123 ((__EDGE__) == ADC_EXTERNALTRIGINJECCONV_EDGE_RISINGFALLING) )
Kojto 107:4f6c30876dfa 1124
Kojto 107:4f6c30876dfa 1125
Kojto 107:4f6c30876dfa 1126 /**
Kojto 107:4f6c30876dfa 1127 * @brief Verify the ADC injected conversions external trigger.
Kojto 107:4f6c30876dfa 1128 * @param __INJTRIG__: programmed ADC injected conversions external trigger.
Kojto 107:4f6c30876dfa 1129 * @retval SET (__INJTRIG__ is a valid value) or RESET (__INJTRIG__ is invalid)
Kojto 107:4f6c30876dfa 1130 */
Kojto 107:4f6c30876dfa 1131 #define IS_ADC_EXTTRIGINJEC(__INJTRIG__) (((__INJTRIG__) == ADC_EXTERNALTRIGINJEC_T1_TRGO) || \
Kojto 107:4f6c30876dfa 1132 ((__INJTRIG__) == ADC_EXTERNALTRIGINJEC_T1_CC4) || \
Kojto 107:4f6c30876dfa 1133 ((__INJTRIG__) == ADC_EXTERNALTRIGINJEC_T2_TRGO) || \
Kojto 107:4f6c30876dfa 1134 ((__INJTRIG__) == ADC_EXTERNALTRIGINJEC_T2_CC1) || \
Kojto 107:4f6c30876dfa 1135 ((__INJTRIG__) == ADC_EXTERNALTRIGINJEC_T3_CC4) || \
Kojto 107:4f6c30876dfa 1136 ((__INJTRIG__) == ADC_EXTERNALTRIGINJEC_T4_TRGO) || \
Kojto 107:4f6c30876dfa 1137 ((__INJTRIG__) == ADC_EXTERNALTRIGINJEC_EXT_IT15) || \
Kojto 107:4f6c30876dfa 1138 ((__INJTRIG__) == ADC_EXTERNALTRIGINJEC_T8_CC4) || \
Kojto 107:4f6c30876dfa 1139 ((__INJTRIG__) == ADC_EXTERNALTRIGINJEC_T1_TRGO2) || \
Kojto 107:4f6c30876dfa 1140 ((__INJTRIG__) == ADC_EXTERNALTRIGINJEC_T8_TRGO) || \
Kojto 107:4f6c30876dfa 1141 ((__INJTRIG__) == ADC_EXTERNALTRIGINJEC_T8_TRGO2) || \
Kojto 107:4f6c30876dfa 1142 ((__INJTRIG__) == ADC_EXTERNALTRIGINJEC_T3_CC3) || \
Kojto 107:4f6c30876dfa 1143 ((__INJTRIG__) == ADC_EXTERNALTRIGINJEC_T3_TRGO) || \
Kojto 107:4f6c30876dfa 1144 ((__INJTRIG__) == ADC_EXTERNALTRIGINJEC_T3_CC1) || \
Kojto 107:4f6c30876dfa 1145 ((__INJTRIG__) == ADC_EXTERNALTRIGINJEC_T6_TRGO) || \
Kojto 107:4f6c30876dfa 1146 ((__INJTRIG__) == ADC_EXTERNALTRIGINJEC_T15_TRGO) || \
Kojto 107:4f6c30876dfa 1147 \
Kojto 107:4f6c30876dfa 1148 ((__INJTRIG__) == ADC_SOFTWARE_START) )
Kojto 107:4f6c30876dfa 1149
Kojto 107:4f6c30876dfa 1150
Kojto 107:4f6c30876dfa 1151 /**
Kojto 107:4f6c30876dfa 1152 * @brief Verify the ADC multimode setting.
Kojto 107:4f6c30876dfa 1153 * @param __MODE__: programmed ADC multimode setting.
Kojto 107:4f6c30876dfa 1154 * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid)
Kojto 107:4f6c30876dfa 1155 */
Kojto 107:4f6c30876dfa 1156 #define IS_ADC_MULTIMODE(__MODE__) (((__MODE__) == ADC_MODE_INDEPENDENT) || \
Kojto 107:4f6c30876dfa 1157 ((__MODE__) == ADC_DUALMODE_REGSIMULT_INJECSIMULT) || \
Kojto 107:4f6c30876dfa 1158 ((__MODE__) == ADC_DUALMODE_REGSIMULT_ALTERTRIG) || \
Kojto 107:4f6c30876dfa 1159 ((__MODE__) == ADC_DUALMODE_REGINTERL_INJECSIMULT) || \
Kojto 107:4f6c30876dfa 1160 ((__MODE__) == ADC_DUALMODE_INJECSIMULT) || \
Kojto 107:4f6c30876dfa 1161 ((__MODE__) == ADC_DUALMODE_REGSIMULT) || \
Kojto 107:4f6c30876dfa 1162 ((__MODE__) == ADC_DUALMODE_INTERL) || \
Kojto 107:4f6c30876dfa 1163 ((__MODE__) == ADC_DUALMODE_ALTERTRIG) )
Kojto 107:4f6c30876dfa 1164
Kojto 107:4f6c30876dfa 1165
Kojto 107:4f6c30876dfa 1166 /**
Kojto 107:4f6c30876dfa 1167 * @brief Verify the ADC multimode DMA access setting.
Kojto 107:4f6c30876dfa 1168 * @param __MODE__: programmed ADC multimode DMA access setting.
Kojto 107:4f6c30876dfa 1169 * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid)
Kojto 107:4f6c30876dfa 1170 */
Kojto 107:4f6c30876dfa 1171 #define IS_ADC_DMA_ACCESS_MULTIMODE(__MODE__) (((__MODE__) == ADC_DMAACCESSMODE_DISABLED) || \
Kojto 107:4f6c30876dfa 1172 ((__MODE__) == ADC_DMAACCESSMODE_12_10_BITS) || \
Kojto 107:4f6c30876dfa 1173 ((__MODE__) == ADC_DMAACCESSMODE_8_6_BITS) )
Kojto 107:4f6c30876dfa 1174
Kojto 107:4f6c30876dfa 1175 /**
Kojto 107:4f6c30876dfa 1176 * @brief Verify the ADC multimode delay setting.
Kojto 107:4f6c30876dfa 1177 * @param __DELAY__: programmed ADC multimode delay setting.
Kojto 107:4f6c30876dfa 1178 * @retval SET (__DELAY__ is a valid value) or RESET (__DELAY__ is invalid)
Kojto 107:4f6c30876dfa 1179 */
Kojto 107:4f6c30876dfa 1180 #define IS_ADC_SAMPLING_DELAY(__DELAY__) (((__DELAY__) == ADC_TWOSAMPLINGDELAY_1CYCLE) || \
Kojto 107:4f6c30876dfa 1181 ((__DELAY__) == ADC_TWOSAMPLINGDELAY_2CYCLES) || \
Kojto 107:4f6c30876dfa 1182 ((__DELAY__) == ADC_TWOSAMPLINGDELAY_3CYCLES) || \
Kojto 107:4f6c30876dfa 1183 ((__DELAY__) == ADC_TWOSAMPLINGDELAY_4CYCLES) || \
Kojto 107:4f6c30876dfa 1184 ((__DELAY__) == ADC_TWOSAMPLINGDELAY_5CYCLES) || \
Kojto 107:4f6c30876dfa 1185 ((__DELAY__) == ADC_TWOSAMPLINGDELAY_6CYCLES) || \
Kojto 107:4f6c30876dfa 1186 ((__DELAY__) == ADC_TWOSAMPLINGDELAY_7CYCLES) || \
Kojto 107:4f6c30876dfa 1187 ((__DELAY__) == ADC_TWOSAMPLINGDELAY_8CYCLES) || \
Kojto 107:4f6c30876dfa 1188 ((__DELAY__) == ADC_TWOSAMPLINGDELAY_9CYCLES) || \
Kojto 107:4f6c30876dfa 1189 ((__DELAY__) == ADC_TWOSAMPLINGDELAY_10CYCLES) || \
Kojto 107:4f6c30876dfa 1190 ((__DELAY__) == ADC_TWOSAMPLINGDELAY_11CYCLES) || \
Kojto 107:4f6c30876dfa 1191 ((__DELAY__) == ADC_TWOSAMPLINGDELAY_12CYCLES) )
Kojto 107:4f6c30876dfa 1192
Kojto 107:4f6c30876dfa 1193
Kojto 107:4f6c30876dfa 1194 /**
Kojto 107:4f6c30876dfa 1195 * @brief Verify the ADC analog watchdog setting.
Kojto 107:4f6c30876dfa 1196 * @param __WATCHDOG__: programmed ADC analog watchdog setting.
Kojto 107:4f6c30876dfa 1197 * @retval SET (__WATCHDOG__ is valid) or RESET (__WATCHDOG__ is invalid)
Kojto 107:4f6c30876dfa 1198 */
Kojto 107:4f6c30876dfa 1199 #define IS_ADC_ANALOG_WATCHDOG_NUMBER(__WATCHDOG__) (((__WATCHDOG__) == ADC_ANALOGWATCHDOG_1) || \
Kojto 107:4f6c30876dfa 1200 ((__WATCHDOG__) == ADC_ANALOGWATCHDOG_2) || \
Kojto 107:4f6c30876dfa 1201 ((__WATCHDOG__) == ADC_ANALOGWATCHDOG_3) )
Kojto 107:4f6c30876dfa 1202
Kojto 107:4f6c30876dfa 1203 /**
Kojto 107:4f6c30876dfa 1204 * @brief Verify the ADC analog watchdog mode setting.
Kojto 107:4f6c30876dfa 1205 * @param __WATCHDOG_MODE__: programmed ADC analog watchdog mode setting.
Kojto 107:4f6c30876dfa 1206 * @retval SET (__WATCHDOG_MODE__ is valid) or RESET (__WATCHDOG_MODE__ is invalid)
Kojto 107:4f6c30876dfa 1207 */
Kojto 107:4f6c30876dfa 1208 #define IS_ADC_ANALOG_WATCHDOG_MODE(__WATCHDOG_MODE__) (((__WATCHDOG_MODE__) == ADC_ANALOGWATCHDOG_NONE) || \
Kojto 107:4f6c30876dfa 1209 ((__WATCHDOG_MODE__) == ADC_ANALOGWATCHDOG_SINGLE_REG) || \
Kojto 107:4f6c30876dfa 1210 ((__WATCHDOG_MODE__) == ADC_ANALOGWATCHDOG_SINGLE_INJEC) || \
Kojto 107:4f6c30876dfa 1211 ((__WATCHDOG_MODE__) == ADC_ANALOGWATCHDOG_SINGLE_REGINJEC) || \
Kojto 107:4f6c30876dfa 1212 ((__WATCHDOG_MODE__) == ADC_ANALOGWATCHDOG_ALL_REG) || \
Kojto 107:4f6c30876dfa 1213 ((__WATCHDOG_MODE__) == ADC_ANALOGWATCHDOG_ALL_INJEC) || \
Kojto 107:4f6c30876dfa 1214 ((__WATCHDOG_MODE__) == ADC_ANALOGWATCHDOG_ALL_REGINJEC) )
Kojto 107:4f6c30876dfa 1215
Kojto 107:4f6c30876dfa 1216 /**
Kojto 107:4f6c30876dfa 1217 * @brief Verify the ADC conversion (regular or injected or both).
Kojto 107:4f6c30876dfa 1218 * @param __CONVERSION__: ADC conversion group.
Kojto 107:4f6c30876dfa 1219 * @retval SET (__CONVERSION__ is valid) or RESET (__CONVERSION__ is invalid)
Kojto 107:4f6c30876dfa 1220 */
Kojto 107:4f6c30876dfa 1221 #define IS_ADC_CONVERSION_GROUP(__CONVERSION__) (((__CONVERSION__) == ADC_REGULAR_GROUP) || \
Kojto 107:4f6c30876dfa 1222 ((__CONVERSION__) == ADC_INJECTED_GROUP) || \
Kojto 107:4f6c30876dfa 1223 ((__CONVERSION__) == ADC_REGULAR_INJECTED_GROUP) )
Kojto 107:4f6c30876dfa 1224
Kojto 107:4f6c30876dfa 1225 /**
Kojto 107:4f6c30876dfa 1226 * @brief Verify the ADC event type.
Kojto 107:4f6c30876dfa 1227 * @param __EVENT__: ADC event.
Kojto 107:4f6c30876dfa 1228 * @retval SET (__EVENT__ is valid) or RESET (__EVENT__ is invalid)
Kojto 107:4f6c30876dfa 1229 */
Kojto 107:4f6c30876dfa 1230 #define IS_ADC_EVENT_TYPE(__EVENT__) (((__EVENT__) == ADC_EOSMP_EVENT) || \
Kojto 107:4f6c30876dfa 1231 ((__EVENT__) == ADC_AWD_EVENT) || \
Kojto 107:4f6c30876dfa 1232 ((__EVENT__) == ADC_AWD2_EVENT) || \
Kojto 107:4f6c30876dfa 1233 ((__EVENT__) == ADC_AWD3_EVENT) || \
Kojto 107:4f6c30876dfa 1234 ((__EVENT__) == ADC_OVR_EVENT) || \
Kojto 107:4f6c30876dfa 1235 ((__EVENT__) == ADC_JQOVF_EVENT) )
Kojto 107:4f6c30876dfa 1236
Kojto 107:4f6c30876dfa 1237 /**
Kojto 107:4f6c30876dfa 1238 * @brief Verify the ADC oversampling ratio.
Kojto 107:4f6c30876dfa 1239 * @param __RATIO__: programmed ADC oversampling ratio.
Kojto 107:4f6c30876dfa 1240 * @retval SET (__RATIO__ is a valid value) or RESET (__RATIO__ is invalid)
Kojto 107:4f6c30876dfa 1241 */
Kojto 107:4f6c30876dfa 1242 #define IS_ADC_OVERSAMPLING_RATIO(__RATIO__) (((__RATIO__) == ADC_OVERSAMPLING_RATIO_2 ) || \
Kojto 107:4f6c30876dfa 1243 ((__RATIO__) == ADC_OVERSAMPLING_RATIO_4 ) || \
Kojto 107:4f6c30876dfa 1244 ((__RATIO__) == ADC_OVERSAMPLING_RATIO_8 ) || \
Kojto 107:4f6c30876dfa 1245 ((__RATIO__) == ADC_OVERSAMPLING_RATIO_16 ) || \
Kojto 107:4f6c30876dfa 1246 ((__RATIO__) == ADC_OVERSAMPLING_RATIO_32 ) || \
Kojto 107:4f6c30876dfa 1247 ((__RATIO__) == ADC_OVERSAMPLING_RATIO_64 ) || \
Kojto 107:4f6c30876dfa 1248 ((__RATIO__) == ADC_OVERSAMPLING_RATIO_128 ) || \
Kojto 107:4f6c30876dfa 1249 ((__RATIO__) == ADC_OVERSAMPLING_RATIO_256 ))
Kojto 107:4f6c30876dfa 1250
Kojto 107:4f6c30876dfa 1251 /**
Kojto 107:4f6c30876dfa 1252 * @brief Verify the ADC oversampling shift.
Kojto 107:4f6c30876dfa 1253 * @param __SHIFT__: programmed ADC oversampling shift.
Kojto 107:4f6c30876dfa 1254 * @retval SET (__SHIFT__ is a valid value) or RESET (__SHIFT__ is invalid)
Kojto 107:4f6c30876dfa 1255 */
Kojto 107:4f6c30876dfa 1256 #define IS_ADC_RIGHT_BIT_SHIFT(__SHIFT__) (((__SHIFT__) == ADC_RIGHTBITSHIFT_NONE) || \
Kojto 107:4f6c30876dfa 1257 ((__SHIFT__) == ADC_RIGHTBITSHIFT_1 ) || \
Kojto 107:4f6c30876dfa 1258 ((__SHIFT__) == ADC_RIGHTBITSHIFT_2 ) || \
Kojto 107:4f6c30876dfa 1259 ((__SHIFT__) == ADC_RIGHTBITSHIFT_3 ) || \
Kojto 107:4f6c30876dfa 1260 ((__SHIFT__) == ADC_RIGHTBITSHIFT_4 ) || \
Kojto 107:4f6c30876dfa 1261 ((__SHIFT__) == ADC_RIGHTBITSHIFT_5 ) || \
Kojto 107:4f6c30876dfa 1262 ((__SHIFT__) == ADC_RIGHTBITSHIFT_6 ) || \
Kojto 107:4f6c30876dfa 1263 ((__SHIFT__) == ADC_RIGHTBITSHIFT_7 ) || \
Kojto 107:4f6c30876dfa 1264 ((__SHIFT__) == ADC_RIGHTBITSHIFT_8 ))
Kojto 107:4f6c30876dfa 1265
Kojto 107:4f6c30876dfa 1266 /**
Kojto 107:4f6c30876dfa 1267 * @brief Verify the ADC oversampling triggered mode.
Kojto 107:4f6c30876dfa 1268 * @param __MODE__: programmed ADC oversampling triggered mode.
Kojto 107:4f6c30876dfa 1269 * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid)
Kojto 107:4f6c30876dfa 1270 */
Kojto 107:4f6c30876dfa 1271 #define IS_ADC_TRIGGERED_OVERSAMPLING_MODE(__MODE__) (((__MODE__) == ADC_TRIGGEREDMODE_SINGLE_TRIGGER) || \
Kojto 107:4f6c30876dfa 1272 ((__MODE__) == ADC_TRIGGEREDMODE_MULTI_TRIGGER) )
Kojto 107:4f6c30876dfa 1273
Kojto 107:4f6c30876dfa 1274 /**
Kojto 107:4f6c30876dfa 1275 * @brief Verify the ADC oversampling regular conversion resumed or continued mode.
Kojto 107:4f6c30876dfa 1276 * @param __MODE__: programmed ADC oversampling regular conversion resumed or continued mode.
Kojto 107:4f6c30876dfa 1277 * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid)
Kojto 107:4f6c30876dfa 1278 */
Kojto 107:4f6c30876dfa 1279 #define IS_ADC_REGOVERSAMPLING_MODE(__MODE__) (((__MODE__) == ADC_REGOVERSAMPLING_CONTINUED_MODE) || \
Kojto 107:4f6c30876dfa 1280 ((__MODE__) == ADC_REGOVERSAMPLING_RESUMED_MODE) )
Kojto 107:4f6c30876dfa 1281
Kojto 107:4f6c30876dfa 1282 /**
Kojto 107:4f6c30876dfa 1283 * @}
Kojto 107:4f6c30876dfa 1284 */
Kojto 107:4f6c30876dfa 1285
Kojto 107:4f6c30876dfa 1286
Kojto 107:4f6c30876dfa 1287 /* Exported functions --------------------------------------------------------*/
Kojto 107:4f6c30876dfa 1288 /** @addtogroup ADCEx_Exported_Functions ADC Extended Exported Functions
Kojto 107:4f6c30876dfa 1289 * @{
Kojto 107:4f6c30876dfa 1290 */
Kojto 107:4f6c30876dfa 1291
Kojto 107:4f6c30876dfa 1292 /* Initialization/de-initialization functions *********************************/
Kojto 107:4f6c30876dfa 1293
Kojto 107:4f6c30876dfa 1294 /** @addtogroup ADCEx_Exported_Functions_Group1 Extended Input and Output operation functions
Kojto 107:4f6c30876dfa 1295 * @brief Extended IO operation functions
Kojto 107:4f6c30876dfa 1296 * @{
Kojto 107:4f6c30876dfa 1297 */
Kojto 107:4f6c30876dfa 1298 /* I/O operation functions ****************************************************/
Kojto 107:4f6c30876dfa 1299
Kojto 107:4f6c30876dfa 1300 /* ADC calibration */
Kojto 107:4f6c30876dfa 1301
Kojto 107:4f6c30876dfa 1302 HAL_StatusTypeDef HAL_ADCEx_Calibration_Start(ADC_HandleTypeDef* hadc, uint32_t SingleDiff);
Kojto 107:4f6c30876dfa 1303 uint32_t HAL_ADCEx_Calibration_GetValue(ADC_HandleTypeDef *hadc, uint32_t SingleDiff);
Kojto 107:4f6c30876dfa 1304 HAL_StatusTypeDef HAL_ADCEx_Calibration_SetValue(ADC_HandleTypeDef *hadc, uint32_t SingleDiff, uint32_t CalibrationFactor);
Kojto 107:4f6c30876dfa 1305
Kojto 107:4f6c30876dfa 1306
Kojto 107:4f6c30876dfa 1307
Kojto 107:4f6c30876dfa 1308 /* Blocking mode: Polling */
Kojto 107:4f6c30876dfa 1309 HAL_StatusTypeDef HAL_ADCEx_InjectedStart(ADC_HandleTypeDef* hadc);
Kojto 107:4f6c30876dfa 1310 HAL_StatusTypeDef HAL_ADCEx_InjectedStop(ADC_HandleTypeDef* hadc);
Kojto 107:4f6c30876dfa 1311 HAL_StatusTypeDef HAL_ADCEx_InjectedPollForConversion(ADC_HandleTypeDef* hadc, uint32_t Timeout);
Kojto 107:4f6c30876dfa 1312
Kojto 107:4f6c30876dfa 1313 /* Non-blocking mode: Interruption */
Kojto 107:4f6c30876dfa 1314 HAL_StatusTypeDef HAL_ADCEx_InjectedStart_IT(ADC_HandleTypeDef* hadc);
Kojto 107:4f6c30876dfa 1315 HAL_StatusTypeDef HAL_ADCEx_InjectedStop_IT(ADC_HandleTypeDef* hadc);
Kojto 107:4f6c30876dfa 1316
Kojto 107:4f6c30876dfa 1317
Kojto 107:4f6c30876dfa 1318 /* ADC multimode */
Kojto 107:4f6c30876dfa 1319 HAL_StatusTypeDef HAL_ADCEx_MultiModeStart_DMA(ADC_HandleTypeDef *hadc, uint32_t *pData, uint32_t Length);
Kojto 107:4f6c30876dfa 1320 HAL_StatusTypeDef HAL_ADCEx_MultiModeStop_DMA(ADC_HandleTypeDef *hadc);
Kojto 107:4f6c30876dfa 1321 uint32_t HAL_ADCEx_MultiModeGetValue(ADC_HandleTypeDef *hadc);
Kojto 107:4f6c30876dfa 1322
Kojto 107:4f6c30876dfa 1323
Kojto 107:4f6c30876dfa 1324 /* ADC retrieve conversion value intended to be used with polling or interruption */
Kojto 107:4f6c30876dfa 1325 uint32_t HAL_ADCEx_InjectedGetValue(ADC_HandleTypeDef* hadc, uint32_t InjectedRank);
Kojto 107:4f6c30876dfa 1326
Kojto 107:4f6c30876dfa 1327 /* ADC IRQHandler and Callbacks used in non-blocking modes (Interruption) */
Kojto 107:4f6c30876dfa 1328 void HAL_ADCEx_InjectedConvCpltCallback(ADC_HandleTypeDef* hadc);
Kojto 107:4f6c30876dfa 1329 void HAL_ADCEx_InjectedQueueOverflowCallback(ADC_HandleTypeDef* hadc);
Kojto 107:4f6c30876dfa 1330 void HAL_ADCEx_LevelOutOfWindow2Callback(ADC_HandleTypeDef* hadc);
Kojto 107:4f6c30876dfa 1331 void HAL_ADCEx_LevelOutOfWindow3Callback(ADC_HandleTypeDef* hadc);
Kojto 107:4f6c30876dfa 1332 void HAL_ADCEx_EndOfSamplingCallback(ADC_HandleTypeDef* hadc);
Kojto 107:4f6c30876dfa 1333
Kojto 107:4f6c30876dfa 1334
Kojto 107:4f6c30876dfa 1335 /* ADC Regular conversions stop */
Kojto 107:4f6c30876dfa 1336 HAL_StatusTypeDef HAL_ADCEx_RegularStop(ADC_HandleTypeDef* hadc);
Kojto 107:4f6c30876dfa 1337 HAL_StatusTypeDef HAL_ADCEx_RegularStop_IT(ADC_HandleTypeDef* hadc);
Kojto 107:4f6c30876dfa 1338 HAL_StatusTypeDef HAL_ADCEx_RegularStop_DMA(ADC_HandleTypeDef* hadc);
Kojto 107:4f6c30876dfa 1339 HAL_StatusTypeDef HAL_ADCEx_RegularMultiModeStop_DMA(ADC_HandleTypeDef* hadc);
Kojto 107:4f6c30876dfa 1340
Kojto 107:4f6c30876dfa 1341 /**
Kojto 107:4f6c30876dfa 1342 * @}
Kojto 107:4f6c30876dfa 1343 */
Kojto 107:4f6c30876dfa 1344
Kojto 107:4f6c30876dfa 1345 /** @addtogroup ADCEx_Exported_Functions_Group2 Extended Peripheral Control functions
Kojto 107:4f6c30876dfa 1346 * @brief Extended Peripheral Control functions
Kojto 107:4f6c30876dfa 1347 * @{
Kojto 107:4f6c30876dfa 1348 */
Kojto 107:4f6c30876dfa 1349 /* Peripheral Control functions ***********************************************/
Kojto 107:4f6c30876dfa 1350 HAL_StatusTypeDef HAL_ADCEx_InjectedConfigChannel(ADC_HandleTypeDef* hadc,ADC_InjectionConfTypeDef* sConfigInjected);
Kojto 107:4f6c30876dfa 1351 HAL_StatusTypeDef HAL_ADCEx_MultiModeConfigChannel(ADC_HandleTypeDef *hadc, ADC_MultiModeTypeDef *multimode);
Kojto 107:4f6c30876dfa 1352 HAL_StatusTypeDef HAL_ADCEx_EnableInjectedQueue(ADC_HandleTypeDef* hadc);
Kojto 107:4f6c30876dfa 1353 HAL_StatusTypeDef HAL_ADCEx_DisableInjectedQueue(ADC_HandleTypeDef* hadc);
Kojto 107:4f6c30876dfa 1354 HAL_StatusTypeDef HAL_ADCEx_DisableVoltageRegulator(ADC_HandleTypeDef* hadc);
Kojto 107:4f6c30876dfa 1355 HAL_StatusTypeDef HAL_ADCEx_EnterADCDeepPowerDownMode(ADC_HandleTypeDef* hadc);
Kojto 107:4f6c30876dfa 1356
Kojto 107:4f6c30876dfa 1357 /**
Kojto 107:4f6c30876dfa 1358 * @}
Kojto 107:4f6c30876dfa 1359 */
Kojto 107:4f6c30876dfa 1360
Kojto 107:4f6c30876dfa 1361 /**
Kojto 107:4f6c30876dfa 1362 * @}
Kojto 107:4f6c30876dfa 1363 */
Kojto 107:4f6c30876dfa 1364
Kojto 107:4f6c30876dfa 1365 /**
Kojto 107:4f6c30876dfa 1366 * @}
Kojto 107:4f6c30876dfa 1367 */
Kojto 107:4f6c30876dfa 1368
Kojto 107:4f6c30876dfa 1369 /**
Kojto 107:4f6c30876dfa 1370 * @}
Kojto 107:4f6c30876dfa 1371 */
Kojto 107:4f6c30876dfa 1372
Kojto 107:4f6c30876dfa 1373 #ifdef __cplusplus
Kojto 107:4f6c30876dfa 1374 }
Kojto 107:4f6c30876dfa 1375 #endif
Kojto 107:4f6c30876dfa 1376
Kojto 107:4f6c30876dfa 1377 #endif /*__STM32L4xx_ADC_EX_H */
Kojto 107:4f6c30876dfa 1378
Kojto 107:4f6c30876dfa 1379
Kojto 107:4f6c30876dfa 1380 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/