001

Committer:
ganlikun
Date:
Sun Jun 12 14:02:44 2022 +0000
Revision:
0:13413ea9a877
00

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ganlikun 0:13413ea9a877 1 /**
ganlikun 0:13413ea9a877 2 ******************************************************************************
ganlikun 0:13413ea9a877 3 * @file stm32f4xx_ll_adc.h
ganlikun 0:13413ea9a877 4 * @author MCD Application Team
ganlikun 0:13413ea9a877 5 * @version V1.7.1
ganlikun 0:13413ea9a877 6 * @date 14-April-2017
ganlikun 0:13413ea9a877 7 * @brief Header file of ADC LL module.
ganlikun 0:13413ea9a877 8 ******************************************************************************
ganlikun 0:13413ea9a877 9 * @attention
ganlikun 0:13413ea9a877 10 *
ganlikun 0:13413ea9a877 11 * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
ganlikun 0:13413ea9a877 12 *
ganlikun 0:13413ea9a877 13 * Redistribution and use in source and binary forms, with or without modification,
ganlikun 0:13413ea9a877 14 * are permitted provided that the following conditions are met:
ganlikun 0:13413ea9a877 15 * 1. Redistributions of source code must retain the above copyright notice,
ganlikun 0:13413ea9a877 16 * this list of conditions and the following disclaimer.
ganlikun 0:13413ea9a877 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
ganlikun 0:13413ea9a877 18 * this list of conditions and the following disclaimer in the documentation
ganlikun 0:13413ea9a877 19 * and/or other materials provided with the distribution.
ganlikun 0:13413ea9a877 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
ganlikun 0:13413ea9a877 21 * may be used to endorse or promote products derived from this software
ganlikun 0:13413ea9a877 22 * without specific prior written permission.
ganlikun 0:13413ea9a877 23 *
ganlikun 0:13413ea9a877 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
ganlikun 0:13413ea9a877 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
ganlikun 0:13413ea9a877 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
ganlikun 0:13413ea9a877 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
ganlikun 0:13413ea9a877 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
ganlikun 0:13413ea9a877 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
ganlikun 0:13413ea9a877 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
ganlikun 0:13413ea9a877 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
ganlikun 0:13413ea9a877 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
ganlikun 0:13413ea9a877 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
ganlikun 0:13413ea9a877 34 *
ganlikun 0:13413ea9a877 35 ******************************************************************************
ganlikun 0:13413ea9a877 36 */
ganlikun 0:13413ea9a877 37
ganlikun 0:13413ea9a877 38 /* Define to prevent recursive inclusion -------------------------------------*/
ganlikun 0:13413ea9a877 39 #ifndef __STM32F4xx_LL_ADC_H
ganlikun 0:13413ea9a877 40 #define __STM32F4xx_LL_ADC_H
ganlikun 0:13413ea9a877 41
ganlikun 0:13413ea9a877 42 #ifdef __cplusplus
ganlikun 0:13413ea9a877 43 extern "C" {
ganlikun 0:13413ea9a877 44 #endif
ganlikun 0:13413ea9a877 45
ganlikun 0:13413ea9a877 46 /* Includes ------------------------------------------------------------------*/
ganlikun 0:13413ea9a877 47 #include "stm32f4xx.h"
ganlikun 0:13413ea9a877 48
ganlikun 0:13413ea9a877 49 /** @addtogroup STM32F4xx_LL_Driver
ganlikun 0:13413ea9a877 50 * @{
ganlikun 0:13413ea9a877 51 */
ganlikun 0:13413ea9a877 52
ganlikun 0:13413ea9a877 53 #if defined (ADC1) || defined (ADC2) || defined (ADC3)
ganlikun 0:13413ea9a877 54
ganlikun 0:13413ea9a877 55 /** @defgroup ADC_LL ADC
ganlikun 0:13413ea9a877 56 * @{
ganlikun 0:13413ea9a877 57 */
ganlikun 0:13413ea9a877 58
ganlikun 0:13413ea9a877 59 /* Private types -------------------------------------------------------------*/
ganlikun 0:13413ea9a877 60 /* Private variables ---------------------------------------------------------*/
ganlikun 0:13413ea9a877 61
ganlikun 0:13413ea9a877 62 /* Private constants ---------------------------------------------------------*/
ganlikun 0:13413ea9a877 63 /** @defgroup ADC_LL_Private_Constants ADC Private Constants
ganlikun 0:13413ea9a877 64 * @{
ganlikun 0:13413ea9a877 65 */
ganlikun 0:13413ea9a877 66
ganlikun 0:13413ea9a877 67 /* Internal mask for ADC group regular sequencer: */
ganlikun 0:13413ea9a877 68 /* To select into literal LL_ADC_REG_RANK_x the relevant bits for: */
ganlikun 0:13413ea9a877 69 /* - sequencer register offset */
ganlikun 0:13413ea9a877 70 /* - sequencer rank bits position into the selected register */
ganlikun 0:13413ea9a877 71
ganlikun 0:13413ea9a877 72 /* Internal register offset for ADC group regular sequencer configuration */
ganlikun 0:13413ea9a877 73 /* (offset placed into a spare area of literal definition) */
ganlikun 0:13413ea9a877 74 #define ADC_SQR1_REGOFFSET 0x00000000U
ganlikun 0:13413ea9a877 75 #define ADC_SQR2_REGOFFSET 0x00000100U
ganlikun 0:13413ea9a877 76 #define ADC_SQR3_REGOFFSET 0x00000200U
ganlikun 0:13413ea9a877 77 #define ADC_SQR4_REGOFFSET 0x00000300U
ganlikun 0:13413ea9a877 78
ganlikun 0:13413ea9a877 79 #define ADC_REG_SQRX_REGOFFSET_MASK (ADC_SQR1_REGOFFSET | ADC_SQR2_REGOFFSET | ADC_SQR3_REGOFFSET | ADC_SQR4_REGOFFSET)
ganlikun 0:13413ea9a877 80 #define ADC_REG_RANK_ID_SQRX_MASK (ADC_CHANNEL_ID_NUMBER_MASK_POSBIT0)
ganlikun 0:13413ea9a877 81
ganlikun 0:13413ea9a877 82 /* Definition of ADC group regular sequencer bits information to be inserted */
ganlikun 0:13413ea9a877 83 /* into ADC group regular sequencer ranks literals definition. */
ganlikun 0:13413ea9a877 84 #define ADC_REG_RANK_1_SQRX_BITOFFSET_POS ( 0U) /* Value equivalent to POSITION_VAL(ADC_SQR3_SQ1) */
ganlikun 0:13413ea9a877 85 #define ADC_REG_RANK_2_SQRX_BITOFFSET_POS ( 5U) /* Value equivalent to POSITION_VAL(ADC_SQR3_SQ2) */
ganlikun 0:13413ea9a877 86 #define ADC_REG_RANK_3_SQRX_BITOFFSET_POS (10U) /* Value equivalent to POSITION_VAL(ADC_SQR3_SQ3) */
ganlikun 0:13413ea9a877 87 #define ADC_REG_RANK_4_SQRX_BITOFFSET_POS (15U) /* Value equivalent to POSITION_VAL(ADC_SQR3_SQ4) */
ganlikun 0:13413ea9a877 88 #define ADC_REG_RANK_5_SQRX_BITOFFSET_POS (20U) /* Value equivalent to POSITION_VAL(ADC_SQR3_SQ5) */
ganlikun 0:13413ea9a877 89 #define ADC_REG_RANK_6_SQRX_BITOFFSET_POS (25U) /* Value equivalent to POSITION_VAL(ADC_SQR3_SQ6) */
ganlikun 0:13413ea9a877 90 #define ADC_REG_RANK_7_SQRX_BITOFFSET_POS ( 0U) /* Value equivalent to POSITION_VAL(ADC_SQR2_SQ7) */
ganlikun 0:13413ea9a877 91 #define ADC_REG_RANK_8_SQRX_BITOFFSET_POS ( 5U) /* Value equivalent to POSITION_VAL(ADC_SQR2_SQ8) */
ganlikun 0:13413ea9a877 92 #define ADC_REG_RANK_9_SQRX_BITOFFSET_POS (10U) /* Value equivalent to POSITION_VAL(ADC_SQR2_SQ9) */
ganlikun 0:13413ea9a877 93 #define ADC_REG_RANK_10_SQRX_BITOFFSET_POS (15U) /* Value equivalent to POSITION_VAL(ADC_SQR2_SQ10) */
ganlikun 0:13413ea9a877 94 #define ADC_REG_RANK_11_SQRX_BITOFFSET_POS (20U) /* Value equivalent to POSITION_VAL(ADC_SQR2_SQ11) */
ganlikun 0:13413ea9a877 95 #define ADC_REG_RANK_12_SQRX_BITOFFSET_POS (25U) /* Value equivalent to POSITION_VAL(ADC_SQR2_SQ12) */
ganlikun 0:13413ea9a877 96 #define ADC_REG_RANK_13_SQRX_BITOFFSET_POS ( 0U) /* Value equivalent to POSITION_VAL(ADC_SQR1_SQ13) */
ganlikun 0:13413ea9a877 97 #define ADC_REG_RANK_14_SQRX_BITOFFSET_POS ( 5U) /* Value equivalent to POSITION_VAL(ADC_SQR1_SQ14) */
ganlikun 0:13413ea9a877 98 #define ADC_REG_RANK_15_SQRX_BITOFFSET_POS (10U) /* Value equivalent to POSITION_VAL(ADC_SQR1_SQ15) */
ganlikun 0:13413ea9a877 99 #define ADC_REG_RANK_16_SQRX_BITOFFSET_POS (15U) /* Value equivalent to POSITION_VAL(ADC_SQR1_SQ16) */
ganlikun 0:13413ea9a877 100
ganlikun 0:13413ea9a877 101 /* Internal mask for ADC group injected sequencer: */
ganlikun 0:13413ea9a877 102 /* To select into literal LL_ADC_INJ_RANK_x the relevant bits for: */
ganlikun 0:13413ea9a877 103 /* - data register offset */
ganlikun 0:13413ea9a877 104 /* - offset register offset */
ganlikun 0:13413ea9a877 105 /* - sequencer rank bits position into the selected register */
ganlikun 0:13413ea9a877 106
ganlikun 0:13413ea9a877 107 /* Internal register offset for ADC group injected data register */
ganlikun 0:13413ea9a877 108 /* (offset placed into a spare area of literal definition) */
ganlikun 0:13413ea9a877 109 #define ADC_JDR1_REGOFFSET 0x00000000U
ganlikun 0:13413ea9a877 110 #define ADC_JDR2_REGOFFSET 0x00000100U
ganlikun 0:13413ea9a877 111 #define ADC_JDR3_REGOFFSET 0x00000200U
ganlikun 0:13413ea9a877 112 #define ADC_JDR4_REGOFFSET 0x00000300U
ganlikun 0:13413ea9a877 113
ganlikun 0:13413ea9a877 114 /* Internal register offset for ADC group injected offset configuration */
ganlikun 0:13413ea9a877 115 /* (offset placed into a spare area of literal definition) */
ganlikun 0:13413ea9a877 116 #define ADC_JOFR1_REGOFFSET 0x00000000U
ganlikun 0:13413ea9a877 117 #define ADC_JOFR2_REGOFFSET 0x00001000U
ganlikun 0:13413ea9a877 118 #define ADC_JOFR3_REGOFFSET 0x00002000U
ganlikun 0:13413ea9a877 119 #define ADC_JOFR4_REGOFFSET 0x00003000U
ganlikun 0:13413ea9a877 120
ganlikun 0:13413ea9a877 121 #define ADC_INJ_JDRX_REGOFFSET_MASK (ADC_JDR1_REGOFFSET | ADC_JDR2_REGOFFSET | ADC_JDR3_REGOFFSET | ADC_JDR4_REGOFFSET)
ganlikun 0:13413ea9a877 122 #define ADC_INJ_JOFRX_REGOFFSET_MASK (ADC_JOFR1_REGOFFSET | ADC_JOFR2_REGOFFSET | ADC_JOFR3_REGOFFSET | ADC_JOFR4_REGOFFSET)
ganlikun 0:13413ea9a877 123 #define ADC_INJ_RANK_ID_JSQR_MASK (ADC_CHANNEL_ID_NUMBER_MASK_POSBIT0)
ganlikun 0:13413ea9a877 124
ganlikun 0:13413ea9a877 125 /* Internal mask for ADC group regular trigger: */
ganlikun 0:13413ea9a877 126 /* To select into literal LL_ADC_REG_TRIG_x the relevant bits for: */
ganlikun 0:13413ea9a877 127 /* - regular trigger source */
ganlikun 0:13413ea9a877 128 /* - regular trigger edge */
ganlikun 0:13413ea9a877 129 #define ADC_REG_TRIG_EXT_EDGE_DEFAULT (ADC_CR2_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) */
ganlikun 0:13413ea9a877 130
ganlikun 0:13413ea9a877 131 /* Mask containing trigger source masks for each of possible */
ganlikun 0:13413ea9a877 132 /* trigger edge selection duplicated with shifts [0; 4; 8; 12] */
ganlikun 0:13413ea9a877 133 /* corresponding to {SW start; ext trigger; ext trigger; ext trigger}. */
ganlikun 0:13413ea9a877 134 #define ADC_REG_TRIG_SOURCE_MASK (((LL_ADC_REG_TRIG_SOFTWARE & ADC_CR2_EXTSEL) >> (4U * 0U)) | \
ganlikun 0:13413ea9a877 135 ((ADC_CR2_EXTSEL) >> (4U * 1U)) | \
ganlikun 0:13413ea9a877 136 ((ADC_CR2_EXTSEL) >> (4U * 2U)) | \
ganlikun 0:13413ea9a877 137 ((ADC_CR2_EXTSEL) >> (4U * 3U)))
ganlikun 0:13413ea9a877 138
ganlikun 0:13413ea9a877 139 /* Mask containing trigger edge masks for each of possible */
ganlikun 0:13413ea9a877 140 /* trigger edge selection duplicated with shifts [0; 4; 8; 12] */
ganlikun 0:13413ea9a877 141 /* corresponding to {SW start; ext trigger; ext trigger; ext trigger}. */
ganlikun 0:13413ea9a877 142 #define ADC_REG_TRIG_EDGE_MASK (((LL_ADC_REG_TRIG_SOFTWARE & ADC_CR2_EXTEN) >> (4U * 0U)) | \
ganlikun 0:13413ea9a877 143 ((ADC_REG_TRIG_EXT_EDGE_DEFAULT) >> (4U * 1U)) | \
ganlikun 0:13413ea9a877 144 ((ADC_REG_TRIG_EXT_EDGE_DEFAULT) >> (4U * 2U)) | \
ganlikun 0:13413ea9a877 145 ((ADC_REG_TRIG_EXT_EDGE_DEFAULT) >> (4U * 3U)))
ganlikun 0:13413ea9a877 146
ganlikun 0:13413ea9a877 147 /* Definition of ADC group regular trigger bits information. */
ganlikun 0:13413ea9a877 148 #define ADC_REG_TRIG_EXTSEL_BITOFFSET_POS (24U) /* Value equivalent to POSITION_VAL(ADC_CR2_EXTSEL) */
ganlikun 0:13413ea9a877 149 #define ADC_REG_TRIG_EXTEN_BITOFFSET_POS (28U) /* Value equivalent to POSITION_VAL(ADC_CR2_EXTEN) */
ganlikun 0:13413ea9a877 150
ganlikun 0:13413ea9a877 151
ganlikun 0:13413ea9a877 152
ganlikun 0:13413ea9a877 153 /* Internal mask for ADC group injected trigger: */
ganlikun 0:13413ea9a877 154 /* To select into literal LL_ADC_INJ_TRIG_x the relevant bits for: */
ganlikun 0:13413ea9a877 155 /* - injected trigger source */
ganlikun 0:13413ea9a877 156 /* - injected trigger edge */
ganlikun 0:13413ea9a877 157 #define ADC_INJ_TRIG_EXT_EDGE_DEFAULT (ADC_CR2_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) */
ganlikun 0:13413ea9a877 158
ganlikun 0:13413ea9a877 159 /* Mask containing trigger source masks for each of possible */
ganlikun 0:13413ea9a877 160 /* trigger edge selection duplicated with shifts [0; 4; 8; 12] */
ganlikun 0:13413ea9a877 161 /* corresponding to {SW start; ext trigger; ext trigger; ext trigger}. */
ganlikun 0:13413ea9a877 162 #define ADC_INJ_TRIG_SOURCE_MASK (((LL_ADC_REG_TRIG_SOFTWARE & ADC_CR2_JEXTSEL) >> (4U * 0U)) | \
ganlikun 0:13413ea9a877 163 ((ADC_CR2_JEXTSEL) >> (4U * 1U)) | \
ganlikun 0:13413ea9a877 164 ((ADC_CR2_JEXTSEL) >> (4U * 2U)) | \
ganlikun 0:13413ea9a877 165 ((ADC_CR2_JEXTSEL) >> (4U * 3U)))
ganlikun 0:13413ea9a877 166
ganlikun 0:13413ea9a877 167 /* Mask containing trigger edge masks for each of possible */
ganlikun 0:13413ea9a877 168 /* trigger edge selection duplicated with shifts [0; 4; 8; 12] */
ganlikun 0:13413ea9a877 169 /* corresponding to {SW start; ext trigger; ext trigger; ext trigger}. */
ganlikun 0:13413ea9a877 170 #define ADC_INJ_TRIG_EDGE_MASK (((LL_ADC_INJ_TRIG_SOFTWARE & ADC_CR2_JEXTEN) >> (4U * 0U)) | \
ganlikun 0:13413ea9a877 171 ((ADC_INJ_TRIG_EXT_EDGE_DEFAULT) >> (4U * 1U)) | \
ganlikun 0:13413ea9a877 172 ((ADC_INJ_TRIG_EXT_EDGE_DEFAULT) >> (4U * 2U)) | \
ganlikun 0:13413ea9a877 173 ((ADC_INJ_TRIG_EXT_EDGE_DEFAULT) >> (4U * 3U)))
ganlikun 0:13413ea9a877 174
ganlikun 0:13413ea9a877 175 /* Definition of ADC group injected trigger bits information. */
ganlikun 0:13413ea9a877 176 #define ADC_INJ_TRIG_EXTSEL_BITOFFSET_POS (16U) /* Value equivalent to POSITION_VAL(ADC_CR2_JEXTSEL) */
ganlikun 0:13413ea9a877 177 #define ADC_INJ_TRIG_EXTEN_BITOFFSET_POS (20U) /* Value equivalent to POSITION_VAL(ADC_CR2_JEXTEN) */
ganlikun 0:13413ea9a877 178
ganlikun 0:13413ea9a877 179 /* Internal mask for ADC channel: */
ganlikun 0:13413ea9a877 180 /* To select into literal LL_ADC_CHANNEL_x the relevant bits for: */
ganlikun 0:13413ea9a877 181 /* - channel identifier defined by number */
ganlikun 0:13413ea9a877 182 /* - channel differentiation between external channels (connected to */
ganlikun 0:13413ea9a877 183 /* GPIO pins) and internal channels (connected to internal paths) */
ganlikun 0:13413ea9a877 184 /* - channel sampling time defined by SMPRx register offset */
ganlikun 0:13413ea9a877 185 /* and SMPx bits positions into SMPRx register */
ganlikun 0:13413ea9a877 186 #define ADC_CHANNEL_ID_NUMBER_MASK (ADC_CR1_AWDCH)
ganlikun 0:13413ea9a877 187 #define ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS ( 0U)/* Value equivalent to POSITION_VAL(ADC_CHANNEL_ID_NUMBER_MASK) */
ganlikun 0:13413ea9a877 188 #define ADC_CHANNEL_ID_MASK (ADC_CHANNEL_ID_NUMBER_MASK | ADC_CHANNEL_ID_INTERNAL_CH_MASK)
ganlikun 0:13413ea9a877 189 /* Equivalent mask of ADC_CHANNEL_NUMBER_MASK aligned on register LSB (bit 0) */
ganlikun 0:13413ea9a877 190 #define ADC_CHANNEL_ID_NUMBER_MASK_POSBIT0 0x0000001FU /* Equivalent to shift: (ADC_CHANNEL_NUMBER_MASK >> POSITION_VAL(ADC_CHANNEL_NUMBER_MASK)) */
ganlikun 0:13413ea9a877 191
ganlikun 0:13413ea9a877 192 /* Channel differentiation between external and internal channels */
ganlikun 0:13413ea9a877 193 #define ADC_CHANNEL_ID_INTERNAL_CH 0x80000000U /* Marker of internal channel */
ganlikun 0:13413ea9a877 194 #define ADC_CHANNEL_ID_INTERNAL_CH_2 0x40000000U /* Marker of internal channel for other ADC instances, in case of different ADC internal channels mapped on same channel number on different ADC instances */
ganlikun 0:13413ea9a877 195 #define ADC_CHANNEL_DIFFERENCIATION_TEMPSENSOR_VBAT 0x10000000U /* Dummy bit for driver internal usage, not used in ADC channel setting registers CR1 or SQRx */
ganlikun 0:13413ea9a877 196 #define ADC_CHANNEL_ID_INTERNAL_CH_MASK (ADC_CHANNEL_ID_INTERNAL_CH | ADC_CHANNEL_ID_INTERNAL_CH_2 | ADC_CHANNEL_DIFFERENCIATION_TEMPSENSOR_VBAT)
ganlikun 0:13413ea9a877 197
ganlikun 0:13413ea9a877 198 /* Internal register offset for ADC channel sampling time configuration */
ganlikun 0:13413ea9a877 199 /* (offset placed into a spare area of literal definition) */
ganlikun 0:13413ea9a877 200 #define ADC_SMPR1_REGOFFSET 0x00000000U
ganlikun 0:13413ea9a877 201 #define ADC_SMPR2_REGOFFSET 0x02000000U
ganlikun 0:13413ea9a877 202 #define ADC_CHANNEL_SMPRX_REGOFFSET_MASK (ADC_SMPR1_REGOFFSET | ADC_SMPR2_REGOFFSET)
ganlikun 0:13413ea9a877 203
ganlikun 0:13413ea9a877 204 #define ADC_CHANNEL_SMPx_BITOFFSET_MASK 0x01F00000U
ganlikun 0:13413ea9a877 205 #define ADC_CHANNEL_SMPx_BITOFFSET_POS (20U) /* Value equivalent to POSITION_VAL(ADC_CHANNEL_SMPx_BITOFFSET_MASK) */
ganlikun 0:13413ea9a877 206
ganlikun 0:13413ea9a877 207 /* Definition of channels ID number information to be inserted into */
ganlikun 0:13413ea9a877 208 /* channels literals definition. */
ganlikun 0:13413ea9a877 209 #define ADC_CHANNEL_0_NUMBER 0x00000000U
ganlikun 0:13413ea9a877 210 #define ADC_CHANNEL_1_NUMBER ( ADC_CR1_AWDCH_0)
ganlikun 0:13413ea9a877 211 #define ADC_CHANNEL_2_NUMBER ( ADC_CR1_AWDCH_1 )
ganlikun 0:13413ea9a877 212 #define ADC_CHANNEL_3_NUMBER ( ADC_CR1_AWDCH_1 | ADC_CR1_AWDCH_0)
ganlikun 0:13413ea9a877 213 #define ADC_CHANNEL_4_NUMBER ( ADC_CR1_AWDCH_2 )
ganlikun 0:13413ea9a877 214 #define ADC_CHANNEL_5_NUMBER ( ADC_CR1_AWDCH_2 | ADC_CR1_AWDCH_0)
ganlikun 0:13413ea9a877 215 #define ADC_CHANNEL_6_NUMBER ( ADC_CR1_AWDCH_2 | ADC_CR1_AWDCH_1 )
ganlikun 0:13413ea9a877 216 #define ADC_CHANNEL_7_NUMBER ( ADC_CR1_AWDCH_2 | ADC_CR1_AWDCH_1 | ADC_CR1_AWDCH_0)
ganlikun 0:13413ea9a877 217 #define ADC_CHANNEL_8_NUMBER ( ADC_CR1_AWDCH_3 )
ganlikun 0:13413ea9a877 218 #define ADC_CHANNEL_9_NUMBER ( ADC_CR1_AWDCH_3 | ADC_CR1_AWDCH_0)
ganlikun 0:13413ea9a877 219 #define ADC_CHANNEL_10_NUMBER ( ADC_CR1_AWDCH_3 | ADC_CR1_AWDCH_1 )
ganlikun 0:13413ea9a877 220 #define ADC_CHANNEL_11_NUMBER ( ADC_CR1_AWDCH_3 | ADC_CR1_AWDCH_1 | ADC_CR1_AWDCH_0)
ganlikun 0:13413ea9a877 221 #define ADC_CHANNEL_12_NUMBER ( ADC_CR1_AWDCH_3 | ADC_CR1_AWDCH_2 )
ganlikun 0:13413ea9a877 222 #define ADC_CHANNEL_13_NUMBER ( ADC_CR1_AWDCH_3 | ADC_CR1_AWDCH_2 | ADC_CR1_AWDCH_0)
ganlikun 0:13413ea9a877 223 #define ADC_CHANNEL_14_NUMBER ( ADC_CR1_AWDCH_3 | ADC_CR1_AWDCH_2 | ADC_CR1_AWDCH_1 )
ganlikun 0:13413ea9a877 224 #define ADC_CHANNEL_15_NUMBER ( ADC_CR1_AWDCH_3 | ADC_CR1_AWDCH_2 | ADC_CR1_AWDCH_1 | ADC_CR1_AWDCH_0)
ganlikun 0:13413ea9a877 225 #define ADC_CHANNEL_16_NUMBER (ADC_CR1_AWDCH_4 )
ganlikun 0:13413ea9a877 226 #define ADC_CHANNEL_17_NUMBER (ADC_CR1_AWDCH_4 | ADC_CR1_AWDCH_0)
ganlikun 0:13413ea9a877 227 #define ADC_CHANNEL_18_NUMBER (ADC_CR1_AWDCH_4 | ADC_CR1_AWDCH_1 )
ganlikun 0:13413ea9a877 228
ganlikun 0:13413ea9a877 229 /* Definition of channels sampling time information to be inserted into */
ganlikun 0:13413ea9a877 230 /* channels literals definition. */
ganlikun 0:13413ea9a877 231 #define ADC_CHANNEL_0_SMP (ADC_SMPR2_REGOFFSET | (( 0U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR2_SMP0) */
ganlikun 0:13413ea9a877 232 #define ADC_CHANNEL_1_SMP (ADC_SMPR2_REGOFFSET | (( 3U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR2_SMP1) */
ganlikun 0:13413ea9a877 233 #define ADC_CHANNEL_2_SMP (ADC_SMPR2_REGOFFSET | (( 6U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR2_SMP2) */
ganlikun 0:13413ea9a877 234 #define ADC_CHANNEL_3_SMP (ADC_SMPR2_REGOFFSET | (( 9U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR2_SMP3) */
ganlikun 0:13413ea9a877 235 #define ADC_CHANNEL_4_SMP (ADC_SMPR2_REGOFFSET | ((12U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR2_SMP4) */
ganlikun 0:13413ea9a877 236 #define ADC_CHANNEL_5_SMP (ADC_SMPR2_REGOFFSET | ((15U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR2_SMP5) */
ganlikun 0:13413ea9a877 237 #define ADC_CHANNEL_6_SMP (ADC_SMPR2_REGOFFSET | ((18U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR2_SMP6) */
ganlikun 0:13413ea9a877 238 #define ADC_CHANNEL_7_SMP (ADC_SMPR2_REGOFFSET | ((21U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR2_SMP7) */
ganlikun 0:13413ea9a877 239 #define ADC_CHANNEL_8_SMP (ADC_SMPR2_REGOFFSET | ((24U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR2_SMP8) */
ganlikun 0:13413ea9a877 240 #define ADC_CHANNEL_9_SMP (ADC_SMPR2_REGOFFSET | ((27U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR2_SMP9) */
ganlikun 0:13413ea9a877 241 #define ADC_CHANNEL_10_SMP (ADC_SMPR1_REGOFFSET | (( 0U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR1_SMP10) */
ganlikun 0:13413ea9a877 242 #define ADC_CHANNEL_11_SMP (ADC_SMPR1_REGOFFSET | (( 3U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR1_SMP11) */
ganlikun 0:13413ea9a877 243 #define ADC_CHANNEL_12_SMP (ADC_SMPR1_REGOFFSET | (( 6U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR1_SMP12) */
ganlikun 0:13413ea9a877 244 #define ADC_CHANNEL_13_SMP (ADC_SMPR1_REGOFFSET | (( 9U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR1_SMP13) */
ganlikun 0:13413ea9a877 245 #define ADC_CHANNEL_14_SMP (ADC_SMPR1_REGOFFSET | ((12U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR1_SMP14) */
ganlikun 0:13413ea9a877 246 #define ADC_CHANNEL_15_SMP (ADC_SMPR1_REGOFFSET | ((15U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR1_SMP15) */
ganlikun 0:13413ea9a877 247 #define ADC_CHANNEL_16_SMP (ADC_SMPR1_REGOFFSET | ((18U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR1_SMP16) */
ganlikun 0:13413ea9a877 248 #define ADC_CHANNEL_17_SMP (ADC_SMPR1_REGOFFSET | ((21U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR1_SMP17) */
ganlikun 0:13413ea9a877 249 #define ADC_CHANNEL_18_SMP (ADC_SMPR1_REGOFFSET | ((24U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR1_SMP18) */
ganlikun 0:13413ea9a877 250
ganlikun 0:13413ea9a877 251 /* Internal mask for ADC analog watchdog: */
ganlikun 0:13413ea9a877 252 /* To select into literals LL_ADC_AWD_CHANNELx_xxx the relevant bits for: */
ganlikun 0:13413ea9a877 253 /* (concatenation of multiple bits used in different analog watchdogs, */
ganlikun 0:13413ea9a877 254 /* (feature of several watchdogs not available on all STM32 families)). */
ganlikun 0:13413ea9a877 255 /* - analog watchdog 1: monitored channel defined by number, */
ganlikun 0:13413ea9a877 256 /* selection of ADC group (ADC groups regular and-or injected). */
ganlikun 0:13413ea9a877 257
ganlikun 0:13413ea9a877 258 /* Internal register offset for ADC analog watchdog channel configuration */
ganlikun 0:13413ea9a877 259 #define ADC_AWD_CR1_REGOFFSET 0x00000000U
ganlikun 0:13413ea9a877 260
ganlikun 0:13413ea9a877 261 #define ADC_AWD_CRX_REGOFFSET_MASK (ADC_AWD_CR1_REGOFFSET)
ganlikun 0:13413ea9a877 262
ganlikun 0:13413ea9a877 263 #define ADC_AWD_CR1_CHANNEL_MASK (ADC_CR1_AWDCH | ADC_CR1_JAWDEN | ADC_CR1_AWDEN | ADC_CR1_AWDSGL)
ganlikun 0:13413ea9a877 264 #define ADC_AWD_CR_ALL_CHANNEL_MASK (ADC_AWD_CR1_CHANNEL_MASK)
ganlikun 0:13413ea9a877 265
ganlikun 0:13413ea9a877 266 /* Internal register offset for ADC analog watchdog threshold configuration */
ganlikun 0:13413ea9a877 267 #define ADC_AWD_TR1_HIGH_REGOFFSET 0x00000000U
ganlikun 0:13413ea9a877 268 #define ADC_AWD_TR1_LOW_REGOFFSET 0x00000001U
ganlikun 0:13413ea9a877 269 #define ADC_AWD_TRX_REGOFFSET_MASK (ADC_AWD_TR1_HIGH_REGOFFSET | ADC_AWD_TR1_LOW_REGOFFSET)
ganlikun 0:13413ea9a877 270
ganlikun 0:13413ea9a877 271 /* ADC registers bits positions */
ganlikun 0:13413ea9a877 272 #define ADC_CR1_RES_BITOFFSET_POS (24U) /* Value equivalent to POSITION_VAL(ADC_CR1_RES) */
ganlikun 0:13413ea9a877 273 #define ADC_TR_HT_BITOFFSET_POS (16U) /* Value equivalent to POSITION_VAL(ADC_TR_HT) */
ganlikun 0:13413ea9a877 274 /**
ganlikun 0:13413ea9a877 275 * @}
ganlikun 0:13413ea9a877 276 */
ganlikun 0:13413ea9a877 277
ganlikun 0:13413ea9a877 278
ganlikun 0:13413ea9a877 279 /* Private macros ------------------------------------------------------------*/
ganlikun 0:13413ea9a877 280 /** @defgroup ADC_LL_Private_Macros ADC Private Macros
ganlikun 0:13413ea9a877 281 * @{
ganlikun 0:13413ea9a877 282 */
ganlikun 0:13413ea9a877 283
ganlikun 0:13413ea9a877 284 /**
ganlikun 0:13413ea9a877 285 * @brief Driver macro reserved for internal use: isolate bits with the
ganlikun 0:13413ea9a877 286 * selected mask and shift them to the register LSB
ganlikun 0:13413ea9a877 287 * (shift mask on register position bit 0).
ganlikun 0:13413ea9a877 288 * @param __BITS__ Bits in register 32 bits
ganlikun 0:13413ea9a877 289 * @param __MASK__ Mask in register 32 bits
ganlikun 0:13413ea9a877 290 * @retval Bits in register 32 bits
ganlikun 0:13413ea9a877 291 */
ganlikun 0:13413ea9a877 292 #define __ADC_MASK_SHIFT(__BITS__, __MASK__) \
ganlikun 0:13413ea9a877 293 (((__BITS__) & (__MASK__)) >> POSITION_VAL((__MASK__)))
ganlikun 0:13413ea9a877 294
ganlikun 0:13413ea9a877 295 /**
ganlikun 0:13413ea9a877 296 * @brief Driver macro reserved for internal use: set a pointer to
ganlikun 0:13413ea9a877 297 * a register from a register basis from which an offset
ganlikun 0:13413ea9a877 298 * is applied.
ganlikun 0:13413ea9a877 299 * @param __REG__ Register basis from which the offset is applied.
ganlikun 0:13413ea9a877 300 * @param __REG_OFFFSET__ Offset to be applied (unit: number of registers).
ganlikun 0:13413ea9a877 301 * @retval Pointer to register address
ganlikun 0:13413ea9a877 302 */
ganlikun 0:13413ea9a877 303 #define __ADC_PTR_REG_OFFSET(__REG__, __REG_OFFFSET__) \
ganlikun 0:13413ea9a877 304 ((uint32_t *)((uint32_t) ((uint32_t)(&(__REG__)) + ((__REG_OFFFSET__) << 2U))))
ganlikun 0:13413ea9a877 305
ganlikun 0:13413ea9a877 306 /**
ganlikun 0:13413ea9a877 307 * @}
ganlikun 0:13413ea9a877 308 */
ganlikun 0:13413ea9a877 309
ganlikun 0:13413ea9a877 310
ganlikun 0:13413ea9a877 311 /* Exported types ------------------------------------------------------------*/
ganlikun 0:13413ea9a877 312 #if defined(USE_FULL_LL_DRIVER)
ganlikun 0:13413ea9a877 313 /** @defgroup ADC_LL_ES_INIT ADC Exported Init structure
ganlikun 0:13413ea9a877 314 * @{
ganlikun 0:13413ea9a877 315 */
ganlikun 0:13413ea9a877 316
ganlikun 0:13413ea9a877 317 /**
ganlikun 0:13413ea9a877 318 * @brief Structure definition of some features of ADC common parameters
ganlikun 0:13413ea9a877 319 * and multimode
ganlikun 0:13413ea9a877 320 * (all ADC instances belonging to the same ADC common instance).
ganlikun 0:13413ea9a877 321 * @note The setting of these parameters by function @ref LL_ADC_CommonInit()
ganlikun 0:13413ea9a877 322 * is conditioned to ADC instances state (all ADC instances
ganlikun 0:13413ea9a877 323 * sharing the same ADC common instance):
ganlikun 0:13413ea9a877 324 * All ADC instances sharing the same ADC common instance must be
ganlikun 0:13413ea9a877 325 * disabled.
ganlikun 0:13413ea9a877 326 */
ganlikun 0:13413ea9a877 327 typedef struct
ganlikun 0:13413ea9a877 328 {
ganlikun 0:13413ea9a877 329 uint32_t CommonClock; /*!< Set parameter common to several ADC: Clock source and prescaler.
ganlikun 0:13413ea9a877 330 This parameter can be a value of @ref ADC_LL_EC_COMMON_CLOCK_SOURCE
ganlikun 0:13413ea9a877 331
ganlikun 0:13413ea9a877 332 This feature can be modified afterwards using unitary function @ref LL_ADC_SetCommonClock(). */
ganlikun 0:13413ea9a877 333
ganlikun 0:13413ea9a877 334 #if defined(ADC_MULTIMODE_SUPPORT)
ganlikun 0:13413ea9a877 335 uint32_t Multimode; /*!< Set ADC multimode configuration to operate in independent mode or multimode (for devices with several ADC instances).
ganlikun 0:13413ea9a877 336 This parameter can be a value of @ref ADC_LL_EC_MULTI_MODE
ganlikun 0:13413ea9a877 337
ganlikun 0:13413ea9a877 338 This feature can be modified afterwards using unitary function @ref LL_ADC_SetMultimode(). */
ganlikun 0:13413ea9a877 339
ganlikun 0:13413ea9a877 340 uint32_t MultiDMATransfer; /*!< Set ADC multimode conversion data transfer: no transfer or transfer by DMA.
ganlikun 0:13413ea9a877 341 This parameter can be a value of @ref ADC_LL_EC_MULTI_DMA_TRANSFER
ganlikun 0:13413ea9a877 342
ganlikun 0:13413ea9a877 343 This feature can be modified afterwards using unitary function @ref LL_ADC_SetMultiDMATransfer(). */
ganlikun 0:13413ea9a877 344
ganlikun 0:13413ea9a877 345 uint32_t MultiTwoSamplingDelay; /*!< Set ADC multimode delay between 2 sampling phases.
ganlikun 0:13413ea9a877 346 This parameter can be a value of @ref ADC_LL_EC_MULTI_TWOSMP_DELAY
ganlikun 0:13413ea9a877 347
ganlikun 0:13413ea9a877 348 This feature can be modified afterwards using unitary function @ref LL_ADC_SetMultiTwoSamplingDelay(). */
ganlikun 0:13413ea9a877 349 #endif /* ADC_MULTIMODE_SUPPORT */
ganlikun 0:13413ea9a877 350
ganlikun 0:13413ea9a877 351 } LL_ADC_CommonInitTypeDef;
ganlikun 0:13413ea9a877 352
ganlikun 0:13413ea9a877 353 /**
ganlikun 0:13413ea9a877 354 * @brief Structure definition of some features of ADC instance.
ganlikun 0:13413ea9a877 355 * @note These parameters have an impact on ADC scope: ADC instance.
ganlikun 0:13413ea9a877 356 * Affects both group regular and group injected (availability
ganlikun 0:13413ea9a877 357 * of ADC group injected depends on STM32 families).
ganlikun 0:13413ea9a877 358 * Refer to corresponding unitary functions into
ganlikun 0:13413ea9a877 359 * @ref ADC_LL_EF_Configuration_ADC_Instance .
ganlikun 0:13413ea9a877 360 * @note The setting of these parameters by function @ref LL_ADC_Init()
ganlikun 0:13413ea9a877 361 * is conditioned to ADC state:
ganlikun 0:13413ea9a877 362 * ADC instance must be disabled.
ganlikun 0:13413ea9a877 363 * This condition is applied to all ADC features, for efficiency
ganlikun 0:13413ea9a877 364 * and compatibility over all STM32 families. However, the different
ganlikun 0:13413ea9a877 365 * features can be set under different ADC state conditions
ganlikun 0:13413ea9a877 366 * (setting possible with ADC enabled without conversion on going,
ganlikun 0:13413ea9a877 367 * ADC enabled with conversion on going, ...)
ganlikun 0:13413ea9a877 368 * Each feature can be updated afterwards with a unitary function
ganlikun 0:13413ea9a877 369 * and potentially with ADC in a different state than disabled,
ganlikun 0:13413ea9a877 370 * refer to description of each function for setting
ganlikun 0:13413ea9a877 371 * conditioned to ADC state.
ganlikun 0:13413ea9a877 372 */
ganlikun 0:13413ea9a877 373 typedef struct
ganlikun 0:13413ea9a877 374 {
ganlikun 0:13413ea9a877 375 uint32_t Resolution; /*!< Set ADC resolution.
ganlikun 0:13413ea9a877 376 This parameter can be a value of @ref ADC_LL_EC_RESOLUTION
ganlikun 0:13413ea9a877 377
ganlikun 0:13413ea9a877 378 This feature can be modified afterwards using unitary function @ref LL_ADC_SetResolution(). */
ganlikun 0:13413ea9a877 379
ganlikun 0:13413ea9a877 380 uint32_t DataAlignment; /*!< Set ADC conversion data alignment.
ganlikun 0:13413ea9a877 381 This parameter can be a value of @ref ADC_LL_EC_DATA_ALIGN
ganlikun 0:13413ea9a877 382
ganlikun 0:13413ea9a877 383 This feature can be modified afterwards using unitary function @ref LL_ADC_SetDataAlignment(). */
ganlikun 0:13413ea9a877 384
ganlikun 0:13413ea9a877 385 uint32_t SequencersScanMode; /*!< Set ADC scan selection.
ganlikun 0:13413ea9a877 386 This parameter can be a value of @ref ADC_LL_EC_SCAN_SELECTION
ganlikun 0:13413ea9a877 387
ganlikun 0:13413ea9a877 388 This feature can be modified afterwards using unitary function @ref LL_ADC_SetSequencersScanMode(). */
ganlikun 0:13413ea9a877 389
ganlikun 0:13413ea9a877 390 } LL_ADC_InitTypeDef;
ganlikun 0:13413ea9a877 391
ganlikun 0:13413ea9a877 392 /**
ganlikun 0:13413ea9a877 393 * @brief Structure definition of some features of ADC group regular.
ganlikun 0:13413ea9a877 394 * @note These parameters have an impact on ADC scope: ADC group regular.
ganlikun 0:13413ea9a877 395 * Refer to corresponding unitary functions into
ganlikun 0:13413ea9a877 396 * @ref ADC_LL_EF_Configuration_ADC_Group_Regular
ganlikun 0:13413ea9a877 397 * (functions with prefix "REG").
ganlikun 0:13413ea9a877 398 * @note The setting of these parameters by function @ref LL_ADC_REG_Init()
ganlikun 0:13413ea9a877 399 * is conditioned to ADC state:
ganlikun 0:13413ea9a877 400 * ADC instance must be disabled.
ganlikun 0:13413ea9a877 401 * This condition is applied to all ADC features, for efficiency
ganlikun 0:13413ea9a877 402 * and compatibility over all STM32 families. However, the different
ganlikun 0:13413ea9a877 403 * features can be set under different ADC state conditions
ganlikun 0:13413ea9a877 404 * (setting possible with ADC enabled without conversion on going,
ganlikun 0:13413ea9a877 405 * ADC enabled with conversion on going, ...)
ganlikun 0:13413ea9a877 406 * Each feature can be updated afterwards with a unitary function
ganlikun 0:13413ea9a877 407 * and potentially with ADC in a different state than disabled,
ganlikun 0:13413ea9a877 408 * refer to description of each function for setting
ganlikun 0:13413ea9a877 409 * conditioned to ADC state.
ganlikun 0:13413ea9a877 410 */
ganlikun 0:13413ea9a877 411 typedef struct
ganlikun 0:13413ea9a877 412 {
ganlikun 0:13413ea9a877 413 uint32_t TriggerSource; /*!< Set ADC group regular conversion trigger source: internal (SW start) or from external IP (timer event, external interrupt line).
ganlikun 0:13413ea9a877 414 This parameter can be a value of @ref ADC_LL_EC_REG_TRIGGER_SOURCE
ganlikun 0:13413ea9a877 415 @note On this STM32 serie, setting of external trigger edge is performed
ganlikun 0:13413ea9a877 416 using function @ref LL_ADC_REG_StartConversionExtTrig().
ganlikun 0:13413ea9a877 417
ganlikun 0:13413ea9a877 418 This feature can be modified afterwards using unitary function @ref LL_ADC_REG_SetTriggerSource(). */
ganlikun 0:13413ea9a877 419
ganlikun 0:13413ea9a877 420 uint32_t SequencerLength; /*!< Set ADC group regular sequencer length.
ganlikun 0:13413ea9a877 421 This parameter can be a value of @ref ADC_LL_EC_REG_SEQ_SCAN_LENGTH
ganlikun 0:13413ea9a877 422 @note This parameter is discarded if scan mode is disabled (refer to parameter 'ADC_SequencersScanMode').
ganlikun 0:13413ea9a877 423
ganlikun 0:13413ea9a877 424 This feature can be modified afterwards using unitary function @ref LL_ADC_REG_SetSequencerLength(). */
ganlikun 0:13413ea9a877 425
ganlikun 0:13413ea9a877 426 uint32_t SequencerDiscont; /*!< Set ADC group regular sequencer discontinuous mode: sequence subdivided and scan conversions interrupted every selected number of ranks.
ganlikun 0:13413ea9a877 427 This parameter can be a value of @ref ADC_LL_EC_REG_SEQ_DISCONT_MODE
ganlikun 0:13413ea9a877 428 @note This parameter has an effect only if group regular sequencer is enabled
ganlikun 0:13413ea9a877 429 (scan length of 2 ranks or more).
ganlikun 0:13413ea9a877 430
ganlikun 0:13413ea9a877 431 This feature can be modified afterwards using unitary function @ref LL_ADC_REG_SetSequencerDiscont(). */
ganlikun 0:13413ea9a877 432
ganlikun 0:13413ea9a877 433 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).
ganlikun 0:13413ea9a877 434 This parameter can be a value of @ref ADC_LL_EC_REG_CONTINUOUS_MODE
ganlikun 0:13413ea9a877 435 Note: It is not possible to enable both ADC group regular continuous mode and discontinuous mode.
ganlikun 0:13413ea9a877 436
ganlikun 0:13413ea9a877 437 This feature can be modified afterwards using unitary function @ref LL_ADC_REG_SetContinuousMode(). */
ganlikun 0:13413ea9a877 438
ganlikun 0:13413ea9a877 439 uint32_t DMATransfer; /*!< Set ADC group regular conversion data transfer: no transfer or transfer by DMA, and DMA requests mode.
ganlikun 0:13413ea9a877 440 This parameter can be a value of @ref ADC_LL_EC_REG_DMA_TRANSFER
ganlikun 0:13413ea9a877 441
ganlikun 0:13413ea9a877 442 This feature can be modified afterwards using unitary function @ref LL_ADC_REG_SetDMATransfer(). */
ganlikun 0:13413ea9a877 443
ganlikun 0:13413ea9a877 444 } LL_ADC_REG_InitTypeDef;
ganlikun 0:13413ea9a877 445
ganlikun 0:13413ea9a877 446 /**
ganlikun 0:13413ea9a877 447 * @brief Structure definition of some features of ADC group injected.
ganlikun 0:13413ea9a877 448 * @note These parameters have an impact on ADC scope: ADC group injected.
ganlikun 0:13413ea9a877 449 * Refer to corresponding unitary functions into
ganlikun 0:13413ea9a877 450 * @ref ADC_LL_EF_Configuration_ADC_Group_Regular
ganlikun 0:13413ea9a877 451 * (functions with prefix "INJ").
ganlikun 0:13413ea9a877 452 * @note The setting of these parameters by function @ref LL_ADC_INJ_Init()
ganlikun 0:13413ea9a877 453 * is conditioned to ADC state:
ganlikun 0:13413ea9a877 454 * ADC instance must be disabled.
ganlikun 0:13413ea9a877 455 * This condition is applied to all ADC features, for efficiency
ganlikun 0:13413ea9a877 456 * and compatibility over all STM32 families. However, the different
ganlikun 0:13413ea9a877 457 * features can be set under different ADC state conditions
ganlikun 0:13413ea9a877 458 * (setting possible with ADC enabled without conversion on going,
ganlikun 0:13413ea9a877 459 * ADC enabled with conversion on going, ...)
ganlikun 0:13413ea9a877 460 * Each feature can be updated afterwards with a unitary function
ganlikun 0:13413ea9a877 461 * and potentially with ADC in a different state than disabled,
ganlikun 0:13413ea9a877 462 * refer to description of each function for setting
ganlikun 0:13413ea9a877 463 * conditioned to ADC state.
ganlikun 0:13413ea9a877 464 */
ganlikun 0:13413ea9a877 465 typedef struct
ganlikun 0:13413ea9a877 466 {
ganlikun 0:13413ea9a877 467 uint32_t TriggerSource; /*!< Set ADC group injected conversion trigger source: internal (SW start) or from external IP (timer event, external interrupt line).
ganlikun 0:13413ea9a877 468 This parameter can be a value of @ref ADC_LL_EC_INJ_TRIGGER_SOURCE
ganlikun 0:13413ea9a877 469 @note On this STM32 serie, setting of external trigger edge is performed
ganlikun 0:13413ea9a877 470 using function @ref LL_ADC_INJ_StartConversionExtTrig().
ganlikun 0:13413ea9a877 471
ganlikun 0:13413ea9a877 472 This feature can be modified afterwards using unitary function @ref LL_ADC_INJ_SetTriggerSource(). */
ganlikun 0:13413ea9a877 473
ganlikun 0:13413ea9a877 474 uint32_t SequencerLength; /*!< Set ADC group injected sequencer length.
ganlikun 0:13413ea9a877 475 This parameter can be a value of @ref ADC_LL_EC_INJ_SEQ_SCAN_LENGTH
ganlikun 0:13413ea9a877 476 @note This parameter is discarded if scan mode is disabled (refer to parameter 'ADC_SequencersScanMode').
ganlikun 0:13413ea9a877 477
ganlikun 0:13413ea9a877 478 This feature can be modified afterwards using unitary function @ref LL_ADC_INJ_SetSequencerLength(). */
ganlikun 0:13413ea9a877 479
ganlikun 0:13413ea9a877 480 uint32_t SequencerDiscont; /*!< Set ADC group injected sequencer discontinuous mode: sequence subdivided and scan conversions interrupted every selected number of ranks.
ganlikun 0:13413ea9a877 481 This parameter can be a value of @ref ADC_LL_EC_INJ_SEQ_DISCONT_MODE
ganlikun 0:13413ea9a877 482 @note This parameter has an effect only if group injected sequencer is enabled
ganlikun 0:13413ea9a877 483 (scan length of 2 ranks or more).
ganlikun 0:13413ea9a877 484
ganlikun 0:13413ea9a877 485 This feature can be modified afterwards using unitary function @ref LL_ADC_INJ_SetSequencerDiscont(). */
ganlikun 0:13413ea9a877 486
ganlikun 0:13413ea9a877 487 uint32_t TrigAuto; /*!< Set ADC group injected conversion trigger: independent or from ADC group regular.
ganlikun 0:13413ea9a877 488 This parameter can be a value of @ref ADC_LL_EC_INJ_TRIG_AUTO
ganlikun 0:13413ea9a877 489 Note: This parameter must be set to set to independent trigger if injected trigger source is set to an external trigger.
ganlikun 0:13413ea9a877 490
ganlikun 0:13413ea9a877 491 This feature can be modified afterwards using unitary function @ref LL_ADC_INJ_SetTrigAuto(). */
ganlikun 0:13413ea9a877 492
ganlikun 0:13413ea9a877 493 } LL_ADC_INJ_InitTypeDef;
ganlikun 0:13413ea9a877 494
ganlikun 0:13413ea9a877 495 /**
ganlikun 0:13413ea9a877 496 * @}
ganlikun 0:13413ea9a877 497 */
ganlikun 0:13413ea9a877 498 #endif /* USE_FULL_LL_DRIVER */
ganlikun 0:13413ea9a877 499
ganlikun 0:13413ea9a877 500 /* Exported constants --------------------------------------------------------*/
ganlikun 0:13413ea9a877 501 /** @defgroup ADC_LL_Exported_Constants ADC Exported Constants
ganlikun 0:13413ea9a877 502 * @{
ganlikun 0:13413ea9a877 503 */
ganlikun 0:13413ea9a877 504
ganlikun 0:13413ea9a877 505 /** @defgroup ADC_LL_EC_FLAG ADC flags
ganlikun 0:13413ea9a877 506 * @brief Flags defines which can be used with LL_ADC_ReadReg function
ganlikun 0:13413ea9a877 507 * @{
ganlikun 0:13413ea9a877 508 */
ganlikun 0:13413ea9a877 509 #define LL_ADC_FLAG_STRT ADC_SR_STRT /*!< ADC flag ADC group regular conversion start */
ganlikun 0:13413ea9a877 510 #define LL_ADC_FLAG_EOCS ADC_SR_EOC /*!< ADC flag ADC group regular end of unitary conversion or sequence conversions (to configure flag of end of conversion, use function @ref LL_ADC_REG_SetFlagEndOfConversion() ) */
ganlikun 0:13413ea9a877 511 #define LL_ADC_FLAG_OVR ADC_SR_OVR /*!< ADC flag ADC group regular overrun */
ganlikun 0:13413ea9a877 512 #define LL_ADC_FLAG_JSTRT ADC_SR_JSTRT /*!< ADC flag ADC group injected conversion start */
ganlikun 0:13413ea9a877 513 #define LL_ADC_FLAG_JEOS ADC_SR_JEOC /*!< ADC flag ADC group injected end of sequence conversions (Note: on this STM32 serie, there is no flag ADC group injected end of unitary conversion. Flag noted as "JEOC" is corresponding to flag "JEOS" in other STM32 families) */
ganlikun 0:13413ea9a877 514 #define LL_ADC_FLAG_AWD1 ADC_SR_AWD /*!< ADC flag ADC analog watchdog 1 */
ganlikun 0:13413ea9a877 515 #if defined(ADC_MULTIMODE_SUPPORT)
ganlikun 0:13413ea9a877 516 #define LL_ADC_FLAG_EOCS_MST ADC_CSR_EOC1 /*!< ADC flag ADC multimode master group regular end of unitary conversion or sequence conversions (to configure flag of end of conversion, use function @ref LL_ADC_REG_SetFlagEndOfConversion() ) */
ganlikun 0:13413ea9a877 517 #define LL_ADC_FLAG_EOCS_SLV1 ADC_CSR_EOC2 /*!< ADC flag ADC multimode slave 1 group regular end of unitary conversion or sequence conversions (to configure flag of end of conversion, use function @ref LL_ADC_REG_SetFlagEndOfConversion() ) */
ganlikun 0:13413ea9a877 518 #define LL_ADC_FLAG_EOCS_SLV2 ADC_CSR_EOC3 /*!< ADC flag ADC multimode slave 2 group regular end of unitary conversion or sequence conversions (to configure flag of end of conversion, use function @ref LL_ADC_REG_SetFlagEndOfConversion() ) */
ganlikun 0:13413ea9a877 519 #define LL_ADC_FLAG_OVR_MST ADC_CSR_OVR1 /*!< ADC flag ADC multimode master group regular overrun */
ganlikun 0:13413ea9a877 520 #define LL_ADC_FLAG_OVR_SLV1 ADC_CSR_OVR2 /*!< ADC flag ADC multimode slave 1 group regular overrun */
ganlikun 0:13413ea9a877 521 #define LL_ADC_FLAG_OVR_SLV2 ADC_CSR_OVR3 /*!< ADC flag ADC multimode slave 2 group regular overrun */
ganlikun 0:13413ea9a877 522 #define LL_ADC_FLAG_JEOS_MST ADC_CSR_JEOC1 /*!< ADC flag ADC multimode master group injected end of sequence conversions (Note: on this STM32 serie, there is no flag ADC group injected end of unitary conversion. Flag noted as "JEOC" is corresponding to flag "JEOS" in other STM32 families) */
ganlikun 0:13413ea9a877 523 #define LL_ADC_FLAG_JEOS_SLV1 ADC_CSR_JEOC2 /*!< ADC flag ADC multimode slave 1 group injected end of sequence conversions (Note: on this STM32 serie, there is no flag ADC group injected end of unitary conversion. Flag noted as "JEOC" is corresponding to flag "JEOS" in other STM32 families) */
ganlikun 0:13413ea9a877 524 #define LL_ADC_FLAG_JEOS_SLV2 ADC_CSR_JEOC3 /*!< ADC flag ADC multimode slave 2 group injected end of sequence conversions (Note: on this STM32 serie, there is no flag ADC group injected end of unitary conversion. Flag noted as "JEOC" is corresponding to flag "JEOS" in other STM32 families) */
ganlikun 0:13413ea9a877 525 #define LL_ADC_FLAG_AWD1_MST ADC_CSR_AWD1 /*!< ADC flag ADC multimode master analog watchdog 1 of the ADC master */
ganlikun 0:13413ea9a877 526 #define LL_ADC_FLAG_AWD1_SLV1 ADC_CSR_AWD2 /*!< ADC flag ADC multimode slave 1 analog watchdog 1 */
ganlikun 0:13413ea9a877 527 #define LL_ADC_FLAG_AWD1_SLV2 ADC_CSR_AWD3 /*!< ADC flag ADC multimode slave 2 analog watchdog 1 */
ganlikun 0:13413ea9a877 528 #endif
ganlikun 0:13413ea9a877 529 /**
ganlikun 0:13413ea9a877 530 * @}
ganlikun 0:13413ea9a877 531 */
ganlikun 0:13413ea9a877 532
ganlikun 0:13413ea9a877 533 /** @defgroup ADC_LL_EC_IT ADC interruptions for configuration (interruption enable or disable)
ganlikun 0:13413ea9a877 534 * @brief IT defines which can be used with LL_ADC_ReadReg and LL_ADC_WriteReg functions
ganlikun 0:13413ea9a877 535 * @{
ganlikun 0:13413ea9a877 536 */
ganlikun 0:13413ea9a877 537 #define LL_ADC_IT_EOCS ADC_CR1_EOCIE /*!< ADC interruption ADC group regular end of unitary conversion or sequence conversions (to configure flag of end of conversion, use function @ref LL_ADC_REG_SetFlagEndOfConversion() ) */
ganlikun 0:13413ea9a877 538 #define LL_ADC_IT_OVR ADC_CR1_OVRIE /*!< ADC interruption ADC group regular overrun */
ganlikun 0:13413ea9a877 539 #define LL_ADC_IT_JEOS ADC_CR1_JEOCIE /*!< ADC interruption ADC group injected end of sequence conversions (Note: on this STM32 serie, there is no flag ADC group injected end of unitary conversion. Flag noted as "JEOC" is corresponding to flag "JEOS" in other STM32 families) */
ganlikun 0:13413ea9a877 540 #define LL_ADC_IT_AWD1 ADC_CR1_AWDIE /*!< ADC interruption ADC analog watchdog 1 */
ganlikun 0:13413ea9a877 541 /**
ganlikun 0:13413ea9a877 542 * @}
ganlikun 0:13413ea9a877 543 */
ganlikun 0:13413ea9a877 544
ganlikun 0:13413ea9a877 545 /** @defgroup ADC_LL_EC_REGISTERS ADC registers compliant with specific purpose
ganlikun 0:13413ea9a877 546 * @{
ganlikun 0:13413ea9a877 547 */
ganlikun 0:13413ea9a877 548 /* List of ADC registers intended to be used (most commonly) with */
ganlikun 0:13413ea9a877 549 /* DMA transfer. */
ganlikun 0:13413ea9a877 550 /* Refer to function @ref LL_ADC_DMA_GetRegAddr(). */
ganlikun 0:13413ea9a877 551 #define LL_ADC_DMA_REG_REGULAR_DATA 0x00000000U /* 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() */
ganlikun 0:13413ea9a877 552 #if defined(ADC_MULTIMODE_SUPPORT)
ganlikun 0:13413ea9a877 553 #define LL_ADC_DMA_REG_REGULAR_DATA_MULTI 0x00000001U /* 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() */
ganlikun 0:13413ea9a877 554 #endif
ganlikun 0:13413ea9a877 555 /**
ganlikun 0:13413ea9a877 556 * @}
ganlikun 0:13413ea9a877 557 */
ganlikun 0:13413ea9a877 558
ganlikun 0:13413ea9a877 559 /** @defgroup ADC_LL_EC_COMMON_CLOCK_SOURCE ADC common - Clock source
ganlikun 0:13413ea9a877 560 * @{
ganlikun 0:13413ea9a877 561 */
ganlikun 0:13413ea9a877 562 #define LL_ADC_CLOCK_SYNC_PCLK_DIV2 0x00000000U /*!< ADC synchronous clock derived from AHB clock with prescaler division by 2 */
ganlikun 0:13413ea9a877 563 #define LL_ADC_CLOCK_SYNC_PCLK_DIV4 ( ADC_CCR_ADCPRE_0) /*!< ADC synchronous clock derived from AHB clock with prescaler division by 4 */
ganlikun 0:13413ea9a877 564 #define LL_ADC_CLOCK_SYNC_PCLK_DIV6 (ADC_CCR_ADCPRE_1 ) /*!< ADC synchronous clock derived from AHB clock with prescaler division by 6 */
ganlikun 0:13413ea9a877 565 #define LL_ADC_CLOCK_SYNC_PCLK_DIV8 (ADC_CCR_ADCPRE_1 | ADC_CCR_ADCPRE_0) /*!< ADC synchronous clock derived from AHB clock with prescaler division by 8 */
ganlikun 0:13413ea9a877 566 /**
ganlikun 0:13413ea9a877 567 * @}
ganlikun 0:13413ea9a877 568 */
ganlikun 0:13413ea9a877 569
ganlikun 0:13413ea9a877 570 /** @defgroup ADC_LL_EC_COMMON_PATH_INTERNAL ADC common - Measurement path to internal channels
ganlikun 0:13413ea9a877 571 * @{
ganlikun 0:13413ea9a877 572 */
ganlikun 0:13413ea9a877 573 /* Note: Other measurement paths to internal channels may be available */
ganlikun 0:13413ea9a877 574 /* (connections to other peripherals). */
ganlikun 0:13413ea9a877 575 /* If they are not listed below, they do not require any specific */
ganlikun 0:13413ea9a877 576 /* path enable. In this case, Access to measurement path is done */
ganlikun 0:13413ea9a877 577 /* only by selecting the corresponding ADC internal channel. */
ganlikun 0:13413ea9a877 578 #define LL_ADC_PATH_INTERNAL_NONE 0x00000000U /*!< ADC measurement pathes all disabled */
ganlikun 0:13413ea9a877 579 #define LL_ADC_PATH_INTERNAL_VREFINT (ADC_CCR_TSVREFE) /*!< ADC measurement path to internal channel VrefInt */
ganlikun 0:13413ea9a877 580 #define LL_ADC_PATH_INTERNAL_TEMPSENSOR (ADC_CCR_TSVREFE) /*!< ADC measurement path to internal channel temperature sensor */
ganlikun 0:13413ea9a877 581 #define LL_ADC_PATH_INTERNAL_VBAT (ADC_CCR_VBATE) /*!< ADC measurement path to internal channel Vbat */
ganlikun 0:13413ea9a877 582 /**
ganlikun 0:13413ea9a877 583 * @}
ganlikun 0:13413ea9a877 584 */
ganlikun 0:13413ea9a877 585
ganlikun 0:13413ea9a877 586 /** @defgroup ADC_LL_EC_RESOLUTION ADC instance - Resolution
ganlikun 0:13413ea9a877 587 * @{
ganlikun 0:13413ea9a877 588 */
ganlikun 0:13413ea9a877 589 #define LL_ADC_RESOLUTION_12B 0x00000000U /*!< ADC resolution 12 bits */
ganlikun 0:13413ea9a877 590 #define LL_ADC_RESOLUTION_10B ( ADC_CR1_RES_0) /*!< ADC resolution 10 bits */
ganlikun 0:13413ea9a877 591 #define LL_ADC_RESOLUTION_8B (ADC_CR1_RES_1 ) /*!< ADC resolution 8 bits */
ganlikun 0:13413ea9a877 592 #define LL_ADC_RESOLUTION_6B (ADC_CR1_RES_1 | ADC_CR1_RES_0) /*!< ADC resolution 6 bits */
ganlikun 0:13413ea9a877 593 /**
ganlikun 0:13413ea9a877 594 * @}
ganlikun 0:13413ea9a877 595 */
ganlikun 0:13413ea9a877 596
ganlikun 0:13413ea9a877 597 /** @defgroup ADC_LL_EC_DATA_ALIGN ADC instance - Data alignment
ganlikun 0:13413ea9a877 598 * @{
ganlikun 0:13413ea9a877 599 */
ganlikun 0:13413ea9a877 600 #define LL_ADC_DATA_ALIGN_RIGHT 0x00000000U /*!< ADC conversion data alignment: right aligned (alignment on data register LSB bit 0)*/
ganlikun 0:13413ea9a877 601 #define LL_ADC_DATA_ALIGN_LEFT (ADC_CR2_ALIGN) /*!< ADC conversion data alignment: left aligned (aligment on data register MSB bit 15)*/
ganlikun 0:13413ea9a877 602 /**
ganlikun 0:13413ea9a877 603 * @}
ganlikun 0:13413ea9a877 604 */
ganlikun 0:13413ea9a877 605
ganlikun 0:13413ea9a877 606 /** @defgroup ADC_LL_EC_SCAN_SELECTION ADC instance - Scan selection
ganlikun 0:13413ea9a877 607 * @{
ganlikun 0:13413ea9a877 608 */
ganlikun 0:13413ea9a877 609 #define LL_ADC_SEQ_SCAN_DISABLE 0x00000000U /*!< ADC conversion is performed in unitary conversion mode (one channel converted, that defined in rank 1). Configuration of both groups regular and injected sequencers (sequence length, ...) is discarded: equivalent to length of 1 rank.*/
ganlikun 0:13413ea9a877 610 #define LL_ADC_SEQ_SCAN_ENABLE (ADC_CR1_SCAN) /*!< ADC conversions are performed in sequence conversions mode, according to configuration of both groups regular and injected sequencers (sequence length, ...). */
ganlikun 0:13413ea9a877 611 /**
ganlikun 0:13413ea9a877 612 * @}
ganlikun 0:13413ea9a877 613 */
ganlikun 0:13413ea9a877 614
ganlikun 0:13413ea9a877 615 /** @defgroup ADC_LL_EC_GROUPS ADC instance - Groups
ganlikun 0:13413ea9a877 616 * @{
ganlikun 0:13413ea9a877 617 */
ganlikun 0:13413ea9a877 618 #define LL_ADC_GROUP_REGULAR 0x00000001U /*!< ADC group regular (available on all STM32 devices) */
ganlikun 0:13413ea9a877 619 #define LL_ADC_GROUP_INJECTED 0x00000002U /*!< ADC group injected (not available on all STM32 devices)*/
ganlikun 0:13413ea9a877 620 #define LL_ADC_GROUP_REGULAR_INJECTED 0x00000003U /*!< ADC both groups regular and injected */
ganlikun 0:13413ea9a877 621 /**
ganlikun 0:13413ea9a877 622 * @}
ganlikun 0:13413ea9a877 623 */
ganlikun 0:13413ea9a877 624
ganlikun 0:13413ea9a877 625 /** @defgroup ADC_LL_EC_CHANNEL ADC instance - Channel number
ganlikun 0:13413ea9a877 626 * @{
ganlikun 0:13413ea9a877 627 */
ganlikun 0:13413ea9a877 628 #define LL_ADC_CHANNEL_0 (ADC_CHANNEL_0_NUMBER | ADC_CHANNEL_0_SMP) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN0 */
ganlikun 0:13413ea9a877 629 #define LL_ADC_CHANNEL_1 (ADC_CHANNEL_1_NUMBER | ADC_CHANNEL_1_SMP) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN1 */
ganlikun 0:13413ea9a877 630 #define LL_ADC_CHANNEL_2 (ADC_CHANNEL_2_NUMBER | ADC_CHANNEL_2_SMP) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN2 */
ganlikun 0:13413ea9a877 631 #define LL_ADC_CHANNEL_3 (ADC_CHANNEL_3_NUMBER | ADC_CHANNEL_3_SMP) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN3 */
ganlikun 0:13413ea9a877 632 #define LL_ADC_CHANNEL_4 (ADC_CHANNEL_4_NUMBER | ADC_CHANNEL_4_SMP) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN4 */
ganlikun 0:13413ea9a877 633 #define LL_ADC_CHANNEL_5 (ADC_CHANNEL_5_NUMBER | ADC_CHANNEL_5_SMP) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN5 */
ganlikun 0:13413ea9a877 634 #define LL_ADC_CHANNEL_6 (ADC_CHANNEL_6_NUMBER | ADC_CHANNEL_6_SMP) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN6 */
ganlikun 0:13413ea9a877 635 #define LL_ADC_CHANNEL_7 (ADC_CHANNEL_7_NUMBER | ADC_CHANNEL_7_SMP) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN7 */
ganlikun 0:13413ea9a877 636 #define LL_ADC_CHANNEL_8 (ADC_CHANNEL_8_NUMBER | ADC_CHANNEL_8_SMP) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN8 */
ganlikun 0:13413ea9a877 637 #define LL_ADC_CHANNEL_9 (ADC_CHANNEL_9_NUMBER | ADC_CHANNEL_9_SMP) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN9 */
ganlikun 0:13413ea9a877 638 #define LL_ADC_CHANNEL_10 (ADC_CHANNEL_10_NUMBER | ADC_CHANNEL_10_SMP) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN10 */
ganlikun 0:13413ea9a877 639 #define LL_ADC_CHANNEL_11 (ADC_CHANNEL_11_NUMBER | ADC_CHANNEL_11_SMP) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN11 */
ganlikun 0:13413ea9a877 640 #define LL_ADC_CHANNEL_12 (ADC_CHANNEL_12_NUMBER | ADC_CHANNEL_12_SMP) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN12 */
ganlikun 0:13413ea9a877 641 #define LL_ADC_CHANNEL_13 (ADC_CHANNEL_13_NUMBER | ADC_CHANNEL_13_SMP) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN13 */
ganlikun 0:13413ea9a877 642 #define LL_ADC_CHANNEL_14 (ADC_CHANNEL_14_NUMBER | ADC_CHANNEL_14_SMP) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN14 */
ganlikun 0:13413ea9a877 643 #define LL_ADC_CHANNEL_15 (ADC_CHANNEL_15_NUMBER | ADC_CHANNEL_15_SMP) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN15 */
ganlikun 0:13413ea9a877 644 #define LL_ADC_CHANNEL_16 (ADC_CHANNEL_16_NUMBER | ADC_CHANNEL_16_SMP) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN16 */
ganlikun 0:13413ea9a877 645 #define LL_ADC_CHANNEL_17 (ADC_CHANNEL_17_NUMBER | ADC_CHANNEL_17_SMP) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN17 */
ganlikun 0:13413ea9a877 646 #define LL_ADC_CHANNEL_18 (ADC_CHANNEL_18_NUMBER | ADC_CHANNEL_18_SMP) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN18 */
ganlikun 0:13413ea9a877 647 #define LL_ADC_CHANNEL_VREFINT (LL_ADC_CHANNEL_17 | ADC_CHANNEL_ID_INTERNAL_CH) /*!< ADC internal channel connected to VrefInt: Internal voltage reference. On STM32F4, ADC channel available only on ADC instance: ADC1. */
ganlikun 0:13413ea9a877 648 #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 STM32F4, ADC channel available only on ADC instance: ADC1. */
ganlikun 0:13413ea9a877 649 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx)
ganlikun 0:13413ea9a877 650 #define LL_ADC_CHANNEL_TEMPSENSOR (LL_ADC_CHANNEL_16 | ADC_CHANNEL_ID_INTERNAL_CH) /*!< ADC internal channel connected to Temperature sensor. On STM32F4, ADC channel available only on ADC instance: ADC1. */
ganlikun 0:13413ea9a877 651 #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F401xC || STM32F401xE || STM32F410xx */
ganlikun 0:13413ea9a877 652 #if defined(STM32F412Cx) || defined(STM32F412Rx) || defined(STM32F412Vx) || defined(STM32F412Zx) || defined(STM32F413xx) || defined(STM32F411xE) || defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx)
ganlikun 0:13413ea9a877 653 #define LL_ADC_CHANNEL_TEMPSENSOR (LL_ADC_CHANNEL_18 | ADC_CHANNEL_ID_INTERNAL_CH | ADC_CHANNEL_DIFFERENCIATION_TEMPSENSOR_VBAT) /*!< ADC internal channel connected to Temperature sensor. On STM32F4, ADC channel available only on ADC instance: ADC1. This internal channel is shared between temperature sensor and Vbat, only 1 measurement path must be enabled. */
ganlikun 0:13413ea9a877 654 #endif /* STM32F412Cx || STM32F412Rx || STM32F412Vx || STM32F412Zx || STM32F413xx || STM32F411xE || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */
ganlikun 0:13413ea9a877 655 /**
ganlikun 0:13413ea9a877 656 * @}
ganlikun 0:13413ea9a877 657 */
ganlikun 0:13413ea9a877 658
ganlikun 0:13413ea9a877 659 /** @defgroup ADC_LL_EC_REG_TRIGGER_SOURCE ADC group regular - Trigger source
ganlikun 0:13413ea9a877 660 * @{
ganlikun 0:13413ea9a877 661 */
ganlikun 0:13413ea9a877 662 #define LL_ADC_REG_TRIG_SOFTWARE 0x00000000U /*!< ADC group regular conversion trigger internal: SW start. */
ganlikun 0:13413ea9a877 663 #define LL_ADC_REG_TRIG_EXT_TIM1_CH1 (ADC_REG_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group regular conversion trigger from external IP: TIM1 channel 1 event (capture compare: input capture or output capture). Trigger edge set to rising edge (default setting). */
ganlikun 0:13413ea9a877 664 #define LL_ADC_REG_TRIG_EXT_TIM1_CH2 (ADC_CR2_EXTSEL_0 | ADC_REG_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group regular conversion trigger from external IP: TIM1 channel 2 event (capture compare: input capture or output capture). Trigger edge set to rising edge (default setting). */
ganlikun 0:13413ea9a877 665 #define LL_ADC_REG_TRIG_EXT_TIM1_CH3 (ADC_CR2_EXTSEL_1 | ADC_REG_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group regular conversion trigger from external IP: TIM1 channel 3 event (capture compare: input capture or output capture). Trigger edge set to rising edge (default setting). */
ganlikun 0:13413ea9a877 666 #define LL_ADC_REG_TRIG_EXT_TIM2_CH2 (ADC_CR2_EXTSEL_1 | ADC_CR2_EXTSEL_0 | ADC_REG_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group regular conversion trigger from external IP: TIM2 channel 2 event (capture compare: input capture or output capture). Trigger edge set to rising edge (default setting). */
ganlikun 0:13413ea9a877 667 #define LL_ADC_REG_TRIG_EXT_TIM2_CH3 (ADC_CR2_EXTSEL_2 | ADC_REG_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group regular conversion trigger from external IP: TIM2 channel 3 event (capture compare: input capture or output capture). Trigger edge set to rising edge (default setting). */
ganlikun 0:13413ea9a877 668 #define LL_ADC_REG_TRIG_EXT_TIM2_CH4 (ADC_CR2_EXTSEL_2 | ADC_CR2_EXTSEL_0 | ADC_REG_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group regular conversion trigger from external IP: TIM2 channel 4 event (capture compare: input capture or output capture). Trigger edge set to rising edge (default setting). */
ganlikun 0:13413ea9a877 669 #define LL_ADC_REG_TRIG_EXT_TIM2_TRGO (ADC_CR2_EXTSEL_2 | ADC_CR2_EXTSEL_1 | ADC_REG_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group regular conversion trigger from external IP: TIM2 TRGO. Trigger edge set to rising edge (default setting). */
ganlikun 0:13413ea9a877 670 #define LL_ADC_REG_TRIG_EXT_TIM3_CH1 (ADC_CR2_EXTSEL_2 | ADC_CR2_EXTSEL_1 | ADC_CR2_EXTSEL_0 | ADC_REG_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group regular conversion trigger from external IP: TIM3 channel 1 event (capture compare: input capture or output capture). Trigger edge set to rising edge (default setting). */
ganlikun 0:13413ea9a877 671 #define LL_ADC_REG_TRIG_EXT_TIM3_TRGO (ADC_CR2_EXTSEL_3 | ADC_REG_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group regular conversion trigger from external IP: TIM3 TRGO. Trigger edge set to rising edge (default setting). */
ganlikun 0:13413ea9a877 672 #define LL_ADC_REG_TRIG_EXT_TIM4_CH4 (ADC_CR2_EXTSEL_3 | ADC_CR2_EXTSEL_0 | ADC_REG_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group regular conversion trigger from external IP: TIM4 channel 4 event (capture compare: input capture or output capture). Trigger edge set to rising edge (default setting). */
ganlikun 0:13413ea9a877 673 #define LL_ADC_REG_TRIG_EXT_TIM5_CH1 (ADC_CR2_EXTSEL_3 | ADC_CR2_EXTSEL_1 | ADC_REG_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group regular conversion trigger from external IP: TIM5 channel 1 event (capture compare: input capture or output capture). Trigger edge set to rising edge (default setting). */
ganlikun 0:13413ea9a877 674 #define LL_ADC_REG_TRIG_EXT_TIM5_CH2 (ADC_CR2_EXTSEL_3 | ADC_CR2_EXTSEL_1 | ADC_CR2_EXTSEL_0 | ADC_REG_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group regular conversion trigger from external IP: TIM5 channel 2 event (capture compare: input capture or output capture). Trigger edge set to rising edge (default setting). */
ganlikun 0:13413ea9a877 675 #define LL_ADC_REG_TRIG_EXT_TIM5_CH3 (ADC_CR2_EXTSEL_3 | ADC_CR2_EXTSEL_2 | ADC_REG_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group regular conversion trigger from external IP: TIM5 channel 3 event (capture compare: input capture or output capture). Trigger edge set to rising edge (default setting). */
ganlikun 0:13413ea9a877 676 #define LL_ADC_REG_TRIG_EXT_TIM8_CH1 (ADC_CR2_EXTSEL_3 | ADC_CR2_EXTSEL_2 | ADC_CR2_EXTSEL_0 | ADC_REG_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group regular conversion trigger from external IP: TIM8 channel 1 event (capture compare: input capture or output capture). Trigger edge set to rising edge (default setting). */
ganlikun 0:13413ea9a877 677 #define LL_ADC_REG_TRIG_EXT_TIM8_TRGO (ADC_CR2_EXTSEL_3 | ADC_CR2_EXTSEL_2 | ADC_CR2_EXTSEL_1 | ADC_REG_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group regular conversion trigger from external IP: TIM8 TRGO. Trigger edge set to rising edge (default setting). */
ganlikun 0:13413ea9a877 678 #define LL_ADC_REG_TRIG_EXT_EXTI_LINE11 (ADC_CR2_EXTSEL_3 | ADC_CR2_EXTSEL_2 | ADC_CR2_EXTSEL_1 | ADC_CR2_EXTSEL_0 | ADC_REG_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group regular conversion trigger from external IP: external interrupt line 11. Trigger edge set to rising edge (default setting). */
ganlikun 0:13413ea9a877 679 /**
ganlikun 0:13413ea9a877 680 * @}
ganlikun 0:13413ea9a877 681 */
ganlikun 0:13413ea9a877 682
ganlikun 0:13413ea9a877 683 /** @defgroup ADC_LL_EC_REG_TRIGGER_EDGE ADC group regular - Trigger edge
ganlikun 0:13413ea9a877 684 * @{
ganlikun 0:13413ea9a877 685 */
ganlikun 0:13413ea9a877 686 #define LL_ADC_REG_TRIG_EXT_RISING ( ADC_CR2_EXTEN_0) /*!< ADC group regular conversion trigger polarity set to rising edge */
ganlikun 0:13413ea9a877 687 #define LL_ADC_REG_TRIG_EXT_FALLING (ADC_CR2_EXTEN_1 ) /*!< ADC group regular conversion trigger polarity set to falling edge */
ganlikun 0:13413ea9a877 688 #define LL_ADC_REG_TRIG_EXT_RISINGFALLING (ADC_CR2_EXTEN_1 | ADC_CR2_EXTEN_0) /*!< ADC group regular conversion trigger polarity set to both rising and falling edges */
ganlikun 0:13413ea9a877 689 /**
ganlikun 0:13413ea9a877 690 * @}
ganlikun 0:13413ea9a877 691 */
ganlikun 0:13413ea9a877 692
ganlikun 0:13413ea9a877 693 /** @defgroup ADC_LL_EC_REG_CONTINUOUS_MODE ADC group regular - Continuous mode
ganlikun 0:13413ea9a877 694 * @{
ganlikun 0:13413ea9a877 695 */
ganlikun 0:13413ea9a877 696 #define LL_ADC_REG_CONV_SINGLE 0x00000000U /*!< ADC conversions are performed in single mode: one conversion per trigger */
ganlikun 0:13413ea9a877 697 #define LL_ADC_REG_CONV_CONTINUOUS (ADC_CR2_CONT) /*!< ADC conversions are performed in continuous mode: after the first trigger, following conversions launched successively automatically */
ganlikun 0:13413ea9a877 698 /**
ganlikun 0:13413ea9a877 699 * @}
ganlikun 0:13413ea9a877 700 */
ganlikun 0:13413ea9a877 701
ganlikun 0:13413ea9a877 702 /** @defgroup ADC_LL_EC_REG_DMA_TRANSFER ADC group regular - DMA transfer of ADC conversion data
ganlikun 0:13413ea9a877 703 * @{
ganlikun 0:13413ea9a877 704 */
ganlikun 0:13413ea9a877 705 #define LL_ADC_REG_DMA_TRANSFER_NONE 0x00000000U /*!< ADC conversions are not transferred by DMA */
ganlikun 0:13413ea9a877 706 #define LL_ADC_REG_DMA_TRANSFER_LIMITED ( ADC_CR2_DMA) /*!< 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. */
ganlikun 0:13413ea9a877 707 #define LL_ADC_REG_DMA_TRANSFER_UNLIMITED (ADC_CR2_DDS | ADC_CR2_DMA) /*!< 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. */
ganlikun 0:13413ea9a877 708 /**
ganlikun 0:13413ea9a877 709 * @}
ganlikun 0:13413ea9a877 710 */
ganlikun 0:13413ea9a877 711
ganlikun 0:13413ea9a877 712 /** @defgroup ADC_LL_EC_REG_FLAG_EOC_SELECTION ADC group regular - Flag EOC selection (unitary or sequence conversions)
ganlikun 0:13413ea9a877 713 * @{
ganlikun 0:13413ea9a877 714 */
ganlikun 0:13413ea9a877 715 #define LL_ADC_REG_FLAG_EOC_SEQUENCE_CONV 0x00000000U /*!< ADC flag EOC (end of unitary conversion) selected */
ganlikun 0:13413ea9a877 716 #define LL_ADC_REG_FLAG_EOC_UNITARY_CONV (ADC_CR2_EOCS) /*!< ADC flag EOS (end of sequence conversions) selected */
ganlikun 0:13413ea9a877 717 /**
ganlikun 0:13413ea9a877 718 * @}
ganlikun 0:13413ea9a877 719 */
ganlikun 0:13413ea9a877 720
ganlikun 0:13413ea9a877 721 /** @defgroup ADC_LL_EC_REG_SEQ_SCAN_LENGTH ADC group regular - Sequencer scan length
ganlikun 0:13413ea9a877 722 * @{
ganlikun 0:13413ea9a877 723 */
ganlikun 0:13413ea9a877 724 #define LL_ADC_REG_SEQ_SCAN_DISABLE 0x00000000U /*!< ADC group regular sequencer disable (equivalent to sequencer of 1 rank: ADC conversion on only 1 channel) */
ganlikun 0:13413ea9a877 725 #define LL_ADC_REG_SEQ_SCAN_ENABLE_2RANKS ( ADC_SQR1_L_0) /*!< ADC group regular sequencer enable with 2 ranks in the sequence */
ganlikun 0:13413ea9a877 726 #define LL_ADC_REG_SEQ_SCAN_ENABLE_3RANKS ( ADC_SQR1_L_1 ) /*!< ADC group regular sequencer enable with 3 ranks in the sequence */
ganlikun 0:13413ea9a877 727 #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 */
ganlikun 0:13413ea9a877 728 #define LL_ADC_REG_SEQ_SCAN_ENABLE_5RANKS ( ADC_SQR1_L_2 ) /*!< ADC group regular sequencer enable with 5 ranks in the sequence */
ganlikun 0:13413ea9a877 729 #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 */
ganlikun 0:13413ea9a877 730 #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 */
ganlikun 0:13413ea9a877 731 #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 */
ganlikun 0:13413ea9a877 732 #define LL_ADC_REG_SEQ_SCAN_ENABLE_9RANKS (ADC_SQR1_L_3 ) /*!< ADC group regular sequencer enable with 9 ranks in the sequence */
ganlikun 0:13413ea9a877 733 #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 */
ganlikun 0:13413ea9a877 734 #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 */
ganlikun 0:13413ea9a877 735 #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 */
ganlikun 0:13413ea9a877 736 #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 */
ganlikun 0:13413ea9a877 737 #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 */
ganlikun 0:13413ea9a877 738 #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 */
ganlikun 0:13413ea9a877 739 #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 */
ganlikun 0:13413ea9a877 740 /**
ganlikun 0:13413ea9a877 741 * @}
ganlikun 0:13413ea9a877 742 */
ganlikun 0:13413ea9a877 743
ganlikun 0:13413ea9a877 744 /** @defgroup ADC_LL_EC_REG_SEQ_DISCONT_MODE ADC group regular - Sequencer discontinuous mode
ganlikun 0:13413ea9a877 745 * @{
ganlikun 0:13413ea9a877 746 */
ganlikun 0:13413ea9a877 747 #define LL_ADC_REG_SEQ_DISCONT_DISABLE 0x00000000U /*!< ADC group regular sequencer discontinuous mode disable */
ganlikun 0:13413ea9a877 748 #define LL_ADC_REG_SEQ_DISCONT_1RANK ( ADC_CR1_DISCEN) /*!< ADC group regular sequencer discontinuous mode enable with sequence interruption every rank */
ganlikun 0:13413ea9a877 749 #define LL_ADC_REG_SEQ_DISCONT_2RANKS ( ADC_CR1_DISCNUM_0 | ADC_CR1_DISCEN) /*!< ADC group regular sequencer discontinuous mode enabled with sequence interruption every 2 ranks */
ganlikun 0:13413ea9a877 750 #define LL_ADC_REG_SEQ_DISCONT_3RANKS ( ADC_CR1_DISCNUM_1 | ADC_CR1_DISCEN) /*!< ADC group regular sequencer discontinuous mode enable with sequence interruption every 3 ranks */
ganlikun 0:13413ea9a877 751 #define LL_ADC_REG_SEQ_DISCONT_4RANKS ( ADC_CR1_DISCNUM_1 | ADC_CR1_DISCNUM_0 | ADC_CR1_DISCEN) /*!< ADC group regular sequencer discontinuous mode enable with sequence interruption every 4 ranks */
ganlikun 0:13413ea9a877 752 #define LL_ADC_REG_SEQ_DISCONT_5RANKS (ADC_CR1_DISCNUM_2 | ADC_CR1_DISCEN) /*!< ADC group regular sequencer discontinuous mode enable with sequence interruption every 5 ranks */
ganlikun 0:13413ea9a877 753 #define LL_ADC_REG_SEQ_DISCONT_6RANKS (ADC_CR1_DISCNUM_2 | ADC_CR1_DISCNUM_0 | ADC_CR1_DISCEN) /*!< ADC group regular sequencer discontinuous mode enable with sequence interruption every 6 ranks */
ganlikun 0:13413ea9a877 754 #define LL_ADC_REG_SEQ_DISCONT_7RANKS (ADC_CR1_DISCNUM_2 | ADC_CR1_DISCNUM_1 | ADC_CR1_DISCEN) /*!< ADC group regular sequencer discontinuous mode enable with sequence interruption every 7 ranks */
ganlikun 0:13413ea9a877 755 #define LL_ADC_REG_SEQ_DISCONT_8RANKS (ADC_CR1_DISCNUM_2 | ADC_CR1_DISCNUM_1 | ADC_CR1_DISCNUM_0 | ADC_CR1_DISCEN) /*!< ADC group regular sequencer discontinuous mode enable with sequence interruption every 8 ranks */
ganlikun 0:13413ea9a877 756 /**
ganlikun 0:13413ea9a877 757 * @}
ganlikun 0:13413ea9a877 758 */
ganlikun 0:13413ea9a877 759
ganlikun 0:13413ea9a877 760 /** @defgroup ADC_LL_EC_REG_SEQ_RANKS ADC group regular - Sequencer ranks
ganlikun 0:13413ea9a877 761 * @{
ganlikun 0:13413ea9a877 762 */
ganlikun 0:13413ea9a877 763 #define LL_ADC_REG_RANK_1 (ADC_SQR3_REGOFFSET | ADC_REG_RANK_1_SQRX_BITOFFSET_POS) /*!< ADC group regular sequencer rank 1 */
ganlikun 0:13413ea9a877 764 #define LL_ADC_REG_RANK_2 (ADC_SQR3_REGOFFSET | ADC_REG_RANK_2_SQRX_BITOFFSET_POS) /*!< ADC group regular sequencer rank 2 */
ganlikun 0:13413ea9a877 765 #define LL_ADC_REG_RANK_3 (ADC_SQR3_REGOFFSET | ADC_REG_RANK_3_SQRX_BITOFFSET_POS) /*!< ADC group regular sequencer rank 3 */
ganlikun 0:13413ea9a877 766 #define LL_ADC_REG_RANK_4 (ADC_SQR3_REGOFFSET | ADC_REG_RANK_4_SQRX_BITOFFSET_POS) /*!< ADC group regular sequencer rank 4 */
ganlikun 0:13413ea9a877 767 #define LL_ADC_REG_RANK_5 (ADC_SQR3_REGOFFSET | ADC_REG_RANK_5_SQRX_BITOFFSET_POS) /*!< ADC group regular sequencer rank 5 */
ganlikun 0:13413ea9a877 768 #define LL_ADC_REG_RANK_6 (ADC_SQR3_REGOFFSET | ADC_REG_RANK_6_SQRX_BITOFFSET_POS) /*!< ADC group regular sequencer rank 6 */
ganlikun 0:13413ea9a877 769 #define LL_ADC_REG_RANK_7 (ADC_SQR2_REGOFFSET | ADC_REG_RANK_7_SQRX_BITOFFSET_POS) /*!< ADC group regular sequencer rank 7 */
ganlikun 0:13413ea9a877 770 #define LL_ADC_REG_RANK_8 (ADC_SQR2_REGOFFSET | ADC_REG_RANK_8_SQRX_BITOFFSET_POS) /*!< ADC group regular sequencer rank 8 */
ganlikun 0:13413ea9a877 771 #define LL_ADC_REG_RANK_9 (ADC_SQR2_REGOFFSET | ADC_REG_RANK_9_SQRX_BITOFFSET_POS) /*!< ADC group regular sequencer rank 9 */
ganlikun 0:13413ea9a877 772 #define LL_ADC_REG_RANK_10 (ADC_SQR2_REGOFFSET | ADC_REG_RANK_10_SQRX_BITOFFSET_POS) /*!< ADC group regular sequencer rank 10 */
ganlikun 0:13413ea9a877 773 #define LL_ADC_REG_RANK_11 (ADC_SQR2_REGOFFSET | ADC_REG_RANK_11_SQRX_BITOFFSET_POS) /*!< ADC group regular sequencer rank 11 */
ganlikun 0:13413ea9a877 774 #define LL_ADC_REG_RANK_12 (ADC_SQR2_REGOFFSET | ADC_REG_RANK_12_SQRX_BITOFFSET_POS) /*!< ADC group regular sequencer rank 12 */
ganlikun 0:13413ea9a877 775 #define LL_ADC_REG_RANK_13 (ADC_SQR1_REGOFFSET | ADC_REG_RANK_13_SQRX_BITOFFSET_POS) /*!< ADC group regular sequencer rank 13 */
ganlikun 0:13413ea9a877 776 #define LL_ADC_REG_RANK_14 (ADC_SQR1_REGOFFSET | ADC_REG_RANK_14_SQRX_BITOFFSET_POS) /*!< ADC group regular sequencer rank 14 */
ganlikun 0:13413ea9a877 777 #define LL_ADC_REG_RANK_15 (ADC_SQR1_REGOFFSET | ADC_REG_RANK_15_SQRX_BITOFFSET_POS) /*!< ADC group regular sequencer rank 15 */
ganlikun 0:13413ea9a877 778 #define LL_ADC_REG_RANK_16 (ADC_SQR1_REGOFFSET | ADC_REG_RANK_16_SQRX_BITOFFSET_POS) /*!< ADC group regular sequencer rank 16 */
ganlikun 0:13413ea9a877 779 /**
ganlikun 0:13413ea9a877 780 * @}
ganlikun 0:13413ea9a877 781 */
ganlikun 0:13413ea9a877 782
ganlikun 0:13413ea9a877 783 /** @defgroup ADC_LL_EC_INJ_TRIGGER_SOURCE ADC group injected - Trigger source
ganlikun 0:13413ea9a877 784 * @{
ganlikun 0:13413ea9a877 785 */
ganlikun 0:13413ea9a877 786 #define LL_ADC_INJ_TRIG_SOFTWARE 0x00000000U /*!< ADC group injected conversion trigger internal: SW start. */
ganlikun 0:13413ea9a877 787 #define LL_ADC_INJ_TRIG_EXT_TIM1_CH4 (ADC_INJ_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group injected conversion trigger from external IP: TIM1 channel 4 event (capture compare: input capture or output capture). Trigger edge set to rising edge (default setting). */
ganlikun 0:13413ea9a877 788 #define LL_ADC_INJ_TRIG_EXT_TIM1_TRGO (ADC_CR2_JEXTSEL_0 | ADC_INJ_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group injected conversion trigger from external IP: TIM1 TRGO. Trigger edge set to rising edge (default setting). */
ganlikun 0:13413ea9a877 789 #define LL_ADC_INJ_TRIG_EXT_TIM2_CH1 (ADC_CR2_JEXTSEL_1 | ADC_INJ_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group injected conversion trigger from external IP: TIM2 channel 1 event (capture compare: input capture or output capture). Trigger edge set to rising edge (default setting). */
ganlikun 0:13413ea9a877 790 #define LL_ADC_INJ_TRIG_EXT_TIM2_TRGO (ADC_CR2_JEXTSEL_1 | ADC_CR2_JEXTSEL_0 | ADC_INJ_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group injected conversion trigger from external IP: TIM2 TRGO. Trigger edge set to rising edge (default setting). */
ganlikun 0:13413ea9a877 791 #define LL_ADC_INJ_TRIG_EXT_TIM3_CH2 (ADC_CR2_JEXTSEL_2 | ADC_INJ_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group injected conversion trigger from external IP: TIM3 channel 2 event (capture compare: input capture or output capture). Trigger edge set to rising edge (default setting). */
ganlikun 0:13413ea9a877 792 #define LL_ADC_INJ_TRIG_EXT_TIM3_CH4 (ADC_CR2_JEXTSEL_2 | ADC_CR2_JEXTSEL_0 | ADC_INJ_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group injected conversion trigger from external IP: TIM3 channel 4 event (capture compare: input capture or output capture). Trigger edge set to rising edge (default setting). */
ganlikun 0:13413ea9a877 793 #define LL_ADC_INJ_TRIG_EXT_TIM4_CH1 (ADC_CR2_JEXTSEL_2 | ADC_CR2_JEXTSEL_1 | ADC_INJ_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group injected conversion trigger from external IP: TIM4 channel 1 event (capture compare: input capture or output capture). Trigger edge set to rising edge (default setting). */
ganlikun 0:13413ea9a877 794 #define LL_ADC_INJ_TRIG_EXT_TIM4_CH2 (ADC_CR2_JEXTSEL_2 | ADC_CR2_JEXTSEL_1 | ADC_CR2_JEXTSEL_0 | ADC_INJ_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group injected conversion trigger from external IP: TIM4 channel 2 event (capture compare: input capture or output capture). Trigger edge set to rising edge (default setting). */
ganlikun 0:13413ea9a877 795 #define LL_ADC_INJ_TRIG_EXT_TIM4_CH3 (ADC_CR2_JEXTSEL_3 | ADC_INJ_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group injected conversion trigger from external IP: TIM4 channel 3 event (capture compare: input capture or output capture). Trigger edge set to rising edge (default setting). */
ganlikun 0:13413ea9a877 796 #define LL_ADC_INJ_TRIG_EXT_TIM4_TRGO (ADC_CR2_JEXTSEL_3 | ADC_CR2_JEXTSEL_0 | ADC_INJ_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group injected conversion trigger from external IP: TIM4 TRGO. Trigger edge set to rising edge (default setting). */
ganlikun 0:13413ea9a877 797 #define LL_ADC_INJ_TRIG_EXT_TIM5_CH4 (ADC_CR2_JEXTSEL_3 | ADC_CR2_JEXTSEL_1 | ADC_INJ_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group injected conversion trigger from external IP: TIM5 channel 4 event (capture compare: input capture or output capture). Trigger edge set to rising edge (default setting). */
ganlikun 0:13413ea9a877 798 #define LL_ADC_INJ_TRIG_EXT_TIM5_TRGO (ADC_CR2_JEXTSEL_3 | ADC_CR2_JEXTSEL_1 | ADC_CR2_JEXTSEL_0 | ADC_INJ_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group injected conversion trigger from external IP: TIM5 TRGO. Trigger edge set to rising edge (default setting). */
ganlikun 0:13413ea9a877 799 #define LL_ADC_INJ_TRIG_EXT_TIM8_CH2 (ADC_CR2_JEXTSEL_3 | ADC_CR2_JEXTSEL_2 | ADC_INJ_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group injected conversion trigger from external IP: TIM8 channel 2 event (capture compare: input capture or output capture). Trigger edge set to rising edge (default setting). */
ganlikun 0:13413ea9a877 800 #define LL_ADC_INJ_TRIG_EXT_TIM8_CH3 (ADC_CR2_JEXTSEL_3 | ADC_CR2_JEXTSEL_2 | ADC_CR2_JEXTSEL_0 | ADC_INJ_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group injected conversion trigger from external IP: TIM8 channel 3 event (capture compare: input capture or output capture). Trigger edge set to rising edge (default setting). */
ganlikun 0:13413ea9a877 801 #define LL_ADC_INJ_TRIG_EXT_TIM8_CH4 (ADC_CR2_JEXTSEL_3 | ADC_CR2_JEXTSEL_2 | ADC_CR2_JEXTSEL_1 | ADC_INJ_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group injected conversion trigger from external IP: TIM8 channel 4 event (capture compare: input capture or output capture). Trigger edge set to rising edge (default setting). */
ganlikun 0:13413ea9a877 802 #define LL_ADC_INJ_TRIG_EXT_EXTI_LINE15 (ADC_CR2_JEXTSEL_3 | ADC_CR2_JEXTSEL_2 | ADC_CR2_JEXTSEL_1 | ADC_CR2_JEXTSEL_0 | ADC_INJ_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group injected conversion trigger from external IP: external interrupt line 15. Trigger edge set to rising edge (default setting). */
ganlikun 0:13413ea9a877 803 /**
ganlikun 0:13413ea9a877 804 * @}
ganlikun 0:13413ea9a877 805 */
ganlikun 0:13413ea9a877 806
ganlikun 0:13413ea9a877 807 /** @defgroup ADC_LL_EC_INJ_TRIGGER_EDGE ADC group injected - Trigger edge
ganlikun 0:13413ea9a877 808 * @{
ganlikun 0:13413ea9a877 809 */
ganlikun 0:13413ea9a877 810 #define LL_ADC_INJ_TRIG_EXT_RISING ( ADC_CR2_JEXTEN_0) /*!< ADC group injected conversion trigger polarity set to rising edge */
ganlikun 0:13413ea9a877 811 #define LL_ADC_INJ_TRIG_EXT_FALLING (ADC_CR2_JEXTEN_1 ) /*!< ADC group injected conversion trigger polarity set to falling edge */
ganlikun 0:13413ea9a877 812 #define LL_ADC_INJ_TRIG_EXT_RISINGFALLING (ADC_CR2_JEXTEN_1 | ADC_CR2_JEXTEN_0) /*!< ADC group injected conversion trigger polarity set to both rising and falling edges */
ganlikun 0:13413ea9a877 813 /**
ganlikun 0:13413ea9a877 814 * @}
ganlikun 0:13413ea9a877 815 */
ganlikun 0:13413ea9a877 816
ganlikun 0:13413ea9a877 817 /** @defgroup ADC_LL_EC_INJ_TRIG_AUTO ADC group injected - Automatic trigger mode
ganlikun 0:13413ea9a877 818 * @{
ganlikun 0:13413ea9a877 819 */
ganlikun 0:13413ea9a877 820 #define LL_ADC_INJ_TRIG_INDEPENDENT 0x00000000U /*!< ADC group injected conversion trigger independent. Setting mandatory if ADC group injected injected trigger source is set to an external trigger. */
ganlikun 0:13413ea9a877 821 #define LL_ADC_INJ_TRIG_FROM_GRP_REGULAR (ADC_CR1_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. */
ganlikun 0:13413ea9a877 822 /**
ganlikun 0:13413ea9a877 823 * @}
ganlikun 0:13413ea9a877 824 */
ganlikun 0:13413ea9a877 825
ganlikun 0:13413ea9a877 826
ganlikun 0:13413ea9a877 827 /** @defgroup ADC_LL_EC_INJ_SEQ_SCAN_LENGTH ADC group injected - Sequencer scan length
ganlikun 0:13413ea9a877 828 * @{
ganlikun 0:13413ea9a877 829 */
ganlikun 0:13413ea9a877 830 #define LL_ADC_INJ_SEQ_SCAN_DISABLE 0x00000000U /*!< ADC group injected sequencer disable (equivalent to sequencer of 1 rank: ADC conversion on only 1 channel) */
ganlikun 0:13413ea9a877 831 #define LL_ADC_INJ_SEQ_SCAN_ENABLE_2RANKS ( ADC_JSQR_JL_0) /*!< ADC group injected sequencer enable with 2 ranks in the sequence */
ganlikun 0:13413ea9a877 832 #define LL_ADC_INJ_SEQ_SCAN_ENABLE_3RANKS (ADC_JSQR_JL_1 ) /*!< ADC group injected sequencer enable with 3 ranks in the sequence */
ganlikun 0:13413ea9a877 833 #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 */
ganlikun 0:13413ea9a877 834 /**
ganlikun 0:13413ea9a877 835 * @}
ganlikun 0:13413ea9a877 836 */
ganlikun 0:13413ea9a877 837
ganlikun 0:13413ea9a877 838 /** @defgroup ADC_LL_EC_INJ_SEQ_DISCONT_MODE ADC group injected - Sequencer discontinuous mode
ganlikun 0:13413ea9a877 839 * @{
ganlikun 0:13413ea9a877 840 */
ganlikun 0:13413ea9a877 841 #define LL_ADC_INJ_SEQ_DISCONT_DISABLE 0x00000000U /*!< ADC group injected sequencer discontinuous mode disable */
ganlikun 0:13413ea9a877 842 #define LL_ADC_INJ_SEQ_DISCONT_1RANK (ADC_CR1_JDISCEN) /*!< ADC group injected sequencer discontinuous mode enable with sequence interruption every rank */
ganlikun 0:13413ea9a877 843 /**
ganlikun 0:13413ea9a877 844 * @}
ganlikun 0:13413ea9a877 845 */
ganlikun 0:13413ea9a877 846
ganlikun 0:13413ea9a877 847 /** @defgroup ADC_LL_EC_INJ_SEQ_RANKS ADC group injected - Sequencer ranks
ganlikun 0:13413ea9a877 848 * @{
ganlikun 0:13413ea9a877 849 */
ganlikun 0:13413ea9a877 850 #define LL_ADC_INJ_RANK_1 (ADC_JDR1_REGOFFSET | ADC_JOFR1_REGOFFSET | 0x00000001U) /*!< ADC group injected sequencer rank 1 */
ganlikun 0:13413ea9a877 851 #define LL_ADC_INJ_RANK_2 (ADC_JDR2_REGOFFSET | ADC_JOFR2_REGOFFSET | 0x00000002U) /*!< ADC group injected sequencer rank 2 */
ganlikun 0:13413ea9a877 852 #define LL_ADC_INJ_RANK_3 (ADC_JDR3_REGOFFSET | ADC_JOFR3_REGOFFSET | 0x00000003U) /*!< ADC group injected sequencer rank 3 */
ganlikun 0:13413ea9a877 853 #define LL_ADC_INJ_RANK_4 (ADC_JDR4_REGOFFSET | ADC_JOFR4_REGOFFSET | 0x00000004U) /*!< ADC group injected sequencer rank 4 */
ganlikun 0:13413ea9a877 854 /**
ganlikun 0:13413ea9a877 855 * @}
ganlikun 0:13413ea9a877 856 */
ganlikun 0:13413ea9a877 857
ganlikun 0:13413ea9a877 858 /** @defgroup ADC_LL_EC_CHANNEL_SAMPLINGTIME Channel - Sampling time
ganlikun 0:13413ea9a877 859 * @{
ganlikun 0:13413ea9a877 860 */
ganlikun 0:13413ea9a877 861 #define LL_ADC_SAMPLINGTIME_3CYCLES 0x00000000U /*!< Sampling time 3 ADC clock cycles */
ganlikun 0:13413ea9a877 862 #define LL_ADC_SAMPLINGTIME_15CYCLES (ADC_SMPR1_SMP10_0) /*!< Sampling time 15 ADC clock cycles */
ganlikun 0:13413ea9a877 863 #define LL_ADC_SAMPLINGTIME_28CYCLES (ADC_SMPR1_SMP10_1) /*!< Sampling time 28 ADC clock cycles */
ganlikun 0:13413ea9a877 864 #define LL_ADC_SAMPLINGTIME_56CYCLES (ADC_SMPR1_SMP10_1 | ADC_SMPR1_SMP10_0) /*!< Sampling time 56 ADC clock cycles */
ganlikun 0:13413ea9a877 865 #define LL_ADC_SAMPLINGTIME_84CYCLES (ADC_SMPR1_SMP10_2) /*!< Sampling time 84 ADC clock cycles */
ganlikun 0:13413ea9a877 866 #define LL_ADC_SAMPLINGTIME_112CYCLES (ADC_SMPR1_SMP10_2 | ADC_SMPR1_SMP10_0) /*!< Sampling time 112 ADC clock cycles */
ganlikun 0:13413ea9a877 867 #define LL_ADC_SAMPLINGTIME_144CYCLES (ADC_SMPR1_SMP10_2 | ADC_SMPR1_SMP10_1) /*!< Sampling time 144 ADC clock cycles */
ganlikun 0:13413ea9a877 868 #define LL_ADC_SAMPLINGTIME_480CYCLES (ADC_SMPR1_SMP10) /*!< Sampling time 480 ADC clock cycles */
ganlikun 0:13413ea9a877 869 /**
ganlikun 0:13413ea9a877 870 * @}
ganlikun 0:13413ea9a877 871 */
ganlikun 0:13413ea9a877 872
ganlikun 0:13413ea9a877 873 /** @defgroup ADC_LL_EC_AWD_NUMBER Analog watchdog - Analog watchdog number
ganlikun 0:13413ea9a877 874 * @{
ganlikun 0:13413ea9a877 875 */
ganlikun 0:13413ea9a877 876 #define LL_ADC_AWD1 (ADC_AWD_CR1_CHANNEL_MASK | ADC_AWD_CR1_REGOFFSET) /*!< ADC analog watchdog number 1 */
ganlikun 0:13413ea9a877 877 /**
ganlikun 0:13413ea9a877 878 * @}
ganlikun 0:13413ea9a877 879 */
ganlikun 0:13413ea9a877 880
ganlikun 0:13413ea9a877 881 /** @defgroup ADC_LL_EC_AWD_CHANNELS Analog watchdog - Monitored channels
ganlikun 0:13413ea9a877 882 * @{
ganlikun 0:13413ea9a877 883 */
ganlikun 0:13413ea9a877 884 #define LL_ADC_AWD_DISABLE 0x00000000U /*!< ADC analog watchdog monitoring disabled */
ganlikun 0:13413ea9a877 885 #define LL_ADC_AWD_ALL_CHANNELS_REG ( ADC_CR1_AWDEN ) /*!< ADC analog watchdog monitoring of all channels, converted by group regular only */
ganlikun 0:13413ea9a877 886 #define LL_ADC_AWD_ALL_CHANNELS_INJ ( ADC_CR1_JAWDEN ) /*!< ADC analog watchdog monitoring of all channels, converted by group injected only */
ganlikun 0:13413ea9a877 887 #define LL_ADC_AWD_ALL_CHANNELS_REG_INJ ( ADC_CR1_JAWDEN | ADC_CR1_AWDEN ) /*!< ADC analog watchdog monitoring of all channels, converted by either group regular or injected */
ganlikun 0:13413ea9a877 888 #define LL_ADC_AWD_CHANNEL_0_REG ((LL_ADC_CHANNEL_0 & ADC_CHANNEL_ID_MASK) | ADC_CR1_AWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN0, converted by group regular only */
ganlikun 0:13413ea9a877 889 #define LL_ADC_AWD_CHANNEL_0_INJ ((LL_ADC_CHANNEL_0 & ADC_CHANNEL_ID_MASK) | ADC_CR1_JAWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN0, converted by group injected only */
ganlikun 0:13413ea9a877 890 #define LL_ADC_AWD_CHANNEL_0_REG_INJ ((LL_ADC_CHANNEL_0 & ADC_CHANNEL_ID_MASK) | ADC_CR1_JAWDEN | ADC_CR1_AWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN0, converted by either group regular or injected */
ganlikun 0:13413ea9a877 891 #define LL_ADC_AWD_CHANNEL_1_REG ((LL_ADC_CHANNEL_1 & ADC_CHANNEL_ID_MASK) | ADC_CR1_AWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN1, converted by group regular only */
ganlikun 0:13413ea9a877 892 #define LL_ADC_AWD_CHANNEL_1_INJ ((LL_ADC_CHANNEL_1 & ADC_CHANNEL_ID_MASK) | ADC_CR1_JAWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN1, converted by group injected only */
ganlikun 0:13413ea9a877 893 #define LL_ADC_AWD_CHANNEL_1_REG_INJ ((LL_ADC_CHANNEL_1 & ADC_CHANNEL_ID_MASK) | ADC_CR1_JAWDEN | ADC_CR1_AWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN1, converted by either group regular or injected */
ganlikun 0:13413ea9a877 894 #define LL_ADC_AWD_CHANNEL_2_REG ((LL_ADC_CHANNEL_2 & ADC_CHANNEL_ID_MASK) | ADC_CR1_AWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN2, converted by group regular only */
ganlikun 0:13413ea9a877 895 #define LL_ADC_AWD_CHANNEL_2_INJ ((LL_ADC_CHANNEL_2 & ADC_CHANNEL_ID_MASK) | ADC_CR1_JAWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN2, converted by group injected only */
ganlikun 0:13413ea9a877 896 #define LL_ADC_AWD_CHANNEL_2_REG_INJ ((LL_ADC_CHANNEL_2 & ADC_CHANNEL_ID_MASK) | ADC_CR1_JAWDEN | ADC_CR1_AWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN2, converted by either group regular or injected */
ganlikun 0:13413ea9a877 897 #define LL_ADC_AWD_CHANNEL_3_REG ((LL_ADC_CHANNEL_3 & ADC_CHANNEL_ID_MASK) | ADC_CR1_AWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN3, converted by group regular only */
ganlikun 0:13413ea9a877 898 #define LL_ADC_AWD_CHANNEL_3_INJ ((LL_ADC_CHANNEL_3 & ADC_CHANNEL_ID_MASK) | ADC_CR1_JAWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN3, converted by group injected only */
ganlikun 0:13413ea9a877 899 #define LL_ADC_AWD_CHANNEL_3_REG_INJ ((LL_ADC_CHANNEL_3 & ADC_CHANNEL_ID_MASK) | ADC_CR1_JAWDEN | ADC_CR1_AWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN3, converted by either group regular or injected */
ganlikun 0:13413ea9a877 900 #define LL_ADC_AWD_CHANNEL_4_REG ((LL_ADC_CHANNEL_4 & ADC_CHANNEL_ID_MASK) | ADC_CR1_AWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN4, converted by group regular only */
ganlikun 0:13413ea9a877 901 #define LL_ADC_AWD_CHANNEL_4_INJ ((LL_ADC_CHANNEL_4 & ADC_CHANNEL_ID_MASK) | ADC_CR1_JAWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN4, converted by group injected only */
ganlikun 0:13413ea9a877 902 #define LL_ADC_AWD_CHANNEL_4_REG_INJ ((LL_ADC_CHANNEL_4 & ADC_CHANNEL_ID_MASK) | ADC_CR1_JAWDEN | ADC_CR1_AWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN4, converted by either group regular or injected */
ganlikun 0:13413ea9a877 903 #define LL_ADC_AWD_CHANNEL_5_REG ((LL_ADC_CHANNEL_5 & ADC_CHANNEL_ID_MASK) | ADC_CR1_AWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN5, converted by group regular only */
ganlikun 0:13413ea9a877 904 #define LL_ADC_AWD_CHANNEL_5_INJ ((LL_ADC_CHANNEL_5 & ADC_CHANNEL_ID_MASK) | ADC_CR1_JAWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN5, converted by group injected only */
ganlikun 0:13413ea9a877 905 #define LL_ADC_AWD_CHANNEL_5_REG_INJ ((LL_ADC_CHANNEL_5 & ADC_CHANNEL_ID_MASK) | ADC_CR1_JAWDEN | ADC_CR1_AWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN5, converted by either group regular or injected */
ganlikun 0:13413ea9a877 906 #define LL_ADC_AWD_CHANNEL_6_REG ((LL_ADC_CHANNEL_6 & ADC_CHANNEL_ID_MASK) | ADC_CR1_AWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN6, converted by group regular only */
ganlikun 0:13413ea9a877 907 #define LL_ADC_AWD_CHANNEL_6_INJ ((LL_ADC_CHANNEL_6 & ADC_CHANNEL_ID_MASK) | ADC_CR1_JAWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN6, converted by group injected only */
ganlikun 0:13413ea9a877 908 #define LL_ADC_AWD_CHANNEL_6_REG_INJ ((LL_ADC_CHANNEL_6 & ADC_CHANNEL_ID_MASK) | ADC_CR1_JAWDEN | ADC_CR1_AWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN6, converted by either group regular or injected */
ganlikun 0:13413ea9a877 909 #define LL_ADC_AWD_CHANNEL_7_REG ((LL_ADC_CHANNEL_7 & ADC_CHANNEL_ID_MASK) | ADC_CR1_AWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN7, converted by group regular only */
ganlikun 0:13413ea9a877 910 #define LL_ADC_AWD_CHANNEL_7_INJ ((LL_ADC_CHANNEL_7 & ADC_CHANNEL_ID_MASK) | ADC_CR1_JAWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN7, converted by group injected only */
ganlikun 0:13413ea9a877 911 #define LL_ADC_AWD_CHANNEL_7_REG_INJ ((LL_ADC_CHANNEL_7 & ADC_CHANNEL_ID_MASK) | ADC_CR1_JAWDEN | ADC_CR1_AWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN7, converted by either group regular or injected */
ganlikun 0:13413ea9a877 912 #define LL_ADC_AWD_CHANNEL_8_REG ((LL_ADC_CHANNEL_8 & ADC_CHANNEL_ID_MASK) | ADC_CR1_AWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN8, converted by group regular only */
ganlikun 0:13413ea9a877 913 #define LL_ADC_AWD_CHANNEL_8_INJ ((LL_ADC_CHANNEL_8 & ADC_CHANNEL_ID_MASK) | ADC_CR1_JAWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN8, converted by group injected only */
ganlikun 0:13413ea9a877 914 #define LL_ADC_AWD_CHANNEL_8_REG_INJ ((LL_ADC_CHANNEL_8 & ADC_CHANNEL_ID_MASK) | ADC_CR1_JAWDEN | ADC_CR1_AWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN8, converted by either group regular or injected */
ganlikun 0:13413ea9a877 915 #define LL_ADC_AWD_CHANNEL_9_REG ((LL_ADC_CHANNEL_9 & ADC_CHANNEL_ID_MASK) | ADC_CR1_AWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN9, converted by group regular only */
ganlikun 0:13413ea9a877 916 #define LL_ADC_AWD_CHANNEL_9_INJ ((LL_ADC_CHANNEL_9 & ADC_CHANNEL_ID_MASK) | ADC_CR1_JAWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN9, converted by group injected only */
ganlikun 0:13413ea9a877 917 #define LL_ADC_AWD_CHANNEL_9_REG_INJ ((LL_ADC_CHANNEL_9 & ADC_CHANNEL_ID_MASK) | ADC_CR1_JAWDEN | ADC_CR1_AWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN9, converted by either group regular or injected */
ganlikun 0:13413ea9a877 918 #define LL_ADC_AWD_CHANNEL_10_REG ((LL_ADC_CHANNEL_10 & ADC_CHANNEL_ID_MASK) | ADC_CR1_AWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN10, converted by group regular only */
ganlikun 0:13413ea9a877 919 #define LL_ADC_AWD_CHANNEL_10_INJ ((LL_ADC_CHANNEL_10 & ADC_CHANNEL_ID_MASK) | ADC_CR1_JAWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN10, converted by group injected only */
ganlikun 0:13413ea9a877 920 #define LL_ADC_AWD_CHANNEL_10_REG_INJ ((LL_ADC_CHANNEL_10 & ADC_CHANNEL_ID_MASK) | ADC_CR1_JAWDEN | ADC_CR1_AWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN10, converted by either group regular or injected */
ganlikun 0:13413ea9a877 921 #define LL_ADC_AWD_CHANNEL_11_REG ((LL_ADC_CHANNEL_11 & ADC_CHANNEL_ID_MASK) | ADC_CR1_AWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN11, converted by group regular only */
ganlikun 0:13413ea9a877 922 #define LL_ADC_AWD_CHANNEL_11_INJ ((LL_ADC_CHANNEL_11 & ADC_CHANNEL_ID_MASK) | ADC_CR1_JAWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN11, converted by group injected only */
ganlikun 0:13413ea9a877 923 #define LL_ADC_AWD_CHANNEL_11_REG_INJ ((LL_ADC_CHANNEL_11 & ADC_CHANNEL_ID_MASK) | ADC_CR1_JAWDEN | ADC_CR1_AWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN11, converted by either group regular or injected */
ganlikun 0:13413ea9a877 924 #define LL_ADC_AWD_CHANNEL_12_REG ((LL_ADC_CHANNEL_12 & ADC_CHANNEL_ID_MASK) | ADC_CR1_AWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN12, converted by group regular only */
ganlikun 0:13413ea9a877 925 #define LL_ADC_AWD_CHANNEL_12_INJ ((LL_ADC_CHANNEL_12 & ADC_CHANNEL_ID_MASK) | ADC_CR1_JAWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN12, converted by group injected only */
ganlikun 0:13413ea9a877 926 #define LL_ADC_AWD_CHANNEL_12_REG_INJ ((LL_ADC_CHANNEL_12 & ADC_CHANNEL_ID_MASK) | ADC_CR1_JAWDEN | ADC_CR1_AWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN12, converted by either group regular or injected */
ganlikun 0:13413ea9a877 927 #define LL_ADC_AWD_CHANNEL_13_REG ((LL_ADC_CHANNEL_13 & ADC_CHANNEL_ID_MASK) | ADC_CR1_AWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN13, converted by group regular only */
ganlikun 0:13413ea9a877 928 #define LL_ADC_AWD_CHANNEL_13_INJ ((LL_ADC_CHANNEL_13 & ADC_CHANNEL_ID_MASK) | ADC_CR1_JAWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN13, converted by group injected only */
ganlikun 0:13413ea9a877 929 #define LL_ADC_AWD_CHANNEL_13_REG_INJ ((LL_ADC_CHANNEL_13 & ADC_CHANNEL_ID_MASK) | ADC_CR1_JAWDEN | ADC_CR1_AWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN13, converted by either group regular or injected */
ganlikun 0:13413ea9a877 930 #define LL_ADC_AWD_CHANNEL_14_REG ((LL_ADC_CHANNEL_14 & ADC_CHANNEL_ID_MASK) | ADC_CR1_AWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN14, converted by group regular only */
ganlikun 0:13413ea9a877 931 #define LL_ADC_AWD_CHANNEL_14_INJ ((LL_ADC_CHANNEL_14 & ADC_CHANNEL_ID_MASK) | ADC_CR1_JAWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN14, converted by group injected only */
ganlikun 0:13413ea9a877 932 #define LL_ADC_AWD_CHANNEL_14_REG_INJ ((LL_ADC_CHANNEL_14 & ADC_CHANNEL_ID_MASK) | ADC_CR1_JAWDEN | ADC_CR1_AWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN14, converted by either group regular or injected */
ganlikun 0:13413ea9a877 933 #define LL_ADC_AWD_CHANNEL_15_REG ((LL_ADC_CHANNEL_15 & ADC_CHANNEL_ID_MASK) | ADC_CR1_AWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN15, converted by group regular only */
ganlikun 0:13413ea9a877 934 #define LL_ADC_AWD_CHANNEL_15_INJ ((LL_ADC_CHANNEL_15 & ADC_CHANNEL_ID_MASK) | ADC_CR1_JAWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN15, converted by group injected only */
ganlikun 0:13413ea9a877 935 #define LL_ADC_AWD_CHANNEL_15_REG_INJ ((LL_ADC_CHANNEL_15 & ADC_CHANNEL_ID_MASK) | ADC_CR1_JAWDEN | ADC_CR1_AWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN15, converted by either group regular or injected */
ganlikun 0:13413ea9a877 936 #define LL_ADC_AWD_CHANNEL_16_REG ((LL_ADC_CHANNEL_16 & ADC_CHANNEL_ID_MASK) | ADC_CR1_AWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN16, converted by group regular only */
ganlikun 0:13413ea9a877 937 #define LL_ADC_AWD_CHANNEL_16_INJ ((LL_ADC_CHANNEL_16 & ADC_CHANNEL_ID_MASK) | ADC_CR1_JAWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN16, converted by group injected only */
ganlikun 0:13413ea9a877 938 #define LL_ADC_AWD_CHANNEL_16_REG_INJ ((LL_ADC_CHANNEL_16 & ADC_CHANNEL_ID_MASK) | ADC_CR1_JAWDEN | ADC_CR1_AWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN16, converted by either group regular or injected */
ganlikun 0:13413ea9a877 939 #define LL_ADC_AWD_CHANNEL_17_REG ((LL_ADC_CHANNEL_17 & ADC_CHANNEL_ID_MASK) | ADC_CR1_AWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN17, converted by group regular only */
ganlikun 0:13413ea9a877 940 #define LL_ADC_AWD_CHANNEL_17_INJ ((LL_ADC_CHANNEL_17 & ADC_CHANNEL_ID_MASK) | ADC_CR1_JAWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN17, converted by group injected only */
ganlikun 0:13413ea9a877 941 #define LL_ADC_AWD_CHANNEL_17_REG_INJ ((LL_ADC_CHANNEL_17 & ADC_CHANNEL_ID_MASK) | ADC_CR1_JAWDEN | ADC_CR1_AWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN17, converted by either group regular or injected */
ganlikun 0:13413ea9a877 942 #define LL_ADC_AWD_CHANNEL_18_REG ((LL_ADC_CHANNEL_18 & ADC_CHANNEL_ID_MASK) | ADC_CR1_AWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN18, converted by group regular only */
ganlikun 0:13413ea9a877 943 #define LL_ADC_AWD_CHANNEL_18_INJ ((LL_ADC_CHANNEL_18 & ADC_CHANNEL_ID_MASK) | ADC_CR1_JAWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN18, converted by group injected only */
ganlikun 0:13413ea9a877 944 #define LL_ADC_AWD_CHANNEL_18_REG_INJ ((LL_ADC_CHANNEL_18 & ADC_CHANNEL_ID_MASK) | ADC_CR1_JAWDEN | ADC_CR1_AWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN18, converted by either group regular or injected */
ganlikun 0:13413ea9a877 945 #define LL_ADC_AWD_CH_VREFINT_REG ((LL_ADC_CHANNEL_VREFINT & ADC_CHANNEL_ID_MASK) | ADC_CR1_AWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC internal channel connected to VrefInt: Internal voltage reference, converted by group regular only */
ganlikun 0:13413ea9a877 946 #define LL_ADC_AWD_CH_VREFINT_INJ ((LL_ADC_CHANNEL_VREFINT & ADC_CHANNEL_ID_MASK) | ADC_CR1_JAWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC internal channel connected to VrefInt: Internal voltage reference, converted by group injected only */
ganlikun 0:13413ea9a877 947 #define LL_ADC_AWD_CH_VREFINT_REG_INJ ((LL_ADC_CHANNEL_VREFINT & ADC_CHANNEL_ID_MASK) | ADC_CR1_JAWDEN | ADC_CR1_AWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC internal channel connected to VrefInt: Internal voltage reference, converted by either group regular or injected */
ganlikun 0:13413ea9a877 948 #define LL_ADC_AWD_CH_VBAT_REG ((LL_ADC_CHANNEL_VBAT & ADC_CHANNEL_ID_MASK) | ADC_CR1_AWDEN | ADC_CR1_AWDSGL) /*!< 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 */
ganlikun 0:13413ea9a877 949 #define LL_ADC_AWD_CH_VBAT_INJ ((LL_ADC_CHANNEL_VBAT & ADC_CHANNEL_ID_MASK) | ADC_CR1_JAWDEN | ADC_CR1_AWDSGL) /*!< 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 */
ganlikun 0:13413ea9a877 950 #define LL_ADC_AWD_CH_VBAT_REG_INJ ((LL_ADC_CHANNEL_VBAT & ADC_CHANNEL_ID_MASK) | ADC_CR1_JAWDEN | ADC_CR1_AWDEN | ADC_CR1_AWDSGL) /*!< 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 */
ganlikun 0:13413ea9a877 951 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx)
ganlikun 0:13413ea9a877 952 #define LL_ADC_AWD_CH_TEMPSENSOR_REG ((LL_ADC_CHANNEL_TEMPSENSOR & ADC_CHANNEL_ID_MASK) | ADC_CR1_AWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC internal channel connected to Temperature sensor, converted by group regular only */
ganlikun 0:13413ea9a877 953 #define LL_ADC_AWD_CH_TEMPSENSOR_INJ ((LL_ADC_CHANNEL_TEMPSENSOR & ADC_CHANNEL_ID_MASK) | ADC_CR1_JAWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC internal channel connected to Temperature sensor, converted by group injected only */
ganlikun 0:13413ea9a877 954 #define LL_ADC_AWD_CH_TEMPSENSOR_REG_INJ ((LL_ADC_CHANNEL_TEMPSENSOR & ADC_CHANNEL_ID_MASK) | ADC_CR1_JAWDEN | ADC_CR1_AWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC internal channel connected to Temperature sensor, converted by either group regular or injected */
ganlikun 0:13413ea9a877 955 #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F401xC || STM32F401xE || STM32F410xx */
ganlikun 0:13413ea9a877 956 #if defined(STM32F412Cx) || defined(STM32F412Rx) || defined(STM32F412Vx) || defined(STM32F412Zx) || defined(STM32F413xx) || defined(STM32F411xE) || defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx)
ganlikun 0:13413ea9a877 957 #define LL_ADC_AWD_CH_TEMPSENSOR_REG ((LL_ADC_CHANNEL_TEMPSENSOR & ADC_CHANNEL_ID_MASK) | ADC_CR1_AWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC internal channel connected to Temperature sensor, converted by group regular only. This internal channel is shared between temperature sensor and Vbat, only 1 measurement path must be enabled. */
ganlikun 0:13413ea9a877 958 #define LL_ADC_AWD_CH_TEMPSENSOR_INJ ((LL_ADC_CHANNEL_TEMPSENSOR & ADC_CHANNEL_ID_MASK) | ADC_CR1_JAWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC internal channel connected to Temperature sensor, converted by group injected only. This internal channel is shared between temperature sensor and Vbat, only 1 measurement path must be enabled. */
ganlikun 0:13413ea9a877 959 #define LL_ADC_AWD_CH_TEMPSENSOR_REG_INJ ((LL_ADC_CHANNEL_TEMPSENSOR & ADC_CHANNEL_ID_MASK) | ADC_CR1_JAWDEN | ADC_CR1_AWDEN | ADC_CR1_AWDSGL) /*!< ADC analog watchdog monitoring of ADC internal channel connected to Temperature sensor, converted by either group regular or injected. This internal channel is shared between temperature sensor and Vbat, only 1 measurement path must be enabled. */
ganlikun 0:13413ea9a877 960 #endif /* STM32F412Cx || STM32F412Rx || STM32F412Vx || STM32F412Zx || STM32F413xx || STM32F411xE || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */
ganlikun 0:13413ea9a877 961 /**
ganlikun 0:13413ea9a877 962 * @}
ganlikun 0:13413ea9a877 963 */
ganlikun 0:13413ea9a877 964
ganlikun 0:13413ea9a877 965 /** @defgroup ADC_LL_EC_AWD_THRESHOLDS Analog watchdog - Thresholds
ganlikun 0:13413ea9a877 966 * @{
ganlikun 0:13413ea9a877 967 */
ganlikun 0:13413ea9a877 968 #define LL_ADC_AWD_THRESHOLD_HIGH (ADC_AWD_TR1_HIGH_REGOFFSET) /*!< ADC analog watchdog threshold high */
ganlikun 0:13413ea9a877 969 #define LL_ADC_AWD_THRESHOLD_LOW (ADC_AWD_TR1_LOW_REGOFFSET) /*!< ADC analog watchdog threshold low */
ganlikun 0:13413ea9a877 970 /**
ganlikun 0:13413ea9a877 971 * @}
ganlikun 0:13413ea9a877 972 */
ganlikun 0:13413ea9a877 973
ganlikun 0:13413ea9a877 974 #if defined(ADC_MULTIMODE_SUPPORT)
ganlikun 0:13413ea9a877 975 /** @defgroup ADC_LL_EC_MULTI_MODE Multimode - Mode
ganlikun 0:13413ea9a877 976 * @{
ganlikun 0:13413ea9a877 977 */
ganlikun 0:13413ea9a877 978 #define LL_ADC_MULTI_INDEPENDENT 0x00000000U /*!< ADC dual mode disabled (ADC independent mode) */
ganlikun 0:13413ea9a877 979 #define LL_ADC_MULTI_DUAL_REG_SIMULT ( ADC_CCR_MULTI_2 | ADC_CCR_MULTI_1 ) /*!< ADC dual mode enabled: group regular simultaneous */
ganlikun 0:13413ea9a877 980 #define LL_ADC_MULTI_DUAL_REG_INTERL ( ADC_CCR_MULTI_2 | ADC_CCR_MULTI_1 | ADC_CCR_MULTI_0) /*!< ADC dual mode enabled: Combined group regular interleaved */
ganlikun 0:13413ea9a877 981 #define LL_ADC_MULTI_DUAL_INJ_SIMULT ( ADC_CCR_MULTI_2 | ADC_CCR_MULTI_0) /*!< ADC dual mode enabled: group injected simultaneous */
ganlikun 0:13413ea9a877 982 #define LL_ADC_MULTI_DUAL_INJ_ALTERN (ADC_CCR_MULTI_3 | ADC_CCR_MULTI_0) /*!< ADC dual mode enabled: group injected alternate trigger. Works only with external triggers (not internal SW start) */
ganlikun 0:13413ea9a877 983 #define LL_ADC_MULTI_DUAL_REG_SIM_INJ_SIM ( ADC_CCR_MULTI_0) /*!< ADC dual mode enabled: Combined group regular simultaneous + group injected simultaneous */
ganlikun 0:13413ea9a877 984 #define LL_ADC_MULTI_DUAL_REG_SIM_INJ_ALT ( ADC_CCR_MULTI_1 ) /*!< ADC dual mode enabled: Combined group regular simultaneous + group injected alternate trigger */
ganlikun 0:13413ea9a877 985 #define LL_ADC_MULTI_DUAL_REG_INT_INJ_SIM ( ADC_CCR_MULTI_1 | ADC_CCR_MULTI_0) /*!< ADC dual mode enabled: Combined group regular interleaved + group injected simultaneous */
ganlikun 0:13413ea9a877 986 #if defined(ADC3)
ganlikun 0:13413ea9a877 987 #define LL_ADC_MULTI_TRIPLE_REG_SIM_INJ_SIM (ADC_CCR_MULTI_4 | ADC_CCR_MULTI_0) /*!< ADC triple mode enabled: Combined group regular simultaneous + group injected simultaneous */
ganlikun 0:13413ea9a877 988 #define LL_ADC_MULTI_TRIPLE_REG_SIM_INJ_ALT (ADC_CCR_MULTI_4 | ADC_CCR_MULTI_1 ) /*!< ADC triple mode enabled: Combined group regular simultaneous + group injected alternate trigger */
ganlikun 0:13413ea9a877 989 #define LL_ADC_MULTI_TRIPLE_INJ_SIMULT (ADC_CCR_MULTI_4 | ADC_CCR_MULTI_2 | ADC_CCR_MULTI_0) /*!< ADC triple mode enabled: group injected simultaneous */
ganlikun 0:13413ea9a877 990 #define LL_ADC_MULTI_TRIPLE_REG_SIMULT (ADC_CCR_MULTI_4 | ADC_CCR_MULTI_2 | ADC_CCR_MULTI_1 ) /*!< ADC triple mode enabled: group regular simultaneous */
ganlikun 0:13413ea9a877 991 #define LL_ADC_MULTI_TRIPLE_REG_INTERL (ADC_CCR_MULTI_4 | ADC_CCR_MULTI_2 | ADC_CCR_MULTI_1 | ADC_CCR_MULTI_0) /*!< ADC triple mode enabled: Combined group regular interleaved */
ganlikun 0:13413ea9a877 992 #define LL_ADC_MULTI_TRIPLE_INJ_ALTERN (ADC_CCR_MULTI_4 | ADC_CCR_MULTI_0) /*!< ADC triple mode enabled: group injected alternate trigger. Works only with external triggers (not internal SW start) */
ganlikun 0:13413ea9a877 993 #endif
ganlikun 0:13413ea9a877 994 /**
ganlikun 0:13413ea9a877 995 * @}
ganlikun 0:13413ea9a877 996 */
ganlikun 0:13413ea9a877 997
ganlikun 0:13413ea9a877 998 /** @defgroup ADC_LL_EC_MULTI_DMA_TRANSFER Multimode - DMA transfer
ganlikun 0:13413ea9a877 999 * @{
ganlikun 0:13413ea9a877 1000 */
ganlikun 0:13413ea9a877 1001 #define LL_ADC_MULTI_REG_DMA_EACH_ADC 0x00000000U /*!< ADC multimode group regular conversions are transferred by DMA: each ADC uses its own DMA channel, with its individual DMA transfer settings */
ganlikun 0:13413ea9a877 1002 #define LL_ADC_MULTI_REG_DMA_LIMIT_1 ( ADC_CCR_DMA_0) /*!< ADC multimode group regular conversions are transferred by DMA, one DMA channel for all ADC instances (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 of DMA mode 1: 2 or 3 (dual or triple mode) half-words one by one, ADC1 then ADC2 then ADC3. */
ganlikun 0:13413ea9a877 1003 #define LL_ADC_MULTI_REG_DMA_LIMIT_2 ( ADC_CCR_DMA_1 ) /*!< ADC multimode group regular conversions are transferred by DMA, one DMA channel for all ADC instances (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 of DMA mode 2: 2 or 3 (dual or triple mode) half-words one by one, ADC2&1 then ADC1&3 then ADC3&2. */
ganlikun 0:13413ea9a877 1004 #define LL_ADC_MULTI_REG_DMA_LIMIT_3 ( ADC_CCR_DMA_0 | ADC_CCR_DMA_0) /*!< ADC multimode group regular conversions are transferred by DMA, one DMA channel for all ADC instances (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 of DMA mode 3: 2 or 3 (dual or triple mode) bytes one by one, ADC2&1 then ADC1&3 then ADC3&2. */
ganlikun 0:13413ea9a877 1005 #define LL_ADC_MULTI_REG_DMA_UNLMT_1 (ADC_CCR_DDS | ADC_CCR_DMA_0) /*!< ADC multimode group regular conversions are transferred by DMA, one DMA channel for all ADC instances (DMA of ADC master), in unlimited mode: DMA transfer requests are unlimited, whatever number of DMA data transferred (number of ADC conversions) is reached. This ADC mode is intended to be used with DMA mode non-circular. Setting of DMA mode 1: 2 or 3 (dual or triple mode) half-words one by one, ADC1 then ADC2 then ADC3. */
ganlikun 0:13413ea9a877 1006 #define LL_ADC_MULTI_REG_DMA_UNLMT_2 (ADC_CCR_DDS | ADC_CCR_DMA_1 ) /*!< ADC multimode group regular conversions are transferred by DMA, one DMA channel for all ADC instances (DMA of ADC master), in unlimited mode: DMA transfer requests are unlimited, whatever number of DMA data transferred (number of ADC conversions) is reached. This ADC mode is intended to be used with DMA mode non-circular. Setting of DMA mode 2: 2 or 3 (dual or triple mode) half-words by pairs, ADC2&1 then ADC1&3 then ADC3&2. */
ganlikun 0:13413ea9a877 1007 #define LL_ADC_MULTI_REG_DMA_UNLMT_3 (ADC_CCR_DDS | ADC_CCR_DMA_0 | ADC_CCR_DMA_0) /*!< ADC multimode group regular conversions are transferred by DMA, one DMA channel for all ADC instances (DMA of ADC master), in unlimited mode: DMA transfer requests are unlimited, whatever number of DMA data transferred (number of ADC conversions) is reached. This ADC mode is intended to be used with DMA mode non-circular. Setting of DMA mode 3: 2 or 3 (dual or triple mode) bytes one by one, ADC2&1 then ADC1&3 then ADC3&2. */
ganlikun 0:13413ea9a877 1008 /**
ganlikun 0:13413ea9a877 1009 * @}
ganlikun 0:13413ea9a877 1010 */
ganlikun 0:13413ea9a877 1011
ganlikun 0:13413ea9a877 1012 /** @defgroup ADC_LL_EC_MULTI_TWOSMP_DELAY Multimode - Delay between two sampling phases
ganlikun 0:13413ea9a877 1013 * @{
ganlikun 0:13413ea9a877 1014 */
ganlikun 0:13413ea9a877 1015 #define LL_ADC_MULTI_TWOSMP_DELAY_5CYCLES 0x00000000U /*!< ADC multimode delay between two sampling phases: 5 ADC clock cycles*/
ganlikun 0:13413ea9a877 1016 #define LL_ADC_MULTI_TWOSMP_DELAY_6CYCLES ( ADC_CCR_DELAY_0) /*!< ADC multimode delay between two sampling phases: 6 ADC clock cycles */
ganlikun 0:13413ea9a877 1017 #define LL_ADC_MULTI_TWOSMP_DELAY_7CYCLES ( ADC_CCR_DELAY_1 ) /*!< ADC multimode delay between two sampling phases: 7 ADC clock cycles */
ganlikun 0:13413ea9a877 1018 #define LL_ADC_MULTI_TWOSMP_DELAY_8CYCLES ( ADC_CCR_DELAY_1 | ADC_CCR_DELAY_0) /*!< ADC multimode delay between two sampling phases: 8 ADC clock cycles */
ganlikun 0:13413ea9a877 1019 #define LL_ADC_MULTI_TWOSMP_DELAY_9CYCLES ( ADC_CCR_DELAY_2 ) /*!< ADC multimode delay between two sampling phases: 9 ADC clock cycles */
ganlikun 0:13413ea9a877 1020 #define LL_ADC_MULTI_TWOSMP_DELAY_10CYCLES ( ADC_CCR_DELAY_2 | ADC_CCR_DELAY_0) /*!< ADC multimode delay between two sampling phases: 10 ADC clock cycles */
ganlikun 0:13413ea9a877 1021 #define LL_ADC_MULTI_TWOSMP_DELAY_11CYCLES ( ADC_CCR_DELAY_2 | ADC_CCR_DELAY_1 ) /*!< ADC multimode delay between two sampling phases: 11 ADC clock cycles */
ganlikun 0:13413ea9a877 1022 #define LL_ADC_MULTI_TWOSMP_DELAY_12CYCLES ( ADC_CCR_DELAY_2 | ADC_CCR_DELAY_1 | ADC_CCR_DELAY_0) /*!< ADC multimode delay between two sampling phases: 12 ADC clock cycles */
ganlikun 0:13413ea9a877 1023 #define LL_ADC_MULTI_TWOSMP_DELAY_13CYCLES (ADC_CCR_DELAY_3 ) /*!< ADC multimode delay between two sampling phases: 13 ADC clock cycles */
ganlikun 0:13413ea9a877 1024 #define LL_ADC_MULTI_TWOSMP_DELAY_14CYCLES (ADC_CCR_DELAY_3 | ADC_CCR_DELAY_0) /*!< ADC multimode delay between two sampling phases: 14 ADC clock cycles */
ganlikun 0:13413ea9a877 1025 #define LL_ADC_MULTI_TWOSMP_DELAY_15CYCLES (ADC_CCR_DELAY_3 | ADC_CCR_DELAY_1 ) /*!< ADC multimode delay between two sampling phases: 15 ADC clock cycles */
ganlikun 0:13413ea9a877 1026 #define LL_ADC_MULTI_TWOSMP_DELAY_16CYCLES (ADC_CCR_DELAY_3 | ADC_CCR_DELAY_1 | ADC_CCR_DELAY_0) /*!< ADC multimode delay between two sampling phases: 16 ADC clock cycles */
ganlikun 0:13413ea9a877 1027 #define LL_ADC_MULTI_TWOSMP_DELAY_17CYCLES (ADC_CCR_DELAY_3 | ADC_CCR_DELAY_2 ) /*!< ADC multimode delay between two sampling phases: 17 ADC clock cycles */
ganlikun 0:13413ea9a877 1028 #define LL_ADC_MULTI_TWOSMP_DELAY_18CYCLES (ADC_CCR_DELAY_3 | ADC_CCR_DELAY_2 | ADC_CCR_DELAY_0) /*!< ADC multimode delay between two sampling phases: 18 ADC clock cycles */
ganlikun 0:13413ea9a877 1029 #define LL_ADC_MULTI_TWOSMP_DELAY_19CYCLES (ADC_CCR_DELAY_3 | ADC_CCR_DELAY_2 | ADC_CCR_DELAY_1 ) /*!< ADC multimode delay between two sampling phases: 19 ADC clock cycles */
ganlikun 0:13413ea9a877 1030 #define LL_ADC_MULTI_TWOSMP_DELAY_20CYCLES (ADC_CCR_DELAY_3 | ADC_CCR_DELAY_2 | ADC_CCR_DELAY_1 | ADC_CCR_DELAY_0) /*!< ADC multimode delay between two sampling phases: 20 ADC clock cycles */
ganlikun 0:13413ea9a877 1031 /**
ganlikun 0:13413ea9a877 1032 * @}
ganlikun 0:13413ea9a877 1033 */
ganlikun 0:13413ea9a877 1034
ganlikun 0:13413ea9a877 1035 /** @defgroup ADC_LL_EC_MULTI_MASTER_SLAVE Multimode - ADC master or slave
ganlikun 0:13413ea9a877 1036 * @{
ganlikun 0:13413ea9a877 1037 */
ganlikun 0:13413ea9a877 1038 #define LL_ADC_MULTI_MASTER ( ADC_CDR_RDATA_MST) /*!< In multimode, selection among several ADC instances: ADC master */
ganlikun 0:13413ea9a877 1039 #define LL_ADC_MULTI_SLAVE (ADC_CDR_RDATA_SLV ) /*!< In multimode, selection among several ADC instances: ADC slave */
ganlikun 0:13413ea9a877 1040 #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 */
ganlikun 0:13413ea9a877 1041 /**
ganlikun 0:13413ea9a877 1042 * @}
ganlikun 0:13413ea9a877 1043 */
ganlikun 0:13413ea9a877 1044
ganlikun 0:13413ea9a877 1045 #endif /* ADC_MULTIMODE_SUPPORT */
ganlikun 0:13413ea9a877 1046
ganlikun 0:13413ea9a877 1047
ganlikun 0:13413ea9a877 1048 /** @defgroup ADC_LL_EC_HW_DELAYS Definitions of ADC hardware constraints delays
ganlikun 0:13413ea9a877 1049 * @note Only ADC IP HW delays are defined in ADC LL driver driver,
ganlikun 0:13413ea9a877 1050 * not timeout values.
ganlikun 0:13413ea9a877 1051 * For details on delays values, refer to descriptions in source code
ganlikun 0:13413ea9a877 1052 * above each literal definition.
ganlikun 0:13413ea9a877 1053 * @{
ganlikun 0:13413ea9a877 1054 */
ganlikun 0:13413ea9a877 1055
ganlikun 0:13413ea9a877 1056 /* Note: Only ADC IP HW delays are defined in ADC LL driver driver, */
ganlikun 0:13413ea9a877 1057 /* not timeout values. */
ganlikun 0:13413ea9a877 1058 /* Timeout values for ADC operations are dependent to device clock */
ganlikun 0:13413ea9a877 1059 /* configuration (system clock versus ADC clock), */
ganlikun 0:13413ea9a877 1060 /* and therefore must be defined in user application. */
ganlikun 0:13413ea9a877 1061 /* Indications for estimation of ADC timeout delays, for this */
ganlikun 0:13413ea9a877 1062 /* STM32 serie: */
ganlikun 0:13413ea9a877 1063 /* - ADC enable time: maximum delay is 2us */
ganlikun 0:13413ea9a877 1064 /* (refer to device datasheet, parameter "tSTAB") */
ganlikun 0:13413ea9a877 1065 /* - ADC conversion time: duration depending on ADC clock and ADC */
ganlikun 0:13413ea9a877 1066 /* configuration. */
ganlikun 0:13413ea9a877 1067 /* (refer to device reference manual, section "Timing") */
ganlikun 0:13413ea9a877 1068
ganlikun 0:13413ea9a877 1069 /* Delay for internal voltage reference stabilization time. */
ganlikun 0:13413ea9a877 1070 /* Delay set to maximum value (refer to device datasheet, */
ganlikun 0:13413ea9a877 1071 /* parameter "tSTART"). */
ganlikun 0:13413ea9a877 1072 /* Unit: us */
ganlikun 0:13413ea9a877 1073 #define LL_ADC_DELAY_VREFINT_STAB_US ( 10U) /*!< Delay for internal voltage reference stabilization time */
ganlikun 0:13413ea9a877 1074
ganlikun 0:13413ea9a877 1075 /* Delay for temperature sensor stabilization time. */
ganlikun 0:13413ea9a877 1076 /* Literal set to maximum value (refer to device datasheet, */
ganlikun 0:13413ea9a877 1077 /* parameter "tSTART"). */
ganlikun 0:13413ea9a877 1078 /* Unit: us */
ganlikun 0:13413ea9a877 1079 #define LL_ADC_DELAY_TEMPSENSOR_STAB_US ( 10U) /*!< Delay for internal voltage reference stabilization time */
ganlikun 0:13413ea9a877 1080
ganlikun 0:13413ea9a877 1081 /**
ganlikun 0:13413ea9a877 1082 * @}
ganlikun 0:13413ea9a877 1083 */
ganlikun 0:13413ea9a877 1084
ganlikun 0:13413ea9a877 1085 /**
ganlikun 0:13413ea9a877 1086 * @}
ganlikun 0:13413ea9a877 1087 */
ganlikun 0:13413ea9a877 1088
ganlikun 0:13413ea9a877 1089
ganlikun 0:13413ea9a877 1090 /* Exported macro ------------------------------------------------------------*/
ganlikun 0:13413ea9a877 1091 /** @defgroup ADC_LL_Exported_Macros ADC Exported Macros
ganlikun 0:13413ea9a877 1092 * @{
ganlikun 0:13413ea9a877 1093 */
ganlikun 0:13413ea9a877 1094
ganlikun 0:13413ea9a877 1095 /** @defgroup ADC_LL_EM_WRITE_READ Common write and read registers Macros
ganlikun 0:13413ea9a877 1096 * @{
ganlikun 0:13413ea9a877 1097 */
ganlikun 0:13413ea9a877 1098
ganlikun 0:13413ea9a877 1099 /**
ganlikun 0:13413ea9a877 1100 * @brief Write a value in ADC register
ganlikun 0:13413ea9a877 1101 * @param __INSTANCE__ ADC Instance
ganlikun 0:13413ea9a877 1102 * @param __REG__ Register to be written
ganlikun 0:13413ea9a877 1103 * @param __VALUE__ Value to be written in the register
ganlikun 0:13413ea9a877 1104 * @retval None
ganlikun 0:13413ea9a877 1105 */
ganlikun 0:13413ea9a877 1106 #define LL_ADC_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
ganlikun 0:13413ea9a877 1107
ganlikun 0:13413ea9a877 1108 /**
ganlikun 0:13413ea9a877 1109 * @brief Read a value in ADC register
ganlikun 0:13413ea9a877 1110 * @param __INSTANCE__ ADC Instance
ganlikun 0:13413ea9a877 1111 * @param __REG__ Register to be read
ganlikun 0:13413ea9a877 1112 * @retval Register value
ganlikun 0:13413ea9a877 1113 */
ganlikun 0:13413ea9a877 1114 #define LL_ADC_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
ganlikun 0:13413ea9a877 1115 /**
ganlikun 0:13413ea9a877 1116 * @}
ganlikun 0:13413ea9a877 1117 */
ganlikun 0:13413ea9a877 1118
ganlikun 0:13413ea9a877 1119 /** @defgroup ADC_LL_EM_HELPER_MACRO ADC helper macro
ganlikun 0:13413ea9a877 1120 * @{
ganlikun 0:13413ea9a877 1121 */
ganlikun 0:13413ea9a877 1122
ganlikun 0:13413ea9a877 1123 /**
ganlikun 0:13413ea9a877 1124 * @brief Helper macro to get ADC channel number in decimal format
ganlikun 0:13413ea9a877 1125 * from literals LL_ADC_CHANNEL_x.
ganlikun 0:13413ea9a877 1126 * @note Example:
ganlikun 0:13413ea9a877 1127 * __LL_ADC_CHANNEL_TO_DECIMAL_NB(LL_ADC_CHANNEL_4)
ganlikun 0:13413ea9a877 1128 * will return decimal number "4".
ganlikun 0:13413ea9a877 1129 * @note The input can be a value from functions where a channel
ganlikun 0:13413ea9a877 1130 * number is returned, either defined with number
ganlikun 0:13413ea9a877 1131 * or with bitfield (only one bit must be set).
ganlikun 0:13413ea9a877 1132 * @param __CHANNEL__ This parameter can be one of the following values:
ganlikun 0:13413ea9a877 1133 * @arg @ref LL_ADC_CHANNEL_0
ganlikun 0:13413ea9a877 1134 * @arg @ref LL_ADC_CHANNEL_1
ganlikun 0:13413ea9a877 1135 * @arg @ref LL_ADC_CHANNEL_2
ganlikun 0:13413ea9a877 1136 * @arg @ref LL_ADC_CHANNEL_3
ganlikun 0:13413ea9a877 1137 * @arg @ref LL_ADC_CHANNEL_4
ganlikun 0:13413ea9a877 1138 * @arg @ref LL_ADC_CHANNEL_5
ganlikun 0:13413ea9a877 1139 * @arg @ref LL_ADC_CHANNEL_6
ganlikun 0:13413ea9a877 1140 * @arg @ref LL_ADC_CHANNEL_7
ganlikun 0:13413ea9a877 1141 * @arg @ref LL_ADC_CHANNEL_8
ganlikun 0:13413ea9a877 1142 * @arg @ref LL_ADC_CHANNEL_9
ganlikun 0:13413ea9a877 1143 * @arg @ref LL_ADC_CHANNEL_10
ganlikun 0:13413ea9a877 1144 * @arg @ref LL_ADC_CHANNEL_11
ganlikun 0:13413ea9a877 1145 * @arg @ref LL_ADC_CHANNEL_12
ganlikun 0:13413ea9a877 1146 * @arg @ref LL_ADC_CHANNEL_13
ganlikun 0:13413ea9a877 1147 * @arg @ref LL_ADC_CHANNEL_14
ganlikun 0:13413ea9a877 1148 * @arg @ref LL_ADC_CHANNEL_15
ganlikun 0:13413ea9a877 1149 * @arg @ref LL_ADC_CHANNEL_16
ganlikun 0:13413ea9a877 1150 * @arg @ref LL_ADC_CHANNEL_17
ganlikun 0:13413ea9a877 1151 * @arg @ref LL_ADC_CHANNEL_18
ganlikun 0:13413ea9a877 1152 * @arg @ref LL_ADC_CHANNEL_VREFINT (1)
ganlikun 0:13413ea9a877 1153 * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR (1)(2)
ganlikun 0:13413ea9a877 1154 * @arg @ref LL_ADC_CHANNEL_VBAT (1)
ganlikun 0:13413ea9a877 1155 *
ganlikun 0:13413ea9a877 1156 * (1) On STM32F4, parameter available only on ADC instance: ADC1.\n
ganlikun 0:13413ea9a877 1157 * (2) On devices STM32F42x and STM32F43x, limitation: this internal channel is shared between temperature sensor and Vbat, only 1 measurement path must be enabled.
ganlikun 0:13413ea9a877 1158 * @retval Value between Min_Data=0 and Max_Data=18
ganlikun 0:13413ea9a877 1159 */
ganlikun 0:13413ea9a877 1160 #define __LL_ADC_CHANNEL_TO_DECIMAL_NB(__CHANNEL__) \
ganlikun 0:13413ea9a877 1161 (((__CHANNEL__) & ADC_CHANNEL_ID_NUMBER_MASK) >> ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS)
ganlikun 0:13413ea9a877 1162
ganlikun 0:13413ea9a877 1163 /**
ganlikun 0:13413ea9a877 1164 * @brief Helper macro to get ADC channel in literal format LL_ADC_CHANNEL_x
ganlikun 0:13413ea9a877 1165 * from number in decimal format.
ganlikun 0:13413ea9a877 1166 * @note Example:
ganlikun 0:13413ea9a877 1167 * __LL_ADC_DECIMAL_NB_TO_CHANNEL(4)
ganlikun 0:13413ea9a877 1168 * will return a data equivalent to "LL_ADC_CHANNEL_4".
ganlikun 0:13413ea9a877 1169 * @param __DECIMAL_NB__: Value between Min_Data=0 and Max_Data=18
ganlikun 0:13413ea9a877 1170 * @retval Returned value can be one of the following values:
ganlikun 0:13413ea9a877 1171 * @arg @ref LL_ADC_CHANNEL_0
ganlikun 0:13413ea9a877 1172 * @arg @ref LL_ADC_CHANNEL_1
ganlikun 0:13413ea9a877 1173 * @arg @ref LL_ADC_CHANNEL_2
ganlikun 0:13413ea9a877 1174 * @arg @ref LL_ADC_CHANNEL_3
ganlikun 0:13413ea9a877 1175 * @arg @ref LL_ADC_CHANNEL_4
ganlikun 0:13413ea9a877 1176 * @arg @ref LL_ADC_CHANNEL_5
ganlikun 0:13413ea9a877 1177 * @arg @ref LL_ADC_CHANNEL_6
ganlikun 0:13413ea9a877 1178 * @arg @ref LL_ADC_CHANNEL_7
ganlikun 0:13413ea9a877 1179 * @arg @ref LL_ADC_CHANNEL_8
ganlikun 0:13413ea9a877 1180 * @arg @ref LL_ADC_CHANNEL_9
ganlikun 0:13413ea9a877 1181 * @arg @ref LL_ADC_CHANNEL_10
ganlikun 0:13413ea9a877 1182 * @arg @ref LL_ADC_CHANNEL_11
ganlikun 0:13413ea9a877 1183 * @arg @ref LL_ADC_CHANNEL_12
ganlikun 0:13413ea9a877 1184 * @arg @ref LL_ADC_CHANNEL_13
ganlikun 0:13413ea9a877 1185 * @arg @ref LL_ADC_CHANNEL_14
ganlikun 0:13413ea9a877 1186 * @arg @ref LL_ADC_CHANNEL_15
ganlikun 0:13413ea9a877 1187 * @arg @ref LL_ADC_CHANNEL_16
ganlikun 0:13413ea9a877 1188 * @arg @ref LL_ADC_CHANNEL_17
ganlikun 0:13413ea9a877 1189 * @arg @ref LL_ADC_CHANNEL_18
ganlikun 0:13413ea9a877 1190 * @arg @ref LL_ADC_CHANNEL_VREFINT (1)
ganlikun 0:13413ea9a877 1191 * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR (1)(2)
ganlikun 0:13413ea9a877 1192 * @arg @ref LL_ADC_CHANNEL_VBAT (1)
ganlikun 0:13413ea9a877 1193 *
ganlikun 0:13413ea9a877 1194 * (1) On STM32F4, parameter available only on ADC instance: ADC1.\n
ganlikun 0:13413ea9a877 1195 * (2) On devices STM32F42x and STM32F43x, limitation: this internal channel is shared between temperature sensor and Vbat, only 1 measurement path must be enabled.\n
ganlikun 0:13413ea9a877 1196 * (1) For ADC channel read back from ADC register,
ganlikun 0:13413ea9a877 1197 * comparison with internal channel parameter to be done
ganlikun 0:13413ea9a877 1198 * using helper macro @ref __LL_ADC_CHANNEL_INTERNAL_TO_EXTERNAL().
ganlikun 0:13413ea9a877 1199 */
ganlikun 0:13413ea9a877 1200 #define __LL_ADC_DECIMAL_NB_TO_CHANNEL(__DECIMAL_NB__) \
ganlikun 0:13413ea9a877 1201 (((__DECIMAL_NB__) <= 9U) \
ganlikun 0:13413ea9a877 1202 ? ( \
ganlikun 0:13413ea9a877 1203 ((__DECIMAL_NB__) << ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS) | \
ganlikun 0:13413ea9a877 1204 (ADC_SMPR2_REGOFFSET | (((uint32_t) (3U * (__DECIMAL_NB__))) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) \
ganlikun 0:13413ea9a877 1205 ) \
ganlikun 0:13413ea9a877 1206 : \
ganlikun 0:13413ea9a877 1207 ( \
ganlikun 0:13413ea9a877 1208 ((__DECIMAL_NB__) << ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS) | \
ganlikun 0:13413ea9a877 1209 (ADC_SMPR1_REGOFFSET | (((uint32_t) (3U * ((__DECIMAL_NB__) - 10U))) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) \
ganlikun 0:13413ea9a877 1210 ) \
ganlikun 0:13413ea9a877 1211 )
ganlikun 0:13413ea9a877 1212
ganlikun 0:13413ea9a877 1213 /**
ganlikun 0:13413ea9a877 1214 * @brief Helper macro to determine whether the selected channel
ganlikun 0:13413ea9a877 1215 * corresponds to literal definitions of driver.
ganlikun 0:13413ea9a877 1216 * @note The different literal definitions of ADC channels are:
ganlikun 0:13413ea9a877 1217 * - ADC internal channel:
ganlikun 0:13413ea9a877 1218 * LL_ADC_CHANNEL_VREFINT, LL_ADC_CHANNEL_TEMPSENSOR, ...
ganlikun 0:13413ea9a877 1219 * - ADC external channel (channel connected to a GPIO pin):
ganlikun 0:13413ea9a877 1220 * LL_ADC_CHANNEL_1, LL_ADC_CHANNEL_2, ...
ganlikun 0:13413ea9a877 1221 * @note The channel parameter must be a value defined from literal
ganlikun 0:13413ea9a877 1222 * definition of a ADC internal channel (LL_ADC_CHANNEL_VREFINT,
ganlikun 0:13413ea9a877 1223 * LL_ADC_CHANNEL_TEMPSENSOR, ...),
ganlikun 0:13413ea9a877 1224 * ADC external channel (LL_ADC_CHANNEL_1, LL_ADC_CHANNEL_2, ...),
ganlikun 0:13413ea9a877 1225 * must not be a value from functions where a channel number is
ganlikun 0:13413ea9a877 1226 * returned from ADC registers,
ganlikun 0:13413ea9a877 1227 * because internal and external channels share the same channel
ganlikun 0:13413ea9a877 1228 * number in ADC registers. The differentiation is made only with
ganlikun 0:13413ea9a877 1229 * parameters definitions of driver.
ganlikun 0:13413ea9a877 1230 * @param __CHANNEL__ This parameter can be one of the following values:
ganlikun 0:13413ea9a877 1231 * @arg @ref LL_ADC_CHANNEL_0
ganlikun 0:13413ea9a877 1232 * @arg @ref LL_ADC_CHANNEL_1
ganlikun 0:13413ea9a877 1233 * @arg @ref LL_ADC_CHANNEL_2
ganlikun 0:13413ea9a877 1234 * @arg @ref LL_ADC_CHANNEL_3
ganlikun 0:13413ea9a877 1235 * @arg @ref LL_ADC_CHANNEL_4
ganlikun 0:13413ea9a877 1236 * @arg @ref LL_ADC_CHANNEL_5
ganlikun 0:13413ea9a877 1237 * @arg @ref LL_ADC_CHANNEL_6
ganlikun 0:13413ea9a877 1238 * @arg @ref LL_ADC_CHANNEL_7
ganlikun 0:13413ea9a877 1239 * @arg @ref LL_ADC_CHANNEL_8
ganlikun 0:13413ea9a877 1240 * @arg @ref LL_ADC_CHANNEL_9
ganlikun 0:13413ea9a877 1241 * @arg @ref LL_ADC_CHANNEL_10
ganlikun 0:13413ea9a877 1242 * @arg @ref LL_ADC_CHANNEL_11
ganlikun 0:13413ea9a877 1243 * @arg @ref LL_ADC_CHANNEL_12
ganlikun 0:13413ea9a877 1244 * @arg @ref LL_ADC_CHANNEL_13
ganlikun 0:13413ea9a877 1245 * @arg @ref LL_ADC_CHANNEL_14
ganlikun 0:13413ea9a877 1246 * @arg @ref LL_ADC_CHANNEL_15
ganlikun 0:13413ea9a877 1247 * @arg @ref LL_ADC_CHANNEL_16
ganlikun 0:13413ea9a877 1248 * @arg @ref LL_ADC_CHANNEL_17
ganlikun 0:13413ea9a877 1249 * @arg @ref LL_ADC_CHANNEL_18
ganlikun 0:13413ea9a877 1250 * @arg @ref LL_ADC_CHANNEL_VREFINT (1)
ganlikun 0:13413ea9a877 1251 * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR (1)(2)
ganlikun 0:13413ea9a877 1252 * @arg @ref LL_ADC_CHANNEL_VBAT (1)
ganlikun 0:13413ea9a877 1253 *
ganlikun 0:13413ea9a877 1254 * (1) On STM32F4, parameter available only on ADC instance: ADC1.\n
ganlikun 0:13413ea9a877 1255 * (2) On devices STM32F42x and STM32F43x, limitation: this internal channel is shared between temperature sensor and Vbat, only 1 measurement path must be enabled.
ganlikun 0:13413ea9a877 1256 * @retval Value "0" if the channel corresponds to a parameter definition of a ADC external channel (channel connected to a GPIO pin).
ganlikun 0:13413ea9a877 1257 * Value "1" if the channel corresponds to a parameter definition of a ADC internal channel.
ganlikun 0:13413ea9a877 1258 */
ganlikun 0:13413ea9a877 1259 #define __LL_ADC_IS_CHANNEL_INTERNAL(__CHANNEL__) \
ganlikun 0:13413ea9a877 1260 (((__CHANNEL__) & ADC_CHANNEL_ID_INTERNAL_CH_MASK) != 0U)
ganlikun 0:13413ea9a877 1261
ganlikun 0:13413ea9a877 1262 /**
ganlikun 0:13413ea9a877 1263 * @brief Helper macro to convert a channel defined from parameter
ganlikun 0:13413ea9a877 1264 * definition of a ADC internal channel (LL_ADC_CHANNEL_VREFINT,
ganlikun 0:13413ea9a877 1265 * LL_ADC_CHANNEL_TEMPSENSOR, ...),
ganlikun 0:13413ea9a877 1266 * to its equivalent parameter definition of a ADC external channel
ganlikun 0:13413ea9a877 1267 * (LL_ADC_CHANNEL_1, LL_ADC_CHANNEL_2, ...).
ganlikun 0:13413ea9a877 1268 * @note The channel parameter can be, additionally to a value
ganlikun 0:13413ea9a877 1269 * defined from parameter definition of a ADC internal channel
ganlikun 0:13413ea9a877 1270 * (LL_ADC_CHANNEL_VREFINT, LL_ADC_CHANNEL_TEMPSENSOR, ...),
ganlikun 0:13413ea9a877 1271 * a value defined from parameter definition of
ganlikun 0:13413ea9a877 1272 * ADC external channel (LL_ADC_CHANNEL_1, LL_ADC_CHANNEL_2, ...)
ganlikun 0:13413ea9a877 1273 * or a value from functions where a channel number is returned
ganlikun 0:13413ea9a877 1274 * from ADC registers.
ganlikun 0:13413ea9a877 1275 * @param __CHANNEL__ This parameter can be one of the following values:
ganlikun 0:13413ea9a877 1276 * @arg @ref LL_ADC_CHANNEL_0
ganlikun 0:13413ea9a877 1277 * @arg @ref LL_ADC_CHANNEL_1
ganlikun 0:13413ea9a877 1278 * @arg @ref LL_ADC_CHANNEL_2
ganlikun 0:13413ea9a877 1279 * @arg @ref LL_ADC_CHANNEL_3
ganlikun 0:13413ea9a877 1280 * @arg @ref LL_ADC_CHANNEL_4
ganlikun 0:13413ea9a877 1281 * @arg @ref LL_ADC_CHANNEL_5
ganlikun 0:13413ea9a877 1282 * @arg @ref LL_ADC_CHANNEL_6
ganlikun 0:13413ea9a877 1283 * @arg @ref LL_ADC_CHANNEL_7
ganlikun 0:13413ea9a877 1284 * @arg @ref LL_ADC_CHANNEL_8
ganlikun 0:13413ea9a877 1285 * @arg @ref LL_ADC_CHANNEL_9
ganlikun 0:13413ea9a877 1286 * @arg @ref LL_ADC_CHANNEL_10
ganlikun 0:13413ea9a877 1287 * @arg @ref LL_ADC_CHANNEL_11
ganlikun 0:13413ea9a877 1288 * @arg @ref LL_ADC_CHANNEL_12
ganlikun 0:13413ea9a877 1289 * @arg @ref LL_ADC_CHANNEL_13
ganlikun 0:13413ea9a877 1290 * @arg @ref LL_ADC_CHANNEL_14
ganlikun 0:13413ea9a877 1291 * @arg @ref LL_ADC_CHANNEL_15
ganlikun 0:13413ea9a877 1292 * @arg @ref LL_ADC_CHANNEL_16
ganlikun 0:13413ea9a877 1293 * @arg @ref LL_ADC_CHANNEL_17
ganlikun 0:13413ea9a877 1294 * @arg @ref LL_ADC_CHANNEL_18
ganlikun 0:13413ea9a877 1295 * @arg @ref LL_ADC_CHANNEL_VREFINT (1)
ganlikun 0:13413ea9a877 1296 * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR (1)(2)
ganlikun 0:13413ea9a877 1297 * @arg @ref LL_ADC_CHANNEL_VBAT (1)
ganlikun 0:13413ea9a877 1298 *
ganlikun 0:13413ea9a877 1299 * (1) On STM32F4, parameter available only on ADC instance: ADC1.\n
ganlikun 0:13413ea9a877 1300 * (2) On devices STM32F42x and STM32F43x, limitation: this internal channel is shared between temperature sensor and Vbat, only 1 measurement path must be enabled.
ganlikun 0:13413ea9a877 1301 * @retval Returned value can be one of the following values:
ganlikun 0:13413ea9a877 1302 * @arg @ref LL_ADC_CHANNEL_0
ganlikun 0:13413ea9a877 1303 * @arg @ref LL_ADC_CHANNEL_1
ganlikun 0:13413ea9a877 1304 * @arg @ref LL_ADC_CHANNEL_2
ganlikun 0:13413ea9a877 1305 * @arg @ref LL_ADC_CHANNEL_3
ganlikun 0:13413ea9a877 1306 * @arg @ref LL_ADC_CHANNEL_4
ganlikun 0:13413ea9a877 1307 * @arg @ref LL_ADC_CHANNEL_5
ganlikun 0:13413ea9a877 1308 * @arg @ref LL_ADC_CHANNEL_6
ganlikun 0:13413ea9a877 1309 * @arg @ref LL_ADC_CHANNEL_7
ganlikun 0:13413ea9a877 1310 * @arg @ref LL_ADC_CHANNEL_8
ganlikun 0:13413ea9a877 1311 * @arg @ref LL_ADC_CHANNEL_9
ganlikun 0:13413ea9a877 1312 * @arg @ref LL_ADC_CHANNEL_10
ganlikun 0:13413ea9a877 1313 * @arg @ref LL_ADC_CHANNEL_11
ganlikun 0:13413ea9a877 1314 * @arg @ref LL_ADC_CHANNEL_12
ganlikun 0:13413ea9a877 1315 * @arg @ref LL_ADC_CHANNEL_13
ganlikun 0:13413ea9a877 1316 * @arg @ref LL_ADC_CHANNEL_14
ganlikun 0:13413ea9a877 1317 * @arg @ref LL_ADC_CHANNEL_15
ganlikun 0:13413ea9a877 1318 * @arg @ref LL_ADC_CHANNEL_16
ganlikun 0:13413ea9a877 1319 * @arg @ref LL_ADC_CHANNEL_17
ganlikun 0:13413ea9a877 1320 * @arg @ref LL_ADC_CHANNEL_18
ganlikun 0:13413ea9a877 1321 */
ganlikun 0:13413ea9a877 1322 #define __LL_ADC_CHANNEL_INTERNAL_TO_EXTERNAL(__CHANNEL__) \
ganlikun 0:13413ea9a877 1323 ((__CHANNEL__) & ~ADC_CHANNEL_ID_INTERNAL_CH_MASK)
ganlikun 0:13413ea9a877 1324
ganlikun 0:13413ea9a877 1325 /**
ganlikun 0:13413ea9a877 1326 * @brief Helper macro to determine whether the internal channel
ganlikun 0:13413ea9a877 1327 * selected is available on the ADC instance selected.
ganlikun 0:13413ea9a877 1328 * @note The channel parameter must be a value defined from parameter
ganlikun 0:13413ea9a877 1329 * definition of a ADC internal channel (LL_ADC_CHANNEL_VREFINT,
ganlikun 0:13413ea9a877 1330 * LL_ADC_CHANNEL_TEMPSENSOR, ...),
ganlikun 0:13413ea9a877 1331 * must not be a value defined from parameter definition of
ganlikun 0:13413ea9a877 1332 * ADC external channel (LL_ADC_CHANNEL_1, LL_ADC_CHANNEL_2, ...)
ganlikun 0:13413ea9a877 1333 * or a value from functions where a channel number is
ganlikun 0:13413ea9a877 1334 * returned from ADC registers,
ganlikun 0:13413ea9a877 1335 * because internal and external channels share the same channel
ganlikun 0:13413ea9a877 1336 * number in ADC registers. The differentiation is made only with
ganlikun 0:13413ea9a877 1337 * parameters definitions of driver.
ganlikun 0:13413ea9a877 1338 * @param __ADC_INSTANCE__ ADC instance
ganlikun 0:13413ea9a877 1339 * @param __CHANNEL__ This parameter can be one of the following values:
ganlikun 0:13413ea9a877 1340 * @arg @ref LL_ADC_CHANNEL_VREFINT (1)
ganlikun 0:13413ea9a877 1341 * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR (1)(2)
ganlikun 0:13413ea9a877 1342 * @arg @ref LL_ADC_CHANNEL_VBAT (1)
ganlikun 0:13413ea9a877 1343 *
ganlikun 0:13413ea9a877 1344 * (1) On STM32F4, parameter available only on ADC instance: ADC1.
ganlikun 0:13413ea9a877 1345 * (2) On devices STM32F42x and STM32F43x, limitation: this internal channel is shared between temperature sensor and Vbat, only 1 measurement path must be enabled.
ganlikun 0:13413ea9a877 1346 * @retval Value "0" if the internal channel selected is not available on the ADC instance selected.
ganlikun 0:13413ea9a877 1347 * Value "1" if the internal channel selected is available on the ADC instance selected.
ganlikun 0:13413ea9a877 1348 */
ganlikun 0:13413ea9a877 1349 #define __LL_ADC_IS_CHANNEL_INTERNAL_AVAILABLE(__ADC_INSTANCE__, __CHANNEL__) \
ganlikun 0:13413ea9a877 1350 ( \
ganlikun 0:13413ea9a877 1351 ((__CHANNEL__) == LL_ADC_CHANNEL_VREFINT) || \
ganlikun 0:13413ea9a877 1352 ((__CHANNEL__) == LL_ADC_CHANNEL_TEMPSENSOR) || \
ganlikun 0:13413ea9a877 1353 ((__CHANNEL__) == LL_ADC_CHANNEL_VBAT) \
ganlikun 0:13413ea9a877 1354 )
ganlikun 0:13413ea9a877 1355 /**
ganlikun 0:13413ea9a877 1356 * @brief Helper macro to define ADC analog watchdog parameter:
ganlikun 0:13413ea9a877 1357 * define a single channel to monitor with analog watchdog
ganlikun 0:13413ea9a877 1358 * from sequencer channel and groups definition.
ganlikun 0:13413ea9a877 1359 * @note To be used with function @ref LL_ADC_SetAnalogWDMonitChannels().
ganlikun 0:13413ea9a877 1360 * Example:
ganlikun 0:13413ea9a877 1361 * LL_ADC_SetAnalogWDMonitChannels(
ganlikun 0:13413ea9a877 1362 * ADC1, LL_ADC_AWD1,
ganlikun 0:13413ea9a877 1363 * __LL_ADC_ANALOGWD_CHANNEL_GROUP(LL_ADC_CHANNEL4, LL_ADC_GROUP_REGULAR))
ganlikun 0:13413ea9a877 1364 * @param __CHANNEL__ This parameter can be one of the following values:
ganlikun 0:13413ea9a877 1365 * @arg @ref LL_ADC_CHANNEL_0
ganlikun 0:13413ea9a877 1366 * @arg @ref LL_ADC_CHANNEL_1
ganlikun 0:13413ea9a877 1367 * @arg @ref LL_ADC_CHANNEL_2
ganlikun 0:13413ea9a877 1368 * @arg @ref LL_ADC_CHANNEL_3
ganlikun 0:13413ea9a877 1369 * @arg @ref LL_ADC_CHANNEL_4
ganlikun 0:13413ea9a877 1370 * @arg @ref LL_ADC_CHANNEL_5
ganlikun 0:13413ea9a877 1371 * @arg @ref LL_ADC_CHANNEL_6
ganlikun 0:13413ea9a877 1372 * @arg @ref LL_ADC_CHANNEL_7
ganlikun 0:13413ea9a877 1373 * @arg @ref LL_ADC_CHANNEL_8
ganlikun 0:13413ea9a877 1374 * @arg @ref LL_ADC_CHANNEL_9
ganlikun 0:13413ea9a877 1375 * @arg @ref LL_ADC_CHANNEL_10
ganlikun 0:13413ea9a877 1376 * @arg @ref LL_ADC_CHANNEL_11
ganlikun 0:13413ea9a877 1377 * @arg @ref LL_ADC_CHANNEL_12
ganlikun 0:13413ea9a877 1378 * @arg @ref LL_ADC_CHANNEL_13
ganlikun 0:13413ea9a877 1379 * @arg @ref LL_ADC_CHANNEL_14
ganlikun 0:13413ea9a877 1380 * @arg @ref LL_ADC_CHANNEL_15
ganlikun 0:13413ea9a877 1381 * @arg @ref LL_ADC_CHANNEL_16
ganlikun 0:13413ea9a877 1382 * @arg @ref LL_ADC_CHANNEL_17
ganlikun 0:13413ea9a877 1383 * @arg @ref LL_ADC_CHANNEL_18
ganlikun 0:13413ea9a877 1384 * @arg @ref LL_ADC_CHANNEL_VREFINT (1)
ganlikun 0:13413ea9a877 1385 * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR (1)(2)
ganlikun 0:13413ea9a877 1386 * @arg @ref LL_ADC_CHANNEL_VBAT (1)
ganlikun 0:13413ea9a877 1387 *
ganlikun 0:13413ea9a877 1388 * (1) On STM32F4, parameter available only on ADC instance: ADC1.\n
ganlikun 0:13413ea9a877 1389 * (2) On devices STM32F42x and STM32F43x, limitation: this internal channel is shared between temperature sensor and Vbat, only 1 measurement path must be enabled.\n
ganlikun 0:13413ea9a877 1390 * (1) For ADC channel read back from ADC register,
ganlikun 0:13413ea9a877 1391 * comparison with internal channel parameter to be done
ganlikun 0:13413ea9a877 1392 * using helper macro @ref __LL_ADC_CHANNEL_INTERNAL_TO_EXTERNAL().
ganlikun 0:13413ea9a877 1393 * @param __GROUP__ This parameter can be one of the following values:
ganlikun 0:13413ea9a877 1394 * @arg @ref LL_ADC_GROUP_REGULAR
ganlikun 0:13413ea9a877 1395 * @arg @ref LL_ADC_GROUP_INJECTED
ganlikun 0:13413ea9a877 1396 * @arg @ref LL_ADC_GROUP_REGULAR_INJECTED
ganlikun 0:13413ea9a877 1397 * @retval Returned value can be one of the following values:
ganlikun 0:13413ea9a877 1398 * @arg @ref LL_ADC_AWD_DISABLE
ganlikun 0:13413ea9a877 1399 * @arg @ref LL_ADC_AWD_ALL_CHANNELS_REG
ganlikun 0:13413ea9a877 1400 * @arg @ref LL_ADC_AWD_ALL_CHANNELS_INJ
ganlikun 0:13413ea9a877 1401 * @arg @ref LL_ADC_AWD_ALL_CHANNELS_REG_INJ
ganlikun 0:13413ea9a877 1402 * @arg @ref LL_ADC_AWD_CHANNEL_0_REG
ganlikun 0:13413ea9a877 1403 * @arg @ref LL_ADC_AWD_CHANNEL_0_INJ
ganlikun 0:13413ea9a877 1404 * @arg @ref LL_ADC_AWD_CHANNEL_0_REG_INJ
ganlikun 0:13413ea9a877 1405 * @arg @ref LL_ADC_AWD_CHANNEL_1_REG
ganlikun 0:13413ea9a877 1406 * @arg @ref LL_ADC_AWD_CHANNEL_1_INJ
ganlikun 0:13413ea9a877 1407 * @arg @ref LL_ADC_AWD_CHANNEL_1_REG_INJ
ganlikun 0:13413ea9a877 1408 * @arg @ref LL_ADC_AWD_CHANNEL_2_REG
ganlikun 0:13413ea9a877 1409 * @arg @ref LL_ADC_AWD_CHANNEL_2_INJ
ganlikun 0:13413ea9a877 1410 * @arg @ref LL_ADC_AWD_CHANNEL_2_REG_INJ
ganlikun 0:13413ea9a877 1411 * @arg @ref LL_ADC_AWD_CHANNEL_3_REG
ganlikun 0:13413ea9a877 1412 * @arg @ref LL_ADC_AWD_CHANNEL_3_INJ
ganlikun 0:13413ea9a877 1413 * @arg @ref LL_ADC_AWD_CHANNEL_3_REG_INJ
ganlikun 0:13413ea9a877 1414 * @arg @ref LL_ADC_AWD_CHANNEL_4_REG
ganlikun 0:13413ea9a877 1415 * @arg @ref LL_ADC_AWD_CHANNEL_4_INJ
ganlikun 0:13413ea9a877 1416 * @arg @ref LL_ADC_AWD_CHANNEL_4_REG_INJ
ganlikun 0:13413ea9a877 1417 * @arg @ref LL_ADC_AWD_CHANNEL_5_REG
ganlikun 0:13413ea9a877 1418 * @arg @ref LL_ADC_AWD_CHANNEL_5_INJ
ganlikun 0:13413ea9a877 1419 * @arg @ref LL_ADC_AWD_CHANNEL_5_REG_INJ
ganlikun 0:13413ea9a877 1420 * @arg @ref LL_ADC_AWD_CHANNEL_6_REG
ganlikun 0:13413ea9a877 1421 * @arg @ref LL_ADC_AWD_CHANNEL_6_INJ
ganlikun 0:13413ea9a877 1422 * @arg @ref LL_ADC_AWD_CHANNEL_6_REG_INJ
ganlikun 0:13413ea9a877 1423 * @arg @ref LL_ADC_AWD_CHANNEL_7_REG
ganlikun 0:13413ea9a877 1424 * @arg @ref LL_ADC_AWD_CHANNEL_7_INJ
ganlikun 0:13413ea9a877 1425 * @arg @ref LL_ADC_AWD_CHANNEL_7_REG_INJ
ganlikun 0:13413ea9a877 1426 * @arg @ref LL_ADC_AWD_CHANNEL_8_REG
ganlikun 0:13413ea9a877 1427 * @arg @ref LL_ADC_AWD_CHANNEL_8_INJ
ganlikun 0:13413ea9a877 1428 * @arg @ref LL_ADC_AWD_CHANNEL_8_REG_INJ
ganlikun 0:13413ea9a877 1429 * @arg @ref LL_ADC_AWD_CHANNEL_9_REG
ganlikun 0:13413ea9a877 1430 * @arg @ref LL_ADC_AWD_CHANNEL_9_INJ
ganlikun 0:13413ea9a877 1431 * @arg @ref LL_ADC_AWD_CHANNEL_9_REG_INJ
ganlikun 0:13413ea9a877 1432 * @arg @ref LL_ADC_AWD_CHANNEL_10_REG
ganlikun 0:13413ea9a877 1433 * @arg @ref LL_ADC_AWD_CHANNEL_10_INJ
ganlikun 0:13413ea9a877 1434 * @arg @ref LL_ADC_AWD_CHANNEL_10_REG_INJ
ganlikun 0:13413ea9a877 1435 * @arg @ref LL_ADC_AWD_CHANNEL_11_REG
ganlikun 0:13413ea9a877 1436 * @arg @ref LL_ADC_AWD_CHANNEL_11_INJ
ganlikun 0:13413ea9a877 1437 * @arg @ref LL_ADC_AWD_CHANNEL_11_REG_INJ
ganlikun 0:13413ea9a877 1438 * @arg @ref LL_ADC_AWD_CHANNEL_12_REG
ganlikun 0:13413ea9a877 1439 * @arg @ref LL_ADC_AWD_CHANNEL_12_INJ
ganlikun 0:13413ea9a877 1440 * @arg @ref LL_ADC_AWD_CHANNEL_12_REG_INJ
ganlikun 0:13413ea9a877 1441 * @arg @ref LL_ADC_AWD_CHANNEL_13_REG
ganlikun 0:13413ea9a877 1442 * @arg @ref LL_ADC_AWD_CHANNEL_13_INJ
ganlikun 0:13413ea9a877 1443 * @arg @ref LL_ADC_AWD_CHANNEL_13_REG_INJ
ganlikun 0:13413ea9a877 1444 * @arg @ref LL_ADC_AWD_CHANNEL_14_REG
ganlikun 0:13413ea9a877 1445 * @arg @ref LL_ADC_AWD_CHANNEL_14_INJ
ganlikun 0:13413ea9a877 1446 * @arg @ref LL_ADC_AWD_CHANNEL_14_REG_INJ
ganlikun 0:13413ea9a877 1447 * @arg @ref LL_ADC_AWD_CHANNEL_15_REG
ganlikun 0:13413ea9a877 1448 * @arg @ref LL_ADC_AWD_CHANNEL_15_INJ
ganlikun 0:13413ea9a877 1449 * @arg @ref LL_ADC_AWD_CHANNEL_15_REG_INJ
ganlikun 0:13413ea9a877 1450 * @arg @ref LL_ADC_AWD_CHANNEL_16_REG
ganlikun 0:13413ea9a877 1451 * @arg @ref LL_ADC_AWD_CHANNEL_16_INJ
ganlikun 0:13413ea9a877 1452 * @arg @ref LL_ADC_AWD_CHANNEL_16_REG_INJ
ganlikun 0:13413ea9a877 1453 * @arg @ref LL_ADC_AWD_CHANNEL_17_REG
ganlikun 0:13413ea9a877 1454 * @arg @ref LL_ADC_AWD_CHANNEL_17_INJ
ganlikun 0:13413ea9a877 1455 * @arg @ref LL_ADC_AWD_CHANNEL_17_REG_INJ
ganlikun 0:13413ea9a877 1456 * @arg @ref LL_ADC_AWD_CHANNEL_18_REG
ganlikun 0:13413ea9a877 1457 * @arg @ref LL_ADC_AWD_CHANNEL_18_INJ
ganlikun 0:13413ea9a877 1458 * @arg @ref LL_ADC_AWD_CHANNEL_18_REG_INJ
ganlikun 0:13413ea9a877 1459 * @arg @ref LL_ADC_AWD_CH_VREFINT_REG (1)
ganlikun 0:13413ea9a877 1460 * @arg @ref LL_ADC_AWD_CH_VREFINT_INJ (1)
ganlikun 0:13413ea9a877 1461 * @arg @ref LL_ADC_AWD_CH_VREFINT_REG_INJ (1)
ganlikun 0:13413ea9a877 1462 * @arg @ref LL_ADC_AWD_CH_TEMPSENSOR_REG (1)(2)
ganlikun 0:13413ea9a877 1463 * @arg @ref LL_ADC_AWD_CH_TEMPSENSOR_INJ (1)(2)
ganlikun 0:13413ea9a877 1464 * @arg @ref LL_ADC_AWD_CH_TEMPSENSOR_REG_INJ (1)(2)
ganlikun 0:13413ea9a877 1465 * @arg @ref LL_ADC_AWD_CH_VBAT_REG (1)
ganlikun 0:13413ea9a877 1466 * @arg @ref LL_ADC_AWD_CH_VBAT_INJ (1)
ganlikun 0:13413ea9a877 1467 * @arg @ref LL_ADC_AWD_CH_VBAT_REG_INJ (1)
ganlikun 0:13413ea9a877 1468 *
ganlikun 0:13413ea9a877 1469 * (1) On STM32F4, parameter available only on ADC instance: ADC1.\n
ganlikun 0:13413ea9a877 1470 * (2) On devices STM32F42x and STM32F43x, limitation: this internal channel is shared between temperature sensor and Vbat, only 1 measurement path must be enabled.
ganlikun 0:13413ea9a877 1471 */
ganlikun 0:13413ea9a877 1472 #define __LL_ADC_ANALOGWD_CHANNEL_GROUP(__CHANNEL__, __GROUP__) \
ganlikun 0:13413ea9a877 1473 (((__GROUP__) == LL_ADC_GROUP_REGULAR) \
ganlikun 0:13413ea9a877 1474 ? (((__CHANNEL__) & ADC_CHANNEL_ID_MASK) | ADC_CR1_AWDEN | ADC_CR1_AWDSGL) \
ganlikun 0:13413ea9a877 1475 : \
ganlikun 0:13413ea9a877 1476 ((__GROUP__) == LL_ADC_GROUP_INJECTED) \
ganlikun 0:13413ea9a877 1477 ? (((__CHANNEL__) & ADC_CHANNEL_ID_MASK) | ADC_CR1_JAWDEN | ADC_CR1_AWDSGL) \
ganlikun 0:13413ea9a877 1478 : \
ganlikun 0:13413ea9a877 1479 (((__CHANNEL__) & ADC_CHANNEL_ID_MASK) | ADC_CR1_JAWDEN | ADC_CR1_AWDEN | ADC_CR1_AWDSGL) \
ganlikun 0:13413ea9a877 1480 )
ganlikun 0:13413ea9a877 1481
ganlikun 0:13413ea9a877 1482 /**
ganlikun 0:13413ea9a877 1483 * @brief Helper macro to set the value of ADC analog watchdog threshold high
ganlikun 0:13413ea9a877 1484 * or low in function of ADC resolution, when ADC resolution is
ganlikun 0:13413ea9a877 1485 * different of 12 bits.
ganlikun 0:13413ea9a877 1486 * @note To be used with function @ref LL_ADC_SetAnalogWDThresholds().
ganlikun 0:13413ea9a877 1487 * Example, with a ADC resolution of 8 bits, to set the value of
ganlikun 0:13413ea9a877 1488 * analog watchdog threshold high (on 8 bits):
ganlikun 0:13413ea9a877 1489 * LL_ADC_SetAnalogWDThresholds
ganlikun 0:13413ea9a877 1490 * (< ADCx param >,
ganlikun 0:13413ea9a877 1491 * __LL_ADC_ANALOGWD_SET_THRESHOLD_RESOLUTION(LL_ADC_RESOLUTION_8B, <threshold_value_8_bits>)
ganlikun 0:13413ea9a877 1492 * );
ganlikun 0:13413ea9a877 1493 * @param __ADC_RESOLUTION__ This parameter can be one of the following values:
ganlikun 0:13413ea9a877 1494 * @arg @ref LL_ADC_RESOLUTION_12B
ganlikun 0:13413ea9a877 1495 * @arg @ref LL_ADC_RESOLUTION_10B
ganlikun 0:13413ea9a877 1496 * @arg @ref LL_ADC_RESOLUTION_8B
ganlikun 0:13413ea9a877 1497 * @arg @ref LL_ADC_RESOLUTION_6B
ganlikun 0:13413ea9a877 1498 * @param __AWD_THRESHOLD__ Value between Min_Data=0x000 and Max_Data=0xFFF
ganlikun 0:13413ea9a877 1499 * @retval Value between Min_Data=0x000 and Max_Data=0xFFF
ganlikun 0:13413ea9a877 1500 */
ganlikun 0:13413ea9a877 1501 #define __LL_ADC_ANALOGWD_SET_THRESHOLD_RESOLUTION(__ADC_RESOLUTION__, __AWD_THRESHOLD__) \
ganlikun 0:13413ea9a877 1502 ((__AWD_THRESHOLD__) << ((__ADC_RESOLUTION__) >> (ADC_CR1_RES_BITOFFSET_POS - 1U )))
ganlikun 0:13413ea9a877 1503
ganlikun 0:13413ea9a877 1504 /**
ganlikun 0:13413ea9a877 1505 * @brief Helper macro to get the value of ADC analog watchdog threshold high
ganlikun 0:13413ea9a877 1506 * or low in function of ADC resolution, when ADC resolution is
ganlikun 0:13413ea9a877 1507 * different of 12 bits.
ganlikun 0:13413ea9a877 1508 * @note To be used with function @ref LL_ADC_GetAnalogWDThresholds().
ganlikun 0:13413ea9a877 1509 * Example, with a ADC resolution of 8 bits, to get the value of
ganlikun 0:13413ea9a877 1510 * analog watchdog threshold high (on 8 bits):
ganlikun 0:13413ea9a877 1511 * < threshold_value_6_bits > = __LL_ADC_ANALOGWD_GET_THRESHOLD_RESOLUTION
ganlikun 0:13413ea9a877 1512 * (LL_ADC_RESOLUTION_8B,
ganlikun 0:13413ea9a877 1513 * LL_ADC_GetAnalogWDThresholds(<ADCx param>, LL_ADC_AWD_THRESHOLD_HIGH)
ganlikun 0:13413ea9a877 1514 * );
ganlikun 0:13413ea9a877 1515 * @param __ADC_RESOLUTION__ This parameter can be one of the following values:
ganlikun 0:13413ea9a877 1516 * @arg @ref LL_ADC_RESOLUTION_12B
ganlikun 0:13413ea9a877 1517 * @arg @ref LL_ADC_RESOLUTION_10B
ganlikun 0:13413ea9a877 1518 * @arg @ref LL_ADC_RESOLUTION_8B
ganlikun 0:13413ea9a877 1519 * @arg @ref LL_ADC_RESOLUTION_6B
ganlikun 0:13413ea9a877 1520 * @param __AWD_THRESHOLD_12_BITS__ Value between Min_Data=0x000 and Max_Data=0xFFF
ganlikun 0:13413ea9a877 1521 * @retval Value between Min_Data=0x000 and Max_Data=0xFFF
ganlikun 0:13413ea9a877 1522 */
ganlikun 0:13413ea9a877 1523 #define __LL_ADC_ANALOGWD_GET_THRESHOLD_RESOLUTION(__ADC_RESOLUTION__, __AWD_THRESHOLD_12_BITS__) \
ganlikun 0:13413ea9a877 1524 ((__AWD_THRESHOLD_12_BITS__) >> ((__ADC_RESOLUTION__) >> (ADC_CR1_RES_BITOFFSET_POS - 1U )))
ganlikun 0:13413ea9a877 1525
ganlikun 0:13413ea9a877 1526 #if defined(ADC_MULTIMODE_SUPPORT)
ganlikun 0:13413ea9a877 1527 /**
ganlikun 0:13413ea9a877 1528 * @brief Helper macro to get the ADC multimode conversion data of ADC master
ganlikun 0:13413ea9a877 1529 * or ADC slave from raw value with both ADC conversion data concatenated.
ganlikun 0:13413ea9a877 1530 * @note This macro is intended to be used when multimode transfer by DMA
ganlikun 0:13413ea9a877 1531 * is enabled: refer to function @ref LL_ADC_SetMultiDMATransfer().
ganlikun 0:13413ea9a877 1532 * In this case the transferred data need to processed with this macro
ganlikun 0:13413ea9a877 1533 * to separate the conversion data of ADC master and ADC slave.
ganlikun 0:13413ea9a877 1534 * @param __ADC_MULTI_MASTER_SLAVE__ This parameter can be one of the following values:
ganlikun 0:13413ea9a877 1535 * @arg @ref LL_ADC_MULTI_MASTER
ganlikun 0:13413ea9a877 1536 * @arg @ref LL_ADC_MULTI_SLAVE
ganlikun 0:13413ea9a877 1537 * @param __ADC_MULTI_CONV_DATA__ Value between Min_Data=0x000 and Max_Data=0xFFF
ganlikun 0:13413ea9a877 1538 * @retval Value between Min_Data=0x000 and Max_Data=0xFFF
ganlikun 0:13413ea9a877 1539 */
ganlikun 0:13413ea9a877 1540 #define __LL_ADC_MULTI_CONV_DATA_MASTER_SLAVE(__ADC_MULTI_MASTER_SLAVE__, __ADC_MULTI_CONV_DATA__) \
ganlikun 0:13413ea9a877 1541 (((__ADC_MULTI_CONV_DATA__) >> POSITION_VAL((__ADC_MULTI_MASTER_SLAVE__))) & ADC_CDR_RDATA_MST)
ganlikun 0:13413ea9a877 1542 #endif
ganlikun 0:13413ea9a877 1543
ganlikun 0:13413ea9a877 1544 /**
ganlikun 0:13413ea9a877 1545 * @brief Helper macro to select the ADC common instance
ganlikun 0:13413ea9a877 1546 * to which is belonging the selected ADC instance.
ganlikun 0:13413ea9a877 1547 * @note ADC common register instance can be used for:
ganlikun 0:13413ea9a877 1548 * - Set parameters common to several ADC instances
ganlikun 0:13413ea9a877 1549 * - Multimode (for devices with several ADC instances)
ganlikun 0:13413ea9a877 1550 * Refer to functions having argument "ADCxy_COMMON" as parameter.
ganlikun 0:13413ea9a877 1551 * @param __ADCx__ ADC instance
ganlikun 0:13413ea9a877 1552 * @retval ADC common register instance
ganlikun 0:13413ea9a877 1553 */
ganlikun 0:13413ea9a877 1554 #if defined(ADC1) && defined(ADC2) && defined(ADC3)
ganlikun 0:13413ea9a877 1555 #define __LL_ADC_COMMON_INSTANCE(__ADCx__) \
ganlikun 0:13413ea9a877 1556 (ADC123_COMMON)
ganlikun 0:13413ea9a877 1557 #elif defined(ADC1) && defined(ADC2)
ganlikun 0:13413ea9a877 1558 #define __LL_ADC_COMMON_INSTANCE(__ADCx__) \
ganlikun 0:13413ea9a877 1559 (ADC12_COMMON)
ganlikun 0:13413ea9a877 1560 #else
ganlikun 0:13413ea9a877 1561 #define __LL_ADC_COMMON_INSTANCE(__ADCx__) \
ganlikun 0:13413ea9a877 1562 (ADC1_COMMON)
ganlikun 0:13413ea9a877 1563 #endif
ganlikun 0:13413ea9a877 1564
ganlikun 0:13413ea9a877 1565 /**
ganlikun 0:13413ea9a877 1566 * @brief Helper macro to check if all ADC instances sharing the same
ganlikun 0:13413ea9a877 1567 * ADC common instance are disabled.
ganlikun 0:13413ea9a877 1568 * @note This check is required by functions with setting conditioned to
ganlikun 0:13413ea9a877 1569 * ADC state:
ganlikun 0:13413ea9a877 1570 * All ADC instances of the ADC common group must be disabled.
ganlikun 0:13413ea9a877 1571 * Refer to functions having argument "ADCxy_COMMON" as parameter.
ganlikun 0:13413ea9a877 1572 * @note On devices with only 1 ADC common instance, parameter of this macro
ganlikun 0:13413ea9a877 1573 * is useless and can be ignored (parameter kept for compatibility
ganlikun 0:13413ea9a877 1574 * with devices featuring several ADC common instances).
ganlikun 0:13413ea9a877 1575 * @param __ADCXY_COMMON__ ADC common instance
ganlikun 0:13413ea9a877 1576 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
ganlikun 0:13413ea9a877 1577 * @retval Value "0" if all ADC instances sharing the same ADC common instance
ganlikun 0:13413ea9a877 1578 * are disabled.
ganlikun 0:13413ea9a877 1579 * Value "1" if at least one ADC instance sharing the same ADC common instance
ganlikun 0:13413ea9a877 1580 * is enabled.
ganlikun 0:13413ea9a877 1581 */
ganlikun 0:13413ea9a877 1582 #if defined(ADC1) && defined(ADC2) && defined(ADC3)
ganlikun 0:13413ea9a877 1583 #define __LL_ADC_IS_ENABLED_ALL_COMMON_INSTANCE(__ADCXY_COMMON__) \
ganlikun 0:13413ea9a877 1584 (LL_ADC_IsEnabled(ADC1) | \
ganlikun 0:13413ea9a877 1585 LL_ADC_IsEnabled(ADC2) | \
ganlikun 0:13413ea9a877 1586 LL_ADC_IsEnabled(ADC3) )
ganlikun 0:13413ea9a877 1587 #elif defined(ADC1) && defined(ADC2)
ganlikun 0:13413ea9a877 1588 #define __LL_ADC_IS_ENABLED_ALL_COMMON_INSTANCE(__ADCXY_COMMON__) \
ganlikun 0:13413ea9a877 1589 (LL_ADC_IsEnabled(ADC1) | \
ganlikun 0:13413ea9a877 1590 LL_ADC_IsEnabled(ADC2) )
ganlikun 0:13413ea9a877 1591 #else
ganlikun 0:13413ea9a877 1592 #define __LL_ADC_IS_ENABLED_ALL_COMMON_INSTANCE(__ADCXY_COMMON__) \
ganlikun 0:13413ea9a877 1593 (LL_ADC_IsEnabled(ADC1))
ganlikun 0:13413ea9a877 1594 #endif
ganlikun 0:13413ea9a877 1595
ganlikun 0:13413ea9a877 1596 /**
ganlikun 0:13413ea9a877 1597 * @brief Helper macro to define the ADC conversion data full-scale digital
ganlikun 0:13413ea9a877 1598 * value corresponding to the selected ADC resolution.
ganlikun 0:13413ea9a877 1599 * @note ADC conversion data full-scale corresponds to voltage range
ganlikun 0:13413ea9a877 1600 * determined by analog voltage references Vref+ and Vref-
ganlikun 0:13413ea9a877 1601 * (refer to reference manual).
ganlikun 0:13413ea9a877 1602 * @param __ADC_RESOLUTION__ This parameter can be one of the following values:
ganlikun 0:13413ea9a877 1603 * @arg @ref LL_ADC_RESOLUTION_12B
ganlikun 0:13413ea9a877 1604 * @arg @ref LL_ADC_RESOLUTION_10B
ganlikun 0:13413ea9a877 1605 * @arg @ref LL_ADC_RESOLUTION_8B
ganlikun 0:13413ea9a877 1606 * @arg @ref LL_ADC_RESOLUTION_6B
ganlikun 0:13413ea9a877 1607 * @retval ADC conversion data equivalent voltage value (unit: mVolt)
ganlikun 0:13413ea9a877 1608 */
ganlikun 0:13413ea9a877 1609 #define __LL_ADC_DIGITAL_SCALE(__ADC_RESOLUTION__) \
ganlikun 0:13413ea9a877 1610 (0xFFFU >> ((__ADC_RESOLUTION__) >> (ADC_CR1_RES_BITOFFSET_POS - 1U)))
ganlikun 0:13413ea9a877 1611
ganlikun 0:13413ea9a877 1612 /**
ganlikun 0:13413ea9a877 1613 * @brief Helper macro to convert the ADC conversion data from
ganlikun 0:13413ea9a877 1614 * a resolution to another resolution.
ganlikun 0:13413ea9a877 1615 * @param __DATA__ ADC conversion data to be converted
ganlikun 0:13413ea9a877 1616 * @param __ADC_RESOLUTION_CURRENT__ Resolution of to the data to be converted
ganlikun 0:13413ea9a877 1617 * This parameter can be one of the following values:
ganlikun 0:13413ea9a877 1618 * @arg @ref LL_ADC_RESOLUTION_12B
ganlikun 0:13413ea9a877 1619 * @arg @ref LL_ADC_RESOLUTION_10B
ganlikun 0:13413ea9a877 1620 * @arg @ref LL_ADC_RESOLUTION_8B
ganlikun 0:13413ea9a877 1621 * @arg @ref LL_ADC_RESOLUTION_6B
ganlikun 0:13413ea9a877 1622 * @param __ADC_RESOLUTION_TARGET__ Resolution of the data after conversion
ganlikun 0:13413ea9a877 1623 * This parameter can be one of the following values:
ganlikun 0:13413ea9a877 1624 * @arg @ref LL_ADC_RESOLUTION_12B
ganlikun 0:13413ea9a877 1625 * @arg @ref LL_ADC_RESOLUTION_10B
ganlikun 0:13413ea9a877 1626 * @arg @ref LL_ADC_RESOLUTION_8B
ganlikun 0:13413ea9a877 1627 * @arg @ref LL_ADC_RESOLUTION_6B
ganlikun 0:13413ea9a877 1628 * @retval ADC conversion data to the requested resolution
ganlikun 0:13413ea9a877 1629 */
ganlikun 0:13413ea9a877 1630 #define __LL_ADC_CONVERT_DATA_RESOLUTION(__DATA__, __ADC_RESOLUTION_CURRENT__, __ADC_RESOLUTION_TARGET__) \
ganlikun 0:13413ea9a877 1631 (((__DATA__) \
ganlikun 0:13413ea9a877 1632 << ((__ADC_RESOLUTION_CURRENT__) >> (ADC_CR1_RES_BITOFFSET_POS - 1U))) \
ganlikun 0:13413ea9a877 1633 >> ((__ADC_RESOLUTION_TARGET__) >> (ADC_CR1_RES_BITOFFSET_POS - 1U)) \
ganlikun 0:13413ea9a877 1634 )
ganlikun 0:13413ea9a877 1635
ganlikun 0:13413ea9a877 1636 /**
ganlikun 0:13413ea9a877 1637 * @brief Helper macro to calculate the voltage (unit: mVolt)
ganlikun 0:13413ea9a877 1638 * corresponding to a ADC conversion data (unit: digital value).
ganlikun 0:13413ea9a877 1639 * @note Analog reference voltage (Vref+) must be either known from
ganlikun 0:13413ea9a877 1640 * user board environment or can be calculated using ADC measurement
ganlikun 0:13413ea9a877 1641 * and ADC helper macro @ref __LL_ADC_CALC_VREFANALOG_VOLTAGE().
ganlikun 0:13413ea9a877 1642 * @param __VREFANALOG_VOLTAGE__ Analog reference voltage (unit: mV)
ganlikun 0:13413ea9a877 1643 * @param __ADC_DATA__ ADC conversion data (resolution 12 bits)
ganlikun 0:13413ea9a877 1644 * (unit: digital value).
ganlikun 0:13413ea9a877 1645 * @param __ADC_RESOLUTION__ This parameter can be one of the following values:
ganlikun 0:13413ea9a877 1646 * @arg @ref LL_ADC_RESOLUTION_12B
ganlikun 0:13413ea9a877 1647 * @arg @ref LL_ADC_RESOLUTION_10B
ganlikun 0:13413ea9a877 1648 * @arg @ref LL_ADC_RESOLUTION_8B
ganlikun 0:13413ea9a877 1649 * @arg @ref LL_ADC_RESOLUTION_6B
ganlikun 0:13413ea9a877 1650 * @retval ADC conversion data equivalent voltage value (unit: mVolt)
ganlikun 0:13413ea9a877 1651 */
ganlikun 0:13413ea9a877 1652 #define __LL_ADC_CALC_DATA_TO_VOLTAGE(__VREFANALOG_VOLTAGE__,\
ganlikun 0:13413ea9a877 1653 __ADC_DATA__,\
ganlikun 0:13413ea9a877 1654 __ADC_RESOLUTION__) \
ganlikun 0:13413ea9a877 1655 ((__ADC_DATA__) * (__VREFANALOG_VOLTAGE__) \
ganlikun 0:13413ea9a877 1656 / __LL_ADC_DIGITAL_SCALE(__ADC_RESOLUTION__) \
ganlikun 0:13413ea9a877 1657 )
ganlikun 0:13413ea9a877 1658
ganlikun 0:13413ea9a877 1659
ganlikun 0:13413ea9a877 1660 /**
ganlikun 0:13413ea9a877 1661 * @brief Helper macro to calculate the temperature (unit: degree Celsius)
ganlikun 0:13413ea9a877 1662 * from ADC conversion data of internal temperature sensor.
ganlikun 0:13413ea9a877 1663 * @note Computation is using temperature sensor typical values
ganlikun 0:13413ea9a877 1664 * (refer to device datasheet).
ganlikun 0:13413ea9a877 1665 * @note Calculation formula:
ganlikun 0:13413ea9a877 1666 * Temperature = (TS_TYP_CALx_VOLT(uV) - TS_ADC_DATA * Conversion_uV)
ganlikun 0:13413ea9a877 1667 * / Avg_Slope + CALx_TEMP
ganlikun 0:13413ea9a877 1668 * with TS_ADC_DATA = temperature sensor raw data measured by ADC
ganlikun 0:13413ea9a877 1669 * (unit: digital value)
ganlikun 0:13413ea9a877 1670 * Avg_Slope = temperature sensor slope
ganlikun 0:13413ea9a877 1671 * (unit: uV/Degree Celsius)
ganlikun 0:13413ea9a877 1672 * TS_TYP_CALx_VOLT = temperature sensor digital value at
ganlikun 0:13413ea9a877 1673 * temperature CALx_TEMP (unit: mV)
ganlikun 0:13413ea9a877 1674 * Caution: Calculation relevancy under reserve the temperature sensor
ganlikun 0:13413ea9a877 1675 * of the current device has characteristics in line with
ganlikun 0:13413ea9a877 1676 * datasheet typical values.
ganlikun 0:13413ea9a877 1677 * If temperature sensor calibration values are available on
ganlikun 0:13413ea9a877 1678 * on this device (presence of macro __LL_ADC_CALC_TEMPERATURE()),
ganlikun 0:13413ea9a877 1679 * temperature calculation will be more accurate using
ganlikun 0:13413ea9a877 1680 * helper macro @ref __LL_ADC_CALC_TEMPERATURE().
ganlikun 0:13413ea9a877 1681 * @note As calculation input, the analog reference voltage (Vref+) must be
ganlikun 0:13413ea9a877 1682 * defined as it impacts the ADC LSB equivalent voltage.
ganlikun 0:13413ea9a877 1683 * @note Analog reference voltage (Vref+) must be either known from
ganlikun 0:13413ea9a877 1684 * user board environment or can be calculated using ADC measurement
ganlikun 0:13413ea9a877 1685 * and ADC helper macro @ref __LL_ADC_CALC_VREFANALOG_VOLTAGE().
ganlikun 0:13413ea9a877 1686 * @note ADC measurement data must correspond to a resolution of 12bits
ganlikun 0:13413ea9a877 1687 * (full scale digital value 4095). If not the case, the data must be
ganlikun 0:13413ea9a877 1688 * preliminarily rescaled to an equivalent resolution of 12 bits.
ganlikun 0:13413ea9a877 1689 * @param __TEMPSENSOR_TYP_AVGSLOPE__ Device datasheet data: Temperature sensor slope typical value (unit: uV/DegCelsius).
ganlikun 0:13413ea9a877 1690 * On STM32F4, refer to device datasheet parameter "Avg_Slope".
ganlikun 0:13413ea9a877 1691 * @param __TEMPSENSOR_TYP_CALX_V__ Device datasheet data: Temperature sensor voltage typical value (at temperature and Vref+ defined in parameters below) (unit: mV).
ganlikun 0:13413ea9a877 1692 * On STM32F4, refer to device datasheet parameter "V25".
ganlikun 0:13413ea9a877 1693 * @param __TEMPSENSOR_CALX_TEMP__ Device datasheet data: Temperature at which temperature sensor voltage (see parameter above) is corresponding (unit: mV)
ganlikun 0:13413ea9a877 1694 * @param __VREFANALOG_VOLTAGE__ Analog voltage reference (Vref+) voltage (unit: mV)
ganlikun 0:13413ea9a877 1695 * @param __TEMPSENSOR_ADC_DATA__ ADC conversion data of internal temperature sensor (unit: digital value).
ganlikun 0:13413ea9a877 1696 * @param __ADC_RESOLUTION__ ADC resolution at which internal temperature sensor voltage has been measured.
ganlikun 0:13413ea9a877 1697 * This parameter can be one of the following values:
ganlikun 0:13413ea9a877 1698 * @arg @ref LL_ADC_RESOLUTION_12B
ganlikun 0:13413ea9a877 1699 * @arg @ref LL_ADC_RESOLUTION_10B
ganlikun 0:13413ea9a877 1700 * @arg @ref LL_ADC_RESOLUTION_8B
ganlikun 0:13413ea9a877 1701 * @arg @ref LL_ADC_RESOLUTION_6B
ganlikun 0:13413ea9a877 1702 * @retval Temperature (unit: degree Celsius)
ganlikun 0:13413ea9a877 1703 */
ganlikun 0:13413ea9a877 1704 #define __LL_ADC_CALC_TEMPERATURE_TYP_PARAMS(__TEMPSENSOR_TYP_AVGSLOPE__,\
ganlikun 0:13413ea9a877 1705 __TEMPSENSOR_TYP_CALX_V__,\
ganlikun 0:13413ea9a877 1706 __TEMPSENSOR_CALX_TEMP__,\
ganlikun 0:13413ea9a877 1707 __VREFANALOG_VOLTAGE__,\
ganlikun 0:13413ea9a877 1708 __TEMPSENSOR_ADC_DATA__,\
ganlikun 0:13413ea9a877 1709 __ADC_RESOLUTION__) \
ganlikun 0:13413ea9a877 1710 ((( ( \
ganlikun 0:13413ea9a877 1711 (int32_t)(((__TEMPSENSOR_TYP_CALX_V__)) \
ganlikun 0:13413ea9a877 1712 * 1000) \
ganlikun 0:13413ea9a877 1713 - \
ganlikun 0:13413ea9a877 1714 (int32_t)((((__TEMPSENSOR_ADC_DATA__) * (__VREFANALOG_VOLTAGE__)) \
ganlikun 0:13413ea9a877 1715 / __LL_ADC_DIGITAL_SCALE(__ADC_RESOLUTION__)) \
ganlikun 0:13413ea9a877 1716 * 1000) \
ganlikun 0:13413ea9a877 1717 ) \
ganlikun 0:13413ea9a877 1718 ) / (__TEMPSENSOR_TYP_AVGSLOPE__) \
ganlikun 0:13413ea9a877 1719 ) + (__TEMPSENSOR_CALX_TEMP__) \
ganlikun 0:13413ea9a877 1720 )
ganlikun 0:13413ea9a877 1721
ganlikun 0:13413ea9a877 1722 /**
ganlikun 0:13413ea9a877 1723 * @}
ganlikun 0:13413ea9a877 1724 */
ganlikun 0:13413ea9a877 1725
ganlikun 0:13413ea9a877 1726 /**
ganlikun 0:13413ea9a877 1727 * @}
ganlikun 0:13413ea9a877 1728 */
ganlikun 0:13413ea9a877 1729
ganlikun 0:13413ea9a877 1730
ganlikun 0:13413ea9a877 1731 /* Exported functions --------------------------------------------------------*/
ganlikun 0:13413ea9a877 1732 /** @defgroup ADC_LL_Exported_Functions ADC Exported Functions
ganlikun 0:13413ea9a877 1733 * @{
ganlikun 0:13413ea9a877 1734 */
ganlikun 0:13413ea9a877 1735
ganlikun 0:13413ea9a877 1736 /** @defgroup ADC_LL_EF_DMA_Management ADC DMA management
ganlikun 0:13413ea9a877 1737 * @{
ganlikun 0:13413ea9a877 1738 */
ganlikun 0:13413ea9a877 1739 /* Note: LL ADC functions to set DMA transfer are located into sections of */
ganlikun 0:13413ea9a877 1740 /* configuration of ADC instance, groups and multimode (if available): */
ganlikun 0:13413ea9a877 1741 /* @ref LL_ADC_REG_SetDMATransfer(), ... */
ganlikun 0:13413ea9a877 1742
ganlikun 0:13413ea9a877 1743 /**
ganlikun 0:13413ea9a877 1744 * @brief Function to help to configure DMA transfer from ADC: retrieve the
ganlikun 0:13413ea9a877 1745 * ADC register address from ADC instance and a list of ADC registers
ganlikun 0:13413ea9a877 1746 * intended to be used (most commonly) with DMA transfer.
ganlikun 0:13413ea9a877 1747 * @note These ADC registers are data registers:
ganlikun 0:13413ea9a877 1748 * when ADC conversion data is available in ADC data registers,
ganlikun 0:13413ea9a877 1749 * ADC generates a DMA transfer request.
ganlikun 0:13413ea9a877 1750 * @note This macro is intended to be used with LL DMA driver, refer to
ganlikun 0:13413ea9a877 1751 * function "LL_DMA_ConfigAddresses()".
ganlikun 0:13413ea9a877 1752 * Example:
ganlikun 0:13413ea9a877 1753 * LL_DMA_ConfigAddresses(DMA1,
ganlikun 0:13413ea9a877 1754 * LL_DMA_CHANNEL_1,
ganlikun 0:13413ea9a877 1755 * LL_ADC_DMA_GetRegAddr(ADC1, LL_ADC_DMA_REG_REGULAR_DATA),
ganlikun 0:13413ea9a877 1756 * (uint32_t)&< array or variable >,
ganlikun 0:13413ea9a877 1757 * LL_DMA_DIRECTION_PERIPH_TO_MEMORY);
ganlikun 0:13413ea9a877 1758 * @note For devices with several ADC: in multimode, some devices
ganlikun 0:13413ea9a877 1759 * use a different data register outside of ADC instance scope
ganlikun 0:13413ea9a877 1760 * (common data register). This macro manages this register difference,
ganlikun 0:13413ea9a877 1761 * only ADC instance has to be set as parameter.
ganlikun 0:13413ea9a877 1762 * @rmtoll DR RDATA LL_ADC_DMA_GetRegAddr\n
ganlikun 0:13413ea9a877 1763 * CDR RDATA_MST LL_ADC_DMA_GetRegAddr\n
ganlikun 0:13413ea9a877 1764 * CDR RDATA_SLV LL_ADC_DMA_GetRegAddr
ganlikun 0:13413ea9a877 1765 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 1766 * @param Register This parameter can be one of the following values:
ganlikun 0:13413ea9a877 1767 * @arg @ref LL_ADC_DMA_REG_REGULAR_DATA
ganlikun 0:13413ea9a877 1768 * @arg @ref LL_ADC_DMA_REG_REGULAR_DATA_MULTI (1)
ganlikun 0:13413ea9a877 1769 *
ganlikun 0:13413ea9a877 1770 * (1) Available on devices with several ADC instances.
ganlikun 0:13413ea9a877 1771 * @retval ADC register address
ganlikun 0:13413ea9a877 1772 */
ganlikun 0:13413ea9a877 1773 #if defined(ADC_MULTIMODE_SUPPORT)
ganlikun 0:13413ea9a877 1774 __STATIC_INLINE uint32_t LL_ADC_DMA_GetRegAddr(ADC_TypeDef *ADCx, uint32_t Register)
ganlikun 0:13413ea9a877 1775 {
ganlikun 0:13413ea9a877 1776 register uint32_t data_reg_addr = 0U;
ganlikun 0:13413ea9a877 1777
ganlikun 0:13413ea9a877 1778 if (Register == LL_ADC_DMA_REG_REGULAR_DATA)
ganlikun 0:13413ea9a877 1779 {
ganlikun 0:13413ea9a877 1780 /* Retrieve address of register DR */
ganlikun 0:13413ea9a877 1781 data_reg_addr = (uint32_t)&(ADCx->DR);
ganlikun 0:13413ea9a877 1782 }
ganlikun 0:13413ea9a877 1783 else /* (Register == LL_ADC_DMA_REG_REGULAR_DATA_MULTI) */
ganlikun 0:13413ea9a877 1784 {
ganlikun 0:13413ea9a877 1785 /* Retrieve address of register CDR */
ganlikun 0:13413ea9a877 1786 data_reg_addr = (uint32_t)&((__LL_ADC_COMMON_INSTANCE(ADCx))->CDR);
ganlikun 0:13413ea9a877 1787 }
ganlikun 0:13413ea9a877 1788
ganlikun 0:13413ea9a877 1789 return data_reg_addr;
ganlikun 0:13413ea9a877 1790 }
ganlikun 0:13413ea9a877 1791 #else
ganlikun 0:13413ea9a877 1792 __STATIC_INLINE uint32_t LL_ADC_DMA_GetRegAddr(ADC_TypeDef *ADCx, uint32_t Register)
ganlikun 0:13413ea9a877 1793 {
ganlikun 0:13413ea9a877 1794 /* Retrieve address of register DR */
ganlikun 0:13413ea9a877 1795 return (uint32_t)&(ADCx->DR);
ganlikun 0:13413ea9a877 1796 }
ganlikun 0:13413ea9a877 1797 #endif
ganlikun 0:13413ea9a877 1798
ganlikun 0:13413ea9a877 1799 /**
ganlikun 0:13413ea9a877 1800 * @}
ganlikun 0:13413ea9a877 1801 */
ganlikun 0:13413ea9a877 1802
ganlikun 0:13413ea9a877 1803 /** @defgroup ADC_LL_EF_Configuration_ADC_Common Configuration of ADC hierarchical scope: common to several ADC instances
ganlikun 0:13413ea9a877 1804 * @{
ganlikun 0:13413ea9a877 1805 */
ganlikun 0:13413ea9a877 1806
ganlikun 0:13413ea9a877 1807 /**
ganlikun 0:13413ea9a877 1808 * @brief Set parameter common to several ADC: Clock source and prescaler.
ganlikun 0:13413ea9a877 1809 * @rmtoll CCR ADCPRE LL_ADC_SetCommonClock
ganlikun 0:13413ea9a877 1810 * @param ADCxy_COMMON ADC common instance
ganlikun 0:13413ea9a877 1811 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
ganlikun 0:13413ea9a877 1812 * @param CommonClock This parameter can be one of the following values:
ganlikun 0:13413ea9a877 1813 * @arg @ref LL_ADC_CLOCK_SYNC_PCLK_DIV2
ganlikun 0:13413ea9a877 1814 * @arg @ref LL_ADC_CLOCK_SYNC_PCLK_DIV4
ganlikun 0:13413ea9a877 1815 * @arg @ref LL_ADC_CLOCK_SYNC_PCLK_DIV6
ganlikun 0:13413ea9a877 1816 * @arg @ref LL_ADC_CLOCK_SYNC_PCLK_DIV8
ganlikun 0:13413ea9a877 1817 * @retval None
ganlikun 0:13413ea9a877 1818 */
ganlikun 0:13413ea9a877 1819 __STATIC_INLINE void LL_ADC_SetCommonClock(ADC_Common_TypeDef *ADCxy_COMMON, uint32_t CommonClock)
ganlikun 0:13413ea9a877 1820 {
ganlikun 0:13413ea9a877 1821 MODIFY_REG(ADCxy_COMMON->CCR, ADC_CCR_ADCPRE, CommonClock);
ganlikun 0:13413ea9a877 1822 }
ganlikun 0:13413ea9a877 1823
ganlikun 0:13413ea9a877 1824 /**
ganlikun 0:13413ea9a877 1825 * @brief Get parameter common to several ADC: Clock source and prescaler.
ganlikun 0:13413ea9a877 1826 * @rmtoll CCR ADCPRE LL_ADC_GetCommonClock
ganlikun 0:13413ea9a877 1827 * @param ADCxy_COMMON ADC common instance
ganlikun 0:13413ea9a877 1828 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
ganlikun 0:13413ea9a877 1829 * @retval Returned value can be one of the following values:
ganlikun 0:13413ea9a877 1830 * @arg @ref LL_ADC_CLOCK_SYNC_PCLK_DIV2
ganlikun 0:13413ea9a877 1831 * @arg @ref LL_ADC_CLOCK_SYNC_PCLK_DIV4
ganlikun 0:13413ea9a877 1832 * @arg @ref LL_ADC_CLOCK_SYNC_PCLK_DIV6
ganlikun 0:13413ea9a877 1833 * @arg @ref LL_ADC_CLOCK_SYNC_PCLK_DIV8
ganlikun 0:13413ea9a877 1834 */
ganlikun 0:13413ea9a877 1835 __STATIC_INLINE uint32_t LL_ADC_GetCommonClock(ADC_Common_TypeDef *ADCxy_COMMON)
ganlikun 0:13413ea9a877 1836 {
ganlikun 0:13413ea9a877 1837 return (uint32_t)(READ_BIT(ADCxy_COMMON->CCR, ADC_CCR_ADCPRE));
ganlikun 0:13413ea9a877 1838 }
ganlikun 0:13413ea9a877 1839
ganlikun 0:13413ea9a877 1840 /**
ganlikun 0:13413ea9a877 1841 * @brief Set parameter common to several ADC: measurement path to internal
ganlikun 0:13413ea9a877 1842 * channels (VrefInt, temperature sensor, ...).
ganlikun 0:13413ea9a877 1843 * @note One or several values can be selected.
ganlikun 0:13413ea9a877 1844 * Example: (LL_ADC_PATH_INTERNAL_VREFINT |
ganlikun 0:13413ea9a877 1845 * LL_ADC_PATH_INTERNAL_TEMPSENSOR)
ganlikun 0:13413ea9a877 1846 * @note Stabilization time of measurement path to internal channel:
ganlikun 0:13413ea9a877 1847 * After enabling internal paths, before starting ADC conversion,
ganlikun 0:13413ea9a877 1848 * a delay is required for internal voltage reference and
ganlikun 0:13413ea9a877 1849 * temperature sensor stabilization time.
ganlikun 0:13413ea9a877 1850 * Refer to device datasheet.
ganlikun 0:13413ea9a877 1851 * Refer to literal @ref LL_ADC_DELAY_VREFINT_STAB_US.
ganlikun 0:13413ea9a877 1852 * Refer to literal @ref LL_ADC_DELAY_TEMPSENSOR_STAB_US.
ganlikun 0:13413ea9a877 1853 * @note ADC internal channel sampling time constraint:
ganlikun 0:13413ea9a877 1854 * For ADC conversion of internal channels,
ganlikun 0:13413ea9a877 1855 * a sampling time minimum value is required.
ganlikun 0:13413ea9a877 1856 * Refer to device datasheet.
ganlikun 0:13413ea9a877 1857 * @rmtoll CCR TSVREFE LL_ADC_SetCommonPathInternalCh\n
ganlikun 0:13413ea9a877 1858 * CCR VBATE LL_ADC_SetCommonPathInternalCh
ganlikun 0:13413ea9a877 1859 * @param ADCxy_COMMON ADC common instance
ganlikun 0:13413ea9a877 1860 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
ganlikun 0:13413ea9a877 1861 * @param PathInternal This parameter can be a combination of the following values:
ganlikun 0:13413ea9a877 1862 * @arg @ref LL_ADC_PATH_INTERNAL_NONE
ganlikun 0:13413ea9a877 1863 * @arg @ref LL_ADC_PATH_INTERNAL_VREFINT
ganlikun 0:13413ea9a877 1864 * @arg @ref LL_ADC_PATH_INTERNAL_TEMPSENSOR
ganlikun 0:13413ea9a877 1865 * @arg @ref LL_ADC_PATH_INTERNAL_VBAT
ganlikun 0:13413ea9a877 1866 * @retval None
ganlikun 0:13413ea9a877 1867 */
ganlikun 0:13413ea9a877 1868 __STATIC_INLINE void LL_ADC_SetCommonPathInternalCh(ADC_Common_TypeDef *ADCxy_COMMON, uint32_t PathInternal)
ganlikun 0:13413ea9a877 1869 {
ganlikun 0:13413ea9a877 1870 MODIFY_REG(ADCxy_COMMON->CCR, ADC_CCR_TSVREFE | ADC_CCR_VBATE, PathInternal);
ganlikun 0:13413ea9a877 1871 }
ganlikun 0:13413ea9a877 1872
ganlikun 0:13413ea9a877 1873 /**
ganlikun 0:13413ea9a877 1874 * @brief Get parameter common to several ADC: measurement path to internal
ganlikun 0:13413ea9a877 1875 * channels (VrefInt, temperature sensor, ...).
ganlikun 0:13413ea9a877 1876 * @note One or several values can be selected.
ganlikun 0:13413ea9a877 1877 * Example: (LL_ADC_PATH_INTERNAL_VREFINT |
ganlikun 0:13413ea9a877 1878 * LL_ADC_PATH_INTERNAL_TEMPSENSOR)
ganlikun 0:13413ea9a877 1879 * @rmtoll CCR TSVREFE LL_ADC_GetCommonPathInternalCh\n
ganlikun 0:13413ea9a877 1880 * CCR VBATE LL_ADC_GetCommonPathInternalCh
ganlikun 0:13413ea9a877 1881 * @param ADCxy_COMMON ADC common instance
ganlikun 0:13413ea9a877 1882 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
ganlikun 0:13413ea9a877 1883 * @retval Returned value can be a combination of the following values:
ganlikun 0:13413ea9a877 1884 * @arg @ref LL_ADC_PATH_INTERNAL_NONE
ganlikun 0:13413ea9a877 1885 * @arg @ref LL_ADC_PATH_INTERNAL_VREFINT
ganlikun 0:13413ea9a877 1886 * @arg @ref LL_ADC_PATH_INTERNAL_TEMPSENSOR
ganlikun 0:13413ea9a877 1887 * @arg @ref LL_ADC_PATH_INTERNAL_VBAT
ganlikun 0:13413ea9a877 1888 */
ganlikun 0:13413ea9a877 1889 __STATIC_INLINE uint32_t LL_ADC_GetCommonPathInternalCh(ADC_Common_TypeDef *ADCxy_COMMON)
ganlikun 0:13413ea9a877 1890 {
ganlikun 0:13413ea9a877 1891 return (uint32_t)(READ_BIT(ADCxy_COMMON->CCR, ADC_CCR_TSVREFE | ADC_CCR_VBATE));
ganlikun 0:13413ea9a877 1892 }
ganlikun 0:13413ea9a877 1893
ganlikun 0:13413ea9a877 1894 /**
ganlikun 0:13413ea9a877 1895 * @}
ganlikun 0:13413ea9a877 1896 */
ganlikun 0:13413ea9a877 1897
ganlikun 0:13413ea9a877 1898 /** @defgroup ADC_LL_EF_Configuration_ADC_Instance Configuration of ADC hierarchical scope: ADC instance
ganlikun 0:13413ea9a877 1899 * @{
ganlikun 0:13413ea9a877 1900 */
ganlikun 0:13413ea9a877 1901
ganlikun 0:13413ea9a877 1902 /**
ganlikun 0:13413ea9a877 1903 * @brief Set ADC resolution.
ganlikun 0:13413ea9a877 1904 * Refer to reference manual for alignments formats
ganlikun 0:13413ea9a877 1905 * dependencies to ADC resolutions.
ganlikun 0:13413ea9a877 1906 * @rmtoll CR1 RES LL_ADC_SetResolution
ganlikun 0:13413ea9a877 1907 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 1908 * @param Resolution This parameter can be one of the following values:
ganlikun 0:13413ea9a877 1909 * @arg @ref LL_ADC_RESOLUTION_12B
ganlikun 0:13413ea9a877 1910 * @arg @ref LL_ADC_RESOLUTION_10B
ganlikun 0:13413ea9a877 1911 * @arg @ref LL_ADC_RESOLUTION_8B
ganlikun 0:13413ea9a877 1912 * @arg @ref LL_ADC_RESOLUTION_6B
ganlikun 0:13413ea9a877 1913 * @retval None
ganlikun 0:13413ea9a877 1914 */
ganlikun 0:13413ea9a877 1915 __STATIC_INLINE void LL_ADC_SetResolution(ADC_TypeDef *ADCx, uint32_t Resolution)
ganlikun 0:13413ea9a877 1916 {
ganlikun 0:13413ea9a877 1917 MODIFY_REG(ADCx->CR1, ADC_CR1_RES, Resolution);
ganlikun 0:13413ea9a877 1918 }
ganlikun 0:13413ea9a877 1919
ganlikun 0:13413ea9a877 1920 /**
ganlikun 0:13413ea9a877 1921 * @brief Get ADC resolution.
ganlikun 0:13413ea9a877 1922 * Refer to reference manual for alignments formats
ganlikun 0:13413ea9a877 1923 * dependencies to ADC resolutions.
ganlikun 0:13413ea9a877 1924 * @rmtoll CR1 RES LL_ADC_GetResolution
ganlikun 0:13413ea9a877 1925 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 1926 * @retval Returned value can be one of the following values:
ganlikun 0:13413ea9a877 1927 * @arg @ref LL_ADC_RESOLUTION_12B
ganlikun 0:13413ea9a877 1928 * @arg @ref LL_ADC_RESOLUTION_10B
ganlikun 0:13413ea9a877 1929 * @arg @ref LL_ADC_RESOLUTION_8B
ganlikun 0:13413ea9a877 1930 * @arg @ref LL_ADC_RESOLUTION_6B
ganlikun 0:13413ea9a877 1931 */
ganlikun 0:13413ea9a877 1932 __STATIC_INLINE uint32_t LL_ADC_GetResolution(ADC_TypeDef *ADCx)
ganlikun 0:13413ea9a877 1933 {
ganlikun 0:13413ea9a877 1934 return (uint32_t)(READ_BIT(ADCx->CR1, ADC_CR1_RES));
ganlikun 0:13413ea9a877 1935 }
ganlikun 0:13413ea9a877 1936
ganlikun 0:13413ea9a877 1937 /**
ganlikun 0:13413ea9a877 1938 * @brief Set ADC conversion data alignment.
ganlikun 0:13413ea9a877 1939 * @note Refer to reference manual for alignments formats
ganlikun 0:13413ea9a877 1940 * dependencies to ADC resolutions.
ganlikun 0:13413ea9a877 1941 * @rmtoll CR2 ALIGN LL_ADC_SetDataAlignment
ganlikun 0:13413ea9a877 1942 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 1943 * @param DataAlignment This parameter can be one of the following values:
ganlikun 0:13413ea9a877 1944 * @arg @ref LL_ADC_DATA_ALIGN_RIGHT
ganlikun 0:13413ea9a877 1945 * @arg @ref LL_ADC_DATA_ALIGN_LEFT
ganlikun 0:13413ea9a877 1946 * @retval None
ganlikun 0:13413ea9a877 1947 */
ganlikun 0:13413ea9a877 1948 __STATIC_INLINE void LL_ADC_SetDataAlignment(ADC_TypeDef *ADCx, uint32_t DataAlignment)
ganlikun 0:13413ea9a877 1949 {
ganlikun 0:13413ea9a877 1950 MODIFY_REG(ADCx->CR2, ADC_CR2_ALIGN, DataAlignment);
ganlikun 0:13413ea9a877 1951 }
ganlikun 0:13413ea9a877 1952
ganlikun 0:13413ea9a877 1953 /**
ganlikun 0:13413ea9a877 1954 * @brief Get ADC conversion data alignment.
ganlikun 0:13413ea9a877 1955 * @note Refer to reference manual for alignments formats
ganlikun 0:13413ea9a877 1956 * dependencies to ADC resolutions.
ganlikun 0:13413ea9a877 1957 * @rmtoll CR2 ALIGN LL_ADC_SetDataAlignment
ganlikun 0:13413ea9a877 1958 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 1959 * @retval Returned value can be one of the following values:
ganlikun 0:13413ea9a877 1960 * @arg @ref LL_ADC_DATA_ALIGN_RIGHT
ganlikun 0:13413ea9a877 1961 * @arg @ref LL_ADC_DATA_ALIGN_LEFT
ganlikun 0:13413ea9a877 1962 */
ganlikun 0:13413ea9a877 1963 __STATIC_INLINE uint32_t LL_ADC_GetDataAlignment(ADC_TypeDef *ADCx)
ganlikun 0:13413ea9a877 1964 {
ganlikun 0:13413ea9a877 1965 return (uint32_t)(READ_BIT(ADCx->CR2, ADC_CR2_ALIGN));
ganlikun 0:13413ea9a877 1966 }
ganlikun 0:13413ea9a877 1967
ganlikun 0:13413ea9a877 1968 /**
ganlikun 0:13413ea9a877 1969 * @brief Set ADC sequencers scan mode, for all ADC groups
ganlikun 0:13413ea9a877 1970 * (group regular, group injected).
ganlikun 0:13413ea9a877 1971 * @note According to sequencers scan mode :
ganlikun 0:13413ea9a877 1972 * - If disabled: ADC conversion is performed in unitary conversion
ganlikun 0:13413ea9a877 1973 * mode (one channel converted, that defined in rank 1).
ganlikun 0:13413ea9a877 1974 * Configuration of sequencers of all ADC groups
ganlikun 0:13413ea9a877 1975 * (sequencer scan length, ...) is discarded: equivalent to
ganlikun 0:13413ea9a877 1976 * scan length of 1 rank.
ganlikun 0:13413ea9a877 1977 * - If enabled: ADC conversions are performed in sequence conversions
ganlikun 0:13413ea9a877 1978 * mode, according to configuration of sequencers of
ganlikun 0:13413ea9a877 1979 * each ADC group (sequencer scan length, ...).
ganlikun 0:13413ea9a877 1980 * Refer to function @ref LL_ADC_REG_SetSequencerLength()
ganlikun 0:13413ea9a877 1981 * and to function @ref LL_ADC_INJ_SetSequencerLength().
ganlikun 0:13413ea9a877 1982 * @rmtoll CR1 SCAN LL_ADC_SetSequencersScanMode
ganlikun 0:13413ea9a877 1983 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 1984 * @param ScanMode This parameter can be one of the following values:
ganlikun 0:13413ea9a877 1985 * @arg @ref LL_ADC_SEQ_SCAN_DISABLE
ganlikun 0:13413ea9a877 1986 * @arg @ref LL_ADC_SEQ_SCAN_ENABLE
ganlikun 0:13413ea9a877 1987 * @retval None
ganlikun 0:13413ea9a877 1988 */
ganlikun 0:13413ea9a877 1989 __STATIC_INLINE void LL_ADC_SetSequencersScanMode(ADC_TypeDef *ADCx, uint32_t ScanMode)
ganlikun 0:13413ea9a877 1990 {
ganlikun 0:13413ea9a877 1991 MODIFY_REG(ADCx->CR1, ADC_CR1_SCAN, ScanMode);
ganlikun 0:13413ea9a877 1992 }
ganlikun 0:13413ea9a877 1993
ganlikun 0:13413ea9a877 1994 /**
ganlikun 0:13413ea9a877 1995 * @brief Get ADC sequencers scan mode, for all ADC groups
ganlikun 0:13413ea9a877 1996 * (group regular, group injected).
ganlikun 0:13413ea9a877 1997 * @note According to sequencers scan mode :
ganlikun 0:13413ea9a877 1998 * - If disabled: ADC conversion is performed in unitary conversion
ganlikun 0:13413ea9a877 1999 * mode (one channel converted, that defined in rank 1).
ganlikun 0:13413ea9a877 2000 * Configuration of sequencers of all ADC groups
ganlikun 0:13413ea9a877 2001 * (sequencer scan length, ...) is discarded: equivalent to
ganlikun 0:13413ea9a877 2002 * scan length of 1 rank.
ganlikun 0:13413ea9a877 2003 * - If enabled: ADC conversions are performed in sequence conversions
ganlikun 0:13413ea9a877 2004 * mode, according to configuration of sequencers of
ganlikun 0:13413ea9a877 2005 * each ADC group (sequencer scan length, ...).
ganlikun 0:13413ea9a877 2006 * Refer to function @ref LL_ADC_REG_SetSequencerLength()
ganlikun 0:13413ea9a877 2007 * and to function @ref LL_ADC_INJ_SetSequencerLength().
ganlikun 0:13413ea9a877 2008 * @rmtoll CR1 SCAN LL_ADC_GetSequencersScanMode
ganlikun 0:13413ea9a877 2009 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 2010 * @retval Returned value can be one of the following values:
ganlikun 0:13413ea9a877 2011 * @arg @ref LL_ADC_SEQ_SCAN_DISABLE
ganlikun 0:13413ea9a877 2012 * @arg @ref LL_ADC_SEQ_SCAN_ENABLE
ganlikun 0:13413ea9a877 2013 */
ganlikun 0:13413ea9a877 2014 __STATIC_INLINE uint32_t LL_ADC_GetSequencersScanMode(ADC_TypeDef *ADCx)
ganlikun 0:13413ea9a877 2015 {
ganlikun 0:13413ea9a877 2016 return (uint32_t)(READ_BIT(ADCx->CR1, ADC_CR1_SCAN));
ganlikun 0:13413ea9a877 2017 }
ganlikun 0:13413ea9a877 2018
ganlikun 0:13413ea9a877 2019 /**
ganlikun 0:13413ea9a877 2020 * @}
ganlikun 0:13413ea9a877 2021 */
ganlikun 0:13413ea9a877 2022
ganlikun 0:13413ea9a877 2023 /** @defgroup ADC_LL_EF_Configuration_ADC_Group_Regular Configuration of ADC hierarchical scope: group regular
ganlikun 0:13413ea9a877 2024 * @{
ganlikun 0:13413ea9a877 2025 */
ganlikun 0:13413ea9a877 2026
ganlikun 0:13413ea9a877 2027 /**
ganlikun 0:13413ea9a877 2028 * @brief Set ADC group regular conversion trigger source:
ganlikun 0:13413ea9a877 2029 * internal (SW start) or from external IP (timer event,
ganlikun 0:13413ea9a877 2030 * external interrupt line).
ganlikun 0:13413ea9a877 2031 * @note On this STM32 serie, setting of external trigger edge is performed
ganlikun 0:13413ea9a877 2032 * using function @ref LL_ADC_REG_StartConversionExtTrig().
ganlikun 0:13413ea9a877 2033 * @note Availability of parameters of trigger sources from timer
ganlikun 0:13413ea9a877 2034 * depends on timers availability on the selected device.
ganlikun 0:13413ea9a877 2035 * @rmtoll CR2 EXTSEL LL_ADC_REG_SetTriggerSource\n
ganlikun 0:13413ea9a877 2036 * CR2 EXTEN LL_ADC_REG_SetTriggerSource
ganlikun 0:13413ea9a877 2037 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 2038 * @param TriggerSource This parameter can be one of the following values:
ganlikun 0:13413ea9a877 2039 * @arg @ref LL_ADC_REG_TRIG_SOFTWARE
ganlikun 0:13413ea9a877 2040 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM1_CH1
ganlikun 0:13413ea9a877 2041 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM1_CH2
ganlikun 0:13413ea9a877 2042 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM1_CH3
ganlikun 0:13413ea9a877 2043 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM2_CH2
ganlikun 0:13413ea9a877 2044 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM2_CH3
ganlikun 0:13413ea9a877 2045 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM2_CH4
ganlikun 0:13413ea9a877 2046 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM2_TRGO
ganlikun 0:13413ea9a877 2047 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM3_CH1
ganlikun 0:13413ea9a877 2048 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM3_TRGO
ganlikun 0:13413ea9a877 2049 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM4_CH4
ganlikun 0:13413ea9a877 2050 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM5_CH1
ganlikun 0:13413ea9a877 2051 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM5_CH2
ganlikun 0:13413ea9a877 2052 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM5_CH3
ganlikun 0:13413ea9a877 2053 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM8_CH1
ganlikun 0:13413ea9a877 2054 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM8_TRGO
ganlikun 0:13413ea9a877 2055 * @arg @ref LL_ADC_REG_TRIG_EXT_EXTI_LINE11
ganlikun 0:13413ea9a877 2056 * @retval None
ganlikun 0:13413ea9a877 2057 */
ganlikun 0:13413ea9a877 2058 __STATIC_INLINE void LL_ADC_REG_SetTriggerSource(ADC_TypeDef *ADCx, uint32_t TriggerSource)
ganlikun 0:13413ea9a877 2059 {
ganlikun 0:13413ea9a877 2060 /* Note: On this STM32 serie, ADC group regular external trigger edge */
ganlikun 0:13413ea9a877 2061 /* is used to perform a ADC conversion start. */
ganlikun 0:13413ea9a877 2062 /* This function does not set external trigger edge. */
ganlikun 0:13413ea9a877 2063 /* This feature is set using function */
ganlikun 0:13413ea9a877 2064 /* @ref LL_ADC_REG_StartConversionExtTrig(). */
ganlikun 0:13413ea9a877 2065 MODIFY_REG(ADCx->CR2, ADC_CR2_EXTSEL, (TriggerSource & ADC_CR2_EXTSEL));
ganlikun 0:13413ea9a877 2066 }
ganlikun 0:13413ea9a877 2067
ganlikun 0:13413ea9a877 2068 /**
ganlikun 0:13413ea9a877 2069 * @brief Get ADC group regular conversion trigger source:
ganlikun 0:13413ea9a877 2070 * internal (SW start) or from external IP (timer event,
ganlikun 0:13413ea9a877 2071 * external interrupt line).
ganlikun 0:13413ea9a877 2072 * @note To determine whether group regular trigger source is
ganlikun 0:13413ea9a877 2073 * internal (SW start) or external, without detail
ganlikun 0:13413ea9a877 2074 * of which peripheral is selected as external trigger,
ganlikun 0:13413ea9a877 2075 * (equivalent to
ganlikun 0:13413ea9a877 2076 * "if(LL_ADC_REG_GetTriggerSource(ADC1) == LL_ADC_REG_TRIG_SOFTWARE)")
ganlikun 0:13413ea9a877 2077 * use function @ref LL_ADC_REG_IsTriggerSourceSWStart.
ganlikun 0:13413ea9a877 2078 * @note Availability of parameters of trigger sources from timer
ganlikun 0:13413ea9a877 2079 * depends on timers availability on the selected device.
ganlikun 0:13413ea9a877 2080 * @rmtoll CR2 EXTSEL LL_ADC_REG_GetTriggerSource\n
ganlikun 0:13413ea9a877 2081 * CR2 EXTEN LL_ADC_REG_GetTriggerSource
ganlikun 0:13413ea9a877 2082 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 2083 * @retval Returned value can be one of the following values:
ganlikun 0:13413ea9a877 2084 * @arg @ref LL_ADC_REG_TRIG_SOFTWARE
ganlikun 0:13413ea9a877 2085 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM1_CH1
ganlikun 0:13413ea9a877 2086 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM1_CH2
ganlikun 0:13413ea9a877 2087 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM1_CH3
ganlikun 0:13413ea9a877 2088 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM2_CH2
ganlikun 0:13413ea9a877 2089 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM2_CH3
ganlikun 0:13413ea9a877 2090 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM2_CH4
ganlikun 0:13413ea9a877 2091 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM2_TRGO
ganlikun 0:13413ea9a877 2092 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM3_CH1
ganlikun 0:13413ea9a877 2093 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM3_TRGO
ganlikun 0:13413ea9a877 2094 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM4_CH4
ganlikun 0:13413ea9a877 2095 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM5_CH1
ganlikun 0:13413ea9a877 2096 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM5_CH2
ganlikun 0:13413ea9a877 2097 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM5_CH3
ganlikun 0:13413ea9a877 2098 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM8_CH1
ganlikun 0:13413ea9a877 2099 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM8_TRGO
ganlikun 0:13413ea9a877 2100 * @arg @ref LL_ADC_REG_TRIG_EXT_EXTI_LINE11
ganlikun 0:13413ea9a877 2101 */
ganlikun 0:13413ea9a877 2102 __STATIC_INLINE uint32_t LL_ADC_REG_GetTriggerSource(ADC_TypeDef *ADCx)
ganlikun 0:13413ea9a877 2103 {
ganlikun 0:13413ea9a877 2104 register uint32_t TriggerSource = READ_BIT(ADCx->CR2, ADC_CR2_EXTSEL | ADC_CR2_EXTEN);
ganlikun 0:13413ea9a877 2105
ganlikun 0:13413ea9a877 2106 /* Value for shift of {0; 4; 8; 12} depending on value of bitfield */
ganlikun 0:13413ea9a877 2107 /* corresponding to ADC_CR2_EXTEN {0; 1; 2; 3}. */
ganlikun 0:13413ea9a877 2108 register uint32_t ShiftExten = ((TriggerSource & ADC_CR2_EXTEN) >> (ADC_REG_TRIG_EXTEN_BITOFFSET_POS - 2U));
ganlikun 0:13413ea9a877 2109
ganlikun 0:13413ea9a877 2110 /* Set bitfield corresponding to ADC_CR2_EXTEN and ADC_CR2_EXTSEL */
ganlikun 0:13413ea9a877 2111 /* to match with triggers literals definition. */
ganlikun 0:13413ea9a877 2112 return ((TriggerSource
ganlikun 0:13413ea9a877 2113 & (ADC_REG_TRIG_SOURCE_MASK << ShiftExten) & ADC_CR2_EXTSEL)
ganlikun 0:13413ea9a877 2114 | ((ADC_REG_TRIG_EDGE_MASK << ShiftExten) & ADC_CR2_EXTEN)
ganlikun 0:13413ea9a877 2115 );
ganlikun 0:13413ea9a877 2116 }
ganlikun 0:13413ea9a877 2117
ganlikun 0:13413ea9a877 2118 /**
ganlikun 0:13413ea9a877 2119 * @brief Get ADC group regular conversion trigger source internal (SW start)
ganlikun 0:13413ea9a877 2120 or external.
ganlikun 0:13413ea9a877 2121 * @note In case of group regular trigger source set to external trigger,
ganlikun 0:13413ea9a877 2122 * to determine which peripheral is selected as external trigger,
ganlikun 0:13413ea9a877 2123 * use function @ref LL_ADC_REG_GetTriggerSource().
ganlikun 0:13413ea9a877 2124 * @rmtoll CR2 EXTEN LL_ADC_REG_IsTriggerSourceSWStart
ganlikun 0:13413ea9a877 2125 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 2126 * @retval Value "0" if trigger source external trigger
ganlikun 0:13413ea9a877 2127 * Value "1" if trigger source SW start.
ganlikun 0:13413ea9a877 2128 */
ganlikun 0:13413ea9a877 2129 __STATIC_INLINE uint32_t LL_ADC_REG_IsTriggerSourceSWStart(ADC_TypeDef *ADCx)
ganlikun 0:13413ea9a877 2130 {
ganlikun 0:13413ea9a877 2131 return (READ_BIT(ADCx->CR2, ADC_CR2_EXTEN) == (LL_ADC_REG_TRIG_SOFTWARE & ADC_CR2_EXTEN));
ganlikun 0:13413ea9a877 2132 }
ganlikun 0:13413ea9a877 2133
ganlikun 0:13413ea9a877 2134 /**
ganlikun 0:13413ea9a877 2135 * @brief Get ADC group regular conversion trigger polarity.
ganlikun 0:13413ea9a877 2136 * @note Applicable only for trigger source set to external trigger.
ganlikun 0:13413ea9a877 2137 * @note On this STM32 serie, setting of external trigger edge is performed
ganlikun 0:13413ea9a877 2138 * using function @ref LL_ADC_REG_StartConversionExtTrig().
ganlikun 0:13413ea9a877 2139 * @rmtoll CR2 EXTEN LL_ADC_REG_GetTriggerEdge
ganlikun 0:13413ea9a877 2140 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 2141 * @retval Returned value can be one of the following values:
ganlikun 0:13413ea9a877 2142 * @arg @ref LL_ADC_REG_TRIG_EXT_RISING
ganlikun 0:13413ea9a877 2143 * @arg @ref LL_ADC_REG_TRIG_EXT_FALLING
ganlikun 0:13413ea9a877 2144 * @arg @ref LL_ADC_REG_TRIG_EXT_RISINGFALLING
ganlikun 0:13413ea9a877 2145 */
ganlikun 0:13413ea9a877 2146 __STATIC_INLINE uint32_t LL_ADC_REG_GetTriggerEdge(ADC_TypeDef *ADCx)
ganlikun 0:13413ea9a877 2147 {
ganlikun 0:13413ea9a877 2148 return (uint32_t)(READ_BIT(ADCx->CR2, ADC_CR2_EXTEN));
ganlikun 0:13413ea9a877 2149 }
ganlikun 0:13413ea9a877 2150
ganlikun 0:13413ea9a877 2151
ganlikun 0:13413ea9a877 2152 /**
ganlikun 0:13413ea9a877 2153 * @brief Set ADC group regular sequencer length and scan direction.
ganlikun 0:13413ea9a877 2154 * @note Description of ADC group regular sequencer features:
ganlikun 0:13413ea9a877 2155 * - For devices with sequencer fully configurable
ganlikun 0:13413ea9a877 2156 * (function "LL_ADC_REG_SetSequencerRanks()" available):
ganlikun 0:13413ea9a877 2157 * sequencer length and each rank affectation to a channel
ganlikun 0:13413ea9a877 2158 * are configurable.
ganlikun 0:13413ea9a877 2159 * This function performs configuration of:
ganlikun 0:13413ea9a877 2160 * - Sequence length: Number of ranks in the scan sequence.
ganlikun 0:13413ea9a877 2161 * - Sequence direction: Unless specified in parameters, sequencer
ganlikun 0:13413ea9a877 2162 * scan direction is forward (from rank 1 to rank n).
ganlikun 0:13413ea9a877 2163 * Sequencer ranks are selected using
ganlikun 0:13413ea9a877 2164 * function "LL_ADC_REG_SetSequencerRanks()".
ganlikun 0:13413ea9a877 2165 * - For devices with sequencer not fully configurable
ganlikun 0:13413ea9a877 2166 * (function "LL_ADC_REG_SetSequencerChannels()" available):
ganlikun 0:13413ea9a877 2167 * sequencer length and each rank affectation to a channel
ganlikun 0:13413ea9a877 2168 * are defined by channel number.
ganlikun 0:13413ea9a877 2169 * This function performs configuration of:
ganlikun 0:13413ea9a877 2170 * - Sequence length: Number of ranks in the scan sequence is
ganlikun 0:13413ea9a877 2171 * defined by number of channels set in the sequence,
ganlikun 0:13413ea9a877 2172 * rank of each channel is fixed by channel HW number.
ganlikun 0:13413ea9a877 2173 * (channel 0 fixed on rank 0, channel 1 fixed on rank1, ...).
ganlikun 0:13413ea9a877 2174 * - Sequence direction: Unless specified in parameters, sequencer
ganlikun 0:13413ea9a877 2175 * scan direction is forward (from lowest channel number to
ganlikun 0:13413ea9a877 2176 * highest channel number).
ganlikun 0:13413ea9a877 2177 * Sequencer ranks are selected using
ganlikun 0:13413ea9a877 2178 * function "LL_ADC_REG_SetSequencerChannels()".
ganlikun 0:13413ea9a877 2179 * @note On this STM32 serie, group regular sequencer configuration
ganlikun 0:13413ea9a877 2180 * is conditioned to ADC instance sequencer mode.
ganlikun 0:13413ea9a877 2181 * If ADC instance sequencer mode is disabled, sequencers of
ganlikun 0:13413ea9a877 2182 * all groups (group regular, group injected) can be configured
ganlikun 0:13413ea9a877 2183 * but their execution is disabled (limited to rank 1).
ganlikun 0:13413ea9a877 2184 * Refer to function @ref LL_ADC_SetSequencersScanMode().
ganlikun 0:13413ea9a877 2185 * @note Sequencer disabled is equivalent to sequencer of 1 rank:
ganlikun 0:13413ea9a877 2186 * ADC conversion on only 1 channel.
ganlikun 0:13413ea9a877 2187 * @rmtoll SQR1 L LL_ADC_REG_SetSequencerLength
ganlikun 0:13413ea9a877 2188 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 2189 * @param SequencerNbRanks This parameter can be one of the following values:
ganlikun 0:13413ea9a877 2190 * @arg @ref LL_ADC_REG_SEQ_SCAN_DISABLE
ganlikun 0:13413ea9a877 2191 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_2RANKS
ganlikun 0:13413ea9a877 2192 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_3RANKS
ganlikun 0:13413ea9a877 2193 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_4RANKS
ganlikun 0:13413ea9a877 2194 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_5RANKS
ganlikun 0:13413ea9a877 2195 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_6RANKS
ganlikun 0:13413ea9a877 2196 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_7RANKS
ganlikun 0:13413ea9a877 2197 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_8RANKS
ganlikun 0:13413ea9a877 2198 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_9RANKS
ganlikun 0:13413ea9a877 2199 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_10RANKS
ganlikun 0:13413ea9a877 2200 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_11RANKS
ganlikun 0:13413ea9a877 2201 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_12RANKS
ganlikun 0:13413ea9a877 2202 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_13RANKS
ganlikun 0:13413ea9a877 2203 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_14RANKS
ganlikun 0:13413ea9a877 2204 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_15RANKS
ganlikun 0:13413ea9a877 2205 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_16RANKS
ganlikun 0:13413ea9a877 2206 * @retval None
ganlikun 0:13413ea9a877 2207 */
ganlikun 0:13413ea9a877 2208 __STATIC_INLINE void LL_ADC_REG_SetSequencerLength(ADC_TypeDef *ADCx, uint32_t SequencerNbRanks)
ganlikun 0:13413ea9a877 2209 {
ganlikun 0:13413ea9a877 2210 MODIFY_REG(ADCx->SQR1, ADC_SQR1_L, SequencerNbRanks);
ganlikun 0:13413ea9a877 2211 }
ganlikun 0:13413ea9a877 2212
ganlikun 0:13413ea9a877 2213 /**
ganlikun 0:13413ea9a877 2214 * @brief Get ADC group regular sequencer length and scan direction.
ganlikun 0:13413ea9a877 2215 * @note Description of ADC group regular sequencer features:
ganlikun 0:13413ea9a877 2216 * - For devices with sequencer fully configurable
ganlikun 0:13413ea9a877 2217 * (function "LL_ADC_REG_SetSequencerRanks()" available):
ganlikun 0:13413ea9a877 2218 * sequencer length and each rank affectation to a channel
ganlikun 0:13413ea9a877 2219 * are configurable.
ganlikun 0:13413ea9a877 2220 * This function retrieves:
ganlikun 0:13413ea9a877 2221 * - Sequence length: Number of ranks in the scan sequence.
ganlikun 0:13413ea9a877 2222 * - Sequence direction: Unless specified in parameters, sequencer
ganlikun 0:13413ea9a877 2223 * scan direction is forward (from rank 1 to rank n).
ganlikun 0:13413ea9a877 2224 * Sequencer ranks are selected using
ganlikun 0:13413ea9a877 2225 * function "LL_ADC_REG_SetSequencerRanks()".
ganlikun 0:13413ea9a877 2226 * - For devices with sequencer not fully configurable
ganlikun 0:13413ea9a877 2227 * (function "LL_ADC_REG_SetSequencerChannels()" available):
ganlikun 0:13413ea9a877 2228 * sequencer length and each rank affectation to a channel
ganlikun 0:13413ea9a877 2229 * are defined by channel number.
ganlikun 0:13413ea9a877 2230 * This function retrieves:
ganlikun 0:13413ea9a877 2231 * - Sequence length: Number of ranks in the scan sequence is
ganlikun 0:13413ea9a877 2232 * defined by number of channels set in the sequence,
ganlikun 0:13413ea9a877 2233 * rank of each channel is fixed by channel HW number.
ganlikun 0:13413ea9a877 2234 * (channel 0 fixed on rank 0, channel 1 fixed on rank1, ...).
ganlikun 0:13413ea9a877 2235 * - Sequence direction: Unless specified in parameters, sequencer
ganlikun 0:13413ea9a877 2236 * scan direction is forward (from lowest channel number to
ganlikun 0:13413ea9a877 2237 * highest channel number).
ganlikun 0:13413ea9a877 2238 * Sequencer ranks are selected using
ganlikun 0:13413ea9a877 2239 * function "LL_ADC_REG_SetSequencerChannels()".
ganlikun 0:13413ea9a877 2240 * @note On this STM32 serie, group regular sequencer configuration
ganlikun 0:13413ea9a877 2241 * is conditioned to ADC instance sequencer mode.
ganlikun 0:13413ea9a877 2242 * If ADC instance sequencer mode is disabled, sequencers of
ganlikun 0:13413ea9a877 2243 * all groups (group regular, group injected) can be configured
ganlikun 0:13413ea9a877 2244 * but their execution is disabled (limited to rank 1).
ganlikun 0:13413ea9a877 2245 * Refer to function @ref LL_ADC_SetSequencersScanMode().
ganlikun 0:13413ea9a877 2246 * @note Sequencer disabled is equivalent to sequencer of 1 rank:
ganlikun 0:13413ea9a877 2247 * ADC conversion on only 1 channel.
ganlikun 0:13413ea9a877 2248 * @rmtoll SQR1 L LL_ADC_REG_SetSequencerLength
ganlikun 0:13413ea9a877 2249 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 2250 * @retval Returned value can be one of the following values:
ganlikun 0:13413ea9a877 2251 * @arg @ref LL_ADC_REG_SEQ_SCAN_DISABLE
ganlikun 0:13413ea9a877 2252 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_2RANKS
ganlikun 0:13413ea9a877 2253 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_3RANKS
ganlikun 0:13413ea9a877 2254 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_4RANKS
ganlikun 0:13413ea9a877 2255 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_5RANKS
ganlikun 0:13413ea9a877 2256 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_6RANKS
ganlikun 0:13413ea9a877 2257 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_7RANKS
ganlikun 0:13413ea9a877 2258 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_8RANKS
ganlikun 0:13413ea9a877 2259 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_9RANKS
ganlikun 0:13413ea9a877 2260 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_10RANKS
ganlikun 0:13413ea9a877 2261 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_11RANKS
ganlikun 0:13413ea9a877 2262 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_12RANKS
ganlikun 0:13413ea9a877 2263 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_13RANKS
ganlikun 0:13413ea9a877 2264 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_14RANKS
ganlikun 0:13413ea9a877 2265 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_15RANKS
ganlikun 0:13413ea9a877 2266 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_16RANKS
ganlikun 0:13413ea9a877 2267 */
ganlikun 0:13413ea9a877 2268 __STATIC_INLINE uint32_t LL_ADC_REG_GetSequencerLength(ADC_TypeDef *ADCx)
ganlikun 0:13413ea9a877 2269 {
ganlikun 0:13413ea9a877 2270 return (uint32_t)(READ_BIT(ADCx->SQR1, ADC_SQR1_L));
ganlikun 0:13413ea9a877 2271 }
ganlikun 0:13413ea9a877 2272
ganlikun 0:13413ea9a877 2273 /**
ganlikun 0:13413ea9a877 2274 * @brief Set ADC group regular sequencer discontinuous mode:
ganlikun 0:13413ea9a877 2275 * sequence subdivided and scan conversions interrupted every selected
ganlikun 0:13413ea9a877 2276 * number of ranks.
ganlikun 0:13413ea9a877 2277 * @note It is not possible to enable both ADC group regular
ganlikun 0:13413ea9a877 2278 * continuous mode and sequencer discontinuous mode.
ganlikun 0:13413ea9a877 2279 * @note It is not possible to enable both ADC auto-injected mode
ganlikun 0:13413ea9a877 2280 * and ADC group regular sequencer discontinuous mode.
ganlikun 0:13413ea9a877 2281 * @rmtoll CR1 DISCEN LL_ADC_REG_SetSequencerDiscont\n
ganlikun 0:13413ea9a877 2282 * CR1 DISCNUM LL_ADC_REG_SetSequencerDiscont
ganlikun 0:13413ea9a877 2283 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 2284 * @param SeqDiscont This parameter can be one of the following values:
ganlikun 0:13413ea9a877 2285 * @arg @ref LL_ADC_REG_SEQ_DISCONT_DISABLE
ganlikun 0:13413ea9a877 2286 * @arg @ref LL_ADC_REG_SEQ_DISCONT_1RANK
ganlikun 0:13413ea9a877 2287 * @arg @ref LL_ADC_REG_SEQ_DISCONT_2RANKS
ganlikun 0:13413ea9a877 2288 * @arg @ref LL_ADC_REG_SEQ_DISCONT_3RANKS
ganlikun 0:13413ea9a877 2289 * @arg @ref LL_ADC_REG_SEQ_DISCONT_4RANKS
ganlikun 0:13413ea9a877 2290 * @arg @ref LL_ADC_REG_SEQ_DISCONT_5RANKS
ganlikun 0:13413ea9a877 2291 * @arg @ref LL_ADC_REG_SEQ_DISCONT_6RANKS
ganlikun 0:13413ea9a877 2292 * @arg @ref LL_ADC_REG_SEQ_DISCONT_7RANKS
ganlikun 0:13413ea9a877 2293 * @arg @ref LL_ADC_REG_SEQ_DISCONT_8RANKS
ganlikun 0:13413ea9a877 2294 * @retval None
ganlikun 0:13413ea9a877 2295 */
ganlikun 0:13413ea9a877 2296 __STATIC_INLINE void LL_ADC_REG_SetSequencerDiscont(ADC_TypeDef *ADCx, uint32_t SeqDiscont)
ganlikun 0:13413ea9a877 2297 {
ganlikun 0:13413ea9a877 2298 MODIFY_REG(ADCx->CR1, ADC_CR1_DISCEN | ADC_CR1_DISCNUM, SeqDiscont);
ganlikun 0:13413ea9a877 2299 }
ganlikun 0:13413ea9a877 2300
ganlikun 0:13413ea9a877 2301 /**
ganlikun 0:13413ea9a877 2302 * @brief Get ADC group regular sequencer discontinuous mode:
ganlikun 0:13413ea9a877 2303 * sequence subdivided and scan conversions interrupted every selected
ganlikun 0:13413ea9a877 2304 * number of ranks.
ganlikun 0:13413ea9a877 2305 * @rmtoll CR1 DISCEN LL_ADC_REG_GetSequencerDiscont\n
ganlikun 0:13413ea9a877 2306 * CR1 DISCNUM LL_ADC_REG_GetSequencerDiscont
ganlikun 0:13413ea9a877 2307 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 2308 * @retval Returned value can be one of the following values:
ganlikun 0:13413ea9a877 2309 * @arg @ref LL_ADC_REG_SEQ_DISCONT_DISABLE
ganlikun 0:13413ea9a877 2310 * @arg @ref LL_ADC_REG_SEQ_DISCONT_1RANK
ganlikun 0:13413ea9a877 2311 * @arg @ref LL_ADC_REG_SEQ_DISCONT_2RANKS
ganlikun 0:13413ea9a877 2312 * @arg @ref LL_ADC_REG_SEQ_DISCONT_3RANKS
ganlikun 0:13413ea9a877 2313 * @arg @ref LL_ADC_REG_SEQ_DISCONT_4RANKS
ganlikun 0:13413ea9a877 2314 * @arg @ref LL_ADC_REG_SEQ_DISCONT_5RANKS
ganlikun 0:13413ea9a877 2315 * @arg @ref LL_ADC_REG_SEQ_DISCONT_6RANKS
ganlikun 0:13413ea9a877 2316 * @arg @ref LL_ADC_REG_SEQ_DISCONT_7RANKS
ganlikun 0:13413ea9a877 2317 * @arg @ref LL_ADC_REG_SEQ_DISCONT_8RANKS
ganlikun 0:13413ea9a877 2318 */
ganlikun 0:13413ea9a877 2319 __STATIC_INLINE uint32_t LL_ADC_REG_GetSequencerDiscont(ADC_TypeDef *ADCx)
ganlikun 0:13413ea9a877 2320 {
ganlikun 0:13413ea9a877 2321 return (uint32_t)(READ_BIT(ADCx->CR1, ADC_CR1_DISCEN | ADC_CR1_DISCNUM));
ganlikun 0:13413ea9a877 2322 }
ganlikun 0:13413ea9a877 2323
ganlikun 0:13413ea9a877 2324 /**
ganlikun 0:13413ea9a877 2325 * @brief Set ADC group regular sequence: channel on the selected
ganlikun 0:13413ea9a877 2326 * scan sequence rank.
ganlikun 0:13413ea9a877 2327 * @note This function performs configuration of:
ganlikun 0:13413ea9a877 2328 * - Channels ordering into each rank of scan sequence:
ganlikun 0:13413ea9a877 2329 * whatever channel can be placed into whatever rank.
ganlikun 0:13413ea9a877 2330 * @note On this STM32 serie, ADC group regular sequencer is
ganlikun 0:13413ea9a877 2331 * fully configurable: sequencer length and each rank
ganlikun 0:13413ea9a877 2332 * affectation to a channel are configurable.
ganlikun 0:13413ea9a877 2333 * Refer to description of function @ref LL_ADC_REG_SetSequencerLength().
ganlikun 0:13413ea9a877 2334 * @note Depending on devices and packages, some channels may not be available.
ganlikun 0:13413ea9a877 2335 * Refer to device datasheet for channels availability.
ganlikun 0:13413ea9a877 2336 * @note On this STM32 serie, to measure internal channels (VrefInt,
ganlikun 0:13413ea9a877 2337 * TempSensor, ...), measurement paths to internal channels must be
ganlikun 0:13413ea9a877 2338 * enabled separately.
ganlikun 0:13413ea9a877 2339 * This can be done using function @ref LL_ADC_SetCommonPathInternalCh().
ganlikun 0:13413ea9a877 2340 * @rmtoll SQR3 SQ1 LL_ADC_REG_SetSequencerRanks\n
ganlikun 0:13413ea9a877 2341 * SQR3 SQ2 LL_ADC_REG_SetSequencerRanks\n
ganlikun 0:13413ea9a877 2342 * SQR3 SQ3 LL_ADC_REG_SetSequencerRanks\n
ganlikun 0:13413ea9a877 2343 * SQR3 SQ4 LL_ADC_REG_SetSequencerRanks\n
ganlikun 0:13413ea9a877 2344 * SQR3 SQ5 LL_ADC_REG_SetSequencerRanks\n
ganlikun 0:13413ea9a877 2345 * SQR3 SQ6 LL_ADC_REG_SetSequencerRanks\n
ganlikun 0:13413ea9a877 2346 * SQR2 SQ7 LL_ADC_REG_SetSequencerRanks\n
ganlikun 0:13413ea9a877 2347 * SQR2 SQ8 LL_ADC_REG_SetSequencerRanks\n
ganlikun 0:13413ea9a877 2348 * SQR2 SQ9 LL_ADC_REG_SetSequencerRanks\n
ganlikun 0:13413ea9a877 2349 * SQR2 SQ10 LL_ADC_REG_SetSequencerRanks\n
ganlikun 0:13413ea9a877 2350 * SQR2 SQ11 LL_ADC_REG_SetSequencerRanks\n
ganlikun 0:13413ea9a877 2351 * SQR2 SQ12 LL_ADC_REG_SetSequencerRanks\n
ganlikun 0:13413ea9a877 2352 * SQR1 SQ13 LL_ADC_REG_SetSequencerRanks\n
ganlikun 0:13413ea9a877 2353 * SQR1 SQ14 LL_ADC_REG_SetSequencerRanks\n
ganlikun 0:13413ea9a877 2354 * SQR1 SQ15 LL_ADC_REG_SetSequencerRanks\n
ganlikun 0:13413ea9a877 2355 * SQR1 SQ16 LL_ADC_REG_SetSequencerRanks
ganlikun 0:13413ea9a877 2356 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 2357 * @param Rank This parameter can be one of the following values:
ganlikun 0:13413ea9a877 2358 * @arg @ref LL_ADC_REG_RANK_1
ganlikun 0:13413ea9a877 2359 * @arg @ref LL_ADC_REG_RANK_2
ganlikun 0:13413ea9a877 2360 * @arg @ref LL_ADC_REG_RANK_3
ganlikun 0:13413ea9a877 2361 * @arg @ref LL_ADC_REG_RANK_4
ganlikun 0:13413ea9a877 2362 * @arg @ref LL_ADC_REG_RANK_5
ganlikun 0:13413ea9a877 2363 * @arg @ref LL_ADC_REG_RANK_6
ganlikun 0:13413ea9a877 2364 * @arg @ref LL_ADC_REG_RANK_7
ganlikun 0:13413ea9a877 2365 * @arg @ref LL_ADC_REG_RANK_8
ganlikun 0:13413ea9a877 2366 * @arg @ref LL_ADC_REG_RANK_9
ganlikun 0:13413ea9a877 2367 * @arg @ref LL_ADC_REG_RANK_10
ganlikun 0:13413ea9a877 2368 * @arg @ref LL_ADC_REG_RANK_11
ganlikun 0:13413ea9a877 2369 * @arg @ref LL_ADC_REG_RANK_12
ganlikun 0:13413ea9a877 2370 * @arg @ref LL_ADC_REG_RANK_13
ganlikun 0:13413ea9a877 2371 * @arg @ref LL_ADC_REG_RANK_14
ganlikun 0:13413ea9a877 2372 * @arg @ref LL_ADC_REG_RANK_15
ganlikun 0:13413ea9a877 2373 * @arg @ref LL_ADC_REG_RANK_16
ganlikun 0:13413ea9a877 2374 * @param Channel This parameter can be one of the following values:
ganlikun 0:13413ea9a877 2375 * @arg @ref LL_ADC_CHANNEL_0
ganlikun 0:13413ea9a877 2376 * @arg @ref LL_ADC_CHANNEL_1
ganlikun 0:13413ea9a877 2377 * @arg @ref LL_ADC_CHANNEL_2
ganlikun 0:13413ea9a877 2378 * @arg @ref LL_ADC_CHANNEL_3
ganlikun 0:13413ea9a877 2379 * @arg @ref LL_ADC_CHANNEL_4
ganlikun 0:13413ea9a877 2380 * @arg @ref LL_ADC_CHANNEL_5
ganlikun 0:13413ea9a877 2381 * @arg @ref LL_ADC_CHANNEL_6
ganlikun 0:13413ea9a877 2382 * @arg @ref LL_ADC_CHANNEL_7
ganlikun 0:13413ea9a877 2383 * @arg @ref LL_ADC_CHANNEL_8
ganlikun 0:13413ea9a877 2384 * @arg @ref LL_ADC_CHANNEL_9
ganlikun 0:13413ea9a877 2385 * @arg @ref LL_ADC_CHANNEL_10
ganlikun 0:13413ea9a877 2386 * @arg @ref LL_ADC_CHANNEL_11
ganlikun 0:13413ea9a877 2387 * @arg @ref LL_ADC_CHANNEL_12
ganlikun 0:13413ea9a877 2388 * @arg @ref LL_ADC_CHANNEL_13
ganlikun 0:13413ea9a877 2389 * @arg @ref LL_ADC_CHANNEL_14
ganlikun 0:13413ea9a877 2390 * @arg @ref LL_ADC_CHANNEL_15
ganlikun 0:13413ea9a877 2391 * @arg @ref LL_ADC_CHANNEL_16
ganlikun 0:13413ea9a877 2392 * @arg @ref LL_ADC_CHANNEL_17
ganlikun 0:13413ea9a877 2393 * @arg @ref LL_ADC_CHANNEL_18
ganlikun 0:13413ea9a877 2394 * @arg @ref LL_ADC_CHANNEL_VREFINT (1)
ganlikun 0:13413ea9a877 2395 * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR (1)(2)
ganlikun 0:13413ea9a877 2396 * @arg @ref LL_ADC_CHANNEL_VBAT (1)
ganlikun 0:13413ea9a877 2397 *
ganlikun 0:13413ea9a877 2398 * (1) On STM32F4, parameter available only on ADC instance: ADC1.\n
ganlikun 0:13413ea9a877 2399 * (2) On devices STM32F42x and STM32F43x, limitation: this internal channel is shared between temperature sensor and Vbat, only 1 measurement path must be enabled.
ganlikun 0:13413ea9a877 2400 * @retval None
ganlikun 0:13413ea9a877 2401 */
ganlikun 0:13413ea9a877 2402 __STATIC_INLINE void LL_ADC_REG_SetSequencerRanks(ADC_TypeDef *ADCx, uint32_t Rank, uint32_t Channel)
ganlikun 0:13413ea9a877 2403 {
ganlikun 0:13413ea9a877 2404 /* Set bits with content of parameter "Channel" with bits position */
ganlikun 0:13413ea9a877 2405 /* in register and register position depending on parameter "Rank". */
ganlikun 0:13413ea9a877 2406 /* Parameters "Rank" and "Channel" are used with masks because containing */
ganlikun 0:13413ea9a877 2407 /* other bits reserved for other purpose. */
ganlikun 0:13413ea9a877 2408 register uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->SQR1, __ADC_MASK_SHIFT(Rank, ADC_REG_SQRX_REGOFFSET_MASK));
ganlikun 0:13413ea9a877 2409
ganlikun 0:13413ea9a877 2410 MODIFY_REG(*preg,
ganlikun 0:13413ea9a877 2411 ADC_CHANNEL_ID_NUMBER_MASK << (Rank & ADC_REG_RANK_ID_SQRX_MASK),
ganlikun 0:13413ea9a877 2412 (Channel & ADC_CHANNEL_ID_NUMBER_MASK) << (Rank & ADC_REG_RANK_ID_SQRX_MASK));
ganlikun 0:13413ea9a877 2413 }
ganlikun 0:13413ea9a877 2414
ganlikun 0:13413ea9a877 2415 /**
ganlikun 0:13413ea9a877 2416 * @brief Get ADC group regular sequence: channel on the selected
ganlikun 0:13413ea9a877 2417 * scan sequence rank.
ganlikun 0:13413ea9a877 2418 * @note On this STM32 serie, ADC group regular sequencer is
ganlikun 0:13413ea9a877 2419 * fully configurable: sequencer length and each rank
ganlikun 0:13413ea9a877 2420 * affectation to a channel are configurable.
ganlikun 0:13413ea9a877 2421 * Refer to description of function @ref LL_ADC_REG_SetSequencerLength().
ganlikun 0:13413ea9a877 2422 * @note Depending on devices and packages, some channels may not be available.
ganlikun 0:13413ea9a877 2423 * Refer to device datasheet for channels availability.
ganlikun 0:13413ea9a877 2424 * @note Usage of the returned channel number:
ganlikun 0:13413ea9a877 2425 * - To reinject this channel into another function LL_ADC_xxx:
ganlikun 0:13413ea9a877 2426 * the returned channel number is only partly formatted on definition
ganlikun 0:13413ea9a877 2427 * of literals LL_ADC_CHANNEL_x. Therefore, it has to be compared
ganlikun 0:13413ea9a877 2428 * with parts of literals LL_ADC_CHANNEL_x or using
ganlikun 0:13413ea9a877 2429 * helper macro @ref __LL_ADC_CHANNEL_TO_DECIMAL_NB().
ganlikun 0:13413ea9a877 2430 * Then the selected literal LL_ADC_CHANNEL_x can be used
ganlikun 0:13413ea9a877 2431 * as parameter for another function.
ganlikun 0:13413ea9a877 2432 * - To get the channel number in decimal format:
ganlikun 0:13413ea9a877 2433 * process the returned value with the helper macro
ganlikun 0:13413ea9a877 2434 * @ref __LL_ADC_CHANNEL_TO_DECIMAL_NB().
ganlikun 0:13413ea9a877 2435 * @rmtoll SQR3 SQ1 LL_ADC_REG_GetSequencerRanks\n
ganlikun 0:13413ea9a877 2436 * SQR3 SQ2 LL_ADC_REG_GetSequencerRanks\n
ganlikun 0:13413ea9a877 2437 * SQR3 SQ3 LL_ADC_REG_GetSequencerRanks\n
ganlikun 0:13413ea9a877 2438 * SQR3 SQ4 LL_ADC_REG_GetSequencerRanks\n
ganlikun 0:13413ea9a877 2439 * SQR3 SQ5 LL_ADC_REG_GetSequencerRanks\n
ganlikun 0:13413ea9a877 2440 * SQR3 SQ6 LL_ADC_REG_GetSequencerRanks\n
ganlikun 0:13413ea9a877 2441 * SQR2 SQ7 LL_ADC_REG_GetSequencerRanks\n
ganlikun 0:13413ea9a877 2442 * SQR2 SQ8 LL_ADC_REG_GetSequencerRanks\n
ganlikun 0:13413ea9a877 2443 * SQR2 SQ9 LL_ADC_REG_GetSequencerRanks\n
ganlikun 0:13413ea9a877 2444 * SQR2 SQ10 LL_ADC_REG_GetSequencerRanks\n
ganlikun 0:13413ea9a877 2445 * SQR2 SQ11 LL_ADC_REG_GetSequencerRanks\n
ganlikun 0:13413ea9a877 2446 * SQR2 SQ12 LL_ADC_REG_GetSequencerRanks\n
ganlikun 0:13413ea9a877 2447 * SQR1 SQ13 LL_ADC_REG_GetSequencerRanks\n
ganlikun 0:13413ea9a877 2448 * SQR1 SQ14 LL_ADC_REG_GetSequencerRanks\n
ganlikun 0:13413ea9a877 2449 * SQR1 SQ15 LL_ADC_REG_GetSequencerRanks\n
ganlikun 0:13413ea9a877 2450 * SQR1 SQ16 LL_ADC_REG_GetSequencerRanks
ganlikun 0:13413ea9a877 2451 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 2452 * @param Rank This parameter can be one of the following values:
ganlikun 0:13413ea9a877 2453 * @arg @ref LL_ADC_REG_RANK_1
ganlikun 0:13413ea9a877 2454 * @arg @ref LL_ADC_REG_RANK_2
ganlikun 0:13413ea9a877 2455 * @arg @ref LL_ADC_REG_RANK_3
ganlikun 0:13413ea9a877 2456 * @arg @ref LL_ADC_REG_RANK_4
ganlikun 0:13413ea9a877 2457 * @arg @ref LL_ADC_REG_RANK_5
ganlikun 0:13413ea9a877 2458 * @arg @ref LL_ADC_REG_RANK_6
ganlikun 0:13413ea9a877 2459 * @arg @ref LL_ADC_REG_RANK_7
ganlikun 0:13413ea9a877 2460 * @arg @ref LL_ADC_REG_RANK_8
ganlikun 0:13413ea9a877 2461 * @arg @ref LL_ADC_REG_RANK_9
ganlikun 0:13413ea9a877 2462 * @arg @ref LL_ADC_REG_RANK_10
ganlikun 0:13413ea9a877 2463 * @arg @ref LL_ADC_REG_RANK_11
ganlikun 0:13413ea9a877 2464 * @arg @ref LL_ADC_REG_RANK_12
ganlikun 0:13413ea9a877 2465 * @arg @ref LL_ADC_REG_RANK_13
ganlikun 0:13413ea9a877 2466 * @arg @ref LL_ADC_REG_RANK_14
ganlikun 0:13413ea9a877 2467 * @arg @ref LL_ADC_REG_RANK_15
ganlikun 0:13413ea9a877 2468 * @arg @ref LL_ADC_REG_RANK_16
ganlikun 0:13413ea9a877 2469 * @retval Returned value can be one of the following values:
ganlikun 0:13413ea9a877 2470 * @arg @ref LL_ADC_CHANNEL_0
ganlikun 0:13413ea9a877 2471 * @arg @ref LL_ADC_CHANNEL_1
ganlikun 0:13413ea9a877 2472 * @arg @ref LL_ADC_CHANNEL_2
ganlikun 0:13413ea9a877 2473 * @arg @ref LL_ADC_CHANNEL_3
ganlikun 0:13413ea9a877 2474 * @arg @ref LL_ADC_CHANNEL_4
ganlikun 0:13413ea9a877 2475 * @arg @ref LL_ADC_CHANNEL_5
ganlikun 0:13413ea9a877 2476 * @arg @ref LL_ADC_CHANNEL_6
ganlikun 0:13413ea9a877 2477 * @arg @ref LL_ADC_CHANNEL_7
ganlikun 0:13413ea9a877 2478 * @arg @ref LL_ADC_CHANNEL_8
ganlikun 0:13413ea9a877 2479 * @arg @ref LL_ADC_CHANNEL_9
ganlikun 0:13413ea9a877 2480 * @arg @ref LL_ADC_CHANNEL_10
ganlikun 0:13413ea9a877 2481 * @arg @ref LL_ADC_CHANNEL_11
ganlikun 0:13413ea9a877 2482 * @arg @ref LL_ADC_CHANNEL_12
ganlikun 0:13413ea9a877 2483 * @arg @ref LL_ADC_CHANNEL_13
ganlikun 0:13413ea9a877 2484 * @arg @ref LL_ADC_CHANNEL_14
ganlikun 0:13413ea9a877 2485 * @arg @ref LL_ADC_CHANNEL_15
ganlikun 0:13413ea9a877 2486 * @arg @ref LL_ADC_CHANNEL_16
ganlikun 0:13413ea9a877 2487 * @arg @ref LL_ADC_CHANNEL_17
ganlikun 0:13413ea9a877 2488 * @arg @ref LL_ADC_CHANNEL_18
ganlikun 0:13413ea9a877 2489 * @arg @ref LL_ADC_CHANNEL_VREFINT (1)
ganlikun 0:13413ea9a877 2490 * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR (1)(2)
ganlikun 0:13413ea9a877 2491 * @arg @ref LL_ADC_CHANNEL_VBAT (1)
ganlikun 0:13413ea9a877 2492 *
ganlikun 0:13413ea9a877 2493 * (1) On STM32F4, parameter available only on ADC instance: ADC1.\n
ganlikun 0:13413ea9a877 2494 * (2) On devices STM32F42x and STM32F43x, limitation: this internal channel is shared between temperature sensor and Vbat, only 1 measurement path must be enabled.\n
ganlikun 0:13413ea9a877 2495 * (1) For ADC channel read back from ADC register,
ganlikun 0:13413ea9a877 2496 * comparison with internal channel parameter to be done
ganlikun 0:13413ea9a877 2497 * using helper macro @ref __LL_ADC_CHANNEL_INTERNAL_TO_EXTERNAL().
ganlikun 0:13413ea9a877 2498 */
ganlikun 0:13413ea9a877 2499 __STATIC_INLINE uint32_t LL_ADC_REG_GetSequencerRanks(ADC_TypeDef *ADCx, uint32_t Rank)
ganlikun 0:13413ea9a877 2500 {
ganlikun 0:13413ea9a877 2501 register uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->SQR1, __ADC_MASK_SHIFT(Rank, ADC_REG_SQRX_REGOFFSET_MASK));
ganlikun 0:13413ea9a877 2502
ganlikun 0:13413ea9a877 2503 return (uint32_t) (READ_BIT(*preg,
ganlikun 0:13413ea9a877 2504 ADC_CHANNEL_ID_NUMBER_MASK << (Rank & ADC_REG_RANK_ID_SQRX_MASK))
ganlikun 0:13413ea9a877 2505 >> (Rank & ADC_REG_RANK_ID_SQRX_MASK)
ganlikun 0:13413ea9a877 2506 );
ganlikun 0:13413ea9a877 2507 }
ganlikun 0:13413ea9a877 2508
ganlikun 0:13413ea9a877 2509 /**
ganlikun 0:13413ea9a877 2510 * @brief Set ADC continuous conversion mode on ADC group regular.
ganlikun 0:13413ea9a877 2511 * @note Description of ADC continuous conversion mode:
ganlikun 0:13413ea9a877 2512 * - single mode: one conversion per trigger
ganlikun 0:13413ea9a877 2513 * - continuous mode: after the first trigger, following
ganlikun 0:13413ea9a877 2514 * conversions launched successively automatically.
ganlikun 0:13413ea9a877 2515 * @note It is not possible to enable both ADC group regular
ganlikun 0:13413ea9a877 2516 * continuous mode and sequencer discontinuous mode.
ganlikun 0:13413ea9a877 2517 * @rmtoll CR2 CONT LL_ADC_REG_SetContinuousMode
ganlikun 0:13413ea9a877 2518 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 2519 * @param Continuous This parameter can be one of the following values:
ganlikun 0:13413ea9a877 2520 * @arg @ref LL_ADC_REG_CONV_SINGLE
ganlikun 0:13413ea9a877 2521 * @arg @ref LL_ADC_REG_CONV_CONTINUOUS
ganlikun 0:13413ea9a877 2522 * @retval None
ganlikun 0:13413ea9a877 2523 */
ganlikun 0:13413ea9a877 2524 __STATIC_INLINE void LL_ADC_REG_SetContinuousMode(ADC_TypeDef *ADCx, uint32_t Continuous)
ganlikun 0:13413ea9a877 2525 {
ganlikun 0:13413ea9a877 2526 MODIFY_REG(ADCx->CR2, ADC_CR2_CONT, Continuous);
ganlikun 0:13413ea9a877 2527 }
ganlikun 0:13413ea9a877 2528
ganlikun 0:13413ea9a877 2529 /**
ganlikun 0:13413ea9a877 2530 * @brief Get ADC continuous conversion mode on ADC group regular.
ganlikun 0:13413ea9a877 2531 * @note Description of ADC continuous conversion mode:
ganlikun 0:13413ea9a877 2532 * - single mode: one conversion per trigger
ganlikun 0:13413ea9a877 2533 * - continuous mode: after the first trigger, following
ganlikun 0:13413ea9a877 2534 * conversions launched successively automatically.
ganlikun 0:13413ea9a877 2535 * @rmtoll CR2 CONT LL_ADC_REG_GetContinuousMode
ganlikun 0:13413ea9a877 2536 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 2537 * @retval Returned value can be one of the following values:
ganlikun 0:13413ea9a877 2538 * @arg @ref LL_ADC_REG_CONV_SINGLE
ganlikun 0:13413ea9a877 2539 * @arg @ref LL_ADC_REG_CONV_CONTINUOUS
ganlikun 0:13413ea9a877 2540 */
ganlikun 0:13413ea9a877 2541 __STATIC_INLINE uint32_t LL_ADC_REG_GetContinuousMode(ADC_TypeDef *ADCx)
ganlikun 0:13413ea9a877 2542 {
ganlikun 0:13413ea9a877 2543 return (uint32_t)(READ_BIT(ADCx->CR2, ADC_CR2_CONT));
ganlikun 0:13413ea9a877 2544 }
ganlikun 0:13413ea9a877 2545
ganlikun 0:13413ea9a877 2546 /**
ganlikun 0:13413ea9a877 2547 * @brief Set ADC group regular conversion data transfer: no transfer or
ganlikun 0:13413ea9a877 2548 * transfer by DMA, and DMA requests mode.
ganlikun 0:13413ea9a877 2549 * @note If transfer by DMA selected, specifies the DMA requests
ganlikun 0:13413ea9a877 2550 * mode:
ganlikun 0:13413ea9a877 2551 * - Limited mode (One shot mode): DMA transfer requests are stopped
ganlikun 0:13413ea9a877 2552 * when number of DMA data transfers (number of
ganlikun 0:13413ea9a877 2553 * ADC conversions) is reached.
ganlikun 0:13413ea9a877 2554 * This ADC mode is intended to be used with DMA mode non-circular.
ganlikun 0:13413ea9a877 2555 * - Unlimited mode: DMA transfer requests are unlimited,
ganlikun 0:13413ea9a877 2556 * whatever number of DMA data transfers (number of
ganlikun 0:13413ea9a877 2557 * ADC conversions).
ganlikun 0:13413ea9a877 2558 * This ADC mode is intended to be used with DMA mode circular.
ganlikun 0:13413ea9a877 2559 * @note If ADC DMA requests mode is set to unlimited and DMA is set to
ganlikun 0:13413ea9a877 2560 * mode non-circular:
ganlikun 0:13413ea9a877 2561 * when DMA transfers size will be reached, DMA will stop transfers of
ganlikun 0:13413ea9a877 2562 * ADC conversions data ADC will raise an overrun error
ganlikun 0:13413ea9a877 2563 * (overrun flag and interruption if enabled).
ganlikun 0:13413ea9a877 2564 * @note For devices with several ADC instances: ADC multimode DMA
ganlikun 0:13413ea9a877 2565 * settings are available using function @ref LL_ADC_SetMultiDMATransfer().
ganlikun 0:13413ea9a877 2566 * @note To configure DMA source address (peripheral address),
ganlikun 0:13413ea9a877 2567 * use function @ref LL_ADC_DMA_GetRegAddr().
ganlikun 0:13413ea9a877 2568 * @rmtoll CR2 DMA LL_ADC_REG_SetDMATransfer\n
ganlikun 0:13413ea9a877 2569 * CR2 DDS LL_ADC_REG_SetDMATransfer
ganlikun 0:13413ea9a877 2570 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 2571 * @param DMATransfer This parameter can be one of the following values:
ganlikun 0:13413ea9a877 2572 * @arg @ref LL_ADC_REG_DMA_TRANSFER_NONE
ganlikun 0:13413ea9a877 2573 * @arg @ref LL_ADC_REG_DMA_TRANSFER_LIMITED
ganlikun 0:13413ea9a877 2574 * @arg @ref LL_ADC_REG_DMA_TRANSFER_UNLIMITED
ganlikun 0:13413ea9a877 2575 * @retval None
ganlikun 0:13413ea9a877 2576 */
ganlikun 0:13413ea9a877 2577 __STATIC_INLINE void LL_ADC_REG_SetDMATransfer(ADC_TypeDef *ADCx, uint32_t DMATransfer)
ganlikun 0:13413ea9a877 2578 {
ganlikun 0:13413ea9a877 2579 MODIFY_REG(ADCx->CR2, ADC_CR2_DMA | ADC_CR2_DDS, DMATransfer);
ganlikun 0:13413ea9a877 2580 }
ganlikun 0:13413ea9a877 2581
ganlikun 0:13413ea9a877 2582 /**
ganlikun 0:13413ea9a877 2583 * @brief Get ADC group regular conversion data transfer: no transfer or
ganlikun 0:13413ea9a877 2584 * transfer by DMA, and DMA requests mode.
ganlikun 0:13413ea9a877 2585 * @note If transfer by DMA selected, specifies the DMA requests
ganlikun 0:13413ea9a877 2586 * mode:
ganlikun 0:13413ea9a877 2587 * - Limited mode (One shot mode): DMA transfer requests are stopped
ganlikun 0:13413ea9a877 2588 * when number of DMA data transfers (number of
ganlikun 0:13413ea9a877 2589 * ADC conversions) is reached.
ganlikun 0:13413ea9a877 2590 * This ADC mode is intended to be used with DMA mode non-circular.
ganlikun 0:13413ea9a877 2591 * - Unlimited mode: DMA transfer requests are unlimited,
ganlikun 0:13413ea9a877 2592 * whatever number of DMA data transfers (number of
ganlikun 0:13413ea9a877 2593 * ADC conversions).
ganlikun 0:13413ea9a877 2594 * This ADC mode is intended to be used with DMA mode circular.
ganlikun 0:13413ea9a877 2595 * @note If ADC DMA requests mode is set to unlimited and DMA is set to
ganlikun 0:13413ea9a877 2596 * mode non-circular:
ganlikun 0:13413ea9a877 2597 * when DMA transfers size will be reached, DMA will stop transfers of
ganlikun 0:13413ea9a877 2598 * ADC conversions data ADC will raise an overrun error
ganlikun 0:13413ea9a877 2599 * (overrun flag and interruption if enabled).
ganlikun 0:13413ea9a877 2600 * @note For devices with several ADC instances: ADC multimode DMA
ganlikun 0:13413ea9a877 2601 * settings are available using function @ref LL_ADC_GetMultiDMATransfer().
ganlikun 0:13413ea9a877 2602 * @note To configure DMA source address (peripheral address),
ganlikun 0:13413ea9a877 2603 * use function @ref LL_ADC_DMA_GetRegAddr().
ganlikun 0:13413ea9a877 2604 * @rmtoll CR2 DMA LL_ADC_REG_GetDMATransfer\n
ganlikun 0:13413ea9a877 2605 * CR2 DDS LL_ADC_REG_GetDMATransfer
ganlikun 0:13413ea9a877 2606 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 2607 * @retval Returned value can be one of the following values:
ganlikun 0:13413ea9a877 2608 * @arg @ref LL_ADC_REG_DMA_TRANSFER_NONE
ganlikun 0:13413ea9a877 2609 * @arg @ref LL_ADC_REG_DMA_TRANSFER_LIMITED
ganlikun 0:13413ea9a877 2610 * @arg @ref LL_ADC_REG_DMA_TRANSFER_UNLIMITED
ganlikun 0:13413ea9a877 2611 */
ganlikun 0:13413ea9a877 2612 __STATIC_INLINE uint32_t LL_ADC_REG_GetDMATransfer(ADC_TypeDef *ADCx)
ganlikun 0:13413ea9a877 2613 {
ganlikun 0:13413ea9a877 2614 return (uint32_t)(READ_BIT(ADCx->CR2, ADC_CR2_DMA | ADC_CR2_DDS));
ganlikun 0:13413ea9a877 2615 }
ganlikun 0:13413ea9a877 2616
ganlikun 0:13413ea9a877 2617 /**
ganlikun 0:13413ea9a877 2618 * @brief Specify which ADC flag between EOC (end of unitary conversion)
ganlikun 0:13413ea9a877 2619 * or EOS (end of sequence conversions) is used to indicate
ganlikun 0:13413ea9a877 2620 * the end of conversion.
ganlikun 0:13413ea9a877 2621 * @note This feature is aimed to be set when using ADC with
ganlikun 0:13413ea9a877 2622 * programming model by polling or interruption
ganlikun 0:13413ea9a877 2623 * (programming model by DMA usually uses DMA interruptions
ganlikun 0:13413ea9a877 2624 * to indicate end of conversion and data transfer).
ganlikun 0:13413ea9a877 2625 * @note For ADC group injected, end of conversion (flag&IT) is raised
ganlikun 0:13413ea9a877 2626 * only at the end of the sequence.
ganlikun 0:13413ea9a877 2627 * @rmtoll CR2 EOCS LL_ADC_REG_SetFlagEndOfConversion
ganlikun 0:13413ea9a877 2628 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 2629 * @param EocSelection This parameter can be one of the following values:
ganlikun 0:13413ea9a877 2630 * @arg @ref LL_ADC_REG_FLAG_EOC_SEQUENCE_CONV
ganlikun 0:13413ea9a877 2631 * @arg @ref LL_ADC_REG_FLAG_EOC_UNITARY_CONV
ganlikun 0:13413ea9a877 2632 * @retval None
ganlikun 0:13413ea9a877 2633 */
ganlikun 0:13413ea9a877 2634 __STATIC_INLINE void LL_ADC_REG_SetFlagEndOfConversion(ADC_TypeDef *ADCx, uint32_t EocSelection)
ganlikun 0:13413ea9a877 2635 {
ganlikun 0:13413ea9a877 2636 MODIFY_REG(ADCx->CR2, ADC_CR2_EOCS, EocSelection);
ganlikun 0:13413ea9a877 2637 }
ganlikun 0:13413ea9a877 2638
ganlikun 0:13413ea9a877 2639 /**
ganlikun 0:13413ea9a877 2640 * @brief Get which ADC flag between EOC (end of unitary conversion)
ganlikun 0:13413ea9a877 2641 * or EOS (end of sequence conversions) is used to indicate
ganlikun 0:13413ea9a877 2642 * the end of conversion.
ganlikun 0:13413ea9a877 2643 * @rmtoll CR2 EOCS LL_ADC_REG_GetFlagEndOfConversion
ganlikun 0:13413ea9a877 2644 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 2645 * @retval Returned value can be one of the following values:
ganlikun 0:13413ea9a877 2646 * @arg @ref LL_ADC_REG_FLAG_EOC_SEQUENCE_CONV
ganlikun 0:13413ea9a877 2647 * @arg @ref LL_ADC_REG_FLAG_EOC_UNITARY_CONV
ganlikun 0:13413ea9a877 2648 */
ganlikun 0:13413ea9a877 2649 __STATIC_INLINE uint32_t LL_ADC_REG_GetFlagEndOfConversion(ADC_TypeDef *ADCx)
ganlikun 0:13413ea9a877 2650 {
ganlikun 0:13413ea9a877 2651 return (uint32_t)(READ_BIT(ADCx->CR2, ADC_CR2_EOCS));
ganlikun 0:13413ea9a877 2652 }
ganlikun 0:13413ea9a877 2653
ganlikun 0:13413ea9a877 2654 /**
ganlikun 0:13413ea9a877 2655 * @}
ganlikun 0:13413ea9a877 2656 */
ganlikun 0:13413ea9a877 2657
ganlikun 0:13413ea9a877 2658 /** @defgroup ADC_LL_EF_Configuration_ADC_Group_Injected Configuration of ADC hierarchical scope: group injected
ganlikun 0:13413ea9a877 2659 * @{
ganlikun 0:13413ea9a877 2660 */
ganlikun 0:13413ea9a877 2661
ganlikun 0:13413ea9a877 2662 /**
ganlikun 0:13413ea9a877 2663 * @brief Set ADC group injected conversion trigger source:
ganlikun 0:13413ea9a877 2664 * internal (SW start) or from external IP (timer event,
ganlikun 0:13413ea9a877 2665 * external interrupt line).
ganlikun 0:13413ea9a877 2666 * @note On this STM32 serie, setting of external trigger edge is performed
ganlikun 0:13413ea9a877 2667 * using function @ref LL_ADC_INJ_StartConversionExtTrig().
ganlikun 0:13413ea9a877 2668 * @note Availability of parameters of trigger sources from timer
ganlikun 0:13413ea9a877 2669 * depends on timers availability on the selected device.
ganlikun 0:13413ea9a877 2670 * @rmtoll CR2 JEXTSEL LL_ADC_INJ_SetTriggerSource\n
ganlikun 0:13413ea9a877 2671 * CR2 JEXTEN LL_ADC_INJ_SetTriggerSource
ganlikun 0:13413ea9a877 2672 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 2673 * @param TriggerSource This parameter can be one of the following values:
ganlikun 0:13413ea9a877 2674 * @arg @ref LL_ADC_INJ_TRIG_SOFTWARE
ganlikun 0:13413ea9a877 2675 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM1_CH4
ganlikun 0:13413ea9a877 2676 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM1_TRGO
ganlikun 0:13413ea9a877 2677 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM2_CH1
ganlikun 0:13413ea9a877 2678 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM2_TRGO
ganlikun 0:13413ea9a877 2679 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM3_CH2
ganlikun 0:13413ea9a877 2680 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM3_CH4
ganlikun 0:13413ea9a877 2681 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM4_CH1
ganlikun 0:13413ea9a877 2682 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM4_CH2
ganlikun 0:13413ea9a877 2683 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM4_CH3
ganlikun 0:13413ea9a877 2684 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM4_TRGO
ganlikun 0:13413ea9a877 2685 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM5_CH4
ganlikun 0:13413ea9a877 2686 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM5_TRGO
ganlikun 0:13413ea9a877 2687 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM8_CH2
ganlikun 0:13413ea9a877 2688 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM8_CH3
ganlikun 0:13413ea9a877 2689 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM8_CH4
ganlikun 0:13413ea9a877 2690 * @arg @ref LL_ADC_INJ_TRIG_EXT_EXTI_LINE15
ganlikun 0:13413ea9a877 2691 * @retval None
ganlikun 0:13413ea9a877 2692 */
ganlikun 0:13413ea9a877 2693 __STATIC_INLINE void LL_ADC_INJ_SetTriggerSource(ADC_TypeDef *ADCx, uint32_t TriggerSource)
ganlikun 0:13413ea9a877 2694 {
ganlikun 0:13413ea9a877 2695 /* Note: On this STM32 serie, ADC group injected external trigger edge */
ganlikun 0:13413ea9a877 2696 /* is used to perform a ADC conversion start. */
ganlikun 0:13413ea9a877 2697 /* This function does not set external trigger edge. */
ganlikun 0:13413ea9a877 2698 /* This feature is set using function */
ganlikun 0:13413ea9a877 2699 /* @ref LL_ADC_INJ_StartConversionExtTrig(). */
ganlikun 0:13413ea9a877 2700 MODIFY_REG(ADCx->CR2, ADC_CR2_JEXTSEL, (TriggerSource & ADC_CR2_JEXTSEL));
ganlikun 0:13413ea9a877 2701 }
ganlikun 0:13413ea9a877 2702
ganlikun 0:13413ea9a877 2703 /**
ganlikun 0:13413ea9a877 2704 * @brief Get ADC group injected conversion trigger source:
ganlikun 0:13413ea9a877 2705 * internal (SW start) or from external IP (timer event,
ganlikun 0:13413ea9a877 2706 * external interrupt line).
ganlikun 0:13413ea9a877 2707 * @note To determine whether group injected trigger source is
ganlikun 0:13413ea9a877 2708 * internal (SW start) or external, without detail
ganlikun 0:13413ea9a877 2709 * of which peripheral is selected as external trigger,
ganlikun 0:13413ea9a877 2710 * (equivalent to
ganlikun 0:13413ea9a877 2711 * "if(LL_ADC_INJ_GetTriggerSource(ADC1) == LL_ADC_INJ_TRIG_SOFTWARE)")
ganlikun 0:13413ea9a877 2712 * use function @ref LL_ADC_INJ_IsTriggerSourceSWStart.
ganlikun 0:13413ea9a877 2713 * @note Availability of parameters of trigger sources from timer
ganlikun 0:13413ea9a877 2714 * depends on timers availability on the selected device.
ganlikun 0:13413ea9a877 2715 * @rmtoll CR2 JEXTSEL LL_ADC_INJ_GetTriggerSource\n
ganlikun 0:13413ea9a877 2716 * CR2 JEXTEN LL_ADC_INJ_GetTriggerSource
ganlikun 0:13413ea9a877 2717 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 2718 * @retval Returned value can be one of the following values:
ganlikun 0:13413ea9a877 2719 * @arg @ref LL_ADC_INJ_TRIG_SOFTWARE
ganlikun 0:13413ea9a877 2720 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM1_CH4
ganlikun 0:13413ea9a877 2721 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM1_TRGO
ganlikun 0:13413ea9a877 2722 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM2_CH1
ganlikun 0:13413ea9a877 2723 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM2_TRGO
ganlikun 0:13413ea9a877 2724 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM3_CH2
ganlikun 0:13413ea9a877 2725 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM3_CH4
ganlikun 0:13413ea9a877 2726 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM4_CH1
ganlikun 0:13413ea9a877 2727 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM4_CH2
ganlikun 0:13413ea9a877 2728 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM4_CH3
ganlikun 0:13413ea9a877 2729 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM4_TRGO
ganlikun 0:13413ea9a877 2730 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM5_CH4
ganlikun 0:13413ea9a877 2731 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM5_TRGO
ganlikun 0:13413ea9a877 2732 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM8_CH2
ganlikun 0:13413ea9a877 2733 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM8_CH3
ganlikun 0:13413ea9a877 2734 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM8_CH4
ganlikun 0:13413ea9a877 2735 * @arg @ref LL_ADC_INJ_TRIG_EXT_EXTI_LINE15
ganlikun 0:13413ea9a877 2736 */
ganlikun 0:13413ea9a877 2737 __STATIC_INLINE uint32_t LL_ADC_INJ_GetTriggerSource(ADC_TypeDef *ADCx)
ganlikun 0:13413ea9a877 2738 {
ganlikun 0:13413ea9a877 2739 register uint32_t TriggerSource = READ_BIT(ADCx->CR2, ADC_CR2_JEXTSEL | ADC_CR2_JEXTEN);
ganlikun 0:13413ea9a877 2740
ganlikun 0:13413ea9a877 2741 /* Value for shift of {0; 4; 8; 12} depending on value of bitfield */
ganlikun 0:13413ea9a877 2742 /* corresponding to ADC_CR2_JEXTEN {0; 1; 2; 3}. */
ganlikun 0:13413ea9a877 2743 register uint32_t ShiftExten = ((TriggerSource & ADC_CR2_JEXTEN) >> (ADC_INJ_TRIG_EXTEN_BITOFFSET_POS - 2U));
ganlikun 0:13413ea9a877 2744
ganlikun 0:13413ea9a877 2745 /* Set bitfield corresponding to ADC_CR2_JEXTEN and ADC_CR2_JEXTSEL */
ganlikun 0:13413ea9a877 2746 /* to match with triggers literals definition. */
ganlikun 0:13413ea9a877 2747 return ((TriggerSource
ganlikun 0:13413ea9a877 2748 & (ADC_INJ_TRIG_SOURCE_MASK << ShiftExten) & ADC_CR2_JEXTSEL)
ganlikun 0:13413ea9a877 2749 | ((ADC_INJ_TRIG_EDGE_MASK << ShiftExten) & ADC_CR2_JEXTEN)
ganlikun 0:13413ea9a877 2750 );
ganlikun 0:13413ea9a877 2751 }
ganlikun 0:13413ea9a877 2752
ganlikun 0:13413ea9a877 2753 /**
ganlikun 0:13413ea9a877 2754 * @brief Get ADC group injected conversion trigger source internal (SW start)
ganlikun 0:13413ea9a877 2755 or external
ganlikun 0:13413ea9a877 2756 * @note In case of group injected trigger source set to external trigger,
ganlikun 0:13413ea9a877 2757 * to determine which peripheral is selected as external trigger,
ganlikun 0:13413ea9a877 2758 * use function @ref LL_ADC_INJ_GetTriggerSource.
ganlikun 0:13413ea9a877 2759 * @rmtoll CR2 JEXTEN LL_ADC_INJ_IsTriggerSourceSWStart
ganlikun 0:13413ea9a877 2760 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 2761 * @retval Value "0" if trigger source external trigger
ganlikun 0:13413ea9a877 2762 * Value "1" if trigger source SW start.
ganlikun 0:13413ea9a877 2763 */
ganlikun 0:13413ea9a877 2764 __STATIC_INLINE uint32_t LL_ADC_INJ_IsTriggerSourceSWStart(ADC_TypeDef *ADCx)
ganlikun 0:13413ea9a877 2765 {
ganlikun 0:13413ea9a877 2766 return (READ_BIT(ADCx->CR2, ADC_CR2_JEXTEN) == (LL_ADC_INJ_TRIG_SOFTWARE & ADC_CR2_JEXTEN));
ganlikun 0:13413ea9a877 2767 }
ganlikun 0:13413ea9a877 2768
ganlikun 0:13413ea9a877 2769 /**
ganlikun 0:13413ea9a877 2770 * @brief Get ADC group injected conversion trigger polarity.
ganlikun 0:13413ea9a877 2771 * Applicable only for trigger source set to external trigger.
ganlikun 0:13413ea9a877 2772 * @rmtoll CR2 JEXTEN LL_ADC_INJ_GetTriggerEdge
ganlikun 0:13413ea9a877 2773 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 2774 * @retval Returned value can be one of the following values:
ganlikun 0:13413ea9a877 2775 * @arg @ref LL_ADC_INJ_TRIG_EXT_RISING
ganlikun 0:13413ea9a877 2776 * @arg @ref LL_ADC_INJ_TRIG_EXT_FALLING
ganlikun 0:13413ea9a877 2777 * @arg @ref LL_ADC_INJ_TRIG_EXT_RISINGFALLING
ganlikun 0:13413ea9a877 2778 */
ganlikun 0:13413ea9a877 2779 __STATIC_INLINE uint32_t LL_ADC_INJ_GetTriggerEdge(ADC_TypeDef *ADCx)
ganlikun 0:13413ea9a877 2780 {
ganlikun 0:13413ea9a877 2781 return (uint32_t)(READ_BIT(ADCx->CR2, ADC_CR2_JEXTEN));
ganlikun 0:13413ea9a877 2782 }
ganlikun 0:13413ea9a877 2783
ganlikun 0:13413ea9a877 2784 /**
ganlikun 0:13413ea9a877 2785 * @brief Set ADC group injected sequencer length and scan direction.
ganlikun 0:13413ea9a877 2786 * @note This function performs configuration of:
ganlikun 0:13413ea9a877 2787 * - Sequence length: Number of ranks in the scan sequence.
ganlikun 0:13413ea9a877 2788 * - Sequence direction: Unless specified in parameters, sequencer
ganlikun 0:13413ea9a877 2789 * scan direction is forward (from rank 1 to rank n).
ganlikun 0:13413ea9a877 2790 * @note On this STM32 serie, group injected sequencer configuration
ganlikun 0:13413ea9a877 2791 * is conditioned to ADC instance sequencer mode.
ganlikun 0:13413ea9a877 2792 * If ADC instance sequencer mode is disabled, sequencers of
ganlikun 0:13413ea9a877 2793 * all groups (group regular, group injected) can be configured
ganlikun 0:13413ea9a877 2794 * but their execution is disabled (limited to rank 1).
ganlikun 0:13413ea9a877 2795 * Refer to function @ref LL_ADC_SetSequencersScanMode().
ganlikun 0:13413ea9a877 2796 * @note Sequencer disabled is equivalent to sequencer of 1 rank:
ganlikun 0:13413ea9a877 2797 * ADC conversion on only 1 channel.
ganlikun 0:13413ea9a877 2798 * @rmtoll JSQR JL LL_ADC_INJ_SetSequencerLength
ganlikun 0:13413ea9a877 2799 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 2800 * @param SequencerNbRanks This parameter can be one of the following values:
ganlikun 0:13413ea9a877 2801 * @arg @ref LL_ADC_INJ_SEQ_SCAN_DISABLE
ganlikun 0:13413ea9a877 2802 * @arg @ref LL_ADC_INJ_SEQ_SCAN_ENABLE_2RANKS
ganlikun 0:13413ea9a877 2803 * @arg @ref LL_ADC_INJ_SEQ_SCAN_ENABLE_3RANKS
ganlikun 0:13413ea9a877 2804 * @arg @ref LL_ADC_INJ_SEQ_SCAN_ENABLE_4RANKS
ganlikun 0:13413ea9a877 2805 * @retval None
ganlikun 0:13413ea9a877 2806 */
ganlikun 0:13413ea9a877 2807 __STATIC_INLINE void LL_ADC_INJ_SetSequencerLength(ADC_TypeDef *ADCx, uint32_t SequencerNbRanks)
ganlikun 0:13413ea9a877 2808 {
ganlikun 0:13413ea9a877 2809 MODIFY_REG(ADCx->JSQR, ADC_JSQR_JL, SequencerNbRanks);
ganlikun 0:13413ea9a877 2810 }
ganlikun 0:13413ea9a877 2811
ganlikun 0:13413ea9a877 2812 /**
ganlikun 0:13413ea9a877 2813 * @brief Get ADC group injected sequencer length and scan direction.
ganlikun 0:13413ea9a877 2814 * @note This function retrieves:
ganlikun 0:13413ea9a877 2815 * - Sequence length: Number of ranks in the scan sequence.
ganlikun 0:13413ea9a877 2816 * - Sequence direction: Unless specified in parameters, sequencer
ganlikun 0:13413ea9a877 2817 * scan direction is forward (from rank 1 to rank n).
ganlikun 0:13413ea9a877 2818 * @note On this STM32 serie, group injected sequencer configuration
ganlikun 0:13413ea9a877 2819 * is conditioned to ADC instance sequencer mode.
ganlikun 0:13413ea9a877 2820 * If ADC instance sequencer mode is disabled, sequencers of
ganlikun 0:13413ea9a877 2821 * all groups (group regular, group injected) can be configured
ganlikun 0:13413ea9a877 2822 * but their execution is disabled (limited to rank 1).
ganlikun 0:13413ea9a877 2823 * Refer to function @ref LL_ADC_SetSequencersScanMode().
ganlikun 0:13413ea9a877 2824 * @note Sequencer disabled is equivalent to sequencer of 1 rank:
ganlikun 0:13413ea9a877 2825 * ADC conversion on only 1 channel.
ganlikun 0:13413ea9a877 2826 * @rmtoll JSQR JL LL_ADC_INJ_GetSequencerLength
ganlikun 0:13413ea9a877 2827 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 2828 * @retval Returned value can be one of the following values:
ganlikun 0:13413ea9a877 2829 * @arg @ref LL_ADC_INJ_SEQ_SCAN_DISABLE
ganlikun 0:13413ea9a877 2830 * @arg @ref LL_ADC_INJ_SEQ_SCAN_ENABLE_2RANKS
ganlikun 0:13413ea9a877 2831 * @arg @ref LL_ADC_INJ_SEQ_SCAN_ENABLE_3RANKS
ganlikun 0:13413ea9a877 2832 * @arg @ref LL_ADC_INJ_SEQ_SCAN_ENABLE_4RANKS
ganlikun 0:13413ea9a877 2833 */
ganlikun 0:13413ea9a877 2834 __STATIC_INLINE uint32_t LL_ADC_INJ_GetSequencerLength(ADC_TypeDef *ADCx)
ganlikun 0:13413ea9a877 2835 {
ganlikun 0:13413ea9a877 2836 return (uint32_t)(READ_BIT(ADCx->JSQR, ADC_JSQR_JL));
ganlikun 0:13413ea9a877 2837 }
ganlikun 0:13413ea9a877 2838
ganlikun 0:13413ea9a877 2839 /**
ganlikun 0:13413ea9a877 2840 * @brief Set ADC group injected sequencer discontinuous mode:
ganlikun 0:13413ea9a877 2841 * sequence subdivided and scan conversions interrupted every selected
ganlikun 0:13413ea9a877 2842 * number of ranks.
ganlikun 0:13413ea9a877 2843 * @note It is not possible to enable both ADC group injected
ganlikun 0:13413ea9a877 2844 * auto-injected mode and sequencer discontinuous mode.
ganlikun 0:13413ea9a877 2845 * @rmtoll CR1 DISCEN LL_ADC_INJ_SetSequencerDiscont
ganlikun 0:13413ea9a877 2846 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 2847 * @param SeqDiscont This parameter can be one of the following values:
ganlikun 0:13413ea9a877 2848 * @arg @ref LL_ADC_INJ_SEQ_DISCONT_DISABLE
ganlikun 0:13413ea9a877 2849 * @arg @ref LL_ADC_INJ_SEQ_DISCONT_1RANK
ganlikun 0:13413ea9a877 2850 * @retval None
ganlikun 0:13413ea9a877 2851 */
ganlikun 0:13413ea9a877 2852 __STATIC_INLINE void LL_ADC_INJ_SetSequencerDiscont(ADC_TypeDef *ADCx, uint32_t SeqDiscont)
ganlikun 0:13413ea9a877 2853 {
ganlikun 0:13413ea9a877 2854 MODIFY_REG(ADCx->CR1, ADC_CR1_JDISCEN, SeqDiscont);
ganlikun 0:13413ea9a877 2855 }
ganlikun 0:13413ea9a877 2856
ganlikun 0:13413ea9a877 2857 /**
ganlikun 0:13413ea9a877 2858 * @brief Get ADC group injected sequencer discontinuous mode:
ganlikun 0:13413ea9a877 2859 * sequence subdivided and scan conversions interrupted every selected
ganlikun 0:13413ea9a877 2860 * number of ranks.
ganlikun 0:13413ea9a877 2861 * @rmtoll CR1 DISCEN LL_ADC_REG_GetSequencerDiscont
ganlikun 0:13413ea9a877 2862 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 2863 * @retval Returned value can be one of the following values:
ganlikun 0:13413ea9a877 2864 * @arg @ref LL_ADC_INJ_SEQ_DISCONT_DISABLE
ganlikun 0:13413ea9a877 2865 * @arg @ref LL_ADC_INJ_SEQ_DISCONT_1RANK
ganlikun 0:13413ea9a877 2866 */
ganlikun 0:13413ea9a877 2867 __STATIC_INLINE uint32_t LL_ADC_INJ_GetSequencerDiscont(ADC_TypeDef *ADCx)
ganlikun 0:13413ea9a877 2868 {
ganlikun 0:13413ea9a877 2869 return (uint32_t)(READ_BIT(ADCx->CR1, ADC_CR1_JDISCEN));
ganlikun 0:13413ea9a877 2870 }
ganlikun 0:13413ea9a877 2871
ganlikun 0:13413ea9a877 2872 /**
ganlikun 0:13413ea9a877 2873 * @brief Set ADC group injected sequence: channel on the selected
ganlikun 0:13413ea9a877 2874 * sequence rank.
ganlikun 0:13413ea9a877 2875 * @note Depending on devices and packages, some channels may not be available.
ganlikun 0:13413ea9a877 2876 * Refer to device datasheet for channels availability.
ganlikun 0:13413ea9a877 2877 * @note On this STM32 serie, to measure internal channels (VrefInt,
ganlikun 0:13413ea9a877 2878 * TempSensor, ...), measurement paths to internal channels must be
ganlikun 0:13413ea9a877 2879 * enabled separately.
ganlikun 0:13413ea9a877 2880 * This can be done using function @ref LL_ADC_SetCommonPathInternalCh().
ganlikun 0:13413ea9a877 2881 * @rmtoll JSQR JSQ1 LL_ADC_INJ_SetSequencerRanks\n
ganlikun 0:13413ea9a877 2882 * JSQR JSQ2 LL_ADC_INJ_SetSequencerRanks\n
ganlikun 0:13413ea9a877 2883 * JSQR JSQ3 LL_ADC_INJ_SetSequencerRanks\n
ganlikun 0:13413ea9a877 2884 * JSQR JSQ4 LL_ADC_INJ_SetSequencerRanks
ganlikun 0:13413ea9a877 2885 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 2886 * @param Rank This parameter can be one of the following values:
ganlikun 0:13413ea9a877 2887 * @arg @ref LL_ADC_INJ_RANK_1
ganlikun 0:13413ea9a877 2888 * @arg @ref LL_ADC_INJ_RANK_2
ganlikun 0:13413ea9a877 2889 * @arg @ref LL_ADC_INJ_RANK_3
ganlikun 0:13413ea9a877 2890 * @arg @ref LL_ADC_INJ_RANK_4
ganlikun 0:13413ea9a877 2891 * @param Channel This parameter can be one of the following values:
ganlikun 0:13413ea9a877 2892 * @arg @ref LL_ADC_CHANNEL_0
ganlikun 0:13413ea9a877 2893 * @arg @ref LL_ADC_CHANNEL_1
ganlikun 0:13413ea9a877 2894 * @arg @ref LL_ADC_CHANNEL_2
ganlikun 0:13413ea9a877 2895 * @arg @ref LL_ADC_CHANNEL_3
ganlikun 0:13413ea9a877 2896 * @arg @ref LL_ADC_CHANNEL_4
ganlikun 0:13413ea9a877 2897 * @arg @ref LL_ADC_CHANNEL_5
ganlikun 0:13413ea9a877 2898 * @arg @ref LL_ADC_CHANNEL_6
ganlikun 0:13413ea9a877 2899 * @arg @ref LL_ADC_CHANNEL_7
ganlikun 0:13413ea9a877 2900 * @arg @ref LL_ADC_CHANNEL_8
ganlikun 0:13413ea9a877 2901 * @arg @ref LL_ADC_CHANNEL_9
ganlikun 0:13413ea9a877 2902 * @arg @ref LL_ADC_CHANNEL_10
ganlikun 0:13413ea9a877 2903 * @arg @ref LL_ADC_CHANNEL_11
ganlikun 0:13413ea9a877 2904 * @arg @ref LL_ADC_CHANNEL_12
ganlikun 0:13413ea9a877 2905 * @arg @ref LL_ADC_CHANNEL_13
ganlikun 0:13413ea9a877 2906 * @arg @ref LL_ADC_CHANNEL_14
ganlikun 0:13413ea9a877 2907 * @arg @ref LL_ADC_CHANNEL_15
ganlikun 0:13413ea9a877 2908 * @arg @ref LL_ADC_CHANNEL_16
ganlikun 0:13413ea9a877 2909 * @arg @ref LL_ADC_CHANNEL_17
ganlikun 0:13413ea9a877 2910 * @arg @ref LL_ADC_CHANNEL_18
ganlikun 0:13413ea9a877 2911 * @arg @ref LL_ADC_CHANNEL_VREFINT (1)
ganlikun 0:13413ea9a877 2912 * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR (1)(2)
ganlikun 0:13413ea9a877 2913 * @arg @ref LL_ADC_CHANNEL_VBAT (1)
ganlikun 0:13413ea9a877 2914 *
ganlikun 0:13413ea9a877 2915 * (1) On STM32F4, parameter available only on ADC instance: ADC1.\n
ganlikun 0:13413ea9a877 2916 * (2) On devices STM32F42x and STM32F43x, limitation: this internal channel is shared between temperature sensor and Vbat, only 1 measurement path must be enabled.
ganlikun 0:13413ea9a877 2917 * @retval None
ganlikun 0:13413ea9a877 2918 */
ganlikun 0:13413ea9a877 2919 __STATIC_INLINE void LL_ADC_INJ_SetSequencerRanks(ADC_TypeDef *ADCx, uint32_t Rank, uint32_t Channel)
ganlikun 0:13413ea9a877 2920 {
ganlikun 0:13413ea9a877 2921 /* Set bits with content of parameter "Channel" with bits position */
ganlikun 0:13413ea9a877 2922 /* in register depending on parameter "Rank". */
ganlikun 0:13413ea9a877 2923 /* Parameters "Rank" and "Channel" are used with masks because containing */
ganlikun 0:13413ea9a877 2924 /* other bits reserved for other purpose. */
ganlikun 0:13413ea9a877 2925 register uint32_t tmpreg1 = (READ_BIT(ADCx->JSQR, ADC_JSQR_JL) >> ADC_JSQR_JL_Pos) + 1U;
ganlikun 0:13413ea9a877 2926
ganlikun 0:13413ea9a877 2927 MODIFY_REG(ADCx->JSQR,
ganlikun 0:13413ea9a877 2928 ADC_CHANNEL_ID_NUMBER_MASK << (5U * (uint8_t)(((Rank) + 3U) - (tmpreg1))),
ganlikun 0:13413ea9a877 2929 (Channel & ADC_CHANNEL_ID_NUMBER_MASK) << (5U * (uint8_t)(((Rank) + 3U) - (tmpreg1))));
ganlikun 0:13413ea9a877 2930 }
ganlikun 0:13413ea9a877 2931
ganlikun 0:13413ea9a877 2932 /**
ganlikun 0:13413ea9a877 2933 * @brief Get ADC group injected sequence: channel on the selected
ganlikun 0:13413ea9a877 2934 * sequence rank.
ganlikun 0:13413ea9a877 2935 * @note Depending on devices and packages, some channels may not be available.
ganlikun 0:13413ea9a877 2936 * Refer to device datasheet for channels availability.
ganlikun 0:13413ea9a877 2937 * @note Usage of the returned channel number:
ganlikun 0:13413ea9a877 2938 * - To reinject this channel into another function LL_ADC_xxx:
ganlikun 0:13413ea9a877 2939 * the returned channel number is only partly formatted on definition
ganlikun 0:13413ea9a877 2940 * of literals LL_ADC_CHANNEL_x. Therefore, it has to be compared
ganlikun 0:13413ea9a877 2941 * with parts of literals LL_ADC_CHANNEL_x or using
ganlikun 0:13413ea9a877 2942 * helper macro @ref __LL_ADC_CHANNEL_TO_DECIMAL_NB().
ganlikun 0:13413ea9a877 2943 * Then the selected literal LL_ADC_CHANNEL_x can be used
ganlikun 0:13413ea9a877 2944 * as parameter for another function.
ganlikun 0:13413ea9a877 2945 * - To get the channel number in decimal format:
ganlikun 0:13413ea9a877 2946 * process the returned value with the helper macro
ganlikun 0:13413ea9a877 2947 * @ref __LL_ADC_CHANNEL_TO_DECIMAL_NB().
ganlikun 0:13413ea9a877 2948 * @rmtoll JSQR JSQ1 LL_ADC_INJ_SetSequencerRanks\n
ganlikun 0:13413ea9a877 2949 * JSQR JSQ2 LL_ADC_INJ_SetSequencerRanks\n
ganlikun 0:13413ea9a877 2950 * JSQR JSQ3 LL_ADC_INJ_SetSequencerRanks\n
ganlikun 0:13413ea9a877 2951 * JSQR JSQ4 LL_ADC_INJ_SetSequencerRanks
ganlikun 0:13413ea9a877 2952 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 2953 * @param Rank This parameter can be one of the following values:
ganlikun 0:13413ea9a877 2954 * @arg @ref LL_ADC_INJ_RANK_1
ganlikun 0:13413ea9a877 2955 * @arg @ref LL_ADC_INJ_RANK_2
ganlikun 0:13413ea9a877 2956 * @arg @ref LL_ADC_INJ_RANK_3
ganlikun 0:13413ea9a877 2957 * @arg @ref LL_ADC_INJ_RANK_4
ganlikun 0:13413ea9a877 2958 * @retval Returned value can be one of the following values:
ganlikun 0:13413ea9a877 2959 * @arg @ref LL_ADC_CHANNEL_0
ganlikun 0:13413ea9a877 2960 * @arg @ref LL_ADC_CHANNEL_1
ganlikun 0:13413ea9a877 2961 * @arg @ref LL_ADC_CHANNEL_2
ganlikun 0:13413ea9a877 2962 * @arg @ref LL_ADC_CHANNEL_3
ganlikun 0:13413ea9a877 2963 * @arg @ref LL_ADC_CHANNEL_4
ganlikun 0:13413ea9a877 2964 * @arg @ref LL_ADC_CHANNEL_5
ganlikun 0:13413ea9a877 2965 * @arg @ref LL_ADC_CHANNEL_6
ganlikun 0:13413ea9a877 2966 * @arg @ref LL_ADC_CHANNEL_7
ganlikun 0:13413ea9a877 2967 * @arg @ref LL_ADC_CHANNEL_8
ganlikun 0:13413ea9a877 2968 * @arg @ref LL_ADC_CHANNEL_9
ganlikun 0:13413ea9a877 2969 * @arg @ref LL_ADC_CHANNEL_10
ganlikun 0:13413ea9a877 2970 * @arg @ref LL_ADC_CHANNEL_11
ganlikun 0:13413ea9a877 2971 * @arg @ref LL_ADC_CHANNEL_12
ganlikun 0:13413ea9a877 2972 * @arg @ref LL_ADC_CHANNEL_13
ganlikun 0:13413ea9a877 2973 * @arg @ref LL_ADC_CHANNEL_14
ganlikun 0:13413ea9a877 2974 * @arg @ref LL_ADC_CHANNEL_15
ganlikun 0:13413ea9a877 2975 * @arg @ref LL_ADC_CHANNEL_16
ganlikun 0:13413ea9a877 2976 * @arg @ref LL_ADC_CHANNEL_17
ganlikun 0:13413ea9a877 2977 * @arg @ref LL_ADC_CHANNEL_18
ganlikun 0:13413ea9a877 2978 * @arg @ref LL_ADC_CHANNEL_VREFINT (1)
ganlikun 0:13413ea9a877 2979 * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR (1)(2)
ganlikun 0:13413ea9a877 2980 * @arg @ref LL_ADC_CHANNEL_VBAT (1)
ganlikun 0:13413ea9a877 2981 *
ganlikun 0:13413ea9a877 2982 * (1) On STM32F4, parameter available only on ADC instance: ADC1.\n
ganlikun 0:13413ea9a877 2983 * (2) On devices STM32F42x and STM32F43x, limitation: this internal channel is shared between temperature sensor and Vbat, only 1 measurement path must be enabled.\n
ganlikun 0:13413ea9a877 2984 * (1) For ADC channel read back from ADC register,
ganlikun 0:13413ea9a877 2985 * comparison with internal channel parameter to be done
ganlikun 0:13413ea9a877 2986 * using helper macro @ref __LL_ADC_CHANNEL_INTERNAL_TO_EXTERNAL().
ganlikun 0:13413ea9a877 2987 */
ganlikun 0:13413ea9a877 2988 __STATIC_INLINE uint32_t LL_ADC_INJ_GetSequencerRanks(ADC_TypeDef *ADCx, uint32_t Rank)
ganlikun 0:13413ea9a877 2989 {
ganlikun 0:13413ea9a877 2990 register uint32_t tmpreg1 = (READ_BIT(ADCx->JSQR, ADC_JSQR_JL) >> ADC_JSQR_JL_Pos) + 1U;
ganlikun 0:13413ea9a877 2991
ganlikun 0:13413ea9a877 2992 return (uint32_t)(READ_BIT(ADCx->JSQR,
ganlikun 0:13413ea9a877 2993 ADC_CHANNEL_ID_NUMBER_MASK << (5U * (uint8_t)(((Rank) + 3U) - (tmpreg1))))
ganlikun 0:13413ea9a877 2994 >> (5U * (uint8_t)(((Rank) + 3U) - (tmpreg1)))
ganlikun 0:13413ea9a877 2995 );
ganlikun 0:13413ea9a877 2996 }
ganlikun 0:13413ea9a877 2997
ganlikun 0:13413ea9a877 2998 /**
ganlikun 0:13413ea9a877 2999 * @brief Set ADC group injected conversion trigger:
ganlikun 0:13413ea9a877 3000 * independent or from ADC group regular.
ganlikun 0:13413ea9a877 3001 * @note This mode can be used to extend number of data registers
ganlikun 0:13413ea9a877 3002 * updated after one ADC conversion trigger and with data
ganlikun 0:13413ea9a877 3003 * permanently kept (not erased by successive conversions of scan of
ganlikun 0:13413ea9a877 3004 * ADC sequencer ranks), up to 5 data registers:
ganlikun 0:13413ea9a877 3005 * 1 data register on ADC group regular, 4 data registers
ganlikun 0:13413ea9a877 3006 * on ADC group injected.
ganlikun 0:13413ea9a877 3007 * @note If ADC group injected injected trigger source is set to an
ganlikun 0:13413ea9a877 3008 * external trigger, this feature must be must be set to
ganlikun 0:13413ea9a877 3009 * independent trigger.
ganlikun 0:13413ea9a877 3010 * ADC group injected automatic trigger is compliant only with
ganlikun 0:13413ea9a877 3011 * group injected trigger source set to SW start, without any
ganlikun 0:13413ea9a877 3012 * further action on ADC group injected conversion start or stop:
ganlikun 0:13413ea9a877 3013 * in this case, ADC group injected is controlled only
ganlikun 0:13413ea9a877 3014 * from ADC group regular.
ganlikun 0:13413ea9a877 3015 * @note It is not possible to enable both ADC group injected
ganlikun 0:13413ea9a877 3016 * auto-injected mode and sequencer discontinuous mode.
ganlikun 0:13413ea9a877 3017 * @rmtoll CR1 JAUTO LL_ADC_INJ_SetTrigAuto
ganlikun 0:13413ea9a877 3018 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 3019 * @param TrigAuto This parameter can be one of the following values:
ganlikun 0:13413ea9a877 3020 * @arg @ref LL_ADC_INJ_TRIG_INDEPENDENT
ganlikun 0:13413ea9a877 3021 * @arg @ref LL_ADC_INJ_TRIG_FROM_GRP_REGULAR
ganlikun 0:13413ea9a877 3022 * @retval None
ganlikun 0:13413ea9a877 3023 */
ganlikun 0:13413ea9a877 3024 __STATIC_INLINE void LL_ADC_INJ_SetTrigAuto(ADC_TypeDef *ADCx, uint32_t TrigAuto)
ganlikun 0:13413ea9a877 3025 {
ganlikun 0:13413ea9a877 3026 MODIFY_REG(ADCx->CR1, ADC_CR1_JAUTO, TrigAuto);
ganlikun 0:13413ea9a877 3027 }
ganlikun 0:13413ea9a877 3028
ganlikun 0:13413ea9a877 3029 /**
ganlikun 0:13413ea9a877 3030 * @brief Get ADC group injected conversion trigger:
ganlikun 0:13413ea9a877 3031 * independent or from ADC group regular.
ganlikun 0:13413ea9a877 3032 * @rmtoll CR1 JAUTO LL_ADC_INJ_GetTrigAuto
ganlikun 0:13413ea9a877 3033 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 3034 * @retval Returned value can be one of the following values:
ganlikun 0:13413ea9a877 3035 * @arg @ref LL_ADC_INJ_TRIG_INDEPENDENT
ganlikun 0:13413ea9a877 3036 * @arg @ref LL_ADC_INJ_TRIG_FROM_GRP_REGULAR
ganlikun 0:13413ea9a877 3037 */
ganlikun 0:13413ea9a877 3038 __STATIC_INLINE uint32_t LL_ADC_INJ_GetTrigAuto(ADC_TypeDef *ADCx)
ganlikun 0:13413ea9a877 3039 {
ganlikun 0:13413ea9a877 3040 return (uint32_t)(READ_BIT(ADCx->CR1, ADC_CR1_JAUTO));
ganlikun 0:13413ea9a877 3041 }
ganlikun 0:13413ea9a877 3042
ganlikun 0:13413ea9a877 3043 /**
ganlikun 0:13413ea9a877 3044 * @brief Set ADC group injected offset.
ganlikun 0:13413ea9a877 3045 * @note It sets:
ganlikun 0:13413ea9a877 3046 * - ADC group injected rank to which the offset programmed
ganlikun 0:13413ea9a877 3047 * will be applied
ganlikun 0:13413ea9a877 3048 * - Offset level (offset to be subtracted from the raw
ganlikun 0:13413ea9a877 3049 * converted data).
ganlikun 0:13413ea9a877 3050 * Caution: Offset format is dependent to ADC resolution:
ganlikun 0:13413ea9a877 3051 * offset has to be left-aligned on bit 11, the LSB (right bits)
ganlikun 0:13413ea9a877 3052 * are set to 0.
ganlikun 0:13413ea9a877 3053 * @note Offset cannot be enabled or disabled.
ganlikun 0:13413ea9a877 3054 * To emulate offset disabled, set an offset value equal to 0.
ganlikun 0:13413ea9a877 3055 * @rmtoll JOFR1 JOFFSET1 LL_ADC_INJ_SetOffset\n
ganlikun 0:13413ea9a877 3056 * JOFR2 JOFFSET2 LL_ADC_INJ_SetOffset\n
ganlikun 0:13413ea9a877 3057 * JOFR3 JOFFSET3 LL_ADC_INJ_SetOffset\n
ganlikun 0:13413ea9a877 3058 * JOFR4 JOFFSET4 LL_ADC_INJ_SetOffset
ganlikun 0:13413ea9a877 3059 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 3060 * @param Rank This parameter can be one of the following values:
ganlikun 0:13413ea9a877 3061 * @arg @ref LL_ADC_INJ_RANK_1
ganlikun 0:13413ea9a877 3062 * @arg @ref LL_ADC_INJ_RANK_2
ganlikun 0:13413ea9a877 3063 * @arg @ref LL_ADC_INJ_RANK_3
ganlikun 0:13413ea9a877 3064 * @arg @ref LL_ADC_INJ_RANK_4
ganlikun 0:13413ea9a877 3065 * @param OffsetLevel Value between Min_Data=0x000 and Max_Data=0xFFF
ganlikun 0:13413ea9a877 3066 * @retval None
ganlikun 0:13413ea9a877 3067 */
ganlikun 0:13413ea9a877 3068 __STATIC_INLINE void LL_ADC_INJ_SetOffset(ADC_TypeDef *ADCx, uint32_t Rank, uint32_t OffsetLevel)
ganlikun 0:13413ea9a877 3069 {
ganlikun 0:13413ea9a877 3070 register uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->JOFR1, __ADC_MASK_SHIFT(Rank, ADC_INJ_JOFRX_REGOFFSET_MASK));
ganlikun 0:13413ea9a877 3071
ganlikun 0:13413ea9a877 3072 MODIFY_REG(*preg,
ganlikun 0:13413ea9a877 3073 ADC_JOFR1_JOFFSET1,
ganlikun 0:13413ea9a877 3074 OffsetLevel);
ganlikun 0:13413ea9a877 3075 }
ganlikun 0:13413ea9a877 3076
ganlikun 0:13413ea9a877 3077 /**
ganlikun 0:13413ea9a877 3078 * @brief Get ADC group injected offset.
ganlikun 0:13413ea9a877 3079 * @note It gives offset level (offset to be subtracted from the raw converted data).
ganlikun 0:13413ea9a877 3080 * Caution: Offset format is dependent to ADC resolution:
ganlikun 0:13413ea9a877 3081 * offset has to be left-aligned on bit 11, the LSB (right bits)
ganlikun 0:13413ea9a877 3082 * are set to 0.
ganlikun 0:13413ea9a877 3083 * @rmtoll JOFR1 JOFFSET1 LL_ADC_INJ_GetOffset\n
ganlikun 0:13413ea9a877 3084 * JOFR2 JOFFSET2 LL_ADC_INJ_GetOffset\n
ganlikun 0:13413ea9a877 3085 * JOFR3 JOFFSET3 LL_ADC_INJ_GetOffset\n
ganlikun 0:13413ea9a877 3086 * JOFR4 JOFFSET4 LL_ADC_INJ_GetOffset
ganlikun 0:13413ea9a877 3087 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 3088 * @param Rank This parameter can be one of the following values:
ganlikun 0:13413ea9a877 3089 * @arg @ref LL_ADC_INJ_RANK_1
ganlikun 0:13413ea9a877 3090 * @arg @ref LL_ADC_INJ_RANK_2
ganlikun 0:13413ea9a877 3091 * @arg @ref LL_ADC_INJ_RANK_3
ganlikun 0:13413ea9a877 3092 * @arg @ref LL_ADC_INJ_RANK_4
ganlikun 0:13413ea9a877 3093 * @retval Value between Min_Data=0x000 and Max_Data=0xFFF
ganlikun 0:13413ea9a877 3094 */
ganlikun 0:13413ea9a877 3095 __STATIC_INLINE uint32_t LL_ADC_INJ_GetOffset(ADC_TypeDef *ADCx, uint32_t Rank)
ganlikun 0:13413ea9a877 3096 {
ganlikun 0:13413ea9a877 3097 register uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->JOFR1, __ADC_MASK_SHIFT(Rank, ADC_INJ_JOFRX_REGOFFSET_MASK));
ganlikun 0:13413ea9a877 3098
ganlikun 0:13413ea9a877 3099 return (uint32_t)(READ_BIT(*preg,
ganlikun 0:13413ea9a877 3100 ADC_JOFR1_JOFFSET1)
ganlikun 0:13413ea9a877 3101 );
ganlikun 0:13413ea9a877 3102 }
ganlikun 0:13413ea9a877 3103
ganlikun 0:13413ea9a877 3104 /**
ganlikun 0:13413ea9a877 3105 * @}
ganlikun 0:13413ea9a877 3106 */
ganlikun 0:13413ea9a877 3107
ganlikun 0:13413ea9a877 3108 /** @defgroup ADC_LL_EF_Configuration_Channels Configuration of ADC hierarchical scope: channels
ganlikun 0:13413ea9a877 3109 * @{
ganlikun 0:13413ea9a877 3110 */
ganlikun 0:13413ea9a877 3111
ganlikun 0:13413ea9a877 3112 /**
ganlikun 0:13413ea9a877 3113 * @brief Set sampling time of the selected ADC channel
ganlikun 0:13413ea9a877 3114 * Unit: ADC clock cycles.
ganlikun 0:13413ea9a877 3115 * @note On this device, sampling time is on channel scope: independently
ganlikun 0:13413ea9a877 3116 * of channel mapped on ADC group regular or injected.
ganlikun 0:13413ea9a877 3117 * @note In case of internal channel (VrefInt, TempSensor, ...) to be
ganlikun 0:13413ea9a877 3118 * converted:
ganlikun 0:13413ea9a877 3119 * sampling time constraints must be respected (sampling time can be
ganlikun 0:13413ea9a877 3120 * adjusted in function of ADC clock frequency and sampling time
ganlikun 0:13413ea9a877 3121 * setting).
ganlikun 0:13413ea9a877 3122 * Refer to device datasheet for timings values (parameters TS_vrefint,
ganlikun 0:13413ea9a877 3123 * TS_temp, ...).
ganlikun 0:13413ea9a877 3124 * @note Conversion time is the addition of sampling time and processing time.
ganlikun 0:13413ea9a877 3125 * Refer to reference manual for ADC processing time of
ganlikun 0:13413ea9a877 3126 * this STM32 serie.
ganlikun 0:13413ea9a877 3127 * @note In case of ADC conversion of internal channel (VrefInt,
ganlikun 0:13413ea9a877 3128 * temperature sensor, ...), a sampling time minimum value
ganlikun 0:13413ea9a877 3129 * is required.
ganlikun 0:13413ea9a877 3130 * Refer to device datasheet.
ganlikun 0:13413ea9a877 3131 * @rmtoll SMPR1 SMP18 LL_ADC_SetChannelSamplingTime\n
ganlikun 0:13413ea9a877 3132 * SMPR1 SMP17 LL_ADC_SetChannelSamplingTime\n
ganlikun 0:13413ea9a877 3133 * SMPR1 SMP16 LL_ADC_SetChannelSamplingTime\n
ganlikun 0:13413ea9a877 3134 * SMPR1 SMP15 LL_ADC_SetChannelSamplingTime\n
ganlikun 0:13413ea9a877 3135 * SMPR1 SMP14 LL_ADC_SetChannelSamplingTime\n
ganlikun 0:13413ea9a877 3136 * SMPR1 SMP13 LL_ADC_SetChannelSamplingTime\n
ganlikun 0:13413ea9a877 3137 * SMPR1 SMP12 LL_ADC_SetChannelSamplingTime\n
ganlikun 0:13413ea9a877 3138 * SMPR1 SMP11 LL_ADC_SetChannelSamplingTime\n
ganlikun 0:13413ea9a877 3139 * SMPR1 SMP10 LL_ADC_SetChannelSamplingTime\n
ganlikun 0:13413ea9a877 3140 * SMPR2 SMP9 LL_ADC_SetChannelSamplingTime\n
ganlikun 0:13413ea9a877 3141 * SMPR2 SMP8 LL_ADC_SetChannelSamplingTime\n
ganlikun 0:13413ea9a877 3142 * SMPR2 SMP7 LL_ADC_SetChannelSamplingTime\n
ganlikun 0:13413ea9a877 3143 * SMPR2 SMP6 LL_ADC_SetChannelSamplingTime\n
ganlikun 0:13413ea9a877 3144 * SMPR2 SMP5 LL_ADC_SetChannelSamplingTime\n
ganlikun 0:13413ea9a877 3145 * SMPR2 SMP4 LL_ADC_SetChannelSamplingTime\n
ganlikun 0:13413ea9a877 3146 * SMPR2 SMP3 LL_ADC_SetChannelSamplingTime\n
ganlikun 0:13413ea9a877 3147 * SMPR2 SMP2 LL_ADC_SetChannelSamplingTime\n
ganlikun 0:13413ea9a877 3148 * SMPR2 SMP1 LL_ADC_SetChannelSamplingTime\n
ganlikun 0:13413ea9a877 3149 * SMPR2 SMP0 LL_ADC_SetChannelSamplingTime
ganlikun 0:13413ea9a877 3150 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 3151 * @param Channel This parameter can be one of the following values:
ganlikun 0:13413ea9a877 3152 * @arg @ref LL_ADC_CHANNEL_0
ganlikun 0:13413ea9a877 3153 * @arg @ref LL_ADC_CHANNEL_1
ganlikun 0:13413ea9a877 3154 * @arg @ref LL_ADC_CHANNEL_2
ganlikun 0:13413ea9a877 3155 * @arg @ref LL_ADC_CHANNEL_3
ganlikun 0:13413ea9a877 3156 * @arg @ref LL_ADC_CHANNEL_4
ganlikun 0:13413ea9a877 3157 * @arg @ref LL_ADC_CHANNEL_5
ganlikun 0:13413ea9a877 3158 * @arg @ref LL_ADC_CHANNEL_6
ganlikun 0:13413ea9a877 3159 * @arg @ref LL_ADC_CHANNEL_7
ganlikun 0:13413ea9a877 3160 * @arg @ref LL_ADC_CHANNEL_8
ganlikun 0:13413ea9a877 3161 * @arg @ref LL_ADC_CHANNEL_9
ganlikun 0:13413ea9a877 3162 * @arg @ref LL_ADC_CHANNEL_10
ganlikun 0:13413ea9a877 3163 * @arg @ref LL_ADC_CHANNEL_11
ganlikun 0:13413ea9a877 3164 * @arg @ref LL_ADC_CHANNEL_12
ganlikun 0:13413ea9a877 3165 * @arg @ref LL_ADC_CHANNEL_13
ganlikun 0:13413ea9a877 3166 * @arg @ref LL_ADC_CHANNEL_14
ganlikun 0:13413ea9a877 3167 * @arg @ref LL_ADC_CHANNEL_15
ganlikun 0:13413ea9a877 3168 * @arg @ref LL_ADC_CHANNEL_16
ganlikun 0:13413ea9a877 3169 * @arg @ref LL_ADC_CHANNEL_17
ganlikun 0:13413ea9a877 3170 * @arg @ref LL_ADC_CHANNEL_18
ganlikun 0:13413ea9a877 3171 * @arg @ref LL_ADC_CHANNEL_VREFINT (1)
ganlikun 0:13413ea9a877 3172 * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR (1)(2)
ganlikun 0:13413ea9a877 3173 * @arg @ref LL_ADC_CHANNEL_VBAT (1)
ganlikun 0:13413ea9a877 3174 *
ganlikun 0:13413ea9a877 3175 * (1) On STM32F4, parameter available only on ADC instance: ADC1.\n
ganlikun 0:13413ea9a877 3176 * (2) On devices STM32F42x and STM32F43x, limitation: this internal channel is shared between temperature sensor and Vbat, only 1 measurement path must be enabled.
ganlikun 0:13413ea9a877 3177 * @param SamplingTime This parameter can be one of the following values:
ganlikun 0:13413ea9a877 3178 * @arg @ref LL_ADC_SAMPLINGTIME_3CYCLES
ganlikun 0:13413ea9a877 3179 * @arg @ref LL_ADC_SAMPLINGTIME_15CYCLES
ganlikun 0:13413ea9a877 3180 * @arg @ref LL_ADC_SAMPLINGTIME_28CYCLES
ganlikun 0:13413ea9a877 3181 * @arg @ref LL_ADC_SAMPLINGTIME_56CYCLES
ganlikun 0:13413ea9a877 3182 * @arg @ref LL_ADC_SAMPLINGTIME_84CYCLES
ganlikun 0:13413ea9a877 3183 * @arg @ref LL_ADC_SAMPLINGTIME_112CYCLES
ganlikun 0:13413ea9a877 3184 * @arg @ref LL_ADC_SAMPLINGTIME_144CYCLES
ganlikun 0:13413ea9a877 3185 * @arg @ref LL_ADC_SAMPLINGTIME_480CYCLES
ganlikun 0:13413ea9a877 3186 * @retval None
ganlikun 0:13413ea9a877 3187 */
ganlikun 0:13413ea9a877 3188 __STATIC_INLINE void LL_ADC_SetChannelSamplingTime(ADC_TypeDef *ADCx, uint32_t Channel, uint32_t SamplingTime)
ganlikun 0:13413ea9a877 3189 {
ganlikun 0:13413ea9a877 3190 /* Set bits with content of parameter "SamplingTime" with bits position */
ganlikun 0:13413ea9a877 3191 /* in register and register position depending on parameter "Channel". */
ganlikun 0:13413ea9a877 3192 /* Parameter "Channel" is used with masks because containing */
ganlikun 0:13413ea9a877 3193 /* other bits reserved for other purpose. */
ganlikun 0:13413ea9a877 3194 register uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->SMPR1, __ADC_MASK_SHIFT(Channel, ADC_CHANNEL_SMPRX_REGOFFSET_MASK));
ganlikun 0:13413ea9a877 3195
ganlikun 0:13413ea9a877 3196 MODIFY_REG(*preg,
ganlikun 0:13413ea9a877 3197 ADC_SMPR2_SMP0 << __ADC_MASK_SHIFT(Channel, ADC_CHANNEL_SMPx_BITOFFSET_MASK),
ganlikun 0:13413ea9a877 3198 SamplingTime << __ADC_MASK_SHIFT(Channel, ADC_CHANNEL_SMPx_BITOFFSET_MASK));
ganlikun 0:13413ea9a877 3199 }
ganlikun 0:13413ea9a877 3200
ganlikun 0:13413ea9a877 3201 /**
ganlikun 0:13413ea9a877 3202 * @brief Get sampling time of the selected ADC channel
ganlikun 0:13413ea9a877 3203 * Unit: ADC clock cycles.
ganlikun 0:13413ea9a877 3204 * @note On this device, sampling time is on channel scope: independently
ganlikun 0:13413ea9a877 3205 * of channel mapped on ADC group regular or injected.
ganlikun 0:13413ea9a877 3206 * @note Conversion time is the addition of sampling time and processing time.
ganlikun 0:13413ea9a877 3207 * Refer to reference manual for ADC processing time of
ganlikun 0:13413ea9a877 3208 * this STM32 serie.
ganlikun 0:13413ea9a877 3209 * @rmtoll SMPR1 SMP18 LL_ADC_GetChannelSamplingTime\n
ganlikun 0:13413ea9a877 3210 * SMPR1 SMP17 LL_ADC_GetChannelSamplingTime\n
ganlikun 0:13413ea9a877 3211 * SMPR1 SMP16 LL_ADC_GetChannelSamplingTime\n
ganlikun 0:13413ea9a877 3212 * SMPR1 SMP15 LL_ADC_GetChannelSamplingTime\n
ganlikun 0:13413ea9a877 3213 * SMPR1 SMP14 LL_ADC_GetChannelSamplingTime\n
ganlikun 0:13413ea9a877 3214 * SMPR1 SMP13 LL_ADC_GetChannelSamplingTime\n
ganlikun 0:13413ea9a877 3215 * SMPR1 SMP12 LL_ADC_GetChannelSamplingTime\n
ganlikun 0:13413ea9a877 3216 * SMPR1 SMP11 LL_ADC_GetChannelSamplingTime\n
ganlikun 0:13413ea9a877 3217 * SMPR1 SMP10 LL_ADC_GetChannelSamplingTime\n
ganlikun 0:13413ea9a877 3218 * SMPR2 SMP9 LL_ADC_GetChannelSamplingTime\n
ganlikun 0:13413ea9a877 3219 * SMPR2 SMP8 LL_ADC_GetChannelSamplingTime\n
ganlikun 0:13413ea9a877 3220 * SMPR2 SMP7 LL_ADC_GetChannelSamplingTime\n
ganlikun 0:13413ea9a877 3221 * SMPR2 SMP6 LL_ADC_GetChannelSamplingTime\n
ganlikun 0:13413ea9a877 3222 * SMPR2 SMP5 LL_ADC_GetChannelSamplingTime\n
ganlikun 0:13413ea9a877 3223 * SMPR2 SMP4 LL_ADC_GetChannelSamplingTime\n
ganlikun 0:13413ea9a877 3224 * SMPR2 SMP3 LL_ADC_GetChannelSamplingTime\n
ganlikun 0:13413ea9a877 3225 * SMPR2 SMP2 LL_ADC_GetChannelSamplingTime\n
ganlikun 0:13413ea9a877 3226 * SMPR2 SMP1 LL_ADC_GetChannelSamplingTime\n
ganlikun 0:13413ea9a877 3227 * SMPR2 SMP0 LL_ADC_GetChannelSamplingTime
ganlikun 0:13413ea9a877 3228 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 3229 * @param Channel This parameter can be one of the following values:
ganlikun 0:13413ea9a877 3230 * @arg @ref LL_ADC_CHANNEL_0
ganlikun 0:13413ea9a877 3231 * @arg @ref LL_ADC_CHANNEL_1
ganlikun 0:13413ea9a877 3232 * @arg @ref LL_ADC_CHANNEL_2
ganlikun 0:13413ea9a877 3233 * @arg @ref LL_ADC_CHANNEL_3
ganlikun 0:13413ea9a877 3234 * @arg @ref LL_ADC_CHANNEL_4
ganlikun 0:13413ea9a877 3235 * @arg @ref LL_ADC_CHANNEL_5
ganlikun 0:13413ea9a877 3236 * @arg @ref LL_ADC_CHANNEL_6
ganlikun 0:13413ea9a877 3237 * @arg @ref LL_ADC_CHANNEL_7
ganlikun 0:13413ea9a877 3238 * @arg @ref LL_ADC_CHANNEL_8
ganlikun 0:13413ea9a877 3239 * @arg @ref LL_ADC_CHANNEL_9
ganlikun 0:13413ea9a877 3240 * @arg @ref LL_ADC_CHANNEL_10
ganlikun 0:13413ea9a877 3241 * @arg @ref LL_ADC_CHANNEL_11
ganlikun 0:13413ea9a877 3242 * @arg @ref LL_ADC_CHANNEL_12
ganlikun 0:13413ea9a877 3243 * @arg @ref LL_ADC_CHANNEL_13
ganlikun 0:13413ea9a877 3244 * @arg @ref LL_ADC_CHANNEL_14
ganlikun 0:13413ea9a877 3245 * @arg @ref LL_ADC_CHANNEL_15
ganlikun 0:13413ea9a877 3246 * @arg @ref LL_ADC_CHANNEL_16
ganlikun 0:13413ea9a877 3247 * @arg @ref LL_ADC_CHANNEL_17
ganlikun 0:13413ea9a877 3248 * @arg @ref LL_ADC_CHANNEL_18
ganlikun 0:13413ea9a877 3249 * @arg @ref LL_ADC_CHANNEL_VREFINT (1)
ganlikun 0:13413ea9a877 3250 * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR (1)(2)
ganlikun 0:13413ea9a877 3251 * @arg @ref LL_ADC_CHANNEL_VBAT (1)
ganlikun 0:13413ea9a877 3252 *
ganlikun 0:13413ea9a877 3253 * (1) On STM32F4, parameter available only on ADC instance: ADC1.\n
ganlikun 0:13413ea9a877 3254 * (2) On devices STM32F42x and STM32F43x, limitation: this internal channel is shared between temperature sensor and Vbat, only 1 measurement path must be enabled.
ganlikun 0:13413ea9a877 3255 * @retval Returned value can be one of the following values:
ganlikun 0:13413ea9a877 3256 * @arg @ref LL_ADC_SAMPLINGTIME_3CYCLES
ganlikun 0:13413ea9a877 3257 * @arg @ref LL_ADC_SAMPLINGTIME_15CYCLES
ganlikun 0:13413ea9a877 3258 * @arg @ref LL_ADC_SAMPLINGTIME_28CYCLES
ganlikun 0:13413ea9a877 3259 * @arg @ref LL_ADC_SAMPLINGTIME_56CYCLES
ganlikun 0:13413ea9a877 3260 * @arg @ref LL_ADC_SAMPLINGTIME_84CYCLES
ganlikun 0:13413ea9a877 3261 * @arg @ref LL_ADC_SAMPLINGTIME_112CYCLES
ganlikun 0:13413ea9a877 3262 * @arg @ref LL_ADC_SAMPLINGTIME_144CYCLES
ganlikun 0:13413ea9a877 3263 * @arg @ref LL_ADC_SAMPLINGTIME_480CYCLES
ganlikun 0:13413ea9a877 3264 */
ganlikun 0:13413ea9a877 3265 __STATIC_INLINE uint32_t LL_ADC_GetChannelSamplingTime(ADC_TypeDef *ADCx, uint32_t Channel)
ganlikun 0:13413ea9a877 3266 {
ganlikun 0:13413ea9a877 3267 register uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->SMPR1, __ADC_MASK_SHIFT(Channel, ADC_CHANNEL_SMPRX_REGOFFSET_MASK));
ganlikun 0:13413ea9a877 3268
ganlikun 0:13413ea9a877 3269 return (uint32_t)(READ_BIT(*preg,
ganlikun 0:13413ea9a877 3270 ADC_SMPR2_SMP0 << __ADC_MASK_SHIFT(Channel, ADC_CHANNEL_SMPx_BITOFFSET_MASK))
ganlikun 0:13413ea9a877 3271 >> __ADC_MASK_SHIFT(Channel, ADC_CHANNEL_SMPx_BITOFFSET_MASK)
ganlikun 0:13413ea9a877 3272 );
ganlikun 0:13413ea9a877 3273 }
ganlikun 0:13413ea9a877 3274
ganlikun 0:13413ea9a877 3275 /**
ganlikun 0:13413ea9a877 3276 * @}
ganlikun 0:13413ea9a877 3277 */
ganlikun 0:13413ea9a877 3278
ganlikun 0:13413ea9a877 3279 /** @defgroup ADC_LL_EF_Configuration_ADC_AnalogWatchdog Configuration of ADC transversal scope: analog watchdog
ganlikun 0:13413ea9a877 3280 * @{
ganlikun 0:13413ea9a877 3281 */
ganlikun 0:13413ea9a877 3282
ganlikun 0:13413ea9a877 3283 /**
ganlikun 0:13413ea9a877 3284 * @brief Set ADC analog watchdog monitored channels:
ganlikun 0:13413ea9a877 3285 * a single channel or all channels,
ganlikun 0:13413ea9a877 3286 * on ADC groups regular and-or injected.
ganlikun 0:13413ea9a877 3287 * @note Once monitored channels are selected, analog watchdog
ganlikun 0:13413ea9a877 3288 * is enabled.
ganlikun 0:13413ea9a877 3289 * @note In case of need to define a single channel to monitor
ganlikun 0:13413ea9a877 3290 * with analog watchdog from sequencer channel definition,
ganlikun 0:13413ea9a877 3291 * use helper macro @ref __LL_ADC_ANALOGWD_CHANNEL_GROUP().
ganlikun 0:13413ea9a877 3292 * @note On this STM32 serie, there is only 1 kind of analog watchdog
ganlikun 0:13413ea9a877 3293 * instance:
ganlikun 0:13413ea9a877 3294 * - AWD standard (instance AWD1):
ganlikun 0:13413ea9a877 3295 * - channels monitored: can monitor 1 channel or all channels.
ganlikun 0:13413ea9a877 3296 * - groups monitored: ADC groups regular and-or injected.
ganlikun 0:13413ea9a877 3297 * - resolution: resolution is not limited (corresponds to
ganlikun 0:13413ea9a877 3298 * ADC resolution configured).
ganlikun 0:13413ea9a877 3299 * @rmtoll CR1 AWD1CH LL_ADC_SetAnalogWDMonitChannels\n
ganlikun 0:13413ea9a877 3300 * CR1 AWD1SGL LL_ADC_SetAnalogWDMonitChannels\n
ganlikun 0:13413ea9a877 3301 * CR1 AWD1EN LL_ADC_SetAnalogWDMonitChannels
ganlikun 0:13413ea9a877 3302 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 3303 * @param AWDChannelGroup This parameter can be one of the following values:
ganlikun 0:13413ea9a877 3304 * @arg @ref LL_ADC_AWD_DISABLE
ganlikun 0:13413ea9a877 3305 * @arg @ref LL_ADC_AWD_ALL_CHANNELS_REG
ganlikun 0:13413ea9a877 3306 * @arg @ref LL_ADC_AWD_ALL_CHANNELS_INJ
ganlikun 0:13413ea9a877 3307 * @arg @ref LL_ADC_AWD_ALL_CHANNELS_REG_INJ
ganlikun 0:13413ea9a877 3308 * @arg @ref LL_ADC_AWD_CHANNEL_0_REG
ganlikun 0:13413ea9a877 3309 * @arg @ref LL_ADC_AWD_CHANNEL_0_INJ
ganlikun 0:13413ea9a877 3310 * @arg @ref LL_ADC_AWD_CHANNEL_0_REG_INJ
ganlikun 0:13413ea9a877 3311 * @arg @ref LL_ADC_AWD_CHANNEL_1_REG
ganlikun 0:13413ea9a877 3312 * @arg @ref LL_ADC_AWD_CHANNEL_1_INJ
ganlikun 0:13413ea9a877 3313 * @arg @ref LL_ADC_AWD_CHANNEL_1_REG_INJ
ganlikun 0:13413ea9a877 3314 * @arg @ref LL_ADC_AWD_CHANNEL_2_REG
ganlikun 0:13413ea9a877 3315 * @arg @ref LL_ADC_AWD_CHANNEL_2_INJ
ganlikun 0:13413ea9a877 3316 * @arg @ref LL_ADC_AWD_CHANNEL_2_REG_INJ
ganlikun 0:13413ea9a877 3317 * @arg @ref LL_ADC_AWD_CHANNEL_3_REG
ganlikun 0:13413ea9a877 3318 * @arg @ref LL_ADC_AWD_CHANNEL_3_INJ
ganlikun 0:13413ea9a877 3319 * @arg @ref LL_ADC_AWD_CHANNEL_3_REG_INJ
ganlikun 0:13413ea9a877 3320 * @arg @ref LL_ADC_AWD_CHANNEL_4_REG
ganlikun 0:13413ea9a877 3321 * @arg @ref LL_ADC_AWD_CHANNEL_4_INJ
ganlikun 0:13413ea9a877 3322 * @arg @ref LL_ADC_AWD_CHANNEL_4_REG_INJ
ganlikun 0:13413ea9a877 3323 * @arg @ref LL_ADC_AWD_CHANNEL_5_REG
ganlikun 0:13413ea9a877 3324 * @arg @ref LL_ADC_AWD_CHANNEL_5_INJ
ganlikun 0:13413ea9a877 3325 * @arg @ref LL_ADC_AWD_CHANNEL_5_REG_INJ
ganlikun 0:13413ea9a877 3326 * @arg @ref LL_ADC_AWD_CHANNEL_6_REG
ganlikun 0:13413ea9a877 3327 * @arg @ref LL_ADC_AWD_CHANNEL_6_INJ
ganlikun 0:13413ea9a877 3328 * @arg @ref LL_ADC_AWD_CHANNEL_6_REG_INJ
ganlikun 0:13413ea9a877 3329 * @arg @ref LL_ADC_AWD_CHANNEL_7_REG
ganlikun 0:13413ea9a877 3330 * @arg @ref LL_ADC_AWD_CHANNEL_7_INJ
ganlikun 0:13413ea9a877 3331 * @arg @ref LL_ADC_AWD_CHANNEL_7_REG_INJ
ganlikun 0:13413ea9a877 3332 * @arg @ref LL_ADC_AWD_CHANNEL_8_REG
ganlikun 0:13413ea9a877 3333 * @arg @ref LL_ADC_AWD_CHANNEL_8_INJ
ganlikun 0:13413ea9a877 3334 * @arg @ref LL_ADC_AWD_CHANNEL_8_REG_INJ
ganlikun 0:13413ea9a877 3335 * @arg @ref LL_ADC_AWD_CHANNEL_9_REG
ganlikun 0:13413ea9a877 3336 * @arg @ref LL_ADC_AWD_CHANNEL_9_INJ
ganlikun 0:13413ea9a877 3337 * @arg @ref LL_ADC_AWD_CHANNEL_9_REG_INJ
ganlikun 0:13413ea9a877 3338 * @arg @ref LL_ADC_AWD_CHANNEL_10_REG
ganlikun 0:13413ea9a877 3339 * @arg @ref LL_ADC_AWD_CHANNEL_10_INJ
ganlikun 0:13413ea9a877 3340 * @arg @ref LL_ADC_AWD_CHANNEL_10_REG_INJ
ganlikun 0:13413ea9a877 3341 * @arg @ref LL_ADC_AWD_CHANNEL_11_REG
ganlikun 0:13413ea9a877 3342 * @arg @ref LL_ADC_AWD_CHANNEL_11_INJ
ganlikun 0:13413ea9a877 3343 * @arg @ref LL_ADC_AWD_CHANNEL_11_REG_INJ
ganlikun 0:13413ea9a877 3344 * @arg @ref LL_ADC_AWD_CHANNEL_12_REG
ganlikun 0:13413ea9a877 3345 * @arg @ref LL_ADC_AWD_CHANNEL_12_INJ
ganlikun 0:13413ea9a877 3346 * @arg @ref LL_ADC_AWD_CHANNEL_12_REG_INJ
ganlikun 0:13413ea9a877 3347 * @arg @ref LL_ADC_AWD_CHANNEL_13_REG
ganlikun 0:13413ea9a877 3348 * @arg @ref LL_ADC_AWD_CHANNEL_13_INJ
ganlikun 0:13413ea9a877 3349 * @arg @ref LL_ADC_AWD_CHANNEL_13_REG_INJ
ganlikun 0:13413ea9a877 3350 * @arg @ref LL_ADC_AWD_CHANNEL_14_REG
ganlikun 0:13413ea9a877 3351 * @arg @ref LL_ADC_AWD_CHANNEL_14_INJ
ganlikun 0:13413ea9a877 3352 * @arg @ref LL_ADC_AWD_CHANNEL_14_REG_INJ
ganlikun 0:13413ea9a877 3353 * @arg @ref LL_ADC_AWD_CHANNEL_15_REG
ganlikun 0:13413ea9a877 3354 * @arg @ref LL_ADC_AWD_CHANNEL_15_INJ
ganlikun 0:13413ea9a877 3355 * @arg @ref LL_ADC_AWD_CHANNEL_15_REG_INJ
ganlikun 0:13413ea9a877 3356 * @arg @ref LL_ADC_AWD_CHANNEL_16_REG
ganlikun 0:13413ea9a877 3357 * @arg @ref LL_ADC_AWD_CHANNEL_16_INJ
ganlikun 0:13413ea9a877 3358 * @arg @ref LL_ADC_AWD_CHANNEL_16_REG_INJ
ganlikun 0:13413ea9a877 3359 * @arg @ref LL_ADC_AWD_CHANNEL_17_REG
ganlikun 0:13413ea9a877 3360 * @arg @ref LL_ADC_AWD_CHANNEL_17_INJ
ganlikun 0:13413ea9a877 3361 * @arg @ref LL_ADC_AWD_CHANNEL_17_REG_INJ
ganlikun 0:13413ea9a877 3362 * @arg @ref LL_ADC_AWD_CHANNEL_18_REG
ganlikun 0:13413ea9a877 3363 * @arg @ref LL_ADC_AWD_CHANNEL_18_INJ
ganlikun 0:13413ea9a877 3364 * @arg @ref LL_ADC_AWD_CHANNEL_18_REG_INJ
ganlikun 0:13413ea9a877 3365 * @arg @ref LL_ADC_AWD_CH_VREFINT_REG (1)
ganlikun 0:13413ea9a877 3366 * @arg @ref LL_ADC_AWD_CH_VREFINT_INJ (1)
ganlikun 0:13413ea9a877 3367 * @arg @ref LL_ADC_AWD_CH_VREFINT_REG_INJ (1)
ganlikun 0:13413ea9a877 3368 * @arg @ref LL_ADC_AWD_CH_TEMPSENSOR_REG (1)(2)
ganlikun 0:13413ea9a877 3369 * @arg @ref LL_ADC_AWD_CH_TEMPSENSOR_INJ (1)(2)
ganlikun 0:13413ea9a877 3370 * @arg @ref LL_ADC_AWD_CH_TEMPSENSOR_REG_INJ (1)(2)
ganlikun 0:13413ea9a877 3371 * @arg @ref LL_ADC_AWD_CH_VBAT_REG (1)
ganlikun 0:13413ea9a877 3372 * @arg @ref LL_ADC_AWD_CH_VBAT_INJ (1)
ganlikun 0:13413ea9a877 3373 * @arg @ref LL_ADC_AWD_CH_VBAT_REG_INJ (1)
ganlikun 0:13413ea9a877 3374 *
ganlikun 0:13413ea9a877 3375 * (1) On STM32F4, parameter available only on ADC instance: ADC1.\n
ganlikun 0:13413ea9a877 3376 * (2) On devices STM32F42x and STM32F43x, limitation: this internal channel is shared between temperature sensor and Vbat, only 1 measurement path must be enabled.
ganlikun 0:13413ea9a877 3377 * @retval None
ganlikun 0:13413ea9a877 3378 */
ganlikun 0:13413ea9a877 3379 __STATIC_INLINE void LL_ADC_SetAnalogWDMonitChannels(ADC_TypeDef *ADCx, uint32_t AWDChannelGroup)
ganlikun 0:13413ea9a877 3380 {
ganlikun 0:13413ea9a877 3381 MODIFY_REG(ADCx->CR1,
ganlikun 0:13413ea9a877 3382 (ADC_CR1_AWDEN | ADC_CR1_JAWDEN | ADC_CR1_AWDSGL | ADC_CR1_AWDCH),
ganlikun 0:13413ea9a877 3383 AWDChannelGroup);
ganlikun 0:13413ea9a877 3384 }
ganlikun 0:13413ea9a877 3385
ganlikun 0:13413ea9a877 3386 /**
ganlikun 0:13413ea9a877 3387 * @brief Get ADC analog watchdog monitored channel.
ganlikun 0:13413ea9a877 3388 * @note Usage of the returned channel number:
ganlikun 0:13413ea9a877 3389 * - To reinject this channel into another function LL_ADC_xxx:
ganlikun 0:13413ea9a877 3390 * the returned channel number is only partly formatted on definition
ganlikun 0:13413ea9a877 3391 * of literals LL_ADC_CHANNEL_x. Therefore, it has to be compared
ganlikun 0:13413ea9a877 3392 * with parts of literals LL_ADC_CHANNEL_x or using
ganlikun 0:13413ea9a877 3393 * helper macro @ref __LL_ADC_CHANNEL_TO_DECIMAL_NB().
ganlikun 0:13413ea9a877 3394 * Then the selected literal LL_ADC_CHANNEL_x can be used
ganlikun 0:13413ea9a877 3395 * as parameter for another function.
ganlikun 0:13413ea9a877 3396 * - To get the channel number in decimal format:
ganlikun 0:13413ea9a877 3397 * process the returned value with the helper macro
ganlikun 0:13413ea9a877 3398 * @ref __LL_ADC_CHANNEL_TO_DECIMAL_NB().
ganlikun 0:13413ea9a877 3399 * Applicable only when the analog watchdog is set to monitor
ganlikun 0:13413ea9a877 3400 * one channel.
ganlikun 0:13413ea9a877 3401 * @note On this STM32 serie, there is only 1 kind of analog watchdog
ganlikun 0:13413ea9a877 3402 * instance:
ganlikun 0:13413ea9a877 3403 * - AWD standard (instance AWD1):
ganlikun 0:13413ea9a877 3404 * - channels monitored: can monitor 1 channel or all channels.
ganlikun 0:13413ea9a877 3405 * - groups monitored: ADC groups regular and-or injected.
ganlikun 0:13413ea9a877 3406 * - resolution: resolution is not limited (corresponds to
ganlikun 0:13413ea9a877 3407 * ADC resolution configured).
ganlikun 0:13413ea9a877 3408 * @rmtoll CR1 AWD1CH LL_ADC_GetAnalogWDMonitChannels\n
ganlikun 0:13413ea9a877 3409 * CR1 AWD1SGL LL_ADC_GetAnalogWDMonitChannels\n
ganlikun 0:13413ea9a877 3410 * CR1 AWD1EN LL_ADC_GetAnalogWDMonitChannels
ganlikun 0:13413ea9a877 3411 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 3412 * @retval Returned value can be one of the following values:
ganlikun 0:13413ea9a877 3413 * @arg @ref LL_ADC_AWD_DISABLE
ganlikun 0:13413ea9a877 3414 * @arg @ref LL_ADC_AWD_ALL_CHANNELS_REG
ganlikun 0:13413ea9a877 3415 * @arg @ref LL_ADC_AWD_ALL_CHANNELS_INJ
ganlikun 0:13413ea9a877 3416 * @arg @ref LL_ADC_AWD_ALL_CHANNELS_REG_INJ
ganlikun 0:13413ea9a877 3417 * @arg @ref LL_ADC_AWD_CHANNEL_0_REG
ganlikun 0:13413ea9a877 3418 * @arg @ref LL_ADC_AWD_CHANNEL_0_INJ
ganlikun 0:13413ea9a877 3419 * @arg @ref LL_ADC_AWD_CHANNEL_0_REG_INJ
ganlikun 0:13413ea9a877 3420 * @arg @ref LL_ADC_AWD_CHANNEL_1_REG
ganlikun 0:13413ea9a877 3421 * @arg @ref LL_ADC_AWD_CHANNEL_1_INJ
ganlikun 0:13413ea9a877 3422 * @arg @ref LL_ADC_AWD_CHANNEL_1_REG_INJ
ganlikun 0:13413ea9a877 3423 * @arg @ref LL_ADC_AWD_CHANNEL_2_REG
ganlikun 0:13413ea9a877 3424 * @arg @ref LL_ADC_AWD_CHANNEL_2_INJ
ganlikun 0:13413ea9a877 3425 * @arg @ref LL_ADC_AWD_CHANNEL_2_REG_INJ
ganlikun 0:13413ea9a877 3426 * @arg @ref LL_ADC_AWD_CHANNEL_3_REG
ganlikun 0:13413ea9a877 3427 * @arg @ref LL_ADC_AWD_CHANNEL_3_INJ
ganlikun 0:13413ea9a877 3428 * @arg @ref LL_ADC_AWD_CHANNEL_3_REG_INJ
ganlikun 0:13413ea9a877 3429 * @arg @ref LL_ADC_AWD_CHANNEL_4_REG
ganlikun 0:13413ea9a877 3430 * @arg @ref LL_ADC_AWD_CHANNEL_4_INJ
ganlikun 0:13413ea9a877 3431 * @arg @ref LL_ADC_AWD_CHANNEL_4_REG_INJ
ganlikun 0:13413ea9a877 3432 * @arg @ref LL_ADC_AWD_CHANNEL_5_REG
ganlikun 0:13413ea9a877 3433 * @arg @ref LL_ADC_AWD_CHANNEL_5_INJ
ganlikun 0:13413ea9a877 3434 * @arg @ref LL_ADC_AWD_CHANNEL_5_REG_INJ
ganlikun 0:13413ea9a877 3435 * @arg @ref LL_ADC_AWD_CHANNEL_6_REG
ganlikun 0:13413ea9a877 3436 * @arg @ref LL_ADC_AWD_CHANNEL_6_INJ
ganlikun 0:13413ea9a877 3437 * @arg @ref LL_ADC_AWD_CHANNEL_6_REG_INJ
ganlikun 0:13413ea9a877 3438 * @arg @ref LL_ADC_AWD_CHANNEL_7_REG
ganlikun 0:13413ea9a877 3439 * @arg @ref LL_ADC_AWD_CHANNEL_7_INJ
ganlikun 0:13413ea9a877 3440 * @arg @ref LL_ADC_AWD_CHANNEL_7_REG_INJ
ganlikun 0:13413ea9a877 3441 * @arg @ref LL_ADC_AWD_CHANNEL_8_REG
ganlikun 0:13413ea9a877 3442 * @arg @ref LL_ADC_AWD_CHANNEL_8_INJ
ganlikun 0:13413ea9a877 3443 * @arg @ref LL_ADC_AWD_CHANNEL_8_REG_INJ
ganlikun 0:13413ea9a877 3444 * @arg @ref LL_ADC_AWD_CHANNEL_9_REG
ganlikun 0:13413ea9a877 3445 * @arg @ref LL_ADC_AWD_CHANNEL_9_INJ
ganlikun 0:13413ea9a877 3446 * @arg @ref LL_ADC_AWD_CHANNEL_9_REG_INJ
ganlikun 0:13413ea9a877 3447 * @arg @ref LL_ADC_AWD_CHANNEL_10_REG
ganlikun 0:13413ea9a877 3448 * @arg @ref LL_ADC_AWD_CHANNEL_10_INJ
ganlikun 0:13413ea9a877 3449 * @arg @ref LL_ADC_AWD_CHANNEL_10_REG_INJ
ganlikun 0:13413ea9a877 3450 * @arg @ref LL_ADC_AWD_CHANNEL_11_REG
ganlikun 0:13413ea9a877 3451 * @arg @ref LL_ADC_AWD_CHANNEL_11_INJ
ganlikun 0:13413ea9a877 3452 * @arg @ref LL_ADC_AWD_CHANNEL_11_REG_INJ
ganlikun 0:13413ea9a877 3453 * @arg @ref LL_ADC_AWD_CHANNEL_12_REG
ganlikun 0:13413ea9a877 3454 * @arg @ref LL_ADC_AWD_CHANNEL_12_INJ
ganlikun 0:13413ea9a877 3455 * @arg @ref LL_ADC_AWD_CHANNEL_12_REG_INJ
ganlikun 0:13413ea9a877 3456 * @arg @ref LL_ADC_AWD_CHANNEL_13_REG
ganlikun 0:13413ea9a877 3457 * @arg @ref LL_ADC_AWD_CHANNEL_13_INJ
ganlikun 0:13413ea9a877 3458 * @arg @ref LL_ADC_AWD_CHANNEL_13_REG_INJ
ganlikun 0:13413ea9a877 3459 * @arg @ref LL_ADC_AWD_CHANNEL_14_REG
ganlikun 0:13413ea9a877 3460 * @arg @ref LL_ADC_AWD_CHANNEL_14_INJ
ganlikun 0:13413ea9a877 3461 * @arg @ref LL_ADC_AWD_CHANNEL_14_REG_INJ
ganlikun 0:13413ea9a877 3462 * @arg @ref LL_ADC_AWD_CHANNEL_15_REG
ganlikun 0:13413ea9a877 3463 * @arg @ref LL_ADC_AWD_CHANNEL_15_INJ
ganlikun 0:13413ea9a877 3464 * @arg @ref LL_ADC_AWD_CHANNEL_15_REG_INJ
ganlikun 0:13413ea9a877 3465 * @arg @ref LL_ADC_AWD_CHANNEL_16_REG
ganlikun 0:13413ea9a877 3466 * @arg @ref LL_ADC_AWD_CHANNEL_16_INJ
ganlikun 0:13413ea9a877 3467 * @arg @ref LL_ADC_AWD_CHANNEL_16_REG_INJ
ganlikun 0:13413ea9a877 3468 * @arg @ref LL_ADC_AWD_CHANNEL_17_REG
ganlikun 0:13413ea9a877 3469 * @arg @ref LL_ADC_AWD_CHANNEL_17_INJ
ganlikun 0:13413ea9a877 3470 * @arg @ref LL_ADC_AWD_CHANNEL_17_REG_INJ
ganlikun 0:13413ea9a877 3471 * @arg @ref LL_ADC_AWD_CHANNEL_18_REG
ganlikun 0:13413ea9a877 3472 * @arg @ref LL_ADC_AWD_CHANNEL_18_INJ
ganlikun 0:13413ea9a877 3473 * @arg @ref LL_ADC_AWD_CHANNEL_18_REG_INJ
ganlikun 0:13413ea9a877 3474 */
ganlikun 0:13413ea9a877 3475 __STATIC_INLINE uint32_t LL_ADC_GetAnalogWDMonitChannels(ADC_TypeDef *ADCx)
ganlikun 0:13413ea9a877 3476 {
ganlikun 0:13413ea9a877 3477 return (uint32_t)(READ_BIT(ADCx->CR1, (ADC_CR1_AWDEN | ADC_CR1_JAWDEN | ADC_CR1_AWDSGL | ADC_CR1_AWDCH)));
ganlikun 0:13413ea9a877 3478 }
ganlikun 0:13413ea9a877 3479
ganlikun 0:13413ea9a877 3480 /**
ganlikun 0:13413ea9a877 3481 * @brief Set ADC analog watchdog threshold value of threshold
ganlikun 0:13413ea9a877 3482 * high or low.
ganlikun 0:13413ea9a877 3483 * @note In case of ADC resolution different of 12 bits,
ganlikun 0:13413ea9a877 3484 * analog watchdog thresholds data require a specific shift.
ganlikun 0:13413ea9a877 3485 * Use helper macro @ref __LL_ADC_ANALOGWD_SET_THRESHOLD_RESOLUTION().
ganlikun 0:13413ea9a877 3486 * @note On this STM32 serie, there is only 1 kind of analog watchdog
ganlikun 0:13413ea9a877 3487 * instance:
ganlikun 0:13413ea9a877 3488 * - AWD standard (instance AWD1):
ganlikun 0:13413ea9a877 3489 * - channels monitored: can monitor 1 channel or all channels.
ganlikun 0:13413ea9a877 3490 * - groups monitored: ADC groups regular and-or injected.
ganlikun 0:13413ea9a877 3491 * - resolution: resolution is not limited (corresponds to
ganlikun 0:13413ea9a877 3492 * ADC resolution configured).
ganlikun 0:13413ea9a877 3493 * @rmtoll HTR HT LL_ADC_SetAnalogWDThresholds\n
ganlikun 0:13413ea9a877 3494 * LTR LT LL_ADC_SetAnalogWDThresholds
ganlikun 0:13413ea9a877 3495 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 3496 * @param AWDThresholdsHighLow This parameter can be one of the following values:
ganlikun 0:13413ea9a877 3497 * @arg @ref LL_ADC_AWD_THRESHOLD_HIGH
ganlikun 0:13413ea9a877 3498 * @arg @ref LL_ADC_AWD_THRESHOLD_LOW
ganlikun 0:13413ea9a877 3499 * @param AWDThresholdValue: Value between Min_Data=0x000 and Max_Data=0xFFF
ganlikun 0:13413ea9a877 3500 * @retval None
ganlikun 0:13413ea9a877 3501 */
ganlikun 0:13413ea9a877 3502 __STATIC_INLINE void LL_ADC_SetAnalogWDThresholds(ADC_TypeDef *ADCx, uint32_t AWDThresholdsHighLow, uint32_t AWDThresholdValue)
ganlikun 0:13413ea9a877 3503 {
ganlikun 0:13413ea9a877 3504 register uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->HTR, AWDThresholdsHighLow);
ganlikun 0:13413ea9a877 3505
ganlikun 0:13413ea9a877 3506 MODIFY_REG(*preg,
ganlikun 0:13413ea9a877 3507 ADC_HTR_HT,
ganlikun 0:13413ea9a877 3508 AWDThresholdValue);
ganlikun 0:13413ea9a877 3509 }
ganlikun 0:13413ea9a877 3510
ganlikun 0:13413ea9a877 3511 /**
ganlikun 0:13413ea9a877 3512 * @brief Get ADC analog watchdog threshold value of threshold high or
ganlikun 0:13413ea9a877 3513 * threshold low.
ganlikun 0:13413ea9a877 3514 * @note In case of ADC resolution different of 12 bits,
ganlikun 0:13413ea9a877 3515 * analog watchdog thresholds data require a specific shift.
ganlikun 0:13413ea9a877 3516 * Use helper macro @ref __LL_ADC_ANALOGWD_GET_THRESHOLD_RESOLUTION().
ganlikun 0:13413ea9a877 3517 * @rmtoll HTR HT LL_ADC_GetAnalogWDThresholds\n
ganlikun 0:13413ea9a877 3518 * LTR LT LL_ADC_GetAnalogWDThresholds
ganlikun 0:13413ea9a877 3519 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 3520 * @param AWDThresholdsHighLow This parameter can be one of the following values:
ganlikun 0:13413ea9a877 3521 * @arg @ref LL_ADC_AWD_THRESHOLD_HIGH
ganlikun 0:13413ea9a877 3522 * @arg @ref LL_ADC_AWD_THRESHOLD_LOW
ganlikun 0:13413ea9a877 3523 * @retval Value between Min_Data=0x000 and Max_Data=0xFFF
ganlikun 0:13413ea9a877 3524 */
ganlikun 0:13413ea9a877 3525 __STATIC_INLINE uint32_t LL_ADC_GetAnalogWDThresholds(ADC_TypeDef *ADCx, uint32_t AWDThresholdsHighLow)
ganlikun 0:13413ea9a877 3526 {
ganlikun 0:13413ea9a877 3527 register uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->HTR, AWDThresholdsHighLow);
ganlikun 0:13413ea9a877 3528
ganlikun 0:13413ea9a877 3529 return (uint32_t)(READ_BIT(*preg, ADC_HTR_HT));
ganlikun 0:13413ea9a877 3530 }
ganlikun 0:13413ea9a877 3531
ganlikun 0:13413ea9a877 3532 /**
ganlikun 0:13413ea9a877 3533 * @}
ganlikun 0:13413ea9a877 3534 */
ganlikun 0:13413ea9a877 3535
ganlikun 0:13413ea9a877 3536 /** @defgroup ADC_LL_EF_Configuration_ADC_Multimode Configuration of ADC hierarchical scope: multimode
ganlikun 0:13413ea9a877 3537 * @{
ganlikun 0:13413ea9a877 3538 */
ganlikun 0:13413ea9a877 3539
ganlikun 0:13413ea9a877 3540 #if defined(ADC_MULTIMODE_SUPPORT)
ganlikun 0:13413ea9a877 3541 /**
ganlikun 0:13413ea9a877 3542 * @brief Set ADC multimode configuration to operate in independent mode
ganlikun 0:13413ea9a877 3543 * or multimode (for devices with several ADC instances).
ganlikun 0:13413ea9a877 3544 * @note If multimode configuration: the selected ADC instance is
ganlikun 0:13413ea9a877 3545 * either master or slave depending on hardware.
ganlikun 0:13413ea9a877 3546 * Refer to reference manual.
ganlikun 0:13413ea9a877 3547 * @rmtoll CCR MULTI LL_ADC_SetMultimode
ganlikun 0:13413ea9a877 3548 * @param ADCxy_COMMON ADC common instance
ganlikun 0:13413ea9a877 3549 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
ganlikun 0:13413ea9a877 3550 * @param Multimode This parameter can be one of the following values:
ganlikun 0:13413ea9a877 3551 * @arg @ref LL_ADC_MULTI_INDEPENDENT
ganlikun 0:13413ea9a877 3552 * @arg @ref LL_ADC_MULTI_DUAL_REG_SIMULT
ganlikun 0:13413ea9a877 3553 * @arg @ref LL_ADC_MULTI_DUAL_REG_INTERL
ganlikun 0:13413ea9a877 3554 * @arg @ref LL_ADC_MULTI_DUAL_INJ_SIMULT
ganlikun 0:13413ea9a877 3555 * @arg @ref LL_ADC_MULTI_DUAL_INJ_ALTERN
ganlikun 0:13413ea9a877 3556 * @arg @ref LL_ADC_MULTI_DUAL_REG_SIM_INJ_SIM
ganlikun 0:13413ea9a877 3557 * @arg @ref LL_ADC_MULTI_DUAL_REG_SIM_INJ_ALT
ganlikun 0:13413ea9a877 3558 * @arg @ref LL_ADC_MULTI_DUAL_REG_INT_INJ_SIM
ganlikun 0:13413ea9a877 3559 * @arg @ref LL_ADC_MULTI_TRIPLE_REG_SIM_INJ_SIM
ganlikun 0:13413ea9a877 3560 * @arg @ref LL_ADC_MULTI_TRIPLE_REG_SIM_INJ_ALT
ganlikun 0:13413ea9a877 3561 * @arg @ref LL_ADC_MULTI_TRIPLE_INJ_SIMULT
ganlikun 0:13413ea9a877 3562 * @arg @ref LL_ADC_MULTI_TRIPLE_REG_SIMULT
ganlikun 0:13413ea9a877 3563 * @arg @ref LL_ADC_MULTI_TRIPLE_REG_INTERL
ganlikun 0:13413ea9a877 3564 * @arg @ref LL_ADC_MULTI_TRIPLE_INJ_ALTERN
ganlikun 0:13413ea9a877 3565 * @retval None
ganlikun 0:13413ea9a877 3566 */
ganlikun 0:13413ea9a877 3567 __STATIC_INLINE void LL_ADC_SetMultimode(ADC_Common_TypeDef *ADCxy_COMMON, uint32_t Multimode)
ganlikun 0:13413ea9a877 3568 {
ganlikun 0:13413ea9a877 3569 MODIFY_REG(ADCxy_COMMON->CCR, ADC_CCR_MULTI, Multimode);
ganlikun 0:13413ea9a877 3570 }
ganlikun 0:13413ea9a877 3571
ganlikun 0:13413ea9a877 3572 /**
ganlikun 0:13413ea9a877 3573 * @brief Get ADC multimode configuration to operate in independent mode
ganlikun 0:13413ea9a877 3574 * or multimode (for devices with several ADC instances).
ganlikun 0:13413ea9a877 3575 * @note If multimode configuration: the selected ADC instance is
ganlikun 0:13413ea9a877 3576 * either master or slave depending on hardware.
ganlikun 0:13413ea9a877 3577 * Refer to reference manual.
ganlikun 0:13413ea9a877 3578 * @rmtoll CCR MULTI LL_ADC_GetMultimode
ganlikun 0:13413ea9a877 3579 * @param ADCxy_COMMON ADC common instance
ganlikun 0:13413ea9a877 3580 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
ganlikun 0:13413ea9a877 3581 * @retval Returned value can be one of the following values:
ganlikun 0:13413ea9a877 3582 * @arg @ref LL_ADC_MULTI_INDEPENDENT
ganlikun 0:13413ea9a877 3583 * @arg @ref LL_ADC_MULTI_DUAL_REG_SIMULT
ganlikun 0:13413ea9a877 3584 * @arg @ref LL_ADC_MULTI_DUAL_REG_INTERL
ganlikun 0:13413ea9a877 3585 * @arg @ref LL_ADC_MULTI_DUAL_INJ_SIMULT
ganlikun 0:13413ea9a877 3586 * @arg @ref LL_ADC_MULTI_DUAL_INJ_ALTERN
ganlikun 0:13413ea9a877 3587 * @arg @ref LL_ADC_MULTI_DUAL_REG_SIM_INJ_SIM
ganlikun 0:13413ea9a877 3588 * @arg @ref LL_ADC_MULTI_DUAL_REG_SIM_INJ_ALT
ganlikun 0:13413ea9a877 3589 * @arg @ref LL_ADC_MULTI_DUAL_REG_INT_INJ_SIM
ganlikun 0:13413ea9a877 3590 * @arg @ref LL_ADC_MULTI_TRIPLE_REG_SIM_INJ_SIM
ganlikun 0:13413ea9a877 3591 * @arg @ref LL_ADC_MULTI_TRIPLE_REG_SIM_INJ_ALT
ganlikun 0:13413ea9a877 3592 * @arg @ref LL_ADC_MULTI_TRIPLE_INJ_SIMULT
ganlikun 0:13413ea9a877 3593 * @arg @ref LL_ADC_MULTI_TRIPLE_REG_SIMULT
ganlikun 0:13413ea9a877 3594 * @arg @ref LL_ADC_MULTI_TRIPLE_REG_INTERL
ganlikun 0:13413ea9a877 3595 * @arg @ref LL_ADC_MULTI_TRIPLE_INJ_ALTERN
ganlikun 0:13413ea9a877 3596 */
ganlikun 0:13413ea9a877 3597 __STATIC_INLINE uint32_t LL_ADC_GetMultimode(ADC_Common_TypeDef *ADCxy_COMMON)
ganlikun 0:13413ea9a877 3598 {
ganlikun 0:13413ea9a877 3599 return (uint32_t)(READ_BIT(ADCxy_COMMON->CCR, ADC_CCR_MULTI));
ganlikun 0:13413ea9a877 3600 }
ganlikun 0:13413ea9a877 3601
ganlikun 0:13413ea9a877 3602 /**
ganlikun 0:13413ea9a877 3603 * @brief Set ADC multimode conversion data transfer: no transfer
ganlikun 0:13413ea9a877 3604 * or transfer by DMA.
ganlikun 0:13413ea9a877 3605 * @note If ADC multimode transfer by DMA is not selected:
ganlikun 0:13413ea9a877 3606 * each ADC uses its own DMA channel, with its individual
ganlikun 0:13413ea9a877 3607 * DMA transfer settings.
ganlikun 0:13413ea9a877 3608 * If ADC multimode transfer by DMA is selected:
ganlikun 0:13413ea9a877 3609 * One DMA channel is used for both ADC (DMA of ADC master)
ganlikun 0:13413ea9a877 3610 * Specifies the DMA requests mode:
ganlikun 0:13413ea9a877 3611 * - Limited mode (One shot mode): DMA transfer requests are stopped
ganlikun 0:13413ea9a877 3612 * when number of DMA data transfers (number of
ganlikun 0:13413ea9a877 3613 * ADC conversions) is reached.
ganlikun 0:13413ea9a877 3614 * This ADC mode is intended to be used with DMA mode non-circular.
ganlikun 0:13413ea9a877 3615 * - Unlimited mode: DMA transfer requests are unlimited,
ganlikun 0:13413ea9a877 3616 * whatever number of DMA data transfers (number of
ganlikun 0:13413ea9a877 3617 * ADC conversions).
ganlikun 0:13413ea9a877 3618 * This ADC mode is intended to be used with DMA mode circular.
ganlikun 0:13413ea9a877 3619 * @note If ADC DMA requests mode is set to unlimited and DMA is set to
ganlikun 0:13413ea9a877 3620 * mode non-circular:
ganlikun 0:13413ea9a877 3621 * when DMA transfers size will be reached, DMA will stop transfers of
ganlikun 0:13413ea9a877 3622 * ADC conversions data ADC will raise an overrun error
ganlikun 0:13413ea9a877 3623 * (overrun flag and interruption if enabled).
ganlikun 0:13413ea9a877 3624 * @note How to retrieve multimode conversion data:
ganlikun 0:13413ea9a877 3625 * Whatever multimode transfer by DMA setting: using function
ganlikun 0:13413ea9a877 3626 * @ref LL_ADC_REG_ReadMultiConversionData32().
ganlikun 0:13413ea9a877 3627 * If ADC multimode transfer by DMA is selected: conversion data
ganlikun 0:13413ea9a877 3628 * is a raw data with ADC master and slave concatenated.
ganlikun 0:13413ea9a877 3629 * A macro is available to get the conversion data of
ganlikun 0:13413ea9a877 3630 * ADC master or ADC slave: see helper macro
ganlikun 0:13413ea9a877 3631 * @ref __LL_ADC_MULTI_CONV_DATA_MASTER_SLAVE().
ganlikun 0:13413ea9a877 3632 * @rmtoll CCR MDMA LL_ADC_SetMultiDMATransfer\n
ganlikun 0:13413ea9a877 3633 * CCR DDS LL_ADC_SetMultiDMATransfer
ganlikun 0:13413ea9a877 3634 * @param ADCxy_COMMON ADC common instance
ganlikun 0:13413ea9a877 3635 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
ganlikun 0:13413ea9a877 3636 * @param MultiDMATransfer This parameter can be one of the following values:
ganlikun 0:13413ea9a877 3637 * @arg @ref LL_ADC_MULTI_REG_DMA_EACH_ADC
ganlikun 0:13413ea9a877 3638 * @arg @ref LL_ADC_MULTI_REG_DMA_LIMIT_1
ganlikun 0:13413ea9a877 3639 * @arg @ref LL_ADC_MULTI_REG_DMA_LIMIT_2
ganlikun 0:13413ea9a877 3640 * @arg @ref LL_ADC_MULTI_REG_DMA_LIMIT_3
ganlikun 0:13413ea9a877 3641 * @arg @ref LL_ADC_MULTI_REG_DMA_UNLMT_1
ganlikun 0:13413ea9a877 3642 * @arg @ref LL_ADC_MULTI_REG_DMA_UNLMT_2
ganlikun 0:13413ea9a877 3643 * @arg @ref LL_ADC_MULTI_REG_DMA_UNLMT_3
ganlikun 0:13413ea9a877 3644 * @retval None
ganlikun 0:13413ea9a877 3645 */
ganlikun 0:13413ea9a877 3646 __STATIC_INLINE void LL_ADC_SetMultiDMATransfer(ADC_Common_TypeDef *ADCxy_COMMON, uint32_t MultiDMATransfer)
ganlikun 0:13413ea9a877 3647 {
ganlikun 0:13413ea9a877 3648 MODIFY_REG(ADCxy_COMMON->CCR, ADC_CCR_DMA | ADC_CCR_DDS, MultiDMATransfer);
ganlikun 0:13413ea9a877 3649 }
ganlikun 0:13413ea9a877 3650
ganlikun 0:13413ea9a877 3651 /**
ganlikun 0:13413ea9a877 3652 * @brief Get ADC multimode conversion data transfer: no transfer
ganlikun 0:13413ea9a877 3653 * or transfer by DMA.
ganlikun 0:13413ea9a877 3654 * @note If ADC multimode transfer by DMA is not selected:
ganlikun 0:13413ea9a877 3655 * each ADC uses its own DMA channel, with its individual
ganlikun 0:13413ea9a877 3656 * DMA transfer settings.
ganlikun 0:13413ea9a877 3657 * If ADC multimode transfer by DMA is selected:
ganlikun 0:13413ea9a877 3658 * One DMA channel is used for both ADC (DMA of ADC master)
ganlikun 0:13413ea9a877 3659 * Specifies the DMA requests mode:
ganlikun 0:13413ea9a877 3660 * - Limited mode (One shot mode): DMA transfer requests are stopped
ganlikun 0:13413ea9a877 3661 * when number of DMA data transfers (number of
ganlikun 0:13413ea9a877 3662 * ADC conversions) is reached.
ganlikun 0:13413ea9a877 3663 * This ADC mode is intended to be used with DMA mode non-circular.
ganlikun 0:13413ea9a877 3664 * - Unlimited mode: DMA transfer requests are unlimited,
ganlikun 0:13413ea9a877 3665 * whatever number of DMA data transfers (number of
ganlikun 0:13413ea9a877 3666 * ADC conversions).
ganlikun 0:13413ea9a877 3667 * This ADC mode is intended to be used with DMA mode circular.
ganlikun 0:13413ea9a877 3668 * @note If ADC DMA requests mode is set to unlimited and DMA is set to
ganlikun 0:13413ea9a877 3669 * mode non-circular:
ganlikun 0:13413ea9a877 3670 * when DMA transfers size will be reached, DMA will stop transfers of
ganlikun 0:13413ea9a877 3671 * ADC conversions data ADC will raise an overrun error
ganlikun 0:13413ea9a877 3672 * (overrun flag and interruption if enabled).
ganlikun 0:13413ea9a877 3673 * @note How to retrieve multimode conversion data:
ganlikun 0:13413ea9a877 3674 * Whatever multimode transfer by DMA setting: using function
ganlikun 0:13413ea9a877 3675 * @ref LL_ADC_REG_ReadMultiConversionData32().
ganlikun 0:13413ea9a877 3676 * If ADC multimode transfer by DMA is selected: conversion data
ganlikun 0:13413ea9a877 3677 * is a raw data with ADC master and slave concatenated.
ganlikun 0:13413ea9a877 3678 * A macro is available to get the conversion data of
ganlikun 0:13413ea9a877 3679 * ADC master or ADC slave: see helper macro
ganlikun 0:13413ea9a877 3680 * @ref __LL_ADC_MULTI_CONV_DATA_MASTER_SLAVE().
ganlikun 0:13413ea9a877 3681 * @rmtoll CCR MDMA LL_ADC_GetMultiDMATransfer\n
ganlikun 0:13413ea9a877 3682 * CCR DDS LL_ADC_GetMultiDMATransfer
ganlikun 0:13413ea9a877 3683 * @param ADCxy_COMMON ADC common instance
ganlikun 0:13413ea9a877 3684 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
ganlikun 0:13413ea9a877 3685 * @retval Returned value can be one of the following values:
ganlikun 0:13413ea9a877 3686 * @arg @ref LL_ADC_MULTI_REG_DMA_EACH_ADC
ganlikun 0:13413ea9a877 3687 * @arg @ref LL_ADC_MULTI_REG_DMA_LIMIT_1
ganlikun 0:13413ea9a877 3688 * @arg @ref LL_ADC_MULTI_REG_DMA_LIMIT_2
ganlikun 0:13413ea9a877 3689 * @arg @ref LL_ADC_MULTI_REG_DMA_LIMIT_3
ganlikun 0:13413ea9a877 3690 * @arg @ref LL_ADC_MULTI_REG_DMA_UNLMT_1
ganlikun 0:13413ea9a877 3691 * @arg @ref LL_ADC_MULTI_REG_DMA_UNLMT_2
ganlikun 0:13413ea9a877 3692 * @arg @ref LL_ADC_MULTI_REG_DMA_UNLMT_3
ganlikun 0:13413ea9a877 3693 */
ganlikun 0:13413ea9a877 3694 __STATIC_INLINE uint32_t LL_ADC_GetMultiDMATransfer(ADC_Common_TypeDef *ADCxy_COMMON)
ganlikun 0:13413ea9a877 3695 {
ganlikun 0:13413ea9a877 3696 return (uint32_t)(READ_BIT(ADCxy_COMMON->CCR, ADC_CCR_DMA | ADC_CCR_DDS));
ganlikun 0:13413ea9a877 3697 }
ganlikun 0:13413ea9a877 3698
ganlikun 0:13413ea9a877 3699 /**
ganlikun 0:13413ea9a877 3700 * @brief Set ADC multimode delay between 2 sampling phases.
ganlikun 0:13413ea9a877 3701 * @note The sampling delay range depends on ADC resolution:
ganlikun 0:13413ea9a877 3702 * - ADC resolution 12 bits can have maximum delay of 12 cycles.
ganlikun 0:13413ea9a877 3703 * - ADC resolution 10 bits can have maximum delay of 10 cycles.
ganlikun 0:13413ea9a877 3704 * - ADC resolution 8 bits can have maximum delay of 8 cycles.
ganlikun 0:13413ea9a877 3705 * - ADC resolution 6 bits can have maximum delay of 6 cycles.
ganlikun 0:13413ea9a877 3706 * @rmtoll CCR DELAY LL_ADC_SetMultiTwoSamplingDelay
ganlikun 0:13413ea9a877 3707 * @param ADCxy_COMMON ADC common instance
ganlikun 0:13413ea9a877 3708 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
ganlikun 0:13413ea9a877 3709 * @param MultiTwoSamplingDelay This parameter can be one of the following values:
ganlikun 0:13413ea9a877 3710 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_5CYCLES
ganlikun 0:13413ea9a877 3711 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_6CYCLES
ganlikun 0:13413ea9a877 3712 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_7CYCLES
ganlikun 0:13413ea9a877 3713 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_8CYCLES
ganlikun 0:13413ea9a877 3714 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_9CYCLES
ganlikun 0:13413ea9a877 3715 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_10CYCLES
ganlikun 0:13413ea9a877 3716 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_11CYCLES
ganlikun 0:13413ea9a877 3717 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_12CYCLES
ganlikun 0:13413ea9a877 3718 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_13CYCLES
ganlikun 0:13413ea9a877 3719 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_14CYCLES
ganlikun 0:13413ea9a877 3720 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_15CYCLES
ganlikun 0:13413ea9a877 3721 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_16CYCLES
ganlikun 0:13413ea9a877 3722 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_17CYCLES
ganlikun 0:13413ea9a877 3723 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_18CYCLES
ganlikun 0:13413ea9a877 3724 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_19CYCLES
ganlikun 0:13413ea9a877 3725 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_20CYCLES
ganlikun 0:13413ea9a877 3726 * @retval None
ganlikun 0:13413ea9a877 3727 */
ganlikun 0:13413ea9a877 3728 __STATIC_INLINE void LL_ADC_SetMultiTwoSamplingDelay(ADC_Common_TypeDef *ADCxy_COMMON, uint32_t MultiTwoSamplingDelay)
ganlikun 0:13413ea9a877 3729 {
ganlikun 0:13413ea9a877 3730 MODIFY_REG(ADCxy_COMMON->CCR, ADC_CCR_DELAY, MultiTwoSamplingDelay);
ganlikun 0:13413ea9a877 3731 }
ganlikun 0:13413ea9a877 3732
ganlikun 0:13413ea9a877 3733 /**
ganlikun 0:13413ea9a877 3734 * @brief Get ADC multimode delay between 2 sampling phases.
ganlikun 0:13413ea9a877 3735 * @rmtoll CCR DELAY LL_ADC_GetMultiTwoSamplingDelay
ganlikun 0:13413ea9a877 3736 * @param ADCxy_COMMON ADC common instance
ganlikun 0:13413ea9a877 3737 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
ganlikun 0:13413ea9a877 3738 * @retval Returned value can be one of the following values:
ganlikun 0:13413ea9a877 3739 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_5CYCLES
ganlikun 0:13413ea9a877 3740 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_6CYCLES
ganlikun 0:13413ea9a877 3741 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_7CYCLES
ganlikun 0:13413ea9a877 3742 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_8CYCLES
ganlikun 0:13413ea9a877 3743 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_9CYCLES
ganlikun 0:13413ea9a877 3744 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_10CYCLES
ganlikun 0:13413ea9a877 3745 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_11CYCLES
ganlikun 0:13413ea9a877 3746 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_12CYCLES
ganlikun 0:13413ea9a877 3747 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_13CYCLES
ganlikun 0:13413ea9a877 3748 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_14CYCLES
ganlikun 0:13413ea9a877 3749 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_15CYCLES
ganlikun 0:13413ea9a877 3750 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_16CYCLES
ganlikun 0:13413ea9a877 3751 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_17CYCLES
ganlikun 0:13413ea9a877 3752 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_18CYCLES
ganlikun 0:13413ea9a877 3753 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_19CYCLES
ganlikun 0:13413ea9a877 3754 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_20CYCLES
ganlikun 0:13413ea9a877 3755 */
ganlikun 0:13413ea9a877 3756 __STATIC_INLINE uint32_t LL_ADC_GetMultiTwoSamplingDelay(ADC_Common_TypeDef *ADCxy_COMMON)
ganlikun 0:13413ea9a877 3757 {
ganlikun 0:13413ea9a877 3758 return (uint32_t)(READ_BIT(ADCxy_COMMON->CCR, ADC_CCR_DELAY));
ganlikun 0:13413ea9a877 3759 }
ganlikun 0:13413ea9a877 3760 #endif /* ADC_MULTIMODE_SUPPORT */
ganlikun 0:13413ea9a877 3761
ganlikun 0:13413ea9a877 3762 /**
ganlikun 0:13413ea9a877 3763 * @}
ganlikun 0:13413ea9a877 3764 */
ganlikun 0:13413ea9a877 3765 /** @defgroup ADC_LL_EF_Operation_ADC_Instance Operation on ADC hierarchical scope: ADC instance
ganlikun 0:13413ea9a877 3766 * @{
ganlikun 0:13413ea9a877 3767 */
ganlikun 0:13413ea9a877 3768
ganlikun 0:13413ea9a877 3769 /**
ganlikun 0:13413ea9a877 3770 * @brief Enable the selected ADC instance.
ganlikun 0:13413ea9a877 3771 * @note On this STM32 serie, after ADC enable, a delay for
ganlikun 0:13413ea9a877 3772 * ADC internal analog stabilization is required before performing a
ganlikun 0:13413ea9a877 3773 * ADC conversion start.
ganlikun 0:13413ea9a877 3774 * Refer to device datasheet, parameter tSTAB.
ganlikun 0:13413ea9a877 3775 * @rmtoll CR2 ADON LL_ADC_Enable
ganlikun 0:13413ea9a877 3776 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 3777 * @retval None
ganlikun 0:13413ea9a877 3778 */
ganlikun 0:13413ea9a877 3779 __STATIC_INLINE void LL_ADC_Enable(ADC_TypeDef *ADCx)
ganlikun 0:13413ea9a877 3780 {
ganlikun 0:13413ea9a877 3781 SET_BIT(ADCx->CR2, ADC_CR2_ADON);
ganlikun 0:13413ea9a877 3782 }
ganlikun 0:13413ea9a877 3783
ganlikun 0:13413ea9a877 3784 /**
ganlikun 0:13413ea9a877 3785 * @brief Disable the selected ADC instance.
ganlikun 0:13413ea9a877 3786 * @rmtoll CR2 ADON LL_ADC_Disable
ganlikun 0:13413ea9a877 3787 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 3788 * @retval None
ganlikun 0:13413ea9a877 3789 */
ganlikun 0:13413ea9a877 3790 __STATIC_INLINE void LL_ADC_Disable(ADC_TypeDef *ADCx)
ganlikun 0:13413ea9a877 3791 {
ganlikun 0:13413ea9a877 3792 CLEAR_BIT(ADCx->CR2, ADC_CR2_ADON);
ganlikun 0:13413ea9a877 3793 }
ganlikun 0:13413ea9a877 3794
ganlikun 0:13413ea9a877 3795 /**
ganlikun 0:13413ea9a877 3796 * @brief Get the selected ADC instance enable state.
ganlikun 0:13413ea9a877 3797 * @rmtoll CR2 ADON LL_ADC_IsEnabled
ganlikun 0:13413ea9a877 3798 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 3799 * @retval 0: ADC is disabled, 1: ADC is enabled.
ganlikun 0:13413ea9a877 3800 */
ganlikun 0:13413ea9a877 3801 __STATIC_INLINE uint32_t LL_ADC_IsEnabled(ADC_TypeDef *ADCx)
ganlikun 0:13413ea9a877 3802 {
ganlikun 0:13413ea9a877 3803 return (READ_BIT(ADCx->CR2, ADC_CR2_ADON) == (ADC_CR2_ADON));
ganlikun 0:13413ea9a877 3804 }
ganlikun 0:13413ea9a877 3805
ganlikun 0:13413ea9a877 3806 /**
ganlikun 0:13413ea9a877 3807 * @}
ganlikun 0:13413ea9a877 3808 */
ganlikun 0:13413ea9a877 3809
ganlikun 0:13413ea9a877 3810 /** @defgroup ADC_LL_EF_Operation_ADC_Group_Regular Operation on ADC hierarchical scope: group regular
ganlikun 0:13413ea9a877 3811 * @{
ganlikun 0:13413ea9a877 3812 */
ganlikun 0:13413ea9a877 3813
ganlikun 0:13413ea9a877 3814 /**
ganlikun 0:13413ea9a877 3815 * @brief Start ADC group regular conversion.
ganlikun 0:13413ea9a877 3816 * @note On this STM32 serie, this function is relevant only for
ganlikun 0:13413ea9a877 3817 * internal trigger (SW start), not for external trigger:
ganlikun 0:13413ea9a877 3818 * - If ADC trigger has been set to software start, ADC conversion
ganlikun 0:13413ea9a877 3819 * starts immediately.
ganlikun 0:13413ea9a877 3820 * - If ADC trigger has been set to external trigger, ADC conversion
ganlikun 0:13413ea9a877 3821 * start must be performed using function
ganlikun 0:13413ea9a877 3822 * @ref LL_ADC_REG_StartConversionExtTrig().
ganlikun 0:13413ea9a877 3823 * (if external trigger edge would have been set during ADC other
ganlikun 0:13413ea9a877 3824 * settings, ADC conversion would start at trigger event
ganlikun 0:13413ea9a877 3825 * as soon as ADC is enabled).
ganlikun 0:13413ea9a877 3826 * @rmtoll CR2 SWSTART LL_ADC_REG_StartConversionSWStart
ganlikun 0:13413ea9a877 3827 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 3828 * @retval None
ganlikun 0:13413ea9a877 3829 */
ganlikun 0:13413ea9a877 3830 __STATIC_INLINE void LL_ADC_REG_StartConversionSWStart(ADC_TypeDef *ADCx)
ganlikun 0:13413ea9a877 3831 {
ganlikun 0:13413ea9a877 3832 SET_BIT(ADCx->CR2, ADC_CR2_SWSTART);
ganlikun 0:13413ea9a877 3833 }
ganlikun 0:13413ea9a877 3834
ganlikun 0:13413ea9a877 3835 /**
ganlikun 0:13413ea9a877 3836 * @brief Start ADC group regular conversion from external trigger.
ganlikun 0:13413ea9a877 3837 * @note ADC conversion will start at next trigger event (on the selected
ganlikun 0:13413ea9a877 3838 * trigger edge) following the ADC start conversion command.
ganlikun 0:13413ea9a877 3839 * @note On this STM32 serie, this function is relevant for
ganlikun 0:13413ea9a877 3840 * ADC conversion start from external trigger.
ganlikun 0:13413ea9a877 3841 * If internal trigger (SW start) is needed, perform ADC conversion
ganlikun 0:13413ea9a877 3842 * start using function @ref LL_ADC_REG_StartConversionSWStart().
ganlikun 0:13413ea9a877 3843 * @rmtoll CR2 EXTEN LL_ADC_REG_StartConversionExtTrig
ganlikun 0:13413ea9a877 3844 * @param ExternalTriggerEdge This parameter can be one of the following values:
ganlikun 0:13413ea9a877 3845 * @arg @ref LL_ADC_REG_TRIG_EXT_RISING
ganlikun 0:13413ea9a877 3846 * @arg @ref LL_ADC_REG_TRIG_EXT_FALLING
ganlikun 0:13413ea9a877 3847 * @arg @ref LL_ADC_REG_TRIG_EXT_RISINGFALLING
ganlikun 0:13413ea9a877 3848 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 3849 * @retval None
ganlikun 0:13413ea9a877 3850 */
ganlikun 0:13413ea9a877 3851 __STATIC_INLINE void LL_ADC_REG_StartConversionExtTrig(ADC_TypeDef *ADCx, uint32_t ExternalTriggerEdge)
ganlikun 0:13413ea9a877 3852 {
ganlikun 0:13413ea9a877 3853 SET_BIT(ADCx->CR2, ExternalTriggerEdge);
ganlikun 0:13413ea9a877 3854 }
ganlikun 0:13413ea9a877 3855
ganlikun 0:13413ea9a877 3856 /**
ganlikun 0:13413ea9a877 3857 * @brief Stop ADC group regular conversion from external trigger.
ganlikun 0:13413ea9a877 3858 * @note No more ADC conversion will start at next trigger event
ganlikun 0:13413ea9a877 3859 * following the ADC stop conversion command.
ganlikun 0:13413ea9a877 3860 * If a conversion is on-going, it will be completed.
ganlikun 0:13413ea9a877 3861 * @note On this STM32 serie, there is no specific command
ganlikun 0:13413ea9a877 3862 * to stop a conversion on-going or to stop ADC converting
ganlikun 0:13413ea9a877 3863 * in continuous mode. These actions can be performed
ganlikun 0:13413ea9a877 3864 * using function @ref LL_ADC_Disable().
ganlikun 0:13413ea9a877 3865 * @rmtoll CR2 EXTEN LL_ADC_REG_StopConversionExtTrig
ganlikun 0:13413ea9a877 3866 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 3867 * @retval None
ganlikun 0:13413ea9a877 3868 */
ganlikun 0:13413ea9a877 3869 __STATIC_INLINE void LL_ADC_REG_StopConversionExtTrig(ADC_TypeDef *ADCx)
ganlikun 0:13413ea9a877 3870 {
ganlikun 0:13413ea9a877 3871 CLEAR_BIT(ADCx->CR2, ADC_CR2_EXTEN);
ganlikun 0:13413ea9a877 3872 }
ganlikun 0:13413ea9a877 3873
ganlikun 0:13413ea9a877 3874 /**
ganlikun 0:13413ea9a877 3875 * @brief Get ADC group regular conversion data, range fit for
ganlikun 0:13413ea9a877 3876 * all ADC configurations: all ADC resolutions and
ganlikun 0:13413ea9a877 3877 * all oversampling increased data width (for devices
ganlikun 0:13413ea9a877 3878 * with feature oversampling).
ganlikun 0:13413ea9a877 3879 * @rmtoll DR RDATA LL_ADC_REG_ReadConversionData32
ganlikun 0:13413ea9a877 3880 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 3881 * @retval Value between Min_Data=0x00000000 and Max_Data=0xFFFFFFFF
ganlikun 0:13413ea9a877 3882 */
ganlikun 0:13413ea9a877 3883 __STATIC_INLINE uint32_t LL_ADC_REG_ReadConversionData32(ADC_TypeDef *ADCx)
ganlikun 0:13413ea9a877 3884 {
ganlikun 0:13413ea9a877 3885 return (uint16_t)(READ_BIT(ADCx->DR, ADC_DR_DATA));
ganlikun 0:13413ea9a877 3886 }
ganlikun 0:13413ea9a877 3887
ganlikun 0:13413ea9a877 3888 /**
ganlikun 0:13413ea9a877 3889 * @brief Get ADC group regular conversion data, range fit for
ganlikun 0:13413ea9a877 3890 * ADC resolution 12 bits.
ganlikun 0:13413ea9a877 3891 * @note For devices with feature oversampling: Oversampling
ganlikun 0:13413ea9a877 3892 * can increase data width, function for extended range
ganlikun 0:13413ea9a877 3893 * may be needed: @ref LL_ADC_REG_ReadConversionData32.
ganlikun 0:13413ea9a877 3894 * @rmtoll DR RDATA LL_ADC_REG_ReadConversionData12
ganlikun 0:13413ea9a877 3895 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 3896 * @retval Value between Min_Data=0x000 and Max_Data=0xFFF
ganlikun 0:13413ea9a877 3897 */
ganlikun 0:13413ea9a877 3898 __STATIC_INLINE uint16_t LL_ADC_REG_ReadConversionData12(ADC_TypeDef *ADCx)
ganlikun 0:13413ea9a877 3899 {
ganlikun 0:13413ea9a877 3900 return (uint16_t)(READ_BIT(ADCx->DR, ADC_DR_DATA));
ganlikun 0:13413ea9a877 3901 }
ganlikun 0:13413ea9a877 3902
ganlikun 0:13413ea9a877 3903 /**
ganlikun 0:13413ea9a877 3904 * @brief Get ADC group regular conversion data, range fit for
ganlikun 0:13413ea9a877 3905 * ADC resolution 10 bits.
ganlikun 0:13413ea9a877 3906 * @note For devices with feature oversampling: Oversampling
ganlikun 0:13413ea9a877 3907 * can increase data width, function for extended range
ganlikun 0:13413ea9a877 3908 * may be needed: @ref LL_ADC_REG_ReadConversionData32.
ganlikun 0:13413ea9a877 3909 * @rmtoll DR RDATA LL_ADC_REG_ReadConversionData10
ganlikun 0:13413ea9a877 3910 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 3911 * @retval Value between Min_Data=0x000 and Max_Data=0x3FF
ganlikun 0:13413ea9a877 3912 */
ganlikun 0:13413ea9a877 3913 __STATIC_INLINE uint16_t LL_ADC_REG_ReadConversionData10(ADC_TypeDef *ADCx)
ganlikun 0:13413ea9a877 3914 {
ganlikun 0:13413ea9a877 3915 return (uint16_t)(READ_BIT(ADCx->DR, ADC_DR_DATA));
ganlikun 0:13413ea9a877 3916 }
ganlikun 0:13413ea9a877 3917
ganlikun 0:13413ea9a877 3918 /**
ganlikun 0:13413ea9a877 3919 * @brief Get ADC group regular conversion data, range fit for
ganlikun 0:13413ea9a877 3920 * ADC resolution 8 bits.
ganlikun 0:13413ea9a877 3921 * @note For devices with feature oversampling: Oversampling
ganlikun 0:13413ea9a877 3922 * can increase data width, function for extended range
ganlikun 0:13413ea9a877 3923 * may be needed: @ref LL_ADC_REG_ReadConversionData32.
ganlikun 0:13413ea9a877 3924 * @rmtoll DR RDATA LL_ADC_REG_ReadConversionData8
ganlikun 0:13413ea9a877 3925 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 3926 * @retval Value between Min_Data=0x00 and Max_Data=0xFF
ganlikun 0:13413ea9a877 3927 */
ganlikun 0:13413ea9a877 3928 __STATIC_INLINE uint8_t LL_ADC_REG_ReadConversionData8(ADC_TypeDef *ADCx)
ganlikun 0:13413ea9a877 3929 {
ganlikun 0:13413ea9a877 3930 return (uint16_t)(READ_BIT(ADCx->DR, ADC_DR_DATA));
ganlikun 0:13413ea9a877 3931 }
ganlikun 0:13413ea9a877 3932
ganlikun 0:13413ea9a877 3933 /**
ganlikun 0:13413ea9a877 3934 * @brief Get ADC group regular conversion data, range fit for
ganlikun 0:13413ea9a877 3935 * ADC resolution 6 bits.
ganlikun 0:13413ea9a877 3936 * @note For devices with feature oversampling: Oversampling
ganlikun 0:13413ea9a877 3937 * can increase data width, function for extended range
ganlikun 0:13413ea9a877 3938 * may be needed: @ref LL_ADC_REG_ReadConversionData32.
ganlikun 0:13413ea9a877 3939 * @rmtoll DR RDATA LL_ADC_REG_ReadConversionData6
ganlikun 0:13413ea9a877 3940 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 3941 * @retval Value between Min_Data=0x00 and Max_Data=0x3F
ganlikun 0:13413ea9a877 3942 */
ganlikun 0:13413ea9a877 3943 __STATIC_INLINE uint8_t LL_ADC_REG_ReadConversionData6(ADC_TypeDef *ADCx)
ganlikun 0:13413ea9a877 3944 {
ganlikun 0:13413ea9a877 3945 return (uint16_t)(READ_BIT(ADCx->DR, ADC_DR_DATA));
ganlikun 0:13413ea9a877 3946 }
ganlikun 0:13413ea9a877 3947
ganlikun 0:13413ea9a877 3948 #if defined(ADC_MULTIMODE_SUPPORT)
ganlikun 0:13413ea9a877 3949 /**
ganlikun 0:13413ea9a877 3950 * @brief Get ADC multimode conversion data of ADC master, ADC slave
ganlikun 0:13413ea9a877 3951 * or raw data with ADC master and slave concatenated.
ganlikun 0:13413ea9a877 3952 * @note If raw data with ADC master and slave concatenated is retrieved,
ganlikun 0:13413ea9a877 3953 * a macro is available to get the conversion data of
ganlikun 0:13413ea9a877 3954 * ADC master or ADC slave: see helper macro
ganlikun 0:13413ea9a877 3955 * @ref __LL_ADC_MULTI_CONV_DATA_MASTER_SLAVE().
ganlikun 0:13413ea9a877 3956 * (however this macro is mainly intended for multimode
ganlikun 0:13413ea9a877 3957 * transfer by DMA, because this function can do the same
ganlikun 0:13413ea9a877 3958 * by getting multimode conversion data of ADC master or ADC slave
ganlikun 0:13413ea9a877 3959 * separately).
ganlikun 0:13413ea9a877 3960 * @rmtoll CDR DATA1 LL_ADC_REG_ReadMultiConversionData32\n
ganlikun 0:13413ea9a877 3961 * CDR DATA2 LL_ADC_REG_ReadMultiConversionData32
ganlikun 0:13413ea9a877 3962 * @param ADCxy_COMMON ADC common instance
ganlikun 0:13413ea9a877 3963 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
ganlikun 0:13413ea9a877 3964 * @param ConversionData This parameter can be one of the following values:
ganlikun 0:13413ea9a877 3965 * @arg @ref LL_ADC_MULTI_MASTER
ganlikun 0:13413ea9a877 3966 * @arg @ref LL_ADC_MULTI_SLAVE
ganlikun 0:13413ea9a877 3967 * @arg @ref LL_ADC_MULTI_MASTER_SLAVE
ganlikun 0:13413ea9a877 3968 * @retval Value between Min_Data=0x00000000 and Max_Data=0xFFFFFFFF
ganlikun 0:13413ea9a877 3969 */
ganlikun 0:13413ea9a877 3970 __STATIC_INLINE uint32_t LL_ADC_REG_ReadMultiConversionData32(ADC_Common_TypeDef *ADCxy_COMMON, uint32_t ConversionData)
ganlikun 0:13413ea9a877 3971 {
ganlikun 0:13413ea9a877 3972 return (uint32_t)(READ_BIT(ADCxy_COMMON->CDR,
ganlikun 0:13413ea9a877 3973 ADC_DR_ADC2DATA)
ganlikun 0:13413ea9a877 3974 >> POSITION_VAL(ConversionData)
ganlikun 0:13413ea9a877 3975 );
ganlikun 0:13413ea9a877 3976 }
ganlikun 0:13413ea9a877 3977 #endif /* ADC_MULTIMODE_SUPPORT */
ganlikun 0:13413ea9a877 3978
ganlikun 0:13413ea9a877 3979 /**
ganlikun 0:13413ea9a877 3980 * @}
ganlikun 0:13413ea9a877 3981 */
ganlikun 0:13413ea9a877 3982
ganlikun 0:13413ea9a877 3983 /** @defgroup ADC_LL_EF_Operation_ADC_Group_Injected Operation on ADC hierarchical scope: group injected
ganlikun 0:13413ea9a877 3984 * @{
ganlikun 0:13413ea9a877 3985 */
ganlikun 0:13413ea9a877 3986
ganlikun 0:13413ea9a877 3987 /**
ganlikun 0:13413ea9a877 3988 * @brief Start ADC group injected conversion.
ganlikun 0:13413ea9a877 3989 * @note On this STM32 serie, this function is relevant only for
ganlikun 0:13413ea9a877 3990 * internal trigger (SW start), not for external trigger:
ganlikun 0:13413ea9a877 3991 * - If ADC trigger has been set to software start, ADC conversion
ganlikun 0:13413ea9a877 3992 * starts immediately.
ganlikun 0:13413ea9a877 3993 * - If ADC trigger has been set to external trigger, ADC conversion
ganlikun 0:13413ea9a877 3994 * start must be performed using function
ganlikun 0:13413ea9a877 3995 * @ref LL_ADC_INJ_StartConversionExtTrig().
ganlikun 0:13413ea9a877 3996 * (if external trigger edge would have been set during ADC other
ganlikun 0:13413ea9a877 3997 * settings, ADC conversion would start at trigger event
ganlikun 0:13413ea9a877 3998 * as soon as ADC is enabled).
ganlikun 0:13413ea9a877 3999 * @rmtoll CR2 JSWSTART LL_ADC_INJ_StartConversionSWStart
ganlikun 0:13413ea9a877 4000 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 4001 * @retval None
ganlikun 0:13413ea9a877 4002 */
ganlikun 0:13413ea9a877 4003 __STATIC_INLINE void LL_ADC_INJ_StartConversionSWStart(ADC_TypeDef *ADCx)
ganlikun 0:13413ea9a877 4004 {
ganlikun 0:13413ea9a877 4005 SET_BIT(ADCx->CR2, ADC_CR2_JSWSTART);
ganlikun 0:13413ea9a877 4006 }
ganlikun 0:13413ea9a877 4007
ganlikun 0:13413ea9a877 4008 /**
ganlikun 0:13413ea9a877 4009 * @brief Start ADC group injected conversion from external trigger.
ganlikun 0:13413ea9a877 4010 * @note ADC conversion will start at next trigger event (on the selected
ganlikun 0:13413ea9a877 4011 * trigger edge) following the ADC start conversion command.
ganlikun 0:13413ea9a877 4012 * @note On this STM32 serie, this function is relevant for
ganlikun 0:13413ea9a877 4013 * ADC conversion start from external trigger.
ganlikun 0:13413ea9a877 4014 * If internal trigger (SW start) is needed, perform ADC conversion
ganlikun 0:13413ea9a877 4015 * start using function @ref LL_ADC_INJ_StartConversionSWStart().
ganlikun 0:13413ea9a877 4016 * @rmtoll CR2 JEXTEN LL_ADC_INJ_StartConversionExtTrig
ganlikun 0:13413ea9a877 4017 * @param ExternalTriggerEdge This parameter can be one of the following values:
ganlikun 0:13413ea9a877 4018 * @arg @ref LL_ADC_INJ_TRIG_EXT_RISING
ganlikun 0:13413ea9a877 4019 * @arg @ref LL_ADC_INJ_TRIG_EXT_FALLING
ganlikun 0:13413ea9a877 4020 * @arg @ref LL_ADC_INJ_TRIG_EXT_RISINGFALLING
ganlikun 0:13413ea9a877 4021 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 4022 * @retval None
ganlikun 0:13413ea9a877 4023 */
ganlikun 0:13413ea9a877 4024 __STATIC_INLINE void LL_ADC_INJ_StartConversionExtTrig(ADC_TypeDef *ADCx, uint32_t ExternalTriggerEdge)
ganlikun 0:13413ea9a877 4025 {
ganlikun 0:13413ea9a877 4026 SET_BIT(ADCx->CR2, ExternalTriggerEdge);
ganlikun 0:13413ea9a877 4027 }
ganlikun 0:13413ea9a877 4028
ganlikun 0:13413ea9a877 4029 /**
ganlikun 0:13413ea9a877 4030 * @brief Stop ADC group injected conversion from external trigger.
ganlikun 0:13413ea9a877 4031 * @note No more ADC conversion will start at next trigger event
ganlikun 0:13413ea9a877 4032 * following the ADC stop conversion command.
ganlikun 0:13413ea9a877 4033 * If a conversion is on-going, it will be completed.
ganlikun 0:13413ea9a877 4034 * @note On this STM32 serie, there is no specific command
ganlikun 0:13413ea9a877 4035 * to stop a conversion on-going or to stop ADC converting
ganlikun 0:13413ea9a877 4036 * in continuous mode. These actions can be performed
ganlikun 0:13413ea9a877 4037 * using function @ref LL_ADC_Disable().
ganlikun 0:13413ea9a877 4038 * @rmtoll CR2 JEXTEN LL_ADC_INJ_StopConversionExtTrig
ganlikun 0:13413ea9a877 4039 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 4040 * @retval None
ganlikun 0:13413ea9a877 4041 */
ganlikun 0:13413ea9a877 4042 __STATIC_INLINE void LL_ADC_INJ_StopConversionExtTrig(ADC_TypeDef *ADCx)
ganlikun 0:13413ea9a877 4043 {
ganlikun 0:13413ea9a877 4044 CLEAR_BIT(ADCx->CR2, ADC_CR2_JEXTEN);
ganlikun 0:13413ea9a877 4045 }
ganlikun 0:13413ea9a877 4046
ganlikun 0:13413ea9a877 4047 /**
ganlikun 0:13413ea9a877 4048 * @brief Get ADC group regular conversion data, range fit for
ganlikun 0:13413ea9a877 4049 * all ADC configurations: all ADC resolutions and
ganlikun 0:13413ea9a877 4050 * all oversampling increased data width (for devices
ganlikun 0:13413ea9a877 4051 * with feature oversampling).
ganlikun 0:13413ea9a877 4052 * @rmtoll JDR1 JDATA LL_ADC_INJ_ReadConversionData32\n
ganlikun 0:13413ea9a877 4053 * JDR2 JDATA LL_ADC_INJ_ReadConversionData32\n
ganlikun 0:13413ea9a877 4054 * JDR3 JDATA LL_ADC_INJ_ReadConversionData32\n
ganlikun 0:13413ea9a877 4055 * JDR4 JDATA LL_ADC_INJ_ReadConversionData32
ganlikun 0:13413ea9a877 4056 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 4057 * @param Rank This parameter can be one of the following values:
ganlikun 0:13413ea9a877 4058 * @arg @ref LL_ADC_INJ_RANK_1
ganlikun 0:13413ea9a877 4059 * @arg @ref LL_ADC_INJ_RANK_2
ganlikun 0:13413ea9a877 4060 * @arg @ref LL_ADC_INJ_RANK_3
ganlikun 0:13413ea9a877 4061 * @arg @ref LL_ADC_INJ_RANK_4
ganlikun 0:13413ea9a877 4062 * @retval Value between Min_Data=0x00000000 and Max_Data=0xFFFFFFFF
ganlikun 0:13413ea9a877 4063 */
ganlikun 0:13413ea9a877 4064 __STATIC_INLINE uint32_t LL_ADC_INJ_ReadConversionData32(ADC_TypeDef *ADCx, uint32_t Rank)
ganlikun 0:13413ea9a877 4065 {
ganlikun 0:13413ea9a877 4066 register uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->JDR1, __ADC_MASK_SHIFT(Rank, ADC_INJ_JDRX_REGOFFSET_MASK));
ganlikun 0:13413ea9a877 4067
ganlikun 0:13413ea9a877 4068 return (uint32_t)(READ_BIT(*preg,
ganlikun 0:13413ea9a877 4069 ADC_JDR1_JDATA)
ganlikun 0:13413ea9a877 4070 );
ganlikun 0:13413ea9a877 4071 }
ganlikun 0:13413ea9a877 4072
ganlikun 0:13413ea9a877 4073 /**
ganlikun 0:13413ea9a877 4074 * @brief Get ADC group injected conversion data, range fit for
ganlikun 0:13413ea9a877 4075 * ADC resolution 12 bits.
ganlikun 0:13413ea9a877 4076 * @note For devices with feature oversampling: Oversampling
ganlikun 0:13413ea9a877 4077 * can increase data width, function for extended range
ganlikun 0:13413ea9a877 4078 * may be needed: @ref LL_ADC_INJ_ReadConversionData32.
ganlikun 0:13413ea9a877 4079 * @rmtoll JDR1 JDATA LL_ADC_INJ_ReadConversionData12\n
ganlikun 0:13413ea9a877 4080 * JDR2 JDATA LL_ADC_INJ_ReadConversionData12\n
ganlikun 0:13413ea9a877 4081 * JDR3 JDATA LL_ADC_INJ_ReadConversionData12\n
ganlikun 0:13413ea9a877 4082 * JDR4 JDATA LL_ADC_INJ_ReadConversionData12
ganlikun 0:13413ea9a877 4083 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 4084 * @param Rank This parameter can be one of the following values:
ganlikun 0:13413ea9a877 4085 * @arg @ref LL_ADC_INJ_RANK_1
ganlikun 0:13413ea9a877 4086 * @arg @ref LL_ADC_INJ_RANK_2
ganlikun 0:13413ea9a877 4087 * @arg @ref LL_ADC_INJ_RANK_3
ganlikun 0:13413ea9a877 4088 * @arg @ref LL_ADC_INJ_RANK_4
ganlikun 0:13413ea9a877 4089 * @retval Value between Min_Data=0x000 and Max_Data=0xFFF
ganlikun 0:13413ea9a877 4090 */
ganlikun 0:13413ea9a877 4091 __STATIC_INLINE uint16_t LL_ADC_INJ_ReadConversionData12(ADC_TypeDef *ADCx, uint32_t Rank)
ganlikun 0:13413ea9a877 4092 {
ganlikun 0:13413ea9a877 4093 register uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->JDR1, __ADC_MASK_SHIFT(Rank, ADC_INJ_JDRX_REGOFFSET_MASK));
ganlikun 0:13413ea9a877 4094
ganlikun 0:13413ea9a877 4095 return (uint16_t)(READ_BIT(*preg,
ganlikun 0:13413ea9a877 4096 ADC_JDR1_JDATA)
ganlikun 0:13413ea9a877 4097 );
ganlikun 0:13413ea9a877 4098 }
ganlikun 0:13413ea9a877 4099
ganlikun 0:13413ea9a877 4100 /**
ganlikun 0:13413ea9a877 4101 * @brief Get ADC group injected conversion data, range fit for
ganlikun 0:13413ea9a877 4102 * ADC resolution 10 bits.
ganlikun 0:13413ea9a877 4103 * @note For devices with feature oversampling: Oversampling
ganlikun 0:13413ea9a877 4104 * can increase data width, function for extended range
ganlikun 0:13413ea9a877 4105 * may be needed: @ref LL_ADC_INJ_ReadConversionData32.
ganlikun 0:13413ea9a877 4106 * @rmtoll JDR1 JDATA LL_ADC_INJ_ReadConversionData10\n
ganlikun 0:13413ea9a877 4107 * JDR2 JDATA LL_ADC_INJ_ReadConversionData10\n
ganlikun 0:13413ea9a877 4108 * JDR3 JDATA LL_ADC_INJ_ReadConversionData10\n
ganlikun 0:13413ea9a877 4109 * JDR4 JDATA LL_ADC_INJ_ReadConversionData10
ganlikun 0:13413ea9a877 4110 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 4111 * @param Rank This parameter can be one of the following values:
ganlikun 0:13413ea9a877 4112 * @arg @ref LL_ADC_INJ_RANK_1
ganlikun 0:13413ea9a877 4113 * @arg @ref LL_ADC_INJ_RANK_2
ganlikun 0:13413ea9a877 4114 * @arg @ref LL_ADC_INJ_RANK_3
ganlikun 0:13413ea9a877 4115 * @arg @ref LL_ADC_INJ_RANK_4
ganlikun 0:13413ea9a877 4116 * @retval Value between Min_Data=0x000 and Max_Data=0x3FF
ganlikun 0:13413ea9a877 4117 */
ganlikun 0:13413ea9a877 4118 __STATIC_INLINE uint16_t LL_ADC_INJ_ReadConversionData10(ADC_TypeDef *ADCx, uint32_t Rank)
ganlikun 0:13413ea9a877 4119 {
ganlikun 0:13413ea9a877 4120 register uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->JDR1, __ADC_MASK_SHIFT(Rank, ADC_INJ_JDRX_REGOFFSET_MASK));
ganlikun 0:13413ea9a877 4121
ganlikun 0:13413ea9a877 4122 return (uint16_t)(READ_BIT(*preg,
ganlikun 0:13413ea9a877 4123 ADC_JDR1_JDATA)
ganlikun 0:13413ea9a877 4124 );
ganlikun 0:13413ea9a877 4125 }
ganlikun 0:13413ea9a877 4126
ganlikun 0:13413ea9a877 4127 /**
ganlikun 0:13413ea9a877 4128 * @brief Get ADC group injected conversion data, range fit for
ganlikun 0:13413ea9a877 4129 * ADC resolution 8 bits.
ganlikun 0:13413ea9a877 4130 * @note For devices with feature oversampling: Oversampling
ganlikun 0:13413ea9a877 4131 * can increase data width, function for extended range
ganlikun 0:13413ea9a877 4132 * may be needed: @ref LL_ADC_INJ_ReadConversionData32.
ganlikun 0:13413ea9a877 4133 * @rmtoll JDR1 JDATA LL_ADC_INJ_ReadConversionData8\n
ganlikun 0:13413ea9a877 4134 * JDR2 JDATA LL_ADC_INJ_ReadConversionData8\n
ganlikun 0:13413ea9a877 4135 * JDR3 JDATA LL_ADC_INJ_ReadConversionData8\n
ganlikun 0:13413ea9a877 4136 * JDR4 JDATA LL_ADC_INJ_ReadConversionData8
ganlikun 0:13413ea9a877 4137 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 4138 * @param Rank This parameter can be one of the following values:
ganlikun 0:13413ea9a877 4139 * @arg @ref LL_ADC_INJ_RANK_1
ganlikun 0:13413ea9a877 4140 * @arg @ref LL_ADC_INJ_RANK_2
ganlikun 0:13413ea9a877 4141 * @arg @ref LL_ADC_INJ_RANK_3
ganlikun 0:13413ea9a877 4142 * @arg @ref LL_ADC_INJ_RANK_4
ganlikun 0:13413ea9a877 4143 * @retval Value between Min_Data=0x00 and Max_Data=0xFF
ganlikun 0:13413ea9a877 4144 */
ganlikun 0:13413ea9a877 4145 __STATIC_INLINE uint8_t LL_ADC_INJ_ReadConversionData8(ADC_TypeDef *ADCx, uint32_t Rank)
ganlikun 0:13413ea9a877 4146 {
ganlikun 0:13413ea9a877 4147 register uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->JDR1, __ADC_MASK_SHIFT(Rank, ADC_INJ_JDRX_REGOFFSET_MASK));
ganlikun 0:13413ea9a877 4148
ganlikun 0:13413ea9a877 4149 return (uint8_t)(READ_BIT(*preg,
ganlikun 0:13413ea9a877 4150 ADC_JDR1_JDATA)
ganlikun 0:13413ea9a877 4151 );
ganlikun 0:13413ea9a877 4152 }
ganlikun 0:13413ea9a877 4153
ganlikun 0:13413ea9a877 4154 /**
ganlikun 0:13413ea9a877 4155 * @brief Get ADC group injected conversion data, range fit for
ganlikun 0:13413ea9a877 4156 * ADC resolution 6 bits.
ganlikun 0:13413ea9a877 4157 * @note For devices with feature oversampling: Oversampling
ganlikun 0:13413ea9a877 4158 * can increase data width, function for extended range
ganlikun 0:13413ea9a877 4159 * may be needed: @ref LL_ADC_INJ_ReadConversionData32.
ganlikun 0:13413ea9a877 4160 * @rmtoll JDR1 JDATA LL_ADC_INJ_ReadConversionData6\n
ganlikun 0:13413ea9a877 4161 * JDR2 JDATA LL_ADC_INJ_ReadConversionData6\n
ganlikun 0:13413ea9a877 4162 * JDR3 JDATA LL_ADC_INJ_ReadConversionData6\n
ganlikun 0:13413ea9a877 4163 * JDR4 JDATA LL_ADC_INJ_ReadConversionData6
ganlikun 0:13413ea9a877 4164 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 4165 * @param Rank This parameter can be one of the following values:
ganlikun 0:13413ea9a877 4166 * @arg @ref LL_ADC_INJ_RANK_1
ganlikun 0:13413ea9a877 4167 * @arg @ref LL_ADC_INJ_RANK_2
ganlikun 0:13413ea9a877 4168 * @arg @ref LL_ADC_INJ_RANK_3
ganlikun 0:13413ea9a877 4169 * @arg @ref LL_ADC_INJ_RANK_4
ganlikun 0:13413ea9a877 4170 * @retval Value between Min_Data=0x00 and Max_Data=0x3F
ganlikun 0:13413ea9a877 4171 */
ganlikun 0:13413ea9a877 4172 __STATIC_INLINE uint8_t LL_ADC_INJ_ReadConversionData6(ADC_TypeDef *ADCx, uint32_t Rank)
ganlikun 0:13413ea9a877 4173 {
ganlikun 0:13413ea9a877 4174 register uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->JDR1, __ADC_MASK_SHIFT(Rank, ADC_INJ_JDRX_REGOFFSET_MASK));
ganlikun 0:13413ea9a877 4175
ganlikun 0:13413ea9a877 4176 return (uint8_t)(READ_BIT(*preg,
ganlikun 0:13413ea9a877 4177 ADC_JDR1_JDATA)
ganlikun 0:13413ea9a877 4178 );
ganlikun 0:13413ea9a877 4179 }
ganlikun 0:13413ea9a877 4180
ganlikun 0:13413ea9a877 4181 /**
ganlikun 0:13413ea9a877 4182 * @}
ganlikun 0:13413ea9a877 4183 */
ganlikun 0:13413ea9a877 4184
ganlikun 0:13413ea9a877 4185 /** @defgroup ADC_LL_EF_FLAG_Management ADC flag management
ganlikun 0:13413ea9a877 4186 * @{
ganlikun 0:13413ea9a877 4187 */
ganlikun 0:13413ea9a877 4188
ganlikun 0:13413ea9a877 4189 /**
ganlikun 0:13413ea9a877 4190 * @brief Get flag ADC group regular end of unitary conversion
ganlikun 0:13413ea9a877 4191 * or end of sequence conversions, depending on
ganlikun 0:13413ea9a877 4192 * ADC configuration.
ganlikun 0:13413ea9a877 4193 * @note To configure flag of end of conversion,
ganlikun 0:13413ea9a877 4194 * use function @ref LL_ADC_REG_SetFlagEndOfConversion().
ganlikun 0:13413ea9a877 4195 * @rmtoll SR EOC LL_ADC_IsActiveFlag_EOCS
ganlikun 0:13413ea9a877 4196 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 4197 * @retval State of bit (1 or 0).
ganlikun 0:13413ea9a877 4198 */
ganlikun 0:13413ea9a877 4199 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_EOCS(ADC_TypeDef *ADCx)
ganlikun 0:13413ea9a877 4200 {
ganlikun 0:13413ea9a877 4201 return (READ_BIT(ADCx->SR, LL_ADC_FLAG_EOCS) == (LL_ADC_FLAG_EOCS));
ganlikun 0:13413ea9a877 4202 }
ganlikun 0:13413ea9a877 4203
ganlikun 0:13413ea9a877 4204 /**
ganlikun 0:13413ea9a877 4205 * @brief Get flag ADC group regular overrun.
ganlikun 0:13413ea9a877 4206 * @rmtoll SR OVR LL_ADC_IsActiveFlag_OVR
ganlikun 0:13413ea9a877 4207 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 4208 * @retval State of bit (1 or 0).
ganlikun 0:13413ea9a877 4209 */
ganlikun 0:13413ea9a877 4210 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_OVR(ADC_TypeDef *ADCx)
ganlikun 0:13413ea9a877 4211 {
ganlikun 0:13413ea9a877 4212 return (READ_BIT(ADCx->SR, LL_ADC_FLAG_OVR) == (LL_ADC_FLAG_OVR));
ganlikun 0:13413ea9a877 4213 }
ganlikun 0:13413ea9a877 4214
ganlikun 0:13413ea9a877 4215
ganlikun 0:13413ea9a877 4216 /**
ganlikun 0:13413ea9a877 4217 * @brief Get flag ADC group injected end of sequence conversions.
ganlikun 0:13413ea9a877 4218 * @rmtoll SR JEOC LL_ADC_IsActiveFlag_JEOS
ganlikun 0:13413ea9a877 4219 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 4220 * @retval State of bit (1 or 0).
ganlikun 0:13413ea9a877 4221 */
ganlikun 0:13413ea9a877 4222 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_JEOS(ADC_TypeDef *ADCx)
ganlikun 0:13413ea9a877 4223 {
ganlikun 0:13413ea9a877 4224 /* Note: on this STM32 serie, there is no flag ADC group injected */
ganlikun 0:13413ea9a877 4225 /* end of unitary conversion. */
ganlikun 0:13413ea9a877 4226 /* Flag noted as "JEOC" is corresponding to flag "JEOS" */
ganlikun 0:13413ea9a877 4227 /* in other STM32 families). */
ganlikun 0:13413ea9a877 4228 return (READ_BIT(ADCx->SR, LL_ADC_FLAG_JEOS) == (LL_ADC_FLAG_JEOS));
ganlikun 0:13413ea9a877 4229 }
ganlikun 0:13413ea9a877 4230
ganlikun 0:13413ea9a877 4231 /**
ganlikun 0:13413ea9a877 4232 * @brief Get flag ADC analog watchdog 1 flag
ganlikun 0:13413ea9a877 4233 * @rmtoll SR AWD LL_ADC_IsActiveFlag_AWD1
ganlikun 0:13413ea9a877 4234 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 4235 * @retval State of bit (1 or 0).
ganlikun 0:13413ea9a877 4236 */
ganlikun 0:13413ea9a877 4237 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_AWD1(ADC_TypeDef *ADCx)
ganlikun 0:13413ea9a877 4238 {
ganlikun 0:13413ea9a877 4239 return (READ_BIT(ADCx->SR, LL_ADC_FLAG_AWD1) == (LL_ADC_FLAG_AWD1));
ganlikun 0:13413ea9a877 4240 }
ganlikun 0:13413ea9a877 4241
ganlikun 0:13413ea9a877 4242 /**
ganlikun 0:13413ea9a877 4243 * @brief Clear flag ADC group regular end of unitary conversion
ganlikun 0:13413ea9a877 4244 * or end of sequence conversions, depending on
ganlikun 0:13413ea9a877 4245 * ADC configuration.
ganlikun 0:13413ea9a877 4246 * @note To configure flag of end of conversion,
ganlikun 0:13413ea9a877 4247 * use function @ref LL_ADC_REG_SetFlagEndOfConversion().
ganlikun 0:13413ea9a877 4248 * @rmtoll SR EOC LL_ADC_ClearFlag_EOCS
ganlikun 0:13413ea9a877 4249 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 4250 * @retval None
ganlikun 0:13413ea9a877 4251 */
ganlikun 0:13413ea9a877 4252 __STATIC_INLINE void LL_ADC_ClearFlag_EOCS(ADC_TypeDef *ADCx)
ganlikun 0:13413ea9a877 4253 {
ganlikun 0:13413ea9a877 4254 WRITE_REG(ADCx->SR, ~LL_ADC_FLAG_EOCS);
ganlikun 0:13413ea9a877 4255 }
ganlikun 0:13413ea9a877 4256
ganlikun 0:13413ea9a877 4257 /**
ganlikun 0:13413ea9a877 4258 * @brief Clear flag ADC group regular overrun.
ganlikun 0:13413ea9a877 4259 * @rmtoll SR OVR LL_ADC_ClearFlag_OVR
ganlikun 0:13413ea9a877 4260 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 4261 * @retval None
ganlikun 0:13413ea9a877 4262 */
ganlikun 0:13413ea9a877 4263 __STATIC_INLINE void LL_ADC_ClearFlag_OVR(ADC_TypeDef *ADCx)
ganlikun 0:13413ea9a877 4264 {
ganlikun 0:13413ea9a877 4265 WRITE_REG(ADCx->SR, ~LL_ADC_FLAG_OVR);
ganlikun 0:13413ea9a877 4266 }
ganlikun 0:13413ea9a877 4267
ganlikun 0:13413ea9a877 4268
ganlikun 0:13413ea9a877 4269 /**
ganlikun 0:13413ea9a877 4270 * @brief Clear flag ADC group injected end of sequence conversions.
ganlikun 0:13413ea9a877 4271 * @rmtoll SR JEOC LL_ADC_ClearFlag_JEOS
ganlikun 0:13413ea9a877 4272 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 4273 * @retval None
ganlikun 0:13413ea9a877 4274 */
ganlikun 0:13413ea9a877 4275 __STATIC_INLINE void LL_ADC_ClearFlag_JEOS(ADC_TypeDef *ADCx)
ganlikun 0:13413ea9a877 4276 {
ganlikun 0:13413ea9a877 4277 /* Note: on this STM32 serie, there is no flag ADC group injected */
ganlikun 0:13413ea9a877 4278 /* end of unitary conversion. */
ganlikun 0:13413ea9a877 4279 /* Flag noted as "JEOC" is corresponding to flag "JEOS" */
ganlikun 0:13413ea9a877 4280 /* in other STM32 families). */
ganlikun 0:13413ea9a877 4281 WRITE_REG(ADCx->SR, ~LL_ADC_FLAG_JEOS);
ganlikun 0:13413ea9a877 4282 }
ganlikun 0:13413ea9a877 4283
ganlikun 0:13413ea9a877 4284 /**
ganlikun 0:13413ea9a877 4285 * @brief Clear flag ADC analog watchdog 1.
ganlikun 0:13413ea9a877 4286 * @rmtoll SR AWD LL_ADC_ClearFlag_AWD1
ganlikun 0:13413ea9a877 4287 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 4288 * @retval None
ganlikun 0:13413ea9a877 4289 */
ganlikun 0:13413ea9a877 4290 __STATIC_INLINE void LL_ADC_ClearFlag_AWD1(ADC_TypeDef *ADCx)
ganlikun 0:13413ea9a877 4291 {
ganlikun 0:13413ea9a877 4292 WRITE_REG(ADCx->SR, ~LL_ADC_FLAG_AWD1);
ganlikun 0:13413ea9a877 4293 }
ganlikun 0:13413ea9a877 4294
ganlikun 0:13413ea9a877 4295 #if defined(ADC_MULTIMODE_SUPPORT)
ganlikun 0:13413ea9a877 4296 /**
ganlikun 0:13413ea9a877 4297 * @brief Get flag multimode ADC group regular end of unitary conversion
ganlikun 0:13413ea9a877 4298 * or end of sequence conversions, depending on
ganlikun 0:13413ea9a877 4299 * ADC configuration, of the ADC master.
ganlikun 0:13413ea9a877 4300 * @note To configure flag of end of conversion,
ganlikun 0:13413ea9a877 4301 * use function @ref LL_ADC_REG_SetFlagEndOfConversion().
ganlikun 0:13413ea9a877 4302 * @rmtoll CSR EOC1 LL_ADC_IsActiveFlag_MST_EOCS
ganlikun 0:13413ea9a877 4303 * @param ADCxy_COMMON ADC common instance
ganlikun 0:13413ea9a877 4304 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
ganlikun 0:13413ea9a877 4305 * @retval State of bit (1 or 0).
ganlikun 0:13413ea9a877 4306 */
ganlikun 0:13413ea9a877 4307 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_MST_EOCS(ADC_Common_TypeDef *ADCxy_COMMON)
ganlikun 0:13413ea9a877 4308 {
ganlikun 0:13413ea9a877 4309 return (READ_BIT(ADC1->SR, LL_ADC_FLAG_EOCS) == (LL_ADC_FLAG_EOCS));
ganlikun 0:13413ea9a877 4310 }
ganlikun 0:13413ea9a877 4311
ganlikun 0:13413ea9a877 4312 /**
ganlikun 0:13413ea9a877 4313 * @brief Get flag multimode ADC group regular end of unitary conversion
ganlikun 0:13413ea9a877 4314 * or end of sequence conversions, depending on
ganlikun 0:13413ea9a877 4315 * ADC configuration, of the ADC slave 1.
ganlikun 0:13413ea9a877 4316 * @note To configure flag of end of conversion,
ganlikun 0:13413ea9a877 4317 * use function @ref LL_ADC_REG_SetFlagEndOfConversion().
ganlikun 0:13413ea9a877 4318 * @rmtoll CSR EOC2 LL_ADC_IsActiveFlag_SLV1_EOCS
ganlikun 0:13413ea9a877 4319 * @param ADCxy_COMMON ADC common instance
ganlikun 0:13413ea9a877 4320 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
ganlikun 0:13413ea9a877 4321 * @retval State of bit (1 or 0).
ganlikun 0:13413ea9a877 4322 */
ganlikun 0:13413ea9a877 4323 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_SLV1_EOCS(ADC_Common_TypeDef *ADCxy_COMMON)
ganlikun 0:13413ea9a877 4324 {
ganlikun 0:13413ea9a877 4325 return (READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_EOCS_SLV1) == (LL_ADC_FLAG_EOCS_SLV1));
ganlikun 0:13413ea9a877 4326 }
ganlikun 0:13413ea9a877 4327
ganlikun 0:13413ea9a877 4328 /**
ganlikun 0:13413ea9a877 4329 * @brief Get flag multimode ADC group regular end of unitary conversion
ganlikun 0:13413ea9a877 4330 * or end of sequence conversions, depending on
ganlikun 0:13413ea9a877 4331 * ADC configuration, of the ADC slave 2.
ganlikun 0:13413ea9a877 4332 * @note To configure flag of end of conversion,
ganlikun 0:13413ea9a877 4333 * use function @ref LL_ADC_REG_SetFlagEndOfConversion().
ganlikun 0:13413ea9a877 4334 * @rmtoll CSR EOC3 LL_ADC_IsActiveFlag_SLV2_EOCS
ganlikun 0:13413ea9a877 4335 * @param ADCxy_COMMON ADC common instance
ganlikun 0:13413ea9a877 4336 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
ganlikun 0:13413ea9a877 4337 * @retval State of bit (1 or 0).
ganlikun 0:13413ea9a877 4338 */
ganlikun 0:13413ea9a877 4339 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_SLV2_EOCS(ADC_Common_TypeDef *ADCxy_COMMON)
ganlikun 0:13413ea9a877 4340 {
ganlikun 0:13413ea9a877 4341 return (READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_EOCS_SLV2) == (LL_ADC_FLAG_EOCS_SLV2));
ganlikun 0:13413ea9a877 4342 }
ganlikun 0:13413ea9a877 4343 /**
ganlikun 0:13413ea9a877 4344 * @brief Get flag multimode ADC group regular overrun of the ADC master.
ganlikun 0:13413ea9a877 4345 * @rmtoll CSR OVR1 LL_ADC_IsActiveFlag_MST_OVR
ganlikun 0:13413ea9a877 4346 * @param ADCxy_COMMON ADC common instance
ganlikun 0:13413ea9a877 4347 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
ganlikun 0:13413ea9a877 4348 * @retval State of bit (1 or 0).
ganlikun 0:13413ea9a877 4349 */
ganlikun 0:13413ea9a877 4350 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_MST_OVR(ADC_Common_TypeDef *ADCxy_COMMON)
ganlikun 0:13413ea9a877 4351 {
ganlikun 0:13413ea9a877 4352 return (READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_OVR_MST) == (LL_ADC_FLAG_OVR_MST));
ganlikun 0:13413ea9a877 4353 }
ganlikun 0:13413ea9a877 4354
ganlikun 0:13413ea9a877 4355 /**
ganlikun 0:13413ea9a877 4356 * @brief Get flag multimode ADC group regular overrun of the ADC slave 1.
ganlikun 0:13413ea9a877 4357 * @rmtoll CSR OVR2 LL_ADC_IsActiveFlag_SLV1_OVR
ganlikun 0:13413ea9a877 4358 * @param ADCxy_COMMON ADC common instance
ganlikun 0:13413ea9a877 4359 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
ganlikun 0:13413ea9a877 4360 * @retval State of bit (1 or 0).
ganlikun 0:13413ea9a877 4361 */
ganlikun 0:13413ea9a877 4362 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_SLV1_OVR(ADC_Common_TypeDef *ADCxy_COMMON)
ganlikun 0:13413ea9a877 4363 {
ganlikun 0:13413ea9a877 4364 return (READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_OVR_SLV1) == (LL_ADC_FLAG_OVR_SLV1));
ganlikun 0:13413ea9a877 4365 }
ganlikun 0:13413ea9a877 4366
ganlikun 0:13413ea9a877 4367 /**
ganlikun 0:13413ea9a877 4368 * @brief Get flag multimode ADC group regular overrun of the ADC slave 2.
ganlikun 0:13413ea9a877 4369 * @rmtoll CSR OVR3 LL_ADC_IsActiveFlag_SLV2_OVR
ganlikun 0:13413ea9a877 4370 * @param ADCxy_COMMON ADC common instance
ganlikun 0:13413ea9a877 4371 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
ganlikun 0:13413ea9a877 4372 * @retval State of bit (1 or 0).
ganlikun 0:13413ea9a877 4373 */
ganlikun 0:13413ea9a877 4374 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_SLV2_OVR(ADC_Common_TypeDef *ADCxy_COMMON)
ganlikun 0:13413ea9a877 4375 {
ganlikun 0:13413ea9a877 4376 return (READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_OVR_SLV2) == (LL_ADC_FLAG_OVR_SLV2));
ganlikun 0:13413ea9a877 4377 }
ganlikun 0:13413ea9a877 4378
ganlikun 0:13413ea9a877 4379
ganlikun 0:13413ea9a877 4380 /**
ganlikun 0:13413ea9a877 4381 * @brief Get flag multimode ADC group injected end of sequence conversions of the ADC master.
ganlikun 0:13413ea9a877 4382 * @rmtoll CSR JEOC LL_ADC_IsActiveFlag_MST_EOCS
ganlikun 0:13413ea9a877 4383 * @param ADCxy_COMMON ADC common instance
ganlikun 0:13413ea9a877 4384 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
ganlikun 0:13413ea9a877 4385 * @retval State of bit (1 or 0).
ganlikun 0:13413ea9a877 4386 */
ganlikun 0:13413ea9a877 4387 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_MST_JEOS(ADC_Common_TypeDef *ADCxy_COMMON)
ganlikun 0:13413ea9a877 4388 {
ganlikun 0:13413ea9a877 4389 /* Note: on this STM32 serie, there is no flag ADC group injected */
ganlikun 0:13413ea9a877 4390 /* end of unitary conversion. */
ganlikun 0:13413ea9a877 4391 /* Flag noted as "JEOC" is corresponding to flag "JEOS" */
ganlikun 0:13413ea9a877 4392 /* in other STM32 families). */
ganlikun 0:13413ea9a877 4393 return (READ_BIT(ADCxy_COMMON->CSR, ADC_CSR_JEOC1) == (ADC_CSR_JEOC1));
ganlikun 0:13413ea9a877 4394 }
ganlikun 0:13413ea9a877 4395
ganlikun 0:13413ea9a877 4396 /**
ganlikun 0:13413ea9a877 4397 * @brief Get flag multimode ADC group injected end of sequence conversions of the ADC slave 1.
ganlikun 0:13413ea9a877 4398 * @rmtoll CSR JEOC2 LL_ADC_IsActiveFlag_SLV1_JEOS
ganlikun 0:13413ea9a877 4399 * @param ADCxy_COMMON ADC common instance
ganlikun 0:13413ea9a877 4400 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
ganlikun 0:13413ea9a877 4401 * @retval State of bit (1 or 0).
ganlikun 0:13413ea9a877 4402 */
ganlikun 0:13413ea9a877 4403 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_SLV1_JEOS(ADC_Common_TypeDef *ADCxy_COMMON)
ganlikun 0:13413ea9a877 4404 {
ganlikun 0:13413ea9a877 4405 /* Note: on this STM32 serie, there is no flag ADC group injected */
ganlikun 0:13413ea9a877 4406 /* end of unitary conversion. */
ganlikun 0:13413ea9a877 4407 /* Flag noted as "JEOC" is corresponding to flag "JEOS" */
ganlikun 0:13413ea9a877 4408 /* in other STM32 families). */
ganlikun 0:13413ea9a877 4409 return (READ_BIT(ADCxy_COMMON->CSR, ADC_CSR_JEOC2) == (ADC_CSR_JEOC2));
ganlikun 0:13413ea9a877 4410 }
ganlikun 0:13413ea9a877 4411
ganlikun 0:13413ea9a877 4412 /**
ganlikun 0:13413ea9a877 4413 * @brief Get flag multimode ADC group injected end of sequence conversions of the ADC slave 2.
ganlikun 0:13413ea9a877 4414 * @rmtoll CSR JEOC3 LL_ADC_IsActiveFlag_SLV2_JEOS
ganlikun 0:13413ea9a877 4415 * @param ADCxy_COMMON ADC common instance
ganlikun 0:13413ea9a877 4416 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
ganlikun 0:13413ea9a877 4417 * @retval State of bit (1 or 0).
ganlikun 0:13413ea9a877 4418 */
ganlikun 0:13413ea9a877 4419 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_SLV2_JEOS(ADC_Common_TypeDef *ADCxy_COMMON)
ganlikun 0:13413ea9a877 4420 {
ganlikun 0:13413ea9a877 4421 /* Note: on this STM32 serie, there is no flag ADC group injected */
ganlikun 0:13413ea9a877 4422 /* end of unitary conversion. */
ganlikun 0:13413ea9a877 4423 /* Flag noted as "JEOC" is corresponding to flag "JEOS" */
ganlikun 0:13413ea9a877 4424 /* in other STM32 families). */
ganlikun 0:13413ea9a877 4425 return (READ_BIT(ADCxy_COMMON->CSR, ADC_CSR_JEOC3) == (ADC_CSR_JEOC3));
ganlikun 0:13413ea9a877 4426 }
ganlikun 0:13413ea9a877 4427
ganlikun 0:13413ea9a877 4428 /**
ganlikun 0:13413ea9a877 4429 * @brief Get flag multimode ADC analog watchdog 1 of the ADC master.
ganlikun 0:13413ea9a877 4430 * @rmtoll CSR AWD1 LL_ADC_IsActiveFlag_MST_AWD1
ganlikun 0:13413ea9a877 4431 * @param ADCxy_COMMON ADC common instance
ganlikun 0:13413ea9a877 4432 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
ganlikun 0:13413ea9a877 4433 * @retval State of bit (1 or 0).
ganlikun 0:13413ea9a877 4434 */
ganlikun 0:13413ea9a877 4435 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_MST_AWD1(ADC_Common_TypeDef *ADCxy_COMMON)
ganlikun 0:13413ea9a877 4436 {
ganlikun 0:13413ea9a877 4437 return (READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_AWD1_MST) == (LL_ADC_FLAG_AWD1_MST));
ganlikun 0:13413ea9a877 4438 }
ganlikun 0:13413ea9a877 4439
ganlikun 0:13413ea9a877 4440 /**
ganlikun 0:13413ea9a877 4441 * @brief Get flag multimode analog watchdog 1 of the ADC slave 1.
ganlikun 0:13413ea9a877 4442 * @rmtoll CSR AWD2 LL_ADC_IsActiveFlag_SLV1_AWD1
ganlikun 0:13413ea9a877 4443 * @param ADCxy_COMMON ADC common instance
ganlikun 0:13413ea9a877 4444 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
ganlikun 0:13413ea9a877 4445 * @retval State of bit (1 or 0).
ganlikun 0:13413ea9a877 4446 */
ganlikun 0:13413ea9a877 4447 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_SLV1_AWD1(ADC_Common_TypeDef *ADCxy_COMMON)
ganlikun 0:13413ea9a877 4448 {
ganlikun 0:13413ea9a877 4449 return (READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_AWD1_SLV1) == (LL_ADC_FLAG_AWD1_SLV1));
ganlikun 0:13413ea9a877 4450 }
ganlikun 0:13413ea9a877 4451
ganlikun 0:13413ea9a877 4452 /**
ganlikun 0:13413ea9a877 4453 * @brief Get flag multimode analog watchdog 1 of the ADC slave 2.
ganlikun 0:13413ea9a877 4454 * @rmtoll CSR AWD3 LL_ADC_IsActiveFlag_SLV2_AWD1
ganlikun 0:13413ea9a877 4455 * @param ADCxy_COMMON ADC common instance
ganlikun 0:13413ea9a877 4456 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
ganlikun 0:13413ea9a877 4457 * @retval State of bit (1 or 0).
ganlikun 0:13413ea9a877 4458 */
ganlikun 0:13413ea9a877 4459 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_SLV2_AWD1(ADC_Common_TypeDef *ADCxy_COMMON)
ganlikun 0:13413ea9a877 4460 {
ganlikun 0:13413ea9a877 4461 return (READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_AWD1_SLV2) == (LL_ADC_FLAG_AWD1_SLV2));
ganlikun 0:13413ea9a877 4462 }
ganlikun 0:13413ea9a877 4463
ganlikun 0:13413ea9a877 4464 #endif /* ADC_MULTIMODE_SUPPORT */
ganlikun 0:13413ea9a877 4465
ganlikun 0:13413ea9a877 4466 /**
ganlikun 0:13413ea9a877 4467 * @}
ganlikun 0:13413ea9a877 4468 */
ganlikun 0:13413ea9a877 4469
ganlikun 0:13413ea9a877 4470 /** @defgroup ADC_LL_EF_IT_Management ADC IT management
ganlikun 0:13413ea9a877 4471 * @{
ganlikun 0:13413ea9a877 4472 */
ganlikun 0:13413ea9a877 4473
ganlikun 0:13413ea9a877 4474 /**
ganlikun 0:13413ea9a877 4475 * @brief Enable interruption ADC group regular end of unitary conversion
ganlikun 0:13413ea9a877 4476 * or end of sequence conversions, depending on
ganlikun 0:13413ea9a877 4477 * ADC configuration.
ganlikun 0:13413ea9a877 4478 * @note To configure flag of end of conversion,
ganlikun 0:13413ea9a877 4479 * use function @ref LL_ADC_REG_SetFlagEndOfConversion().
ganlikun 0:13413ea9a877 4480 * @rmtoll CR1 EOCIE LL_ADC_EnableIT_EOCS
ganlikun 0:13413ea9a877 4481 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 4482 * @retval None
ganlikun 0:13413ea9a877 4483 */
ganlikun 0:13413ea9a877 4484 __STATIC_INLINE void LL_ADC_EnableIT_EOCS(ADC_TypeDef *ADCx)
ganlikun 0:13413ea9a877 4485 {
ganlikun 0:13413ea9a877 4486 SET_BIT(ADCx->CR1, LL_ADC_IT_EOCS);
ganlikun 0:13413ea9a877 4487 }
ganlikun 0:13413ea9a877 4488
ganlikun 0:13413ea9a877 4489 /**
ganlikun 0:13413ea9a877 4490 * @brief Enable ADC group regular interruption overrun.
ganlikun 0:13413ea9a877 4491 * @rmtoll CR1 OVRIE LL_ADC_EnableIT_OVR
ganlikun 0:13413ea9a877 4492 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 4493 * @retval None
ganlikun 0:13413ea9a877 4494 */
ganlikun 0:13413ea9a877 4495 __STATIC_INLINE void LL_ADC_EnableIT_OVR(ADC_TypeDef *ADCx)
ganlikun 0:13413ea9a877 4496 {
ganlikun 0:13413ea9a877 4497 SET_BIT(ADCx->CR1, LL_ADC_IT_OVR);
ganlikun 0:13413ea9a877 4498 }
ganlikun 0:13413ea9a877 4499
ganlikun 0:13413ea9a877 4500
ganlikun 0:13413ea9a877 4501 /**
ganlikun 0:13413ea9a877 4502 * @brief Enable interruption ADC group injected end of sequence conversions.
ganlikun 0:13413ea9a877 4503 * @rmtoll CR1 JEOCIE LL_ADC_EnableIT_JEOS
ganlikun 0:13413ea9a877 4504 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 4505 * @retval None
ganlikun 0:13413ea9a877 4506 */
ganlikun 0:13413ea9a877 4507 __STATIC_INLINE void LL_ADC_EnableIT_JEOS(ADC_TypeDef *ADCx)
ganlikun 0:13413ea9a877 4508 {
ganlikun 0:13413ea9a877 4509 /* Note: on this STM32 serie, there is no flag ADC group injected */
ganlikun 0:13413ea9a877 4510 /* end of unitary conversion. */
ganlikun 0:13413ea9a877 4511 /* Flag noted as "JEOC" is corresponding to flag "JEOS" */
ganlikun 0:13413ea9a877 4512 /* in other STM32 families). */
ganlikun 0:13413ea9a877 4513 SET_BIT(ADCx->CR1, LL_ADC_IT_JEOS);
ganlikun 0:13413ea9a877 4514 }
ganlikun 0:13413ea9a877 4515
ganlikun 0:13413ea9a877 4516 /**
ganlikun 0:13413ea9a877 4517 * @brief Enable interruption ADC analog watchdog 1.
ganlikun 0:13413ea9a877 4518 * @rmtoll CR1 AWDIE LL_ADC_EnableIT_AWD1
ganlikun 0:13413ea9a877 4519 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 4520 * @retval None
ganlikun 0:13413ea9a877 4521 */
ganlikun 0:13413ea9a877 4522 __STATIC_INLINE void LL_ADC_EnableIT_AWD1(ADC_TypeDef *ADCx)
ganlikun 0:13413ea9a877 4523 {
ganlikun 0:13413ea9a877 4524 SET_BIT(ADCx->CR1, LL_ADC_IT_AWD1);
ganlikun 0:13413ea9a877 4525 }
ganlikun 0:13413ea9a877 4526
ganlikun 0:13413ea9a877 4527 /**
ganlikun 0:13413ea9a877 4528 * @brief Disable interruption ADC group regular end of unitary conversion
ganlikun 0:13413ea9a877 4529 * or end of sequence conversions, depending on
ganlikun 0:13413ea9a877 4530 * ADC configuration.
ganlikun 0:13413ea9a877 4531 * @note To configure flag of end of conversion,
ganlikun 0:13413ea9a877 4532 * use function @ref LL_ADC_REG_SetFlagEndOfConversion().
ganlikun 0:13413ea9a877 4533 * @rmtoll CR1 EOCIE LL_ADC_DisableIT_EOCS
ganlikun 0:13413ea9a877 4534 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 4535 * @retval None
ganlikun 0:13413ea9a877 4536 */
ganlikun 0:13413ea9a877 4537 __STATIC_INLINE void LL_ADC_DisableIT_EOCS(ADC_TypeDef *ADCx)
ganlikun 0:13413ea9a877 4538 {
ganlikun 0:13413ea9a877 4539 CLEAR_BIT(ADCx->CR1, LL_ADC_IT_EOCS);
ganlikun 0:13413ea9a877 4540 }
ganlikun 0:13413ea9a877 4541
ganlikun 0:13413ea9a877 4542 /**
ganlikun 0:13413ea9a877 4543 * @brief Disable interruption ADC group regular overrun.
ganlikun 0:13413ea9a877 4544 * @rmtoll CR1 OVRIE LL_ADC_DisableIT_OVR
ganlikun 0:13413ea9a877 4545 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 4546 * @retval None
ganlikun 0:13413ea9a877 4547 */
ganlikun 0:13413ea9a877 4548 __STATIC_INLINE void LL_ADC_DisableIT_OVR(ADC_TypeDef *ADCx)
ganlikun 0:13413ea9a877 4549 {
ganlikun 0:13413ea9a877 4550 CLEAR_BIT(ADCx->CR1, LL_ADC_IT_OVR);
ganlikun 0:13413ea9a877 4551 }
ganlikun 0:13413ea9a877 4552
ganlikun 0:13413ea9a877 4553
ganlikun 0:13413ea9a877 4554 /**
ganlikun 0:13413ea9a877 4555 * @brief Disable interruption ADC group injected end of sequence conversions.
ganlikun 0:13413ea9a877 4556 * @rmtoll CR1 JEOCIE LL_ADC_EnableIT_JEOS
ganlikun 0:13413ea9a877 4557 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 4558 * @retval None
ganlikun 0:13413ea9a877 4559 */
ganlikun 0:13413ea9a877 4560 __STATIC_INLINE void LL_ADC_DisableIT_JEOS(ADC_TypeDef *ADCx)
ganlikun 0:13413ea9a877 4561 {
ganlikun 0:13413ea9a877 4562 /* Note: on this STM32 serie, there is no flag ADC group injected */
ganlikun 0:13413ea9a877 4563 /* end of unitary conversion. */
ganlikun 0:13413ea9a877 4564 /* Flag noted as "JEOC" is corresponding to flag "JEOS" */
ganlikun 0:13413ea9a877 4565 /* in other STM32 families). */
ganlikun 0:13413ea9a877 4566 CLEAR_BIT(ADCx->CR1, LL_ADC_IT_JEOS);
ganlikun 0:13413ea9a877 4567 }
ganlikun 0:13413ea9a877 4568
ganlikun 0:13413ea9a877 4569 /**
ganlikun 0:13413ea9a877 4570 * @brief Disable interruption ADC analog watchdog 1.
ganlikun 0:13413ea9a877 4571 * @rmtoll CR1 AWDIE LL_ADC_EnableIT_AWD1
ganlikun 0:13413ea9a877 4572 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 4573 * @retval None
ganlikun 0:13413ea9a877 4574 */
ganlikun 0:13413ea9a877 4575 __STATIC_INLINE void LL_ADC_DisableIT_AWD1(ADC_TypeDef *ADCx)
ganlikun 0:13413ea9a877 4576 {
ganlikun 0:13413ea9a877 4577 CLEAR_BIT(ADCx->CR1, LL_ADC_IT_AWD1);
ganlikun 0:13413ea9a877 4578 }
ganlikun 0:13413ea9a877 4579
ganlikun 0:13413ea9a877 4580 /**
ganlikun 0:13413ea9a877 4581 * @brief Get state of interruption ADC group regular end of unitary conversion
ganlikun 0:13413ea9a877 4582 * or end of sequence conversions, depending on
ganlikun 0:13413ea9a877 4583 * ADC configuration.
ganlikun 0:13413ea9a877 4584 * @note To configure flag of end of conversion,
ganlikun 0:13413ea9a877 4585 * use function @ref LL_ADC_REG_SetFlagEndOfConversion().
ganlikun 0:13413ea9a877 4586 * (0: interrupt disabled, 1: interrupt enabled)
ganlikun 0:13413ea9a877 4587 * @rmtoll CR1 EOCIE LL_ADC_IsEnabledIT_EOCS
ganlikun 0:13413ea9a877 4588 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 4589 * @retval State of bit (1 or 0).
ganlikun 0:13413ea9a877 4590 */
ganlikun 0:13413ea9a877 4591 __STATIC_INLINE uint32_t LL_ADC_IsEnabledIT_EOCS(ADC_TypeDef *ADCx)
ganlikun 0:13413ea9a877 4592 {
ganlikun 0:13413ea9a877 4593 return (READ_BIT(ADCx->CR1, LL_ADC_IT_EOCS) == (LL_ADC_IT_EOCS));
ganlikun 0:13413ea9a877 4594 }
ganlikun 0:13413ea9a877 4595
ganlikun 0:13413ea9a877 4596 /**
ganlikun 0:13413ea9a877 4597 * @brief Get state of interruption ADC group regular overrun
ganlikun 0:13413ea9a877 4598 * (0: interrupt disabled, 1: interrupt enabled).
ganlikun 0:13413ea9a877 4599 * @rmtoll CR1 OVRIE LL_ADC_IsEnabledIT_OVR
ganlikun 0:13413ea9a877 4600 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 4601 * @retval State of bit (1 or 0).
ganlikun 0:13413ea9a877 4602 */
ganlikun 0:13413ea9a877 4603 __STATIC_INLINE uint32_t LL_ADC_IsEnabledIT_OVR(ADC_TypeDef *ADCx)
ganlikun 0:13413ea9a877 4604 {
ganlikun 0:13413ea9a877 4605 return (READ_BIT(ADCx->CR1, LL_ADC_IT_OVR) == (LL_ADC_IT_OVR));
ganlikun 0:13413ea9a877 4606 }
ganlikun 0:13413ea9a877 4607
ganlikun 0:13413ea9a877 4608
ganlikun 0:13413ea9a877 4609 /**
ganlikun 0:13413ea9a877 4610 * @brief Get state of interruption ADC group injected end of sequence conversions
ganlikun 0:13413ea9a877 4611 * (0: interrupt disabled, 1: interrupt enabled).
ganlikun 0:13413ea9a877 4612 * @rmtoll CR1 JEOCIE LL_ADC_EnableIT_JEOS
ganlikun 0:13413ea9a877 4613 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 4614 * @retval State of bit (1 or 0).
ganlikun 0:13413ea9a877 4615 */
ganlikun 0:13413ea9a877 4616 __STATIC_INLINE uint32_t LL_ADC_IsEnabledIT_JEOS(ADC_TypeDef *ADCx)
ganlikun 0:13413ea9a877 4617 {
ganlikun 0:13413ea9a877 4618 /* Note: on this STM32 serie, there is no flag ADC group injected */
ganlikun 0:13413ea9a877 4619 /* end of unitary conversion. */
ganlikun 0:13413ea9a877 4620 /* Flag noted as "JEOC" is corresponding to flag "JEOS" */
ganlikun 0:13413ea9a877 4621 /* in other STM32 families). */
ganlikun 0:13413ea9a877 4622 return (READ_BIT(ADCx->CR1, LL_ADC_IT_JEOS) == (LL_ADC_IT_JEOS));
ganlikun 0:13413ea9a877 4623 }
ganlikun 0:13413ea9a877 4624
ganlikun 0:13413ea9a877 4625 /**
ganlikun 0:13413ea9a877 4626 * @brief Get state of interruption ADC analog watchdog 1
ganlikun 0:13413ea9a877 4627 * (0: interrupt disabled, 1: interrupt enabled).
ganlikun 0:13413ea9a877 4628 * @rmtoll CR1 AWDIE LL_ADC_EnableIT_AWD1
ganlikun 0:13413ea9a877 4629 * @param ADCx ADC instance
ganlikun 0:13413ea9a877 4630 * @retval State of bit (1 or 0).
ganlikun 0:13413ea9a877 4631 */
ganlikun 0:13413ea9a877 4632 __STATIC_INLINE uint32_t LL_ADC_IsEnabledIT_AWD1(ADC_TypeDef *ADCx)
ganlikun 0:13413ea9a877 4633 {
ganlikun 0:13413ea9a877 4634 return (READ_BIT(ADCx->CR1, LL_ADC_IT_AWD1) == (LL_ADC_IT_AWD1));
ganlikun 0:13413ea9a877 4635 }
ganlikun 0:13413ea9a877 4636
ganlikun 0:13413ea9a877 4637 /**
ganlikun 0:13413ea9a877 4638 * @}
ganlikun 0:13413ea9a877 4639 */
ganlikun 0:13413ea9a877 4640
ganlikun 0:13413ea9a877 4641 #if defined(USE_FULL_LL_DRIVER)
ganlikun 0:13413ea9a877 4642 /** @defgroup ADC_LL_EF_Init Initialization and de-initialization functions
ganlikun 0:13413ea9a877 4643 * @{
ganlikun 0:13413ea9a877 4644 */
ganlikun 0:13413ea9a877 4645
ganlikun 0:13413ea9a877 4646 /* Initialization of some features of ADC common parameters and multimode */
ganlikun 0:13413ea9a877 4647 ErrorStatus LL_ADC_CommonDeInit(ADC_Common_TypeDef *ADCxy_COMMON);
ganlikun 0:13413ea9a877 4648 ErrorStatus LL_ADC_CommonInit(ADC_Common_TypeDef *ADCxy_COMMON, LL_ADC_CommonInitTypeDef *ADC_CommonInitStruct);
ganlikun 0:13413ea9a877 4649 void LL_ADC_CommonStructInit(LL_ADC_CommonInitTypeDef *ADC_CommonInitStruct);
ganlikun 0:13413ea9a877 4650
ganlikun 0:13413ea9a877 4651 /* De-initialization of ADC instance, ADC group regular and ADC group injected */
ganlikun 0:13413ea9a877 4652 /* (availability of ADC group injected depends on STM32 families) */
ganlikun 0:13413ea9a877 4653 ErrorStatus LL_ADC_DeInit(ADC_TypeDef *ADCx);
ganlikun 0:13413ea9a877 4654
ganlikun 0:13413ea9a877 4655 /* Initialization of some features of ADC instance */
ganlikun 0:13413ea9a877 4656 ErrorStatus LL_ADC_Init(ADC_TypeDef *ADCx, LL_ADC_InitTypeDef *ADC_InitStruct);
ganlikun 0:13413ea9a877 4657 void LL_ADC_StructInit(LL_ADC_InitTypeDef *ADC_InitStruct);
ganlikun 0:13413ea9a877 4658
ganlikun 0:13413ea9a877 4659 /* Initialization of some features of ADC instance and ADC group regular */
ganlikun 0:13413ea9a877 4660 ErrorStatus LL_ADC_REG_Init(ADC_TypeDef *ADCx, LL_ADC_REG_InitTypeDef *ADC_REG_InitStruct);
ganlikun 0:13413ea9a877 4661 void LL_ADC_REG_StructInit(LL_ADC_REG_InitTypeDef *ADC_REG_InitStruct);
ganlikun 0:13413ea9a877 4662
ganlikun 0:13413ea9a877 4663 /* Initialization of some features of ADC instance and ADC group injected */
ganlikun 0:13413ea9a877 4664 ErrorStatus LL_ADC_INJ_Init(ADC_TypeDef *ADCx, LL_ADC_INJ_InitTypeDef *ADC_INJ_InitStruct);
ganlikun 0:13413ea9a877 4665 void LL_ADC_INJ_StructInit(LL_ADC_INJ_InitTypeDef *ADC_INJ_InitStruct);
ganlikun 0:13413ea9a877 4666
ganlikun 0:13413ea9a877 4667 /**
ganlikun 0:13413ea9a877 4668 * @}
ganlikun 0:13413ea9a877 4669 */
ganlikun 0:13413ea9a877 4670 #endif /* USE_FULL_LL_DRIVER */
ganlikun 0:13413ea9a877 4671
ganlikun 0:13413ea9a877 4672 /**
ganlikun 0:13413ea9a877 4673 * @}
ganlikun 0:13413ea9a877 4674 */
ganlikun 0:13413ea9a877 4675
ganlikun 0:13413ea9a877 4676 /**
ganlikun 0:13413ea9a877 4677 * @}
ganlikun 0:13413ea9a877 4678 */
ganlikun 0:13413ea9a877 4679
ganlikun 0:13413ea9a877 4680 #endif /* ADC1 || ADC2 || ADC3 */
ganlikun 0:13413ea9a877 4681
ganlikun 0:13413ea9a877 4682 /**
ganlikun 0:13413ea9a877 4683 * @}
ganlikun 0:13413ea9a877 4684 */
ganlikun 0:13413ea9a877 4685
ganlikun 0:13413ea9a877 4686 #ifdef __cplusplus
ganlikun 0:13413ea9a877 4687 }
ganlikun 0:13413ea9a877 4688 #endif
ganlikun 0:13413ea9a877 4689
ganlikun 0:13413ea9a877 4690 #endif /* __STM32F4xx_LL_ADC_H */
ganlikun 0:13413ea9a877 4691
ganlikun 0:13413ea9a877 4692 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
ganlikun 0:13413ea9a877 4693