mbed library sources

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Mon Nov 03 10:30:07 2014 +0000
Revision:
381:5460fc57b6e4
Synchronized with git revision 02478cd1f27fc7b9643486472635eb515b2bca81

Full URL: https://github.com/mbedmicro/mbed/commit/02478cd1f27fc7b9643486472635eb515b2bca81/

Target: LPC1549 - Fix serial interrupt issues (issue report #616)

Who changed what in which revision?

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