my fork

Dependents:   Nucleo_blueNRG

Fork of mbed by mbed official

Committer:
bogdanm
Date:
Wed Jul 02 13:22:23 2014 +0100
Revision:
86:04dd9b1680ae
Child:
92:4fc01daae5a5
Release 86 of the mbed library

Main changes:


- bug fixes in various backends
- mbed "error" replaced by assert logic (mbed_assert)
- new ST Nucleo targets

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