my fork

Dependents:   Nucleo_blueNRG

Fork of mbed by mbed official

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

Who changed what in which revision?

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