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