The official mbed C/C SDK provides the software platform and libraries to build your applications.

Fork of mbed by mbed official

Committer:
bogdanm
Date:
Thu Nov 27 13:33:22 2014 +0000
Revision:
92:4fc01daae5a5
Parent:
86:04dd9b1680ae
Release 92 of the mbed libray

Main changes:

- nRF51822: fixed pin assignment issues
- ST targets moving to the STM32Cube driver
- LPC1439: fixed serial interrupt issue
- first Cortex-A platform supported in mbed (RZ_A1H)

Who changed what in which revision?

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