STM32H735xx HAL User Manual
stm32h7xx_ll_adc.h
Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    stm32h7xx_ll_adc.h
00004   * @author  MCD Application Team
00005   * @brief   Header file of ADC LL module.
00006   ******************************************************************************
00007   * @attention
00008   *
00009   * Copyright (c) 2017 STMicroelectronics.
00010   * All rights reserved.
00011   *
00012   * This software is licensed under terms that can be found in the LICENSE file
00013   * in the root directory of this software component.
00014   * If no LICENSE file comes with this software, it is provided AS-IS.
00015   *
00016   ******************************************************************************
00017   */
00018 
00019 /* Define to prevent recursive inclusion -------------------------------------*/
00020 #ifndef STM32H7xx_LL_ADC_H
00021 #define STM32H7xx_LL_ADC_H
00022 
00023 #ifdef __cplusplus
00024 extern "C" {
00025 #endif
00026 
00027 /* Includes ------------------------------------------------------------------*/
00028 #include "stm32h7xx.h"
00029 
00030 /** @addtogroup STM32H7xx_LL_Driver
00031   * @{
00032   */
00033 
00034 #if defined (ADC1) || defined (ADC2) || defined (ADC3)
00035 
00036 /** @defgroup ADC_LL ADC
00037   * @{
00038   */
00039 
00040 /* Private types -------------------------------------------------------------*/
00041 /* Private variables ---------------------------------------------------------*/
00042 
00043 /* Private constants ---------------------------------------------------------*/
00044 /** @defgroup ADC_LL_Private_Constants ADC Private Constants
00045   * @{
00046   */
00047 
00048 /* Internal mask for ADC calibration:                                         */
00049 /* Internal register offset for ADC calibration factors configuration */
00050 
00051 /* To select into literals LL_ADC_CALIB_OFFSET, LL_ADC_CALIB_LINEARITY, ...   */
00052 /* the relevant bits for:                                                     */
00053 /* (concatenation of multiple bits used in different registers)               */
00054 /* - ADC calibration configuration: configuration before calibration start    */
00055 /* - ADC calibration factors: register offset                                 */
00056 #define ADC_CALIB_FACTOR_OFFSET_REGOFFSET    (0x00000000UL) /* Register CALFACT defined as reference register */
00057 #define ADC_CALIB_FACTOR_LINEARITY_REGOFFSET (0x00000001UL) /* Register CALFACT2 offset vs register CALFACT */
00058 #define ADC_CALIB_FACTOR_REGOFFSET_MASK      (ADC_CALIB_FACTOR_OFFSET_REGOFFSET | ADC_CALIB_FACTOR_LINEARITY_REGOFFSET)
00059 #define ADC_CALIB_MODE_MASK                  (ADC_CR_ADCALLIN)
00060 #define ADC_CALIB_MODE_BINARY_MASK           (ADC_CALIB_FACTOR_REGOFFSET_MASK) /* Mask to get binary value of calibration mode: 0 for offset, 1 for linearity */
00061 
00062 
00063 /* Internal mask for ADC group regular sequencer:                             */
00064 /* To select into literal LL_ADC_REG_RANK_x the relevant bits for:            */
00065 /* - sequencer register offset                                                */
00066 /* - sequencer rank bits position into the selected register                  */
00067 
00068 /* Internal register offset for ADC group regular sequencer configuration */
00069 /* (offset placed into a spare area of literal definition) */
00070 #define ADC_SQR1_REGOFFSET                 (0x00000000UL)
00071 #define ADC_SQR2_REGOFFSET                 (0x00000100UL)
00072 #define ADC_SQR3_REGOFFSET                 (0x00000200UL)
00073 #define ADC_SQR4_REGOFFSET                 (0x00000300UL)
00074 
00075 #define ADC_REG_SQRX_REGOFFSET_MASK        (ADC_SQR1_REGOFFSET | ADC_SQR2_REGOFFSET | ADC_SQR3_REGOFFSET | ADC_SQR4_REGOFFSET)
00076 #define ADC_SQRX_REGOFFSET_POS             (8UL) /* Position of bits ADC_SQRx_REGOFFSET in ADC_REG_SQRX_REGOFFSET_MASK */
00077 #define ADC_REG_RANK_ID_SQRX_MASK          (ADC_CHANNEL_ID_NUMBER_MASK_POSBIT0)
00078 
00079 /* Definition of ADC group regular sequencer bits information to be inserted  */
00080 /* into ADC group regular sequencer ranks literals definition.                */
00081 #define ADC_REG_RANK_1_SQRX_BITOFFSET_POS  ( 6UL) /* Value equivalent to bitfield "ADC_SQR1_SQ1" position in register */
00082 #define ADC_REG_RANK_2_SQRX_BITOFFSET_POS  (12UL) /* Value equivalent to bitfield "ADC_SQR1_SQ2" position in register */
00083 #define ADC_REG_RANK_3_SQRX_BITOFFSET_POS  (18UL) /* Value equivalent to bitfield "ADC_SQR1_SQ3" position in register */
00084 #define ADC_REG_RANK_4_SQRX_BITOFFSET_POS  (24UL) /* Value equivalent to bitfield "ADC_SQR1_SQ4" position in register */
00085 #define ADC_REG_RANK_5_SQRX_BITOFFSET_POS  ( 0UL) /* Value equivalent to bitfield "ADC_SQR2_SQ5" position in register */
00086 #define ADC_REG_RANK_6_SQRX_BITOFFSET_POS  ( 6UL) /* Value equivalent to bitfield "ADC_SQR2_SQ6" position in register */
00087 #define ADC_REG_RANK_7_SQRX_BITOFFSET_POS  (12UL) /* Value equivalent to bitfield "ADC_SQR2_SQ7" position in register */
00088 #define ADC_REG_RANK_8_SQRX_BITOFFSET_POS  (18UL) /* Value equivalent to bitfield "ADC_SQR2_SQ8" position in register */
00089 #define ADC_REG_RANK_9_SQRX_BITOFFSET_POS  (24UL) /* Value equivalent to bitfield "ADC_SQR2_SQ9" position in register */
00090 #define ADC_REG_RANK_10_SQRX_BITOFFSET_POS ( 0UL) /* Value equivalent to bitfield "ADC_SQR3_SQ10" position in register */
00091 #define ADC_REG_RANK_11_SQRX_BITOFFSET_POS ( 6UL) /* Value equivalent to bitfield "ADC_SQR3_SQ11" position in register */
00092 #define ADC_REG_RANK_12_SQRX_BITOFFSET_POS (12UL) /* Value equivalent to bitfield "ADC_SQR3_SQ12" position in register */
00093 #define ADC_REG_RANK_13_SQRX_BITOFFSET_POS (18UL) /* Value equivalent to bitfield "ADC_SQR3_SQ13" position in register */
00094 #define ADC_REG_RANK_14_SQRX_BITOFFSET_POS (24UL) /* Value equivalent to bitfield "ADC_SQR3_SQ14" position in register */
00095 #define ADC_REG_RANK_15_SQRX_BITOFFSET_POS ( 0UL) /* Value equivalent to bitfield "ADC_SQR4_SQ15" position in register */
00096 #define ADC_REG_RANK_16_SQRX_BITOFFSET_POS ( 6UL) /* Value equivalent to bitfield "ADC_SQR4_SQ16" position in register */
00097 
00098 
00099 
00100 /* Internal mask for ADC group injected sequencer:                            */
00101 /* To select into literal LL_ADC_INJ_RANK_x the relevant bits for:            */
00102 /* - data register offset                                                     */
00103 /* - sequencer rank bits position into the selected register                  */
00104 
00105 /* Internal register offset for ADC group injected data register */
00106 /* (offset placed into a spare area of literal definition) */
00107 #define ADC_JDR1_REGOFFSET                 (0x00000000UL)
00108 #define ADC_JDR2_REGOFFSET                 (0x00000100UL)
00109 #define ADC_JDR3_REGOFFSET                 (0x00000200UL)
00110 #define ADC_JDR4_REGOFFSET                 (0x00000300UL)
00111 
00112 #define ADC_INJ_JDRX_REGOFFSET_MASK        (ADC_JDR1_REGOFFSET | ADC_JDR2_REGOFFSET | ADC_JDR3_REGOFFSET | ADC_JDR4_REGOFFSET)
00113 #define ADC_INJ_RANK_ID_JSQR_MASK          (ADC_CHANNEL_ID_NUMBER_MASK_POSBIT0)
00114 #define ADC_JDRX_REGOFFSET_POS             (8UL) /* Position of bits ADC_JDRx_REGOFFSET in ADC_INJ_JDRX_REGOFFSET_MASK */
00115 
00116 /* Definition of ADC group injected sequencer bits information to be inserted */
00117 /* into ADC group injected sequencer ranks literals definition.               */
00118 #define ADC_INJ_RANK_1_JSQR_BITOFFSET_POS  (ADC_JSQR_JSQ1_Pos)
00119 #define ADC_INJ_RANK_2_JSQR_BITOFFSET_POS  (ADC_JSQR_JSQ2_Pos)
00120 #define ADC_INJ_RANK_3_JSQR_BITOFFSET_POS  (ADC_JSQR_JSQ3_Pos)
00121 #define ADC_INJ_RANK_4_JSQR_BITOFFSET_POS  (ADC_JSQR_JSQ4_Pos)
00122 
00123 
00124 
00125 /* Internal mask for ADC group regular trigger:                               */
00126 /* To select into literal LL_ADC_REG_TRIG_x the relevant bits for:            */
00127 /* - regular trigger source                                                   */
00128 /* - regular trigger edge                                                     */
00129 #define ADC_REG_TRIG_EXT_EDGE_DEFAULT       (ADC_CFGR_EXTEN_0) /* Trigger edge set to rising edge (default setting for compatibility with some ADC on other STM32 families having this setting set by HW default value) */
00130 
00131 /* Mask containing trigger source masks for each of possible                  */
00132 /* trigger edge selection duplicated with shifts [0; 4; 8; 12]                */
00133 /* corresponding to {SW start; ext trigger; ext trigger; ext trigger}.        */
00134 #define ADC_REG_TRIG_SOURCE_MASK            (((LL_ADC_REG_TRIG_SOFTWARE & ADC_CFGR_EXTSEL) << (4U * 0UL)) | \
00135                                              ((ADC_CFGR_EXTSEL)                            << (4U * 1UL)) | \
00136                                              ((ADC_CFGR_EXTSEL)                            << (4U * 2UL)) | \
00137                                              ((ADC_CFGR_EXTSEL)                            << (4U * 3UL))  )
00138 
00139 /* Mask containing trigger edge masks for each of possible                    */
00140 /* trigger edge selection duplicated with shifts [0; 4; 8; 12]                */
00141 /* corresponding to {SW start; ext trigger; ext trigger; ext trigger}.        */
00142 #define ADC_REG_TRIG_EDGE_MASK              (((LL_ADC_REG_TRIG_SOFTWARE & ADC_CFGR_EXTEN) << (4U * 0UL)) | \
00143                                              ((ADC_REG_TRIG_EXT_EDGE_DEFAULT)             << (4U * 1UL)) | \
00144                                              ((ADC_REG_TRIG_EXT_EDGE_DEFAULT)             << (4U * 2UL)) | \
00145                                              ((ADC_REG_TRIG_EXT_EDGE_DEFAULT)             << (4U * 3UL))  )
00146 
00147 /* Definition of ADC group regular trigger bits information.                  */
00148 #define ADC_REG_TRIG_EXTSEL_BITOFFSET_POS  ( 6UL) /* Value equivalent to bitfield "ADC_CFGR_EXTSEL" position in register */
00149 #define ADC_REG_TRIG_EXTEN_BITOFFSET_POS   (10UL) /* Value equivalent to bitfield "ADC_CFGR_EXTEN" position in register */
00150 
00151 
00152 
00153 /* Internal mask for ADC group injected trigger:                              */
00154 /* To select into literal LL_ADC_INJ_TRIG_x the relevant bits for:            */
00155 /* - injected trigger source                                                  */
00156 /* - injected trigger edge                                                    */
00157 #define ADC_INJ_TRIG_EXT_EDGE_DEFAULT      (ADC_JSQR_JEXTEN_0) /* Trigger edge set to rising edge (default setting for compatibility with some ADC on other STM32 families having this setting set by HW default value) */
00158 
00159 /* Mask containing trigger source masks for each of possible                  */
00160 /* trigger edge selection duplicated with shifts [0; 4; 8; 12]                */
00161 /* corresponding to {SW start; ext trigger; ext trigger; ext trigger}.        */
00162 #define ADC_INJ_TRIG_SOURCE_MASK            (((LL_ADC_INJ_TRIG_SOFTWARE & ADC_JSQR_JEXTSEL) << (4U * 0UL)) | \
00163                                             ((ADC_JSQR_JEXTSEL)                             << (4U * 1UL)) | \
00164                                             ((ADC_JSQR_JEXTSEL)                             << (4U * 2UL)) | \
00165                                             ((ADC_JSQR_JEXTSEL)                             << (4U * 3UL))  )
00166 
00167 /* Mask containing trigger edge masks for each of possible                    */
00168 /* trigger edge selection duplicated with shifts [0; 4; 8; 12]                */
00169 /* corresponding to {SW start; ext trigger; ext trigger; ext trigger}.        */
00170 #define ADC_INJ_TRIG_EDGE_MASK              (((LL_ADC_INJ_TRIG_SOFTWARE & ADC_JSQR_JEXTEN) << (4U * 0UL)) | \
00171                                              ((ADC_INJ_TRIG_EXT_EDGE_DEFAULT)              << (4U * 1UL)) | \
00172                                              ((ADC_INJ_TRIG_EXT_EDGE_DEFAULT)              << (4U * 2UL)) | \
00173                                              ((ADC_INJ_TRIG_EXT_EDGE_DEFAULT)              << (4U * 3UL))  )
00174 
00175 /* Definition of ADC group injected trigger bits information.                 */
00176 #define ADC_INJ_TRIG_EXTSEL_BITOFFSET_POS  ( 2UL) /* Value equivalent to bitfield "ADC_JSQR_JEXTSEL" position in register */
00177 #define ADC_INJ_TRIG_EXTEN_BITOFFSET_POS   ( 6UL) /* Value equivalent to bitfield "ADC_JSQR_JEXTEN" position in register */
00178 
00179 
00180 
00181 
00182 
00183 
00184 /* Internal mask for ADC channel:                                             */
00185 /* To select into literal LL_ADC_CHANNEL_x the relevant bits for:             */
00186 /* - channel identifier defined by number                                     */
00187 /* - channel identifier defined by bitfield                                   */
00188 /* - channel differentiation between external channels (connected to          */
00189 /*   GPIO pins) and internal channels (connected to internal paths)           */
00190 /* - channel sampling time defined by SMPRx register offset                   */
00191 /*   and SMPx bits positions into SMPRx register                              */
00192 #define ADC_CHANNEL_ID_NUMBER_MASK         (ADC_CFGR_AWD1CH)
00193 #define ADC_CHANNEL_ID_BITFIELD_MASK       (ADC_AWD2CR_AWD2CH)
00194 #define ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS (26UL)/* Value equivalent to bitfield "ADC_CHANNEL_ID_NUMBER_MASK" position in register */
00195 #define ADC_CHANNEL_ID_MASK                (ADC_CHANNEL_ID_NUMBER_MASK | ADC_CHANNEL_ID_BITFIELD_MASK | ADC_CHANNEL_ID_INTERNAL_CH_MASK)
00196 /* Equivalent mask of ADC_CHANNEL_NUMBER_MASK aligned on register LSB (bit 0) */
00197 #define ADC_CHANNEL_ID_NUMBER_MASK_POSBIT0 (ADC_SQR2_SQ5) /* Equivalent to shift: (ADC_CHANNEL_NUMBER_MASK >> [Position of bitfield "ADC_CHANNEL_NUMBER_MASK" in register]) */
00198 
00199 /* Channel differentiation between external and internal channels */
00200 #define ADC_CHANNEL_ID_INTERNAL_CH         (0x80000000UL) /* Marker of internal channel */
00201 #define ADC_CHANNEL_ID_INTERNAL_CH_MASK    (ADC_CHANNEL_ID_INTERNAL_CH)
00202 
00203 /* Internal register offset for ADC channel sampling time configuration */
00204 /* (offset placed into a spare area of literal definition) */
00205 #define ADC_SMPR1_REGOFFSET                (0x00000000UL)
00206 #define ADC_SMPR2_REGOFFSET                (0x02000000UL)
00207 #define ADC_CHANNEL_SMPRX_REGOFFSET_MASK   (ADC_SMPR1_REGOFFSET | ADC_SMPR2_REGOFFSET)
00208 #define ADC_SMPRX_REGOFFSET_POS            (25UL) /* Position of bits ADC_SMPRx_REGOFFSET in ADC_CHANNEL_SMPRX_REGOFFSET_MASK */
00209 
00210 #define ADC_CHANNEL_SMPx_BITOFFSET_MASK    (0x01F00000UL)
00211 #define ADC_CHANNEL_SMPx_BITOFFSET_POS     (20UL)           /* Value equivalent to bitfield "ADC_CHANNEL_SMPx_BITOFFSET_MASK" position in register */
00212 
00213 /* Definition of channels ID number information to be inserted into           */
00214 /* channels literals definition.                                              */
00215 #define ADC_CHANNEL_0_NUMBER               (0x00000000UL)
00216 #define ADC_CHANNEL_1_NUMBER               (                                                                                ADC_CFGR_AWD1CH_0)
00217 #define ADC_CHANNEL_2_NUMBER               (                                                            ADC_CFGR_AWD1CH_1                    )
00218 #define ADC_CHANNEL_3_NUMBER               (                                                            ADC_CFGR_AWD1CH_1 | ADC_CFGR_AWD1CH_0)
00219 #define ADC_CHANNEL_4_NUMBER               (                                        ADC_CFGR_AWD1CH_2                                        )
00220 #define ADC_CHANNEL_5_NUMBER               (                                        ADC_CFGR_AWD1CH_2                     | ADC_CFGR_AWD1CH_0)
00221 #define ADC_CHANNEL_6_NUMBER               (                                        ADC_CFGR_AWD1CH_2 | ADC_CFGR_AWD1CH_1                    )
00222 #define ADC_CHANNEL_7_NUMBER               (                                        ADC_CFGR_AWD1CH_2 | ADC_CFGR_AWD1CH_1 | ADC_CFGR_AWD1CH_0)
00223 #define ADC_CHANNEL_8_NUMBER               (                    ADC_CFGR_AWD1CH_3                                                            )
00224 #define ADC_CHANNEL_9_NUMBER               (                    ADC_CFGR_AWD1CH_3                                         | ADC_CFGR_AWD1CH_0)
00225 #define ADC_CHANNEL_10_NUMBER              (                    ADC_CFGR_AWD1CH_3                     | ADC_CFGR_AWD1CH_1                    )
00226 #define ADC_CHANNEL_11_NUMBER              (                    ADC_CFGR_AWD1CH_3                     | ADC_CFGR_AWD1CH_1 | ADC_CFGR_AWD1CH_0)
00227 #define ADC_CHANNEL_12_NUMBER              (                    ADC_CFGR_AWD1CH_3 | ADC_CFGR_AWD1CH_2                                        )
00228 #define ADC_CHANNEL_13_NUMBER              (                    ADC_CFGR_AWD1CH_3 | ADC_CFGR_AWD1CH_2                     | ADC_CFGR_AWD1CH_0)
00229 #define ADC_CHANNEL_14_NUMBER              (                    ADC_CFGR_AWD1CH_3 | ADC_CFGR_AWD1CH_2 | ADC_CFGR_AWD1CH_1                    )
00230 #define ADC_CHANNEL_15_NUMBER              (                    ADC_CFGR_AWD1CH_3 | ADC_CFGR_AWD1CH_2 | ADC_CFGR_AWD1CH_1 | ADC_CFGR_AWD1CH_0)
00231 #define ADC_CHANNEL_16_NUMBER              (ADC_CFGR_AWD1CH_4                                                                                )
00232 #define ADC_CHANNEL_17_NUMBER              (ADC_CFGR_AWD1CH_4                                                             | ADC_CFGR_AWD1CH_0)
00233 #define ADC_CHANNEL_18_NUMBER              (ADC_CFGR_AWD1CH_4                                         | ADC_CFGR_AWD1CH_1                    )
00234 #define ADC_CHANNEL_19_NUMBER              (ADC_CFGR_AWD1CH_4                                         | ADC_CFGR_AWD1CH_1 | ADC_CFGR_AWD1CH_0)
00235 
00236 /* Definition of channels ID bitfield information to be inserted into         */
00237 /* channels literals definition.                                              */
00238 #define ADC_CHANNEL_0_BITFIELD             (ADC_AWD2CR_AWD2CH_0)
00239 #define ADC_CHANNEL_1_BITFIELD             (ADC_AWD2CR_AWD2CH_1)
00240 #define ADC_CHANNEL_2_BITFIELD             (ADC_AWD2CR_AWD2CH_2)
00241 #define ADC_CHANNEL_3_BITFIELD             (ADC_AWD2CR_AWD2CH_3)
00242 #define ADC_CHANNEL_4_BITFIELD             (ADC_AWD2CR_AWD2CH_4)
00243 #define ADC_CHANNEL_5_BITFIELD             (ADC_AWD2CR_AWD2CH_5)
00244 #define ADC_CHANNEL_6_BITFIELD             (ADC_AWD2CR_AWD2CH_6)
00245 #define ADC_CHANNEL_7_BITFIELD             (ADC_AWD2CR_AWD2CH_7)
00246 #define ADC_CHANNEL_8_BITFIELD             (ADC_AWD2CR_AWD2CH_8)
00247 #define ADC_CHANNEL_9_BITFIELD             (ADC_AWD2CR_AWD2CH_9)
00248 #define ADC_CHANNEL_10_BITFIELD            (ADC_AWD2CR_AWD2CH_10)
00249 #define ADC_CHANNEL_11_BITFIELD            (ADC_AWD2CR_AWD2CH_11)
00250 #define ADC_CHANNEL_12_BITFIELD            (ADC_AWD2CR_AWD2CH_12)
00251 #define ADC_CHANNEL_13_BITFIELD            (ADC_AWD2CR_AWD2CH_13)
00252 #define ADC_CHANNEL_14_BITFIELD            (ADC_AWD2CR_AWD2CH_14)
00253 #define ADC_CHANNEL_15_BITFIELD            (ADC_AWD2CR_AWD2CH_15)
00254 #define ADC_CHANNEL_16_BITFIELD            (ADC_AWD2CR_AWD2CH_16)
00255 #define ADC_CHANNEL_17_BITFIELD            (ADC_AWD2CR_AWD2CH_17)
00256 #define ADC_CHANNEL_18_BITFIELD            (ADC_AWD2CR_AWD2CH_18)
00257 #define ADC_CHANNEL_19_BITFIELD            (ADC_AWD2CR_AWD2CH_19)
00258 
00259 /* Definition of channels sampling time information to be inserted into       */
00260 /* channels literals definition.                                              */
00261 #define ADC_CHANNEL_0_SMP                  (ADC_SMPR1_REGOFFSET | (( 0UL) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to bitfield "ADC_SMPR1_SMP0" position in register */
00262 #define ADC_CHANNEL_1_SMP                  (ADC_SMPR1_REGOFFSET | (( 3UL) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to bitfield "ADC_SMPR1_SMP1" position in register */
00263 #define ADC_CHANNEL_2_SMP                  (ADC_SMPR1_REGOFFSET | (( 6UL) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to bitfield "ADC_SMPR1_SMP2" position in register */
00264 #define ADC_CHANNEL_3_SMP                  (ADC_SMPR1_REGOFFSET | (( 9UL) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to bitfield "ADC_SMPR1_SMP3" position in register */
00265 #define ADC_CHANNEL_4_SMP                  (ADC_SMPR1_REGOFFSET | ((12UL) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to bitfield "ADC_SMPR1_SMP4" position in register */
00266 #define ADC_CHANNEL_5_SMP                  (ADC_SMPR1_REGOFFSET | ((15UL) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to bitfield "ADC_SMPR1_SMP5" position in register */
00267 #define ADC_CHANNEL_6_SMP                  (ADC_SMPR1_REGOFFSET | ((18UL) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to bitfield "ADC_SMPR1_SMP6" position in register */
00268 #define ADC_CHANNEL_7_SMP                  (ADC_SMPR1_REGOFFSET | ((21UL) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to bitfield "ADC_SMPR1_SMP7" position in register */
00269 #define ADC_CHANNEL_8_SMP                  (ADC_SMPR1_REGOFFSET | ((24UL) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to bitfield "ADC_SMPR1_SMP8" position in register */
00270 #define ADC_CHANNEL_9_SMP                  (ADC_SMPR1_REGOFFSET | ((27UL) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to bitfield "ADC_SMPR1_SMP9" position in register */
00271 #define ADC_CHANNEL_10_SMP                 (ADC_SMPR2_REGOFFSET | (( 0UL) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to bitfield "ADC_SMPR2_SMP10" position in register */
00272 #define ADC_CHANNEL_11_SMP                 (ADC_SMPR2_REGOFFSET | (( 3UL) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to bitfield "ADC_SMPR2_SMP11" position in register */
00273 #define ADC_CHANNEL_12_SMP                 (ADC_SMPR2_REGOFFSET | (( 6UL) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to bitfield "ADC_SMPR2_SMP12" position in register */
00274 #define ADC_CHANNEL_13_SMP                 (ADC_SMPR2_REGOFFSET | (( 9UL) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to bitfield "ADC_SMPR2_SMP13" position in register */
00275 #define ADC_CHANNEL_14_SMP                 (ADC_SMPR2_REGOFFSET | ((12UL) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to bitfield "ADC_SMPR2_SMP14" position in register */
00276 #define ADC_CHANNEL_15_SMP                 (ADC_SMPR2_REGOFFSET | ((15UL) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to bitfield "ADC_SMPR2_SMP15" position in register */
00277 #define ADC_CHANNEL_16_SMP                 (ADC_SMPR2_REGOFFSET | ((18UL) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to bitfield "ADC_SMPR2_SMP16" position in register */
00278 #define ADC_CHANNEL_17_SMP                 (ADC_SMPR2_REGOFFSET | ((21UL) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to bitfield "ADC_SMPR2_SMP17" position in register */
00279 #define ADC_CHANNEL_18_SMP                 (ADC_SMPR2_REGOFFSET | ((24UL) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to bitfield "ADC_SMPR2_SMP18" position in register */
00280 #define ADC_CHANNEL_19_SMP                 (ADC_SMPR2_REGOFFSET | ((27UL) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to bitfield "ADC_SMPR2_SMP19" position in register */
00281 
00282 
00283 /* Internal mask for ADC mode single or differential ended:                   */
00284 /* To select into literals LL_ADC_SINGLE_ENDED or LL_ADC_SINGLE_DIFFERENTIAL  */
00285 /* the relevant bits for:                                                     */
00286 /* (concatenation of multiple bits used in different registers)               */
00287 /* - ADC calibration: calibration start, calibration factor get or set        */
00288 /* - ADC channels: set each ADC channel ending mode                           */
00289 #define ADC_SINGLEDIFF_CALIB_START_MASK    (ADC_CR_ADCALDIF)
00290 #define ADC_SINGLEDIFF_CALIB_FACTOR_MASK   (ADC_CALFACT_CALFACT_D | ADC_CALFACT_CALFACT_S)
00291 #define ADC_SINGLEDIFF_CHANNEL_MASK        (ADC_CHANNEL_ID_BITFIELD_MASK) /* Equivalent to ADC_DIFSEL_DIFSEL */
00292 #define ADC_SINGLEDIFF_CHANNEL_SHIFT_MASK  (ADC_CALFACT_CALFACT_S_4 | ADC_CALFACT_CALFACT_S_3) /* Bits chosen to perform of shift when single mode is selected, shift value out of channels bits range. */
00293 #define ADC_SINGLEDIFF_CALIB_F_BIT_D_MASK   (0x00010000UL)                           /* Selection of 1 bit to discriminate differential mode: mask of bit */
00294 #define ADC_SINGLEDIFF_CALIB_F_BIT_D_POS    (16UL)                                   /* Selection of 1 bit to discriminate differential mode: position of bit */
00295 #define ADC_SINGLEDIFF_CALIB_F_BIT_D_SHIFT4 (ADC_SINGLEDIFF_CALIB_F_BIT_D_POS - 4UL) /* Shift of bit ADC_SINGLEDIFF_CALIB_F_BIT_D to position to perform a shift of 4 ranks */
00296 
00297 /* Internal mask for ADC analog watchdog:                                     */
00298 /* To select into literals LL_ADC_AWD_CHANNELx_xxx the relevant bits for:     */
00299 /* (concatenation of multiple bits used in different analog watchdogs,        */
00300 /* (feature of several watchdogs not available on all STM32 families)).       */
00301 /* - analog watchdog 1: monitored channel defined by number,                  */
00302 /*   selection of ADC group (ADC groups regular and-or injected).             */
00303 /* - analog watchdog 2 and 3: monitored channel defined by bitfield, no       */
00304 /*   selection on groups.                                                     */
00305 
00306 /* Internal register offset for ADC analog watchdog channel configuration */
00307 #define ADC_AWD_CR1_REGOFFSET              (0x00000000UL)
00308 #define ADC_AWD_CR2_REGOFFSET              (0x00100000UL)
00309 #define ADC_AWD_CR3_REGOFFSET              (0x00200000UL)
00310 
00311 /* Register offset gap between AWD1 and AWD2-AWD3 configuration registers */
00312 /* (Set separately as ADC_AWD_CRX_REGOFFSET to spare 32 bits space */
00313 #define ADC_AWD_CR12_REGOFFSETGAP_MASK     (ADC_AWD2CR_AWD2CH_0)
00314 #define ADC_AWD_CR12_REGOFFSETGAP_VAL      (0x00000024UL)
00315 
00316 #define ADC_AWD_CRX_REGOFFSET_MASK         (ADC_AWD_CR1_REGOFFSET | ADC_AWD_CR2_REGOFFSET | ADC_AWD_CR3_REGOFFSET)
00317 
00318 #define ADC_AWD_CR1_CHANNEL_MASK           (ADC_CFGR_AWD1CH | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL)
00319 #define ADC_AWD_CR23_CHANNEL_MASK          (ADC_AWD2CR_AWD2CH)
00320 #define ADC_AWD_CR_ALL_CHANNEL_MASK        (ADC_AWD_CR1_CHANNEL_MASK | ADC_AWD_CR23_CHANNEL_MASK)
00321 
00322 #define ADC_AWD_CRX_REGOFFSET_POS          (20UL) /* Position of bits ADC_AWD_CRx_REGOFFSET in ADC_AWD_CRX_REGOFFSET_MASK */
00323 
00324 /* Internal register offset for ADC analog watchdog threshold configuration */
00325 #define ADC_AWD_TR1_REGOFFSET              (ADC_AWD_CR1_REGOFFSET)
00326 #define ADC_AWD_TR2_REGOFFSET              (ADC_AWD_CR2_REGOFFSET)
00327 #define ADC_AWD_TR3_REGOFFSET              (ADC_AWD_CR3_REGOFFSET)
00328 #define ADC_AWD_TRX_REGOFFSET_MASK         (ADC_AWD_TR1_REGOFFSET | ADC_AWD_TR2_REGOFFSET | ADC_AWD_TR3_REGOFFSET)
00329 #define ADC_AWD_TRX_REGOFFSET_POS          (ADC_AWD_CRX_REGOFFSET_POS)     /* Position of bits ADC_TRx_REGOFFSET in ADC_AWD_TRX_REGOFFSET_MASK */
00330 #if defined(ADC_VER_V5_V90)
00331 #define ADC_AWD_TRX_BIT_HIGH_MASK          (0x00010000UL)                   /* Selection of 1 bit to discriminate threshold high: mask of bit */
00332 #define ADC_AWD_TRX_BIT_HIGH_POS           (16UL)                           /* Selection of 1 bit to discriminate threshold high: position of bit */
00333 #define ADC_AWD_TRX_BIT_HIGH_SHIFT4        (ADC_AWD_TRX_BIT_HIGH_POS - 4UL) /* Shift of bit ADC_AWD_TRX_BIT_HIGH to position to perform a shift of 4 ranks */
00334 #endif  /* ADC_VER_V5_V90 */
00335 
00336 /* Register offset gap between AWD1 and AWD2-AWD3 thresholds registers */
00337 /* (Set separately as ADC_AWD_TRX_REGOFFSET to spare 32 bits space */
00338 #define ADC_AWD_TR12_REGOFFSETGAP_MASK     (ADC_AWD2CR_AWD2CH_0)
00339 #define ADC_AWD_TR12_REGOFFSETGAP_VAL      (0x00000022UL)
00340 
00341 /* Legacy literals */
00342 #define LL_ADC_AWD1_TR                      LL_ADC_AWD1
00343 #define LL_ADC_AWD2_TR                      LL_ADC_AWD2
00344 #define LL_ADC_AWD3_TR                      LL_ADC_AWD3
00345 
00346 /* Internal mask for ADC offset:                                              */
00347 /* Internal register offset for ADC offset number configuration */
00348 #define ADC_OFR1_REGOFFSET                 (0x00000000UL)
00349 #define ADC_OFR2_REGOFFSET                 (0x00000001UL)
00350 #define ADC_OFR3_REGOFFSET                 (0x00000002UL)
00351 #define ADC_OFR4_REGOFFSET                 (0x00000003UL)
00352 #define ADC_OFRx_REGOFFSET_MASK            (ADC_OFR1_REGOFFSET | ADC_OFR2_REGOFFSET | ADC_OFR3_REGOFFSET | ADC_OFR4_REGOFFSET)
00353 
00354 
00355 /* ADC registers bits positions */
00356 #define ADC_CFGR_RES_BITOFFSET_POS         (ADC_CFGR_RES_Pos)
00357 #define ADC_CFGR_AWD1SGL_BITOFFSET_POS     (ADC_CFGR_AWD1SGL_Pos)
00358 #define ADC_CFGR_AWD1EN_BITOFFSET_POS      (ADC_CFGR_AWD1EN_Pos)
00359 #define ADC_CFGR_JAWD1EN_BITOFFSET_POS     (ADC_CFGR_JAWD1EN_Pos)
00360 #if defined(ADC_VER_V5_V90)
00361 #define ADC_CFGR_RES_BITOFFSET_POS_ADC3    (ADC3_CFGR_RES_Pos)
00362 #endif /* ADC_VER_V5_V90 */
00363 
00364 
00365 /* ADC registers bits groups */
00366 #define ADC_CR_BITS_PROPERTY_RS            (ADC_CR_ADCAL | ADC_CR_JADSTP | ADC_CR_ADSTP | ADC_CR_JADSTART | ADC_CR_ADSTART | ADC_CR_ADDIS | ADC_CR_ADEN) /* ADC register CR bits with HW property "rs": Software can read as well as set this bit. Writing '0' has no effect on the bit value. */
00367 
00368 
00369 /* ADC internal channels related definitions */
00370 /* Internal voltage reference VrefInt */
00371 #if defined(ADC_VER_V5_3)
00372 #define VREFINT_CAL_ADDR                   ((uint16_t*) (0x8fff810UL))  /* Internal voltage reference, address of parameter VREFINT_CAL: VrefInt ADC raw data acquired at temperature 30 DegC (tolerance: +-5 DegC), Vref+ = 3.3 V (tolerance: +-10 mV). */
00373                                                                         /* Address related to STM32H7A3 */
00374 #else /* ADC_VER_V5_90 || ADC_VER_V5_X */
00375 #define VREFINT_CAL_ADDR                   ((uint16_t*) (0x1FF1E860UL)) /* Internal voltage reference, address of parameter VREFINT_CAL: VrefInt ADC raw data acquired at temperature 30 DegC (tolerance: +-5 DegC), Vref+ = 3.3 V (tolerance: +-10 mV). */
00376 #endif /* ADC_VER_V5_3 */
00377 #define VREFINT_CAL_VREF                   (3300UL)                     /* Analog voltage reference (Vref+) value with which temperature sensor has been calibrated in production (tolerance: +-10 mV) (unit: mV). */
00378 /* Temperature sensor */
00379 #if defined(ADC_VER_V5_3)
00380 #define TEMPSENSOR_CAL1_ADDR               ((uint16_t*) (0x8fff814UL))  /* Internal temperature sensor, address of parameter TS_CAL1: On STM32H7, temperature sensor ADC raw data acquired at temperature  30 DegC (tolerance: +-5 DegC), Vref+ = 3.3 V (tolerance: +-10 mV). */
00381 #define TEMPSENSOR_CAL2_ADDR               ((uint16_t*) (0x8fff818UL))  /* Internal temperature sensor, address of parameter TS_CAL2: On STM32H7, temperature sensor ADC raw data acquired at temperature 110 DegC (tolerance: +-5 DegC), Vref+ = 3.3 V (tolerance: +-10 mV). */
00382                                                                         /* Addresses related to STM32H7A3 */
00383 #else /* ADC_VER_V5_90 || ADC_VER_V5_X */
00384 #define TEMPSENSOR_CAL1_ADDR               ((uint16_t*) (0x1FF1E820UL)) /* Internal temperature sensor, address of parameter TS_CAL1: On STM32H7, temperature sensor ADC raw data acquired at temperature  30 DegC (tolerance: +-5 DegC), Vref+ = 3.3 V (tolerance: +-10 mV). */
00385 #define TEMPSENSOR_CAL2_ADDR               ((uint16_t*) (0x1FF1E840UL)) /* Internal temperature sensor, address of parameter TS_CAL2: On STM32H7, temperature sensor ADC raw data acquired at temperature 110 DegC (tolerance: +-5 DegC), Vref+ = 3.3 V (tolerance: +-10 mV). */
00386 #endif /* ADC_VER_V5_3 */
00387 
00388 #define TEMPSENSOR_CAL1_TEMP               (30L)                        /* Internal temperature sensor, temperature at which temperature sensor has been calibrated in production for data into TEMPSENSOR_CAL1_ADDR (tolerance: +-5 DegC) (unit: DegC). */
00389 #define TEMPSENSOR_CAL2_TEMP               (110L)                       /* Internal temperature sensor, temperature at which temperature sensor has been calibrated in production for data into TEMPSENSOR_CAL2_ADDR (tolerance: +-5 DegC) (unit: DegC). */
00390 #define TEMPSENSOR_CAL_VREFANALOG          (3300UL)                     /* Analog voltage reference (Vref+) voltage with which temperature sensor has been calibrated in production (+-10 mV) (unit: mV). */
00391 
00392 /* Registers addresses with ADC linearity calibration content (programmed during device production, specific to each device) */
00393 #define ADC_LINEAR_CALIB_REG_1_ADDR ((uint32_t*) (0x1FF1EC00UL))
00394 #define ADC_LINEAR_CALIB_REG_2_ADDR ((uint32_t*) (0x1FF1EC04UL))
00395 #define ADC_LINEAR_CALIB_REG_3_ADDR ((uint32_t*) (0x1FF1EC08UL))
00396 #define ADC_LINEAR_CALIB_REG_4_ADDR ((uint32_t*) (0x1FF1EC0CUL))
00397 #define ADC_LINEAR_CALIB_REG_5_ADDR ((uint32_t*) (0x1FF1EC10UL))
00398 #define ADC_LINEAR_CALIB_REG_6_ADDR ((uint32_t*) (0x1FF1EC14UL))
00399 #define ADC_LINEAR_CALIB_REG_COUNT  (6UL)
00400 /**
00401   * @}
00402   */
00403 
00404 
00405 /* Private macros ------------------------------------------------------------*/
00406 /** @defgroup ADC_LL_Private_Macros ADC Private Macros
00407   * @{
00408   */
00409 
00410 /**
00411   * @brief  Driver macro reserved for internal use: set a pointer to
00412   *         a register from a register basis from which an offset
00413   *         is applied.
00414   * @param  __REG__ Register basis from which the offset is applied.
00415   * @param  __REG_OFFFSET__ Offset to be applied (unit: number of registers).
00416   * @retval Pointer to register address
00417   */
00418 #define __ADC_PTR_REG_OFFSET(__REG__, __REG_OFFFSET__)                         \
00419  ((__IO uint32_t *)((uint32_t) ((uint32_t)(&(__REG__)) + ((__REG_OFFFSET__) << 2UL))))
00420 
00421 /**
00422   * @}
00423   */
00424 
00425 
00426 /* Exported types ------------------------------------------------------------*/
00427 #if defined(USE_FULL_LL_DRIVER)
00428 /** @defgroup ADC_LL_ES_INIT ADC Exported Init structure
00429   * @{
00430   */
00431 
00432 /**
00433   * @brief  Structure definition of some features of ADC common parameters
00434   *         and multimode
00435   *         (all ADC instances belonging to the same ADC common instance).
00436   * @note   The setting of these parameters by function @ref LL_ADC_CommonInit()
00437   *         is conditioned to ADC instances state (all ADC instances
00438   *         sharing the same ADC common instance):
00439   *         All ADC instances sharing the same ADC common instance must be
00440   *         disabled.
00441   */
00442 typedef struct
00443 {
00444   uint32_t CommonClock;                 /*!< Set parameter common to several ADC: Clock source and prescaler.
00445                                              This parameter can be a value of @ref ADC_LL_EC_COMMON_CLOCK_SOURCE
00446                                              @note On this STM32 series, if ADC group injected is used, some
00447                                                    clock ratio constraints between ADC clock and AHB clock
00448                                                    must be respected. Refer to reference manual.
00449 
00450                                              This feature can be modified afterwards using unitary function @ref LL_ADC_SetCommonClock(). */
00451 
00452   uint32_t Multimode;                   /*!< Set ADC multimode configuration to operate in independent mode or multimode (for devices with several ADC instances).
00453                                              This parameter can be a value of @ref ADC_LL_EC_MULTI_MODE
00454 
00455                                              This feature can be modified afterwards using unitary function @ref LL_ADC_SetMultimode(). */
00456 
00457   uint32_t MultiDMATransfer;            /*!< Set ADC dual ADC mode DMA transfer data format: Each DMA, 32 down to 10-bits or 8-bits resolution.
00458                                              This parameter can be a value of @ref ADC_LL_EC_MULTI_DMA_TRANSFER
00459 
00460                                              This feature can be modified afterwards using unitary function @ref LL_ADC_SetMultiDMATransfer(). */
00461 
00462   uint32_t MultiTwoSamplingDelay;       /*!< Set ADC multimode delay between 2 sampling phases.
00463                                              This parameter can be a value of @ref ADC_LL_EC_MULTI_TWOSMP_DELAY
00464 
00465                                              This feature can be modified afterwards using unitary function @ref LL_ADC_SetMultiTwoSamplingDelay(). */
00466 
00467 } LL_ADC_CommonInitTypeDef;
00468 
00469 /**
00470   * @brief  Structure definition of some features of ADC instance.
00471   * @note   These parameters have an impact on ADC scope: ADC instance.
00472   *         Affects both group regular and group injected (availability
00473   *         of ADC group injected depends on STM32 families).
00474   *         Refer to corresponding unitary functions into
00475   *         @ref ADC_LL_EF_Configuration_ADC_Instance .
00476   * @note   The setting of these parameters by function @ref LL_ADC_Init()
00477   *         is conditioned to ADC state:
00478   *         ADC instance must be disabled.
00479   *         This condition is applied to all ADC features, for efficiency
00480   *         and compatibility over all STM32 families. However, the different
00481   *         features can be set under different ADC state conditions
00482   *         (setting possible with ADC enabled without conversion on going,
00483   *         ADC enabled with conversion on going, ...)
00484   *         Each feature can be updated afterwards with a unitary function
00485   *         and potentially with ADC in a different state than disabled,
00486   *         refer to description of each function for setting
00487   *         conditioned to ADC state.
00488   */
00489 typedef struct
00490 {
00491   uint32_t Resolution;                  /*!< Set ADC resolution.
00492                                              This parameter can be a value of @ref ADC_LL_EC_RESOLUTION
00493 
00494                                              This feature can be modified afterwards using unitary function @ref LL_ADC_SetResolution(). */
00495 
00496   uint32_t LeftBitShift;                /*!< Configures the left shifting applied to the final result with or without oversampling.
00497                                              This parameter can be a value of @ref ADC_LL_EC_LEFT_BIT_SHIFT. */
00498 
00499   uint32_t LowPowerMode;                /*!< Set ADC low power mode.
00500                                              This parameter can be a value of @ref ADC_LL_EC_LP_MODE
00501 
00502                                              This feature can be modified afterwards using unitary function @ref LL_ADC_SetLowPowerMode(). */
00503 
00504 } LL_ADC_InitTypeDef;
00505 
00506 /**
00507   * @brief  Structure definition of some features of ADC group regular.
00508   * @note   These parameters have an impact on ADC scope: ADC group regular.
00509   *         Refer to corresponding unitary functions into
00510   *         @ref ADC_LL_EF_Configuration_ADC_Group_Regular
00511   *         (functions with prefix "REG").
00512   * @note   The setting of these parameters by function @ref LL_ADC_REG_Init()
00513   *         is conditioned to ADC state:
00514   *         ADC instance must be disabled.
00515   *         This condition is applied to all ADC features, for efficiency
00516   *         and compatibility over all STM32 families. However, the different
00517   *         features can be set under different ADC state conditions
00518   *         (setting possible with ADC enabled without conversion on going,
00519   *         ADC enabled with conversion on going, ...)
00520   *         Each feature can be updated afterwards with a unitary function
00521   *         and potentially with ADC in a different state than disabled,
00522   *         refer to description of each function for setting
00523   *         conditioned to ADC state.
00524   */
00525 typedef struct
00526 {
00527   uint32_t TriggerSource;               /*!< Set ADC group regular conversion trigger source: internal (SW start) or from external peripheral (timer event, external interrupt line).
00528                                              This parameter can be a value of @ref ADC_LL_EC_REG_TRIGGER_SOURCE
00529                                              @note On this STM32 series, setting trigger source to external trigger also set trigger polarity to rising edge
00530                                                    (default setting for compatibility with some ADC on other STM32 families having this setting set by HW default value).
00531                                                    In case of need to modify trigger edge, use function @ref LL_ADC_REG_SetTriggerEdge().
00532 
00533                                              This feature can be modified afterwards using unitary function @ref LL_ADC_REG_SetTriggerSource(). */
00534 
00535   uint32_t SequencerLength;             /*!< Set ADC group regular sequencer length.
00536                                              This parameter can be a value of @ref ADC_LL_EC_REG_SEQ_SCAN_LENGTH
00537 
00538                                              This feature can be modified afterwards using unitary function @ref LL_ADC_REG_SetSequencerLength(). */
00539 
00540   uint32_t SequencerDiscont;            /*!< Set ADC group regular sequencer discontinuous mode: sequence subdivided and scan conversions interrupted every selected number of ranks.
00541                                              This parameter can be a value of @ref ADC_LL_EC_REG_SEQ_DISCONT_MODE
00542                                              @note This parameter has an effect only if group regular sequencer is enabled
00543                                                    (scan length of 2 ranks or more).
00544 
00545                                              This feature can be modified afterwards using unitary function @ref LL_ADC_REG_SetSequencerDiscont(). */
00546 
00547   uint32_t ContinuousMode;              /*!< Set ADC continuous conversion mode on ADC group regular, whether ADC conversions are performed in single mode (one conversion per trigger) or in continuous mode (after the first trigger, following conversions launched successively automatically).
00548                                              This parameter can be a value of @ref ADC_LL_EC_REG_CONTINUOUS_MODE
00549                                              Note: It is not possible to enable both ADC group regular continuous mode and discontinuous mode.
00550 
00551                                              This feature can be modified afterwards using unitary function @ref LL_ADC_REG_SetContinuousMode(). */
00552 
00553   uint32_t DataTransferMode;            /*!< Set ADC group regular conversion data transfer mode: no transfer, transfer by DMA (Limited/Unlimited) or DFSDM.
00554                                              This parameter can be a value of @ref ADC_LL_EC_REG_DATA_TRANSFER_MODE
00555 
00556                                              This feature can be modified afterwards using unitary function @ref LL_ADC_REG_SetDataTransferMode(). */
00557 
00558   uint32_t Overrun;                     /*!< Set ADC group regular behavior in case of overrun:
00559                                              data preserved or overwritten.
00560                                              This parameter can be a value of @ref ADC_LL_EC_REG_OVR_DATA_BEHAVIOR
00561 
00562                                              This feature can be modified afterwards using unitary function @ref LL_ADC_REG_SetOverrun(). */
00563 
00564 } LL_ADC_REG_InitTypeDef;
00565 
00566 /**
00567   * @brief  Structure definition of some features of ADC group injected.
00568   * @note   These parameters have an impact on ADC scope: ADC group injected.
00569   *         Refer to corresponding unitary functions into
00570   *         @ref ADC_LL_EF_Configuration_ADC_Group_Regular
00571   *         (functions with prefix "INJ").
00572   * @note   The setting of these parameters by function @ref LL_ADC_INJ_Init()
00573   *         is conditioned to ADC state:
00574   *         ADC instance must be disabled.
00575   *         This condition is applied to all ADC features, for efficiency
00576   *         and compatibility over all STM32 families. However, the different
00577   *         features can be set under different ADC state conditions
00578   *         (setting possible with ADC enabled without conversion on going,
00579   *         ADC enabled with conversion on going, ...)
00580   *         Each feature can be updated afterwards with a unitary function
00581   *         and potentially with ADC in a different state than disabled,
00582   *         refer to description of each function for setting
00583   *         conditioned to ADC state.
00584   */
00585 typedef struct
00586 {
00587   uint32_t TriggerSource;               /*!< Set ADC group injected conversion trigger source: internal (SW start) or from external peripheral (timer event, external interrupt line).
00588                                              This parameter can be a value of @ref ADC_LL_EC_INJ_TRIGGER_SOURCE
00589                                              @note On this STM32 series, setting trigger source to external trigger also set trigger polarity to rising edge
00590                                                    (default setting for compatibility with some ADC on other STM32 families having this setting set by HW default value).
00591                                                    In case of need to modify trigger edge, use function @ref LL_ADC_INJ_SetTriggerEdge().
00592 
00593                                              This feature can be modified afterwards using unitary function @ref LL_ADC_INJ_SetTriggerSource(). */
00594 
00595   uint32_t SequencerLength;             /*!< Set ADC group injected sequencer length.
00596                                              This parameter can be a value of @ref ADC_LL_EC_INJ_SEQ_SCAN_LENGTH
00597 
00598                                              This feature can be modified afterwards using unitary function @ref LL_ADC_INJ_SetSequencerLength(). */
00599 
00600   uint32_t SequencerDiscont;            /*!< Set ADC group injected sequencer discontinuous mode: sequence subdivided and scan conversions interrupted every selected number of ranks.
00601                                              This parameter can be a value of @ref ADC_LL_EC_INJ_SEQ_DISCONT_MODE
00602                                              @note This parameter has an effect only if group injected sequencer is enabled
00603                                                    (scan length of 2 ranks or more).
00604 
00605                                              This feature can be modified afterwards using unitary function @ref LL_ADC_INJ_SetSequencerDiscont(). */
00606 
00607   uint32_t TrigAuto;                    /*!< Set ADC group injected conversion trigger: independent or from ADC group regular.
00608                                              This parameter can be a value of @ref ADC_LL_EC_INJ_TRIG_AUTO
00609                                              Note: This parameter must be set to set to independent trigger if injected trigger source is set to an external trigger.
00610 
00611                                              This feature can be modified afterwards using unitary function @ref LL_ADC_INJ_SetTrigAuto(). */
00612 
00613 } LL_ADC_INJ_InitTypeDef;
00614 
00615 /**
00616   * @}
00617   */
00618 #endif /* USE_FULL_LL_DRIVER */
00619 
00620 /* Exported constants --------------------------------------------------------*/
00621 /** @defgroup ADC_LL_Exported_Constants ADC Exported Constants
00622   * @{
00623   */
00624 
00625 /** @defgroup ADC_LL_EC_FLAG ADC flags
00626   * @brief    Flags defines which can be used with LL_ADC_ReadReg function
00627   * @{
00628   */
00629 #define LL_ADC_FLAG_ADRDY                  ADC_ISR_ADRDY      /*!< ADC flag ADC instance ready */
00630 #define LL_ADC_FLAG_EOC                    ADC_ISR_EOC        /*!< ADC flag ADC group regular end of unitary conversion */
00631 #define LL_ADC_FLAG_EOS                    ADC_ISR_EOS        /*!< ADC flag ADC group regular end of sequence conversions */
00632 #define LL_ADC_FLAG_OVR                    ADC_ISR_OVR        /*!< ADC flag ADC group regular overrun */
00633 #define LL_ADC_FLAG_EOSMP                  ADC_ISR_EOSMP      /*!< ADC flag ADC group regular end of sampling phase */
00634 #define LL_ADC_FLAG_JEOC                   ADC_ISR_JEOC       /*!< ADC flag ADC group injected end of unitary conversion */
00635 #define LL_ADC_FLAG_JEOS                   ADC_ISR_JEOS       /*!< ADC flag ADC group injected end of sequence conversions */
00636 #define LL_ADC_FLAG_JQOVF                  ADC_ISR_JQOVF      /*!< ADC flag ADC group injected contexts queue overflow */
00637 #define LL_ADC_FLAG_AWD1                   ADC_ISR_AWD1       /*!< ADC flag ADC analog watchdog 1 */
00638 #define LL_ADC_FLAG_AWD2                   ADC_ISR_AWD2       /*!< ADC flag ADC analog watchdog 2 */
00639 #define LL_ADC_FLAG_AWD3                   ADC_ISR_AWD3       /*!< ADC flag ADC analog watchdog 3 */
00640 #define LL_ADC_FLAG_ADRDY_MST              ADC_CSR_ADRDY_MST  /*!< ADC flag ADC multimode master instance ready */
00641 #define LL_ADC_FLAG_ADRDY_SLV              ADC_CSR_ADRDY_SLV  /*!< ADC flag ADC multimode slave instance ready */
00642 #define LL_ADC_FLAG_EOC_MST                ADC_CSR_EOC_MST    /*!< ADC flag ADC multimode master group regular end of unitary conversion */
00643 #define LL_ADC_FLAG_EOC_SLV                ADC_CSR_EOC_SLV    /*!< ADC flag ADC multimode slave group regular end of unitary conversion */
00644 #define LL_ADC_FLAG_EOS_MST                ADC_CSR_EOS_MST    /*!< ADC flag ADC multimode master group regular end of sequence conversions */
00645 #define LL_ADC_FLAG_EOS_SLV                ADC_CSR_EOS_SLV    /*!< ADC flag ADC multimode slave group regular end of sequence conversions */
00646 #define LL_ADC_FLAG_OVR_MST                ADC_CSR_OVR_MST    /*!< ADC flag ADC multimode master group regular overrun */
00647 #define LL_ADC_FLAG_OVR_SLV                ADC_CSR_OVR_SLV    /*!< ADC flag ADC multimode slave group regular overrun */
00648 #define LL_ADC_FLAG_EOSMP_MST              ADC_CSR_EOSMP_MST  /*!< ADC flag ADC multimode master group regular end of sampling phase */
00649 #define LL_ADC_FLAG_EOSMP_SLV              ADC_CSR_EOSMP_SLV  /*!< ADC flag ADC multimode slave group regular end of sampling phase */
00650 #define LL_ADC_FLAG_JEOC_MST               ADC_CSR_JEOC_MST   /*!< ADC flag ADC multimode master group injected end of unitary conversion */
00651 #define LL_ADC_FLAG_JEOC_SLV               ADC_CSR_JEOC_SLV   /*!< ADC flag ADC multimode slave group injected end of unitary conversion */
00652 #define LL_ADC_FLAG_JEOS_MST               ADC_CSR_JEOS_MST   /*!< ADC flag ADC multimode master group injected end of sequence conversions */
00653 #define LL_ADC_FLAG_JEOS_SLV               ADC_CSR_JEOS_SLV   /*!< ADC flag ADC multimode slave group injected end of sequence conversions */
00654 #define LL_ADC_FLAG_JQOVF_MST              ADC_CSR_JQOVF_MST  /*!< ADC flag ADC multimode master group injected contexts queue overflow */
00655 #define LL_ADC_FLAG_JQOVF_SLV              ADC_CSR_JQOVF_SLV  /*!< ADC flag ADC multimode slave group injected contexts queue overflow */
00656 #define LL_ADC_FLAG_AWD1_MST               ADC_CSR_AWD1_MST   /*!< ADC flag ADC multimode master analog watchdog 1 of the ADC master */
00657 #define LL_ADC_FLAG_AWD1_SLV               ADC_CSR_AWD1_SLV   /*!< ADC flag ADC multimode slave analog watchdog 1 of the ADC slave */
00658 #define LL_ADC_FLAG_AWD2_MST               ADC_CSR_AWD2_MST   /*!< ADC flag ADC multimode master analog watchdog 2 of the ADC master */
00659 #define LL_ADC_FLAG_AWD2_SLV               ADC_CSR_AWD2_SLV   /*!< ADC flag ADC multimode slave analog watchdog 2 of the ADC slave */
00660 #define LL_ADC_FLAG_AWD3_MST               ADC_CSR_AWD3_MST   /*!< ADC flag ADC multimode master analog watchdog 3 of the ADC master */
00661 #define LL_ADC_FLAG_AWD3_SLV               ADC_CSR_AWD3_SLV   /*!< ADC flag ADC multimode slave analog watchdog 3 of the ADC slave */
00662 /**
00663   * @}
00664   */
00665 
00666 /** @defgroup ADC_LL_EC_IT ADC interruptions for configuration (interruption enable or disable)
00667   * @brief    IT defines which can be used with LL_ADC_ReadReg and  LL_ADC_WriteReg functions
00668   * @{
00669   */
00670 #define LL_ADC_IT_ADRDY                    ADC_IER_ADRDYIE    /*!< ADC interruption ADC instance ready */
00671 #define LL_ADC_IT_EOC                      ADC_IER_EOCIE      /*!< ADC interruption ADC group regular end of unitary conversion */
00672 #define LL_ADC_IT_EOS                      ADC_IER_EOSIE      /*!< ADC interruption ADC group regular end of sequence conversions */
00673 #define LL_ADC_IT_OVR                      ADC_IER_OVRIE      /*!< ADC interruption ADC group regular overrun */
00674 #define LL_ADC_IT_EOSMP                    ADC_IER_EOSMPIE    /*!< ADC interruption ADC group regular end of sampling phase */
00675 #define LL_ADC_IT_JEOC                     ADC_IER_JEOCIE     /*!< ADC interruption ADC group injected end of unitary conversion */
00676 #define LL_ADC_IT_JEOS                     ADC_IER_JEOSIE     /*!< ADC interruption ADC group injected end of sequence conversions */
00677 #define LL_ADC_IT_JQOVF                    ADC_IER_JQOVFIE    /*!< ADC interruption ADC group injected contexts queue overflow */
00678 #define LL_ADC_IT_AWD1                     ADC_IER_AWD1IE     /*!< ADC interruption ADC analog watchdog 1 */
00679 #define LL_ADC_IT_AWD2                     ADC_IER_AWD2IE     /*!< ADC interruption ADC analog watchdog 2 */
00680 #define LL_ADC_IT_AWD3                     ADC_IER_AWD3IE     /*!< ADC interruption ADC analog watchdog 3 */
00681 /**
00682   * @}
00683   */
00684 
00685 /** @defgroup ADC_LL_EC_REGISTERS  ADC registers compliant with specific purpose
00686   * @{
00687   */
00688 /* List of ADC registers intended to be used (most commonly) with             */
00689 /* DMA transfer.                                                              */
00690 /* Refer to function @ref LL_ADC_DMA_GetRegAddr().                            */
00691 #define LL_ADC_DMA_REG_REGULAR_DATA          (0x00000000UL) /* ADC group regular conversion data register (corresponding to register DR) to be used with ADC configured in independent mode. Without DMA transfer, register accessed by LL function @ref LL_ADC_REG_ReadConversionData32() and other functions @ref LL_ADC_REG_ReadConversionDatax() */
00692 #define LL_ADC_DMA_REG_REGULAR_DATA_MULTI    (0x00000001UL) /* ADC group regular conversion data register (corresponding to register CDR) to be used with ADC configured in multimode (available on STM32 devices with several ADC instances). Without DMA transfer, register accessed by LL function @ref LL_ADC_REG_ReadMultiConversionData32() */
00693 /**
00694   * @}
00695   */
00696 
00697 /** @defgroup ADC_LL_EC_COMMON_CLOCK_SOURCE  ADC common - Clock source
00698   * @{
00699   */
00700 #define LL_ADC_CLOCK_SYNC_PCLK_DIV1        (ADC_CCR_CKMODE_0)                                    /*!< ADC synchronous clock derived from AHB clock without prescaler */
00701 #define LL_ADC_CLOCK_SYNC_PCLK_DIV2        (ADC_CCR_CKMODE_1                   )                 /*!< ADC synchronous clock derived from AHB clock with prescaler division by 2 */
00702 #define LL_ADC_CLOCK_SYNC_PCLK_DIV4        (ADC_CCR_CKMODE_1 | ADC_CCR_CKMODE_0)                 /*!< ADC synchronous clock derived from AHB clock with prescaler division by 4 */
00703 #define LL_ADC_CLOCK_ASYNC_DIV1            (0x00000000UL)                                        /*!< ADC asynchronous clock without prescaler */
00704 #define LL_ADC_CLOCK_ASYNC_DIV2            (ADC_CCR_PRESC_0)                                     /*!< ADC asynchronous clock with prescaler division by 2   */
00705 #define LL_ADC_CLOCK_ASYNC_DIV4            (ADC_CCR_PRESC_1                  )                   /*!< ADC asynchronous clock with prescaler division by 4   */
00706 #define LL_ADC_CLOCK_ASYNC_DIV6            (ADC_CCR_PRESC_1 | ADC_CCR_PRESC_0)                   /*!< ADC asynchronous clock with prescaler division by 6   */
00707 #define LL_ADC_CLOCK_ASYNC_DIV8            (ADC_CCR_PRESC_2                                    ) /*!< ADC asynchronous clock with prescaler division by 8   */
00708 #define LL_ADC_CLOCK_ASYNC_DIV10           (ADC_CCR_PRESC_2                   | ADC_CCR_PRESC_0) /*!< ADC asynchronous clock with prescaler division by 10  */
00709 #define LL_ADC_CLOCK_ASYNC_DIV12           (ADC_CCR_PRESC_2 | ADC_CCR_PRESC_1                  ) /*!< ADC asynchronous clock with prescaler division by 12  */
00710 #define LL_ADC_CLOCK_ASYNC_DIV16           (ADC_CCR_PRESC_2 | ADC_CCR_PRESC_1 | ADC_CCR_PRESC_0) /*!< ADC asynchronous clock with prescaler division by 16  */
00711 #define LL_ADC_CLOCK_ASYNC_DIV32           (ADC_CCR_PRESC_3)                                     /*!< ADC asynchronous clock with prescaler division by 32  */
00712 #define LL_ADC_CLOCK_ASYNC_DIV64           (ADC_CCR_PRESC_3 | ADC_CCR_PRESC_0)                   /*!< ADC asynchronous clock with prescaler division by 64  */
00713 #define LL_ADC_CLOCK_ASYNC_DIV128          (ADC_CCR_PRESC_3 | ADC_CCR_PRESC_1)                   /*!< ADC asynchronous clock with prescaler division by 128 */
00714 #define LL_ADC_CLOCK_ASYNC_DIV256          (ADC_CCR_PRESC_3 | ADC_CCR_PRESC_1 | ADC_CCR_PRESC_0) /*!< ADC asynchronous clock with prescaler division by 256 */
00715 /**
00716   * @}
00717   */
00718 
00719 /** @defgroup ADC_LL_EC_COMMON_PATH_INTERNAL  ADC common - Measurement path to internal channels
00720   * @{
00721   */
00722 /* Note: Other measurement paths to internal channels may be available        */
00723 /*       (connections to other peripherals).                                  */
00724 /*       If they are not listed below, they do not require any specific       */
00725 /*       path enable. In this case, Access to measurement path is done        */
00726 /*       only by selecting the corresponding ADC internal channel.            */
00727 #define LL_ADC_PATH_INTERNAL_NONE          (0x00000000UL)         /*!< ADC measurement paths all disabled */
00728 #define LL_ADC_PATH_INTERNAL_VREFINT       (ADC_CCR_VREFEN)       /*!< ADC measurement path to internal channel VrefInt */
00729 #define LL_ADC_PATH_INTERNAL_TEMPSENSOR    (ADC_CCR_TSEN)         /*!< ADC measurement path to internal channel temperature sensor */
00730 #define LL_ADC_PATH_INTERNAL_VBAT          (ADC_CCR_VBATEN)       /*!< ADC measurement path to internal channel Vbat */
00731 /**
00732   * @}
00733   */
00734 
00735 /** @defgroup ADC_LL_EC_BOOST_MODE ADC instance - Boost mode
00736   * @{
00737   */
00738 #define LL_ADC_BOOST_MODE_6MHZ25   (0x00000000UL)                                            /*!< Boost mode is configured for frequency <= 6.25Mhz           */
00739 #define LL_ADC_BOOST_MODE_12MHZ5   (                                        ADC_CR_BOOST_0)  /*!< Boost mode is configured for 6.25Mhz < frequency <= 12.5Mhz */
00740 #define LL_ADC_BOOST_MODE_20MHZ    (                       ADC_CR_BOOST_1                 )  /*!< Boost mode is configured for 12.5Mhz < frequency <= 20Mhz   */
00741 #define LL_ADC_BOOST_MODE_25MHZ    ((ADC_CR_BOOST_0 <<2) | ADC_CR_BOOST_1                 )  /*!< Boost mode is configured for 20Mhz   < frequency <= 25Mhz   */
00742 #define LL_ADC_BOOST_MODE_50MHZ    ((ADC_CR_BOOST_0 <<2) | ADC_CR_BOOST_1 | ADC_CR_BOOST_0)  /*!< Boost mode is configured for frequency > 25Mhz              */
00743 /**
00744   * @}
00745   */
00746 
00747 /** @defgroup ADC_LL_EC_CALIBRATION_OFFSET_LINEARITY  ADC instance - Calibration mode for offset and linearity
00748   * @{
00749   */
00750 #define LL_ADC_CALIB_OFFSET                (ADC_CALIB_FACTOR_OFFSET_REGOFFSET)                      /*!< Calibration of ADC offset. Duration of calibration of offset duration: 1280 ADC clock cycles. For devices with differential mode available: Calibration of offset is specific to each of single-ended and differential modes. */
00751 #define LL_ADC_CALIB_LINEARITY             (ADC_CALIB_FACTOR_LINEARITY_REGOFFSET)                   /*!< Calibration of ADC linearity. Duration of calibration of linearity: 15104 ADC clock cycles. For devices with differential mode available: Calibration of linearity is common to both single-ended and differential modes. */
00752 #define LL_ADC_CALIB_OFFSET_LINEARITY      (ADC_CALIB_FACTOR_LINEARITY_REGOFFSET | ADC_CR_ADCALLIN) /*!< Calibration of ADC offset and linearity. Duration of calibration of offset and linearity: 16384 ADC clock cycles. For devices with differential mode available: Calibration of offset is specific to each of single-ended and differential modes, calibration of linearity is common to both single-ended and differential modes. */
00753 /**
00754   * @}
00755   */
00756 
00757 /** @defgroup ADC_LL_EC_CALIBRATION_LINEARITY_WORD  ADC instance - Calibration linearity words
00758   * @{
00759   */
00760 #define LL_ADC_CALIB_LINEARITY_WORD1       (ADC_CR_LINCALRDYW1)    /*!< ADC calibration linearity word 1 */
00761 #define LL_ADC_CALIB_LINEARITY_WORD2       (ADC_CR_LINCALRDYW2)    /*!< ADC calibration linearity word 2 */
00762 #define LL_ADC_CALIB_LINEARITY_WORD3       (ADC_CR_LINCALRDYW3)    /*!< ADC calibration linearity word 3 */
00763 #define LL_ADC_CALIB_LINEARITY_WORD4       (ADC_CR_LINCALRDYW4)    /*!< ADC calibration linearity word 4 */
00764 #define LL_ADC_CALIB_LINEARITY_WORD5       (ADC_CR_LINCALRDYW5)    /*!< ADC calibration linearity word 5 */
00765 #define LL_ADC_CALIB_LINEARITY_WORD6       (ADC_CR_LINCALRDYW6)    /*!< ADC calibration linearity word 6 */
00766 /**
00767   * @}
00768   */
00769 
00770 /** @defgroup ADC_LL_EC_RESOLUTION  ADC instance - Resolution
00771   * @{
00772   */
00773 #define LL_ADC_RESOLUTION_16B              (0x00000000UL)                                      /*!< ADC resolution 16 bits */
00774 #define LL_ADC_RESOLUTION_14B              (                                  ADC_CFGR_RES_0)  /*!< ADC resolution 12 bits */
00775 #define LL_ADC_RESOLUTION_12B              (                 ADC_CFGR_RES_1                 )  /*!< ADC resolution 12 bits */
00776 #define LL_ADC_RESOLUTION_10B              (                 ADC_CFGR_RES_1 | ADC_CFGR_RES_0)  /*!< ADC resolution 10 bits */
00777 
00778 #if defined (ADC_VER_V5_X)
00779 #define LL_ADC_RESOLUTION_14B_OPT          (ADC_CFGR_RES_2 |                  ADC_CFGR_RES_0)  /*!< ADC resolution 14 bits optimized for power consumption, available on for devices revision V only */
00780 #define LL_ADC_RESOLUTION_12B_OPT          (ADC_CFGR_RES_2 | ADC_CFGR_RES_1                 )  /*!< ADC resolution 12 bits optimized for power consumption, available on for devices revision V only */
00781 #endif
00782 
00783 #if defined (ADC_VER_V5_3) || defined(ADC_VER_V5_V90)
00784 #define LL_ADC_RESOLUTION_8B               (ADC_CFGR_RES_2|ADC_CFGR_RES_1 | ADC_CFGR_RES_0) /*!< ADC resolution  8 bits */
00785 #else
00786 #define LL_ADC_RESOLUTION_8B               (ADC_CFGR_RES_2                                ) /*!< ADC resolution  8 bits */
00787                                                                                             /*!< The resolution setting is managed internally in the driver:
00788                                                                                                     "LL_ADC_RESOLUTION_8B" definition: keep using the "100b" value (corresponding to STM32H74x/5x rev Y).
00789                                                                                                     Rev.V value "111b" is handled through functions "LL_ADC_SetResolution/LL_ADC_GetResolution"  with a dedicated check on DBGMCU IDCODE register */
00790 #endif
00791 #if defined(ADC_VER_V5_V90)
00792 #define LL_ADC_RESOLUTION_6B               (ADC3_CFGR_RES_1 | ADC3_CFGR_RES_0)   /*!< ADC resolution  6 bits. Value available for ADC3 on STM32H72xx/3xx devices only*/
00793 #endif  /* ADC_VER_V5_V90 */
00794 /**
00795   * @}
00796   */
00797 
00798 #if defined(ADC_VER_V5_V90)
00799 /** @defgroup ADC_LL_EC_DATA_ALIGN  ADC instance - Data alignment
00800   * @{
00801   */
00802 #define LL_ADC_DATA_ALIGN_RIGHT            (0x00000000UL)         /*!< ADC conversion data alignment: right aligned (alignment on data register LSB bit 0)*/
00803 #define LL_ADC_DATA_ALIGN_LEFT             (ADC3_CFGR_ALIGN)       /*!< ADC conversion data alignment: left aligned (alignment on data register MSB bit 15)*/
00804 /**
00805   * @}
00806   */
00807 
00808 #endif  /* ADC_VER_V5_V90 */
00809 
00810 /** @defgroup ADC_LL_EC_LEFT_BIT_SHIFT   ADC left Shift
00811   * @{
00812   */
00813 #define LL_ADC_LEFT_BIT_SHIFT_NONE  (0x00000000UL)                                                                       /*!< ADC no bit shift left applied on the final ADC conversion data */
00814 #define LL_ADC_LEFT_BIT_SHIFT_1     (ADC_CFGR2_LSHIFT_0)                                                                 /*!< ADC 1 bit shift left applied on the final ADC conversion data */
00815 #define LL_ADC_LEFT_BIT_SHIFT_2     (ADC_CFGR2_LSHIFT_1)                                                                 /*!< ADC 2 bits shift left applied on the final ADC conversion data */
00816 #define LL_ADC_LEFT_BIT_SHIFT_3     (ADC_CFGR2_LSHIFT_1 | ADC_CFGR2_LSHIFT_0)                                            /*!< ADC 3 bits shift left applied on the final ADC conversion data */
00817 #define LL_ADC_LEFT_BIT_SHIFT_4     (ADC_CFGR2_LSHIFT_2)                                                                 /*!< ADC 4 bits shift left applied on the final ADC conversion data */
00818 #define LL_ADC_LEFT_BIT_SHIFT_5     (ADC_CFGR2_LSHIFT_2 | ADC_CFGR2_LSHIFT_0)                                            /*!< ADC 5 bits shift left applied on the final ADC conversion data */
00819 #define LL_ADC_LEFT_BIT_SHIFT_6     (ADC_CFGR2_LSHIFT_2 | ADC_CFGR2_LSHIFT_1)                                            /*!< ADC 6 bits shift left applied on the final ADC conversion data */
00820 #define LL_ADC_LEFT_BIT_SHIFT_7     (ADC_CFGR2_LSHIFT_2 | ADC_CFGR2_LSHIFT_1 | ADC_CFGR2_LSHIFT_0)                       /*!< ADC 7 bits shift left applied on the final ADC conversion data */
00821 #define LL_ADC_LEFT_BIT_SHIFT_8     (ADC_CFGR2_LSHIFT_3)                                                                 /*!< ADC 8 bits shift left applied on the final ADC conversion data */
00822 #define LL_ADC_LEFT_BIT_SHIFT_9     (ADC_CFGR2_LSHIFT_3 | ADC_CFGR2_LSHIFT_0)                                            /*!< ADC 9 bits shift left applied on the final ADC conversion data */
00823 #define LL_ADC_LEFT_BIT_SHIFT_10    (ADC_CFGR2_LSHIFT_3 | ADC_CFGR2_LSHIFT_1)                                            /*!< ADC 10 bits shift left applied on the final ADC conversion data */
00824 #define LL_ADC_LEFT_BIT_SHIFT_11    (ADC_CFGR2_LSHIFT_3 | ADC_CFGR2_LSHIFT_1 | ADC_CFGR2_LSHIFT_0)                       /*!< ADC 11 bits shift left applied on the final ADC conversion data */
00825 #define LL_ADC_LEFT_BIT_SHIFT_12    (ADC_CFGR2_LSHIFT_3 | ADC_CFGR2_LSHIFT_2)                                            /*!< ADC 12 bits shift left applied on the final ADC conversion data */
00826 #define LL_ADC_LEFT_BIT_SHIFT_13    (ADC_CFGR2_LSHIFT_3 | ADC_CFGR2_LSHIFT_2 | ADC_CFGR2_LSHIFT_0)                       /*!< ADC 13 bits shift left applied on the final ADC conversion data */
00827 #define LL_ADC_LEFT_BIT_SHIFT_14    (ADC_CFGR2_LSHIFT_3 | ADC_CFGR2_LSHIFT_2 | ADC_CFGR2_LSHIFT_1)                       /*!< ADC 14 bits shift left applied on the final ADC conversion data */
00828 #define LL_ADC_LEFT_BIT_SHIFT_15    (ADC_CFGR2_LSHIFT_3 | ADC_CFGR2_LSHIFT_2 | ADC_CFGR2_LSHIFT_1 | ADC_CFGR2_LSHIFT_0)  /*!< ADC 15 bits shift left applied on the final ADC conversion data */
00829 /**
00830   * @}
00831   */
00832 
00833 /** @defgroup ADC_LL_EC_LP_MODE  ADC instance - Low power mode
00834   * @{
00835   */
00836 #define LL_ADC_LP_MODE_NONE                (0x00000000UL)                      /*!< No ADC low power mode activated */
00837 #define LL_ADC_LP_AUTOWAIT                 (ADC_CFGR_AUTDLY)                   /*!< ADC low power mode auto delay: Dynamic low power mode, ADC conversions are performed only when necessary (when previous ADC conversion data is read). See description with function @ref LL_ADC_SetLowPowerMode(). */
00838 /**
00839   * @}
00840   */
00841 
00842 /** @defgroup ADC_LL_EC_OFFSET_NB  ADC instance - Offset number
00843   * @{
00844   */
00845 #define LL_ADC_OFFSET_1                    ADC_OFR1_REGOFFSET /*!< ADC offset number 1: ADC channel and offset level to which the offset programmed will be applied (independently of channel mapped on ADC group regular or group injected) */
00846 #define LL_ADC_OFFSET_2                    ADC_OFR2_REGOFFSET /*!< ADC offset number 2: ADC channel and offset level to which the offset programmed will be applied (independently of channel mapped on ADC group regular or group injected) */
00847 #define LL_ADC_OFFSET_3                    ADC_OFR3_REGOFFSET /*!< ADC offset number 3: ADC channel and offset level to which the offset programmed will be applied (independently of channel mapped on ADC group regular or group injected) */
00848 #define LL_ADC_OFFSET_4                    ADC_OFR4_REGOFFSET /*!< ADC offset number 4: ADC channel and offset level to which the offset programmed will be applied (independently of channel mapped on ADC group regular or group injected) */
00849 /**
00850   * @}
00851   */
00852 
00853 /** @defgroup ADC_LL_EC_OFFSET_SIGNED_SATURATION ADC instance - Offset signed saturation mode
00854   * @{
00855   */
00856 #define LL_ADC_OFFSET_SIGNED_SATURATION_DISABLE   (0x00000000UL)   /*!< ADC offset signed saturation is disabled (among ADC selected offset number 1, 2, 3 or 4) */
00857 #define LL_ADC_OFFSET_SIGNED_SATURATION_ENABLE    (ADC_OFR1_SSATE) /*!< ADC offset signed saturation is enabled (among ADC selected offset number 1, 2, 3 or 4) */
00858 /**
00859   * @}
00860   */
00861 
00862 /** @defgroup ADC_LL_EC_OFFSET_RSHIFT ADC instance - Offset right shift
00863   * @{
00864   */
00865 #define LL_ADC_OFFSET_RSHIFT_DISABLE   (0x00000000UL)      /*!< ADC offset right shift is disabled (among ADC selected offset number 1, 2, 3 or 4) */
00866 #define LL_ADC_OFFSET_RSHIFT_ENABLE    (ADC_CFGR2_RSHIFT1) /*!< ADC offset right shift is enabled (among ADC selected offset number 1, 2, 3 or 4) */
00867 /**
00868   * @}
00869   */
00870 #if defined(ADC_VER_V5_V90)
00871 /** @defgroup ADC_LL_EC_OFFSET_SATURATION ADC instance - Offset saturation mode
00872   * @{
00873   */
00874 #define LL_ADC_OFFSET_SATURATION_DISABLE   (0x00000000UL)           /*!< ADC offset saturation is disabled (among ADC selected offset number 1, 2, 3 or 4). On devices STM32H72xx and STM32H73xx */
00875 #define LL_ADC_OFFSET_SATURATION_ENABLE    (ADC3_OFR1_SATEN)        /*!< ADC offset saturation is enabled (among ADC selected offset number 1, 2, 3 or 4). On devices STM32H72xx and STM32H73xx */
00876 /**
00877   * @}
00878   */
00879 
00880 /** @defgroup ADC_LL_EC_OFFSET_STATE ADC instance - Offset state
00881   * @{
00882   */
00883 #define LL_ADC_OFFSET_DISABLE              (0x00000000UL)         /*!< ADC offset disabled (among ADC selected offset number 1, 2, 3 or 4) */
00884 #define LL_ADC_OFFSET_ENABLE               (ADC3_OFR1_OFFSET1_EN)  /*!< ADC offset enabled (among ADC selected offset number 1, 2, 3 or 4) */
00885 /**
00886   * @}
00887   */
00888 #if defined(ADC_VER_V5_V90)
00889 /** @defgroup ADC_LL_EC_OFFSET_SIGN ADC instance - Offset sign
00890   * @{
00891   */
00892 #define LL_ADC_OFFSET_SIGN_NEGATIVE        (0x00000000UL)        /*!< ADC offset is negative (among ADC selected offset number 1, 2, 3 or 4). On devices STM32H72xx and STM32H73xx */
00893 #define LL_ADC_OFFSET_SIGN_POSITIVE        (ADC3_OFR1_OFFSETPOS) /*!< ADC offset is positive (among ADC selected offset number 1, 2, 3 or 4). On devices STM32H72xx and STM32H73xx */
00894 /**
00895   * @}
00896   */
00897 #endif
00898 
00899 #endif /* ADC_VER_V5_V90 */
00900 
00901 /** @defgroup ADC_LL_EC_GROUPS  ADC instance - Groups
00902   * @{
00903   */
00904 #define LL_ADC_GROUP_REGULAR               (0x00000001UL) /*!< ADC group regular (available on all STM32 devices) */
00905 #define LL_ADC_GROUP_INJECTED              (0x00000002UL) /*!< ADC group injected (not available on all STM32 devices)*/
00906 #define LL_ADC_GROUP_REGULAR_INJECTED      (0x00000003UL) /*!< ADC both groups regular and injected */
00907 /**
00908   * @}
00909   */
00910 
00911 /** @defgroup ADC_LL_EC_CHANNEL  ADC instance - Channel number
00912   * @{
00913   */
00914 #define LL_ADC_CHANNEL_0                   (ADC_CHANNEL_0_NUMBER  | ADC_CHANNEL_0_SMP  | ADC_CHANNEL_0_BITFIELD ) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN0  */
00915 #define LL_ADC_CHANNEL_1                   (ADC_CHANNEL_1_NUMBER  | ADC_CHANNEL_1_SMP  | ADC_CHANNEL_1_BITFIELD ) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN1  */
00916 #define LL_ADC_CHANNEL_2                   (ADC_CHANNEL_2_NUMBER  | ADC_CHANNEL_2_SMP  | ADC_CHANNEL_2_BITFIELD ) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN2  */
00917 #define LL_ADC_CHANNEL_3                   (ADC_CHANNEL_3_NUMBER  | ADC_CHANNEL_3_SMP  | ADC_CHANNEL_3_BITFIELD ) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN3  */
00918 #define LL_ADC_CHANNEL_4                   (ADC_CHANNEL_4_NUMBER  | ADC_CHANNEL_4_SMP  | ADC_CHANNEL_4_BITFIELD ) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN4  */
00919 #define LL_ADC_CHANNEL_5                   (ADC_CHANNEL_5_NUMBER  | ADC_CHANNEL_5_SMP  | ADC_CHANNEL_5_BITFIELD ) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN5  */
00920 #define LL_ADC_CHANNEL_6                   (ADC_CHANNEL_6_NUMBER  | ADC_CHANNEL_6_SMP  | ADC_CHANNEL_6_BITFIELD ) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN6  */
00921 #define LL_ADC_CHANNEL_7                   (ADC_CHANNEL_7_NUMBER  | ADC_CHANNEL_7_SMP  | ADC_CHANNEL_7_BITFIELD ) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN7  */
00922 #define LL_ADC_CHANNEL_8                   (ADC_CHANNEL_8_NUMBER  | ADC_CHANNEL_8_SMP  | ADC_CHANNEL_8_BITFIELD ) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN8  */
00923 #define LL_ADC_CHANNEL_9                   (ADC_CHANNEL_9_NUMBER  | ADC_CHANNEL_9_SMP  | ADC_CHANNEL_9_BITFIELD ) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN9  */
00924 #define LL_ADC_CHANNEL_10                  (ADC_CHANNEL_10_NUMBER | ADC_CHANNEL_10_SMP | ADC_CHANNEL_10_BITFIELD) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN10 */
00925 #define LL_ADC_CHANNEL_11                  (ADC_CHANNEL_11_NUMBER | ADC_CHANNEL_11_SMP | ADC_CHANNEL_11_BITFIELD) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN11 */
00926 #define LL_ADC_CHANNEL_12                  (ADC_CHANNEL_12_NUMBER | ADC_CHANNEL_12_SMP | ADC_CHANNEL_12_BITFIELD) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN12 */
00927 #define LL_ADC_CHANNEL_13                  (ADC_CHANNEL_13_NUMBER | ADC_CHANNEL_13_SMP | ADC_CHANNEL_13_BITFIELD) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN13 */
00928 #define LL_ADC_CHANNEL_14                  (ADC_CHANNEL_14_NUMBER | ADC_CHANNEL_14_SMP | ADC_CHANNEL_14_BITFIELD) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN14 */
00929 #define LL_ADC_CHANNEL_15                  (ADC_CHANNEL_15_NUMBER | ADC_CHANNEL_15_SMP | ADC_CHANNEL_15_BITFIELD) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN15 */
00930 #define LL_ADC_CHANNEL_16                  (ADC_CHANNEL_16_NUMBER | ADC_CHANNEL_16_SMP | ADC_CHANNEL_16_BITFIELD) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN16 */
00931 #define LL_ADC_CHANNEL_17                  (ADC_CHANNEL_17_NUMBER | ADC_CHANNEL_17_SMP | ADC_CHANNEL_17_BITFIELD) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN17 */
00932 #define LL_ADC_CHANNEL_18                  (ADC_CHANNEL_18_NUMBER | ADC_CHANNEL_18_SMP | ADC_CHANNEL_18_BITFIELD) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN18 */
00933 #define LL_ADC_CHANNEL_19                  (ADC_CHANNEL_19_NUMBER | ADC_CHANNEL_19_SMP | ADC_CHANNEL_19_BITFIELD) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN19 */
00934 #if defined(ADC3)
00935 #if defined(ADC_VER_V5_V90)
00936 #define LL_ADC_CHANNEL_VREFINT             (LL_ADC_CHANNEL_18 | ADC_CHANNEL_ID_INTERNAL_CH) /*!< ADC internal channel connected to VrefInt: Internal voltage reference. On STM32H7, ADC channel available only on ADC instance: ADC3. */
00937 #define LL_ADC_CHANNEL_TEMPSENSOR          (LL_ADC_CHANNEL_17 | ADC_CHANNEL_ID_INTERNAL_CH) /*!< ADC internal channel connected to Temperature sensor. On STM32H7, ADC channel available only on ADC instance: ADC3. */
00938 #define LL_ADC_CHANNEL_VBAT                (LL_ADC_CHANNEL_16 | ADC_CHANNEL_ID_INTERNAL_CH) /*!< ADC internal channel connected to Vbat/3: Vbat voltage through a divider ladder of factor 1/4 to have Vbat always below Vdda. On STM32H7, ADC channel available only on ADC instance: ADC3. */
00939 #else
00940 #define LL_ADC_CHANNEL_VREFINT             (LL_ADC_CHANNEL_19 | ADC_CHANNEL_ID_INTERNAL_CH) /*!< ADC internal channel connected to VrefInt: Internal voltage reference. On STM32H7, ADC channel available only on ADC instance: ADC3. */
00941 #define LL_ADC_CHANNEL_TEMPSENSOR          (LL_ADC_CHANNEL_18 | ADC_CHANNEL_ID_INTERNAL_CH) /*!< ADC internal channel connected to Temperature sensor. On STM32H7, ADC channel available only on ADC instance: ADC3. */
00942 #define LL_ADC_CHANNEL_VBAT                (LL_ADC_CHANNEL_17 | ADC_CHANNEL_ID_INTERNAL_CH) /*!< ADC internal channel connected to Vbat/3: Vbat voltage through a divider ladder of factor 1/4 to have Vbat always below Vdda. On STM32H7, ADC channel available only on ADC instance: ADC3. */
00943 #endif
00944 #else
00945 /*!< Specific define for STM32H7A3xx and STM32HB3xx varieties of STM32H7XXX */
00946 #define LL_ADC_CHANNEL_VREFINT             (LL_ADC_CHANNEL_19 | ADC_CHANNEL_ID_INTERNAL_CH) /*!< ADC internal channel connected to VrefInt: Internal voltage reference. On STM32H7, ADC channel available only on ADC instance: ADC2. */
00947 #define LL_ADC_CHANNEL_TEMPSENSOR          (LL_ADC_CHANNEL_18 | ADC_CHANNEL_ID_INTERNAL_CH) /*!< ADC internal channel connected to Temperature sensor. On STM32H7, ADC channel available only on ADC instance: ADC2. */
00948 #define LL_ADC_CHANNEL_VBAT                (LL_ADC_CHANNEL_14 | ADC_CHANNEL_ID_INTERNAL_CH) /*!< ADC internal channel connected to Vbat/3: Vbat voltage through a divider ladder of factor 1/4 to have Vbat always below Vdda. On STM32H7, ADC channel available only on ADC instance: ADC2. */
00949 #endif
00950 #define LL_ADC_CHANNEL_DAC1CH1_ADC2        (LL_ADC_CHANNEL_16 | ADC_CHANNEL_ID_INTERNAL_CH) /*!< ADC internal channel connected to DAC1 channel 1, channel specific to ADC2 */
00951 #define LL_ADC_CHANNEL_DAC1CH2_ADC2        (LL_ADC_CHANNEL_17 | ADC_CHANNEL_ID_INTERNAL_CH) /*!< ADC internal channel connected to DAC1 channel 2, channel specific to ADC2 */
00952 #if defined(DAC2)
00953 /*!< Specific define for STM32H7A3xx and STM32HB3xx varieties of STM32H7XXX */
00954 #define LL_ADC_CHANNEL_DAC2CH1_ADC2        (LL_ADC_CHANNEL_15 | ADC_CHANNEL_ID_INTERNAL_CH) /*!< ADC internal channel connected to DAC2 channel 1, channel specific to ADC2 */
00955 #endif
00956 /**
00957   * @}
00958   */
00959 
00960 /** @defgroup ADC_LL_EC_REG_TRIGGER_SOURCE  ADC group regular - Trigger source
00961   * @{
00962   */
00963 #define LL_ADC_REG_TRIG_SOFTWARE          (0x00000000UL)                                                                                                    /*!< ADC group regular conversion trigger internal: SW start. */
00964 #define LL_ADC_REG_TRIG_EXT_TIM1_CH1      (ADC_REG_TRIG_EXT_EDGE_DEFAULT)                                                                                   /*!< ADC group regular conversion trigger from external peripheral: TIM1 channel 1 event (capture compare: input capture or output capture). Trigger edge set to rising edge (default setting). */
00965 #define LL_ADC_REG_TRIG_EXT_TIM1_CH2      (ADC_CFGR_EXTSEL_0 | ADC_REG_TRIG_EXT_EDGE_DEFAULT)                                                               /*!< ADC group regular conversion trigger from external peripheral: TIM1 channel 2 event (capture compare: input capture or output capture). Trigger edge set to rising edge (default setting). */
00966 #define LL_ADC_REG_TRIG_EXT_TIM1_CH3      (ADC_CFGR_EXTSEL_1 | ADC_REG_TRIG_EXT_EDGE_DEFAULT)                                                               /*!< ADC group regular conversion trigger from external peripheral: TIM1 channel 3 event (capture compare: input capture or output capture). Trigger edge set to rising edge (default setting). */
00967 #define LL_ADC_REG_TRIG_EXT_TIM2_CH2      (ADC_CFGR_EXTSEL_1 | ADC_CFGR_EXTSEL_0 | ADC_REG_TRIG_EXT_EDGE_DEFAULT)                                           /*!< ADC group regular conversion trigger from external peripheral: TIM2 channel 2 event (capture compare: input capture or output capture). Trigger edge set to rising edge (default setting). */
00968 #define LL_ADC_REG_TRIG_EXT_TIM3_TRGO     (ADC_CFGR_EXTSEL_2 | ADC_REG_TRIG_EXT_EDGE_DEFAULT)                                                               /*!< ADC group regular conversion trigger from external peripheral: TIM3 TRGO event. Trigger edge set to rising edge (default setting). */
00969 #define LL_ADC_REG_TRIG_EXT_TIM4_CH4      (ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_0 | ADC_REG_TRIG_EXT_EDGE_DEFAULT)                                           /*!< ADC group regular conversion trigger from external peripheral: TIM4 channel 4 event (capture compare: input capture or output capture). Trigger edge set to rising edge (default setting). */
00970 #define LL_ADC_REG_TRIG_EXT_EXTI_LINE11   (ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_1 | ADC_REG_TRIG_EXT_EDGE_DEFAULT)                                           /*!< ADC group regular conversion trigger from external peripheral: external interrupt line 11 event. Trigger edge set to rising edge (default setting). */
00971 #define LL_ADC_REG_TRIG_EXT_TIM8_TRGO     (ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_1 | ADC_CFGR_EXTSEL_0 | ADC_REG_TRIG_EXT_EDGE_DEFAULT)                       /*!< ADC group regular conversion trigger from external peripheral: TIM8 TRGO event. Trigger edge set to rising edge (default setting). */
00972 #define LL_ADC_REG_TRIG_EXT_TIM8_TRGO2    (ADC_CFGR_EXTSEL_3 | ADC_REG_TRIG_EXT_EDGE_DEFAULT)                                                               /*!< ADC group regular conversion trigger from external peripheral: TIM8 TRGO2 event. Trigger edge set to rising edge (default setting). */
00973 #define LL_ADC_REG_TRIG_EXT_TIM1_TRGO     (ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_0 | ADC_REG_TRIG_EXT_EDGE_DEFAULT)                                           /*!< ADC group regular conversion trigger from external peripheral: TIM1 TRGO event. Trigger edge set to rising edge (default setting). */
00974 #define LL_ADC_REG_TRIG_EXT_TIM1_TRGO2    (ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_1 | ADC_REG_TRIG_EXT_EDGE_DEFAULT)                                           /*!< ADC group regular conversion trigger from external peripheral: TIM1 TRGO2 event. Trigger edge set to rising edge (default setting). */
00975 #define LL_ADC_REG_TRIG_EXT_TIM2_TRGO     (ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_1 | ADC_CFGR_EXTSEL_0 | ADC_REG_TRIG_EXT_EDGE_DEFAULT)                       /*!< ADC group regular conversion trigger from external peripheral: TIM2 TRGO event. Trigger edge set to rising edge (default setting). */
00976 #define LL_ADC_REG_TRIG_EXT_TIM4_TRGO     (ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_2 | ADC_REG_TRIG_EXT_EDGE_DEFAULT)                                           /*!< ADC group regular conversion trigger from external peripheral: TIM4 TRGO event. Trigger edge set to rising edge (default setting). */
00977 #define LL_ADC_REG_TRIG_EXT_TIM6_TRGO     (ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_0 | ADC_REG_TRIG_EXT_EDGE_DEFAULT)                       /*!< ADC group regular conversion trigger from external peripheral: TIM6 TRGO event. Trigger edge set to rising edge (default setting). */
00978 #define LL_ADC_REG_TRIG_EXT_TIM15_TRGO    (ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_1 | ADC_REG_TRIG_EXT_EDGE_DEFAULT)                       /*!< ADC group regular conversion trigger from external peripheral: TIM15 TRGO event. Trigger edge set to rising edge (default setting). */
00979 #define LL_ADC_REG_TRIG_EXT_TIM3_CH4      (ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_1 | ADC_CFGR_EXTSEL_0 | ADC_REG_TRIG_EXT_EDGE_DEFAULT)   /*!< ADC group regular conversion trigger from external peripheral: TIM3 channel 4 event (capture compare: input capture or output capture). Trigger edge set to rising edge (default setting). */
00980 #define LL_ADC_REG_TRIG_EXT_HRTIM_TRG1    (ADC_CFGR_EXTSEL_4 | ADC_REG_TRIG_EXT_EDGE_DEFAULT)                                                               /*!< ADC group regular conversion trigger from external peripheral: HRTIM TRG1 event. Trigger edge set to rising edge (default setting). */
00981 #define LL_ADC_REG_TRIG_EXT_HRTIM_TRG3    (ADC_CFGR_EXTSEL_4 | ADC_CFGR_EXTSEL_0 | ADC_REG_TRIG_EXT_EDGE_DEFAULT)                                           /*!< ADC group regular conversion trigger from external peripheral: HRTIM TRG2 event. Trigger edge set to rising edge (default setting). */
00982 #define LL_ADC_REG_TRIG_EXT_LPTIM1_OUT    (ADC_CFGR_EXTSEL_4 | ADC_CFGR_EXTSEL_1 | ADC_REG_TRIG_EXT_EDGE_DEFAULT)                                           /*!< ADC group regular conversion trigger from external peripheral: LPTIM1 OUT event. Trigger edge set to rising edge (default setting). */
00983 #define LL_ADC_REG_TRIG_EXT_LPTIM2_OUT    (ADC_CFGR_EXTSEL_4 | ADC_CFGR_EXTSEL_1 | ADC_CFGR_EXTSEL_0 | ADC_REG_TRIG_EXT_EDGE_DEFAULT)                       /*!< ADC group regular conversion trigger from external peripheral: LPTIM2 OUT event. Trigger edge set to rising edge (default setting). */
00984 #define LL_ADC_REG_TRIG_EXT_LPTIM3_OUT    (ADC_CFGR_EXTSEL_4 | ADC_CFGR_EXTSEL_2 | ADC_REG_TRIG_EXT_EDGE_DEFAULT)                                           /*!< ADC group regular conversion trigger from external peripheral: LPTIM3 event OUT. Trigger edge set to rising edge (default setting). */
00985 #if defined (TIM23)
00986 #define LL_ADC_REG_TRIG_EXT_TIM23_TRGO    (ADC_CFGR_EXTSEL_4 | ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_0 | ADC_REG_TRIG_EXT_EDGE_DEFAULT)                       /*!< ADC group regular conversion trigger from external peripheral: TIM23 TRGO event. Trigger edge set to rising edge (default setting). */
00987 #endif /* TIM23 */
00988 #if defined (TIM24)
00989 #define LL_ADC_REG_TRIG_EXT_TIM24_TRGO    (ADC_CFGR_EXTSEL_4 | ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_1 | ADC_REG_TRIG_EXT_EDGE_DEFAULT)                       /*!< ADC group regular conversion trigger from external peripheral: TIM24 TRGO event. Trigger edge set to rising edge (default setting). */
00990 #endif /* TIM24 */
00991 /**
00992   * @}
00993   */
00994 
00995 /** @defgroup ADC_LL_EC_REG_TRIGGER_EDGE  ADC group regular - Trigger edge
00996   * @{
00997   */
00998 #define LL_ADC_REG_TRIG_EXT_RISING         (                   ADC_CFGR_EXTEN_0)   /*!< ADC group regular conversion trigger polarity set to rising edge */
00999 #define LL_ADC_REG_TRIG_EXT_FALLING        (ADC_CFGR_EXTEN_1                   )   /*!< ADC group regular conversion trigger polarity set to falling edge */
01000 #define LL_ADC_REG_TRIG_EXT_RISINGFALLING  (ADC_CFGR_EXTEN_1 | ADC_CFGR_EXTEN_0)   /*!< ADC group regular conversion trigger polarity set to both rising and falling edges */
01001 /**
01002   * @}
01003   */
01004 #if defined(ADC_VER_V5_V90)
01005  /** @defgroup ADC_LL_EC_REG_SAMPLING_MODE  ADC group regular - Sampling mode
01006   * @{
01007   */
01008 #define LL_ADC_REG_SAMPLING_MODE_NORMAL               (0x00000000UL)        /*!< ADC conversions sampling phase duration is defined using  @ref ADC_LL_EC_CHANNEL_SAMPLINGTIME. On devices STM32H72xx and STM32H73xx */
01009 #define LL_ADC_REG_SAMPLING_MODE_BULB                 (ADC3_CFGR2_BULB)     /*!< ADC conversions sampling phase starts immediately after end of conversion, and stops upon trigger event.
01010                                                                                  Note: First conversion is using minimal sampling time (see @ref ADC_LL_EC_CHANNEL_SAMPLINGTIME). On devices STM32H72xx and STM32H73xx */
01011 #define LL_ADC_REG_SAMPLING_MODE_TRIGGER_CONTROLED    (ADC3_CFGR2_SMPTRIG)  /*!< ADC conversions sampling phase is controlled by trigger events:
01012                                                                                  Trigger rising edge  = start sampling
01013                                                                                  Trigger falling edge = stop sampling and start conversion. On devices STM32H72xx and STM32H73xx */
01014 /**
01015   * @}
01016   */ 
01017 #endif /* ADC_VER_V5_V90 */
01018 
01019 /** @defgroup ADC_LL_EC_REG_CONTINUOUS_MODE  ADC group regular - Continuous mode
01020 * @{
01021 */
01022 #define LL_ADC_REG_CONV_SINGLE             (0x00000000UL)          /*!< ADC conversions are performed in single mode: one conversion per trigger */
01023 #define LL_ADC_REG_CONV_CONTINUOUS         (ADC_CFGR_CONT)         /*!< ADC conversions are performed in continuous mode: after the first trigger, following conversions launched successively automatically */
01024 /**
01025   * @}
01026   */
01027 
01028 /** @defgroup ADC_LL_EC_REG_DATA_TRANSFER_MODE  ADC group regular - Data transfer mode of ADC conversion data
01029   * @{
01030   */
01031 #define LL_ADC_REG_DR_TRANSFER             (0x00000000UL)                        /*!< ADC conversions are transferred to DR rigister */
01032 #define LL_ADC_REG_DMA_TRANSFER_LIMITED    (                   ADC_CFGR_DMNGT_0) /*!< ADC conversion data are transferred by DMA, in limited mode (one shot mode): DMA transfer requests are stopped when number of DMA data transfers (number of ADC conversions) is reached. This ADC mode is intended to be used with DMA mode non-circular. */
01033 #define LL_ADC_REG_DMA_TRANSFER_UNLIMITED  (ADC_CFGR_DMNGT_1 | ADC_CFGR_DMNGT_0) /*!< ADC conversion data are transferred by DMA, in unlimited mode: DMA transfer requests are unlimited, whatever number of DMA data transferred (number of ADC conversions). This ADC mode is intended to be used with DMA mode circular. */
01034 #define LL_ADC_REG_DFSDM_TRANSFER          (ADC_CFGR_DMNGT_1                   ) /*!< ADC conversion data are transferred to DFSDM */
01035 /**
01036   * @}
01037   */
01038 
01039 #if defined(ADC_VER_V5_V90)
01040 /** @defgroup ADC_LL_EC_REG_DMA_TRANSFER  ADC group regular - DMA transfer of ADC conversion data
01041   * @{
01042   */
01043 
01044 #define LL_ADC3_REG_DMA_TRANSFER_NONE       (0x00000000UL)                        /*!< ADC conversions are not transferred by DMA. On ADC3 of devices STM32H72xx and STM32H73xx */
01045 #define LL_ADC3_REG_DMA_TRANSFER_LIMITED    (                  ADC3_CFGR_DMAEN)    /*!< ADC conversion data are transferred by DMA, in limited mode (one shot mode): DMA transfer requests are stopped when number of DMA data transfers (number of ADC conversions) is reached. This ADC mode is intended to be used with DMA mode non-circular. On ADC3 of devices STM32H72xx and STM32H73xx */
01046 #define LL_ADC3_REG_DMA_TRANSFER_UNLIMITED  (ADC3_CFGR_DMACFG | ADC3_CFGR_DMAEN)    /*!< ADC conversion data are transferred by DMA, in unlimited mode: DMA transfer requests are unlimited, whatever number of DMA data transferred (number of ADC conversions). This ADC mode is intended to be used with DMA mode circular. On ADC3 of devices STM32H72xx and STM32H73xx*/
01047 /**
01048   * @}
01049   */
01050 #endif
01051 
01052 /** @defgroup ADC_LL_EC_REG_OVR_DATA_BEHAVIOR  ADC group regular - Overrun behavior on conversion data
01053 * @{
01054 */
01055 #define LL_ADC_REG_OVR_DATA_PRESERVED      (0x00000000UL)         /*!< ADC group regular behavior in case of overrun: data preserved */
01056 #define LL_ADC_REG_OVR_DATA_OVERWRITTEN    (ADC_CFGR_OVRMOD)      /*!< ADC group regular behavior in case of overrun: data overwritten */
01057 /**
01058   * @}
01059   */
01060 
01061 /** @defgroup ADC_LL_EC_REG_SEQ_SCAN_LENGTH  ADC group regular - Sequencer scan length
01062   * @{
01063   */
01064 #define LL_ADC_REG_SEQ_SCAN_DISABLE        (0x00000000UL)                                              /*!< ADC group regular sequencer disable (equivalent to sequencer of 1 rank: ADC conversion on only 1 channel) */
01065 #define LL_ADC_REG_SEQ_SCAN_ENABLE_2RANKS  (                                             ADC_SQR1_L_0) /*!< ADC group regular sequencer enable with 2 ranks in the sequence */
01066 #define LL_ADC_REG_SEQ_SCAN_ENABLE_3RANKS  (                              ADC_SQR1_L_1               ) /*!< ADC group regular sequencer enable with 3 ranks in the sequence */
01067 #define LL_ADC_REG_SEQ_SCAN_ENABLE_4RANKS  (                              ADC_SQR1_L_1 | ADC_SQR1_L_0) /*!< ADC group regular sequencer enable with 4 ranks in the sequence */
01068 #define LL_ADC_REG_SEQ_SCAN_ENABLE_5RANKS  (               ADC_SQR1_L_2                              ) /*!< ADC group regular sequencer enable with 5 ranks in the sequence */
01069 #define LL_ADC_REG_SEQ_SCAN_ENABLE_6RANKS  (               ADC_SQR1_L_2                | ADC_SQR1_L_0) /*!< ADC group regular sequencer enable with 6 ranks in the sequence */
01070 #define LL_ADC_REG_SEQ_SCAN_ENABLE_7RANKS  (               ADC_SQR1_L_2 | ADC_SQR1_L_1               ) /*!< ADC group regular sequencer enable with 7 ranks in the sequence */
01071 #define LL_ADC_REG_SEQ_SCAN_ENABLE_8RANKS  (               ADC_SQR1_L_2 | ADC_SQR1_L_1 | ADC_SQR1_L_0) /*!< ADC group regular sequencer enable with 8 ranks in the sequence */
01072 #define LL_ADC_REG_SEQ_SCAN_ENABLE_9RANKS  (ADC_SQR1_L_3                                             ) /*!< ADC group regular sequencer enable with 9 ranks in the sequence */
01073 #define LL_ADC_REG_SEQ_SCAN_ENABLE_10RANKS (ADC_SQR1_L_3                               | ADC_SQR1_L_0) /*!< ADC group regular sequencer enable with 10 ranks in the sequence */
01074 #define LL_ADC_REG_SEQ_SCAN_ENABLE_11RANKS (ADC_SQR1_L_3                | ADC_SQR1_L_1               ) /*!< ADC group regular sequencer enable with 11 ranks in the sequence */
01075 #define LL_ADC_REG_SEQ_SCAN_ENABLE_12RANKS (ADC_SQR1_L_3                | ADC_SQR1_L_1 | ADC_SQR1_L_0) /*!< ADC group regular sequencer enable with 12 ranks in the sequence */
01076 #define LL_ADC_REG_SEQ_SCAN_ENABLE_13RANKS (ADC_SQR1_L_3 | ADC_SQR1_L_2                              ) /*!< ADC group regular sequencer enable with 13 ranks in the sequence */
01077 #define LL_ADC_REG_SEQ_SCAN_ENABLE_14RANKS (ADC_SQR1_L_3 | ADC_SQR1_L_2                | ADC_SQR1_L_0) /*!< ADC group regular sequencer enable with 14 ranks in the sequence */
01078 #define LL_ADC_REG_SEQ_SCAN_ENABLE_15RANKS (ADC_SQR1_L_3 | ADC_SQR1_L_2 | ADC_SQR1_L_1               ) /*!< ADC group regular sequencer enable with 15 ranks in the sequence */
01079 #define LL_ADC_REG_SEQ_SCAN_ENABLE_16RANKS (ADC_SQR1_L_3 | ADC_SQR1_L_2 | ADC_SQR1_L_1 | ADC_SQR1_L_0) /*!< ADC group regular sequencer enable with 16 ranks in the sequence */
01080 /**
01081   * @}
01082   */
01083 
01084 /** @defgroup ADC_LL_EC_REG_SEQ_DISCONT_MODE  ADC group regular - Sequencer discontinuous mode
01085   * @{
01086   */
01087 #define LL_ADC_REG_SEQ_DISCONT_DISABLE     (0x00000000UL)                                                               /*!< ADC group regular sequencer discontinuous mode disable */
01088 #define LL_ADC_REG_SEQ_DISCONT_1RANK       (                                                               ADC_CFGR_DISCEN) /*!< ADC group regular sequencer discontinuous mode enable with sequence interruption every rank */
01089 #define LL_ADC_REG_SEQ_DISCONT_2RANKS      (                                          ADC_CFGR_DISCNUM_0 | ADC_CFGR_DISCEN) /*!< ADC group regular sequencer discontinuous mode enabled with sequence interruption every 2 ranks */
01090 #define LL_ADC_REG_SEQ_DISCONT_3RANKS      (                     ADC_CFGR_DISCNUM_1                      | ADC_CFGR_DISCEN) /*!< ADC group regular sequencer discontinuous mode enable with sequence interruption every 3 ranks */
01091 #define LL_ADC_REG_SEQ_DISCONT_4RANKS      (                     ADC_CFGR_DISCNUM_1 | ADC_CFGR_DISCNUM_0 | ADC_CFGR_DISCEN) /*!< ADC group regular sequencer discontinuous mode enable with sequence interruption every 4 ranks */
01092 #define LL_ADC_REG_SEQ_DISCONT_5RANKS      (ADC_CFGR_DISCNUM_2                                           | ADC_CFGR_DISCEN) /*!< ADC group regular sequencer discontinuous mode enable with sequence interruption every 5 ranks */
01093 #define LL_ADC_REG_SEQ_DISCONT_6RANKS      (ADC_CFGR_DISCNUM_2                      | ADC_CFGR_DISCNUM_0 | ADC_CFGR_DISCEN) /*!< ADC group regular sequencer discontinuous mode enable with sequence interruption every 6 ranks */
01094 #define LL_ADC_REG_SEQ_DISCONT_7RANKS      (ADC_CFGR_DISCNUM_2 | ADC_CFGR_DISCNUM_1                      | ADC_CFGR_DISCEN) /*!< ADC group regular sequencer discontinuous mode enable with sequence interruption every 7 ranks */
01095 #define LL_ADC_REG_SEQ_DISCONT_8RANKS      (ADC_CFGR_DISCNUM_2 | ADC_CFGR_DISCNUM_1 | ADC_CFGR_DISCNUM_0 | ADC_CFGR_DISCEN) /*!< ADC group regular sequencer discontinuous mode enable with sequence interruption every 8 ranks */
01096 /**
01097   * @}
01098   */
01099 
01100 /** @defgroup ADC_LL_EC_REG_SEQ_RANKS  ADC group regular - Sequencer ranks
01101   * @{
01102   */
01103 #define LL_ADC_REG_RANK_1                  (ADC_SQR1_REGOFFSET | ADC_REG_RANK_1_SQRX_BITOFFSET_POS)  /*!< ADC group regular sequencer rank 1 */
01104 #define LL_ADC_REG_RANK_2                  (ADC_SQR1_REGOFFSET | ADC_REG_RANK_2_SQRX_BITOFFSET_POS)  /*!< ADC group regular sequencer rank 2 */
01105 #define LL_ADC_REG_RANK_3                  (ADC_SQR1_REGOFFSET | ADC_REG_RANK_3_SQRX_BITOFFSET_POS)  /*!< ADC group regular sequencer rank 3 */
01106 #define LL_ADC_REG_RANK_4                  (ADC_SQR1_REGOFFSET | ADC_REG_RANK_4_SQRX_BITOFFSET_POS)  /*!< ADC group regular sequencer rank 4 */
01107 #define LL_ADC_REG_RANK_5                  (ADC_SQR2_REGOFFSET | ADC_REG_RANK_5_SQRX_BITOFFSET_POS)  /*!< ADC group regular sequencer rank 5 */
01108 #define LL_ADC_REG_RANK_6                  (ADC_SQR2_REGOFFSET | ADC_REG_RANK_6_SQRX_BITOFFSET_POS)  /*!< ADC group regular sequencer rank 6 */
01109 #define LL_ADC_REG_RANK_7                  (ADC_SQR2_REGOFFSET | ADC_REG_RANK_7_SQRX_BITOFFSET_POS)  /*!< ADC group regular sequencer rank 7 */
01110 #define LL_ADC_REG_RANK_8                  (ADC_SQR2_REGOFFSET | ADC_REG_RANK_8_SQRX_BITOFFSET_POS)  /*!< ADC group regular sequencer rank 8 */
01111 #define LL_ADC_REG_RANK_9                  (ADC_SQR2_REGOFFSET | ADC_REG_RANK_9_SQRX_BITOFFSET_POS)  /*!< ADC group regular sequencer rank 9 */
01112 #define LL_ADC_REG_RANK_10                 (ADC_SQR3_REGOFFSET | ADC_REG_RANK_10_SQRX_BITOFFSET_POS) /*!< ADC group regular sequencer rank 10 */
01113 #define LL_ADC_REG_RANK_11                 (ADC_SQR3_REGOFFSET | ADC_REG_RANK_11_SQRX_BITOFFSET_POS) /*!< ADC group regular sequencer rank 11 */
01114 #define LL_ADC_REG_RANK_12                 (ADC_SQR3_REGOFFSET | ADC_REG_RANK_12_SQRX_BITOFFSET_POS) /*!< ADC group regular sequencer rank 12 */
01115 #define LL_ADC_REG_RANK_13                 (ADC_SQR3_REGOFFSET | ADC_REG_RANK_13_SQRX_BITOFFSET_POS) /*!< ADC group regular sequencer rank 13 */
01116 #define LL_ADC_REG_RANK_14                 (ADC_SQR3_REGOFFSET | ADC_REG_RANK_14_SQRX_BITOFFSET_POS) /*!< ADC group regular sequencer rank 14 */
01117 #define LL_ADC_REG_RANK_15                 (ADC_SQR4_REGOFFSET | ADC_REG_RANK_15_SQRX_BITOFFSET_POS) /*!< ADC group regular sequencer rank 15 */
01118 #define LL_ADC_REG_RANK_16                 (ADC_SQR4_REGOFFSET | ADC_REG_RANK_16_SQRX_BITOFFSET_POS) /*!< ADC group regular sequencer rank 16 */
01119 /**
01120   * @}
01121   */
01122 
01123 /** @defgroup ADC_LL_EC_INJ_TRIGGER_SOURCE  ADC group injected - Trigger source
01124   * @{
01125   */
01126 #define LL_ADC_INJ_TRIG_SOFTWARE           (0x00000000UL)                                                                                                         /*!< ADC group injected conversion trigger internal: SW start. */
01127 #define LL_ADC_INJ_TRIG_EXT_TIM1_TRGO      (ADC_INJ_TRIG_EXT_EDGE_DEFAULT)                                                                                        /*!< ADC group injected conversion trigger from external peripheral: TIM1 TRGO event. Trigger edge set to rising edge (default setting). */
01128 #define LL_ADC_INJ_TRIG_EXT_TIM1_CH4       (ADC_JSQR_JEXTSEL_0 | ADC_INJ_TRIG_EXT_EDGE_DEFAULT)                                                                   /*!< ADC group injected conversion trigger from external peripheral: TIM1 channel 4 event (capture compare: input capture or output capture). Trigger edge set to rising edge (default setting). */
01129 #define LL_ADC_INJ_TRIG_EXT_TIM2_TRGO      (ADC_JSQR_JEXTSEL_1 | ADC_INJ_TRIG_EXT_EDGE_DEFAULT)                                                                   /*!< ADC group injected conversion trigger from external peripheral: TIM2 TRGO event. Trigger edge set to rising edge (default setting). */
01130 #define LL_ADC_INJ_TRIG_EXT_TIM2_CH1       (ADC_JSQR_JEXTSEL_1 | ADC_JSQR_JEXTSEL_0 | ADC_INJ_TRIG_EXT_EDGE_DEFAULT)                                              /*!< ADC group injected conversion trigger from external peripheral: TIM2 channel 1 event (capture compare: input capture or output capture). Trigger edge set to rising edge (default setting). */
01131 #define LL_ADC_INJ_TRIG_EXT_TIM3_CH4       (ADC_JSQR_JEXTSEL_2 | ADC_INJ_TRIG_EXT_EDGE_DEFAULT)                                                                   /*!< ADC group injected conversion trigger from external peripheral: TIM3 channel 4 event (capture compare: input capture or output capture). Trigger edge set to rising edge (default setting). */
01132 #define LL_ADC_INJ_TRIG_EXT_TIM4_TRGO      (ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_0 | ADC_INJ_TRIG_EXT_EDGE_DEFAULT)                                              /*!< ADC group injected conversion trigger from external peripheral: TIM4 TRGO event. Trigger edge set to rising edge (default setting). */
01133 #define LL_ADC_INJ_TRIG_EXT_EXTI_LINE15    (ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_1 | ADC_INJ_TRIG_EXT_EDGE_DEFAULT)                                              /*!< ADC group injected conversion trigger from external peripheral: external interrupt line 15. Trigger edge set to rising edge (default setting). */
01134 #define LL_ADC_INJ_TRIG_EXT_TIM8_CH4       (ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_1 | ADC_JSQR_JEXTSEL_0 | ADC_INJ_TRIG_EXT_EDGE_DEFAULT)                         /*!< ADC group injected conversion trigger from external peripheral: TIM8 channel 4 event (capture compare: input capture or output capture). Trigger edge set to rising edge (default setting). */
01135 #define LL_ADC_INJ_TRIG_EXT_TIM1_TRGO2     (ADC_JSQR_JEXTSEL_3 | ADC_INJ_TRIG_EXT_EDGE_DEFAULT)                                                                   /*!< ADC group injected conversion trigger from external peripheral: TIM1 TRGO2 event. Trigger edge set to rising edge (default setting). */
01136 #define LL_ADC_INJ_TRIG_EXT_TIM8_TRGO      (ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_0 | ADC_INJ_TRIG_EXT_EDGE_DEFAULT)                                              /*!< ADC group injected conversion trigger from external peripheral: TIM8 TRGO event. Trigger edge set to rising edge (default setting). */
01137 #define LL_ADC_INJ_TRIG_EXT_TIM8_TRGO2     (ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_1 | ADC_INJ_TRIG_EXT_EDGE_DEFAULT)                                              /*!< ADC group injected conversion trigger from external peripheral: TIM8 TRGO2 event. Trigger edge set to rising edge (default setting). */
01138 #define LL_ADC_INJ_TRIG_EXT_TIM3_CH3       (ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_1 | ADC_JSQR_JEXTSEL_0 | ADC_INJ_TRIG_EXT_EDGE_DEFAULT)                         /*!< ADC group injected conversion trigger from external peripheral: TIM3 channel 3 event (capture compare: input capture or output capture). Trigger edge set to rising edge (default setting). */
01139 #define LL_ADC_INJ_TRIG_EXT_TIM3_TRGO      (ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_2 | ADC_INJ_TRIG_EXT_EDGE_DEFAULT)                                                                            /*!< ADC group injected conversion trigger from external peripheral: TIM3 TRGO event. Trigger edge set to rising edge (default setting). */
01140 #define LL_ADC_INJ_TRIG_EXT_TIM3_CH1       (ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_0 | ADC_INJ_TRIG_EXT_EDGE_DEFAULT)                         /*!< ADC group injected conversion trigger from external peripheral: TIM3 channel 1 event (capture compare: input capture or output capture). Trigger edge set to rising edge (default setting). */
01141 #define LL_ADC_INJ_TRIG_EXT_TIM6_TRGO      (ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_1 | ADC_INJ_TRIG_EXT_EDGE_DEFAULT)                         /*!< ADC group injected conversion trigger from external peripheral: TIM6 TRGO event. Trigger edge set to rising edge (default setting). */
01142 #define LL_ADC_INJ_TRIG_EXT_TIM15_TRGO     (ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_1 | ADC_JSQR_JEXTSEL_0 | ADC_INJ_TRIG_EXT_EDGE_DEFAULT)    /*!< ADC group injected conversion trigger from external peripheral: TIM15 TRGO event. Trigger edge set to rising edge (default setting). */
01143 #if defined(HRTIM1)
01144 #define LL_ADC_INJ_TRIG_EXT_HRTIM_TRG2     (ADC_JSQR_JEXTSEL_4 | ADC_INJ_TRIG_EXT_EDGE_DEFAULT)                                                                                                   /*!< ADC group injected conversion trigger from external peripheral: HRTIM1 TRG2 event. Trigger edge set to rising edge (default setting). */
01145 #define LL_ADC_INJ_TRIG_EXT_HRTIM_TRG4     (ADC_JSQR_JEXTSEL_4 | ADC_JSQR_JEXTSEL_0 | ADC_INJ_TRIG_EXT_EDGE_DEFAULT)                                                                              /*!< ADC group injected conversion trigger from external peripheral: HRTIM1 TRG4 event. Trigger edge set to rising edge (default setting). */
01146 #endif /* HRTIM1 */
01147 #define LL_ADC_INJ_TRIG_EXT_LPTIM1_OUT     (ADC_JSQR_JEXTSEL_4 | ADC_JSQR_JEXTSEL_1 | ADC_INJ_TRIG_EXT_EDGE_DEFAULT)                                                                              /*!< ADC group injected conversion trigger from external peripheral: LPTIM1 OUT event. Trigger edge set to rising edge (default setting). */
01148 #define LL_ADC_INJ_TRIG_EXT_LPTIM2_OUT     (ADC_JSQR_JEXTSEL_4 | ADC_JSQR_JEXTSEL_1 | ADC_JSQR_JEXTSEL_0 | ADC_INJ_TRIG_EXT_EDGE_DEFAULT)                         /*!< ADC group injected conversion trigger from external peripheral: LPTIM2 OUT event. Trigger edge set to rising edge (default setting). */
01149 #define LL_ADC_INJ_TRIG_EXT_LPTIM3_OUT     (ADC_JSQR_JEXTSEL_4 | ADC_JSQR_JEXTSEL_2 | ADC_INJ_TRIG_EXT_EDGE_DEFAULT)                                              /*!< ADC group injected conversion trigger from external peripheral: LPTIM3 OUT event. 4 event (capture compare: input capture or output capture). Trigger edge set to rising edge (default setting). */
01150 #define LL_ADC_INJ_TRIG_EXT_TIM23_TRGO     (ADC_JSQR_JEXTSEL_4 | ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_0 | ADC_INJ_TRIG_EXT_EDGE_DEFAULT)                       /*!< ADC group regular conversion trigger from external peripheral: TIM23 TRGO event. Trigger edge set to rising edge (default setting). */
01151 #define LL_ADC_INJ_TRIG_EXT_TIM24_TRGO     (ADC_JSQR_JEXTSEL_4 | ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_1 | ADC_INJ_TRIG_EXT_EDGE_DEFAULT)                       /*!< ADC group regular conversion trigger from external peripheral: TIM24 TRGO event. Trigger edge set to rising edge (default setting). */
01152 /**
01153   * @}
01154   */
01155 
01156 /** @defgroup ADC_LL_EC_INJ_TRIGGER_EDGE  ADC group injected - Trigger edge
01157   * @{
01158   */
01159 #define LL_ADC_INJ_TRIG_EXT_RISING         (                    ADC_JSQR_JEXTEN_0) /*!< ADC group injected conversion trigger polarity set to rising edge */
01160 #define LL_ADC_INJ_TRIG_EXT_FALLING        (ADC_JSQR_JEXTEN_1                    ) /*!< ADC group injected conversion trigger polarity set to falling edge */
01161 #define LL_ADC_INJ_TRIG_EXT_RISINGFALLING  (ADC_JSQR_JEXTEN_1 | ADC_JSQR_JEXTEN_0) /*!< ADC group injected conversion trigger polarity set to both rising and falling edges */
01162 /**
01163   * @}
01164   */
01165 
01166 /** @defgroup ADC_LL_EC_INJ_TRIG_AUTO  ADC group injected - Automatic trigger mode
01167 * @{
01168 */
01169 #define LL_ADC_INJ_TRIG_INDEPENDENT        (0x00000000UL)         /*!< ADC group injected conversion trigger independent. Setting mandatory if ADC group injected injected trigger source is set to an external trigger. */
01170 #define LL_ADC_INJ_TRIG_FROM_GRP_REGULAR   (ADC_CFGR_JAUTO)       /*!< ADC group injected conversion trigger from ADC group regular. Setting compliant only with group injected trigger source set to SW start, without any further action on  ADC group injected conversion start or stop: in this case, ADC group injected is controlled only from ADC group regular. */
01171 /**
01172   * @}
01173   */
01174 
01175 /** @defgroup ADC_LL_EC_INJ_CONTEXT_QUEUE  ADC group injected - Context queue mode
01176   * @{
01177   */
01178 #define LL_ADC_INJ_QUEUE_2CONTEXTS_LAST_ACTIVE (0x00000000UL)         /* Group injected sequence context queue is enabled and can contain up to 2 contexts. When all contexts have been processed, the queue maintains the last context active perpetually. */
01179 #define LL_ADC_INJ_QUEUE_2CONTEXTS_END_EMPTY   (ADC_CFGR_JQM)         /* Group injected sequence context queue is enabled and can contain up to 2 contexts. When all contexts have been processed, the queue is empty and injected group triggers are disabled. */
01180 #define LL_ADC_INJ_QUEUE_DISABLE               (ADC_CFGR_JQDIS)       /* Group injected sequence context queue is disabled: only 1 sequence can be configured and is active perpetually. */
01181 /**
01182   * @}
01183   */
01184 
01185 /** @defgroup ADC_LL_EC_INJ_SEQ_SCAN_LENGTH  ADC group injected - Sequencer scan length
01186   * @{
01187   */
01188 #define LL_ADC_INJ_SEQ_SCAN_DISABLE        (0x00000000UL)                  /*!< ADC group injected sequencer disable (equivalent to sequencer of 1 rank: ADC conversion on only 1 channel) */
01189 #define LL_ADC_INJ_SEQ_SCAN_ENABLE_2RANKS  (                ADC_JSQR_JL_0) /*!< ADC group injected sequencer enable with 2 ranks in the sequence */
01190 #define LL_ADC_INJ_SEQ_SCAN_ENABLE_3RANKS  (ADC_JSQR_JL_1                ) /*!< ADC group injected sequencer enable with 3 ranks in the sequence */
01191 #define LL_ADC_INJ_SEQ_SCAN_ENABLE_4RANKS  (ADC_JSQR_JL_1 | ADC_JSQR_JL_0) /*!< ADC group injected sequencer enable with 4 ranks in the sequence */
01192 /**
01193   * @}
01194   */
01195 
01196 /** @defgroup ADC_LL_EC_INJ_SEQ_DISCONT_MODE  ADC group injected - Sequencer discontinuous mode
01197   * @{
01198   */
01199 #define LL_ADC_INJ_SEQ_DISCONT_DISABLE     (0x00000000UL)         /*!< ADC group injected sequencer discontinuous mode disable */
01200 #define LL_ADC_INJ_SEQ_DISCONT_1RANK       (ADC_CFGR_JDISCEN)     /*!< ADC group injected sequencer discontinuous mode enable with sequence interruption every rank */
01201 /**
01202   * @}
01203   */
01204 
01205 /** @defgroup ADC_LL_EC_INJ_SEQ_RANKS  ADC group injected - Sequencer ranks
01206   * @{
01207   */
01208 #define LL_ADC_INJ_RANK_1                  (ADC_JDR1_REGOFFSET | ADC_INJ_RANK_1_JSQR_BITOFFSET_POS) /*!< ADC group injected sequencer rank 1 */
01209 #define LL_ADC_INJ_RANK_2                  (ADC_JDR2_REGOFFSET | ADC_INJ_RANK_2_JSQR_BITOFFSET_POS) /*!< ADC group injected sequencer rank 2 */
01210 #define LL_ADC_INJ_RANK_3                  (ADC_JDR3_REGOFFSET | ADC_INJ_RANK_3_JSQR_BITOFFSET_POS) /*!< ADC group injected sequencer rank 3 */
01211 #define LL_ADC_INJ_RANK_4                  (ADC_JDR4_REGOFFSET | ADC_INJ_RANK_4_JSQR_BITOFFSET_POS) /*!< ADC group injected sequencer rank 4 */
01212 /**
01213   * @}
01214   */
01215 
01216 /** @defgroup ADC_LL_EC_CHANNEL_SAMPLINGTIME  Channel - Sampling time
01217   * @{
01218   */
01219 #define LL_ADC_SAMPLINGTIME_1CYCLE_5       (0x00000000UL)                                              /*!< Sampling time 1.5 ADC clock cycles */
01220 #define LL_ADC_SAMPLINGTIME_2CYCLES_5      (                                        ADC_SMPR2_SMP10_0) /*!< Sampling time 2.5 ADC clock cycles */
01221 #define LL_ADC_SAMPLINGTIME_8CYCLES_5      (                    ADC_SMPR2_SMP10_1                    ) /*!< Sampling time 8.5 ADC clock cycles */
01222 #define LL_ADC_SAMPLINGTIME_16CYCLES_5     (                    ADC_SMPR2_SMP10_1 | ADC_SMPR2_SMP10_0) /*!< Sampling time 16.5 ADC clock cycles */
01223 #define LL_ADC_SAMPLINGTIME_32CYCLES_5     (ADC_SMPR2_SMP10_2                                        ) /*!< Sampling time 32.5 ADC clock cycles */
01224 #define LL_ADC_SAMPLINGTIME_64CYCLES_5     (ADC_SMPR2_SMP10_2                     | ADC_SMPR2_SMP10_0) /*!< Sampling time 64.5 ADC clock cycles */
01225 #define LL_ADC_SAMPLINGTIME_387CYCLES_5    (ADC_SMPR2_SMP10_2 | ADC_SMPR2_SMP10_1                    ) /*!< Sampling time 387.5 ADC clock cycles */
01226 #define LL_ADC_SAMPLINGTIME_810CYCLES_5    (ADC_SMPR2_SMP10_2 | ADC_SMPR2_SMP10_1 | ADC_SMPR2_SMP10_0) /*!< Sampling time 810.5 ADC clock cycles */
01227 /**
01228   * @}
01229   */
01230 #if defined(ADC_VER_V5_V90)
01231 /** @defgroup ADC_LL_EC_CHANNEL_SAMPLINGTIME  Channel - Sampling time
01232   * @{
01233   */
01234 #define LL_ADC_SAMPLINGTIME_ADC3_2CYCLES_5      (0x00000000UL)                                              /*!< Sampling time 2.5 ADC clock cycles. On ADC3 of devices STM32H72xx and STM32H73xx */
01235 #define LL_ADC_SAMPLINGTIME_ADC3_6CYCLES_5      (                                        ADC_SMPR2_SMP10_0) /*!< Sampling time 6.5 ADC clock cycles. On ADC3 of devices STM32H72xx and STM32H73xx */
01236 #define LL_ADC_SAMPLINGTIME_ADC3_12CYCLES_5     (                    ADC_SMPR2_SMP10_1                    ) /*!< Sampling time 12.5 ADC clock cycles. On ADC3 of devices STM32H72xx and STM32H73xx */
01237 #define LL_ADC_SAMPLINGTIME_ADC3_24CYCLES_5     (                    ADC_SMPR2_SMP10_1 | ADC_SMPR2_SMP10_0) /*!< Sampling time 24.5 ADC clock cycles. On ADC3 of devices STM32H72xx and STM32H73xx */
01238 #define LL_ADC_SAMPLINGTIME_ADC3_47CYCLES_5     (ADC_SMPR2_SMP10_2                                        ) /*!< Sampling time 47.5 ADC clock cycles. On ADC3 of devices STM32H72xx and STM32H73xx */
01239 #define LL_ADC_SAMPLINGTIME_ADC3_92CYCLES_5     (ADC_SMPR2_SMP10_2                     | ADC_SMPR2_SMP10_0) /*!< Sampling time 92.5 ADC clock cycles. On ADC3 of devices STM32H72xx and STM32H73xx */
01240 #define LL_ADC_SAMPLINGTIME_ADC3_247CYCLES_5    (ADC_SMPR2_SMP10_2 | ADC_SMPR2_SMP10_1                    ) /*!< Sampling time 247.5 ADC clock cycles. On ADC3 of devices STM32H72xx and STM32H73xx */
01241 #define LL_ADC_SAMPLINGTIME_ADC3_640CYCLES_5    (ADC_SMPR2_SMP10_2 | ADC_SMPR2_SMP10_1 | ADC_SMPR2_SMP10_0) /*!< Sampling time 640.5 ADC clock cycles. On ADC3 of devices STM32H72xx and STM32H73xx */
01242 /**
01243   * @}
01244   */
01245 #endif  /* ADC_VER_V5_V90 */
01246 
01247 /** @defgroup ADC_LL_EC_CHANNEL_SINGLE_DIFF_ENDING  Channel - Single or differential ending
01248   * @{
01249   */
01250 #define LL_ADC_SINGLE_ENDED                (                  ADC_CALFACT_CALFACT_S)         /*!< ADC channel ending set to single ended (literal also used to set calibration mode) */
01251 #define LL_ADC_DIFFERENTIAL_ENDED          (ADC_CR_ADCALDIF | ADC_CALFACT_CALFACT_D)         /*!< ADC channel ending set to differential (literal also used to set calibration mode) */
01252 #define LL_ADC_BOTH_SINGLE_DIFF_ENDED      (LL_ADC_SINGLE_ENDED | LL_ADC_DIFFERENTIAL_ENDED) /*!< ADC channel ending set to both single ended and differential (literal used only to set calibration factors) */
01253 /**
01254   * @}
01255   */
01256 
01257 /** @defgroup ADC_LL_EC_AWD_NUMBER Analog watchdog - Analog watchdog number
01258   * @{
01259   */
01260 #define LL_ADC_AWD1                        (ADC_AWD_CR1_CHANNEL_MASK  | ADC_AWD_CR1_REGOFFSET) /*!< ADC analog watchdog number 1 */
01261 #define LL_ADC_AWD2                        (ADC_AWD_CR23_CHANNEL_MASK | ADC_AWD_CR2_REGOFFSET) /*!< ADC analog watchdog number 2 */
01262 #define LL_ADC_AWD3                        (ADC_AWD_CR23_CHANNEL_MASK | ADC_AWD_CR3_REGOFFSET) /*!< ADC analog watchdog number 3 */
01263 /**
01264   * @}
01265   */
01266 
01267 /** @defgroup ADC_LL_EC_AWD_CHANNELS  Analog watchdog - Monitored channels
01268   * @{
01269   */
01270 #define LL_ADC_AWD_DISABLE                 (0x00000000UL)                                                                                      /*!< ADC analog watchdog monitoring disabled */
01271 #define LL_ADC_AWD_ALL_CHANNELS_REG        (ADC_AWD_CR23_CHANNEL_MASK                                    | ADC_CFGR_AWD1EN                   ) /*!< ADC analog watchdog monitoring of all channels, converted by group regular only */
01272 #define LL_ADC_AWD_ALL_CHANNELS_INJ        (ADC_AWD_CR23_CHANNEL_MASK                 | ADC_CFGR_JAWD1EN                                     ) /*!< ADC analog watchdog monitoring of all channels, converted by group injected only */
01273 #define LL_ADC_AWD_ALL_CHANNELS_REG_INJ    (ADC_AWD_CR23_CHANNEL_MASK                 | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN                   ) /*!< ADC analog watchdog monitoring of all channels, converted by either group regular or injected */
01274 #define LL_ADC_AWD_CHANNEL_0_REG           ((LL_ADC_CHANNEL_0  & ADC_CHANNEL_ID_MASK)                    | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN0, converted by group regular only */
01275 #define LL_ADC_AWD_CHANNEL_0_INJ           ((LL_ADC_CHANNEL_0  & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN                   | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN0, converted by group injected only */
01276 #define LL_ADC_AWD_CHANNEL_0_REG_INJ       ((LL_ADC_CHANNEL_0  & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN0, converted by either group regular or injected */
01277 #define LL_ADC_AWD_CHANNEL_1_REG           ((LL_ADC_CHANNEL_1  & ADC_CHANNEL_ID_MASK)                    | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN1, converted by group regular only */
01278 #define LL_ADC_AWD_CHANNEL_1_INJ           ((LL_ADC_CHANNEL_1  & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN                   | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN1, converted by group injected only */
01279 #define LL_ADC_AWD_CHANNEL_1_REG_INJ       ((LL_ADC_CHANNEL_1  & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN1, converted by either group regular or injected */
01280 #define LL_ADC_AWD_CHANNEL_2_REG           ((LL_ADC_CHANNEL_2  & ADC_CHANNEL_ID_MASK)                    | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN2, converted by group regular only */
01281 #define LL_ADC_AWD_CHANNEL_2_INJ           ((LL_ADC_CHANNEL_2  & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN                   | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN2, converted by group injected only */
01282 #define LL_ADC_AWD_CHANNEL_2_REG_INJ       ((LL_ADC_CHANNEL_2  & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN2, converted by either group regular or injected */
01283 #define LL_ADC_AWD_CHANNEL_3_REG           ((LL_ADC_CHANNEL_3  & ADC_CHANNEL_ID_MASK)                    | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN3, converted by group regular only */
01284 #define LL_ADC_AWD_CHANNEL_3_INJ           ((LL_ADC_CHANNEL_3  & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN                   | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN3, converted by group injected only */
01285 #define LL_ADC_AWD_CHANNEL_3_REG_INJ       ((LL_ADC_CHANNEL_3  & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN3, converted by either group regular or injected */
01286 #define LL_ADC_AWD_CHANNEL_4_REG           ((LL_ADC_CHANNEL_4  & ADC_CHANNEL_ID_MASK)                    | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN4, converted by group regular only */
01287 #define LL_ADC_AWD_CHANNEL_4_INJ           ((LL_ADC_CHANNEL_4  & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN                   | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN4, converted by group injected only */
01288 #define LL_ADC_AWD_CHANNEL_4_REG_INJ       ((LL_ADC_CHANNEL_4  & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN4, converted by either group regular or injected */
01289 #define LL_ADC_AWD_CHANNEL_5_REG           ((LL_ADC_CHANNEL_5  & ADC_CHANNEL_ID_MASK)                    | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN5, converted by group regular only */
01290 #define LL_ADC_AWD_CHANNEL_5_INJ           ((LL_ADC_CHANNEL_5  & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN                   | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN5, converted by group injected only */
01291 #define LL_ADC_AWD_CHANNEL_5_REG_INJ       ((LL_ADC_CHANNEL_5  & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN5, converted by either group regular or injected */
01292 #define LL_ADC_AWD_CHANNEL_6_REG           ((LL_ADC_CHANNEL_6  & ADC_CHANNEL_ID_MASK)                    | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN6, converted by group regular only */
01293 #define LL_ADC_AWD_CHANNEL_6_INJ           ((LL_ADC_CHANNEL_6  & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN                   | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN6, converted by group injected only */
01294 #define LL_ADC_AWD_CHANNEL_6_REG_INJ       ((LL_ADC_CHANNEL_6  & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN6, converted by either group regular or injected */
01295 #define LL_ADC_AWD_CHANNEL_7_REG           ((LL_ADC_CHANNEL_7  & ADC_CHANNEL_ID_MASK)                    | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN7, converted by group regular only */
01296 #define LL_ADC_AWD_CHANNEL_7_INJ           ((LL_ADC_CHANNEL_7  & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN                   | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN7, converted by group injected only */
01297 #define LL_ADC_AWD_CHANNEL_7_REG_INJ       ((LL_ADC_CHANNEL_7  & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN7, converted by either group regular or injected */
01298 #define LL_ADC_AWD_CHANNEL_8_REG           ((LL_ADC_CHANNEL_8  & ADC_CHANNEL_ID_MASK)                    | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN8, converted by group regular only */
01299 #define LL_ADC_AWD_CHANNEL_8_INJ           ((LL_ADC_CHANNEL_8  & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN                   | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN8, converted by group injected only */
01300 #define LL_ADC_AWD_CHANNEL_8_REG_INJ       ((LL_ADC_CHANNEL_8  & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN8, converted by either group regular or injected */
01301 #define LL_ADC_AWD_CHANNEL_9_REG           ((LL_ADC_CHANNEL_9  & ADC_CHANNEL_ID_MASK)                    | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN9, converted by group regular only */
01302 #define LL_ADC_AWD_CHANNEL_9_INJ           ((LL_ADC_CHANNEL_9  & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN                   | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN9, converted by group injected only */
01303 #define LL_ADC_AWD_CHANNEL_9_REG_INJ       ((LL_ADC_CHANNEL_9  & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN9, converted by either group regular or injected */
01304 #define LL_ADC_AWD_CHANNEL_10_REG          ((LL_ADC_CHANNEL_10 & ADC_CHANNEL_ID_MASK)                    | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN10, converted by group regular only */
01305 #define LL_ADC_AWD_CHANNEL_10_INJ          ((LL_ADC_CHANNEL_10 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN                   | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN10, converted by group injected only */
01306 #define LL_ADC_AWD_CHANNEL_10_REG_INJ      ((LL_ADC_CHANNEL_10 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN10, converted by either group regular or injected */
01307 #define LL_ADC_AWD_CHANNEL_11_REG          ((LL_ADC_CHANNEL_11 & ADC_CHANNEL_ID_MASK)                    | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN11, converted by group regular only */
01308 #define LL_ADC_AWD_CHANNEL_11_INJ          ((LL_ADC_CHANNEL_11 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN                   | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN11, converted by group injected only */
01309 #define LL_ADC_AWD_CHANNEL_11_REG_INJ      ((LL_ADC_CHANNEL_11 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN11, converted by either group regular or injected */
01310 #define LL_ADC_AWD_CHANNEL_12_REG          ((LL_ADC_CHANNEL_12 & ADC_CHANNEL_ID_MASK)                    | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN12, converted by group regular only */
01311 #define LL_ADC_AWD_CHANNEL_12_INJ          ((LL_ADC_CHANNEL_12 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN                   | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN12, converted by group injected only */
01312 #define LL_ADC_AWD_CHANNEL_12_REG_INJ      ((LL_ADC_CHANNEL_12 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN12, converted by either group regular or injected */
01313 #define LL_ADC_AWD_CHANNEL_13_REG          ((LL_ADC_CHANNEL_13 & ADC_CHANNEL_ID_MASK)                    | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN13, converted by group regular only */
01314 #define LL_ADC_AWD_CHANNEL_13_INJ          ((LL_ADC_CHANNEL_13 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN                   | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN13, converted by group injected only */
01315 #define LL_ADC_AWD_CHANNEL_13_REG_INJ      ((LL_ADC_CHANNEL_13 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN13, converted by either group regular or injected */
01316 #define LL_ADC_AWD_CHANNEL_14_REG          ((LL_ADC_CHANNEL_14 & ADC_CHANNEL_ID_MASK)                    | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN14, converted by group regular only */
01317 #define LL_ADC_AWD_CHANNEL_14_INJ          ((LL_ADC_CHANNEL_14 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN                   | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN14, converted by group injected only */
01318 #define LL_ADC_AWD_CHANNEL_14_REG_INJ      ((LL_ADC_CHANNEL_14 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN14, converted by either group regular or injected */
01319 #define LL_ADC_AWD_CHANNEL_15_REG          ((LL_ADC_CHANNEL_15 & ADC_CHANNEL_ID_MASK)                    | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN15, converted by group regular only */
01320 #define LL_ADC_AWD_CHANNEL_15_INJ          ((LL_ADC_CHANNEL_15 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN                   | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN15, converted by group injected only */
01321 #define LL_ADC_AWD_CHANNEL_15_REG_INJ      ((LL_ADC_CHANNEL_15 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN15, converted by either group regular or injected */
01322 #define LL_ADC_AWD_CHANNEL_16_REG          ((LL_ADC_CHANNEL_16 & ADC_CHANNEL_ID_MASK)                    | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN16, converted by group regular only */
01323 #define LL_ADC_AWD_CHANNEL_16_INJ          ((LL_ADC_CHANNEL_16 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN                   | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN16, converted by group injected only */
01324 #define LL_ADC_AWD_CHANNEL_16_REG_INJ      ((LL_ADC_CHANNEL_16 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN16, converted by either group regular or injected */
01325 #define LL_ADC_AWD_CHANNEL_17_REG          ((LL_ADC_CHANNEL_17 & ADC_CHANNEL_ID_MASK)                    | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN17, converted by group regular only */
01326 #define LL_ADC_AWD_CHANNEL_17_INJ          ((LL_ADC_CHANNEL_17 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN                   | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN17, converted by group injected only */
01327 #define LL_ADC_AWD_CHANNEL_17_REG_INJ      ((LL_ADC_CHANNEL_17 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN17, converted by either group regular or injected */
01328 #define LL_ADC_AWD_CHANNEL_18_REG          ((LL_ADC_CHANNEL_18 & ADC_CHANNEL_ID_MASK)                    | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN18, converted by group regular only */
01329 #define LL_ADC_AWD_CHANNEL_18_INJ          ((LL_ADC_CHANNEL_18 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN                   | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN18, converted by group injected only */
01330 #define LL_ADC_AWD_CHANNEL_18_REG_INJ      ((LL_ADC_CHANNEL_18 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN18, converted by either group regular or injected */
01331 #define LL_ADC_AWD_CHANNEL_19_REG          ((LL_ADC_CHANNEL_19 & ADC_CHANNEL_ID_MASK)                    | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN19, converted by group regular only */
01332 #define LL_ADC_AWD_CHANNEL_19_INJ          ((LL_ADC_CHANNEL_19 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN                   | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN19, converted by group injected only */
01333 #define LL_ADC_AWD_CHANNEL_19_REG_INJ      ((LL_ADC_CHANNEL_19 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN19, converted by either group regular or injected */
01334 #define LL_ADC_AWD_CH_VREFINT_REG          ((LL_ADC_CHANNEL_VREFINT       & ADC_CHANNEL_ID_MASK)                    | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC internal channel connected to VrefInt: Internal voltage reference, converted by group regular only */
01335 #define LL_ADC_AWD_CH_VREFINT_INJ          ((LL_ADC_CHANNEL_VREFINT       & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN                   | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC internal channel connected to VrefInt: Internal voltage reference, converted by group injected only */
01336 #define LL_ADC_AWD_CH_VREFINT_REG_INJ      ((LL_ADC_CHANNEL_VREFINT       & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC internal channel connected to VrefInt: Internal voltage reference, converted by either group regular or injected */
01337 #define LL_ADC_AWD_CH_TEMPSENSOR_REG       ((LL_ADC_CHANNEL_TEMPSENSOR    & ADC_CHANNEL_ID_MASK)                    | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC internal channel connected to Temperature sensor, converted by group regular only */
01338 #define LL_ADC_AWD_CH_TEMPSENSOR_INJ       ((LL_ADC_CHANNEL_TEMPSENSOR    & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN                   | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC internal channel connected to Temperature sensor, converted by group injected only */
01339 #define LL_ADC_AWD_CH_TEMPSENSOR_REG_INJ   ((LL_ADC_CHANNEL_TEMPSENSOR    & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC internal channel connected to Temperature sensor, converted by either group regular or injected */
01340 #define LL_ADC_AWD_CH_VBAT_REG             ((LL_ADC_CHANNEL_VBAT          & ADC_CHANNEL_ID_MASK)                    | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC internal channel connected to Vbat/4: Vbat voltage through a divider ladder of factor 1/4 to have Vbat always below Vdda, converted by group regular only */
01341 #define LL_ADC_AWD_CH_VBAT_INJ             ((LL_ADC_CHANNEL_VBAT          & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN                   | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC internal channel connected to Vbat/4: Vbat voltage through a divider ladder of factor 1/4 to have Vbat always below Vdda, converted by group injected only */
01342 #define LL_ADC_AWD_CH_VBAT_REG_INJ         ((LL_ADC_CHANNEL_VBAT          & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC internal channel connected to Vbat/4: Vbat voltage through a divider ladder of factor 1/4 to have Vbat always below Vdda */
01343 #define LL_ADC_AWD_CH_DAC1CH1_ADC2_REG     ((LL_ADC_CHANNEL_DAC1CH1_ADC2  & ADC_CHANNEL_ID_MASK)                    | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC internal channel connected to DAC1 channel 1, channel specific to ADC2, converted by group regular only */
01344 #define LL_ADC_AWD_CH_DAC1CH1_ADC2_INJ     ((LL_ADC_CHANNEL_DAC1CH1_ADC2  & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN                   | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC internal channel connected to DAC1 channel 1, channel specific to ADC2, converted by group injected only */
01345 #define LL_ADC_AWD_CH_DAC1CH1_ADC2_REG_INJ ((LL_ADC_CHANNEL_DAC1CH1_ADC2  & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC internal channel connected to DAC1 channel 1, channel specific to ADC2, converted by either group regular or injected */
01346 #define LL_ADC_AWD_CH_DAC1CH2_ADC2_REG     ((LL_ADC_CHANNEL_DAC1CH2_ADC2  & ADC_CHANNEL_ID_MASK)                    | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC internal channel connected to DAC1 channel 1, channel specific to ADC2, converted by group regular only */
01347 #define LL_ADC_AWD_CH_DAC1CH2_ADC2_INJ     ((LL_ADC_CHANNEL_DAC1CH2_ADC2  & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN                   | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC internal channel connected to DAC1 channel 1, channel specific to ADC2, converted by group injected only */
01348 #define LL_ADC_AWD_CH_DAC1CH2_ADC2_REG_INJ ((LL_ADC_CHANNEL_DAC1CH2_ADC2  & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC internal channel connected to DAC1 channel 1, channel specific to ADC2, converted by either group regular or injected */
01349 /**
01350   * @}
01351   */
01352 
01353 /** @defgroup ADC_LL_EC_AWD_THRESHOLDS  Analog watchdog - Thresholds
01354   * @{
01355   */
01356 #define LL_ADC_AWD_THRESHOLD_HIGH          (0x1UL)                     /*!< ADC analog watchdog threshold high */
01357 #define LL_ADC_AWD_THRESHOLD_LOW           (0x0UL)                     /*!< ADC analog watchdog threshold low */
01358 /**
01359   * @}
01360   */
01361 #if defined(ADC_VER_V5_V90)
01362 /** @defgroup ADC_LL_EC_AWD_FILTERING_CONFIG  Analog watchdog - filtering config
01363   * @{
01364   */
01365 #define LL_ADC_AWD_FILTERING_NONE          (0x00000000UL)                                                   /*!< ADC analog wathdog no filtering, one out-of-window sample is needed to raise flag or interrupt. On ADC3 of devices STM32H72xx and STM32H73xx */
01366 #define LL_ADC_AWD_FILTERING_2SAMPLES      (                                          ADC3_TR1_AWDFILT_0)   /*!< ADC analog wathdog 2 consecutives out-of-window samples are needed to raise flag or interrupt. On ADC3 of devices STM32H72xx and STM32H73xx */
01367 #define LL_ADC_AWD_FILTERING_3SAMPLES      (                     ADC3_TR1_AWDFILT_1                     )   /*!< ADC analog wathdog 3 consecutives out-of-window samples are needed to raise flag or interrupt. On ADC3 of devices STM32H72xx and STM32H73xx */
01368 #define LL_ADC_AWD_FILTERING_4SAMPLES      (                     ADC3_TR1_AWDFILT_1 | ADC3_TR1_AWDFILT_0)   /*!< ADC analog wathdog 4 consecutives out-of-window samples are needed to raise flag or interrupt. On ADC3 of devices STM32H72xx and STM32H73xx */
01369 #define LL_ADC_AWD_FILTERING_5SAMPLES      (ADC3_TR1_AWDFILT_2                                          )   /*!< ADC analog wathdog 5 consecutives out-of-window samples are needed to raise flag or interrupt. On ADC3 of devices STM32H72xx and STM32H73xx */
01370 #define LL_ADC_AWD_FILTERING_6SAMPLES      (ADC3_TR1_AWDFILT_2 |                      ADC3_TR1_AWDFILT_0)   /*!< ADC analog wathdog 6 consecutives out-of-window samples are needed to raise flag or interrupt. On ADC3 of devices STM32H72xx and STM32H73xx */
01371 #define LL_ADC_AWD_FILTERING_7SAMPLES      (ADC3_TR1_AWDFILT_2 | ADC3_TR1_AWDFILT_1                     )   /*!< ADC analog wathdog 7 consecutives out-of-window samples are needed to raise flag or interrupt. On ADC3 of devices STM32H72xx and STM32H73xx */
01372 #define LL_ADC_AWD_FILTERING_8SAMPLES      (ADC3_TR1_AWDFILT_2 | ADC3_TR1_AWDFILT_1 | ADC3_TR1_AWDFILT_0)   /*!< ADC analog wathdog 8 consecutives out-of-window samples are needed to raise flag or interrupt. On ADC3 of devices STM32H72xx and STM32H73xx */
01373 /**
01374   * @}
01375   */
01376 #endif /* ADC_VER_V5_V90 */
01377 
01378 /** @defgroup ADC_LL_EC_OVS_SCOPE  Oversampling - Oversampling scope
01379   * @{
01380   */
01381 #define LL_ADC_OVS_DISABLE                 (0x00000000UL)                                        /*!< ADC oversampling disabled. */
01382 #define LL_ADC_OVS_GRP_REGULAR_CONTINUED   (                                    ADC_CFGR2_ROVSE) /*!< ADC oversampling on conversions of ADC group regular. If group injected interrupts group regular: when ADC group injected is triggered, the oversampling on ADC group regular is temporary stopped and continued afterwards. */
01383 #define LL_ADC_OVS_GRP_REGULAR_RESUMED     (ADC_CFGR2_ROVSM |                   ADC_CFGR2_ROVSE) /*!< ADC oversampling on conversions of ADC group regular. If group injected interrupts group regular: when ADC group injected is triggered, the oversampling on ADC group regular is resumed from start (oversampler buffer reset). */
01384 #define LL_ADC_OVS_GRP_INJECTED            (                  ADC_CFGR2_JOVSE                  ) /*!< ADC oversampling on conversions of ADC group injected. */
01385 #define LL_ADC_OVS_GRP_INJ_REG_RESUMED     (                  ADC_CFGR2_JOVSE | ADC_CFGR2_ROVSE) /*!< ADC oversampling on conversions of both ADC groups regular and injected. If group injected interrupting group regular: when ADC group injected is triggered, the oversampling on ADC group regular is resumed from start (oversampler buffer reset). */
01386 /**
01387   * @}
01388   */
01389 
01390 /** @defgroup ADC_LL_EC_OVS_DISCONT_MODE  Oversampling - Discontinuous mode
01391   * @{
01392   */
01393 #define LL_ADC_OVS_REG_CONT                (0x00000000UL)         /*!< ADC oversampling discontinuous mode: continuous mode (all conversions of oversampling ratio are done from 1 trigger) */
01394 #define LL_ADC_OVS_REG_DISCONT             (ADC_CFGR2_TROVS)      /*!< ADC oversampling discontinuous mode: discontinuous mode (each conversion of oversampling ratio needs a trigger) */
01395 /**
01396   * @}
01397   */
01398 #if defined(ADC_VER_V5_V90)
01399 /** @defgroup ADC_LL_EC_OVS_RATIO  Oversampling - Ratio
01400   * @{
01401   */
01402 #define LL_ADC_OVS_RATIO_2                 (0x00000000UL)                                               /*!< ADC oversampling ratio of 2 (2 ADC conversions are performed, sum of these conversions data is computed to result as the ADC oversampling conversion data (before potential shift) */
01403 #define LL_ADC_OVS_RATIO_4                 (                                        ADC3_CFGR2_OVSR_0)  /*!< ADC oversampling ratio of 4 (4 ADC conversions are performed, sum of these conversions data is computed to result as the ADC oversampling conversion data (before potential shift) */
01404 #define LL_ADC_OVS_RATIO_8                 (                    ADC3_CFGR2_OVSR_1                    )  /*!< ADC oversampling ratio of 8 (8 ADC conversions are performed, sum of these conversions data is computed to result as the ADC oversampling conversion data (before potential shift) */
01405 #define LL_ADC_OVS_RATIO_16                (                    ADC3_CFGR2_OVSR_1 | ADC3_CFGR2_OVSR_0)  /*!< ADC oversampling ratio of 16 (16 ADC conversions are performed, sum of these conversions data is computed to result as the ADC oversampling conversion data (before potential shift) */
01406 #define LL_ADC_OVS_RATIO_32                (ADC3_CFGR2_OVSR_2                                        )  /*!< ADC oversampling ratio of 32 (32 ADC conversions are performed, sum of these conversions data is computed to result as the ADC oversampling conversion data (before potential shift) */
01407 #define LL_ADC_OVS_RATIO_64                (ADC3_CFGR2_OVSR_2                     | ADC3_CFGR2_OVSR_0)  /*!< ADC oversampling ratio of 64 (64 ADC conversions are performed, sum of these conversions data is computed to result as the ADC oversampling conversion data (before potential shift) */
01408 #define LL_ADC_OVS_RATIO_128               (ADC3_CFGR2_OVSR_2 | ADC3_CFGR2_OVSR_1                    )  /*!< ADC oversampling ratio of 128 (128 ADC conversions are performed, sum of these conversions data is computed to result as the ADC oversampling conversion data (before potential shift) */
01409 #define LL_ADC_OVS_RATIO_256               (ADC3_CFGR2_OVSR_2 | ADC3_CFGR2_OVSR_1 | ADC3_CFGR2_OVSR_0)  /*!< ADC oversampling ratio of 256 (256 ADC conversions are performed, sum of these conversions data is computed to result as the ADC oversampling conversion data (before potential shift) */
01410 /**
01411   * @}
01412   */
01413 #endif  /* ADC_VER_V5_V90 */
01414 
01415 /** @defgroup ADC_LL_EC_OVS_SHIFT  Oversampling - Data shift
01416   * @{
01417   */
01418 #define LL_ADC_OVS_SHIFT_NONE              (0x00000000UL)                                                              /*!< ADC oversampling no shift (sum of the ADC conversions data is not divided to result as the ADC oversampling conversion data) */
01419 #define LL_ADC_OVS_SHIFT_RIGHT_1           (                                                         ADC_CFGR2_OVSS_0) /*!< ADC oversampling shift of 1 (sum of the ADC conversions data is divided by 2 to result as the ADC oversampling conversion data) */
01420 #define LL_ADC_OVS_SHIFT_RIGHT_2           (                                      ADC_CFGR2_OVSS_1                   ) /*!< ADC oversampling shift of 2 (sum of the ADC conversions data is divided by 4 to result as the ADC oversampling conversion data) */
01421 #define LL_ADC_OVS_SHIFT_RIGHT_3           (                                      ADC_CFGR2_OVSS_1 | ADC_CFGR2_OVSS_0) /*!< ADC oversampling shift of 3 (sum of the ADC conversions data is divided by 8 to result as the ADC oversampling conversion data) */
01422 #define LL_ADC_OVS_SHIFT_RIGHT_4           (                   ADC_CFGR2_OVSS_2                                      ) /*!< ADC oversampling shift of 4 (sum of the ADC conversions data is divided by 16 to result as the ADC oversampling conversion data) */
01423 #define LL_ADC_OVS_SHIFT_RIGHT_5           (                   ADC_CFGR2_OVSS_2                    | ADC_CFGR2_OVSS_0) /*!< ADC oversampling shift of 5 (sum of the ADC conversions data is divided by 32 to result as the ADC oversampling conversion data) */
01424 #define LL_ADC_OVS_SHIFT_RIGHT_6           (                   ADC_CFGR2_OVSS_2 | ADC_CFGR2_OVSS_1                   ) /*!< ADC oversampling shift of 6 (sum of the ADC conversions data is divided by 64 to result as the ADC oversampling conversion data) */
01425 #define LL_ADC_OVS_SHIFT_RIGHT_7           (                   ADC_CFGR2_OVSS_2 | ADC_CFGR2_OVSS_1 | ADC_CFGR2_OVSS_0) /*!< ADC oversampling shift of 7 (sum of the ADC conversions data is divided by 128 to result as the ADC oversampling conversion data) */
01426 #define LL_ADC_OVS_SHIFT_RIGHT_8           (ADC_CFGR2_OVSS_3                                                         ) /*!< ADC oversampling shift of 8 (sum of the ADC conversions data is divided by 256 to result as the ADC oversampling conversion data) */
01427 #define LL_ADC_OVS_SHIFT_RIGHT_9           (ADC_CFGR2_OVSS_3                                       | ADC_CFGR2_OVSS_0) /*!< ADC oversampling shift of 9 (sum of the ADC conversions data is divided by 512 to result as the ADC oversampling conversion data) */
01428 #define LL_ADC_OVS_SHIFT_RIGHT_10          (ADC_CFGR2_OVSS_3                    | ADC_CFGR2_OVSS_1                   ) /*!< ADC oversampling shift of 10 (sum of the ADC conversions data is divided by 1024 to result as the ADC oversampling conversion data) */
01429 #define LL_ADC_OVS_SHIFT_RIGHT_11          (ADC_CFGR2_OVSS_3                    | ADC_CFGR2_OVSS_1 | ADC_CFGR2_OVSS_0) /*!< ADC oversampling shift of 11 (sum of the ADC conversions data is divided by 2048 to result as the ADC oversampling conversion data) */
01430 /**
01431   * @}
01432   */
01433 
01434 /** @defgroup ADC_LL_EC_MULTI_MODE  Multimode - Mode
01435   * @{
01436   */
01437 #define LL_ADC_MULTI_INDEPENDENT           (0x00000000UL)                                                      /*!< ADC dual mode disabled (ADC independent mode) */
01438 #define LL_ADC_MULTI_DUAL_REG_SIMULT       (                 ADC_CCR_DUAL_2 | ADC_CCR_DUAL_1                 ) /*!< ADC dual mode enabled: group regular simultaneous */
01439 #define LL_ADC_MULTI_DUAL_REG_INTERL       (                 ADC_CCR_DUAL_2 | ADC_CCR_DUAL_1 | ADC_CCR_DUAL_0) /*!< ADC dual mode enabled: Combined group regular interleaved */
01440 #define LL_ADC_MULTI_DUAL_INJ_SIMULT       (                 ADC_CCR_DUAL_2                  | ADC_CCR_DUAL_0) /*!< ADC dual mode enabled: group injected simultaneous */
01441 #define LL_ADC_MULTI_DUAL_INJ_ALTERN       (ADC_CCR_DUAL_3                                   | ADC_CCR_DUAL_0) /*!< ADC dual mode enabled: group injected alternate trigger. Works only with external triggers (not internal SW start) */
01442 #define LL_ADC_MULTI_DUAL_REG_SIM_INJ_SIM  (                                                   ADC_CCR_DUAL_0) /*!< ADC dual mode enabled: Combined group regular simultaneous + group injected simultaneous */
01443 #define LL_ADC_MULTI_DUAL_REG_SIM_INJ_ALT  (                                  ADC_CCR_DUAL_1                 ) /*!< ADC dual mode enabled: Combined group regular simultaneous + group injected alternate trigger */
01444 #define LL_ADC_MULTI_DUAL_REG_INT_INJ_SIM  (                                  ADC_CCR_DUAL_1 | ADC_CCR_DUAL_0) /*!< ADC dual mode enabled: Combined group regular interleaved + group injected simultaneous */
01445 /**
01446   * @}
01447   */
01448 
01449 /** @defgroup ADC_LL_EC_MULTI_DMA_TRANSFER  Multimode - DMA transfer
01450   * @{
01451   */
01452 #define LL_ADC_MULTI_REG_DMA_EACH_ADC        (0x00000000UL)                      /*!< ADC multimode group regular conversions are transferred by DMA: each ADC uses its own DMA channel, with its individual DMA transfer settings */
01453 #define LL_ADC_MULTI_REG_DMA_RES_32_10B      (ADC_CCR_DAMDF_1                  ) /*!< ADC multimode group regular conversions are transferred by DMA, one DMA channel for both ADC (DMA of ADC master). Setting for ADC resolution of 32 (16x2) down to 10 bits */
01454 #define LL_ADC_MULTI_REG_DMA_RES_8B          (ADC_CCR_DAMDF_1 | ADC_CCR_DAMDF_0) /*!< ADC multimode group regular conversions are transferred by DMA, one DMA channel for both ADC (DMA of ADC master). Setting for ADC resolution of 8 bits */
01455 /**
01456   * @}
01457   */
01458 
01459 /** @defgroup ADC_LL_EC_MULTI_TWOSMP_DELAY  Multimode - Delay between two sampling phases
01460   * @{
01461   */
01462 #define LL_ADC_MULTI_TWOSMP_DELAY_1CYCLE_5           (0x00000000UL)                                                          /*!< ADC multimode delay between two sampling phases: 1.5 ADC clock cycle for all resolution                    */
01463 #define LL_ADC_MULTI_TWOSMP_DELAY_2CYCLES_5          (                                                      ADC_CCR_DELAY_0) /*!< ADC multimode delay between two sampling phases: 2.5 ADC clock cycles for all resolution                   */
01464 #define LL_ADC_MULTI_TWOSMP_DELAY_3CYCLES_5          (                                    ADC_CCR_DELAY_1                  ) /*!< ADC multimode delay between two sampling phases: 3.5 ADC clock cycles for all resolution                   */
01465 #define LL_ADC_MULTI_TWOSMP_DELAY_4CYCLES_5          (                                    ADC_CCR_DELAY_1 | ADC_CCR_DELAY_0) /*!< ADC multimode delay between two sampling phases: 4.5 ADC clock cycles for 16, 14, 12 or 10 bits resolution */
01466 #define LL_ADC_MULTI_TWOSMP_DELAY_4CYCLES_5_8_BITS   (                  ADC_CCR_DELAY_2 | ADC_CCR_DELAY_1 | ADC_CCR_DELAY_0) /*!< ADC multimode delay between two sampling phases: 4.5 ADC clock cycles  for 8 bits resolution               */
01467 #define LL_ADC_MULTI_TWOSMP_DELAY_5CYCLES_5          (                  ADC_CCR_DELAY_2                                    ) /*!< ADC multimode delay between two sampling phases: 5.5 ADC clock cycles for 16, 14, 12 bits resolution       */
01468 #define LL_ADC_MULTI_TWOSMP_DELAY_5CYCLES_5_10_BITS  (                  ADC_CCR_DELAY_2 | ADC_CCR_DELAY_1 | ADC_CCR_DELAY_0) /*!< ADC multimode delay between two sampling phases: 5.5 ADC clock cycles for 10 bits resolution               */
01469 #define LL_ADC_MULTI_TWOSMP_DELAY_6CYCLES            (ADC_CCR_DELAY_3                                                      ) /*!< ADC multimode delay between two sampling phases: 6 ADC clock cycles for 10 or 8 bits resolution            */
01470 #define LL_ADC_MULTI_TWOSMP_DELAY_6CYCLES_5          (                  ADC_CCR_DELAY_2                   | ADC_CCR_DELAY_0) /*!< ADC multimode delay between two sampling phases: 6.5 ADC clock cycles for 16 or 14 bits resolution         */
01471 #define LL_ADC_MULTI_TWOSMP_DELAY_6CYCLES_5_12_BITS  (                  ADC_CCR_DELAY_2 | ADC_CCR_DELAY_1 | ADC_CCR_DELAY_0) /*!< ADC multimode delay between two sampling phases: 6.5 ADC clock cycles for 12 bits resolution               */
01472 #define LL_ADC_MULTI_TWOSMP_DELAY_7CYCLES_5          (                  ADC_CCR_DELAY_2 | ADC_CCR_DELAY_1 | ADC_CCR_DELAY_0) /*!< ADC multimode delay between two sampling phases: 7.5 ADC clock cycles for 16 bits resolution               */
01473 #define LL_ADC_MULTI_TWOSMP_DELAY_8CYCLES            (ADC_CCR_DELAY_3                                                      ) /*!< ADC multimode delay between two sampling phases: 8 ADC clock cycles for 12 bits resolution                 */
01474 #define LL_ADC_MULTI_TWOSMP_DELAY_9CYCLES            (ADC_CCR_DELAY_3                                                      ) /*!< ADC multimode delay between two sampling phases: 9 ADC clock cycles for 16 or 14 bits resolution           */
01475 /**
01476   * @}
01477   */
01478 
01479 /** @defgroup ADC_LL_EC_MULTI_MASTER_SLAVE  Multimode - ADC master or slave
01480   * @{
01481   */
01482 #define LL_ADC_MULTI_MASTER                (                    ADC_CDR_RDATA_MST) /*!< In multimode, selection among several ADC instances: ADC master */
01483 #define LL_ADC_MULTI_SLAVE                 (ADC_CDR_RDATA_SLV                    ) /*!< In multimode, selection among several ADC instances: ADC slave */
01484 #define LL_ADC_MULTI_MASTER_SLAVE          (ADC_CDR_RDATA_SLV | ADC_CDR_RDATA_MST) /*!< In multimode, selection among several ADC instances: both ADC master and ADC slave */
01485 /**
01486   * @}
01487   */
01488 
01489 
01490 
01491 /** @defgroup ADC_LL_EC_HW_DELAYS  Definitions of ADC hardware constraints delays
01492   * @note   Only ADC peripheral HW delays are defined in ADC LL driver driver,
01493   *         not timeout values.
01494   *         For details on delays values, refer to descriptions in source code
01495   *         above each literal definition.
01496   * @{
01497   */
01498 
01499 /* Note: Only ADC peripheral HW delays are defined in ADC LL driver driver,   */
01500 /*       not timeout values.                                                  */
01501 /*       Timeout values for ADC operations are dependent to device clock      */
01502 /*       configuration (system clock versus ADC clock),                       */
01503 /*       and therefore must be defined in user application.                   */
01504 /*       Indications for estimation of ADC timeout delays, for this           */
01505 /*       STM32 series:                                                         */
01506 /*       - ADC calibration time: maximum delay is 16384/fADC.                   */
01507 /*         (refer to device datasheet, parameter "tCAL")                      */
01508 /*       - ADC enable time: maximum delay is 1 conversion cycle.              */
01509 /*         (refer to device datasheet, parameter "tSTAB")                     */
01510 /*       - ADC disable time: maximum delay should be a few ADC clock cycles   */
01511 /*       - ADC stop conversion time: maximum delay should be a few ADC clock  */
01512 /*         cycles                                                             */
01513 /*       - ADC conversion time: duration depending on ADC clock and ADC       */
01514 /*         configuration.                                                     */
01515 /*         (refer to device reference manual, section "Timing")               */
01516 
01517 /* Delay for ADC stabilization time (ADC voltage regulator start-up time)     */
01518 /* Delay set to maximum value (refer to device datasheet,                     */
01519 /* parameter "tADCVREG_STUP").                                                */
01520 /* Unit: us                                                                   */
01521 #define LL_ADC_DELAY_INTERNAL_REGUL_STAB_US ( 10UL)  /*!< Delay for ADC stabilization time (ADC voltage regulator start-up time) */
01522 
01523 /* Delay for internal voltage reference stabilization time.                   */
01524 /* Delay set to maximum value (refer to device datasheet,                     */
01525 /* parameter "ts_vrefint").                                                   */
01526 /* Unit: us                                                                   */
01527 #define LL_ADC_DELAY_VREFINT_STAB_US       (5UL)  /*!< Delay for internal voltage reference stabilization time */
01528 
01529 /* Delay for temperature sensor stabilization time.                           */
01530 /* Literal set to maximum value (refer to device datasheet,                   */
01531 /* parameter "tSTART_RUN").                                                   */
01532 /* Unit: us                                                                   */
01533 #define LL_ADC_DELAY_TEMPSENSOR_STAB_US    ( 26UL)  /*!< Delay for temperature sensor stabilization time */
01534 
01535 /* Delay required between ADC end of calibration and ADC enable.              */
01536 /* Note: On this STM32 series, a minimum number of ADC clock cycles            */
01537 /*       are required between ADC end of calibration and ADC enable.          */
01538 /*       Wait time can be computed in user application by waiting for the     */
01539 /*       equivalent number of CPU cycles, by taking into account              */
01540 /*       ratio of CPU clock versus ADC clock prescalers.                      */
01541 /* Unit: ADC clock cycles.                                                    */
01542 #define LL_ADC_DELAY_CALIB_ENABLE_ADC_CYCLES (  4UL)  /*!< Delay required between ADC end of calibration and ADC enable */
01543 
01544 /* Fixed timeout value for ADC linearity word bit set/clear delay.                         */
01545 /* Values defined to be higher than worst cases: low clock frequency,                      */
01546 /* maximum prescalers.                                                                     */
01547 /* Ex of profile low frequency : f_ADC at 4,577 Khz (minimum value                         */
01548 /* according to Data sheet), linearity set/clear bit delay MAX = 6 / f_ADC + 3 cycles AHB  */
01549 /*           6 / 4577 = 1,311ms                                                            */
01550 /* At maximum CPU speed (400 MHz), this means                                              */
01551 /*    3.58 * 400 MHz = 524400 CPU cycles                                                   */
01552 #define ADC_LINEARITY_BIT_TOGGLE_TIMEOUT         (524400UL)      /*!< ADC linearity set/clear bit delay */
01553 
01554 /**
01555   * @}
01556   */
01557 
01558 /**
01559   * @}
01560   */
01561 
01562 
01563 /* Exported macro ------------------------------------------------------------*/
01564 /** @defgroup ADC_LL_Exported_Macros ADC Exported Macros
01565   * @{
01566   */
01567 
01568 /** @defgroup ADC_LL_EM_WRITE_READ Common write and read registers Macros
01569   * @{
01570   */
01571 
01572 /**
01573   * @brief  Write a value in ADC register
01574   * @param  __INSTANCE__ ADC Instance
01575   * @param  __REG__ Register to be written
01576   * @param  __VALUE__ Value to be written in the register
01577   * @retval None
01578   */
01579 #define LL_ADC_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
01580 
01581 /**
01582   * @brief  Read a value in ADC register
01583   * @param  __INSTANCE__ ADC Instance
01584   * @param  __REG__ Register to be read
01585   * @retval Register value
01586   */
01587 #define LL_ADC_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
01588 /**
01589   * @}
01590   */
01591 
01592 /** @defgroup ADC_LL_EM_HELPER_MACRO ADC helper macro
01593   * @{
01594   */
01595 
01596 #if defined(ADC_VER_V5_V90)
01597 /**
01598   * @brief  Helper macro to convert the resolution defines to STM32H73x/2x ADC3 registers values
01599   *         value corresponding to the ADC3 resolution according to the STM32H73x/2x RefMan.
01600   * @note   The input can be a value from ADC3 resolution (12b, 10b, 8b,6b)
01601   * @param  __ADC_RESOLUTION__ This parameter can be one of the following values:
01602   *         @arg @ref LL_ADC_RESOLUTION_12B
01603   *         @arg @ref LL_ADC_RESOLUTION_10B
01604   *         @arg @ref LL_ADC_RESOLUTION_8B
01605   *         @arg @ref LL_ADC_RESOLUTION_6B
01606   * @retval Returned value can be one of the following values:
01607   *         @arg 0x00000000UL (value correspodning to ADC3 12 bits)
01608   *         @arg ADC_CFGR_RES_0 = 0x00000004  (value corresponding to ADC3 10 bits)
01609   *         @arg ADC_CFGR_RES_1 = 0x00000008 (value corresponding to ADC3 8 bits)
01610   *         @arg 0x0000001C (value corresponding to ADC3 6 bits)
01611   * @note   This helper macro is applicable for STM32H73x/2x devices only
01612   */
01613 #define __LL_ADC12_RESOLUTION_TO_ADC3(__ADC_RESOLUTION__)                      \
01614          (                                                                     \
01615            ((__ADC_RESOLUTION__) == LL_ADC_RESOLUTION_12B)                     \
01616             ?(0x00000000UL)                                                    \
01617              :                                                                 \
01618              ((__ADC_RESOLUTION__) == LL_ADC_RESOLUTION_10B)                   \
01619                ?(ADC_CFGR_RES_0)                                               \
01620                 :                                                              \
01621                 ((__ADC_RESOLUTION__) == LL_ADC_RESOLUTION_8B)                 \
01622                   ?(ADC_CFGR_RES_1)                                            \
01623                    :                                                           \
01624                    ((__ADC_RESOLUTION__) == LL_ADC_RESOLUTION_6B)              \
01625                      ?((ADC_CFGR_RES_2|ADC_CFGR_RES_1 | ADC_CFGR_RES_0))       \
01626                        :(0x00000000UL)                                         \
01627          )
01628 
01629 #endif /* ADC_VER_V5_V90 */
01630 
01631 /**
01632   * @brief  Helper macro to get ADC channel number in decimal format
01633   *         from literals LL_ADC_CHANNEL_x.
01634   * @note   Example:
01635   *           __LL_ADC_CHANNEL_TO_DECIMAL_NB(LL_ADC_CHANNEL_4)
01636   *           will return decimal number "4".
01637   * @note   The input can be a value from functions where a channel
01638   *         number is returned, either defined with number
01639   *         or with bitfield (only one bit must be set).
01640   * @param  __CHANNEL__ This parameter can be one of the following values:
01641   *         @arg @ref LL_ADC_CHANNEL_0           (3)
01642   *         @arg @ref LL_ADC_CHANNEL_1           (3)
01643   *         @arg @ref LL_ADC_CHANNEL_2           (3)
01644   *         @arg @ref LL_ADC_CHANNEL_3           (3)
01645   *         @arg @ref LL_ADC_CHANNEL_4           (3)
01646   *         @arg @ref LL_ADC_CHANNEL_5           (3)
01647   *         @arg @ref LL_ADC_CHANNEL_6
01648   *         @arg @ref LL_ADC_CHANNEL_7
01649   *         @arg @ref LL_ADC_CHANNEL_8
01650   *         @arg @ref LL_ADC_CHANNEL_9
01651   *         @arg @ref LL_ADC_CHANNEL_10
01652   *         @arg @ref LL_ADC_CHANNEL_11
01653   *         @arg @ref LL_ADC_CHANNEL_12
01654   *         @arg @ref LL_ADC_CHANNEL_13
01655   *         @arg @ref LL_ADC_CHANNEL_14
01656   *         @arg @ref LL_ADC_CHANNEL_15
01657   *         @arg @ref LL_ADC_CHANNEL_16
01658   *         @arg @ref LL_ADC_CHANNEL_17
01659   *         @arg @ref LL_ADC_CHANNEL_18
01660   *         @arg @ref LL_ADC_CHANNEL_19
01661   *         @arg @ref LL_ADC_CHANNEL_VREFINT      (1)
01662   *         @arg @ref LL_ADC_CHANNEL_TEMPSENSOR   (1)
01663   *         @arg @ref LL_ADC_CHANNEL_VBAT         (1)
01664   *         @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)
01665   *         @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)
01666   *
01667   *         (1) On STM32H7, parameter available only on ADC instance: ADC3.\n
01668   *         (2) On STM32H7, parameter available only on ADC instance: ADC2.\n
01669   *         (3) On STM32H7, fast channel (0.125 us for 14-bit resolution (ADC conversion rate up to 8 Ms/s)).
01670   *             Other channels are slow channels (conversion rate: refer to reference manual).
01671   * @retval Value between Min_Data=0 and Max_Data=18
01672   */
01673 #define __LL_ADC_CHANNEL_TO_DECIMAL_NB(__CHANNEL__)                                        \
01674   ((((__CHANNEL__) & ADC_CHANNEL_ID_BITFIELD_MASK) == 0UL)                                 \
01675     ? (                                                                                    \
01676        ((__CHANNEL__) & ADC_CHANNEL_ID_NUMBER_MASK) >> ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS \
01677       )                                                                                    \
01678       :                                                                                    \
01679       (                                                                                    \
01680        (uint32_t)POSITION_VAL((__CHANNEL__))                                               \
01681       )                                                                                    \
01682   )
01683 
01684 /**
01685   * @brief  Helper macro to get ADC channel in literal format LL_ADC_CHANNEL_x
01686   *         from number in decimal format.
01687   * @note   Example:
01688   *           __LL_ADC_DECIMAL_NB_TO_CHANNEL(4)
01689   *           will return a data equivalent to "LL_ADC_CHANNEL_4".
01690   * @param  __DECIMAL_NB__ Value between Min_Data=0 and Max_Data=18
01691   * @retval Returned value can be one of the following values:
01692   *         @arg @ref LL_ADC_CHANNEL_0           (3)
01693   *         @arg @ref LL_ADC_CHANNEL_1           (3)
01694   *         @arg @ref LL_ADC_CHANNEL_2           (3)
01695   *         @arg @ref LL_ADC_CHANNEL_3           (3)
01696   *         @arg @ref LL_ADC_CHANNEL_4           (3)
01697   *         @arg @ref LL_ADC_CHANNEL_5           (3)
01698   *         @arg @ref LL_ADC_CHANNEL_6
01699   *         @arg @ref LL_ADC_CHANNEL_7
01700   *         @arg @ref LL_ADC_CHANNEL_8
01701   *         @arg @ref LL_ADC_CHANNEL_9
01702   *         @arg @ref LL_ADC_CHANNEL_10
01703   *         @arg @ref LL_ADC_CHANNEL_11
01704   *         @arg @ref LL_ADC_CHANNEL_12
01705   *         @arg @ref LL_ADC_CHANNEL_13
01706   *         @arg @ref LL_ADC_CHANNEL_14
01707   *         @arg @ref LL_ADC_CHANNEL_15
01708   *         @arg @ref LL_ADC_CHANNEL_16
01709   *         @arg @ref LL_ADC_CHANNEL_17
01710   *         @arg @ref LL_ADC_CHANNEL_18
01711   *         @arg @ref LL_ADC_CHANNEL_19
01712   *         @arg @ref LL_ADC_CHANNEL_VREFINT      (1)
01713   *         @arg @ref LL_ADC_CHANNEL_TEMPSENSOR   (1)
01714   *         @arg @ref LL_ADC_CHANNEL_VBAT         (1)
01715   *         @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)
01716   *         @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)
01717   *
01718   *         (1) On STM32H7, parameter available only on ADC instance: ADC3.\n
01719   *         (2) On STM32H7, parameter available only on ADC instance: ADC2.\n
01720   *         (3) On STM32H7, fast channel (0.125 us for 14-bit resolution (ADC conversion rate up to 8 Ms/s)).
01721   *             Other channels are slow channels (conversion rate: refer to reference manual).\n
01722   *         (1, 2) For ADC channel read back from ADC register,
01723   *                comparison with internal channel parameter to be done
01724   *                using helper macro @ref __LL_ADC_CHANNEL_INTERNAL_TO_EXTERNAL().
01725   */
01726 #define __LL_ADC_DECIMAL_NB_TO_CHANNEL(__DECIMAL_NB__)                                                  \
01727   (((__DECIMAL_NB__) <= 9UL)                                                                            \
01728     ? (                                                                                                 \
01729        ((__DECIMAL_NB__) << ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS)                             |          \
01730        (ADC_AWD2CR_AWD2CH_0 << (__DECIMAL_NB__))                                             |          \
01731        (ADC_SMPR1_REGOFFSET | (((3UL * (__DECIMAL_NB__))) << ADC_CHANNEL_SMPx_BITOFFSET_POS))           \
01732       )                                                                                                 \
01733       :                                                                                                 \
01734       (                                                                                                 \
01735        ((__DECIMAL_NB__) << ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS)                                      | \
01736        (ADC_AWD2CR_AWD2CH_0 << (__DECIMAL_NB__))                                                      | \
01737        (ADC_SMPR2_REGOFFSET | (((3UL * ((__DECIMAL_NB__) - 10UL))) << ADC_CHANNEL_SMPx_BITOFFSET_POS))  \
01738       )                                                                                                 \
01739   )
01740 
01741 /**
01742   * @brief  Helper macro to determine whether the selected channel
01743   *         corresponds to literal definitions of driver.
01744   * @note   The different literal definitions of ADC channels are:
01745   *         - ADC internal channel:
01746   *           LL_ADC_CHANNEL_VREFINT, LL_ADC_CHANNEL_TEMPSENSOR, ...
01747   *         - ADC external channel (channel connected to a GPIO pin):
01748   *           LL_ADC_CHANNEL_1, LL_ADC_CHANNEL_2, ...
01749   * @note   The channel parameter must be a value defined from literal
01750   *         definition of a ADC internal channel (LL_ADC_CHANNEL_VREFINT,
01751   *         LL_ADC_CHANNEL_TEMPSENSOR, ...),
01752   *         ADC external channel (LL_ADC_CHANNEL_1, LL_ADC_CHANNEL_2, ...),
01753   *         must not be a value from functions where a channel number is
01754   *         returned from ADC registers,
01755   *         because internal and external channels share the same channel
01756   *         number in ADC registers. The differentiation is made only with
01757   *         parameters definitions of driver.
01758   * @param  __CHANNEL__ This parameter can be one of the following values:
01759   *         @arg @ref LL_ADC_CHANNEL_0           (3)
01760   *         @arg @ref LL_ADC_CHANNEL_1           (3)
01761   *         @arg @ref LL_ADC_CHANNEL_2           (3)
01762   *         @arg @ref LL_ADC_CHANNEL_3           (3)
01763   *         @arg @ref LL_ADC_CHANNEL_4           (3)
01764   *         @arg @ref LL_ADC_CHANNEL_5           (3)
01765   *         @arg @ref LL_ADC_CHANNEL_6
01766   *         @arg @ref LL_ADC_CHANNEL_7
01767   *         @arg @ref LL_ADC_CHANNEL_8
01768   *         @arg @ref LL_ADC_CHANNEL_9
01769   *         @arg @ref LL_ADC_CHANNEL_10
01770   *         @arg @ref LL_ADC_CHANNEL_11
01771   *         @arg @ref LL_ADC_CHANNEL_12
01772   *         @arg @ref LL_ADC_CHANNEL_13
01773   *         @arg @ref LL_ADC_CHANNEL_14
01774   *         @arg @ref LL_ADC_CHANNEL_15
01775   *         @arg @ref LL_ADC_CHANNEL_16
01776   *         @arg @ref LL_ADC_CHANNEL_17
01777   *         @arg @ref LL_ADC_CHANNEL_18
01778   *         @arg @ref LL_ADC_CHANNEL_19
01779   *         @arg @ref LL_ADC_CHANNEL_VREFINT      (1)
01780   *         @arg @ref LL_ADC_CHANNEL_TEMPSENSOR   (1)
01781   *         @arg @ref LL_ADC_CHANNEL_VBAT         (1)
01782   *         @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)
01783   *         @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)
01784   *
01785   *         (1) On STM32H7, parameter available only on ADC instance: ADC3.\n
01786   *         (2) On STM32H7, parameter available only on ADC instance: ADC2.\n
01787   *         (3) On STM32H7, fast channel (0.125 us for 14-bit resolution (ADC conversion rate up to 8 Ms/s)).
01788   *             Other channels are slow channels (conversion rate: refer to reference manual).
01789   * @retval Value "0" if the channel corresponds to a parameter definition of a ADC external channel (channel connected to a GPIO pin).
01790   *         Value "1" if the channel corresponds to a parameter definition of a ADC internal channel.
01791   */
01792 #define __LL_ADC_IS_CHANNEL_INTERNAL(__CHANNEL__)                              \
01793   (((__CHANNEL__) & ADC_CHANNEL_ID_INTERNAL_CH_MASK) != 0UL)
01794 
01795 /**
01796   * @brief  Helper macro to convert a channel defined from parameter
01797   *         definition of a ADC internal channel (LL_ADC_CHANNEL_VREFINT,
01798   *         LL_ADC_CHANNEL_TEMPSENSOR, ...),
01799   *         to its equivalent parameter definition of a ADC external channel
01800   *         (LL_ADC_CHANNEL_1, LL_ADC_CHANNEL_2, ...).
01801   * @note   The channel parameter can be, additionally to a value
01802   *         defined from parameter definition of a ADC internal channel
01803   *         (LL_ADC_CHANNEL_VREFINT, LL_ADC_CHANNEL_TEMPSENSOR, ...),
01804   *         a value defined from parameter definition of
01805   *         ADC external channel (LL_ADC_CHANNEL_1, LL_ADC_CHANNEL_2, ...)
01806   *         or a value from functions where a channel number is returned
01807   *         from ADC registers.
01808   * @param  __CHANNEL__ This parameter can be one of the following values:
01809   *         @arg @ref LL_ADC_CHANNEL_0           (3)
01810   *         @arg @ref LL_ADC_CHANNEL_1           (3)
01811   *         @arg @ref LL_ADC_CHANNEL_2           (3)
01812   *         @arg @ref LL_ADC_CHANNEL_3           (3)
01813   *         @arg @ref LL_ADC_CHANNEL_4           (3)
01814   *         @arg @ref LL_ADC_CHANNEL_5           (3)
01815   *         @arg @ref LL_ADC_CHANNEL_6
01816   *         @arg @ref LL_ADC_CHANNEL_7
01817   *         @arg @ref LL_ADC_CHANNEL_8
01818   *         @arg @ref LL_ADC_CHANNEL_9
01819   *         @arg @ref LL_ADC_CHANNEL_10
01820   *         @arg @ref LL_ADC_CHANNEL_11
01821   *         @arg @ref LL_ADC_CHANNEL_12
01822   *         @arg @ref LL_ADC_CHANNEL_13
01823   *         @arg @ref LL_ADC_CHANNEL_14
01824   *         @arg @ref LL_ADC_CHANNEL_15
01825   *         @arg @ref LL_ADC_CHANNEL_16
01826   *         @arg @ref LL_ADC_CHANNEL_17
01827   *         @arg @ref LL_ADC_CHANNEL_18
01828   *         @arg @ref LL_ADC_CHANNEL_19
01829   *         @arg @ref LL_ADC_CHANNEL_VREFINT      (1)
01830   *         @arg @ref LL_ADC_CHANNEL_TEMPSENSOR   (1)
01831   *         @arg @ref LL_ADC_CHANNEL_VBAT         (1)
01832   *         @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)
01833   *         @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)
01834   *
01835   *         (1) On STM32H7, parameter available only on ADC instance: ADC3.\n
01836   *         (2) On STM32H7, parameter available only on ADC instance: ADC2.\n
01837   *         (3) On STM32H7, fast channel (0.125 us for 14-bit resolution (ADC conversion rate up to 8 Ms/s)).
01838   *             Other channels are slow channels (conversion rate: refer to reference manual).
01839   * @retval Returned value can be one of the following values:
01840   *         @arg @ref LL_ADC_CHANNEL_0
01841   *         @arg @ref LL_ADC_CHANNEL_1
01842   *         @arg @ref LL_ADC_CHANNEL_2
01843   *         @arg @ref LL_ADC_CHANNEL_3
01844   *         @arg @ref LL_ADC_CHANNEL_4
01845   *         @arg @ref LL_ADC_CHANNEL_5
01846   *         @arg @ref LL_ADC_CHANNEL_6
01847   *         @arg @ref LL_ADC_CHANNEL_7
01848   *         @arg @ref LL_ADC_CHANNEL_8
01849   *         @arg @ref LL_ADC_CHANNEL_9
01850   *         @arg @ref LL_ADC_CHANNEL_10
01851   *         @arg @ref LL_ADC_CHANNEL_11
01852   *         @arg @ref LL_ADC_CHANNEL_12
01853   *         @arg @ref LL_ADC_CHANNEL_13
01854   *         @arg @ref LL_ADC_CHANNEL_14
01855   *         @arg @ref LL_ADC_CHANNEL_15
01856   *         @arg @ref LL_ADC_CHANNEL_16
01857   *         @arg @ref LL_ADC_CHANNEL_17
01858   *         @arg @ref LL_ADC_CHANNEL_18
01859   *         @arg @ref LL_ADC_CHANNEL_19
01860   */
01861 #define __LL_ADC_CHANNEL_INTERNAL_TO_EXTERNAL(__CHANNEL__)                     \
01862   ((__CHANNEL__) & ~ADC_CHANNEL_ID_INTERNAL_CH_MASK)
01863 
01864 /**
01865   * @brief  Helper macro to determine whether the internal channel
01866   *         selected is available on the ADC instance selected.
01867   * @note   The channel parameter must be a value defined from parameter
01868   *         definition of a ADC internal channel (LL_ADC_CHANNEL_VREFINT,
01869   *         LL_ADC_CHANNEL_TEMPSENSOR, ...),
01870   *         must not be a value defined from parameter definition of
01871   *         ADC external channel (LL_ADC_CHANNEL_1, LL_ADC_CHANNEL_2, ...)
01872   *         or a value from functions where a channel number is
01873   *         returned from ADC registers,
01874   *         because internal and external channels share the same channel
01875   *         number in ADC registers. The differentiation is made only with
01876   *         parameters definitions of driver.
01877   * @param  __ADC_INSTANCE__ ADC instance
01878   * @param  __CHANNEL__ This parameter can be one of the following values:
01879   *         @arg @ref LL_ADC_CHANNEL_VREFINT      (1)
01880   *         @arg @ref LL_ADC_CHANNEL_TEMPSENSOR   (1)
01881   *         @arg @ref LL_ADC_CHANNEL_VBAT         (1)
01882   *         @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)
01883   *         @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)
01884   *
01885   *         (1) On STM32H7, parameter available only on ADC instance: ADC3.\n
01886   *         (2) On STM32H7, parameter available only on ADC instance: ADC2.
01887   * @retval Value "0" if the internal channel selected is not available on the ADC instance selected.
01888   *         Value "1" if the internal channel selected is available on the ADC instance selected.
01889   */
01890 #if defined(ADC3)
01891 #define __LL_ADC_IS_CHANNEL_INTERNAL_AVAILABLE(__ADC_INSTANCE__, __CHANNEL__)  \
01892   ((((__ADC_INSTANCE__) == ADC2)                                               \
01893     &&(                                                                        \
01894        ((__CHANNEL__) == LL_ADC_CHANNEL_DAC1CH1_ADC2) ||                       \
01895        ((__CHANNEL__) == LL_ADC_CHANNEL_DAC1CH2_ADC2)                          \
01896       )                                                                        \
01897    )                                                                           \
01898    ||                                                                          \
01899    (((__ADC_INSTANCE__) == ADC3)                                               \
01900     &&(                                                                        \
01901        ((__CHANNEL__) == LL_ADC_CHANNEL_TEMPSENSOR)   ||                       \
01902        ((__CHANNEL__) == LL_ADC_CHANNEL_VBAT)         ||                       \
01903        ((__CHANNEL__) == LL_ADC_CHANNEL_VREFINT)                               \
01904       )                                                                        \
01905    )                                                                           \
01906   )
01907 #else
01908 #define __LL_ADC_IS_CHANNEL_INTERNAL_AVAILABLE(__ADC_INSTANCE__, __CHANNEL__)  \
01909   ((((__ADC_INSTANCE__) == ADC2)                                               \
01910     &&(                                                                        \
01911        ((__CHANNEL__) == LL_ADC_CHANNEL_DAC1CH1_ADC2) ||                       \
01912        ((__CHANNEL__) == LL_ADC_CHANNEL_DAC1CH2_ADC2) ||                       \
01913        ((__CHANNEL__) == LL_ADC_CHANNEL_TEMPSENSOR)   ||                       \
01914        ((__CHANNEL__) == LL_ADC_CHANNEL_VBAT)         ||                       \
01915        ((__CHANNEL__) == LL_ADC_CHANNEL_VREFINT)                               \
01916       )                                                                        \
01917    )                                                                           \
01918   )
01919 #endif
01920 
01921 /**
01922   * @brief  Helper macro to define ADC analog watchdog parameter:
01923   *         define a single channel to monitor with analog watchdog
01924   *         from sequencer channel and groups definition.
01925   * @note   To be used with function @ref LL_ADC_SetAnalogWDMonitChannels().
01926   *         Example:
01927   *           LL_ADC_SetAnalogWDMonitChannels(
01928   *             ADC1, LL_ADC_AWD1,
01929   *             __LL_ADC_ANALOGWD_CHANNEL_GROUP(LL_ADC_CHANNEL4, LL_ADC_GROUP_REGULAR))
01930   * @param  __CHANNEL__ This parameter can be one of the following values:
01931   *         @arg @ref LL_ADC_CHANNEL_0           (3)
01932   *         @arg @ref LL_ADC_CHANNEL_1           (3)
01933   *         @arg @ref LL_ADC_CHANNEL_2           (3)
01934   *         @arg @ref LL_ADC_CHANNEL_3           (3)
01935   *         @arg @ref LL_ADC_CHANNEL_4           (3)
01936   *         @arg @ref LL_ADC_CHANNEL_5           (3)
01937   *         @arg @ref LL_ADC_CHANNEL_6
01938   *         @arg @ref LL_ADC_CHANNEL_7
01939   *         @arg @ref LL_ADC_CHANNEL_8
01940   *         @arg @ref LL_ADC_CHANNEL_9
01941   *         @arg @ref LL_ADC_CHANNEL_10
01942   *         @arg @ref LL_ADC_CHANNEL_11
01943   *         @arg @ref LL_ADC_CHANNEL_12
01944   *         @arg @ref LL_ADC_CHANNEL_13
01945   *         @arg @ref LL_ADC_CHANNEL_14
01946   *         @arg @ref LL_ADC_CHANNEL_15
01947   *         @arg @ref LL_ADC_CHANNEL_16
01948   *         @arg @ref LL_ADC_CHANNEL_17
01949   *         @arg @ref LL_ADC_CHANNEL_18
01950   *         @arg @ref LL_ADC_CHANNEL_19
01951   *         @arg @ref LL_ADC_CHANNEL_VREFINT      (1)
01952   *         @arg @ref LL_ADC_CHANNEL_TEMPSENSOR   (1)
01953   *         @arg @ref LL_ADC_CHANNEL_VBAT         (1)
01954   *         @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)
01955   *         @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)
01956   *
01957   *         (1) On STM32H7, parameter available only on ADC instance: ADC3.\n
01958   *         (2) On STM32H7, parameter available only on ADC instance: ADC2.\n
01959   *         (3) On STM32H7, fast channel (0.125 us for 14-bit resolution (ADC conversion rate up to 8 Ms/s)).
01960   *             Other channels are slow channels (conversion rate: refer to reference manual).\n
01961   *         (1, 2) For ADC channel read back from ADC register,
01962   *                comparison with internal channel parameter to be done
01963   *                using helper macro @ref __LL_ADC_CHANNEL_INTERNAL_TO_EXTERNAL().
01964   * @param  __GROUP__ This parameter can be one of the following values:
01965   *         @arg @ref LL_ADC_GROUP_REGULAR
01966   *         @arg @ref LL_ADC_GROUP_INJECTED
01967   *         @arg @ref LL_ADC_GROUP_REGULAR_INJECTED
01968   * @retval Returned value can be one of the following values:
01969   *         @arg @ref LL_ADC_AWD_DISABLE
01970   *         @arg @ref LL_ADC_AWD_ALL_CHANNELS_REG        (0)
01971   *         @arg @ref LL_ADC_AWD_ALL_CHANNELS_INJ        (0)
01972   *         @arg @ref LL_ADC_AWD_ALL_CHANNELS_REG_INJ
01973   *         @arg @ref LL_ADC_AWD_CHANNEL_0_REG           (0)
01974   *         @arg @ref LL_ADC_AWD_CHANNEL_0_INJ           (0)
01975   *         @arg @ref LL_ADC_AWD_CHANNEL_0_REG_INJ
01976   *         @arg @ref LL_ADC_AWD_CHANNEL_1_REG           (0)
01977   *         @arg @ref LL_ADC_AWD_CHANNEL_1_INJ           (0)
01978   *         @arg @ref LL_ADC_AWD_CHANNEL_1_REG_INJ
01979   *         @arg @ref LL_ADC_AWD_CHANNEL_2_REG           (0)
01980   *         @arg @ref LL_ADC_AWD_CHANNEL_2_INJ           (0)
01981   *         @arg @ref LL_ADC_AWD_CHANNEL_2_REG_INJ
01982   *         @arg @ref LL_ADC_AWD_CHANNEL_3_REG           (0)
01983   *         @arg @ref LL_ADC_AWD_CHANNEL_3_INJ           (0)
01984   *         @arg @ref LL_ADC_AWD_CHANNEL_3_REG_INJ
01985   *         @arg @ref LL_ADC_AWD_CHANNEL_4_REG           (0)
01986   *         @arg @ref LL_ADC_AWD_CHANNEL_4_INJ           (0)
01987   *         @arg @ref LL_ADC_AWD_CHANNEL_4_REG_INJ
01988   *         @arg @ref LL_ADC_AWD_CHANNEL_5_REG           (0)
01989   *         @arg @ref LL_ADC_AWD_CHANNEL_5_INJ           (0)
01990   *         @arg @ref LL_ADC_AWD_CHANNEL_5_REG_INJ
01991   *         @arg @ref LL_ADC_AWD_CHANNEL_6_REG           (0)
01992   *         @arg @ref LL_ADC_AWD_CHANNEL_6_INJ           (0)
01993   *         @arg @ref LL_ADC_AWD_CHANNEL_6_REG_INJ
01994   *         @arg @ref LL_ADC_AWD_CHANNEL_7_REG           (0)
01995   *         @arg @ref LL_ADC_AWD_CHANNEL_7_INJ           (0)
01996   *         @arg @ref LL_ADC_AWD_CHANNEL_7_REG_INJ
01997   *         @arg @ref LL_ADC_AWD_CHANNEL_8_REG           (0)
01998   *         @arg @ref LL_ADC_AWD_CHANNEL_8_INJ           (0)
01999   *         @arg @ref LL_ADC_AWD_CHANNEL_8_REG_INJ
02000   *         @arg @ref LL_ADC_AWD_CHANNEL_9_REG           (0)
02001   *         @arg @ref LL_ADC_AWD_CHANNEL_9_INJ           (0)
02002   *         @arg @ref LL_ADC_AWD_CHANNEL_9_REG_INJ
02003   *         @arg @ref LL_ADC_AWD_CHANNEL_10_REG          (0)
02004   *         @arg @ref LL_ADC_AWD_CHANNEL_10_INJ          (0)
02005   *         @arg @ref LL_ADC_AWD_CHANNEL_10_REG_INJ
02006   *         @arg @ref LL_ADC_AWD_CHANNEL_11_REG          (0)
02007   *         @arg @ref LL_ADC_AWD_CHANNEL_11_INJ          (0)
02008   *         @arg @ref LL_ADC_AWD_CHANNEL_11_REG_INJ
02009   *         @arg @ref LL_ADC_AWD_CHANNEL_12_REG          (0)
02010   *         @arg @ref LL_ADC_AWD_CHANNEL_12_INJ          (0)
02011   *         @arg @ref LL_ADC_AWD_CHANNEL_12_REG_INJ
02012   *         @arg @ref LL_ADC_AWD_CHANNEL_13_REG          (0)
02013   *         @arg @ref LL_ADC_AWD_CHANNEL_13_INJ          (0)
02014   *         @arg @ref LL_ADC_AWD_CHANNEL_13_REG_INJ
02015   *         @arg @ref LL_ADC_AWD_CHANNEL_14_REG          (0)
02016   *         @arg @ref LL_ADC_AWD_CHANNEL_14_INJ          (0)
02017   *         @arg @ref LL_ADC_AWD_CHANNEL_14_REG_INJ
02018   *         @arg @ref LL_ADC_AWD_CHANNEL_15_REG          (0)
02019   *         @arg @ref LL_ADC_AWD_CHANNEL_15_INJ          (0)
02020   *         @arg @ref LL_ADC_AWD_CHANNEL_15_REG_INJ
02021   *         @arg @ref LL_ADC_AWD_CHANNEL_16_REG          (0)
02022   *         @arg @ref LL_ADC_AWD_CHANNEL_16_INJ          (0)
02023   *         @arg @ref LL_ADC_AWD_CHANNEL_16_REG_INJ
02024   *         @arg @ref LL_ADC_AWD_CHANNEL_17_REG          (0)
02025   *         @arg @ref LL_ADC_AWD_CHANNEL_17_INJ          (0)
02026   *         @arg @ref LL_ADC_AWD_CHANNEL_17_REG_INJ
02027   *         @arg @ref LL_ADC_AWD_CHANNEL_18_REG          (0)
02028   *         @arg @ref LL_ADC_AWD_CHANNEL_18_INJ          (0)
02029   *         @arg @ref LL_ADC_AWD_CHANNEL_18_REG_INJ
02030   *         @arg @ref LL_ADC_AWD_CHANNEL_19_REG          (0)
02031   *         @arg @ref LL_ADC_AWD_CHANNEL_19_INJ          (0)
02032   *         @arg @ref LL_ADC_AWD_CHANNEL_19_REG_INJ
02033   *         @arg @ref LL_ADC_AWD_CH_VREFINT_REG          (0)(1)
02034   *         @arg @ref LL_ADC_AWD_CH_VREFINT_INJ          (0)(1)
02035   *         @arg @ref LL_ADC_AWD_CH_VREFINT_REG_INJ         (1)
02036   *         @arg @ref LL_ADC_AWD_CH_TEMPSENSOR_REG       (0)(1)
02037   *         @arg @ref LL_ADC_AWD_CH_TEMPSENSOR_INJ       (0)(1)
02038   *         @arg @ref LL_ADC_AWD_CH_TEMPSENSOR_REG_INJ      (1)
02039   *         @arg @ref LL_ADC_AWD_CH_VBAT_REG             (0)(1)
02040   *         @arg @ref LL_ADC_AWD_CH_VBAT_INJ             (0)(1)
02041   *         @arg @ref LL_ADC_AWD_CH_VBAT_REG_INJ            (1)
02042   *         @arg @ref LL_ADC_AWD_CH_DAC1CH1_ADC2_REG     (0)(2)
02043   *         @arg @ref LL_ADC_AWD_CH_DAC1CH1_ADC2_INJ     (0)(2)
02044   *         @arg @ref LL_ADC_AWD_CH_DAC1CH1_ADC2_REG_INJ    (2)
02045   *         @arg @ref LL_ADC_AWD_CH_DAC1CH2_ADC2_REG     (0)(2)
02046   *         @arg @ref LL_ADC_AWD_CH_DAC1CH2_ADC2_INJ     (0)(2)
02047   *         @arg @ref LL_ADC_AWD_CH_DAC1CH2_ADC2_REG_INJ    (2)
02048   *
02049   *         (0) On STM32H7, parameter available only on analog watchdog number: AWD1.\n
02050   *         (1) On STM32H7, parameter available only on ADC instance: ADC3.\n
02051   *         (2) On STM32H7, parameter available only on ADC instance: ADC2.
02052   */
02053 #define __LL_ADC_ANALOGWD_CHANNEL_GROUP(__CHANNEL__, __GROUP__)                                           \
02054   (((__GROUP__) == LL_ADC_GROUP_REGULAR)                                                                  \
02055     ? (((__CHANNEL__) & ADC_CHANNEL_ID_MASK) | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL)                        \
02056       :                                                                                                   \
02057       ((__GROUP__) == LL_ADC_GROUP_INJECTED)                                                              \
02058        ? (((__CHANNEL__) & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1SGL)                    \
02059          :                                                                                                \
02060          (((__CHANNEL__) & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL)  \
02061   )
02062 
02063 /**
02064   * @brief  Helper macro to set the value of ADC analog watchdog threshold high
02065   *         or low in function of ADC resolution, when ADC resolution is
02066   *         different of 16 bits.
02067   * @note   To be used with function @ref LL_ADC_SetAnalogWDThresholds().
02068   *         Example, with a ADC resolution of 8 bits, to set the value of
02069   *         analog watchdog threshold high (on 18 bits):
02070   *           LL_ADC_SetAnalogWDThresholds
02071   *            (< ADCx param >,
02072   *             __LL_ADC_ANALOGWD_SET_THRESHOLD_RESOLUTION(LL_ADC_RESOLUTION_8B, <threshold_value_18_bits>)
02073   *            );
02074   * @param  __ADC_RESOLUTION__ This parameter can be one of the following values:
02075   *         @arg @ref LL_ADC_RESOLUTION_16B
02076   *         @arg @ref LL_ADC_RESOLUTION_14B
02077   *         @arg @ref LL_ADC_RESOLUTION_12B
02078   *         @arg @ref LL_ADC_RESOLUTION_10B
02079   *         @arg @ref LL_ADC_RESOLUTION_8B
02080   * @param  __AWD_THRESHOLD__ Value between Min_Data=0x000000 and Max_Data=0xFFFFFF
02081   * @retval Value between Min_Data=0x000000 and Max_Data=0xFFFFFF
02082   */
02083 #define __LL_ADC_ANALOGWD_SET_THRESHOLD_RESOLUTION(__ADC_RESOLUTION__, __AWD_THRESHOLD__) \
02084   ((__AWD_THRESHOLD__) << ((__ADC_RESOLUTION__) >> (ADC_CFGR_RES_BITOFFSET_POS - 1U )))
02085 
02086 /**
02087   * @brief  Helper macro to get the value of ADC analog watchdog threshold high
02088   *         or low in function of ADC resolution, when ADC resolution is
02089   *         different of 16 bits.
02090   * @note   To be used with function @ref LL_ADC_GetAnalogWDThresholds().
02091   *         Example, with a ADC resolution of 8 bits, to get the value of
02092   *         analog watchdog threshold high (on 18 bits):
02093   *           < threshold_value_18_bits > = __LL_ADC_ANALOGWD_GET_THRESHOLD_RESOLUTION
02094   *            (LL_ADC_RESOLUTION_8B,
02095   *             LL_ADC_GetAnalogWDThresholds(<ADCx param>, LL_ADC_AWD_THRESHOLD_HIGH)
02096   *            );
02097   * @param  __ADC_RESOLUTION__ This parameter can be one of the following values:
02098   *         @arg @ref LL_ADC_RESOLUTION_16B
02099   *         @arg @ref LL_ADC_RESOLUTION_14B
02100   *         @arg @ref LL_ADC_RESOLUTION_12B
02101   *         @arg @ref LL_ADC_RESOLUTION_10B
02102   *         @arg @ref LL_ADC_RESOLUTION_8B
02103   * @param  __AWD_THRESHOLD_16_BITS__ Value between Min_Data=0x000000 and Max_Data=0xFFFFFF
02104   * @retval Value between Min_Data=0x000000 and Max_Data=0xFFFFFF
02105   */
02106 #define __LL_ADC_ANALOGWD_GET_THRESHOLD_RESOLUTION(__ADC_RESOLUTION__, __AWD_THRESHOLD_16_BITS__) \
02107   ((__AWD_THRESHOLD_16_BITS__) >> ((__ADC_RESOLUTION__) >> (ADC_CFGR_RES_BITOFFSET_POS - 1U )))
02108 
02109 /**
02110   * @brief  Helper macro to set the ADC calibration value with both single ended
02111   *         and differential modes calibration factors concatenated.
02112   * @note   To be used with function @ref LL_ADC_SetCalibrationOffsetFactor().
02113   *         Example, to set calibration factors single ended to 0x55
02114   *         and differential ended to 0x2A:
02115   *           LL_ADC_SetCalibrationOffsetFactor(
02116   *             ADC1,
02117   *             __LL_ADC_CALIB_FACTOR_SINGLE_DIFF(0x55, 0x2A))
02118   * @param  __CALIB_FACTOR_SINGLE_ENDED__ Value between Min_Data=0x00 and Max_Data=0x7F
02119   * @param  __CALIB_FACTOR_DIFFERENTIAL__ Value between Min_Data=0x00 and Max_Data=0x7F
02120   * @retval Value between Min_Data=0x00000000 and Max_Data=0xFFFFFFFF
02121   */
02122 #define __LL_ADC_CALIB_FACTOR_SINGLE_DIFF(__CALIB_FACTOR_SINGLE_ENDED__, __CALIB_FACTOR_DIFFERENTIAL__)        \
02123   (((__CALIB_FACTOR_DIFFERENTIAL__) << ADC_CALFACT_CALFACT_D_Pos) | (__CALIB_FACTOR_SINGLE_ENDED__))
02124 
02125 /**
02126   * @brief  Helper macro to get the ADC multimode conversion data of ADC master
02127   *         or ADC slave from raw value with both ADC conversion data concatenated.
02128   * @note   This macro is intended to be used when multimode transfer by DMA
02129   *         is enabled: refer to function @ref LL_ADC_SetMultiDMATransfer().
02130   *         In this case the transferred data need to processed with this macro
02131   *         to separate the conversion data of ADC master and ADC slave.
02132   * @param  __ADC_MULTI_MASTER_SLAVE__ This parameter can be one of the following values:
02133   *         @arg @ref LL_ADC_MULTI_MASTER
02134   *         @arg @ref LL_ADC_MULTI_SLAVE
02135   * @param  __ADC_MULTI_CONV_DATA__ Value between Min_Data=0x000 and Max_Data=0xFFF
02136   * @retval Value between Min_Data=0x000 and Max_Data=0xFFF
02137   */
02138 #define __LL_ADC_MULTI_CONV_DATA_MASTER_SLAVE(__ADC_MULTI_MASTER_SLAVE__, __ADC_MULTI_CONV_DATA__) \
02139   (((__ADC_MULTI_CONV_DATA__) >> ((ADC_CDR_RDATA_SLV_Pos) & ~(__ADC_MULTI_MASTER_SLAVE__))) & ADC_CDR_RDATA_MST)
02140 
02141 /**
02142   * @brief  Helper macro to select, from a ADC instance, to which ADC instance
02143   *         it has a dependence in multimode (ADC master of the corresponding
02144   *         ADC common instance).
02145   * @note   In case of device with multimode available and a mix of
02146   *         ADC instances compliant and not compliant with multimode feature,
02147   *         ADC instances not compliant with multimode feature are
02148   *         considered as master instances (do not depend to
02149   *         any other ADC instance).
02150   * @param  __ADCx__ ADC instance
02151   * @retval __ADCx__ ADC instance master of the corresponding ADC common instance
02152   */
02153 #define __LL_ADC_MULTI_INSTANCE_MASTER(__ADCx__) \
02154   ( ( ((__ADCx__) == ADC2)                                                     \
02155     )?                                                                         \
02156      (ADC1)                                                                    \
02157      :                                                                         \
02158      (__ADCx__)                                                                \
02159   )
02160 
02161 /**
02162   * @brief  Helper macro to select the ADC common instance
02163   *         to which is belonging the selected ADC instance.
02164   * @note   ADC common register instance can be used for:
02165   *         - Set parameters common to several ADC instances
02166   *         - Multimode (for devices with several ADC instances)
02167   *         Refer to functions having argument "ADCxy_COMMON" as parameter.
02168   * @param  __ADCx__ ADC instance
02169   * @retval ADC common register instance
02170   */
02171 #if defined(ADC3_COMMON)
02172 #define __LL_ADC_COMMON_INSTANCE(__ADCx__)                                     \
02173   ((((__ADCx__) == ADC1) || ((__ADCx__) == ADC2))                              \
02174     ? (                                                                        \
02175        (ADC12_COMMON)                                                          \
02176       )                                                                        \
02177       :                                                                        \
02178       (                                                                        \
02179        (ADC3_COMMON)                                                           \
02180       )                                                                        \
02181   )
02182 #else
02183 #define __LL_ADC_COMMON_INSTANCE(__ADCx__)   (ADC12_COMMON)
02184 #endif
02185 
02186 /**
02187   * @brief  Helper macro to check if all ADC instances sharing the same
02188   *         ADC common instance are disabled.
02189   * @note   This check is required by functions with setting conditioned to
02190   *         ADC state:
02191   *         All ADC instances of the ADC common group must be disabled.
02192   *         Refer to functions having argument "ADCxy_COMMON" as parameter.
02193   * @note   On devices with only 1 ADC common instance, parameter of this macro
02194   *         is useless and can be ignored (parameter kept for compatibility
02195   *         with devices featuring several ADC common instances).
02196   * @param  __ADCXY_COMMON__ ADC common instance
02197   *         (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
02198   * @retval Value "0" if all ADC instances sharing the same ADC common instance
02199   *         are disabled.
02200   *         Value "1" if at least one ADC instance sharing the same ADC common instance
02201   *         is enabled.
02202   */
02203 #if defined(ADC3_COMMON)
02204 #define __LL_ADC_IS_ENABLED_ALL_COMMON_INSTANCE(__ADCXY_COMMON__)              \
02205   (((__ADCXY_COMMON__) == ADC12_COMMON)                                        \
02206     ? (                                                                        \
02207        (LL_ADC_IsEnabled(ADC1) |                                               \
02208         LL_ADC_IsEnabled(ADC2)  )                                              \
02209       )                                                                        \
02210       :                                                                        \
02211       (                                                                        \
02212        (LL_ADC_IsEnabled(ADC3))                                                \
02213       )                                                                        \
02214   )
02215 #else
02216 #define __LL_ADC_IS_ENABLED_ALL_COMMON_INSTANCE(__ADCXY_COMMON__)              \
02217                         (LL_ADC_IsEnabled(ADC1) | LL_ADC_IsEnabled(ADC2))
02218 #endif
02219 
02220 /**
02221   * @brief  Helper macro to define the ADC conversion data full-scale digital
02222   *         value corresponding to the selected ADC resolution.
02223   * @note   ADC conversion data full-scale corresponds to voltage range
02224   *         determined by analog voltage references Vref+ and Vref-
02225   *         (refer to reference manual).
02226   * @param  __ADC_RESOLUTION__ This parameter can be one of the following values:
02227   *         @arg @ref LL_ADC_RESOLUTION_16B
02228   *         @arg @ref LL_ADC_RESOLUTION_14B
02229   *         @arg @ref LL_ADC_RESOLUTION_12B
02230   *         @arg @ref LL_ADC_RESOLUTION_10B
02231   *         @arg @ref LL_ADC_RESOLUTION_8B
02232   * @retval ADC conversion data full-scale digital value (unit: digital value of ADC conversion data)
02233   */
02234 #define __LL_ADC_DIGITAL_SCALE(__ADC_RESOLUTION__)                             \
02235   (0xFFFFUL >> ((__ADC_RESOLUTION__) >> (ADC_CFGR_RES_BITOFFSET_POS - 1UL)))
02236 
02237 #if defined(ADC_VER_V5_V90)
02238 /**
02239   * @brief  Helper macro to define the ADC conversion data full-scale digital
02240   *         value corresponding to the selected ADC resolution.
02241   * @note   ADC conversion data full-scale corresponds to voltage range
02242   *         determined by analog voltage references Vref+ and Vref-
02243   *         (refer to reference manual).
02244   * @param  __ADC_RESOLUTION__ This parameter can be one of the following values:
02245   *         @arg @ref LL_ADC_RESOLUTION_12B
02246   *         @arg @ref LL_ADC_RESOLUTION_10B
02247   *         @arg @ref LL_ADC_RESOLUTION_8B
02248   *         @arg @ref LL_ADC_RESOLUTION_6B
02249   * @retval ADC conversion data equivalent voltage value (unit: digital value of ADC conversion bitfield)
02250   */
02251 #define __LL_ADC3_DIGITAL_SCALE(__ADC_RESOLUTION__)                             \
02252     (0xFFFUL >> ((__ADC_RESOLUTION__) >> (ADC_CFGR_RES_BITOFFSET_POS_ADC3 - 1UL)))
02253 #endif  /* ADC_VER_V5_V90 */
02254 /**
02255   * @brief  Helper macro to convert the ADC conversion data from
02256   *         a resolution to another resolution.
02257   * @param  __DATA__ ADC conversion data to be converted
02258   * @param  __ADC_RESOLUTION_CURRENT__ Resolution of the data to be converted
02259   *         This parameter can be one of the following values:
02260   *         @arg @ref LL_ADC_RESOLUTION_16B
02261   *         @arg @ref LL_ADC_RESOLUTION_14B
02262   *         @arg @ref LL_ADC_RESOLUTION_12B
02263   *         @arg @ref LL_ADC_RESOLUTION_10B
02264   *         @arg @ref LL_ADC_RESOLUTION_8B
02265   * @param  __ADC_RESOLUTION_TARGET__ Resolution of the data after conversion
02266   *         This parameter can be one of the following values:
02267   *         @arg @ref LL_ADC_RESOLUTION_16B
02268   *         @arg @ref LL_ADC_RESOLUTION_14B
02269   *         @arg @ref LL_ADC_RESOLUTION_12B
02270   *         @arg @ref LL_ADC_RESOLUTION_10B
02271   *         @arg @ref LL_ADC_RESOLUTION_8B
02272   * @retval ADC conversion data to the requested resolution
02273   */
02274 #if defined(ADC_VER_V5_X) || defined(ADC_VER_V5_V90)
02275 #define __LL_ADC_CONVERT_DATA_RESOLUTION(__DATA__,\
02276                                          __ADC_RESOLUTION_CURRENT__,\
02277                                          __ADC_RESOLUTION_TARGET__) \
02278 ( (__ADC_RESOLUTION_CURRENT__ == LL_ADC_RESOLUTION_8B)                                                               \
02279   ?(                                                                                                                 \
02280     ((__DATA__)                                                                                                      \
02281     << (((__ADC_RESOLUTION_CURRENT__) & ~(ADC_CFGR_RES_1 | ADC_CFGR_RES_0) ) >> (ADC_CFGR_RES_BITOFFSET_POS - 1UL)))  \
02282    >> ((__ADC_RESOLUTION_TARGET__) >> (ADC_CFGR_RES_BITOFFSET_POS - 1UL))                                            \
02283    )                                                                                                                 \
02284   :                                                                                                                  \
02285    (                                                                                                                 \
02286      (__ADC_RESOLUTION_TARGET__ == LL_ADC_RESOLUTION_8B) \
02287        ? ( \
02288            ((__DATA__)                                                                                                      \
02289             << ((__ADC_RESOLUTION_CURRENT__) >> (ADC_CFGR_RES_BITOFFSET_POS - 1UL)))                                         \
02290            >> (((__ADC_RESOLUTION_TARGET__) & ~(ADC_CFGR_RES_1 | ADC_CFGR_RES_0) ) >> (ADC_CFGR_RES_BITOFFSET_POS - 1UL))    \
02291            )                                                                                                                 \
02292          :\
02293           (\
02294     ((__DATA__)                                                                                                      \
02295     << ((__ADC_RESOLUTION_CURRENT__) >> (ADC_CFGR_RES_BITOFFSET_POS - 1UL)))                                         \
02296     >> ((__ADC_RESOLUTION_TARGET__) >> (ADC_CFGR_RES_BITOFFSET_POS - 1UL))                                            \
02297      )                                                                                                                 \
02298    )\
02299  )
02300 
02301 
02302 #else /* defined(ADC_VER_V5_3) */
02303 #define __LL_ADC_CONVERT_DATA_RESOLUTION(__DATA__,\
02304                                          __ADC_RESOLUTION_CURRENT__,\
02305                                          __ADC_RESOLUTION_TARGET__) \
02306 ( (__ADC_RESOLUTION_CURRENT__ == LL_ADC_RESOLUTION_8B)                                                               \
02307   ?(                                                                                                                 \
02308     ((__DATA__)                                                                                                      \
02309     << (((__ADC_RESOLUTION_CURRENT__) & ~(ADC_CFGR_RES_1 | ADC_CFGR_RES_0) ) >> (ADC_CFGR_RES_BITOFFSET_POS - 1UL)))  \
02310    >> ((__ADC_RESOLUTION_TARGET__) >> (ADC_CFGR_RES_BITOFFSET_POS - 1UL))                                            \
02311    )                                                                                                                 \
02312   :                                                                                                                  \
02313    (                                                                                                                 \
02314      (__ADC_RESOLUTION_TARGET__ == LL_ADC_RESOLUTION_8B) \
02315        ? ( \
02316            ((__DATA__)                                                                                                      \
02317             << ((__ADC_RESOLUTION_CURRENT__) >> (ADC_CFGR_RES_BITOFFSET_POS - 1UL)))                                         \
02318            >> (((__ADC_RESOLUTION_TARGET__) & ~(ADC_CFGR_RES_1 | ADC_CFGR_RES_0) ) >> (ADC_CFGR_RES_BITOFFSET_POS - 1UL))                                            \
02319            )                                                                                                                 \
02320          :\
02321           (\
02322     ((__DATA__)                                                                                                      \
02323     << ((__ADC_RESOLUTION_CURRENT__) >> (ADC_CFGR_RES_BITOFFSET_POS - 1UL)))                                         \
02324     >> ((__ADC_RESOLUTION_TARGET__) >> (ADC_CFGR_RES_BITOFFSET_POS - 1UL))                                            \
02325      )                                                                                                                 \
02326    )\
02327  )
02328 
02329 #endif
02330 
02331 #if defined(ADC_VER_V5_V90)
02332 /**
02333 * @brief  Helper macro to convert the ADC conversion data from
02334 *         a resolution to another resolution.
02335 * @param  __DATA__ ADC conversion data to be converted
02336 * @param  __ADC_RESOLUTION_CURRENT__ Resolution of the data to be converted
02337 *         This parameter can be one of the following values:
02338 *         @arg @ref LL_ADC_RESOLUTION_12B
02339 *         @arg @ref LL_ADC_RESOLUTION_10B
02340 *         @arg @ref LL_ADC_RESOLUTION_8B
02341 *         @arg @ref LL_ADC_RESOLUTION_6B
02342 * @param  __ADC_RESOLUTION_TARGET__ Resolution of the data after conversion
02343 *         This parameter can be one of the following values:
02344 *         @arg @ref LL_ADC_RESOLUTION_12B
02345 *         @arg @ref LL_ADC_RESOLUTION_10B
02346 *         @arg @ref LL_ADC_RESOLUTION_8B
02347 *         @arg @ref LL_ADC_RESOLUTION_6B
02348 * @retval ADC conversion data to the requested resolution
02349 */
02350 #define __LL_ADC_CONVERT_DATA_RESOLUTION_ADC3(__DATA__,\
02351                                          __ADC_RESOLUTION_CURRENT__,\
02352                                          __ADC_RESOLUTION_TARGET__)            \
02353   (((__DATA__)                                                                 \
02354     << ((__ADC_RESOLUTION_CURRENT__) >> (ADC_CFGR_RES_BITOFFSET_POS_ADC3 - 1UL)))  \
02355    >> ((__ADC_RESOLUTION_TARGET__) >> (ADC_CFGR_RES_BITOFFSET_POS_ADC3 - 1UL))     \
02356   )
02357 #endif  /* ADC_VER_V5_V90 */
02358 /**
02359   * @brief  Helper macro to calculate the voltage (unit: mVolt)
02360   *         corresponding to a ADC conversion data (unit: digital value).
02361   * @note   Analog reference voltage (Vref+) must be either known from
02362   *         user board environment or can be calculated using ADC measurement
02363   *         and ADC helper macro @ref __LL_ADC_CALC_VREFANALOG_VOLTAGE().
02364   * @param  __VREFANALOG_VOLTAGE__ Analog reference voltage (unit: mV)
02365   * @param  __ADC_DATA__ ADC conversion data (resolution 16 bits)
02366   *                       (unit: digital value).
02367   * @param  __ADC_RESOLUTION__ This parameter can be one of the following values:
02368   *         @arg @ref LL_ADC_RESOLUTION_16B
02369   *         @arg @ref LL_ADC_RESOLUTION_14B
02370   *         @arg @ref LL_ADC_RESOLUTION_12B
02371   *         @arg @ref LL_ADC_RESOLUTION_10B
02372   *         @arg @ref LL_ADC_RESOLUTION_8B
02373   * @retval ADC conversion data equivalent voltage value (unit: mVolt)
02374   */
02375 #define __LL_ADC_CALC_DATA_TO_VOLTAGE(__VREFANALOG_VOLTAGE__,\
02376                                       __ADC_DATA__,\
02377                                       __ADC_RESOLUTION__)                      \
02378   ((__ADC_DATA__) * (__VREFANALOG_VOLTAGE__)                                   \
02379    / __LL_ADC_DIGITAL_SCALE(__ADC_RESOLUTION__)                                \
02380   )
02381 
02382 /**
02383   * @brief  Helper macro to calculate analog reference voltage (Vref+)
02384   *         (unit: mVolt) from ADC conversion data of internal voltage
02385   *         reference VrefInt.
02386   * @note   Computation is using VrefInt calibration value
02387   *         stored in system memory for each device during production.
02388   * @note   This voltage depends on user board environment: voltage level
02389   *         connected to pin Vref+.
02390   *         On devices with small package, the pin Vref+ is not present
02391   *         and internally bonded to pin Vdda.
02392   * @note   On this STM32 series, calibration data of internal voltage reference
02393   *         VrefInt corresponds to a resolution of 16 bits,
02394   *         this is the recommended ADC resolution to convert voltage of
02395   *         internal voltage reference VrefInt.
02396   *         Otherwise, this macro performs the processing to scale
02397   *         ADC conversion data to 16 bits.
02398   * @param  __VREFINT_ADC_DATA__ ADC conversion data (resolution 16 bits)
02399   *         of internal voltage reference VrefInt (unit: digital value).
02400   * @param  __ADC_RESOLUTION__ This parameter can be one of the following values:
02401   *         @arg @ref LL_ADC_RESOLUTION_16B
02402   *         @arg @ref LL_ADC_RESOLUTION_14B
02403   *         @arg @ref LL_ADC_RESOLUTION_12B
02404   *         @arg @ref LL_ADC_RESOLUTION_10B
02405   *         @arg @ref LL_ADC_RESOLUTION_8B
02406   * @retval Analog reference voltage (unit: mV)
02407   */
02408 #define __LL_ADC_CALC_VREFANALOG_VOLTAGE(__VREFINT_ADC_DATA__,\
02409                                          __ADC_RESOLUTION__)                   \
02410   (((uint32_t)(*VREFINT_CAL_ADDR) * VREFINT_CAL_VREF)                          \
02411     / __LL_ADC_CONVERT_DATA_RESOLUTION((__VREFINT_ADC_DATA__),                 \
02412                                        (__ADC_RESOLUTION__),                   \
02413                                        LL_ADC_RESOLUTION_16B)                  \
02414   )
02415 
02416 /**
02417   * @brief  Helper macro to calculate the temperature (unit: degree Celsius)
02418   *         from ADC conversion data of internal temperature sensor.
02419   * @note   Computation is using temperature sensor calibration values
02420   *         stored in system memory for each device during production.
02421   * @note   Calculation formula:
02422   *           Temperature = ((TS_ADC_DATA - TS_CAL1)
02423   *                           * (TS_CAL2_TEMP - TS_CAL1_TEMP))
02424   *                         / (TS_CAL2 - TS_CAL1) + TS_CAL1_TEMP
02425   *           with TS_ADC_DATA = temperature sensor raw data measured by ADC
02426   *                Avg_Slope = (TS_CAL2 - TS_CAL1)
02427   *                            / (TS_CAL2_TEMP - TS_CAL1_TEMP)
02428   *                TS_CAL1   = equivalent TS_ADC_DATA at temperature
02429   *                            TEMP_DEGC_CAL1 (calibrated in factory)
02430   *                TS_CAL2   = equivalent TS_ADC_DATA at temperature
02431   *                            TEMP_DEGC_CAL2 (calibrated in factory)
02432   *         Caution: Calculation relevancy under reserve that calibration
02433   *                  parameters are correct (address and data).
02434   *                  To calculate temperature using temperature sensor
02435   *                  datasheet typical values (generic values less, therefore
02436   *                  less accurate than calibrated values),
02437   *                  use helper macro @ref __LL_ADC_CALC_TEMPERATURE_TYP_PARAMS().
02438   * @note   As calculation input, the analog reference voltage (Vref+) must be
02439   *         defined as it impacts the ADC LSB equivalent voltage.
02440   * @note   Analog reference voltage (Vref+) must be either known from
02441   *         user board environment or can be calculated using ADC measurement
02442   *         and ADC helper macro @ref __LL_ADC_CALC_VREFANALOG_VOLTAGE().
02443   * @note   On this STM32 series, calibration data of temperature sensor
02444   *         corresponds to a resolution of 16 bits,
02445   *         this is the recommended ADC resolution to convert voltage of
02446   *         temperature sensor.
02447   *         Otherwise, this macro performs the processing to scale
02448   *         ADC conversion data to 16 bits.
02449   * @param  __VREFANALOG_VOLTAGE__  Analog reference voltage (unit: mV)
02450   * @param  __TEMPSENSOR_ADC_DATA__ ADC conversion data of internal
02451   *                                 temperature sensor (unit: digital value).
02452   * @param  __ADC_RESOLUTION__      ADC resolution at which internal temperature
02453   *                                 sensor voltage has been measured.
02454   *         This parameter can be one of the following values:
02455   *         @arg @ref LL_ADC_RESOLUTION_16B
02456   *         @arg @ref LL_ADC_RESOLUTION_14B
02457   *         @arg @ref LL_ADC_RESOLUTION_12B
02458   *         @arg @ref LL_ADC_RESOLUTION_10B
02459   *         @arg @ref LL_ADC_RESOLUTION_8B
02460   * @retval Temperature (unit: degree Celsius)
02461   */
02462 #define __LL_ADC_CALC_TEMPERATURE(__VREFANALOG_VOLTAGE__,\
02463                                   __TEMPSENSOR_ADC_DATA__,\
02464                                   __ADC_RESOLUTION__)                              \
02465   (((( ((int32_t)((__LL_ADC_CONVERT_DATA_RESOLUTION((__TEMPSENSOR_ADC_DATA__),     \
02466                                                     (__ADC_RESOLUTION__),          \
02467                                                     LL_ADC_RESOLUTION_16B)         \
02468                    * (__VREFANALOG_VOLTAGE__))                                     \
02469                   / TEMPSENSOR_CAL_VREFANALOG)                                     \
02470         - (int32_t) *TEMPSENSOR_CAL1_ADDR)                                         \
02471      ) * (int32_t)(TEMPSENSOR_CAL2_TEMP - TEMPSENSOR_CAL1_TEMP)                    \
02472     ) / (int32_t)((int32_t)*TEMPSENSOR_CAL2_ADDR - (int32_t)*TEMPSENSOR_CAL1_ADDR) \
02473    ) + TEMPSENSOR_CAL1_TEMP                                                        \
02474   )
02475 
02476 /**
02477   * @brief  Helper macro to calculate the temperature (unit: degree Celsius)
02478   *         from ADC conversion data of internal temperature sensor.
02479   * @note   Computation is using temperature sensor typical values
02480   *         (refer to device datasheet).
02481   * @note   Calculation formula:
02482   *           Temperature = (TS_TYP_CALx_VOLT(uV) - TS_ADC_DATA * Conversion_uV)
02483   *                         / Avg_Slope + CALx_TEMP
02484   *           with TS_ADC_DATA      = temperature sensor raw data measured by ADC
02485   *                                   (unit: digital value)
02486   *                Avg_Slope        = temperature sensor slope
02487   *                                   (unit: uV/Degree Celsius)
02488   *                TS_TYP_CALx_VOLT = temperature sensor digital value at
02489   *                                   temperature CALx_TEMP (unit: mV)
02490   *         Caution: Calculation relevancy under reserve the temperature sensor
02491   *                  of the current device has characteristics in line with
02492   *                  datasheet typical values.
02493   *                  If temperature sensor calibration values are available on
02494   *                  on this device (presence of macro __LL_ADC_CALC_TEMPERATURE()),
02495   *                  temperature calculation will be more accurate using
02496   *                  helper macro @ref __LL_ADC_CALC_TEMPERATURE().
02497   * @note   As calculation input, the analog reference voltage (Vref+) must be
02498   *         defined as it impacts the ADC LSB equivalent voltage.
02499   * @note   Analog reference voltage (Vref+) must be either known from
02500   *         user board environment or can be calculated using ADC measurement
02501   *         and ADC helper macro @ref __LL_ADC_CALC_VREFANALOG_VOLTAGE().
02502   * @note   ADC measurement data must correspond to a resolution of 16 bits
02503   *         (full scale digital value 4095). If not the case, the data must be
02504   *         preliminarily rescaled to an equivalent resolution of 16 bits.
02505   * @param  __TEMPSENSOR_TYP_AVGSLOPE__   Device datasheet data: Temperature sensor slope typical value (unit: uV/DegCelsius).
02506   *                                       On STM32H7, refer to device datasheet parameter "Avg_Slope".
02507   * @param  __TEMPSENSOR_TYP_CALX_V__     Device datasheet data: Temperature sensor voltage typical value (at temperature and Vref+ defined in parameters below) (unit: mV).
02508   *                                       On STM32H7, refer to device datasheet parameter "V30" (corresponding to TS_CAL1).
02509   * @param  __TEMPSENSOR_CALX_TEMP__      Device datasheet data: Temperature at which temperature sensor voltage (see parameter above) is corresponding (unit: mV)
02510   * @param  __VREFANALOG_VOLTAGE__        Analog voltage reference (Vref+) voltage (unit: mV)
02511   * @param  __TEMPSENSOR_ADC_DATA__       ADC conversion data of internal temperature sensor (unit: digital value).
02512   * @param  __ADC_RESOLUTION__            ADC resolution at which internal temperature sensor voltage has been measured.
02513   *         This parameter can be one of the following values:
02514   *         @arg @ref LL_ADC_RESOLUTION_16B
02515   *         @arg @ref LL_ADC_RESOLUTION_14B
02516   *         @arg @ref LL_ADC_RESOLUTION_12B
02517   *         @arg @ref LL_ADC_RESOLUTION_10B
02518   *         @arg @ref LL_ADC_RESOLUTION_8B
02519   * @retval Temperature (unit: degree Celsius)
02520   */
02521 #define __LL_ADC_CALC_TEMPERATURE_TYP_PARAMS(__TEMPSENSOR_TYP_AVGSLOPE__,\
02522                                              __TEMPSENSOR_TYP_CALX_V__,\
02523                                              __TEMPSENSOR_CALX_TEMP__,\
02524                                              __VREFANALOG_VOLTAGE__,\
02525                                              __TEMPSENSOR_ADC_DATA__,\
02526                                              __ADC_RESOLUTION__)               \
02527   ((( (                                                                        \
02528        (int32_t)((((__TEMPSENSOR_ADC_DATA__) * (__VREFANALOG_VOLTAGE__))       \
02529                   / __LL_ADC_DIGITAL_SCALE(__ADC_RESOLUTION__))                \
02530                  * 1000UL)                                                     \
02531        -                                                                       \
02532        (int32_t)(((__TEMPSENSOR_TYP_CALX_V__))                                 \
02533                  * 1000UL)                                                     \
02534       )                                                                        \
02535     ) / (int32_t)(__TEMPSENSOR_TYP_AVGSLOPE__)                                 \
02536    ) + (int32_t)(__TEMPSENSOR_CALX_TEMP__)                                     \
02537   )
02538 
02539 /**
02540   * @}
02541   */
02542 
02543 /**
02544   * @}
02545   */
02546 
02547 
02548 /* Exported functions --------------------------------------------------------*/
02549 /** @defgroup ADC_LL_Exported_Functions ADC Exported Functions
02550   * @{
02551   */
02552 
02553 /** @defgroup ADC_LL_EF_DMA_Management ADC DMA management
02554   * @{
02555   */
02556 
02557 /**
02558   * @brief  Function to help to configure DMA transfer from ADC: retrieve the
02559   *         ADC register address from ADC instance and a list of ADC registers
02560   *         intended to be used (most commonly) with DMA transfer.
02561   * @note   These ADC registers are data registers:
02562   *         when ADC conversion data is available in ADC data registers,
02563   *         ADC generates a DMA transfer request.
02564   * @note   This macro is intended to be used with LL DMA driver, refer to
02565   *         function "LL_DMA_ConfigAddresses()".
02566   *         Example:
02567   *           LL_DMA_ConfigAddresses(DMA1,
02568   *                                  LL_DMA_CHANNEL_1,
02569   *                                  LL_ADC_DMA_GetRegAddr(ADC1, LL_ADC_DMA_REG_REGULAR_DATA),
02570   *                                  (uint32_t)&< array or variable >,
02571   *                                  LL_DMA_DIRECTION_PERIPH_TO_MEMORY);
02572   * @note   For devices with several ADC: in multimode, some devices
02573   *         use a different data register outside of ADC instance scope
02574   *         (common data register). This macro manages this register difference,
02575   *         only ADC instance has to be set as parameter.
02576   * @rmtoll DR       RDATA          LL_ADC_DMA_GetRegAddr\n
02577   *         CDR      RDATA_MST      LL_ADC_DMA_GetRegAddr\n
02578   *         CDR      RDATA_SLV      LL_ADC_DMA_GetRegAddr
02579   * @param  ADCx ADC instance
02580   * @param  Register This parameter can be one of the following values:
02581   *         @arg @ref LL_ADC_DMA_REG_REGULAR_DATA
02582   *         @arg @ref LL_ADC_DMA_REG_REGULAR_DATA_MULTI (1)
02583   *
02584   *         (1) Available on devices with several ADC instances.
02585   * @retval ADC register address
02586   */
02587 __STATIC_INLINE uint32_t LL_ADC_DMA_GetRegAddr(ADC_TypeDef *ADCx, uint32_t Register)
02588 {
02589   uint32_t data_reg_addr;
02590 
02591   if (Register == LL_ADC_DMA_REG_REGULAR_DATA)
02592   {
02593     /* Retrieve address of register DR */
02594     data_reg_addr = (uint32_t) & (ADCx->DR);
02595   }
02596   else /* (Register == LL_ADC_DMA_REG_REGULAR_DATA_MULTI) */
02597   {
02598     /* Retrieve address of register CDR */
02599     data_reg_addr = (uint32_t) & ((__LL_ADC_COMMON_INSTANCE(ADCx))->CDR);
02600   }
02601 
02602   return data_reg_addr;
02603 }
02604 
02605 /**
02606   * @}
02607   */
02608 
02609 /** @defgroup ADC_LL_EF_Configuration_ADC_Common Configuration of ADC hierarchical scope: common to several ADC instances
02610   * @{
02611   */
02612 
02613 /**
02614   * @brief  Set parameter common to several ADC: Clock source and prescaler.
02615   * @note   On this STM32 series, if ADC group injected is used, some
02616   *         clock ratio constraints between ADC clock and AHB clock
02617   *         must be respected.
02618   *         Refer to reference manual.
02619   * @note   On this STM32 series, setting of this feature is conditioned to
02620   *         ADC state:
02621   *         All ADC instances of the ADC common group must be disabled.
02622   *         This check can be done with function @ref LL_ADC_IsEnabled() for each
02623   *         ADC instance or by using helper macro helper macro
02624   *         @ref __LL_ADC_IS_ENABLED_ALL_COMMON_INSTANCE().
02625   * @rmtoll CCR      CKMODE         LL_ADC_SetCommonClock\n
02626   *         CCR      PRESC          LL_ADC_SetCommonClock
02627   * @param  ADCxy_COMMON ADC common instance
02628   *         (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
02629   * @param  CommonClock This parameter can be one of the following values:
02630   *         @arg @ref LL_ADC_CLOCK_SYNC_PCLK_DIV1
02631   *         @arg @ref LL_ADC_CLOCK_SYNC_PCLK_DIV2
02632   *         @arg @ref LL_ADC_CLOCK_SYNC_PCLK_DIV4
02633   *         @arg @ref LL_ADC_CLOCK_ASYNC_DIV1
02634   *         @arg @ref LL_ADC_CLOCK_ASYNC_DIV2
02635   *         @arg @ref LL_ADC_CLOCK_ASYNC_DIV4
02636   *         @arg @ref LL_ADC_CLOCK_ASYNC_DIV6
02637   *         @arg @ref LL_ADC_CLOCK_ASYNC_DIV8
02638   *         @arg @ref LL_ADC_CLOCK_ASYNC_DIV10
02639   *         @arg @ref LL_ADC_CLOCK_ASYNC_DIV12
02640   *         @arg @ref LL_ADC_CLOCK_ASYNC_DIV16
02641   *         @arg @ref LL_ADC_CLOCK_ASYNC_DIV32
02642   *         @arg @ref LL_ADC_CLOCK_ASYNC_DIV64
02643   *         @arg @ref LL_ADC_CLOCK_ASYNC_DIV128
02644   *         @arg @ref LL_ADC_CLOCK_ASYNC_DIV256
02645   * @retval None
02646   */
02647 __STATIC_INLINE void LL_ADC_SetCommonClock(ADC_Common_TypeDef *ADCxy_COMMON, uint32_t CommonClock)
02648 {
02649   MODIFY_REG(ADCxy_COMMON->CCR, ADC_CCR_CKMODE | ADC_CCR_PRESC, CommonClock);
02650 }
02651 
02652 /**
02653   * @brief  Get parameter common to several ADC: Clock source and prescaler.
02654   * @rmtoll CCR      CKMODE         LL_ADC_GetCommonClock\n
02655   *         CCR      PRESC          LL_ADC_GetCommonClock
02656   * @param  ADCxy_COMMON ADC common instance
02657   *         (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
02658   * @retval Returned value can be one of the following values:
02659   *         @arg @ref LL_ADC_CLOCK_SYNC_PCLK_DIV1
02660   *         @arg @ref LL_ADC_CLOCK_SYNC_PCLK_DIV2
02661   *         @arg @ref LL_ADC_CLOCK_SYNC_PCLK_DIV4
02662   *         @arg @ref LL_ADC_CLOCK_ASYNC_DIV1
02663   *         @arg @ref LL_ADC_CLOCK_ASYNC_DIV2
02664   *         @arg @ref LL_ADC_CLOCK_ASYNC_DIV4
02665   *         @arg @ref LL_ADC_CLOCK_ASYNC_DIV6
02666   *         @arg @ref LL_ADC_CLOCK_ASYNC_DIV8
02667   *         @arg @ref LL_ADC_CLOCK_ASYNC_DIV10
02668   *         @arg @ref LL_ADC_CLOCK_ASYNC_DIV12
02669   *         @arg @ref LL_ADC_CLOCK_ASYNC_DIV16
02670   *         @arg @ref LL_ADC_CLOCK_ASYNC_DIV32
02671   *         @arg @ref LL_ADC_CLOCK_ASYNC_DIV64
02672   *         @arg @ref LL_ADC_CLOCK_ASYNC_DIV128
02673   *         @arg @ref LL_ADC_CLOCK_ASYNC_DIV256
02674   */
02675 __STATIC_INLINE uint32_t LL_ADC_GetCommonClock(ADC_Common_TypeDef *ADCxy_COMMON)
02676 {
02677   return (uint32_t)(READ_BIT(ADCxy_COMMON->CCR, ADC_CCR_CKMODE | ADC_CCR_PRESC));
02678 }
02679 
02680 /**
02681   * @brief  Set parameter common to several ADC: measurement path to internal
02682   *         channels (VrefInt, temperature sensor, ...).
02683   * @note   One or several values can be selected.
02684   *         Example: (LL_ADC_PATH_INTERNAL_VREFINT |
02685   *                   LL_ADC_PATH_INTERNAL_TEMPSENSOR)
02686   * @note   Stabilization time of measurement path to internal channel:
02687   *         After enabling internal paths, before starting ADC conversion,
02688   *         a delay is required for internal voltage reference and
02689   *         temperature sensor stabilization time.
02690   *         Refer to device datasheet.
02691   *         Refer to literal @ref LL_ADC_DELAY_VREFINT_STAB_US.
02692   *         Refer to literal @ref LL_ADC_DELAY_TEMPSENSOR_STAB_US.
02693   * @note   ADC internal channel sampling time constraint:
02694   *         For ADC conversion of internal channels,
02695   *         a sampling time minimum value is required.
02696   *         Refer to device datasheet.
02697   * @note   On this STM32 series, setting of this feature is conditioned to
02698   *         ADC state:
02699   *         All ADC instances of the ADC common group must be disabled.
02700   *         This check can be done with function @ref LL_ADC_IsEnabled() for each
02701   *         ADC instance or by using helper macro helper macro
02702   *         @ref __LL_ADC_IS_ENABLED_ALL_COMMON_INSTANCE().
02703   * @rmtoll CCR      VREFEN         LL_ADC_SetCommonPathInternalCh\n
02704   *         CCR      TSEN           LL_ADC_SetCommonPathInternalCh\n
02705   *         CCR      VBATEN         LL_ADC_SetCommonPathInternalCh
02706   * @param  ADCxy_COMMON ADC common instance
02707   *         (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
02708   * @param  PathInternal This parameter can be a combination of the following values:
02709   *         @arg @ref LL_ADC_PATH_INTERNAL_NONE
02710   *         @arg @ref LL_ADC_PATH_INTERNAL_VREFINT
02711   *         @arg @ref LL_ADC_PATH_INTERNAL_TEMPSENSOR
02712   *         @arg @ref LL_ADC_PATH_INTERNAL_VBAT
02713   * @retval None
02714   */
02715 __STATIC_INLINE void LL_ADC_SetCommonPathInternalCh(ADC_Common_TypeDef *ADCxy_COMMON, uint32_t PathInternal)
02716 {
02717   MODIFY_REG(ADCxy_COMMON->CCR, ADC_CCR_VREFEN | ADC_CCR_TSEN | ADC_CCR_VBATEN, PathInternal);
02718 }
02719 
02720 /**
02721   * @brief  Get parameter common to several ADC: measurement path to internal
02722   *         channels (VrefInt, temperature sensor, ...).
02723   * @note   One or several values can be selected.
02724   *         Example: (LL_ADC_PATH_INTERNAL_VREFINT |
02725   *                   LL_ADC_PATH_INTERNAL_TEMPSENSOR)
02726   * @rmtoll CCR      VREFEN         LL_ADC_GetCommonPathInternalCh\n
02727   *         CCR      TSEN           LL_ADC_GetCommonPathInternalCh\n
02728   *         CCR      VBATEN         LL_ADC_GetCommonPathInternalCh
02729   * @param  ADCxy_COMMON ADC common instance
02730   *         (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
02731   * @retval Returned value can be a combination of the following values:
02732   *         @arg @ref LL_ADC_PATH_INTERNAL_NONE
02733   *         @arg @ref LL_ADC_PATH_INTERNAL_VREFINT
02734   *         @arg @ref LL_ADC_PATH_INTERNAL_TEMPSENSOR
02735   *         @arg @ref LL_ADC_PATH_INTERNAL_VBAT
02736   */
02737 __STATIC_INLINE uint32_t LL_ADC_GetCommonPathInternalCh(ADC_Common_TypeDef *ADCxy_COMMON)
02738 {
02739   return (uint32_t)(READ_BIT(ADCxy_COMMON->CCR, ADC_CCR_VREFEN | ADC_CCR_TSEN | ADC_CCR_VBATEN));
02740 }
02741 
02742 /**
02743   * @brief  Set parameter common to several ADC: measurement path to
02744   *         internal channels (VrefInt, temperature sensor, ...).
02745   *         Add paths to the current configuration.
02746   * @note   One or several values can be selected.
02747   *         Example: (LL_ADC_PATH_INTERNAL_VREFINT |
02748   *                   LL_ADC_PATH_INTERNAL_TEMPSENSOR)
02749   * @note   Stabilization time of measurement path to internal channel:
02750   *         After enabling internal paths, before starting ADC conversion,
02751   *         a delay is required for internal voltage reference and
02752   *         temperature sensor stabilization time.
02753   *         Refer to device datasheet.
02754   *         Refer to literal @ref LL_ADC_DELAY_VREFINT_STAB_US.
02755   *         Refer to literal @ref LL_ADC_DELAY_TEMPSENSOR_STAB_US.
02756   * @note   ADC internal channel sampling time constraint:
02757   *         For ADC conversion of internal channels,
02758   *         a sampling time minimum value is required.
02759   *         Refer to device datasheet.
02760   * @rmtoll CCR      VREFEN         LL_ADC_SetCommonPathInternalChAdd\n
02761   *         CCR      TSEN           LL_ADC_SetCommonPathInternalChAdd\n
02762   *         CCR      VBATEN        LL_ADC_SetCommonPathInternalChAdd
02763   * @param  ADCxy_COMMON ADC common instance
02764   *         (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
02765   * @param  PathInternal This parameter can be a combination of the following values:
02766   *         @arg @ref LL_ADC_PATH_INTERNAL_NONE
02767   *         @arg @ref LL_ADC_PATH_INTERNAL_VREFINT
02768   *         @arg @ref LL_ADC_PATH_INTERNAL_TEMPSENSOR
02769   *         @arg @ref LL_ADC_PATH_INTERNAL_VBAT
02770   * @retval None
02771   */
02772 __STATIC_INLINE void LL_ADC_SetCommonPathInternalChAdd(ADC_Common_TypeDef *ADCxy_COMMON, uint32_t PathInternal)
02773 {
02774   SET_BIT(ADCxy_COMMON->CCR, PathInternal);
02775 }
02776 
02777 /**
02778   * @brief  Set parameter common to several ADC: measurement path to
02779   *         internal channels (VrefInt, temperature sensor, ...).
02780   *         Remove paths to the current configuration.
02781   * @note   One or several values can be selected.
02782   *         Example: (LL_ADC_PATH_INTERNAL_VREFINT |
02783   *                   LL_ADC_PATH_INTERNAL_TEMPSENSOR)
02784   * @rmtoll CCR      VREFEN         LL_ADC_SetCommonPathInternalChRem\n
02785   *         CCR      TSEN           LL_ADC_SetCommonPathInternalChRem\n
02786   *         CCR      VBATEN        LL_ADC_SetCommonPathInternalChRem
02787   * @param  ADCxy_COMMON ADC common instance
02788   *         (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
02789   * @param  PathInternal This parameter can be a combination of the following values:
02790   *         @arg @ref LL_ADC_PATH_INTERNAL_NONE
02791   *         @arg @ref LL_ADC_PATH_INTERNAL_VREFINT
02792   *         @arg @ref LL_ADC_PATH_INTERNAL_TEMPSENSOR
02793   *         @arg @ref LL_ADC_PATH_INTERNAL_VBAT
02794   * @retval None
02795   */
02796 __STATIC_INLINE void LL_ADC_SetCommonPathInternalChRem(ADC_Common_TypeDef *ADCxy_COMMON, uint32_t PathInternal)
02797 {
02798   CLEAR_BIT(ADCxy_COMMON->CCR, PathInternal);
02799 }
02800 
02801 /**
02802   * @}
02803   */
02804 
02805 /** @defgroup ADC_LL_EF_Configuration_ADC_Instance Configuration of ADC hierarchical scope: ADC instance
02806   * @{
02807   */
02808 
02809 /**
02810   * @brief  Set ADC calibration factor in the mode single-ended
02811   *         or differential (for devices with differential mode available).
02812   * @note   This function is intended to set calibration parameters
02813   *         without having to perform a new calibration using
02814   *         @ref LL_ADC_StartCalibration().
02815   * @note   For devices with differential mode available:
02816   *         Calibration of offset is specific to each of
02817   *         single-ended and differential modes
02818   *         (calibration factor must be specified for each of these
02819   *         differential modes, if used afterwards and if the application
02820   *         requires their calibration).
02821   *         Calibration of linearity is common to both
02822   *         single-ended and differential modes
02823   *         (calibration factor can be specified only once).
02824   * @note   In case of setting calibration factors of both modes single ended
02825   *         and differential (parameter LL_ADC_BOTH_SINGLE_DIFF_ENDED):
02826   *         both calibration factors must be concatenated.
02827   *         To perform this processing, use helper macro
02828   *         @ref __LL_ADC_CALIB_FACTOR_SINGLE_DIFF().
02829   * @note   On this STM32 series, setting of this feature is conditioned to
02830   *         ADC state:
02831   *         ADC must be enabled, without calibration on going, without conversion
02832   *         on going on group regular.
02833   * @rmtoll CALFACT  CALFACT_S      LL_ADC_SetCalibrationOffsetFactor\n
02834   *         CALFACT  CALFACT_D      LL_ADC_SetCalibrationOffsetFactor
02835   * @param  ADCx ADC instance
02836   * @param  SingleDiff This parameter can be one of the following values:
02837   *         @arg @ref LL_ADC_SINGLE_ENDED
02838   *         @arg @ref LL_ADC_DIFFERENTIAL_ENDED
02839   *         @arg @ref LL_ADC_BOTH_SINGLE_DIFF_ENDED
02840   * @param  CalibrationFactor Value between Min_Data=0x00 and Max_Data=0x7F
02841   * @retval None
02842   */
02843 __STATIC_INLINE void LL_ADC_SetCalibrationOffsetFactor(ADC_TypeDef *ADCx, uint32_t SingleDiff, uint32_t CalibrationFactor)
02844 {
02845 #if defined(ADC_VER_V5_V90)  
02846   MODIFY_REG(ADCx->CALFACT_RES13,
02847              SingleDiff & ADC_SINGLEDIFF_CALIB_FACTOR_MASK,
02848              CalibrationFactor << (((SingleDiff & ADC_SINGLEDIFF_CALIB_F_BIT_D_MASK) >> ADC_SINGLEDIFF_CALIB_F_BIT_D_SHIFT4) & ~(SingleDiff & ADC_CALFACT_CALFACT_S)));
02849 #else
02850   MODIFY_REG(ADCx->CALFACT,
02851              SingleDiff & ADC_SINGLEDIFF_CALIB_FACTOR_MASK,
02852              CalibrationFactor << (((SingleDiff & ADC_SINGLEDIFF_CALIB_F_BIT_D_MASK) >> ADC_SINGLEDIFF_CALIB_F_BIT_D_SHIFT4) & ~(SingleDiff & ADC_CALFACT_CALFACT_S)));
02853 #endif
02854 }
02855 
02856 /**
02857   * @brief  Get ADC calibration factor in the mode single-ended
02858   *         or differential (for devices with differential mode available).
02859   * @note   Calibration factors are set by hardware after performing
02860   *         a calibration run using function @ref LL_ADC_StartCalibration().
02861   * @note   For devices with differential mode available:
02862   *         Calibration of offset is specific to each of
02863   *         single-ended and differential modes
02864   *         Calibration of linearity is common to both
02865   *         single-ended and differential modes
02866   * @rmtoll CALFACT  CALFACT_S      LL_ADC_GetCalibrationOffsetFactor\n
02867   *         CALFACT  CALFACT_D      LL_ADC_GetCalibrationOffsetFactor
02868   * @param  ADCx ADC instance
02869   * @param  SingleDiff This parameter can be one of the following values:
02870   *         @arg @ref LL_ADC_SINGLE_ENDED
02871   *         @arg @ref LL_ADC_DIFFERENTIAL_ENDED
02872   * @retval Value between Min_Data=0x00 and Max_Data=0x7F
02873   */
02874 __STATIC_INLINE uint32_t LL_ADC_GetCalibrationOffsetFactor(ADC_TypeDef *ADCx, uint32_t SingleDiff)
02875 {
02876   /* Retrieve bits with position in register depending on parameter           */
02877   /* "SingleDiff".                                                            */
02878   /* Parameter used with mask "ADC_SINGLEDIFF_CALIB_FACTOR_MASK" because      */
02879   /* containing other bits reserved for other purpose.                        */
02880 #if defined(ADC_VER_V5_V90)
02881   return (uint32_t)(READ_BIT(ADCx->CALFACT_RES13, (SingleDiff & ADC_SINGLEDIFF_CALIB_FACTOR_MASK)) >> ((SingleDiff & ADC_SINGLEDIFF_CALIB_F_BIT_D_MASK) >> ADC_SINGLEDIFF_CALIB_F_BIT_D_SHIFT4));
02882 #else
02883   return (uint32_t)(READ_BIT(ADCx->CALFACT, (SingleDiff & ADC_SINGLEDIFF_CALIB_FACTOR_MASK)) >> ((SingleDiff & ADC_SINGLEDIFF_CALIB_F_BIT_D_MASK) >> ADC_SINGLEDIFF_CALIB_F_BIT_D_SHIFT4));
02884 #endif
02885 }
02886 
02887 /**
02888   * @brief  Set ADC Linear calibration factor in the mode single-ended.
02889   * @note   This function is intended to set linear calibration parameters
02890   *         without having to perform a new calibration using
02891   *         @ref LL_ADC_StartCalibration().
02892   * @note   On this STM32 series, setting of this feature is conditioned to
02893   *         ADC state:
02894   *         ADC must be enabled, without calibration on going, without conversion
02895   *         on going on group regular.
02896   * @rmtoll CALFACT2  LINCALFACT      LL_ADC_SetCalibrationLinearFactor\n
02897   *         CALFACT2  LINCALFACT      LL_ADC_SetCalibrationLinearFactor
02898   * @param  ADCx ADC instance
02899   * @param  LinearityWord This parameter can be one of the following values:
02900   *         @arg @ref LL_ADC_CALIB_LINEARITY_WORD1
02901   *         @arg @ref LL_ADC_CALIB_LINEARITY_WORD2
02902   *         @arg @ref LL_ADC_CALIB_LINEARITY_WORD3
02903   *         @arg @ref LL_ADC_CALIB_LINEARITY_WORD4
02904   *         @arg @ref LL_ADC_CALIB_LINEARITY_WORD5
02905   *         @arg @ref LL_ADC_CALIB_LINEARITY_WORD6
02906   * @param  CalibrationFactor Value between Min_Data=0x00 and Max_Data=0x3FFFFFFF
02907   * @retval None
02908   */
02909 __STATIC_INLINE void LL_ADC_SetCalibrationLinearFactor(ADC_TypeDef *ADCx, uint32_t LinearityWord, uint32_t CalibrationFactor)
02910 {
02911 #if defined(ADC_VER_V5_V90)
02912   if (ADCx != ADC3)
02913   {
02914     uint32_t timeout_cpu_cycles = ADC_LINEARITY_BIT_TOGGLE_TIMEOUT;
02915     MODIFY_REG(ADCx->CALFACT2_RES14, ADC_CALFACT2_LINCALFACT, CalibrationFactor);
02916     MODIFY_REG(ADCx->CR, ADC_CR_ADCALLIN, LinearityWord);
02917     while ((READ_BIT(ADCx->CR, LinearityWord) == 0UL) && (timeout_cpu_cycles > 0UL))
02918     {
02919       timeout_cpu_cycles--;
02920     }
02921   }
02922 #else /* ADC_VER_V5_V90 */
02923   uint32_t timeout_cpu_cycles = ADC_LINEARITY_BIT_TOGGLE_TIMEOUT;
02924   MODIFY_REG(ADCx->CALFACT2, ADC_CALFACT2_LINCALFACT, CalibrationFactor);
02925   MODIFY_REG(ADCx->CR, ADC_CR_ADCALLIN, LinearityWord);
02926   while ((READ_BIT(ADCx->CR, LinearityWord) == 0UL) && (timeout_cpu_cycles > 0UL))
02927   {
02928     timeout_cpu_cycles--;
02929   }
02930 #endif
02931 }
02932 
02933 /**
02934   * @brief  Get ADC Linear calibration factor in the mode single-ended.
02935   * @note   Calibration factors are set by hardware after performing
02936   *         a calibration run using function @ref LL_ADC_StartCalibration().
02937   * @rmtoll CALFACT2  LINCALFACT      LL_ADC_GetCalibrationLinearFactor\n
02938   *         CALFACT2  LINCALFACT      LL_ADC_GetCalibrationLinearFactor
02939   * @param  ADCx ADC instance
02940   * @param  LinearityWord This parameter can be one of the following values:
02941   *         @arg @ref LL_ADC_CALIB_LINEARITY_WORD1
02942   *         @arg @ref LL_ADC_CALIB_LINEARITY_WORD2
02943   *         @arg @ref LL_ADC_CALIB_LINEARITY_WORD3
02944   *         @arg @ref LL_ADC_CALIB_LINEARITY_WORD4
02945   *         @arg @ref LL_ADC_CALIB_LINEARITY_WORD5
02946   *         @arg @ref LL_ADC_CALIB_LINEARITY_WORD6
02947   * @retval Value between Min_Data=0x00 and Max_Data=0x3FFFFFFF
02948   */
02949 __STATIC_INLINE uint32_t LL_ADC_GetCalibrationLinearFactor(ADC_TypeDef *ADCx, uint32_t LinearityWord)
02950 {
02951   uint32_t timeout_cpu_cycles = ADC_LINEARITY_BIT_TOGGLE_TIMEOUT;
02952   CLEAR_BIT(ADCx->CR, LinearityWord);
02953   while ((READ_BIT(ADCx->CR, LinearityWord) != 0UL) && (timeout_cpu_cycles > 0UL))
02954   {
02955     timeout_cpu_cycles--;
02956   }
02957 #if defined(ADC_VER_V5_V90)
02958   return (uint32_t)(READ_BIT(ADCx->CALFACT2_RES14, ADC_CALFACT2_LINCALFACT));
02959 #else
02960   return (uint32_t)(READ_BIT(ADCx->CALFACT2, ADC_CALFACT2_LINCALFACT));
02961 #endif
02962 }
02963 /**
02964   * @brief  Set ADC resolution.
02965   *         Refer to reference manual for alignments formats
02966   *         dependencies to ADC resolutions.
02967   * @note   On this STM32 series, setting of this feature is conditioned to
02968   *         ADC state:
02969   *         ADC must be disabled or enabled without conversion on going
02970   *         on either groups regular or injected.
02971   * @rmtoll CFGR     RES            LL_ADC_SetResolution
02972   * @param  ADCx ADC instance
02973   * @param  Resolution This parameter can be one of the following values:
02974   *         @arg @ref LL_ADC_RESOLUTION_16B
02975   *         @arg @ref LL_ADC_RESOLUTION_14B
02976   *         @arg @ref LL_ADC_RESOLUTION_12B
02977   *         @arg @ref LL_ADC_RESOLUTION_10B
02978   *         @arg @ref LL_ADC_RESOLUTION_8B
02979   * @retval None
02980   */
02981 __STATIC_INLINE void LL_ADC_SetResolution(ADC_TypeDef *ADCx, uint32_t Resolution)
02982 {
02983 #if defined(ADC_VER_V5_3)
02984 
02985   MODIFY_REG(ADCx->CFGR, ADC_CFGR_RES, Resolution);
02986 
02987 #elif defined(ADC_VER_V5_V90)
02988   if (ADCx == ADC3)
02989   {
02990     MODIFY_REG(ADCx->CFGR, ADC3_CFGR_RES, ((__LL_ADC12_RESOLUTION_TO_ADC3(Resolution)  & (ADC_CFGR_RES_1 | ADC_CFGR_RES_0)) << 1UL));
02991   }
02992   else
02993   {
02994     if ((DBGMCU->IDCODE & 0x30000000UL) == 0x10000000UL) /* Rev.Y */
02995     {
02996       MODIFY_REG(ADCx->CFGR, ADC_CFGR_RES, Resolution);
02997     }
02998     else /* Rev.V */
02999     {
03000       if (LL_ADC_RESOLUTION_8B == Resolution)
03001       {
03002         MODIFY_REG(ADCx->CFGR, ADC_CFGR_RES, Resolution | 0x0000000CUL);
03003       }
03004       else
03005       {
03006         MODIFY_REG(ADCx->CFGR, ADC_CFGR_RES, Resolution);
03007       }
03008     }
03009   }
03010 #else /* ADC_VER_V5_V90 */
03011   if ((DBGMCU->IDCODE & 0x30000000UL) == 0x10000000UL) /* Rev.Y */
03012   {
03013     MODIFY_REG(ADCx->CFGR, ADC_CFGR_RES, Resolution);
03014   }
03015   else /* Rev.V */
03016   {
03017     if (LL_ADC_RESOLUTION_8B == Resolution)
03018     {
03019       MODIFY_REG(ADCx->CFGR, ADC_CFGR_RES, Resolution | 0x0000000CUL);
03020     }
03021     else
03022     {
03023       MODIFY_REG(ADCx->CFGR, ADC_CFGR_RES, Resolution);
03024     }
03025   }
03026 
03027 #endif /* ADC_VER_V5_X*/
03028 }
03029 
03030 /**
03031   * @brief  Get ADC resolution.
03032   *         Refer to reference manual for alignments formats
03033   *         dependencies to ADC resolutions.
03034   * @rmtoll CFGR     RES            LL_ADC_GetResolution
03035   * @param  ADCx ADC instance
03036   * @retval Returned value can be one of the following values:
03037   *         @arg @ref LL_ADC_RESOLUTION_16B
03038   *         @arg @ref LL_ADC_RESOLUTION_14B
03039   *         @arg @ref LL_ADC_RESOLUTION_12B
03040   *         @arg @ref LL_ADC_RESOLUTION_10B
03041   *         @arg @ref LL_ADC_RESOLUTION_8B
03042    *         @arg @ref LL_ADC_RESOLUTION_6B   **Value available for ADC3 on STM32H72x/3x devices only **
03043   */
03044 __STATIC_INLINE uint32_t LL_ADC_GetResolution(ADC_TypeDef *ADCx)
03045 {
03046 #if defined (ADC_VER_V5_3)
03047 
03048   return (uint32_t)(READ_BIT(ADCx->CFGR, ADC_CFGR_RES));
03049 
03050 #elif defined(ADC_VER_V5_V90)
03051   if (ADCx == ADC3)
03052   {
03053     return (uint32_t)(READ_BIT(ADCx->CFGR, ADC3_CFGR_RES));
03054   }
03055   else
03056   {
03057     if ((uint32_t)(READ_BIT(ADCx->CFGR, ADC_CFGR_RES)) == 0x0000001CUL)
03058     {
03059       return (LL_ADC_RESOLUTION_8B);
03060     }
03061     else
03062     {
03063       return (uint32_t)(READ_BIT(ADCx->CFGR, ADC_CFGR_RES));
03064     }
03065   }
03066 
03067 #else  /* ADC_VER_V5_V90 */
03068   if ((DBGMCU->IDCODE & 0x30000000UL) == 0x10000000UL) /* Rev.Y */
03069   {
03070     return (uint32_t)(READ_BIT(ADCx->CFGR, ADC_CFGR_RES));
03071   }
03072   else /* Rev.V */
03073   {
03074     if ((uint32_t)(READ_BIT(ADCx->CFGR, ADC_CFGR_RES)) == 0x0000001CUL)
03075     {
03076       return (LL_ADC_RESOLUTION_8B);
03077     }
03078     else
03079     {
03080       return (uint32_t)(READ_BIT(ADCx->CFGR, ADC_CFGR_RES));
03081     }
03082   }
03083 
03084 #endif /* ADC_VER_V5_X */
03085 }
03086 
03087 /**
03088   * @brief  Set ADC low power mode.
03089   * @note   Description of ADC low power modes:
03090   *         - ADC low power mode "auto wait": Dynamic low power mode,
03091   *           ADC conversions occurrences are limited to the minimum necessary
03092   *           in order to reduce power consumption.
03093   *           New ADC conversion starts only when the previous
03094   *           unitary conversion data (for ADC group regular)
03095   *           or previous sequence conversions data (for ADC group injected)
03096   *           has been retrieved by user software.
03097   *           In the meantime, ADC remains idle: does not performs any
03098   *           other conversion.
03099   *           This mode allows to automatically adapt the ADC conversions
03100   *           triggers to the speed of the software that reads the data.
03101   *           Moreover, this avoids risk of overrun for low frequency
03102   *           applications.
03103   *           How to use this low power mode:
03104   *           - It is not recommended to use with interruption or DMA
03105   *             since these modes have to clear immediately the EOC flag
03106   *             (by CPU to free the IRQ pending event or by DMA).
03107   *             Auto wait will work but fort a very short time, discarding
03108   *             its intended benefit (except specific case of high load of CPU
03109   *             or DMA transfers which can justify usage of auto wait).
03110   *           - Do use with polling: 1. Start conversion,
03111   *             2. Later on, when conversion data is needed: poll for end of
03112   *             conversion  to ensure that conversion is completed and
03113   *             retrieve ADC conversion data. This will trig another
03114   *             ADC conversion start.
03115   *         - ADC low power mode "auto power-off" (feature available on
03116   *           this device if parameter LL_ADC_LP_AUTOPOWEROFF is available):
03117   *           the ADC automatically powers-off after a conversion and
03118   *           automatically wakes up when a new conversion is triggered
03119   *           (with startup time between trigger and start of sampling).
03120   *           This feature can be combined with low power mode "auto wait".
03121   * @note   With ADC low power mode "auto wait", the ADC conversion data read
03122   *         is corresponding to previous ADC conversion start, independently
03123   *         of delay during which ADC was idle.
03124   *         Therefore, the ADC conversion data may be outdated: does not
03125   *         correspond to the current voltage level on the selected
03126   *         ADC channel.
03127   * @note   On this STM32 series, setting of this feature is conditioned to
03128   *         ADC state:
03129   *         ADC must be disabled or enabled without conversion on going
03130   *         on either groups regular or injected.
03131   * @rmtoll CFGR     AUTDLY         LL_ADC_SetLowPowerMode
03132   * @param  ADCx ADC instance
03133   * @param  LowPowerMode This parameter can be one of the following values:
03134   *         @arg @ref LL_ADC_LP_MODE_NONE
03135   *         @arg @ref LL_ADC_LP_AUTOWAIT
03136   * @retval None
03137   */
03138 __STATIC_INLINE void LL_ADC_SetLowPowerMode(ADC_TypeDef *ADCx, uint32_t LowPowerMode)
03139 {
03140   MODIFY_REG(ADCx->CFGR, ADC_CFGR_AUTDLY, LowPowerMode);
03141 }
03142 
03143 /**
03144   * @brief  Get ADC low power mode:
03145   * @note   Description of ADC low power modes:
03146   *         - ADC low power mode "auto wait": Dynamic low power mode,
03147   *           ADC conversions occurrences are limited to the minimum necessary
03148   *           in order to reduce power consumption.
03149   *           New ADC conversion starts only when the previous
03150   *           unitary conversion data (for ADC group regular)
03151   *           or previous sequence conversions data (for ADC group injected)
03152   *           has been retrieved by user software.
03153   *           In the meantime, ADC remains idle: does not performs any
03154   *           other conversion.
03155   *           This mode allows to automatically adapt the ADC conversions
03156   *           triggers to the speed of the software that reads the data.
03157   *           Moreover, this avoids risk of overrun for low frequency
03158   *           applications.
03159   *           How to use this low power mode:
03160   *           - It is not recommended to use with interruption or DMA
03161   *             since these modes have to clear immediately the EOC flag
03162   *             (by CPU to free the IRQ pending event or by DMA).
03163   *             Auto wait will work but fort a very short time, discarding
03164   *             its intended benefit (except specific case of high load of CPU
03165   *             or DMA transfers which can justify usage of auto wait).
03166   *           - Do use with polling: 1. Start conversion,
03167   *             2. Later on, when conversion data is needed: poll for end of
03168   *             conversion  to ensure that conversion is completed and
03169   *             retrieve ADC conversion data. This will trig another
03170   *             ADC conversion start.
03171   *         - ADC low power mode "auto power-off" (feature available on
03172   *           this device if parameter LL_ADC_LP_AUTOPOWEROFF is available):
03173   *           the ADC automatically powers-off after a conversion and
03174   *           automatically wakes up when a new conversion is triggered
03175   *           (with startup time between trigger and start of sampling).
03176   *           This feature can be combined with low power mode "auto wait".
03177   * @note   With ADC low power mode "auto wait", the ADC conversion data read
03178   *         is corresponding to previous ADC conversion start, independently
03179   *         of delay during which ADC was idle.
03180   *         Therefore, the ADC conversion data may be outdated: does not
03181   *         correspond to the current voltage level on the selected
03182   *         ADC channel.
03183   * @rmtoll CFGR     AUTDLY         LL_ADC_GetLowPowerMode
03184   * @param  ADCx ADC instance
03185   * @retval Returned value can be one of the following values:
03186   *         @arg @ref LL_ADC_LP_MODE_NONE
03187   *         @arg @ref LL_ADC_LP_AUTOWAIT
03188   */
03189 __STATIC_INLINE uint32_t LL_ADC_GetLowPowerMode(ADC_TypeDef *ADCx)
03190 {
03191   return (uint32_t)(READ_BIT(ADCx->CFGR, ADC_CFGR_AUTDLY));
03192 }
03193 
03194 /**
03195   * @brief  Set ADC selected Channel.
03196   * @note   This function set the pre-selection of channel configuration.
03197   * @note   Caution: Channel selections is dependent to ADC instance and IP version:
03198   *         For STM32H72x/3x This is applicable only for ADC1/ADC2
03199   *         For Rest of STM32H7xxx This is applicable only all the ADCs instances.
03200   * 
03201   * @param  ADCx ADC instance
03202   * @param  Channel This parameter can be one of the following values:
03203   *         @arg @ref LL_ADC_CHANNEL_0           
03204   *         @arg @ref LL_ADC_CHANNEL_1           
03205   *         @arg @ref LL_ADC_CHANNEL_2           
03206   *         @arg @ref LL_ADC_CHANNEL_3           
03207   *         @arg @ref LL_ADC_CHANNEL_4           
03208   *         @arg @ref LL_ADC_CHANNEL_5           
03209   *         @arg @ref LL_ADC_CHANNEL_6
03210   *         @arg @ref LL_ADC_CHANNEL_7
03211   *         @arg @ref LL_ADC_CHANNEL_8
03212   *         @arg @ref LL_ADC_CHANNEL_9
03213   *         @arg @ref LL_ADC_CHANNEL_10
03214   *         @arg @ref LL_ADC_CHANNEL_11
03215   *         @arg @ref LL_ADC_CHANNEL_12
03216   *         @arg @ref LL_ADC_CHANNEL_13
03217   *         @arg @ref LL_ADC_CHANNEL_14
03218   *         @arg @ref LL_ADC_CHANNEL_15
03219   *         @arg @ref LL_ADC_CHANNEL_16
03220   *         @arg @ref LL_ADC_CHANNEL_17
03221   *         @arg @ref LL_ADC_CHANNEL_18
03222   *         @arg @ref LL_ADC_CHANNEL_19
03223   * @retval None
03224   */
03225 __STATIC_INLINE void LL_ADC_SetChannelPreSelection(ADC_TypeDef *ADCx, uint32_t Channel)
03226 {
03227 #if defined(ADC_VER_V5_V90)
03228     if (ADCx != ADC3)
03229     {
03230       /* ADC channels preselection */
03231       ADCx->PCSEL_RES0 |= (1UL << (__LL_ADC_CHANNEL_TO_DECIMAL_NB(Channel) & 0x1FUL));
03232     }
03233 #else
03234     /* ADC channels preselection */
03235     ADCx->PCSEL |= (1UL << (__LL_ADC_CHANNEL_TO_DECIMAL_NB(Channel) & 0x1FUL));
03236 #endif /* ADC_VER_V5_V90 */
03237 }
03238 
03239 /**
03240   * @brief  Set ADC selected offset number 1, 2, 3 or 4.
03241   * @note   This function set the 2 items of offset configuration:
03242   *         - ADC channel to which the offset programmed will be applied
03243   *           (independently of channel mapped on ADC group regular
03244   *           or group injected)
03245   *         - Offset level (offset to be subtracted from the raw
03246   *           converted data).
03247   * @note   Caution: Offset format is dependent to ADC resolution:
03248   *         offset has to be left-aligned on bit 11, the LSB (right bits)
03249   *         are set to 0.
03250   * @note   This function enables the offset, by default. It can be forced
03251   *         to disable state using function LL_ADC_SetOffsetState().
03252   * @note   If a channel is mapped on several offsets numbers, only the offset
03253   *         with the lowest value is considered for the subtraction.
03254   * @note   On this STM32 series, setting of this feature is conditioned to
03255   *         ADC state:
03256   *         ADC must be disabled or enabled without conversion on going
03257   *         on either groups regular or injected.
03258   * @note   On STM32H7, some fast channels are available: fast analog inputs
03259   *         coming from GPIO pads (ADC_IN0..5).
03260   * @rmtoll OFR1     OFFSET1_CH     LL_ADC_SetOffset\n
03261   *         OFR1     OFFSET1        LL_ADC_SetOffset\n
03262   *         OFR1     OFFSET1_EN     LL_ADC_SetOffset\n
03263   *         OFR2     OFFSET2_CH     LL_ADC_SetOffset\n
03264   *         OFR2     OFFSET2        LL_ADC_SetOffset\n
03265   *         OFR2     OFFSET2_EN     LL_ADC_SetOffset\n
03266   *         OFR3     OFFSET3_CH     LL_ADC_SetOffset\n
03267   *         OFR3     OFFSET3        LL_ADC_SetOffset\n
03268   *         OFR3     OFFSET3_EN     LL_ADC_SetOffset\n
03269   *         OFR4     OFFSET4_CH     LL_ADC_SetOffset\n
03270   *         OFR4     OFFSET4        LL_ADC_SetOffset\n
03271   *         OFR4     OFFSET4_EN     LL_ADC_SetOffset
03272   * @param  ADCx ADC instance
03273   * @param  Offsety This parameter can be one of the following values:
03274   *         @arg @ref LL_ADC_OFFSET_1
03275   *         @arg @ref LL_ADC_OFFSET_2
03276   *         @arg @ref LL_ADC_OFFSET_3
03277   *         @arg @ref LL_ADC_OFFSET_4
03278   * @param  Channel This parameter can be one of the following values:
03279   *         @arg @ref LL_ADC_CHANNEL_0           (3)
03280   *         @arg @ref LL_ADC_CHANNEL_1           (3)
03281   *         @arg @ref LL_ADC_CHANNEL_2           (3)
03282   *         @arg @ref LL_ADC_CHANNEL_3           (3)
03283   *         @arg @ref LL_ADC_CHANNEL_4           (3)
03284   *         @arg @ref LL_ADC_CHANNEL_5           (3)
03285   *         @arg @ref LL_ADC_CHANNEL_6
03286   *         @arg @ref LL_ADC_CHANNEL_7
03287   *         @arg @ref LL_ADC_CHANNEL_8
03288   *         @arg @ref LL_ADC_CHANNEL_9
03289   *         @arg @ref LL_ADC_CHANNEL_10
03290   *         @arg @ref LL_ADC_CHANNEL_11
03291   *         @arg @ref LL_ADC_CHANNEL_12
03292   *         @arg @ref LL_ADC_CHANNEL_13
03293   *         @arg @ref LL_ADC_CHANNEL_14
03294   *         @arg @ref LL_ADC_CHANNEL_15
03295   *         @arg @ref LL_ADC_CHANNEL_16
03296   *         @arg @ref LL_ADC_CHANNEL_17
03297   *         @arg @ref LL_ADC_CHANNEL_18
03298   *         @arg @ref LL_ADC_CHANNEL_19
03299   *         @arg @ref LL_ADC_CHANNEL_VREFINT      (1)
03300   *         @arg @ref LL_ADC_CHANNEL_TEMPSENSOR   (1)
03301   *         @arg @ref LL_ADC_CHANNEL_VBAT         (1)
03302   *         @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)
03303   *         @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)
03304   *
03305   *         (1) On STM32H7, parameter available only on ADC instance: ADC3.\n
03306   *         (2) On STM32H7, parameter available only on ADC instance: ADC2.\n
03307   *         (3) On STM32H7, fast channel (0.125 us for 14-bit resolution (ADC conversion rate up to 8 Ms/s)).
03308   *             Other channels are slow channels (conversion rate: refer to reference manual).
03309   * @param  OffsetLevel Value between Min_Data=0x000 and Max_Data=0x1FFFFFF
03310   * @retval None
03311   */
03312 __STATIC_INLINE void LL_ADC_SetOffset(ADC_TypeDef *ADCx, uint32_t Offsety, uint32_t Channel, uint32_t OffsetLevel)
03313 {
03314   __IO uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->OFR1, Offsety);
03315 #if defined(ADC_VER_V5_V90)
03316   if (ADCx == ADC3)
03317   {
03318     MODIFY_REG(*preg,
03319                ADC3_OFR1_OFFSET1_EN | ADC_OFR1_OFFSET1_CH | ADC_OFR1_OFFSET1,
03320                ADC3_OFR1_OFFSET1_EN | (Channel & ADC_CHANNEL_ID_NUMBER_MASK) | OffsetLevel);
03321   }
03322   else
03323 #endif /* ADC_VER_V5_V90 */
03324   {
03325     MODIFY_REG(*preg,
03326                ADC_OFR1_OFFSET1_CH | ADC_OFR1_OFFSET1,
03327                (Channel & ADC_CHANNEL_ID_NUMBER_MASK) | OffsetLevel);
03328   }
03329 }
03330 
03331 /**
03332   * @brief  Get for the ADC selected offset number 1, 2, 3 or 4:
03333   *         Channel to which the offset programmed will be applied
03334   *         (independently of channel mapped on ADC group regular
03335   *         or group injected)
03336   * @note   Usage of the returned channel number:
03337   *         - To reinject this channel into another function LL_ADC_xxx:
03338   *           the returned channel number is only partly formatted on definition
03339   *           of literals LL_ADC_CHANNEL_x. Therefore, it has to be compared
03340   *           with parts of literals LL_ADC_CHANNEL_x or using
03341   *           helper macro @ref __LL_ADC_CHANNEL_TO_DECIMAL_NB().
03342   *           Then the selected literal LL_ADC_CHANNEL_x can be used
03343   *           as parameter for another function.
03344   *         - To get the channel number in decimal format:
03345   *           process the returned value with the helper macro
03346   *           @ref __LL_ADC_CHANNEL_TO_DECIMAL_NB().
03347   * @note   On STM32H7, some fast channels are available: fast analog inputs
03348   *         coming from GPIO pads (ADC_IN0..5).
03349   * @rmtoll OFR1     OFFSET1_CH     LL_ADC_GetOffsetChannel\n
03350   *         OFR2     OFFSET2_CH     LL_ADC_GetOffsetChannel\n
03351   *         OFR3     OFFSET3_CH     LL_ADC_GetOffsetChannel\n
03352   *         OFR4     OFFSET4_CH     LL_ADC_GetOffsetChannel
03353   * @param  ADCx ADC instance
03354   * @param  Offsety This parameter can be one of the following values:
03355   *         @arg @ref LL_ADC_OFFSET_1
03356   *         @arg @ref LL_ADC_OFFSET_2
03357   *         @arg @ref LL_ADC_OFFSET_3
03358   *         @arg @ref LL_ADC_OFFSET_4
03359   * @retval Returned value can be one of the following values:
03360   *         @arg @ref LL_ADC_CHANNEL_0           (3)
03361   *         @arg @ref LL_ADC_CHANNEL_1           (3)
03362   *         @arg @ref LL_ADC_CHANNEL_2           (3)
03363   *         @arg @ref LL_ADC_CHANNEL_3           (3)
03364   *         @arg @ref LL_ADC_CHANNEL_4           (3)
03365   *         @arg @ref LL_ADC_CHANNEL_5           (3)
03366   *         @arg @ref LL_ADC_CHANNEL_6
03367   *         @arg @ref LL_ADC_CHANNEL_7
03368   *         @arg @ref LL_ADC_CHANNEL_8
03369   *         @arg @ref LL_ADC_CHANNEL_9
03370   *         @arg @ref LL_ADC_CHANNEL_10
03371   *         @arg @ref LL_ADC_CHANNEL_11
03372   *         @arg @ref LL_ADC_CHANNEL_12
03373   *         @arg @ref LL_ADC_CHANNEL_13
03374   *         @arg @ref LL_ADC_CHANNEL_14
03375   *         @arg @ref LL_ADC_CHANNEL_15
03376   *         @arg @ref LL_ADC_CHANNEL_16
03377   *         @arg @ref LL_ADC_CHANNEL_17
03378   *         @arg @ref LL_ADC_CHANNEL_18
03379   *         @arg @ref LL_ADC_CHANNEL_19
03380   *         @arg @ref LL_ADC_CHANNEL_VREFINT      (1)
03381   *         @arg @ref LL_ADC_CHANNEL_TEMPSENSOR   (1)
03382   *         @arg @ref LL_ADC_CHANNEL_VBAT         (1)
03383   *         @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)
03384   *         @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)
03385   *
03386   *         (1) On STM32H7, parameter available only on ADC instance: ADC3.\n
03387   *         (2) On STM32H7, parameter available only on ADC instance: ADC2.\n
03388   *         (3) On STM32H7, fast channel (0.125 us for 14-bit resolution (ADC conversion rate up to 8 Ms/s)).
03389   *             Other channels are slow channels (conversion rate: refer to reference manual).\n
03390   *         (1, 2) For ADC channel read back from ADC register,
03391   *                comparison with internal channel parameter to be done
03392   *                using helper macro @ref __LL_ADC_CHANNEL_INTERNAL_TO_EXTERNAL().
03393   */
03394 __STATIC_INLINE uint32_t LL_ADC_GetOffsetChannel(ADC_TypeDef *ADCx, uint32_t Offsety)
03395 {
03396   const __IO uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->OFR1, Offsety);
03397 
03398   return (uint32_t) READ_BIT(*preg, ADC_OFR1_OFFSET1_CH);
03399 }
03400 
03401 /**
03402   * @brief  Get for the ADC selected offset number 1, 2, 3 or 4:
03403   *         Offset level (offset to be subtracted from the raw
03404   *         converted data).
03405   * @note   Caution: Offset format is dependent to ADC resolution:
03406   *         offset has to be left-aligned on bit 11, the LSB (right bits)
03407   *         are set to 0.
03408   * @rmtoll OFR1     OFFSET1        LL_ADC_GetOffsetLevel\n
03409   *         OFR2     OFFSET2        LL_ADC_GetOffsetLevel\n
03410   *         OFR3     OFFSET3        LL_ADC_GetOffsetLevel\n
03411   *         OFR4     OFFSET4        LL_ADC_GetOffsetLevel
03412   * @param  ADCx ADC instance
03413   * @param  Offsety This parameter can be one of the following values:
03414   *         @arg @ref LL_ADC_OFFSET_1
03415   *         @arg @ref LL_ADC_OFFSET_2
03416   *         @arg @ref LL_ADC_OFFSET_3
03417   *         @arg @ref LL_ADC_OFFSET_4
03418   * @retval Value between Min_Data=0x000 and Max_Data=0x1FFFFFF
03419   */
03420 __STATIC_INLINE uint32_t LL_ADC_GetOffsetLevel(ADC_TypeDef *ADCx, uint32_t Offsety)
03421 {
03422   const __IO uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->OFR1, Offsety);
03423 
03424   return (uint32_t) READ_BIT(*preg, ADC_OFR1_OFFSET1);
03425 }
03426 
03427 
03428 /**
03429   * @brief  Set data right shift for the ADC selected offset number 1, 2, 3 or 4:
03430   *         signed offset saturation if enabled or disabled.
03431   * @rmtoll CFGR2    RSHIFT          LL_ADC_SetDataRightShift\n
03432   * @param  ADCx ADC instance
03433   * @param  Offsety This parameter can be one of the following values:
03434   *         @arg @ref LL_ADC_OFFSET_1
03435   *         @arg @ref LL_ADC_OFFSET_2
03436   *         @arg @ref LL_ADC_OFFSET_3
03437   *         @arg @ref LL_ADC_OFFSET_4
03438   * @param  RigthShift This parameter can be one of the following values:
03439   *         @arg @ref LL_ADC_OFFSET_RSHIFT_ENABLE
03440   *         @arg @ref LL_ADC_OFFSET_RSHIFT_DISABLE
03441   * @retval Returned None
03442   */
03443 __STATIC_INLINE void LL_ADC_SetDataRightShift(ADC_TypeDef *ADCx, uint32_t Offsety, uint32_t RigthShift)
03444 {
03445   MODIFY_REG(ADCx->CFGR2, (ADC_CFGR2_RSHIFT1 | ADC_CFGR2_RSHIFT2 | ADC_CFGR2_RSHIFT3 | ADC_CFGR2_RSHIFT4), RigthShift << (Offsety & 0x1FUL));
03446 }
03447 
03448 /**
03449   * @brief  Get data right shift for the ADC selected offset number 1, 2, 3 or 4:
03450   *         signed offset saturation if enabled or disabled.
03451   * @rmtoll CFGR2    RSHIFT          LL_ADC_GetDataRightShift\n
03452   * @param  ADCx ADC instance
03453   * @param  Offsety This parameter can be one of the following values:
03454   *         @arg @ref LL_ADC_OFFSET_1
03455   *         @arg @ref LL_ADC_OFFSET_2
03456   *         @arg @ref LL_ADC_OFFSET_3
03457   *         @arg @ref LL_ADC_OFFSET_4
03458   * @retval Returned value can be one of the following values:
03459   *         @arg @ref LL_ADC_OFFSET_RSHIFT_ENABLE
03460   *         @arg @ref LL_ADC_OFFSET_RSHIFT_DISABLE
03461   */
03462 __STATIC_INLINE uint32_t LL_ADC_GetDataRightShift(ADC_TypeDef *ADCx, uint32_t Offsety)
03463 {
03464   return (uint32_t)((READ_BIT(ADCx->CFGR2, (ADC_CFGR2_RSHIFT1 << (Offsety & 0x1FUL)))) >> (Offsety & 0x1FUL));
03465 }
03466 
03467 /**
03468   * @brief  Set signed saturation for the ADC selected offset number 1, 2, 3 or 4:
03469   *         signed offset saturation if enabled or disabled.
03470   * @rmtoll OFR1     SSATE          LL_ADC_SetOffsetSignedSaturation\n
03471   *         OFR2     SSATE          LL_ADC_SetOffsetSignedSaturation\n
03472   *         OFR3     SSATE          LL_ADC_SetOffsetSignedSaturation\n
03473   *         OFR4     SSATE          LL_ADC_SetOffsetSignedSaturation
03474   * @param  ADCx ADC instance
03475   * @param  Offsety This parameter can be one of the following values:
03476   *         @arg @ref LL_ADC_OFFSET_1
03477   *         @arg @ref LL_ADC_OFFSET_2
03478   *         @arg @ref LL_ADC_OFFSET_3
03479   *         @arg @ref LL_ADC_OFFSET_4
03480   * @param  OffsetSignedSaturation This parameter can be one of the following values:
03481   *         @arg @ref LL_ADC_OFFSET_SIGNED_SATURATION_ENABLE
03482   *         @arg @ref LL_ADC_OFFSET_SIGNED_SATURATION_DISABLE
03483   * @retval Returned None
03484   */
03485 __STATIC_INLINE void LL_ADC_SetOffsetSignedSaturation(ADC_TypeDef *ADCx, uint32_t Offsety, uint32_t OffsetSignedSaturation)
03486 {
03487 #if defined(ADC_VER_V5_V90)
03488   if (ADCx == ADC3)
03489   {
03490     /* Function not available on this instance */
03491   }
03492   else
03493 #endif  /* ADC_VER_V5_V90 */
03494   {
03495     __IO uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->OFR1, Offsety);
03496     MODIFY_REG(*preg, ADC_OFR1_SSATE, OffsetSignedSaturation);
03497   }
03498 }
03499 
03500 /**
03501   * @brief  Get signed saturation for the ADC selected offset number 1, 2, 3 or 4:
03502   *         signed offset saturation if enabled or disabled.
03503   * @rmtoll OFR1     SSATE          LL_ADC_GetOffsetSignedSaturation\n
03504   *         OFR2     SSATE          LL_ADC_GetOffsetSignedSaturation\n
03505   *         OFR3     SSATE          LL_ADC_GetOffsetSignedSaturation\n
03506   *         OFR4     SSATE          LL_ADC_GetOffsetSignedSaturation
03507   * @param  ADCx ADC instance
03508   * @param  Offsety This parameter can be one of the following values:
03509   *         @arg @ref LL_ADC_OFFSET_1
03510   *         @arg @ref LL_ADC_OFFSET_2
03511   *         @arg @ref LL_ADC_OFFSET_3
03512   *         @arg @ref LL_ADC_OFFSET_4
03513   * @retval Returned value can be one of the following values:
03514   *         @arg @ref LL_ADC_OFFSET_SIGNED_SATURATION_ENABLE
03515   *         @arg @ref LL_ADC_OFFSET_SIGNED_SATURATION_DISABLE
03516   */
03517 __STATIC_INLINE uint32_t LL_ADC_GetOffsetSignedSaturation(ADC_TypeDef *ADCx, uint32_t Offsety)
03518 {
03519 #if defined(ADC_VER_V5_V90)
03520   if (ADCx == ADC3)
03521   {
03522     /* Function not available on this instance */
03523     return 0UL;
03524   }
03525   else
03526 #endif  /* ADC_VER_V5_V90 */
03527   {
03528     const __IO uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->OFR1, Offsety);
03529     return (uint32_t) READ_BIT(*preg, ADC_OFR1_SSATE);
03530   }
03531 }
03532 
03533 #if defined(ADC_VER_V5_V90)
03534 /**
03535   * @brief  Set for the ADC selected offset number 1, 2, 3 or 4:
03536   *         choose offset saturation mode.
03537   * @note   On this STM32 series, setting of this feature is conditioned to
03538   *         ADC state:
03539   *         ADC must be disabled or enabled without conversion on going
03540   *         on either groups regular or injected.
03541   * @rmtoll OFR1     SATEN          LL_ADC_SetOffsetSaturation\n
03542   *         OFR2     SATEN          LL_ADC_SetOffsetSaturation\n
03543   *         OFR3     SATEN          LL_ADC_SetOffsetSaturation\n
03544   *         OFR4     SATEN          LL_ADC_SetOffsetSaturation
03545   * @param  ADCx ADC instance
03546   * @param  Offsety This parameter can be one of the following values:
03547   *         @arg @ref LL_ADC_OFFSET_1
03548   *         @arg @ref LL_ADC_OFFSET_2
03549   *         @arg @ref LL_ADC_OFFSET_3
03550   *         @arg @ref LL_ADC_OFFSET_4
03551   * @param  OffsetSaturation This parameter can be one of the following values:
03552   *         @arg @ref LL_ADC_OFFSET_SATURATION_ENABLE
03553   *         @arg @ref LL_ADC_OFFSET_SATURATION_DISABLE
03554   * @retval None
03555   */
03556 __STATIC_INLINE void LL_ADC_SetOffsetSaturation(ADC_TypeDef *ADCx, uint32_t Offsety, uint32_t OffsetSaturation)
03557 {
03558   if (ADCx == ADC3)
03559   {
03560     __IO uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->OFR1, Offsety);
03561 
03562     MODIFY_REG(*preg,
03563                ADC3_OFR1_SATEN,
03564                OffsetSaturation);
03565   }
03566 }
03567 
03568 /**
03569   * @brief  Get for the ADC selected offset number 1, 2, 3 or 4:
03570   *         offset saturation if enabled or disabled.
03571   * @rmtoll OFR1     SATEN          LL_ADC_GetOffsetSaturation\n
03572   *         OFR2     SATEN          LL_ADC_GetOffsetSaturation\n
03573   *         OFR3     SATEN          LL_ADC_GetOffsetSaturation\n
03574   *         OFR4     SATEN          LL_ADC_GetOffsetSaturation
03575   * @param  ADCx ADC instance
03576   * @param  Offsety This parameter can be one of the following values:
03577   *         @arg @ref LL_ADC_OFFSET_1
03578   *         @arg @ref LL_ADC_OFFSET_2
03579   *         @arg @ref LL_ADC_OFFSET_3
03580   *         @arg @ref LL_ADC_OFFSET_4
03581   * @retval Returned value can be one of the following values:
03582   *         @arg @ref LL_ADC_OFFSET_SATURATION_ENABLE
03583   *         @arg @ref LL_ADC_OFFSET_SATURATION_DISABLE
03584   */
03585 __STATIC_INLINE uint32_t LL_ADC_GetOffsetSaturation(ADC_TypeDef *ADCx, uint32_t Offsety)
03586 {
03587   if (ADCx == ADC3)
03588   {
03589     const __IO uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->OFR1, Offsety);
03590 
03591     return (uint32_t) READ_BIT(*preg, ADC3_OFR1_SATEN);
03592   }else
03593   {
03594     return 0UL;
03595   }
03596 }
03597 
03598 /**
03599   * @brief  Set for the ADC selected offset number 1, 2, 3 or 4:
03600   *         choose offset sign.
03601   * @note   On this STM32 series, setting of this feature is conditioned to
03602   *         ADC state:
03603   *         ADC must be disabled or enabled without conversion on going
03604   *         on either groups regular or injected.
03605   * @rmtoll OFR1     OFFSETPOS      LL_ADC_SetOffsetSign\n
03606   *         OFR2     OFFSETPOS      LL_ADC_SetOffsetSign\n
03607   *         OFR3     OFFSETPOS      LL_ADC_SetOffsetSign\n
03608   *         OFR4     OFFSETPOS      LL_ADC_SetOffsetSign
03609   * @param  ADCx ADC instance
03610   * @param  Offsety This parameter can be one of the following values:
03611   *         @arg @ref LL_ADC_OFFSET_1
03612   *         @arg @ref LL_ADC_OFFSET_2
03613   *         @arg @ref LL_ADC_OFFSET_3
03614   *         @arg @ref LL_ADC_OFFSET_4
03615   * @param  OffsetSign This parameter can be one of the following values:
03616   *         @arg @ref LL_ADC_OFFSET_SIGN_NEGATIVE
03617   *         @arg @ref LL_ADC_OFFSET_SIGN_POSITIVE
03618   * @retval None
03619   */
03620 __STATIC_INLINE void LL_ADC_SetOffsetSign(ADC_TypeDef *ADCx, uint32_t Offsety, uint32_t OffsetSign)
03621 {
03622   if (ADCx == ADC3)
03623   {
03624     __IO uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->OFR1, Offsety);
03625 
03626     MODIFY_REG(*preg,
03627                ADC3_OFR1_OFFSETPOS,
03628                OffsetSign);
03629   }
03630 }
03631 
03632 /**
03633   * @brief  Get for the ADC selected offset number 1, 2, 3 or 4:
03634   *         offset sign if positive or negative.
03635   * @rmtoll OFR1     OFFSETPOS      LL_ADC_GetOffsetSign\n
03636   *         OFR2     OFFSETPOS      LL_ADC_GetOffsetSign\n
03637   *         OFR3     OFFSETPOS      LL_ADC_GetOffsetSign\n
03638   *         OFR4     OFFSETPOS      LL_ADC_GetOffsetSign
03639   * @param  ADCx ADC instance
03640   * @param  Offsety This parameter can be one of the following values:
03641   *         @arg @ref LL_ADC_OFFSET_1
03642   *         @arg @ref LL_ADC_OFFSET_2
03643   *         @arg @ref LL_ADC_OFFSET_3
03644   *         @arg @ref LL_ADC_OFFSET_4
03645   * @retval Returned value can be one of the following values:
03646   *         @arg @ref LL_ADC_OFFSET_SIGN_NEGATIVE
03647   *         @arg @ref LL_ADC_OFFSET_SIGN_POSITIVE
03648   */
03649 __STATIC_INLINE uint32_t LL_ADC_GetOffsetSign(ADC_TypeDef *ADCx, uint32_t Offsety)
03650 {
03651   if (ADCx == ADC3)
03652   {
03653     const __IO uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->OFR1, Offsety);
03654 
03655     return (uint32_t) READ_BIT(*preg, ADC3_OFR1_OFFSETPOS);
03656   }
03657   else
03658   { 
03659     return 0UL;
03660   }
03661 }
03662 
03663 /**
03664   * @brief  Set for the ADC selected offset number 1, 2, 3 or 4:
03665   *         force offset state disable or enable
03666   *         without modifying offset channel or offset value.
03667   * @note   This function should be needed only in case of offset to be
03668   *         enabled-disabled dynamically, and should not be needed in other cases:
03669   *         function LL_ADC_SetOffset() automatically enables the offset.
03670   * @note   On this STM32 series, setting of this feature is conditioned to
03671   *         ADC state:
03672   *         ADC must be disabled or enabled without conversion on going
03673   *         on either groups regular or injected.
03674   * @rmtoll OFR1     OFFSET1_EN     LL_ADC_SetOffsetState\n
03675   *         OFR2     OFFSET2_EN     LL_ADC_SetOffsetState\n
03676   *         OFR3     OFFSET3_EN     LL_ADC_SetOffsetState\n
03677   *         OFR4     OFFSET4_EN     LL_ADC_SetOffsetState
03678   * @param  ADCx ADC instance
03679   * @param  Offsety This parameter can be one of the following values:
03680   *         @arg @ref LL_ADC_OFFSET_1
03681   *         @arg @ref LL_ADC_OFFSET_2
03682   *         @arg @ref LL_ADC_OFFSET_3
03683   *         @arg @ref LL_ADC_OFFSET_4
03684   * @param  OffsetState This parameter can be one of the following values:
03685   *         @arg @ref LL_ADC_OFFSET_DISABLE
03686   *         @arg @ref LL_ADC_OFFSET_ENABLE
03687   * @retval None
03688   */
03689 __STATIC_INLINE void LL_ADC_SetOffsetState(ADC_TypeDef *ADCx, uint32_t Offsety, uint32_t OffsetState)
03690 {
03691   __IO uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->OFR1, Offsety);
03692   if (ADCx == ADC3)
03693   {
03694     MODIFY_REG(*preg,
03695                ADC3_OFR1_OFFSET1_EN,
03696                OffsetState);
03697   }
03698   else
03699   {
03700     MODIFY_REG(*preg,
03701                ADC_OFR1_SSATE,
03702                OffsetState);
03703   }
03704 }
03705 
03706 /**
03707   * @brief  Get for the ADC selected offset number 1, 2, 3 or 4:
03708   *         offset state disabled or enabled.
03709   * @rmtoll OFR1     OFFSET1_EN     LL_ADC_GetOffsetState\n
03710   *         OFR2     OFFSET2_EN     LL_ADC_GetOffsetState\n
03711   *         OFR3     OFFSET3_EN     LL_ADC_GetOffsetState\n
03712   *         OFR4     OFFSET4_EN     LL_ADC_GetOffsetState
03713   * @param  ADCx ADC instance
03714   * @param  Offsety This parameter can be one of the following values:
03715   *         @arg @ref LL_ADC_OFFSET_1
03716   *         @arg @ref LL_ADC_OFFSET_2
03717   *         @arg @ref LL_ADC_OFFSET_3
03718   *         @arg @ref LL_ADC_OFFSET_4
03719   * @retval Returned value can be one of the following values:
03720   *         @arg @ref LL_ADC_OFFSET_DISABLE
03721   *         @arg @ref LL_ADC_OFFSET_ENABLE
03722   */
03723 __STATIC_INLINE uint32_t LL_ADC_GetOffsetState(ADC_TypeDef *ADCx, uint32_t Offsety)
03724 {
03725   const __IO uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->OFR1, Offsety);
03726   if (ADCx == ADC3)
03727   {
03728     return (uint32_t) READ_BIT(*preg, ADC3_OFR1_OFFSET1_EN);
03729   }
03730   else
03731   {
03732     return (uint32_t) READ_BIT(*preg, ADC_OFR1_SSATE);
03733   }
03734 }
03735 
03736 #endif  /* ADC_VER_V5_V90 */
03737 
03738 /**
03739   * @}
03740   */
03741 
03742 /** @defgroup ADC_LL_EF_Configuration_ADC_Group_Regular Configuration of ADC hierarchical scope: group regular
03743   * @{
03744   */
03745 
03746 /**
03747   * @brief  Set ADC group regular conversion trigger source:
03748   *         internal (SW start) or from external peripheral (timer event,
03749   *         external interrupt line).
03750   * @note   On this STM32 series, setting trigger source to external trigger
03751   *         also set trigger polarity to rising edge
03752   *         (default setting for compatibility with some ADC on other
03753   *         STM32 families having this setting set by HW default value).
03754   *         In case of need to modify trigger edge, use
03755   *         function @ref LL_ADC_REG_SetTriggerEdge().
03756   * @note   Availability of parameters of trigger sources from timer
03757   *         depends on timers availability on the selected device.
03758   * @note   On this STM32 series, setting of this feature is conditioned to
03759   *         ADC state:
03760   *         ADC must be disabled or enabled without conversion on going
03761   *         on group regular.
03762   * @rmtoll CFGR     EXTSEL         LL_ADC_REG_SetTriggerSource\n
03763   *         CFGR     EXTEN          LL_ADC_REG_SetTriggerSource
03764   * @param  ADCx ADC instance
03765   * @param  TriggerSource This parameter can be one of the following values:
03766   *         @arg @ref LL_ADC_REG_TRIG_SOFTWARE
03767   *         @arg @ref LL_ADC_REG_TRIG_EXT_TIM1_CH1
03768   *         @arg @ref LL_ADC_REG_TRIG_EXT_TIM1_CH2
03769   *         @arg @ref LL_ADC_REG_TRIG_EXT_TIM1_CH3
03770   *         @arg @ref LL_ADC_REG_TRIG_EXT_TIM2_CH2
03771   *         @arg @ref LL_ADC_REG_TRIG_EXT_TIM3_TRGO
03772   *         @arg @ref LL_ADC_REG_TRIG_EXT_TIM4_CH4
03773   *         @arg @ref LL_ADC_REG_TRIG_EXT_EXTI_LINE11
03774   *         @arg @ref LL_ADC_REG_TRIG_EXT_TIM8_TRGO
03775   *         @arg @ref LL_ADC_REG_TRIG_EXT_TIM8_TRGO2
03776   *         @arg @ref LL_ADC_REG_TRIG_EXT_TIM1_TRGO
03777   *         @arg @ref LL_ADC_REG_TRIG_EXT_TIM1_TRGO2
03778   *         @arg @ref LL_ADC_REG_TRIG_EXT_TIM2_TRGO
03779   *         @arg @ref LL_ADC_REG_TRIG_EXT_TIM4_TRGO
03780   *         @arg @ref LL_ADC_REG_TRIG_EXT_TIM6_TRGO
03781   *         @arg @ref LL_ADC_REG_TRIG_EXT_TIM15_TRGO
03782   *         @arg @ref LL_ADC_REG_TRIG_EXT_TIM3_CH4
03783   *         @arg @ref LL_ADC_REG_TRIG_EXT_HRTIM_TRG1
03784   *         @arg @ref LL_ADC_REG_TRIG_EXT_HRTIM_TRG3
03785   *         @arg @ref LL_ADC_REG_TRIG_EXT_LPTIM1_OUT
03786   *         @arg @ref LL_ADC_REG_TRIG_EXT_LPTIM2_OUT
03787   *         @arg @ref LL_ADC_REG_TRIG_EXT_LPTIM3_OUT
03788   * @retval None
03789   */
03790 __STATIC_INLINE void LL_ADC_REG_SetTriggerSource(ADC_TypeDef *ADCx, uint32_t TriggerSource)
03791 {
03792   MODIFY_REG(ADCx->CFGR, ADC_CFGR_EXTEN | ADC_CFGR_EXTSEL, TriggerSource);
03793 }
03794 
03795 /**
03796   * @brief  Get ADC group regular conversion trigger source:
03797   *         internal (SW start) or from external peripheral (timer event,
03798   *         external interrupt line).
03799   * @note   To determine whether group regular trigger source is
03800   *         internal (SW start) or external, without detail
03801   *         of which peripheral is selected as external trigger,
03802   *         (equivalent to
03803   *         "if(LL_ADC_REG_GetTriggerSource(ADC1) == LL_ADC_REG_TRIG_SOFTWARE)")
03804   *         use function @ref LL_ADC_REG_IsTriggerSourceSWStart.
03805   * @note   Availability of parameters of trigger sources from timer
03806   *         depends on timers availability on the selected device.
03807   * @rmtoll CFGR     EXTSEL         LL_ADC_REG_GetTriggerSource\n
03808   *         CFGR     EXTEN          LL_ADC_REG_GetTriggerSource
03809   * @param  ADCx ADC instance
03810   * @retval Returned value can be one of the following values:
03811   *         @arg @ref LL_ADC_REG_TRIG_SOFTWARE
03812   *         @arg @ref LL_ADC_REG_TRIG_EXT_TIM1_CH1
03813   *         @arg @ref LL_ADC_REG_TRIG_EXT_TIM1_CH2
03814   *         @arg @ref LL_ADC_REG_TRIG_EXT_TIM1_CH3
03815   *         @arg @ref LL_ADC_REG_TRIG_EXT_TIM2_CH2
03816   *         @arg @ref LL_ADC_REG_TRIG_EXT_TIM3_TRGO
03817   *         @arg @ref LL_ADC_REG_TRIG_EXT_TIM4_CH4
03818   *         @arg @ref LL_ADC_REG_TRIG_EXT_EXTI_LINE11
03819   *         @arg @ref LL_ADC_REG_TRIG_EXT_TIM8_TRGO
03820   *         @arg @ref LL_ADC_REG_TRIG_EXT_TIM8_TRGO2
03821   *         @arg @ref LL_ADC_REG_TRIG_EXT_TIM1_TRGO
03822   *         @arg @ref LL_ADC_REG_TRIG_EXT_TIM1_TRGO2
03823   *         @arg @ref LL_ADC_REG_TRIG_EXT_TIM2_TRGO
03824   *         @arg @ref LL_ADC_REG_TRIG_EXT_TIM4_TRGO
03825   *         @arg @ref LL_ADC_REG_TRIG_EXT_TIM6_TRGO
03826   *         @arg @ref LL_ADC_REG_TRIG_EXT_TIM15_TRGO
03827   *         @arg @ref LL_ADC_REG_TRIG_EXT_TIM3_CH4
03828   *         @arg @ref LL_ADC_REG_TRIG_EXT_HRTIM_TRG1
03829   *         @arg @ref LL_ADC_REG_TRIG_EXT_HRTIM_TRG3
03830   *         @arg @ref LL_ADC_REG_TRIG_EXT_LPTIM1_OUT
03831   *         @arg @ref LL_ADC_REG_TRIG_EXT_LPTIM2_OUT
03832   *         @arg @ref LL_ADC_REG_TRIG_EXT_LPTIM3_OUT
03833   */
03834 __STATIC_INLINE uint32_t LL_ADC_REG_GetTriggerSource(ADC_TypeDef *ADCx)
03835 {
03836   __IO uint32_t TriggerSource = READ_BIT(ADCx->CFGR, ADC_CFGR_EXTSEL | ADC_CFGR_EXTEN);
03837 
03838   /* Value for shift of {0; 4; 8; 12} depending on value of bitfield          */
03839   /* corresponding to ADC_CFGR_EXTEN {0; 1; 2; 3}.                            */
03840   uint32_t ShiftExten = ((TriggerSource & ADC_CFGR_EXTEN) >> (ADC_REG_TRIG_EXTEN_BITOFFSET_POS - 2UL));
03841 
03842   /* Set bitfield corresponding to ADC_CFGR_EXTEN and ADC_CFGR_EXTSEL         */
03843   /* to match with triggers literals definition.                              */
03844   return ((TriggerSource
03845            & (ADC_REG_TRIG_SOURCE_MASK >> ShiftExten) & ADC_CFGR_EXTSEL)
03846           | ((ADC_REG_TRIG_EDGE_MASK >> ShiftExten) & ADC_CFGR_EXTEN)
03847          );
03848 }
03849 
03850 /**
03851   * @brief  Get ADC group regular conversion trigger source internal (SW start)
03852   *         or external.
03853   * @note   In case of group regular trigger source set to external trigger,
03854   *         to determine which peripheral is selected as external trigger,
03855   *         use function @ref LL_ADC_REG_GetTriggerSource().
03856   * @rmtoll CFGR     EXTEN          LL_ADC_REG_IsTriggerSourceSWStart
03857   * @param  ADCx ADC instance
03858   * @retval Value "0" if trigger source external trigger
03859   *         Value "1" if trigger source SW start.
03860   */
03861 __STATIC_INLINE uint32_t LL_ADC_REG_IsTriggerSourceSWStart(ADC_TypeDef *ADCx)
03862 {
03863   return ((READ_BIT(ADCx->CFGR, ADC_CFGR_EXTEN) == (LL_ADC_REG_TRIG_SOFTWARE & ADC_CFGR_EXTEN)) ? 1UL : 0UL);
03864 }
03865 
03866 /**
03867   * @brief  Set ADC group regular conversion trigger polarity.
03868   * @note   Applicable only for trigger source set to external trigger.
03869   * @note   On this STM32 series, setting of this feature is conditioned to
03870   *         ADC state:
03871   *         ADC must be disabled or enabled without conversion on going
03872   *         on group regular.
03873   * @rmtoll CFGR     EXTEN          LL_ADC_REG_SetTriggerEdge
03874   * @param  ADCx ADC instance
03875   * @param  ExternalTriggerEdge This parameter can be one of the following values:
03876   *         @arg @ref LL_ADC_REG_TRIG_EXT_RISING
03877   *         @arg @ref LL_ADC_REG_TRIG_EXT_FALLING
03878   *         @arg @ref LL_ADC_REG_TRIG_EXT_RISINGFALLING
03879   * @retval None
03880   */
03881 __STATIC_INLINE void LL_ADC_REG_SetTriggerEdge(ADC_TypeDef *ADCx, uint32_t ExternalTriggerEdge)
03882 {
03883   MODIFY_REG(ADCx->CFGR, ADC_CFGR_EXTEN, ExternalTriggerEdge);
03884 }
03885 
03886 /**
03887   * @brief  Get ADC group regular conversion trigger polarity.
03888   * @note   Applicable only for trigger source set to external trigger.
03889   * @rmtoll CFGR     EXTEN          LL_ADC_REG_GetTriggerEdge
03890   * @param  ADCx ADC instance
03891   * @retval Returned value can be one of the following values:
03892   *         @arg @ref LL_ADC_REG_TRIG_EXT_RISING
03893   *         @arg @ref LL_ADC_REG_TRIG_EXT_FALLING
03894   *         @arg @ref LL_ADC_REG_TRIG_EXT_RISINGFALLING
03895   */
03896 __STATIC_INLINE uint32_t LL_ADC_REG_GetTriggerEdge(ADC_TypeDef *ADCx)
03897 {
03898   return (uint32_t)(READ_BIT(ADCx->CFGR, ADC_CFGR_EXTEN));
03899 }
03900 
03901 #if defined(ADC_VER_V5_V90)
03902 /**
03903   * @brief  Set ADC sampling mode.
03904   * @note   This function set the ADC conversion sampling mode
03905   * @note   This mode applies to regular group only.
03906   * @note   Set sampling mode is applied to all conversion of regular group.
03907   * @note   On this STM32 series, setting of this feature is conditioned to
03908   *         ADC state:
03909   *         ADC must be disabled or enabled without conversion on going
03910   *         on group regular.
03911   * @rmtoll CFGR2    BULB           LL_ADC_REG_SetSamplingMode\n
03912   *         CFGR2    SMPTRIG        LL_ADC_REG_SetSamplingMode
03913   * @param  ADCx ADC instance
03914   * @param  SamplingMode This parameter can be one of the following values:
03915   *         @arg @ref LL_ADC_REG_SAMPLING_MODE_NORMAL
03916   *         @arg @ref LL_ADC_REG_SAMPLING_MODE_BULB
03917   *         @arg @ref LL_ADC_REG_SAMPLING_MODE_TRIGGER_CONTROLED
03918   * @retval None
03919   */
03920 __STATIC_INLINE void LL_ADC_REG_SetSamplingMode(ADC_TypeDef *ADCx, uint32_t SamplingMode)
03921 {
03922   if (ADCx != ADC3)
03923   {
03924     /* Function not available on this instance */
03925   }
03926   else
03927   {
03928     MODIFY_REG(ADCx->CFGR2, ADC3_CFGR2_BULB | ADC3_CFGR2_SMPTRIG, SamplingMode);
03929   }
03930 }
03931 #endif  /* ADC_VER_V5_V90 */
03932 
03933 /**
03934   * @brief  Set ADC group regular sequencer length and scan direction.
03935   * @note   Description of ADC group regular sequencer features:
03936   *         - For devices with sequencer fully configurable
03937   *           (function "LL_ADC_REG_SetSequencerRanks()" available):
03938   *           sequencer length and each rank affectation to a channel
03939   *           are configurable.
03940   *           This function performs configuration of:
03941   *           - Sequence length: Number of ranks in the scan sequence.
03942   *           - Sequence direction: Unless specified in parameters, sequencer
03943   *             scan direction is forward (from rank 1 to rank n).
03944   *           Sequencer ranks are selected using
03945   *           function "LL_ADC_REG_SetSequencerRanks()".
03946   *         - For devices with sequencer not fully configurable
03947   *           (function "LL_ADC_REG_SetSequencerChannels()" available):
03948   *           sequencer length and each rank affectation to a channel
03949   *           are defined by channel number.
03950   *           This function performs configuration of:
03951   *           - Sequence length: Number of ranks in the scan sequence is
03952   *             defined by number of channels set in the sequence,
03953   *             rank of each channel is fixed by channel HW number.
03954   *             (channel 0 fixed on rank 0, channel 1 fixed on rank1, ...).
03955   *           - Sequence direction: Unless specified in parameters, sequencer
03956   *             scan direction is forward (from lowest channel number to
03957   *             highest channel number).
03958   *           Sequencer ranks are selected using
03959   *           function "LL_ADC_REG_SetSequencerChannels()".
03960   * @note   Sequencer disabled is equivalent to sequencer of 1 rank:
03961   *         ADC conversion on only 1 channel.
03962   * @note   On this STM32 series, setting of this feature is conditioned to
03963   *         ADC state:
03964   *         ADC must be disabled or enabled without conversion on going
03965   *         on group regular.
03966   * @rmtoll SQR1     L              LL_ADC_REG_SetSequencerLength
03967   * @param  ADCx ADC instance
03968   * @param  SequencerNbRanks This parameter can be one of the following values:
03969   *         @arg @ref LL_ADC_REG_SEQ_SCAN_DISABLE
03970   *         @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_2RANKS
03971   *         @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_3RANKS
03972   *         @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_4RANKS
03973   *         @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_5RANKS
03974   *         @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_6RANKS
03975   *         @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_7RANKS
03976   *         @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_8RANKS
03977   *         @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_9RANKS
03978   *         @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_10RANKS
03979   *         @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_11RANKS
03980   *         @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_12RANKS
03981   *         @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_13RANKS
03982   *         @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_14RANKS
03983   *         @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_15RANKS
03984   *         @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_16RANKS
03985   * @retval None
03986   */
03987 __STATIC_INLINE void LL_ADC_REG_SetSequencerLength(ADC_TypeDef *ADCx, uint32_t SequencerNbRanks)
03988 {
03989   MODIFY_REG(ADCx->SQR1, ADC_SQR1_L, SequencerNbRanks);
03990 }
03991 
03992 /**
03993   * @brief  Get ADC group regular sequencer length and scan direction.
03994   * @note   Description of ADC group regular sequencer features:
03995   *         - For devices with sequencer fully configurable
03996   *           (function "LL_ADC_REG_SetSequencerRanks()" available):
03997   *           sequencer length and each rank affectation to a channel
03998   *           are configurable.
03999   *           This function retrieves:
04000   *           - Sequence length: Number of ranks in the scan sequence.
04001   *           - Sequence direction: Unless specified in parameters, sequencer
04002   *             scan direction is forward (from rank 1 to rank n).
04003   *           Sequencer ranks are selected using
04004   *           function "LL_ADC_REG_SetSequencerRanks()".
04005   *         - For devices with sequencer not fully configurable
04006   *           (function "LL_ADC_REG_SetSequencerChannels()" available):
04007   *           sequencer length and each rank affectation to a channel
04008   *           are defined by channel number.
04009   *           This function retrieves:
04010   *           - Sequence length: Number of ranks in the scan sequence is
04011   *             defined by number of channels set in the sequence,
04012   *             rank of each channel is fixed by channel HW number.
04013   *             (channel 0 fixed on rank 0, channel 1 fixed on rank1, ...).
04014   *           - Sequence direction: Unless specified in parameters, sequencer
04015   *             scan direction is forward (from lowest channel number to
04016   *             highest channel number).
04017   *           Sequencer ranks are selected using
04018   *           function "LL_ADC_REG_SetSequencerChannels()".
04019   * @note   Sequencer disabled is equivalent to sequencer of 1 rank:
04020   *         ADC conversion on only 1 channel.
04021   * @rmtoll SQR1     L              LL_ADC_REG_GetSequencerLength
04022   * @param  ADCx ADC instance
04023   * @retval Returned value can be one of the following values:
04024   *         @arg @ref LL_ADC_REG_SEQ_SCAN_DISABLE
04025   *         @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_2RANKS
04026   *         @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_3RANKS
04027   *         @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_4RANKS
04028   *         @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_5RANKS
04029   *         @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_6RANKS
04030   *         @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_7RANKS
04031   *         @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_8RANKS
04032   *         @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_9RANKS
04033   *         @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_10RANKS
04034   *         @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_11RANKS
04035   *         @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_12RANKS
04036   *         @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_13RANKS
04037   *         @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_14RANKS
04038   *         @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_15RANKS
04039   *         @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_16RANKS
04040   */
04041 __STATIC_INLINE uint32_t LL_ADC_REG_GetSequencerLength(ADC_TypeDef *ADCx)
04042 {
04043   return (uint32_t)(READ_BIT(ADCx->SQR1, ADC_SQR1_L));
04044 }
04045 
04046 /**
04047   * @brief  Set ADC group regular sequencer discontinuous mode:
04048   *         sequence subdivided and scan conversions interrupted every selected
04049   *         number of ranks.
04050   * @note   It is not possible to enable both ADC group regular
04051   *         continuous mode and sequencer discontinuous mode.
04052   * @note   It is not possible to enable both ADC auto-injected mode
04053   *         and ADC group regular sequencer discontinuous mode.
04054   * @note   On this STM32 series, setting of this feature is conditioned to
04055   *         ADC state:
04056   *         ADC must be disabled or enabled without conversion on going
04057   *         on group regular.
04058   * @rmtoll CFGR     DISCEN         LL_ADC_REG_SetSequencerDiscont\n
04059   *         CFGR     DISCNUM        LL_ADC_REG_SetSequencerDiscont
04060   * @param  ADCx ADC instance
04061   * @param  SeqDiscont This parameter can be one of the following values:
04062   *         @arg @ref LL_ADC_REG_SEQ_DISCONT_DISABLE
04063   *         @arg @ref LL_ADC_REG_SEQ_DISCONT_1RANK
04064   *         @arg @ref LL_ADC_REG_SEQ_DISCONT_2RANKS
04065   *         @arg @ref LL_ADC_REG_SEQ_DISCONT_3RANKS
04066   *         @arg @ref LL_ADC_REG_SEQ_DISCONT_4RANKS
04067   *         @arg @ref LL_ADC_REG_SEQ_DISCONT_5RANKS
04068   *         @arg @ref LL_ADC_REG_SEQ_DISCONT_6RANKS
04069   *         @arg @ref LL_ADC_REG_SEQ_DISCONT_7RANKS
04070   *         @arg @ref LL_ADC_REG_SEQ_DISCONT_8RANKS
04071   * @retval None
04072   */
04073 __STATIC_INLINE void LL_ADC_REG_SetSequencerDiscont(ADC_TypeDef *ADCx, uint32_t SeqDiscont)
04074 {
04075   MODIFY_REG(ADCx->CFGR, ADC_CFGR_DISCEN | ADC_CFGR_DISCNUM, SeqDiscont);
04076 }
04077 
04078 /**
04079   * @brief  Get ADC group regular sequencer discontinuous mode:
04080   *         sequence subdivided and scan conversions interrupted every selected
04081   *         number of ranks.
04082   * @rmtoll CFGR     DISCEN         LL_ADC_REG_GetSequencerDiscont\n
04083   *         CFGR     DISCNUM        LL_ADC_REG_GetSequencerDiscont
04084   * @param  ADCx ADC instance
04085   * @retval Returned value can be one of the following values:
04086   *         @arg @ref LL_ADC_REG_SEQ_DISCONT_DISABLE
04087   *         @arg @ref LL_ADC_REG_SEQ_DISCONT_1RANK
04088   *         @arg @ref LL_ADC_REG_SEQ_DISCONT_2RANKS
04089   *         @arg @ref LL_ADC_REG_SEQ_DISCONT_3RANKS
04090   *         @arg @ref LL_ADC_REG_SEQ_DISCONT_4RANKS
04091   *         @arg @ref LL_ADC_REG_SEQ_DISCONT_5RANKS
04092   *         @arg @ref LL_ADC_REG_SEQ_DISCONT_6RANKS
04093   *         @arg @ref LL_ADC_REG_SEQ_DISCONT_7RANKS
04094   *         @arg @ref LL_ADC_REG_SEQ_DISCONT_8RANKS
04095   */
04096 __STATIC_INLINE uint32_t LL_ADC_REG_GetSequencerDiscont(ADC_TypeDef *ADCx)
04097 {
04098   return (uint32_t)(READ_BIT(ADCx->CFGR, ADC_CFGR_DISCEN | ADC_CFGR_DISCNUM));
04099 }
04100 
04101 /**
04102   * @brief  Set ADC group regular sequence: channel on the selected
04103   *         scan sequence rank.
04104   * @note   This function performs configuration of:
04105   *         - Channels ordering into each rank of scan sequence:
04106   *           whatever channel can be placed into whatever rank.
04107   * @note   On this STM32 series, ADC group regular sequencer is
04108   *         fully configurable: sequencer length and each rank
04109   *         affectation to a channel are configurable.
04110   *         Refer to description of function @ref LL_ADC_REG_SetSequencerLength().
04111   * @note   Depending on devices and packages, some channels may not be available.
04112   *         Refer to device datasheet for channels availability.
04113   * @note   On this STM32 series, to measure internal channels (VrefInt,
04114   *         TempSensor, ...), measurement paths to internal channels must be
04115   *         enabled separately.
04116   *         This can be done using function @ref LL_ADC_SetCommonPathInternalCh().
04117   * @note   On this STM32 series, setting of this feature is conditioned to
04118   *         ADC state:
04119   *         ADC must be disabled or enabled without conversion on going
04120   *         on group regular.
04121   * @rmtoll SQR1     SQ1            LL_ADC_REG_SetSequencerRanks\n
04122   *         SQR1     SQ2            LL_ADC_REG_SetSequencerRanks\n
04123   *         SQR1     SQ3            LL_ADC_REG_SetSequencerRanks\n
04124   *         SQR1     SQ4            LL_ADC_REG_SetSequencerRanks\n
04125   *         SQR2     SQ5            LL_ADC_REG_SetSequencerRanks\n
04126   *         SQR2     SQ6            LL_ADC_REG_SetSequencerRanks\n
04127   *         SQR2     SQ7            LL_ADC_REG_SetSequencerRanks\n
04128   *         SQR2     SQ8            LL_ADC_REG_SetSequencerRanks\n
04129   *         SQR2     SQ9            LL_ADC_REG_SetSequencerRanks\n
04130   *         SQR3     SQ10           LL_ADC_REG_SetSequencerRanks\n
04131   *         SQR3     SQ11           LL_ADC_REG_SetSequencerRanks\n
04132   *         SQR3     SQ12           LL_ADC_REG_SetSequencerRanks\n
04133   *         SQR3     SQ13           LL_ADC_REG_SetSequencerRanks\n
04134   *         SQR3     SQ14           LL_ADC_REG_SetSequencerRanks\n
04135   *         SQR4     SQ15           LL_ADC_REG_SetSequencerRanks\n
04136   *         SQR4     SQ16           LL_ADC_REG_SetSequencerRanks
04137   * @param  ADCx ADC instance
04138   * @param  Rank This parameter can be one of the following values:
04139   *         @arg @ref LL_ADC_REG_RANK_1
04140   *         @arg @ref LL_ADC_REG_RANK_2
04141   *         @arg @ref LL_ADC_REG_RANK_3
04142   *         @arg @ref LL_ADC_REG_RANK_4
04143   *         @arg @ref LL_ADC_REG_RANK_5
04144   *         @arg @ref LL_ADC_REG_RANK_6
04145   *         @arg @ref LL_ADC_REG_RANK_7
04146   *         @arg @ref LL_ADC_REG_RANK_8
04147   *         @arg @ref LL_ADC_REG_RANK_9
04148   *         @arg @ref LL_ADC_REG_RANK_10
04149   *         @arg @ref LL_ADC_REG_RANK_11
04150   *         @arg @ref LL_ADC_REG_RANK_12
04151   *         @arg @ref LL_ADC_REG_RANK_13
04152   *         @arg @ref LL_ADC_REG_RANK_14
04153   *         @arg @ref LL_ADC_REG_RANK_15
04154   *         @arg @ref LL_ADC_REG_RANK_16
04155   * @param  Channel This parameter can be one of the following values:
04156   *         @arg @ref LL_ADC_CHANNEL_0           (3)
04157   *         @arg @ref LL_ADC_CHANNEL_1           (3)
04158   *         @arg @ref LL_ADC_CHANNEL_2           (3)
04159   *         @arg @ref LL_ADC_CHANNEL_3           (3)
04160   *         @arg @ref LL_ADC_CHANNEL_4           (3)
04161   *         @arg @ref LL_ADC_CHANNEL_5           (3)
04162   *         @arg @ref LL_ADC_CHANNEL_6
04163   *         @arg @ref LL_ADC_CHANNEL_7
04164   *         @arg @ref LL_ADC_CHANNEL_8
04165   *         @arg @ref LL_ADC_CHANNEL_9
04166   *         @arg @ref LL_ADC_CHANNEL_10
04167   *         @arg @ref LL_ADC_CHANNEL_11
04168   *         @arg @ref LL_ADC_CHANNEL_12
04169   *         @arg @ref LL_ADC_CHANNEL_13
04170   *         @arg @ref LL_ADC_CHANNEL_14
04171   *         @arg @ref LL_ADC_CHANNEL_15
04172   *         @arg @ref LL_ADC_CHANNEL_16
04173   *         @arg @ref LL_ADC_CHANNEL_17
04174   *         @arg @ref LL_ADC_CHANNEL_18
04175   *         @arg @ref LL_ADC_CHANNEL_19
04176   *         @arg @ref LL_ADC_CHANNEL_VREFINT      (1)
04177   *         @arg @ref LL_ADC_CHANNEL_TEMPSENSOR   (1)
04178   *         @arg @ref LL_ADC_CHANNEL_VBAT         (1)
04179   *         @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)
04180   *         @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)
04181   *
04182   *         (1) On STM32H7, parameter available only on ADC instance: ADC3.\n
04183   *         (2) On STM32H7, parameter available only on ADC instance: ADC2.\n
04184   *         (3) On STM32H7, fast channel (0.125 us for 14-bit resolution (ADC conversion rate up to 8 Ms/s)).
04185   *             Other channels are slow channels (conversion rate: refer to reference manual).
04186   * @retval None
04187   */
04188 __STATIC_INLINE void LL_ADC_REG_SetSequencerRanks(ADC_TypeDef *ADCx, uint32_t Rank, uint32_t Channel)
04189 {
04190   /* Set bits with content of parameter "Channel" with bits position          */
04191   /* in register and register position depending on parameter "Rank".         */
04192   /* Parameters "Rank" and "Channel" are used with masks because containing   */
04193   /* other bits reserved for other purpose.                                   */
04194   __IO uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->SQR1, ((Rank & ADC_REG_SQRX_REGOFFSET_MASK) >> ADC_SQRX_REGOFFSET_POS));
04195 
04196   MODIFY_REG(*preg,
04197              ADC_CHANNEL_ID_NUMBER_MASK_POSBIT0 << (Rank & ADC_REG_RANK_ID_SQRX_MASK),
04198              ((Channel & ADC_CHANNEL_ID_NUMBER_MASK) >> ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS) << (Rank & ADC_REG_RANK_ID_SQRX_MASK));
04199 }
04200 
04201 /**
04202   * @brief  Get ADC group regular sequence: channel on the selected
04203   *         scan sequence rank.
04204   * @note   On this STM32 series, ADC group regular sequencer is
04205   *         fully configurable: sequencer length and each rank
04206   *         affectation to a channel are configurable.
04207   *         Refer to description of function @ref LL_ADC_REG_SetSequencerLength().
04208   * @note   Depending on devices and packages, some channels may not be available.
04209   *         Refer to device datasheet for channels availability.
04210   * @note   Usage of the returned channel number:
04211   *         - To reinject this channel into another function LL_ADC_xxx:
04212   *           the returned channel number is only partly formatted on definition
04213   *           of literals LL_ADC_CHANNEL_x. Therefore, it has to be compared
04214   *           with parts of literals LL_ADC_CHANNEL_x or using
04215   *           helper macro @ref __LL_ADC_CHANNEL_TO_DECIMAL_NB().
04216   *           Then the selected literal LL_ADC_CHANNEL_x can be used
04217   *           as parameter for another function.
04218   *         - To get the channel number in decimal format:
04219   *           process the returned value with the helper macro
04220   *           @ref __LL_ADC_CHANNEL_TO_DECIMAL_NB().
04221   * @rmtoll SQR1     SQ1            LL_ADC_REG_GetSequencerRanks\n
04222   *         SQR1     SQ2            LL_ADC_REG_GetSequencerRanks\n
04223   *         SQR1     SQ3            LL_ADC_REG_GetSequencerRanks\n
04224   *         SQR1     SQ4            LL_ADC_REG_GetSequencerRanks\n
04225   *         SQR2     SQ5            LL_ADC_REG_GetSequencerRanks\n
04226   *         SQR2     SQ6            LL_ADC_REG_GetSequencerRanks\n
04227   *         SQR2     SQ7            LL_ADC_REG_GetSequencerRanks\n
04228   *         SQR2     SQ8            LL_ADC_REG_GetSequencerRanks\n
04229   *         SQR2     SQ9            LL_ADC_REG_GetSequencerRanks\n
04230   *         SQR3     SQ10           LL_ADC_REG_GetSequencerRanks\n
04231   *         SQR3     SQ11           LL_ADC_REG_GetSequencerRanks\n
04232   *         SQR3     SQ12           LL_ADC_REG_GetSequencerRanks\n
04233   *         SQR3     SQ13           LL_ADC_REG_GetSequencerRanks\n
04234   *         SQR3     SQ14           LL_ADC_REG_GetSequencerRanks\n
04235   *         SQR4     SQ15           LL_ADC_REG_GetSequencerRanks\n
04236   *         SQR4     SQ16           LL_ADC_REG_GetSequencerRanks
04237   * @param  ADCx ADC instance
04238   * @param  Rank This parameter can be one of the following values:
04239   *         @arg @ref LL_ADC_REG_RANK_1
04240   *         @arg @ref LL_ADC_REG_RANK_2
04241   *         @arg @ref LL_ADC_REG_RANK_3
04242   *         @arg @ref LL_ADC_REG_RANK_4
04243   *         @arg @ref LL_ADC_REG_RANK_5
04244   *         @arg @ref LL_ADC_REG_RANK_6
04245   *         @arg @ref LL_ADC_REG_RANK_7
04246   *         @arg @ref LL_ADC_REG_RANK_8
04247   *         @arg @ref LL_ADC_REG_RANK_9
04248   *         @arg @ref LL_ADC_REG_RANK_10
04249   *         @arg @ref LL_ADC_REG_RANK_11
04250   *         @arg @ref LL_ADC_REG_RANK_12
04251   *         @arg @ref LL_ADC_REG_RANK_13
04252   *         @arg @ref LL_ADC_REG_RANK_14
04253   *         @arg @ref LL_ADC_REG_RANK_15
04254   *         @arg @ref LL_ADC_REG_RANK_16
04255   * @retval Returned value can be one of the following values:
04256   *         @arg @ref LL_ADC_CHANNEL_0           (3)
04257   *         @arg @ref LL_ADC_CHANNEL_1           (3)
04258   *         @arg @ref LL_ADC_CHANNEL_2           (3)
04259   *         @arg @ref LL_ADC_CHANNEL_3           (3)
04260   *         @arg @ref LL_ADC_CHANNEL_4           (3)
04261   *         @arg @ref LL_ADC_CHANNEL_5           (3)
04262   *         @arg @ref LL_ADC_CHANNEL_6
04263   *         @arg @ref LL_ADC_CHANNEL_7
04264   *         @arg @ref LL_ADC_CHANNEL_8
04265   *         @arg @ref LL_ADC_CHANNEL_9
04266   *         @arg @ref LL_ADC_CHANNEL_10
04267   *         @arg @ref LL_ADC_CHANNEL_11
04268   *         @arg @ref LL_ADC_CHANNEL_12
04269   *         @arg @ref LL_ADC_CHANNEL_13
04270   *         @arg @ref LL_ADC_CHANNEL_14
04271   *         @arg @ref LL_ADC_CHANNEL_15
04272   *         @arg @ref LL_ADC_CHANNEL_16
04273   *         @arg @ref LL_ADC_CHANNEL_17
04274   *         @arg @ref LL_ADC_CHANNEL_18
04275   *         @arg @ref LL_ADC_CHANNEL_19
04276   *         @arg @ref LL_ADC_CHANNEL_VREFINT      (1)
04277   *         @arg @ref LL_ADC_CHANNEL_TEMPSENSOR   (1)
04278   *         @arg @ref LL_ADC_CHANNEL_VBAT         (1)
04279   *         @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)
04280   *         @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)
04281   *
04282   *         (1) On STM32H7, parameter available only on ADC instance: ADC3.\n
04283   *         (2) On STM32H7, parameter available only on ADC instance: ADC2.\n
04284   *         (3) On STM32H7, fast channel (0.125 us for 14-bit resolution (ADC conversion rate up to 8 Ms/s)).
04285   *             Other channels are slow channels (conversion rate: refer to reference manual).\n
04286   *         (1, 2) For ADC channel read back from ADC register,
04287   *                comparison with internal channel parameter to be done
04288   *                using helper macro @ref __LL_ADC_CHANNEL_INTERNAL_TO_EXTERNAL().
04289   */
04290 __STATIC_INLINE uint32_t LL_ADC_REG_GetSequencerRanks(ADC_TypeDef *ADCx, uint32_t Rank)
04291 {
04292   const __IO uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->SQR1, ((Rank & ADC_REG_SQRX_REGOFFSET_MASK) >> ADC_SQRX_REGOFFSET_POS));
04293 
04294   return (uint32_t)((READ_BIT(*preg,
04295                               ADC_CHANNEL_ID_NUMBER_MASK_POSBIT0 << (Rank & ADC_REG_RANK_ID_SQRX_MASK))
04296                      >> (Rank & ADC_REG_RANK_ID_SQRX_MASK)) << ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS
04297                    );
04298 }
04299 
04300 /**
04301   * @brief  Set ADC continuous conversion mode on ADC group regular.
04302   * @note   Description of ADC continuous conversion mode:
04303   *         - single mode: one conversion per trigger
04304   *         - continuous mode: after the first trigger, following
04305   *           conversions launched successively automatically.
04306   * @note   It is not possible to enable both ADC group regular
04307   *         continuous mode and sequencer discontinuous mode.
04308   * @note   On this STM32 series, setting of this feature is conditioned to
04309   *         ADC state:
04310   *         ADC must be disabled or enabled without conversion on going
04311   *         on group regular.
04312   * @rmtoll CFGR     CONT           LL_ADC_REG_SetContinuousMode
04313   * @param  ADCx ADC instance
04314   * @param  Continuous This parameter can be one of the following values:
04315   *         @arg @ref LL_ADC_REG_CONV_SINGLE
04316   *         @arg @ref LL_ADC_REG_CONV_CONTINUOUS
04317   * @retval None
04318   */
04319 __STATIC_INLINE void LL_ADC_REG_SetContinuousMode(ADC_TypeDef *ADCx, uint32_t Continuous)
04320 {
04321   MODIFY_REG(ADCx->CFGR, ADC_CFGR_CONT, Continuous);
04322 }
04323 
04324 /**
04325   * @brief  Get ADC continuous conversion mode on ADC group regular.
04326   * @note   Description of ADC continuous conversion mode:
04327   *         - single mode: one conversion per trigger
04328   *         - continuous mode: after the first trigger, following
04329   *           conversions launched successively automatically.
04330   * @rmtoll CFGR     CONT           LL_ADC_REG_GetContinuousMode
04331   * @param  ADCx ADC instance
04332   * @retval Returned value can be one of the following values:
04333   *         @arg @ref LL_ADC_REG_CONV_SINGLE
04334   *         @arg @ref LL_ADC_REG_CONV_CONTINUOUS
04335   */
04336 __STATIC_INLINE uint32_t LL_ADC_REG_GetContinuousMode(ADC_TypeDef *ADCx)
04337 {
04338   return (uint32_t)(READ_BIT(ADCx->CFGR, ADC_CFGR_CONT));
04339 }
04340 /**
04341   * @brief  Set ADC data transfer mode
04342   * @note   Conversion data can be either:
04343   *            - Available in Data Register
04344   *            - Transferred by DMA in one shot mode
04345   *            - Transferred by DMA in circular mode
04346   *            - Transferred to DFSDM data register
04347   * @rmtoll CFGR     DMNGT           LL_ADC_REG_SetDataTransferMode
04348   * @param  ADCx ADC instance
04349   * @param  DataTransferMode Select Data Management configuration
04350   * @retval None
04351   */
04352 __STATIC_INLINE void LL_ADC_REG_SetDataTransferMode(ADC_TypeDef *ADCx, uint32_t DataTransferMode)
04353 {
04354   MODIFY_REG(ADCx->CFGR, ADC_CFGR_DMNGT, DataTransferMode);
04355 }
04356 
04357 #if defined(ADC_VER_V5_V90)
04358 /**
04359   * @brief  Enable DMA requests for ADC3.
04360   * @rmtoll CFGR     DMAEN          LL_ADC_REG_SetDMATransfer\n
04361   * @param  ADCx ADC instance
04362   * @retval None
04363   */
04364 __STATIC_INLINE void LL_ADC_EnableDMAReq (ADC_TypeDef *ADCx)
04365 {
04366   SET_BIT(ADCx->CFGR, ADC3_CFGR_DMAEN);
04367 }
04368 
04369 __STATIC_INLINE void LL_ADC_DisableDMAReq(ADC_TypeDef *ADCx)
04370 {
04371   CLEAR_BIT (ADCx->CFGR, ADC3_CFGR_DMAEN);
04372 }
04373 
04374 __STATIC_INLINE uint32_t LL_ADC_IsEnabledDMAReq (ADC_TypeDef *ADCx)
04375 {
04376   return ((READ_BIT(ADCx->CFGR, ADC3_CFGR_DMAEN) == (ADC3_CFGR_DMAEN)) ? 1UL : 0UL);
04377 }
04378 /**
04379   * @brief  Set ADC group regular conversion data transfer: no transfer or
04380   *         transfer by DMA, and DMA requests mode.
04381   * @note   If transfer by DMA selected, specifies the DMA requests
04382   *         mode:
04383   *         - Limited mode (One shot mode): DMA transfer requests are stopped
04384   *           when number of DMA data transfers (number of
04385   *           ADC conversions) is reached.
04386   *           This ADC mode is intended to be used with DMA mode non-circular.
04387   *         - Unlimited mode: DMA transfer requests are unlimited,
04388   *           whatever number of DMA data transfers (number of
04389   *           ADC conversions).
04390   *           This ADC mode is intended to be used with DMA mode circular.
04391   * @note   If ADC DMA requests mode is set to unlimited and DMA is set to
04392   *         mode non-circular:
04393   *         when DMA transfers size will be reached, DMA will stop transfers of
04394   *         ADC conversions data ADC will raise an overrun error
04395   *        (overrun flag and interruption if enabled).
04396   * @note   For devices with several ADC instances: ADC multimode DMA
04397   *         settings are available using function @ref LL_ADC_SetMultiDMATransfer().
04398   * @note   To configure DMA source address (peripheral address),
04399   *         use function @ref LL_ADC_DMA_GetRegAddr().
04400   * @note   On this STM32 series, setting of this feature is conditioned to
04401   *         ADC state:
04402   *         ADC must be disabled or enabled without conversion on going
04403   *         on either groups regular or injected.
04404   * @rmtoll CFGR     DMAEN          LL_ADC_REG_SetDMATransferMode\n
04405   *         CFGR     DMACFG         LL_ADC_REG_SetDMATransferMode
04406   * @param  ADCx ADC instance
04407   * @param  DMATransfer This parameter can be one of the following values:
04408   *         @arg @ref LL_ADC3_REG_DMA_TRANSFER_NONE
04409   *         @arg @ref LL_ADC3_REG_DMA_TRANSFER_LIMITED
04410   *         @arg @ref LL_ADC3_REG_DMA_TRANSFER_UNLIMITED
04411   * @retval None
04412   */
04413 __STATIC_INLINE void LL_ADC_REG_SetDMATransferMode(ADC_TypeDef *ADCx, uint32_t DMATransfer)
04414 {
04415   if (ADCx == ADC3)
04416   {
04417     MODIFY_REG(ADCx->CFGR, ADC3_CFGR_DMAEN | ADC3_CFGR_DMACFG, DMATransfer);
04418   }
04419 }
04420 
04421 /**
04422   * @brief  Get ADC group regular conversion data transfer: no transfer or
04423   *         transfer by DMA, and DMA requests mode.
04424   * @note   If transfer by DMA selected, specifies the DMA requests
04425   *         mode:
04426   *         - Limited mode (One shot mode): DMA transfer requests are stopped
04427   *           when number of DMA data transfers (number of
04428   *           ADC conversions) is reached.
04429   *           This ADC mode is intended to be used with DMA mode non-circular.
04430   *         - Unlimited mode: DMA transfer requests are unlimited,
04431   *           whatever number of DMA data transfers (number of
04432   *           ADC conversions).
04433   *           This ADC mode is intended to be used with DMA mode circular.
04434   * @note   If ADC DMA requests mode is set to unlimited and DMA is set to
04435   *         mode non-circular:
04436   *         when DMA transfers size will be reached, DMA will stop transfers of
04437   *         ADC conversions data ADC will raise an overrun error
04438   *         (overrun flag and interruption if enabled).
04439   * @note   For devices with several ADC instances: ADC multimode DMA
04440   *         settings are available using function @ref LL_ADC_GetMultiDMATransfer().
04441   * @note   To configure DMA source address (peripheral address),
04442   *         use function @ref LL_ADC_DMA_GetRegAddr().
04443   * @rmtoll CFGR     DMAEN          LL_ADC_REG_GetDMATransfer\n
04444   *         CFGR     DMACFG         LL_ADC_REG_GetDMATransfer
04445   * @param  ADCx ADC instance
04446   * @retval Returned value can be one of the following values:
04447   *         @arg @ref LL_ADC3_REG_DMA_TRANSFER_NONE
04448   *         @arg @ref LL_ADC3_REG_DMA_TRANSFER_LIMITED
04449   *         @arg @ref LL_ADC3_REG_DMA_TRANSFER_UNLIMITED
04450   */
04451 __STATIC_INLINE uint32_t LL_ADC_REG_GetDMATransferMode(ADC_TypeDef *ADCx)
04452 {
04453   if (ADCx == ADC3)
04454   {
04455     return (uint32_t)(READ_BIT(ADCx->CFGR, ADC3_CFGR_DMAEN | ADC3_CFGR_DMACFG));
04456   }
04457    else
04458   { 
04459     return 0UL;
04460   }
04461 }
04462 
04463 #endif  /* ADC_VER_V5_V90 */
04464 
04465 /**
04466   * @brief  Get ADC data transfer mode
04467   * @note   Conversion data can be either:
04468   *            - Available in Data Register
04469   *            - Transferred by DMA in one shot mode
04470   *            - Transferred by DMA in circular mode
04471   *            - Transferred to DFSDM data register
04472   * @rmtoll CFGR     DMNGT           LL_ADC_REG_GetDataTransferMode
04473   * @param  ADCx ADC instance
04474   * @retval Returned value can be one of the following values:
04475   *         @arg @ref LL_ADC_REG_DR_TRANSFER
04476   *         @arg @ref LL_ADC_REG_DMA_TRANSFER_LIMITED
04477   *         @arg @ref LL_ADC_REG_DMA_TRANSFER_UNLIMITED
04478   *         @arg @ref LL_ADC_REG_DFSDM_TRANSFER
04479   */
04480 __STATIC_INLINE uint32_t LL_ADC_REG_GetDataTransferMode(ADC_TypeDef *ADCx)
04481 {
04482   return (uint32_t)(READ_BIT(ADCx->CFGR, ADC_CFGR_DMNGT));
04483 }
04484 
04485 
04486 /**
04487   * @brief  Set ADC group regular behavior in case of overrun:
04488   *         data preserved or overwritten.
04489   * @note   Compatibility with devices without feature overrun:
04490   *         other devices without this feature have a behavior
04491   *         equivalent to data overwritten.
04492   *         The default setting of overrun is data preserved.
04493   *         Therefore, for compatibility with all devices, parameter
04494   *         overrun should be set to data overwritten.
04495   * @note   On this STM32 series, setting of this feature is conditioned to
04496   *         ADC state:
04497   *         ADC must be disabled or enabled without conversion on going
04498   *         on group regular.
04499   * @rmtoll CFGR     OVRMOD         LL_ADC_REG_SetOverrun
04500   * @param  ADCx ADC instance
04501   * @param  Overrun This parameter can be one of the following values:
04502   *         @arg @ref LL_ADC_REG_OVR_DATA_PRESERVED
04503   *         @arg @ref LL_ADC_REG_OVR_DATA_OVERWRITTEN
04504   * @retval None
04505   */
04506 __STATIC_INLINE void LL_ADC_REG_SetOverrun(ADC_TypeDef *ADCx, uint32_t Overrun)
04507 {
04508   MODIFY_REG(ADCx->CFGR, ADC_CFGR_OVRMOD, Overrun);
04509 }
04510 
04511 /**
04512   * @brief  Get ADC group regular behavior in case of overrun:
04513   *         data preserved or overwritten.
04514   * @rmtoll CFGR     OVRMOD         LL_ADC_REG_GetOverrun
04515   * @param  ADCx ADC instance
04516   * @retval Returned value can be one of the following values:
04517   *         @arg @ref LL_ADC_REG_OVR_DATA_PRESERVED
04518   *         @arg @ref LL_ADC_REG_OVR_DATA_OVERWRITTEN
04519   */
04520 __STATIC_INLINE uint32_t LL_ADC_REG_GetOverrun(ADC_TypeDef *ADCx)
04521 {
04522   return (uint32_t)(READ_BIT(ADCx->CFGR, ADC_CFGR_OVRMOD));
04523 }
04524 
04525 /**
04526   * @}
04527   */
04528 
04529 /** @defgroup ADC_LL_EF_Configuration_ADC_Group_Injected Configuration of ADC hierarchical scope: group injected
04530   * @{
04531   */
04532 
04533 /**
04534   * @brief  Set ADC group injected conversion trigger source:
04535   *         internal (SW start) or from external peripheral (timer event,
04536   *         external interrupt line).
04537   * @note   On this STM32 series, setting trigger source to external trigger
04538   *         also set trigger polarity to rising edge
04539   *         (default setting for compatibility with some ADC on other
04540   *         STM32 families having this setting set by HW default value).
04541   *         In case of need to modify trigger edge, use
04542   *         function @ref LL_ADC_INJ_SetTriggerEdge().
04543   * @note   Availability of parameters of trigger sources from timer
04544   *         depends on timers availability on the selected device.
04545   * @note   On this STM32 series, setting of this feature is conditioned to
04546   *         ADC state:
04547   *         ADC must not be disabled. Can be enabled with or without conversion
04548   *         on going on either groups regular or injected.
04549   * @rmtoll JSQR     JEXTSEL        LL_ADC_INJ_SetTriggerSource\n
04550   *         JSQR     JEXTEN         LL_ADC_INJ_SetTriggerSource
04551   * @param  ADCx ADC instance
04552   * @param  TriggerSource This parameter can be one of the following values:
04553   *         @arg @ref LL_ADC_INJ_TRIG_SOFTWARE
04554   *         @arg @ref LL_ADC_INJ_TRIG_EXT_TIM1_TRGO
04555   *         @arg @ref LL_ADC_INJ_TRIG_EXT_TIM1_CH4
04556   *         @arg @ref LL_ADC_INJ_TRIG_EXT_TIM2_TRGO
04557   *         @arg @ref LL_ADC_INJ_TRIG_EXT_TIM2_CH1
04558   *         @arg @ref LL_ADC_INJ_TRIG_EXT_TIM3_CH4
04559   *         @arg @ref LL_ADC_INJ_TRIG_EXT_TIM4_TRGO
04560   *         @arg @ref LL_ADC_INJ_TRIG_EXT_EXTI_LINE15
04561   *         @arg @ref LL_ADC_INJ_TRIG_EXT_TIM8_CH4
04562   *         @arg @ref LL_ADC_INJ_TRIG_EXT_TIM1_TRGO2
04563   *         @arg @ref LL_ADC_INJ_TRIG_EXT_TIM8_TRGO
04564   *         @arg @ref LL_ADC_INJ_TRIG_EXT_TIM8_TRGO2
04565   *         @arg @ref LL_ADC_INJ_TRIG_EXT_TIM3_CH3
04566   *         @arg @ref LL_ADC_INJ_TRIG_EXT_TIM3_TRGO
04567   *         @arg @ref LL_ADC_INJ_TRIG_EXT_TIM3_CH1
04568   *         @arg @ref LL_ADC_INJ_TRIG_EXT_TIM6_TRGO
04569   *         @arg @ref LL_ADC_INJ_TRIG_EXT_TIM15_TRGO
04570   *         @arg @ref LL_ADC_INJ_TRIG_EXT_HRTIM_TRG2
04571   *         @arg @ref LL_ADC_INJ_TRIG_EXT_HRTIM_TRG4
04572   *         @arg @ref LL_ADC_INJ_TRIG_EXT_LPTIM1_OUT
04573   *         @arg @ref LL_ADC_INJ_TRIG_EXT_LPTIM2_OUT
04574   *         @arg @ref LL_ADC_INJ_TRIG_EXT_LPTIM3_OUT
04575   * @retval None
04576   */
04577 __STATIC_INLINE void LL_ADC_INJ_SetTriggerSource(ADC_TypeDef *ADCx, uint32_t TriggerSource)
04578 {
04579   MODIFY_REG(ADCx->JSQR, ADC_JSQR_JEXTSEL | ADC_JSQR_JEXTEN, TriggerSource);
04580 }
04581 
04582 /**
04583   * @brief  Get ADC group injected conversion trigger source:
04584   *         internal (SW start) or from external peripheral (timer event,
04585   *         external interrupt line).
04586   * @note   To determine whether group injected trigger source is
04587   *         internal (SW start) or external, without detail
04588   *         of which peripheral is selected as external trigger,
04589   *         (equivalent to
04590   *         "if(LL_ADC_INJ_GetTriggerSource(ADC1) == LL_ADC_INJ_TRIG_SOFTWARE)")
04591   *         use function @ref LL_ADC_INJ_IsTriggerSourceSWStart.
04592   * @note   Availability of parameters of trigger sources from timer
04593   *         depends on timers availability on the selected device.
04594   * @rmtoll JSQR     JEXTSEL        LL_ADC_INJ_GetTriggerSource\n
04595   *         JSQR     JEXTEN         LL_ADC_INJ_GetTriggerSource
04596   * @param  ADCx ADC instance
04597   * @retval Returned value can be one of the following values:
04598   *         @arg @ref LL_ADC_INJ_TRIG_SOFTWARE
04599   *         @arg @ref LL_ADC_INJ_TRIG_EXT_TIM1_TRGO
04600   *         @arg @ref LL_ADC_INJ_TRIG_EXT_TIM1_CH4
04601   *         @arg @ref LL_ADC_INJ_TRIG_EXT_TIM2_TRGO
04602   *         @arg @ref LL_ADC_INJ_TRIG_EXT_TIM2_CH1
04603   *         @arg @ref LL_ADC_INJ_TRIG_EXT_TIM3_CH4
04604   *         @arg @ref LL_ADC_INJ_TRIG_EXT_TIM4_TRGO
04605   *         @arg @ref LL_ADC_INJ_TRIG_EXT_EXTI_LINE15
04606   *         @arg @ref LL_ADC_INJ_TRIG_EXT_TIM8_CH4
04607   *         @arg @ref LL_ADC_INJ_TRIG_EXT_TIM1_TRGO2
04608   *         @arg @ref LL_ADC_INJ_TRIG_EXT_TIM8_TRGO
04609   *         @arg @ref LL_ADC_INJ_TRIG_EXT_TIM8_TRGO2
04610   *         @arg @ref LL_ADC_INJ_TRIG_EXT_TIM3_CH3
04611   *         @arg @ref LL_ADC_INJ_TRIG_EXT_TIM3_TRGO
04612   *         @arg @ref LL_ADC_INJ_TRIG_EXT_TIM3_CH1
04613   *         @arg @ref LL_ADC_INJ_TRIG_EXT_TIM6_TRGO
04614   *         @arg @ref LL_ADC_INJ_TRIG_EXT_TIM15_TRGO
04615   *         @arg @ref LL_ADC_INJ_TRIG_EXT_HRTIM_TRG2
04616   *         @arg @ref LL_ADC_INJ_TRIG_EXT_HRTIM_TRG4
04617   *         @arg @ref LL_ADC_INJ_TRIG_EXT_LPTIM1_OUT
04618   *         @arg @ref LL_ADC_INJ_TRIG_EXT_LPTIM2_OUT
04619   *         @arg @ref LL_ADC_INJ_TRIG_EXT_LPTIM3_OUT
04620   */
04621 __STATIC_INLINE uint32_t LL_ADC_INJ_GetTriggerSource(ADC_TypeDef *ADCx)
04622 {
04623   __IO uint32_t TriggerSource = READ_BIT(ADCx->JSQR, ADC_JSQR_JEXTSEL | ADC_JSQR_JEXTEN);
04624 
04625   /* Value for shift of {0; 4; 8; 12} depending on value of bitfield          */
04626   /* corresponding to ADC_JSQR_JEXTEN {0; 1; 2; 3}.                           */
04627   uint32_t ShiftJexten = ((TriggerSource & ADC_JSQR_JEXTEN) >> (ADC_INJ_TRIG_EXTEN_BITOFFSET_POS - 2UL));
04628 
04629   /* Set bitfield corresponding to ADC_JSQR_JEXTEN and ADC_JSQR_JEXTSEL       */
04630   /* to match with triggers literals definition.                              */
04631   return ((TriggerSource
04632            & (ADC_INJ_TRIG_SOURCE_MASK >> ShiftJexten) & ADC_JSQR_JEXTSEL)
04633           | ((ADC_INJ_TRIG_EDGE_MASK >> ShiftJexten) & ADC_JSQR_JEXTEN)
04634          );
04635 }
04636 
04637 /**
04638   * @brief  Get ADC group injected conversion trigger source internal (SW start)
04639             or external
04640   * @note   In case of group injected trigger source set to external trigger,
04641   *         to determine which peripheral is selected as external trigger,
04642   *         use function @ref LL_ADC_INJ_GetTriggerSource.
04643   * @rmtoll JSQR     JEXTEN         LL_ADC_INJ_IsTriggerSourceSWStart
04644   * @param  ADCx ADC instance
04645   * @retval Value "0" if trigger source external trigger
04646   *         Value "1" if trigger source SW start.
04647   */
04648 __STATIC_INLINE uint32_t LL_ADC_INJ_IsTriggerSourceSWStart(ADC_TypeDef *ADCx)
04649 {
04650   return ((READ_BIT(ADCx->JSQR, ADC_JSQR_JEXTEN) == (LL_ADC_INJ_TRIG_SOFTWARE & ADC_JSQR_JEXTEN)) ? 1UL : 0UL);
04651 }
04652 
04653 /**
04654   * @brief  Set ADC group injected conversion trigger polarity.
04655   *         Applicable only for trigger source set to external trigger.
04656   * @note   On this STM32 series, setting of this feature is conditioned to
04657   *         ADC state:
04658   *         ADC must not be disabled. Can be enabled with or without conversion
04659   *         on going on either groups regular or injected.
04660   * @rmtoll JSQR     JEXTEN         LL_ADC_INJ_SetTriggerEdge
04661   * @param  ADCx ADC instance
04662   * @param  ExternalTriggerEdge This parameter can be one of the following values:
04663   *         @arg @ref LL_ADC_INJ_TRIG_EXT_RISING
04664   *         @arg @ref LL_ADC_INJ_TRIG_EXT_FALLING
04665   *         @arg @ref LL_ADC_INJ_TRIG_EXT_RISINGFALLING
04666   * @retval None
04667   */
04668 __STATIC_INLINE void LL_ADC_INJ_SetTriggerEdge(ADC_TypeDef *ADCx, uint32_t ExternalTriggerEdge)
04669 {
04670   MODIFY_REG(ADCx->JSQR, ADC_JSQR_JEXTEN, ExternalTriggerEdge);
04671 }
04672 
04673 /**
04674   * @brief  Get ADC group injected conversion trigger polarity.
04675   *         Applicable only for trigger source set to external trigger.
04676   * @rmtoll JSQR     JEXTEN         LL_ADC_INJ_GetTriggerEdge
04677   * @param  ADCx ADC instance
04678   * @retval Returned value can be one of the following values:
04679   *         @arg @ref LL_ADC_INJ_TRIG_EXT_RISING
04680   *         @arg @ref LL_ADC_INJ_TRIG_EXT_FALLING
04681   *         @arg @ref LL_ADC_INJ_TRIG_EXT_RISINGFALLING
04682   */
04683 __STATIC_INLINE uint32_t LL_ADC_INJ_GetTriggerEdge(ADC_TypeDef *ADCx)
04684 {
04685   return (uint32_t)(READ_BIT(ADCx->JSQR, ADC_JSQR_JEXTEN));
04686 }
04687 
04688 /**
04689   * @brief  Set ADC group injected sequencer length and scan direction.
04690   * @note   This function performs configuration of:
04691   *         - Sequence length: Number of ranks in the scan sequence.
04692   *         - Sequence direction: Unless specified in parameters, sequencer
04693   *           scan direction is forward (from rank 1 to rank n).
04694   * @note   Sequencer disabled is equivalent to sequencer of 1 rank:
04695   *         ADC conversion on only 1 channel.
04696   * @note   On this STM32 series, setting of this feature is conditioned to
04697   *         ADC state:
04698   *         ADC must not be disabled. Can be enabled with or without conversion
04699   *         on going on either groups regular or injected.
04700   * @rmtoll JSQR     JL             LL_ADC_INJ_SetSequencerLength
04701   * @param  ADCx ADC instance
04702   * @param  SequencerNbRanks This parameter can be one of the following values:
04703   *         @arg @ref LL_ADC_INJ_SEQ_SCAN_DISABLE
04704   *         @arg @ref LL_ADC_INJ_SEQ_SCAN_ENABLE_2RANKS
04705   *         @arg @ref LL_ADC_INJ_SEQ_SCAN_ENABLE_3RANKS
04706   *         @arg @ref LL_ADC_INJ_SEQ_SCAN_ENABLE_4RANKS
04707   * @retval None
04708   */
04709 __STATIC_INLINE void LL_ADC_INJ_SetSequencerLength(ADC_TypeDef *ADCx, uint32_t SequencerNbRanks)
04710 {
04711   MODIFY_REG(ADCx->JSQR, ADC_JSQR_JL, SequencerNbRanks);
04712 }
04713 
04714 /**
04715   * @brief  Get ADC group injected sequencer length and scan direction.
04716   * @note   This function retrieves:
04717   *         - Sequence length: Number of ranks in the scan sequence.
04718   *         - Sequence direction: Unless specified in parameters, sequencer
04719   *           scan direction is forward (from rank 1 to rank n).
04720   * @note   Sequencer disabled is equivalent to sequencer of 1 rank:
04721   *         ADC conversion on only 1 channel.
04722   * @rmtoll JSQR     JL             LL_ADC_INJ_GetSequencerLength
04723   * @param  ADCx ADC instance
04724   * @retval Returned value can be one of the following values:
04725   *         @arg @ref LL_ADC_INJ_SEQ_SCAN_DISABLE
04726   *         @arg @ref LL_ADC_INJ_SEQ_SCAN_ENABLE_2RANKS
04727   *         @arg @ref LL_ADC_INJ_SEQ_SCAN_ENABLE_3RANKS
04728   *         @arg @ref LL_ADC_INJ_SEQ_SCAN_ENABLE_4RANKS
04729   */
04730 __STATIC_INLINE uint32_t LL_ADC_INJ_GetSequencerLength(ADC_TypeDef *ADCx)
04731 {
04732   return (uint32_t)(READ_BIT(ADCx->JSQR, ADC_JSQR_JL));
04733 }
04734 
04735 /**
04736   * @brief  Set ADC group injected sequencer discontinuous mode:
04737   *         sequence subdivided and scan conversions interrupted every selected
04738   *         number of ranks.
04739   * @note   It is not possible to enable both ADC group injected
04740   *         auto-injected mode and sequencer discontinuous mode.
04741   * @rmtoll CFGR     JDISCEN        LL_ADC_INJ_SetSequencerDiscont
04742   * @param  ADCx ADC instance
04743   * @param  SeqDiscont This parameter can be one of the following values:
04744   *         @arg @ref LL_ADC_INJ_SEQ_DISCONT_DISABLE
04745   *         @arg @ref LL_ADC_INJ_SEQ_DISCONT_1RANK
04746   * @retval None
04747   */
04748 __STATIC_INLINE void LL_ADC_INJ_SetSequencerDiscont(ADC_TypeDef *ADCx, uint32_t SeqDiscont)
04749 {
04750   MODIFY_REG(ADCx->CFGR, ADC_CFGR_JDISCEN, SeqDiscont);
04751 }
04752 
04753 /**
04754   * @brief  Get ADC group injected sequencer discontinuous mode:
04755   *         sequence subdivided and scan conversions interrupted every selected
04756   *         number of ranks.
04757   * @rmtoll CFGR     JDISCEN        LL_ADC_INJ_GetSequencerDiscont
04758   * @param  ADCx ADC instance
04759   * @retval Returned value can be one of the following values:
04760   *         @arg @ref LL_ADC_INJ_SEQ_DISCONT_DISABLE
04761   *         @arg @ref LL_ADC_INJ_SEQ_DISCONT_1RANK
04762   */
04763 __STATIC_INLINE uint32_t LL_ADC_INJ_GetSequencerDiscont(ADC_TypeDef *ADCx)
04764 {
04765   return (uint32_t)(READ_BIT(ADCx->CFGR, ADC_CFGR_JDISCEN));
04766 }
04767 
04768 /**
04769   * @brief  Set ADC group injected sequence: channel on the selected
04770   *         sequence rank.
04771   * @note   Depending on devices and packages, some channels may not be available.
04772   *         Refer to device datasheet for channels availability.
04773   * @note   On this STM32 series, to measure internal channels (VrefInt,
04774   *         TempSensor, ...), measurement paths to internal channels must be
04775   *         enabled separately.
04776   *         This can be done using function @ref LL_ADC_SetCommonPathInternalCh().
04777   * @note   On STM32H7, some fast channels are available: fast analog inputs
04778   *         coming from GPIO pads (ADC_IN0..5).
04779   * @note   On this STM32 series, setting of this feature is conditioned to
04780   *         ADC state:
04781   *         ADC must not be disabled. Can be enabled with or without conversion
04782   *         on going on either groups regular or injected.
04783   * @rmtoll JSQR     JSQ1           LL_ADC_INJ_SetSequencerRanks\n
04784   *         JSQR     JSQ2           LL_ADC_INJ_SetSequencerRanks\n
04785   *         JSQR     JSQ3           LL_ADC_INJ_SetSequencerRanks\n
04786   *         JSQR     JSQ4           LL_ADC_INJ_SetSequencerRanks
04787   * @param  ADCx ADC instance
04788   * @param  Rank This parameter can be one of the following values:
04789   *         @arg @ref LL_ADC_INJ_RANK_1
04790   *         @arg @ref LL_ADC_INJ_RANK_2
04791   *         @arg @ref LL_ADC_INJ_RANK_3
04792   *         @arg @ref LL_ADC_INJ_RANK_4
04793   * @param  Channel This parameter can be one of the following values:
04794   *         @arg @ref LL_ADC_CHANNEL_0           (3)
04795   *         @arg @ref LL_ADC_CHANNEL_1           (3)
04796   *         @arg @ref LL_ADC_CHANNEL_2           (3)
04797   *         @arg @ref LL_ADC_CHANNEL_3           (3)
04798   *         @arg @ref LL_ADC_CHANNEL_4           (3)
04799   *         @arg @ref LL_ADC_CHANNEL_5           (3)
04800   *         @arg @ref LL_ADC_CHANNEL_6
04801   *         @arg @ref LL_ADC_CHANNEL_7
04802   *         @arg @ref LL_ADC_CHANNEL_8
04803   *         @arg @ref LL_ADC_CHANNEL_9
04804   *         @arg @ref LL_ADC_CHANNEL_10
04805   *         @arg @ref LL_ADC_CHANNEL_11
04806   *         @arg @ref LL_ADC_CHANNEL_12
04807   *         @arg @ref LL_ADC_CHANNEL_13
04808   *         @arg @ref LL_ADC_CHANNEL_14
04809   *         @arg @ref LL_ADC_CHANNEL_15
04810   *         @arg @ref LL_ADC_CHANNEL_16
04811   *         @arg @ref LL_ADC_CHANNEL_17
04812   *         @arg @ref LL_ADC_CHANNEL_18
04813   *         @arg @ref LL_ADC_CHANNEL_19
04814   *         @arg @ref LL_ADC_CHANNEL_VREFINT      (1)
04815   *         @arg @ref LL_ADC_CHANNEL_TEMPSENSOR   (1)
04816   *         @arg @ref LL_ADC_CHANNEL_VBAT         (1)
04817   *         @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)
04818   *         @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)
04819   *
04820   *         (1) On STM32H7, parameter available only on ADC instance: ADC3.\n
04821   *         (2) On STM32H7, parameter available only on ADC instance: ADC2.\n
04822   *         (3) On STM32H7, fast channel (0.125 us for 14-bit resolution (ADC conversion rate up to 8 Ms/s)).
04823   *             Other channels are slow channels (conversion rate: refer to reference manual).
04824   * @retval None
04825   */
04826 __STATIC_INLINE void LL_ADC_INJ_SetSequencerRanks(ADC_TypeDef *ADCx, uint32_t Rank, uint32_t Channel)
04827 {
04828   /* Set bits with content of parameter "Channel" with bits position          */
04829   /* in register depending on parameter "Rank".                               */
04830   /* Parameters "Rank" and "Channel" are used with masks because containing   */
04831   /* other bits reserved for other purpose.                                   */
04832   MODIFY_REG(ADCx->JSQR,
04833              (ADC_CHANNEL_ID_NUMBER_MASK >> ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS) << (Rank & ADC_INJ_RANK_ID_JSQR_MASK),
04834              ((Channel & ADC_CHANNEL_ID_NUMBER_MASK) >> ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS) << (Rank & ADC_INJ_RANK_ID_JSQR_MASK));
04835 }
04836 
04837 /**
04838   * @brief  Get ADC group injected sequence: channel on the selected
04839   *         sequence rank.
04840   * @note   Depending on devices and packages, some channels may not be available.
04841   *         Refer to device datasheet for channels availability.
04842   * @note   Usage of the returned channel number:
04843   *         - To reinject this channel into another function LL_ADC_xxx:
04844   *           the returned channel number is only partly formatted on definition
04845   *           of literals LL_ADC_CHANNEL_x. Therefore, it has to be compared
04846   *           with parts of literals LL_ADC_CHANNEL_x or using
04847   *           helper macro @ref __LL_ADC_CHANNEL_TO_DECIMAL_NB().
04848   *           Then the selected literal LL_ADC_CHANNEL_x can be used
04849   *           as parameter for another function.
04850   *         - To get the channel number in decimal format:
04851   *           process the returned value with the helper macro
04852   *           @ref __LL_ADC_CHANNEL_TO_DECIMAL_NB().
04853   * @rmtoll JSQR     JSQ1           LL_ADC_INJ_GetSequencerRanks\n
04854   *         JSQR     JSQ2           LL_ADC_INJ_GetSequencerRanks\n
04855   *         JSQR     JSQ3           LL_ADC_INJ_GetSequencerRanks\n
04856   *         JSQR     JSQ4           LL_ADC_INJ_GetSequencerRanks
04857   * @param  ADCx ADC instance
04858   * @param  Rank This parameter can be one of the following values:
04859   *         @arg @ref LL_ADC_INJ_RANK_1
04860   *         @arg @ref LL_ADC_INJ_RANK_2
04861   *         @arg @ref LL_ADC_INJ_RANK_3
04862   *         @arg @ref LL_ADC_INJ_RANK_4
04863   * @retval Returned value can be one of the following values:
04864   *         @arg @ref LL_ADC_CHANNEL_0           (3)
04865   *         @arg @ref LL_ADC_CHANNEL_1           (3)
04866   *         @arg @ref LL_ADC_CHANNEL_2           (3)
04867   *         @arg @ref LL_ADC_CHANNEL_3           (3)
04868   *         @arg @ref LL_ADC_CHANNEL_4           (3)
04869   *         @arg @ref LL_ADC_CHANNEL_5           (3)
04870   *         @arg @ref LL_ADC_CHANNEL_6
04871   *         @arg @ref LL_ADC_CHANNEL_7
04872   *         @arg @ref LL_ADC_CHANNEL_8
04873   *         @arg @ref LL_ADC_CHANNEL_9
04874   *         @arg @ref LL_ADC_CHANNEL_10
04875   *         @arg @ref LL_ADC_CHANNEL_11
04876   *         @arg @ref LL_ADC_CHANNEL_12
04877   *         @arg @ref LL_ADC_CHANNEL_13
04878   *         @arg @ref LL_ADC_CHANNEL_14
04879   *         @arg @ref LL_ADC_CHANNEL_15
04880   *         @arg @ref LL_ADC_CHANNEL_16
04881   *         @arg @ref LL_ADC_CHANNEL_17
04882   *         @arg @ref LL_ADC_CHANNEL_18
04883   *         @arg @ref LL_ADC_CHANNEL_19
04884   *         @arg @ref LL_ADC_CHANNEL_VREFINT      (1)
04885   *         @arg @ref LL_ADC_CHANNEL_TEMPSENSOR   (1)
04886   *         @arg @ref LL_ADC_CHANNEL_VBAT         (1)
04887   *         @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)
04888   *         @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)
04889   *
04890   *         (1) On STM32H7, parameter available only on ADC instance: ADC3.\n
04891   *         (2) On STM32H7, parameter available only on ADC instance: ADC2.\n
04892   *         (3) On STM32H7, fast channel (0.125 us for 14-bit resolution (ADC conversion rate up to 8 Ms/s)).
04893   *             Other channels are slow channels (conversion rate: refer to reference manual).\n
04894   *         (1, 2) For ADC channel read back from ADC register,
04895   *                comparison with internal channel parameter to be done
04896   *                using helper macro @ref __LL_ADC_CHANNEL_INTERNAL_TO_EXTERNAL().
04897   */
04898 __STATIC_INLINE uint32_t LL_ADC_INJ_GetSequencerRanks(ADC_TypeDef *ADCx, uint32_t Rank)
04899 {
04900   return (uint32_t)((READ_BIT(ADCx->JSQR,
04901                              (ADC_CHANNEL_ID_NUMBER_MASK >> ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS) << (Rank & ADC_INJ_RANK_ID_JSQR_MASK))
04902                     >> (Rank & ADC_INJ_RANK_ID_JSQR_MASK)) << ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS
04903                    );
04904 }
04905 
04906 /**
04907   * @brief  Set ADC group injected conversion trigger:
04908   *         independent or from ADC group regular.
04909   * @note   This mode can be used to extend number of data registers
04910   *         updated after one ADC conversion trigger and with data
04911   *         permanently kept (not erased by successive conversions of scan of
04912   *         ADC sequencer ranks), up to 5 data registers:
04913   *         1 data register on ADC group regular, 4 data registers
04914   *         on ADC group injected.
04915   * @note   If ADC group injected injected trigger source is set to an
04916   *         external trigger, this feature must be must be set to
04917   *         independent trigger.
04918   *         ADC group injected automatic trigger is compliant only with
04919   *         group injected trigger source set to SW start, without any
04920   *         further action on  ADC group injected conversion start or stop:
04921   *         in this case, ADC group injected is controlled only
04922   *         from ADC group regular.
04923   * @note   It is not possible to enable both ADC group injected
04924   *         auto-injected mode and sequencer discontinuous mode.
04925   * @note   On this STM32 series, setting of this feature is conditioned to
04926   *         ADC state:
04927   *         ADC must be disabled or enabled without conversion on going
04928   *         on either groups regular or injected.
04929   * @rmtoll CFGR     JAUTO          LL_ADC_INJ_SetTrigAuto
04930   * @param  ADCx ADC instance
04931   * @param  TrigAuto This parameter can be one of the following values:
04932   *         @arg @ref LL_ADC_INJ_TRIG_INDEPENDENT
04933   *         @arg @ref LL_ADC_INJ_TRIG_FROM_GRP_REGULAR
04934   * @retval None
04935   */
04936 __STATIC_INLINE void LL_ADC_INJ_SetTrigAuto(ADC_TypeDef *ADCx, uint32_t TrigAuto)
04937 {
04938   MODIFY_REG(ADCx->CFGR, ADC_CFGR_JAUTO, TrigAuto);
04939 }
04940 
04941 /**
04942   * @brief  Get ADC group injected conversion trigger:
04943   *         independent or from ADC group regular.
04944   * @rmtoll CFGR     JAUTO          LL_ADC_INJ_GetTrigAuto
04945   * @param  ADCx ADC instance
04946   * @retval Returned value can be one of the following values:
04947   *         @arg @ref LL_ADC_INJ_TRIG_INDEPENDENT
04948   *         @arg @ref LL_ADC_INJ_TRIG_FROM_GRP_REGULAR
04949   */
04950 __STATIC_INLINE uint32_t LL_ADC_INJ_GetTrigAuto(ADC_TypeDef *ADCx)
04951 {
04952   return (uint32_t)(READ_BIT(ADCx->CFGR, ADC_CFGR_JAUTO));
04953 }
04954 
04955 /**
04956   * @brief  Set ADC group injected contexts queue mode.
04957   * @note   A context is a setting of group injected sequencer:
04958   *         - group injected trigger
04959   *         - sequencer length
04960   *         - sequencer ranks
04961   *         If contexts queue is disabled:
04962   *         - only 1 sequence can be configured
04963   *           and is active perpetually.
04964   *         If contexts queue is enabled:
04965   *         - up to 2 contexts can be queued
04966   *           and are checked in and out as a FIFO stack (first-in, first-out).
04967   *         - If a new context is set when queues is full, error is triggered
04968   *           by interruption "Injected Queue Overflow".
04969   *         - Two behaviors are possible when all contexts have been processed:
04970   *           the contexts queue can maintain the last context active perpetually
04971   *           or can be empty and injected group triggers are disabled.
04972   *         - Triggers can be only external (not internal SW start)
04973   *         - Caution: The sequence must be fully configured in one time
04974   *           (one write of register JSQR makes a check-in of a new context
04975   *           into the queue).
04976   *           Therefore functions to set separately injected trigger and
04977   *           sequencer channels cannot be used, register JSQR must be set
04978   *           using function @ref LL_ADC_INJ_ConfigQueueContext().
04979   * @note   This parameter can be modified only when no conversion is on going
04980   *         on either groups regular or injected.
04981   * @note   A modification of the context mode (bit JQDIS) causes the contexts
04982   *         queue to be flushed and the register JSQR is cleared.
04983   * @note   On this STM32 series, setting of this feature is conditioned to
04984   *         ADC state:
04985   *         ADC must be disabled or enabled without conversion on going
04986   *         on either groups regular or injected.
04987   * @rmtoll CFGR     JQM            LL_ADC_INJ_SetQueueMode\n
04988   *         CFGR     JQDIS          LL_ADC_INJ_SetQueueMode
04989   * @param  ADCx ADC instance
04990   * @param  QueueMode This parameter can be one of the following values:
04991   *         @arg @ref LL_ADC_INJ_QUEUE_DISABLE
04992   *         @arg @ref LL_ADC_INJ_QUEUE_2CONTEXTS_LAST_ACTIVE
04993   *         @arg @ref LL_ADC_INJ_QUEUE_2CONTEXTS_END_EMPTY
04994   * @retval None
04995   */
04996 __STATIC_INLINE void LL_ADC_INJ_SetQueueMode(ADC_TypeDef *ADCx, uint32_t QueueMode)
04997 {
04998   MODIFY_REG(ADCx->CFGR, ADC_CFGR_JQM | ADC_CFGR_JQDIS, QueueMode);
04999 }
05000 
05001 /**
05002   * @brief  Get ADC group injected context queue mode.
05003   * @rmtoll CFGR     JQM            LL_ADC_INJ_GetQueueMode\n
05004   *         CFGR     JQDIS          LL_ADC_INJ_GetQueueMode
05005   * @param  ADCx ADC instance
05006   * @retval Returned value can be one of the following values:
05007   *         @arg @ref LL_ADC_INJ_QUEUE_DISABLE
05008   *         @arg @ref LL_ADC_INJ_QUEUE_2CONTEXTS_LAST_ACTIVE
05009   *         @arg @ref LL_ADC_INJ_QUEUE_2CONTEXTS_END_EMPTY
05010   */
05011 __STATIC_INLINE uint32_t LL_ADC_INJ_GetQueueMode(ADC_TypeDef *ADCx)
05012 {
05013   return (uint32_t)(READ_BIT(ADCx->CFGR, ADC_CFGR_JQM | ADC_CFGR_JQDIS));
05014 }
05015 
05016 /**
05017   * @brief  Set one context on ADC group injected that will be checked in
05018   *         contexts queue.
05019   * @note   A context is a setting of group injected sequencer:
05020   *         - group injected trigger
05021   *         - sequencer length
05022   *         - sequencer ranks
05023   *         This function is intended to be used when contexts queue is enabled,
05024   *         because the sequence must be fully configured in one time
05025   *         (functions to set separately injected trigger and sequencer channels
05026   *         cannot be used):
05027   *         Refer to function @ref LL_ADC_INJ_SetQueueMode().
05028   * @note   In the contexts queue, only the active context can be read.
05029   *         The parameters of this function can be read using functions:
05030   *         @arg @ref LL_ADC_INJ_GetTriggerSource()
05031   *         @arg @ref LL_ADC_INJ_GetTriggerEdge()
05032   *         @arg @ref LL_ADC_INJ_GetSequencerRanks()
05033   * @note   On this STM32 series, to measure internal channels (VrefInt,
05034   *         TempSensor, ...), measurement paths to internal channels must be
05035   *         enabled separately.
05036   *         This can be done using function @ref LL_ADC_SetCommonPathInternalCh().
05037   * @note   On STM32H7, some fast channels are available: fast analog inputs
05038   *         coming from GPIO pads (ADC_IN0..5).
05039   * @note   On this STM32 series, setting of this feature is conditioned to
05040   *         ADC state:
05041   *         ADC must not be disabled. Can be enabled with or without conversion
05042   *         on going on either groups regular or injected.
05043   * @rmtoll JSQR     JEXTSEL        LL_ADC_INJ_ConfigQueueContext\n
05044   *         JSQR     JEXTEN         LL_ADC_INJ_ConfigQueueContext\n
05045   *         JSQR     JL             LL_ADC_INJ_ConfigQueueContext\n
05046   *         JSQR     JSQ1           LL_ADC_INJ_ConfigQueueContext\n
05047   *         JSQR     JSQ2           LL_ADC_INJ_ConfigQueueContext\n
05048   *         JSQR     JSQ3           LL_ADC_INJ_ConfigQueueContext\n
05049   *         JSQR     JSQ4           LL_ADC_INJ_ConfigQueueContext
05050   * @param  ADCx ADC instance
05051   * @param  TriggerSource This parameter can be one of the following values:
05052   *         @arg @ref LL_ADC_INJ_TRIG_SOFTWARE
05053   *         @arg @ref LL_ADC_INJ_TRIG_EXT_TIM1_TRGO
05054   *         @arg @ref LL_ADC_INJ_TRIG_EXT_TIM1_CH4
05055   *         @arg @ref LL_ADC_INJ_TRIG_EXT_TIM2_TRGO
05056   *         @arg @ref LL_ADC_INJ_TRIG_EXT_TIM2_CH1
05057   *         @arg @ref LL_ADC_INJ_TRIG_EXT_TIM3_CH4
05058   *         @arg @ref LL_ADC_INJ_TRIG_EXT_TIM4_TRGO
05059   *         @arg @ref LL_ADC_INJ_TRIG_EXT_EXTI_LINE15
05060   *         @arg @ref LL_ADC_INJ_TRIG_EXT_TIM8_CH4
05061   *         @arg @ref LL_ADC_INJ_TRIG_EXT_TIM1_TRGO2
05062   *         @arg @ref LL_ADC_INJ_TRIG_EXT_TIM8_TRGO
05063   *         @arg @ref LL_ADC_INJ_TRIG_EXT_TIM8_TRGO2
05064   *         @arg @ref LL_ADC_INJ_TRIG_EXT_TIM3_CH3
05065   *         @arg @ref LL_ADC_INJ_TRIG_EXT_TIM3_TRGO
05066   *         @arg @ref LL_ADC_INJ_TRIG_EXT_TIM3_CH1
05067   *         @arg @ref LL_ADC_INJ_TRIG_EXT_TIM6_TRGO
05068   *         @arg @ref LL_ADC_INJ_TRIG_EXT_TIM15_TRGO
05069   *         @arg @ref LL_ADC_INJ_TRIG_EXT_HRTIM_TRG2
05070   *         @arg @ref LL_ADC_INJ_TRIG_EXT_HRTIM_TRG4
05071   *         @arg @ref LL_ADC_INJ_TRIG_EXT_LPTIM1_OUT
05072   *         @arg @ref LL_ADC_INJ_TRIG_EXT_LPTIM2_OUT
05073   *         @arg @ref LL_ADC_INJ_TRIG_EXT_LPTIM3_OUT
05074   * @param  ExternalTriggerEdge This parameter can be one of the following values:
05075   *         @arg @ref LL_ADC_INJ_TRIG_EXT_RISING
05076   *         @arg @ref LL_ADC_INJ_TRIG_EXT_FALLING
05077   *         @arg @ref LL_ADC_INJ_TRIG_EXT_RISINGFALLING
05078   *
05079   *         Note: This parameter is discarded in case of SW start:
05080   *               parameter "TriggerSource" set to "LL_ADC_INJ_TRIG_SOFTWARE".
05081   * @param  SequencerNbRanks This parameter can be one of the following values:
05082   *         @arg @ref LL_ADC_INJ_SEQ_SCAN_DISABLE
05083   *         @arg @ref LL_ADC_INJ_SEQ_SCAN_ENABLE_2RANKS
05084   *         @arg @ref LL_ADC_INJ_SEQ_SCAN_ENABLE_3RANKS
05085   *         @arg @ref LL_ADC_INJ_SEQ_SCAN_ENABLE_4RANKS
05086   * @param  Rank1_Channel This parameter can be one of the following values:
05087   *         @arg @ref LL_ADC_CHANNEL_0           (3)
05088   *         @arg @ref LL_ADC_CHANNEL_1           (3)
05089   *         @arg @ref LL_ADC_CHANNEL_2           (3)
05090   *         @arg @ref LL_ADC_CHANNEL_3           (3)
05091   *         @arg @ref LL_ADC_CHANNEL_4           (3)
05092   *         @arg @ref LL_ADC_CHANNEL_5           (3)
05093   *         @arg @ref LL_ADC_CHANNEL_6
05094   *         @arg @ref LL_ADC_CHANNEL_7
05095   *         @arg @ref LL_ADC_CHANNEL_8
05096   *         @arg @ref LL_ADC_CHANNEL_9
05097   *         @arg @ref LL_ADC_CHANNEL_10
05098   *         @arg @ref LL_ADC_CHANNEL_11
05099   *         @arg @ref LL_ADC_CHANNEL_12
05100   *         @arg @ref LL_ADC_CHANNEL_13
05101   *         @arg @ref LL_ADC_CHANNEL_14
05102   *         @arg @ref LL_ADC_CHANNEL_15
05103   *         @arg @ref LL_ADC_CHANNEL_16
05104   *         @arg @ref LL_ADC_CHANNEL_17
05105   *         @arg @ref LL_ADC_CHANNEL_18
05106   *         @arg @ref LL_ADC_CHANNEL_19
05107   *         @arg @ref LL_ADC_CHANNEL_VREFINT      (1)
05108   *         @arg @ref LL_ADC_CHANNEL_TEMPSENSOR   (1)
05109   *         @arg @ref LL_ADC_CHANNEL_VBAT         (1)
05110   *         @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)
05111   *         @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)
05112   *
05113   *         (1) On STM32H7, parameter available only on ADC instance: ADC3.\n
05114   *         (2) On STM32H7, parameter available only on ADC instance: ADC2.\n
05115   *         (3) On STM32H7, fast channel (0.125 us for 14-bit resolution (ADC conversion rate up to 8 Ms/s)).
05116   *             Other channels are slow channels (conversion rate: refer to reference manual).
05117   * @param  Rank2_Channel This parameter can be one of the following values:
05118   *         @arg @ref LL_ADC_CHANNEL_0           (3)
05119   *         @arg @ref LL_ADC_CHANNEL_1           (3)
05120   *         @arg @ref LL_ADC_CHANNEL_2           (3)
05121   *         @arg @ref LL_ADC_CHANNEL_3           (3)
05122   *         @arg @ref LL_ADC_CHANNEL_4           (3)
05123   *         @arg @ref LL_ADC_CHANNEL_5           (3)
05124   *         @arg @ref LL_ADC_CHANNEL_6
05125   *         @arg @ref LL_ADC_CHANNEL_7
05126   *         @arg @ref LL_ADC_CHANNEL_8
05127   *         @arg @ref LL_ADC_CHANNEL_9
05128   *         @arg @ref LL_ADC_CHANNEL_10
05129   *         @arg @ref LL_ADC_CHANNEL_11
05130   *         @arg @ref LL_ADC_CHANNEL_12
05131   *         @arg @ref LL_ADC_CHANNEL_13
05132   *         @arg @ref LL_ADC_CHANNEL_14
05133   *         @arg @ref LL_ADC_CHANNEL_15
05134   *         @arg @ref LL_ADC_CHANNEL_16
05135   *         @arg @ref LL_ADC_CHANNEL_17
05136   *         @arg @ref LL_ADC_CHANNEL_18
05137   *         @arg @ref LL_ADC_CHANNEL_19
05138   *         @arg @ref LL_ADC_CHANNEL_VREFINT      (1)
05139   *         @arg @ref LL_ADC_CHANNEL_TEMPSENSOR   (1)
05140   *         @arg @ref LL_ADC_CHANNEL_VBAT         (1)
05141   *         @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)
05142   *         @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)
05143   *
05144   *         (1) On STM32H7, parameter available only on ADC instance: ADC3.\n
05145   *         (2) On STM32H7, parameter available only on ADC instance: ADC2.\n
05146   *         (3) On STM32H7, fast channel (0.125 us for 14-bit resolution (ADC conversion rate up to 8 Ms/s)).
05147   *             Other channels are slow channels (conversion rate: refer to reference manual).
05148   * @param  Rank3_Channel This parameter can be one of the following values:
05149   *         @arg @ref LL_ADC_CHANNEL_0           (3)
05150   *         @arg @ref LL_ADC_CHANNEL_1           (3)
05151   *         @arg @ref LL_ADC_CHANNEL_2           (3)
05152   *         @arg @ref LL_ADC_CHANNEL_3           (3)
05153   *         @arg @ref LL_ADC_CHANNEL_4           (3)
05154   *         @arg @ref LL_ADC_CHANNEL_5           (3)
05155   *         @arg @ref LL_ADC_CHANNEL_6
05156   *         @arg @ref LL_ADC_CHANNEL_7
05157   *         @arg @ref LL_ADC_CHANNEL_8
05158   *         @arg @ref LL_ADC_CHANNEL_9
05159   *         @arg @ref LL_ADC_CHANNEL_10
05160   *         @arg @ref LL_ADC_CHANNEL_11
05161   *         @arg @ref LL_ADC_CHANNEL_12
05162   *         @arg @ref LL_ADC_CHANNEL_13
05163   *         @arg @ref LL_ADC_CHANNEL_14
05164   *         @arg @ref LL_ADC_CHANNEL_15
05165   *         @arg @ref LL_ADC_CHANNEL_16
05166   *         @arg @ref LL_ADC_CHANNEL_17
05167   *         @arg @ref LL_ADC_CHANNEL_18
05168   *         @arg @ref LL_ADC_CHANNEL_19
05169   *         @arg @ref LL_ADC_CHANNEL_VREFINT      (1)
05170   *         @arg @ref LL_ADC_CHANNEL_TEMPSENSOR   (1)
05171   *         @arg @ref LL_ADC_CHANNEL_VBAT         (1)
05172   *         @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)
05173   *         @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)
05174   *
05175   *         (1) On STM32H7, parameter available only on ADC instance: ADC3.\n
05176   *         (2) On STM32H7, parameter available only on ADC instance: ADC2.\n
05177   *         (3) On STM32H7, fast channel (0.125 us for 14-bit resolution (ADC conversion rate up to 8 Ms/s)).
05178   *             Other channels are slow channels (conversion rate: refer to reference manual).
05179   * @param  Rank4_Channel This parameter can be one of the following values:
05180   *         @arg @ref LL_ADC_CHANNEL_0           (3)
05181   *         @arg @ref LL_ADC_CHANNEL_1           (3)
05182   *         @arg @ref LL_ADC_CHANNEL_2           (3)
05183   *         @arg @ref LL_ADC_CHANNEL_3           (3)
05184   *         @arg @ref LL_ADC_CHANNEL_4           (3)
05185   *         @arg @ref LL_ADC_CHANNEL_5           (3)
05186   *         @arg @ref LL_ADC_CHANNEL_6
05187   *         @arg @ref LL_ADC_CHANNEL_7
05188   *         @arg @ref LL_ADC_CHANNEL_8
05189   *         @arg @ref LL_ADC_CHANNEL_9
05190   *         @arg @ref LL_ADC_CHANNEL_10
05191   *         @arg @ref LL_ADC_CHANNEL_11
05192   *         @arg @ref LL_ADC_CHANNEL_12
05193   *         @arg @ref LL_ADC_CHANNEL_13
05194   *         @arg @ref LL_ADC_CHANNEL_14
05195   *         @arg @ref LL_ADC_CHANNEL_15
05196   *         @arg @ref LL_ADC_CHANNEL_16
05197   *         @arg @ref LL_ADC_CHANNEL_17
05198   *         @arg @ref LL_ADC_CHANNEL_18
05199   *         @arg @ref LL_ADC_CHANNEL_19
05200   *         @arg @ref LL_ADC_CHANNEL_VREFINT      (1)
05201   *         @arg @ref LL_ADC_CHANNEL_TEMPSENSOR   (1)
05202   *         @arg @ref LL_ADC_CHANNEL_VBAT         (1)
05203   *         @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)
05204   *         @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)
05205   *
05206   *         (1) On STM32H7, parameter available only on ADC instance: ADC3.\n
05207   *         (2) On STM32H7, parameter available only on ADC instance: ADC2.\n
05208   *         (3) On STM32H7, fast channel (0.125 us for 14-bit resolution (ADC conversion rate up to 8 Ms/s)).
05209   *             Other channels are slow channels (conversion rate: refer to reference manual).
05210   * @retval None
05211   */
05212 __STATIC_INLINE void LL_ADC_INJ_ConfigQueueContext(ADC_TypeDef *ADCx,
05213                                                    uint32_t TriggerSource,
05214                                                    uint32_t ExternalTriggerEdge,
05215                                                    uint32_t SequencerNbRanks,
05216                                                    uint32_t Rank1_Channel,
05217                                                    uint32_t Rank2_Channel,
05218                                                    uint32_t Rank3_Channel,
05219                                                    uint32_t Rank4_Channel)
05220 {
05221   /* Set bits with content of parameter "Rankx_Channel" with bits position    */
05222   /* in register depending on literal "LL_ADC_INJ_RANK_x".                    */
05223   /* Parameters "Rankx_Channel" and "LL_ADC_INJ_RANK_x" are used with masks   */
05224   /* because containing other bits reserved for other purpose.                */
05225   /* If parameter "TriggerSource" is set to SW start, then parameter          */
05226   /* "ExternalTriggerEdge" is discarded.                                      */
05227   uint32_t is_trigger_not_sw = (uint32_t)((TriggerSource != LL_ADC_INJ_TRIG_SOFTWARE) ? 1UL : 0UL);
05228   MODIFY_REG(ADCx->JSQR,
05229              ADC_JSQR_JEXTSEL |
05230              ADC_JSQR_JEXTEN  |
05231              ADC_JSQR_JSQ4    |
05232              ADC_JSQR_JSQ3    |
05233              ADC_JSQR_JSQ2    |
05234              ADC_JSQR_JSQ1    |
05235              ADC_JSQR_JL,
05236              (TriggerSource & ADC_JSQR_JEXTSEL)        |
05237              (ExternalTriggerEdge * (is_trigger_not_sw)) |
05238              (((Rank4_Channel & ADC_CHANNEL_ID_NUMBER_MASK) >> ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS) << (LL_ADC_INJ_RANK_4 & ADC_INJ_RANK_ID_JSQR_MASK)) |
05239              (((Rank3_Channel & ADC_CHANNEL_ID_NUMBER_MASK) >> ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS) << (LL_ADC_INJ_RANK_3 & ADC_INJ_RANK_ID_JSQR_MASK)) |
05240              (((Rank2_Channel & ADC_CHANNEL_ID_NUMBER_MASK) >> ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS) << (LL_ADC_INJ_RANK_2 & ADC_INJ_RANK_ID_JSQR_MASK)) |
05241              (((Rank1_Channel & ADC_CHANNEL_ID_NUMBER_MASK) >> ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS) << (LL_ADC_INJ_RANK_1 & ADC_INJ_RANK_ID_JSQR_MASK)) |
05242              SequencerNbRanks
05243             );
05244 }
05245 
05246 /**
05247   * @}
05248   */
05249 
05250 /** @defgroup ADC_LL_EF_Configuration_Channels Configuration of ADC hierarchical scope: channels
05251   * @{
05252   */
05253 
05254 /**
05255   * @brief  Set sampling time of the selected ADC channel
05256   *         Unit: ADC clock cycles.
05257   * @note   On this device, sampling time is on channel scope: independently
05258   *         of channel mapped on ADC group regular or injected.
05259   * @note   In case of internal channel (VrefInt, TempSensor, ...) to be
05260   *         converted:
05261   *         sampling time constraints must be respected (sampling time can be
05262   *         adjusted in function of ADC clock frequency and sampling time
05263   *         setting).
05264   *         Refer to device datasheet for timings values (parameters TS_vrefint,
05265   *         TS_temp, ...).
05266   * @note   Conversion time is the addition of sampling time and processing time.
05267   *         On this STM32 series, ADC processing time is:
05268   *         - 12.5 ADC clock cycles at ADC resolution 12 bits
05269   *         - 10.5 ADC clock cycles at ADC resolution 10 bits
05270   *         - 8.5 ADC clock cycles at ADC resolution 8 bits
05271   *         - 6.5 ADC clock cycles at ADC resolution 6 bits
05272   * @note   In case of ADC conversion of internal channel (VrefInt,
05273   *         temperature sensor, ...), a sampling time minimum value
05274   *         is required.
05275   *         Refer to device datasheet.
05276   * @note   On this STM32 series, setting of this feature is conditioned to
05277   *         ADC state:
05278   *         ADC must be disabled or enabled without conversion on going
05279   *         on either groups regular or injected.
05280   * @rmtoll SMPR1    SMP0           LL_ADC_SetChannelSamplingTime\n
05281   *         SMPR1    SMP1           LL_ADC_SetChannelSamplingTime\n
05282   *         SMPR1    SMP2           LL_ADC_SetChannelSamplingTime\n
05283   *         SMPR1    SMP3           LL_ADC_SetChannelSamplingTime\n
05284   *         SMPR1    SMP4           LL_ADC_SetChannelSamplingTime\n
05285   *         SMPR1    SMP5           LL_ADC_SetChannelSamplingTime\n
05286   *         SMPR1    SMP6           LL_ADC_SetChannelSamplingTime\n
05287   *         SMPR1    SMP7           LL_ADC_SetChannelSamplingTime\n
05288   *         SMPR1    SMP8           LL_ADC_SetChannelSamplingTime\n
05289   *         SMPR1    SMP9           LL_ADC_SetChannelSamplingTime\n
05290   *         SMPR2    SMP10          LL_ADC_SetChannelSamplingTime\n
05291   *         SMPR2    SMP11          LL_ADC_SetChannelSamplingTime\n
05292   *         SMPR2    SMP12          LL_ADC_SetChannelSamplingTime\n
05293   *         SMPR2    SMP13          LL_ADC_SetChannelSamplingTime\n
05294   *         SMPR2    SMP14          LL_ADC_SetChannelSamplingTime\n
05295   *         SMPR2    SMP15          LL_ADC_SetChannelSamplingTime\n
05296   *         SMPR2    SMP16          LL_ADC_SetChannelSamplingTime\n
05297   *         SMPR2    SMP17          LL_ADC_SetChannelSamplingTime\n
05298   *         SMPR2    SMP18          LL_ADC_SetChannelSamplingTime
05299   * @param  ADCx ADC instance
05300   * @param  Channel This parameter can be one of the following values:
05301   *         @arg @ref LL_ADC_CHANNEL_0           (3)
05302   *         @arg @ref LL_ADC_CHANNEL_1           (3)
05303   *         @arg @ref LL_ADC_CHANNEL_2           (3)
05304   *         @arg @ref LL_ADC_CHANNEL_3           (3)
05305   *         @arg @ref LL_ADC_CHANNEL_4           (3)
05306   *         @arg @ref LL_ADC_CHANNEL_5           (3)
05307   *         @arg @ref LL_ADC_CHANNEL_6
05308   *         @arg @ref LL_ADC_CHANNEL_7
05309   *         @arg @ref LL_ADC_CHANNEL_8
05310   *         @arg @ref LL_ADC_CHANNEL_9
05311   *         @arg @ref LL_ADC_CHANNEL_10
05312   *         @arg @ref LL_ADC_CHANNEL_11
05313   *         @arg @ref LL_ADC_CHANNEL_12
05314   *         @arg @ref LL_ADC_CHANNEL_13
05315   *         @arg @ref LL_ADC_CHANNEL_14
05316   *         @arg @ref LL_ADC_CHANNEL_15
05317   *         @arg @ref LL_ADC_CHANNEL_16
05318   *         @arg @ref LL_ADC_CHANNEL_17
05319   *         @arg @ref LL_ADC_CHANNEL_18
05320   *         @arg @ref LL_ADC_CHANNEL_19
05321   *         @arg @ref LL_ADC_CHANNEL_VREFINT      (1)
05322   *         @arg @ref LL_ADC_CHANNEL_TEMPSENSOR   (1)
05323   *         @arg @ref LL_ADC_CHANNEL_VBAT         (1)
05324   *         @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)
05325   *         @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)
05326   *
05327   *         (1) On STM32H7, parameter available only on ADC instance: ADC3.\n
05328   *         (2) On STM32H7, parameter available only on ADC instance: ADC2.\n
05329   *         (3) On STM32H7, fast channel (0.125 us for 14-bit resolution (ADC conversion rate up to 8 Ms/s)).
05330   *             Other channels are slow channels (conversion rate: refer to reference manual).
05331   * @param  SamplingTime This parameter can be one of the following values:
05332   *         @arg @ref LL_ADC_SAMPLINGTIME_1CYCLE_5
05333   *         @arg @ref LL_ADC_SAMPLINGTIME_2CYCLES_5
05334   *         @arg @ref LL_ADC_SAMPLINGTIME_8CYCLES_5
05335   *         @arg @ref LL_ADC_SAMPLINGTIME_16CYCLES_5
05336   *         @arg @ref LL_ADC_SAMPLINGTIME_32CYCLES_5
05337   *         @arg @ref LL_ADC_SAMPLINGTIME_64CYCLES_5
05338   *         @arg @ref LL_ADC_SAMPLINGTIME_387CYCLES_5
05339   *         @arg @ref LL_ADC_SAMPLINGTIME_810CYCLES_5
05340   * @retval None
05341   */
05342 __STATIC_INLINE void LL_ADC_SetChannelSamplingTime(ADC_TypeDef *ADCx, uint32_t Channel, uint32_t SamplingTime)
05343 {
05344   /* Set bits with content of parameter "SamplingTime" with bits position     */
05345   /* in register and register position depending on parameter "Channel".      */
05346   /* Parameter "Channel" is used with masks because containing                */
05347   /* other bits reserved for other purpose.                                   */
05348   __IO uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->SMPR1, ((Channel & ADC_CHANNEL_SMPRX_REGOFFSET_MASK) >> ADC_SMPRX_REGOFFSET_POS));
05349 
05350   MODIFY_REG(*preg,
05351              ADC_SMPR1_SMP0 << ((Channel & ADC_CHANNEL_SMPx_BITOFFSET_MASK) >> ADC_CHANNEL_SMPx_BITOFFSET_POS),
05352              SamplingTime   << ((Channel & ADC_CHANNEL_SMPx_BITOFFSET_MASK) >> ADC_CHANNEL_SMPx_BITOFFSET_POS));
05353 }
05354 
05355 /**
05356   * @brief  Get sampling time of the selected ADC channel
05357   *         Unit: ADC clock cycles.
05358   * @note   On this device, sampling time is on channel scope: independently
05359   *         of channel mapped on ADC group regular or injected.
05360   * @note   Conversion time is the addition of sampling time and processing time.
05361   *         On this STM32 series, ADC processing time is:
05362   *         - 12.5 ADC clock cycles at ADC resolution 12 bits
05363   *         - 10.5 ADC clock cycles at ADC resolution 10 bits
05364   *         - 8.5 ADC clock cycles at ADC resolution 8 bits
05365   *         - 6.5 ADC clock cycles at ADC resolution 6 bits
05366   * @rmtoll SMPR1    SMP0           LL_ADC_GetChannelSamplingTime\n
05367   *         SMPR1    SMP1           LL_ADC_GetChannelSamplingTime\n
05368   *         SMPR1    SMP2           LL_ADC_GetChannelSamplingTime\n
05369   *         SMPR1    SMP3           LL_ADC_GetChannelSamplingTime\n
05370   *         SMPR1    SMP4           LL_ADC_GetChannelSamplingTime\n
05371   *         SMPR1    SMP5           LL_ADC_GetChannelSamplingTime\n
05372   *         SMPR1    SMP6           LL_ADC_GetChannelSamplingTime\n
05373   *         SMPR1    SMP7           LL_ADC_GetChannelSamplingTime\n
05374   *         SMPR1    SMP8           LL_ADC_GetChannelSamplingTime\n
05375   *         SMPR1    SMP9           LL_ADC_GetChannelSamplingTime\n
05376   *         SMPR2    SMP10          LL_ADC_GetChannelSamplingTime\n
05377   *         SMPR2    SMP11          LL_ADC_GetChannelSamplingTime\n
05378   *         SMPR2    SMP12          LL_ADC_GetChannelSamplingTime\n
05379   *         SMPR2    SMP13          LL_ADC_GetChannelSamplingTime\n
05380   *         SMPR2    SMP14          LL_ADC_GetChannelSamplingTime\n
05381   *         SMPR2    SMP15          LL_ADC_GetChannelSamplingTime\n
05382   *         SMPR2    SMP16          LL_ADC_GetChannelSamplingTime\n
05383   *         SMPR2    SMP17          LL_ADC_GetChannelSamplingTime\n
05384   *         SMPR2    SMP18          LL_ADC_GetChannelSamplingTime
05385   * @param  ADCx ADC instance
05386   * @param  Channel This parameter can be one of the following values:
05387   *         @arg @ref LL_ADC_CHANNEL_0           (3)
05388   *         @arg @ref LL_ADC_CHANNEL_1           (3)
05389   *         @arg @ref LL_ADC_CHANNEL_2           (3)
05390   *         @arg @ref LL_ADC_CHANNEL_3           (3)
05391   *         @arg @ref LL_ADC_CHANNEL_4           (3)
05392   *         @arg @ref LL_ADC_CHANNEL_5           (3)
05393   *         @arg @ref LL_ADC_CHANNEL_6
05394   *         @arg @ref LL_ADC_CHANNEL_7
05395   *         @arg @ref LL_ADC_CHANNEL_8
05396   *         @arg @ref LL_ADC_CHANNEL_9
05397   *         @arg @ref LL_ADC_CHANNEL_10
05398   *         @arg @ref LL_ADC_CHANNEL_11
05399   *         @arg @ref LL_ADC_CHANNEL_12
05400   *         @arg @ref LL_ADC_CHANNEL_13
05401   *         @arg @ref LL_ADC_CHANNEL_14
05402   *         @arg @ref LL_ADC_CHANNEL_15
05403   *         @arg @ref LL_ADC_CHANNEL_16
05404   *         @arg @ref LL_ADC_CHANNEL_17
05405   *         @arg @ref LL_ADC_CHANNEL_18
05406   *         @arg @ref LL_ADC_CHANNEL_19
05407   *         @arg @ref LL_ADC_CHANNEL_VREFINT      (1)
05408   *         @arg @ref LL_ADC_CHANNEL_TEMPSENSOR   (1)
05409   *         @arg @ref LL_ADC_CHANNEL_VBAT         (1)
05410   *         @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)
05411   *         @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)
05412   *
05413   *         (1) On STM32H7, parameter available only on ADC instance: ADC3.\n
05414   *         (2) On STM32H7, parameter available only on ADC instance: ADC2.\n
05415   *         (3) On STM32H7, fast channel (0.125 us for 14-bit resolution (ADC conversion rate up to 8 Ms/s)).
05416   *             Other channels are slow channels (conversion rate: refer to reference manual).
05417   * @retval Returned value can be one of the following values:
05418   *         @arg @ref LL_ADC_SAMPLINGTIME_1CYCLE_5
05419   *         @arg @ref LL_ADC_SAMPLINGTIME_2CYCLES_5
05420   *         @arg @ref LL_ADC_SAMPLINGTIME_8CYCLES_5
05421   *         @arg @ref LL_ADC_SAMPLINGTIME_16CYCLES_5
05422   *         @arg @ref LL_ADC_SAMPLINGTIME_32CYCLES_5
05423   *         @arg @ref LL_ADC_SAMPLINGTIME_64CYCLES_5
05424   *         @arg @ref LL_ADC_SAMPLINGTIME_387CYCLES_5
05425   *         @arg @ref LL_ADC_SAMPLINGTIME_810CYCLES_5
05426   */
05427 __STATIC_INLINE uint32_t LL_ADC_GetChannelSamplingTime(ADC_TypeDef *ADCx, uint32_t Channel)
05428 {
05429   const __IO uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->SMPR1, ((Channel & ADC_CHANNEL_SMPRX_REGOFFSET_MASK) >> ADC_SMPRX_REGOFFSET_POS));
05430 
05431   return (uint32_t)(READ_BIT(*preg,
05432                              ADC_SMPR1_SMP0 << ((Channel & ADC_CHANNEL_SMPx_BITOFFSET_MASK) >> ADC_CHANNEL_SMPx_BITOFFSET_POS))
05433                     >> ((Channel & ADC_CHANNEL_SMPx_BITOFFSET_MASK) >> ADC_CHANNEL_SMPx_BITOFFSET_POS)
05434                    );
05435 }
05436 
05437 /**
05438   * @brief  Set mode single-ended or differential input of the selected
05439   *         ADC channel.
05440   * @note   Channel ending is on channel scope: independently of channel mapped
05441   *         on ADC group regular or injected.
05442   *         In differential mode: Differential measurement is carried out
05443   *         between the selected channel 'i' (positive input) and
05444   *         channel 'i+1' (negative input). Only channel 'i' has to be
05445   *         configured, channel 'i+1' is configured automatically.
05446   * @note   Refer to Reference Manual to ensure the selected channel is
05447   *         available in differential mode.
05448   *         For example, internal channels (VrefInt, TempSensor, ...) are
05449   *         not available in differential mode.
05450   * @note   When configuring a channel 'i' in differential mode,
05451   *         the channel 'i+1' is not usable separately.
05452   * @note   On STM32H7, some channels are internally fixed to single-ended inputs
05453   *         configuration:
05454   *         - ADC1: Channels 0, 6, 7, 8, 9, 13, 14, 15, 17, and 19
05455   *         - ADC2: Channels 0, 6, 7, 8, 9, 13, 14, 15 and 19
05456   *         - ADC3: Channels 0, 6, 7, 8, 9, 12, 16, 17, and 19
05457   * @note   For ADC channels configured in differential mode, both inputs
05458   *         should be biased at (Vref+)/2 +/-200mV.
05459   *         (Vref+ is the analog voltage reference)
05460   * @note   On this STM32 series, setting of this feature is conditioned to
05461   *         ADC state:
05462   *         ADC must be ADC disabled.
05463   * @note   One or several values can be selected.
05464   *         Example: (LL_ADC_CHANNEL_4 | LL_ADC_CHANNEL_12 | ...)
05465   * @rmtoll DIFSEL   DIFSEL         LL_ADC_SetChannelSingleDiff
05466   * @param  ADCx ADC instance
05467   * @param  Channel This parameter can be one of the following values:
05468   *         @arg @ref LL_ADC_CHANNEL_1
05469   *         @arg @ref LL_ADC_CHANNEL_2
05470   *         @arg @ref LL_ADC_CHANNEL_3
05471   *         @arg @ref LL_ADC_CHANNEL_4
05472   *         @arg @ref LL_ADC_CHANNEL_5
05473   *         @arg @ref LL_ADC_CHANNEL_10
05474   *         @arg @ref LL_ADC_CHANNEL_11
05475   *         @arg @ref LL_ADC_CHANNEL_12
05476   *         @arg @ref LL_ADC_CHANNEL_13
05477   *         @arg @ref LL_ADC_CHANNEL_14
05478   *         @arg @ref LL_ADC_CHANNEL_15
05479   *         @arg @ref LL_ADC_CHANNEL_16
05480   *         @arg @ref LL_ADC_CHANNEL_17
05481   *         @arg @ref LL_ADC_CHANNEL_18
05482   *         @arg @ref LL_ADC_CHANNEL_19
05483   * @param  SingleDiff This parameter can be a combination of the following values:
05484   *         @arg @ref LL_ADC_SINGLE_ENDED
05485   *         @arg @ref LL_ADC_DIFFERENTIAL_ENDED
05486   * @retval None
05487   */
05488 __STATIC_INLINE void LL_ADC_SetChannelSingleDiff(ADC_TypeDef *ADCx, uint32_t Channel, uint32_t SingleDiff)
05489 {
05490 #if defined(ADC_VER_V5_V90)
05491   /* Bits of channels in single or differential mode are set only for         */
05492   /* differential mode (for single mode, mask of bits allowed to be set is    */
05493   /* shifted out of range of bits of channels in single or differential mode. */
05494   if (ADCx == ADC3)
05495   {
05496     MODIFY_REG(ADCx->LTR2_DIFSEL,
05497                Channel & ADC_SINGLEDIFF_CHANNEL_MASK,
05498                (Channel & ADC_SINGLEDIFF_CHANNEL_MASK) & (ADC_DIFSEL_DIFSEL >> (SingleDiff & ADC_SINGLEDIFF_CHANNEL_SHIFT_MASK)));
05499   }
05500   else
05501   {
05502     MODIFY_REG(ADCx->DIFSEL_RES12,
05503                Channel & ADC_SINGLEDIFF_CHANNEL_MASK,
05504                (Channel & ADC_SINGLEDIFF_CHANNEL_MASK) & (ADC_DIFSEL_DIFSEL >> (SingleDiff & ADC_SINGLEDIFF_CHANNEL_SHIFT_MASK)));
05505   }
05506 #else  /* ADC_VER_V5_V90 */
05507   /* Bits of channels in single or differential mode are set only for         */
05508   /* differential mode (for single mode, mask of bits allowed to be set is    */
05509   /* shifted out of range of bits of channels in single or differential mode. */
05510   MODIFY_REG(ADCx->DIFSEL,
05511              Channel & ADC_SINGLEDIFF_CHANNEL_MASK,
05512              (Channel & ADC_SINGLEDIFF_CHANNEL_MASK) & (ADC_DIFSEL_DIFSEL >> (SingleDiff & ADC_SINGLEDIFF_CHANNEL_SHIFT_MASK)));
05513 #endif
05514 }
05515 
05516 /**
05517   * @brief  Get mode single-ended or differential input of the selected
05518   *         ADC channel.
05519   * @note   When configuring a channel 'i' in differential mode,
05520   *         the channel 'i+1' is not usable separately.
05521   *         Therefore, to ensure a channel is configured in single-ended mode,
05522   *         the configuration of channel itself and the channel 'i-1' must be
05523   *         read back (to ensure that the selected channel channel has not been
05524   *         configured in differential mode by the previous channel).
05525   * @note   Refer to Reference Manual to ensure the selected channel is
05526   *         available in differential mode.
05527   *         For example, internal channels (VrefInt, TempSensor, ...) are
05528   *         not available in differential mode.
05529   * @note   When configuring a channel 'i' in differential mode,
05530   *         the channel 'i+1' is not usable separately.
05531   * @note   On STM32H7, some channels are internally fixed to single-ended inputs
05532   *         configuration:
05533   *         - ADC1: Channels 0, 6, 7, 8, 9, 13, 14, 15, 17, and 19
05534   *         - ADC2: Channels 0, 6, 7, 8, 9, 13, 14, 15 and 19
05535   *         - ADC3: Channels 0, 6, 7, 8, 9, 12, 16, 17, and 19
05536   * @note   One or several values can be selected. In this case, the value
05537   *         returned is null if all channels are in single ended-mode.
05538   *         Example: (LL_ADC_CHANNEL_4 | LL_ADC_CHANNEL_12 | ...)
05539   * @rmtoll DIFSEL   DIFSEL         LL_ADC_GetChannelSingleDiff
05540   * @param  ADCx ADC instance
05541   * @param  Channel This parameter can be a combination of the following values:
05542   *         @arg @ref LL_ADC_CHANNEL_1
05543   *         @arg @ref LL_ADC_CHANNEL_2
05544   *         @arg @ref LL_ADC_CHANNEL_3
05545   *         @arg @ref LL_ADC_CHANNEL_4
05546   *         @arg @ref LL_ADC_CHANNEL_5
05547   *         @arg @ref LL_ADC_CHANNEL_10
05548   *         @arg @ref LL_ADC_CHANNEL_11
05549   *         @arg @ref LL_ADC_CHANNEL_12
05550   *         @arg @ref LL_ADC_CHANNEL_13
05551   *         @arg @ref LL_ADC_CHANNEL_14
05552   *         @arg @ref LL_ADC_CHANNEL_15
05553   *         @arg @ref LL_ADC_CHANNEL_16
05554   *         @arg @ref LL_ADC_CHANNEL_17
05555   *         @arg @ref LL_ADC_CHANNEL_18
05556   *         @arg @ref LL_ADC_CHANNEL_19
05557   * @retval 0: channel in single-ended mode, else: channel in differential mode
05558   */
05559 __STATIC_INLINE uint32_t LL_ADC_GetChannelSingleDiff(ADC_TypeDef *ADCx, uint32_t Channel)
05560 {
05561 #if defined(ADC_VER_V5_V90)  
05562   return (uint32_t)(READ_BIT(ADCx->DIFSEL_RES12, (Channel & ADC_SINGLEDIFF_CHANNEL_MASK)));
05563 #else  
05564   return (uint32_t)(READ_BIT(ADCx->DIFSEL, (Channel & ADC_SINGLEDIFF_CHANNEL_MASK)));
05565 #endif
05566 }
05567 
05568 /**
05569   * @}
05570   */
05571 
05572 /** @defgroup ADC_LL_EF_Configuration_ADC_AnalogWatchdog Configuration of ADC transversal scope: analog watchdog
05573   * @{
05574   */
05575 
05576 /**
05577   * @brief  Set ADC analog watchdog monitored channels:
05578   *         a single channel, multiple channels or all channels,
05579   *         on ADC groups regular and-or injected.
05580   * @note   Once monitored channels are selected, analog watchdog
05581   *         is enabled.
05582   * @note   In case of need to define a single channel to monitor
05583   *         with analog watchdog from sequencer channel definition,
05584   *         use helper macro @ref __LL_ADC_ANALOGWD_CHANNEL_GROUP().
05585   * @note   On this STM32 series, there are 2 kinds of analog watchdog
05586   *         instance:
05587   *         - AWD standard (instance AWD1):
05588   *           - channels monitored: can monitor 1 channel or all channels.
05589   *           - groups monitored: ADC groups regular and-or injected.
05590   *           - resolution: resolution is not limited (corresponds to
05591   *             ADC resolution configured).
05592   *         - AWD flexible (instances AWD2, AWD3):
05593   *           - channels monitored: flexible on channels monitored, selection is
05594   *             channel wise, from from 1 to all channels.
05595   *             Specificity of this analog watchdog: Multiple channels can
05596   *             be selected. For example:
05597   *             (LL_ADC_AWD_CHANNEL4_REG_INJ | LL_ADC_AWD_CHANNEL5_REG_INJ | ...)
05598   *           - groups monitored: not selection possible (monitoring on both
05599   *             groups regular and injected).
05600   *             Channels selected are monitored on groups regular and injected:
05601   *             LL_ADC_AWD_CHANNELxx_REG_INJ (do not use parameters
05602   *             LL_ADC_AWD_CHANNELxx_REG and LL_ADC_AWD_CHANNELxx_INJ)
05603   *           - resolution: resolution is limited to 8 bits: if ADC resolution is
05604   *             12 bits the 4 LSB are ignored, if ADC resolution is 10 bits
05605   *             the 2 LSB are ignored.
05606   * @note   On this STM32 series, setting of this feature is conditioned to
05607   *         ADC state:
05608   *         ADC must be disabled or enabled without conversion on going
05609   *         on either groups regular or injected.
05610   * @rmtoll CFGR     AWD1CH         LL_ADC_SetAnalogWDMonitChannels\n
05611   *         CFGR     AWD1SGL        LL_ADC_SetAnalogWDMonitChannels\n
05612   *         CFGR     AWD1EN         LL_ADC_SetAnalogWDMonitChannels\n
05613   *         CFGR     JAWD1EN        LL_ADC_SetAnalogWDMonitChannels\n
05614   *         AWD2CR   AWD2CH         LL_ADC_SetAnalogWDMonitChannels\n
05615   *         AWD3CR   AWD3CH         LL_ADC_SetAnalogWDMonitChannels
05616   * @param  ADCx ADC instance
05617   * @param  AWDy This parameter can be one of the following values:
05618   *         @arg @ref LL_ADC_AWD1
05619   *         @arg @ref LL_ADC_AWD2
05620   *         @arg @ref LL_ADC_AWD3
05621   * @param  AWDChannelGroup This parameter can be one of the following values:
05622   *         @arg @ref LL_ADC_AWD_DISABLE
05623   *         @arg @ref LL_ADC_AWD_ALL_CHANNELS_REG        (0)
05624   *         @arg @ref LL_ADC_AWD_ALL_CHANNELS_INJ        (0)
05625   *         @arg @ref LL_ADC_AWD_ALL_CHANNELS_REG_INJ
05626   *         @arg @ref LL_ADC_AWD_CHANNEL_0_REG           (0)
05627   *         @arg @ref LL_ADC_AWD_CHANNEL_0_INJ           (0)
05628   *         @arg @ref LL_ADC_AWD_CHANNEL_0_REG_INJ
05629   *         @arg @ref LL_ADC_AWD_CHANNEL_1_REG           (0)
05630   *         @arg @ref LL_ADC_AWD_CHANNEL_1_INJ           (0)
05631   *         @arg @ref LL_ADC_AWD_CHANNEL_1_REG_INJ
05632   *         @arg @ref LL_ADC_AWD_CHANNEL_2_REG           (0)
05633   *         @arg @ref LL_ADC_AWD_CHANNEL_2_INJ           (0)
05634   *         @arg @ref LL_ADC_AWD_CHANNEL_2_REG_INJ
05635   *         @arg @ref LL_ADC_AWD_CHANNEL_3_REG           (0)
05636   *         @arg @ref LL_ADC_AWD_CHANNEL_3_INJ           (0)
05637   *         @arg @ref LL_ADC_AWD_CHANNEL_3_REG_INJ
05638   *         @arg @ref LL_ADC_AWD_CHANNEL_4_REG           (0)
05639   *         @arg @ref LL_ADC_AWD_CHANNEL_4_INJ           (0)
05640   *         @arg @ref LL_ADC_AWD_CHANNEL_4_REG_INJ
05641   *         @arg @ref LL_ADC_AWD_CHANNEL_5_REG           (0)
05642   *         @arg @ref LL_ADC_AWD_CHANNEL_5_INJ           (0)
05643   *         @arg @ref LL_ADC_AWD_CHANNEL_5_REG_INJ
05644   *         @arg @ref LL_ADC_AWD_CHANNEL_6_REG           (0)
05645   *         @arg @ref LL_ADC_AWD_CHANNEL_6_INJ           (0)
05646   *         @arg @ref LL_ADC_AWD_CHANNEL_6_REG_INJ
05647   *         @arg @ref LL_ADC_AWD_CHANNEL_7_REG           (0)
05648   *         @arg @ref LL_ADC_AWD_CHANNEL_7_INJ           (0)
05649   *         @arg @ref LL_ADC_AWD_CHANNEL_7_REG_INJ
05650   *         @arg @ref LL_ADC_AWD_CHANNEL_8_REG           (0)
05651   *         @arg @ref LL_ADC_AWD_CHANNEL_8_INJ           (0)
05652   *         @arg @ref LL_ADC_AWD_CHANNEL_8_REG_INJ
05653   *         @arg @ref LL_ADC_AWD_CHANNEL_9_REG           (0)
05654   *         @arg @ref LL_ADC_AWD_CHANNEL_9_INJ           (0)
05655   *         @arg @ref LL_ADC_AWD_CHANNEL_9_REG_INJ
05656   *         @arg @ref LL_ADC_AWD_CHANNEL_10_REG          (0)
05657   *         @arg @ref LL_ADC_AWD_CHANNEL_10_INJ          (0)
05658   *         @arg @ref LL_ADC_AWD_CHANNEL_10_REG_INJ
05659   *         @arg @ref LL_ADC_AWD_CHANNEL_11_REG          (0)
05660   *         @arg @ref LL_ADC_AWD_CHANNEL_11_INJ          (0)
05661   *         @arg @ref LL_ADC_AWD_CHANNEL_11_REG_INJ
05662   *         @arg @ref LL_ADC_AWD_CHANNEL_12_REG          (0)
05663   *         @arg @ref LL_ADC_AWD_CHANNEL_12_INJ          (0)
05664   *         @arg @ref LL_ADC_AWD_CHANNEL_12_REG_INJ
05665   *         @arg @ref LL_ADC_AWD_CHANNEL_13_REG          (0)
05666   *         @arg @ref LL_ADC_AWD_CHANNEL_13_INJ          (0)
05667   *         @arg @ref LL_ADC_AWD_CHANNEL_13_REG_INJ
05668   *         @arg @ref LL_ADC_AWD_CHANNEL_14_REG          (0)
05669   *         @arg @ref LL_ADC_AWD_CHANNEL_14_INJ          (0)
05670   *         @arg @ref LL_ADC_AWD_CHANNEL_14_REG_INJ
05671   *         @arg @ref LL_ADC_AWD_CHANNEL_15_REG          (0)
05672   *         @arg @ref LL_ADC_AWD_CHANNEL_15_INJ          (0)
05673   *         @arg @ref LL_ADC_AWD_CHANNEL_15_REG_INJ
05674   *         @arg @ref LL_ADC_AWD_CHANNEL_16_REG          (0)
05675   *         @arg @ref LL_ADC_AWD_CHANNEL_16_INJ          (0)
05676   *         @arg @ref LL_ADC_AWD_CHANNEL_16_REG_INJ
05677   *         @arg @ref LL_ADC_AWD_CHANNEL_17_REG          (0)
05678   *         @arg @ref LL_ADC_AWD_CHANNEL_17_INJ          (0)
05679   *         @arg @ref LL_ADC_AWD_CHANNEL_17_REG_INJ
05680   *         @arg @ref LL_ADC_AWD_CHANNEL_18_REG          (0)
05681   *         @arg @ref LL_ADC_AWD_CHANNEL_18_INJ          (0)
05682   *         @arg @ref LL_ADC_AWD_CHANNEL_18_REG_INJ
05683   *         @arg @ref LL_ADC_AWD_CHANNEL_19_REG          (0)
05684   *         @arg @ref LL_ADC_AWD_CHANNEL_19_INJ          (0)
05685   *         @arg @ref LL_ADC_AWD_CHANNEL_19_REG_INJ
05686   *         @arg @ref LL_ADC_AWD_CH_VREFINT_REG          (0)(1)
05687   *         @arg @ref LL_ADC_AWD_CH_VREFINT_INJ          (0)(1)
05688   *         @arg @ref LL_ADC_AWD_CH_VREFINT_REG_INJ         (1)
05689   *         @arg @ref LL_ADC_AWD_CH_TEMPSENSOR_REG       (0)(1)
05690   *         @arg @ref LL_ADC_AWD_CH_TEMPSENSOR_INJ       (0)(1)
05691   *         @arg @ref LL_ADC_AWD_CH_TEMPSENSOR_REG_INJ      (1)
05692   *         @arg @ref LL_ADC_AWD_CH_VBAT_REG             (0)(1)
05693   *         @arg @ref LL_ADC_AWD_CH_VBAT_INJ             (0)(1)
05694   *         @arg @ref LL_ADC_AWD_CH_VBAT_REG_INJ            (1)
05695   *         @arg @ref LL_ADC_AWD_CH_DAC1CH1_ADC2_REG     (0)(2)
05696   *         @arg @ref LL_ADC_AWD_CH_DAC1CH1_ADC2_INJ     (0)(2)
05697   *         @arg @ref LL_ADC_AWD_CH_DAC1CH1_ADC2_REG_INJ    (2)
05698   *         @arg @ref LL_ADC_AWD_CH_DAC1CH2_ADC2_REG     (0)(2)
05699   *         @arg @ref LL_ADC_AWD_CH_DAC1CH2_ADC2_INJ     (0)(2)
05700   *         @arg @ref LL_ADC_AWD_CH_DAC1CH2_ADC2_REG_INJ    (2)
05701   *
05702   *         (0) On STM32H7, parameter available only on analog watchdog number: AWD1.\n
05703   *         (1) On STM32H7, parameter available only on ADC instance: ADC3.\n
05704   *         (2) On STM32H7, parameter available only on ADC instance: ADC2.
05705   * @retval None
05706   */
05707 __STATIC_INLINE void LL_ADC_SetAnalogWDMonitChannels(ADC_TypeDef *ADCx, uint32_t AWDy, uint32_t AWDChannelGroup)
05708 {
05709   /* Set bits with content of parameter "AWDChannelGroup" with bits position  */
05710   /* in register and register position depending on parameter "AWDy".         */
05711   /* Parameters "AWDChannelGroup" and "AWDy" are used with masks because      */
05712   /* containing other bits reserved for other purpose.                        */
05713   __IO uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->CFGR, ((AWDy & ADC_AWD_CRX_REGOFFSET_MASK) >> ADC_AWD_CRX_REGOFFSET_POS)
05714                                                       + ((AWDy & ADC_AWD_CR12_REGOFFSETGAP_MASK) * ADC_AWD_CR12_REGOFFSETGAP_VAL));
05715 
05716   MODIFY_REG(*preg,
05717              (AWDy & ADC_AWD_CR_ALL_CHANNEL_MASK),
05718              AWDChannelGroup & AWDy);
05719 }
05720 
05721 /**
05722   * @brief  Get ADC analog watchdog monitored channel.
05723   * @note   Usage of the returned channel number:
05724   *         - To reinject this channel into another function LL_ADC_xxx:
05725   *           the returned channel number is only partly formatted on definition
05726   *           of literals LL_ADC_CHANNEL_x. Therefore, it has to be compared
05727   *           with parts of literals LL_ADC_CHANNEL_x or using
05728   *           helper macro @ref __LL_ADC_CHANNEL_TO_DECIMAL_NB().
05729   *           Then the selected literal LL_ADC_CHANNEL_x can be used
05730   *           as parameter for another function.
05731   *         - To get the channel number in decimal format:
05732   *           process the returned value with the helper macro
05733   *           @ref __LL_ADC_CHANNEL_TO_DECIMAL_NB().
05734   *           Applicable only when the analog watchdog is set to monitor
05735   *           one channel.
05736   * @note   On this STM32 series, there are 2 kinds of analog watchdog
05737   *         instance:
05738   *         - AWD standard (instance AWD1):
05739   *           - channels monitored: can monitor 1 channel or all channels.
05740   *           - groups monitored: ADC groups regular and-or injected.
05741   *           - resolution: resolution is not limited (corresponds to
05742   *             ADC resolution configured).
05743   *         - AWD flexible (instances AWD2, AWD3):
05744   *           - channels monitored: flexible on channels monitored, selection is
05745   *             channel wise, from from 1 to all channels.
05746   *             Specificity of this analog watchdog: Multiple channels can
05747   *             be selected. For example:
05748   *             (LL_ADC_AWD_CHANNEL4_REG_INJ | LL_ADC_AWD_CHANNEL5_REG_INJ | ...)
05749   *           - groups monitored: not selection possible (monitoring on both
05750   *             groups regular and injected).
05751   *             Channels selected are monitored on groups regular and injected:
05752   *             LL_ADC_AWD_CHANNELxx_REG_INJ (do not use parameters
05753   *             LL_ADC_AWD_CHANNELxx_REG and LL_ADC_AWD_CHANNELxx_INJ)
05754   *           - resolution: resolution is limited to 8 bits: if ADC resolution is
05755   *             12 bits the 4 LSB are ignored, if ADC resolution is 10 bits
05756   *             the 2 LSB are ignored.
05757   * @note   On this STM32 series, setting of this feature is conditioned to
05758   *         ADC state:
05759   *         ADC must be disabled or enabled without conversion on going
05760   *         on either groups regular or injected.
05761   * @rmtoll CFGR     AWD1CH         LL_ADC_GetAnalogWDMonitChannels\n
05762   *         CFGR     AWD1SGL        LL_ADC_GetAnalogWDMonitChannels\n
05763   *         CFGR     AWD1EN         LL_ADC_GetAnalogWDMonitChannels\n
05764   *         CFGR     JAWD1EN        LL_ADC_GetAnalogWDMonitChannels\n
05765   *         AWD2CR   AWD2CH         LL_ADC_GetAnalogWDMonitChannels\n
05766   *         AWD3CR   AWD3CH         LL_ADC_GetAnalogWDMonitChannels
05767   * @param  ADCx ADC instance
05768   * @param  AWDy This parameter can be one of the following values:
05769   *         @arg @ref LL_ADC_AWD1
05770   *         @arg @ref LL_ADC_AWD2 (1)
05771   *         @arg @ref LL_ADC_AWD3 (1)
05772   *
05773   *         (1) On this AWD number, monitored channel can be retrieved
05774   *             if only 1 channel is programmed (or none or all channels).
05775   *             This function cannot retrieve monitored channel if
05776   *             multiple channels are programmed simultaneously
05777   *             by bitfield.
05778   * @retval Returned value can be one of the following values:
05779   *         @arg @ref LL_ADC_AWD_DISABLE
05780   *         @arg @ref LL_ADC_AWD_ALL_CHANNELS_REG        (0)
05781   *         @arg @ref LL_ADC_AWD_ALL_CHANNELS_INJ        (0)
05782   *         @arg @ref LL_ADC_AWD_ALL_CHANNELS_REG_INJ
05783   *         @arg @ref LL_ADC_AWD_CHANNEL_0_REG           (0)
05784   *         @arg @ref LL_ADC_AWD_CHANNEL_0_INJ           (0)
05785   *         @arg @ref LL_ADC_AWD_CHANNEL_0_REG_INJ
05786   *         @arg @ref LL_ADC_AWD_CHANNEL_1_REG           (0)
05787   *         @arg @ref LL_ADC_AWD_CHANNEL_1_INJ           (0)
05788   *         @arg @ref LL_ADC_AWD_CHANNEL_1_REG_INJ
05789   *         @arg @ref LL_ADC_AWD_CHANNEL_2_REG           (0)
05790   *         @arg @ref LL_ADC_AWD_CHANNEL_2_INJ           (0)
05791   *         @arg @ref LL_ADC_AWD_CHANNEL_2_REG_INJ
05792   *         @arg @ref LL_ADC_AWD_CHANNEL_3_REG           (0)
05793   *         @arg @ref LL_ADC_AWD_CHANNEL_3_INJ           (0)
05794   *         @arg @ref LL_ADC_AWD_CHANNEL_3_REG_INJ
05795   *         @arg @ref LL_ADC_AWD_CHANNEL_4_REG           (0)
05796   *         @arg @ref LL_ADC_AWD_CHANNEL_4_INJ           (0)
05797   *         @arg @ref LL_ADC_AWD_CHANNEL_4_REG_INJ
05798   *         @arg @ref LL_ADC_AWD_CHANNEL_5_REG           (0)
05799   *         @arg @ref LL_ADC_AWD_CHANNEL_5_INJ           (0)
05800   *         @arg @ref LL_ADC_AWD_CHANNEL_5_REG_INJ
05801   *         @arg @ref LL_ADC_AWD_CHANNEL_6_REG           (0)
05802   *         @arg @ref LL_ADC_AWD_CHANNEL_6_INJ           (0)
05803   *         @arg @ref LL_ADC_AWD_CHANNEL_6_REG_INJ
05804   *         @arg @ref LL_ADC_AWD_CHANNEL_7_REG           (0)
05805   *         @arg @ref LL_ADC_AWD_CHANNEL_7_INJ           (0)
05806   *         @arg @ref LL_ADC_AWD_CHANNEL_7_REG_INJ
05807   *         @arg @ref LL_ADC_AWD_CHANNEL_8_REG           (0)
05808   *         @arg @ref LL_ADC_AWD_CHANNEL_8_INJ           (0)
05809   *         @arg @ref LL_ADC_AWD_CHANNEL_8_REG_INJ
05810   *         @arg @ref LL_ADC_AWD_CHANNEL_9_REG           (0)
05811   *         @arg @ref LL_ADC_AWD_CHANNEL_9_INJ           (0)
05812   *         @arg @ref LL_ADC_AWD_CHANNEL_9_REG_INJ
05813   *         @arg @ref LL_ADC_AWD_CHANNEL_10_REG          (0)
05814   *         @arg @ref LL_ADC_AWD_CHANNEL_10_INJ          (0)
05815   *         @arg @ref LL_ADC_AWD_CHANNEL_10_REG_INJ
05816   *         @arg @ref LL_ADC_AWD_CHANNEL_11_REG          (0)
05817   *         @arg @ref LL_ADC_AWD_CHANNEL_11_INJ          (0)
05818   *         @arg @ref LL_ADC_AWD_CHANNEL_11_REG_INJ
05819   *         @arg @ref LL_ADC_AWD_CHANNEL_12_REG          (0)
05820   *         @arg @ref LL_ADC_AWD_CHANNEL_12_INJ          (0)
05821   *         @arg @ref LL_ADC_AWD_CHANNEL_12_REG_INJ
05822   *         @arg @ref LL_ADC_AWD_CHANNEL_13_REG          (0)
05823   *         @arg @ref LL_ADC_AWD_CHANNEL_13_INJ          (0)
05824   *         @arg @ref LL_ADC_AWD_CHANNEL_13_REG_INJ
05825   *         @arg @ref LL_ADC_AWD_CHANNEL_14_REG          (0)
05826   *         @arg @ref LL_ADC_AWD_CHANNEL_14_INJ          (0)
05827   *         @arg @ref LL_ADC_AWD_CHANNEL_14_REG_INJ
05828   *         @arg @ref LL_ADC_AWD_CHANNEL_15_REG          (0)
05829   *         @arg @ref LL_ADC_AWD_CHANNEL_15_INJ          (0)
05830   *         @arg @ref LL_ADC_AWD_CHANNEL_15_REG_INJ
05831   *         @arg @ref LL_ADC_AWD_CHANNEL_16_REG          (0)
05832   *         @arg @ref LL_ADC_AWD_CHANNEL_16_INJ          (0)
05833   *         @arg @ref LL_ADC_AWD_CHANNEL_16_REG_INJ
05834   *         @arg @ref LL_ADC_AWD_CHANNEL_17_REG          (0)
05835   *         @arg @ref LL_ADC_AWD_CHANNEL_17_INJ          (0)
05836   *         @arg @ref LL_ADC_AWD_CHANNEL_17_REG_INJ
05837   *         @arg @ref LL_ADC_AWD_CHANNEL_18_REG          (0)
05838   *         @arg @ref LL_ADC_AWD_CHANNEL_18_INJ          (0)
05839   *         @arg @ref LL_ADC_AWD_CHANNEL_18_REG_INJ
05840   *         @arg @ref LL_ADC_AWD_CHANNEL_19_REG          (0)
05841   *         @arg @ref LL_ADC_AWD_CHANNEL_19_INJ          (0)
05842   *         @arg @ref LL_ADC_AWD_CHANNEL_19_REG_INJ
05843   *
05844   *         (0) On STM32H7, parameter available only on analog watchdog number: AWD1.
05845   */
05846 __STATIC_INLINE uint32_t LL_ADC_GetAnalogWDMonitChannels(ADC_TypeDef *ADCx, uint32_t AWDy)
05847 {
05848   const __IO uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->CFGR, ((AWDy & ADC_AWD_CRX_REGOFFSET_MASK) >> ADC_AWD_CRX_REGOFFSET_POS)
05849                                                             + ((AWDy & ADC_AWD_CR12_REGOFFSETGAP_MASK) * ADC_AWD_CR12_REGOFFSETGAP_VAL));
05850 
05851   uint32_t AnalogWDMonitChannels = (READ_BIT(*preg, AWDy) & AWDy & ADC_AWD_CR_ALL_CHANNEL_MASK);
05852 
05853   /* If "AnalogWDMonitChannels" == 0, then the selected AWD is disabled       */
05854   /* (parameter value LL_ADC_AWD_DISABLE).                                    */
05855   /* Else, the selected AWD is enabled and is monitoring a group of channels  */
05856   /* or a single channel.                                                     */
05857   if (AnalogWDMonitChannels != 0UL)
05858   {
05859     if (AWDy == LL_ADC_AWD1)
05860     {
05861       if ((AnalogWDMonitChannels & ADC_CFGR_AWD1SGL) == 0UL)
05862       {
05863         /* AWD monitoring a group of channels */
05864         AnalogWDMonitChannels = ((AnalogWDMonitChannels
05865                                   | (ADC_AWD_CR23_CHANNEL_MASK)
05866                                  )
05867                                  & (~(ADC_CFGR_AWD1CH))
05868                                 );
05869       }
05870       else
05871       {
05872         /* AWD monitoring a single channel */
05873         AnalogWDMonitChannels = (AnalogWDMonitChannels
05874                                  | (ADC_AWD2CR_AWD2CH_0 << (AnalogWDMonitChannels >> ADC_CFGR_AWD1CH_Pos))
05875                                 );
05876       }
05877     }
05878     else
05879     {
05880       if ((AnalogWDMonitChannels & ADC_AWD_CR23_CHANNEL_MASK) == ADC_AWD_CR23_CHANNEL_MASK)
05881       {
05882         /* AWD monitoring a group of channels */
05883         AnalogWDMonitChannels = (ADC_AWD_CR23_CHANNEL_MASK
05884                                  | ((ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN))
05885                                 );
05886       }
05887       else
05888       {
05889         /* AWD monitoring a single channel */
05890         /* AWD monitoring a group of channels */
05891         AnalogWDMonitChannels = (AnalogWDMonitChannels
05892                                  | (ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL)
05893                                  | (__LL_ADC_CHANNEL_TO_DECIMAL_NB(AnalogWDMonitChannels) << ADC_CFGR_AWD1CH_Pos)
05894                                 );
05895       }
05896     }
05897   }
05898 
05899   return AnalogWDMonitChannels;
05900 }
05901 
05902 /**
05903   * @brief  Set ADC analog watchdog threshold value of threshold
05904   *         high or low.
05905   * @note   In case of ADC resolution different of 12 bits,
05906   *         analog watchdog thresholds data require a specific shift.
05907   *         Use helper macro @ref __LL_ADC_ANALOGWD_SET_THRESHOLD_RESOLUTION().
05908   * @note   On this STM32 series, there are 2 kinds of analog watchdog
05909   *         instance:
05910   *         - AWD standard (instance AWD1):
05911   *           - channels monitored: can monitor 1 channel or all channels.
05912   *           - groups monitored: ADC groups regular and-or injected.
05913   *           - resolution: resolution is not limited (corresponds to
05914   *             ADC resolution configured).
05915   *         - AWD flexible (instances AWD2, AWD3):
05916   *           - channels monitored: flexible on channels monitored, selection is
05917   *             channel wise, from from 1 to all channels.
05918   *             Specificity of this analog watchdog: Multiple channels can
05919   *             be selected. For example:
05920   *             (LL_ADC_AWD_CHANNEL4_REG_INJ | LL_ADC_AWD_CHANNEL5_REG_INJ | ...)
05921   *           - groups monitored: not selection possible (monitoring on both
05922   *             groups regular and injected).
05923   *             Channels selected are monitored on groups regular and injected:
05924   *             LL_ADC_AWD_CHANNELxx_REG_INJ (do not use parameters
05925   *             LL_ADC_AWD_CHANNELxx_REG and LL_ADC_AWD_CHANNELxx_INJ)
05926   *           - resolution: resolution is limited to 8 bits: if ADC resolution is
05927   *             12 bits the 4 LSB are ignored, if ADC resolution is 10 bits
05928   *             the 2 LSB are ignored.
05929   * @note   If ADC oversampling is enabled, ADC analog watchdog thresholds are
05930   *         impacted: the comparison of analog watchdog thresholds is done
05931   *         on oversampling intermediate computation (after ratio, before shift
05932   *         application): intermediate register bitfield [32:7]
05933   *         (26 most significant bits).
05934   * @note   On this STM32 series, setting of this feature is conditioned to
05935   *         ADC state:
05936   *         ADC must be disabled or enabled without conversion on going
05937   *         on either ADC groups regular or injected.
05938   * @rmtoll TR1      HT1            LL_ADC_SetAnalogWDThresholds\n
05939   *         TR2      HT2            LL_ADC_SetAnalogWDThresholds\n
05940   *         TR3      HT3            LL_ADC_SetAnalogWDThresholds\n
05941   *         TR1      LT1            LL_ADC_SetAnalogWDThresholds\n
05942   *         TR2      LT2            LL_ADC_SetAnalogWDThresholds\n
05943   *         TR3      LT3            LL_ADC_SetAnalogWDThresholds
05944   * @param  ADCx ADC instance
05945   * @param  AWDy This parameter can be one of the following values:
05946   *         @arg @ref LL_ADC_AWD1
05947   *         @arg @ref LL_ADC_AWD2
05948   *         @arg @ref LL_ADC_AWD3
05949   * @param  AWDThresholdsHighLow This parameter can be one of the following values:
05950   *         @arg @ref LL_ADC_AWD_THRESHOLD_HIGH
05951   *         @arg @ref LL_ADC_AWD_THRESHOLD_LOW
05952   * @param  AWDThresholdValue Value between Min_Data=0x000 and Max_Data=0xFFF
05953   * @retval None
05954   */
05955 __STATIC_INLINE void LL_ADC_SetAnalogWDThresholds(ADC_TypeDef *ADCx, uint32_t AWDy, uint32_t AWDThresholdsHighLow, uint32_t AWDThresholdValue)
05956 {
05957 #if defined(ADC_VER_V5_V90)
05958   if (ADCx == ADC3)
05959   {
05960     /* Set bits with content of parameter "AWDThresholdValue" with bits         */
05961     /* position in register and register position depending on parameters       */
05962     /* "AWDThresholdsHighLow" and "AWDy".                                       */
05963     /* Parameters "AWDy" and "AWDThresholdValue" are used with masks because    */
05964     /* containing other bits reserved for other purpose.                        */
05965     __IO uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->LTR1_TR1, ((AWDy & ADC_AWD_TRX_REGOFFSET_MASK) >> ADC_AWD_TRX_REGOFFSET_POS));
05966 
05967     MODIFY_REG(*preg,
05968                AWDThresholdsHighLow,
05969                AWDThresholdValue << ((AWDThresholdsHighLow & ADC_AWD_TRX_BIT_HIGH_MASK) >> ADC_AWD_TRX_BIT_HIGH_SHIFT4));
05970   }
05971   else
05972   {
05973     /* Set bits with content of parameter "AWDThresholdValue" with bits         */
05974     /* position in register and register position depending on parameters       */
05975     /* "AWDThresholdsHighLow" and "AWDy".                                       */
05976     /* Parameters "AWDy" and "AWDThresholdValue" are used with masks because    */
05977     /* containing other bits reserved for other purpose.                        */
05978     __IO uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->LTR1_TR1, (((AWDy & ADC_AWD_TRX_REGOFFSET_MASK) >> ADC_AWD_TRX_REGOFFSET_POS) * 2UL)
05979                                                         + ((AWDy & ADC_AWD_TR12_REGOFFSETGAP_MASK) * ADC_AWD_TR12_REGOFFSETGAP_VAL)
05980                                                         + (AWDThresholdsHighLow));
05981 
05982     MODIFY_REG(*preg, ADC_LTR_LT, AWDThresholdValue);
05983   }
05984 #else
05985   /* Set bits with content of parameter "AWDThresholdValue" with bits         */
05986   /* position in register and register position depending on parameters       */
05987   /* "AWDThresholdsHighLow" and "AWDy".                                       */
05988   /* Parameters "AWDy" and "AWDThresholdValue" are used with masks because    */
05989   /* containing other bits reserved for other purpose.                        */
05990   __IO uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->LTR1, (((AWDy & ADC_AWD_TRX_REGOFFSET_MASK) >> ADC_AWD_TRX_REGOFFSET_POS) * 2UL)
05991                                                       + ((AWDy & ADC_AWD_TR12_REGOFFSETGAP_MASK) * ADC_AWD_TR12_REGOFFSETGAP_VAL)
05992                                                       + (AWDThresholdsHighLow));
05993 
05994   MODIFY_REG(*preg, ADC_LTR_LT, AWDThresholdValue);
05995 #endif  /* ADC_VER_V5_V90 */
05996 }
05997 
05998 /**
05999   * @brief  Get ADC analog watchdog threshold value of threshold high,
06000   *         threshold low or raw data with ADC thresholds high and low
06001   *         concatenated.
06002   * @note   In case of ADC resolution different of 12 bits,
06003   *         analog watchdog thresholds data require a specific shift.
06004   *         Use helper macro @ref __LL_ADC_ANALOGWD_GET_THRESHOLD_RESOLUTION().
06005   * @rmtoll TR1      HT1            LL_ADC_GetAnalogWDThresholds\n
06006   *         TR2      HT2            LL_ADC_GetAnalogWDThresholds\n
06007   *         TR3      HT3            LL_ADC_GetAnalogWDThresholds\n
06008   *         TR1      LT1            LL_ADC_GetAnalogWDThresholds\n
06009   *         TR2      LT2            LL_ADC_GetAnalogWDThresholds\n
06010   *         TR3      LT3            LL_ADC_GetAnalogWDThresholds
06011   * @param  ADCx ADC instance
06012   * @param  AWDy This parameter can be one of the following values:
06013   *         @arg @ref LL_ADC_AWD1
06014   *         @arg @ref LL_ADC_AWD2
06015   *         @arg @ref LL_ADC_AWD3
06016   * @param  AWDThresholdsHighLow This parameter can be one of the following values:
06017   *         @arg @ref LL_ADC_AWD_THRESHOLD_HIGH
06018   *         @arg @ref LL_ADC_AWD_THRESHOLD_LOW
06019   * @retval Value between Min_Data=0x000 and Max_Data=0x3FFFFFF
06020 */
06021 __STATIC_INLINE uint32_t LL_ADC_GetAnalogWDThresholds(ADC_TypeDef *ADCx, uint32_t AWDy, uint32_t AWDThresholdsHighLow)
06022 {
06023 #if defined(ADC_VER_V5_V90)
06024   const __IO uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->LTR1_TR1, (((AWDy & ADC_AWD_TRX_REGOFFSET_MASK) >> ADC_AWD_TRX_REGOFFSET_POS) * 2UL)
06025                                                             + ((AWDy & ADC_AWD_TR12_REGOFFSETGAP_MASK) * ADC_AWD_TR12_REGOFFSETGAP_VAL)
06026                                                             + (AWDThresholdsHighLow));
06027 
06028   return (uint32_t)(READ_BIT(*preg, ADC_LTR_LT));
06029 #else
06030    const __IO uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->LTR1, (((AWDy & ADC_AWD_TRX_REGOFFSET_MASK) >> ADC_AWD_TRX_REGOFFSET_POS) * 2UL)
06031                                                                    + ((AWDy & ADC_AWD_TR12_REGOFFSETGAP_MASK) * ADC_AWD_TR12_REGOFFSETGAP_VAL)
06032                                                                    + (AWDThresholdsHighLow));
06033 
06034   return (uint32_t)(READ_BIT(*preg, ADC_LTR_LT));
06035 #endif
06036 }
06037 
06038 #if defined(ADC_VER_V5_V90)
06039 
06040 /**
06041   * @brief  Set ADC analog watchdog thresholds value of both thresholds
06042   *         high and low. Applicable for devices STM32H72xx and STM32H73xx.
06043   * @note   If value of only one threshold high or low must be set,
06044   *         use function @ref LL_ADC_SetAnalogWDThresholds().
06045   * @note   In case of ADC resolution different of 12 bits,
06046   *         analog watchdog thresholds data require a specific shift.
06047   *         Use helper macro @ref __LL_ADC_ANALOGWD_SET_THRESHOLD_RESOLUTION().
06048   * @note   On this STM32 series, there are 2 kinds of analog watchdog
06049   *         instance:
06050   *         - AWD standard (instance AWD1):
06051   *           - channels monitored: can monitor 1 channel or all channels.
06052   *           - groups monitored: ADC groups regular and-or injected.
06053   *           - resolution: resolution is not limited (corresponds to
06054   *             ADC resolution configured).
06055   *         - AWD flexible (instances AWD2, AWD3):
06056   *           - channels monitored: flexible on channels monitored, selection is
06057   *             channel wise, from from 1 to all channels.
06058   *             Specificity of this analog watchdog: Multiple channels can
06059   *             be selected. For example:
06060   *             (LL_ADC_AWD_CHANNEL4_REG_INJ | LL_ADC_AWD_CHANNEL5_REG_INJ | ...)
06061   *           - groups monitored: not selection possible (monitoring on both
06062   *             groups regular and injected).
06063   *             Channels selected are monitored on groups regular and injected:
06064   *             LL_ADC_AWD_CHANNELxx_REG_INJ (do not use parameters
06065   *             LL_ADC_AWD_CHANNELxx_REG and LL_ADC_AWD_CHANNELxx_INJ)
06066   *           - resolution: resolution is limited to 8 bits: if ADC resolution is
06067   *             12 bits the 4 LSB are ignored, if ADC resolution is 10 bits
06068   *             the 2 LSB are ignored.
06069   * @rmtoll TR1      HT1            LL_ADC_ConfigAnalogWDThresholds\n
06070   *         TR2      HT2            LL_ADC_ConfigAnalogWDThresholds\n
06071   *         TR3      HT3            LL_ADC_ConfigAnalogWDThresholds\n
06072   *         TR1      LT1            LL_ADC_ConfigAnalogWDThresholds\n
06073   *         TR2      LT2            LL_ADC_ConfigAnalogWDThresholds\n
06074   *         TR3      LT3            LL_ADC_ConfigAnalogWDThresholds
06075   * @param  ADCx ADC instance
06076   * @param  AWDy This parameter can be one of the following values:
06077   *         @arg @ref LL_ADC_AWD1
06078   *         @arg @ref LL_ADC_AWD2
06079   *         @arg @ref LL_ADC_AWD3
06080   * @param  AWDThresholdHighValue Value between Min_Data=0x000 and Max_Data=0xFFF
06081   * @param  AWDThresholdLowValue Value between Min_Data=0x000 and Max_Data=0xFFF
06082   * @retval None
06083   */
06084 __STATIC_INLINE void LL_ADC_ConfigAnalogWDThresholds(ADC_TypeDef *ADCx, uint32_t AWDy, uint32_t AWDThresholdHighValue, uint32_t AWDThresholdLowValue)
06085 {
06086   /* Set bits with content of parameter "AWDThresholdxxxValue" with bits      */
06087   /* position in register and register position depending on parameter        */
06088   /* "AWDy".                                                                  */
06089   /* Parameters "AWDy" and "AWDThresholdxxxValue" are used with masks because */
06090   /* containing other bits reserved for other purpose.                        */
06091   if (ADCx == ADC3)
06092   {
06093     uint32_t __IO *preg = __ADC_PTR_REG_OFFSET(ADCx->LTR1_TR1, ((AWDy & ADC_AWD_TRX_REGOFFSET_MASK) >> ADC_AWD_TRX_REGOFFSET_POS));
06094 
06095     MODIFY_REG(*preg,
06096                ADC3_TR1_HT1 | ADC3_TR1_LT1,
06097                (AWDThresholdHighValue << ADC3_TR1_HT1_Pos) | AWDThresholdLowValue);
06098   }
06099   else
06100   {
06101     __IO uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->LTR1_TR1, (((AWDy & ADC_AWD_TRX_REGOFFSET_MASK) >> ADC_AWD_TRX_REGOFFSET_POS) * 2UL)
06102                                                         + ((AWDy & ADC_AWD_TR12_REGOFFSETGAP_MASK) * ADC_AWD_TR12_REGOFFSETGAP_VAL)
06103                                                         + (LL_ADC_AWD_THRESHOLD_LOW));
06104     __IO uint32_t *preg2 = __ADC_PTR_REG_OFFSET(ADCx->LTR1_TR1, (((AWDy & ADC_AWD_TRX_REGOFFSET_MASK) >> ADC_AWD_TRX_REGOFFSET_POS) * 2UL)
06105                                                          + ((AWDy & ADC_AWD_TR12_REGOFFSETGAP_MASK) * ADC_AWD_TR12_REGOFFSETGAP_VAL)
06106                                                          + (LL_ADC_AWD_THRESHOLD_HIGH));
06107 
06108     MODIFY_REG(*preg, ADC_LTR_LT, AWDThresholdLowValue);
06109     MODIFY_REG(*preg2, ADC_HTR_HT, AWDThresholdHighValue);
06110   }
06111 }
06112 
06113 
06114 /**
06115   * @brief  Set ADC analog watchdog filtering configuration
06116   * @note   On this STM32 series, setting of this feature is conditioned to
06117   *         ADC state:
06118   *         ADC must be disabled or enabled without conversion on going
06119   *         on either groups regular or injected.
06120   *         Applicable on ADC3 of devices STM32H72xx and STM32H73xx.
06121   *  @note  On this STM32 series, this feature is only available on first
06122   *         analog watchdog (AWD1)
06123   * @rmtoll TR1      AWDFILT        LL_ADC_SetAWDFilteringConfiguration
06124   * @param  ADCx ADC instance
06125   * @param  AWDy This parameter can be one of the following values:
06126   *         @arg @ref LL_ADC_AWD1
06127   * @param  FilteringConfig This parameter can be one of the following values:
06128   *         @arg @ref LL_ADC_AWD_FILTERING_NONE
06129   *         @arg @ref LL_ADC_AWD_FILTERING_2SAMPLES
06130   *         @arg @ref LL_ADC_AWD_FILTERING_3SAMPLES
06131   *         @arg @ref LL_ADC_AWD_FILTERING_4SAMPLES
06132   *         @arg @ref LL_ADC_AWD_FILTERING_5SAMPLES
06133   *         @arg @ref LL_ADC_AWD_FILTERING_6SAMPLES
06134   *         @arg @ref LL_ADC_AWD_FILTERING_7SAMPLES
06135   *         @arg @ref LL_ADC_AWD_FILTERING_8SAMPLES
06136   * @retval None
06137   */
06138 __STATIC_INLINE void LL_ADC_SetAWDFilteringConfiguration(ADC_TypeDef *ADCx, uint32_t AWDy, uint32_t FilteringConfig)
06139 {
06140   if (ADCx == ADC3)
06141   {
06142     /* Prevent unused argument(s) compilation warning */
06143     (void)(AWDy);
06144     MODIFY_REG(ADCx->LTR1_TR1, ADC3_TR1_AWDFILT, FilteringConfig);
06145   }
06146 }
06147 
06148 /**
06149   * @brief  Get ADC analog watchdog filtering configuration
06150   *  @note  On this STM32 series, this feature is only available on first
06151   *         analog watchdog (AWD1)
06152   *         Applicable on ADC3 of devices STM32H72xx and STM32H73xx.
06153   * @rmtoll TR1      AWDFILT        LL_ADC_GetAWDFilteringConfiguration
06154   * @param  ADCx ADC instance
06155   * @param  AWDy This parameter can be one of the following values:
06156   *         @arg @ref LL_ADC_AWD1
06157   * @retval Returned value can be:
06158   *         @arg @ref LL_ADC_AWD_FILTERING_NONE
06159   *         @arg @ref LL_ADC_AWD_FILTERING_2SAMPLES
06160   *         @arg @ref LL_ADC_AWD_FILTERING_3SAMPLES
06161   *         @arg @ref LL_ADC_AWD_FILTERING_4SAMPLES
06162   *         @arg @ref LL_ADC_AWD_FILTERING_5SAMPLES
06163   *         @arg @ref LL_ADC_AWD_FILTERING_6SAMPLES
06164   *         @arg @ref LL_ADC_AWD_FILTERING_7SAMPLES
06165   *         @arg @ref LL_ADC_AWD_FILTERING_8SAMPLES
06166   */
06167 __STATIC_INLINE uint32_t LL_ADC_GetAWDFilteringConfiguration(ADC_TypeDef *ADCx, uint32_t AWDy)
06168 {
06169   if (ADCx == ADC3)
06170   {
06171     /* Prevent unused argument(s) compilation warning */
06172     (void)(AWDy);
06173     return (uint32_t)(READ_BIT(ADCx->LTR1_TR1, ADC3_TR1_AWDFILT));
06174   }
06175   else
06176   {
06177     /* Function not available on this instance, return 0 */
06178     return 0UL;
06179   }
06180 }
06181 #endif /* ADC_VER_V5_V90 */
06182 /**
06183   * @}
06184   */
06185 
06186 /** @defgroup ADC_LL_EF_Configuration_ADC_oversampling Configuration of ADC transversal scope: oversampling
06187   * @{
06188   */
06189 
06190 /**
06191   * @brief  Set ADC oversampling scope: ADC groups regular and-or injected
06192   *         (availability of ADC group injected depends on STM32 families).
06193   * @note   If both groups regular and injected are selected,
06194   *         specify behavior of ADC group injected interrupting
06195   *         group regular: when ADC group injected is triggered,
06196   *         the oversampling on ADC group regular is either
06197   *         temporary stopped and continued, or resumed from start
06198   *         (oversampler buffer reset).
06199   * @note   On this STM32 series, setting of this feature is conditioned to
06200   *         ADC state:
06201   *         ADC must be disabled or enabled without conversion on going
06202   *         on either groups regular or injected.
06203   * @rmtoll CFGR2    ROVSE          LL_ADC_SetOverSamplingScope\n
06204   *         CFGR2    JOVSE          LL_ADC_SetOverSamplingScope\n
06205   *         CFGR2    ROVSM          LL_ADC_SetOverSamplingScope
06206   * @param  ADCx ADC instance
06207   * @param  OvsScope This parameter can be one of the following values:
06208   *         @arg @ref LL_ADC_OVS_DISABLE
06209   *         @arg @ref LL_ADC_OVS_GRP_REGULAR_CONTINUED
06210   *         @arg @ref LL_ADC_OVS_GRP_REGULAR_RESUMED
06211   *         @arg @ref LL_ADC_OVS_GRP_INJECTED
06212   *         @arg @ref LL_ADC_OVS_GRP_INJ_REG_RESUMED
06213   * @retval None
06214   */
06215 __STATIC_INLINE void LL_ADC_SetOverSamplingScope(ADC_TypeDef *ADCx, uint32_t OvsScope)
06216 {
06217   MODIFY_REG(ADCx->CFGR2, ADC_CFGR2_ROVSE | ADC_CFGR2_JOVSE | ADC_CFGR2_ROVSM, OvsScope);
06218 }
06219 
06220 /**
06221   * @brief  Get ADC oversampling scope: ADC groups regular and-or injected
06222   *         (availability of ADC group injected depends on STM32 families).
06223   * @note   If both groups regular and injected are selected,
06224   *         specify behavior of ADC group injected interrupting
06225   *         group regular: when ADC group injected is triggered,
06226   *         the oversampling on ADC group regular is either
06227   *         temporary stopped and continued, or resumed from start
06228   *         (oversampler buffer reset).
06229   * @rmtoll CFGR2    ROVSE          LL_ADC_GetOverSamplingScope\n
06230   *         CFGR2    JOVSE          LL_ADC_GetOverSamplingScope\n
06231   *         CFGR2    ROVSM          LL_ADC_GetOverSamplingScope
06232   * @param  ADCx ADC instance
06233   * @retval Returned value can be one of the following values:
06234   *         @arg @ref LL_ADC_OVS_DISABLE
06235   *         @arg @ref LL_ADC_OVS_GRP_REGULAR_CONTINUED
06236   *         @arg @ref LL_ADC_OVS_GRP_REGULAR_RESUMED
06237   *         @arg @ref LL_ADC_OVS_GRP_INJECTED
06238   *         @arg @ref LL_ADC_OVS_GRP_INJ_REG_RESUMED
06239   */
06240 __STATIC_INLINE uint32_t LL_ADC_GetOverSamplingScope(ADC_TypeDef *ADCx)
06241 {
06242   return (uint32_t)(READ_BIT(ADCx->CFGR2, ADC_CFGR2_ROVSE | ADC_CFGR2_JOVSE | ADC_CFGR2_ROVSM));
06243 }
06244 
06245 /**
06246   * @brief  Set ADC oversampling discontinuous mode (triggered mode)
06247   *         on the selected ADC group.
06248   * @note   Number of oversampled conversions are done either in:
06249   *         - continuous mode (all conversions of oversampling ratio
06250   *           are done from 1 trigger)
06251   *         - discontinuous mode (each conversion of oversampling ratio
06252   *           needs a trigger)
06253   * @note   On this STM32 series, setting of this feature is conditioned to
06254   *         ADC state:
06255   *         ADC must be disabled or enabled without conversion on going
06256   *         on group regular.
06257   * @note   On this STM32 series, oversampling discontinuous mode
06258   *         (triggered mode) can be used only when oversampling is
06259   *         set on group regular only and in resumed mode.
06260   * @rmtoll CFGR2    TROVS          LL_ADC_SetOverSamplingDiscont
06261   * @param  ADCx ADC instance
06262   * @param  OverSamplingDiscont This parameter can be one of the following values:
06263   *         @arg @ref LL_ADC_OVS_REG_CONT
06264   *         @arg @ref LL_ADC_OVS_REG_DISCONT
06265   * @retval None
06266   */
06267 __STATIC_INLINE void LL_ADC_SetOverSamplingDiscont(ADC_TypeDef *ADCx, uint32_t OverSamplingDiscont)
06268 {
06269   MODIFY_REG(ADCx->CFGR2, ADC_CFGR2_TROVS, OverSamplingDiscont);
06270 }
06271 
06272 /**
06273   * @brief  Get ADC oversampling discontinuous mode (triggered mode)
06274   *         on the selected ADC group.
06275   * @note   Number of oversampled conversions are done either in:
06276   *         - continuous mode (all conversions of oversampling ratio
06277   *           are done from 1 trigger)
06278   *         - discontinuous mode (each conversion of oversampling ratio
06279   *           needs a trigger)
06280   * @rmtoll CFGR2    TROVS          LL_ADC_GetOverSamplingDiscont
06281   * @param  ADCx ADC instance
06282   * @retval Returned value can be one of the following values:
06283   *         @arg @ref LL_ADC_OVS_REG_CONT
06284   *         @arg @ref LL_ADC_OVS_REG_DISCONT
06285   */
06286 __STATIC_INLINE uint32_t LL_ADC_GetOverSamplingDiscont(ADC_TypeDef *ADCx)
06287 {
06288   return (uint32_t)(READ_BIT(ADCx->CFGR2, ADC_CFGR2_TROVS));
06289 }
06290 
06291 /**
06292   * @brief  Set ADC oversampling
06293   *         (impacting both ADC groups regular and injected)
06294   * @note   This function set the 2 items of oversampling configuration:
06295   *         - ratio
06296   *         - shift
06297   * @note   On this STM32 series, setting of this feature is conditioned to
06298   *         ADC state:
06299   *         ADC must be disabled or enabled without conversion on going
06300   *         on either groups regular or injected.
06301   * @rmtoll CFGR2    OVSS           LL_ADC_ConfigOverSamplingRatioShift\n
06302   *         CFGR2    OVSR           LL_ADC_ConfigOverSamplingRatioShift
06303   * @param  ADCx ADC instance
06304   * @param  Ratio This parameter can be in the range from 1 to 1024.
06305   * @param  Shift This parameter can be one of the following values:
06306   *         @arg @ref LL_ADC_OVS_SHIFT_NONE
06307   *         @arg @ref LL_ADC_OVS_SHIFT_RIGHT_1
06308   *         @arg @ref LL_ADC_OVS_SHIFT_RIGHT_2
06309   *         @arg @ref LL_ADC_OVS_SHIFT_RIGHT_3
06310   *         @arg @ref LL_ADC_OVS_SHIFT_RIGHT_4
06311   *         @arg @ref LL_ADC_OVS_SHIFT_RIGHT_5
06312   *         @arg @ref LL_ADC_OVS_SHIFT_RIGHT_6
06313   *         @arg @ref LL_ADC_OVS_SHIFT_RIGHT_7
06314   *         @arg @ref LL_ADC_OVS_SHIFT_RIGHT_8
06315   *         @arg @ref LL_ADC_OVS_SHIFT_RIGHT_9
06316   *         @arg @ref LL_ADC_OVS_SHIFT_RIGHT_10
06317   *         @arg @ref LL_ADC_OVS_SHIFT_RIGHT_11
06318   * @retval None
06319   */
06320 __STATIC_INLINE void LL_ADC_ConfigOverSamplingRatioShift(ADC_TypeDef *ADCx, uint32_t Ratio, uint32_t Shift)
06321 {
06322   MODIFY_REG(ADCx->CFGR2, (ADC_CFGR2_OVSS | ADC_CFGR2_OVSR), (Shift | (((Ratio - 1UL) << ADC_CFGR2_OVSR_Pos))));
06323 }
06324 
06325 /**
06326   * @brief  Get ADC oversampling ratio
06327   *        (impacting both ADC groups regular and injected)
06328   * @rmtoll CFGR2    OVSR           LL_ADC_GetOverSamplingRatio
06329   * @param  ADCx ADC instance
06330   * @retval Ratio This parameter can be in the from 1 to 1024.
06331 */
06332 __STATIC_INLINE uint32_t LL_ADC_GetOverSamplingRatio(ADC_TypeDef *ADCx)
06333 {
06334   return (((uint32_t)(READ_BIT(ADCx->CFGR2, ADC_CFGR2_OVSR)) + (1UL << ADC_CFGR2_OVSR_Pos)) >> ADC_CFGR2_OVSR_Pos);
06335 }
06336 
06337 /**
06338   * @brief  Get ADC oversampling shift
06339   *        (impacting both ADC groups regular and injected)
06340   * @rmtoll CFGR2    OVSS           LL_ADC_GetOverSamplingShift
06341   * @param  ADCx ADC instance
06342   * @retval Shift This parameter can be one of the following values:
06343   *         @arg @ref LL_ADC_OVS_SHIFT_NONE
06344   *         @arg @ref LL_ADC_OVS_SHIFT_RIGHT_1
06345   *         @arg @ref LL_ADC_OVS_SHIFT_RIGHT_2
06346   *         @arg @ref LL_ADC_OVS_SHIFT_RIGHT_3
06347   *         @arg @ref LL_ADC_OVS_SHIFT_RIGHT_4
06348   *         @arg @ref LL_ADC_OVS_SHIFT_RIGHT_5
06349   *         @arg @ref LL_ADC_OVS_SHIFT_RIGHT_6
06350   *         @arg @ref LL_ADC_OVS_SHIFT_RIGHT_7
06351   *         @arg @ref LL_ADC_OVS_SHIFT_RIGHT_8
06352   *         @arg @ref LL_ADC_OVS_SHIFT_RIGHT_9
06353   *         @arg @ref LL_ADC_OVS_SHIFT_RIGHT_10
06354   *         @arg @ref LL_ADC_OVS_SHIFT_RIGHT_11
06355 */
06356 __STATIC_INLINE uint32_t LL_ADC_GetOverSamplingShift(ADC_TypeDef *ADCx)
06357 {
06358   return (uint32_t)(READ_BIT(ADCx->CFGR2, ADC_CFGR2_OVSS));
06359 }
06360 
06361 /**
06362   * @}
06363   */
06364 
06365 /** @defgroup ADC_LL_EF_Configuration_ADC_Multimode Configuration of ADC hierarchical scope: multimode
06366   * @{
06367   */
06368 /**
06369   * @brief  Set ADC boost mode.
06370   * @note   On this STM32 series, setting of this feature is conditioned to
06371   *         ADC state:
06372   *         ADC boost must be configured, without calibration on going, without conversion
06373   *         on going on group regular.
06374   * @rmtoll CR  BOOST      LL_ADC_SetBoostMode
06375   * @param  ADCx ADC instance
06376   * @param  BoostMode This parameter can be one of the following values:
06377   *         @arg @ref LL_ADC_BOOST_MODE_6MHZ25
06378   *         @arg @ref LL_ADC_BOOST_MODE_12MHZ5
06379   *         @arg @ref LL_ADC_BOOST_MODE_20MHZ
06380   *         @arg @ref LL_ADC_BOOST_MODE_25MHZ
06381   *         @arg @ref LL_ADC_BOOST_MODE_50MHZ
06382   * @retval None
06383   */
06384 __STATIC_INLINE void LL_ADC_SetBoostMode(ADC_TypeDef *ADCx, uint32_t BoostMode)
06385 {
06386 #if defined(ADC_VER_V5_V90)
06387   if (ADCx != ADC3)
06388   {
06389     MODIFY_REG(ADCx->CR, ADC_CR_BOOST, (BoostMode & ADC_CR_BOOST));
06390   }
06391 #else   /* ADC_VER_V5_V90 */
06392   if ((DBGMCU->IDCODE & 0x30000000UL) == 0x10000000UL) /* Cut 1.x */
06393   {
06394     MODIFY_REG(ADCx->CR, ADC_CR_BOOST_0, (BoostMode >> 2UL));
06395   }
06396   else /* Cut 2.x */
06397   {
06398     MODIFY_REG(ADCx->CR, ADC_CR_BOOST, (BoostMode & ADC_CR_BOOST));
06399   }
06400 #endif
06401 }
06402 
06403 
06404 /**
06405   * @brief  Get ADC boost mode.
06406   * @note   On this STM32 series, setting of this feature is conditioned to
06407   *         ADC state:
06408   *         ADC boost must be configured, without calibration on going, without conversion
06409   *         on going on group regular.
06410   * @rmtoll CR  BOOST      LL_ADC_GetBoostMode
06411   * @param  ADCx ADC instance
06412   * @retval 0: Boost disabled 1: Boost enabled
06413   */
06414 __STATIC_INLINE uint32_t LL_ADC_GetBoostMode(ADC_TypeDef *ADCx)
06415 {
06416   if ((DBGMCU->IDCODE & 0x30000000UL) == 0x10000000UL) /* Cut 1.x */
06417   {
06418     return (uint32_t)READ_BIT(ADCx->CR, ADC_CR_BOOST_0);
06419   }
06420   else /* Cut 2.x */
06421   {
06422     return ((READ_BIT(ADCx->CR, ADC_CR_BOOST) == (ADC_CR_BOOST)) ? 1UL : 0UL);
06423   }
06424 }
06425 
06426 /**
06427   * @brief  Set ADC multimode configuration to operate in independent mode
06428   *         or multimode (for devices with several ADC instances).
06429   * @note   If multimode configuration: the selected ADC instance is
06430   *         either master or slave depending on hardware.
06431   *         Refer to reference manual.
06432   * @note   On this STM32 series, setting of this feature is conditioned to
06433   *         ADC state:
06434   *         All ADC instances of the ADC common group must be disabled.
06435   *         This check can be done with function @ref LL_ADC_IsEnabled() for each
06436   *         ADC instance or by using helper macro
06437   *         @ref __LL_ADC_IS_ENABLED_ALL_COMMON_INSTANCE().
06438   * @rmtoll CCR      DUAL           LL_ADC_SetMultimode
06439   * @param  ADCxy_COMMON ADC common instance
06440   *         (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
06441   * @param  Multimode This parameter can be one of the following values:
06442   *         @arg @ref LL_ADC_MULTI_INDEPENDENT
06443   *         @arg @ref LL_ADC_MULTI_DUAL_REG_SIMULT
06444   *         @arg @ref LL_ADC_MULTI_DUAL_REG_INTERL
06445   *         @arg @ref LL_ADC_MULTI_DUAL_INJ_SIMULT
06446   *         @arg @ref LL_ADC_MULTI_DUAL_INJ_ALTERN
06447   *         @arg @ref LL_ADC_MULTI_DUAL_REG_SIM_INJ_SIM
06448   *         @arg @ref LL_ADC_MULTI_DUAL_REG_SIM_INJ_ALT
06449   *         @arg @ref LL_ADC_MULTI_DUAL_REG_INT_INJ_SIM
06450   * @retval None
06451   */
06452 __STATIC_INLINE void LL_ADC_SetMultimode(ADC_Common_TypeDef *ADCxy_COMMON, uint32_t Multimode)
06453 {
06454   MODIFY_REG(ADCxy_COMMON->CCR, ADC_CCR_DUAL, Multimode);
06455 }
06456 
06457 /**
06458   * @brief  Get ADC multimode configuration to operate in independent mode
06459   *         or multimode (for devices with several ADC instances).
06460   * @note   If multimode configuration: the selected ADC instance is
06461   *         either master or slave depending on hardware.
06462   *         Refer to reference manual.
06463   * @rmtoll CCR      DUAL           LL_ADC_GetMultimode
06464   * @param  ADCxy_COMMON ADC common instance
06465   *         (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
06466   * @retval Returned value can be one of the following values:
06467   *         @arg @ref LL_ADC_MULTI_INDEPENDENT
06468   *         @arg @ref LL_ADC_MULTI_DUAL_REG_SIMULT
06469   *         @arg @ref LL_ADC_MULTI_DUAL_REG_INTERL
06470   *         @arg @ref LL_ADC_MULTI_DUAL_INJ_SIMULT
06471   *         @arg @ref LL_ADC_MULTI_DUAL_INJ_ALTERN
06472   *         @arg @ref LL_ADC_MULTI_DUAL_REG_SIM_INJ_SIM
06473   *         @arg @ref LL_ADC_MULTI_DUAL_REG_SIM_INJ_ALT
06474   *         @arg @ref LL_ADC_MULTI_DUAL_REG_INT_INJ_SIM
06475   */
06476 __STATIC_INLINE uint32_t LL_ADC_GetMultimode(ADC_Common_TypeDef *ADCxy_COMMON)
06477 {
06478   return (uint32_t)(READ_BIT(ADCxy_COMMON->CCR, ADC_CCR_DUAL));
06479 }
06480 
06481 /**
06482   * @brief  Set ADC multimode conversion data transfer: no transfer
06483   *         or transfer by DMA.
06484   * @note   If ADC multimode transfer by DMA is not selected:
06485   *         each ADC uses its own DMA channel, with its individual
06486   *         DMA transfer settings.
06487   *         If ADC multimode transfer by DMA is selected:
06488   *         One DMA channel is used for both ADC (DMA of ADC master)
06489   *         Specifies the DMA requests mode:
06490   *         - Limited mode (One shot mode): DMA transfer requests are stopped
06491   *           when number of DMA data transfers (number of
06492   *           ADC conversions) is reached.
06493   *           This ADC mode is intended to be used with DMA mode non-circular.
06494   *         - Unlimited mode: DMA transfer requests are unlimited,
06495   *           whatever number of DMA data transfers (number of
06496   *           ADC conversions).
06497   *           This ADC mode is intended to be used with DMA mode circular.
06498   * @note   If ADC DMA requests mode is set to unlimited and DMA is set to
06499   *         mode non-circular:
06500   *         when DMA transfers size will be reached, DMA will stop transfers of
06501   *         ADC conversions data ADC will raise an overrun error
06502   *         (overrun flag and interruption if enabled).
06503   * @note   How to retrieve multimode conversion data:
06504   *         Whatever multimode transfer by DMA setting: using function
06505   *         @ref LL_ADC_REG_ReadMultiConversionData32().
06506   *         If ADC multimode transfer by DMA is selected: conversion data
06507   *         is a raw data with ADC master and slave concatenated.
06508   *         A macro is available to get the conversion data of
06509   *         ADC master or ADC slave: see helper macro
06510   *         @ref __LL_ADC_MULTI_CONV_DATA_MASTER_SLAVE().
06511   * @note   On this STM32 series, setting of this feature is conditioned to
06512   *         ADC state:
06513   *         All ADC instances of the ADC common group must be disabled
06514   *         or enabled without conversion on going on group regular.
06515   * @rmtoll CCR      DAMDF          LL_ADC_GetMultiDMATransfer\n
06516   * @param  ADCxy_COMMON ADC common instance
06517   *         (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
06518   * @param  MultiDMATransfer This parameter can be one of the following values:
06519   *         @arg @ref LL_ADC_MULTI_REG_DMA_EACH_ADC
06520   *         @arg @ref LL_ADC_MULTI_REG_DMA_RES_32_10B
06521   *         @arg @ref LL_ADC_MULTI_REG_DMA_RES_8B
06522   * @retval None
06523   */
06524 __STATIC_INLINE void LL_ADC_SetMultiDMATransfer(ADC_Common_TypeDef *ADCxy_COMMON, uint32_t MultiDMATransfer)
06525 {
06526   MODIFY_REG(ADCxy_COMMON->CCR, ADC_CCR_DAMDF, MultiDMATransfer);
06527 }
06528 
06529 /**
06530   * @brief  Get ADC multimode conversion data transfer: no transfer
06531   *         or transfer by DMA.
06532   * @note   If ADC multimode transfer by DMA is not selected:
06533   *         each ADC uses its own DMA channel, with its individual
06534   *         DMA transfer settings.
06535   *         If ADC multimode transfer by DMA is selected:
06536   *         One DMA channel is used for both ADC (DMA of ADC master)
06537   *         Specifies the DMA requests mode:
06538   *         - Limited mode (One shot mode): DMA transfer requests are stopped
06539   *           when number of DMA data transfers (number of
06540   *           ADC conversions) is reached.
06541   *           This ADC mode is intended to be used with DMA mode non-circular.
06542   *         - Unlimited mode: DMA transfer requests are unlimited,
06543   *           whatever number of DMA data transfers (number of
06544   *           ADC conversions).
06545   *           This ADC mode is intended to be used with DMA mode circular.
06546   * @note   If ADC DMA requests mode is set to unlimited and DMA is set to
06547   *         mode non-circular:
06548   *         when DMA transfers size will be reached, DMA will stop transfers of
06549   *         ADC conversions data ADC will raise an overrun error
06550   *         (overrun flag and interruption if enabled).
06551   * @note   How to retrieve multimode conversion data:
06552   *         Whatever multimode transfer by DMA setting: using function
06553   *         @ref LL_ADC_REG_ReadMultiConversionData32().
06554   *         If ADC multimode transfer by DMA is selected: conversion data
06555   *         is a raw data with ADC master and slave concatenated.
06556   *         A macro is available to get the conversion data of
06557   *         ADC master or ADC slave: see helper macro
06558   *         @ref __LL_ADC_MULTI_CONV_DATA_MASTER_SLAVE().
06559   * @rmtoll CCR      DAMDF          LL_ADC_GetMultiDMATransfer\n
06560   * @param  ADCxy_COMMON ADC common instance
06561   *         (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
06562   * @retval Returned value can be one of the following values:
06563   *         @arg @ref LL_ADC_MULTI_REG_DMA_EACH_ADC
06564   *         @arg @ref LL_ADC_MULTI_REG_DMA_RES_32_10B
06565   *         @arg @ref LL_ADC_MULTI_REG_DMA_RES_8B
06566   */
06567 __STATIC_INLINE uint32_t LL_ADC_GetMultiDMATransfer(ADC_Common_TypeDef *ADCxy_COMMON)
06568 {
06569   return (uint32_t)(READ_BIT(ADCxy_COMMON->CCR, ADC_CCR_DAMDF));
06570 }
06571 
06572 /**
06573   * @brief  Set ADC multimode delay between 2 sampling phases.
06574   * @note   The sampling delay range depends on ADC resolution:
06575   *         - ADC resolution 12 bits can have maximum delay of 12 cycles.
06576   *         - ADC resolution 10 bits can have maximum delay of 10 cycles.
06577   *         - ADC resolution  8 bits can have maximum delay of  8 cycles.
06578   *         - ADC resolution  6 bits can have maximum delay of  6 cycles.
06579   * @note   On this STM32 series, setting of this feature is conditioned to
06580   *         ADC state:
06581   *         All ADC instances of the ADC common group must be disabled.
06582   *         This check can be done with function @ref LL_ADC_IsEnabled() for each
06583   *         ADC instance or by using helper macro helper macro
06584   *         @ref __LL_ADC_IS_ENABLED_ALL_COMMON_INSTANCE().
06585   * @rmtoll CCR      DELAY          LL_ADC_SetMultiTwoSamplingDelay
06586   * @param  ADCxy_COMMON ADC common instance
06587   *         (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
06588   * @param  MultiTwoSamplingDelay This parameter can be one of the following values:
06589   *         @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_1CYCLE_5
06590   *         @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_2CYCLES_5
06591   *         @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_3CYCLES_5
06592   *         @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_4CYCLES_5 (1)
06593   *         @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_4CYCLES_5_8_BITS
06594   *         @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_5CYCLES_5 (2)
06595   *         @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_5CYCLES_5_10_BITS
06596   *         @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_6CYCLES  (3)
06597   *         @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_6CYCLES_5 (4)
06598   *         @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_6CYCLES_5_12_BITS
06599   *         @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_7CYCLES_5 (5)
06600   *         @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_8CYCLES  (6)
06601   *         @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_9CYCLES  (7)
06602   *
06603   *         (1) Parameter available only if ADC resolution is 16, 14, 12 or 10 bits.
06604   *         (2) Parameter available only if ADC resolution is 16, 14 or 12  bits.
06605   *         (3) Parameter available only if ADC resolution is 10 or 8 bits.
06606   *         (4) Parameter available only if ADC resolution is 16 or 14 bits.
06607   *         (5) Parameter available only if ADC resolution is 16 bits.
06608   *         (6) Parameter available only if ADC resolution is 12 bits.
06609   *         (7) Parameter available only if ADC resolution is 16 or 14 bits.
06610   * @retval None
06611   */
06612 __STATIC_INLINE void LL_ADC_SetMultiTwoSamplingDelay(ADC_Common_TypeDef *ADCxy_COMMON, uint32_t MultiTwoSamplingDelay)
06613 {
06614   MODIFY_REG(ADCxy_COMMON->CCR, ADC_CCR_DELAY, MultiTwoSamplingDelay);
06615 }
06616 
06617 /**
06618   * @brief  Get ADC multimode delay between 2 sampling phases.
06619   * @rmtoll CCR      DELAY          LL_ADC_GetMultiTwoSamplingDelay
06620   * @param  ADCxy_COMMON ADC common instance
06621   *         (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
06622   * @retval Returned value can be one of the following values:
06623   *         @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_1CYCLE_5
06624   *         @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_2CYCLES_5
06625   *         @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_3CYCLES_5
06626   *         @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_4CYCLES_5 (1)
06627   *         @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_4CYCLES_5_8_BITS
06628   *         @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_5CYCLES_5 (2)
06629   *         @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_5CYCLES_5_10_BITS
06630   *         @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_6CYCLES  (3)
06631   *         @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_6CYCLES_5 (4)
06632   *         @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_6CYCLES_5_12_BITS
06633   *         @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_7CYCLES_5 (5)
06634   *         @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_8CYCLES  (6)
06635   *         @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_9CYCLES  (7)
06636   *
06637   *         (1) Parameter available only if ADC resolution is 16, 14, 12 or 10 bits.
06638   *         (2) Parameter available only if ADC resolution is 16, 14 or 12  bits.
06639   *         (3) Parameter available only if ADC resolution is 10 or 8 bits.
06640   *         (4) Parameter available only if ADC resolution is 16 or 14 bits.
06641   *         (5) Parameter available only if ADC resolution is 16 bits.
06642   *         (6) Parameter available only if ADC resolution is 12 bits.
06643   *         (7) Parameter available only if ADC resolution is 16 or 14 bits.
06644   */
06645 __STATIC_INLINE uint32_t LL_ADC_GetMultiTwoSamplingDelay(ADC_Common_TypeDef *ADCxy_COMMON)
06646 {
06647   return (uint32_t)(READ_BIT(ADCxy_COMMON->CCR, ADC_CCR_DELAY));
06648 }
06649 
06650 /**
06651   * @}
06652   */
06653 /** @defgroup ADC_LL_EF_Operation_ADC_Instance Operation on ADC hierarchical scope: ADC instance
06654   * @{
06655   */
06656 
06657 /**
06658   * @brief  Put ADC instance in deep power down state.
06659   * @note   In case of ADC calibration necessary: When ADC is in deep-power-down
06660   *         state, the internal analog calibration is lost. After exiting from
06661   *         deep power down, calibration must be relaunched or calibration factor
06662   *         (preliminarily saved) must be set back into calibration register.
06663   * @note   On this STM32 series, setting of this feature is conditioned to
06664   *         ADC state:
06665   *         ADC must be ADC disabled.
06666   * @rmtoll CR       DEEPPWD        LL_ADC_EnableDeepPowerDown
06667   * @param  ADCx ADC instance
06668   * @retval None
06669   */
06670 __STATIC_INLINE void LL_ADC_EnableDeepPowerDown(ADC_TypeDef *ADCx)
06671 {
06672   /* Note: Write register with some additional bits forced to state reset     */
06673   /*       instead of modifying only the selected bit for this function,      */
06674   /*       to not interfere with bits with HW property "rs".                  */
06675   MODIFY_REG(ADCx->CR,
06676              ADC_CR_BITS_PROPERTY_RS,
06677              ADC_CR_DEEPPWD);
06678 }
06679 
06680 /**
06681   * @brief  Disable ADC deep power down mode.
06682   * @note   In case of ADC calibration necessary: When ADC is in deep-power-down
06683   *         state, the internal analog calibration is lost. After exiting from
06684   *         deep power down, calibration must be relaunched or calibration factor
06685   *         (preliminarily saved) must be set back into calibration register.
06686   * @note   On this STM32 series, setting of this feature is conditioned to
06687   *         ADC state:
06688   *         ADC must be ADC disabled.
06689   * @rmtoll CR       DEEPPWD        LL_ADC_DisableDeepPowerDown
06690   * @param  ADCx ADC instance
06691   * @retval None
06692   */
06693 __STATIC_INLINE void LL_ADC_DisableDeepPowerDown(ADC_TypeDef *ADCx)
06694 {
06695   /* Note: Write register with some additional bits forced to state reset     */
06696   /*       instead of modifying only the selected bit for this function,      */
06697   /*       to not interfere with bits with HW property "rs".                  */
06698   CLEAR_BIT(ADCx->CR, (ADC_CR_DEEPPWD | ADC_CR_BITS_PROPERTY_RS));
06699 }
06700 
06701 /**
06702   * @brief  Get the selected ADC instance deep power down state.
06703   * @rmtoll CR       DEEPPWD        LL_ADC_IsDeepPowerDownEnabled
06704   * @param  ADCx ADC instance
06705   * @retval 0: deep power down is disabled, 1: deep power down is enabled.
06706   */
06707 __STATIC_INLINE uint32_t LL_ADC_IsDeepPowerDownEnabled(ADC_TypeDef *ADCx)
06708 {
06709   return ((READ_BIT(ADCx->CR, ADC_CR_DEEPPWD) == (ADC_CR_DEEPPWD)) ? 1UL : 0UL);
06710 }
06711 
06712 /**
06713   * @brief  Enable ADC instance internal voltage regulator.
06714   * @note   On this STM32 series, after ADC internal voltage regulator enable,
06715   *         a delay for ADC internal voltage regulator stabilization
06716   *         is required before performing a ADC calibration or ADC enable.
06717   *         Refer to device datasheet, parameter tADCVREG_STUP.
06718   *         Refer to literal @ref LL_ADC_DELAY_INTERNAL_REGUL_STAB_US.
06719   * @note   On this STM32 series, setting of this feature is conditioned to
06720   *         ADC state:
06721   *         ADC must be ADC disabled.
06722   * @rmtoll CR       ADVREGEN       LL_ADC_EnableInternalRegulator
06723   * @param  ADCx ADC instance
06724   * @retval None
06725   */
06726 __STATIC_INLINE void LL_ADC_EnableInternalRegulator(ADC_TypeDef *ADCx)
06727 {
06728   /* Note: Write register with some additional bits forced to state reset     */
06729   /*       instead of modifying only the selected bit for this function,      */
06730   /*       to not interfere with bits with HW property "rs".                  */
06731   MODIFY_REG(ADCx->CR,
06732              ADC_CR_BITS_PROPERTY_RS,
06733              ADC_CR_ADVREGEN);
06734 }
06735 
06736 /**
06737   * @brief  Disable ADC internal voltage regulator.
06738   * @note   On this STM32 series, setting of this feature is conditioned to
06739   *         ADC state:
06740   *         ADC must be ADC disabled.
06741   * @rmtoll CR       ADVREGEN       LL_ADC_DisableInternalRegulator
06742   * @param  ADCx ADC instance
06743   * @retval None
06744   */
06745 __STATIC_INLINE void LL_ADC_DisableInternalRegulator(ADC_TypeDef *ADCx)
06746 {
06747   CLEAR_BIT(ADCx->CR, (ADC_CR_ADVREGEN | ADC_CR_BITS_PROPERTY_RS));
06748 }
06749 
06750 /**
06751   * @brief  Get the selected ADC instance internal voltage regulator state.
06752   * @rmtoll CR       ADVREGEN       LL_ADC_IsInternalRegulatorEnabled
06753   * @param  ADCx ADC instance
06754   * @retval 0: internal regulator is disabled, 1: internal regulator is enabled.
06755   */
06756 __STATIC_INLINE uint32_t LL_ADC_IsInternalRegulatorEnabled(ADC_TypeDef *ADCx)
06757 {
06758   return ((READ_BIT(ADCx->CR, ADC_CR_ADVREGEN) == (ADC_CR_ADVREGEN)) ? 1UL : 0UL);
06759 }
06760 
06761 /**
06762   * @brief  Enable the selected ADC instance.
06763   * @note   On this STM32 series, after ADC enable, a delay for
06764   *         ADC internal analog stabilization is required before performing a
06765   *         ADC conversion start.
06766   *         Refer to device datasheet, parameter tSTAB.
06767   * @note   On this STM32 series, flag LL_ADC_FLAG_ADRDY is raised when the ADC
06768   *         is enabled and when conversion clock is active.
06769   *         (not only core clock: this ADC has a dual clock domain)
06770   * @note   On this STM32 series, setting of this feature is conditioned to
06771   *         ADC state:
06772   *         ADC must be ADC disabled and ADC internal voltage regulator enabled.
06773   * @rmtoll CR       ADEN           LL_ADC_Enable
06774   * @param  ADCx ADC instance
06775   * @retval None
06776   */
06777 __STATIC_INLINE void LL_ADC_Enable(ADC_TypeDef *ADCx)
06778 {
06779   /* Note: Write register with some additional bits forced to state reset     */
06780   /*       instead of modifying only the selected bit for this function,      */
06781   /*       to not interfere with bits with HW property "rs".                  */
06782   MODIFY_REG(ADCx->CR,
06783              ADC_CR_BITS_PROPERTY_RS,
06784              ADC_CR_ADEN);
06785 }
06786 
06787 /**
06788   * @brief  Disable the selected ADC instance.
06789   * @note   On this STM32 series, setting of this feature is conditioned to
06790   *         ADC state:
06791   *         ADC must be not disabled. Must be enabled without conversion on going
06792   *         on either groups regular or injected.
06793   * @rmtoll CR       ADDIS          LL_ADC_Disable
06794   * @param  ADCx ADC instance
06795   * @retval None
06796   */
06797 __STATIC_INLINE void LL_ADC_Disable(ADC_TypeDef *ADCx)
06798 {
06799   /* Note: Write register with some additional bits forced to state reset     */
06800   /*       instead of modifying only the selected bit for this function,      */
06801   /*       to not interfere with bits with HW property "rs".                  */
06802   MODIFY_REG(ADCx->CR,
06803              ADC_CR_BITS_PROPERTY_RS,
06804              ADC_CR_ADDIS);
06805 }
06806 
06807 /**
06808   * @brief  Get the selected ADC instance enable state.
06809   * @note   On this STM32 series, flag LL_ADC_FLAG_ADRDY is raised when the ADC
06810   *         is enabled and when conversion clock is active.
06811   *         (not only core clock: this ADC has a dual clock domain)
06812   * @rmtoll CR       ADEN           LL_ADC_IsEnabled
06813   * @param  ADCx ADC instance
06814   * @retval 0: ADC is disabled, 1: ADC is enabled.
06815   */
06816 __STATIC_INLINE uint32_t LL_ADC_IsEnabled(ADC_TypeDef *ADCx)
06817 {
06818   return ((READ_BIT(ADCx->CR, ADC_CR_ADEN) == (ADC_CR_ADEN)) ? 1UL : 0UL);
06819 }
06820 
06821 /**
06822   * @brief  Get the selected ADC instance disable state.
06823   * @rmtoll CR       ADDIS          LL_ADC_IsDisableOngoing
06824   * @param  ADCx ADC instance
06825   * @retval 0: no ADC disable command on going.
06826   */
06827 __STATIC_INLINE uint32_t LL_ADC_IsDisableOngoing(ADC_TypeDef *ADCx)
06828 {
06829   return ((READ_BIT(ADCx->CR, ADC_CR_ADDIS) == (ADC_CR_ADDIS)) ? 1UL : 0UL);
06830 }
06831 
06832 /**
06833   * @brief  Start ADC calibration in the mode single-ended
06834   *         or differential (for devices with differential mode available).
06835   * @note   On this STM32 series, a minimum number of ADC clock cycles
06836   *         are required between ADC end of calibration and ADC enable.
06837   *         Refer to literal @ref LL_ADC_DELAY_CALIB_ENABLE_ADC_CYCLES.
06838   * @note   Calibration duration:
06839   *         - Calibration of offset: 520 ADC clock cycles
06840   *         - Calibration of linearity: 131072 ADC clock cycles
06841   * @note   For devices with differential mode available:
06842   *         Calibration of offset is specific to each of
06843   *         single-ended and differential modes
06844   *         (calibration run must be performed for each of these
06845   *         differential modes, if used afterwards and if the application
06846   *         requires their calibration).
06847   *         Calibration of linearity is common to both
06848   *         single-ended and differential modes
06849   *         (calibration run can be performed only once).
06850   * @note   On this STM32 series, setting of this feature is conditioned to
06851   *         ADC state:
06852   *         ADC must be ADC disabled.
06853   * @rmtoll CR       ADCAL          LL_ADC_StartCalibration\n
06854   *         CR       ADCALDIF       LL_ADC_StartCalibration\n
06855   *         CR       ADCALLIN       LL_ADC_StartCalibration
06856   * @param  ADCx ADC instance
06857   * @param  CalibrationMode This parameter can be one of the following values:
06858   *         @arg @ref LL_ADC_CALIB_OFFSET
06859   *         @arg @ref LL_ADC_CALIB_OFFSET_LINEARITY
06860   * @param  SingleDiff This parameter can be one of the following values:
06861   *         @arg @ref LL_ADC_SINGLE_ENDED
06862   *         @arg @ref LL_ADC_DIFFERENTIAL_ENDED
06863   * @retval None
06864   */
06865 __STATIC_INLINE void LL_ADC_StartCalibration(ADC_TypeDef *ADCx, uint32_t CalibrationMode, uint32_t SingleDiff)
06866 {
06867   /* Note: Write register with some additional bits forced to state reset     */
06868   /*       instead of modifying only the selected bit for this function,      */
06869   /*       to not interfere with bits with HW property "rs".                  */
06870   MODIFY_REG(ADCx->CR,
06871              ADC_CR_ADCALLIN | ADC_CR_ADCALDIF | ADC_CR_BITS_PROPERTY_RS,
06872              ADC_CR_ADCAL | (CalibrationMode & ADC_CALIB_MODE_MASK) | (SingleDiff & ADC_SINGLEDIFF_CALIB_START_MASK));
06873 }
06874 
06875 /**
06876   * @brief  Get ADC calibration state.
06877   * @rmtoll CR       ADCAL          LL_ADC_IsCalibrationOnGoing
06878   * @param  ADCx ADC instance
06879   * @retval 0: calibration complete, 1: calibration in progress.
06880   */
06881 __STATIC_INLINE uint32_t LL_ADC_IsCalibrationOnGoing(ADC_TypeDef *ADCx)
06882 {
06883   return ((READ_BIT(ADCx->CR, ADC_CR_ADCAL) == (ADC_CR_ADCAL)) ? 1UL : 0UL);
06884 }
06885 
06886 /**
06887   * @}
06888   */
06889 
06890 /** @defgroup ADC_LL_EF_Operation_ADC_Group_Regular Operation on ADC hierarchical scope: group regular
06891   * @{
06892   */
06893 
06894 /**
06895   * @brief  Start ADC group regular conversion.
06896   * @note   On this STM32 series, this function is relevant for both
06897   *         internal trigger (SW start) and external trigger:
06898   *         - If ADC trigger has been set to software start, ADC conversion
06899   *           starts immediately.
06900   *         - If ADC trigger has been set to external trigger, ADC conversion
06901   *           will start at next trigger event (on the selected trigger edge)
06902   *           following the ADC start conversion command.
06903   * @note   On this STM32 series, setting of this feature is conditioned to
06904   *         ADC state:
06905   *         ADC must be enabled without conversion on going on group regular,
06906   *         without conversion stop command on going on group regular,
06907   *         without ADC disable command on going.
06908   * @rmtoll CR       ADSTART        LL_ADC_REG_StartConversion
06909   * @param  ADCx ADC instance
06910   * @retval None
06911   */
06912 __STATIC_INLINE void LL_ADC_REG_StartConversion(ADC_TypeDef *ADCx)
06913 {
06914   /* Note: Write register with some additional bits forced to state reset     */
06915   /*       instead of modifying only the selected bit for this function,      */
06916   /*       to not interfere with bits with HW property "rs".                  */
06917   MODIFY_REG(ADCx->CR,
06918              ADC_CR_BITS_PROPERTY_RS,
06919              ADC_CR_ADSTART);
06920 }
06921 
06922 /**
06923   * @brief  Stop ADC group regular conversion.
06924   * @note   On this STM32 series, setting of this feature is conditioned to
06925   *         ADC state:
06926   *         ADC must be enabled with conversion on going on group regular,
06927   *         without ADC disable command on going.
06928   * @rmtoll CR       ADSTP          LL_ADC_REG_StopConversion
06929   * @param  ADCx ADC instance
06930   * @retval None
06931   */
06932 __STATIC_INLINE void LL_ADC_REG_StopConversion(ADC_TypeDef *ADCx)
06933 {
06934   /* Note: Write register with some additional bits forced to state reset     */
06935   /*       instead of modifying only the selected bit for this function,      */
06936   /*       to not interfere with bits with HW property "rs".                  */
06937   MODIFY_REG(ADCx->CR,
06938              ADC_CR_BITS_PROPERTY_RS,
06939              ADC_CR_ADSTP);
06940 }
06941 
06942 /**
06943   * @brief  Get ADC group regular conversion state.
06944   * @rmtoll CR       ADSTART        LL_ADC_REG_IsConversionOngoing
06945   * @param  ADCx ADC instance
06946   * @retval 0: no conversion is on going on ADC group regular.
06947   */
06948 __STATIC_INLINE uint32_t LL_ADC_REG_IsConversionOngoing(ADC_TypeDef *ADCx)
06949 {
06950   return ((READ_BIT(ADCx->CR, ADC_CR_ADSTART) == (ADC_CR_ADSTART)) ? 1UL : 0UL);
06951 }
06952 
06953 /**
06954   * @brief  Get ADC group regular command of conversion stop state
06955   * @rmtoll CR       ADSTP          LL_ADC_REG_IsStopConversionOngoing
06956   * @param  ADCx ADC instance
06957   * @retval 0: no command of conversion stop is on going on ADC group regular.
06958   */
06959 __STATIC_INLINE uint32_t LL_ADC_REG_IsStopConversionOngoing(ADC_TypeDef *ADCx)
06960 {
06961   return ((READ_BIT(ADCx->CR, ADC_CR_ADSTP) == (ADC_CR_ADSTP)) ? 1UL : 0UL);
06962 }
06963 
06964 /**
06965   * @brief  Get ADC group regular conversion data, range fit for
06966   *         all ADC configurations: all ADC resolutions and
06967   *         all oversampling increased data width (for devices
06968   *         with feature oversampling).
06969   * @rmtoll DR       RDATA          LL_ADC_REG_ReadConversionData32
06970   * @param  ADCx ADC instance
06971   * @retval Value between Min_Data=0x00000000 and Max_Data=0xFFFFFFFF
06972   */
06973 __STATIC_INLINE uint32_t LL_ADC_REG_ReadConversionData32(ADC_TypeDef *ADCx)
06974 {
06975   return (uint32_t)(READ_BIT(ADCx->DR, ADC_DR_RDATA));
06976 }
06977 
06978 /**
06979   * @brief  Get ADC group regular conversion data, range fit for
06980   *         ADC resolution 16 bits.
06981   * @note   For devices with feature oversampling: Oversampling
06982   *         can increase data width, function for extended range
06983   *         may be needed: @ref LL_ADC_REG_ReadConversionData32.
06984   * @rmtoll DR       RDATA          LL_ADC_REG_ReadConversionData16
06985   * @param  ADCx ADC instance
06986   * @retval Value between Min_Data=0x00 and Max_Data=0xFFFF
06987   */
06988 __STATIC_INLINE uint16_t LL_ADC_REG_ReadConversionData16(ADC_TypeDef *ADCx)
06989 {
06990   return (uint16_t)(READ_BIT(ADCx->DR, ADC_DR_RDATA));
06991 }
06992 
06993 /**
06994   * @brief  Get ADC group regular conversion data, range fit for
06995   *         ADC resolution 14 bits.
06996   * @note   For devices with feature oversampling: Oversampling
06997   *         can increase data width, function for extended range
06998   *         may be needed: @ref LL_ADC_REG_ReadConversionData32.
06999   * @rmtoll DR       RDATA          LL_ADC_REG_ReadConversionData14
07000   * @param  ADCx ADC instance
07001   * @retval Value between Min_Data=0x00 and Max_Data=0x3FF
07002   */
07003 __STATIC_INLINE uint16_t LL_ADC_REG_ReadConversionData14(ADC_TypeDef *ADCx)
07004 {
07005   return (uint16_t)(READ_BIT(ADCx->DR, ADC_DR_RDATA));
07006 }
07007 
07008 /**
07009   * @brief  Get ADC group regular conversion data, range fit for
07010   *         ADC resolution 12 bits.
07011   * @note   For devices with feature oversampling: Oversampling
07012   *         can increase data width, function for extended range
07013   *         may be needed: @ref LL_ADC_REG_ReadConversionData32.
07014   * @rmtoll DR       RDATA          LL_ADC_REG_ReadConversionData12
07015   * @param  ADCx ADC instance
07016   * @retval Value between Min_Data=0x000 and Max_Data=0xFFF
07017   */
07018 __STATIC_INLINE uint16_t LL_ADC_REG_ReadConversionData12(ADC_TypeDef *ADCx)
07019 {
07020   return (uint16_t)(READ_BIT(ADCx->DR, ADC_DR_RDATA));
07021 }
07022 
07023 /**
07024   * @brief  Get ADC group regular conversion data, range fit for
07025   *         ADC resolution 10 bits.
07026   * @note   For devices with feature oversampling: Oversampling
07027   *         can increase data width, function for extended range
07028   *         may be needed: @ref LL_ADC_REG_ReadConversionData32.
07029   * @rmtoll DR       RDATA          LL_ADC_REG_ReadConversionData10
07030   * @param  ADCx ADC instance
07031   * @retval Value between Min_Data=0x000 and Max_Data=0x3FF
07032   */
07033 __STATIC_INLINE uint16_t LL_ADC_REG_ReadConversionData10(ADC_TypeDef *ADCx)
07034 {
07035   return (uint16_t)(READ_BIT(ADCx->DR, ADC_DR_RDATA));
07036 }
07037 
07038 /**
07039   * @brief  Get ADC group regular conversion data, range fit for
07040   *         ADC resolution 8 bits.
07041   * @note   For devices with feature oversampling: Oversampling
07042   *         can increase data width, function for extended range
07043   *         may be needed: @ref LL_ADC_REG_ReadConversionData32.
07044   * @rmtoll DR       RDATA          LL_ADC_REG_ReadConversionData8
07045   * @param  ADCx ADC instance
07046   * @retval Value between Min_Data=0x00 and Max_Data=0xFF
07047   */
07048 __STATIC_INLINE uint8_t LL_ADC_REG_ReadConversionData8(ADC_TypeDef *ADCx)
07049 {
07050   return (uint8_t)(READ_BIT(ADCx->DR, ADC_DR_RDATA));
07051 }
07052 /**
07053   * @brief  Get ADC multimode conversion data of ADC master, ADC slave
07054   *         or raw data with ADC master and slave concatenated.
07055   * @note   If raw data with ADC master and slave concatenated is retrieved,
07056   *         a macro is available to get the conversion data of
07057   *         ADC master or ADC slave: see helper macro
07058   *         @ref __LL_ADC_MULTI_CONV_DATA_MASTER_SLAVE().
07059   *         (however this macro is mainly intended for multimode
07060   *         transfer by DMA, because this function can do the same
07061   *         by getting multimode conversion data of ADC master or ADC slave
07062   *         separately).
07063   * @rmtoll CDR      RDATA_MST      LL_ADC_REG_ReadMultiConversionData32\n
07064   *         CDR      RDATA_SLV      LL_ADC_REG_ReadMultiConversionData32
07065   * @param  ADCxy_COMMON ADC common instance
07066   *         (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
07067   * @param  ConversionData This parameter can be one of the following values:
07068   *         @arg @ref LL_ADC_MULTI_MASTER
07069   *         @arg @ref LL_ADC_MULTI_SLAVE
07070   *         @arg @ref LL_ADC_MULTI_MASTER_SLAVE
07071   * @retval Value between Min_Data=0x00000000 and Max_Data=0xFFFFFFFF
07072   */
07073 __STATIC_INLINE uint32_t LL_ADC_REG_ReadMultiConversionData32(ADC_Common_TypeDef *ADCxy_COMMON, uint32_t ConversionData)
07074 {
07075   return (uint32_t)(READ_BIT(ADCxy_COMMON->CDR,
07076                              ConversionData)
07077                     >> (POSITION_VAL(ConversionData) & 0x1FUL)
07078                    );
07079 }
07080 
07081 /**
07082   * @}
07083   */
07084 
07085 /** @defgroup ADC_LL_EF_Operation_ADC_Group_Injected Operation on ADC hierarchical scope: group injected
07086   * @{
07087   */
07088 
07089 /**
07090   * @brief  Start ADC group injected conversion.
07091   * @note   On this STM32 series, this function is relevant for both
07092   *         internal trigger (SW start) and external trigger:
07093   *         - If ADC trigger has been set to software start, ADC conversion
07094   *           starts immediately.
07095   *         - If ADC trigger has been set to external trigger, ADC conversion
07096   *           will start at next trigger event (on the selected trigger edge)
07097   *           following the ADC start conversion command.
07098   * @note   On this STM32 series, setting of this feature is conditioned to
07099   *         ADC state:
07100   *         ADC must be enabled without conversion on going on group injected,
07101   *         without conversion stop command on going on group injected,
07102   *         without ADC disable command on going.
07103   * @rmtoll CR       JADSTART       LL_ADC_INJ_StartConversion
07104   * @param  ADCx ADC instance
07105   * @retval None
07106   */
07107 __STATIC_INLINE void LL_ADC_INJ_StartConversion(ADC_TypeDef *ADCx)
07108 {
07109   /* Note: Write register with some additional bits forced to state reset     */
07110   /*       instead of modifying only the selected bit for this function,      */
07111   /*       to not interfere with bits with HW property "rs".                  */
07112   MODIFY_REG(ADCx->CR,
07113              ADC_CR_BITS_PROPERTY_RS,
07114              ADC_CR_JADSTART);
07115 }
07116 
07117 /**
07118   * @brief  Stop ADC group injected conversion.
07119   * @note   On this STM32 series, setting of this feature is conditioned to
07120   *         ADC state:
07121   *         ADC must be enabled with conversion on going on group injected,
07122   *         without ADC disable command on going.
07123   * @rmtoll CR       JADSTP         LL_ADC_INJ_StopConversion
07124   * @param  ADCx ADC instance
07125   * @retval None
07126   */
07127 __STATIC_INLINE void LL_ADC_INJ_StopConversion(ADC_TypeDef *ADCx)
07128 {
07129   /* Note: Write register with some additional bits forced to state reset     */
07130   /*       instead of modifying only the selected bit for this function,      */
07131   /*       to not interfere with bits with HW property "rs".                  */
07132   MODIFY_REG(ADCx->CR,
07133              ADC_CR_BITS_PROPERTY_RS,
07134              ADC_CR_JADSTP);
07135 }
07136 
07137 /**
07138   * @brief  Get ADC group injected conversion state.
07139   * @rmtoll CR       JADSTART       LL_ADC_INJ_IsConversionOngoing
07140   * @param  ADCx ADC instance
07141   * @retval 0: no conversion is on going on ADC group injected.
07142   */
07143 __STATIC_INLINE uint32_t LL_ADC_INJ_IsConversionOngoing(ADC_TypeDef *ADCx)
07144 {
07145   return ((READ_BIT(ADCx->CR, ADC_CR_JADSTART) == (ADC_CR_JADSTART)) ? 1UL : 0UL);
07146 }
07147 
07148 /**
07149   * @brief  Get ADC group injected command of conversion stop state
07150   * @rmtoll CR       JADSTP         LL_ADC_INJ_IsStopConversionOngoing
07151   * @param  ADCx ADC instance
07152   * @retval 0: no command of conversion stop is on going on ADC group injected.
07153   */
07154 __STATIC_INLINE uint32_t LL_ADC_INJ_IsStopConversionOngoing(ADC_TypeDef *ADCx)
07155 {
07156   return ((READ_BIT(ADCx->CR, ADC_CR_JADSTP) == (ADC_CR_JADSTP)) ? 1UL : 0UL);
07157 }
07158 
07159 /**
07160   * @brief  Get ADC group injected conversion data, range fit for
07161   *         all ADC configurations: all ADC resolutions and
07162   *         all oversampling increased data width (for devices
07163   *         with feature oversampling).
07164   * @rmtoll JDR1     JDATA          LL_ADC_INJ_ReadConversionData32\n
07165   *         JDR2     JDATA          LL_ADC_INJ_ReadConversionData32\n
07166   *         JDR3     JDATA          LL_ADC_INJ_ReadConversionData32\n
07167   *         JDR4     JDATA          LL_ADC_INJ_ReadConversionData32
07168   * @param  ADCx ADC instance
07169   * @param  Rank This parameter can be one of the following values:
07170   *         @arg @ref LL_ADC_INJ_RANK_1
07171   *         @arg @ref LL_ADC_INJ_RANK_2
07172   *         @arg @ref LL_ADC_INJ_RANK_3
07173   *         @arg @ref LL_ADC_INJ_RANK_4
07174   * @retval Value between Min_Data=0x00000000 and Max_Data=0xFFFFFFFF
07175   */
07176 __STATIC_INLINE uint32_t LL_ADC_INJ_ReadConversionData32(ADC_TypeDef *ADCx, uint32_t Rank)
07177 {
07178   const __IO uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->JDR1, ((Rank & ADC_INJ_JDRX_REGOFFSET_MASK) >> ADC_JDRX_REGOFFSET_POS));
07179 
07180   return (uint32_t)(READ_BIT(*preg,
07181                              ADC_JDR1_JDATA)
07182                    );
07183 }
07184 
07185 /**
07186   * @brief  Get ADC group injected conversion data, range fit for
07187   *         ADC resolution 16 bits.
07188   * @note   For devices with feature oversampling: Oversampling
07189   *         can increase data width, function for extended range
07190   *         may be needed: @ref LL_ADC_INJ_ReadConversionData32.
07191   * @rmtoll JDR1     JDATA          LL_ADC_INJ_ReadConversionData16\n
07192   *         JDR2     JDATA          LL_ADC_INJ_ReadConversionData16\n
07193   *         JDR3     JDATA          LL_ADC_INJ_ReadConversionData16\n
07194   *         JDR4     JDATA          LL_ADC_INJ_ReadConversionData16
07195   * @param  ADCx ADC instance
07196   * @param  Rank This parameter can be one of the following values:
07197   *         @arg @ref LL_ADC_INJ_RANK_1
07198   *         @arg @ref LL_ADC_INJ_RANK_2
07199   *         @arg @ref LL_ADC_INJ_RANK_3
07200   *         @arg @ref LL_ADC_INJ_RANK_4
07201   * @retval Value between Min_Data=0x000 and Max_Data=0xFFFF
07202   */
07203 __STATIC_INLINE uint16_t LL_ADC_INJ_ReadConversionData16(ADC_TypeDef *ADCx, uint32_t Rank)
07204 {
07205   const __IO uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->JDR1, ((Rank & ADC_INJ_JDRX_REGOFFSET_MASK) >> ADC_JDRX_REGOFFSET_POS));
07206 
07207   return (uint16_t)(READ_BIT(*preg,
07208                              ADC_JDR1_JDATA)
07209                    );
07210 }
07211 
07212 /**
07213   * @brief  Get ADC group injected conversion data, range fit for
07214   *         ADC resolution 14 bits.
07215   * @note   For devices with feature oversampling: Oversampling
07216   *         can increase data width, function for extended range
07217   *         may be needed: @ref LL_ADC_INJ_ReadConversionData32.
07218   * @rmtoll JDR1     JDATA          LL_ADC_INJ_ReadConversionData14\n
07219   *         JDR2     JDATA          LL_ADC_INJ_ReadConversionData14\n
07220   *         JDR3     JDATA          LL_ADC_INJ_ReadConversionData14\n
07221   *         JDR4     JDATA          LL_ADC_INJ_ReadConversionData14
07222   * @param  ADCx ADC instance
07223   * @param  Rank This parameter can be one of the following values:
07224   *         @arg @ref LL_ADC_INJ_RANK_1
07225   *         @arg @ref LL_ADC_INJ_RANK_2
07226   *         @arg @ref LL_ADC_INJ_RANK_3
07227   *         @arg @ref LL_ADC_INJ_RANK_4
07228   * @retval Value between Min_Data=0x000 and Max_Data=0x3FFF
07229   */
07230 __STATIC_INLINE uint16_t LL_ADC_INJ_ReadConversionData14(ADC_TypeDef *ADCx, uint32_t Rank)
07231 {
07232   const __IO uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->JDR1, ((Rank & ADC_INJ_JDRX_REGOFFSET_MASK) >> ADC_JDRX_REGOFFSET_POS));
07233 
07234   return (uint16_t)(READ_BIT(*preg,
07235                              ADC_JDR1_JDATA)
07236                    );
07237 }
07238 
07239 /**
07240   * @brief  Get ADC group injected conversion data, range fit for
07241   *         ADC resolution 12 bits.
07242   * @note   For devices with feature oversampling: Oversampling
07243   *         can increase data width, function for extended range
07244   *         may be needed: @ref LL_ADC_INJ_ReadConversionData32.
07245   * @rmtoll JDR1     JDATA          LL_ADC_INJ_ReadConversionData12\n
07246   *         JDR2     JDATA          LL_ADC_INJ_ReadConversionData12\n
07247   *         JDR3     JDATA          LL_ADC_INJ_ReadConversionData12\n
07248   *         JDR4     JDATA          LL_ADC_INJ_ReadConversionData12
07249   * @param  ADCx ADC instance
07250   * @param  Rank This parameter can be one of the following values:
07251   *         @arg @ref LL_ADC_INJ_RANK_1
07252   *         @arg @ref LL_ADC_INJ_RANK_2
07253   *         @arg @ref LL_ADC_INJ_RANK_3
07254   *         @arg @ref LL_ADC_INJ_RANK_4
07255   * @retval Value between Min_Data=0x000 and Max_Data=0xFFF
07256   */
07257 __STATIC_INLINE uint16_t LL_ADC_INJ_ReadConversionData12(ADC_TypeDef *ADCx, uint32_t Rank)
07258 {
07259   const __IO uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->JDR1, ((Rank & ADC_INJ_JDRX_REGOFFSET_MASK) >> ADC_JDRX_REGOFFSET_POS));
07260 
07261   return (uint16_t)(READ_BIT(*preg,
07262                              ADC_JDR1_JDATA)
07263                    );
07264 }
07265 
07266 /**
07267   * @brief  Get ADC group injected conversion data, range fit for
07268   *         ADC resolution 10 bits.
07269   * @note   For devices with feature oversampling: Oversampling
07270   *         can increase data width, function for extended range
07271   *         may be needed: @ref LL_ADC_INJ_ReadConversionData32.
07272   * @rmtoll JDR1     JDATA          LL_ADC_INJ_ReadConversionData10\n
07273   *         JDR2     JDATA          LL_ADC_INJ_ReadConversionData10\n
07274   *         JDR3     JDATA          LL_ADC_INJ_ReadConversionData10\n
07275   *         JDR4     JDATA          LL_ADC_INJ_ReadConversionData10
07276   * @param  ADCx ADC instance
07277   * @param  Rank This parameter can be one of the following values:
07278   *         @arg @ref LL_ADC_INJ_RANK_1
07279   *         @arg @ref LL_ADC_INJ_RANK_2
07280   *         @arg @ref LL_ADC_INJ_RANK_3
07281   *         @arg @ref LL_ADC_INJ_RANK_4
07282   * @retval Value between Min_Data=0x000 and Max_Data=0x3FF
07283   */
07284 __STATIC_INLINE uint16_t LL_ADC_INJ_ReadConversionData10(ADC_TypeDef *ADCx, uint32_t Rank)
07285 {
07286   const __IO uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->JDR1, ((Rank & ADC_INJ_JDRX_REGOFFSET_MASK) >> ADC_JDRX_REGOFFSET_POS));
07287 
07288   return (uint16_t)(READ_BIT(*preg,
07289                              ADC_JDR1_JDATA)
07290                    );
07291 }
07292 
07293 /**
07294   * @brief  Get ADC group injected conversion data, range fit for
07295   *         ADC resolution 8 bits.
07296   * @note   For devices with feature oversampling: Oversampling
07297   *         can increase data width, function for extended range
07298   *         may be needed: @ref LL_ADC_INJ_ReadConversionData32.
07299   * @rmtoll JDR1     JDATA          LL_ADC_INJ_ReadConversionData8\n
07300   *         JDR2     JDATA          LL_ADC_INJ_ReadConversionData8\n
07301   *         JDR3     JDATA          LL_ADC_INJ_ReadConversionData8\n
07302   *         JDR4     JDATA          LL_ADC_INJ_ReadConversionData8
07303   * @param  ADCx ADC instance
07304   * @param  Rank This parameter can be one of the following values:
07305   *         @arg @ref LL_ADC_INJ_RANK_1
07306   *         @arg @ref LL_ADC_INJ_RANK_2
07307   *         @arg @ref LL_ADC_INJ_RANK_3
07308   *         @arg @ref LL_ADC_INJ_RANK_4
07309   * @retval Value between Min_Data=0x00 and Max_Data=0xFF
07310   */
07311 __STATIC_INLINE uint8_t LL_ADC_INJ_ReadConversionData8(ADC_TypeDef *ADCx, uint32_t Rank)
07312 {
07313   const __IO uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->JDR1, ((Rank & ADC_INJ_JDRX_REGOFFSET_MASK) >> ADC_JDRX_REGOFFSET_POS));
07314 
07315   return (uint8_t)(READ_BIT(*preg,
07316                             ADC_JDR1_JDATA)
07317                   );
07318 }
07319 
07320 /**
07321   * @}
07322   */
07323 
07324 /** @defgroup ADC_LL_EF_FLAG_Management ADC flag management
07325   * @{
07326   */
07327 
07328 /**
07329   * @brief  Get flag ADC ready.
07330   * @note   On this STM32 series, flag LL_ADC_FLAG_ADRDY is raised when the ADC
07331   *         is enabled and when conversion clock is active.
07332   *         (not only core clock: this ADC has a dual clock domain)
07333   * @rmtoll ISR      ADRDY          LL_ADC_IsActiveFlag_ADRDY
07334   * @param  ADCx ADC instance
07335   * @retval State of bit (1 or 0).
07336   */
07337 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_ADRDY(ADC_TypeDef *ADCx)
07338 {
07339   return ((READ_BIT(ADCx->ISR, LL_ADC_FLAG_ADRDY) == (LL_ADC_FLAG_ADRDY)) ? 1UL : 0UL);
07340 }
07341 
07342 /**
07343   * @brief  Get flag ADC group regular end of unitary conversion.
07344   * @rmtoll ISR      EOC            LL_ADC_IsActiveFlag_EOC
07345   * @param  ADCx ADC instance
07346   * @retval State of bit (1 or 0).
07347   */
07348 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_EOC(ADC_TypeDef *ADCx)
07349 {
07350   return ((READ_BIT(ADCx->ISR, ADC_ISR_EOC) == (ADC_ISR_EOC)) ? 1UL : 0UL);
07351 }
07352 
07353 /**
07354   * @brief  Get flag ADC group regular end of sequence conversions.
07355   * @rmtoll ISR      EOS            LL_ADC_IsActiveFlag_EOS
07356   * @param  ADCx ADC instance
07357   * @retval State of bit (1 or 0).
07358   */
07359 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_EOS(ADC_TypeDef *ADCx)
07360 {
07361   return ((READ_BIT(ADCx->ISR, LL_ADC_FLAG_EOS) == (LL_ADC_FLAG_EOS)) ? 1UL : 0UL);
07362 }
07363 
07364 /**
07365   * @brief  Get flag ADC group regular overrun.
07366   * @rmtoll ISR      OVR            LL_ADC_IsActiveFlag_OVR
07367   * @param  ADCx ADC instance
07368   * @retval State of bit (1 or 0).
07369   */
07370 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_OVR(ADC_TypeDef *ADCx)
07371 {
07372   return ((READ_BIT(ADCx->ISR, LL_ADC_FLAG_OVR) == (LL_ADC_FLAG_OVR)) ? 1UL : 0UL);
07373 }
07374 
07375 /**
07376   * @brief  Get flag ADC group regular end of sampling phase.
07377   * @rmtoll ISR      EOSMP          LL_ADC_IsActiveFlag_EOSMP
07378   * @param  ADCx ADC instance
07379   * @retval State of bit (1 or 0).
07380   */
07381 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_EOSMP(ADC_TypeDef *ADCx)
07382 {
07383   return ((READ_BIT(ADCx->ISR, LL_ADC_FLAG_EOSMP) == (LL_ADC_FLAG_EOSMP)) ? 1UL : 0UL);
07384 }
07385 
07386 /**
07387   * @brief  Get flag ADC group injected end of unitary conversion.
07388   * @rmtoll ISR      JEOC           LL_ADC_IsActiveFlag_JEOC
07389   * @param  ADCx ADC instance
07390   * @retval State of bit (1 or 0).
07391   */
07392 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_JEOC(ADC_TypeDef *ADCx)
07393 {
07394   return ((READ_BIT(ADCx->ISR, LL_ADC_FLAG_JEOC) == (LL_ADC_FLAG_JEOC)) ? 1UL : 0UL);
07395 }
07396 
07397 /**
07398   * @brief  Get flag ADC group injected end of sequence conversions.
07399   * @rmtoll ISR      JEOS           LL_ADC_IsActiveFlag_JEOS
07400   * @param  ADCx ADC instance
07401   * @retval State of bit (1 or 0).
07402   */
07403 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_JEOS(ADC_TypeDef *ADCx)
07404 {
07405   return ((READ_BIT(ADCx->ISR, LL_ADC_FLAG_JEOS) == (LL_ADC_FLAG_JEOS)) ? 1UL : 0UL);
07406 }
07407 
07408 /**
07409   * @brief  Get flag ADC group injected contexts queue overflow.
07410   * @rmtoll ISR      JQOVF          LL_ADC_IsActiveFlag_JQOVF
07411   * @param  ADCx ADC instance
07412   * @retval State of bit (1 or 0).
07413   */
07414 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_JQOVF(ADC_TypeDef *ADCx)
07415 {
07416   return ((READ_BIT(ADCx->ISR, LL_ADC_FLAG_JQOVF) == (LL_ADC_FLAG_JQOVF)) ? 1UL : 0UL);
07417 }
07418 
07419 /**
07420   * @brief  Get flag ADC analog watchdog 1 flag
07421   * @rmtoll ISR      AWD1           LL_ADC_IsActiveFlag_AWD1
07422   * @param  ADCx ADC instance
07423   * @retval State of bit (1 or 0).
07424   */
07425 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_AWD1(ADC_TypeDef *ADCx)
07426 {
07427   return ((READ_BIT(ADCx->ISR, LL_ADC_FLAG_AWD1) == (LL_ADC_FLAG_AWD1)) ? 1UL : 0UL);
07428 }
07429 
07430 /**
07431   * @brief  Get flag ADC analog watchdog 2.
07432   * @rmtoll ISR      AWD2           LL_ADC_IsActiveFlag_AWD2
07433   * @param  ADCx ADC instance
07434   * @retval State of bit (1 or 0).
07435   */
07436 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_AWD2(ADC_TypeDef *ADCx)
07437 {
07438   return ((READ_BIT(ADCx->ISR, LL_ADC_FLAG_AWD2) == (LL_ADC_FLAG_AWD2)) ? 1UL : 0UL);
07439 }
07440 
07441 /**
07442   * @brief  Get flag ADC analog watchdog 3.
07443   * @rmtoll ISR      AWD3           LL_ADC_IsActiveFlag_AWD3
07444   * @param  ADCx ADC instance
07445   * @retval State of bit (1 or 0).
07446   */
07447 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_AWD3(ADC_TypeDef *ADCx)
07448 {
07449   return ((READ_BIT(ADCx->ISR, LL_ADC_FLAG_AWD3) == (LL_ADC_FLAG_AWD3)) ? 1UL : 0UL);
07450 }
07451 
07452 /**
07453   * @brief  Clear flag ADC ready.
07454   * @note   On this STM32 series, flag LL_ADC_FLAG_ADRDY is raised when the ADC
07455   *         is enabled and when conversion clock is active.
07456   *         (not only core clock: this ADC has a dual clock domain)
07457   * @rmtoll ISR      ADRDY          LL_ADC_ClearFlag_ADRDY
07458   * @param  ADCx ADC instance
07459   * @retval None
07460   */
07461 __STATIC_INLINE void LL_ADC_ClearFlag_ADRDY(ADC_TypeDef *ADCx)
07462 {
07463   WRITE_REG(ADCx->ISR, LL_ADC_FLAG_ADRDY);
07464 }
07465 
07466 /**
07467   * @brief  Clear flag ADC group regular end of unitary conversion.
07468   * @rmtoll ISR      EOC            LL_ADC_ClearFlag_EOC
07469   * @param  ADCx ADC instance
07470   * @retval None
07471   */
07472 __STATIC_INLINE void LL_ADC_ClearFlag_EOC(ADC_TypeDef *ADCx)
07473 {
07474   WRITE_REG(ADCx->ISR, LL_ADC_FLAG_EOC);
07475 }
07476 
07477 /**
07478   * @brief  Clear flag ADC group regular end of sequence conversions.
07479   * @rmtoll ISR      EOS            LL_ADC_ClearFlag_EOS
07480   * @param  ADCx ADC instance
07481   * @retval None
07482   */
07483 __STATIC_INLINE void LL_ADC_ClearFlag_EOS(ADC_TypeDef *ADCx)
07484 {
07485   WRITE_REG(ADCx->ISR, LL_ADC_FLAG_EOS);
07486 }
07487 
07488 /**
07489   * @brief  Clear flag ADC group regular overrun.
07490   * @rmtoll ISR      OVR            LL_ADC_ClearFlag_OVR
07491   * @param  ADCx ADC instance
07492   * @retval None
07493   */
07494 __STATIC_INLINE void LL_ADC_ClearFlag_OVR(ADC_TypeDef *ADCx)
07495 {
07496   WRITE_REG(ADCx->ISR, LL_ADC_FLAG_OVR);
07497 }
07498 
07499 /**
07500   * @brief  Clear flag ADC group regular end of sampling phase.
07501   * @rmtoll ISR      EOSMP          LL_ADC_ClearFlag_EOSMP
07502   * @param  ADCx ADC instance
07503   * @retval None
07504   */
07505 __STATIC_INLINE void LL_ADC_ClearFlag_EOSMP(ADC_TypeDef *ADCx)
07506 {
07507   WRITE_REG(ADCx->ISR, LL_ADC_FLAG_EOSMP);
07508 }
07509 
07510 /**
07511   * @brief  Clear flag ADC group injected end of unitary conversion.
07512   * @rmtoll ISR      JEOC           LL_ADC_ClearFlag_JEOC
07513   * @param  ADCx ADC instance
07514   * @retval None
07515   */
07516 __STATIC_INLINE void LL_ADC_ClearFlag_JEOC(ADC_TypeDef *ADCx)
07517 {
07518   WRITE_REG(ADCx->ISR, LL_ADC_FLAG_JEOC);
07519 }
07520 
07521 /**
07522   * @brief  Clear flag ADC group injected end of sequence conversions.
07523   * @rmtoll ISR      JEOS           LL_ADC_ClearFlag_JEOS
07524   * @param  ADCx ADC instance
07525   * @retval None
07526   */
07527 __STATIC_INLINE void LL_ADC_ClearFlag_JEOS(ADC_TypeDef *ADCx)
07528 {
07529   WRITE_REG(ADCx->ISR, LL_ADC_FLAG_JEOS);
07530 }
07531 
07532 /**
07533   * @brief  Clear flag ADC group injected contexts queue overflow.
07534   * @rmtoll ISR      JQOVF          LL_ADC_ClearFlag_JQOVF
07535   * @param  ADCx ADC instance
07536   * @retval None
07537   */
07538 __STATIC_INLINE void LL_ADC_ClearFlag_JQOVF(ADC_TypeDef *ADCx)
07539 {
07540   WRITE_REG(ADCx->ISR, LL_ADC_FLAG_JQOVF);
07541 }
07542 
07543 /**
07544   * @brief  Clear flag ADC analog watchdog 1.
07545   * @rmtoll ISR      AWD1           LL_ADC_ClearFlag_AWD1
07546   * @param  ADCx ADC instance
07547   * @retval None
07548   */
07549 __STATIC_INLINE void LL_ADC_ClearFlag_AWD1(ADC_TypeDef *ADCx)
07550 {
07551   WRITE_REG(ADCx->ISR, LL_ADC_FLAG_AWD1);
07552 }
07553 
07554 /**
07555   * @brief  Clear flag ADC analog watchdog 2.
07556   * @rmtoll ISR      AWD2           LL_ADC_ClearFlag_AWD2
07557   * @param  ADCx ADC instance
07558   * @retval None
07559   */
07560 __STATIC_INLINE void LL_ADC_ClearFlag_AWD2(ADC_TypeDef *ADCx)
07561 {
07562   WRITE_REG(ADCx->ISR, LL_ADC_FLAG_AWD2);
07563 }
07564 
07565 /**
07566   * @brief  Clear flag ADC analog watchdog 3.
07567   * @rmtoll ISR      AWD3           LL_ADC_ClearFlag_AWD3
07568   * @param  ADCx ADC instance
07569   * @retval None
07570   */
07571 __STATIC_INLINE void LL_ADC_ClearFlag_AWD3(ADC_TypeDef *ADCx)
07572 {
07573   WRITE_REG(ADCx->ISR, LL_ADC_FLAG_AWD3);
07574 }
07575 
07576 /**
07577   * @brief  Get flag multimode ADC ready of the ADC master.
07578   * @rmtoll CSR      ADRDY_MST      LL_ADC_IsActiveFlag_MST_ADRDY
07579   * @param  ADCxy_COMMON ADC common instance
07580   *         (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
07581   * @retval State of bit (1 or 0).
07582   */
07583 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_MST_ADRDY(ADC_Common_TypeDef *ADCxy_COMMON)
07584 {
07585   return ((READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_ADRDY_MST) == (LL_ADC_FLAG_ADRDY_MST)) ? 1UL : 0UL);
07586 }
07587 
07588 /**
07589   * @brief  Get flag multimode ADC ready of the ADC slave.
07590   * @rmtoll CSR      ADRDY_SLV      LL_ADC_IsActiveFlag_SLV_ADRDY
07591   * @param  ADCxy_COMMON ADC common instance
07592   *         (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
07593   * @retval State of bit (1 or 0).
07594   */
07595 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_SLV_ADRDY(ADC_Common_TypeDef *ADCxy_COMMON)
07596 {
07597   return ((READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_ADRDY_SLV) == (LL_ADC_FLAG_ADRDY_SLV)) ? 1UL : 0UL);
07598 }
07599 
07600 /**
07601   * @brief  Get flag multimode ADC group regular end of unitary conversion of the ADC master.
07602   * @rmtoll CSR      EOC_MST        LL_ADC_IsActiveFlag_MST_EOC
07603   * @param  ADCxy_COMMON ADC common instance
07604   *         (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
07605   * @retval State of bit (1 or 0).
07606   */
07607 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_MST_EOC(ADC_Common_TypeDef *ADCxy_COMMON)
07608 {
07609   return ((READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_EOC_SLV) == (LL_ADC_FLAG_EOC_SLV)) ? 1UL : 0UL);
07610 }
07611 
07612 /**
07613   * @brief  Get flag multimode ADC group regular end of unitary conversion of the ADC slave.
07614   * @rmtoll CSR      EOC_SLV        LL_ADC_IsActiveFlag_SLV_EOC
07615   * @param  ADCxy_COMMON ADC common instance
07616   *         (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
07617   * @retval State of bit (1 or 0).
07618   */
07619 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_SLV_EOC(ADC_Common_TypeDef *ADCxy_COMMON)
07620 {
07621   return ((READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_EOC_SLV) == (LL_ADC_FLAG_EOC_SLV)) ? 1UL : 0UL);
07622 }
07623 
07624 /**
07625   * @brief  Get flag multimode ADC group regular end of sequence conversions of the ADC master.
07626   * @rmtoll CSR      EOS_MST        LL_ADC_IsActiveFlag_MST_EOS
07627   * @param  ADCxy_COMMON ADC common instance
07628   *         (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
07629   * @retval State of bit (1 or 0).
07630   */
07631 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_MST_EOS(ADC_Common_TypeDef *ADCxy_COMMON)
07632 {
07633   return ((READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_EOS_MST) == (LL_ADC_FLAG_EOS_MST)) ? 1UL : 0UL);
07634 }
07635 
07636 /**
07637   * @brief  Get flag multimode ADC group regular end of sequence conversions of the ADC slave.
07638   * @rmtoll CSR      EOS_SLV        LL_ADC_IsActiveFlag_SLV_EOS
07639   * @param  ADCxy_COMMON ADC common instance
07640   *         (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
07641   * @retval State of bit (1 or 0).
07642   */
07643 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_SLV_EOS(ADC_Common_TypeDef *ADCxy_COMMON)
07644 {
07645   return ((READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_EOS_SLV) == (LL_ADC_FLAG_EOS_SLV)) ? 1UL : 0UL);
07646 }
07647 
07648 /**
07649   * @brief  Get flag multimode ADC group regular overrun of the ADC master.
07650   * @rmtoll CSR      OVR_MST        LL_ADC_IsActiveFlag_MST_OVR
07651   * @param  ADCxy_COMMON ADC common instance
07652   *         (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
07653   * @retval State of bit (1 or 0).
07654   */
07655 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_MST_OVR(ADC_Common_TypeDef *ADCxy_COMMON)
07656 {
07657   return ((READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_OVR_MST) == (LL_ADC_FLAG_OVR_MST)) ? 1UL : 0UL);
07658 }
07659 
07660 /**
07661   * @brief  Get flag multimode ADC group regular overrun of the ADC slave.
07662   * @rmtoll CSR      OVR_SLV        LL_ADC_IsActiveFlag_SLV_OVR
07663   * @param  ADCxy_COMMON ADC common instance
07664   *         (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
07665   * @retval State of bit (1 or 0).
07666   */
07667 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_SLV_OVR(ADC_Common_TypeDef *ADCxy_COMMON)
07668 {
07669   return ((READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_OVR_SLV) == (LL_ADC_FLAG_OVR_SLV)) ? 1UL : 0UL);
07670 }
07671 
07672 /**
07673   * @brief  Get flag multimode ADC group regular end of sampling of the ADC master.
07674   * @rmtoll CSR      EOSMP_MST      LL_ADC_IsActiveFlag_MST_EOSMP
07675   * @param  ADCxy_COMMON ADC common instance
07676   *         (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
07677   * @retval State of bit (1 or 0).
07678   */
07679 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_MST_EOSMP(ADC_Common_TypeDef *ADCxy_COMMON)
07680 {
07681   return ((READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_EOSMP_MST) == (LL_ADC_FLAG_EOSMP_MST)) ? 1UL : 0UL);
07682 }
07683 
07684 /**
07685   * @brief  Get flag multimode ADC group regular end of sampling of the ADC slave.
07686   * @rmtoll CSR      EOSMP_SLV      LL_ADC_IsActiveFlag_SLV_EOSMP
07687   * @param  ADCxy_COMMON ADC common instance
07688   *         (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
07689   * @retval State of bit (1 or 0).
07690   */
07691 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_SLV_EOSMP(ADC_Common_TypeDef *ADCxy_COMMON)
07692 {
07693   return ((READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_EOSMP_SLV) == (LL_ADC_FLAG_EOSMP_SLV)) ? 1UL : 0UL);
07694 }
07695 
07696 /**
07697   * @brief  Get flag multimode ADC group injected end of unitary conversion of the ADC master.
07698   * @rmtoll CSR      JEOC_MST       LL_ADC_IsActiveFlag_MST_JEOC
07699   * @param  ADCxy_COMMON ADC common instance
07700   *         (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
07701   * @retval State of bit (1 or 0).
07702   */
07703 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_MST_JEOC(ADC_Common_TypeDef *ADCxy_COMMON)
07704 {
07705   return ((READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_JEOC_MST) == (LL_ADC_FLAG_JEOC_MST)) ? 1UL : 0UL);
07706 }
07707 
07708 /**
07709   * @brief  Get flag multimode ADC group injected end of unitary conversion of the ADC slave.
07710   * @rmtoll CSR      JEOC_SLV       LL_ADC_IsActiveFlag_SLV_JEOC
07711   * @param  ADCxy_COMMON ADC common instance
07712   *         (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
07713   * @retval State of bit (1 or 0).
07714   */
07715 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_SLV_JEOC(ADC_Common_TypeDef *ADCxy_COMMON)
07716 {
07717   return ((READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_JEOC_SLV) == (LL_ADC_FLAG_JEOC_SLV)) ? 1UL : 0UL);
07718 }
07719 
07720 /**
07721   * @brief  Get flag multimode ADC group injected end of sequence conversions of the ADC master.
07722   * @rmtoll CSR      JEOS_MST       LL_ADC_IsActiveFlag_MST_JEOS
07723   * @param  ADCxy_COMMON ADC common instance
07724   *         (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
07725   * @retval State of bit (1 or 0).
07726   */
07727 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_MST_JEOS(ADC_Common_TypeDef *ADCxy_COMMON)
07728 {
07729   return ((READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_JEOS_MST) == (LL_ADC_FLAG_JEOS_MST)) ? 1UL : 0UL);
07730 }
07731 
07732 /**
07733   * @brief  Get flag multimode ADC group injected end of sequence conversions of the ADC slave.
07734   * @rmtoll CSR      JEOS_SLV       LL_ADC_IsActiveFlag_SLV_JEOS
07735   * @param  ADCxy_COMMON ADC common instance
07736   *         (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
07737   * @retval State of bit (1 or 0).
07738   */
07739 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_SLV_JEOS(ADC_Common_TypeDef *ADCxy_COMMON)
07740 {
07741   return ((READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_JEOS_SLV) == (LL_ADC_FLAG_JEOS_SLV)) ? 1UL : 0UL);
07742 }
07743 
07744 /**
07745   * @brief  Get flag multimode ADC group injected context queue overflow of the ADC master.
07746   * @rmtoll CSR      JQOVF_MST      LL_ADC_IsActiveFlag_MST_JQOVF
07747   * @param  ADCxy_COMMON ADC common instance
07748   *         (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
07749   * @retval State of bit (1 or 0).
07750   */
07751 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_MST_JQOVF(ADC_Common_TypeDef *ADCxy_COMMON)
07752 {
07753   return ((READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_JQOVF_MST) == (LL_ADC_FLAG_JQOVF_MST)) ? 1UL : 0UL);
07754 }
07755 
07756 /**
07757   * @brief  Get flag multimode ADC group injected context queue overflow of the ADC slave.
07758   * @rmtoll CSR      JQOVF_SLV      LL_ADC_IsActiveFlag_SLV_JQOVF
07759   * @param  ADCxy_COMMON ADC common instance
07760   *         (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
07761   * @retval State of bit (1 or 0).
07762   */
07763 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_SLV_JQOVF(ADC_Common_TypeDef *ADCxy_COMMON)
07764 {
07765   return ((READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_JQOVF_SLV) == (LL_ADC_FLAG_JQOVF_SLV)) ? 1UL : 0UL);
07766 }
07767 
07768 /**
07769   * @brief  Get flag multimode ADC analog watchdog 1 of the ADC master.
07770   * @rmtoll CSR      AWD1_MST       LL_ADC_IsActiveFlag_MST_AWD1
07771   * @param  ADCxy_COMMON ADC common instance
07772   *         (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
07773   * @retval State of bit (1 or 0).
07774   */
07775 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_MST_AWD1(ADC_Common_TypeDef *ADCxy_COMMON)
07776 {
07777   return ((READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_AWD1_MST) == (LL_ADC_FLAG_AWD1_MST)) ? 1UL : 0UL);
07778 }
07779 
07780 /**
07781   * @brief  Get flag multimode analog watchdog 1 of the ADC slave.
07782   * @rmtoll CSR      AWD1_SLV       LL_ADC_IsActiveFlag_SLV_AWD1
07783   * @param  ADCxy_COMMON ADC common instance
07784   *         (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
07785   * @retval State of bit (1 or 0).
07786   */
07787 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_SLV_AWD1(ADC_Common_TypeDef *ADCxy_COMMON)
07788 {
07789   return ((READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_AWD1_SLV) == (LL_ADC_FLAG_AWD1_SLV)) ? 1UL : 0UL);
07790 }
07791 
07792 /**
07793   * @brief  Get flag multimode ADC analog watchdog 2 of the ADC master.
07794   * @rmtoll CSR      AWD2_MST       LL_ADC_IsActiveFlag_MST_AWD2
07795   * @param  ADCxy_COMMON ADC common instance
07796   *         (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
07797   * @retval State of bit (1 or 0).
07798   */
07799 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_MST_AWD2(ADC_Common_TypeDef *ADCxy_COMMON)
07800 {
07801   return ((READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_AWD2_MST) == (LL_ADC_FLAG_AWD2_MST)) ? 1UL : 0UL);
07802 }
07803 
07804 /**
07805   * @brief  Get flag multimode ADC analog watchdog 2 of the ADC slave.
07806   * @rmtoll CSR      AWD2_SLV       LL_ADC_IsActiveFlag_SLV_AWD2
07807   * @param  ADCxy_COMMON ADC common instance
07808   *         (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
07809   * @retval State of bit (1 or 0).
07810   */
07811 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_SLV_AWD2(ADC_Common_TypeDef *ADCxy_COMMON)
07812 {
07813   return ((READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_AWD2_SLV) == (LL_ADC_FLAG_AWD2_SLV)) ? 1UL : 0UL);
07814 }
07815 
07816 /**
07817   * @brief  Get flag multimode ADC analog watchdog 3 of the ADC master.
07818   * @rmtoll CSR      AWD3_MST       LL_ADC_IsActiveFlag_MST_AWD3
07819   * @param  ADCxy_COMMON ADC common instance
07820   *         (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
07821   * @retval State of bit (1 or 0).
07822   */
07823 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_MST_AWD3(ADC_Common_TypeDef *ADCxy_COMMON)
07824 {
07825   return ((READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_AWD3_MST) == (LL_ADC_FLAG_AWD3_MST)) ? 1UL : 0UL);
07826 }
07827 
07828 /**
07829   * @brief  Get flag multimode ADC analog watchdog 3 of the ADC slave.
07830   * @rmtoll CSR      AWD3_SLV       LL_ADC_IsActiveFlag_SLV_AWD3
07831   * @param  ADCxy_COMMON ADC common instance
07832   *         (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
07833   * @retval State of bit (1 or 0).
07834   */
07835 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_SLV_AWD3(ADC_Common_TypeDef *ADCxy_COMMON)
07836 {
07837   return ((READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_AWD3_SLV) == (LL_ADC_FLAG_AWD3_SLV)) ? 1UL : 0UL);
07838 }
07839 
07840 /**
07841   * @}
07842   */
07843 
07844 /** @defgroup ADC_LL_EF_IT_Management ADC IT management
07845   * @{
07846   */
07847 
07848 /**
07849   * @brief  Enable ADC ready.
07850   * @rmtoll IER      ADRDYIE        LL_ADC_EnableIT_ADRDY
07851   * @param  ADCx ADC instance
07852   * @retval None
07853   */
07854 __STATIC_INLINE void LL_ADC_EnableIT_ADRDY(ADC_TypeDef *ADCx)
07855 {
07856   SET_BIT(ADCx->IER, LL_ADC_IT_ADRDY);
07857 }
07858 
07859 /**
07860   * @brief  Enable interruption ADC group regular end of unitary conversion.
07861   * @rmtoll IER      EOCIE          LL_ADC_EnableIT_EOC
07862   * @param  ADCx ADC instance
07863   * @retval None
07864   */
07865 __STATIC_INLINE void LL_ADC_EnableIT_EOC(ADC_TypeDef *ADCx)
07866 {
07867   SET_BIT(ADCx->IER, LL_ADC_IT_EOC);
07868 }
07869 
07870 /**
07871   * @brief  Enable interruption ADC group regular end of sequence conversions.
07872   * @rmtoll IER      EOSIE          LL_ADC_EnableIT_EOS
07873   * @param  ADCx ADC instance
07874   * @retval None
07875   */
07876 __STATIC_INLINE void LL_ADC_EnableIT_EOS(ADC_TypeDef *ADCx)
07877 {
07878   SET_BIT(ADCx->IER, LL_ADC_IT_EOS);
07879 }
07880 
07881 /**
07882   * @brief  Enable ADC group regular interruption overrun.
07883   * @rmtoll IER      OVRIE          LL_ADC_EnableIT_OVR
07884   * @param  ADCx ADC instance
07885   * @retval None
07886   */
07887 __STATIC_INLINE void LL_ADC_EnableIT_OVR(ADC_TypeDef *ADCx)
07888 {
07889   SET_BIT(ADCx->IER, LL_ADC_IT_OVR);
07890 }
07891 
07892 /**
07893   * @brief  Enable interruption ADC group regular end of sampling.
07894   * @rmtoll IER      EOSMPIE        LL_ADC_EnableIT_EOSMP
07895   * @param  ADCx ADC instance
07896   * @retval None
07897   */
07898 __STATIC_INLINE void LL_ADC_EnableIT_EOSMP(ADC_TypeDef *ADCx)
07899 {
07900   SET_BIT(ADCx->IER, LL_ADC_IT_EOSMP);
07901 }
07902 
07903 /**
07904   * @brief  Enable interruption ADC group injected end of unitary conversion.
07905   * @rmtoll IER      JEOCIE         LL_ADC_EnableIT_JEOC
07906   * @param  ADCx ADC instance
07907   * @retval None
07908   */
07909 __STATIC_INLINE void LL_ADC_EnableIT_JEOC(ADC_TypeDef *ADCx)
07910 {
07911   SET_BIT(ADCx->IER, LL_ADC_IT_JEOC);
07912 }
07913 
07914 /**
07915   * @brief  Enable interruption ADC group injected end of sequence conversions.
07916   * @rmtoll IER      JEOSIE         LL_ADC_EnableIT_JEOS
07917   * @param  ADCx ADC instance
07918   * @retval None
07919   */
07920 __STATIC_INLINE void LL_ADC_EnableIT_JEOS(ADC_TypeDef *ADCx)
07921 {
07922   SET_BIT(ADCx->IER, LL_ADC_IT_JEOS);
07923 }
07924 
07925 /**
07926   * @brief  Enable interruption ADC group injected context queue overflow.
07927   * @rmtoll IER      JQOVFIE        LL_ADC_EnableIT_JQOVF
07928   * @param  ADCx ADC instance
07929   * @retval None
07930   */
07931 __STATIC_INLINE void LL_ADC_EnableIT_JQOVF(ADC_TypeDef *ADCx)
07932 {
07933   SET_BIT(ADCx->IER, LL_ADC_IT_JQOVF);
07934 }
07935 
07936 /**
07937   * @brief  Enable interruption ADC analog watchdog 1.
07938   * @rmtoll IER      AWD1IE         LL_ADC_EnableIT_AWD1
07939   * @param  ADCx ADC instance
07940   * @retval None
07941   */
07942 __STATIC_INLINE void LL_ADC_EnableIT_AWD1(ADC_TypeDef *ADCx)
07943 {
07944   SET_BIT(ADCx->IER, LL_ADC_IT_AWD1);
07945 }
07946 
07947 /**
07948   * @brief  Enable interruption ADC analog watchdog 2.
07949   * @rmtoll IER      AWD2IE         LL_ADC_EnableIT_AWD2
07950   * @param  ADCx ADC instance
07951   * @retval None
07952   */
07953 __STATIC_INLINE void LL_ADC_EnableIT_AWD2(ADC_TypeDef *ADCx)
07954 {
07955   SET_BIT(ADCx->IER, LL_ADC_IT_AWD2);
07956 }
07957 
07958 /**
07959   * @brief  Enable interruption ADC analog watchdog 3.
07960   * @rmtoll IER      AWD3IE         LL_ADC_EnableIT_AWD3
07961   * @param  ADCx ADC instance
07962   * @retval None
07963   */
07964 __STATIC_INLINE void LL_ADC_EnableIT_AWD3(ADC_TypeDef *ADCx)
07965 {
07966   SET_BIT(ADCx->IER, LL_ADC_IT_AWD3);
07967 }
07968 
07969 /**
07970   * @brief  Disable interruption ADC ready.
07971   * @rmtoll IER      ADRDYIE        LL_ADC_DisableIT_ADRDY
07972   * @param  ADCx ADC instance
07973   * @retval None
07974   */
07975 __STATIC_INLINE void LL_ADC_DisableIT_ADRDY(ADC_TypeDef *ADCx)
07976 {
07977   CLEAR_BIT(ADCx->IER, LL_ADC_IT_ADRDY);
07978 }
07979 
07980 /**
07981   * @brief  Disable interruption ADC group regular end of unitary conversion.
07982   * @rmtoll IER      EOCIE          LL_ADC_DisableIT_EOC
07983   * @param  ADCx ADC instance
07984   * @retval None
07985   */
07986 __STATIC_INLINE void LL_ADC_DisableIT_EOC(ADC_TypeDef *ADCx)
07987 {
07988   CLEAR_BIT(ADCx->IER, LL_ADC_IT_EOC);
07989 }
07990 
07991 /**
07992   * @brief  Disable interruption ADC group regular end of sequence conversions.
07993   * @rmtoll IER      EOSIE          LL_ADC_DisableIT_EOS
07994   * @param  ADCx ADC instance
07995   * @retval None
07996   */
07997 __STATIC_INLINE void LL_ADC_DisableIT_EOS(ADC_TypeDef *ADCx)
07998 {
07999   CLEAR_BIT(ADCx->IER, LL_ADC_IT_EOS);
08000 }
08001 
08002 /**
08003   * @brief  Disable interruption ADC group regular overrun.
08004   * @rmtoll IER      OVRIE          LL_ADC_DisableIT_OVR
08005   * @param  ADCx ADC instance
08006   * @retval None
08007   */
08008 __STATIC_INLINE void LL_ADC_DisableIT_OVR(ADC_TypeDef *ADCx)
08009 {
08010   CLEAR_BIT(ADCx->IER, LL_ADC_IT_OVR);
08011 }
08012 
08013 /**
08014   * @brief  Disable interruption ADC group regular end of sampling.
08015   * @rmtoll IER      EOSMPIE        LL_ADC_DisableIT_EOSMP
08016   * @param  ADCx ADC instance
08017   * @retval None
08018   */
08019 __STATIC_INLINE void LL_ADC_DisableIT_EOSMP(ADC_TypeDef *ADCx)
08020 {
08021   CLEAR_BIT(ADCx->IER, LL_ADC_IT_EOSMP);
08022 }
08023 
08024 /**
08025   * @brief  Disable interruption ADC group regular end of unitary conversion.
08026   * @rmtoll IER      JEOCIE         LL_ADC_DisableIT_JEOC
08027   * @param  ADCx ADC instance
08028   * @retval None
08029   */
08030 __STATIC_INLINE void LL_ADC_DisableIT_JEOC(ADC_TypeDef *ADCx)
08031 {
08032   CLEAR_BIT(ADCx->IER, LL_ADC_IT_JEOC);
08033 }
08034 
08035 /**
08036   * @brief  Disable interruption ADC group injected end of sequence conversions.
08037   * @rmtoll IER      JEOSIE         LL_ADC_DisableIT_JEOS
08038   * @param  ADCx ADC instance
08039   * @retval None
08040   */
08041 __STATIC_INLINE void LL_ADC_DisableIT_JEOS(ADC_TypeDef *ADCx)
08042 {
08043   CLEAR_BIT(ADCx->IER, LL_ADC_IT_JEOS);
08044 }
08045 
08046 /**
08047   * @brief  Disable interruption ADC group injected context queue overflow.
08048   * @rmtoll IER      JQOVFIE        LL_ADC_DisableIT_JQOVF
08049   * @param  ADCx ADC instance
08050   * @retval None
08051   */
08052 __STATIC_INLINE void LL_ADC_DisableIT_JQOVF(ADC_TypeDef *ADCx)
08053 {
08054   CLEAR_BIT(ADCx->IER, LL_ADC_IT_JQOVF);
08055 }
08056 
08057 /**
08058   * @brief  Disable interruption ADC analog watchdog 1.
08059   * @rmtoll IER      AWD1IE         LL_ADC_DisableIT_AWD1
08060   * @param  ADCx ADC instance
08061   * @retval None
08062   */
08063 __STATIC_INLINE void LL_ADC_DisableIT_AWD1(ADC_TypeDef *ADCx)
08064 {
08065   CLEAR_BIT(ADCx->IER, LL_ADC_IT_AWD1);
08066 }
08067 
08068 /**
08069   * @brief  Disable interruption ADC analog watchdog 2.
08070   * @rmtoll IER      AWD2IE         LL_ADC_DisableIT_AWD2
08071   * @param  ADCx ADC instance
08072   * @retval None
08073   */
08074 __STATIC_INLINE void LL_ADC_DisableIT_AWD2(ADC_TypeDef *ADCx)
08075 {
08076   CLEAR_BIT(ADCx->IER, LL_ADC_IT_AWD2);
08077 }
08078 
08079 /**
08080   * @brief  Disable interruption ADC analog watchdog 3.
08081   * @rmtoll IER      AWD3IE         LL_ADC_DisableIT_AWD3
08082   * @param  ADCx ADC instance
08083   * @retval None
08084   */
08085 __STATIC_INLINE void LL_ADC_DisableIT_AWD3(ADC_TypeDef *ADCx)
08086 {
08087   CLEAR_BIT(ADCx->IER, LL_ADC_IT_AWD3);
08088 }
08089 
08090 /**
08091   * @brief  Get state of interruption ADC ready
08092   *         (0: interrupt disabled, 1: interrupt enabled).
08093   * @rmtoll IER      ADRDYIE        LL_ADC_IsEnabledIT_ADRDY
08094   * @param  ADCx ADC instance
08095   * @retval State of bit (1 or 0).
08096   */
08097 __STATIC_INLINE uint32_t LL_ADC_IsEnabledIT_ADRDY(ADC_TypeDef *ADCx)
08098 {
08099   return ((READ_BIT(ADCx->IER, LL_ADC_IT_ADRDY) == (LL_ADC_IT_ADRDY)) ? 1UL : 0UL);
08100 }
08101 
08102 /**
08103   * @brief  Get state of interruption ADC group regular end of unitary conversion
08104   *         (0: interrupt disabled, 1: interrupt enabled).
08105   * @rmtoll IER      EOCIE          LL_ADC_IsEnabledIT_EOC
08106   * @param  ADCx ADC instance
08107   * @retval State of bit (1 or 0).
08108   */
08109 __STATIC_INLINE uint32_t LL_ADC_IsEnabledIT_EOC(ADC_TypeDef *ADCx)
08110 {
08111   return ((READ_BIT(ADCx->IER, LL_ADC_IT_EOC) == (LL_ADC_IT_EOC)) ? 1UL : 0UL);
08112 }
08113 
08114 /**
08115   * @brief  Get state of interruption ADC group regular end of sequence conversions
08116   *         (0: interrupt disabled, 1: interrupt enabled).
08117   * @rmtoll IER      EOSIE          LL_ADC_IsEnabledIT_EOS
08118   * @param  ADCx ADC instance
08119   * @retval State of bit (1 or 0).
08120   */
08121 __STATIC_INLINE uint32_t LL_ADC_IsEnabledIT_EOS(ADC_TypeDef *ADCx)
08122 {
08123   return ((READ_BIT(ADCx->IER, LL_ADC_IT_EOS) == (LL_ADC_IT_EOS)) ? 1UL : 0UL);
08124 }
08125 
08126 /**
08127   * @brief  Get state of interruption ADC group regular overrun
08128   *         (0: interrupt disabled, 1: interrupt enabled).
08129   * @rmtoll IER      OVRIE          LL_ADC_IsEnabledIT_OVR
08130   * @param  ADCx ADC instance
08131   * @retval State of bit (1 or 0).
08132   */
08133 __STATIC_INLINE uint32_t LL_ADC_IsEnabledIT_OVR(ADC_TypeDef *ADCx)
08134 {
08135   return ((READ_BIT(ADCx->IER, LL_ADC_IT_OVR) == (LL_ADC_IT_OVR)) ? 1UL : 0UL);
08136 }
08137 
08138 /**
08139   * @brief  Get state of interruption ADC group regular end of sampling
08140   *         (0: interrupt disabled, 1: interrupt enabled).
08141   * @rmtoll IER      EOSMPIE        LL_ADC_IsEnabledIT_EOSMP
08142   * @param  ADCx ADC instance
08143   * @retval State of bit (1 or 0).
08144   */
08145 __STATIC_INLINE uint32_t LL_ADC_IsEnabledIT_EOSMP(ADC_TypeDef *ADCx)
08146 {
08147   return ((READ_BIT(ADCx->IER, LL_ADC_IT_EOSMP) == (LL_ADC_IT_EOSMP)) ? 1UL : 0UL);
08148 }
08149 
08150 /**
08151   * @brief  Get state of interruption ADC group injected end of unitary conversion
08152   *         (0: interrupt disabled, 1: interrupt enabled).
08153   * @rmtoll IER      JEOCIE         LL_ADC_IsEnabledIT_JEOC
08154   * @param  ADCx ADC instance
08155   * @retval State of bit (1 or 0).
08156   */
08157 __STATIC_INLINE uint32_t LL_ADC_IsEnabledIT_JEOC(ADC_TypeDef *ADCx)
08158 {
08159   return ((READ_BIT(ADCx->IER, LL_ADC_IT_JEOC) == (LL_ADC_IT_JEOC)) ? 1UL : 0UL);
08160 }
08161 
08162 /**
08163   * @brief  Get state of interruption ADC group injected end of sequence conversions
08164   *         (0: interrupt disabled, 1: interrupt enabled).
08165   * @rmtoll IER      JEOSIE         LL_ADC_IsEnabledIT_JEOS
08166   * @param  ADCx ADC instance
08167   * @retval State of bit (1 or 0).
08168   */
08169 __STATIC_INLINE uint32_t LL_ADC_IsEnabledIT_JEOS(ADC_TypeDef *ADCx)
08170 {
08171   return ((READ_BIT(ADCx->IER, LL_ADC_IT_JEOS) == (LL_ADC_IT_JEOS)) ? 1UL : 0UL);
08172 }
08173 
08174 /**
08175   * @brief  Get state of interruption ADC group injected context queue overflow interrupt state
08176   *         (0: interrupt disabled, 1: interrupt enabled).
08177   * @rmtoll IER      JQOVFIE        LL_ADC_IsEnabledIT_JQOVF
08178   * @param  ADCx ADC instance
08179   * @retval State of bit (1 or 0).
08180   */
08181 __STATIC_INLINE uint32_t LL_ADC_IsEnabledIT_JQOVF(ADC_TypeDef *ADCx)
08182 {
08183   return ((READ_BIT(ADCx->IER, LL_ADC_IT_JQOVF) == (LL_ADC_IT_JQOVF)) ? 1UL : 0UL);
08184 }
08185 
08186 /**
08187   * @brief  Get state of interruption ADC analog watchdog 1
08188   *         (0: interrupt disabled, 1: interrupt enabled).
08189   * @rmtoll IER      AWD1IE         LL_ADC_IsEnabledIT_AWD1
08190   * @param  ADCx ADC instance
08191   * @retval State of bit (1 or 0).
08192   */
08193 __STATIC_INLINE uint32_t LL_ADC_IsEnabledIT_AWD1(ADC_TypeDef *ADCx)
08194 {
08195   return ((READ_BIT(ADCx->IER, LL_ADC_IT_AWD1) == (LL_ADC_IT_AWD1)) ? 1UL : 0UL);
08196 }
08197 
08198 /**
08199   * @brief  Get state of interruption Get ADC analog watchdog 2
08200   *         (0: interrupt disabled, 1: interrupt enabled).
08201   * @rmtoll IER      AWD2IE         LL_ADC_IsEnabledIT_AWD2
08202   * @param  ADCx ADC instance
08203   * @retval State of bit (1 or 0).
08204   */
08205 __STATIC_INLINE uint32_t LL_ADC_IsEnabledIT_AWD2(ADC_TypeDef *ADCx)
08206 {
08207   return ((READ_BIT(ADCx->IER, LL_ADC_IT_AWD2) == (LL_ADC_IT_AWD2)) ? 1UL : 0UL);
08208 }
08209 
08210 /**
08211   * @brief  Get state of interruption Get ADC analog watchdog 3
08212   *         (0: interrupt disabled, 1: interrupt enabled).
08213   * @rmtoll IER      AWD3IE         LL_ADC_IsEnabledIT_AWD3
08214   * @param  ADCx ADC instance
08215   * @retval State of bit (1 or 0).
08216   */
08217 __STATIC_INLINE uint32_t LL_ADC_IsEnabledIT_AWD3(ADC_TypeDef *ADCx)
08218 {
08219   return ((READ_BIT(ADCx->IER, LL_ADC_IT_AWD3) == (LL_ADC_IT_AWD3)) ? 1UL : 0UL);
08220 }
08221 
08222 /**
08223   * @}
08224   */
08225 
08226 #if defined(USE_FULL_LL_DRIVER)
08227 /** @defgroup ADC_LL_EF_Init Initialization and de-initialization functions
08228   * @{
08229   */
08230 
08231 /* Initialization of some features of ADC common parameters and multimode */
08232 ErrorStatus LL_ADC_CommonDeInit(ADC_Common_TypeDef *ADCxy_COMMON);
08233 ErrorStatus LL_ADC_CommonInit(ADC_Common_TypeDef *ADCxy_COMMON, LL_ADC_CommonInitTypeDef *ADC_CommonInitStruct);
08234 void        LL_ADC_CommonStructInit(LL_ADC_CommonInitTypeDef *ADC_CommonInitStruct);
08235 
08236 /* De-initialization of ADC instance, ADC group regular and ADC group injected */
08237 /* (availability of ADC group injected depends on STM32 families) */
08238 ErrorStatus LL_ADC_DeInit(ADC_TypeDef *ADCx);
08239 
08240 /* Initialization of some features of ADC instance */
08241 ErrorStatus LL_ADC_Init(ADC_TypeDef *ADCx, LL_ADC_InitTypeDef *ADC_InitStruct);
08242 void        LL_ADC_StructInit(LL_ADC_InitTypeDef *ADC_InitStruct);
08243 
08244 /* Initialization of some features of ADC instance and ADC group regular */
08245 ErrorStatus LL_ADC_REG_Init(ADC_TypeDef *ADCx, LL_ADC_REG_InitTypeDef *ADC_REG_InitStruct);
08246 void        LL_ADC_REG_StructInit(LL_ADC_REG_InitTypeDef *ADC_REG_InitStruct);
08247 
08248 /* Initialization of some features of ADC instance and ADC group injected */
08249 ErrorStatus LL_ADC_INJ_Init(ADC_TypeDef *ADCx, LL_ADC_INJ_InitTypeDef *ADC_INJ_InitStruct);
08250 void        LL_ADC_INJ_StructInit(LL_ADC_INJ_InitTypeDef *ADC_INJ_InitStruct);
08251 
08252 /**
08253   * @}
08254   */
08255 #endif /* USE_FULL_LL_DRIVER */
08256 
08257 /**
08258   * @}
08259   */
08260 
08261 /**
08262   * @}
08263   */
08264 
08265 #endif /* ADC1 || ADC2 || ADC3 */
08266 
08267 /**
08268   * @}
08269   */
08270 
08271 #ifdef __cplusplus
08272 }
08273 #endif
08274 
08275 #endif /* STM32H7xx_LL_ADC_H */
08276