inport from local

Dependents:   Hobbyking_Cheetah_0511

Committer:
NYX
Date:
Mon Mar 16 06:35:48 2020 +0000
Revision:
0:85b3fd62ea1a
reinport to mbed;

Who changed what in which revision?

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