mbed official / mbed

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

Committer:
Kojto
Date:
Tue Feb 16 14:28:01 2016 +0000
Revision:
114:252557024ec3
Parent:
109:9296ab0bfc11
Child:
122:f9eeca106725
Release 114 of the mbed library

Changes:
- Atmel SAM - warnings fixes
- B96B F446VE - hw control flow addition
- Remove of GCC CW which was not active
- Remove GCC CS, not released anymore - deprecated

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 109:9296ab0bfc11 1 /**
Kojto 109:9296ab0bfc11 2 ******************************************************************************
Kojto 109:9296ab0bfc11 3 * @file stm32f3xx_hal_adc_ex.h
Kojto 109:9296ab0bfc11 4 * @author MCD Application Team
Kojto 109:9296ab0bfc11 5 * @version V1.1.0
Kojto 109:9296ab0bfc11 6 * @date 12-Sept-2014
Kojto 109:9296ab0bfc11 7 * @brief Header file containing functions prototypes of ADC HAL library.
Kojto 109:9296ab0bfc11 8 ******************************************************************************
Kojto 109:9296ab0bfc11 9 * @attention
Kojto 109:9296ab0bfc11 10 *
Kojto 109:9296ab0bfc11 11 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
Kojto 109:9296ab0bfc11 12 *
Kojto 109:9296ab0bfc11 13 * Redistribution and use in source and binary forms, with or without modification,
Kojto 109:9296ab0bfc11 14 * are permitted provided that the following conditions are met:
Kojto 109:9296ab0bfc11 15 * 1. Redistributions of source code must retain the above copyright notice,
Kojto 109:9296ab0bfc11 16 * this list of conditions and the following disclaimer.
Kojto 109:9296ab0bfc11 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
Kojto 109:9296ab0bfc11 18 * this list of conditions and the following disclaimer in the documentation
Kojto 109:9296ab0bfc11 19 * and/or other materials provided with the distribution.
Kojto 109:9296ab0bfc11 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Kojto 109:9296ab0bfc11 21 * may be used to endorse or promote products derived from this software
Kojto 109:9296ab0bfc11 22 * without specific prior written permission.
Kojto 109:9296ab0bfc11 23 *
Kojto 109:9296ab0bfc11 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Kojto 109:9296ab0bfc11 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Kojto 109:9296ab0bfc11 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Kojto 109:9296ab0bfc11 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Kojto 109:9296ab0bfc11 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Kojto 109:9296ab0bfc11 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Kojto 109:9296ab0bfc11 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Kojto 109:9296ab0bfc11 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Kojto 109:9296ab0bfc11 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Kojto 109:9296ab0bfc11 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Kojto 109:9296ab0bfc11 34 *
Kojto 109:9296ab0bfc11 35 ******************************************************************************
Kojto 109:9296ab0bfc11 36 */
Kojto 109:9296ab0bfc11 37
Kojto 109:9296ab0bfc11 38 /* Define to prevent recursive inclusion -------------------------------------*/
Kojto 109:9296ab0bfc11 39 #ifndef __STM32F3xx_ADC_EX_H
Kojto 109:9296ab0bfc11 40 #define __STM32F3xx_ADC_EX_H
Kojto 109:9296ab0bfc11 41
Kojto 109:9296ab0bfc11 42 #ifdef __cplusplus
Kojto 109:9296ab0bfc11 43 extern "C" {
Kojto 109:9296ab0bfc11 44 #endif
Kojto 109:9296ab0bfc11 45
Kojto 109:9296ab0bfc11 46 /* Includes ------------------------------------------------------------------*/
Kojto 109:9296ab0bfc11 47 #include "stm32f3xx_hal_def.h"
Kojto 109:9296ab0bfc11 48
Kojto 109:9296ab0bfc11 49 /** @addtogroup STM32F3xx_HAL_Driver
Kojto 109:9296ab0bfc11 50 * @{
Kojto 109:9296ab0bfc11 51 */
Kojto 109:9296ab0bfc11 52
Kojto 109:9296ab0bfc11 53 /** @addtogroup ADCEx ADC Extended HAL module driver
Kojto 109:9296ab0bfc11 54 * @{
Kojto 109:9296ab0bfc11 55 */
Kojto 109:9296ab0bfc11 56
Kojto 109:9296ab0bfc11 57 /* Exported types ------------------------------------------------------------*/
Kojto 109:9296ab0bfc11 58 /** @defgroup ADCEx_Exported_Types ADC Extented Exported Types
Kojto 109:9296ab0bfc11 59 * @{
Kojto 109:9296ab0bfc11 60 */
Kojto 109:9296ab0bfc11 61 struct __ADC_HandleTypeDef;
Kojto 109:9296ab0bfc11 62
Kojto 109:9296ab0bfc11 63 #if defined(STM32F302xE) || defined(STM32F303xE) || defined(STM32F398xx) || \
Kojto 109:9296ab0bfc11 64 defined(STM32F302xC) || defined(STM32F303xC) || defined(STM32F358xx) || \
Kojto 109:9296ab0bfc11 65 defined(STM32F303x8) || defined(STM32F334x8) || defined(STM32F328xx) || \
Kojto 109:9296ab0bfc11 66 defined(STM32F301x8) || defined(STM32F302x8) || defined(STM32F318xx)
Kojto 109:9296ab0bfc11 67 /**
Kojto 109:9296ab0bfc11 68 * @brief Structure definition of ADC initialization and regular group
Kojto 109:9296ab0bfc11 69 * @note Parameters of this structure are shared within 2 scopes:
Kojto 109:9296ab0bfc11 70 * - Scope entire ADC (affects regular and injected groups): ClockPrescaler, Resolution, DataAlign,
Kojto 109:9296ab0bfc11 71 * ScanConvMode, EOCSelection, LowPowerAutoWait.
Kojto 109:9296ab0bfc11 72 * - Scope regular group: ContinuousConvMode, NbrOfConversion, DiscontinuousConvMode, NbrOfDiscConversion, ExternalTrigConvEdge, ExternalTrigConv, DMAContinuousRequests, Overrun.
Kojto 109:9296ab0bfc11 73 * @note The setting of these parameters with function HAL_ADC_Init() is conditioned to ADC state.
Kojto 109:9296ab0bfc11 74 * ADC state can be either:
Kojto 109:9296ab0bfc11 75 * - For all parameters: ADC disabled
Kojto 109:9296ab0bfc11 76 * - For all parameters except 'LowPowerAutoWait' and 'DMAContinuousRequests': ADC enabled without conversion on going on regular group.
Kojto 109:9296ab0bfc11 77 * - For parameters 'LowPowerAutoWait' and 'DMAContinuousRequests': ADC enabled without conversion on going on regular and injected groups.
Kojto 109:9296ab0bfc11 78 * If ADC is not in the appropriate state to modify some parameters, these parameters setting is bypassed
Kojto 109:9296ab0bfc11 79 * without error reporting without error reporting (as it can be the expected behaviour in case of intended action to update another parameter (which fullfills the ADC state condition) on the fly).
Kojto 109:9296ab0bfc11 80 */
Kojto 109:9296ab0bfc11 81 typedef struct
Kojto 109:9296ab0bfc11 82 {
Kojto 109:9296ab0bfc11 83 uint32_t ClockPrescaler; /*!< Select ADC clock source (synchronous clock derived from AHB clock or asynchronous clock derived from ADC dedicated PLL 72MHz) and clock prescaler.
Kojto 109:9296ab0bfc11 84 The clock is common for all the ADCs.
Kojto 109:9296ab0bfc11 85 This parameter can be a value of @ref ADCEx_ClockPrescaler
Kojto 109:9296ab0bfc11 86 Note: In case of usage of channels on injected group, ADC frequency should be low than AHB clock frequency /4 for resolution 12 or 10 bits,
Kojto 109:9296ab0bfc11 87 AHB clock frequency /3 for resolution 8 bits, AHB clock frequency /2 for resolution 6 bits.
Kojto 109:9296ab0bfc11 88 Note: In case of usage of the ADC dedicated PLL clock, this clock must be preliminarily enabled and prescaler set at RCC top level.
Kojto 109:9296ab0bfc11 89 Note: This parameter can be modified only if all ADCs of the common ADC group are disabled (for products with several ADCs) */
Kojto 109:9296ab0bfc11 90 uint32_t Resolution; /*!< Configures the ADC resolution.
Kojto 109:9296ab0bfc11 91 This parameter can be a value of @ref ADCEx_Resolution */
Kojto 109:9296ab0bfc11 92 uint32_t DataAlign; /*!< Specifies ADC data alignment to right (for resolution 12 bits: MSB on register bit 11 and LSB on register bit 0) (default setting)
Kojto 109:9296ab0bfc11 93 or to left (for resolution 12 bits, if offset disabled: MSB on register bit 15 and LSB on register bit 4, if offset enabled: MSB on register bit 14 and LSB on register bit 3).
Kojto 109:9296ab0bfc11 94 See reference manual for alignments with other resolutions.
Kojto 109:9296ab0bfc11 95 This parameter can be a value of @ref ADCEx_Data_align */
Kojto 109:9296ab0bfc11 96 uint32_t ScanConvMode; /*!< Configures the sequencer of regular and injected groups.
Kojto 109:9296ab0bfc11 97 This parameter can be associated to parameter 'DiscontinuousConvMode' to have main sequence subdivided in successive parts.
Kojto 109:9296ab0bfc11 98 If disabled: Conversion is performed in single mode (one channel converted, the one defined in rank 1).
Kojto 109:9296ab0bfc11 99 Parameters 'NbrOfConversion' and 'InjectedNbrOfConversion' are discarded (equivalent to set to 1).
Kojto 109:9296ab0bfc11 100 If enabled: Conversions are performed in sequence mode (multiple ranks defined by 'NbrOfConversion'/'InjectedNbrOfConversion' and each channel rank).
Kojto 109:9296ab0bfc11 101 Scan direction is upward: from rank1 to rank 'n'.
Kojto 109:9296ab0bfc11 102 This parameter can be a value of @ref ADCEx_Scan_mode */
Kojto 109:9296ab0bfc11 103 uint32_t EOCSelection; /*!< Specifies what EOC (End Of Conversion) flag is used for conversion by polling and interruption: end of conversion of each rank or complete sequence.
Kojto 109:9296ab0bfc11 104 This parameter can be a value of @ref ADCEx_EOCSelection. */
Kojto 109:9296ab0bfc11 105 uint32_t LowPowerAutoWait; /*!< Selects the dynamic low power Auto Delay: new conversion start only when the previous
Kojto 109:9296ab0bfc11 106 conversion (for regular group) or previous sequence (for injected group) has been treated by user software.
Kojto 109:9296ab0bfc11 107 This feature automatically adapts the speed of ADC to the speed of the system that reads the data. Moreover, this avoids risk of overrun for low frequency applications.
Kojto 109:9296ab0bfc11 108 This parameter can be set to ENABLE or DISABLE.
Kojto 109:9296ab0bfc11 109 Note: Do not use with interruption or DMA (HAL_ADC_Start_IT(), HAL_ADC_Start_DMA()) since they have to clear immediately the EOC flag to free the IRQ vector sequencer.
Kojto 109:9296ab0bfc11 110 Do use with polling: 1. Start conversion with HAL_ADC_Start(), 2. Later on, when conversion data is needed: use HAL_ADC_PollForConversion() to ensure that conversion is completed
Kojto 109:9296ab0bfc11 111 and use HAL_ADC_GetValue() to retrieve conversion result and trig another conversion. */
Kojto 109:9296ab0bfc11 112 uint32_t ContinuousConvMode; /*!< Specifies whether the conversion is performed in single mode (one conversion) or continuous mode for regular group,
Kojto 109:9296ab0bfc11 113 after the selected trigger occurred (software start or external trigger).
Kojto 109:9296ab0bfc11 114 This parameter can be set to ENABLE or DISABLE. */
Kojto 109:9296ab0bfc11 115 uint32_t NbrOfConversion; /*!< Specifies the number of ranks that will be converted within the regular group sequencer.
Kojto 109:9296ab0bfc11 116 To use the regular group sequencer and convert several ranks, parameter 'ScanConvMode' must be enabled.
Kojto 109:9296ab0bfc11 117 This parameter must be a number between Min_Data = 1 and Max_Data = 16.
Kojto 109:9296ab0bfc11 118 Note: This parameter must be modified when no conversion is on going on regular group (ADC disabled, or ADC enabled without continuous mode or external trigger that could lauch a conversion). */
Kojto 109:9296ab0bfc11 119 uint32_t DiscontinuousConvMode; /*!< Specifies whether the conversions sequence of regular group is performed in Complete-sequence/Discontinuous-sequence (main sequence subdivided in successive parts).
Kojto 109:9296ab0bfc11 120 Discontinuous mode is used only if sequencer is enabled (parameter 'ScanConvMode'). If sequencer is disabled, this parameter is discarded.
Kojto 109:9296ab0bfc11 121 Discontinuous mode can be enabled only if continuous mode is disabled. If continuous mode is enabled, this parameter setting is discarded.
Kojto 109:9296ab0bfc11 122 This parameter can be set to ENABLE or DISABLE. */
Kojto 109:9296ab0bfc11 123 uint32_t NbrOfDiscConversion; /*!< Specifies the number of discontinuous conversions in which the main sequence of regular group (parameter NbrOfConversion) will be subdivided.
Kojto 109:9296ab0bfc11 124 If parameter 'DiscontinuousConvMode' is disabled, this parameter is discarded.
Kojto 109:9296ab0bfc11 125 This parameter must be a number between Min_Data = 1 and Max_Data = 8. */
Kojto 109:9296ab0bfc11 126 uint32_t ExternalTrigConv; /*!< Selects the external event used to trigger the conversion start of regular group.
Kojto 109:9296ab0bfc11 127 If set to ADC_SOFTWARE_START, external triggers are disabled.
Kojto 109:9296ab0bfc11 128 This parameter can be a value of @ref ADCEx_External_trigger_source_Regular
Kojto 109:9296ab0bfc11 129 Caution: For devices with several ADCs, external trigger source is common to ADC common group (for example: ADC1&ADC2, ADC3&ADC4, if available) */
Kojto 109:9296ab0bfc11 130 uint32_t ExternalTrigConvEdge; /*!< Selects the external trigger edge of regular group.
Kojto 109:9296ab0bfc11 131 If trigger is set to ADC_SOFTWARE_START, this parameter is discarded.
Kojto 109:9296ab0bfc11 132 This parameter can be a value of @ref ADCEx_External_trigger_edge_Regular */
Kojto 109:9296ab0bfc11 133 uint32_t DMAContinuousRequests; /*!< Specifies whether the DMA requests are performed in one shot mode (DMA transfer stop when number of conversions is reached)
Kojto 109:9296ab0bfc11 134 or in Continuous mode (DMA transfer unlimited, whatever number of conversions).
Kojto 109:9296ab0bfc11 135 Note: In continuous mode, DMA must be configured in circular mode. Otherwise an overrun will be triggered when DMA buffer maximum pointer is reached.
Kojto 109:9296ab0bfc11 136 This parameter can be set to ENABLE or DISABLE.
Kojto 109:9296ab0bfc11 137 Note: This parameter must be modified when no conversion is on going on both regular and injected groups (ADC disabled, or ADC enabled without continuous mode or external trigger that could lauch a conversion). */
Kojto 109:9296ab0bfc11 138 uint32_t Overrun; /*!< Select the behaviour in case of overrun: data overwritten (default) or preserved.
Kojto 109:9296ab0bfc11 139 This parameter is for regular group only.
Kojto 109:9296ab0bfc11 140 This parameter can be a value of @ref ADCEx_Overrun
Kojto 109:9296ab0bfc11 141 Note: Case of overrun set to data preserved and usage with end on conversion interruption (HAL_Start_IT()): ADC IRQ handler has to clear end of conversion flags, this induces the release of the preserved data. If needed, this data can be saved into function HAL_ADC_ConvCpltCallback() (called before end of conversion flags clear).
Kojto 109:9296ab0bfc11 142 Note: Error reporting in function of conversion mode:
Kojto 109:9296ab0bfc11 143 - Usage with ADC conversion by polling for event or interruption: Error is reported only if overrun is set to data preserved. If overrun is set to data overwritten, user can willingly not read the conversion data each time, this is not considered as an erroneous case.
Kojto 109:9296ab0bfc11 144 - Usage with ADC conversion by DMA: Error is reported whatever overrun setting (DMA is expected to process all data from data register, any data missed would be abnormal). */
Kojto 109:9296ab0bfc11 145 }ADC_InitTypeDef;
Kojto 109:9296ab0bfc11 146
Kojto 109:9296ab0bfc11 147 /**
Kojto 109:9296ab0bfc11 148 * @brief Structure definition of ADC channel for regular group
Kojto 109:9296ab0bfc11 149 * @note The setting of these parameters with function HAL_ADC_ConfigChannel() is conditioned to ADC state.
Kojto 109:9296ab0bfc11 150 * ADC state can be either:
Kojto 109:9296ab0bfc11 151 * - For all parameters: ADC disabled (this is the only possible ADC state to modify parameter 'SingleDiff')
Kojto 109:9296ab0bfc11 152 * - For all except parameters 'SamplingTime', 'Offset', 'OffsetNumber': ADC enabled without conversion on going on regular group.
Kojto 109:9296ab0bfc11 153 * - For parameters 'SamplingTime', 'Offset', 'OffsetNumber': ADC enabled without conversion on going on regular and injected groups.
Kojto 109:9296ab0bfc11 154 * If ADC is not in the appropriate state to modify some parameters, these parameters setting is bypassed
Kojto 109:9296ab0bfc11 155 * 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 109:9296ab0bfc11 156 */
Kojto 109:9296ab0bfc11 157 typedef struct
Kojto 109:9296ab0bfc11 158 {
Kojto 109:9296ab0bfc11 159 uint32_t Channel; /*!< Specifies the channel to configure into ADC regular group.
Kojto 109:9296ab0bfc11 160 This parameter can be a value of @ref ADCEx_channels
Kojto 109:9296ab0bfc11 161 Note: Depending on devices, some channels may not be available on package pins. Refer to device datasheet for channels availability. */
Kojto 109:9296ab0bfc11 162 uint32_t Rank; /*!< Specifies the rank in the regular group sequencer.
Kojto 109:9296ab0bfc11 163 This parameter can be a value of @ref ADCEx_regular_rank
Kojto 109:9296ab0bfc11 164 Note: In case of need to disable a channel or change order of conversion sequencer, rank containing a previous channel setting can be overwritten by the new channel setting (or parameter number of conversions can be adjusted) */
Kojto 109:9296ab0bfc11 165 uint32_t SamplingTime; /*!< Sampling time value to be set for the selected channel.
Kojto 109:9296ab0bfc11 166 Unit: ADC clock cycles
Kojto 109:9296ab0bfc11 167 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, 8.5 cycles at 8 bits, 6.5 cycles at 6 bits).
Kojto 109:9296ab0bfc11 168 This parameter can be a value of @ref ADCEx_sampling_times
Kojto 109:9296ab0bfc11 169 Caution: This parameter updates the parameter property of the channel, that can be used into regular and/or injected groups.
Kojto 109:9296ab0bfc11 170 If this same channel has been previously configured in the other group (regular/injected), it will be updated to last setting.
Kojto 109:9296ab0bfc11 171 Note: In case of usage of internal measurement channels (VrefInt/Vbat/TempSensor),
Kojto 109:9296ab0bfc11 172 sampling time constraints must be respected (sampling time can be adjusted in function of ADC clock frequency and sampling time setting)
Kojto 109:9296ab0bfc11 173 Refer to device datasheet for timings values, parameters TS_vrefint, TS_vbat, TS_temp (values rough order: 2.2us min). */
Kojto 109:9296ab0bfc11 174 uint32_t SingleDiff; /*!< Selection of single-ended or differential input.
Kojto 109:9296ab0bfc11 175 In differential mode: Differential measurement is between the selected channel 'i' (positive input) and channel 'i+1' (negative input).
Kojto 109:9296ab0bfc11 176 Only channel 'i' has to be configured, channel 'i+1' is configured automatically.
Kojto 109:9296ab0bfc11 177 This parameter must be a value of @ref ADCEx_SingleDifferential
Kojto 109:9296ab0bfc11 178 Caution: This parameter updates the parameter property of the channel, that can be used into regular and/or injected groups.
Kojto 109:9296ab0bfc11 179 If this same channel has been previously configured in the other group (regular/injected), it will be updated to last setting.
Kojto 109:9296ab0bfc11 180 Note: Channels 1 to 14 are available in differential mode. Channels 15, 16, 17, 18 can be used only in single-ended mode.
Kojto 109:9296ab0bfc11 181 Note: When configuring a channel 'i' in differential mode, the channel 'i+1' is not usable separately.
Kojto 109:9296ab0bfc11 182 Note: This parameter must be modified when ADC is disabled (before ADC start conversion or after ADC stop conversion).
Kojto 109:9296ab0bfc11 183 If ADC is enabled, this parameter setting is bypassed without error reporting (as it can be the expected behaviour in case of another parameter update on the fly) */
Kojto 109:9296ab0bfc11 184 uint32_t OffsetNumber; /*!< Selects the offset number
Kojto 109:9296ab0bfc11 185 This parameter can be a value of @ref ADCEx_OffsetNumber
Kojto 109:9296ab0bfc11 186 Caution: Only one channel is allowed per channel. If another channel was on this offset number, the offset will be changed to the new channel */
Kojto 109:9296ab0bfc11 187 uint32_t Offset; /*!< Defines the offset to be subtracted from the raw converted data when convert channels.
Kojto 109:9296ab0bfc11 188 Offset value must be a positive number.
Kojto 109:9296ab0bfc11 189 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, 0x3FF, 0xFF or 0x3F respectively.
Kojto 109:9296ab0bfc11 190 Note: This parameter must be modified when no conversion is on going on both regular and injected groups (ADC disabled, or ADC enabled without continuous mode or external trigger that could lauch a conversion). */
Kojto 109:9296ab0bfc11 191 }ADC_ChannelConfTypeDef;
Kojto 109:9296ab0bfc11 192
Kojto 109:9296ab0bfc11 193 /**
Kojto 109:9296ab0bfc11 194 * @brief Structure definition of ADC injected group and ADC channel for injected group
Kojto 109:9296ab0bfc11 195 * @note Parameters of this structure are shared within 2 scopes:
Kojto 109:9296ab0bfc11 196 * - Scope channel: InjectedChannel, InjectedRank, InjectedSamplingTime , InjectedSingleDiff, InjectedOffsetNumber, InjectedOffset
Kojto 109:9296ab0bfc11 197 * - Scope injected group (affects all channels of injected group): InjectedNbrOfConversion, InjectedDiscontinuousConvMode,
Kojto 109:9296ab0bfc11 198 * AutoInjectedConv, QueueInjectedContext, ExternalTrigInjecConvEdge, ExternalTrigInjecConv.
Kojto 109:9296ab0bfc11 199 * @note The setting of these parameters with function HAL_ADCEx_InjectedConfigChannel() is conditioned to ADC state.
Kojto 109:9296ab0bfc11 200 * ADC state can be either:
Kojto 109:9296ab0bfc11 201 * - For all parameters: ADC disabled (this is the only possible ADC state to modify parameter 'InjectedSingleDiff')
Kojto 109:9296ab0bfc11 202 * - For parameters 'InjectedDiscontinuousConvMode', 'QueueInjectedContext': ADC enabled without conversion on going on injected group.
Kojto 109:9296ab0bfc11 203 * - For parameters 'InjectedSamplingTime', 'InjectedOffset', 'InjectedOffsetNumber', 'AutoInjectedConv': ADC enabled without conversion on going on regular and injected groups.
Kojto 109:9296ab0bfc11 204 * - For parameters 'InjectedChannel', 'InjectedRank', 'InjectedNbrOfConversion', 'ExternalTrigInjecConv', 'ExternalTrigInjecConvEdge': ADC enabled and while conversion on going on regular and injected groups.
Kojto 109:9296ab0bfc11 205 * If ADC is not in the appropriate state to modify some parameters, these parameters setting is bypassed
Kojto 109:9296ab0bfc11 206 * without error reporting 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 109:9296ab0bfc11 207 */
Kojto 109:9296ab0bfc11 208 typedef struct
Kojto 109:9296ab0bfc11 209 {
Kojto 109:9296ab0bfc11 210 uint32_t InjectedChannel; /*!< Configure the ADC injected channel
Kojto 109:9296ab0bfc11 211 This parameter can be a value of @ref ADCEx_channels
Kojto 109:9296ab0bfc11 212 Note: Depending on devices, some channels may not be available on package pins. Refer to device datasheet for channels availability. */
Kojto 109:9296ab0bfc11 213 uint32_t InjectedRank; /*!< The rank in the regular group sequencer
Kojto 109:9296ab0bfc11 214 This parameter must be a value of @ref ADCEx_injected_rank
Kojto 109:9296ab0bfc11 215 Note: In case of need to disable a channel or change order of conversion sequencer, rank containing a previous channel setting can be overwritten by the new channel setting (or parameter number of conversions can be adjusted) */
Kojto 109:9296ab0bfc11 216 uint32_t InjectedSamplingTime; /*!< Sampling time value to be set for the selected channel.
Kojto 109:9296ab0bfc11 217 Unit: ADC clock cycles
Kojto 109:9296ab0bfc11 218 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, 8.5 cycles at 8 bits, 6.5 cycles at 6 bits).
Kojto 109:9296ab0bfc11 219 This parameter can be a value of @ref ADCEx_sampling_times
Kojto 109:9296ab0bfc11 220 Caution: This parameter updates the parameter property of the channel, that can be used into regular and/or injected groups.
Kojto 109:9296ab0bfc11 221 If this same channel has been previously configured in the other group (regular/injected), it will be updated to last setting.
Kojto 109:9296ab0bfc11 222 Note: In case of usage of internal measurement channels (VrefInt/Vbat/TempSensor),
Kojto 109:9296ab0bfc11 223 sampling time constraints must be respected (sampling time can be adjusted in function of ADC clock frequency and sampling time setting)
Kojto 109:9296ab0bfc11 224 Refer to device datasheet for timings values, parameters TS_vrefint, TS_vbat, TS_temp (values rough order: 2.2us min). */
Kojto 109:9296ab0bfc11 225 uint32_t InjectedSingleDiff; /*!< Selection of single-ended or differential input.
Kojto 109:9296ab0bfc11 226 In differential mode: Differential measurement is between the selected channel 'i' (positive input) and channel 'i+1' (negative input).
Kojto 109:9296ab0bfc11 227 Only channel 'i' has to be configured, channel 'i+1' is configured automatically.
Kojto 109:9296ab0bfc11 228 This parameter must be a value of @ref ADCEx_SingleDifferential
Kojto 109:9296ab0bfc11 229 Caution: This parameter updates the parameter property of the channel, that can be used into regular and/or injected groups.
Kojto 109:9296ab0bfc11 230 If this same channel has been previously configured in the other group (regular/injected), it will be updated to last setting.
Kojto 109:9296ab0bfc11 231 Note: Channels 1 to 14 are available in differential mode. Channels 15, 16, 17, 18 can be used only in single-ended mode.
Kojto 109:9296ab0bfc11 232 Note: When configuring a channel 'i' in differential mode, the channel 'i-1' is not usable separately.
Kojto 109:9296ab0bfc11 233 Note: This parameter must be modified when ADC is disabled (before ADC start conversion or after ADC stop conversion).
Kojto 109:9296ab0bfc11 234 If ADC is enabled, this parameter setting is bypassed without error reporting (as it can be the expected behaviour in case of another parameter update on the fly) */
Kojto 109:9296ab0bfc11 235 uint32_t InjectedOffsetNumber; /*!< Selects the offset number
Kojto 109:9296ab0bfc11 236 This parameter can be a value of @ref ADCEx_OffsetNumber
Kojto 109:9296ab0bfc11 237 Caution: Only one channel is allowed per offset number. If another channel was on this offset number, the offset will be changed to the new channel. */
Kojto 109:9296ab0bfc11 238 uint32_t InjectedOffset; /*!< Defines the offset to be subtracted from the raw converted data.
Kojto 109:9296ab0bfc11 239 Offset value must be a positive number.
Kojto 109:9296ab0bfc11 240 Depending of ADC resolution selected (12, 10, 8 or 6 bits),
Kojto 109:9296ab0bfc11 241 this parameter must be a number between Min_Data = 0x000 and Max_Data = 0xFFF, 0x3FF, 0xFF or 0x3F respectively. */
Kojto 109:9296ab0bfc11 242 uint32_t InjectedNbrOfConversion; /*!< Specifies the number of ranks that will be converted within the injected group sequencer.
Kojto 109:9296ab0bfc11 243 To use the injected group sequencer and convert several ranks, parameter 'ScanConvMode' must be enabled.
Kojto 109:9296ab0bfc11 244 This parameter must be a number between Min_Data = 1 and Max_Data = 4.
Kojto 109:9296ab0bfc11 245 Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to
Kojto 109:9296ab0bfc11 246 configure a channel on injected group can impact the configuration of other channels previously set. */
Kojto 109:9296ab0bfc11 247 uint32_t InjectedDiscontinuousConvMode; /*!< Specifies whether the conversions sequence of injected group is performed in Complete-sequence/Discontinuous-sequence (main sequence subdivided in successive parts).
Kojto 109:9296ab0bfc11 248 Discontinuous mode is used only if sequencer is enabled (parameter 'ScanConvMode'). If sequencer is disabled, this parameter is discarded.
Kojto 109:9296ab0bfc11 249 Discontinuous mode can be enabled only if continuous mode is disabled. If continuous mode is enabled, this parameter setting is discarded.
Kojto 109:9296ab0bfc11 250 This parameter can be set to ENABLE or DISABLE.
Kojto 109:9296ab0bfc11 251 Note: This parameter must be modified when ADC is disabled (before ADC start conversion or after ADC stop conversion).
Kojto 109:9296ab0bfc11 252 Note: For injected group, number of discontinuous ranks increment is fixed to one-by-one.
Kojto 109:9296ab0bfc11 253 Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to
Kojto 109:9296ab0bfc11 254 configure a channel on injected group can impact the configuration of other channels previously set. */
Kojto 109:9296ab0bfc11 255 uint32_t AutoInjectedConv; /*!< Enables or disables the selected ADC automatic injected group conversion after regular one
Kojto 109:9296ab0bfc11 256 This parameter can be set to ENABLE or DISABLE.
Kojto 109:9296ab0bfc11 257 Note: To use Automatic injected conversion, discontinuous mode must be disabled ('DiscontinuousConvMode' and 'InjectedDiscontinuousConvMode' set to DISABLE)
Kojto 109:9296ab0bfc11 258 Note: To use Automatic injected conversion, injected group external triggers must be disabled ('ExternalTrigInjecConv' set to ADC_SOFTWARE_START)
Kojto 109:9296ab0bfc11 259 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 109:9296ab0bfc11 260 To maintain JAUTO always enabled, DMA must be configured in circular mode.
Kojto 109:9296ab0bfc11 261 Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to
Kojto 109:9296ab0bfc11 262 configure a channel on injected group can impact the configuration of other channels previously set. */
Kojto 109:9296ab0bfc11 263 uint32_t QueueInjectedContext; /*!< Specifies whether the context queue feature is enabled.
Kojto 109:9296ab0bfc11 264 This parameter can be set to ENABLE or DISABLE.
Kojto 109:9296ab0bfc11 265 If context queue is enabled, injected sequencer&channels configurations are queued on up to 2 contexts. If a
Kojto 109:9296ab0bfc11 266 new injected context is set when queue is full, error is triggered by interruption and through function 'HAL_ADCEx_InjectedQueueOverflowCallback'.
Kojto 109:9296ab0bfc11 267 Caution: This feature request that the sequence is fully configured before injected conversion start.
Kojto 109:9296ab0bfc11 268 Therefore, configure channels with HAL_ADCEx_InjectedConfigChannel() as many times as value of 'InjectedNbrOfConversion' parameter.
Kojto 109:9296ab0bfc11 269 Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to
Kojto 109:9296ab0bfc11 270 configure a channel on injected group can impact the configuration of other channels previously set.
Kojto 109:9296ab0bfc11 271 Note: This parameter must be modified when ADC is disabled (before ADC start conversion or after ADC stop conversion). */
Kojto 109:9296ab0bfc11 272 uint32_t ExternalTrigInjecConv; /*!< Selects the external event used to trigger the conversion start of injected group.
Kojto 109:9296ab0bfc11 273 If set to ADC_INJECTED_SOFTWARE_START, external triggers are disabled.
Kojto 109:9296ab0bfc11 274 This parameter can be a value of @ref ADCEx_External_trigger_source_Injected
Kojto 109:9296ab0bfc11 275 Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to
Kojto 109:9296ab0bfc11 276 configure a channel on injected group can impact the configuration of other channels previously set. */
Kojto 109:9296ab0bfc11 277 uint32_t ExternalTrigInjecConvEdge; /*!< Selects the external trigger edge of injected group.
Kojto 109:9296ab0bfc11 278 This parameter can be a value of @ref ADCEx_External_trigger_edge_Injected.
Kojto 109:9296ab0bfc11 279 If trigger is set to ADC_INJECTED_SOFTWARE_START, this parameter is discarded.
Kojto 109:9296ab0bfc11 280 Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to
Kojto 109:9296ab0bfc11 281 configure a channel on injected group can impact the configuration of other channels previously set. */
Kojto 109:9296ab0bfc11 282 }ADC_InjectionConfTypeDef;
Kojto 109:9296ab0bfc11 283
Kojto 109:9296ab0bfc11 284 /**
Kojto 109:9296ab0bfc11 285 * @brief Structure definition of ADC analog watchdog
Kojto 109:9296ab0bfc11 286 * @note The setting of these parameters with function HAL_ADC_AnalogWDGConfig() is conditioned to ADC state.
Kojto 109:9296ab0bfc11 287 * ADC state can be either: ADC disabled or ADC enabled without conversion on going on regular and injected groups.
Kojto 109:9296ab0bfc11 288 */
Kojto 109:9296ab0bfc11 289 typedef struct
Kojto 109:9296ab0bfc11 290 {
Kojto 109:9296ab0bfc11 291 uint32_t WatchdogNumber; /*!< Selects which ADC analog watchdog to apply to the selected channel.
Kojto 109:9296ab0bfc11 292 For Analog Watchdog 1: Only 1 channel can be monitored (or overall group of channels by setting parameter 'WatchdogMode')
Kojto 109:9296ab0bfc11 293 For Analog Watchdog 2 and 3: Several channels can be monitored (by successive calls of 'HAL_ADC_AnalogWDGConfig()' for each channel)
Kojto 109:9296ab0bfc11 294 This parameter can be a value of @ref ADCEx_analog_watchdog_number. */
Kojto 109:9296ab0bfc11 295 uint32_t WatchdogMode; /*!< For Analog Watchdog 1: Configures the ADC analog watchdog mode: single channel/overall group of channels, regular/injected group.
Kojto 109:9296ab0bfc11 296 For Analog Watchdog 2 and 3: There is no configuration for overall group of channels as AWD1. Set value 'ADC_ANALOGWATCHDOG_NONE' to reset channels group programmed with parameter 'Channel', set any other value to not use this parameter.
Kojto 109:9296ab0bfc11 297 This parameter can be a value of @ref ADCEx_analog_watchdog_mode. */
Kojto 109:9296ab0bfc11 298 uint32_t Channel; /*!< Selects which ADC channel to monitor by analog watchdog.
Kojto 109:9296ab0bfc11 299 For Analog Watchdog 1: this parameter has an effect only if parameter 'WatchdogMode' is configured on single channel. Only 1 channel can be monitored.
Kojto 109:9296ab0bfc11 300 For Analog Watchdog 2 and 3: Several channels can be monitored (successive calls of HAL_ADC_AnalogWDGConfig() must be done, one for each channel.
Kojto 109:9296ab0bfc11 301 Channels group reset can be done by setting WatchdogMode to 'ADC_ANALOGWATCHDOG_NONE').
Kojto 109:9296ab0bfc11 302 This parameter can be a value of @ref ADCEx_channels. */
Kojto 109:9296ab0bfc11 303 uint32_t ITMode; /*!< Specifies whether the analog watchdog is configured in interrupt or polling mode.
Kojto 109:9296ab0bfc11 304 This parameter can be set to ENABLE or DISABLE */
Kojto 109:9296ab0bfc11 305 uint32_t HighThreshold; /*!< Configures the ADC analog watchdog High threshold value.
Kojto 109:9296ab0bfc11 306 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, 0x3FF, 0xFF or 0x3F respectively.
Kojto 109:9296ab0bfc11 307 Note: Analog watchdog 2 and 3 are limited to a resolution of 8 bits: if ADC resolution is 12 bits
Kojto 109:9296ab0bfc11 308 the 4 LSB are ignored, if ADC resolution is 10 bits the 2 LSB are ignored. */
Kojto 109:9296ab0bfc11 309 uint32_t LowThreshold; /*!< Configures the ADC analog watchdog High threshold value.
Kojto 109:9296ab0bfc11 310 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, 0x3FF, 0xFF or 0x3F respectively.
Kojto 109:9296ab0bfc11 311 Note: Analog watchdog 2 and 3 are limited to a resolution of 8 bits: if ADC resolution is 12 bits
Kojto 109:9296ab0bfc11 312 the 4 LSB are ignored, if ADC resolution is 10 bits the 2 LSB are ignored. */
Kojto 109:9296ab0bfc11 313 }ADC_AnalogWDGConfTypeDef;
Kojto 109:9296ab0bfc11 314
Kojto 109:9296ab0bfc11 315 /**
Kojto 109:9296ab0bfc11 316 * @brief Structure definition of ADC multimode
Kojto 109:9296ab0bfc11 317 * @note The setting of these parameters with function HAL_ADCEx_MultiModeConfigChannel() is conditioned to ADCs state (both ADCs of the common group).
Kojto 109:9296ab0bfc11 318 * State of ADCs of the common group must be: disabled.
Kojto 109:9296ab0bfc11 319 */
Kojto 109:9296ab0bfc11 320 typedef struct
Kojto 109:9296ab0bfc11 321 {
Kojto 109:9296ab0bfc11 322 uint32_t Mode; /*!< Configures the ADC to operate in independent or multi mode.
Kojto 109:9296ab0bfc11 323 This parameter can be a value of @ref ADCEx_Common_mode */
Kojto 109:9296ab0bfc11 324 uint32_t DMAAccessMode; /*!< Configures the DMA mode for multi ADC mode:
Kojto 109:9296ab0bfc11 325 selection whether 2 DMA channels (each ADC use its own DMA channel) or 1 DMA channel (one DMA channel for both ADC, DMA of ADC master)
Kojto 109:9296ab0bfc11 326 This parameter can be a value of @ref ADCEx_Direct_memory_access_mode_for_multimode
Kojto 109:9296ab0bfc11 327 Caution: Limitations with multimode DMA access enabled (1 DMA channel used): In case of dual mode in high speed (more than 5Msps) or high activity of DMA by other peripherals, there is a risk of DMA overrun.
Kojto 109:9296ab0bfc11 328 Therefore, it is recommended to disable multimode DMA access: each ADC use its own DMA channel. */
Kojto 109:9296ab0bfc11 329 uint32_t TwoSamplingDelay; /*!< Configures the Delay between 2 sampling phases.
Kojto 109:9296ab0bfc11 330 This parameter can be a value of @ref ADCEx_delay_between_2_sampling_phases
Kojto 109:9296ab0bfc11 331 Delay range depends on selected resolution: from 1 to 12 clock cycles for 12 bits, from 1 to 10 clock cycles for 10 bits
Kojto 109:9296ab0bfc11 332 from 1 to 8 clock cycles for 8 bits, from 1 to 6 clock cycles for 6 bits */
Kojto 109:9296ab0bfc11 333 }ADC_MultiModeTypeDef;
Kojto 109:9296ab0bfc11 334 #endif /* STM32F302xE || STM32F303xE || STM32F398xx || */
Kojto 109:9296ab0bfc11 335 /* STM32F302xC || STM32F303xC || STM32F358xx || */
Kojto 109:9296ab0bfc11 336 /* STM32F303x8 || STM32F334x8 || STM32F328xx || */
Kojto 109:9296ab0bfc11 337 /* STM32F301x8 || STM32F302x8 || STM32F318xx */
Kojto 109:9296ab0bfc11 338
Kojto 109:9296ab0bfc11 339 #if defined(STM32F373xC) || defined(STM32F378xx)
Kojto 109:9296ab0bfc11 340 /**
Kojto 109:9296ab0bfc11 341 * @brief Structure definition of ADC and regular group initialization
Kojto 109:9296ab0bfc11 342 * @note Parameters of this structure are shared within 2 scopes:
Kojto 109:9296ab0bfc11 343 * - Scope entire ADC (affects regular and injected groups): DataAlign, ScanConvMode.
Kojto 109:9296ab0bfc11 344 * - Scope regular group: ContinuousConvMode, NbrOfConversion, DiscontinuousConvMode, NbrOfDiscConversion, ExternalTrigConvEdge, ExternalTrigConv.
Kojto 109:9296ab0bfc11 345 * @note The setting of these parameters with function HAL_ADC_Init() is conditioned to ADC state.
Kojto 109:9296ab0bfc11 346 * ADC can be either disabled or enabled without conversion on going on regular group.
Kojto 109:9296ab0bfc11 347 */
Kojto 109:9296ab0bfc11 348 typedef struct
Kojto 109:9296ab0bfc11 349 {
Kojto 109:9296ab0bfc11 350 uint32_t DataAlign; /*!< Specifies ADC data alignment to right (MSB on register bit 11 and LSB on register bit 0) (default setting)
Kojto 109:9296ab0bfc11 351 or to left (if regular group: MSB on register bit 15 and LSB on register bit 4, if injected group (MSB kept as signed value due to potential negative value after offset application): MSB on register bit 14 and LSB on register bit 3).
Kojto 109:9296ab0bfc11 352 This parameter can be a value of @ref ADCEx_Data_align */
Kojto 109:9296ab0bfc11 353 uint32_t ScanConvMode; /*!< Configures the sequencer of regular and injected groups.
Kojto 109:9296ab0bfc11 354 This parameter can be associated to parameter 'DiscontinuousConvMode' to have main sequence subdivided in successive parts.
Kojto 109:9296ab0bfc11 355 If disabled: Conversion is performed in single mode (one channel converted, the one defined in rank 1).
Kojto 109:9296ab0bfc11 356 Parameters 'NbrOfConversion' and 'InjectedNbrOfConversion' are discarded (equivalent to set to 1).
Kojto 109:9296ab0bfc11 357 If enabled: Conversions are performed in sequence mode (multiple ranks defined by 'NbrOfConversion'/'InjectedNbrOfConversion' and each channel rank).
Kojto 109:9296ab0bfc11 358 Scan direction is upward: from rank1 to rank 'n'.
Kojto 109:9296ab0bfc11 359 This parameter can be a value of @ref ADCEx_Scan_mode
Kojto 109:9296ab0bfc11 360 Note: For regular group, this parameter should be enabled in conversion either by polling (HAL_ADC_Start with Discontinuous mode and NbrOfDiscConversion=1)
Kojto 109:9296ab0bfc11 361 or by DMA (HAL_ADC_Start_DMA), but not by interruption (HAL_ADC_Start_IT): in scan mode, interruption is triggered only on the
Kojto 109:9296ab0bfc11 362 the last conversion of the sequence. All previous conversions would be overwritten by the last one.
Kojto 109:9296ab0bfc11 363 Injected group used with scan mode has not this constraint: each rank has its own result register, no data is overwritten. */
Kojto 109:9296ab0bfc11 364 uint32_t ContinuousConvMode; /*!< Specifies whether the conversion is performed in single mode (one conversion) or continuous mode for regular group,
Kojto 109:9296ab0bfc11 365 after the selected trigger occurred (software start or external trigger).
Kojto 109:9296ab0bfc11 366 This parameter can be set to ENABLE or DISABLE. */
Kojto 109:9296ab0bfc11 367 uint32_t NbrOfConversion; /*!< Specifies the number of ranks that will be converted within the regular group sequencer.
Kojto 109:9296ab0bfc11 368 To use regular group sequencer and convert several ranks, parameter 'ScanConvMode' must be enabled.
Kojto 109:9296ab0bfc11 369 This parameter must be a number between Min_Data = 1 and Max_Data = 16. */
Kojto 109:9296ab0bfc11 370 uint32_t DiscontinuousConvMode; /*!< Specifies whether the conversions sequence of regular group is performed in Complete-sequence/Discontinuous-sequence (main sequence subdivided in successive parts).
Kojto 109:9296ab0bfc11 371 Discontinuous mode is used only if sequencer is enabled (parameter 'ScanConvMode'). If sequencer is disabled, this parameter is discarded.
Kojto 109:9296ab0bfc11 372 Discontinuous mode can be enabled only if continuous mode is disabled. If continuous mode is enabled, this parameter setting is discarded.
Kojto 109:9296ab0bfc11 373 This parameter can be set to ENABLE or DISABLE. */
Kojto 109:9296ab0bfc11 374 uint32_t NbrOfDiscConversion; /*!< Specifies the number of discontinuous conversions in which the main sequence of regular group (parameter NbrOfConversion) will be subdivided.
Kojto 109:9296ab0bfc11 375 If parameter 'DiscontinuousConvMode' is disabled, this parameter is discarded.
Kojto 109:9296ab0bfc11 376 This parameter must be a number between Min_Data = 1 and Max_Data = 8. */
Kojto 109:9296ab0bfc11 377 uint32_t ExternalTrigConv; /*!< Selects the external event used to trigger the conversion start of regular group.
Kojto 109:9296ab0bfc11 378 If set to ADC_SOFTWARE_START, external triggers are disabled.
Kojto 109:9296ab0bfc11 379 If set to external trigger source, triggering is on event rising edge.
Kojto 109:9296ab0bfc11 380 This parameter can be a value of @ref ADCEx_External_trigger_source_Regular */
Kojto 109:9296ab0bfc11 381 }ADC_InitTypeDef;
Kojto 109:9296ab0bfc11 382
Kojto 109:9296ab0bfc11 383 /**
Kojto 109:9296ab0bfc11 384 * @brief Structure definition of ADC channel for regular group
Kojto 109:9296ab0bfc11 385 * @note The setting of these parameters with function HAL_ADC_ConfigChannel() is conditioned to ADC state.
Kojto 109:9296ab0bfc11 386 * ADC can be either disabled or enabled without conversion on going on regular group.
Kojto 109:9296ab0bfc11 387 */
Kojto 109:9296ab0bfc11 388 typedef struct
Kojto 109:9296ab0bfc11 389 {
Kojto 109:9296ab0bfc11 390 uint32_t Channel; /*!< Specifies the channel to configure into ADC regular group.
Kojto 109:9296ab0bfc11 391 This parameter can be a value of @ref ADCEx_channels
Kojto 109:9296ab0bfc11 392 Note: Depending on devices, some channels may not be available on package pins. Refer to device datasheet for channels availability. */
Kojto 109:9296ab0bfc11 393 uint32_t Rank; /*!< Specifies the rank in the regular group sequencer
Kojto 109:9296ab0bfc11 394 This parameter can be a value of @ref ADCEx_regular_rank
Kojto 109:9296ab0bfc11 395 Note: In case of need to disable a channel or change order of conversion sequencer, rank containing a previous channel setting can be overwritten by the new channel setting (or parameter number of conversions can be adjusted) */
Kojto 109:9296ab0bfc11 396 uint32_t SamplingTime; /*!< Sampling time value to be set for the selected channel.
Kojto 109:9296ab0bfc11 397 Unit: ADC clock cycles
Kojto 109:9296ab0bfc11 398 Conversion time is the addition of sampling time and processing time (12.5 ADC clock cycles at ADC resolution 12 bits).
Kojto 109:9296ab0bfc11 399 This parameter can be a value of @ref ADCEx_sampling_times
Kojto 109:9296ab0bfc11 400 Caution: This parameter updates the parameter property of the channel, that can be used into regular and/or injected groups.
Kojto 109:9296ab0bfc11 401 If this same channel has been previously configured in the other group (regular/injected), it will be updated to last setting.
Kojto 109:9296ab0bfc11 402 Note: In case of usage of internal measurement channels (VrefInt/Vbat/TempSensor),
Kojto 109:9296ab0bfc11 403 sampling time constraints must be respected (sampling time can be adjusted in function of ADC clock frequency and sampling time setting)
Kojto 109:9296ab0bfc11 404 Refer to device datasheet for timings values, parameters TS_vrefint, TS_vbat, TS_temp (values rough order: 5us to 17.1us min). */
Kojto 109:9296ab0bfc11 405 }ADC_ChannelConfTypeDef;
Kojto 109:9296ab0bfc11 406
Kojto 109:9296ab0bfc11 407 /**
Kojto 109:9296ab0bfc11 408 * @brief ADC Configuration injected Channel structure definition
Kojto 109:9296ab0bfc11 409 * @note Parameters of this structure are shared within 2 scopes:
Kojto 109:9296ab0bfc11 410 * - Scope channel: InjectedChannel, InjectedRank, InjectedSamplingTime, InjectedOffset
Kojto 109:9296ab0bfc11 411 * - Scope injected group (affects all channels of injected group): InjectedNbrOfConversion, InjectedDiscontinuousConvMode,
Kojto 109:9296ab0bfc11 412 * AutoInjectedConv, ExternalTrigInjecConvEdge, ExternalTrigInjecConv.
Kojto 109:9296ab0bfc11 413 * @note The setting of these parameters with function HAL_ADCEx_InjectedConfigChannel() is conditioned to ADC state.
Kojto 109:9296ab0bfc11 414 * ADC state can be either:
Kojto 109:9296ab0bfc11 415 * - For all parameters: ADC disabled (this is the only possible ADC state to modify parameter 'ExternalTrigInjecConv')
Kojto 109:9296ab0bfc11 416 * - For all except parameters 'ExternalTrigInjecConv': ADC enabled without conversion on going on injected group.
Kojto 109:9296ab0bfc11 417 */
Kojto 109:9296ab0bfc11 418 typedef struct
Kojto 109:9296ab0bfc11 419 {
Kojto 109:9296ab0bfc11 420 uint32_t InjectedChannel; /*!< Selection of ADC channel to configure
Kojto 109:9296ab0bfc11 421 This parameter can be a value of @ref ADCEx_channels
Kojto 109:9296ab0bfc11 422 Note: Depending on devices, some channels may not be available on package pins. Refer to device datasheet for channels availability. */
Kojto 109:9296ab0bfc11 423 uint32_t InjectedRank; /*!< Rank in the injected group sequencer
Kojto 109:9296ab0bfc11 424 This parameter must be a value of @ref ADCEx_injected_rank
Kojto 109:9296ab0bfc11 425 Note: In case of need to disable a channel or change order of conversion sequencer, rank containing a previous channel setting can be overwritten by the new channel setting (or parameter number of conversions can be adjusted) */
Kojto 109:9296ab0bfc11 426 uint32_t InjectedSamplingTime; /*!< Sampling time value to be set for the selected channel.
Kojto 109:9296ab0bfc11 427 Unit: ADC clock cycles
Kojto 109:9296ab0bfc11 428 Conversion time is the addition of sampling time and processing time (12.5 ADC clock cycles at ADC resolution 12 bits).
Kojto 109:9296ab0bfc11 429 This parameter can be a value of @ref ADCEx_sampling_times
Kojto 109:9296ab0bfc11 430 Caution: This parameter updates the parameter property of the channel, that can be used into regular and/or injected groups.
Kojto 109:9296ab0bfc11 431 If this same channel has been previously configured in the other group (regular/injected), it will be updated to last setting.
Kojto 109:9296ab0bfc11 432 Note: In case of usage of internal measurement channels (VrefInt/Vbat/TempSensor),
Kojto 109:9296ab0bfc11 433 sampling time constraints must be respected (sampling time can be adjusted in function of ADC clock frequency and sampling time setting)
Kojto 109:9296ab0bfc11 434 Refer to device datasheet for timings values, parameters TS_vrefint, TS_vbat, TS_temp (values rough order: 5us to 17.1us min). */
Kojto 109:9296ab0bfc11 435 uint32_t InjectedOffset; /*!< Defines the offset to be subtracted from the raw converted data (for channels set on injected group only).
Kojto 109:9296ab0bfc11 436 Offset value must be a positive number.
Kojto 109:9296ab0bfc11 437 Depending of ADC resolution selected (12, 10, 8 or 6 bits),
Kojto 109:9296ab0bfc11 438 this parameter must be a number between Min_Data = 0x000 and Max_Data = 0xFFF, 0x3FF, 0xFF or 0x3F respectively. */
Kojto 109:9296ab0bfc11 439 uint32_t InjectedNbrOfConversion; /*!< Specifies the number of ranks that will be converted within the injected group sequencer.
Kojto 109:9296ab0bfc11 440 To use the injected group sequencer and convert several ranks, parameter 'ScanConvMode' must be enabled.
Kojto 109:9296ab0bfc11 441 This parameter must be a number between Min_Data = 1 and Max_Data = 4.
Kojto 109:9296ab0bfc11 442 Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to
Kojto 109:9296ab0bfc11 443 configure a channel on injected group can impact the configuration of other channels previously set. */
Kojto 109:9296ab0bfc11 444 uint32_t InjectedDiscontinuousConvMode; /*!< Specifies whether the conversions sequence of injected group is performed in Complete-sequence/Discontinuous-sequence (main sequence subdivided in successive parts).
Kojto 109:9296ab0bfc11 445 Discontinuous mode is used only if sequencer is enabled (parameter 'ScanConvMode'). If sequencer is disabled, this parameter is discarded.
Kojto 109:9296ab0bfc11 446 Discontinuous mode can be enabled only if continuous mode is disabled. If continuous mode is enabled, this parameter setting is discarded.
Kojto 109:9296ab0bfc11 447 This parameter can be set to ENABLE or DISABLE.
Kojto 109:9296ab0bfc11 448 Note: For injected group, number of discontinuous ranks increment is fixed to one-by-one.
Kojto 109:9296ab0bfc11 449 Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to
Kojto 109:9296ab0bfc11 450 configure a channel on injected group can impact the configuration of other channels previously set. */
Kojto 109:9296ab0bfc11 451 uint32_t AutoInjectedConv; /*!< Enables or disables the selected ADC automatic injected group conversion after regular one
Kojto 109:9296ab0bfc11 452 This parameter can be set to ENABLE or DISABLE.
Kojto 109:9296ab0bfc11 453 Note: To use Automatic injected conversion, discontinuous mode must be disabled ('DiscontinuousConvMode' and 'InjectedDiscontinuousConvMode' set to DISABLE)
Kojto 109:9296ab0bfc11 454 Note: To use Automatic injected conversion, injected group external triggers must be disabled ('ExternalTrigInjecConv' set to ADC_SOFTWARE_START)
Kojto 109:9296ab0bfc11 455 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 109:9296ab0bfc11 456 To maintain JAUTO always enabled, DMA must be configured in circular mode.
Kojto 109:9296ab0bfc11 457 Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to
Kojto 109:9296ab0bfc11 458 configure a channel on injected group can impact the configuration of other channels previously set. */
Kojto 109:9296ab0bfc11 459 uint32_t ExternalTrigInjecConv; /*!< Selects the external event used to trigger the conversion start of injected group.
Kojto 109:9296ab0bfc11 460 If set to ADC_INJECTED_SOFTWARE_START, external triggers are disabled.
Kojto 109:9296ab0bfc11 461 If set to external trigger source, triggering is on event rising edge.
Kojto 109:9296ab0bfc11 462 This parameter can be a value of @ref ADCEx_External_trigger_source_Injected
Kojto 109:9296ab0bfc11 463 Note: This parameter must be modified when ADC is disabled (before ADC start conversion or after ADC stop conversion).
Kojto 109:9296ab0bfc11 464 If ADC is enabled, this parameter setting is bypassed without error reporting (as it can be the expected behaviour in case of another parameter update on the fly)
Kojto 109:9296ab0bfc11 465 Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to
Kojto 109:9296ab0bfc11 466 configure a channel on injected group can impact the configuration of other channels previously set. */
Kojto 109:9296ab0bfc11 467 }ADC_InjectionConfTypeDef;
Kojto 109:9296ab0bfc11 468
Kojto 109:9296ab0bfc11 469 /**
Kojto 109:9296ab0bfc11 470 * @brief ADC Configuration analog watchdog definition
Kojto 109:9296ab0bfc11 471 * @note The setting of these parameters with function is conditioned to ADC state.
Kojto 109:9296ab0bfc11 472 * ADC state can be either disabled or enabled without conversion on going on regular and injected groups.
Kojto 109:9296ab0bfc11 473 */
Kojto 109:9296ab0bfc11 474 typedef struct
Kojto 109:9296ab0bfc11 475 {
Kojto 109:9296ab0bfc11 476 uint32_t WatchdogMode; /*!< Configures the ADC analog watchdog mode: single/all channels, regular/injected group.
Kojto 109:9296ab0bfc11 477 This parameter can be a value of @ref ADCEx_analog_watchdog_mode. */
Kojto 109:9296ab0bfc11 478 uint32_t Channel; /*!< Selects which ADC channel to monitor by analog watchdog.
Kojto 109:9296ab0bfc11 479 This parameter has an effect only if watchdog mode is configured on single channel (parameter WatchdogMode)
Kojto 109:9296ab0bfc11 480 This parameter can be a value of @ref ADCEx_channels. */
Kojto 109:9296ab0bfc11 481 uint32_t ITMode; /*!< Specifies whether the analog watchdog is configured in interrupt or polling mode.
Kojto 109:9296ab0bfc11 482 This parameter can be set to ENABLE or DISABLE */
Kojto 109:9296ab0bfc11 483 uint32_t HighThreshold; /*!< Configures the ADC analog watchdog High threshold value.
Kojto 109:9296ab0bfc11 484 This parameter must be a number between Min_Data = 0x000 and Max_Data = 0xFFF. */
Kojto 109:9296ab0bfc11 485 uint32_t LowThreshold; /*!< Configures the ADC analog watchdog High threshold value.
Kojto 109:9296ab0bfc11 486 This parameter must be a number between Min_Data = 0x000 and Max_Data = 0xFFF. */
Kojto 109:9296ab0bfc11 487 uint32_t WatchdogNumber; /*!< Reserved for future use, can be set to 0 */
Kojto 109:9296ab0bfc11 488 }ADC_AnalogWDGConfTypeDef;
Kojto 109:9296ab0bfc11 489 #endif /* STM32F373xC || STM32F378xx */
Kojto 109:9296ab0bfc11 490 /**
Kojto 109:9296ab0bfc11 491 * @}
Kojto 109:9296ab0bfc11 492 */
Kojto 109:9296ab0bfc11 493
Kojto 109:9296ab0bfc11 494 /* Exported constants --------------------------------------------------------*/
Kojto 109:9296ab0bfc11 495
Kojto 109:9296ab0bfc11 496 /** @defgroup ADCEx_Exported_Constants ADC Extended Exported Constants
Kojto 109:9296ab0bfc11 497 * @{
Kojto 109:9296ab0bfc11 498 */
Kojto 109:9296ab0bfc11 499
Kojto 109:9296ab0bfc11 500 /** @defgroup ADCEx_Error_Code ADC Extended Error Code
Kojto 109:9296ab0bfc11 501 * @{
Kojto 109:9296ab0bfc11 502 */
Kojto 109:9296ab0bfc11 503 #define HAL_ADC_ERROR_NONE ((uint32_t)0x00) /*!< No error */
Kojto 109:9296ab0bfc11 504 #define HAL_ADC_ERROR_INTERNAL ((uint32_t)0x01) /*!< ADC IP internal error: if problem of clocking,
Kojto 109:9296ab0bfc11 505 enable/disable, erroneous state */
Kojto 109:9296ab0bfc11 506 #define HAL_ADC_ERROR_OVR ((uint32_t)0x02) /*!< Overrun error */
Kojto 109:9296ab0bfc11 507 #define HAL_ADC_ERROR_DMA ((uint32_t)0x04) /*!< DMA transfer error */
Kojto 109:9296ab0bfc11 508 #define HAL_ADC_ERROR_JQOVF ((uint32_t)0x08) /*!< Injected context queue overflow error */
Kojto 109:9296ab0bfc11 509 /**
Kojto 109:9296ab0bfc11 510 * @}
Kojto 109:9296ab0bfc11 511 */
Kojto 109:9296ab0bfc11 512
Kojto 109:9296ab0bfc11 513 #if defined(STM32F302xE) || defined(STM32F303xE) || defined(STM32F398xx) || \
Kojto 109:9296ab0bfc11 514 defined(STM32F302xC) || defined(STM32F303xC) || defined(STM32F358xx) || \
Kojto 109:9296ab0bfc11 515 defined(STM32F303x8) || defined(STM32F334x8) || defined(STM32F328xx) || \
Kojto 109:9296ab0bfc11 516 defined(STM32F301x8) || defined(STM32F302x8) || defined(STM32F318xx)
Kojto 109:9296ab0bfc11 517 /** @defgroup ADCEx_ClockPrescaler ADC Extended Clock Prescaler
Kojto 109:9296ab0bfc11 518 * @{
Kojto 109:9296ab0bfc11 519 */
Kojto 109:9296ab0bfc11 520 #define ADC_CLOCK_ASYNC ((uint32_t)0x00000000) /*!< ADC asynchronous clock derived from ADC dedicated PLL */
Kojto 109:9296ab0bfc11 521
Kojto 109:9296ab0bfc11 522 #if defined(STM32F302xE) || defined(STM32F303xE) || defined(STM32F398xx) || \
Kojto 109:9296ab0bfc11 523 defined(STM32F302xC) || defined(STM32F303xC) || defined(STM32F358xx) || \
Kojto 109:9296ab0bfc11 524 defined(STM32F303x8) || defined(STM32F334x8) || defined(STM32F328xx)
Kojto 109:9296ab0bfc11 525 #define ADC_CLOCK_SYNC_PCLK_DIV1 ((uint32_t)ADC12_CCR_CKMODE_0) /*!< ADC synchronous clock derived from AHB clock without prescaler */
Kojto 109:9296ab0bfc11 526 #define ADC_CLOCK_SYNC_PCLK_DIV2 ((uint32_t)ADC12_CCR_CKMODE_1) /*!< ADC synchronous clock derived from AHB clock divided by a prescaler of 2 */
Kojto 109:9296ab0bfc11 527 #define ADC_CLOCK_SYNC_PCLK_DIV4 ((uint32_t)ADC12_CCR_CKMODE) /*!< ADC synchronous clock derived from AHB clock divided by a prescaler of 4 */
Kojto 109:9296ab0bfc11 528 #endif /* STM32F302xE || STM32F303xE || STM32F398xx || */
Kojto 109:9296ab0bfc11 529 /* STM32F302xC || STM32F303xC || STM32F358xx || */
Kojto 109:9296ab0bfc11 530 /* STM32F303x8 || STM32F334x8 || STM32F328xx */
Kojto 109:9296ab0bfc11 531
Kojto 109:9296ab0bfc11 532 #if defined(STM32F301x8) || defined(STM32F302x8) || defined(STM32F318xx)
Kojto 109:9296ab0bfc11 533 #define ADC_CLOCK_SYNC_PCLK_DIV1 ((uint32_t)ADC1_CCR_CKMODE_0) /*!< ADC synchronous clock derived from AHB clock without prescaler */
Kojto 109:9296ab0bfc11 534 #define ADC_CLOCK_SYNC_PCLK_DIV2 ((uint32_t)ADC1_CCR_CKMODE_1) /*!< ADC synchronous clock derived from AHB clock divided by a prescaler of 2 */
Kojto 109:9296ab0bfc11 535 #define ADC_CLOCK_SYNC_PCLK_DIV4 ((uint32_t)ADC1_CCR_CKMODE) /*!< ADC synchronous clock derived from AHB clock divided by a prescaler of 4 */
Kojto 109:9296ab0bfc11 536 #endif /* STM32F301x8 || STM32F318xx || STM32F302x8 */
Kojto 109:9296ab0bfc11 537
Kojto 109:9296ab0bfc11 538 #define ADC_CLOCKPRESCALER_PCLK_DIV1 ADC_CLOCK_SYNC_PCLK_DIV1 /* Obsolete naming, kept for compatibility with some other devices */
Kojto 109:9296ab0bfc11 539 #define ADC_CLOCKPRESCALER_PCLK_DIV2 ADC_CLOCK_SYNC_PCLK_DIV2 /* Obsolete naming, kept for compatibility with some other devices */
Kojto 109:9296ab0bfc11 540 #define ADC_CLOCKPRESCALER_PCLK_DIV4 ADC_CLOCK_SYNC_PCLK_DIV4 /* Obsolete naming, kept for compatibility with some other devices */
Kojto 109:9296ab0bfc11 541
Kojto 109:9296ab0bfc11 542 #define IS_ADC_CLOCKPRESCALER(ADC_CLOCK) (((ADC_CLOCK) == ADC_CLOCK_ASYNC) || \
Kojto 109:9296ab0bfc11 543 ((ADC_CLOCK) == ADC_CLOCK_SYNC_PCLK_DIV1) || \
Kojto 109:9296ab0bfc11 544 ((ADC_CLOCK) == ADC_CLOCK_SYNC_PCLK_DIV2) || \
Kojto 109:9296ab0bfc11 545 ((ADC_CLOCK) == ADC_CLOCK_SYNC_PCLK_DIV4) )
Kojto 109:9296ab0bfc11 546 /**
Kojto 109:9296ab0bfc11 547 * @}
Kojto 109:9296ab0bfc11 548 */
Kojto 109:9296ab0bfc11 549
Kojto 109:9296ab0bfc11 550 /** @defgroup ADCEx_Resolution ADC Extended Resolution
Kojto 109:9296ab0bfc11 551 * @{
Kojto 109:9296ab0bfc11 552 */
Kojto 109:9296ab0bfc11 553 #define ADC_RESOLUTION12b ((uint32_t)0x00000000) /*!< ADC 12-bit resolution */
Kojto 109:9296ab0bfc11 554 #define ADC_RESOLUTION10b ((uint32_t)ADC_CFGR_RES_0) /*!< ADC 10-bit resolution */
Kojto 109:9296ab0bfc11 555 #define ADC_RESOLUTION8b ((uint32_t)ADC_CFGR_RES_1) /*!< ADC 8-bit resolution */
Kojto 109:9296ab0bfc11 556 #define ADC_RESOLUTION6b ((uint32_t)ADC_CFGR_RES) /*!< ADC 6-bit resolution */
Kojto 109:9296ab0bfc11 557
Kojto 109:9296ab0bfc11 558 #define IS_ADC_RESOLUTION(RESOLUTION) (((RESOLUTION) == ADC_RESOLUTION12b) || \
Kojto 109:9296ab0bfc11 559 ((RESOLUTION) == ADC_RESOLUTION10b) || \
Kojto 109:9296ab0bfc11 560 ((RESOLUTION) == ADC_RESOLUTION8b) || \
Kojto 109:9296ab0bfc11 561 ((RESOLUTION) == ADC_RESOLUTION6b) )
Kojto 109:9296ab0bfc11 562
Kojto 109:9296ab0bfc11 563 #define IS_ADC_RESOLUTION_8_6_BITS(RESOLUTION) (((RESOLUTION) == ADC_RESOLUTION8b) || \
Kojto 109:9296ab0bfc11 564 ((RESOLUTION) == ADC_RESOLUTION6b) )
Kojto 109:9296ab0bfc11 565 /**
Kojto 109:9296ab0bfc11 566 * @}
Kojto 109:9296ab0bfc11 567 */
Kojto 109:9296ab0bfc11 568
Kojto 109:9296ab0bfc11 569 /** @defgroup ADCEx_Data_align ADC Extended Data Alignment
Kojto 109:9296ab0bfc11 570 * @{
Kojto 109:9296ab0bfc11 571 */
Kojto 109:9296ab0bfc11 572 #define ADC_DATAALIGN_RIGHT ((uint32_t)0x00000000)
Kojto 109:9296ab0bfc11 573 #define ADC_DATAALIGN_LEFT ((uint32_t)ADC_CFGR_ALIGN)
Kojto 109:9296ab0bfc11 574
Kojto 109:9296ab0bfc11 575 #define IS_ADC_DATA_ALIGN(ALIGN) (((ALIGN) == ADC_DATAALIGN_RIGHT) || \
Kojto 109:9296ab0bfc11 576 ((ALIGN) == ADC_DATAALIGN_LEFT) )
Kojto 109:9296ab0bfc11 577 /**
Kojto 109:9296ab0bfc11 578 * @}
Kojto 109:9296ab0bfc11 579 */
Kojto 109:9296ab0bfc11 580
Kojto 109:9296ab0bfc11 581 /** @defgroup ADCEx_Scan_mode ADC Extended Scan Mode
Kojto 109:9296ab0bfc11 582 * @{
Kojto 109:9296ab0bfc11 583 */
Kojto 109:9296ab0bfc11 584 #define ADC_SCAN_DISABLE ((uint32_t)0x00000000)
Kojto 109:9296ab0bfc11 585 #define ADC_SCAN_ENABLE ((uint32_t)0x00000001)
Kojto 109:9296ab0bfc11 586
Kojto 109:9296ab0bfc11 587 #define IS_ADC_SCAN_MODE(SCAN_MODE) (((SCAN_MODE) == ADC_SCAN_DISABLE) || \
Kojto 109:9296ab0bfc11 588 ((SCAN_MODE) == ADC_SCAN_ENABLE) )
Kojto 109:9296ab0bfc11 589 /**
Kojto 109:9296ab0bfc11 590 * @}
Kojto 109:9296ab0bfc11 591 */
Kojto 109:9296ab0bfc11 592
Kojto 109:9296ab0bfc11 593 /** @defgroup ADCEx_External_trigger_edge_Regular ADC Extended External trigger enable and polarity selection for regular channels
Kojto 109:9296ab0bfc11 594 * @{
Kojto 109:9296ab0bfc11 595 */
Kojto 109:9296ab0bfc11 596 #define ADC_EXTERNALTRIGCONVEDGE_NONE ((uint32_t)0x00000000)
Kojto 109:9296ab0bfc11 597 #define ADC_EXTERNALTRIGCONVEDGE_RISING ((uint32_t)ADC_CFGR_EXTEN_0)
Kojto 109:9296ab0bfc11 598 #define ADC_EXTERNALTRIGCONVEDGE_FALLING ((uint32_t)ADC_CFGR_EXTEN_1)
Kojto 109:9296ab0bfc11 599 #define ADC_EXTERNALTRIGCONVEDGE_RISINGFALLING ((uint32_t)ADC_CFGR_EXTEN)
Kojto 109:9296ab0bfc11 600
Kojto 109:9296ab0bfc11 601 #define IS_ADC_EXTTRIG_EDGE(EDGE) (((EDGE) == ADC_EXTERNALTRIGCONVEDGE_NONE) || \
Kojto 109:9296ab0bfc11 602 ((EDGE) == ADC_EXTERNALTRIGCONVEDGE_RISING) || \
Kojto 109:9296ab0bfc11 603 ((EDGE) == ADC_EXTERNALTRIGCONVEDGE_FALLING) || \
Kojto 109:9296ab0bfc11 604 ((EDGE) == ADC_EXTERNALTRIGCONVEDGE_RISINGFALLING) )
Kojto 109:9296ab0bfc11 605 /**
Kojto 109:9296ab0bfc11 606 * @}
Kojto 109:9296ab0bfc11 607 */
Kojto 109:9296ab0bfc11 608
Kojto 109:9296ab0bfc11 609 /** @defgroup ADCEx_External_trigger_source_Regular ADC Extended External trigger selection for regular group
Kojto 109:9296ab0bfc11 610 * @{
Kojto 109:9296ab0bfc11 611 */
Kojto 109:9296ab0bfc11 612 #if defined(STM32F303xE) || defined(STM32F398xx) || \
Kojto 109:9296ab0bfc11 613 defined(STM32F303xC) || defined(STM32F358xx)
Kojto 109:9296ab0bfc11 614 /*!< List of external triggers with generic trigger name, independently of */
Kojto 109:9296ab0bfc11 615 /* ADC target (caution: applies to other ADCs sharing the same common group), */
Kojto 109:9296ab0bfc11 616 /* sorted by trigger name: */
Kojto 109:9296ab0bfc11 617
Kojto 109:9296ab0bfc11 618 /*!< External triggers of regular group for ADC1&ADC2 only */
Kojto 109:9296ab0bfc11 619 #define ADC_EXTERNALTRIGCONV_T1_CC1 ADC1_2_EXTERNALTRIG_T1_CC1
Kojto 109:9296ab0bfc11 620 #define ADC_EXTERNALTRIGCONV_T1_CC2 ADC1_2_EXTERNALTRIG_T1_CC2
Kojto 109:9296ab0bfc11 621 #define ADC_EXTERNALTRIGCONV_T2_CC2 ADC1_2_EXTERNALTRIG_T2_CC2
Kojto 109:9296ab0bfc11 622 #define ADC_EXTERNALTRIGCONV_T3_CC4 ADC1_2_EXTERNALTRIG_T3_CC4
Kojto 109:9296ab0bfc11 623 #define ADC_EXTERNALTRIGCONV_T4_CC4 ADC1_2_EXTERNALTRIG_T4_CC4
Kojto 109:9296ab0bfc11 624 #define ADC_EXTERNALTRIGCONV_T6_TRGO ADC1_2_EXTERNALTRIG_T6_TRGO
Kojto 109:9296ab0bfc11 625 #define ADC_EXTERNALTRIGCONV_EXT_IT11 ADC1_2_EXTERNALTRIG_EXT_IT11
Kojto 109:9296ab0bfc11 626
Kojto 109:9296ab0bfc11 627 /*!< External triggers of regular group for ADC3&ADC4 only */
Kojto 109:9296ab0bfc11 628 #define ADC_EXTERNALTRIGCONV_T2_CC1 ADC3_4_EXTERNALTRIG_T2_CC1
Kojto 109:9296ab0bfc11 629 #define ADC_EXTERNALTRIGCONV_T2_CC3 ADC3_4_EXTERNALTRIG_T2_CC3
Kojto 109:9296ab0bfc11 630 #define ADC_EXTERNALTRIGCONV_T3_CC1 ADC3_4_EXTERNALTRIG_T3_CC1
Kojto 109:9296ab0bfc11 631 #define ADC_EXTERNALTRIGCONV_T4_CC1 ADC3_4_EXTERNALTRIG_T4_CC1
Kojto 109:9296ab0bfc11 632 #define ADC_EXTERNALTRIGCONV_T7_TRGO ADC3_4_EXTERNALTRIG_T7_TRGO
Kojto 109:9296ab0bfc11 633 #define ADC_EXTERNALTRIGCONV_T8_CC1 ADC3_4_EXTERNALTRIG_T8_CC1
Kojto 109:9296ab0bfc11 634 #define ADC_EXTERNALTRIGCONV_EXT_IT2 ADC3_4_EXTERNALTRIG_EXT_IT2
Kojto 109:9296ab0bfc11 635
Kojto 109:9296ab0bfc11 636 /*!< External triggers of regular group for ADC1&ADC2, ADC3&ADC4 */
Kojto 109:9296ab0bfc11 637 /* Note: Triggers affected to group ADC1_2 by default, redirected to group */
Kojto 109:9296ab0bfc11 638 /* ADC3_4 by driver when needed. */
Kojto 109:9296ab0bfc11 639 #define ADC_EXTERNALTRIGCONV_T1_CC3 ADC1_2_EXTERNALTRIG_T1_CC3
Kojto 109:9296ab0bfc11 640 #define ADC_EXTERNALTRIGCONV_T1_TRGO ADC1_2_EXTERNALTRIG_T1_TRGO
Kojto 109:9296ab0bfc11 641 #define ADC_EXTERNALTRIGCONV_T1_TRGO2 ADC1_2_EXTERNALTRIG_T1_TRGO2
Kojto 109:9296ab0bfc11 642 #define ADC_EXTERNALTRIGCONV_T2_TRGO ADC1_2_EXTERNALTRIG_T2_TRGO
Kojto 109:9296ab0bfc11 643 #define ADC_EXTERNALTRIGCONV_T3_TRGO ADC1_2_EXTERNALTRIG_T3_TRGO
Kojto 109:9296ab0bfc11 644 #define ADC_EXTERNALTRIGCONV_T4_TRGO ADC1_2_EXTERNALTRIG_T4_TRGO
Kojto 109:9296ab0bfc11 645 #define ADC_EXTERNALTRIGCONV_T8_TRGO ADC1_2_EXTERNALTRIG_T8_TRGO
Kojto 109:9296ab0bfc11 646 #define ADC_EXTERNALTRIGCONV_T8_TRGO2 ADC1_2_EXTERNALTRIG_T8_TRGO2
Kojto 109:9296ab0bfc11 647 #define ADC_EXTERNALTRIGCONV_T15_TRGO ADC1_2_EXTERNALTRIG_T15_TRGO
Kojto 109:9296ab0bfc11 648
Kojto 109:9296ab0bfc11 649 #define ADC_SOFTWARE_START ((uint32_t)0x00000001)
Kojto 109:9296ab0bfc11 650
Kojto 109:9296ab0bfc11 651 #if defined(STM32F303xE) || defined(STM32F398xx)
Kojto 109:9296ab0bfc11 652 /* ADC external triggers specific to device STM303xE: mask to differentiate */
Kojto 109:9296ab0bfc11 653 /* standard triggers from specific timer 20, needed for reallocation of */
Kojto 109:9296ab0bfc11 654 /* triggers common to ADC1&2/ADC3&4 and to avoind mixing with standard */
Kojto 109:9296ab0bfc11 655 /* triggers without remap. */
Kojto 109:9296ab0bfc11 656 #define ADC_EXTERNALTRIGCONV_T20_MASK 0x1000
Kojto 109:9296ab0bfc11 657
Kojto 109:9296ab0bfc11 658 /*!< List of external triggers specific to device STM303xE: using Timer20 */
Kojto 109:9296ab0bfc11 659 /* with ADC trigger input remap. */
Kojto 109:9296ab0bfc11 660 /* To remap ADC trigger from other timers/ExtLine to timer20: use macro */
Kojto 109:9296ab0bfc11 661 /* " __HAL_REMAPADCTRIGGER_ENABLE(...) " with parameters described below: */
Kojto 109:9296ab0bfc11 662
Kojto 109:9296ab0bfc11 663 /*!< External triggers of regular group for ADC1&ADC2 only, specific to */
Kojto 109:9296ab0bfc11 664 /* device STM303xE: : using Timer20 with ADC trigger input remap */
Kojto 109:9296ab0bfc11 665 #define ADC_EXTERNALTRIGCONV_T20_CC2 ADC_EXTERNALTRIGCONV_T6_TRGO /*!< Remap trigger using macro __HAL_REMAPADCTRIGGER_ENABLE(HAL_REMAPADCTRIGGER_ADC12_EXT13) */
Kojto 109:9296ab0bfc11 666 #define ADC_EXTERNALTRIGCONV_T20_CC3 ADC_EXTERNALTRIGCONV_T3_CC4 /*!< Remap trigger using macro __HAL_REMAPADCTRIGGER_ENABLE(HAL_REMAPADCTRIGGER_ADC12_EXT15) */
Kojto 109:9296ab0bfc11 667
Kojto 109:9296ab0bfc11 668 /*!< External triggers of regular group for ADC3&ADC4 only, specific to */
Kojto 109:9296ab0bfc11 669 /* device STM303xE: : using Timer20 with ADC trigger input remap */
Kojto 109:9296ab0bfc11 670 /* None */
Kojto 109:9296ab0bfc11 671
Kojto 109:9296ab0bfc11 672 /*!< External triggers of regular group for ADC1&ADC2, ADC3&ADC4, specific to */
Kojto 109:9296ab0bfc11 673 /* device STM303xE: : using Timer20 with ADC trigger input remap */
Kojto 109:9296ab0bfc11 674 /* Note: Triggers affected to group ADC1_2 by default, redirected to group */
Kojto 109:9296ab0bfc11 675 /* ADC3_4 by driver when needed. */
Kojto 109:9296ab0bfc11 676 #define ADC_EXTERNALTRIGCONV_T20_CC1 (ADC_EXTERNALTRIGCONV_T4_CC4 | ADC_EXTERNALTRIGCONV_T20_MASK) /*!< For ADC1&ADC2: Remap trigger using macro __HAL_REMAPADCTRIGGER_ENABLE(HAL_REMAPADCTRIGGER_ADC12_EXT5) */
Kojto 109:9296ab0bfc11 677 /*!< For ADC3&ADC4: Remap trigger using macro __HAL_REMAPADCTRIGGER_ENABLE(HAL_REMAPADCTRIGGER_ADC34_EXT15) */
Kojto 109:9296ab0bfc11 678 #define ADC_EXTERNALTRIGCONV_T20_TRGO (ADC_EXTERNALTRIGCONV_T1_CC3 | ADC_EXTERNALTRIGCONV_T20_MASK) /*!< For ADC1&ADC2: Remap trigger using macro __HAL_REMAPADCTRIGGER_ENABLE(HAL_REMAPADCTRIGGER_ADC12_EXT2) */
Kojto 109:9296ab0bfc11 679 /*!< For ADC3&ADC4: Remap trigger using macro __HAL_REMAPADCTRIGGER_ENABLE(HAL_REMAPADCTRIGGER_ADC34_EXT5) */
Kojto 109:9296ab0bfc11 680 #define ADC_EXTERNALTRIGCONV_T20_TRGO2 (ADC_EXTERNALTRIGCONV_T2_CC2 | ADC_EXTERNALTRIGCONV_T20_MASK) /*!< For ADC1&ADC2: Remap trigger using macro __HAL_REMAPADCTRIGGER_ENABLE(HAL_REMAPADCTRIGGER_ADC12_EXT3) */
Kojto 109:9296ab0bfc11 681 /*!< For ADC3&ADC4: Remap trigger using macro __HAL_REMAPADCTRIGGER_ENABLE(HAL_REMAPADCTRIGGER_ADC34_EXT6) */
Kojto 109:9296ab0bfc11 682 #endif /* STM32F303xE || STM32F398xx */
Kojto 109:9296ab0bfc11 683
Kojto 109:9296ab0bfc11 684 #if defined(STM32F303xC) || defined(STM32F358xx)
Kojto 109:9296ab0bfc11 685 #define IS_ADC_EXTTRIG(REGTRIG) (((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC1) || \
Kojto 109:9296ab0bfc11 686 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC2) || \
Kojto 109:9296ab0bfc11 687 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_CC2) || \
Kojto 109:9296ab0bfc11 688 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T3_CC4) || \
Kojto 109:9296ab0bfc11 689 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T4_CC4) || \
Kojto 109:9296ab0bfc11 690 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T6_TRGO) || \
Kojto 109:9296ab0bfc11 691 ((REGTRIG) == ADC_EXTERNALTRIGCONV_EXT_IT11) || \
Kojto 109:9296ab0bfc11 692 \
Kojto 109:9296ab0bfc11 693 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_CC1) || \
Kojto 109:9296ab0bfc11 694 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_CC3) || \
Kojto 109:9296ab0bfc11 695 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T3_CC1) || \
Kojto 109:9296ab0bfc11 696 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T4_CC1) || \
Kojto 109:9296ab0bfc11 697 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T7_TRGO) || \
Kojto 109:9296ab0bfc11 698 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T8_CC1) || \
Kojto 109:9296ab0bfc11 699 ((REGTRIG) == ADC_EXTERNALTRIGCONV_EXT_IT2) || \
Kojto 109:9296ab0bfc11 700 \
Kojto 109:9296ab0bfc11 701 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC3) || \
Kojto 109:9296ab0bfc11 702 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_TRGO) || \
Kojto 109:9296ab0bfc11 703 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_TRGO2) || \
Kojto 109:9296ab0bfc11 704 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_TRGO) || \
Kojto 109:9296ab0bfc11 705 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T3_TRGO) || \
Kojto 109:9296ab0bfc11 706 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T4_TRGO) || \
Kojto 109:9296ab0bfc11 707 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T8_TRGO) || \
Kojto 109:9296ab0bfc11 708 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T8_TRGO2) || \
Kojto 109:9296ab0bfc11 709 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T15_TRGO) || \
Kojto 109:9296ab0bfc11 710 \
Kojto 109:9296ab0bfc11 711 ((REGTRIG) == ADC_SOFTWARE_START) )
Kojto 109:9296ab0bfc11 712 #endif /* STM32F303xC || STM32F358xx */
Kojto 109:9296ab0bfc11 713
Kojto 109:9296ab0bfc11 714 #if defined(STM32F303xE) || defined(STM32F398xx)
Kojto 109:9296ab0bfc11 715 #define IS_ADC_EXTTRIG(REGTRIG) (((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC1) || \
Kojto 109:9296ab0bfc11 716 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC2) || \
Kojto 109:9296ab0bfc11 717 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_CC2) || \
Kojto 109:9296ab0bfc11 718 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T3_CC4) || \
Kojto 109:9296ab0bfc11 719 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T4_CC4) || \
Kojto 109:9296ab0bfc11 720 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T6_TRGO) || \
Kojto 109:9296ab0bfc11 721 ((REGTRIG) == ADC_EXTERNALTRIGCONV_EXT_IT11) || \
Kojto 109:9296ab0bfc11 722 \
Kojto 109:9296ab0bfc11 723 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_CC1) || \
Kojto 109:9296ab0bfc11 724 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_CC3) || \
Kojto 109:9296ab0bfc11 725 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T3_CC1) || \
Kojto 109:9296ab0bfc11 726 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T4_CC1) || \
Kojto 109:9296ab0bfc11 727 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T7_TRGO) || \
Kojto 109:9296ab0bfc11 728 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T8_CC1) || \
Kojto 109:9296ab0bfc11 729 ((REGTRIG) == ADC_EXTERNALTRIGCONV_EXT_IT2) || \
Kojto 109:9296ab0bfc11 730 \
Kojto 109:9296ab0bfc11 731 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC3) || \
Kojto 109:9296ab0bfc11 732 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_TRGO) || \
Kojto 109:9296ab0bfc11 733 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_TRGO2) || \
Kojto 109:9296ab0bfc11 734 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_TRGO) || \
Kojto 109:9296ab0bfc11 735 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T3_TRGO) || \
Kojto 109:9296ab0bfc11 736 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T4_TRGO) || \
Kojto 109:9296ab0bfc11 737 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T8_TRGO) || \
Kojto 109:9296ab0bfc11 738 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T8_TRGO2) || \
Kojto 109:9296ab0bfc11 739 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T15_TRGO) || \
Kojto 109:9296ab0bfc11 740 \
Kojto 109:9296ab0bfc11 741 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T20_CC2) || \
Kojto 109:9296ab0bfc11 742 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T20_CC3) || \
Kojto 109:9296ab0bfc11 743 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T20_CC1) || \
Kojto 109:9296ab0bfc11 744 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T20_TRGO) || \
Kojto 109:9296ab0bfc11 745 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T20_TRGO2) || \
Kojto 109:9296ab0bfc11 746 \
Kojto 109:9296ab0bfc11 747 ((REGTRIG) == ADC_SOFTWARE_START) )
Kojto 109:9296ab0bfc11 748 #endif /* STM32F303xE || STM32F398xx */
Kojto 109:9296ab0bfc11 749
Kojto 109:9296ab0bfc11 750 #endif /* STM32F303xE || STM32F398xx || */
Kojto 109:9296ab0bfc11 751 /* STM32F303xC || STM32F358xx */
Kojto 109:9296ab0bfc11 752
Kojto 109:9296ab0bfc11 753 #if defined(STM32F302xE) || \
Kojto 109:9296ab0bfc11 754 defined(STM32F302xC)
Kojto 109:9296ab0bfc11 755 /*!< List of external triggers with generic trigger name, independently of */
Kojto 109:9296ab0bfc11 756 /* ADC target (caution: applies to other ADCs sharing the same common group), */
Kojto 109:9296ab0bfc11 757 /* sorted by trigger name: */
Kojto 109:9296ab0bfc11 758
Kojto 109:9296ab0bfc11 759 /*!< External triggers of regular group for ADC1&ADC2 */
Kojto 109:9296ab0bfc11 760 #define ADC_EXTERNALTRIGCONV_T1_CC1 ADC1_2_EXTERNALTRIG_T1_CC1
Kojto 109:9296ab0bfc11 761 #define ADC_EXTERNALTRIGCONV_T1_CC2 ADC1_2_EXTERNALTRIG_T1_CC2
Kojto 109:9296ab0bfc11 762 #define ADC_EXTERNALTRIGCONV_T1_CC3 ADC1_2_EXTERNALTRIG_T1_CC3
Kojto 109:9296ab0bfc11 763 #define ADC_EXTERNALTRIGCONV_T1_TRGO ADC1_2_EXTERNALTRIG_T1_TRGO
Kojto 109:9296ab0bfc11 764 #define ADC_EXTERNALTRIGCONV_T1_TRGO2 ADC1_2_EXTERNALTRIG_T1_TRGO2
Kojto 109:9296ab0bfc11 765 #define ADC_EXTERNALTRIGCONV_T2_CC2 ADC1_2_EXTERNALTRIG_T2_CC2
Kojto 109:9296ab0bfc11 766 #define ADC_EXTERNALTRIGCONV_T2_TRGO ADC1_2_EXTERNALTRIG_T2_TRGO
Kojto 109:9296ab0bfc11 767 #define ADC_EXTERNALTRIGCONV_T3_CC4 ADC1_2_EXTERNALTRIG_T3_CC4
Kojto 109:9296ab0bfc11 768 #define ADC_EXTERNALTRIGCONV_T3_TRGO ADC1_2_EXTERNALTRIG_T3_TRGO
Kojto 109:9296ab0bfc11 769 #define ADC_EXTERNALTRIGCONV_T4_CC4 ADC1_2_EXTERNALTRIG_T4_CC4
Kojto 109:9296ab0bfc11 770 #define ADC_EXTERNALTRIGCONV_T4_TRGO ADC1_2_EXTERNALTRIG_T4_TRGO
Kojto 109:9296ab0bfc11 771 #define ADC_EXTERNALTRIGCONV_T6_TRGO ADC1_2_EXTERNALTRIG_T6_TRGO
Kojto 109:9296ab0bfc11 772 #define ADC_EXTERNALTRIGCONV_T15_TRGO ADC1_2_EXTERNALTRIG_T15_TRGO
Kojto 109:9296ab0bfc11 773 #define ADC_EXTERNALTRIGCONV_EXT_IT11 ADC1_2_EXTERNALTRIG_EXT_IT11
Kojto 109:9296ab0bfc11 774 #define ADC_SOFTWARE_START ((uint32_t)0x00000001)
Kojto 109:9296ab0bfc11 775
Kojto 109:9296ab0bfc11 776 #if defined(STM32F302xE)
Kojto 109:9296ab0bfc11 777 /* ADC external triggers specific to device STM302xE: mask to differentiate */
Kojto 109:9296ab0bfc11 778 /* standard triggers from specific timer 20, needed for reallocation of */
Kojto 109:9296ab0bfc11 779 /* triggers common to ADC1&2 and to avoind mixing with standard */
Kojto 109:9296ab0bfc11 780 /* triggers without remap. */
Kojto 109:9296ab0bfc11 781 #define ADC_EXTERNALTRIGCONV_T20_MASK 0x1000
Kojto 109:9296ab0bfc11 782
Kojto 109:9296ab0bfc11 783 /*!< List of external triggers specific to device STM302xE: using Timer20 */
Kojto 109:9296ab0bfc11 784 /* with ADC trigger input remap. */
Kojto 109:9296ab0bfc11 785 /* To remap ADC trigger from other timers/ExtLine to timer20: use macro */
Kojto 109:9296ab0bfc11 786 /* " __HAL_REMAPADCTRIGGER_ENABLE(...) " with parameters described below: */
Kojto 109:9296ab0bfc11 787
Kojto 109:9296ab0bfc11 788 /*!< External triggers of regular group for ADC1&ADC2 only, specific to */
Kojto 109:9296ab0bfc11 789 /* device STM302xE: : using Timer20 with ADC trigger input remap */
Kojto 109:9296ab0bfc11 790 #define ADC_EXTERNALTRIGCONV_T20_CC2 ADC_EXTERNALTRIGCONV_T6_TRGO /*!< Remap trigger using macro __HAL_REMAPADCTRIGGER_ENABLE(HAL_REMAPADCTRIGGER_ADC12_EXT13) */
Kojto 109:9296ab0bfc11 791 #define ADC_EXTERNALTRIGCONV_T20_CC3 ADC_EXTERNALTRIGCONV_T3_CC4 /*!< Remap trigger using macro __HAL_REMAPADCTRIGGER_ENABLE(HAL_REMAPADCTRIGGER_ADC12_EXT15) */
Kojto 109:9296ab0bfc11 792 #endif /* STM32F302xE */
Kojto 109:9296ab0bfc11 793
Kojto 109:9296ab0bfc11 794 #if defined(STM32F302xE)
Kojto 109:9296ab0bfc11 795 #define IS_ADC_EXTTRIG(REGTRIG) (((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC1) || \
Kojto 109:9296ab0bfc11 796 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC2) || \
Kojto 109:9296ab0bfc11 797 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC3) || \
Kojto 109:9296ab0bfc11 798 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_CC2) || \
Kojto 109:9296ab0bfc11 799 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T3_TRGO) || \
Kojto 109:9296ab0bfc11 800 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T4_CC4) || \
Kojto 109:9296ab0bfc11 801 ((REGTRIG) == ADC_EXTERNALTRIGCONV_EXT_IT11) || \
Kojto 109:9296ab0bfc11 802 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_TRGO) || \
Kojto 109:9296ab0bfc11 803 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_TRGO2) || \
Kojto 109:9296ab0bfc11 804 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_TRGO) || \
Kojto 109:9296ab0bfc11 805 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T4_TRGO) || \
Kojto 109:9296ab0bfc11 806 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T6_TRGO) || \
Kojto 109:9296ab0bfc11 807 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T15_TRGO) || \
Kojto 109:9296ab0bfc11 808 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T3_CC4) || \
Kojto 109:9296ab0bfc11 809 \
Kojto 109:9296ab0bfc11 810 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T20_CC2) || \
Kojto 109:9296ab0bfc11 811 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T20_CC3) || \
Kojto 109:9296ab0bfc11 812 \
Kojto 109:9296ab0bfc11 813 ((REGTRIG) == ADC_SOFTWARE_START) )
Kojto 109:9296ab0bfc11 814 #endif /* STM32F302xE */
Kojto 109:9296ab0bfc11 815
Kojto 109:9296ab0bfc11 816 #if defined(STM32F302xC)
Kojto 109:9296ab0bfc11 817 #define IS_ADC_EXTTRIG(REGTRIG) (((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC1) || \
Kojto 109:9296ab0bfc11 818 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC2) || \
Kojto 109:9296ab0bfc11 819 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC3) || \
Kojto 109:9296ab0bfc11 820 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_CC2) || \
Kojto 109:9296ab0bfc11 821 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T3_TRGO) || \
Kojto 109:9296ab0bfc11 822 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T4_CC4) || \
Kojto 109:9296ab0bfc11 823 ((REGTRIG) == ADC_EXTERNALTRIGCONV_EXT_IT11) || \
Kojto 109:9296ab0bfc11 824 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_TRGO) || \
Kojto 109:9296ab0bfc11 825 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_TRGO2) || \
Kojto 109:9296ab0bfc11 826 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_TRGO) || \
Kojto 109:9296ab0bfc11 827 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T4_TRGO) || \
Kojto 109:9296ab0bfc11 828 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T6_TRGO) || \
Kojto 109:9296ab0bfc11 829 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T15_TRGO) || \
Kojto 109:9296ab0bfc11 830 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T3_CC4) || \
Kojto 109:9296ab0bfc11 831 \
Kojto 109:9296ab0bfc11 832 ((REGTRIG) == ADC_SOFTWARE_START) )
Kojto 109:9296ab0bfc11 833 #endif /* STM32F302xC */
Kojto 109:9296ab0bfc11 834
Kojto 109:9296ab0bfc11 835 #endif /* STM32F302xE || */
Kojto 109:9296ab0bfc11 836 /* STM32F302xC */
Kojto 109:9296ab0bfc11 837
Kojto 109:9296ab0bfc11 838 #if defined(STM32F303x8) || defined(STM32F328xx)
Kojto 109:9296ab0bfc11 839 /*!< List of external triggers with generic trigger name, independently of */
Kojto 109:9296ab0bfc11 840 /* ADC target (caution: applies to other ADCs sharing the same common group), */
Kojto 109:9296ab0bfc11 841 /* sorted by trigger name: */
Kojto 109:9296ab0bfc11 842
Kojto 109:9296ab0bfc11 843 /*!< External triggers of regular group for ADC1&ADC2 */
Kojto 109:9296ab0bfc11 844 #define ADC_EXTERNALTRIGCONV_T1_CC1 ADC1_2_EXTERNALTRIG_T1_CC1
Kojto 109:9296ab0bfc11 845 #define ADC_EXTERNALTRIGCONV_T1_CC2 ADC1_2_EXTERNALTRIG_T1_CC2
Kojto 109:9296ab0bfc11 846 #define ADC_EXTERNALTRIGCONV_T1_CC3 ADC1_2_EXTERNALTRIG_T1_CC3
Kojto 109:9296ab0bfc11 847 #define ADC_EXTERNALTRIGCONV_T1_TRGO ADC1_2_EXTERNALTRIG_T1_TRGO
Kojto 109:9296ab0bfc11 848 #define ADC_EXTERNALTRIGCONV_T1_TRGO2 ADC1_2_EXTERNALTRIG_T1_TRGO2
Kojto 109:9296ab0bfc11 849 #define ADC_EXTERNALTRIGCONV_T2_CC2 ADC1_2_EXTERNALTRIG_T2_CC2
Kojto 109:9296ab0bfc11 850 #define ADC_EXTERNALTRIGCONV_T2_TRGO ADC1_2_EXTERNALTRIG_T2_TRGO
Kojto 109:9296ab0bfc11 851 #define ADC_EXTERNALTRIGCONV_T3_CC4 ADC1_2_EXTERNALTRIG_T3_CC4
Kojto 109:9296ab0bfc11 852 #define ADC_EXTERNALTRIGCONV_T3_TRGO ADC1_2_EXTERNALTRIG_T3_TRGO
Kojto 109:9296ab0bfc11 853 #define ADC_EXTERNALTRIGCONV_T4_CC4 ADC1_2_EXTERNALTRIG_T4_CC4
Kojto 109:9296ab0bfc11 854 #define ADC_EXTERNALTRIGCONV_T4_TRGO ADC1_2_EXTERNALTRIG_T4_TRGO
Kojto 109:9296ab0bfc11 855 #define ADC_EXTERNALTRIGCONV_T8_TRGO ADC1_2_EXTERNALTRIG_T8_TRGO
Kojto 109:9296ab0bfc11 856 #define ADC_EXTERNALTRIGCONV_T8_TRGO2 ADC1_2_EXTERNALTRIG_T8_TRGO2
Kojto 109:9296ab0bfc11 857 #define ADC_EXTERNALTRIGCONV_T6_TRGO ADC1_2_EXTERNALTRIG_T6_TRGO
Kojto 109:9296ab0bfc11 858 #define ADC_EXTERNALTRIGCONV_T15_TRGO ADC1_2_EXTERNALTRIG_T15_TRGO
Kojto 109:9296ab0bfc11 859 #define ADC_EXTERNALTRIGCONV_EXT_IT11 ADC1_2_EXTERNALTRIG_EXT_IT11
Kojto 109:9296ab0bfc11 860 #define ADC_SOFTWARE_START ((uint32_t)0x00000001)
Kojto 109:9296ab0bfc11 861
Kojto 109:9296ab0bfc11 862 #define IS_ADC_EXTTRIG(REGTRIG) (((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC1) || \
Kojto 109:9296ab0bfc11 863 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC2) || \
Kojto 109:9296ab0bfc11 864 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC3) || \
Kojto 109:9296ab0bfc11 865 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_CC2) || \
Kojto 109:9296ab0bfc11 866 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T3_TRGO) || \
Kojto 109:9296ab0bfc11 867 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T4_CC4) || \
Kojto 109:9296ab0bfc11 868 ((REGTRIG) == ADC_EXTERNALTRIGCONV_EXT_IT11) || \
Kojto 109:9296ab0bfc11 869 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T8_TRGO) || \
Kojto 109:9296ab0bfc11 870 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T8_TRGO2) || \
Kojto 109:9296ab0bfc11 871 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_TRGO) || \
Kojto 109:9296ab0bfc11 872 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_TRGO2) || \
Kojto 109:9296ab0bfc11 873 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_TRGO) || \
Kojto 109:9296ab0bfc11 874 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T4_TRGO) || \
Kojto 109:9296ab0bfc11 875 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T6_TRGO) || \
Kojto 109:9296ab0bfc11 876 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T15_TRGO) || \
Kojto 109:9296ab0bfc11 877 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T3_CC4) || \
Kojto 109:9296ab0bfc11 878 \
Kojto 109:9296ab0bfc11 879 ((REGTRIG) == ADC_SOFTWARE_START) )
Kojto 109:9296ab0bfc11 880 #endif /* STM32F303x8 || STM32F328xx */
Kojto 109:9296ab0bfc11 881
Kojto 109:9296ab0bfc11 882 #if defined(STM32F334x8)
Kojto 109:9296ab0bfc11 883 /*!< List of external triggers with generic trigger name, independently of */
Kojto 109:9296ab0bfc11 884 /* ADC target (caution: applies to other ADCs sharing the same common group), */
Kojto 109:9296ab0bfc11 885 /* sorted by trigger name: */
Kojto 109:9296ab0bfc11 886
Kojto 109:9296ab0bfc11 887 /*!< External triggers of regular group for ADC1&ADC2 */
Kojto 109:9296ab0bfc11 888 #define ADC_EXTERNALTRIGCONV_T1_CC1 ADC1_2_EXTERNALTRIG_T1_CC1
Kojto 109:9296ab0bfc11 889 #define ADC_EXTERNALTRIGCONV_T1_CC2 ADC1_2_EXTERNALTRIG_T1_CC2
Kojto 109:9296ab0bfc11 890 #define ADC_EXTERNALTRIGCONV_T1_CC3 ADC1_2_EXTERNALTRIG_T1_CC3
Kojto 109:9296ab0bfc11 891 #define ADC_EXTERNALTRIGCONV_T1_TRGO ADC1_2_EXTERNALTRIG_T1_TRGO
Kojto 109:9296ab0bfc11 892 #define ADC_EXTERNALTRIGCONV_T1_TRGO2 ADC1_2_EXTERNALTRIG_T1_TRGO2
Kojto 109:9296ab0bfc11 893 #define ADC_EXTERNALTRIGCONV_T2_CC2 ADC1_2_EXTERNALTRIG_T2_CC2
Kojto 109:9296ab0bfc11 894 #define ADC_EXTERNALTRIGCONV_T2_TRGO ADC1_2_EXTERNALTRIG_T2_TRGO
Kojto 109:9296ab0bfc11 895 #define ADC_EXTERNALTRIGCONV_T3_CC4 ADC1_2_EXTERNALTRIG_T3_CC4
Kojto 109:9296ab0bfc11 896 #define ADC_EXTERNALTRIGCONV_T3_TRGO ADC1_2_EXTERNALTRIG_T3_TRGO
Kojto 109:9296ab0bfc11 897 #define ADC_EXTERNALTRIGCONV_T6_TRGO ADC1_2_EXTERNALTRIG_T6_TRGO
Kojto 109:9296ab0bfc11 898 #define ADC_EXTERNALTRIGCONV_T15_TRGO ADC1_2_EXTERNALTRIG_T15_TRGO
Kojto 109:9296ab0bfc11 899 #define ADC_EXTERNALTRIGCONVHRTIM_TRG1 ADC1_2_EXTERNALTRIG_HRTIM_TRG1
Kojto 109:9296ab0bfc11 900 #define ADC_EXTERNALTRIGCONVHRTIM_TRG3 ADC1_2_EXTERNALTRIG_HRTIM_TRG3
Kojto 109:9296ab0bfc11 901 #define ADC_EXTERNALTRIGCONV_EXT_IT11 ADC1_2_EXTERNALTRIG_EXT_IT11
Kojto 109:9296ab0bfc11 902 #define ADC_SOFTWARE_START ((uint32_t)0x00000001)
Kojto 109:9296ab0bfc11 903
Kojto 109:9296ab0bfc11 904 #define IS_ADC_EXTTRIG(REGTRIG) (((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC1) || \
Kojto 109:9296ab0bfc11 905 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC2) || \
Kojto 109:9296ab0bfc11 906 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC3) || \
Kojto 109:9296ab0bfc11 907 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_CC2) || \
Kojto 109:9296ab0bfc11 908 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T3_TRGO) || \
Kojto 109:9296ab0bfc11 909 ((REGTRIG) == ADC_EXTERNALTRIGCONV_EXT_IT11) || \
Kojto 109:9296ab0bfc11 910 ((REGTRIG) == ADC_EXTERNALTRIGCONVHRTIM_TRG1) || \
Kojto 109:9296ab0bfc11 911 ((REGTRIG) == ADC_EXTERNALTRIGCONVHRTIM_TRG3) || \
Kojto 109:9296ab0bfc11 912 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_TRGO) || \
Kojto 109:9296ab0bfc11 913 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_TRGO2) || \
Kojto 109:9296ab0bfc11 914 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_TRGO) || \
Kojto 109:9296ab0bfc11 915 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T6_TRGO) || \
Kojto 109:9296ab0bfc11 916 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T15_TRGO) || \
Kojto 109:9296ab0bfc11 917 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T3_CC4) || \
Kojto 109:9296ab0bfc11 918 \
Kojto 109:9296ab0bfc11 919 ((REGTRIG) == ADC_SOFTWARE_START) )
Kojto 109:9296ab0bfc11 920 #endif /* STM32F334x8 */
Kojto 109:9296ab0bfc11 921
Kojto 109:9296ab0bfc11 922 #if defined(STM32F301x8) || defined(STM32F302x8) || defined(STM32F318xx)
Kojto 109:9296ab0bfc11 923 /* List of external triggers with generic trigger name, sorted by trigger */
Kojto 109:9296ab0bfc11 924 /* name: */
Kojto 109:9296ab0bfc11 925
Kojto 109:9296ab0bfc11 926 /* External triggers of regular group for ADC1 */
Kojto 109:9296ab0bfc11 927 #define ADC_EXTERNALTRIGCONV_T1_CC1 ADC1_EXTERNALTRIG_T1_CC1
Kojto 109:9296ab0bfc11 928 #define ADC_EXTERNALTRIGCONV_T1_CC2 ADC1_EXTERNALTRIG_T1_CC2
Kojto 109:9296ab0bfc11 929 #define ADC_EXTERNALTRIGCONV_T1_CC3 ADC1_EXTERNALTRIG_T1_CC3
Kojto 109:9296ab0bfc11 930 #define ADC_EXTERNALTRIGCONV_EXT_IT11 ADC1_EXTERNALTRIG_EXT_IT11
Kojto 109:9296ab0bfc11 931 #define ADC_EXTERNALTRIGCONV_T1_TRGO ADC1_EXTERNALTRIG_T1_TRGO
Kojto 109:9296ab0bfc11 932 #define ADC_EXTERNALTRIGCONV_T1_TRGO2 ADC1_EXTERNALTRIG_T1_TRGO2
Kojto 109:9296ab0bfc11 933 #define ADC_EXTERNALTRIGCONV_T2_TRGO ADC1_EXTERNALTRIG_T2_TRGO
Kojto 109:9296ab0bfc11 934 #define ADC_EXTERNALTRIGCONV_T6_TRGO ADC1_EXTERNALTRIG_T6_TRGO
Kojto 109:9296ab0bfc11 935 #define ADC_EXTERNALTRIGCONV_T15_TRGO ADC1_EXTERNALTRIG_T15_TRGO
Kojto 109:9296ab0bfc11 936 #define ADC_SOFTWARE_START ((uint32_t)0x00000001)
Kojto 109:9296ab0bfc11 937
Kojto 109:9296ab0bfc11 938 #define IS_ADC_EXTTRIG(REGTRIG) (((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC1) || \
Kojto 109:9296ab0bfc11 939 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC2) || \
Kojto 109:9296ab0bfc11 940 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC3) || \
Kojto 109:9296ab0bfc11 941 ((REGTRIG) == ADC_EXTERNALTRIGCONV_EXT_IT11) || \
Kojto 109:9296ab0bfc11 942 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_TRGO) || \
Kojto 109:9296ab0bfc11 943 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_TRGO2) || \
Kojto 109:9296ab0bfc11 944 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_TRGO) || \
Kojto 109:9296ab0bfc11 945 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T6_TRGO) || \
Kojto 109:9296ab0bfc11 946 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T15_TRGO) || \
Kojto 109:9296ab0bfc11 947 ((REGTRIG) == ADC_SOFTWARE_START) )
Kojto 109:9296ab0bfc11 948 #endif /* STM32F301x8 || STM32F302x8 || STM32F318xx */
Kojto 109:9296ab0bfc11 949 /**
Kojto 109:9296ab0bfc11 950 * @}
Kojto 109:9296ab0bfc11 951 */
Kojto 109:9296ab0bfc11 952
Kojto 109:9296ab0bfc11 953 /** @defgroup ADCEx_Internal_HAL_driver_Ext_trig_src_Regular ADC Extended External trigger selection for regular group (Used Internally)
Kojto 109:9296ab0bfc11 954 * @{
Kojto 109:9296ab0bfc11 955 */
Kojto 109:9296ab0bfc11 956 #if defined(STM32F303xE) || defined(STM32F398xx) || \
Kojto 109:9296ab0bfc11 957 defined(STM32F303xC) || defined(STM32F358xx)
Kojto 109:9296ab0bfc11 958 /* List of external triggers for common groups ADC1&ADC2 and/or ADC3&ADC4: */
Kojto 109:9296ab0bfc11 959 /* (used internally by HAL driver. To not use into HAL structure parameters) */
Kojto 109:9296ab0bfc11 960
Kojto 109:9296ab0bfc11 961 /* External triggers of regular group for ADC1 & ADC2 */
Kojto 109:9296ab0bfc11 962 #define ADC1_2_EXTERNALTRIG_T1_CC1 ((uint32_t)0x00000000)
Kojto 109:9296ab0bfc11 963 #define ADC1_2_EXTERNALTRIG_T1_CC2 ((uint32_t)ADC_CFGR_EXTSEL_0)
Kojto 109:9296ab0bfc11 964 #define ADC1_2_EXTERNALTRIG_T1_CC3 ((uint32_t)ADC_CFGR_EXTSEL_1)
Kojto 109:9296ab0bfc11 965 #define ADC1_2_EXTERNALTRIG_T2_CC2 ((uint32_t)(ADC_CFGR_EXTSEL_1 | ADC_CFGR_EXTSEL_0))
Kojto 109:9296ab0bfc11 966 #define ADC1_2_EXTERNALTRIG_T3_TRGO ((uint32_t)ADC_CFGR_EXTSEL_2)
Kojto 109:9296ab0bfc11 967 #define ADC1_2_EXTERNALTRIG_T4_CC4 ((uint32_t)(ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_0))
Kojto 109:9296ab0bfc11 968 #define ADC1_2_EXTERNALTRIG_EXT_IT11 ((uint32_t)(ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_1))
Kojto 109:9296ab0bfc11 969 #define ADC1_2_EXTERNALTRIG_T8_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_1 | ADC_CFGR_EXTSEL_0))
Kojto 109:9296ab0bfc11 970 #define ADC1_2_EXTERNALTRIG_T8_TRGO2 ((uint32_t) ADC_CFGR_EXTSEL_3)
Kojto 109:9296ab0bfc11 971 #define ADC1_2_EXTERNALTRIG_T1_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_0))
Kojto 109:9296ab0bfc11 972 #define ADC1_2_EXTERNALTRIG_T1_TRGO2 ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_1))
Kojto 109:9296ab0bfc11 973 #define ADC1_2_EXTERNALTRIG_T2_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_1 | ADC_CFGR_EXTSEL_0))
Kojto 109:9296ab0bfc11 974 #define ADC1_2_EXTERNALTRIG_T4_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_2))
Kojto 109:9296ab0bfc11 975 #define ADC1_2_EXTERNALTRIG_T6_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_0))
Kojto 109:9296ab0bfc11 976 #define ADC1_2_EXTERNALTRIG_T15_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_1))
Kojto 109:9296ab0bfc11 977 #define ADC1_2_EXTERNALTRIG_T3_CC4 ((uint32_t)ADC_CFGR_EXTSEL)
Kojto 109:9296ab0bfc11 978
Kojto 109:9296ab0bfc11 979 /* External triggers of regular group for ADC3 & ADC4 */
Kojto 109:9296ab0bfc11 980 #define ADC3_4_EXTERNALTRIG_T3_CC1 ((uint32_t)0x00000000)
Kojto 109:9296ab0bfc11 981 #define ADC3_4_EXTERNALTRIG_T2_CC3 ((uint32_t)ADC_CFGR_EXTSEL_0)
Kojto 109:9296ab0bfc11 982 #define ADC3_4_EXTERNALTRIG_T1_CC3 ((uint32_t)ADC_CFGR_EXTSEL_1)
Kojto 109:9296ab0bfc11 983 #define ADC3_4_EXTERNALTRIG_T8_CC1 ((uint32_t)(ADC_CFGR_EXTSEL_1 | ADC_CFGR_EXTSEL_0))
Kojto 109:9296ab0bfc11 984 #define ADC3_4_EXTERNALTRIG_T8_TRGO ((uint32_t)ADC_CFGR_EXTSEL_2)
Kojto 109:9296ab0bfc11 985 #define ADC3_4_EXTERNALTRIG_EXT_IT2 ((uint32_t)(ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_0))
Kojto 109:9296ab0bfc11 986 #define ADC3_4_EXTERNALTRIG_T4_CC1 ((uint32_t)(ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_1))
Kojto 109:9296ab0bfc11 987 #define ADC3_4_EXTERNALTRIG_T2_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_1 | ADC_CFGR_EXTSEL_0))
Kojto 109:9296ab0bfc11 988 #define ADC3_4_EXTERNALTRIG_T8_TRGO2 ((uint32_t)ADC_CFGR_EXTSEL_3)
Kojto 109:9296ab0bfc11 989 #define ADC3_4_EXTERNALTRIG_T1_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_0))
Kojto 109:9296ab0bfc11 990 #define ADC3_4_EXTERNALTRIG_T1_TRGO2 ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_1))
Kojto 109:9296ab0bfc11 991 #define ADC3_4_EXTERNALTRIG_T3_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_1 | ADC_CFGR_EXTSEL_0))
Kojto 109:9296ab0bfc11 992 #define ADC3_4_EXTERNALTRIG_T4_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_2))
Kojto 109:9296ab0bfc11 993 #define ADC3_4_EXTERNALTRIG_T7_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_0))
Kojto 109:9296ab0bfc11 994 #define ADC3_4_EXTERNALTRIG_T15_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_1))
Kojto 109:9296ab0bfc11 995 #define ADC3_4_EXTERNALTRIG_T2_CC1 ((uint32_t)ADC_CFGR_EXTSEL)
Kojto 109:9296ab0bfc11 996 #endif /* STM32F303xE || STM32F398xx || */
Kojto 109:9296ab0bfc11 997 /* STM32F303xC || STM32F358xx */
Kojto 109:9296ab0bfc11 998
Kojto 109:9296ab0bfc11 999 #if defined(STM32F302xE) || \
Kojto 109:9296ab0bfc11 1000 defined(STM32F302xC)
Kojto 109:9296ab0bfc11 1001 /* List of external triggers of common group ADC1&ADC2: */
Kojto 109:9296ab0bfc11 1002 /* (used internally by HAL driver. To not use into HAL structure parameters) */
Kojto 109:9296ab0bfc11 1003 #define ADC1_2_EXTERNALTRIG_T1_CC1 ((uint32_t)0x00000000)
Kojto 109:9296ab0bfc11 1004 #define ADC1_2_EXTERNALTRIG_T1_CC2 ((uint32_t)ADC_CFGR_EXTSEL_0)
Kojto 109:9296ab0bfc11 1005 #define ADC1_2_EXTERNALTRIG_T1_CC3 ((uint32_t)ADC_CFGR_EXTSEL_1)
Kojto 109:9296ab0bfc11 1006 #define ADC1_2_EXTERNALTRIG_T1_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_0))
Kojto 109:9296ab0bfc11 1007 #define ADC1_2_EXTERNALTRIG_T1_TRGO2 ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_1))
Kojto 109:9296ab0bfc11 1008 #define ADC1_2_EXTERNALTRIG_T2_CC2 ((uint32_t)(ADC_CFGR_EXTSEL_1 | ADC_CFGR_EXTSEL_0))
Kojto 109:9296ab0bfc11 1009 #define ADC1_2_EXTERNALTRIG_T2_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_1 | ADC_CFGR_EXTSEL_0))
Kojto 109:9296ab0bfc11 1010 #define ADC1_2_EXTERNALTRIG_T3_CC4 ((uint32_t)ADC_CFGR_EXTSEL)
Kojto 109:9296ab0bfc11 1011 #define ADC1_2_EXTERNALTRIG_T3_TRGO ((uint32_t)ADC_CFGR_EXTSEL_2)
Kojto 109:9296ab0bfc11 1012 #define ADC1_2_EXTERNALTRIG_T4_CC4 ((uint32_t)(ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_0))
Kojto 109:9296ab0bfc11 1013 #define ADC1_2_EXTERNALTRIG_T4_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_2))
Kojto 109:9296ab0bfc11 1014 #define ADC1_2_EXTERNALTRIG_T6_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_0))
Kojto 109:9296ab0bfc11 1015 #define ADC1_2_EXTERNALTRIG_T15_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_1))
Kojto 109:9296ab0bfc11 1016 #define ADC1_2_EXTERNALTRIG_EXT_IT11 ((uint32_t)(ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_1))
Kojto 109:9296ab0bfc11 1017 #endif /* STM32F302xE || */
Kojto 109:9296ab0bfc11 1018 /* STM32F302xC */
Kojto 109:9296ab0bfc11 1019
Kojto 109:9296ab0bfc11 1020 #if defined(STM32F303x8) || defined(STM32F328xx)
Kojto 109:9296ab0bfc11 1021 /* List of external triggers of common group ADC1&ADC2: */
Kojto 109:9296ab0bfc11 1022 /* (used internally by HAL driver. To not use into HAL structure parameters) */
Kojto 109:9296ab0bfc11 1023 #define ADC1_2_EXTERNALTRIG_T1_CC1 ((uint32_t)0x00000000)
Kojto 109:9296ab0bfc11 1024 #define ADC1_2_EXTERNALTRIG_T1_CC2 ((uint32_t)ADC_CFGR_EXTSEL_0)
Kojto 109:9296ab0bfc11 1025 #define ADC1_2_EXTERNALTRIG_T1_CC3 ((uint32_t)ADC_CFGR_EXTSEL_1)
Kojto 109:9296ab0bfc11 1026 #define ADC1_2_EXTERNALTRIG_T2_CC2 ((uint32_t)(ADC_CFGR_EXTSEL_1 | ADC_CFGR_EXTSEL_0))
Kojto 109:9296ab0bfc11 1027 #define ADC1_2_EXTERNALTRIG_T3_TRGO ((uint32_t)ADC_CFGR_EXTSEL_2)
Kojto 109:9296ab0bfc11 1028 #define ADC1_2_EXTERNALTRIG_T4_CC4 ((uint32_t)(ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_0))
Kojto 109:9296ab0bfc11 1029 #define ADC1_2_EXTERNALTRIG_EXT_IT11 ((uint32_t)(ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_1))
Kojto 109:9296ab0bfc11 1030 #define ADC1_2_EXTERNALTRIG_T8_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_1 | ADC_CFGR_EXTSEL_0))
Kojto 109:9296ab0bfc11 1031 #define ADC1_2_EXTERNALTRIG_T8_TRGO2 ((uint32_t) ADC_CFGR_EXTSEL_3)
Kojto 109:9296ab0bfc11 1032 #define ADC1_2_EXTERNALTRIG_T1_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_0))
Kojto 109:9296ab0bfc11 1033 #define ADC1_2_EXTERNALTRIG_T1_TRGO2 ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_1))
Kojto 109:9296ab0bfc11 1034 #define ADC1_2_EXTERNALTRIG_T2_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_1 | ADC_CFGR_EXTSEL_0))
Kojto 109:9296ab0bfc11 1035 #define ADC1_2_EXTERNALTRIG_T4_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_2))
Kojto 109:9296ab0bfc11 1036 #define ADC1_2_EXTERNALTRIG_T6_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_0))
Kojto 109:9296ab0bfc11 1037 #define ADC1_2_EXTERNALTRIG_T15_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_1))
Kojto 109:9296ab0bfc11 1038 #define ADC1_2_EXTERNALTRIG_T3_CC4 ((uint32_t)ADC_CFGR_EXTSEL)
Kojto 109:9296ab0bfc11 1039 #endif /* STM32F303x8 || STM32F328xx */
Kojto 109:9296ab0bfc11 1040
Kojto 109:9296ab0bfc11 1041 #if defined(STM32F334x8)
Kojto 109:9296ab0bfc11 1042 /* List of external triggers of common group ADC1&ADC2: */
Kojto 109:9296ab0bfc11 1043 /* (used internally by HAL driver. To not use into HAL structure parameters) */
Kojto 109:9296ab0bfc11 1044 #define ADC1_2_EXTERNALTRIG_T1_CC1 ((uint32_t)0x00000000)
Kojto 109:9296ab0bfc11 1045 #define ADC1_2_EXTERNALTRIG_T1_CC2 ((uint32_t)ADC_CFGR_EXTSEL_0)
Kojto 109:9296ab0bfc11 1046 #define ADC1_2_EXTERNALTRIG_T1_CC3 ((uint32_t)ADC_CFGR_EXTSEL_1)
Kojto 109:9296ab0bfc11 1047 #define ADC1_2_EXTERNALTRIG_T2_CC2 ((uint32_t)(ADC_CFGR_EXTSEL_1 | ADC_CFGR_EXTSEL_0))
Kojto 109:9296ab0bfc11 1048 #define ADC1_2_EXTERNALTRIG_T3_TRGO ((uint32_t)ADC_CFGR_EXTSEL_2)
Kojto 109:9296ab0bfc11 1049 #define ADC1_2_EXTERNALTRIG_EXT_IT11 ((uint32_t)(ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_1))
Kojto 109:9296ab0bfc11 1050 #define ADC1_2_EXTERNALTRIG_HRTIM_TRG1 ((uint32_t)(ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_1 | ADC_CFGR_EXTSEL_0))
Kojto 109:9296ab0bfc11 1051 #define ADC1_2_EXTERNALTRIG_HRTIM_TRG3 ((uint32_t) ADC_CFGR_EXTSEL_3)
Kojto 109:9296ab0bfc11 1052 #define ADC1_2_EXTERNALTRIG_T1_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_0))
Kojto 109:9296ab0bfc11 1053 #define ADC1_2_EXTERNALTRIG_T1_TRGO2 ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_1))
Kojto 109:9296ab0bfc11 1054 #define ADC1_2_EXTERNALTRIG_T2_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_1 | ADC_CFGR_EXTSEL_0))
Kojto 109:9296ab0bfc11 1055 #define ADC1_2_EXTERNALTRIG_T6_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_0))
Kojto 109:9296ab0bfc11 1056 #define ADC1_2_EXTERNALTRIG_T15_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_1))
Kojto 109:9296ab0bfc11 1057 #define ADC1_2_EXTERNALTRIG_T3_CC4 ((uint32_t)ADC_CFGR_EXTSEL)
Kojto 109:9296ab0bfc11 1058 #endif /* STM32F334x8 */
Kojto 109:9296ab0bfc11 1059
Kojto 109:9296ab0bfc11 1060 #if defined(STM32F301x8) || defined(STM32F302x8) || defined(STM32F318xx)
Kojto 109:9296ab0bfc11 1061 /* List of external triggers of regular group for ADC1: */
Kojto 109:9296ab0bfc11 1062 /* (used internally by HAL driver. To not use into HAL structure parameters) */
Kojto 109:9296ab0bfc11 1063 #define ADC1_EXTERNALTRIG_T1_CC1 ((uint32_t)0x00000000)
Kojto 109:9296ab0bfc11 1064 #define ADC1_EXTERNALTRIG_T1_CC2 ((uint32_t)ADC_CFGR_EXTSEL_0)
Kojto 109:9296ab0bfc11 1065 #define ADC1_EXTERNALTRIG_T1_CC3 ((uint32_t)ADC_CFGR_EXTSEL_1)
Kojto 109:9296ab0bfc11 1066 #define ADC1_EXTERNALTRIG_EXT_IT11 ((uint32_t)(ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_1))
Kojto 109:9296ab0bfc11 1067 #define ADC1_EXTERNALTRIG_T1_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_0))
Kojto 109:9296ab0bfc11 1068 #define ADC1_EXTERNALTRIG_T1_TRGO2 ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_1))
Kojto 109:9296ab0bfc11 1069 #define ADC1_EXTERNALTRIG_T2_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_1 | ADC_CFGR_EXTSEL_0))
Kojto 109:9296ab0bfc11 1070 #define ADC1_EXTERNALTRIG_T6_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_0))
Kojto 109:9296ab0bfc11 1071 #define ADC1_EXTERNALTRIG_T15_TRGO ((uint32_t)(ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_1))
Kojto 109:9296ab0bfc11 1072 #define ADC_SOFTWARE_START ((uint32_t)0x00000001)
Kojto 109:9296ab0bfc11 1073 #endif /* STM32F301x8 || STM32F302x8 || STM32F318xx */
Kojto 109:9296ab0bfc11 1074 /**
Kojto 109:9296ab0bfc11 1075 * @}
Kojto 109:9296ab0bfc11 1076 */
Kojto 109:9296ab0bfc11 1077
Kojto 109:9296ab0bfc11 1078
Kojto 109:9296ab0bfc11 1079 /** @defgroup ADCEx_EOCSelection ADC Extended End of Regular Sequence/Conversion
Kojto 109:9296ab0bfc11 1080 * @{
Kojto 109:9296ab0bfc11 1081 */
Kojto 109:9296ab0bfc11 1082 #define EOC_SINGLE_CONV ((uint32_t) ADC_ISR_EOC)
Kojto 109:9296ab0bfc11 1083 #define EOC_SEQ_CONV ((uint32_t) ADC_ISR_EOS)
Kojto 109:9296ab0bfc11 1084 #define EOC_SINGLE_SEQ_CONV ((uint32_t)(ADC_ISR_EOC | ADC_ISR_EOS)) /*!< reserved for future use */
Kojto 109:9296ab0bfc11 1085
Kojto 109:9296ab0bfc11 1086 #define IS_ADC_EOC_SELECTION(EOC_SELECTION) (((EOC_SELECTION) == EOC_SINGLE_CONV) || \
Kojto 109:9296ab0bfc11 1087 ((EOC_SELECTION) == EOC_SEQ_CONV) || \
Kojto 109:9296ab0bfc11 1088 ((EOC_SELECTION) == EOC_SINGLE_SEQ_CONV) )
Kojto 109:9296ab0bfc11 1089 /**
Kojto 109:9296ab0bfc11 1090 * @}
Kojto 109:9296ab0bfc11 1091 */
Kojto 109:9296ab0bfc11 1092
Kojto 109:9296ab0bfc11 1093 /** @defgroup ADCEx_Overrun ADC Extended overrun
Kojto 109:9296ab0bfc11 1094 * @{
Kojto 109:9296ab0bfc11 1095 */
Kojto 109:9296ab0bfc11 1096 #define OVR_DATA_OVERWRITTEN ((uint32_t)0x00000000) /*!< Default setting, to be used for compatibility with other STM32 devices */
Kojto 109:9296ab0bfc11 1097 #define OVR_DATA_PRESERVED ((uint32_t)0x00000001)
Kojto 109:9296ab0bfc11 1098
Kojto 109:9296ab0bfc11 1099 #define IS_ADC_OVERRUN(OVR) (((OVR) == OVR_DATA_PRESERVED) || \
Kojto 109:9296ab0bfc11 1100 ((OVR) == OVR_DATA_OVERWRITTEN) )
Kojto 109:9296ab0bfc11 1101 /**
Kojto 109:9296ab0bfc11 1102 * @}
Kojto 109:9296ab0bfc11 1103 */
Kojto 109:9296ab0bfc11 1104
Kojto 109:9296ab0bfc11 1105 /** @defgroup ADCEx_channels ADC Extended Channels
Kojto 109:9296ab0bfc11 1106 * @{
Kojto 109:9296ab0bfc11 1107 */
Kojto 109:9296ab0bfc11 1108 /* Note: Depending on devices, some channels may not be available on package */
Kojto 109:9296ab0bfc11 1109 /* pins. Refer to device datasheet for channels availability. */
Kojto 109:9296ab0bfc11 1110 #define ADC_CHANNEL_1 ((uint32_t)(ADC_SQR3_SQ10_0))
Kojto 109:9296ab0bfc11 1111 #define ADC_CHANNEL_2 ((uint32_t)(ADC_SQR3_SQ10_1))
Kojto 109:9296ab0bfc11 1112 #define ADC_CHANNEL_3 ((uint32_t)(ADC_SQR3_SQ10_1 | ADC_SQR3_SQ10_0))
Kojto 109:9296ab0bfc11 1113 #define ADC_CHANNEL_4 ((uint32_t)(ADC_SQR3_SQ10_2))
Kojto 109:9296ab0bfc11 1114 #define ADC_CHANNEL_5 ((uint32_t)(ADC_SQR3_SQ10_2 | ADC_SQR3_SQ10_0))
Kojto 109:9296ab0bfc11 1115 #define ADC_CHANNEL_6 ((uint32_t)(ADC_SQR3_SQ10_2 | ADC_SQR3_SQ10_1))
Kojto 109:9296ab0bfc11 1116 #define ADC_CHANNEL_7 ((uint32_t)(ADC_SQR3_SQ10_2 | ADC_SQR3_SQ10_1 | ADC_SQR3_SQ10_0))
Kojto 109:9296ab0bfc11 1117 #define ADC_CHANNEL_8 ((uint32_t)(ADC_SQR3_SQ10_3))
Kojto 109:9296ab0bfc11 1118 #define ADC_CHANNEL_9 ((uint32_t)(ADC_SQR3_SQ10_3 | ADC_SQR3_SQ10_0))
Kojto 109:9296ab0bfc11 1119 #define ADC_CHANNEL_10 ((uint32_t)(ADC_SQR3_SQ10_3 | ADC_SQR3_SQ10_1))
Kojto 109:9296ab0bfc11 1120 #define ADC_CHANNEL_11 ((uint32_t)(ADC_SQR3_SQ10_3 | ADC_SQR3_SQ10_1 | ADC_SQR3_SQ10_0))
Kojto 109:9296ab0bfc11 1121 #define ADC_CHANNEL_12 ((uint32_t)(ADC_SQR3_SQ10_3 | ADC_SQR3_SQ10_2))
Kojto 109:9296ab0bfc11 1122 #define ADC_CHANNEL_13 ((uint32_t)(ADC_SQR3_SQ10_3 | ADC_SQR3_SQ10_2 | ADC_SQR3_SQ10_0))
Kojto 109:9296ab0bfc11 1123 #define ADC_CHANNEL_14 ((uint32_t)(ADC_SQR3_SQ10_3 | ADC_SQR3_SQ10_2 | ADC_SQR3_SQ10_1))
Kojto 109:9296ab0bfc11 1124 #define ADC_CHANNEL_15 ((uint32_t)(ADC_SQR3_SQ10_3 | ADC_SQR3_SQ10_2 | ADC_SQR3_SQ10_1 | ADC_SQR3_SQ10_0))
Kojto 109:9296ab0bfc11 1125 #define ADC_CHANNEL_16 ((uint32_t)(ADC_SQR3_SQ10_4))
Kojto 109:9296ab0bfc11 1126 #define ADC_CHANNEL_17 ((uint32_t)(ADC_SQR3_SQ10_4 | ADC_SQR3_SQ10_0))
Kojto 109:9296ab0bfc11 1127 #define ADC_CHANNEL_18 ((uint32_t)(ADC_SQR3_SQ10_4 | ADC_SQR3_SQ10_1))
Kojto 109:9296ab0bfc11 1128
Kojto 109:9296ab0bfc11 1129 /* Note: Vopamp1, TempSensor and Vbat internal channels available on ADC1 only */
Kojto 109:9296ab0bfc11 1130 #define ADC_CHANNEL_VOPAMP1 ADC_CHANNEL_15
Kojto 109:9296ab0bfc11 1131 #define ADC_CHANNEL_TEMPSENSOR ADC_CHANNEL_16
Kojto 109:9296ab0bfc11 1132 #define ADC_CHANNEL_VBAT ADC_CHANNEL_17
Kojto 109:9296ab0bfc11 1133
Kojto 109:9296ab0bfc11 1134 /* Note: Vopamp2/3/4 internal channels available on ADC2/3/4 respectively */
Kojto 109:9296ab0bfc11 1135 #define ADC_CHANNEL_VOPAMP2 ADC_CHANNEL_17
Kojto 109:9296ab0bfc11 1136 #define ADC_CHANNEL_VOPAMP3 ADC_CHANNEL_17
Kojto 109:9296ab0bfc11 1137 #define ADC_CHANNEL_VOPAMP4 ADC_CHANNEL_17
Kojto 109:9296ab0bfc11 1138
Kojto 109:9296ab0bfc11 1139 /* Note: VrefInt internal channels available on all ADCs, but only */
Kojto 109:9296ab0bfc11 1140 /* one ADC is allowed to be connected to VrefInt at the same time. */
Kojto 109:9296ab0bfc11 1141 #define ADC_CHANNEL_VREFINT ((uint32_t)ADC_CHANNEL_18)
Kojto 109:9296ab0bfc11 1142
Kojto 109:9296ab0bfc11 1143 #define IS_ADC_CHANNEL(CHANNEL) (((CHANNEL) == ADC_CHANNEL_1) || \
Kojto 109:9296ab0bfc11 1144 ((CHANNEL) == ADC_CHANNEL_2) || \
Kojto 109:9296ab0bfc11 1145 ((CHANNEL) == ADC_CHANNEL_3) || \
Kojto 109:9296ab0bfc11 1146 ((CHANNEL) == ADC_CHANNEL_4) || \
Kojto 109:9296ab0bfc11 1147 ((CHANNEL) == ADC_CHANNEL_5) || \
Kojto 109:9296ab0bfc11 1148 ((CHANNEL) == ADC_CHANNEL_6) || \
Kojto 109:9296ab0bfc11 1149 ((CHANNEL) == ADC_CHANNEL_7) || \
Kojto 109:9296ab0bfc11 1150 ((CHANNEL) == ADC_CHANNEL_8) || \
Kojto 109:9296ab0bfc11 1151 ((CHANNEL) == ADC_CHANNEL_9) || \
Kojto 109:9296ab0bfc11 1152 ((CHANNEL) == ADC_CHANNEL_10) || \
Kojto 109:9296ab0bfc11 1153 ((CHANNEL) == ADC_CHANNEL_11) || \
Kojto 109:9296ab0bfc11 1154 ((CHANNEL) == ADC_CHANNEL_12) || \
Kojto 109:9296ab0bfc11 1155 ((CHANNEL) == ADC_CHANNEL_13) || \
Kojto 109:9296ab0bfc11 1156 ((CHANNEL) == ADC_CHANNEL_14) || \
Kojto 109:9296ab0bfc11 1157 ((CHANNEL) == ADC_CHANNEL_15) || \
Kojto 109:9296ab0bfc11 1158 ((CHANNEL) == ADC_CHANNEL_TEMPSENSOR) || \
Kojto 109:9296ab0bfc11 1159 ((CHANNEL) == ADC_CHANNEL_VBAT) || \
Kojto 109:9296ab0bfc11 1160 ((CHANNEL) == ADC_CHANNEL_VREFINT) || \
Kojto 109:9296ab0bfc11 1161 ((CHANNEL) == ADC_CHANNEL_VOPAMP1) || \
Kojto 109:9296ab0bfc11 1162 ((CHANNEL) == ADC_CHANNEL_VOPAMP2) || \
Kojto 109:9296ab0bfc11 1163 ((CHANNEL) == ADC_CHANNEL_VOPAMP3) || \
Kojto 109:9296ab0bfc11 1164 ((CHANNEL) == ADC_CHANNEL_VOPAMP4) )
Kojto 109:9296ab0bfc11 1165
Kojto 109:9296ab0bfc11 1166 #define IS_ADC_DIFF_CHANNEL(CHANNEL) (((CHANNEL) == ADC_CHANNEL_1) || \
Kojto 109:9296ab0bfc11 1167 ((CHANNEL) == ADC_CHANNEL_2) || \
Kojto 109:9296ab0bfc11 1168 ((CHANNEL) == ADC_CHANNEL_3) || \
Kojto 109:9296ab0bfc11 1169 ((CHANNEL) == ADC_CHANNEL_4) || \
Kojto 109:9296ab0bfc11 1170 ((CHANNEL) == ADC_CHANNEL_5) || \
Kojto 109:9296ab0bfc11 1171 ((CHANNEL) == ADC_CHANNEL_6) || \
Kojto 109:9296ab0bfc11 1172 ((CHANNEL) == ADC_CHANNEL_7) || \
Kojto 109:9296ab0bfc11 1173 ((CHANNEL) == ADC_CHANNEL_8) || \
Kojto 109:9296ab0bfc11 1174 ((CHANNEL) == ADC_CHANNEL_9) || \
Kojto 109:9296ab0bfc11 1175 ((CHANNEL) == ADC_CHANNEL_10) || \
Kojto 109:9296ab0bfc11 1176 ((CHANNEL) == ADC_CHANNEL_11) || \
Kojto 109:9296ab0bfc11 1177 ((CHANNEL) == ADC_CHANNEL_12) || \
Kojto 109:9296ab0bfc11 1178 ((CHANNEL) == ADC_CHANNEL_13) || \
Kojto 109:9296ab0bfc11 1179 ((CHANNEL) == ADC_CHANNEL_14) )
Kojto 109:9296ab0bfc11 1180
Kojto 109:9296ab0bfc11 1181 /**
Kojto 109:9296ab0bfc11 1182 * @}
Kojto 109:9296ab0bfc11 1183 */
Kojto 109:9296ab0bfc11 1184
Kojto 109:9296ab0bfc11 1185 /** @defgroup ADCEx_sampling_times ADC Extended Sampling Times
Kojto 109:9296ab0bfc11 1186 * @{
Kojto 109:9296ab0bfc11 1187 */
Kojto 109:9296ab0bfc11 1188 #define ADC_SAMPLETIME_1CYCLE_5 ((uint32_t)0x00000000) /*!< Sampling time 1.5 ADC clock cycle */
Kojto 109:9296ab0bfc11 1189 #define ADC_SAMPLETIME_2CYCLES_5 ((uint32_t)ADC_SMPR2_SMP10_0) /*!< Sampling time 2.5 ADC clock cycles */
Kojto 109:9296ab0bfc11 1190 #define ADC_SAMPLETIME_4CYCLES_5 ((uint32_t)ADC_SMPR2_SMP10_1) /*!< Sampling time 4.5 ADC clock cycles */
Kojto 109:9296ab0bfc11 1191 #define ADC_SAMPLETIME_7CYCLES_5 ((uint32_t)(ADC_SMPR2_SMP10_1 | ADC_SMPR2_SMP10_0)) /*!< Sampling time 7.5 ADC clock cycles */
Kojto 109:9296ab0bfc11 1192 #define ADC_SAMPLETIME_19CYCLES_5 ((uint32_t)ADC_SMPR2_SMP10_2) /*!< Sampling time 19.5 ADC clock cycles */
Kojto 109:9296ab0bfc11 1193 #define ADC_SAMPLETIME_61CYCLES_5 ((uint32_t)(ADC_SMPR2_SMP10_2 | ADC_SMPR2_SMP10_0)) /*!< Sampling time 61.5 ADC clock cycles */
Kojto 109:9296ab0bfc11 1194 #define ADC_SAMPLETIME_181CYCLES_5 ((uint32_t)(ADC_SMPR2_SMP10_2 | ADC_SMPR2_SMP10_1)) /*!< Sampling time 181.5 ADC clock cycles */
Kojto 109:9296ab0bfc11 1195 #define ADC_SAMPLETIME_601CYCLES_5 ((uint32_t)ADC_SMPR2_SMP10) /*!< Sampling time 601.5 ADC clock cycles */
Kojto 109:9296ab0bfc11 1196
Kojto 109:9296ab0bfc11 1197 #define IS_ADC_SAMPLE_TIME(TIME) (((TIME) == ADC_SAMPLETIME_1CYCLE_5) || \
Kojto 109:9296ab0bfc11 1198 ((TIME) == ADC_SAMPLETIME_2CYCLES_5) || \
Kojto 109:9296ab0bfc11 1199 ((TIME) == ADC_SAMPLETIME_4CYCLES_5) || \
Kojto 109:9296ab0bfc11 1200 ((TIME) == ADC_SAMPLETIME_7CYCLES_5) || \
Kojto 109:9296ab0bfc11 1201 ((TIME) == ADC_SAMPLETIME_19CYCLES_5) || \
Kojto 109:9296ab0bfc11 1202 ((TIME) == ADC_SAMPLETIME_61CYCLES_5) || \
Kojto 109:9296ab0bfc11 1203 ((TIME) == ADC_SAMPLETIME_181CYCLES_5) || \
Kojto 109:9296ab0bfc11 1204 ((TIME) == ADC_SAMPLETIME_601CYCLES_5) )
Kojto 109:9296ab0bfc11 1205 /**
Kojto 109:9296ab0bfc11 1206 * @}
Kojto 109:9296ab0bfc11 1207 */
Kojto 109:9296ab0bfc11 1208
Kojto 109:9296ab0bfc11 1209 /** @defgroup ADCEx_SingleDifferential ADC Extended Single-ended/Differential input mode
Kojto 109:9296ab0bfc11 1210 * @{
Kojto 109:9296ab0bfc11 1211 */
Kojto 109:9296ab0bfc11 1212 #define ADC_SINGLE_ENDED ((uint32_t)0x00000000)
Kojto 109:9296ab0bfc11 1213 #define ADC_DIFFERENTIAL_ENDED ((uint32_t)0x00000001)
Kojto 109:9296ab0bfc11 1214
Kojto 109:9296ab0bfc11 1215 #define IS_ADC_SINGLE_DIFFERENTIAL(SING_DIFF) (((SING_DIFF) == ADC_SINGLE_ENDED) || \
Kojto 109:9296ab0bfc11 1216 ((SING_DIFF) == ADC_DIFFERENTIAL_ENDED) )
Kojto 109:9296ab0bfc11 1217 /**
Kojto 109:9296ab0bfc11 1218 * @}
Kojto 109:9296ab0bfc11 1219 */
Kojto 109:9296ab0bfc11 1220
Kojto 109:9296ab0bfc11 1221 /** @defgroup ADCEx_OffsetNumber ADC Extended Offset Number
Kojto 109:9296ab0bfc11 1222 * @{
Kojto 109:9296ab0bfc11 1223 */
Kojto 109:9296ab0bfc11 1224 #define ADC_OFFSET_NONE ((uint32_t)0x00)
Kojto 109:9296ab0bfc11 1225 #define ADC_OFFSET_1 ((uint32_t)0x01)
Kojto 109:9296ab0bfc11 1226 #define ADC_OFFSET_2 ((uint32_t)0x02)
Kojto 109:9296ab0bfc11 1227 #define ADC_OFFSET_3 ((uint32_t)0x03)
Kojto 109:9296ab0bfc11 1228 #define ADC_OFFSET_4 ((uint32_t)0x04)
Kojto 109:9296ab0bfc11 1229
Kojto 109:9296ab0bfc11 1230 #define IS_ADC_OFFSET_NUMBER(OFFSET_NUMBER) (((OFFSET_NUMBER) == ADC_OFFSET_NONE) || \
Kojto 109:9296ab0bfc11 1231 ((OFFSET_NUMBER) == ADC_OFFSET_1) || \
Kojto 109:9296ab0bfc11 1232 ((OFFSET_NUMBER) == ADC_OFFSET_2) || \
Kojto 109:9296ab0bfc11 1233 ((OFFSET_NUMBER) == ADC_OFFSET_3) || \
Kojto 109:9296ab0bfc11 1234 ((OFFSET_NUMBER) == ADC_OFFSET_4) )
Kojto 109:9296ab0bfc11 1235 /**
Kojto 109:9296ab0bfc11 1236 * @}
Kojto 109:9296ab0bfc11 1237 */
Kojto 109:9296ab0bfc11 1238
Kojto 109:9296ab0bfc11 1239 /** @defgroup ADCEx_regular_rank ADC Extended Regular Channel Rank
Kojto 109:9296ab0bfc11 1240 * @{
Kojto 109:9296ab0bfc11 1241 */
Kojto 109:9296ab0bfc11 1242 #define ADC_REGULAR_RANK_1 ((uint32_t)0x00000001)
Kojto 109:9296ab0bfc11 1243 #define ADC_REGULAR_RANK_2 ((uint32_t)0x00000002)
Kojto 109:9296ab0bfc11 1244 #define ADC_REGULAR_RANK_3 ((uint32_t)0x00000003)
Kojto 109:9296ab0bfc11 1245 #define ADC_REGULAR_RANK_4 ((uint32_t)0x00000004)
Kojto 109:9296ab0bfc11 1246 #define ADC_REGULAR_RANK_5 ((uint32_t)0x00000005)
Kojto 109:9296ab0bfc11 1247 #define ADC_REGULAR_RANK_6 ((uint32_t)0x00000006)
Kojto 109:9296ab0bfc11 1248 #define ADC_REGULAR_RANK_7 ((uint32_t)0x00000007)
Kojto 109:9296ab0bfc11 1249 #define ADC_REGULAR_RANK_8 ((uint32_t)0x00000008)
Kojto 109:9296ab0bfc11 1250 #define ADC_REGULAR_RANK_9 ((uint32_t)0x00000009)
Kojto 109:9296ab0bfc11 1251 #define ADC_REGULAR_RANK_10 ((uint32_t)0x0000000A)
Kojto 109:9296ab0bfc11 1252 #define ADC_REGULAR_RANK_11 ((uint32_t)0x0000000B)
Kojto 109:9296ab0bfc11 1253 #define ADC_REGULAR_RANK_12 ((uint32_t)0x0000000C)
Kojto 109:9296ab0bfc11 1254 #define ADC_REGULAR_RANK_13 ((uint32_t)0x0000000D)
Kojto 109:9296ab0bfc11 1255 #define ADC_REGULAR_RANK_14 ((uint32_t)0x0000000E)
Kojto 109:9296ab0bfc11 1256 #define ADC_REGULAR_RANK_15 ((uint32_t)0x0000000F)
Kojto 109:9296ab0bfc11 1257 #define ADC_REGULAR_RANK_16 ((uint32_t)0x00000010)
Kojto 109:9296ab0bfc11 1258
Kojto 109:9296ab0bfc11 1259 #define IS_ADC_REGULAR_RANK(CHANNEL) (((CHANNEL) == ADC_REGULAR_RANK_1 ) || \
Kojto 109:9296ab0bfc11 1260 ((CHANNEL) == ADC_REGULAR_RANK_2 ) || \
Kojto 109:9296ab0bfc11 1261 ((CHANNEL) == ADC_REGULAR_RANK_3 ) || \
Kojto 109:9296ab0bfc11 1262 ((CHANNEL) == ADC_REGULAR_RANK_4 ) || \
Kojto 109:9296ab0bfc11 1263 ((CHANNEL) == ADC_REGULAR_RANK_5 ) || \
Kojto 109:9296ab0bfc11 1264 ((CHANNEL) == ADC_REGULAR_RANK_6 ) || \
Kojto 109:9296ab0bfc11 1265 ((CHANNEL) == ADC_REGULAR_RANK_7 ) || \
Kojto 109:9296ab0bfc11 1266 ((CHANNEL) == ADC_REGULAR_RANK_8 ) || \
Kojto 109:9296ab0bfc11 1267 ((CHANNEL) == ADC_REGULAR_RANK_9 ) || \
Kojto 109:9296ab0bfc11 1268 ((CHANNEL) == ADC_REGULAR_RANK_10) || \
Kojto 109:9296ab0bfc11 1269 ((CHANNEL) == ADC_REGULAR_RANK_11) || \
Kojto 109:9296ab0bfc11 1270 ((CHANNEL) == ADC_REGULAR_RANK_12) || \
Kojto 109:9296ab0bfc11 1271 ((CHANNEL) == ADC_REGULAR_RANK_13) || \
Kojto 109:9296ab0bfc11 1272 ((CHANNEL) == ADC_REGULAR_RANK_14) || \
Kojto 109:9296ab0bfc11 1273 ((CHANNEL) == ADC_REGULAR_RANK_15) || \
Kojto 109:9296ab0bfc11 1274 ((CHANNEL) == ADC_REGULAR_RANK_16) )
Kojto 109:9296ab0bfc11 1275 /**
Kojto 109:9296ab0bfc11 1276 * @}
Kojto 109:9296ab0bfc11 1277 */
Kojto 109:9296ab0bfc11 1278
Kojto 109:9296ab0bfc11 1279 /** @defgroup ADCEx_injected_rank ADC Extended Injected Channel Rank
Kojto 109:9296ab0bfc11 1280 * @{
Kojto 109:9296ab0bfc11 1281 */
Kojto 109:9296ab0bfc11 1282 #define ADC_INJECTED_RANK_1 ((uint32_t)0x00000001)
Kojto 109:9296ab0bfc11 1283 #define ADC_INJECTED_RANK_2 ((uint32_t)0x00000002)
Kojto 109:9296ab0bfc11 1284 #define ADC_INJECTED_RANK_3 ((uint32_t)0x00000003)
Kojto 109:9296ab0bfc11 1285 #define ADC_INJECTED_RANK_4 ((uint32_t)0x00000004)
Kojto 109:9296ab0bfc11 1286
Kojto 109:9296ab0bfc11 1287 #define IS_ADC_INJECTED_RANK(CHANNEL) (((CHANNEL) == ADC_INJECTED_RANK_1) || \
Kojto 109:9296ab0bfc11 1288 ((CHANNEL) == ADC_INJECTED_RANK_2) || \
Kojto 109:9296ab0bfc11 1289 ((CHANNEL) == ADC_INJECTED_RANK_3) || \
Kojto 109:9296ab0bfc11 1290 ((CHANNEL) == ADC_INJECTED_RANK_4) )
Kojto 109:9296ab0bfc11 1291 /**
Kojto 109:9296ab0bfc11 1292 * @}
Kojto 109:9296ab0bfc11 1293 */
Kojto 109:9296ab0bfc11 1294
Kojto 109:9296ab0bfc11 1295 /** @defgroup ADCEx_External_trigger_edge_Injected External Trigger Edge of Injected Group
Kojto 109:9296ab0bfc11 1296 * @{
Kojto 109:9296ab0bfc11 1297 */
Kojto 109:9296ab0bfc11 1298 #define ADC_EXTERNALTRIGINJECCONV_EDGE_NONE ((uint32_t)0x00000000)
Kojto 109:9296ab0bfc11 1299 #define ADC_EXTERNALTRIGINJECCONV_EDGE_RISING ((uint32_t)ADC_JSQR_JEXTEN_0)
Kojto 109:9296ab0bfc11 1300 #define ADC_EXTERNALTRIGINJECCONV_EDGE_FALLING ((uint32_t)ADC_JSQR_JEXTEN_1)
Kojto 109:9296ab0bfc11 1301 #define ADC_EXTERNALTRIGINJECCONV_EDGE_RISINGFALLING ((uint32_t)ADC_JSQR_JEXTEN)
Kojto 109:9296ab0bfc11 1302
Kojto 109:9296ab0bfc11 1303 #define IS_ADC_EXTTRIGINJEC_EDGE(EDGE) (((EDGE) == ADC_EXTERNALTRIGINJECCONV_EDGE_NONE) || \
Kojto 109:9296ab0bfc11 1304 ((EDGE) == ADC_EXTERNALTRIGINJECCONV_EDGE_RISING) || \
Kojto 109:9296ab0bfc11 1305 ((EDGE) == ADC_EXTERNALTRIGINJECCONV_EDGE_FALLING) || \
Kojto 109:9296ab0bfc11 1306 ((EDGE) == ADC_EXTERNALTRIGINJECCONV_EDGE_RISINGFALLING) )
Kojto 109:9296ab0bfc11 1307 /**
Kojto 109:9296ab0bfc11 1308 * @}
Kojto 109:9296ab0bfc11 1309 */
Kojto 109:9296ab0bfc11 1310
Kojto 109:9296ab0bfc11 1311 /** @defgroup ADCEx_External_trigger_source_Injected External Trigger Source of Injected Group
Kojto 109:9296ab0bfc11 1312 * @{
Kojto 109:9296ab0bfc11 1313 */
Kojto 109:9296ab0bfc11 1314 #if defined(STM32F303xE) || defined(STM32F398xx) || \
Kojto 109:9296ab0bfc11 1315 defined(STM32F303xC) || defined(STM32F358xx)
Kojto 109:9296ab0bfc11 1316 /* List of external triggers with generic trigger name, independently of ADC */
Kojto 109:9296ab0bfc11 1317 /* target (caution: applies to other ADCs sharing the same common group), */
Kojto 109:9296ab0bfc11 1318 /* sorted by trigger name: */
Kojto 109:9296ab0bfc11 1319
Kojto 109:9296ab0bfc11 1320 /* External triggers of injected group for ADC1&ADC2 only */
Kojto 109:9296ab0bfc11 1321 #define ADC_EXTERNALTRIGINJECCONV_T2_CC1 ADC1_2_EXTERNALTRIGINJEC_T2_CC1
Kojto 109:9296ab0bfc11 1322 #define ADC_EXTERNALTRIGINJECCONV_T3_CC1 ADC1_2_EXTERNALTRIGINJEC_T3_CC1
Kojto 109:9296ab0bfc11 1323 #define ADC_EXTERNALTRIGINJECCONV_T3_CC3 ADC1_2_EXTERNALTRIGINJEC_T3_CC3
Kojto 109:9296ab0bfc11 1324 #define ADC_EXTERNALTRIGINJECCONV_T3_CC4 ADC1_2_EXTERNALTRIGINJEC_T3_CC4
Kojto 109:9296ab0bfc11 1325 #define ADC_EXTERNALTRIGINJECCONV_T6_TRGO ADC1_2_EXTERNALTRIGINJEC_T6_TRGO
Kojto 109:9296ab0bfc11 1326 #define ADC_EXTERNALTRIGINJECCONV_EXT_IT15 ADC1_2_EXTERNALTRIGINJEC_EXT_IT15
Kojto 109:9296ab0bfc11 1327
Kojto 109:9296ab0bfc11 1328 /* External triggers of injected group for ADC3&ADC4 only */
Kojto 109:9296ab0bfc11 1329 #define ADC_EXTERNALTRIGINJECCONV_T1_CC3 ADC3_4_EXTERNALTRIGINJEC_T1_CC3
Kojto 109:9296ab0bfc11 1330 #define ADC_EXTERNALTRIGINJECCONV_T4_CC3 ADC3_4_EXTERNALTRIGINJEC_T4_CC3
Kojto 109:9296ab0bfc11 1331 #define ADC_EXTERNALTRIGINJECCONV_T4_CC4 ADC3_4_EXTERNALTRIGINJEC_T4_CC4
Kojto 109:9296ab0bfc11 1332 #define ADC_EXTERNALTRIGINJECCONV_T7_TRGO ADC3_4_EXTERNALTRIGINJEC_T7_TRGO
Kojto 109:9296ab0bfc11 1333 #define ADC_EXTERNALTRIGINJECCONV_T8_CC2 ADC3_4_EXTERNALTRIGINJEC_T8_CC2
Kojto 109:9296ab0bfc11 1334
Kojto 109:9296ab0bfc11 1335 /* External triggers of injected group for ADC1&ADC2, ADC3&ADC4 */
Kojto 109:9296ab0bfc11 1336 /* Note: Triggers affected to group ADC1_2 by default, redirected to group */
Kojto 109:9296ab0bfc11 1337 /* ADC3_4 by driver when needed. */
Kojto 109:9296ab0bfc11 1338 #define ADC_EXTERNALTRIGINJECCONV_T1_CC4 ADC1_2_EXTERNALTRIGINJEC_T1_CC4
Kojto 109:9296ab0bfc11 1339 #define ADC_EXTERNALTRIGINJECCONV_T1_TRGO ADC1_2_EXTERNALTRIGINJEC_T1_TRGO
Kojto 109:9296ab0bfc11 1340 #define ADC_EXTERNALTRIGINJECCONV_T1_TRGO2 ADC1_2_EXTERNALTRIGINJEC_T1_TRGO2
Kojto 109:9296ab0bfc11 1341 #define ADC_EXTERNALTRIGINJECCONV_T2_TRGO ADC1_2_EXTERNALTRIGINJEC_T2_TRGO
Kojto 109:9296ab0bfc11 1342 #define ADC_EXTERNALTRIGINJECCONV_T3_TRGO ADC1_2_EXTERNALTRIGINJEC_T3_TRGO
Kojto 109:9296ab0bfc11 1343 #define ADC_EXTERNALTRIGINJECCONV_T4_TRGO ADC1_2_EXTERNALTRIGINJEC_T4_TRGO
Kojto 109:9296ab0bfc11 1344 #define ADC_EXTERNALTRIGINJECCONV_T8_CC4 ADC1_2_EXTERNALTRIGINJEC_T8_CC4
Kojto 109:9296ab0bfc11 1345 #define ADC_EXTERNALTRIGINJECCONV_T8_TRGO ADC1_2_EXTERNALTRIGINJEC_T8_TRGO
Kojto 109:9296ab0bfc11 1346 #define ADC_EXTERNALTRIGINJECCONV_T8_TRGO2 ADC1_2_EXTERNALTRIGINJEC_T8_TRGO2
Kojto 109:9296ab0bfc11 1347 #define ADC_EXTERNALTRIGINJECCONV_T15_TRGO ADC1_2_EXTERNALTRIGINJEC_T15_TRGO
Kojto 109:9296ab0bfc11 1348
Kojto 109:9296ab0bfc11 1349 #define ADC_INJECTED_SOFTWARE_START ((uint32_t)0x00000001)
Kojto 109:9296ab0bfc11 1350
Kojto 109:9296ab0bfc11 1351 #if defined(STM32F303xE) || defined(STM32F398xx)
Kojto 109:9296ab0bfc11 1352 /*!< List of external triggers specific to device STM303xE: using Timer20 */
Kojto 109:9296ab0bfc11 1353 /* with ADC trigger input remap. */
Kojto 109:9296ab0bfc11 1354 /* To remap ADC trigger from other timers/ExtLine to timer20: use macro */
Kojto 109:9296ab0bfc11 1355 /* " __HAL_REMAPADCTRIGGER_ENABLE(...) " with parameters described below: */
Kojto 109:9296ab0bfc11 1356
Kojto 109:9296ab0bfc11 1357 /*!< External triggers of injected group for ADC1&ADC2 only, specific to */
Kojto 109:9296ab0bfc11 1358 /* device STM303xE: : using Timer20 with ADC trigger input remap */
Kojto 109:9296ab0bfc11 1359 #define ADC_EXTERNALTRIGINJECCONV_T20_CC4 ADC_EXTERNALTRIGINJECCONV_T3_CC1 /*!< Remap trigger using macro __HAL_REMAPADCTRIGGER_ENABLE(HAL_REMAPADCTRIGGER_ADC12_JEXT13) */
Kojto 109:9296ab0bfc11 1360
Kojto 109:9296ab0bfc11 1361 /*!< External triggers of injected group for ADC3&ADC4 only, specific to */
Kojto 109:9296ab0bfc11 1362 /* device STM303xE: : using Timer20 with ADC trigger input remap */
Kojto 109:9296ab0bfc11 1363 #define ADC_EXTERNALTRIGINJECCONV_T20_CC2 ADC_EXTERNALTRIGINJECCONV_T7_TRGO /*!< Remap trigger using macro __HAL_REMAPADCTRIGGER_ENABLE(HAL_REMAPADCTRIGGER_ADC34_JEXT14) */
Kojto 109:9296ab0bfc11 1364
Kojto 109:9296ab0bfc11 1365 /*!< External triggers of regular group for ADC1&ADC2, ADC3&ADC4, specific to */
Kojto 109:9296ab0bfc11 1366 /* device STM303xE: : using Timer20 with ADC trigger input remap */
Kojto 109:9296ab0bfc11 1367 /* Note: Triggers affected to group ADC1_2 by default, redirected to group */
Kojto 109:9296ab0bfc11 1368 /* ADC3_4 by driver when needed. */
Kojto 109:9296ab0bfc11 1369 #define ADC_EXTERNALTRIGINJECCONV_T20_TRGO (ADC_EXTERNALTRIGINJECCONV_T2_CC1 | ADC_EXTERNALTRIGCONV_T20_MASK) /*!< For ADC1&ADC2: Remap trigger using macro __HAL_REMAPADCTRIGGER_ENABLE(HAL_REMAPADCTRIGGER_ADC12_JEXT3) */
Kojto 109:9296ab0bfc11 1370 /*!< For ADC3&ADC4: Remap trigger using macro __HAL_REMAPADCTRIGGER_ENABLE(HAL_REMAPADCTRIGGER_ADC34_JEXT5) */
Kojto 109:9296ab0bfc11 1371 #define ADC_EXTERNALTRIGINJECCONV_T20_TRGO2 (ADC_EXTERNALTRIGINJECCONV_EXT_IT15 | ADC_EXTERNALTRIGCONV_T20_MASK) /*!< For ADC1&ADC2: Remap trigger using macro __HAL_REMAPADCTRIGGER_ENABLE(HAL_REMAPADCTRIGGER_ADC12_JEXT6) */
Kojto 109:9296ab0bfc11 1372 /*!< For ADC3&ADC4: Remap trigger using macro __HAL_REMAPADCTRIGGER_ENABLE(HAL_REMAPADCTRIGGER_ADC34_JEXT11) */
Kojto 109:9296ab0bfc11 1373 #endif /* STM32F303xE || STM32F398xx */
Kojto 109:9296ab0bfc11 1374
Kojto 109:9296ab0bfc11 1375 #if defined(STM32F303xC) || defined(STM32F358xx)
Kojto 109:9296ab0bfc11 1376 #define IS_ADC_EXTTRIGINJEC(INJTRIG) (((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T2_CC1) || \
Kojto 109:9296ab0bfc11 1377 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T3_CC1) || \
Kojto 109:9296ab0bfc11 1378 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T3_CC4) || \
Kojto 109:9296ab0bfc11 1379 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T6_TRGO) || \
Kojto 109:9296ab0bfc11 1380 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_EXT_IT15) || \
Kojto 109:9296ab0bfc11 1381 \
Kojto 109:9296ab0bfc11 1382 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T4_CC3) || \
Kojto 109:9296ab0bfc11 1383 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T4_CC4) || \
Kojto 109:9296ab0bfc11 1384 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T7_TRGO) || \
Kojto 109:9296ab0bfc11 1385 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T8_CC2) || \
Kojto 109:9296ab0bfc11 1386 \
Kojto 109:9296ab0bfc11 1387 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T1_CC4) || \
Kojto 109:9296ab0bfc11 1388 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T1_TRGO) || \
Kojto 109:9296ab0bfc11 1389 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T1_TRGO2) || \
Kojto 109:9296ab0bfc11 1390 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T2_TRGO) || \
Kojto 109:9296ab0bfc11 1391 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T3_CC3) || \
Kojto 109:9296ab0bfc11 1392 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T3_TRGO) || \
Kojto 109:9296ab0bfc11 1393 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T4_TRGO) || \
Kojto 109:9296ab0bfc11 1394 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T8_CC4) || \
Kojto 109:9296ab0bfc11 1395 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T8_TRGO) || \
Kojto 109:9296ab0bfc11 1396 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T8_TRGO2) || \
Kojto 109:9296ab0bfc11 1397 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T15_TRGO) || \
Kojto 109:9296ab0bfc11 1398 \
Kojto 109:9296ab0bfc11 1399 ((INJTRIG) == ADC_INJECTED_SOFTWARE_START) )
Kojto 109:9296ab0bfc11 1400 #endif /* STM32F303xC || STM32F358xx */
Kojto 109:9296ab0bfc11 1401
Kojto 109:9296ab0bfc11 1402 #if defined(STM32F303xE) || defined(STM32F398xx)
Kojto 109:9296ab0bfc11 1403 #define IS_ADC_EXTTRIGINJEC(INJTRIG) (((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T2_CC1) || \
Kojto 109:9296ab0bfc11 1404 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T3_CC1) || \
Kojto 109:9296ab0bfc11 1405 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T3_CC4) || \
Kojto 109:9296ab0bfc11 1406 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T6_TRGO) || \
Kojto 109:9296ab0bfc11 1407 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_EXT_IT15) || \
Kojto 109:9296ab0bfc11 1408 \
Kojto 109:9296ab0bfc11 1409 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T4_CC3) || \
Kojto 109:9296ab0bfc11 1410 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T4_CC4) || \
Kojto 109:9296ab0bfc11 1411 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T7_TRGO) || \
Kojto 109:9296ab0bfc11 1412 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T8_CC2) || \
Kojto 109:9296ab0bfc11 1413 \
Kojto 109:9296ab0bfc11 1414 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T1_CC4) || \
Kojto 109:9296ab0bfc11 1415 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T1_TRGO) || \
Kojto 109:9296ab0bfc11 1416 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T1_TRGO2) || \
Kojto 109:9296ab0bfc11 1417 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T2_TRGO) || \
Kojto 109:9296ab0bfc11 1418 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T3_CC3) || \
Kojto 109:9296ab0bfc11 1419 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T3_TRGO) || \
Kojto 109:9296ab0bfc11 1420 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T4_TRGO) || \
Kojto 109:9296ab0bfc11 1421 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T8_CC4) || \
Kojto 109:9296ab0bfc11 1422 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T8_TRGO) || \
Kojto 109:9296ab0bfc11 1423 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T8_TRGO2) || \
Kojto 109:9296ab0bfc11 1424 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T15_TRGO) || \
Kojto 109:9296ab0bfc11 1425 \
Kojto 109:9296ab0bfc11 1426 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T20_CC4) || \
Kojto 109:9296ab0bfc11 1427 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T20_CC2) || \
Kojto 109:9296ab0bfc11 1428 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T20_TRGO) || \
Kojto 109:9296ab0bfc11 1429 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T20_TRGO2) || \
Kojto 109:9296ab0bfc11 1430 \
Kojto 109:9296ab0bfc11 1431 ((INJTRIG) == ADC_INJECTED_SOFTWARE_START) )
Kojto 109:9296ab0bfc11 1432 #endif /* STM32F303xE || STM32F398xx */
Kojto 109:9296ab0bfc11 1433
Kojto 109:9296ab0bfc11 1434 #endif /* STM32F303xC || STM32F303xE || STM32F398xx || STM32F358xx */
Kojto 109:9296ab0bfc11 1435
Kojto 109:9296ab0bfc11 1436 #if defined(STM32F302xE) || \
Kojto 109:9296ab0bfc11 1437 defined(STM32F302xC)
Kojto 109:9296ab0bfc11 1438 /*!< List of external triggers with generic trigger name, independently of */
Kojto 109:9296ab0bfc11 1439 /* ADC target (caution: applies to other ADCs sharing the same common group), */
Kojto 109:9296ab0bfc11 1440 /* sorted by trigger name: */
Kojto 109:9296ab0bfc11 1441
Kojto 109:9296ab0bfc11 1442 /* External triggers of injected group for ADC1&ADC2 */
Kojto 109:9296ab0bfc11 1443 #define ADC_EXTERNALTRIGINJECCONV_T1_CC4 ADC1_2_EXTERNALTRIGINJEC_T1_CC4
Kojto 109:9296ab0bfc11 1444 #define ADC_EXTERNALTRIGINJECCONV_T1_TRGO ADC1_2_EXTERNALTRIGINJEC_T1_TRGO
Kojto 109:9296ab0bfc11 1445 #define ADC_EXTERNALTRIGINJECCONV_T1_TRGO2 ADC1_2_EXTERNALTRIGINJEC_T1_TRGO2
Kojto 109:9296ab0bfc11 1446 #define ADC_EXTERNALTRIGINJECCONV_T2_CC1 ADC1_2_EXTERNALTRIGINJEC_T2_CC1
Kojto 109:9296ab0bfc11 1447 #define ADC_EXTERNALTRIGINJECCONV_T2_TRGO ADC1_2_EXTERNALTRIGINJEC_T2_TRGO
Kojto 109:9296ab0bfc11 1448 #define ADC_EXTERNALTRIGINJECCONV_T3_CC1 ADC1_2_EXTERNALTRIGINJEC_T3_CC1
Kojto 109:9296ab0bfc11 1449 #define ADC_EXTERNALTRIGINJECCONV_T3_CC3 ADC1_2_EXTERNALTRIGINJEC_T3_CC3
Kojto 109:9296ab0bfc11 1450 #define ADC_EXTERNALTRIGINJECCONV_T3_CC4 ADC1_2_EXTERNALTRIGINJEC_T3_CC4
Kojto 109:9296ab0bfc11 1451 #define ADC_EXTERNALTRIGINJECCONV_T3_TRGO ADC1_2_EXTERNALTRIGINJEC_T3_TRGO
Kojto 109:9296ab0bfc11 1452 #define ADC_EXTERNALTRIGINJECCONV_T4_TRGO ADC1_2_EXTERNALTRIGINJEC_T4_TRGO
Kojto 109:9296ab0bfc11 1453 #define ADC_EXTERNALTRIGINJECCONV_T6_TRGO ADC1_2_EXTERNALTRIGINJEC_T6_TRGO
Kojto 109:9296ab0bfc11 1454 #define ADC_EXTERNALTRIGINJECCONV_T15_TRGO ADC1_2_EXTERNALTRIGINJEC_T15_TRGO
Kojto 109:9296ab0bfc11 1455 #define ADC_EXTERNALTRIGINJECCONV_EXT_IT15 ADC1_2_EXTERNALTRIGINJEC_EXT_IT15
Kojto 109:9296ab0bfc11 1456
Kojto 109:9296ab0bfc11 1457 #define ADC_INJECTED_SOFTWARE_START ((uint32_t)0x00000001)
Kojto 109:9296ab0bfc11 1458
Kojto 109:9296ab0bfc11 1459 #if defined(STM32F302xE)
Kojto 109:9296ab0bfc11 1460 /*!< List of external triggers specific to device STM302xE: using Timer20 */
Kojto 109:9296ab0bfc11 1461 /* with ADC trigger input remap. */
Kojto 109:9296ab0bfc11 1462 /* To remap ADC trigger from other timers/ExtLine to timer20: use macro */
Kojto 109:9296ab0bfc11 1463 /* " __HAL_REMAPADCTRIGGER_ENABLE(...) " with parameters described below: */
Kojto 109:9296ab0bfc11 1464
Kojto 109:9296ab0bfc11 1465 /*!< External triggers of injected group for ADC1&ADC2 only, specific to */
Kojto 109:9296ab0bfc11 1466 /* device STM302xE: : using Timer20 with ADC trigger input remap */
Kojto 109:9296ab0bfc11 1467 #define ADC_EXTERNALTRIGINJECCONV_T20_CC4 ADC_EXTERNALTRIGINJECCONV_T3_CC1 /*!< Remap trigger using macro __HAL_REMAPADCTRIGGER_ENABLE(HAL_REMAPADCTRIGGER_ADC12_JEXT13) */
Kojto 109:9296ab0bfc11 1468 #define ADC_EXTERNALTRIGINJECCONV_T20_TRGO (ADC_EXTERNALTRIGINJECCONV_T2_CC1 | ADC_EXTERNALTRIGCONV_T20_MASK) /*!< For ADC1&ADC2: Remap trigger using macro __HAL_REMAPADCTRIGGER_ENABLE(HAL_REMAPADCTRIGGER_ADC12_JEXT3) */
Kojto 109:9296ab0bfc11 1469 #define ADC_EXTERNALTRIGINJECCONV_T20_TRGO2 (ADC_EXTERNALTRIGINJECCONV_EXT_IT15 | ADC_EXTERNALTRIGCONV_T20_MASK) /*!< For ADC1&ADC2: Remap trigger using macro __HAL_REMAPADCTRIGGER_ENABLE(HAL_REMAPADCTRIGGER_ADC12_JEXT6) */
Kojto 109:9296ab0bfc11 1470 #endif /* STM32F302xE */
Kojto 109:9296ab0bfc11 1471
Kojto 109:9296ab0bfc11 1472 #if defined(STM32F302xE)
Kojto 109:9296ab0bfc11 1473 #define IS_ADC_EXTTRIGINJEC(INJTRIG) (((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T1_CC4) || \
Kojto 109:9296ab0bfc11 1474 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T1_TRGO) || \
Kojto 109:9296ab0bfc11 1475 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T1_TRGO2) || \
Kojto 109:9296ab0bfc11 1476 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T2_CC1) || \
Kojto 109:9296ab0bfc11 1477 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T2_TRGO) || \
Kojto 109:9296ab0bfc11 1478 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T3_CC1) || \
Kojto 109:9296ab0bfc11 1479 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T3_CC3) || \
Kojto 109:9296ab0bfc11 1480 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T3_CC4) || \
Kojto 109:9296ab0bfc11 1481 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T3_TRGO) || \
Kojto 109:9296ab0bfc11 1482 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T4_TRGO) || \
Kojto 109:9296ab0bfc11 1483 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T6_TRGO) || \
Kojto 109:9296ab0bfc11 1484 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T15_TRGO) || \
Kojto 109:9296ab0bfc11 1485 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_EXT_IT15) || \
Kojto 109:9296ab0bfc11 1486 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T20_CC4) || \
Kojto 109:9296ab0bfc11 1487 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T20_TRGO) || \
Kojto 109:9296ab0bfc11 1488 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T20_TRGO2) || \
Kojto 109:9296ab0bfc11 1489 ((INJTRIG) == ADC_INJECTED_SOFTWARE_START) )
Kojto 109:9296ab0bfc11 1490 #endif /* STM32F302xE */
Kojto 109:9296ab0bfc11 1491
Kojto 109:9296ab0bfc11 1492 #if defined(STM32F302xC)
Kojto 109:9296ab0bfc11 1493 #define IS_ADC_EXTTRIGINJEC(INJTRIG) (((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T1_CC4) || \
Kojto 109:9296ab0bfc11 1494 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T1_TRGO) || \
Kojto 109:9296ab0bfc11 1495 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T1_TRGO2) || \
Kojto 109:9296ab0bfc11 1496 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T2_CC1) || \
Kojto 109:9296ab0bfc11 1497 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T2_TRGO) || \
Kojto 109:9296ab0bfc11 1498 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T3_CC1) || \
Kojto 109:9296ab0bfc11 1499 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T3_CC3) || \
Kojto 109:9296ab0bfc11 1500 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T3_CC4) || \
Kojto 109:9296ab0bfc11 1501 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T3_TRGO) || \
Kojto 109:9296ab0bfc11 1502 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T4_TRGO) || \
Kojto 109:9296ab0bfc11 1503 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T6_TRGO) || \
Kojto 109:9296ab0bfc11 1504 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T15_TRGO) || \
Kojto 109:9296ab0bfc11 1505 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_EXT_IT15) || \
Kojto 109:9296ab0bfc11 1506 ((INJTRIG) == ADC_INJECTED_SOFTWARE_START) )
Kojto 109:9296ab0bfc11 1507 #endif /* STM32F302xC */
Kojto 109:9296ab0bfc11 1508
Kojto 109:9296ab0bfc11 1509 #endif /* STM32F302xE || */
Kojto 109:9296ab0bfc11 1510 /* STM32F302xC */
Kojto 109:9296ab0bfc11 1511
Kojto 109:9296ab0bfc11 1512 #if defined(STM32F303x8) || defined(STM32F328xx)
Kojto 109:9296ab0bfc11 1513 /*!< List of external triggers with generic trigger name, independently of */
Kojto 109:9296ab0bfc11 1514 /* ADC target (caution: applies to other ADCs sharing the same common group), */
Kojto 109:9296ab0bfc11 1515 /* sorted by trigger name: */
Kojto 109:9296ab0bfc11 1516
Kojto 109:9296ab0bfc11 1517 /* External triggers of injected group for ADC1&ADC2 */
Kojto 109:9296ab0bfc11 1518 #define ADC_EXTERNALTRIGINJECCONV_T1_CC4 ADC1_2_EXTERNALTRIGINJEC_T1_CC4
Kojto 109:9296ab0bfc11 1519 #define ADC_EXTERNALTRIGINJECCONV_T1_TRGO ADC1_2_EXTERNALTRIGINJEC_T1_TRGO
Kojto 109:9296ab0bfc11 1520 #define ADC_EXTERNALTRIGINJECCONV_T1_TRGO2 ADC1_2_EXTERNALTRIGINJEC_T1_TRGO2
Kojto 109:9296ab0bfc11 1521 #define ADC_EXTERNALTRIGINJECCONV_T2_CC1 ADC1_2_EXTERNALTRIGINJEC_T2_CC1
Kojto 109:9296ab0bfc11 1522 #define ADC_EXTERNALTRIGINJECCONV_T2_TRGO ADC1_2_EXTERNALTRIGINJEC_T2_TRGO
Kojto 109:9296ab0bfc11 1523 #define ADC_EXTERNALTRIGINJECCONV_T3_CC1 ADC1_2_EXTERNALTRIGINJEC_T3_CC1
Kojto 109:9296ab0bfc11 1524 #define ADC_EXTERNALTRIGINJECCONV_T3_CC3 ADC1_2_EXTERNALTRIGINJEC_T3_CC3
Kojto 109:9296ab0bfc11 1525 #define ADC_EXTERNALTRIGINJECCONV_T3_CC4 ADC1_2_EXTERNALTRIGINJEC_T3_CC4
Kojto 109:9296ab0bfc11 1526 #define ADC_EXTERNALTRIGINJECCONV_T3_TRGO ADC1_2_EXTERNALTRIGINJEC_T3_TRGO
Kojto 109:9296ab0bfc11 1527 #define ADC_EXTERNALTRIGINJECCONV_T4_TRGO ADC1_2_EXTERNALTRIGINJEC_T4_TRGO
Kojto 109:9296ab0bfc11 1528 #define ADC_EXTERNALTRIGINJECCONV_T6_TRGO ADC1_2_EXTERNALTRIGINJEC_T6_TRGO
Kojto 109:9296ab0bfc11 1529 #define ADC_EXTERNALTRIGINJECCONV_T8_CC4 ADC1_2_EXTERNALTRIGINJEC_T8_CC4
Kojto 109:9296ab0bfc11 1530 #define ADC_EXTERNALTRIGINJECCONV_T8_TRGO ADC1_2_EXTERNALTRIGINJEC_T8_TRGO
Kojto 109:9296ab0bfc11 1531 #define ADC_EXTERNALTRIGINJECCONV_T8_TRGO2 ADC1_2_EXTERNALTRIGINJEC_T8_TRGO2
Kojto 109:9296ab0bfc11 1532 #define ADC_EXTERNALTRIGINJECCONV_T15_TRGO ADC1_2_EXTERNALTRIGINJEC_T15_TRGO
Kojto 109:9296ab0bfc11 1533 #define ADC_EXTERNALTRIGINJECCONV_EXT_IT15 ADC1_2_EXTERNALTRIGINJEC_EXT_IT15
Kojto 109:9296ab0bfc11 1534
Kojto 109:9296ab0bfc11 1535 #define ADC_INJECTED_SOFTWARE_START ((uint32_t)0x00000001)
Kojto 109:9296ab0bfc11 1536
Kojto 109:9296ab0bfc11 1537 #define IS_ADC_EXTTRIGINJEC(INJTRIG) (((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T1_TRGO) || \
Kojto 109:9296ab0bfc11 1538 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T1_CC4) || \
Kojto 109:9296ab0bfc11 1539 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T2_TRGO) || \
Kojto 109:9296ab0bfc11 1540 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T2_CC1) || \
Kojto 109:9296ab0bfc11 1541 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T3_CC4) || \
Kojto 109:9296ab0bfc11 1542 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T4_TRGO) || \
Kojto 109:9296ab0bfc11 1543 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_EXT_IT15) || \
Kojto 109:9296ab0bfc11 1544 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T8_CC4) || \
Kojto 109:9296ab0bfc11 1545 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T1_TRGO2) || \
Kojto 109:9296ab0bfc11 1546 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T8_TRGO) || \
Kojto 109:9296ab0bfc11 1547 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T8_TRGO2) || \
Kojto 109:9296ab0bfc11 1548 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T3_CC3) || \
Kojto 109:9296ab0bfc11 1549 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T3_TRGO) || \
Kojto 109:9296ab0bfc11 1550 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T3_CC1) || \
Kojto 109:9296ab0bfc11 1551 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T6_TRGO) || \
Kojto 109:9296ab0bfc11 1552 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T15_TRGO) || \
Kojto 109:9296ab0bfc11 1553 ((INJTRIG) == ADC_INJECTED_SOFTWARE_START) )
Kojto 109:9296ab0bfc11 1554 #endif /* STM32F303x8 || STM32F328xx */
Kojto 109:9296ab0bfc11 1555
Kojto 109:9296ab0bfc11 1556 #if defined(STM32F334x8)
Kojto 109:9296ab0bfc11 1557 /*!< List of external triggers with generic trigger name, independently of */
Kojto 109:9296ab0bfc11 1558 /* ADC target (caution: applies to other ADCs sharing the same common group), */
Kojto 109:9296ab0bfc11 1559 /* sorted by trigger name: */
Kojto 109:9296ab0bfc11 1560
Kojto 109:9296ab0bfc11 1561 /* External triggers of injected group for ADC1&ADC2 */
Kojto 109:9296ab0bfc11 1562 #define ADC_EXTERNALTRIGINJECCONV_T1_CC4 ADC1_2_EXTERNALTRIGINJEC_T1_CC4
Kojto 109:9296ab0bfc11 1563 #define ADC_EXTERNALTRIGINJECCONV_T1_TRGO ADC1_2_EXTERNALTRIGINJEC_T1_TRGO
Kojto 109:9296ab0bfc11 1564 #define ADC_EXTERNALTRIGINJECCONV_T1_TRGO2 ADC1_2_EXTERNALTRIGINJEC_T1_TRGO2
Kojto 109:9296ab0bfc11 1565 #define ADC_EXTERNALTRIGINJECCONV_T2_CC1 ADC1_2_EXTERNALTRIGINJEC_T2_CC1
Kojto 109:9296ab0bfc11 1566 #define ADC_EXTERNALTRIGINJECCONV_T2_TRGO ADC1_2_EXTERNALTRIGINJEC_T2_TRGO
Kojto 109:9296ab0bfc11 1567 #define ADC_EXTERNALTRIGINJECCONV_T3_CC1 ADC1_2_EXTERNALTRIGINJEC_T3_CC1
Kojto 109:9296ab0bfc11 1568 #define ADC_EXTERNALTRIGINJECCONV_T3_CC3 ADC1_2_EXTERNALTRIGINJEC_T3_CC3
Kojto 109:9296ab0bfc11 1569 #define ADC_EXTERNALTRIGINJECCONV_T3_CC4 ADC1_2_EXTERNALTRIGINJEC_T3_CC4
Kojto 109:9296ab0bfc11 1570 #define ADC_EXTERNALTRIGINJECCONV_T3_TRGO ADC1_2_EXTERNALTRIGINJEC_T3_TRGO
Kojto 109:9296ab0bfc11 1571 #define ADC_EXTERNALTRIGINJECCONV_T6_TRGO ADC1_2_EXTERNALTRIGINJEC_T6_TRGO
Kojto 109:9296ab0bfc11 1572 #define ADC_EXTERNALTRIGINJECCONV_T15_TRGO ADC1_2_EXTERNALTRIGINJEC_T15_TRGO
Kojto 109:9296ab0bfc11 1573 #define ADC_EXTERNALTRIGINJECCONV_HRTIM_TRG2 ADC1_2_EXTERNALTRIGINJEC_HRTIM_TRG2
Kojto 109:9296ab0bfc11 1574 #define ADC_EXTERNALTRIGINJECCONV_HRTIM_TRG4 ADC1_2_EXTERNALTRIGINJEC_HRTIM_TRG4
Kojto 109:9296ab0bfc11 1575 #define ADC_EXTERNALTRIGINJECCONV_EXT_IT15 ADC1_2_EXTERNALTRIGINJEC_EXT_IT15
Kojto 109:9296ab0bfc11 1576
Kojto 109:9296ab0bfc11 1577 #define ADC_INJECTED_SOFTWARE_START ((uint32_t)0x00000001)
Kojto 109:9296ab0bfc11 1578
Kojto 109:9296ab0bfc11 1579 #define IS_ADC_EXTTRIGINJEC(INJTRIG) (((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T1_TRGO) || \
Kojto 109:9296ab0bfc11 1580 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T1_CC4) || \
Kojto 109:9296ab0bfc11 1581 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T2_TRGO) || \
Kojto 109:9296ab0bfc11 1582 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T2_CC1) || \
Kojto 109:9296ab0bfc11 1583 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T3_CC4) || \
Kojto 109:9296ab0bfc11 1584 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_EXT_IT15) || \
Kojto 109:9296ab0bfc11 1585 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T1_TRGO2) || \
Kojto 109:9296ab0bfc11 1586 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_HRTIM_TRG2) || \
Kojto 109:9296ab0bfc11 1587 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_HRTIM_TRG4) || \
Kojto 109:9296ab0bfc11 1588 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T3_CC3) || \
Kojto 109:9296ab0bfc11 1589 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T3_TRGO) || \
Kojto 109:9296ab0bfc11 1590 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T3_CC1) || \
Kojto 109:9296ab0bfc11 1591 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T6_TRGO) || \
Kojto 109:9296ab0bfc11 1592 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T15_TRGO) || \
Kojto 109:9296ab0bfc11 1593 ((INJTRIG) == ADC_INJECTED_SOFTWARE_START) )
Kojto 109:9296ab0bfc11 1594 #endif /* STM32F334x8 */
Kojto 109:9296ab0bfc11 1595
Kojto 109:9296ab0bfc11 1596 #if defined(STM32F301x8) || defined(STM32F302x8) || defined(STM32F318xx)
Kojto 109:9296ab0bfc11 1597 /* List of external triggers with generic trigger name, sorted by trigger */
Kojto 109:9296ab0bfc11 1598 /* name: */
Kojto 109:9296ab0bfc11 1599
Kojto 109:9296ab0bfc11 1600 /* External triggers of injected group for ADC1 */
Kojto 109:9296ab0bfc11 1601 #define ADC_EXTERNALTRIGINJECCONV_T1_CC4 ADC1_EXTERNALTRIGINJEC_T1_CC4
Kojto 109:9296ab0bfc11 1602 #define ADC_EXTERNALTRIGINJECCONV_T1_TRGO ADC1_EXTERNALTRIGINJEC_T1_TRGO
Kojto 109:9296ab0bfc11 1603 #define ADC_EXTERNALTRIGINJECCONV_T1_TRGO2 ADC1_EXTERNALTRIGINJEC_T1_TRGO2
Kojto 109:9296ab0bfc11 1604 #define ADC_EXTERNALTRIGINJECCONV_T6_TRGO ADC1_EXTERNALTRIGINJEC_T6_TRGO
Kojto 109:9296ab0bfc11 1605 #define ADC_EXTERNALTRIGINJECCONV_T15_TRGO ADC1_EXTERNALTRIGINJEC_T15_TRGO
Kojto 109:9296ab0bfc11 1606 #define ADC_EXTERNALTRIGINJECCONV_EXT_IT15 ADC1_EXTERNALTRIGINJEC_EXT_IT15
Kojto 109:9296ab0bfc11 1607
Kojto 109:9296ab0bfc11 1608 #define ADC_INJECTED_SOFTWARE_START ((uint32_t)0x00000001)
Kojto 109:9296ab0bfc11 1609
Kojto 109:9296ab0bfc11 1610 #define IS_ADC_EXTTRIGINJEC(INJTRIG) (((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T1_TRGO) || \
Kojto 109:9296ab0bfc11 1611 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T1_CC4) || \
Kojto 109:9296ab0bfc11 1612 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_EXT_IT15) || \
Kojto 109:9296ab0bfc11 1613 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T1_TRGO2) || \
Kojto 109:9296ab0bfc11 1614 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T6_TRGO) || \
Kojto 109:9296ab0bfc11 1615 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T15_TRGO) || \
Kojto 109:9296ab0bfc11 1616 ((INJTRIG) == ADC_INJECTED_SOFTWARE_START) )
Kojto 109:9296ab0bfc11 1617 #endif /* STM32F301x8 || STM32F302x8 || STM32F318xx */
Kojto 109:9296ab0bfc11 1618 /**
Kojto 109:9296ab0bfc11 1619 * @}
Kojto 109:9296ab0bfc11 1620 */
Kojto 109:9296ab0bfc11 1621
Kojto 109:9296ab0bfc11 1622 /** @defgroup ADCEx_Internal_HAL_driver_Ext_trig_src_Injected ADC Extended External Trigger Source of Injected Group (Internal)
Kojto 109:9296ab0bfc11 1623 * @{
Kojto 109:9296ab0bfc11 1624 */
Kojto 109:9296ab0bfc11 1625 #if defined(STM32F303xE) || defined(STM32F398xx) || \
Kojto 109:9296ab0bfc11 1626 defined(STM32F303xC) || defined(STM32F358xx)
Kojto 109:9296ab0bfc11 1627 /* List of external triggers sorted of groups ADC1&ADC2 and/or ADC3&ADC4: */
Kojto 109:9296ab0bfc11 1628 /* (used internally by HAL driver. To not use into HAL structure parameters) */
Kojto 109:9296ab0bfc11 1629
Kojto 109:9296ab0bfc11 1630 /* External triggers for injected groups of ADC1 & ADC2 */
Kojto 109:9296ab0bfc11 1631 #define ADC1_2_EXTERNALTRIGINJEC_T1_TRGO ((uint32_t)0x00000000)
Kojto 109:9296ab0bfc11 1632 #define ADC1_2_EXTERNALTRIGINJEC_T1_CC4 ((uint32_t)ADC_JSQR_JEXTSEL_0)
Kojto 109:9296ab0bfc11 1633 #define ADC1_2_EXTERNALTRIGINJEC_T2_TRGO ((uint32_t)ADC_JSQR_JEXTSEL_1)
Kojto 109:9296ab0bfc11 1634 #define ADC1_2_EXTERNALTRIGINJEC_T2_CC1 ((uint32_t)(ADC_JSQR_JEXTSEL_1 | ADC_JSQR_JEXTSEL_0))
Kojto 109:9296ab0bfc11 1635 #define ADC1_2_EXTERNALTRIGINJEC_T3_CC4 ((uint32_t)ADC_JSQR_JEXTSEL_2)
Kojto 109:9296ab0bfc11 1636 #define ADC1_2_EXTERNALTRIGINJEC_T4_TRGO ((uint32_t)(ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_0))
Kojto 109:9296ab0bfc11 1637 #define ADC1_2_EXTERNALTRIGINJEC_EXT_IT15 ((uint32_t)(ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_1))
Kojto 109:9296ab0bfc11 1638 #define ADC1_2_EXTERNALTRIGINJEC_T8_CC4 ((uint32_t)(ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_1 | ADC_JSQR_JEXTSEL_0))
Kojto 109:9296ab0bfc11 1639 #define ADC1_2_EXTERNALTRIGINJEC_T1_TRGO2 ((uint32_t)ADC_JSQR_JEXTSEL_3)
Kojto 109:9296ab0bfc11 1640 #define ADC1_2_EXTERNALTRIGINJEC_T8_TRGO ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_0))
Kojto 109:9296ab0bfc11 1641 #define ADC1_2_EXTERNALTRIGINJEC_T8_TRGO2 ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_1))
Kojto 109:9296ab0bfc11 1642 #define ADC1_2_EXTERNALTRIGINJEC_T3_CC3 ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_1 | ADC_JSQR_JEXTSEL_0))
Kojto 109:9296ab0bfc11 1643 #define ADC1_2_EXTERNALTRIGINJEC_T3_TRGO ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_2))
Kojto 109:9296ab0bfc11 1644 #define ADC1_2_EXTERNALTRIGINJEC_T3_CC1 ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_0))
Kojto 109:9296ab0bfc11 1645 #define ADC1_2_EXTERNALTRIGINJEC_T6_TRGO ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_1))
Kojto 109:9296ab0bfc11 1646 #define ADC1_2_EXTERNALTRIGINJEC_T15_TRGO ((uint32_t)ADC_JSQR_JEXTSEL)
Kojto 109:9296ab0bfc11 1647
Kojto 109:9296ab0bfc11 1648 /* External triggers for injected groups of ADC3 & ADC4 */
Kojto 109:9296ab0bfc11 1649 /* Note: External triggers JEXT2 and JEXT5 are the same (TIM4_CC3 event). */
Kojto 109:9296ab0bfc11 1650 /* JEXT2 is the main trigger, JEXT5 could be redirected to another */
Kojto 109:9296ab0bfc11 1651 /* in future devices. */
Kojto 109:9296ab0bfc11 1652 /* However, this channel is implemented with a SW offset of 0x10000 for */
Kojto 109:9296ab0bfc11 1653 /* differentiation between similar triggers of common groups ADC1&ADC2, */
Kojto 109:9296ab0bfc11 1654 /* ADC3&ADC4 (Differentiation processed into macro */
Kojto 109:9296ab0bfc11 1655 /* __HAL_ADC_JSQR_JEXTSEL) */
Kojto 109:9296ab0bfc11 1656 #define ADC3_4_EXTERNALTRIGINJEC_T1_TRGO ((uint32_t)0x00000000)
Kojto 109:9296ab0bfc11 1657 #define ADC3_4_EXTERNALTRIGINJEC_T1_CC4 ((uint32_t)ADC_JSQR_JEXTSEL_0)
Kojto 109:9296ab0bfc11 1658 #define ADC3_4_EXTERNALTRIGINJEC_T4_CC3 ((uint32_t)ADC_JSQR_JEXTSEL_1 | 0x10000)
Kojto 109:9296ab0bfc11 1659 #define ADC3_4_EXTERNALTRIGINJEC_T8_CC2 ((uint32_t)(ADC_JSQR_JEXTSEL_1 | ADC_JSQR_JEXTSEL_0))
Kojto 109:9296ab0bfc11 1660 #define ADC3_4_EXTERNALTRIGINJEC_T8_CC4 ((uint32_t)ADC_JSQR_JEXTSEL_2)
Kojto 109:9296ab0bfc11 1661
Kojto 109:9296ab0bfc11 1662 #if defined(STM32F303xE) || defined(STM32F398xx)
Kojto 109:9296ab0bfc11 1663 #define ADC3_4_EXTERNALTRIGINJEC_T20_TRGO ((uint32_t)(ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_0))
Kojto 109:9296ab0bfc11 1664 #endif /* STM32F303xE || STM32F398xx */
Kojto 109:9296ab0bfc11 1665
Kojto 109:9296ab0bfc11 1666 #define ADC3_4_EXTERNALTRIGINJEC_T4_CC4 ((uint32_t)(ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_1))
Kojto 109:9296ab0bfc11 1667 #define ADC3_4_EXTERNALTRIGINJEC_T4_TRGO ((uint32_t)(ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_1 | ADC_JSQR_JEXTSEL_0))
Kojto 109:9296ab0bfc11 1668 #define ADC3_4_EXTERNALTRIGINJEC_T1_TRGO2 ((uint32_t)ADC_JSQR_JEXTSEL_3)
Kojto 109:9296ab0bfc11 1669 #define ADC3_4_EXTERNALTRIGINJEC_T8_TRGO ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_0))
Kojto 109:9296ab0bfc11 1670 #define ADC3_4_EXTERNALTRIGINJEC_T8_TRGO2 ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_1))
Kojto 109:9296ab0bfc11 1671 #define ADC3_4_EXTERNALTRIGINJEC_T1_CC3 ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_1 | ADC_JSQR_JEXTSEL_0))
Kojto 109:9296ab0bfc11 1672 #define ADC3_4_EXTERNALTRIGINJEC_T3_TRGO ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_2))
Kojto 109:9296ab0bfc11 1673 #define ADC3_4_EXTERNALTRIGINJEC_T2_TRGO ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_0))
Kojto 109:9296ab0bfc11 1674 #define ADC3_4_EXTERNALTRIGINJEC_T7_TRGO ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_1))
Kojto 109:9296ab0bfc11 1675 #define ADC3_4_EXTERNALTRIGINJEC_T15_TRGO ((uint32_t)ADC_JSQR_JEXTSEL)
Kojto 109:9296ab0bfc11 1676 #endif /* STM32F303xE || STM32F398xx || */
Kojto 109:9296ab0bfc11 1677 /* STM32F303xC || STM32F358xx */
Kojto 109:9296ab0bfc11 1678
Kojto 109:9296ab0bfc11 1679 #if defined(STM32F302xE) || \
Kojto 109:9296ab0bfc11 1680 defined(STM32F302xC)
Kojto 109:9296ab0bfc11 1681 /* List of external triggers of group ADC1&ADC2: */
Kojto 109:9296ab0bfc11 1682 /* (used internally by HAL driver. To not use into HAL structure parameters) */
Kojto 109:9296ab0bfc11 1683 #define ADC1_2_EXTERNALTRIGINJEC_T1_TRGO ((uint32_t)0x00000000)
Kojto 109:9296ab0bfc11 1684 #define ADC1_2_EXTERNALTRIGINJEC_T1_CC4 ((uint32_t)ADC_JSQR_JEXTSEL_0)
Kojto 109:9296ab0bfc11 1685 #define ADC1_2_EXTERNALTRIGINJEC_T2_TRGO ((uint32_t)ADC_JSQR_JEXTSEL_1)
Kojto 109:9296ab0bfc11 1686 #define ADC1_2_EXTERNALTRIGINJEC_T2_CC1 ((uint32_t)(ADC_JSQR_JEXTSEL_1 | ADC_JSQR_JEXTSEL_0))
Kojto 109:9296ab0bfc11 1687 #define ADC1_2_EXTERNALTRIGINJEC_T3_CC4 ((uint32_t)ADC_JSQR_JEXTSEL_2)
Kojto 109:9296ab0bfc11 1688 #define ADC1_2_EXTERNALTRIGINJEC_T4_TRGO ((uint32_t)(ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_0))
Kojto 109:9296ab0bfc11 1689 #define ADC1_2_EXTERNALTRIGINJEC_EXT_IT15 ((uint32_t)(ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_1))
Kojto 109:9296ab0bfc11 1690 #define ADC1_2_EXTERNALTRIGINJEC_T1_TRGO2 ((uint32_t)ADC_JSQR_JEXTSEL_3)
Kojto 109:9296ab0bfc11 1691 #define ADC1_2_EXTERNALTRIGINJEC_T3_CC3 ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_1 | ADC_JSQR_JEXTSEL_0))
Kojto 109:9296ab0bfc11 1692 #define ADC1_2_EXTERNALTRIGINJEC_T3_TRGO ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_2))
Kojto 109:9296ab0bfc11 1693 #define ADC1_2_EXTERNALTRIGINJEC_T3_CC1 ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_0))
Kojto 109:9296ab0bfc11 1694 #define ADC1_2_EXTERNALTRIGINJEC_T6_TRGO ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_1))
Kojto 109:9296ab0bfc11 1695 #define ADC1_2_EXTERNALTRIGINJEC_T15_TRGO ((uint32_t)ADC_JSQR_JEXTSEL)
Kojto 109:9296ab0bfc11 1696 #endif /* STM32F302xE || */
Kojto 109:9296ab0bfc11 1697 /* STM32F302xC */
Kojto 109:9296ab0bfc11 1698
Kojto 109:9296ab0bfc11 1699 #if defined(STM32F303x8) || defined(STM32F328xx)
Kojto 109:9296ab0bfc11 1700 /* List of external triggers of group ADC1&ADC2: */
Kojto 109:9296ab0bfc11 1701 /* (used internally by HAL driver. To not use into HAL structure parameters) */
Kojto 109:9296ab0bfc11 1702 #define ADC1_2_EXTERNALTRIGINJEC_T1_TRGO ((uint32_t)0x00000000)
Kojto 109:9296ab0bfc11 1703 #define ADC1_2_EXTERNALTRIGINJEC_T1_CC4 ((uint32_t)ADC_JSQR_JEXTSEL_0)
Kojto 109:9296ab0bfc11 1704 #define ADC1_2_EXTERNALTRIGINJEC_T2_TRGO ((uint32_t)ADC_JSQR_JEXTSEL_1)
Kojto 109:9296ab0bfc11 1705 #define ADC1_2_EXTERNALTRIGINJEC_T2_CC1 ((uint32_t)(ADC_JSQR_JEXTSEL_1 | ADC_JSQR_JEXTSEL_0))
Kojto 109:9296ab0bfc11 1706 #define ADC1_2_EXTERNALTRIGINJEC_T3_CC4 ((uint32_t)ADC_JSQR_JEXTSEL_2)
Kojto 109:9296ab0bfc11 1707 #define ADC1_2_EXTERNALTRIGINJEC_T4_TRGO ((uint32_t)(ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_0))
Kojto 109:9296ab0bfc11 1708 #define ADC1_2_EXTERNALTRIGINJEC_EXT_IT15 ((uint32_t)(ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_1))
Kojto 109:9296ab0bfc11 1709 #define ADC1_2_EXTERNALTRIGINJEC_T8_CC4 ((uint32_t)(ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_1 | ADC_JSQR_JEXTSEL_0))
Kojto 109:9296ab0bfc11 1710 #define ADC1_2_EXTERNALTRIGINJEC_T1_TRGO2 ((uint32_t)ADC_JSQR_JEXTSEL_3)
Kojto 109:9296ab0bfc11 1711 #define ADC1_2_EXTERNALTRIGINJEC_T8_TRGO ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_0))
Kojto 109:9296ab0bfc11 1712 #define ADC1_2_EXTERNALTRIGINJEC_T8_TRGO2 ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_1))
Kojto 109:9296ab0bfc11 1713 #define ADC1_2_EXTERNALTRIGINJEC_T3_CC3 ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_1 | ADC_JSQR_JEXTSEL_0))
Kojto 109:9296ab0bfc11 1714 #define ADC1_2_EXTERNALTRIGINJEC_T3_TRGO ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_2))
Kojto 109:9296ab0bfc11 1715 #define ADC1_2_EXTERNALTRIGINJEC_T3_CC1 ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_0))
Kojto 109:9296ab0bfc11 1716 #define ADC1_2_EXTERNALTRIGINJEC_T6_TRGO ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_1))
Kojto 109:9296ab0bfc11 1717 #define ADC1_2_EXTERNALTRIGINJEC_T15_TRGO ((uint32_t)ADC_JSQR_JEXTSEL)
Kojto 109:9296ab0bfc11 1718 #endif /* STM32F303x8 || STM32F328xx */
Kojto 109:9296ab0bfc11 1719
Kojto 109:9296ab0bfc11 1720 #if defined(STM32F334x8)
Kojto 109:9296ab0bfc11 1721 /* List of external triggers of group ADC1&ADC2: */
Kojto 109:9296ab0bfc11 1722 /* (used internally by HAL driver. To not use into HAL structure parameters) */
Kojto 109:9296ab0bfc11 1723 #define ADC1_2_EXTERNALTRIGINJEC_T1_TRGO ((uint32_t)0x00000000)
Kojto 109:9296ab0bfc11 1724 #define ADC1_2_EXTERNALTRIGINJEC_T1_CC4 ((uint32_t)ADC_JSQR_JEXTSEL_0)
Kojto 109:9296ab0bfc11 1725 #define ADC1_2_EXTERNALTRIGINJEC_T2_TRGO ((uint32_t)ADC_JSQR_JEXTSEL_1)
Kojto 109:9296ab0bfc11 1726 #define ADC1_2_EXTERNALTRIGINJEC_T2_CC1 ((uint32_t)(ADC_JSQR_JEXTSEL_1 | ADC_JSQR_JEXTSEL_0))
Kojto 109:9296ab0bfc11 1727 #define ADC1_2_EXTERNALTRIGINJEC_T3_CC4 ((uint32_t)ADC_JSQR_JEXTSEL_2)
Kojto 109:9296ab0bfc11 1728 #define ADC1_2_EXTERNALTRIGINJEC_EXT_IT15 ((uint32_t)(ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_1))
Kojto 109:9296ab0bfc11 1729 #define ADC1_2_EXTERNALTRIGINJEC_T1_TRGO2 ((uint32_t)ADC_JSQR_JEXTSEL_3)
Kojto 109:9296ab0bfc11 1730 #define ADC1_2_EXTERNALTRIGINJEC_HRTIM_TRG2 ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_0))
Kojto 109:9296ab0bfc11 1731 #define ADC1_2_EXTERNALTRIGINJEC_HRTIM_TRG4 ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_1))
Kojto 109:9296ab0bfc11 1732 #define ADC1_2_EXTERNALTRIGINJEC_T3_CC3 ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_1 | ADC_JSQR_JEXTSEL_0))
Kojto 109:9296ab0bfc11 1733 #define ADC1_2_EXTERNALTRIGINJEC_T3_TRGO ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_2))
Kojto 109:9296ab0bfc11 1734 #define ADC1_2_EXTERNALTRIGINJEC_T3_CC1 ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_0))
Kojto 109:9296ab0bfc11 1735 #define ADC1_2_EXTERNALTRIGINJEC_T6_TRGO ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_1))
Kojto 109:9296ab0bfc11 1736 #define ADC1_2_EXTERNALTRIGINJEC_T15_TRGO ((uint32_t)ADC_JSQR_JEXTSEL)
Kojto 109:9296ab0bfc11 1737 #endif /* STM32F334x8 */
Kojto 109:9296ab0bfc11 1738
Kojto 109:9296ab0bfc11 1739 #if defined(STM32F301x8) || defined(STM32F302x8) || defined(STM32F318xx)
Kojto 109:9296ab0bfc11 1740 /* List of external triggers of injected group for ADC1: */
Kojto 109:9296ab0bfc11 1741 /* (used internally by HAL driver. To not use into HAL structure parameters) */
Kojto 109:9296ab0bfc11 1742 #define ADC1_EXTERNALTRIGINJEC_T1_TRGO ((uint32_t)0x00000000)
Kojto 109:9296ab0bfc11 1743 #define ADC1_EXTERNALTRIGINJEC_T1_CC4 ((uint32_t)ADC_JSQR_JEXTSEL_0)
Kojto 109:9296ab0bfc11 1744 #define ADC1_EXTERNALTRIGINJEC_EXT_IT15 ((uint32_t)(ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_1))
Kojto 109:9296ab0bfc11 1745 #define ADC1_EXTERNALTRIGINJEC_T1_TRGO2 ((uint32_t)ADC_JSQR_JEXTSEL_3)
Kojto 109:9296ab0bfc11 1746 #define ADC1_EXTERNALTRIGINJEC_T6_TRGO ((uint32_t)(ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_1))
Kojto 109:9296ab0bfc11 1747 #define ADC1_EXTERNALTRIGINJEC_T15_TRGO ((uint32_t)ADC_JSQR_JEXTSEL)
Kojto 109:9296ab0bfc11 1748 #endif /* STM32F301x8 || STM32F302x8 || STM32F318xx */
Kojto 109:9296ab0bfc11 1749 /**
Kojto 109:9296ab0bfc11 1750 * @}
Kojto 109:9296ab0bfc11 1751 */
Kojto 109:9296ab0bfc11 1752
Kojto 109:9296ab0bfc11 1753 /** @defgroup ADCEx_Common_mode ADC Extended Dual ADC Mode
Kojto 109:9296ab0bfc11 1754 * @{
Kojto 109:9296ab0bfc11 1755 */
Kojto 109:9296ab0bfc11 1756 #define ADC_MODE_INDEPENDENT ((uint32_t)(0x00000000))
Kojto 109:9296ab0bfc11 1757 #define ADC_DUALMODE_REGSIMULT_INJECSIMULT ((uint32_t)(ADC12_CCR_MULTI_0))
Kojto 109:9296ab0bfc11 1758 #define ADC_DUALMODE_REGSIMULT_ALTERTRIG ((uint32_t)(ADC12_CCR_MULTI_1))
Kojto 109:9296ab0bfc11 1759 #define ADC_DUALMODE_INJECSIMULT ((uint32_t)(ADC12_CCR_MULTI_2 | ADC12_CCR_MULTI_0))
Kojto 109:9296ab0bfc11 1760 #define ADC_DUALMODE_REGSIMULT ((uint32_t)(ADC12_CCR_MULTI_2 | ADC12_CCR_MULTI_1))
Kojto 109:9296ab0bfc11 1761 #define ADC_DUALMODE_INTERL ((uint32_t)(ADC12_CCR_MULTI_2 | ADC12_CCR_MULTI_1 | ADC12_CCR_MULTI_0))
Kojto 109:9296ab0bfc11 1762 #define ADC_DUALMODE_ALTERTRIG ((uint32_t)(ADC12_CCR_MULTI_3 | ADC12_CCR_MULTI_0))
Kojto 109:9296ab0bfc11 1763
Kojto 109:9296ab0bfc11 1764 #define IS_ADC_MODE(MODE) (((MODE) == ADC_MODE_INDEPENDENT) || \
Kojto 109:9296ab0bfc11 1765 ((MODE) == ADC_DUALMODE_REGSIMULT_INJECSIMULT) || \
Kojto 109:9296ab0bfc11 1766 ((MODE) == ADC_DUALMODE_REGSIMULT_ALTERTRIG) || \
Kojto 109:9296ab0bfc11 1767 ((MODE) == ADC_DUALMODE_INJECSIMULT) || \
Kojto 109:9296ab0bfc11 1768 ((MODE) == ADC_DUALMODE_REGSIMULT) || \
Kojto 109:9296ab0bfc11 1769 ((MODE) == ADC_DUALMODE_INTERL) || \
Kojto 109:9296ab0bfc11 1770 ((MODE) == ADC_DUALMODE_ALTERTRIG) )
Kojto 109:9296ab0bfc11 1771 /**
Kojto 109:9296ab0bfc11 1772 * @}
Kojto 109:9296ab0bfc11 1773 */
Kojto 109:9296ab0bfc11 1774
Kojto 109:9296ab0bfc11 1775
Kojto 109:9296ab0bfc11 1776 /** @defgroup ADCEx_Direct_memory_access_mode_for_multimode ADC Extended DMA Mode for Dual ADC Mode
Kojto 109:9296ab0bfc11 1777 * @{
Kojto 109:9296ab0bfc11 1778 */
Kojto 109:9296ab0bfc11 1779 #define ADC_DMAACCESSMODE_DISABLED ((uint32_t)0x00000000) /*!< DMA multimode disabled: each ADC will use its own DMA channel */
Kojto 109:9296ab0bfc11 1780 #define ADC_DMAACCESSMODE_12_10_BITS ((uint32_t)ADC12_CCR_MDMA_1) /*!< DMA multimode enabled (one DMA channel for both ADC, DMA of ADC master) for 12 and 10 bits resolution */
Kojto 109:9296ab0bfc11 1781 #define ADC_DMAACCESSMODE_8_6_BITS ((uint32_t)ADC12_CCR_MDMA) /*!< DMA multimode enabled (one DMA channel for both ADC, DMA of ADC master) for 8 and 6 bits resolution */
Kojto 109:9296ab0bfc11 1782
Kojto 109:9296ab0bfc11 1783 #define IS_ADC_DMA_ACCESS_MODE(MODE) (((MODE) == ADC_DMAACCESSMODE_DISABLED) || \
Kojto 109:9296ab0bfc11 1784 ((MODE) == ADC_DMAACCESSMODE_12_10_BITS) || \
Kojto 109:9296ab0bfc11 1785 ((MODE) == ADC_DMAACCESSMODE_8_6_BITS) )
Kojto 109:9296ab0bfc11 1786 /**
Kojto 109:9296ab0bfc11 1787 * @}
Kojto 109:9296ab0bfc11 1788 */
Kojto 109:9296ab0bfc11 1789
Kojto 109:9296ab0bfc11 1790 /** @defgroup ADCEx_delay_between_2_sampling_phases ADC Extended Delay Between 2 Sampling Phases
Kojto 109:9296ab0bfc11 1791 * @{
Kojto 109:9296ab0bfc11 1792 */
Kojto 109:9296ab0bfc11 1793 #define ADC_TWOSAMPLINGDELAY_1CYCLE ((uint32_t)(0x00000000))
Kojto 109:9296ab0bfc11 1794 #define ADC_TWOSAMPLINGDELAY_2CYCLES ((uint32_t)(ADC12_CCR_DELAY_0))
Kojto 109:9296ab0bfc11 1795 #define ADC_TWOSAMPLINGDELAY_3CYCLES ((uint32_t)(ADC12_CCR_DELAY_1))
Kojto 109:9296ab0bfc11 1796 #define ADC_TWOSAMPLINGDELAY_4CYCLES ((uint32_t)(ADC12_CCR_DELAY_1 | ADC12_CCR_DELAY_0))
Kojto 109:9296ab0bfc11 1797 #define ADC_TWOSAMPLINGDELAY_5CYCLES ((uint32_t)(ADC12_CCR_DELAY_2))
Kojto 109:9296ab0bfc11 1798 #define ADC_TWOSAMPLINGDELAY_6CYCLES ((uint32_t)(ADC12_CCR_DELAY_2 | ADC12_CCR_DELAY_0))
Kojto 109:9296ab0bfc11 1799 #define ADC_TWOSAMPLINGDELAY_7CYCLES ((uint32_t)(ADC12_CCR_DELAY_2 | ADC12_CCR_DELAY_1))
Kojto 109:9296ab0bfc11 1800 #define ADC_TWOSAMPLINGDELAY_8CYCLES ((uint32_t)(ADC12_CCR_DELAY_2 | ADC12_CCR_DELAY_1 | ADC12_CCR_DELAY_0))
Kojto 109:9296ab0bfc11 1801 #define ADC_TWOSAMPLINGDELAY_9CYCLES ((uint32_t)(ADC12_CCR_DELAY_3))
Kojto 109:9296ab0bfc11 1802 #define ADC_TWOSAMPLINGDELAY_10CYCLES ((uint32_t)(ADC12_CCR_DELAY_3 | ADC12_CCR_DELAY_0))
Kojto 109:9296ab0bfc11 1803 #define ADC_TWOSAMPLINGDELAY_11CYCLES ((uint32_t)(ADC12_CCR_DELAY_3 | ADC12_CCR_DELAY_1))
Kojto 109:9296ab0bfc11 1804 #define ADC_TWOSAMPLINGDELAY_12CYCLES ((uint32_t)(ADC12_CCR_DELAY_3 | ADC12_CCR_DELAY_1 | ADC12_CCR_DELAY_0))
Kojto 109:9296ab0bfc11 1805
Kojto 109:9296ab0bfc11 1806 #define IS_ADC_SAMPLING_DELAY(DELAY) (((DELAY) == ADC_TWOSAMPLINGDELAY_1CYCLE) || \
Kojto 109:9296ab0bfc11 1807 ((DELAY) == ADC_TWOSAMPLINGDELAY_2CYCLES) || \
Kojto 109:9296ab0bfc11 1808 ((DELAY) == ADC_TWOSAMPLINGDELAY_3CYCLES) || \
Kojto 109:9296ab0bfc11 1809 ((DELAY) == ADC_TWOSAMPLINGDELAY_4CYCLES) || \
Kojto 109:9296ab0bfc11 1810 ((DELAY) == ADC_TWOSAMPLINGDELAY_5CYCLES) || \
Kojto 109:9296ab0bfc11 1811 ((DELAY) == ADC_TWOSAMPLINGDELAY_6CYCLES) || \
Kojto 109:9296ab0bfc11 1812 ((DELAY) == ADC_TWOSAMPLINGDELAY_7CYCLES) || \
Kojto 109:9296ab0bfc11 1813 ((DELAY) == ADC_TWOSAMPLINGDELAY_8CYCLES) || \
Kojto 109:9296ab0bfc11 1814 ((DELAY) == ADC_TWOSAMPLINGDELAY_9CYCLES) || \
Kojto 109:9296ab0bfc11 1815 ((DELAY) == ADC_TWOSAMPLINGDELAY_10CYCLES) || \
Kojto 109:9296ab0bfc11 1816 ((DELAY) == ADC_TWOSAMPLINGDELAY_11CYCLES) || \
Kojto 109:9296ab0bfc11 1817 ((DELAY) == ADC_TWOSAMPLINGDELAY_12CYCLES) )
Kojto 109:9296ab0bfc11 1818 /**
Kojto 109:9296ab0bfc11 1819 * @}
Kojto 109:9296ab0bfc11 1820 */
Kojto 109:9296ab0bfc11 1821
Kojto 109:9296ab0bfc11 1822 /** @defgroup ADCEx_analog_watchdog_number ADC Extended Analog Watchdog Selection
Kojto 109:9296ab0bfc11 1823 * @{
Kojto 109:9296ab0bfc11 1824 */
Kojto 109:9296ab0bfc11 1825 #define ADC_ANALOGWATCHDOG_1 ((uint32_t)0x00000001)
Kojto 109:9296ab0bfc11 1826 #define ADC_ANALOGWATCHDOG_2 ((uint32_t)0x00000002)
Kojto 109:9296ab0bfc11 1827 #define ADC_ANALOGWATCHDOG_3 ((uint32_t)0x00000003)
Kojto 109:9296ab0bfc11 1828
Kojto 109:9296ab0bfc11 1829 #define IS_ADC_ANALOG_WATCHDOG_NUMBER(WATCHDOG) (((WATCHDOG) == ADC_ANALOGWATCHDOG_1) || \
Kojto 109:9296ab0bfc11 1830 ((WATCHDOG) == ADC_ANALOGWATCHDOG_2) || \
Kojto 109:9296ab0bfc11 1831 ((WATCHDOG) == ADC_ANALOGWATCHDOG_3) )
Kojto 109:9296ab0bfc11 1832 /**
Kojto 109:9296ab0bfc11 1833 * @}
Kojto 109:9296ab0bfc11 1834 */
Kojto 109:9296ab0bfc11 1835
Kojto 109:9296ab0bfc11 1836 /** @defgroup ADCEx_analog_watchdog_mode ADC Extended Analog Watchdog Mode
Kojto 109:9296ab0bfc11 1837 * @{
Kojto 109:9296ab0bfc11 1838 */
Kojto 109:9296ab0bfc11 1839 #define ADC_ANALOGWATCHDOG_NONE ((uint32_t) 0x00000000)
Kojto 109:9296ab0bfc11 1840 #define ADC_ANALOGWATCHDOG_SINGLE_REG ((uint32_t)(ADC_CFGR_AWD1SGL | ADC_CFGR_AWD1EN))
Kojto 109:9296ab0bfc11 1841 #define ADC_ANALOGWATCHDOG_SINGLE_INJEC ((uint32_t)(ADC_CFGR_AWD1SGL | ADC_CFGR_JAWD1EN))
Kojto 109:9296ab0bfc11 1842 #define ADC_ANALOGWATCHDOG_SINGLE_REGINJEC ((uint32_t)(ADC_CFGR_AWD1SGL | ADC_CFGR_AWD1EN | ADC_CFGR_JAWD1EN))
Kojto 109:9296ab0bfc11 1843 #define ADC_ANALOGWATCHDOG_ALL_REG ((uint32_t) ADC_CFGR_AWD1EN)
Kojto 109:9296ab0bfc11 1844 #define ADC_ANALOGWATCHDOG_ALL_INJEC ((uint32_t) ADC_CFGR_JAWD1EN)
Kojto 109:9296ab0bfc11 1845 #define ADC_ANALOGWATCHDOG_ALL_REGINJEC ((uint32_t)(ADC_CFGR_AWD1EN | ADC_CFGR_JAWD1EN))
Kojto 109:9296ab0bfc11 1846
Kojto 109:9296ab0bfc11 1847 #define IS_ADC_ANALOG_WATCHDOG_MODE(WATCHDOG) (((WATCHDOG) == ADC_ANALOGWATCHDOG_NONE) || \
Kojto 109:9296ab0bfc11 1848 ((WATCHDOG) == ADC_ANALOGWATCHDOG_SINGLE_REG) || \
Kojto 109:9296ab0bfc11 1849 ((WATCHDOG) == ADC_ANALOGWATCHDOG_SINGLE_INJEC) || \
Kojto 109:9296ab0bfc11 1850 ((WATCHDOG) == ADC_ANALOGWATCHDOG_SINGLE_REGINJEC) || \
Kojto 109:9296ab0bfc11 1851 ((WATCHDOG) == ADC_ANALOGWATCHDOG_ALL_REG) || \
Kojto 109:9296ab0bfc11 1852 ((WATCHDOG) == ADC_ANALOGWATCHDOG_ALL_INJEC) || \
Kojto 109:9296ab0bfc11 1853 ((WATCHDOG) == ADC_ANALOGWATCHDOG_ALL_REGINJEC) )
Kojto 109:9296ab0bfc11 1854 /**
Kojto 109:9296ab0bfc11 1855 * @}
Kojto 109:9296ab0bfc11 1856 */
Kojto 109:9296ab0bfc11 1857
Kojto 109:9296ab0bfc11 1858 /** @defgroup ADC_conversion_group ADC Conversion Group
Kojto 109:9296ab0bfc11 1859 * @{
Kojto 109:9296ab0bfc11 1860 */
Kojto 109:9296ab0bfc11 1861 #define REGULAR_GROUP ((uint32_t)(ADC_FLAG_EOC | ADC_FLAG_EOS))
Kojto 109:9296ab0bfc11 1862 #define INJECTED_GROUP ((uint32_t)(ADC_FLAG_JEOC | ADC_FLAG_JEOS))
Kojto 109:9296ab0bfc11 1863 #define REGULAR_INJECTED_GROUP ((uint32_t)(ADC_FLAG_EOC | ADC_FLAG_EOS | ADC_FLAG_JEOC | ADC_FLAG_JEOS))
Kojto 109:9296ab0bfc11 1864
Kojto 109:9296ab0bfc11 1865 #define IS_ADC_CONVERSION_GROUP(CONVERSION) (((CONVERSION) == REGULAR_GROUP) || \
Kojto 109:9296ab0bfc11 1866 ((CONVERSION) == INJECTED_GROUP) || \
Kojto 109:9296ab0bfc11 1867 ((CONVERSION) == REGULAR_INJECTED_GROUP) )
Kojto 109:9296ab0bfc11 1868 /**
Kojto 109:9296ab0bfc11 1869 * @}
Kojto 109:9296ab0bfc11 1870 */
Kojto 109:9296ab0bfc11 1871
Kojto 109:9296ab0bfc11 1872 /** @defgroup ADCEx_Event_type ADC Extended Event Type
Kojto 109:9296ab0bfc11 1873 * @{
Kojto 109:9296ab0bfc11 1874 */
Kojto 109:9296ab0bfc11 1875 #define AWD1_EVENT ((uint32_t)ADC_FLAG_AWD1) /*!< ADC Analog watchdog 1 event (main analog watchdog, present on all STM32 devices) */
Kojto 109:9296ab0bfc11 1876 #define AWD2_EVENT ((uint32_t)ADC_FLAG_AWD2) /*!< ADC Analog watchdog 2 event (additional analog watchdog, present only on STM32F3 devices) */
Kojto 109:9296ab0bfc11 1877 #define AWD3_EVENT ((uint32_t)ADC_FLAG_AWD3) /*!< ADC Analog watchdog 3 event (additional analog watchdog, present only on STM32F3 devices) */
Kojto 109:9296ab0bfc11 1878 #define OVR_EVENT ((uint32_t)ADC_FLAG_OVR) /*!< ADC overrun event */
Kojto 109:9296ab0bfc11 1879 #define JQOVF_EVENT ((uint32_t)ADC_FLAG_JQOVF) /*!< ADC Injected Context Queue Overflow event */
Kojto 109:9296ab0bfc11 1880
Kojto 109:9296ab0bfc11 1881 #define AWD_EVENT AWD1_EVENT /*!< ADC Analog watchdog 1 event: Naming for compatibility with other STM32 devices having only 1 analog watchdog */
Kojto 109:9296ab0bfc11 1882
Kojto 109:9296ab0bfc11 1883 #define IS_ADC_EVENT_TYPE(EVENT) (((EVENT) == AWD_EVENT) || \
Kojto 109:9296ab0bfc11 1884 ((EVENT) == AWD2_EVENT) || \
Kojto 109:9296ab0bfc11 1885 ((EVENT) == AWD3_EVENT) || \
Kojto 109:9296ab0bfc11 1886 ((EVENT) == OVR_EVENT) || \
Kojto 109:9296ab0bfc11 1887 ((EVENT) == JQOVF_EVENT) )
Kojto 109:9296ab0bfc11 1888 /**
Kojto 109:9296ab0bfc11 1889 * @}
Kojto 109:9296ab0bfc11 1890 */
Kojto 109:9296ab0bfc11 1891
Kojto 109:9296ab0bfc11 1892 /** @defgroup ADCEx_interrupts_definition ADC Extended Interrupts Definition
Kojto 109:9296ab0bfc11 1893 * @{
Kojto 109:9296ab0bfc11 1894 */
Kojto 109:9296ab0bfc11 1895 #define ADC_IT_RDY ADC_IER_RDY /*!< ADC Ready (ADRDY) interrupt source */
Kojto 109:9296ab0bfc11 1896 #define ADC_IT_EOSMP ADC_IER_EOSMP /*!< ADC End of Sampling interrupt source */
Kojto 109:9296ab0bfc11 1897 #define ADC_IT_EOC ADC_IER_EOC /*!< ADC End of Regular Conversion interrupt source */
Kojto 109:9296ab0bfc11 1898 #define ADC_IT_EOS ADC_IER_EOS /*!< ADC End of Regular sequence of Conversions interrupt source */
Kojto 109:9296ab0bfc11 1899 #define ADC_IT_OVR ADC_IER_OVR /*!< ADC overrun interrupt source */
Kojto 109:9296ab0bfc11 1900 #define ADC_IT_JEOC ADC_IER_JEOC /*!< ADC End of Injected Conversion interrupt source */
Kojto 109:9296ab0bfc11 1901 #define ADC_IT_JEOS ADC_IER_JEOS /*!< ADC End of Injected sequence of Conversions interrupt source */
Kojto 109:9296ab0bfc11 1902 #define ADC_IT_AWD1 ADC_IER_AWD1 /*!< ADC Analog watchdog 1 interrupt source (main analog watchdog, present on all STM32 devices) */
Kojto 109:9296ab0bfc11 1903 #define ADC_IT_AWD2 ADC_IER_AWD2 /*!< ADC Analog watchdog 2 interrupt source (additional analog watchdog, present only on STM32F3 devices) */
Kojto 109:9296ab0bfc11 1904 #define ADC_IT_AWD3 ADC_IER_AWD3 /*!< ADC Analog watchdog 3 interrupt source (additional analog watchdog, present only on STM32F3 devices) */
Kojto 109:9296ab0bfc11 1905 #define ADC_IT_JQOVF ADC_IER_JQOVF /*!< ADC Injected Context Queue Overflow interrupt source */
Kojto 109:9296ab0bfc11 1906
Kojto 109:9296ab0bfc11 1907 #define ADC_IT_AWD ADC_IT_AWD1 /*!< ADC Analog watchdog 1 interrupt source: Naming for compatibility with other STM32 devices having only 1 analog watchdog */
Kojto 109:9296ab0bfc11 1908
Kojto 109:9296ab0bfc11 1909 /* Check of single flag */
Kojto 109:9296ab0bfc11 1910 #define IS_ADC_IT(IT) (((IT) == ADC_IT_RDY) || ((IT) == ADC_IT_EOSMP) || \
Kojto 109:9296ab0bfc11 1911 ((IT) == ADC_IT_EOC) || ((IT) == ADC_IT_EOS) || \
Kojto 109:9296ab0bfc11 1912 ((IT) == ADC_IT_OVR) || ((IT) == ADC_IT_EOS) || \
Kojto 109:9296ab0bfc11 1913 ((IT) == ADC_IT_JEOS) || ((IT) == ADC_IT_AWD1) || \
Kojto 109:9296ab0bfc11 1914 ((IT) == ADC_IT_AWD2) || ((IT) == ADC_IT_AWD3) || \
Kojto 109:9296ab0bfc11 1915 ((IT) == ADC_IT_JQOVF) )
Kojto 109:9296ab0bfc11 1916 /**
Kojto 109:9296ab0bfc11 1917 * @}
Kojto 109:9296ab0bfc11 1918 */
Kojto 109:9296ab0bfc11 1919
Kojto 109:9296ab0bfc11 1920 /** @defgroup ADCEx_flags_definition ADC Extended Flags Definition
Kojto 109:9296ab0bfc11 1921 * @{
Kojto 109:9296ab0bfc11 1922 */
Kojto 109:9296ab0bfc11 1923 #define ADC_FLAG_RDY ADC_ISR_ADRD /*!< ADC Ready (ADRDY) flag */
Kojto 109:9296ab0bfc11 1924 #define ADC_FLAG_EOSMP ADC_ISR_EOSMP /*!< ADC End of Sampling flag */
Kojto 109:9296ab0bfc11 1925 #define ADC_FLAG_EOC ADC_ISR_EOC /*!< ADC End of Regular Conversion flag */
Kojto 109:9296ab0bfc11 1926 #define ADC_FLAG_EOS ADC_ISR_EOS /*!< ADC End of Regular sequence of Conversions flag */
Kojto 109:9296ab0bfc11 1927 #define ADC_FLAG_OVR ADC_ISR_OVR /*!< ADC overrun flag */
Kojto 109:9296ab0bfc11 1928 #define ADC_FLAG_JEOC ADC_ISR_JEOC /*!< ADC End of Injected Conversion flag */
Kojto 109:9296ab0bfc11 1929 #define ADC_FLAG_JEOS ADC_ISR_JEOS /*!< ADC End of Injected sequence of Conversions flag */
Kojto 109:9296ab0bfc11 1930 #define ADC_FLAG_AWD1 ADC_ISR_AWD1 /*!< ADC Analog watchdog 1 flag (main analog watchdog, present on all STM32 devices) */
Kojto 109:9296ab0bfc11 1931 #define ADC_FLAG_AWD2 ADC_ISR_AWD2 /*!< ADC Analog watchdog 2 flag (additional analog watchdog, present only on STM32F3 devices) */
Kojto 109:9296ab0bfc11 1932 #define ADC_FLAG_AWD3 ADC_ISR_AWD3 /*!< ADC Analog watchdog 3 flag (additional analog watchdog, present only on STM32F3 devices) */
Kojto 109:9296ab0bfc11 1933 #define ADC_FLAG_JQOVF ADC_ISR_JQOVF /*!< ADC Injected Context Queue Overflow flag */
Kojto 109:9296ab0bfc11 1934
Kojto 109:9296ab0bfc11 1935 #define ADC_FLAG_AWD ADC_FLAG_AWD1 /*!< ADC Analog watchdog 1 flag: Naming for compatibility with other STM32 devices having only 1 analog watchdog */
Kojto 109:9296ab0bfc11 1936
Kojto 109:9296ab0bfc11 1937 #define ADC_FLAG_ALL (ADC_FLAG_RDY | ADC_FLAG_EOSMP | ADC_FLAG_EOC | ADC_FLAG_EOS | \
Kojto 109:9296ab0bfc11 1938 ADC_FLAG_JEOC | ADC_FLAG_JEOS | ADC_FLAG_OVR | ADC_FLAG_AWD1 | \
Kojto 109:9296ab0bfc11 1939 ADC_FLAG_AWD2 | ADC_FLAG_AWD3 | ADC_FLAG_JQOVF)
Kojto 109:9296ab0bfc11 1940
Kojto 109:9296ab0bfc11 1941 /* Combination of all post-conversion flags bits: EOC/EOS, JEOC/JEOS, OVR, AWDx */
Kojto 109:9296ab0bfc11 1942 #define ADC_FLAG_POSTCONV_ALL (ADC_FLAG_EOC | ADC_FLAG_EOS | ADC_FLAG_JEOC | ADC_FLAG_JEOS | \
Kojto 109:9296ab0bfc11 1943 ADC_FLAG_OVR | ADC_FLAG_AWD1 | ADC_FLAG_AWD2 | ADC_FLAG_AWD3 | \
Kojto 109:9296ab0bfc11 1944 ADC_FLAG_JQOVF)
Kojto 109:9296ab0bfc11 1945
Kojto 109:9296ab0bfc11 1946 /* Check of single flag */
Kojto 109:9296ab0bfc11 1947 #define IS_ADC_FLAG(FLAG) (((FLAG) == ADC_FLAG_RDY) || ((FLAG) == ADC_FLAG_EOSMP) || \
Kojto 109:9296ab0bfc11 1948 ((FLAG) == ADC_FLAG_EOC) || ((FLAG) == ADC_FLAG_EOS) || \
Kojto 109:9296ab0bfc11 1949 ((FLAG) == ADC_FLAG_OVR) || ((FLAG) == ADC_FLAG_JEOC) || \
Kojto 109:9296ab0bfc11 1950 ((FLAG) == ADC_FLAG_JEOS) || ((FLAG) == ADC_FLAG_AWD1) || \
Kojto 109:9296ab0bfc11 1951 ((FLAG) == ADC_FLAG_AWD2) || ((FLAG) == ADC_FLAG_AWD3) || \
Kojto 109:9296ab0bfc11 1952 ((FLAG) == ADC_FLAG_JQOVF) )
Kojto 109:9296ab0bfc11 1953 /**
Kojto 109:9296ab0bfc11 1954 * @}
Kojto 109:9296ab0bfc11 1955 */
Kojto 109:9296ab0bfc11 1956
Kojto 109:9296ab0bfc11 1957 /** @defgroup ADC_multimode_bits ADC Multimode Bits
Kojto 109:9296ab0bfc11 1958 * @{
Kojto 109:9296ab0bfc11 1959 */
Kojto 109:9296ab0bfc11 1960 #if defined(STM32F302xE) || defined(STM32F303xE) || defined(STM32F398xx) || \
Kojto 109:9296ab0bfc11 1961 defined(STM32F302xC) || defined(STM32F303xC) || defined(STM32F358xx) || \
Kojto 109:9296ab0bfc11 1962 defined(STM32F303x8) || defined(STM32F334x8) || defined(STM32F328xx)
Kojto 109:9296ab0bfc11 1963 #define ADC_CCR_MULTI ADC12_CCR_MULTI /*!< Multi ADC mode selection */
Kojto 109:9296ab0bfc11 1964 #define ADC_CCR_MULTI_0 ADC12_CCR_MULTI_0 /*!< MULTI bit 0 */
Kojto 109:9296ab0bfc11 1965 #define ADC_CCR_MULTI_1 ADC12_CCR_MULTI_1 /*!< MULTI bit 1 */
Kojto 109:9296ab0bfc11 1966 #define ADC_CCR_MULTI_2 ADC12_CCR_MULTI_2 /*!< MULTI bit 2 */
Kojto 109:9296ab0bfc11 1967 #define ADC_CCR_MULTI_3 ADC12_CCR_MULTI_3 /*!< MULTI bit 3 */
Kojto 109:9296ab0bfc11 1968 #define ADC_CCR_MULTI_4 ADC12_CCR_MULTI_4 /*!< MULTI bit 4 */
Kojto 109:9296ab0bfc11 1969 #define ADC_CCR_DELAY ADC12_CCR_DELAY /*!< Delay between 2 sampling phases */
Kojto 109:9296ab0bfc11 1970 #define ADC_CCR_DELAY_0 ADC12_CCR_DELAY_0 /*!< DELAY bit 0 */
Kojto 109:9296ab0bfc11 1971 #define ADC_CCR_DELAY_1 ADC12_CCR_DELAY_1 /*!< DELAY bit 1 */
Kojto 109:9296ab0bfc11 1972 #define ADC_CCR_DELAY_2 ADC12_CCR_DELAY_2 /*!< DELAY bit 2 */
Kojto 109:9296ab0bfc11 1973 #define ADC_CCR_DELAY_3 ADC12_CCR_DELAY_3 /*!< DELAY bit 3 */
Kojto 109:9296ab0bfc11 1974 #define ADC_CCR_DMACFG ADC12_CCR_DMACFG /*!< DMA configuration for multi-ADC mode */
Kojto 109:9296ab0bfc11 1975 #define ADC_CCR_MDMA ADC12_CCR_MDMA /*!< DMA mode for multi-ADC mode */
Kojto 109:9296ab0bfc11 1976 #define ADC_CCR_MDMA_0 ADC12_CCR_MDMA_0 /*!< MDMA bit 0 */
Kojto 109:9296ab0bfc11 1977 #define ADC_CCR_MDMA_1 ADC12_CCR_MDMA_1 /*!< MDMA bit 1 */
Kojto 109:9296ab0bfc11 1978 #define ADC_CCR_CKMODE ADC12_CCR_CKMODE /*!< ADC clock mode */
Kojto 109:9296ab0bfc11 1979 #define ADC_CCR_CKMODE_0 ADC12_CCR_CKMODE_0 /*!< CKMODE bit 0 */
Kojto 109:9296ab0bfc11 1980 #define ADC_CCR_CKMODE_1 ADC12_CCR_CKMODE_1 /*!< CKMODE bit 1 */
Kojto 109:9296ab0bfc11 1981 #define ADC_CCR_VREFEN ADC12_CCR_VREFEN /*!< VREFINT enable */
Kojto 109:9296ab0bfc11 1982 #define ADC_CCR_TSEN ADC12_CCR_TSEN /*!< Temperature sensor enable */
Kojto 109:9296ab0bfc11 1983 #define ADC_CCR_VBATEN ADC12_CCR_VBATEN /*!< VBAT enable */
Kojto 109:9296ab0bfc11 1984 #endif /* STM32F302xE || STM32F303xE || STM32F398xx || */
Kojto 109:9296ab0bfc11 1985 /* STM32F302xC || STM32F303xC || STM32F358xx || */
Kojto 109:9296ab0bfc11 1986 /* STM32F303x8 || STM32F334x8 || STM32F328xx */
Kojto 109:9296ab0bfc11 1987
Kojto 109:9296ab0bfc11 1988 #if defined(STM32F301x8) || defined(STM32F302x8) || defined(STM32F318xx)
Kojto 109:9296ab0bfc11 1989 #define ADC_CCR_MULTI ADC1_CCR_MULTI /*!< Multi ADC mode selection */
Kojto 109:9296ab0bfc11 1990 #define ADC_CCR_MULTI_0 ADC1_CCR_MULTI_0 /*!< MULTI bit 0 */
Kojto 109:9296ab0bfc11 1991 #define ADC_CCR_MULTI_1 ADC1_CCR_MULTI_1 /*!< MULTI bit 1 */
Kojto 109:9296ab0bfc11 1992 #define ADC_CCR_MULTI_2 ADC1_CCR_MULTI_2 /*!< MULTI bit 2 */
Kojto 109:9296ab0bfc11 1993 #define ADC_CCR_MULTI_3 ADC1_CCR_MULTI_3 /*!< MULTI bit 3 */
Kojto 109:9296ab0bfc11 1994 #define ADC_CCR_MULTI_4 ADC1_CCR_MULTI_4 /*!< MULTI bit 4 */
Kojto 109:9296ab0bfc11 1995 #define ADC_CCR_DELAY ADC1_CCR_DELAY /*!< Delay between 2 sampling phases */
Kojto 109:9296ab0bfc11 1996 #define ADC_CCR_DELAY_0 ADC1_CCR_DELAY_0 /*!< DELAY bit 0 */
Kojto 109:9296ab0bfc11 1997 #define ADC_CCR_DELAY_1 ADC1_CCR_DELAY_1 /*!< DELAY bit 1 */
Kojto 109:9296ab0bfc11 1998 #define ADC_CCR_DELAY_2 ADC1_CCR_DELAY_2 /*!< DELAY bit 2 */
Kojto 109:9296ab0bfc11 1999 #define ADC_CCR_DELAY_3 ADC1_CCR_DELAY_3 /*!< DELAY bit 3 */
Kojto 109:9296ab0bfc11 2000 #define ADC_CCR_DMACFG ADC1_CCR_DMACFG /*!< DMA configuration for multi-ADC mode */
Kojto 109:9296ab0bfc11 2001 #define ADC_CCR_MDMA ADC1_CCR_MDMA /*!< DMA mode for multi-ADC mode */
Kojto 109:9296ab0bfc11 2002 #define ADC_CCR_MDMA_0 ADC1_CCR_MDMA_0 /*!< MDMA bit 0 */
Kojto 109:9296ab0bfc11 2003 #define ADC_CCR_MDMA_1 ADC1_CCR_MDMA_1 /*!< MDMA bit 1 */
Kojto 109:9296ab0bfc11 2004 #define ADC_CCR_CKMODE ADC1_CCR_CKMODE /*!< ADC clock mode */
Kojto 109:9296ab0bfc11 2005 #define ADC_CCR_CKMODE_0 ADC1_CCR_CKMODE_0 /*!< CKMODE bit 0 */
Kojto 109:9296ab0bfc11 2006 #define ADC_CCR_CKMODE_1 ADC1_CCR_CKMODE_1 /*!< CKMODE bit 1 */
Kojto 109:9296ab0bfc11 2007 #define ADC_CCR_VREFEN ADC1_CCR_VREFEN /*!< VREFINT enable */
Kojto 109:9296ab0bfc11 2008 #define ADC_CCR_TSEN ADC1_CCR_TSEN /*!< Temperature sensor enable */
Kojto 109:9296ab0bfc11 2009 #define ADC_CCR_VBATEN ADC1_CCR_VBATEN /*!< VBAT enable */
Kojto 109:9296ab0bfc11 2010 #endif /* STM32F301x8 || STM32F302x8 || STM32F318xx */
Kojto 109:9296ab0bfc11 2011
Kojto 109:9296ab0bfc11 2012
Kojto 109:9296ab0bfc11 2013 /**
Kojto 109:9296ab0bfc11 2014 * @}
Kojto 109:9296ab0bfc11 2015 */
Kojto 109:9296ab0bfc11 2016
Kojto 109:9296ab0bfc11 2017 /** @defgroup ADCEx_range_verification ADC Extended Range Verification
Kojto 109:9296ab0bfc11 2018 * in function of ADC resolution selected (12, 10, 8 or 6 bits)
Kojto 109:9296ab0bfc11 2019 * @{
Kojto 109:9296ab0bfc11 2020 */
Kojto 109:9296ab0bfc11 2021 #define IS_ADC_RANGE(RESOLUTION, ADC_VALUE) \
Kojto 109:9296ab0bfc11 2022 ((((RESOLUTION) == ADC_RESOLUTION12b) && ((ADC_VALUE) <= ((uint32_t)0x0FFF))) || \
Kojto 109:9296ab0bfc11 2023 (((RESOLUTION) == ADC_RESOLUTION10b) && ((ADC_VALUE) <= ((uint32_t)0x03FF))) || \
Kojto 109:9296ab0bfc11 2024 (((RESOLUTION) == ADC_RESOLUTION8b) && ((ADC_VALUE) <= ((uint32_t)0x00FF))) || \
Kojto 109:9296ab0bfc11 2025 (((RESOLUTION) == ADC_RESOLUTION6b) && ((ADC_VALUE) <= ((uint32_t)0x003F))) )
Kojto 109:9296ab0bfc11 2026 /**
Kojto 109:9296ab0bfc11 2027 * @}
Kojto 109:9296ab0bfc11 2028 */
Kojto 109:9296ab0bfc11 2029
Kojto 109:9296ab0bfc11 2030 /** @defgroup ADC_injected_nb_conv_verification ADC Injected Conversion Number Verification
Kojto 109:9296ab0bfc11 2031 * @{
Kojto 109:9296ab0bfc11 2032 */
Kojto 109:9296ab0bfc11 2033 #define IS_ADC_INJECTED_NB_CONV(LENGTH) (((LENGTH) >= ((uint32_t)1)) && ((LENGTH) <= ((uint32_t)4)))
Kojto 109:9296ab0bfc11 2034 /**
Kojto 109:9296ab0bfc11 2035 * @}
Kojto 109:9296ab0bfc11 2036 */
Kojto 109:9296ab0bfc11 2037
Kojto 109:9296ab0bfc11 2038 /** @defgroup ADC_regular_nb_conv_verification ADC Regular Conversion Number Verification
Kojto 109:9296ab0bfc11 2039 * @{
Kojto 109:9296ab0bfc11 2040 */
Kojto 109:9296ab0bfc11 2041 #define IS_ADC_REGULAR_NB_CONV(LENGTH) (((LENGTH) >= ((uint32_t)1)) && ((LENGTH) <= ((uint32_t)16)))
Kojto 109:9296ab0bfc11 2042 /**
Kojto 109:9296ab0bfc11 2043 * @}
Kojto 109:9296ab0bfc11 2044 */
Kojto 109:9296ab0bfc11 2045
Kojto 109:9296ab0bfc11 2046 /** @defgroup ADC_regular_discontinuous_mode_number_verification ADC Regular Discontinuous Mode NumberVerification
Kojto 109:9296ab0bfc11 2047 * @{
Kojto 109:9296ab0bfc11 2048 */
Kojto 109:9296ab0bfc11 2049 #define IS_ADC_REGULAR_DISCONT_NUMBER(NUMBER) (((NUMBER) >= ((uint32_t)1)) && ((NUMBER) <= ((uint32_t)8)))
Kojto 109:9296ab0bfc11 2050 /**
Kojto 109:9296ab0bfc11 2051 * @}
Kojto 109:9296ab0bfc11 2052 */
Kojto 109:9296ab0bfc11 2053
Kojto 109:9296ab0bfc11 2054 /** @defgroup ADC_calibration_factor_length_verification ADC Calibration Factor Length Verification
Kojto 109:9296ab0bfc11 2055 * @{
Kojto 109:9296ab0bfc11 2056 */
Kojto 109:9296ab0bfc11 2057 /**
Kojto 109:9296ab0bfc11 2058 * @brief Calibration factor length verification (7 bits maximum)
Kojto 109:9296ab0bfc11 2059 * @param _Calibration_Factor_: Calibration factor value
Kojto 109:9296ab0bfc11 2060 * @retval None
Kojto 109:9296ab0bfc11 2061 */
Kojto 109:9296ab0bfc11 2062 #define IS_ADC_CALFACT(_Calibration_Factor_) ((_Calibration_Factor_) <= ((uint32_t)0x7F))
Kojto 109:9296ab0bfc11 2063 /**
Kojto 109:9296ab0bfc11 2064 * @}
Kojto 109:9296ab0bfc11 2065 */
Kojto 109:9296ab0bfc11 2066 #endif /* STM32F302xE || STM32F303xE || STM32F398xx || */
Kojto 109:9296ab0bfc11 2067 /* STM32F302xC || STM32F303xC || STM32F358xx || */
Kojto 109:9296ab0bfc11 2068 /* STM32F303x8 || STM32F334x8 || STM32F328xx || */
Kojto 109:9296ab0bfc11 2069 /* STM32F301x8 || STM32F302x8 || STM32F318xx */
Kojto 109:9296ab0bfc11 2070
Kojto 109:9296ab0bfc11 2071
Kojto 109:9296ab0bfc11 2072 #if defined(STM32F373xC) || defined(STM32F378xx)
Kojto 109:9296ab0bfc11 2073 /** @defgroup ADCEx_Data_align ADC Extended Data Alignment
Kojto 109:9296ab0bfc11 2074 * @{
Kojto 109:9296ab0bfc11 2075 */
Kojto 109:9296ab0bfc11 2076 #define ADC_DATAALIGN_RIGHT ((uint32_t)0x00000000)
Kojto 109:9296ab0bfc11 2077 #define ADC_DATAALIGN_LEFT ((uint32_t)ADC_CR2_ALIGN)
Kojto 109:9296ab0bfc11 2078
Kojto 109:9296ab0bfc11 2079 #define IS_ADC_DATA_ALIGN(ALIGN) (((ALIGN) == ADC_DATAALIGN_RIGHT) || \
Kojto 109:9296ab0bfc11 2080 ((ALIGN) == ADC_DATAALIGN_LEFT) )
Kojto 109:9296ab0bfc11 2081 /**
Kojto 109:9296ab0bfc11 2082 * @}
Kojto 109:9296ab0bfc11 2083 */
Kojto 109:9296ab0bfc11 2084
Kojto 109:9296ab0bfc11 2085 /** @defgroup ADCEx_Scan_mode ADC Extended Scan Mode
Kojto 109:9296ab0bfc11 2086 * @{
Kojto 109:9296ab0bfc11 2087 */
Kojto 109:9296ab0bfc11 2088 #define ADC_SCAN_DISABLE ((uint32_t)0x00000000)
Kojto 109:9296ab0bfc11 2089 #define ADC_SCAN_ENABLE ((uint32_t)0x00000001)
Kojto 109:9296ab0bfc11 2090
Kojto 109:9296ab0bfc11 2091 #define IS_ADC_SCAN_MODE(SCAN_MODE) (((SCAN_MODE) == ADC_SCAN_DISABLE) || \
Kojto 109:9296ab0bfc11 2092 ((SCAN_MODE) == ADC_SCAN_ENABLE) )
Kojto 109:9296ab0bfc11 2093 /**
Kojto 109:9296ab0bfc11 2094 * @}
Kojto 109:9296ab0bfc11 2095 */
Kojto 109:9296ab0bfc11 2096
Kojto 109:9296ab0bfc11 2097 /** @defgroup ADCEx_External_trigger_edge_Regular ADC Extended External trigger enable for regular channels
Kojto 109:9296ab0bfc11 2098 * @{
Kojto 109:9296ab0bfc11 2099 */
Kojto 109:9296ab0bfc11 2100 #define ADC_EXTERNALTRIGCONVEDGE_NONE ((uint32_t)0x00000000)
Kojto 109:9296ab0bfc11 2101 #define ADC_EXTERNALTRIGCONVEDGE_RISING ((uint32_t)ADC_CR2_EXTTRIG)
Kojto 109:9296ab0bfc11 2102
Kojto 109:9296ab0bfc11 2103 #define IS_ADC_EXTTRIG_EDGE(EDGE) (((EDGE) == ADC_EXTERNALTRIGCONVEDGE_NONE) || \
Kojto 109:9296ab0bfc11 2104 ((EDGE) == ADC_EXTERNALTRIGCONVEDGE_RISING) )
Kojto 109:9296ab0bfc11 2105 /**
Kojto 109:9296ab0bfc11 2106 * @}
Kojto 109:9296ab0bfc11 2107 */
Kojto 109:9296ab0bfc11 2108
Kojto 109:9296ab0bfc11 2109 /** @defgroup ADCEx_External_trigger_source_Regular ADC Extended External trigger selection for regular group
Kojto 109:9296ab0bfc11 2110 * @{
Kojto 109:9296ab0bfc11 2111 */
Kojto 109:9296ab0bfc11 2112 /* List of external triggers with generic trigger name, sorted by trigger */
Kojto 109:9296ab0bfc11 2113 /* name: */
Kojto 109:9296ab0bfc11 2114
Kojto 109:9296ab0bfc11 2115 /* External triggers of regular group for ADC1 */
Kojto 109:9296ab0bfc11 2116 #define ADC_EXTERNALTRIGCONV_T2_CC2 ADC_EXTERNALTRIG_T2_CC2
Kojto 109:9296ab0bfc11 2117 #define ADC_EXTERNALTRIGCONV_T3_TRGO ADC_EXTERNALTRIG_T3_TRGO
Kojto 109:9296ab0bfc11 2118 #define ADC_EXTERNALTRIGCONV_T4_CC2 ADC_EXTERNALTRIG_T4_CC2
Kojto 109:9296ab0bfc11 2119 #define ADC_EXTERNALTRIGCONV_T19_TRGO ADC_EXTERNALTRIG_T19_TRGO
Kojto 109:9296ab0bfc11 2120 #define ADC_EXTERNALTRIGCONV_T19_CC3 ADC_EXTERNALTRIG_T19_CC3
Kojto 109:9296ab0bfc11 2121 #define ADC_EXTERNALTRIGCONV_T19_CC4 ADC_EXTERNALTRIG_T19_CC4
Kojto 109:9296ab0bfc11 2122 #define ADC_EXTERNALTRIGCONV_EXT_IT11 ADC_EXTERNALTRIG_EXT_IT11
Kojto 109:9296ab0bfc11 2123 #define ADC_SOFTWARE_START ADC_SWSTART
Kojto 109:9296ab0bfc11 2124
Kojto 109:9296ab0bfc11 2125 #define IS_ADC_EXTTRIG(REGTRIG) (((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_CC2) || \
Kojto 109:9296ab0bfc11 2126 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T3_TRGO) || \
Kojto 109:9296ab0bfc11 2127 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T4_CC2) || \
Kojto 109:9296ab0bfc11 2128 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T19_TRGO) || \
Kojto 109:9296ab0bfc11 2129 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T19_CC3) || \
Kojto 109:9296ab0bfc11 2130 ((REGTRIG) == ADC_EXTERNALTRIGCONV_T19_CC4) || \
Kojto 109:9296ab0bfc11 2131 ((REGTRIG) == ADC_EXTERNALTRIGCONV_EXT_IT11) || \
Kojto 109:9296ab0bfc11 2132 ((REGTRIG) == ADC_SOFTWARE_START) )
Kojto 109:9296ab0bfc11 2133 /**
Kojto 109:9296ab0bfc11 2134 * @}
Kojto 109:9296ab0bfc11 2135 */
Kojto 109:9296ab0bfc11 2136
Kojto 109:9296ab0bfc11 2137
Kojto 109:9296ab0bfc11 2138 /** @defgroup ADCEx_Internal_HAL_driver_Ext_trig_src_Regular ADC Extended External trigger selection for regular group (Used Internally)
Kojto 109:9296ab0bfc11 2139 * @{
Kojto 109:9296ab0bfc11 2140 */
Kojto 109:9296ab0bfc11 2141
Kojto 109:9296ab0bfc11 2142 /* List of external triggers of regular group for ADC1: */
Kojto 109:9296ab0bfc11 2143 /* (used internally by HAL driver. To not use into HAL structure parameters) */
Kojto 109:9296ab0bfc11 2144
Kojto 109:9296ab0bfc11 2145 /* External triggers of regular group for ADC1 */
Kojto 109:9296ab0bfc11 2146 #define ADC_EXTERNALTRIG_T19_TRGO ((uint32_t)0x00000000)
Kojto 109:9296ab0bfc11 2147 #define ADC_EXTERNALTRIG_T19_CC3 ((uint32_t)ADC_CR2_EXTSEL_0)
Kojto 109:9296ab0bfc11 2148 #define ADC_EXTERNALTRIG_T19_CC4 ((uint32_t)ADC_CR2_EXTSEL_1)
Kojto 109:9296ab0bfc11 2149 #define ADC_EXTERNALTRIG_T2_CC2 ((uint32_t)(ADC_CR2_EXTSEL_1 | ADC_CR2_EXTSEL_0))
Kojto 109:9296ab0bfc11 2150 #define ADC_EXTERNALTRIG_T3_TRGO ((uint32_t)ADC_CR2_EXTSEL_2)
Kojto 109:9296ab0bfc11 2151 #define ADC_EXTERNALTRIG_T4_CC2 ((uint32_t)(ADC_CR2_EXTSEL_2 | ADC_CR2_EXTSEL_0))
Kojto 109:9296ab0bfc11 2152 #define ADC_EXTERNALTRIG_EXT_IT11 ((uint32_t)(ADC_CR2_EXTSEL_2 | ADC_CR2_EXTSEL_1))
Kojto 109:9296ab0bfc11 2153 #define ADC_SWSTART ((uint32_t)(ADC_CR2_EXTSEL_2 | ADC_CR2_EXTSEL_1 | ADC_CR2_EXTSEL_0))
Kojto 109:9296ab0bfc11 2154
Kojto 109:9296ab0bfc11 2155 /**
Kojto 109:9296ab0bfc11 2156 * @}
Kojto 109:9296ab0bfc11 2157 */
Kojto 109:9296ab0bfc11 2158
Kojto 109:9296ab0bfc11 2159
Kojto 109:9296ab0bfc11 2160 /** @defgroup ADCEx_channels ADC Extended Channels
Kojto 109:9296ab0bfc11 2161 * @{
Kojto 109:9296ab0bfc11 2162 */
Kojto 109:9296ab0bfc11 2163 /* Note: Depending on devices, some channels may not be available on package */
Kojto 109:9296ab0bfc11 2164 /* pins. Refer to device datasheet for channels availability. */
Kojto 109:9296ab0bfc11 2165 #define ADC_CHANNEL_0 ((uint32_t)0x00000000)
Kojto 109:9296ab0bfc11 2166 #define ADC_CHANNEL_1 ((uint32_t)(ADC_SQR3_SQ1_0))
Kojto 109:9296ab0bfc11 2167 #define ADC_CHANNEL_2 ((uint32_t)(ADC_SQR3_SQ1_1))
Kojto 109:9296ab0bfc11 2168 #define ADC_CHANNEL_3 ((uint32_t)(ADC_SQR3_SQ1_1 | ADC_SQR3_SQ1_0))
Kojto 109:9296ab0bfc11 2169 #define ADC_CHANNEL_4 ((uint32_t)(ADC_SQR3_SQ1_2))
Kojto 109:9296ab0bfc11 2170 #define ADC_CHANNEL_5 ((uint32_t)(ADC_SQR3_SQ1_2 | ADC_SQR3_SQ1_0))
Kojto 109:9296ab0bfc11 2171 #define ADC_CHANNEL_6 ((uint32_t)(ADC_SQR3_SQ1_2 | ADC_SQR3_SQ1_1))
Kojto 109:9296ab0bfc11 2172 #define ADC_CHANNEL_7 ((uint32_t)(ADC_SQR3_SQ1_2 | ADC_SQR3_SQ1_1 | ADC_SQR3_SQ1_0))
Kojto 109:9296ab0bfc11 2173 #define ADC_CHANNEL_8 ((uint32_t)(ADC_SQR3_SQ1_3))
Kojto 109:9296ab0bfc11 2174 #define ADC_CHANNEL_9 ((uint32_t)(ADC_SQR3_SQ1_3 | ADC_SQR3_SQ1_0))
Kojto 109:9296ab0bfc11 2175 #define ADC_CHANNEL_10 ((uint32_t)(ADC_SQR3_SQ1_3 | ADC_SQR3_SQ1_1))
Kojto 109:9296ab0bfc11 2176 #define ADC_CHANNEL_11 ((uint32_t)(ADC_SQR3_SQ1_3 | ADC_SQR3_SQ1_1 | ADC_SQR3_SQ1_0))
Kojto 109:9296ab0bfc11 2177 #define ADC_CHANNEL_12 ((uint32_t)(ADC_SQR3_SQ1_3 | ADC_SQR3_SQ1_2))
Kojto 109:9296ab0bfc11 2178 #define ADC_CHANNEL_13 ((uint32_t)(ADC_SQR3_SQ1_3 | ADC_SQR3_SQ1_2 | ADC_SQR3_SQ1_0))
Kojto 109:9296ab0bfc11 2179 #define ADC_CHANNEL_14 ((uint32_t)(ADC_SQR3_SQ1_3 | ADC_SQR3_SQ1_2 | ADC_SQR3_SQ1_1))
Kojto 109:9296ab0bfc11 2180 #define ADC_CHANNEL_15 ((uint32_t)(ADC_SQR3_SQ1_3 | ADC_SQR3_SQ1_2 | ADC_SQR3_SQ1_1 | ADC_SQR3_SQ1_0))
Kojto 109:9296ab0bfc11 2181 #define ADC_CHANNEL_16 ((uint32_t)(ADC_SQR3_SQ1_4))
Kojto 109:9296ab0bfc11 2182 #define ADC_CHANNEL_17 ((uint32_t)(ADC_SQR3_SQ1_4 | ADC_SQR3_SQ1_0))
Kojto 109:9296ab0bfc11 2183 #define ADC_CHANNEL_18 ((uint32_t)(ADC_SQR3_SQ1_4 | ADC_SQR3_SQ1_1))
Kojto 109:9296ab0bfc11 2184
Kojto 109:9296ab0bfc11 2185 #define ADC_CHANNEL_TEMPSENSOR ADC_CHANNEL_16
Kojto 109:9296ab0bfc11 2186 #define ADC_CHANNEL_VREFINT ADC_CHANNEL_17
Kojto 109:9296ab0bfc11 2187 #define ADC_CHANNEL_VBAT ADC_CHANNEL_18
Kojto 109:9296ab0bfc11 2188
Kojto 109:9296ab0bfc11 2189 #define IS_ADC_CHANNEL(CHANNEL) (((CHANNEL) == ADC_CHANNEL_0) || \
Kojto 109:9296ab0bfc11 2190 ((CHANNEL) == ADC_CHANNEL_1) || \
Kojto 109:9296ab0bfc11 2191 ((CHANNEL) == ADC_CHANNEL_2) || \
Kojto 109:9296ab0bfc11 2192 ((CHANNEL) == ADC_CHANNEL_3) || \
Kojto 109:9296ab0bfc11 2193 ((CHANNEL) == ADC_CHANNEL_4) || \
Kojto 109:9296ab0bfc11 2194 ((CHANNEL) == ADC_CHANNEL_5) || \
Kojto 109:9296ab0bfc11 2195 ((CHANNEL) == ADC_CHANNEL_6) || \
Kojto 109:9296ab0bfc11 2196 ((CHANNEL) == ADC_CHANNEL_7) || \
Kojto 109:9296ab0bfc11 2197 ((CHANNEL) == ADC_CHANNEL_8) || \
Kojto 109:9296ab0bfc11 2198 ((CHANNEL) == ADC_CHANNEL_9) || \
Kojto 109:9296ab0bfc11 2199 ((CHANNEL) == ADC_CHANNEL_10) || \
Kojto 109:9296ab0bfc11 2200 ((CHANNEL) == ADC_CHANNEL_11) || \
Kojto 109:9296ab0bfc11 2201 ((CHANNEL) == ADC_CHANNEL_12) || \
Kojto 109:9296ab0bfc11 2202 ((CHANNEL) == ADC_CHANNEL_13) || \
Kojto 109:9296ab0bfc11 2203 ((CHANNEL) == ADC_CHANNEL_14) || \
Kojto 109:9296ab0bfc11 2204 ((CHANNEL) == ADC_CHANNEL_15) || \
Kojto 109:9296ab0bfc11 2205 ((CHANNEL) == ADC_CHANNEL_TEMPSENSOR) || \
Kojto 109:9296ab0bfc11 2206 ((CHANNEL) == ADC_CHANNEL_VREFINT) || \
Kojto 109:9296ab0bfc11 2207 ((CHANNEL) == ADC_CHANNEL_VBAT) )
Kojto 109:9296ab0bfc11 2208 /**
Kojto 109:9296ab0bfc11 2209 * @}
Kojto 109:9296ab0bfc11 2210 */
Kojto 109:9296ab0bfc11 2211
Kojto 109:9296ab0bfc11 2212 /** @defgroup ADCEx_sampling_times ADC Extended Sampling Times
Kojto 109:9296ab0bfc11 2213 * @{
Kojto 109:9296ab0bfc11 2214 */
Kojto 109:9296ab0bfc11 2215 #define ADC_SAMPLETIME_1CYCLE_5 ((uint32_t)0x00000000) /*!< Sampling time 1.5 ADC clock cycle */
Kojto 109:9296ab0bfc11 2216 #define ADC_SAMPLETIME_7CYCLES_5 ((uint32_t) ADC_SMPR2_SMP0_0) /*!< Sampling time 7.5 ADC clock cycles */
Kojto 109:9296ab0bfc11 2217 #define ADC_SAMPLETIME_13CYCLES_5 ((uint32_t) ADC_SMPR2_SMP0_1) /*!< Sampling time 13.5 ADC clock cycles */
Kojto 109:9296ab0bfc11 2218 #define ADC_SAMPLETIME_28CYCLES_5 ((uint32_t)(ADC_SMPR2_SMP0_1 | ADC_SMPR2_SMP0_0)) /*!< Sampling time 28.5 ADC clock cycles */
Kojto 109:9296ab0bfc11 2219 #define ADC_SAMPLETIME_41CYCLES_5 ((uint32_t) ADC_SMPR2_SMP0_2) /*!< Sampling time 41.5 ADC clock cycles */
Kojto 109:9296ab0bfc11 2220 #define ADC_SAMPLETIME_55CYCLES_5 ((uint32_t)(ADC_SMPR2_SMP0_2 | ADC_SMPR2_SMP0_0)) /*!< Sampling time 55.5 ADC clock cycles */
Kojto 109:9296ab0bfc11 2221 #define ADC_SAMPLETIME_71CYCLES_5 ((uint32_t)(ADC_SMPR2_SMP0_2 | ADC_SMPR2_SMP0_1)) /*!< Sampling time 71.5 ADC clock cycles */
Kojto 109:9296ab0bfc11 2222 #define ADC_SAMPLETIME_239CYCLES_5 ((uint32_t) ADC_SMPR2_SMP0) /*!< Sampling time 239.5 ADC clock cycles */
Kojto 109:9296ab0bfc11 2223
Kojto 109:9296ab0bfc11 2224 #define IS_ADC_SAMPLE_TIME(TIME) (((TIME) == ADC_SAMPLETIME_1CYCLE_5) || \
Kojto 109:9296ab0bfc11 2225 ((TIME) == ADC_SAMPLETIME_7CYCLES_5) || \
Kojto 109:9296ab0bfc11 2226 ((TIME) == ADC_SAMPLETIME_13CYCLES_5) || \
Kojto 109:9296ab0bfc11 2227 ((TIME) == ADC_SAMPLETIME_28CYCLES_5) || \
Kojto 109:9296ab0bfc11 2228 ((TIME) == ADC_SAMPLETIME_41CYCLES_5) || \
Kojto 109:9296ab0bfc11 2229 ((TIME) == ADC_SAMPLETIME_55CYCLES_5) || \
Kojto 109:9296ab0bfc11 2230 ((TIME) == ADC_SAMPLETIME_71CYCLES_5) || \
Kojto 109:9296ab0bfc11 2231 ((TIME) == ADC_SAMPLETIME_239CYCLES_5) )
Kojto 109:9296ab0bfc11 2232 /**
Kojto 109:9296ab0bfc11 2233 * @}
Kojto 109:9296ab0bfc11 2234 */
Kojto 109:9296ab0bfc11 2235
Kojto 109:9296ab0bfc11 2236 /** @defgroup ADCEx_sampling_times_all_channels ADC Extended Sampling Times All Channels
Kojto 109:9296ab0bfc11 2237 * @{
Kojto 109:9296ab0bfc11 2238 */
Kojto 109:9296ab0bfc11 2239 #define ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT2 \
Kojto 109:9296ab0bfc11 2240 (ADC_SMPR2_SMP9_2 | ADC_SMPR2_SMP8_2 | ADC_SMPR2_SMP7_2 | ADC_SMPR2_SMP6_2 | \
Kojto 109:9296ab0bfc11 2241 ADC_SMPR2_SMP5_2 | ADC_SMPR2_SMP4_2 | ADC_SMPR2_SMP3_2 | ADC_SMPR2_SMP2_2 | \
Kojto 109:9296ab0bfc11 2242 ADC_SMPR2_SMP1_2 | ADC_SMPR2_SMP0_2)
Kojto 109:9296ab0bfc11 2243 #define ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT2 \
Kojto 109:9296ab0bfc11 2244 (ADC_SMPR1_SMP17_2 | ADC_SMPR1_SMP16_2 | ADC_SMPR1_SMP15_2 | ADC_SMPR1_SMP14_2 | \
Kojto 109:9296ab0bfc11 2245 ADC_SMPR1_SMP13_2 | ADC_SMPR1_SMP12_2 | ADC_SMPR1_SMP11_2 | ADC_SMPR1_SMP10_2 )
Kojto 109:9296ab0bfc11 2246
Kojto 109:9296ab0bfc11 2247 #define ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT1 \
Kojto 109:9296ab0bfc11 2248 (ADC_SMPR2_SMP9_1 | ADC_SMPR2_SMP8_1 | ADC_SMPR2_SMP7_1 | ADC_SMPR2_SMP6_1 | \
Kojto 109:9296ab0bfc11 2249 ADC_SMPR2_SMP5_1 | ADC_SMPR2_SMP4_1 | ADC_SMPR2_SMP3_1 | ADC_SMPR2_SMP2_1 | \
Kojto 109:9296ab0bfc11 2250 ADC_SMPR2_SMP1_1 | ADC_SMPR2_SMP0_1)
Kojto 109:9296ab0bfc11 2251 #define ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT1 \
Kojto 109:9296ab0bfc11 2252 (ADC_SMPR1_SMP17_1 | ADC_SMPR1_SMP16_1 | ADC_SMPR1_SMP15_1 | ADC_SMPR1_SMP14_1 | \
Kojto 109:9296ab0bfc11 2253 ADC_SMPR1_SMP13_1 | ADC_SMPR1_SMP12_1 | ADC_SMPR1_SMP11_1 | ADC_SMPR1_SMP10_1 )
Kojto 109:9296ab0bfc11 2254
Kojto 109:9296ab0bfc11 2255 #define ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT0 \
Kojto 109:9296ab0bfc11 2256 (ADC_SMPR2_SMP9_0 | ADC_SMPR2_SMP8_0 | ADC_SMPR2_SMP7_0 | ADC_SMPR2_SMP6_0 | \
Kojto 109:9296ab0bfc11 2257 ADC_SMPR2_SMP5_0 | ADC_SMPR2_SMP4_0 | ADC_SMPR2_SMP3_0 | ADC_SMPR2_SMP2_0 | \
Kojto 109:9296ab0bfc11 2258 ADC_SMPR2_SMP1_0 | ADC_SMPR2_SMP0_0)
Kojto 109:9296ab0bfc11 2259 #define ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT0 \
Kojto 109:9296ab0bfc11 2260 (ADC_SMPR1_SMP17_0 | ADC_SMPR1_SMP16_0 | ADC_SMPR1_SMP15_0 | ADC_SMPR1_SMP14_0 | \
Kojto 109:9296ab0bfc11 2261 ADC_SMPR1_SMP13_0 | ADC_SMPR1_SMP12_0 | ADC_SMPR1_SMP11_0 | ADC_SMPR1_SMP10_0 )
Kojto 109:9296ab0bfc11 2262
Kojto 109:9296ab0bfc11 2263 #define ADC_SAMPLETIME_1CYCLE5_SMPR2ALLCHANNELS ((uint32_t)0x00000000)
Kojto 109:9296ab0bfc11 2264 #define ADC_SAMPLETIME_7CYCLES5_SMPR2ALLCHANNELS (ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT0)
Kojto 109:9296ab0bfc11 2265 #define ADC_SAMPLETIME_13CYCLES5_SMPR2ALLCHANNELS (ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT1)
Kojto 109:9296ab0bfc11 2266 #define ADC_SAMPLETIME_28CYCLES5_SMPR2ALLCHANNELS (ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT1 | ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT0)
Kojto 109:9296ab0bfc11 2267 #define ADC_SAMPLETIME_41CYCLES5_SMPR2ALLCHANNELS (ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT2)
Kojto 109:9296ab0bfc11 2268 #define ADC_SAMPLETIME_55CYCLES5_SMPR2ALLCHANNELS (ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT2 | ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT0)
Kojto 109:9296ab0bfc11 2269 #define ADC_SAMPLETIME_71CYCLES5_SMPR2ALLCHANNELS (ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT2 | ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT1)
Kojto 109:9296ab0bfc11 2270 #define ADC_SAMPLETIME_239CYCLES5_SMPR2ALLCHANNELS (ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT2 | ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT1 | ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT0)
Kojto 109:9296ab0bfc11 2271
Kojto 109:9296ab0bfc11 2272 #define ADC_SAMPLETIME_1CYCLE5_SMPR1ALLCHANNELS ((uint32_t)0x00000000)
Kojto 109:9296ab0bfc11 2273 #define ADC_SAMPLETIME_7CYCLES5_SMPR1ALLCHANNELS (ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT0)
Kojto 109:9296ab0bfc11 2274 #define ADC_SAMPLETIME_13CYCLES5_SMPR1ALLCHANNELS (ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT1)
Kojto 109:9296ab0bfc11 2275 #define ADC_SAMPLETIME_28CYCLES5_SMPR1ALLCHANNELS (ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT1 | ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT0)
Kojto 109:9296ab0bfc11 2276 #define ADC_SAMPLETIME_41CYCLES5_SMPR1ALLCHANNELS (ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT2)
Kojto 109:9296ab0bfc11 2277 #define ADC_SAMPLETIME_55CYCLES5_SMPR1ALLCHANNELS (ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT2 | ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT0)
Kojto 109:9296ab0bfc11 2278 #define ADC_SAMPLETIME_71CYCLES5_SMPR1ALLCHANNELS (ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT2 | ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT1)
Kojto 109:9296ab0bfc11 2279 #define ADC_SAMPLETIME_239CYCLES5_SMPR1ALLCHANNELS (ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT2 | ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT1 | ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT0)
Kojto 109:9296ab0bfc11 2280
Kojto 109:9296ab0bfc11 2281 /**
Kojto 109:9296ab0bfc11 2282 * @}
Kojto 109:9296ab0bfc11 2283 */
Kojto 109:9296ab0bfc11 2284
Kojto 109:9296ab0bfc11 2285 /** @defgroup ADCEx_regular_rank ADC Extended Regular Channel Rank
Kojto 109:9296ab0bfc11 2286 * @{
Kojto 109:9296ab0bfc11 2287 */
Kojto 109:9296ab0bfc11 2288 #define ADC_REGULAR_RANK_1 ((uint32_t)0x00000001)
Kojto 109:9296ab0bfc11 2289 #define ADC_REGULAR_RANK_2 ((uint32_t)0x00000002)
Kojto 109:9296ab0bfc11 2290 #define ADC_REGULAR_RANK_3 ((uint32_t)0x00000003)
Kojto 109:9296ab0bfc11 2291 #define ADC_REGULAR_RANK_4 ((uint32_t)0x00000004)
Kojto 109:9296ab0bfc11 2292 #define ADC_REGULAR_RANK_5 ((uint32_t)0x00000005)
Kojto 109:9296ab0bfc11 2293 #define ADC_REGULAR_RANK_6 ((uint32_t)0x00000006)
Kojto 109:9296ab0bfc11 2294 #define ADC_REGULAR_RANK_7 ((uint32_t)0x00000007)
Kojto 109:9296ab0bfc11 2295 #define ADC_REGULAR_RANK_8 ((uint32_t)0x00000008)
Kojto 109:9296ab0bfc11 2296 #define ADC_REGULAR_RANK_9 ((uint32_t)0x00000009)
Kojto 109:9296ab0bfc11 2297 #define ADC_REGULAR_RANK_10 ((uint32_t)0x0000000A)
Kojto 109:9296ab0bfc11 2298 #define ADC_REGULAR_RANK_11 ((uint32_t)0x0000000B)
Kojto 109:9296ab0bfc11 2299 #define ADC_REGULAR_RANK_12 ((uint32_t)0x0000000C)
Kojto 109:9296ab0bfc11 2300 #define ADC_REGULAR_RANK_13 ((uint32_t)0x0000000D)
Kojto 109:9296ab0bfc11 2301 #define ADC_REGULAR_RANK_14 ((uint32_t)0x0000000E)
Kojto 109:9296ab0bfc11 2302 #define ADC_REGULAR_RANK_15 ((uint32_t)0x0000000F)
Kojto 109:9296ab0bfc11 2303 #define ADC_REGULAR_RANK_16 ((uint32_t)0x00000010)
Kojto 109:9296ab0bfc11 2304
Kojto 109:9296ab0bfc11 2305 #define IS_ADC_REGULAR_RANK(CHANNEL) (((CHANNEL) == ADC_REGULAR_RANK_1 ) || \
Kojto 109:9296ab0bfc11 2306 ((CHANNEL) == ADC_REGULAR_RANK_2 ) || \
Kojto 109:9296ab0bfc11 2307 ((CHANNEL) == ADC_REGULAR_RANK_3 ) || \
Kojto 109:9296ab0bfc11 2308 ((CHANNEL) == ADC_REGULAR_RANK_4 ) || \
Kojto 109:9296ab0bfc11 2309 ((CHANNEL) == ADC_REGULAR_RANK_5 ) || \
Kojto 109:9296ab0bfc11 2310 ((CHANNEL) == ADC_REGULAR_RANK_6 ) || \
Kojto 109:9296ab0bfc11 2311 ((CHANNEL) == ADC_REGULAR_RANK_7 ) || \
Kojto 109:9296ab0bfc11 2312 ((CHANNEL) == ADC_REGULAR_RANK_8 ) || \
Kojto 109:9296ab0bfc11 2313 ((CHANNEL) == ADC_REGULAR_RANK_9 ) || \
Kojto 109:9296ab0bfc11 2314 ((CHANNEL) == ADC_REGULAR_RANK_10) || \
Kojto 109:9296ab0bfc11 2315 ((CHANNEL) == ADC_REGULAR_RANK_11) || \
Kojto 109:9296ab0bfc11 2316 ((CHANNEL) == ADC_REGULAR_RANK_12) || \
Kojto 109:9296ab0bfc11 2317 ((CHANNEL) == ADC_REGULAR_RANK_13) || \
Kojto 109:9296ab0bfc11 2318 ((CHANNEL) == ADC_REGULAR_RANK_14) || \
Kojto 109:9296ab0bfc11 2319 ((CHANNEL) == ADC_REGULAR_RANK_15) || \
Kojto 109:9296ab0bfc11 2320 ((CHANNEL) == ADC_REGULAR_RANK_16) )
Kojto 109:9296ab0bfc11 2321 /**
Kojto 109:9296ab0bfc11 2322 * @}
Kojto 109:9296ab0bfc11 2323 */
Kojto 109:9296ab0bfc11 2324
Kojto 109:9296ab0bfc11 2325 /** @defgroup ADCEx_injected_rank ADC Extended Injected Channel Rank
Kojto 109:9296ab0bfc11 2326 * @{
Kojto 109:9296ab0bfc11 2327 */
Kojto 109:9296ab0bfc11 2328 #define ADC_INJECTED_RANK_1 ((uint32_t)0x00000001)
Kojto 109:9296ab0bfc11 2329 #define ADC_INJECTED_RANK_2 ((uint32_t)0x00000002)
Kojto 109:9296ab0bfc11 2330 #define ADC_INJECTED_RANK_3 ((uint32_t)0x00000003)
Kojto 109:9296ab0bfc11 2331 #define ADC_INJECTED_RANK_4 ((uint32_t)0x00000004)
Kojto 109:9296ab0bfc11 2332
Kojto 109:9296ab0bfc11 2333 #define IS_ADC_INJECTED_RANK(CHANNEL) (((CHANNEL) == ADC_INJECTED_RANK_1) || \
Kojto 109:9296ab0bfc11 2334 ((CHANNEL) == ADC_INJECTED_RANK_2) || \
Kojto 109:9296ab0bfc11 2335 ((CHANNEL) == ADC_INJECTED_RANK_3) || \
Kojto 109:9296ab0bfc11 2336 ((CHANNEL) == ADC_INJECTED_RANK_4) )
Kojto 109:9296ab0bfc11 2337 /**
Kojto 109:9296ab0bfc11 2338 * @}
Kojto 109:9296ab0bfc11 2339 */
Kojto 109:9296ab0bfc11 2340
Kojto 109:9296ab0bfc11 2341 /** @defgroup ADCEx_External_trigger_edge_Injected External Trigger Edge of Injected Group
Kojto 109:9296ab0bfc11 2342 * @{
Kojto 109:9296ab0bfc11 2343 */
Kojto 109:9296ab0bfc11 2344 #define ADC_EXTERNALTRIGINJECCONV_EDGE_NONE ((uint32_t)0x00000000)
Kojto 109:9296ab0bfc11 2345 #define ADC_EXTERNALTRIGINJECCONV_EDGE_RISING ((uint32_t)ADC_CR2_JEXTTRIG)
Kojto 109:9296ab0bfc11 2346
Kojto 109:9296ab0bfc11 2347 #define IS_ADC_EXTTRIGINJEC_EDGE(EDGE) (((EDGE) == ADC_EXTERNALTRIGINJECCONV_EDGE_NONE) || \
Kojto 109:9296ab0bfc11 2348 ((EDGE) == ADC_EXTERNALTRIGINJECCONV_EDGE_RISING) )
Kojto 109:9296ab0bfc11 2349 /**
Kojto 109:9296ab0bfc11 2350 * @}
Kojto 109:9296ab0bfc11 2351 */
Kojto 109:9296ab0bfc11 2352
Kojto 109:9296ab0bfc11 2353 /** @defgroup ADCEx_External_trigger_source_Injected External Trigger Source of Injected Group
Kojto 109:9296ab0bfc11 2354 * @{
Kojto 109:9296ab0bfc11 2355 */
Kojto 109:9296ab0bfc11 2356 /* External triggers for injected groups of ADC1 */
Kojto 109:9296ab0bfc11 2357 #define ADC_EXTERNALTRIGINJECCONV_T2_CC1 ADC_EXTERNALTRIGINJEC_T2_CC1
Kojto 109:9296ab0bfc11 2358 #define ADC_EXTERNALTRIGINJECCONV_T2_TRGO ADC_EXTERNALTRIGINJEC_T2_TRGO
Kojto 109:9296ab0bfc11 2359 #define ADC_EXTERNALTRIGINJECCONV_T3_CC4 ADC_EXTERNALTRIGINJEC_T3_CC4
Kojto 109:9296ab0bfc11 2360 #define ADC_EXTERNALTRIGINJECCONV_T4_TRGO ADC_EXTERNALTRIGINJEC_T4_TRGO
Kojto 109:9296ab0bfc11 2361 #define ADC_EXTERNALTRIGINJECCONV_T19_CC1 ADC_EXTERNALTRIGINJEC_T19_CC1
Kojto 109:9296ab0bfc11 2362 #define ADC_EXTERNALTRIGINJECCONV_T19_CC2 ADC_EXTERNALTRIGINJEC_T19_CC2
Kojto 109:9296ab0bfc11 2363 #define ADC_EXTERNALTRIGINJECCONV_EXT_IT15 ADC_EXTERNALTRIGINJEC_EXT_IT15
Kojto 109:9296ab0bfc11 2364 #define ADC_INJECTED_SOFTWARE_START ADC_JSWSTART
Kojto 109:9296ab0bfc11 2365
Kojto 109:9296ab0bfc11 2366 #define IS_ADC_EXTTRIGINJEC(INJTRIG) (((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T2_CC1) || \
Kojto 109:9296ab0bfc11 2367 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T2_TRGO) || \
Kojto 109:9296ab0bfc11 2368 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T3_CC4) || \
Kojto 109:9296ab0bfc11 2369 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T4_TRGO) || \
Kojto 109:9296ab0bfc11 2370 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T19_CC1) || \
Kojto 109:9296ab0bfc11 2371 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_T19_CC2) || \
Kojto 109:9296ab0bfc11 2372 ((INJTRIG) == ADC_EXTERNALTRIGINJECCONV_EXT_IT15) || \
Kojto 109:9296ab0bfc11 2373 ((INJTRIG) == ADC_INJECTED_SOFTWARE_START) )
Kojto 109:9296ab0bfc11 2374 /**
Kojto 109:9296ab0bfc11 2375 * @}
Kojto 109:9296ab0bfc11 2376 */
Kojto 109:9296ab0bfc11 2377
Kojto 109:9296ab0bfc11 2378
Kojto 109:9296ab0bfc11 2379 /** @defgroup ADCEx_Internal_HAL_driver_Ext_trig_src_Injected ADC Extended External Trigger Source of Injected Group (Internal)
Kojto 109:9296ab0bfc11 2380 * @{
Kojto 109:9296ab0bfc11 2381 */
Kojto 109:9296ab0bfc11 2382
Kojto 109:9296ab0bfc11 2383 /* List of external triggers of injected group for ADC1: */
Kojto 109:9296ab0bfc11 2384 /* (used internally by HAL driver. To not use into HAL structure parameters) */
Kojto 109:9296ab0bfc11 2385 #define ADC_EXTERNALTRIGINJEC_T19_CC1 ((uint32_t) 0x00000000)
Kojto 109:9296ab0bfc11 2386 #define ADC_EXTERNALTRIGINJEC_T19_CC2 ((uint32_t) ADC_CR2_JEXTSEL_0)
Kojto 109:9296ab0bfc11 2387 #define ADC_EXTERNALTRIGINJEC_T2_TRGO ((uint32_t) ADC_CR2_JEXTSEL_1)
Kojto 109:9296ab0bfc11 2388 #define ADC_EXTERNALTRIGINJEC_T2_CC1 ((uint32_t)(ADC_CR2_JEXTSEL_1 | ADC_CR2_JEXTSEL_0))
Kojto 109:9296ab0bfc11 2389 #define ADC_EXTERNALTRIGINJEC_T3_CC4 ((uint32_t) ADC_CR2_JEXTSEL_2)
Kojto 109:9296ab0bfc11 2390 #define ADC_EXTERNALTRIGINJEC_T4_TRGO ((uint32_t)(ADC_CR2_JEXTSEL_2 | ADC_CR2_JEXTSEL_0))
Kojto 109:9296ab0bfc11 2391 #define ADC_EXTERNALTRIGINJEC_EXT_IT15 ((uint32_t)(ADC_CR2_JEXTSEL_2 | ADC_CR2_JEXTSEL_1))
Kojto 109:9296ab0bfc11 2392 #define ADC_JSWSTART ((uint32_t)(ADC_CR2_JEXTSEL_2 | ADC_CR2_JEXTSEL_1 | ADC_CR2_JEXTSEL_0))
Kojto 109:9296ab0bfc11 2393
Kojto 109:9296ab0bfc11 2394 /**
Kojto 109:9296ab0bfc11 2395 * @}
Kojto 109:9296ab0bfc11 2396 */
Kojto 109:9296ab0bfc11 2397
Kojto 109:9296ab0bfc11 2398
Kojto 109:9296ab0bfc11 2399 /** @defgroup ADCEx_analog_watchdog_mode ADC Extended analog watchdog mode
Kojto 109:9296ab0bfc11 2400 * @{
Kojto 109:9296ab0bfc11 2401 */
Kojto 109:9296ab0bfc11 2402 #define ADC_ANALOGWATCHDOG_NONE ((uint32_t)0x00000000)
Kojto 109:9296ab0bfc11 2403 #define ADC_ANALOGWATCHDOG_SINGLE_REG ((uint32_t)(ADC_CR1_AWDSGL | ADC_CR1_AWDEN))
Kojto 109:9296ab0bfc11 2404 #define ADC_ANALOGWATCHDOG_SINGLE_INJEC ((uint32_t)(ADC_CR1_AWDSGL | ADC_CR1_JAWDEN))
Kojto 109:9296ab0bfc11 2405 #define ADC_ANALOGWATCHDOG_SINGLE_REGINJEC ((uint32_t)(ADC_CR1_AWDSGL | ADC_CR1_AWDEN | ADC_CR1_JAWDEN))
Kojto 109:9296ab0bfc11 2406 #define ADC_ANALOGWATCHDOG_ALL_REG ((uint32_t) ADC_CR1_AWDEN)
Kojto 109:9296ab0bfc11 2407 #define ADC_ANALOGWATCHDOG_ALL_INJEC ((uint32_t) ADC_CR1_JAWDEN)
Kojto 109:9296ab0bfc11 2408 #define ADC_ANALOGWATCHDOG_ALL_REGINJEC ((uint32_t)(ADC_CR1_AWDEN | ADC_CR1_JAWDEN))
Kojto 109:9296ab0bfc11 2409
Kojto 109:9296ab0bfc11 2410 #define IS_ADC_ANALOG_WATCHDOG_MODE(WATCHDOG) (((WATCHDOG) == ADC_ANALOGWATCHDOG_NONE) || \
Kojto 109:9296ab0bfc11 2411 ((WATCHDOG) == ADC_ANALOGWATCHDOG_SINGLE_REG) || \
Kojto 109:9296ab0bfc11 2412 ((WATCHDOG) == ADC_ANALOGWATCHDOG_SINGLE_INJEC) || \
Kojto 109:9296ab0bfc11 2413 ((WATCHDOG) == ADC_ANALOGWATCHDOG_SINGLE_REGINJEC) || \
Kojto 109:9296ab0bfc11 2414 ((WATCHDOG) == ADC_ANALOGWATCHDOG_ALL_REG) || \
Kojto 109:9296ab0bfc11 2415 ((WATCHDOG) == ADC_ANALOGWATCHDOG_ALL_INJEC) || \
Kojto 109:9296ab0bfc11 2416 ((WATCHDOG) == ADC_ANALOGWATCHDOG_ALL_REGINJEC) )
Kojto 109:9296ab0bfc11 2417 /**
Kojto 109:9296ab0bfc11 2418 * @}
Kojto 109:9296ab0bfc11 2419 */
Kojto 109:9296ab0bfc11 2420
Kojto 109:9296ab0bfc11 2421 /** @defgroup ADC_conversion_group ADC Conversion Group
Kojto 109:9296ab0bfc11 2422 * @{
Kojto 109:9296ab0bfc11 2423 */
Kojto 109:9296ab0bfc11 2424 #define REGULAR_GROUP ((uint32_t)(ADC_FLAG_EOC))
Kojto 109:9296ab0bfc11 2425 #define INJECTED_GROUP ((uint32_t)(ADC_FLAG_JEOC))
Kojto 109:9296ab0bfc11 2426 #define REGULAR_INJECTED_GROUP ((uint32_t)(ADC_FLAG_EOC | ADC_FLAG_JEOC))
Kojto 109:9296ab0bfc11 2427
Kojto 109:9296ab0bfc11 2428 #define IS_ADC_CONVERSION_GROUP(CONVERSION) (((CONVERSION) == REGULAR_GROUP) || \
Kojto 109:9296ab0bfc11 2429 ((CONVERSION) == INJECTED_GROUP) || \
Kojto 109:9296ab0bfc11 2430 ((CONVERSION) == REGULAR_INJECTED_GROUP) )
Kojto 109:9296ab0bfc11 2431 /**
Kojto 109:9296ab0bfc11 2432 * @}
Kojto 109:9296ab0bfc11 2433 */
Kojto 109:9296ab0bfc11 2434
Kojto 109:9296ab0bfc11 2435 /** @defgroup ADCEx_Event_type ADC Extended Event Type
Kojto 109:9296ab0bfc11 2436 * @{
Kojto 109:9296ab0bfc11 2437 */
Kojto 109:9296ab0bfc11 2438 #define AWD_EVENT ((uint32_t)ADC_FLAG_AWD) /*!< ADC Analog watchdog event */
Kojto 109:9296ab0bfc11 2439
Kojto 109:9296ab0bfc11 2440 #define IS_ADC_EVENT_TYPE(EVENT) ((EVENT) == AWD_EVENT)
Kojto 109:9296ab0bfc11 2441 /**
Kojto 109:9296ab0bfc11 2442 * @}
Kojto 109:9296ab0bfc11 2443 */
Kojto 109:9296ab0bfc11 2444
Kojto 109:9296ab0bfc11 2445 /** @defgroup ADCEx_interrupts_definition ADC Extended Interrupts Definition
Kojto 109:9296ab0bfc11 2446 * @{
Kojto 109:9296ab0bfc11 2447 */
Kojto 109:9296ab0bfc11 2448 #define ADC_IT_EOC ADC_CR1_EOCIE /*!< ADC End of Regular Conversion interrupt source */
Kojto 109:9296ab0bfc11 2449 #define ADC_IT_JEOC ADC_CR1_JEOCIE /*!< ADC End of Injected Conversion interrupt source */
Kojto 109:9296ab0bfc11 2450 #define ADC_IT_AWD ADC_CR1_AWDIE /*!< ADC Analog watchdog interrupt source */
Kojto 109:9296ab0bfc11 2451
Kojto 109:9296ab0bfc11 2452 /* Check of single flag */
Kojto 109:9296ab0bfc11 2453 #define IS_ADC_IT(IT) (((IT) == ADC_IT_EOC ) || \
Kojto 109:9296ab0bfc11 2454 ((IT) == ADC_IT_JEOC) || \
Kojto 109:9296ab0bfc11 2455 ((IT) == ADC_IT_AWD ) )
Kojto 109:9296ab0bfc11 2456 /**
Kojto 109:9296ab0bfc11 2457 * @}
Kojto 109:9296ab0bfc11 2458 */
Kojto 109:9296ab0bfc11 2459
Kojto 109:9296ab0bfc11 2460 /** @defgroup ADCEx_flags_definition ADC Extended Flags Definition
Kojto 109:9296ab0bfc11 2461 * @{
Kojto 109:9296ab0bfc11 2462 */
Kojto 109:9296ab0bfc11 2463 #define ADC_FLAG_AWD ADC_SR_AWD /*!< ADC Analog watchdog flag */
Kojto 109:9296ab0bfc11 2464 #define ADC_FLAG_EOC ADC_SR_EOC /*!< ADC End of Regular conversion flag */
Kojto 109:9296ab0bfc11 2465 #define ADC_FLAG_JEOC ADC_SR_JEOC /*!< ADC End of Injected conversion flag */
Kojto 109:9296ab0bfc11 2466 #define ADC_FLAG_JSTRT ADC_SR_JSTRT /*!< ADC Injected group start flag */
Kojto 109:9296ab0bfc11 2467 #define ADC_FLAG_STRT ADC_SR_STRT /*!< ADC Regular group start flag */
Kojto 109:9296ab0bfc11 2468
Kojto 109:9296ab0bfc11 2469 /* Combination of all post-conversion flags bits: EOC/EOS, JEOC/JEOS, OVR, AWDx */
Kojto 109:9296ab0bfc11 2470 #define ADC_FLAG_POSTCONV_ALL (ADC_FLAG_EOC | ADC_FLAG_JEOC | ADC_FLAG_AWD )
Kojto 109:9296ab0bfc11 2471
Kojto 109:9296ab0bfc11 2472 /* Check of single flag */
Kojto 109:9296ab0bfc11 2473 #define IS_ADC_FLAG(FLAG) (((FLAG) == ADC_FLAG_AWD) || \
Kojto 109:9296ab0bfc11 2474 ((FLAG) == ADC_FLAG_EOC) || \
Kojto 109:9296ab0bfc11 2475 ((FLAG) == ADC_FLAG_JEOC) || \
Kojto 109:9296ab0bfc11 2476 ((FLAG) == ADC_FLAG_JSTRT) || \
Kojto 109:9296ab0bfc11 2477 ((FLAG) == ADC_FLAG_STRT) )
Kojto 109:9296ab0bfc11 2478 /**
Kojto 109:9296ab0bfc11 2479 * @}
Kojto 109:9296ab0bfc11 2480 */
Kojto 109:9296ab0bfc11 2481
Kojto 109:9296ab0bfc11 2482 /** @defgroup ADCEx_range_verification ADC Extended Range Verification
Kojto 109:9296ab0bfc11 2483 * For a unique ADC resolution: 12 bits
Kojto 109:9296ab0bfc11 2484 * @{
Kojto 109:9296ab0bfc11 2485 */
Kojto 109:9296ab0bfc11 2486 #define IS_ADC_RANGE(ADC_VALUE) ((ADC_VALUE) <= ((uint32_t)0x0FFF))
Kojto 109:9296ab0bfc11 2487 /**
Kojto 109:9296ab0bfc11 2488 * @}
Kojto 109:9296ab0bfc11 2489 */
Kojto 109:9296ab0bfc11 2490
Kojto 109:9296ab0bfc11 2491 /** @defgroup ADC_injected_nb_conv_verification ADC Injected Conversion Number Verification
Kojto 109:9296ab0bfc11 2492 * @{
Kojto 109:9296ab0bfc11 2493 */
Kojto 109:9296ab0bfc11 2494 #define IS_ADC_INJECTED_NB_CONV(LENGTH) (((LENGTH) >= ((uint32_t)1)) && ((LENGTH) <= ((uint32_t)4)))
Kojto 109:9296ab0bfc11 2495 /**
Kojto 109:9296ab0bfc11 2496 * @}
Kojto 109:9296ab0bfc11 2497 */
Kojto 109:9296ab0bfc11 2498
Kojto 109:9296ab0bfc11 2499 /** @defgroup ADC_regular_nb_conv_verification ADC Regular Conversion Number Verification
Kojto 109:9296ab0bfc11 2500 * @{
Kojto 109:9296ab0bfc11 2501 */
Kojto 109:9296ab0bfc11 2502 #define IS_ADC_REGULAR_NB_CONV(LENGTH) (((LENGTH) >= ((uint32_t)1)) && ((LENGTH) <= ((uint32_t)16)))
Kojto 109:9296ab0bfc11 2503 /**
Kojto 109:9296ab0bfc11 2504 * @}
Kojto 109:9296ab0bfc11 2505 */
Kojto 109:9296ab0bfc11 2506
Kojto 109:9296ab0bfc11 2507 /** @defgroup ADC_regular_discontinuous_mode_number_verification ADC Regular Discontinuous Mode NumberVerification
Kojto 109:9296ab0bfc11 2508 * @{
Kojto 109:9296ab0bfc11 2509 */
Kojto 109:9296ab0bfc11 2510 #define IS_ADC_REGULAR_DISCONT_NUMBER(NUMBER) (((NUMBER) >= ((uint32_t)1)) && ((NUMBER) <= ((uint32_t)8)))
Kojto 109:9296ab0bfc11 2511 /**
Kojto 109:9296ab0bfc11 2512 * @}
Kojto 109:9296ab0bfc11 2513 */
Kojto 109:9296ab0bfc11 2514 #endif /* STM32F373xC || STM32F378xx */
Kojto 109:9296ab0bfc11 2515
Kojto 109:9296ab0bfc11 2516 /**
Kojto 109:9296ab0bfc11 2517 * @}
Kojto 109:9296ab0bfc11 2518 */
Kojto 109:9296ab0bfc11 2519
Kojto 109:9296ab0bfc11 2520 /* Exported macros -----------------------------------------------------------*/
Kojto 109:9296ab0bfc11 2521
Kojto 109:9296ab0bfc11 2522 /** @addtogroup ADC_Exported_Macro ADC Exported Macros
Kojto 109:9296ab0bfc11 2523 * @{
Kojto 109:9296ab0bfc11 2524 */
Kojto 109:9296ab0bfc11 2525 /* Macro for internal HAL driver usage, and possibly can be used into code of */
Kojto 109:9296ab0bfc11 2526 /* final user. */
Kojto 109:9296ab0bfc11 2527
Kojto 109:9296ab0bfc11 2528 #if defined(STM32F302xE) || defined(STM32F303xE) || defined(STM32F398xx) || \
Kojto 109:9296ab0bfc11 2529 defined(STM32F302xC) || defined(STM32F303xC) || defined(STM32F358xx) || \
Kojto 109:9296ab0bfc11 2530 defined(STM32F303x8) || defined(STM32F334x8) || defined(STM32F328xx) || \
Kojto 109:9296ab0bfc11 2531 defined(STM32F301x8) || defined(STM32F302x8) || defined(STM32F318xx)
Kojto 109:9296ab0bfc11 2532 /**
Kojto 109:9296ab0bfc11 2533 * @brief Verification of ADC state: enabled or disabled
Kojto 109:9296ab0bfc11 2534 * @param __HANDLE__: ADC handle
Kojto 109:9296ab0bfc11 2535 * @retval SET (ADC enabled) or RESET (ADC disabled)
Kojto 109:9296ab0bfc11 2536 */
Kojto 109:9296ab0bfc11 2537 #define __HAL_ADC_IS_ENABLED(__HANDLE__) \
Kojto 109:9296ab0bfc11 2538 (( ((((__HANDLE__)->Instance->CR) & (ADC_CR_ADEN | ADC_CR_ADDIS)) == ADC_CR_ADEN) && \
Kojto 109:9296ab0bfc11 2539 ((((__HANDLE__)->Instance->ISR) & ADC_FLAG_RDY) == ADC_FLAG_RDY) \
Kojto 109:9296ab0bfc11 2540 ) ? SET : RESET)
Kojto 109:9296ab0bfc11 2541
Kojto 109:9296ab0bfc11 2542 /**
Kojto 109:9296ab0bfc11 2543 * @brief Test if conversion trigger of regular group is software start
Kojto 109:9296ab0bfc11 2544 * or external trigger.
Kojto 109:9296ab0bfc11 2545 * @param __HANDLE__: ADC handle
Kojto 109:9296ab0bfc11 2546 * @retval SET (software start) or RESET (external trigger)
Kojto 109:9296ab0bfc11 2547 */
Kojto 109:9296ab0bfc11 2548 #define __HAL_ADC_IS_SOFTWARE_START_REGULAR(__HANDLE__) \
Kojto 109:9296ab0bfc11 2549 (((__HANDLE__)->Instance->CFGR & ADC_CFGR_EXTEN) == RESET)
Kojto 109:9296ab0bfc11 2550
Kojto 109:9296ab0bfc11 2551 /**
Kojto 109:9296ab0bfc11 2552 * @brief Test if conversion trigger of injected group is software start
Kojto 109:9296ab0bfc11 2553 * or external trigger.
Kojto 109:9296ab0bfc11 2554 * @param __HANDLE__: ADC handle
Kojto 109:9296ab0bfc11 2555 * @retval SET (software start) or RESET (external trigger)
Kojto 109:9296ab0bfc11 2556 */
Kojto 109:9296ab0bfc11 2557 #define __HAL_ADC_IS_SOFTWARE_START_INJECTED(__HANDLE__) \
Kojto 109:9296ab0bfc11 2558 (((__HANDLE__)->Instance->JSQR & ADC_JSQR_JEXTEN) == RESET)
Kojto 109:9296ab0bfc11 2559
Kojto 109:9296ab0bfc11 2560 /**
Kojto 109:9296ab0bfc11 2561 * @brief Check if no conversion on going on regular and/or injected groups
Kojto 109:9296ab0bfc11 2562 * @param __HANDLE__: ADC handle
Kojto 109:9296ab0bfc11 2563 * @retval SET (conversion is on going) or RESET (no conversion is on going)
Kojto 109:9296ab0bfc11 2564 */
Kojto 109:9296ab0bfc11 2565 #define __HAL_ADC_IS_CONVERSION_ONGOING_REGULAR_INJECTED(__HANDLE__) \
Kojto 109:9296ab0bfc11 2566 (( (((__HANDLE__)->Instance->CR) & (ADC_CR_ADSTART | ADC_CR_JADSTART)) == RESET \
Kojto 109:9296ab0bfc11 2567 ) ? RESET : SET)
Kojto 109:9296ab0bfc11 2568
Kojto 109:9296ab0bfc11 2569 /**
Kojto 109:9296ab0bfc11 2570 * @brief Check if no conversion on going on regular group
Kojto 109:9296ab0bfc11 2571 * @param __HANDLE__: ADC handle
Kojto 109:9296ab0bfc11 2572 * @retval SET (conversion is on going) or RESET (no conversion is on going)
Kojto 109:9296ab0bfc11 2573 */
Kojto 109:9296ab0bfc11 2574 #define __HAL_ADC_IS_CONVERSION_ONGOING_REGULAR(__HANDLE__) \
Kojto 109:9296ab0bfc11 2575 (( (((__HANDLE__)->Instance->CR) & ADC_CR_ADSTART) == RESET \
Kojto 109:9296ab0bfc11 2576 ) ? RESET : SET)
Kojto 109:9296ab0bfc11 2577
Kojto 109:9296ab0bfc11 2578 /**
Kojto 109:9296ab0bfc11 2579 * @brief Check if no conversion on going on injected group
Kojto 109:9296ab0bfc11 2580 * @param __HANDLE__: ADC handle
Kojto 109:9296ab0bfc11 2581 * @retval SET (conversion is on going) or RESET (no conversion is on going)
Kojto 109:9296ab0bfc11 2582 */
Kojto 109:9296ab0bfc11 2583 #define __HAL_ADC_IS_CONVERSION_ONGOING_INJECTED(__HANDLE__) \
Kojto 109:9296ab0bfc11 2584 (( (((__HANDLE__)->Instance->CR) & ADC_CR_JADSTART) == RESET \
Kojto 109:9296ab0bfc11 2585 ) ? RESET : SET)
Kojto 109:9296ab0bfc11 2586
Kojto 109:9296ab0bfc11 2587 /**
Kojto 109:9296ab0bfc11 2588 * @brief Returns resolution bits in CFGR1 register: RES[1:0].
Kojto 109:9296ab0bfc11 2589 * Returned value is among parameters to @ref ADCEx_Resolution.
Kojto 109:9296ab0bfc11 2590 * @param __HANDLE__: ADC handle
Kojto 109:9296ab0bfc11 2591 * @retval None
Kojto 109:9296ab0bfc11 2592 */
Kojto 109:9296ab0bfc11 2593 #define __HAL_ADC_GET_RESOLUTION(__HANDLE__) (((__HANDLE__)->Instance->CFGR) & ADC_CFGR_RES)
Kojto 109:9296ab0bfc11 2594
Kojto 109:9296ab0bfc11 2595 /** @brief Checks if the specified ADC interrupt source is enabled or disabled.
Kojto 109:9296ab0bfc11 2596 * @param __HANDLE__: ADC handle
Kojto 109:9296ab0bfc11 2597 * @param __INTERRUPT__: ADC interrupt source to check
Kojto 109:9296ab0bfc11 2598 * @retval State of interruption (SET or RESET)
Kojto 109:9296ab0bfc11 2599 */
Kojto 109:9296ab0bfc11 2600 #define __HAL_ADC_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) \
Kojto 109:9296ab0bfc11 2601 (( ((__HANDLE__)->Instance->IER & (__INTERRUPT__)) == (__INTERRUPT__) \
Kojto 109:9296ab0bfc11 2602 )? SET : RESET \
Kojto 109:9296ab0bfc11 2603 )
Kojto 109:9296ab0bfc11 2604
Kojto 109:9296ab0bfc11 2605 /**
Kojto 109:9296ab0bfc11 2606 * @brief Enable the ADC end of conversion interrupt.
Kojto 109:9296ab0bfc11 2607 * @param __HANDLE__: ADC handle
Kojto 109:9296ab0bfc11 2608 * @param __INTERRUPT__: ADC Interrupt
Kojto 109:9296ab0bfc11 2609 * @retval None
Kojto 109:9296ab0bfc11 2610 */
Kojto 109:9296ab0bfc11 2611 #define __HAL_ADC_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->IER) |= (__INTERRUPT__))
Kojto 109:9296ab0bfc11 2612
Kojto 109:9296ab0bfc11 2613 /**
Kojto 109:9296ab0bfc11 2614 * @brief Disable the ADC end of conversion interrupt.
Kojto 109:9296ab0bfc11 2615 * @param __HANDLE__: ADC handle
Kojto 109:9296ab0bfc11 2616 * @param __INTERRUPT__: ADC Interrupt
Kojto 109:9296ab0bfc11 2617 * @retval None
Kojto 109:9296ab0bfc11 2618 */
Kojto 109:9296ab0bfc11 2619 #define __HAL_ADC_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->IER) &= ~(__INTERRUPT__))
Kojto 109:9296ab0bfc11 2620
Kojto 109:9296ab0bfc11 2621 /**
Kojto 109:9296ab0bfc11 2622 * @brief Get the selected ADC's flag status.
Kojto 109:9296ab0bfc11 2623 * @param __HANDLE__: ADC handle
Kojto 109:9296ab0bfc11 2624 * @param __FLAG__: ADC flag
Kojto 109:9296ab0bfc11 2625 * @retval None
Kojto 109:9296ab0bfc11 2626 */
Kojto 109:9296ab0bfc11 2627 #define __HAL_ADC_GET_FLAG(__HANDLE__, __FLAG__) ((((__HANDLE__)->Instance->ISR) & (__FLAG__)) == (__FLAG__))
Kojto 109:9296ab0bfc11 2628
Kojto 109:9296ab0bfc11 2629 /**
Kojto 109:9296ab0bfc11 2630 * @brief Clear the ADC's pending flags
Kojto 109:9296ab0bfc11 2631 * @param __HANDLE__: ADC handle
Kojto 109:9296ab0bfc11 2632 * @param __FLAG__: ADC flag
Kojto 109:9296ab0bfc11 2633 * @retval None
Kojto 109:9296ab0bfc11 2634 */
Kojto 109:9296ab0bfc11 2635 /* Note: bit cleared bit by writing 1 (writing 0 has no effect on any bit of register ISR) */
Kojto 109:9296ab0bfc11 2636 #define __HAL_ADC_CLEAR_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->ISR) = (__FLAG__))
Kojto 109:9296ab0bfc11 2637
Kojto 109:9296ab0bfc11 2638 /**
Kojto 109:9296ab0bfc11 2639 * @brief Clear ADC error code (set it to error code: "no error")
Kojto 109:9296ab0bfc11 2640 * @param __HANDLE__: ADC handle
Kojto 109:9296ab0bfc11 2641 * @retval None
Kojto 109:9296ab0bfc11 2642 */
Kojto 109:9296ab0bfc11 2643 #define __HAL_ADC_CLEAR_ERRORCODE(__HANDLE__) ((__HANDLE__)->ErrorCode = HAL_ADC_ERROR_NONE)
Kojto 109:9296ab0bfc11 2644 #endif /* STM32F302xE || STM32F303xE || STM32F398xx || */
Kojto 109:9296ab0bfc11 2645 /* STM32F302xC || STM32F303xC || STM32F358xx || */
Kojto 109:9296ab0bfc11 2646 /* STM32F303x8 || STM32F334x8 || STM32F328xx || */
Kojto 109:9296ab0bfc11 2647 /* STM32F301x8 || STM32F302x8 || STM32F318xx */
Kojto 109:9296ab0bfc11 2648
Kojto 109:9296ab0bfc11 2649 #if defined(STM32F373xC) || defined(STM32F378xx)
Kojto 109:9296ab0bfc11 2650 /**
Kojto 109:9296ab0bfc11 2651 * @brief Verification of ADC state: enabled or disabled
Kojto 109:9296ab0bfc11 2652 * @param __HANDLE__: ADC handle
Kojto 109:9296ab0bfc11 2653 * @retval SET (ADC enabled) or RESET (ADC disabled)
Kojto 109:9296ab0bfc11 2654 */
Kojto 109:9296ab0bfc11 2655 #define __HAL_ADC_IS_ENABLED(__HANDLE__) \
Kojto 109:9296ab0bfc11 2656 ((( ((__HANDLE__)->Instance->CR2 & ADC_CR2_ADON) == ADC_CR2_ADON ) \
Kojto 109:9296ab0bfc11 2657 ) ? SET : RESET)
Kojto 109:9296ab0bfc11 2658
Kojto 109:9296ab0bfc11 2659 /**
Kojto 109:9296ab0bfc11 2660 * @brief Test if conversion trigger of regular group is software start
Kojto 109:9296ab0bfc11 2661 * or external trigger.
Kojto 109:9296ab0bfc11 2662 * @param __HANDLE__: ADC handle
Kojto 109:9296ab0bfc11 2663 * @retval SET (software start) or RESET (external trigger)
Kojto 109:9296ab0bfc11 2664 */
Kojto 109:9296ab0bfc11 2665 #define __HAL_ADC_IS_SOFTWARE_START_REGULAR(__HANDLE__) \
Kojto 109:9296ab0bfc11 2666 (((__HANDLE__)->Instance->CR2 & ADC_CR2_EXTSEL) == ADC_SOFTWARE_START)
Kojto 109:9296ab0bfc11 2667
Kojto 109:9296ab0bfc11 2668 /**
Kojto 109:9296ab0bfc11 2669 * @brief Test if conversion trigger of injected group is software start
Kojto 109:9296ab0bfc11 2670 * or external trigger.
Kojto 109:9296ab0bfc11 2671 * @param __HANDLE__: ADC handle
Kojto 109:9296ab0bfc11 2672 * @retval SET (software start) or RESET (external trigger)
Kojto 109:9296ab0bfc11 2673 */
Kojto 109:9296ab0bfc11 2674 #define __HAL_ADC_IS_SOFTWARE_START_INJECTED(__HANDLE__) \
Kojto 109:9296ab0bfc11 2675 (((__HANDLE__)->Instance->CR2 & ADC_CR2_JEXTSEL) == ADC_INJECTED_SOFTWARE_START)
Kojto 109:9296ab0bfc11 2676
Kojto 109:9296ab0bfc11 2677 /** @brief Checks if the specified ADC interrupt source is enabled or disabled.
Kojto 109:9296ab0bfc11 2678 * @param __HANDLE__: ADC handle
Kojto 109:9296ab0bfc11 2679 * @param __INTERRUPT__: ADC interrupt source to check
Kojto 109:9296ab0bfc11 2680 * @retval State of interruption (SET or RESET)
Kojto 109:9296ab0bfc11 2681 */
Kojto 109:9296ab0bfc11 2682 #define __HAL_ADC_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) \
Kojto 109:9296ab0bfc11 2683 (( ((__HANDLE__)->Instance->CR1 & (__INTERRUPT__)) == (__INTERRUPT__) \
Kojto 109:9296ab0bfc11 2684 )? SET : RESET \
Kojto 109:9296ab0bfc11 2685 )
Kojto 109:9296ab0bfc11 2686
Kojto 109:9296ab0bfc11 2687
Kojto 109:9296ab0bfc11 2688 /**
Kojto 109:9296ab0bfc11 2689 * @brief Enable the ADC end of conversion interrupt.
Kojto 109:9296ab0bfc11 2690 * @param __HANDLE__: ADC handle
Kojto 109:9296ab0bfc11 2691 * @param __INTERRUPT__: ADC Interrupt
Kojto 109:9296ab0bfc11 2692 * @retval None
Kojto 109:9296ab0bfc11 2693 */
Kojto 109:9296ab0bfc11 2694 #define __HAL_ADC_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->CR1) |= (__INTERRUPT__))
Kojto 109:9296ab0bfc11 2695
Kojto 109:9296ab0bfc11 2696 /**
Kojto 109:9296ab0bfc11 2697 * @brief Disable the ADC end of conversion interrupt.
Kojto 109:9296ab0bfc11 2698 * @param __HANDLE__: ADC handle
Kojto 109:9296ab0bfc11 2699 * @param __INTERRUPT__: ADC Interrupt
Kojto 109:9296ab0bfc11 2700 * @retval None
Kojto 109:9296ab0bfc11 2701 */
Kojto 109:9296ab0bfc11 2702 #define __HAL_ADC_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->CR1) &= ~(__INTERRUPT__))
Kojto 109:9296ab0bfc11 2703
Kojto 109:9296ab0bfc11 2704 /**
Kojto 109:9296ab0bfc11 2705 * @brief Get the selected ADC's flag status.
Kojto 109:9296ab0bfc11 2706 * @param __HANDLE__: ADC handle
Kojto 109:9296ab0bfc11 2707 * @param __FLAG__: ADC flag
Kojto 109:9296ab0bfc11 2708 * @retval None
Kojto 109:9296ab0bfc11 2709 */
Kojto 109:9296ab0bfc11 2710 #define __HAL_ADC_GET_FLAG(__HANDLE__, __FLAG__) ((((__HANDLE__)->Instance->SR) & (__FLAG__)) == (__FLAG__))
Kojto 109:9296ab0bfc11 2711
Kojto 109:9296ab0bfc11 2712 /**
Kojto 109:9296ab0bfc11 2713 * @brief Clear the ADC's pending flags
Kojto 109:9296ab0bfc11 2714 * @param __HANDLE__: ADC handle
Kojto 109:9296ab0bfc11 2715 * @param __FLAG__: ADC flag
Kojto 109:9296ab0bfc11 2716 * @retval None
Kojto 109:9296ab0bfc11 2717 */
Kojto 109:9296ab0bfc11 2718 #define __HAL_ADC_CLEAR_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR) = ~(__FLAG__))
Kojto 109:9296ab0bfc11 2719
Kojto 109:9296ab0bfc11 2720 /**
Kojto 109:9296ab0bfc11 2721 * @brief Clear ADC error code (set it to error code: "no error")
Kojto 109:9296ab0bfc11 2722 * @param __HANDLE__: ADC handle
Kojto 109:9296ab0bfc11 2723 * @retval None
Kojto 109:9296ab0bfc11 2724 */
Kojto 109:9296ab0bfc11 2725 #define __HAL_ADC_CLEAR_ERRORCODE(__HANDLE__) ((__HANDLE__)->ErrorCode = HAL_ADC_ERROR_NONE)
Kojto 109:9296ab0bfc11 2726
Kojto 109:9296ab0bfc11 2727 #endif /* STM32F373xC || STM32F378xx */
Kojto 109:9296ab0bfc11 2728 /**
Kojto 109:9296ab0bfc11 2729 * @}
Kojto 109:9296ab0bfc11 2730 */
Kojto 109:9296ab0bfc11 2731
Kojto 109:9296ab0bfc11 2732
Kojto 109:9296ab0bfc11 2733 /* Macro reserved for internal HAL driver usage, not intended to be used in */
Kojto 109:9296ab0bfc11 2734 /* code of final user. */
Kojto 109:9296ab0bfc11 2735
Kojto 109:9296ab0bfc11 2736 /** @defgroup ADCEx_Exported_Macro_internal_HAL_driver ADC Extended Exported Macros (Internal)
Kojto 109:9296ab0bfc11 2737 * @{
Kojto 109:9296ab0bfc11 2738 */
Kojto 109:9296ab0bfc11 2739 #if defined(STM32F302xE) || defined(STM32F303xE) || defined(STM32F398xx) || \
Kojto 109:9296ab0bfc11 2740 defined(STM32F302xC) || defined(STM32F303xC) || defined(STM32F358xx) || \
Kojto 109:9296ab0bfc11 2741 defined(STM32F303x8) || defined(STM32F334x8) || defined(STM32F328xx) || \
Kojto 109:9296ab0bfc11 2742 defined(STM32F301x8) || defined(STM32F302x8) || defined(STM32F318xx)
Kojto 109:9296ab0bfc11 2743
Kojto 109:9296ab0bfc11 2744 /**
Kojto 109:9296ab0bfc11 2745 * @brief Set the ADC's sample time for Channels numbers between 0 and 9.
Kojto 109:9296ab0bfc11 2746 * @param _SAMPLETIME_: Sample time parameter.
Kojto 109:9296ab0bfc11 2747 * @param _CHANNELNB_: Channel number.
Kojto 109:9296ab0bfc11 2748 * @retval None
Kojto 109:9296ab0bfc11 2749 */
Kojto 109:9296ab0bfc11 2750 #define __HAL_ADC_SMPR1(_SAMPLETIME_, _CHANNELNB_) ((_SAMPLETIME_) << (3 * (_CHANNELNB_)))
Kojto 109:9296ab0bfc11 2751
Kojto 109:9296ab0bfc11 2752 /**
Kojto 109:9296ab0bfc11 2753 * @brief Set the ADC's sample time for Channels numbers between 10 and 18.
Kojto 109:9296ab0bfc11 2754 * @param _SAMPLETIME_: Sample time parameter.
Kojto 109:9296ab0bfc11 2755 * @param _CHANNELNB_: Channel number.
Kojto 109:9296ab0bfc11 2756 * @retval None
Kojto 109:9296ab0bfc11 2757 */
Kojto 109:9296ab0bfc11 2758 #define __HAL_ADC_SMPR2(_SAMPLETIME_, _CHANNELNB_) ((_SAMPLETIME_) << (3 * ((_CHANNELNB_) - 10)))
Kojto 109:9296ab0bfc11 2759
Kojto 109:9296ab0bfc11 2760 /**
Kojto 109:9296ab0bfc11 2761 * @brief Set the selected regular Channel rank for rank between 1 and 4.
Kojto 109:9296ab0bfc11 2762 * @param _CHANNELNB_: Channel number.
Kojto 109:9296ab0bfc11 2763 * @param _RANKNB_: Rank number.
Kojto 109:9296ab0bfc11 2764 * @retval None
Kojto 109:9296ab0bfc11 2765 */
Kojto 109:9296ab0bfc11 2766 #define __HAL_ADC_SQR1_RK(_CHANNELNB_, _RANKNB_) ((_CHANNELNB_) << (6 * (_RANKNB_)))
Kojto 109:9296ab0bfc11 2767
Kojto 109:9296ab0bfc11 2768 /**
Kojto 109:9296ab0bfc11 2769 * @brief Set the selected regular Channel rank for rank between 5 and 9.
Kojto 109:9296ab0bfc11 2770 * @param _CHANNELNB_: Channel number.
Kojto 109:9296ab0bfc11 2771 * @param _RANKNB_: Rank number.
Kojto 109:9296ab0bfc11 2772 * @retval None
Kojto 109:9296ab0bfc11 2773 */
Kojto 109:9296ab0bfc11 2774 #define __HAL_ADC_SQR2_RK(_CHANNELNB_, _RANKNB_) ((_CHANNELNB_) << (6 * ((_RANKNB_) - 5)))
Kojto 109:9296ab0bfc11 2775
Kojto 109:9296ab0bfc11 2776 /**
Kojto 109:9296ab0bfc11 2777 * @brief Set the selected regular Channel rank for rank between 10 and 14.
Kojto 109:9296ab0bfc11 2778 * @param _CHANNELNB_: Channel number.
Kojto 109:9296ab0bfc11 2779 * @param _RANKNB_: Rank number.
Kojto 109:9296ab0bfc11 2780 * @retval None
Kojto 109:9296ab0bfc11 2781 */
Kojto 109:9296ab0bfc11 2782 #define __HAL_ADC_SQR3_RK(_CHANNELNB_, _RANKNB_) ((_CHANNELNB_) << (6 * ((_RANKNB_) - 10)))
Kojto 109:9296ab0bfc11 2783
Kojto 109:9296ab0bfc11 2784 /**
Kojto 109:9296ab0bfc11 2785 * @brief Set the selected regular Channel rank for rank between 15 and 16.
Kojto 109:9296ab0bfc11 2786 * @param _CHANNELNB_: Channel number.
Kojto 109:9296ab0bfc11 2787 * @param _RANKNB_: Rank number.
Kojto 109:9296ab0bfc11 2788 * @retval None
Kojto 109:9296ab0bfc11 2789 */
Kojto 109:9296ab0bfc11 2790 #define __HAL_ADC_SQR4_RK(_CHANNELNB_, _RANKNB_) ((_CHANNELNB_) << (6 * ((_RANKNB_) - 15)))
Kojto 109:9296ab0bfc11 2791
Kojto 109:9296ab0bfc11 2792 /**
Kojto 109:9296ab0bfc11 2793 * @brief Set the selected injected Channel rank.
Kojto 109:9296ab0bfc11 2794 * @param _CHANNELNB_: Channel number.
Kojto 109:9296ab0bfc11 2795 * @param _RANKNB_: Rank number.
Kojto 109:9296ab0bfc11 2796 * @retval None
Kojto 109:9296ab0bfc11 2797 */
Kojto 109:9296ab0bfc11 2798 #define __HAL_ADC_JSQR_RK(_CHANNELNB_, _RANKNB_) ((_CHANNELNB_) << (6 * (_RANKNB_) +2))
Kojto 109:9296ab0bfc11 2799
Kojto 109:9296ab0bfc11 2800
Kojto 109:9296ab0bfc11 2801 /**
Kojto 109:9296ab0bfc11 2802 * @brief Set the Analog Watchdog 1 channel.
Kojto 109:9296ab0bfc11 2803 * @param _CHANNEL_: channel to be monitored by Analog Watchdog 1.
Kojto 109:9296ab0bfc11 2804 * @retval None
Kojto 109:9296ab0bfc11 2805 */
Kojto 109:9296ab0bfc11 2806 #define __HAL_ADC_CFGR_AWD1CH(_CHANNEL_) ((_CHANNEL_) << 26)
Kojto 109:9296ab0bfc11 2807
Kojto 109:9296ab0bfc11 2808 /**
Kojto 109:9296ab0bfc11 2809 * @brief Configure the channel number into Analog Watchdog 2 or 3.
Kojto 109:9296ab0bfc11 2810 * @param _CHANNEL_: ADC Channel
Kojto 109:9296ab0bfc11 2811 * @retval None
Kojto 109:9296ab0bfc11 2812 */
Kojto 109:9296ab0bfc11 2813 #define __HAL_ADC_CFGR_AWD23CR(_CHANNEL_) (1U << (_CHANNEL_))
Kojto 109:9296ab0bfc11 2814
Kojto 109:9296ab0bfc11 2815 /**
Kojto 109:9296ab0bfc11 2816 * @brief Enable automatic conversion of injected group
Kojto 109:9296ab0bfc11 2817 * @param _INJECT_AUTO_CONVERSION_: Injected automatic conversion.
Kojto 109:9296ab0bfc11 2818 * @retval None
Kojto 109:9296ab0bfc11 2819 */
Kojto 109:9296ab0bfc11 2820 #define __HAL_ADC_CFGR_INJECT_AUTO_CONVERSION(_INJECT_AUTO_CONVERSION_) ((_INJECT_AUTO_CONVERSION_) << 25)
Kojto 109:9296ab0bfc11 2821
Kojto 109:9296ab0bfc11 2822 /**
Kojto 109:9296ab0bfc11 2823 * @brief Enable ADC injected context queue
Kojto 109:9296ab0bfc11 2824 * @param _INJECT_CONTEXT_QUEUE_MODE_: Injected context queue mode.
Kojto 109:9296ab0bfc11 2825 * @retval None
Kojto 109:9296ab0bfc11 2826 */
Kojto 109:9296ab0bfc11 2827 #define __HAL_ADC_CFGR_INJECT_CONTEXT_QUEUE(_INJECT_CONTEXT_QUEUE_MODE_) ((_INJECT_CONTEXT_QUEUE_MODE_) << 21)
Kojto 109:9296ab0bfc11 2828
Kojto 109:9296ab0bfc11 2829 /**
Kojto 109:9296ab0bfc11 2830 * @brief Enable ADC discontinuous conversion mode for injected group
Kojto 109:9296ab0bfc11 2831 * @param _INJECT_DISCONTINUOUS_MODE_: Injected discontinuous mode.
Kojto 109:9296ab0bfc11 2832 * @retval None
Kojto 109:9296ab0bfc11 2833 */
Kojto 109:9296ab0bfc11 2834 #define __HAL_ADC_CFGR_INJECT_DISCCONTINUOUS(_INJECT_DISCONTINUOUS_MODE_) ((_INJECT_DISCONTINUOUS_MODE_) << 20)
Kojto 109:9296ab0bfc11 2835
Kojto 109:9296ab0bfc11 2836 /**
Kojto 109:9296ab0bfc11 2837 * @brief Enable ADC discontinuous conversion mode for regular group
Kojto 109:9296ab0bfc11 2838 * @param _REG_DISCONTINUOUS_MODE_: Regular discontinuous mode.
Kojto 109:9296ab0bfc11 2839 * @retval None
Kojto 109:9296ab0bfc11 2840 */
Kojto 109:9296ab0bfc11 2841 #define __HAL_ADC_CFGR_REG_DISCCONTINUOUS(_REG_DISCONTINUOUS_MODE_) ((_REG_DISCONTINUOUS_MODE_) << 16)
Kojto 109:9296ab0bfc11 2842
Kojto 109:9296ab0bfc11 2843 /**
Kojto 109:9296ab0bfc11 2844 * @brief Configures the number of discontinuous conversions for regular group.
Kojto 109:9296ab0bfc11 2845 * @param _NBR_DISCONTINUOUS_CONV_: Number of discontinuous conversions.
Kojto 109:9296ab0bfc11 2846 * @retval None
Kojto 109:9296ab0bfc11 2847 */
Kojto 109:9296ab0bfc11 2848 #define __HAL_ADC_CFGR_DISCONTINUOUS_NUM(_NBR_DISCONTINUOUS_CONV_) (((_NBR_DISCONTINUOUS_CONV_) - 1) << 17)
Kojto 109:9296ab0bfc11 2849
Kojto 109:9296ab0bfc11 2850 /**
Kojto 109:9296ab0bfc11 2851 * @brief Enable the ADC auto delay mode.
Kojto 109:9296ab0bfc11 2852 * @param _AUTOWAIT_: Auto delay bit enable or disable.
Kojto 109:9296ab0bfc11 2853 * @retval None
Kojto 109:9296ab0bfc11 2854 */
Kojto 109:9296ab0bfc11 2855 #define __HAL_ADC_CFGR_AUTOWAIT(_AUTOWAIT_) ((_AUTOWAIT_) << 14)
Kojto 109:9296ab0bfc11 2856
Kojto 109:9296ab0bfc11 2857 /**
Kojto 109:9296ab0bfc11 2858 * @brief Enable ADC continuous conversion mode.
Kojto 109:9296ab0bfc11 2859 * @param _CONTINUOUS_MODE_: Continuous mode.
Kojto 109:9296ab0bfc11 2860 * @retval None
Kojto 109:9296ab0bfc11 2861 */
Kojto 109:9296ab0bfc11 2862 #define __HAL_ADC_CFGR_CONTINUOUS(_CONTINUOUS_MODE_) ((_CONTINUOUS_MODE_) << 13)
Kojto 109:9296ab0bfc11 2863
Kojto 109:9296ab0bfc11 2864 /**
Kojto 109:9296ab0bfc11 2865 * @brief Enable ADC overrun mode.
Kojto 109:9296ab0bfc11 2866 * @param _OVERRUN_MODE_: Overrun mode.
Kojto 109:9296ab0bfc11 2867 * @retval Overrun bit setting to be programmed into CFGR register
Kojto 109:9296ab0bfc11 2868 */
Kojto 109:9296ab0bfc11 2869 /* Note: Bit ADC_CFGR_OVRMOD not used directly in constant */
Kojto 109:9296ab0bfc11 2870 /* "OVR_DATA_OVERWRITTEN" to have this case defined to 0x00, to set it as the */
Kojto 109:9296ab0bfc11 2871 /* default case to be compliant with other STM32 devices. */
Kojto 109:9296ab0bfc11 2872 #define __HAL_ADC_CFGR_OVERRUN(_OVERRUN_MODE_) \
Kojto 109:9296ab0bfc11 2873 ( ( (_OVERRUN_MODE_) != (OVR_DATA_PRESERVED) \
Kojto 109:9296ab0bfc11 2874 )? (ADC_CFGR_OVRMOD) : (0x00000000) \
Kojto 109:9296ab0bfc11 2875 )
Kojto 109:9296ab0bfc11 2876
Kojto 109:9296ab0bfc11 2877 /**
Kojto 109:9296ab0bfc11 2878 * @brief Enable the ADC DMA continuous request.
Kojto 109:9296ab0bfc11 2879 * @param _DMACONTREQ_MODE_: DMA continuous request mode.
Kojto 109:9296ab0bfc11 2880 * @retval None
Kojto 109:9296ab0bfc11 2881 */
Kojto 109:9296ab0bfc11 2882 #define __HAL_ADC_CFGR_DMACONTREQ(_DMACONTREQ_MODE_) ((_DMACONTREQ_MODE_) << 1)
Kojto 109:9296ab0bfc11 2883
Kojto 109:9296ab0bfc11 2884 /**
Kojto 109:9296ab0bfc11 2885 * @brief For devices with 3 ADCs or more: Defines the external trigger source
Kojto 109:9296ab0bfc11 2886 * for regular group according to ADC into common group ADC1&ADC2 or
Kojto 109:9296ab0bfc11 2887 * ADC3&ADC4 (some triggers with same source have different value to
Kojto 109:9296ab0bfc11 2888 * be programmed into ADC EXTSEL bits of CFGR register).
Kojto 109:9296ab0bfc11 2889 * Note: No risk of trigger bits value of common group ADC1&ADC2
Kojto 109:9296ab0bfc11 2890 * misleading to another trigger at same bits value, because the 3
Kojto 109:9296ab0bfc11 2891 * exceptions below are circular and do not point to any other trigger
Kojto 109:9296ab0bfc11 2892 * with direct treatment.
Kojto 109:9296ab0bfc11 2893 * For devices with 2 ADCs or less: this macro makes no change.
Kojto 109:9296ab0bfc11 2894 * @param __HANDLE__: ADC handle
Kojto 109:9296ab0bfc11 2895 * @param __EXT_TRIG_CONV__: External trigger selected for regular group.
Kojto 109:9296ab0bfc11 2896 * @retval External trigger to be programmed into EXTSEL bits of CFGR register
Kojto 109:9296ab0bfc11 2897 */
Kojto 109:9296ab0bfc11 2898 #if defined(STM32F303xE) || defined(STM32F398xx) || \
Kojto 109:9296ab0bfc11 2899 defined(STM32F303xC) || defined(STM32F358xx)
Kojto 109:9296ab0bfc11 2900
Kojto 109:9296ab0bfc11 2901 #if defined(STM32F303xC) || defined(STM32F358xx)
Kojto 109:9296ab0bfc11 2902 #define __HAL_ADC_CFGR_EXTSEL(__HANDLE__, __EXT_TRIG_CONV__) \
Kojto 109:9296ab0bfc11 2903 (( ((((__HANDLE__)->Instance) == ADC3) || (((__HANDLE__)->Instance) == ADC4)) \
Kojto 109:9296ab0bfc11 2904 )? \
Kojto 109:9296ab0bfc11 2905 ( ( (__EXT_TRIG_CONV__) == ADC_EXTERNALTRIGCONV_T2_TRGO \
Kojto 109:9296ab0bfc11 2906 )? \
Kojto 109:9296ab0bfc11 2907 (ADC3_4_EXTERNALTRIG_T2_TRGO) \
Kojto 109:9296ab0bfc11 2908 : \
Kojto 109:9296ab0bfc11 2909 ( ( (__EXT_TRIG_CONV__) == ADC_EXTERNALTRIGCONV_T3_TRGO \
Kojto 109:9296ab0bfc11 2910 )? \
Kojto 109:9296ab0bfc11 2911 (ADC3_4_EXTERNALTRIG_T3_TRGO) \
Kojto 109:9296ab0bfc11 2912 : \
Kojto 109:9296ab0bfc11 2913 ( ( (__EXT_TRIG_CONV__) == ADC_EXTERNALTRIGCONV_T8_TRGO \
Kojto 109:9296ab0bfc11 2914 )? \
Kojto 109:9296ab0bfc11 2915 (ADC3_4_EXTERNALTRIG_T8_TRGO) \
Kojto 109:9296ab0bfc11 2916 : \
Kojto 109:9296ab0bfc11 2917 (__EXT_TRIG_CONV__) \
Kojto 109:9296ab0bfc11 2918 ) \
Kojto 109:9296ab0bfc11 2919 ) \
Kojto 109:9296ab0bfc11 2920 ) \
Kojto 109:9296ab0bfc11 2921 : \
Kojto 109:9296ab0bfc11 2922 (__EXT_TRIG_CONV__) \
Kojto 109:9296ab0bfc11 2923 )
Kojto 109:9296ab0bfc11 2924 #endif /* STM32F303xC || STM32F358xx */
Kojto 109:9296ab0bfc11 2925
Kojto 109:9296ab0bfc11 2926 #if defined(STM32F303xE) || defined(STM32F398xx)
Kojto 109:9296ab0bfc11 2927 /* Note: Macro including external triggers specific to device STM303xE: using */
Kojto 109:9296ab0bfc11 2928 /* Timer20 with ADC trigger input remap. */
Kojto 109:9296ab0bfc11 2929 #define __HAL_ADC_CFGR_EXTSEL(__HANDLE__, __EXT_TRIG_CONV__) \
Kojto 109:9296ab0bfc11 2930 (( ((((__HANDLE__)->Instance) == ADC3) || (((__HANDLE__)->Instance) == ADC4)) \
Kojto 109:9296ab0bfc11 2931 )? \
Kojto 109:9296ab0bfc11 2932 ( ( (__EXT_TRIG_CONV__) == ADC_EXTERNALTRIGCONV_T2_TRGO \
Kojto 109:9296ab0bfc11 2933 )? \
Kojto 109:9296ab0bfc11 2934 (ADC3_4_EXTERNALTRIG_T2_TRGO) \
Kojto 109:9296ab0bfc11 2935 : \
Kojto 109:9296ab0bfc11 2936 ( ( (__EXT_TRIG_CONV__) == ADC_EXTERNALTRIGCONV_T3_TRGO \
Kojto 109:9296ab0bfc11 2937 )? \
Kojto 109:9296ab0bfc11 2938 (ADC3_4_EXTERNALTRIG_T3_TRGO) \
Kojto 109:9296ab0bfc11 2939 : \
Kojto 109:9296ab0bfc11 2940 ( ( (__EXT_TRIG_CONV__) == ADC_EXTERNALTRIGCONV_T8_TRGO \
Kojto 109:9296ab0bfc11 2941 )? \
Kojto 109:9296ab0bfc11 2942 (ADC3_4_EXTERNALTRIG_T8_TRGO) \
Kojto 109:9296ab0bfc11 2943 : \
Kojto 109:9296ab0bfc11 2944 ( ( (__EXT_TRIG_CONV__) == ADC_EXTERNALTRIGCONV_T20_CC1 \
Kojto 109:9296ab0bfc11 2945 )? \
Kojto 109:9296ab0bfc11 2946 (ADC3_4_EXTERNALTRIG_T2_CC1) \
Kojto 109:9296ab0bfc11 2947 : \
Kojto 109:9296ab0bfc11 2948 ( ( (__EXT_TRIG_CONV__) == ADC_EXTERNALTRIGCONV_T20_TRGO \
Kojto 109:9296ab0bfc11 2949 )? \
Kojto 109:9296ab0bfc11 2950 (ADC3_4_EXTERNALTRIG_EXT_IT2) \
Kojto 109:9296ab0bfc11 2951 : \
Kojto 109:9296ab0bfc11 2952 ( ( (__EXT_TRIG_CONV__) == ADC_EXTERNALTRIGCONV_T20_TRGO2 \
Kojto 109:9296ab0bfc11 2953 )? \
Kojto 109:9296ab0bfc11 2954 (ADC3_4_EXTERNALTRIG_T4_CC1) \
Kojto 109:9296ab0bfc11 2955 : \
Kojto 109:9296ab0bfc11 2956 (__EXT_TRIG_CONV__) \
Kojto 109:9296ab0bfc11 2957 ) \
Kojto 109:9296ab0bfc11 2958 ) \
Kojto 109:9296ab0bfc11 2959 ) \
Kojto 109:9296ab0bfc11 2960 ) \
Kojto 109:9296ab0bfc11 2961 ) \
Kojto 109:9296ab0bfc11 2962 ) \
Kojto 109:9296ab0bfc11 2963 : \
Kojto 109:9296ab0bfc11 2964 (__EXT_TRIG_CONV__ & (~ADC_EXTERNALTRIGCONV_T20_MASK)) \
Kojto 109:9296ab0bfc11 2965 )
Kojto 109:9296ab0bfc11 2966 #endif /* STM32F303xE || STM32F398xx */
Kojto 109:9296ab0bfc11 2967 #else
Kojto 109:9296ab0bfc11 2968 #define __HAL_ADC_CFGR_EXTSEL(__HANDLE__, __EXT_TRIG_CONV__) \
Kojto 109:9296ab0bfc11 2969 (__EXT_TRIG_CONV__)
Kojto 109:9296ab0bfc11 2970 #endif /* STM32F303xE || STM32F398xx || */
Kojto 109:9296ab0bfc11 2971 /* STM32F303xC || STM32F358xx */
Kojto 109:9296ab0bfc11 2972
Kojto 109:9296ab0bfc11 2973 /**
Kojto 109:9296ab0bfc11 2974 * @brief For devices with 3 ADCs or more: Defines the external trigger source
Kojto 109:9296ab0bfc11 2975 * for injected group according to ADC into common group ADC1&ADC2 or
Kojto 109:9296ab0bfc11 2976 * ADC3&ADC4 (some triggers with same source have different value to
Kojto 109:9296ab0bfc11 2977 * be programmed into ADC JEXTSEL bits of JSQR register).
Kojto 109:9296ab0bfc11 2978 * Note: No risk of trigger bits value of common group ADC1&ADC2
Kojto 109:9296ab0bfc11 2979 * misleading to another trigger at same bits value, because the 3
Kojto 109:9296ab0bfc11 2980 * exceptions below are circular and do not point to any other trigger
Kojto 109:9296ab0bfc11 2981 * with direct treatment, except trigger
Kojto 109:9296ab0bfc11 2982 * ADC_EXTERNALTRIGINJECCONV_T4_CC3 differentiated with SW offset.
Kojto 109:9296ab0bfc11 2983 * For devices with 2 ADCs or less: this macro makes no change.
Kojto 109:9296ab0bfc11 2984 * @param __HANDLE__: ADC handle
Kojto 109:9296ab0bfc11 2985 * @param __EXT_TRIG_INJECTCONV__: External trigger selected for injected group
Kojto 109:9296ab0bfc11 2986 * @retval External trigger to be programmed into JEXTSEL bits of JSQR register
Kojto 109:9296ab0bfc11 2987 */
Kojto 109:9296ab0bfc11 2988 #if defined(STM32F303xC) || defined(STM32F303xE) || defined(STM32F398xx) || defined(STM32F358xx)
Kojto 109:9296ab0bfc11 2989 #if defined(STM32F303xC) || defined(STM32F358xx)
Kojto 109:9296ab0bfc11 2990 #define __HAL_ADC_JSQR_JEXTSEL(__HANDLE__, __EXT_TRIG_INJECTCONV__) \
Kojto 109:9296ab0bfc11 2991 (( ((((__HANDLE__)->Instance) == ADC3) || (((__HANDLE__)->Instance) == ADC4)) \
Kojto 109:9296ab0bfc11 2992 )? \
Kojto 109:9296ab0bfc11 2993 ( ( (__EXT_TRIG_INJECTCONV__) == ADC_EXTERNALTRIGINJECCONV_T2_TRGO \
Kojto 109:9296ab0bfc11 2994 )? \
Kojto 109:9296ab0bfc11 2995 (ADC3_4_EXTERNALTRIGINJEC_T2_TRGO) \
Kojto 109:9296ab0bfc11 2996 : \
Kojto 109:9296ab0bfc11 2997 ( ( (__EXT_TRIG_INJECTCONV__) == ADC_EXTERNALTRIGINJECCONV_T4_TRGO \
Kojto 109:9296ab0bfc11 2998 )? \
Kojto 109:9296ab0bfc11 2999 (ADC3_4_EXTERNALTRIGINJEC_T4_TRGO) \
Kojto 109:9296ab0bfc11 3000 : \
Kojto 109:9296ab0bfc11 3001 ( ( (__EXT_TRIG_INJECTCONV__) == ADC_EXTERNALTRIGINJECCONV_T8_CC4 \
Kojto 109:9296ab0bfc11 3002 )? \
Kojto 109:9296ab0bfc11 3003 (ADC3_4_EXTERNALTRIGINJEC_T8_CC4) \
Kojto 109:9296ab0bfc11 3004 : \
Kojto 109:9296ab0bfc11 3005 ( ( (__EXT_TRIG_INJECTCONV__) == ADC_EXTERNALTRIGINJECCONV_T4_CC3 \
Kojto 109:9296ab0bfc11 3006 )? \
Kojto 109:9296ab0bfc11 3007 (ADC3_4_EXTERNALTRIGINJEC_T4_CC3) \
Kojto 109:9296ab0bfc11 3008 : \
Kojto 109:9296ab0bfc11 3009 (__EXT_TRIG_INJECTCONV__) \
Kojto 109:9296ab0bfc11 3010 ) \
Kojto 109:9296ab0bfc11 3011 ) \
Kojto 109:9296ab0bfc11 3012 ) \
Kojto 109:9296ab0bfc11 3013 ) \
Kojto 109:9296ab0bfc11 3014 : \
Kojto 109:9296ab0bfc11 3015 (__EXT_TRIG_INJECTCONV__) \
Kojto 109:9296ab0bfc11 3016 )
Kojto 109:9296ab0bfc11 3017 #endif /* STM32F303xC || STM32F358xx */
Kojto 109:9296ab0bfc11 3018
Kojto 109:9296ab0bfc11 3019 #if defined(STM32F303xE) || defined(STM32F398xx)
Kojto 109:9296ab0bfc11 3020 /* Note: Macro including external triggers specific to device STM303xE: using */
Kojto 109:9296ab0bfc11 3021 /* Timer20 with ADC trigger input remap. */
Kojto 109:9296ab0bfc11 3022 #define __HAL_ADC_JSQR_JEXTSEL(__HANDLE__, __EXT_TRIG_INJECTCONV__) \
Kojto 109:9296ab0bfc11 3023 (( ((((__HANDLE__)->Instance) == ADC3) || (((__HANDLE__)->Instance) == ADC4)) \
Kojto 109:9296ab0bfc11 3024 )? \
Kojto 109:9296ab0bfc11 3025 ( ( (__EXT_TRIG_INJECTCONV__) == ADC_EXTERNALTRIGINJECCONV_T2_TRGO \
Kojto 109:9296ab0bfc11 3026 )? \
Kojto 109:9296ab0bfc11 3027 (ADC3_4_EXTERNALTRIGINJEC_T2_TRGO) \
Kojto 109:9296ab0bfc11 3028 : \
Kojto 109:9296ab0bfc11 3029 ( ( (__EXT_TRIG_INJECTCONV__) == ADC_EXTERNALTRIGINJECCONV_T4_TRGO \
Kojto 109:9296ab0bfc11 3030 )? \
Kojto 109:9296ab0bfc11 3031 (ADC3_4_EXTERNALTRIGINJEC_T4_TRGO) \
Kojto 109:9296ab0bfc11 3032 : \
Kojto 109:9296ab0bfc11 3033 ( ( (__EXT_TRIG_INJECTCONV__) == ADC_EXTERNALTRIGINJECCONV_T8_CC4 \
Kojto 109:9296ab0bfc11 3034 )? \
Kojto 109:9296ab0bfc11 3035 (ADC3_4_EXTERNALTRIGINJEC_T8_CC4) \
Kojto 109:9296ab0bfc11 3036 : \
Kojto 109:9296ab0bfc11 3037 ( ( (__EXT_TRIG_INJECTCONV__) == ADC_EXTERNALTRIGINJECCONV_T4_CC3 \
Kojto 109:9296ab0bfc11 3038 )? \
Kojto 109:9296ab0bfc11 3039 (ADC3_4_EXTERNALTRIGINJEC_T4_CC3) \
Kojto 109:9296ab0bfc11 3040 : \
Kojto 109:9296ab0bfc11 3041 ( ( (__EXT_TRIG_INJECTCONV__) \
Kojto 109:9296ab0bfc11 3042 == ADC_EXTERNALTRIGINJECCONV_T20_TRGO \
Kojto 109:9296ab0bfc11 3043 )? \
Kojto 109:9296ab0bfc11 3044 (ADC3_4_EXTERNALTRIGINJEC_T20_TRGO) \
Kojto 109:9296ab0bfc11 3045 : \
Kojto 109:9296ab0bfc11 3046 ( ( (__EXT_TRIG_INJECTCONV__) \
Kojto 109:9296ab0bfc11 3047 == ADC_EXTERNALTRIGINJECCONV_T20_TRGO2 \
Kojto 109:9296ab0bfc11 3048 )? \
Kojto 109:9296ab0bfc11 3049 (ADC3_4_EXTERNALTRIGINJEC_T1_CC3) \
Kojto 109:9296ab0bfc11 3050 : \
Kojto 109:9296ab0bfc11 3051 (__EXT_TRIG_INJECTCONV__) \
Kojto 109:9296ab0bfc11 3052 ) \
Kojto 109:9296ab0bfc11 3053 ) \
Kojto 109:9296ab0bfc11 3054 ) \
Kojto 109:9296ab0bfc11 3055 ) \
Kojto 109:9296ab0bfc11 3056 ) \
Kojto 109:9296ab0bfc11 3057 ) \
Kojto 109:9296ab0bfc11 3058 : \
Kojto 109:9296ab0bfc11 3059 (__EXT_TRIG_INJECTCONV__ & (~ADC_EXTERNALTRIGCONV_T20_MASK)) \
Kojto 109:9296ab0bfc11 3060 )
Kojto 109:9296ab0bfc11 3061 #endif /* STM32F303xE || STM32F398xx */
Kojto 109:9296ab0bfc11 3062 #else
Kojto 109:9296ab0bfc11 3063 #define __HAL_ADC_JSQR_JEXTSEL(__HANDLE__, __EXT_TRIG_INJECTCONV__) \
Kojto 109:9296ab0bfc11 3064 (__EXT_TRIG_INJECTCONV__)
Kojto 109:9296ab0bfc11 3065 #endif /* STM32F303xE || STM32F398xx || */
Kojto 109:9296ab0bfc11 3066 /* STM32F303xC || STM32F358xx */
Kojto 109:9296ab0bfc11 3067
Kojto 109:9296ab0bfc11 3068 /**
Kojto 109:9296ab0bfc11 3069 * @brief Configure the channel number into offset OFRx register
Kojto 109:9296ab0bfc11 3070 * @param _CHANNEL_: ADC Channel
Kojto 109:9296ab0bfc11 3071 * @retval None
Kojto 109:9296ab0bfc11 3072 */
Kojto 109:9296ab0bfc11 3073 #define __HAL_ADC_OFR_CHANNEL(_CHANNEL_) ((_CHANNEL_) << 26)
Kojto 109:9296ab0bfc11 3074
Kojto 109:9296ab0bfc11 3075 /**
Kojto 109:9296ab0bfc11 3076 * @brief Configure the channel number into differential mode selection register
Kojto 109:9296ab0bfc11 3077 * @param _CHANNEL_: ADC Channel
Kojto 109:9296ab0bfc11 3078 * @retval None
Kojto 109:9296ab0bfc11 3079 */
Kojto 109:9296ab0bfc11 3080 #define __HAL_ADC_DIFSEL_CHANNEL(_CHANNEL_) (1U << (_CHANNEL_))
Kojto 109:9296ab0bfc11 3081
Kojto 109:9296ab0bfc11 3082 /**
Kojto 109:9296ab0bfc11 3083 * @brief Calibration factor in differential mode to be set into calibration register
Kojto 109:9296ab0bfc11 3084 * @param _Calibration_Factor_: Calibration factor value
Kojto 109:9296ab0bfc11 3085 * @retval None
Kojto 109:9296ab0bfc11 3086 */
Kojto 109:9296ab0bfc11 3087 #define __HAL_ADC_CALFACT_DIFF_SET(_Calibration_Factor_) ((_Calibration_Factor_) << 16)
Kojto 109:9296ab0bfc11 3088
Kojto 109:9296ab0bfc11 3089 /**
Kojto 109:9296ab0bfc11 3090 * @brief Calibration factor in differential mode to be retrieved from calibration register
Kojto 109:9296ab0bfc11 3091 * @param _Calibration_Factor_: Calibration factor value
Kojto 109:9296ab0bfc11 3092 * @retval None
Kojto 109:9296ab0bfc11 3093 */
Kojto 109:9296ab0bfc11 3094 #define __HAL_ADC_CALFACT_DIFF_GET(_Calibration_Factor_) ((_Calibration_Factor_) >> 16)
Kojto 109:9296ab0bfc11 3095
Kojto 109:9296ab0bfc11 3096 /**
Kojto 109:9296ab0bfc11 3097 * @brief Configure the analog watchdog high threshold into registers TR1, TR2 or TR3.
Kojto 109:9296ab0bfc11 3098 * @param _Threshold_: Threshold value
Kojto 109:9296ab0bfc11 3099 * @retval None
Kojto 109:9296ab0bfc11 3100 */
Kojto 109:9296ab0bfc11 3101 #define __HAL_ADC_TRX_HIGHTHRESHOLD(_Threshold_) ((_Threshold_) << 16)
Kojto 109:9296ab0bfc11 3102
Kojto 109:9296ab0bfc11 3103 /**
Kojto 109:9296ab0bfc11 3104 * @brief Enable the ADC DMA continuous request for ADC multimode.
Kojto 109:9296ab0bfc11 3105 * @param _DMAContReq_MODE_: DMA continuous request mode.
Kojto 109:9296ab0bfc11 3106 * @retval None
Kojto 109:9296ab0bfc11 3107 */
Kojto 109:9296ab0bfc11 3108 #define __HAL_ADC_CCR_MULTI_DMACONTREQ(_DMAContReq_MODE_) ((_DMAContReq_MODE_) << 13)
Kojto 109:9296ab0bfc11 3109
Kojto 109:9296ab0bfc11 3110
Kojto 109:9296ab0bfc11 3111 /**
Kojto 109:9296ab0bfc11 3112 * @brief Enable the ADC peripheral
Kojto 109:9296ab0bfc11 3113 * @param __HANDLE__: ADC handle
Kojto 109:9296ab0bfc11 3114 * @retval None
Kojto 109:9296ab0bfc11 3115 */
Kojto 109:9296ab0bfc11 3116 #define __HAL_ADC_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= ADC_CR_ADEN)
Kojto 109:9296ab0bfc11 3117
Kojto 109:9296ab0bfc11 3118 /**
Kojto 109:9296ab0bfc11 3119 * @brief Verification of hardware constraints before ADC can be enabled
Kojto 109:9296ab0bfc11 3120 * @param __HANDLE__: ADC handle
Kojto 109:9296ab0bfc11 3121 * @retval SET (ADC can be enabled) or RESET (ADC cannot be enabled)
Kojto 109:9296ab0bfc11 3122 */
Kojto 109:9296ab0bfc11 3123 #define __HAL_ADC_ENABLING_CONDITIONS(__HANDLE__) \
Kojto 109:9296ab0bfc11 3124 (( ( ((__HANDLE__)->Instance->CR) & \
Kojto 109:9296ab0bfc11 3125 (ADC_CR_ADCAL | ADC_CR_JADSTP | ADC_CR_ADSTP | ADC_CR_JADSTART | \
Kojto 109:9296ab0bfc11 3126 ADC_CR_ADSTART | ADC_CR_ADDIS | ADC_CR_ADEN ) \
Kojto 109:9296ab0bfc11 3127 ) == RESET \
Kojto 109:9296ab0bfc11 3128 ) ? SET : RESET)
Kojto 109:9296ab0bfc11 3129
Kojto 109:9296ab0bfc11 3130 /**
Kojto 109:9296ab0bfc11 3131 * @brief Disable the ADC peripheral
Kojto 109:9296ab0bfc11 3132 * @param __HANDLE__: ADC handle
Kojto 109:9296ab0bfc11 3133 * @retval None
Kojto 109:9296ab0bfc11 3134 */
Kojto 109:9296ab0bfc11 3135 #define __HAL_ADC_DISABLE(__HANDLE__) \
Kojto 109:9296ab0bfc11 3136 do{ \
Kojto 109:9296ab0bfc11 3137 (__HANDLE__)->Instance->CR |= ADC_CR_ADDIS; \
Kojto 109:9296ab0bfc11 3138 __HAL_ADC_CLEAR_FLAG((__HANDLE__), (ADC_FLAG_EOSMP | ADC_FLAG_RDY)); \
Kojto 109:9296ab0bfc11 3139 } while(0)
Kojto 109:9296ab0bfc11 3140
Kojto 109:9296ab0bfc11 3141 /**
Kojto 109:9296ab0bfc11 3142 * @brief Verification of hardware constraints before ADC can be disabled
Kojto 109:9296ab0bfc11 3143 * @param __HANDLE__: ADC handle
Kojto 109:9296ab0bfc11 3144 * @retval SET (ADC can be disabled) or RESET (ADC cannot be disabled)
Kojto 109:9296ab0bfc11 3145 */
Kojto 109:9296ab0bfc11 3146 #define __HAL_ADC_DISABLING_CONDITIONS(__HANDLE__) \
Kojto 109:9296ab0bfc11 3147 (( ( ((__HANDLE__)->Instance->CR) & \
Kojto 109:9296ab0bfc11 3148 (ADC_CR_JADSTART | ADC_CR_ADSTART | ADC_CR_ADEN)) == ADC_CR_ADEN \
Kojto 109:9296ab0bfc11 3149 ) ? SET : RESET)
Kojto 109:9296ab0bfc11 3150
Kojto 109:9296ab0bfc11 3151
Kojto 109:9296ab0bfc11 3152 /**
Kojto 109:9296ab0bfc11 3153 * @brief Shift the offset in function of the selected ADC resolution.
Kojto 109:9296ab0bfc11 3154 * Offset has to be left-aligned on bit 11, the LSB (right bits) are set to 0
Kojto 109:9296ab0bfc11 3155 * If resolution 12 bits, no shift.
Kojto 109:9296ab0bfc11 3156 * If resolution 10 bits, shift of 2 ranks on the left.
Kojto 109:9296ab0bfc11 3157 * If resolution 8 bits, shift of 4 ranks on the left.
Kojto 109:9296ab0bfc11 3158 * If resolution 6 bits, shift of 6 ranks on the left.
Kojto 109:9296ab0bfc11 3159 * therefore, shift = (12 - resolution) = 12 - (12- (((RES[1:0]) >> 3)*2))
Kojto 109:9296ab0bfc11 3160 * @param __HANDLE__: ADC handle
Kojto 109:9296ab0bfc11 3161 * @param _Offset_: Value to be shifted
Kojto 109:9296ab0bfc11 3162 * @retval None
Kojto 109:9296ab0bfc11 3163 */
Kojto 109:9296ab0bfc11 3164 #define __HAL_ADC_OFFSET_SHIFT_RESOLUTION(__HANDLE__, _Offset_) \
Kojto 109:9296ab0bfc11 3165 ((_Offset_) << ((((__HANDLE__)->Instance->CFGR & ADC_CFGR_RES) >> 3)*2))
Kojto 109:9296ab0bfc11 3166
Kojto 109:9296ab0bfc11 3167 /**
Kojto 109:9296ab0bfc11 3168 * @brief Shift the AWD1 threshold in function of the selected ADC resolution.
Kojto 109:9296ab0bfc11 3169 * Thresholds have to be left-aligned on bit 11, the LSB (right bits) are set to 0.
Kojto 109:9296ab0bfc11 3170 * If resolution 12 bits, no shift.
Kojto 109:9296ab0bfc11 3171 * If resolution 10 bits, shift of 2 ranks on the left.
Kojto 109:9296ab0bfc11 3172 * If resolution 8 bits, shift of 4 ranks on the left.
Kojto 109:9296ab0bfc11 3173 * If resolution 6 bits, shift of 6 ranks on the left.
Kojto 109:9296ab0bfc11 3174 * therefore, shift = (12 - resolution) = 12 - (12- (((RES[1:0]) >> 3)*2))
Kojto 109:9296ab0bfc11 3175 * @param __HANDLE__: ADC handle
Kojto 109:9296ab0bfc11 3176 * @param _Threshold_: Value to be shifted
Kojto 109:9296ab0bfc11 3177 * @retval None
Kojto 109:9296ab0bfc11 3178 */
Kojto 109:9296ab0bfc11 3179 #define __HAL_ADC_AWD1THRESHOLD_SHIFT_RESOLUTION(__HANDLE__, _Threshold_) \
Kojto 109:9296ab0bfc11 3180 ((_Threshold_) << ((((__HANDLE__)->Instance->CFGR & ADC_CFGR_RES) >> 3)*2))
Kojto 109:9296ab0bfc11 3181
Kojto 109:9296ab0bfc11 3182 /**
Kojto 109:9296ab0bfc11 3183 * @brief Shift the AWD2 and AWD3 threshold in function of the selected ADC resolution.
Kojto 109:9296ab0bfc11 3184 * Thresholds have to be left-aligned on bit 7.
Kojto 109:9296ab0bfc11 3185 * If resolution 12 bits, shift of 4 ranks on the right (the 4 LSB are discarded)
Kojto 109:9296ab0bfc11 3186 * If resolution 10 bits, shift of 2 ranks on the right (the 2 LSB are discarded)
Kojto 109:9296ab0bfc11 3187 * If resolution 8 bits, no shift.
Kojto 109:9296ab0bfc11 3188 * If resolution 6 bits, shift of 2 ranks on the left (the 2 LSB are set to 0)
Kojto 109:9296ab0bfc11 3189 * @param __HANDLE__: ADC handle
Kojto 109:9296ab0bfc11 3190 * @param _Threshold_: Value to be shifted
Kojto 109:9296ab0bfc11 3191 * @retval None
Kojto 109:9296ab0bfc11 3192 */
Kojto 109:9296ab0bfc11 3193 #define __HAL_ADC_AWD23THRESHOLD_SHIFT_RESOLUTION(__HANDLE__, _Threshold_) \
Kojto 109:9296ab0bfc11 3194 ( ((__HANDLE__)->Instance->CFGR & ADC_CFGR_RES) != (ADC_CFGR_RES_1 | ADC_CFGR_RES_0) ? \
Kojto 109:9296ab0bfc11 3195 ((_Threshold_) >> (4- ((((__HANDLE__)->Instance->CFGR & ADC_CFGR_RES) >> 3)*2))) : \
Kojto 109:9296ab0bfc11 3196 (_Threshold_) << 2 )
Kojto 109:9296ab0bfc11 3197
Kojto 109:9296ab0bfc11 3198 /**
Kojto 109:9296ab0bfc11 3199 * @brief Defines if the selected ADC is within ADC common register ADC1_2 or ADC3_4
Kojto 109:9296ab0bfc11 3200 * if available (ADC2, ADC3, ADC4 availability depends on STM32 product)
Kojto 109:9296ab0bfc11 3201 * @param __HANDLE__: ADC handle
Kojto 109:9296ab0bfc11 3202 * @retval Common control register ADC1_2 or ADC3_4
Kojto 109:9296ab0bfc11 3203 */
Kojto 109:9296ab0bfc11 3204 #if defined(STM32F303xE) || defined(STM32F398xx) || \
Kojto 109:9296ab0bfc11 3205 defined(STM32F303xC) || defined(STM32F358xx)
Kojto 109:9296ab0bfc11 3206 #define __HAL_ADC_COMMON_REGISTER(__HANDLE__) \
Kojto 109:9296ab0bfc11 3207 ( ( ((((__HANDLE__)->Instance) == ADC1) || (((__HANDLE__)->Instance) == ADC2)) \
Kojto 109:9296ab0bfc11 3208 )? (ADC1_2_COMMON) : (ADC3_4_COMMON) \
Kojto 109:9296ab0bfc11 3209 )
Kojto 109:9296ab0bfc11 3210 #endif /* STM32F303xE || STM32F398xx || */
Kojto 109:9296ab0bfc11 3211 /* STM32F303xC || STM32F358xx */
Kojto 109:9296ab0bfc11 3212
Kojto 109:9296ab0bfc11 3213 #if defined(STM32F302xE) || \
Kojto 109:9296ab0bfc11 3214 defined(STM32F302xC) || \
Kojto 109:9296ab0bfc11 3215 defined(STM32F303x8) || defined(STM32F334x8) || defined(STM32F328xx)
Kojto 109:9296ab0bfc11 3216 #define __HAL_ADC_COMMON_REGISTER(__HANDLE__) \
Kojto 109:9296ab0bfc11 3217 (ADC1_2_COMMON)
Kojto 109:9296ab0bfc11 3218 #endif /* STM32F302xE || */
Kojto 109:9296ab0bfc11 3219 /* STM32F302xC || */
Kojto 109:9296ab0bfc11 3220 /* STM32F303x8 || STM32F328xx || STM32F334x8 */
Kojto 109:9296ab0bfc11 3221
Kojto 109:9296ab0bfc11 3222 #if defined(STM32F301x8) || defined(STM32F302x8) || defined(STM32F318xx)
Kojto 109:9296ab0bfc11 3223 #define __HAL_ADC_COMMON_REGISTER(__HANDLE__) \
Kojto 109:9296ab0bfc11 3224 (ADC1_COMMON)
Kojto 109:9296ab0bfc11 3225 #endif /* STM32F301x8 || STM32F302x8 || STM32F318xx */
Kojto 109:9296ab0bfc11 3226
Kojto 109:9296ab0bfc11 3227 /**
Kojto 109:9296ab0bfc11 3228 * @brief Selection of ADC common register CCR bits MULTI[4:0]corresponding to the selected ADC (applicable for devices with several ADCs)
Kojto 109:9296ab0bfc11 3229 * @param __HANDLE__: ADC handle
Kojto 109:9296ab0bfc11 3230 * @retval None
Kojto 109:9296ab0bfc11 3231 */
Kojto 109:9296ab0bfc11 3232 #if defined(STM32F303xE) || defined(STM32F398xx) || \
Kojto 109:9296ab0bfc11 3233 defined(STM32F303xC) || defined(STM32F358xx)
Kojto 109:9296ab0bfc11 3234 #define __HAL_ADC_COMMON_CCR_MULTI(__HANDLE__) \
Kojto 109:9296ab0bfc11 3235 ( ( ((((__HANDLE__)->Instance) == ADC1) || (((__HANDLE__)->Instance) == ADC2)) \
Kojto 109:9296ab0bfc11 3236 )? \
Kojto 109:9296ab0bfc11 3237 (ADC1_2_COMMON->CCR & ADC12_CCR_MULTI) \
Kojto 109:9296ab0bfc11 3238 : \
Kojto 109:9296ab0bfc11 3239 (ADC3_4_COMMON->CCR & ADC34_CCR_MULTI) \
Kojto 109:9296ab0bfc11 3240 )
Kojto 109:9296ab0bfc11 3241 #endif /* STM32F303xE || STM32F398xx || */
Kojto 109:9296ab0bfc11 3242 /* STM32F303xC || STM32F358xx */
Kojto 109:9296ab0bfc11 3243
Kojto 109:9296ab0bfc11 3244 #if defined(STM32F302xE) || \
Kojto 109:9296ab0bfc11 3245 defined(STM32F302xC) || \
Kojto 109:9296ab0bfc11 3246 defined(STM32F303x8) || defined(STM32F334x8) || defined(STM32F328xx)
Kojto 109:9296ab0bfc11 3247 #define __HAL_ADC_COMMON_CCR_MULTI(__HANDLE__) \
Kojto 109:9296ab0bfc11 3248 (ADC1_2_COMMON->CCR & ADC12_CCR_MULTI)
Kojto 109:9296ab0bfc11 3249 #endif /* STM32F302xE || */
Kojto 109:9296ab0bfc11 3250 /* STM32F302xC || */
Kojto 109:9296ab0bfc11 3251 /* STM32F303x8 || STM32F328xx || STM32F334x8 */
Kojto 109:9296ab0bfc11 3252
Kojto 109:9296ab0bfc11 3253 #if defined(STM32F301x8) || defined(STM32F302x8) || defined(STM32F318xx)
Kojto 109:9296ab0bfc11 3254 #define __HAL_ADC_COMMON_CCR_MULTI(__HANDLE__) \
Kojto 109:9296ab0bfc11 3255 (RESET)
Kojto 109:9296ab0bfc11 3256 #endif /* STM32F301x8 || STM32F302x8 || STM32F318xx */
Kojto 109:9296ab0bfc11 3257
Kojto 109:9296ab0bfc11 3258 /**
Kojto 109:9296ab0bfc11 3259 * @brief Verification of condition for ADC start conversion: ADC must be in non-multimode, or multimode with handle of ADC master (applicable for devices with several ADCs)
Kojto 109:9296ab0bfc11 3260 * @param __HANDLE__: ADC handle
Kojto 109:9296ab0bfc11 3261 * @retval None
Kojto 109:9296ab0bfc11 3262 */
Kojto 109:9296ab0bfc11 3263 #if defined(STM32F302xE) || defined(STM32F303xE) || defined(STM32F398xx) || \
Kojto 109:9296ab0bfc11 3264 defined(STM32F302xC) || defined(STM32F303xC) || defined(STM32F358xx) || \
Kojto 109:9296ab0bfc11 3265 defined(STM32F303x8) || defined(STM32F334x8) || defined(STM32F328xx)
Kojto 109:9296ab0bfc11 3266 #define __HAL_ADC_NONMULTIMODE_OR_MULTIMODEMASTER(__HANDLE__) \
Kojto 109:9296ab0bfc11 3267 ((__HAL_ADC_COMMON_CCR_MULTI(__HANDLE__) == RESET) || (IS_ADC_MULTIMODE_MASTER_INSTANCE((__HANDLE__)->Instance)))
Kojto 109:9296ab0bfc11 3268 #endif /* STM32F302xE || STM32F303xE || STM32F398xx || */
Kojto 109:9296ab0bfc11 3269 /* STM32F302xC || STM32F303xC || STM32F358xx || */
Kojto 109:9296ab0bfc11 3270 /* STM32F303x8 || STM32F334x8 || STM32F328xx */
Kojto 109:9296ab0bfc11 3271
Kojto 109:9296ab0bfc11 3272 #if defined(STM32F301x8) || defined(STM32F302x8) || defined(STM32F318xx)
Kojto 109:9296ab0bfc11 3273 #define __HAL_ADC_NONMULTIMODE_OR_MULTIMODEMASTER(__HANDLE__) \
Kojto 109:9296ab0bfc11 3274 (!RESET)
Kojto 109:9296ab0bfc11 3275 #endif /* STM32F301x8 || STM32F302x8 || STM32F318xx */
Kojto 109:9296ab0bfc11 3276
Kojto 109:9296ab0bfc11 3277 /**
Kojto 109:9296ab0bfc11 3278 * @brief Set handle of the other ADC sharing the same common register ADC1_2 or ADC3_4
Kojto 109:9296ab0bfc11 3279 * if available (ADC2, ADC3, ADC4 availability depends on STM32 product)
Kojto 109:9296ab0bfc11 3280 * @param __HANDLE__: ADC handle
Kojto 109:9296ab0bfc11 3281 * @param __HANDLE_OTHER_ADC__: other ADC handle
Kojto 109:9296ab0bfc11 3282 * @retval None
Kojto 109:9296ab0bfc11 3283 */
Kojto 109:9296ab0bfc11 3284 #if defined(STM32F303xE) || defined(STM32F398xx) || \
Kojto 109:9296ab0bfc11 3285 defined(STM32F303xC) || defined(STM32F358xx)
Kojto 109:9296ab0bfc11 3286 #define __HAL_ADC_COMMON_ADC_OTHER(__HANDLE__, __HANDLE_OTHER_ADC__) \
Kojto 109:9296ab0bfc11 3287 ( ( ((__HANDLE__)->Instance == ADC1) \
Kojto 109:9296ab0bfc11 3288 )? \
Kojto 109:9296ab0bfc11 3289 ((__HANDLE_OTHER_ADC__)->Instance = ADC2) \
Kojto 109:9296ab0bfc11 3290 : \
Kojto 109:9296ab0bfc11 3291 ( ( ((__HANDLE__)->Instance == ADC2) \
Kojto 109:9296ab0bfc11 3292 )? \
Kojto 109:9296ab0bfc11 3293 ((__HANDLE_OTHER_ADC__)->Instance = ADC1) \
Kojto 109:9296ab0bfc11 3294 : \
Kojto 109:9296ab0bfc11 3295 ( ( ((__HANDLE__)->Instance == ADC3) \
Kojto 109:9296ab0bfc11 3296 )? \
Kojto 109:9296ab0bfc11 3297 ((__HANDLE_OTHER_ADC__)->Instance = ADC4) \
Kojto 109:9296ab0bfc11 3298 : \
Kojto 109:9296ab0bfc11 3299 ( ( ((__HANDLE__)->Instance == ADC4) \
Kojto 109:9296ab0bfc11 3300 )? \
Kojto 109:9296ab0bfc11 3301 ((__HANDLE_OTHER_ADC__)->Instance = ADC3) \
Kojto 109:9296ab0bfc11 3302 : \
Kojto 109:9296ab0bfc11 3303 ((__HANDLE_OTHER_ADC__)->Instance = HAL_NULL) \
Kojto 109:9296ab0bfc11 3304 ) \
Kojto 109:9296ab0bfc11 3305 ) \
Kojto 109:9296ab0bfc11 3306 ) \
Kojto 109:9296ab0bfc11 3307 )
Kojto 109:9296ab0bfc11 3308 #endif /* STM32F303xE || STM32F398xx || */
Kojto 109:9296ab0bfc11 3309 /* STM32F303xC || STM32F358xx */
Kojto 109:9296ab0bfc11 3310
Kojto 109:9296ab0bfc11 3311 #if defined(STM32F302xE) || \
Kojto 109:9296ab0bfc11 3312 defined(STM32F302xC) || \
Kojto 109:9296ab0bfc11 3313 defined(STM32F303x8) || defined(STM32F334x8) || defined(STM32F328xx)
Kojto 109:9296ab0bfc11 3314 #define __HAL_ADC_COMMON_ADC_OTHER(__HANDLE__, __HANDLE_OTHER_ADC__) \
Kojto 109:9296ab0bfc11 3315 ( ( ((__HANDLE__)->Instance == ADC1) \
Kojto 109:9296ab0bfc11 3316 )? \
Kojto 109:9296ab0bfc11 3317 ((__HANDLE_OTHER_ADC__)->Instance = ADC2) \
Kojto 109:9296ab0bfc11 3318 : \
Kojto 109:9296ab0bfc11 3319 ((__HANDLE_OTHER_ADC__)->Instance = ADC1) \
Kojto 109:9296ab0bfc11 3320 )
Kojto 109:9296ab0bfc11 3321 #endif /* STM32F302xE || */
Kojto 109:9296ab0bfc11 3322 /* STM32F302xC || */
Kojto 109:9296ab0bfc11 3323 /* STM32F303x8 || STM32F328xx || STM32F334x8 */
Kojto 109:9296ab0bfc11 3324
Kojto 109:9296ab0bfc11 3325 #if defined(STM32F301x8) || defined(STM32F302x8) || defined(STM32F318xx)
Kojto 109:9296ab0bfc11 3326 #define __HAL_ADC_COMMON_ADC_OTHER(__HANDLE__, __HANDLE_OTHER_ADC__) \
Kojto 109:9296ab0bfc11 3327 ((__HANDLE_OTHER_ADC__)->Instance = HAL_NULL)
Kojto 109:9296ab0bfc11 3328 #endif /* STM32F301x8 || STM32F302x8 || STM32F318xx */
Kojto 109:9296ab0bfc11 3329
Kojto 109:9296ab0bfc11 3330 /**
Kojto 109:9296ab0bfc11 3331 * @brief Set handle of the ADC slave associated to the ADC master
Kojto 109:9296ab0bfc11 3332 * if available (ADC2, ADC3, ADC4 availability depends on STM32 product)
Kojto 109:9296ab0bfc11 3333 * @param __HANDLE_MASTER__: ADC master handle
Kojto 109:9296ab0bfc11 3334 * @param __HANDLE_SLAVE__: ADC slave handle
Kojto 109:9296ab0bfc11 3335 * @retval None
Kojto 109:9296ab0bfc11 3336 */
Kojto 109:9296ab0bfc11 3337 #if defined(STM32F303xE) || defined(STM32F398xx) || \
Kojto 109:9296ab0bfc11 3338 defined(STM32F303xC) || defined(STM32F358xx)
Kojto 109:9296ab0bfc11 3339 #define __HAL_ADC_MULTI_SLAVE(__HANDLE_MASTER__, __HANDLE_SLAVE__) \
Kojto 109:9296ab0bfc11 3340 ( ( ((__HANDLE_MASTER__)->Instance == ADC1) \
Kojto 109:9296ab0bfc11 3341 )? \
Kojto 109:9296ab0bfc11 3342 ((__HANDLE_SLAVE__)->Instance = ADC2) \
Kojto 109:9296ab0bfc11 3343 : \
Kojto 109:9296ab0bfc11 3344 ( ( ((__HANDLE_MASTER__)->Instance == ADC3) \
Kojto 109:9296ab0bfc11 3345 )? \
Kojto 109:9296ab0bfc11 3346 ((__HANDLE_SLAVE__)->Instance = ADC4) \
Kojto 109:9296ab0bfc11 3347 : \
Kojto 109:9296ab0bfc11 3348 ((__HANDLE_SLAVE__)->Instance = HAL_NULL) \
Kojto 109:9296ab0bfc11 3349 ) \
Kojto 109:9296ab0bfc11 3350 )
Kojto 109:9296ab0bfc11 3351 #endif /* STM32F303xE || STM32F398xx || */
Kojto 109:9296ab0bfc11 3352 /* STM32F303xC || STM32F358xx */
Kojto 109:9296ab0bfc11 3353
Kojto 109:9296ab0bfc11 3354 #if defined(STM32F302xE) || \
Kojto 109:9296ab0bfc11 3355 defined(STM32F302xC) || \
Kojto 109:9296ab0bfc11 3356 defined(STM32F303x8) || defined(STM32F334x8) || defined(STM32F328xx)
Kojto 109:9296ab0bfc11 3357 #define __HAL_ADC_MULTI_SLAVE(__HANDLE_MASTER__, __HANDLE_SLAVE__) \
Kojto 109:9296ab0bfc11 3358 ( ( ((__HANDLE_MASTER__)->Instance == ADC1) \
Kojto 109:9296ab0bfc11 3359 )? \
Kojto 109:9296ab0bfc11 3360 ((__HANDLE_SLAVE__)->Instance = ADC2) \
Kojto 109:9296ab0bfc11 3361 : \
Kojto 109:9296ab0bfc11 3362 ( HAL_NULL ) \
Kojto 109:9296ab0bfc11 3363 )
Kojto 109:9296ab0bfc11 3364 #endif /* STM32F302xE || */
Kojto 109:9296ab0bfc11 3365 /* STM32F302xC || */
Kojto 109:9296ab0bfc11 3366 /* STM32F303x8 || STM32F328xx || STM32F334x8 */
Kojto 109:9296ab0bfc11 3367
Kojto 109:9296ab0bfc11 3368 #endif /* STM32F302xE || STM32F303xE || STM32F398xx || */
Kojto 109:9296ab0bfc11 3369 /* STM32F302xC || STM32F303xC || STM32F358xx || */
Kojto 109:9296ab0bfc11 3370 /* STM32F303x8 || STM32F334x8 || STM32F328xx || */
Kojto 109:9296ab0bfc11 3371 /* STM32F301x8 || STM32F302x8 || STM32F318xx */
Kojto 109:9296ab0bfc11 3372
Kojto 109:9296ab0bfc11 3373
Kojto 109:9296ab0bfc11 3374 #if defined(STM32F373xC) || defined(STM32F378xx)
Kojto 109:9296ab0bfc11 3375 /**
Kojto 109:9296ab0bfc11 3376 * @brief Set ADC number of conversions into regular channel sequence length.
Kojto 109:9296ab0bfc11 3377 * @param _NbrOfConversion_: Regular channel sequence length
Kojto 109:9296ab0bfc11 3378 * @retval None
Kojto 109:9296ab0bfc11 3379 */
Kojto 109:9296ab0bfc11 3380 #define __HAL_ADC_SQR1_L(_NbrOfConversion_) (((_NbrOfConversion_) - (uint8_t)1) << 20)
Kojto 109:9296ab0bfc11 3381
Kojto 109:9296ab0bfc11 3382 /**
Kojto 109:9296ab0bfc11 3383 * @brief Set the ADC's sample time for channel numbers between 10 and 18.
Kojto 109:9296ab0bfc11 3384 * @param _SAMPLETIME_: Sample time parameter.
Kojto 109:9296ab0bfc11 3385 * @param _CHANNELNB_: Channel number.
Kojto 109:9296ab0bfc11 3386 * @retval None
Kojto 109:9296ab0bfc11 3387 */
Kojto 109:9296ab0bfc11 3388 #define __HAL_ADC_SMPR1(_SAMPLETIME_, _CHANNELNB_) ((_SAMPLETIME_) << (3 * ((_CHANNELNB_) - 10)))
Kojto 109:9296ab0bfc11 3389
Kojto 109:9296ab0bfc11 3390 /**
Kojto 109:9296ab0bfc11 3391 * @brief Set the ADC's sample time for channel numbers between 0 and 9.
Kojto 109:9296ab0bfc11 3392 * @param _SAMPLETIME_: Sample time parameter.
Kojto 109:9296ab0bfc11 3393 * @param _CHANNELNB_: Channel number.
Kojto 109:9296ab0bfc11 3394 * @retval None
Kojto 109:9296ab0bfc11 3395 */
Kojto 109:9296ab0bfc11 3396 #define __HAL_ADC_SMPR2(_SAMPLETIME_, _CHANNELNB_) ((_SAMPLETIME_) << (3 * (_CHANNELNB_)))
Kojto 109:9296ab0bfc11 3397
Kojto 109:9296ab0bfc11 3398 /**
Kojto 109:9296ab0bfc11 3399 * @brief Set the selected regular channel rank for rank between 1 and 6.
Kojto 109:9296ab0bfc11 3400 * @param _CHANNELNB_: Channel number.
Kojto 109:9296ab0bfc11 3401 * @param _RANKNB_: Rank number.
Kojto 109:9296ab0bfc11 3402 * @retval None
Kojto 109:9296ab0bfc11 3403 */
Kojto 109:9296ab0bfc11 3404 #define __HAL_ADC_SQR3_RK(_CHANNELNB_, _RANKNB_) ((_CHANNELNB_) << (5 * ((_RANKNB_) - 1)))
Kojto 109:9296ab0bfc11 3405
Kojto 109:9296ab0bfc11 3406 /**
Kojto 109:9296ab0bfc11 3407 * @brief Set the selected regular channel rank for rank between 7 and 12.
Kojto 109:9296ab0bfc11 3408 * @param _CHANNELNB_: Channel number.
Kojto 109:9296ab0bfc11 3409 * @param _RANKNB_: Rank number.
Kojto 109:9296ab0bfc11 3410 * @retval None
Kojto 109:9296ab0bfc11 3411 */
Kojto 109:9296ab0bfc11 3412 #define __HAL_ADC_SQR2_RK(_CHANNELNB_, _RANKNB_) ((_CHANNELNB_) << (5 * ((_RANKNB_) - 7)))
Kojto 109:9296ab0bfc11 3413
Kojto 109:9296ab0bfc11 3414 /**
Kojto 109:9296ab0bfc11 3415 * @brief Set the selected regular channel rank for rank between 13 and 16.
Kojto 109:9296ab0bfc11 3416 * @param _CHANNELNB_: Channel number.
Kojto 109:9296ab0bfc11 3417 * @param _RANKNB_: Rank number.
Kojto 109:9296ab0bfc11 3418 * @retval None
Kojto 109:9296ab0bfc11 3419 */
Kojto 109:9296ab0bfc11 3420 #define __HAL_ADC_SQR1_RK(_CHANNELNB_, _RANKNB_) ((_CHANNELNB_) << (5 * ((_RANKNB_) - 13)))
Kojto 109:9296ab0bfc11 3421
Kojto 109:9296ab0bfc11 3422 /**
Kojto 109:9296ab0bfc11 3423 * @brief Set the injected sequence length.
Kojto 109:9296ab0bfc11 3424 * @param _JSQR_JL_: Sequence length.
Kojto 109:9296ab0bfc11 3425 * @retval None
Kojto 109:9296ab0bfc11 3426 */
Kojto 109:9296ab0bfc11 3427 #define __HAL_ADC_JSQR_JL(_JSQR_JL_) (((_JSQR_JL_) -1) << 20)
Kojto 109:9296ab0bfc11 3428
Kojto 109:9296ab0bfc11 3429 /**
Kojto 109:9296ab0bfc11 3430 * @brief Set the selected injected Channel rank (channels sequence starting from 4-JL)
Kojto 109:9296ab0bfc11 3431 * @param _CHANNELNB_: Channel number.
Kojto 109:9296ab0bfc11 3432 * @param _RANKNB_: Rank number.
Kojto 109:9296ab0bfc11 3433 * @param _JSQR_JL_: Sequence length.
Kojto 109:9296ab0bfc11 3434 * @retval None
Kojto 109:9296ab0bfc11 3435 */
Kojto 109:9296ab0bfc11 3436 #define __HAL_ADC_JSQR_RK(_CHANNELNB_, _RANKNB_, _JSQR_JL_) \
Kojto 109:9296ab0bfc11 3437 ((_CHANNELNB_) << (5 * ((4 - ((_JSQR_JL_) - (_RANKNB_))) - 1)))
Kojto 109:9296ab0bfc11 3438
Kojto 109:9296ab0bfc11 3439 /**
Kojto 109:9296ab0bfc11 3440 * @brief Enable ADC continuous conversion mode.
Kojto 109:9296ab0bfc11 3441 * @param _CONTINUOUS_MODE_: Continuous mode.
Kojto 109:9296ab0bfc11 3442 * @retval None
Kojto 109:9296ab0bfc11 3443 */
Kojto 109:9296ab0bfc11 3444 #define __HAL_ADC_CR2_CONTINUOUS(_CONTINUOUS_MODE_) ((_CONTINUOUS_MODE_) << 1)
Kojto 109:9296ab0bfc11 3445
Kojto 109:9296ab0bfc11 3446 /**
Kojto 109:9296ab0bfc11 3447 * @brief Configures the number of discontinuous conversions for the regular group channels.
Kojto 109:9296ab0bfc11 3448 * @param _NBR_DISCONTINUOUS_CONV_: Number of discontinuous conversions.
Kojto 109:9296ab0bfc11 3449 * @retval None
Kojto 109:9296ab0bfc11 3450 */
Kojto 109:9296ab0bfc11 3451 #define __HAL_ADC_CR1_DISCONTINUOUS_NUM(_NBR_DISCONTINUOUS_CONV_) (((_NBR_DISCONTINUOUS_CONV_) - 1) << 13)
Kojto 109:9296ab0bfc11 3452
Kojto 109:9296ab0bfc11 3453 /**
Kojto 109:9296ab0bfc11 3454 * @brief Enable ADC scan mode to convert multiple ranks with sequencer.
Kojto 109:9296ab0bfc11 3455 * @param _SCAN_MODE_: Scan conversion mode.
Kojto 109:9296ab0bfc11 3456 * @retval None
Kojto 109:9296ab0bfc11 3457 */
Kojto 109:9296ab0bfc11 3458 #define __HAL_ADC_CR1_SCAN(_SCAN_MODE_) \
Kojto 109:9296ab0bfc11 3459 ( ( (_SCAN_MODE_) == (ADC_SCAN_ENABLE) \
Kojto 109:9296ab0bfc11 3460 )? (ADC_CR1_SCAN) : (0x00000000) \
Kojto 109:9296ab0bfc11 3461 )
Kojto 109:9296ab0bfc11 3462
Kojto 109:9296ab0bfc11 3463 /**
Kojto 109:9296ab0bfc11 3464 * @brief Calibration factor in differential mode to be set into calibration register
Kojto 109:9296ab0bfc11 3465 * @param _Calibration_Factor_: Calibration factor value
Kojto 109:9296ab0bfc11 3466 * @retval None
Kojto 109:9296ab0bfc11 3467 */
Kojto 109:9296ab0bfc11 3468 #define __HAL_ADC_CALFACT_DIFF_SET(_Calibration_Factor_) ((_Calibration_Factor_) << 16)
Kojto 109:9296ab0bfc11 3469
Kojto 109:9296ab0bfc11 3470 /**
Kojto 109:9296ab0bfc11 3471 * @brief Calibration factor in differential mode to be retrieved from calibration register
Kojto 109:9296ab0bfc11 3472 * @param _Calibration_Factor_: Calibration factor value
Kojto 109:9296ab0bfc11 3473 * @retval None
Kojto 109:9296ab0bfc11 3474 */
Kojto 109:9296ab0bfc11 3475 #define __HAL_ADC_CALFACT_DIFF_GET(_Calibration_Factor_) ((_Calibration_Factor_) >> 16)
Kojto 109:9296ab0bfc11 3476
Kojto 109:9296ab0bfc11 3477
Kojto 109:9296ab0bfc11 3478 /**
Kojto 109:9296ab0bfc11 3479 * @brief Get the maximum ADC conversion cycles on all channels.
Kojto 109:9296ab0bfc11 3480 * Returns the selected sampling time + conversion time (12.5 ADC clock cycles)
Kojto 109:9296ab0bfc11 3481 * Approximation of sampling time within 4 ranges, returns the higher value:
Kojto 109:9296ab0bfc11 3482 * below 7.5 cycles {1.5 cycle; 7.5 cycles},
Kojto 109:9296ab0bfc11 3483 * between 13.5 cycles and 28.5 cycles {13.5 cycles; 28.5 cycles}
Kojto 109:9296ab0bfc11 3484 * between 41.5 cycles and 71.5 cycles {41.5 cycles; 55.5 cycles; 71.5cycles}
Kojto 109:9296ab0bfc11 3485 * equal to 239.5 cycles
Kojto 109:9296ab0bfc11 3486 * Unit: ADC clock cycles
Kojto 109:9296ab0bfc11 3487 * @param __HANDLE__: ADC handle
Kojto 109:9296ab0bfc11 3488 * @retval ADC conversion cycles on all channels
Kojto 109:9296ab0bfc11 3489 */
Kojto 109:9296ab0bfc11 3490 #define __HAL_ADC_CONVCYCLES_MAX_RANGE(__HANDLE__) \
Kojto 109:9296ab0bfc11 3491 (( (((__HANDLE__)->Instance->SMPR2 & ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT2) == RESET) && \
Kojto 109:9296ab0bfc11 3492 (((__HANDLE__)->Instance->SMPR1 & ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT2) == RESET) ) ? \
Kojto 109:9296ab0bfc11 3493 \
Kojto 109:9296ab0bfc11 3494 (( (((__HANDLE__)->Instance->SMPR2 & ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT1) == RESET) && \
Kojto 109:9296ab0bfc11 3495 (((__HANDLE__)->Instance->SMPR1 & ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT1) == RESET) ) ? \
Kojto 109:9296ab0bfc11 3496 ADC_CONVERSIONCLOCKCYCLES_SAMPLETIME_7CYCLES5 : ADC_CONVERSIONCLOCKCYCLES_SAMPLETIME_28CYCLES5) \
Kojto 109:9296ab0bfc11 3497 : \
Kojto 109:9296ab0bfc11 3498 ((((((__HANDLE__)->Instance->SMPR2 & ADC_SAMPLETIME_ALLCHANNELS_SMPR2BIT1) == RESET) && \
Kojto 109:9296ab0bfc11 3499 (((__HANDLE__)->Instance->SMPR1 & ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT1) == RESET)) || \
Kojto 109:9296ab0bfc11 3500 ((((__HANDLE__)->Instance->SMPR2 & ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT0) == RESET) && \
Kojto 109:9296ab0bfc11 3501 (((__HANDLE__)->Instance->SMPR1 & ADC_SAMPLETIME_ALLCHANNELS_SMPR1BIT0) == RESET))) ? \
Kojto 109:9296ab0bfc11 3502 ADC_CONVERSIONCLOCKCYCLES_SAMPLETIME_71CYCLES5 : ADC_CONVERSIONCLOCKCYCLES_SAMPLETIME_239CYCLES5) \
Kojto 109:9296ab0bfc11 3503 )
Kojto 109:9296ab0bfc11 3504
Kojto 109:9296ab0bfc11 3505 /**
Kojto 109:9296ab0bfc11 3506 * @brief Get the total ADC clock prescaler (APB2 prescaler x ADC prescaler)
Kojto 109:9296ab0bfc11 3507 * from system clock configuration register.
Kojto 109:9296ab0bfc11 3508 * Approximation within 3 ranges, returns the higher value:
Kojto 109:9296ab0bfc11 3509 * total prescaler minimum: 2 (ADC presc 2, APB2 presc 0)
Kojto 109:9296ab0bfc11 3510 * total prescaler 32 (ADC presc 0 and APB2 presc all, or
Kojto 109:9296ab0bfc11 3511 * ADC presc {4, 6, 8} and APB2 presc {0, 2, 4})
Kojto 109:9296ab0bfc11 3512 * total prescaler maximum: 128 (ADC presc {4, 6, 8} and APB2 presc {8, 16})
Kojto 109:9296ab0bfc11 3513 * Unit: none (prescaler factor)
Kojto 109:9296ab0bfc11 3514 * @param __HANDLE__: ADC handle
Kojto 109:9296ab0bfc11 3515 * @retval ADC and APB2 prescaler factor
Kojto 109:9296ab0bfc11 3516 */
Kojto 109:9296ab0bfc11 3517 #define __HAL_ADC_CLOCK_PRECSALER_RANGE(__HANDLE__) \
Kojto 109:9296ab0bfc11 3518 (( (RCC->CFGR & (RCC_CFGR_ADCPRE_1 | RCC_CFGR_ADCPRE_0)) == RESET) ? \
Kojto 109:9296ab0bfc11 3519 (( (RCC->CFGR & RCC_CFGR_PPRE2_2) == RESET) ? 2 : 32 ) \
Kojto 109:9296ab0bfc11 3520 : \
Kojto 109:9296ab0bfc11 3521 (( (RCC->CFGR & RCC_CFGR_PPRE2_1) == RESET) ? 32 : 128 ) \
Kojto 109:9296ab0bfc11 3522 )
Kojto 109:9296ab0bfc11 3523
Kojto 109:9296ab0bfc11 3524 /**
Kojto 109:9296ab0bfc11 3525 * @brief Get the ADC clock prescaler from system clock configuration register.
Kojto 109:9296ab0bfc11 3526 * @retval None
Kojto 109:9296ab0bfc11 3527 */
Kojto 109:9296ab0bfc11 3528 #define __HAL_ADC_GET_CLOCK_PRESCALER() (((RCC->CFGR & RCC_CFGR_ADCPRE) >> 14) +1)
Kojto 109:9296ab0bfc11 3529
Kojto 109:9296ab0bfc11 3530 /**
Kojto 109:9296ab0bfc11 3531 * @brief Enable the ADC peripheral (if not already enable to not trig a conversion)
Kojto 109:9296ab0bfc11 3532 * @param __HANDLE__: ADC handle
Kojto 109:9296ab0bfc11 3533 * @retval None
Kojto 109:9296ab0bfc11 3534 */
Kojto 109:9296ab0bfc11 3535 #define __HAL_ADC_ENABLE(__HANDLE__) \
Kojto 109:9296ab0bfc11 3536 (__HANDLE__)->Instance->CR2 |= ADC_CR2_ADON
Kojto 109:9296ab0bfc11 3537
Kojto 109:9296ab0bfc11 3538 /**
Kojto 109:9296ab0bfc11 3539 * @brief Disable the ADC peripheral
Kojto 109:9296ab0bfc11 3540 * @param __HANDLE__: ADC handle
Kojto 109:9296ab0bfc11 3541 * @retval None
Kojto 109:9296ab0bfc11 3542 */
Kojto 109:9296ab0bfc11 3543 #define __HAL_ADC_DISABLE(__HANDLE__) \
Kojto 109:9296ab0bfc11 3544 (__HANDLE__)->Instance->CR2 &= ~ADC_CR2_ADON
Kojto 109:9296ab0bfc11 3545
Kojto 109:9296ab0bfc11 3546 #endif /* STM32F373xC || STM32F378xx */
Kojto 109:9296ab0bfc11 3547 /**
Kojto 109:9296ab0bfc11 3548 * @}
Kojto 109:9296ab0bfc11 3549 */
Kojto 109:9296ab0bfc11 3550
Kojto 109:9296ab0bfc11 3551
Kojto 109:9296ab0bfc11 3552 /* Exported functions --------------------------------------------------------*/
Kojto 109:9296ab0bfc11 3553 /** @addtogroup ADCEx_Exported_Functions ADC Extended Exported Functions
Kojto 109:9296ab0bfc11 3554 * @{
Kojto 109:9296ab0bfc11 3555 */
Kojto 109:9296ab0bfc11 3556
Kojto 109:9296ab0bfc11 3557 /* Initialization/de-initialization functions *********************************/
Kojto 109:9296ab0bfc11 3558
Kojto 109:9296ab0bfc11 3559 /** @addtogroup ADCEx_Exported_Functions_Group2 Extended Input and Output operation functions
Kojto 109:9296ab0bfc11 3560 * @brief Extended IO operation functions
Kojto 109:9296ab0bfc11 3561 * @{
Kojto 109:9296ab0bfc11 3562 */
Kojto 109:9296ab0bfc11 3563 /* I/O operation functions ****************************************************/
Kojto 109:9296ab0bfc11 3564
Kojto 109:9296ab0bfc11 3565 /* ADC calibration */
Kojto 109:9296ab0bfc11 3566 #if defined(STM32F302xE) || defined(STM32F303xE) || defined(STM32F398xx) || \
Kojto 109:9296ab0bfc11 3567 defined(STM32F302xC) || defined(STM32F303xC) || defined(STM32F358xx) || \
Kojto 109:9296ab0bfc11 3568 defined(STM32F303x8) || defined(STM32F334x8) || defined(STM32F328xx) || \
Kojto 109:9296ab0bfc11 3569 defined(STM32F301x8) || defined(STM32F302x8) || defined(STM32F318xx)
Kojto 109:9296ab0bfc11 3570 HAL_StatusTypeDef HAL_ADCEx_Calibration_Start(struct __ADC_HandleTypeDef* hadc, uint32_t SingleDiff);
Kojto 109:9296ab0bfc11 3571 uint32_t HAL_ADCEx_Calibration_GetValue(struct __ADC_HandleTypeDef *hadc, uint32_t SingleDiff);
Kojto 109:9296ab0bfc11 3572 HAL_StatusTypeDef HAL_ADCEx_Calibration_SetValue(struct __ADC_HandleTypeDef *hadc, uint32_t SingleDiff, uint32_t CalibrationFactor);
Kojto 109:9296ab0bfc11 3573 #endif /* STM32F302xE || STM32F303xE || STM32F398xx || */
Kojto 109:9296ab0bfc11 3574 /* STM32F302xC || STM32F303xC || STM32F358xx || */
Kojto 109:9296ab0bfc11 3575 /* STM32F303x8 || STM32F334x8 || STM32F328xx || */
Kojto 109:9296ab0bfc11 3576 /* STM32F301x8 || STM32F302x8 || STM32F318xx */
Kojto 109:9296ab0bfc11 3577
Kojto 109:9296ab0bfc11 3578 #if defined(STM32F373xC) || defined(STM32F378xx)
Kojto 109:9296ab0bfc11 3579 HAL_StatusTypeDef HAL_ADCEx_Calibration_Start(struct __ADC_HandleTypeDef* hadc);
Kojto 109:9296ab0bfc11 3580 #endif /* STM32F373xC || STM32F378xx */
Kojto 109:9296ab0bfc11 3581
Kojto 109:9296ab0bfc11 3582 /* Blocking mode: Polling */
Kojto 109:9296ab0bfc11 3583 HAL_StatusTypeDef HAL_ADCEx_InjectedStart(struct __ADC_HandleTypeDef* hadc);
Kojto 109:9296ab0bfc11 3584 HAL_StatusTypeDef HAL_ADCEx_InjectedStop(struct __ADC_HandleTypeDef* hadc);
Kojto 109:9296ab0bfc11 3585 HAL_StatusTypeDef HAL_ADCEx_InjectedPollForConversion(struct __ADC_HandleTypeDef* hadc, uint32_t Timeout);
Kojto 109:9296ab0bfc11 3586
Kojto 109:9296ab0bfc11 3587 /* Non-blocking mode: Interruption */
Kojto 109:9296ab0bfc11 3588 HAL_StatusTypeDef HAL_ADCEx_InjectedStart_IT(struct __ADC_HandleTypeDef* hadc);
Kojto 109:9296ab0bfc11 3589 HAL_StatusTypeDef HAL_ADCEx_InjectedStop_IT(struct __ADC_HandleTypeDef* hadc);
Kojto 109:9296ab0bfc11 3590
Kojto 109:9296ab0bfc11 3591 #if defined(STM32F302xE) || defined(STM32F303xE) || defined(STM32F398xx) || \
Kojto 109:9296ab0bfc11 3592 defined(STM32F302xC) || defined(STM32F303xC) || defined(STM32F358xx) || \
Kojto 109:9296ab0bfc11 3593 defined(STM32F303x8) || defined(STM32F334x8) || defined(STM32F328xx) || \
Kojto 109:9296ab0bfc11 3594 defined(STM32F301x8) || defined(STM32F302x8) || defined(STM32F318xx)
Kojto 109:9296ab0bfc11 3595 /* ADC multimode */
Kojto 109:9296ab0bfc11 3596 HAL_StatusTypeDef HAL_ADCEx_MultiModeStart_DMA(struct __ADC_HandleTypeDef *hadc, uint32_t *pData, uint32_t Length);
Kojto 109:9296ab0bfc11 3597 HAL_StatusTypeDef HAL_ADCEx_MultiModeStop_DMA(struct __ADC_HandleTypeDef *hadc);
Kojto 109:9296ab0bfc11 3598 uint32_t HAL_ADCEx_MultiModeGetValue(struct __ADC_HandleTypeDef *hadc);
Kojto 109:9296ab0bfc11 3599 #endif /* STM32F302xE || STM32F303xE || STM32F398xx || */
Kojto 109:9296ab0bfc11 3600 /* STM32F302xC || STM32F303xC || STM32F358xx || */
Kojto 109:9296ab0bfc11 3601 /* STM32F303x8 || STM32F334x8 || STM32F328xx || */
Kojto 109:9296ab0bfc11 3602 /* STM32F301x8 || STM32F302x8 || STM32F318xx */
Kojto 109:9296ab0bfc11 3603
Kojto 109:9296ab0bfc11 3604 /* ADC retrieve conversion value intended to be used with polling or interruption */
Kojto 109:9296ab0bfc11 3605 uint32_t HAL_ADCEx_InjectedGetValue(struct __ADC_HandleTypeDef* hadc, uint32_t InjectedRank);
Kojto 109:9296ab0bfc11 3606
Kojto 109:9296ab0bfc11 3607 /* ADC IRQHandler and Callbacks used in non-blocking modes (Interruption) */
Kojto 109:9296ab0bfc11 3608 void HAL_ADCEx_InjectedConvCpltCallback(struct __ADC_HandleTypeDef* hadc);
Kojto 109:9296ab0bfc11 3609
Kojto 109:9296ab0bfc11 3610 #if defined(STM32F302xE) || defined(STM32F303xE) || defined(STM32F398xx) || \
Kojto 109:9296ab0bfc11 3611 defined(STM32F302xC) || defined(STM32F303xC) || defined(STM32F358xx) || \
Kojto 109:9296ab0bfc11 3612 defined(STM32F303x8) || defined(STM32F334x8) || defined(STM32F328xx) || \
Kojto 109:9296ab0bfc11 3613 defined(STM32F301x8) || defined(STM32F302x8) || defined(STM32F318xx)
Kojto 109:9296ab0bfc11 3614 void HAL_ADCEx_InjectedQueueOverflowCallback(struct __ADC_HandleTypeDef* hadc);
Kojto 109:9296ab0bfc11 3615 #endif /* STM32F302xE || STM32F303xE || STM32F398xx || */
Kojto 109:9296ab0bfc11 3616 /* STM32F302xC || STM32F303xC || STM32F358xx || */
Kojto 109:9296ab0bfc11 3617 /* STM32F303x8 || STM32F334x8 || STM32F328xx || */
Kojto 109:9296ab0bfc11 3618 /* STM32F301x8 || STM32F302x8 || STM32F318xx */
Kojto 109:9296ab0bfc11 3619 /**
Kojto 109:9296ab0bfc11 3620 * @}
Kojto 109:9296ab0bfc11 3621 */
Kojto 109:9296ab0bfc11 3622
Kojto 109:9296ab0bfc11 3623 /** @addtogroup ADCEx_Exported_Functions_Group3 Extended Peripheral Control functions
Kojto 109:9296ab0bfc11 3624 * @brief Extended Peripheral Control functions
Kojto 109:9296ab0bfc11 3625 * @{
Kojto 109:9296ab0bfc11 3626 */
Kojto 109:9296ab0bfc11 3627 /* Peripheral Control functions ***********************************************/
Kojto 109:9296ab0bfc11 3628 HAL_StatusTypeDef HAL_ADCEx_InjectedConfigChannel(struct __ADC_HandleTypeDef* hadc,ADC_InjectionConfTypeDef* sConfigInjected);
Kojto 109:9296ab0bfc11 3629
Kojto 109:9296ab0bfc11 3630 #if defined(STM32F302xE) || defined(STM32F303xE) || defined(STM32F398xx) || \
Kojto 109:9296ab0bfc11 3631 defined(STM32F302xC) || defined(STM32F303xC) || defined(STM32F358xx) || \
Kojto 109:9296ab0bfc11 3632 defined(STM32F303x8) || defined(STM32F334x8) || defined(STM32F328xx) || \
Kojto 109:9296ab0bfc11 3633 defined(STM32F301x8) || defined(STM32F302x8) || defined(STM32F318xx)
Kojto 109:9296ab0bfc11 3634 HAL_StatusTypeDef HAL_ADCEx_MultiModeConfigChannel(struct __ADC_HandleTypeDef *hadc, ADC_MultiModeTypeDef *multimode);
Kojto 109:9296ab0bfc11 3635 #endif /* STM32F302xE || STM32F303xE || STM32F398xx || */
Kojto 109:9296ab0bfc11 3636 /* STM32F302xC || STM32F303xC || STM32F358xx || */
Kojto 109:9296ab0bfc11 3637 /* STM32F303x8 || STM32F334x8 || STM32F328xx || */
Kojto 109:9296ab0bfc11 3638 /* STM32F301x8 || STM32F302x8 || STM32F318xx */
Kojto 109:9296ab0bfc11 3639 /**
Kojto 109:9296ab0bfc11 3640 * @}
Kojto 109:9296ab0bfc11 3641 */
Kojto 109:9296ab0bfc11 3642
Kojto 109:9296ab0bfc11 3643 /**
Kojto 109:9296ab0bfc11 3644 * @}
Kojto 109:9296ab0bfc11 3645 */
Kojto 109:9296ab0bfc11 3646
Kojto 109:9296ab0bfc11 3647 /**
Kojto 109:9296ab0bfc11 3648 * @}
Kojto 109:9296ab0bfc11 3649 */
Kojto 109:9296ab0bfc11 3650
Kojto 109:9296ab0bfc11 3651 /**
Kojto 109:9296ab0bfc11 3652 * @}
Kojto 109:9296ab0bfc11 3653 */
Kojto 109:9296ab0bfc11 3654
Kojto 109:9296ab0bfc11 3655 #ifdef __cplusplus
Kojto 109:9296ab0bfc11 3656 }
Kojto 109:9296ab0bfc11 3657 #endif
Kojto 109:9296ab0bfc11 3658
Kojto 109:9296ab0bfc11 3659 #endif /*__STM32F3xx_ADC_H */
Kojto 109:9296ab0bfc11 3660
Kojto 109:9296ab0bfc11 3661
Kojto 109:9296ab0bfc11 3662 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/