The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
AnnaBridge
Date:
Wed Jun 21 17:31:38 2017 +0100
Revision:
145:64910690c574
Parent:
128:9bcdf88f62b0
Release 145 of the mbed library.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 122:f9eeca106725 1 /**
Kojto 122:f9eeca106725 2 ******************************************************************************
Kojto 122:f9eeca106725 3 * @file stm32l4xx_ll_adc.h
Kojto 122:f9eeca106725 4 * @author MCD Application Team
AnnaBridge 145:64910690c574 5 * @version V1.7.1
AnnaBridge 145:64910690c574 6 * @date 21-April-2017
Kojto 122:f9eeca106725 7 * @brief Header file of ADC LL module.
Kojto 122:f9eeca106725 8 ******************************************************************************
Kojto 122:f9eeca106725 9 * @attention
Kojto 122:f9eeca106725 10 *
AnnaBridge 145:64910690c574 11 * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
Kojto 122:f9eeca106725 12 *
Kojto 122:f9eeca106725 13 * Redistribution and use in source and binary forms, with or without modification,
Kojto 122:f9eeca106725 14 * are permitted provided that the following conditions are met:
Kojto 122:f9eeca106725 15 * 1. Redistributions of source code must retain the above copyright notice,
Kojto 122:f9eeca106725 16 * this list of conditions and the following disclaimer.
Kojto 122:f9eeca106725 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
Kojto 122:f9eeca106725 18 * this list of conditions and the following disclaimer in the documentation
Kojto 122:f9eeca106725 19 * and/or other materials provided with the distribution.
Kojto 122:f9eeca106725 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Kojto 122:f9eeca106725 21 * may be used to endorse or promote products derived from this software
Kojto 122:f9eeca106725 22 * without specific prior written permission.
Kojto 122:f9eeca106725 23 *
Kojto 122:f9eeca106725 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Kojto 122:f9eeca106725 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Kojto 122:f9eeca106725 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Kojto 122:f9eeca106725 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Kojto 122:f9eeca106725 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Kojto 122:f9eeca106725 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Kojto 122:f9eeca106725 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Kojto 122:f9eeca106725 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Kojto 122:f9eeca106725 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Kojto 122:f9eeca106725 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Kojto 122:f9eeca106725 34 *
Kojto 122:f9eeca106725 35 ******************************************************************************
Kojto 122:f9eeca106725 36 */
Kojto 122:f9eeca106725 37
Kojto 122:f9eeca106725 38 /* Define to prevent recursive inclusion -------------------------------------*/
Kojto 122:f9eeca106725 39 #ifndef __STM32L4xx_LL_ADC_H
Kojto 122:f9eeca106725 40 #define __STM32L4xx_LL_ADC_H
Kojto 122:f9eeca106725 41
Kojto 122:f9eeca106725 42 #ifdef __cplusplus
Kojto 122:f9eeca106725 43 extern "C" {
Kojto 122:f9eeca106725 44 #endif
Kojto 122:f9eeca106725 45
Kojto 122:f9eeca106725 46 /* Includes ------------------------------------------------------------------*/
Kojto 122:f9eeca106725 47 #include "stm32l4xx.h"
Kojto 122:f9eeca106725 48
Kojto 122:f9eeca106725 49 /** @addtogroup STM32L4xx_LL_Driver
Kojto 122:f9eeca106725 50 * @{
Kojto 122:f9eeca106725 51 */
Kojto 122:f9eeca106725 52
Kojto 122:f9eeca106725 53 #if defined (ADC1) || defined (ADC2) || defined (ADC3)
Kojto 122:f9eeca106725 54
Kojto 122:f9eeca106725 55 /** @defgroup ADC_LL ADC
Kojto 122:f9eeca106725 56 * @{
Kojto 122:f9eeca106725 57 */
Kojto 122:f9eeca106725 58
Kojto 122:f9eeca106725 59 /* Private types -------------------------------------------------------------*/
Kojto 122:f9eeca106725 60 /* Private variables ---------------------------------------------------------*/
Kojto 122:f9eeca106725 61
Kojto 122:f9eeca106725 62 /* Private constants ---------------------------------------------------------*/
Kojto 122:f9eeca106725 63 /** @defgroup ADC_LL_Private_Constants ADC Private Constants
Kojto 122:f9eeca106725 64 * @{
Kojto 122:f9eeca106725 65 */
Kojto 122:f9eeca106725 66
Kojto 122:f9eeca106725 67 /* Internal mask for ADC group regular sequencer: */
Kojto 122:f9eeca106725 68 /* To select into literal LL_ADC_REG_RANK_x the relevant bits for: */
Kojto 122:f9eeca106725 69 /* - sequencer register offset */
Kojto 122:f9eeca106725 70 /* - sequencer rank bits position into the selected register */
Kojto 122:f9eeca106725 71
Kojto 122:f9eeca106725 72 /* Internal register offset for ADC group regular sequencer configuration */
Kojto 122:f9eeca106725 73 /* (offset placed into a spare area of literal definition) */
AnnaBridge 145:64910690c574 74 #define ADC_SQR1_REGOFFSET (0x00000000U)
AnnaBridge 145:64910690c574 75 #define ADC_SQR2_REGOFFSET (0x00000100U)
AnnaBridge 145:64910690c574 76 #define ADC_SQR3_REGOFFSET (0x00000200U)
AnnaBridge 145:64910690c574 77 #define ADC_SQR4_REGOFFSET (0x00000300U)
Kojto 122:f9eeca106725 78
Kojto 122:f9eeca106725 79 #define ADC_REG_SQRX_REGOFFSET_MASK (ADC_SQR1_REGOFFSET | ADC_SQR2_REGOFFSET | ADC_SQR3_REGOFFSET | ADC_SQR4_REGOFFSET)
Kojto 122:f9eeca106725 80 #define ADC_REG_RANK_ID_SQRX_MASK (ADC_CHANNEL_ID_NUMBER_MASK_POSBIT0)
Kojto 122:f9eeca106725 81
Kojto 122:f9eeca106725 82 /* Definition of ADC group regular sequencer bits information to be inserted */
Kojto 122:f9eeca106725 83 /* into ADC group regular sequencer ranks literals definition. */
AnnaBridge 145:64910690c574 84 #define ADC_REG_RANK_1_SQRX_BITOFFSET_POS ( 6U) /* Value equivalent to POSITION_VAL(ADC_SQR1_SQ1) */
AnnaBridge 145:64910690c574 85 #define ADC_REG_RANK_2_SQRX_BITOFFSET_POS (12U) /* Value equivalent to POSITION_VAL(ADC_SQR1_SQ2) */
AnnaBridge 145:64910690c574 86 #define ADC_REG_RANK_3_SQRX_BITOFFSET_POS (18U) /* Value equivalent to POSITION_VAL(ADC_SQR1_SQ3) */
AnnaBridge 145:64910690c574 87 #define ADC_REG_RANK_4_SQRX_BITOFFSET_POS (24U) /* Value equivalent to POSITION_VAL(ADC_SQR1_SQ4) */
AnnaBridge 145:64910690c574 88 #define ADC_REG_RANK_5_SQRX_BITOFFSET_POS ( 0U) /* Value equivalent to POSITION_VAL(ADC_SQR2_SQ5) */
AnnaBridge 145:64910690c574 89 #define ADC_REG_RANK_6_SQRX_BITOFFSET_POS ( 6U) /* Value equivalent to POSITION_VAL(ADC_SQR2_SQ6) */
AnnaBridge 145:64910690c574 90 #define ADC_REG_RANK_7_SQRX_BITOFFSET_POS (12U) /* Value equivalent to POSITION_VAL(ADC_SQR2_SQ7) */
AnnaBridge 145:64910690c574 91 #define ADC_REG_RANK_8_SQRX_BITOFFSET_POS (18U) /* Value equivalent to POSITION_VAL(ADC_SQR2_SQ8) */
AnnaBridge 145:64910690c574 92 #define ADC_REG_RANK_9_SQRX_BITOFFSET_POS (24U) /* Value equivalent to POSITION_VAL(ADC_SQR2_SQ9) */
AnnaBridge 145:64910690c574 93 #define ADC_REG_RANK_10_SQRX_BITOFFSET_POS ( 0U) /* Value equivalent to POSITION_VAL(ADC_SQR3_SQ10) */
AnnaBridge 145:64910690c574 94 #define ADC_REG_RANK_11_SQRX_BITOFFSET_POS ( 6U) /* Value equivalent to POSITION_VAL(ADC_SQR3_SQ11) */
AnnaBridge 145:64910690c574 95 #define ADC_REG_RANK_12_SQRX_BITOFFSET_POS (12U) /* Value equivalent to POSITION_VAL(ADC_SQR3_SQ12) */
AnnaBridge 145:64910690c574 96 #define ADC_REG_RANK_13_SQRX_BITOFFSET_POS (18U) /* Value equivalent to POSITION_VAL(ADC_SQR3_SQ13) */
AnnaBridge 145:64910690c574 97 #define ADC_REG_RANK_14_SQRX_BITOFFSET_POS (24U) /* Value equivalent to POSITION_VAL(ADC_SQR3_SQ14) */
AnnaBridge 145:64910690c574 98 #define ADC_REG_RANK_15_SQRX_BITOFFSET_POS ( 0U) /* Value equivalent to POSITION_VAL(ADC_SQR4_SQ15) */
AnnaBridge 145:64910690c574 99 #define ADC_REG_RANK_16_SQRX_BITOFFSET_POS ( 6U) /* Value equivalent to POSITION_VAL(ADC_SQR4_SQ16) */
Kojto 122:f9eeca106725 100
Kojto 122:f9eeca106725 101
Kojto 122:f9eeca106725 102
Kojto 122:f9eeca106725 103 /* Internal mask for ADC group injected sequencer: */
Kojto 122:f9eeca106725 104 /* To select into literal LL_ADC_INJ_RANK_x the relevant bits for: */
Kojto 122:f9eeca106725 105 /* - data register offset */
Kojto 122:f9eeca106725 106 /* - sequencer rank bits position into the selected register */
Kojto 122:f9eeca106725 107
Kojto 122:f9eeca106725 108 /* Internal register offset for ADC group injected data register */
Kojto 122:f9eeca106725 109 /* (offset placed into a spare area of literal definition) */
AnnaBridge 145:64910690c574 110 #define ADC_JDR1_REGOFFSET (0x00000000U)
AnnaBridge 145:64910690c574 111 #define ADC_JDR2_REGOFFSET (0x00000100U)
AnnaBridge 145:64910690c574 112 #define ADC_JDR3_REGOFFSET (0x00000200U)
AnnaBridge 145:64910690c574 113 #define ADC_JDR4_REGOFFSET (0x00000300U)
Kojto 122:f9eeca106725 114
Kojto 122:f9eeca106725 115 #define ADC_INJ_JDRX_REGOFFSET_MASK (ADC_JDR1_REGOFFSET | ADC_JDR2_REGOFFSET | ADC_JDR3_REGOFFSET | ADC_JDR4_REGOFFSET)
Kojto 122:f9eeca106725 116 #define ADC_INJ_RANK_ID_JSQR_MASK (ADC_CHANNEL_ID_NUMBER_MASK_POSBIT0)
Kojto 122:f9eeca106725 117
Kojto 122:f9eeca106725 118 /* Definition of ADC group injected sequencer bits information to be inserted */
Kojto 122:f9eeca106725 119 /* into ADC group injected sequencer ranks literals definition. */
AnnaBridge 145:64910690c574 120 #define ADC_INJ_RANK_1_JSQR_BITOFFSET_POS ( 8U) /* Value equivalent to POSITION_VAL(ADC_JSQR_JSQ1) */
AnnaBridge 145:64910690c574 121 #define ADC_INJ_RANK_2_JSQR_BITOFFSET_POS (14U) /* Value equivalent to POSITION_VAL(ADC_JSQR_JSQ2) */
AnnaBridge 145:64910690c574 122 #define ADC_INJ_RANK_3_JSQR_BITOFFSET_POS (20U) /* Value equivalent to POSITION_VAL(ADC_JSQR_JSQ3) */
AnnaBridge 145:64910690c574 123 #define ADC_INJ_RANK_4_JSQR_BITOFFSET_POS (26U) /* Value equivalent to POSITION_VAL(ADC_JSQR_JSQ4) */
Kojto 122:f9eeca106725 124
Kojto 122:f9eeca106725 125
Kojto 122:f9eeca106725 126
Kojto 122:f9eeca106725 127 /* Internal mask for ADC group regular trigger: */
Kojto 122:f9eeca106725 128 /* To select into literal LL_ADC_REG_TRIG_x the relevant bits for: */
Kojto 122:f9eeca106725 129 /* - regular trigger source */
Kojto 122:f9eeca106725 130 /* - regular trigger edge */
Kojto 122:f9eeca106725 131 #define ADC_REG_TRIG_EXT_EDGE_DEFAULT (ADC_CFGR_EXTEN_0) /* Trigger edge set to rising edge (default setting for compatibility with some ADC on other STM32 families having this setting set by HW default value) */
Kojto 122:f9eeca106725 132
Kojto 122:f9eeca106725 133 /* Mask containing trigger source masks for each of possible */
Kojto 122:f9eeca106725 134 /* trigger edge selection duplicated with shifts [0; 4; 8; 12] */
Kojto 122:f9eeca106725 135 /* corresponding to {SW start; ext trigger; ext trigger; ext trigger}. */
Kojto 122:f9eeca106725 136 #define ADC_REG_TRIG_SOURCE_MASK (((LL_ADC_REG_TRIG_SOFTWARE & ADC_CFGR_EXTSEL) << (4U * 0U)) | \
Kojto 122:f9eeca106725 137 ((ADC_CFGR_EXTSEL) << (4U * 1U)) | \
Kojto 122:f9eeca106725 138 ((ADC_CFGR_EXTSEL) << (4U * 2U)) | \
Kojto 122:f9eeca106725 139 ((ADC_CFGR_EXTSEL) << (4U * 3U)) )
Kojto 122:f9eeca106725 140
Kojto 122:f9eeca106725 141 /* Mask containing trigger edge masks for each of possible */
Kojto 122:f9eeca106725 142 /* trigger edge selection duplicated with shifts [0; 4; 8; 12] */
Kojto 122:f9eeca106725 143 /* corresponding to {SW start; ext trigger; ext trigger; ext trigger}. */
Kojto 122:f9eeca106725 144 #define ADC_REG_TRIG_EDGE_MASK (((LL_ADC_REG_TRIG_SOFTWARE & ADC_CFGR_EXTEN) << (4U * 0U)) | \
Kojto 122:f9eeca106725 145 ((ADC_REG_TRIG_EXT_EDGE_DEFAULT) << (4U * 1U)) | \
Kojto 122:f9eeca106725 146 ((ADC_REG_TRIG_EXT_EDGE_DEFAULT) << (4U * 2U)) | \
Kojto 122:f9eeca106725 147 ((ADC_REG_TRIG_EXT_EDGE_DEFAULT) << (4U * 3U)) )
Kojto 122:f9eeca106725 148
Kojto 122:f9eeca106725 149 /* Definition of ADC group regular trigger bits information. */
AnnaBridge 145:64910690c574 150 #define ADC_REG_TRIG_EXTSEL_BITOFFSET_POS ( 6U) /* Value equivalent to POSITION_VAL(ADC_CFGR_EXTSEL) */
AnnaBridge 145:64910690c574 151 #define ADC_REG_TRIG_EXTEN_BITOFFSET_POS (10U) /* Value equivalent to POSITION_VAL(ADC_CFGR_EXTEN) */
Kojto 122:f9eeca106725 152
Kojto 122:f9eeca106725 153
Kojto 122:f9eeca106725 154
Kojto 122:f9eeca106725 155 /* Internal mask for ADC group injected trigger: */
Kojto 122:f9eeca106725 156 /* To select into literal LL_ADC_INJ_TRIG_x the relevant bits for: */
Kojto 122:f9eeca106725 157 /* - injected trigger source */
Kojto 122:f9eeca106725 158 /* - injected trigger edge */
Kojto 122:f9eeca106725 159 #define ADC_INJ_TRIG_EXT_EDGE_DEFAULT (ADC_JSQR_JEXTEN_0) /* Trigger edge set to rising edge (default setting for compatibility with some ADC on other STM32 families having this setting set by HW default value) */
Kojto 122:f9eeca106725 160
Kojto 122:f9eeca106725 161 /* Mask containing trigger source masks for each of possible */
Kojto 122:f9eeca106725 162 /* trigger edge selection duplicated with shifts [0; 4; 8; 12] */
Kojto 122:f9eeca106725 163 /* corresponding to {SW start; ext trigger; ext trigger; ext trigger}. */
Kojto 122:f9eeca106725 164 #define ADC_INJ_TRIG_SOURCE_MASK (((LL_ADC_INJ_TRIG_SOFTWARE & ADC_JSQR_JEXTSEL) << (4U * 0U)) | \
Kojto 122:f9eeca106725 165 ((ADC_JSQR_JEXTSEL) << (4U * 1U)) | \
Kojto 122:f9eeca106725 166 ((ADC_JSQR_JEXTSEL) << (4U * 2U)) | \
Kojto 122:f9eeca106725 167 ((ADC_JSQR_JEXTSEL) << (4U * 3U)) )
Kojto 122:f9eeca106725 168
Kojto 122:f9eeca106725 169 /* Mask containing trigger edge masks for each of possible */
Kojto 122:f9eeca106725 170 /* trigger edge selection duplicated with shifts [0; 4; 8; 12] */
Kojto 122:f9eeca106725 171 /* corresponding to {SW start; ext trigger; ext trigger; ext trigger}. */
Kojto 122:f9eeca106725 172 #define ADC_INJ_TRIG_EDGE_MASK (((LL_ADC_INJ_TRIG_SOFTWARE & ADC_JSQR_JEXTEN) << (4U * 0U)) | \
Kojto 122:f9eeca106725 173 ((ADC_INJ_TRIG_EXT_EDGE_DEFAULT) << (4U * 1U)) | \
Kojto 122:f9eeca106725 174 ((ADC_INJ_TRIG_EXT_EDGE_DEFAULT) << (4U * 2U)) | \
Kojto 122:f9eeca106725 175 ((ADC_INJ_TRIG_EXT_EDGE_DEFAULT) << (4U * 3U)) )
Kojto 122:f9eeca106725 176
Kojto 122:f9eeca106725 177 /* Definition of ADC group injected trigger bits information. */
AnnaBridge 145:64910690c574 178 #define ADC_INJ_TRIG_EXTSEL_BITOFFSET_POS ( 2U) /* Value equivalent to POSITION_VAL(ADC_JSQR_JEXTSEL) */
AnnaBridge 145:64910690c574 179 #define ADC_INJ_TRIG_EXTEN_BITOFFSET_POS ( 6U) /* Value equivalent to POSITION_VAL(ADC_JSQR_JEXTEN) */
Kojto 122:f9eeca106725 180
Kojto 122:f9eeca106725 181
Kojto 122:f9eeca106725 182
Kojto 122:f9eeca106725 183
Kojto 122:f9eeca106725 184
Kojto 122:f9eeca106725 185
Kojto 122:f9eeca106725 186 /* Internal mask for ADC channel: */
Kojto 122:f9eeca106725 187 /* To select into literal LL_ADC_CHANNEL_x the relevant bits for: */
Kojto 122:f9eeca106725 188 /* - channel identifier defined by number */
Kojto 122:f9eeca106725 189 /* - channel identifier defined by bitfield */
Kojto 122:f9eeca106725 190 /* - channel differentiation between external channels (connected to */
Kojto 122:f9eeca106725 191 /* GPIO pins) and internal channels (connected to internal paths) */
Kojto 122:f9eeca106725 192 /* - channel sampling time defined by SMPRx register offset */
Kojto 122:f9eeca106725 193 /* and SMPx bits positions into SMPRx register */
Kojto 122:f9eeca106725 194 #define ADC_CHANNEL_ID_NUMBER_MASK (ADC_CFGR_AWD1CH)
Kojto 122:f9eeca106725 195 #define ADC_CHANNEL_ID_BITFIELD_MASK (ADC_AWD2CR_AWD2CH)
AnnaBridge 145:64910690c574 196 #define ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS (26U)/* Value equivalent to POSITION_VAL(ADC_CHANNEL_ID_NUMBER_MASK) */
Kojto 122:f9eeca106725 197 #define ADC_CHANNEL_ID_MASK (ADC_CHANNEL_ID_NUMBER_MASK | ADC_CHANNEL_ID_BITFIELD_MASK | ADC_CHANNEL_ID_INTERNAL_CH_MASK)
Kojto 122:f9eeca106725 198 /* Equivalent mask of ADC_CHANNEL_NUMBER_MASK aligned on register LSB (bit 0) */
Kojto 122:f9eeca106725 199 #define ADC_CHANNEL_ID_NUMBER_MASK_POSBIT0 (ADC_SQR2_SQ5) /* Equivalent to shift: (ADC_CHANNEL_NUMBER_MASK >> POSITION_VAL(ADC_CHANNEL_NUMBER_MASK)) */
Kojto 122:f9eeca106725 200
Kojto 122:f9eeca106725 201 /* Channel differentiation between external and internal channels */
AnnaBridge 145:64910690c574 202 #define ADC_CHANNEL_ID_INTERNAL_CH (0x80000000U) /* Marker of internal channel */
AnnaBridge 145:64910690c574 203 #define ADC_CHANNEL_ID_INTERNAL_CH_2 (0x00080000U) /* Marker of internal channel for other ADC instances, in case of different ADC internal channels mapped on same channel number on different ADC instances */
Kojto 122:f9eeca106725 204 #define ADC_CHANNEL_ID_INTERNAL_CH_MASK (ADC_CHANNEL_ID_INTERNAL_CH | ADC_CHANNEL_ID_INTERNAL_CH_2)
Kojto 122:f9eeca106725 205
Kojto 122:f9eeca106725 206 /* Internal register offset for ADC channel sampling time configuration */
Kojto 122:f9eeca106725 207 /* (offset placed into a spare area of literal definition) */
AnnaBridge 145:64910690c574 208 #define ADC_SMPR1_REGOFFSET (0x00000000U)
AnnaBridge 145:64910690c574 209 #define ADC_SMPR2_REGOFFSET (0x02000000U)
Kojto 122:f9eeca106725 210 #define ADC_CHANNEL_SMPRX_REGOFFSET_MASK (ADC_SMPR1_REGOFFSET | ADC_SMPR2_REGOFFSET)
Kojto 122:f9eeca106725 211
AnnaBridge 145:64910690c574 212 #define ADC_CHANNEL_SMPx_BITOFFSET_MASK (0x01F00000U)
AnnaBridge 145:64910690c574 213 #define ADC_CHANNEL_SMPx_BITOFFSET_POS (20U) /* Value equivalent to POSITION_VAL(ADC_CHANNEL_SMPx_BITOFFSET_MASK) */
Kojto 122:f9eeca106725 214
Kojto 122:f9eeca106725 215 /* Definition of channels ID number information to be inserted into */
Kojto 122:f9eeca106725 216 /* channels literals definition. */
AnnaBridge 145:64910690c574 217 #define ADC_CHANNEL_0_NUMBER (0x00000000U)
Kojto 122:f9eeca106725 218 #define ADC_CHANNEL_1_NUMBER ( ADC_CFGR_AWD1CH_0)
Kojto 122:f9eeca106725 219 #define ADC_CHANNEL_2_NUMBER ( ADC_CFGR_AWD1CH_1 )
Kojto 122:f9eeca106725 220 #define ADC_CHANNEL_3_NUMBER ( ADC_CFGR_AWD1CH_1 | ADC_CFGR_AWD1CH_0)
Kojto 122:f9eeca106725 221 #define ADC_CHANNEL_4_NUMBER ( ADC_CFGR_AWD1CH_2 )
Kojto 122:f9eeca106725 222 #define ADC_CHANNEL_5_NUMBER ( ADC_CFGR_AWD1CH_2 | ADC_CFGR_AWD1CH_0)
Kojto 122:f9eeca106725 223 #define ADC_CHANNEL_6_NUMBER ( ADC_CFGR_AWD1CH_2 | ADC_CFGR_AWD1CH_1 )
Kojto 122:f9eeca106725 224 #define ADC_CHANNEL_7_NUMBER ( ADC_CFGR_AWD1CH_2 | ADC_CFGR_AWD1CH_1 | ADC_CFGR_AWD1CH_0)
Kojto 122:f9eeca106725 225 #define ADC_CHANNEL_8_NUMBER ( ADC_CFGR_AWD1CH_3 )
Kojto 122:f9eeca106725 226 #define ADC_CHANNEL_9_NUMBER ( ADC_CFGR_AWD1CH_3 | ADC_CFGR_AWD1CH_0)
Kojto 122:f9eeca106725 227 #define ADC_CHANNEL_10_NUMBER ( ADC_CFGR_AWD1CH_3 | ADC_CFGR_AWD1CH_1 )
Kojto 122:f9eeca106725 228 #define ADC_CHANNEL_11_NUMBER ( ADC_CFGR_AWD1CH_3 | ADC_CFGR_AWD1CH_1 | ADC_CFGR_AWD1CH_0)
Kojto 122:f9eeca106725 229 #define ADC_CHANNEL_12_NUMBER ( ADC_CFGR_AWD1CH_3 | ADC_CFGR_AWD1CH_2 )
Kojto 122:f9eeca106725 230 #define ADC_CHANNEL_13_NUMBER ( ADC_CFGR_AWD1CH_3 | ADC_CFGR_AWD1CH_2 | ADC_CFGR_AWD1CH_0)
Kojto 122:f9eeca106725 231 #define ADC_CHANNEL_14_NUMBER ( ADC_CFGR_AWD1CH_3 | ADC_CFGR_AWD1CH_2 | ADC_CFGR_AWD1CH_1 )
Kojto 122:f9eeca106725 232 #define ADC_CHANNEL_15_NUMBER ( ADC_CFGR_AWD1CH_3 | ADC_CFGR_AWD1CH_2 | ADC_CFGR_AWD1CH_1 | ADC_CFGR_AWD1CH_0)
Kojto 122:f9eeca106725 233 #define ADC_CHANNEL_16_NUMBER (ADC_CFGR_AWD1CH_4 )
Kojto 122:f9eeca106725 234 #define ADC_CHANNEL_17_NUMBER (ADC_CFGR_AWD1CH_4 | ADC_CFGR_AWD1CH_0)
Kojto 122:f9eeca106725 235 #define ADC_CHANNEL_18_NUMBER (ADC_CFGR_AWD1CH_4 | ADC_CFGR_AWD1CH_1 )
Kojto 122:f9eeca106725 236
Kojto 122:f9eeca106725 237 /* Definition of channels ID bitfield information to be inserted into */
Kojto 122:f9eeca106725 238 /* channels literals definition. */
Kojto 122:f9eeca106725 239 #define ADC_CHANNEL_0_BITFIELD (ADC_AWD2CR_AWD2CH_0)
Kojto 122:f9eeca106725 240 #define ADC_CHANNEL_1_BITFIELD (ADC_AWD2CR_AWD2CH_1)
Kojto 122:f9eeca106725 241 #define ADC_CHANNEL_2_BITFIELD (ADC_AWD2CR_AWD2CH_2)
Kojto 122:f9eeca106725 242 #define ADC_CHANNEL_3_BITFIELD (ADC_AWD2CR_AWD2CH_3)
Kojto 122:f9eeca106725 243 #define ADC_CHANNEL_4_BITFIELD (ADC_AWD2CR_AWD2CH_4)
Kojto 122:f9eeca106725 244 #define ADC_CHANNEL_5_BITFIELD (ADC_AWD2CR_AWD2CH_5)
Kojto 122:f9eeca106725 245 #define ADC_CHANNEL_6_BITFIELD (ADC_AWD2CR_AWD2CH_6)
Kojto 122:f9eeca106725 246 #define ADC_CHANNEL_7_BITFIELD (ADC_AWD2CR_AWD2CH_7)
Kojto 122:f9eeca106725 247 #define ADC_CHANNEL_8_BITFIELD (ADC_AWD2CR_AWD2CH_8)
Kojto 122:f9eeca106725 248 #define ADC_CHANNEL_9_BITFIELD (ADC_AWD2CR_AWD2CH_9)
Kojto 122:f9eeca106725 249 #define ADC_CHANNEL_10_BITFIELD (ADC_AWD2CR_AWD2CH_10)
Kojto 122:f9eeca106725 250 #define ADC_CHANNEL_11_BITFIELD (ADC_AWD2CR_AWD2CH_11)
Kojto 122:f9eeca106725 251 #define ADC_CHANNEL_12_BITFIELD (ADC_AWD2CR_AWD2CH_12)
Kojto 122:f9eeca106725 252 #define ADC_CHANNEL_13_BITFIELD (ADC_AWD2CR_AWD2CH_13)
Kojto 122:f9eeca106725 253 #define ADC_CHANNEL_14_BITFIELD (ADC_AWD2CR_AWD2CH_14)
Kojto 122:f9eeca106725 254 #define ADC_CHANNEL_15_BITFIELD (ADC_AWD2CR_AWD2CH_15)
Kojto 122:f9eeca106725 255 #define ADC_CHANNEL_16_BITFIELD (ADC_AWD2CR_AWD2CH_16)
Kojto 122:f9eeca106725 256 #define ADC_CHANNEL_17_BITFIELD (ADC_AWD2CR_AWD2CH_17)
Kojto 122:f9eeca106725 257 #define ADC_CHANNEL_18_BITFIELD (ADC_AWD2CR_AWD2CH_18)
Kojto 122:f9eeca106725 258
Kojto 122:f9eeca106725 259 /* Definition of channels sampling time information to be inserted into */
Kojto 122:f9eeca106725 260 /* channels literals definition. */
AnnaBridge 145:64910690c574 261 #define ADC_CHANNEL_0_SMP (ADC_SMPR1_REGOFFSET | (( 0U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR1_SMP0) */
AnnaBridge 145:64910690c574 262 #define ADC_CHANNEL_1_SMP (ADC_SMPR1_REGOFFSET | (( 3U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR1_SMP1) */
AnnaBridge 145:64910690c574 263 #define ADC_CHANNEL_2_SMP (ADC_SMPR1_REGOFFSET | (( 6U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR1_SMP2) */
AnnaBridge 145:64910690c574 264 #define ADC_CHANNEL_3_SMP (ADC_SMPR1_REGOFFSET | (( 9U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR1_SMP3) */
AnnaBridge 145:64910690c574 265 #define ADC_CHANNEL_4_SMP (ADC_SMPR1_REGOFFSET | ((12U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR1_SMP4) */
AnnaBridge 145:64910690c574 266 #define ADC_CHANNEL_5_SMP (ADC_SMPR1_REGOFFSET | ((15U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR1_SMP5) */
AnnaBridge 145:64910690c574 267 #define ADC_CHANNEL_6_SMP (ADC_SMPR1_REGOFFSET | ((18U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR1_SMP6) */
AnnaBridge 145:64910690c574 268 #define ADC_CHANNEL_7_SMP (ADC_SMPR1_REGOFFSET | ((21U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR1_SMP7) */
AnnaBridge 145:64910690c574 269 #define ADC_CHANNEL_8_SMP (ADC_SMPR1_REGOFFSET | ((24U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR1_SMP8) */
AnnaBridge 145:64910690c574 270 #define ADC_CHANNEL_9_SMP (ADC_SMPR1_REGOFFSET | ((27U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR1_SMP9) */
AnnaBridge 145:64910690c574 271 #define ADC_CHANNEL_10_SMP (ADC_SMPR2_REGOFFSET | (( 0U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR2_SMP10) */
AnnaBridge 145:64910690c574 272 #define ADC_CHANNEL_11_SMP (ADC_SMPR2_REGOFFSET | (( 3U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR2_SMP11) */
AnnaBridge 145:64910690c574 273 #define ADC_CHANNEL_12_SMP (ADC_SMPR2_REGOFFSET | (( 6U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR2_SMP12) */
AnnaBridge 145:64910690c574 274 #define ADC_CHANNEL_13_SMP (ADC_SMPR2_REGOFFSET | (( 9U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR2_SMP13) */
AnnaBridge 145:64910690c574 275 #define ADC_CHANNEL_14_SMP (ADC_SMPR2_REGOFFSET | ((12U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR2_SMP14) */
AnnaBridge 145:64910690c574 276 #define ADC_CHANNEL_15_SMP (ADC_SMPR2_REGOFFSET | ((15U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR2_SMP15) */
AnnaBridge 145:64910690c574 277 #define ADC_CHANNEL_16_SMP (ADC_SMPR2_REGOFFSET | ((18U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR2_SMP16) */
AnnaBridge 145:64910690c574 278 #define ADC_CHANNEL_17_SMP (ADC_SMPR2_REGOFFSET | ((21U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR2_SMP17) */
AnnaBridge 145:64910690c574 279 #define ADC_CHANNEL_18_SMP (ADC_SMPR2_REGOFFSET | ((24U) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) /* Value shifted is equivalent to POSITION_VAL(ADC_SMPR2_SMP18) */
Kojto 122:f9eeca106725 280
Kojto 122:f9eeca106725 281
Kojto 122:f9eeca106725 282 /* Internal mask for ADC mode single or differential ended: */
Kojto 122:f9eeca106725 283 /* To select into literals LL_ADC_SINGLE_ENDED or LL_ADC_SINGLE_DIFFERENTIAL */
Kojto 122:f9eeca106725 284 /* the relevant bits for: */
Kojto 122:f9eeca106725 285 /* (concatenation of multiple bits used in different registers) */
Kojto 122:f9eeca106725 286 /* - ADC calibration: calibration start, calibration factor get or set */
Kojto 122:f9eeca106725 287 /* - ADC channels: set each ADC channel ending mode */
Kojto 122:f9eeca106725 288 #define ADC_SINGLEDIFF_CALIB_START_MASK (ADC_CR_ADCALDIF)
Kojto 122:f9eeca106725 289 #define ADC_SINGLEDIFF_CALIB_FACTOR_MASK (ADC_CALFACT_CALFACT_D | ADC_CALFACT_CALFACT_S)
Kojto 122:f9eeca106725 290 #define ADC_SINGLEDIFF_CHANNEL_MASK (ADC_CHANNEL_ID_BITFIELD_MASK) /* Equivalent to ADC_DIFSEL_DIFSEL */
Kojto 122:f9eeca106725 291 #define ADC_SINGLEDIFF_CHANNEL_SHIFT_MASK (ADC_CALFACT_CALFACT_S_5) /* Bit chosen to perform of shift when single mode is selected, shift value out of channels bits range. */
Kojto 122:f9eeca106725 292
Kojto 122:f9eeca106725 293
Kojto 122:f9eeca106725 294 /* Internal mask for ADC analog watchdog: */
Kojto 122:f9eeca106725 295 /* To select into literals LL_ADC_AWD_CHANNELx_xxx the relevant bits for: */
Kojto 122:f9eeca106725 296 /* (concatenation of multiple bits used in different analog watchdogs, */
Kojto 122:f9eeca106725 297 /* (feature of several watchdogs not available on all STM32 families)). */
Kojto 122:f9eeca106725 298 /* - analog watchdog 1: monitored channel defined by number, */
Kojto 122:f9eeca106725 299 /* selection of ADC group (ADC groups regular and-or injected). */
Kojto 122:f9eeca106725 300 /* - analog watchdog 2 and 3: monitored channel defined by bitfield, no */
Kojto 122:f9eeca106725 301 /* selection on groups. */
Kojto 122:f9eeca106725 302
Kojto 122:f9eeca106725 303 /* Internal register offset for ADC analog watchdog channel configuration */
AnnaBridge 145:64910690c574 304 #define ADC_AWD_CR1_REGOFFSET (0x00000000U)
AnnaBridge 145:64910690c574 305 #define ADC_AWD_CR2_REGOFFSET (0x00100000U)
AnnaBridge 145:64910690c574 306 #define ADC_AWD_CR3_REGOFFSET (0x00200000U)
Kojto 122:f9eeca106725 307
Kojto 122:f9eeca106725 308 /* Register offset gap between AWD1 and AWD2-AWD3 configuration registers */
Kojto 122:f9eeca106725 309 /* (Set separately as ADC_AWD_CRX_REGOFFSET to spare 32 bits space */
Kojto 122:f9eeca106725 310 #define ADC_AWD_CR12_REGOFFSETGAP_MASK (ADC_AWD2CR_AWD2CH_0)
AnnaBridge 145:64910690c574 311 #define ADC_AWD_CR12_REGOFFSETGAP_VAL (0x00000024U)
Kojto 122:f9eeca106725 312
Kojto 122:f9eeca106725 313 #define ADC_AWD_CRX_REGOFFSET_MASK (ADC_AWD_CR1_REGOFFSET | ADC_AWD_CR2_REGOFFSET | ADC_AWD_CR3_REGOFFSET)
Kojto 122:f9eeca106725 314
Kojto 122:f9eeca106725 315 #define ADC_AWD_CR1_CHANNEL_MASK (ADC_CFGR_AWD1CH | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL)
Kojto 122:f9eeca106725 316 #define ADC_AWD_CR23_CHANNEL_MASK (ADC_AWD2CR_AWD2CH)
Kojto 122:f9eeca106725 317 #define ADC_AWD_CR_ALL_CHANNEL_MASK (ADC_AWD_CR1_CHANNEL_MASK | ADC_AWD_CR23_CHANNEL_MASK)
Kojto 122:f9eeca106725 318
Kojto 122:f9eeca106725 319 /* Internal register offset for ADC analog watchdog threshold configuration */
Kojto 122:f9eeca106725 320 #define ADC_AWD_TR1_REGOFFSET (ADC_AWD_CR1_REGOFFSET)
Kojto 122:f9eeca106725 321 #define ADC_AWD_TR2_REGOFFSET (ADC_AWD_CR2_REGOFFSET)
Kojto 122:f9eeca106725 322 #define ADC_AWD_TR3_REGOFFSET (ADC_AWD_CR3_REGOFFSET)
Kojto 122:f9eeca106725 323 #define ADC_AWD_TRX_REGOFFSET_MASK (ADC_AWD_TR1_REGOFFSET | ADC_AWD_TR2_REGOFFSET | ADC_AWD_TR3_REGOFFSET)
Kojto 122:f9eeca106725 324
Kojto 122:f9eeca106725 325
Kojto 122:f9eeca106725 326 /* Internal mask for ADC offset: */
Kojto 122:f9eeca106725 327 /* Internal register offset for ADC offset number configuration */
AnnaBridge 145:64910690c574 328 #define ADC_OFR1_REGOFFSET (0x00000000U)
AnnaBridge 145:64910690c574 329 #define ADC_OFR2_REGOFFSET (0x00000001U)
AnnaBridge 145:64910690c574 330 #define ADC_OFR3_REGOFFSET (0x00000002U)
AnnaBridge 145:64910690c574 331 #define ADC_OFR4_REGOFFSET (0x00000003U)
Kojto 122:f9eeca106725 332 #define ADC_OFRx_REGOFFSET_MASK (ADC_OFR1_REGOFFSET | ADC_OFR2_REGOFFSET | ADC_OFR3_REGOFFSET | ADC_OFR4_REGOFFSET)
Kojto 122:f9eeca106725 333
Kojto 122:f9eeca106725 334
Kojto 122:f9eeca106725 335 /* ADC registers bits positions */
AnnaBridge 145:64910690c574 336 #define ADC_CFGR_RES_BITOFFSET_POS ( 3U) /* Value equivalent to POSITION_VAL(ADC_CFGR_RES) */
AnnaBridge 145:64910690c574 337 #define ADC_CFGR_AWD1SGL_BITOFFSET_POS (22U) /* Value equivalent to POSITION_VAL(ADC_CFGR_AWD1SGL) */
AnnaBridge 145:64910690c574 338 #define ADC_CFGR_AWD1EN_BITOFFSET_POS (23U) /* Value equivalent to POSITION_VAL(ADC_CFGR_AWD1EN) */
AnnaBridge 145:64910690c574 339 #define ADC_CFGR_JAWD1EN_BITOFFSET_POS (24U) /* Value equivalent to POSITION_VAL(ADC_CFGR_JAWD1EN) */
AnnaBridge 145:64910690c574 340 #define ADC_TR1_HT1_BITOFFSET_POS (16U) /* Value equivalent to POSITION_VAL(ADC_TR1_HT1) */
Kojto 122:f9eeca106725 341
Kojto 122:f9eeca106725 342
Kojto 122:f9eeca106725 343 /* ADC registers bits groups */
Kojto 122:f9eeca106725 344 #define ADC_CR_BITS_PROPERTY_RS (ADC_CR_ADCAL | ADC_CR_JADSTP | ADC_CR_ADSTP | ADC_CR_JADSTART | ADC_CR_ADSTART | ADC_CR_ADDIS | ADC_CR_ADEN) /* ADC register CR bits with HW property "rs": Software can read as well as set this bit. Writing '0' has no effect on the bit value. */
Kojto 122:f9eeca106725 345
Kojto 122:f9eeca106725 346
Kojto 122:f9eeca106725 347 /* ADC internal channels related definitions */
Kojto 122:f9eeca106725 348 /* Internal voltage reference VrefInt */
AnnaBridge 145:64910690c574 349 #define VREFINT_CAL_ADDR ((uint16_t*) (0x1FFF75AAU)) /* Internal voltage reference, address of parameter VREFINT_CAL: VrefInt ADC raw data acquired at temperature 30 DegC (tolerance: +-5 DegC), Vref+ = 3.0 V (tolerance: +-10 mV). */
AnnaBridge 145:64910690c574 350 #define VREFINT_CAL_VREF ( 3000U) /* Analog voltage reference (Vref+) value with which temperature sensor has been calibrated in production (tolerance: +-10 mV) (unit: mV). */
Kojto 122:f9eeca106725 351 /* Temperature sensor */
AnnaBridge 145:64910690c574 352 #define TEMPSENSOR_CAL1_ADDR ((uint16_t*) (0x1FFF75A8U)) /* Internal temperature sensor, address of parameter TS_CAL1: On STM32L4, temperature sensor ADC raw data acquired at temperature 30 DegC (tolerance: +-5 DegC), Vref+ = 3.0 V (tolerance: +-10 mV). */
AnnaBridge 145:64910690c574 353 #define TEMPSENSOR_CAL2_ADDR ((uint16_t*) (0x1FFF75CAU)) /* Internal temperature sensor, address of parameter TS_CAL2: On STM32L4, temperature sensor ADC raw data acquired at temperature 110 DegC (tolerance: +-5 DegC), Vref+ = 3.0 V (tolerance: +-10 mV). */
AnnaBridge 145:64910690c574 354 #define TEMPSENSOR_CAL1_TEMP (( int32_t) 30) /* Internal temperature sensor, temperature at which temperature sensor has been calibrated in production for data into TEMPSENSOR_CAL1_ADDR (tolerance: +-5 DegC) (unit: DegC). */
AnnaBridge 145:64910690c574 355 #define TEMPSENSOR_CAL2_TEMP (( int32_t) 110) /* Internal temperature sensor, temperature at which temperature sensor has been calibrated in production for data into TEMPSENSOR_CAL2_ADDR (tolerance: +-5 DegC) (unit: DegC). */
AnnaBridge 145:64910690c574 356 #define TEMPSENSOR_CAL_VREFANALOG ( 3000U) /* Analog voltage reference (Vref+) voltage with which temperature sensor has been calibrated in production (+-10 mV) (unit: mV). */
Kojto 122:f9eeca106725 357
Kojto 122:f9eeca106725 358
Kojto 122:f9eeca106725 359 /**
Kojto 122:f9eeca106725 360 * @}
Kojto 122:f9eeca106725 361 */
Kojto 122:f9eeca106725 362
Kojto 122:f9eeca106725 363
Kojto 122:f9eeca106725 364 /* Private macros ------------------------------------------------------------*/
Kojto 122:f9eeca106725 365 /** @defgroup ADC_LL_Private_Macros ADC Private Macros
Kojto 122:f9eeca106725 366 * @{
Kojto 122:f9eeca106725 367 */
Kojto 122:f9eeca106725 368
Kojto 122:f9eeca106725 369 /**
Kojto 122:f9eeca106725 370 * @brief Driver macro reserved for internal use: isolate bits with the
Kojto 122:f9eeca106725 371 * selected mask and shift them to the register LSB
Kojto 122:f9eeca106725 372 * (shift mask on register position bit 0).
Kojto 122:f9eeca106725 373 * @param __BITS__ Bits in register 32 bits
Kojto 122:f9eeca106725 374 * @param __MASK__ Mask in register 32 bits
Kojto 122:f9eeca106725 375 * @retval Bits in register 32 bits
Kojto 122:f9eeca106725 376 */
Kojto 122:f9eeca106725 377 #define __ADC_MASK_SHIFT(__BITS__, __MASK__) \
Kojto 122:f9eeca106725 378 (((__BITS__) & (__MASK__)) >> POSITION_VAL((__MASK__)))
Kojto 122:f9eeca106725 379
Kojto 122:f9eeca106725 380 /**
Kojto 122:f9eeca106725 381 * @brief Driver macro reserved for internal use: set a pointer to
Kojto 122:f9eeca106725 382 * a register from a register basis from which an offset
Kojto 122:f9eeca106725 383 * is applied.
Kojto 122:f9eeca106725 384 * @param __REG__ Register basis from which the offset is applied.
Kojto 122:f9eeca106725 385 * @param __REG_OFFFSET__ Offset to be applied (unit: number of registers).
Kojto 122:f9eeca106725 386 * @retval Pointer to register address
Kojto 122:f9eeca106725 387 */
Kojto 122:f9eeca106725 388 #define __ADC_PTR_REG_OFFSET(__REG__, __REG_OFFFSET__) \
Kojto 122:f9eeca106725 389 ((uint32_t *)((uint32_t) ((uint32_t)(&(__REG__)) + ((__REG_OFFFSET__) << 2U))))
Kojto 122:f9eeca106725 390
Kojto 122:f9eeca106725 391 /**
Kojto 122:f9eeca106725 392 * @}
Kojto 122:f9eeca106725 393 */
Kojto 122:f9eeca106725 394
Kojto 122:f9eeca106725 395
Kojto 122:f9eeca106725 396 /* Exported types ------------------------------------------------------------*/
Kojto 122:f9eeca106725 397 #if defined(USE_FULL_LL_DRIVER)
Kojto 122:f9eeca106725 398 /** @defgroup ADC_LL_ES_INIT ADC Exported Init structure
Kojto 122:f9eeca106725 399 * @{
Kojto 122:f9eeca106725 400 */
Kojto 122:f9eeca106725 401
Kojto 122:f9eeca106725 402 /**
Kojto 122:f9eeca106725 403 * @brief Structure definition of some features of ADC common parameters
Kojto 122:f9eeca106725 404 * and multimode
Kojto 122:f9eeca106725 405 * (all ADC instances belonging to the same ADC common instance).
Kojto 122:f9eeca106725 406 * @note The setting of these parameters by function @ref LL_ADC_CommonInit()
Kojto 122:f9eeca106725 407 * is conditioned to ADC instances state (all ADC instances
Kojto 122:f9eeca106725 408 * sharing the same ADC common instance):
Kojto 122:f9eeca106725 409 * All ADC instances sharing the same ADC common instance must be
Kojto 122:f9eeca106725 410 * disabled.
Kojto 122:f9eeca106725 411 */
Kojto 122:f9eeca106725 412 typedef struct
Kojto 122:f9eeca106725 413 {
Kojto 122:f9eeca106725 414 uint32_t CommonClock; /*!< Set parameter common to several ADC: Clock source and prescaler.
Kojto 122:f9eeca106725 415 This parameter can be a value of @ref ADC_LL_EC_COMMON_CLOCK_SOURCE
Kojto 122:f9eeca106725 416 @note On this STM32 serie, if ADC group injected is used, some
Kojto 122:f9eeca106725 417 clock ratio constraints between ADC clock and AHB clock
Kojto 122:f9eeca106725 418 must be respected. Refer to reference manual.
Kojto 122:f9eeca106725 419
Kojto 122:f9eeca106725 420 This feature can be modified afterwards using unitary function @ref LL_ADC_SetCommonClock(). */
Kojto 122:f9eeca106725 421
Kojto 122:f9eeca106725 422 #if defined(ADC_MULTIMODE_SUPPORT)
Kojto 122:f9eeca106725 423 uint32_t Multimode; /*!< Set ADC multimode configuration to operate in independent mode or multimode (for devices with several ADC instances).
Kojto 122:f9eeca106725 424 This parameter can be a value of @ref ADC_LL_EC_MULTI_MODE
Kojto 122:f9eeca106725 425
Kojto 122:f9eeca106725 426 This feature can be modified afterwards using unitary function @ref LL_ADC_SetMultimode(). */
Kojto 122:f9eeca106725 427
Kojto 122:f9eeca106725 428 uint32_t MultiDMATransfer; /*!< Set ADC multimode conversion data transfer: no transfer or transfer by DMA.
Kojto 122:f9eeca106725 429 This parameter can be a value of @ref ADC_LL_EC_MULTI_DMA_TRANSFER
Kojto 122:f9eeca106725 430
Kojto 122:f9eeca106725 431 This feature can be modified afterwards using unitary function @ref LL_ADC_SetMultiDMATransfer(). */
Kojto 122:f9eeca106725 432
Kojto 122:f9eeca106725 433 uint32_t MultiTwoSamplingDelay; /*!< Set ADC multimode delay between 2 sampling phases.
Kojto 122:f9eeca106725 434 This parameter can be a value of @ref ADC_LL_EC_MULTI_TWOSMP_DELAY
Kojto 122:f9eeca106725 435
Kojto 122:f9eeca106725 436 This feature can be modified afterwards using unitary function @ref LL_ADC_SetMultiTwoSamplingDelay(). */
Kojto 122:f9eeca106725 437 #endif /* ADC_MULTIMODE_SUPPORT */
Kojto 122:f9eeca106725 438
Kojto 122:f9eeca106725 439 } LL_ADC_CommonInitTypeDef;
Kojto 122:f9eeca106725 440
Kojto 122:f9eeca106725 441 /**
Kojto 122:f9eeca106725 442 * @brief Structure definition of some features of ADC instance.
Kojto 122:f9eeca106725 443 * @note These parameters have an impact on ADC scope: ADC instance.
Kojto 122:f9eeca106725 444 * Affects both group regular and group injected (availability
Kojto 122:f9eeca106725 445 * of ADC group injected depends on STM32 families).
Kojto 122:f9eeca106725 446 * Refer to corresponding unitary functions into
Kojto 122:f9eeca106725 447 * @ref ADC_LL_EF_Configuration_ADC_Instance .
Kojto 122:f9eeca106725 448 * @note The setting of these parameters by function @ref LL_ADC_Init()
Kojto 122:f9eeca106725 449 * is conditioned to ADC state:
Kojto 122:f9eeca106725 450 * ADC instance must be disabled.
Kojto 122:f9eeca106725 451 * This condition is applied to all ADC features, for efficiency
Kojto 122:f9eeca106725 452 * and compatibility over all STM32 families. However, the different
Kojto 122:f9eeca106725 453 * features can be set under different ADC state conditions
Kojto 122:f9eeca106725 454 * (setting possible with ADC enabled without conversion on going,
Kojto 122:f9eeca106725 455 * ADC enabled with conversion on going, ...)
Kojto 122:f9eeca106725 456 * Each feature can be updated afterwards with a unitary function
Kojto 122:f9eeca106725 457 * and potentially with ADC in a different state than disabled,
Kojto 122:f9eeca106725 458 * refer to description of each function for setting
Kojto 122:f9eeca106725 459 * conditioned to ADC state.
Kojto 122:f9eeca106725 460 */
Kojto 122:f9eeca106725 461 typedef struct
Kojto 122:f9eeca106725 462 {
Kojto 122:f9eeca106725 463 uint32_t Resolution; /*!< Set ADC resolution.
Kojto 122:f9eeca106725 464 This parameter can be a value of @ref ADC_LL_EC_RESOLUTION
Kojto 122:f9eeca106725 465
Kojto 122:f9eeca106725 466 This feature can be modified afterwards using unitary function @ref LL_ADC_SetResolution(). */
Kojto 122:f9eeca106725 467
Kojto 122:f9eeca106725 468 uint32_t DataAlignment; /*!< Set ADC conversion data alignment.
Kojto 122:f9eeca106725 469 This parameter can be a value of @ref ADC_LL_EC_DATA_ALIGN
Kojto 122:f9eeca106725 470
Kojto 122:f9eeca106725 471 This feature can be modified afterwards using unitary function @ref LL_ADC_SetDataAlignment(). */
Kojto 122:f9eeca106725 472
Kojto 122:f9eeca106725 473 uint32_t LowPowerMode; /*!< Set ADC low power mode.
Kojto 122:f9eeca106725 474 This parameter can be a value of @ref ADC_LL_EC_LP_MODE
Kojto 122:f9eeca106725 475
Kojto 122:f9eeca106725 476 This feature can be modified afterwards using unitary function @ref LL_ADC_SetLowPowerMode(). */
Kojto 122:f9eeca106725 477
Kojto 122:f9eeca106725 478 } LL_ADC_InitTypeDef;
Kojto 122:f9eeca106725 479
Kojto 122:f9eeca106725 480 /**
Kojto 122:f9eeca106725 481 * @brief Structure definition of some features of ADC group regular.
Kojto 122:f9eeca106725 482 * @note These parameters have an impact on ADC scope: ADC group regular.
Kojto 122:f9eeca106725 483 * Refer to corresponding unitary functions into
Kojto 122:f9eeca106725 484 * @ref ADC_LL_EF_Configuration_ADC_Group_Regular
Kojto 122:f9eeca106725 485 * (functions with prefix "REG").
Kojto 122:f9eeca106725 486 * @note The setting of these parameters by function @ref LL_ADC_REG_Init()
Kojto 122:f9eeca106725 487 * is conditioned to ADC state:
Kojto 122:f9eeca106725 488 * ADC instance must be disabled.
Kojto 122:f9eeca106725 489 * This condition is applied to all ADC features, for efficiency
Kojto 122:f9eeca106725 490 * and compatibility over all STM32 families. However, the different
Kojto 122:f9eeca106725 491 * features can be set under different ADC state conditions
Kojto 122:f9eeca106725 492 * (setting possible with ADC enabled without conversion on going,
Kojto 122:f9eeca106725 493 * ADC enabled with conversion on going, ...)
Kojto 122:f9eeca106725 494 * Each feature can be updated afterwards with a unitary function
Kojto 122:f9eeca106725 495 * and potentially with ADC in a different state than disabled,
Kojto 122:f9eeca106725 496 * refer to description of each function for setting
Kojto 122:f9eeca106725 497 * conditioned to ADC state.
Kojto 122:f9eeca106725 498 */
Kojto 122:f9eeca106725 499 typedef struct
Kojto 122:f9eeca106725 500 {
Kojto 122:f9eeca106725 501 uint32_t TriggerSource; /*!< Set ADC group regular conversion trigger source: internal (SW start) or from external IP (timer event, external interrupt line).
Kojto 122:f9eeca106725 502 This parameter can be a value of @ref ADC_LL_EC_REG_TRIGGER_SOURCE
Kojto 122:f9eeca106725 503 @note On this STM32 serie, setting trigger source to external trigger also set trigger polarity to rising edge
Kojto 122:f9eeca106725 504 (default setting for compatibility with some ADC on other STM32 families having this setting set by HW default value).
Kojto 122:f9eeca106725 505 In case of need to modify trigger edge, use function @ref LL_ADC_REG_SetTriggerEdge().
Kojto 122:f9eeca106725 506
Kojto 122:f9eeca106725 507 This feature can be modified afterwards using unitary function @ref LL_ADC_REG_SetTriggerSource(). */
Kojto 122:f9eeca106725 508
Kojto 122:f9eeca106725 509 uint32_t SequencerLength; /*!< Set ADC group regular sequencer length.
Kojto 122:f9eeca106725 510 This parameter can be a value of @ref ADC_LL_EC_REG_SEQ_SCAN_LENGTH
Kojto 122:f9eeca106725 511
Kojto 122:f9eeca106725 512 This feature can be modified afterwards using unitary function @ref LL_ADC_REG_SetSequencerLength(). */
Kojto 122:f9eeca106725 513
Kojto 122:f9eeca106725 514 uint32_t SequencerDiscont; /*!< Set ADC group regular sequencer discontinuous mode: sequence subdivided and scan conversions interrupted every selected number of ranks.
Kojto 122:f9eeca106725 515 This parameter can be a value of @ref ADC_LL_EC_REG_SEQ_DISCONT_MODE
Kojto 122:f9eeca106725 516 @note This parameter has an effect only if group regular sequencer is enabled
Kojto 122:f9eeca106725 517 (scan length of 2 ranks or more).
Kojto 122:f9eeca106725 518
Kojto 122:f9eeca106725 519 This feature can be modified afterwards using unitary function @ref LL_ADC_REG_SetSequencerDiscont(). */
Kojto 122:f9eeca106725 520
Kojto 122:f9eeca106725 521 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).
Kojto 122:f9eeca106725 522 This parameter can be a value of @ref ADC_LL_EC_REG_CONTINUOUS_MODE
Kojto 122:f9eeca106725 523 Note: It is not possible to enable both ADC group regular continuous mode and discontinuous mode.
Kojto 122:f9eeca106725 524
Kojto 122:f9eeca106725 525 This feature can be modified afterwards using unitary function @ref LL_ADC_REG_SetContinuousMode(). */
Kojto 122:f9eeca106725 526
Kojto 122:f9eeca106725 527 uint32_t DMATransfer; /*!< Set ADC group regular conversion data transfer: no transfer or transfer by DMA, and DMA requests mode.
Kojto 122:f9eeca106725 528 This parameter can be a value of @ref ADC_LL_EC_REG_DMA_TRANSFER
Kojto 122:f9eeca106725 529
Kojto 122:f9eeca106725 530 This feature can be modified afterwards using unitary function @ref LL_ADC_REG_SetDMATransfer(). */
Kojto 122:f9eeca106725 531
Kojto 122:f9eeca106725 532 uint32_t Overrun; /*!< Set ADC group regular behavior in case of overrun:
Kojto 122:f9eeca106725 533 data preserved or overwritten.
Kojto 122:f9eeca106725 534 This parameter can be a value of @ref ADC_LL_EC_REG_OVR_DATA_BEHAVIOR
Kojto 122:f9eeca106725 535
Kojto 122:f9eeca106725 536 This feature can be modified afterwards using unitary function @ref LL_ADC_REG_SetOverrun(). */
Kojto 122:f9eeca106725 537
Kojto 122:f9eeca106725 538 } LL_ADC_REG_InitTypeDef;
Kojto 122:f9eeca106725 539
Kojto 122:f9eeca106725 540 /**
Kojto 122:f9eeca106725 541 * @brief Structure definition of some features of ADC group injected.
Kojto 122:f9eeca106725 542 * @note These parameters have an impact on ADC scope: ADC group injected.
Kojto 122:f9eeca106725 543 * Refer to corresponding unitary functions into
Kojto 122:f9eeca106725 544 * @ref ADC_LL_EF_Configuration_ADC_Group_Regular
Kojto 122:f9eeca106725 545 * (functions with prefix "INJ").
Kojto 122:f9eeca106725 546 * @note The setting of these parameters by function @ref LL_ADC_INJ_Init()
Kojto 122:f9eeca106725 547 * is conditioned to ADC state:
Kojto 122:f9eeca106725 548 * ADC instance must be disabled.
Kojto 122:f9eeca106725 549 * This condition is applied to all ADC features, for efficiency
Kojto 122:f9eeca106725 550 * and compatibility over all STM32 families. However, the different
Kojto 122:f9eeca106725 551 * features can be set under different ADC state conditions
Kojto 122:f9eeca106725 552 * (setting possible with ADC enabled without conversion on going,
Kojto 122:f9eeca106725 553 * ADC enabled with conversion on going, ...)
Kojto 122:f9eeca106725 554 * Each feature can be updated afterwards with a unitary function
Kojto 122:f9eeca106725 555 * and potentially with ADC in a different state than disabled,
Kojto 122:f9eeca106725 556 * refer to description of each function for setting
Kojto 122:f9eeca106725 557 * conditioned to ADC state.
Kojto 122:f9eeca106725 558 */
Kojto 122:f9eeca106725 559 typedef struct
Kojto 122:f9eeca106725 560 {
Kojto 122:f9eeca106725 561 uint32_t TriggerSource; /*!< Set ADC group injected conversion trigger source: internal (SW start) or from external IP (timer event, external interrupt line).
Kojto 122:f9eeca106725 562 This parameter can be a value of @ref ADC_LL_EC_INJ_TRIGGER_SOURCE
Kojto 122:f9eeca106725 563 @note On this STM32 serie, setting trigger source to external trigger also set trigger polarity to rising edge
Kojto 122:f9eeca106725 564 (default setting for compatibility with some ADC on other STM32 families having this setting set by HW default value).
Kojto 122:f9eeca106725 565 In case of need to modify trigger edge, use function @ref LL_ADC_INJ_SetTriggerEdge().
Kojto 122:f9eeca106725 566
Kojto 122:f9eeca106725 567 This feature can be modified afterwards using unitary function @ref LL_ADC_INJ_SetTriggerSource(). */
Kojto 122:f9eeca106725 568
Kojto 122:f9eeca106725 569 uint32_t SequencerLength; /*!< Set ADC group injected sequencer length.
Kojto 122:f9eeca106725 570 This parameter can be a value of @ref ADC_LL_EC_INJ_SEQ_SCAN_LENGTH
Kojto 122:f9eeca106725 571
Kojto 122:f9eeca106725 572 This feature can be modified afterwards using unitary function @ref LL_ADC_INJ_SetSequencerLength(). */
Kojto 122:f9eeca106725 573
Kojto 122:f9eeca106725 574 uint32_t SequencerDiscont; /*!< Set ADC group injected sequencer discontinuous mode: sequence subdivided and scan conversions interrupted every selected number of ranks.
Kojto 122:f9eeca106725 575 This parameter can be a value of @ref ADC_LL_EC_INJ_SEQ_DISCONT_MODE
Kojto 122:f9eeca106725 576 @note This parameter has an effect only if group injected sequencer is enabled
Kojto 122:f9eeca106725 577 (scan length of 2 ranks or more).
Kojto 122:f9eeca106725 578
Kojto 122:f9eeca106725 579 This feature can be modified afterwards using unitary function @ref LL_ADC_INJ_SetSequencerDiscont(). */
Kojto 122:f9eeca106725 580
Kojto 122:f9eeca106725 581 uint32_t TrigAuto; /*!< Set ADC group injected conversion trigger: independent or from ADC group regular.
Kojto 122:f9eeca106725 582 This parameter can be a value of @ref ADC_LL_EC_INJ_TRIG_AUTO
Kojto 122:f9eeca106725 583 Note: This parameter must be set to set to independent trigger if injected trigger source is set to an external trigger.
Kojto 122:f9eeca106725 584
Kojto 122:f9eeca106725 585 This feature can be modified afterwards using unitary function @ref LL_ADC_INJ_SetTrigAuto(). */
Kojto 122:f9eeca106725 586
Kojto 122:f9eeca106725 587 } LL_ADC_INJ_InitTypeDef;
Kojto 122:f9eeca106725 588
Kojto 122:f9eeca106725 589 /**
Kojto 122:f9eeca106725 590 * @}
Kojto 122:f9eeca106725 591 */
Kojto 122:f9eeca106725 592 #endif /* USE_FULL_LL_DRIVER */
Kojto 122:f9eeca106725 593
Kojto 122:f9eeca106725 594 /* Exported constants --------------------------------------------------------*/
Kojto 122:f9eeca106725 595 /** @defgroup ADC_LL_Exported_Constants ADC Exported Constants
Kojto 122:f9eeca106725 596 * @{
Kojto 122:f9eeca106725 597 */
Kojto 122:f9eeca106725 598
Kojto 122:f9eeca106725 599 /** @defgroup ADC_LL_EC_FLAG ADC flags
Kojto 122:f9eeca106725 600 * @brief Flags defines which can be used with LL_ADC_ReadReg function
Kojto 122:f9eeca106725 601 * @{
Kojto 122:f9eeca106725 602 */
Kojto 122:f9eeca106725 603 #define LL_ADC_FLAG_ADRDY ADC_ISR_ADRDY /*!< ADC flag ADC instance ready */
Kojto 122:f9eeca106725 604 #define LL_ADC_FLAG_EOC ADC_ISR_EOC /*!< ADC flag ADC group regular end of unitary conversion */
Kojto 122:f9eeca106725 605 #define LL_ADC_FLAG_EOS ADC_ISR_EOS /*!< ADC flag ADC group regular end of sequence conversions */
Kojto 122:f9eeca106725 606 #define LL_ADC_FLAG_OVR ADC_ISR_OVR /*!< ADC flag ADC group regular overrun */
Kojto 122:f9eeca106725 607 #define LL_ADC_FLAG_EOSMP ADC_ISR_EOSMP /*!< ADC flag ADC group regular end of sampling phase */
Kojto 122:f9eeca106725 608 #define LL_ADC_FLAG_JEOC ADC_ISR_JEOC /*!< ADC flag ADC group injected end of unitary conversion */
Kojto 122:f9eeca106725 609 #define LL_ADC_FLAG_JEOS ADC_ISR_JEOS /*!< ADC flag ADC group injected end of sequence conversions */
Kojto 122:f9eeca106725 610 #define LL_ADC_FLAG_JQOVF ADC_ISR_JQOVF /*!< ADC flag ADC group injected contexts queue overflow */
Kojto 122:f9eeca106725 611 #define LL_ADC_FLAG_AWD1 ADC_ISR_AWD1 /*!< ADC flag ADC analog watchdog 1 */
Kojto 122:f9eeca106725 612 #define LL_ADC_FLAG_AWD2 ADC_ISR_AWD2 /*!< ADC flag ADC analog watchdog 2 */
Kojto 122:f9eeca106725 613 #define LL_ADC_FLAG_AWD3 ADC_ISR_AWD3 /*!< ADC flag ADC analog watchdog 3 */
Kojto 122:f9eeca106725 614 #if defined(ADC_MULTIMODE_SUPPORT)
Kojto 122:f9eeca106725 615 #define LL_ADC_FLAG_ADRDY_MST ADC_CSR_ADRDY_MST /*!< ADC flag ADC multimode master instance ready */
Kojto 122:f9eeca106725 616 #define LL_ADC_FLAG_ADRDY_SLV ADC_CSR_ADRDY_SLV /*!< ADC flag ADC multimode slave instance ready */
Kojto 122:f9eeca106725 617 #define LL_ADC_FLAG_EOC_MST ADC_CSR_EOC_MST /*!< ADC flag ADC multimode master group regular end of unitary conversion */
Kojto 122:f9eeca106725 618 #define LL_ADC_FLAG_EOC_SLV ADC_CSR_EOC_SLV /*!< ADC flag ADC multimode slave group regular end of unitary conversion */
Kojto 122:f9eeca106725 619 #define LL_ADC_FLAG_EOS_MST ADC_CSR_EOS_MST /*!< ADC flag ADC multimode master group regular end of sequence conversions */
Kojto 122:f9eeca106725 620 #define LL_ADC_FLAG_EOS_SLV ADC_CSR_EOS_SLV /*!< ADC flag ADC multimode slave group regular end of sequence conversions */
Kojto 122:f9eeca106725 621 #define LL_ADC_FLAG_OVR_MST ADC_CSR_OVR_MST /*!< ADC flag ADC multimode master group regular overrun */
Kojto 122:f9eeca106725 622 #define LL_ADC_FLAG_OVR_SLV ADC_CSR_OVR_SLV /*!< ADC flag ADC multimode slave group regular overrun */
Kojto 122:f9eeca106725 623 #define LL_ADC_FLAG_EOSMP_MST ADC_CSR_EOSMP_MST /*!< ADC flag ADC multimode master group regular end of sampling phase */
Kojto 122:f9eeca106725 624 #define LL_ADC_FLAG_EOSMP_SLV ADC_CSR_EOSMP_SLV /*!< ADC flag ADC multimode slave group regular end of sampling phase */
Kojto 122:f9eeca106725 625 #define LL_ADC_FLAG_JEOC_MST ADC_CSR_JEOC_MST /*!< ADC flag ADC multimode master group injected end of unitary conversion */
Kojto 122:f9eeca106725 626 #define LL_ADC_FLAG_JEOC_SLV ADC_CSR_JEOC_SLV /*!< ADC flag ADC multimode slave group injected end of unitary conversion */
Kojto 122:f9eeca106725 627 #define LL_ADC_FLAG_JEOS_MST ADC_CSR_JEOS_MST /*!< ADC flag ADC multimode master group injected end of sequence conversions */
Kojto 122:f9eeca106725 628 #define LL_ADC_FLAG_JEOS_SLV ADC_CSR_JEOS_SLV /*!< ADC flag ADC multimode slave group injected end of sequence conversions */
Kojto 122:f9eeca106725 629 #define LL_ADC_FLAG_JQOVF_MST ADC_CSR_JQOVF_MST /*!< ADC flag ADC multimode master group injected contexts queue overflow */
Kojto 122:f9eeca106725 630 #define LL_ADC_FLAG_JQOVF_SLV ADC_CSR_JQOVF_SLV /*!< ADC flag ADC multimode slave group injected contexts queue overflow */
Kojto 122:f9eeca106725 631 #define LL_ADC_FLAG_AWD1_MST ADC_CSR_AWD1_MST /*!< ADC flag ADC multimode master analog watchdog 1 of the ADC master */
Kojto 122:f9eeca106725 632 #define LL_ADC_FLAG_AWD1_SLV ADC_CSR_AWD1_SLV /*!< ADC flag ADC multimode slave analog watchdog 1 of the ADC slave */
Kojto 122:f9eeca106725 633 #define LL_ADC_FLAG_AWD2_MST ADC_CSR_AWD2_MST /*!< ADC flag ADC multimode master analog watchdog 2 of the ADC master */
Kojto 122:f9eeca106725 634 #define LL_ADC_FLAG_AWD2_SLV ADC_CSR_AWD2_SLV /*!< ADC flag ADC multimode slave analog watchdog 2 of the ADC slave */
Kojto 122:f9eeca106725 635 #define LL_ADC_FLAG_AWD3_MST ADC_CSR_AWD3_MST /*!< ADC flag ADC multimode master analog watchdog 3 of the ADC master */
Kojto 122:f9eeca106725 636 #define LL_ADC_FLAG_AWD3_SLV ADC_CSR_AWD3_SLV /*!< ADC flag ADC multimode slave analog watchdog 3 of the ADC slave */
Kojto 122:f9eeca106725 637 #endif
Kojto 122:f9eeca106725 638 /**
Kojto 122:f9eeca106725 639 * @}
Kojto 122:f9eeca106725 640 */
Kojto 122:f9eeca106725 641
Kojto 122:f9eeca106725 642 /** @defgroup ADC_LL_EC_IT ADC interruptions for configuration (interruption enable or disable)
Kojto 122:f9eeca106725 643 * @brief IT defines which can be used with LL_ADC_ReadReg and LL_ADC_WriteReg functions
Kojto 122:f9eeca106725 644 * @{
Kojto 122:f9eeca106725 645 */
Kojto 122:f9eeca106725 646 #define LL_ADC_IT_ADRDY ADC_IER_ADRDYIE /*!< ADC interruption ADC instance ready */
Kojto 122:f9eeca106725 647 #define LL_ADC_IT_EOC ADC_IER_EOCIE /*!< ADC interruption ADC group regular end of unitary conversion */
Kojto 122:f9eeca106725 648 #define LL_ADC_IT_EOS ADC_IER_EOSIE /*!< ADC interruption ADC group regular end of sequence conversions */
Kojto 122:f9eeca106725 649 #define LL_ADC_IT_OVR ADC_IER_OVRIE /*!< ADC interruption ADC group regular overrun */
Kojto 122:f9eeca106725 650 #define LL_ADC_IT_EOSMP ADC_IER_EOSMPIE /*!< ADC interruption ADC group regular end of sampling phase */
Kojto 122:f9eeca106725 651 #define LL_ADC_IT_JEOC ADC_IER_JEOCIE /*!< ADC interruption ADC group injected end of unitary conversion */
Kojto 122:f9eeca106725 652 #define LL_ADC_IT_JEOS ADC_IER_JEOSIE /*!< ADC interruption ADC group injected end of sequence conversions */
Kojto 122:f9eeca106725 653 #define LL_ADC_IT_JQOVF ADC_IER_JQOVFIE /*!< ADC interruption ADC group injected contexts queue overflow */
Kojto 122:f9eeca106725 654 #define LL_ADC_IT_AWD1 ADC_IER_AWD1IE /*!< ADC interruption ADC analog watchdog 1 */
Kojto 122:f9eeca106725 655 #define LL_ADC_IT_AWD2 ADC_IER_AWD2IE /*!< ADC interruption ADC analog watchdog 2 */
Kojto 122:f9eeca106725 656 #define LL_ADC_IT_AWD3 ADC_IER_AWD3IE /*!< ADC interruption ADC analog watchdog 3 */
Kojto 122:f9eeca106725 657 /**
Kojto 122:f9eeca106725 658 * @}
Kojto 122:f9eeca106725 659 */
Kojto 122:f9eeca106725 660
Kojto 122:f9eeca106725 661 /** @defgroup ADC_LL_EC_REGISTERS ADC registers compliant with specific purpose
Kojto 122:f9eeca106725 662 * @{
Kojto 122:f9eeca106725 663 */
Kojto 122:f9eeca106725 664 /* List of ADC registers intended to be used (most commonly) with */
Kojto 122:f9eeca106725 665 /* DMA transfer. */
Kojto 122:f9eeca106725 666 /* Refer to function @ref LL_ADC_DMA_GetRegAddr(). */
AnnaBridge 145:64910690c574 667 #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() */
Kojto 122:f9eeca106725 668 #if defined(ADC_MULTIMODE_SUPPORT)
AnnaBridge 145:64910690c574 669 #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() */
Kojto 122:f9eeca106725 670 #endif
Kojto 122:f9eeca106725 671 /**
Kojto 122:f9eeca106725 672 * @}
Kojto 122:f9eeca106725 673 */
Kojto 122:f9eeca106725 674
Kojto 122:f9eeca106725 675 /** @defgroup ADC_LL_EC_COMMON_CLOCK_SOURCE ADC common - Clock source
Kojto 122:f9eeca106725 676 * @{
Kojto 122:f9eeca106725 677 */
Kojto 122:f9eeca106725 678 #define LL_ADC_CLOCK_SYNC_PCLK_DIV1 (ADC_CCR_CKMODE_0) /*!< ADC synchronous clock derived from AHB clock without prescaler */
Kojto 122:f9eeca106725 679 #define LL_ADC_CLOCK_SYNC_PCLK_DIV2 (ADC_CCR_CKMODE_1 ) /*!< ADC synchronous clock derived from AHB clock with prescaler division by 2 */
Kojto 122:f9eeca106725 680 #define LL_ADC_CLOCK_SYNC_PCLK_DIV4 (ADC_CCR_CKMODE_1 | ADC_CCR_CKMODE_0) /*!< ADC synchronous clock derived from AHB clock with prescaler division by 4 */
AnnaBridge 145:64910690c574 681 #define LL_ADC_CLOCK_ASYNC_DIV1 (0x00000000U) /*!< ADC asynchronous clock without prescaler */
Kojto 122:f9eeca106725 682 #define LL_ADC_CLOCK_ASYNC_DIV2 (ADC_CCR_PRESC_0) /*!< ADC asynchronous clock with prescaler division by 2 */
Kojto 122:f9eeca106725 683 #define LL_ADC_CLOCK_ASYNC_DIV4 (ADC_CCR_PRESC_1 ) /*!< ADC asynchronous clock with prescaler division by 4 */
Kojto 122:f9eeca106725 684 #define LL_ADC_CLOCK_ASYNC_DIV6 (ADC_CCR_PRESC_1 | ADC_CCR_PRESC_0) /*!< ADC asynchronous clock with prescaler division by 6 */
Kojto 122:f9eeca106725 685 #define LL_ADC_CLOCK_ASYNC_DIV8 (ADC_CCR_PRESC_2 ) /*!< ADC asynchronous clock with prescaler division by 8 */
Kojto 122:f9eeca106725 686 #define LL_ADC_CLOCK_ASYNC_DIV10 (ADC_CCR_PRESC_2 | ADC_CCR_PRESC_0) /*!< ADC asynchronous clock with prescaler division by 10 */
Kojto 122:f9eeca106725 687 #define LL_ADC_CLOCK_ASYNC_DIV12 (ADC_CCR_PRESC_2 | ADC_CCR_PRESC_1 ) /*!< ADC asynchronous clock with prescaler division by 12 */
Kojto 122:f9eeca106725 688 #define LL_ADC_CLOCK_ASYNC_DIV16 (ADC_CCR_PRESC_2 | ADC_CCR_PRESC_1 | ADC_CCR_PRESC_0) /*!< ADC asynchronous clock with prescaler division by 16 */
Kojto 122:f9eeca106725 689 #define LL_ADC_CLOCK_ASYNC_DIV32 (ADC_CCR_PRESC_3) /*!< ADC asynchronous clock with prescaler division by 32 */
Kojto 122:f9eeca106725 690 #define LL_ADC_CLOCK_ASYNC_DIV64 (ADC_CCR_PRESC_3 | ADC_CCR_PRESC_0) /*!< ADC asynchronous clock with prescaler division by 64 */
Kojto 122:f9eeca106725 691 #define LL_ADC_CLOCK_ASYNC_DIV128 (ADC_CCR_PRESC_3 | ADC_CCR_PRESC_1) /*!< ADC asynchronous clock with prescaler division by 128 */
Kojto 122:f9eeca106725 692 #define LL_ADC_CLOCK_ASYNC_DIV256 (ADC_CCR_PRESC_3 | ADC_CCR_PRESC_1 | ADC_CCR_PRESC_0) /*!< ADC asynchronous clock with prescaler division by 256 */
Kojto 122:f9eeca106725 693 /**
Kojto 122:f9eeca106725 694 * @}
Kojto 122:f9eeca106725 695 */
Kojto 122:f9eeca106725 696
Kojto 122:f9eeca106725 697 /** @defgroup ADC_LL_EC_COMMON_PATH_INTERNAL ADC common - Measurement path to internal channels
Kojto 122:f9eeca106725 698 * @{
Kojto 122:f9eeca106725 699 */
Kojto 122:f9eeca106725 700 /* Note: Other measurement paths to internal channels may be available */
Kojto 122:f9eeca106725 701 /* (connections to other peripherals). */
Kojto 122:f9eeca106725 702 /* If they are not listed below, they do not require any specific */
Kojto 122:f9eeca106725 703 /* path enable. In this case, Access to measurement path is done */
Kojto 122:f9eeca106725 704 /* only by selecting the corresponding ADC internal channel. */
AnnaBridge 145:64910690c574 705 #define LL_ADC_PATH_INTERNAL_NONE (0x00000000U)/*!< ADC measurement pathes all disabled */
Kojto 122:f9eeca106725 706 #define LL_ADC_PATH_INTERNAL_VREFINT (ADC_CCR_VREFEN) /*!< ADC measurement path to internal channel VrefInt */
Kojto 122:f9eeca106725 707 #define LL_ADC_PATH_INTERNAL_TEMPSENSOR (ADC_CCR_TSEN) /*!< ADC measurement path to internal channel temperature sensor */
Kojto 122:f9eeca106725 708 #define LL_ADC_PATH_INTERNAL_VBAT (ADC_CCR_VBATEN) /*!< ADC measurement path to internal channel Vbat */
Kojto 122:f9eeca106725 709 /**
Kojto 122:f9eeca106725 710 * @}
Kojto 122:f9eeca106725 711 */
Kojto 122:f9eeca106725 712
Kojto 122:f9eeca106725 713 /** @defgroup ADC_LL_EC_RESOLUTION ADC instance - Resolution
Kojto 122:f9eeca106725 714 * @{
Kojto 122:f9eeca106725 715 */
AnnaBridge 145:64910690c574 716 #define LL_ADC_RESOLUTION_12B (0x00000000U) /*!< ADC resolution 12 bits */
Kojto 122:f9eeca106725 717 #define LL_ADC_RESOLUTION_10B ( ADC_CFGR_RES_0) /*!< ADC resolution 10 bits */
Kojto 122:f9eeca106725 718 #define LL_ADC_RESOLUTION_8B (ADC_CFGR_RES_1 ) /*!< ADC resolution 8 bits */
Kojto 122:f9eeca106725 719 #define LL_ADC_RESOLUTION_6B (ADC_CFGR_RES_1 | ADC_CFGR_RES_0) /*!< ADC resolution 6 bits */
Kojto 122:f9eeca106725 720 /**
Kojto 122:f9eeca106725 721 * @}
Kojto 122:f9eeca106725 722 */
Kojto 122:f9eeca106725 723
Kojto 122:f9eeca106725 724 /** @defgroup ADC_LL_EC_DATA_ALIGN ADC instance - Data alignment
Kojto 122:f9eeca106725 725 * @{
Kojto 122:f9eeca106725 726 */
AnnaBridge 145:64910690c574 727 #define LL_ADC_DATA_ALIGN_RIGHT (0x00000000U)/*!< ADC conversion data alignment: right aligned (alignment on data register LSB bit 0)*/
Kojto 122:f9eeca106725 728 #define LL_ADC_DATA_ALIGN_LEFT (ADC_CFGR_ALIGN) /*!< ADC conversion data alignment: left aligned (aligment on data register MSB bit 15)*/
Kojto 122:f9eeca106725 729 /**
Kojto 122:f9eeca106725 730 * @}
Kojto 122:f9eeca106725 731 */
Kojto 122:f9eeca106725 732
Kojto 122:f9eeca106725 733 /** @defgroup ADC_LL_EC_LP_MODE ADC instance - Low power mode
Kojto 122:f9eeca106725 734 * @{
Kojto 122:f9eeca106725 735 */
AnnaBridge 145:64910690c574 736 #define LL_ADC_LP_MODE_NONE (0x00000000U) /*!< No ADC low power mode activated */
Kojto 122:f9eeca106725 737 #define LL_ADC_LP_AUTOWAIT (ADC_CFGR_AUTDLY) /*!< ADC low power mode auto delay: Dynamic low power mode, ADC conversions are performed only when necessary (when previous ADC conversion data is read). See description with function @ref LL_ADC_SetLowPowerMode(). */
Kojto 122:f9eeca106725 738 /**
Kojto 122:f9eeca106725 739 * @}
Kojto 122:f9eeca106725 740 */
Kojto 122:f9eeca106725 741
Kojto 122:f9eeca106725 742 /** @defgroup ADC_LL_EC_OFFSET_NB ADC instance - Offset number
Kojto 122:f9eeca106725 743 * @{
Kojto 122:f9eeca106725 744 */
Kojto 122:f9eeca106725 745 #define LL_ADC_OFFSET_1 ADC_OFR1_REGOFFSET /*!< ADC offset number 1: ADC channel and offset level to which the offset programmed will be applied (independently of channel mapped on ADC group regular or group injected) */
Kojto 122:f9eeca106725 746 #define LL_ADC_OFFSET_2 ADC_OFR2_REGOFFSET /*!< ADC offset number 2: ADC channel and offset level to which the offset programmed will be applied (independently of channel mapped on ADC group regular or group injected) */
Kojto 122:f9eeca106725 747 #define LL_ADC_OFFSET_3 ADC_OFR3_REGOFFSET /*!< ADC offset number 3: ADC channel and offset level to which the offset programmed will be applied (independently of channel mapped on ADC group regular or group injected) */
Kojto 122:f9eeca106725 748 #define LL_ADC_OFFSET_4 ADC_OFR4_REGOFFSET /*!< ADC offset number 4: ADC channel and offset level to which the offset programmed will be applied (independently of channel mapped on ADC group regular or group injected) */
Kojto 122:f9eeca106725 749 /**
Kojto 122:f9eeca106725 750 * @}
Kojto 122:f9eeca106725 751 */
Kojto 122:f9eeca106725 752
Kojto 122:f9eeca106725 753 /** @defgroup ADC_LL_EC_OFFSET_STATE ADC instance - Offset state
Kojto 122:f9eeca106725 754 * @{
Kojto 122:f9eeca106725 755 */
AnnaBridge 145:64910690c574 756 #define LL_ADC_OFFSET_DISABLE (0x00000000U)/*!< ADC offset disabled (among ADC selected offset number 1, 2, 3 or 4) */
Kojto 122:f9eeca106725 757 #define LL_ADC_OFFSET_ENABLE (ADC_OFR1_OFFSET1_EN) /*!< ADC offset enabled (among ADC selected offset number 1, 2, 3 or 4) */
Kojto 122:f9eeca106725 758 /**
Kojto 122:f9eeca106725 759 * @}
Kojto 122:f9eeca106725 760 */
Kojto 122:f9eeca106725 761
Kojto 122:f9eeca106725 762 /** @defgroup ADC_LL_EC_GROUPS ADC instance - Groups
Kojto 122:f9eeca106725 763 * @{
Kojto 122:f9eeca106725 764 */
AnnaBridge 145:64910690c574 765 #define LL_ADC_GROUP_REGULAR (0x00000001U) /*!< ADC group regular (available on all STM32 devices) */
AnnaBridge 145:64910690c574 766 #define LL_ADC_GROUP_INJECTED (0x00000002U) /*!< ADC group injected (not available on all STM32 devices)*/
AnnaBridge 145:64910690c574 767 #define LL_ADC_GROUP_REGULAR_INJECTED (0x00000003U) /*!< ADC both groups regular and injected */
Kojto 122:f9eeca106725 768 /**
Kojto 122:f9eeca106725 769 * @}
Kojto 122:f9eeca106725 770 */
Kojto 122:f9eeca106725 771
Kojto 122:f9eeca106725 772 /** @defgroup ADC_LL_EC_CHANNEL ADC instance - Channel number
Kojto 122:f9eeca106725 773 * @{
Kojto 122:f9eeca106725 774 */
Kojto 122:f9eeca106725 775 #define LL_ADC_CHANNEL_0 (ADC_CHANNEL_0_NUMBER | ADC_CHANNEL_0_SMP | ADC_CHANNEL_0_BITFIELD ) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN0 */
Kojto 122:f9eeca106725 776 #define LL_ADC_CHANNEL_1 (ADC_CHANNEL_1_NUMBER | ADC_CHANNEL_1_SMP | ADC_CHANNEL_1_BITFIELD ) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN1 */
Kojto 122:f9eeca106725 777 #define LL_ADC_CHANNEL_2 (ADC_CHANNEL_2_NUMBER | ADC_CHANNEL_2_SMP | ADC_CHANNEL_2_BITFIELD ) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN2 */
Kojto 122:f9eeca106725 778 #define LL_ADC_CHANNEL_3 (ADC_CHANNEL_3_NUMBER | ADC_CHANNEL_3_SMP | ADC_CHANNEL_3_BITFIELD ) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN3 */
Kojto 122:f9eeca106725 779 #define LL_ADC_CHANNEL_4 (ADC_CHANNEL_4_NUMBER | ADC_CHANNEL_4_SMP | ADC_CHANNEL_4_BITFIELD ) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN4 */
Kojto 122:f9eeca106725 780 #define LL_ADC_CHANNEL_5 (ADC_CHANNEL_5_NUMBER | ADC_CHANNEL_5_SMP | ADC_CHANNEL_5_BITFIELD ) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN5 */
Kojto 122:f9eeca106725 781 #define LL_ADC_CHANNEL_6 (ADC_CHANNEL_6_NUMBER | ADC_CHANNEL_6_SMP | ADC_CHANNEL_6_BITFIELD ) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN6 */
Kojto 122:f9eeca106725 782 #define LL_ADC_CHANNEL_7 (ADC_CHANNEL_7_NUMBER | ADC_CHANNEL_7_SMP | ADC_CHANNEL_7_BITFIELD ) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN7 */
Kojto 122:f9eeca106725 783 #define LL_ADC_CHANNEL_8 (ADC_CHANNEL_8_NUMBER | ADC_CHANNEL_8_SMP | ADC_CHANNEL_8_BITFIELD ) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN8 */
Kojto 122:f9eeca106725 784 #define LL_ADC_CHANNEL_9 (ADC_CHANNEL_9_NUMBER | ADC_CHANNEL_9_SMP | ADC_CHANNEL_9_BITFIELD ) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN9 */
Kojto 122:f9eeca106725 785 #define LL_ADC_CHANNEL_10 (ADC_CHANNEL_10_NUMBER | ADC_CHANNEL_10_SMP | ADC_CHANNEL_10_BITFIELD) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN10 */
Kojto 122:f9eeca106725 786 #define LL_ADC_CHANNEL_11 (ADC_CHANNEL_11_NUMBER | ADC_CHANNEL_11_SMP | ADC_CHANNEL_11_BITFIELD) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN11 */
Kojto 122:f9eeca106725 787 #define LL_ADC_CHANNEL_12 (ADC_CHANNEL_12_NUMBER | ADC_CHANNEL_12_SMP | ADC_CHANNEL_12_BITFIELD) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN12 */
Kojto 122:f9eeca106725 788 #define LL_ADC_CHANNEL_13 (ADC_CHANNEL_13_NUMBER | ADC_CHANNEL_13_SMP | ADC_CHANNEL_13_BITFIELD) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN13 */
Kojto 122:f9eeca106725 789 #define LL_ADC_CHANNEL_14 (ADC_CHANNEL_14_NUMBER | ADC_CHANNEL_14_SMP | ADC_CHANNEL_14_BITFIELD) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN14 */
Kojto 122:f9eeca106725 790 #define LL_ADC_CHANNEL_15 (ADC_CHANNEL_15_NUMBER | ADC_CHANNEL_15_SMP | ADC_CHANNEL_15_BITFIELD) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN15 */
Kojto 122:f9eeca106725 791 #define LL_ADC_CHANNEL_16 (ADC_CHANNEL_16_NUMBER | ADC_CHANNEL_16_SMP | ADC_CHANNEL_16_BITFIELD) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN16 */
Kojto 122:f9eeca106725 792 #define LL_ADC_CHANNEL_17 (ADC_CHANNEL_17_NUMBER | ADC_CHANNEL_17_SMP | ADC_CHANNEL_17_BITFIELD) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN17 */
Kojto 122:f9eeca106725 793 #define LL_ADC_CHANNEL_18 (ADC_CHANNEL_18_NUMBER | ADC_CHANNEL_18_SMP | ADC_CHANNEL_18_BITFIELD) /*!< ADC external channel (channel connected to GPIO pin) ADCx_IN18 */
Kojto 122:f9eeca106725 794 #define LL_ADC_CHANNEL_VREFINT (LL_ADC_CHANNEL_0 | ADC_CHANNEL_ID_INTERNAL_CH) /*!< ADC internal channel connected to VrefInt: Internal voltage reference. On STM32L4, ADC channel available only on ADC instance: ADC1. */
Kojto 122:f9eeca106725 795 #define LL_ADC_CHANNEL_TEMPSENSOR (LL_ADC_CHANNEL_17 | ADC_CHANNEL_ID_INTERNAL_CH) /*!< ADC internal channel connected to Temperature sensor. On STM32L4, ADC channel available only on ADC instances: ADC1, ADC3. */
Kojto 122:f9eeca106725 796 #define LL_ADC_CHANNEL_VBAT (LL_ADC_CHANNEL_18 | ADC_CHANNEL_ID_INTERNAL_CH) /*!< ADC internal channel connected to Vbat/3: Vbat voltage through a divider ladder of factor 1/3 to have Vbat always below Vdda. On STM32L4, ADC channel available only on ADC instances: ADC1, ADC3. */
Kojto 122:f9eeca106725 797 #if defined(ADC1) && !defined(ADC2)
Kojto 122:f9eeca106725 798 #define LL_ADC_CHANNEL_DAC1CH1 (LL_ADC_CHANNEL_17 | ADC_CHANNEL_ID_INTERNAL_CH | ADC_CHANNEL_ID_INTERNAL_CH_2) /*!< ADC internal channel connected to DAC1 channel 1, channel specific to ADC1. This channel is shared with ADC internal channel connected to temperature sensor, selection is done using function @ref LL_ADC_SetCommonPathInternalCh(). */
Kojto 122:f9eeca106725 799 #define LL_ADC_CHANNEL_DAC1CH2 (LL_ADC_CHANNEL_18 | ADC_CHANNEL_ID_INTERNAL_CH | ADC_CHANNEL_ID_INTERNAL_CH_2) /*!< ADC internal channel connected to DAC1 channel 2, channel specific to ADC1. This channel is shared with ADC internal channel connected to Vbat, selection is done using function @ref LL_ADC_SetCommonPathInternalCh(). */
Kojto 122:f9eeca106725 800 #elif defined(ADC2)
Kojto 122:f9eeca106725 801 #define LL_ADC_CHANNEL_DAC1CH1_ADC2 (LL_ADC_CHANNEL_17 | ADC_CHANNEL_ID_INTERNAL_CH | ADC_CHANNEL_ID_INTERNAL_CH_2) /*!< ADC internal channel connected to DAC1 channel 1, channel specific to ADC2 */
Kojto 122:f9eeca106725 802 #define LL_ADC_CHANNEL_DAC1CH2_ADC2 (LL_ADC_CHANNEL_18 | ADC_CHANNEL_ID_INTERNAL_CH | ADC_CHANNEL_ID_INTERNAL_CH_2) /*!< ADC internal channel connected to DAC1 channel 2, channel specific to ADC2 */
Kojto 122:f9eeca106725 803 #if defined(ADC3)
Kojto 122:f9eeca106725 804 #define LL_ADC_CHANNEL_DAC1CH1_ADC3 (LL_ADC_CHANNEL_14 | ADC_CHANNEL_ID_INTERNAL_CH) /*!< ADC internal channel connected to DAC1 channel 1, channel specific to ADC3 */
Kojto 122:f9eeca106725 805 #define LL_ADC_CHANNEL_DAC1CH2_ADC3 (LL_ADC_CHANNEL_15 | ADC_CHANNEL_ID_INTERNAL_CH) /*!< ADC internal channel connected to DAC1 channel 2, channel specific to ADC3 */
Kojto 122:f9eeca106725 806 #endif
Kojto 122:f9eeca106725 807 #endif
Kojto 122:f9eeca106725 808 /**
Kojto 122:f9eeca106725 809 * @}
Kojto 122:f9eeca106725 810 */
Kojto 122:f9eeca106725 811
Kojto 122:f9eeca106725 812 /** @defgroup ADC_LL_EC_REG_TRIGGER_SOURCE ADC group regular - Trigger source
Kojto 122:f9eeca106725 813 * @{
Kojto 122:f9eeca106725 814 */
AnnaBridge 145:64910690c574 815 #define LL_ADC_REG_TRIG_SOFTWARE (0x00000000U) /*!< ADC group regular conversion trigger internal: SW start. */
Kojto 122:f9eeca106725 816 #define LL_ADC_REG_TRIG_EXT_TIM1_TRGO (ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_0 | ADC_REG_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group regular conversion trigger from external IP: TIM1 TRGO. Trigger edge set to rising edge (default setting). */
Kojto 122:f9eeca106725 817 #define LL_ADC_REG_TRIG_EXT_TIM1_TRGO2 (ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_1 | ADC_REG_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group regular conversion trigger from external IP: TIM1 TRGO2. Trigger edge set to rising edge (default setting). */
Kojto 122:f9eeca106725 818 #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). */
Kojto 122:f9eeca106725 819 #define LL_ADC_REG_TRIG_EXT_TIM1_CH2 (ADC_CFGR_EXTSEL_0 | ADC_REG_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group regular conversion trigger from external IP: TIM1 channel 2 event (capture compare: input capture or output capture). Trigger edge set to rising edge (default setting). */
Kojto 122:f9eeca106725 820 #define LL_ADC_REG_TRIG_EXT_TIM1_CH3 (ADC_CFGR_EXTSEL_1 | ADC_REG_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group regular conversion trigger from external IP: TIM1 channel 3 event (capture compare: input capture or output capture). Trigger edge set to rising edge (default setting). */
Kojto 122:f9eeca106725 821 #define LL_ADC_REG_TRIG_EXT_TIM2_TRGO (ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_1 | ADC_CFGR_EXTSEL_0 | ADC_REG_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group regular conversion trigger from external IP: TIM2 TRGO. Trigger edge set to rising edge (default setting). */
Kojto 122:f9eeca106725 822 #define LL_ADC_REG_TRIG_EXT_TIM2_CH2 (ADC_CFGR_EXTSEL_1 | ADC_CFGR_EXTSEL_0 | ADC_REG_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group regular conversion trigger from external IP: TIM2 channel 2 event (capture compare: input capture or output capture). Trigger edge set to rising edge (default setting). */
Kojto 122:f9eeca106725 823 #define LL_ADC_REG_TRIG_EXT_TIM3_TRGO (ADC_CFGR_EXTSEL_2 | ADC_REG_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group regular conversion trigger from external IP: TIM3 TRGO. Trigger edge set to rising edge (default setting). */
Kojto 122:f9eeca106725 824 #define LL_ADC_REG_TRIG_EXT_TIM3_CH4 (ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_1 | ADC_CFGR_EXTSEL_0 | ADC_REG_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group regular conversion trigger from external IP: TIM3 channel 4 event (capture compare: input capture or output capture). Trigger edge set to rising edge (default setting). */
Kojto 122:f9eeca106725 825 #define LL_ADC_REG_TRIG_EXT_TIM4_TRGO (ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_2 | ADC_REG_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group regular conversion trigger from external IP: TIM4 TRGO. Trigger edge set to rising edge (default setting). */
Kojto 122:f9eeca106725 826 #define LL_ADC_REG_TRIG_EXT_TIM4_CH4 (ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_0 | ADC_REG_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group regular conversion trigger from external IP: TIM4 channel 4 event (capture compare: input capture or output capture). Trigger edge set to rising edge (default setting). */
Kojto 122:f9eeca106725 827 #define LL_ADC_REG_TRIG_EXT_TIM6_TRGO (ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_0 | ADC_REG_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group regular conversion trigger from external IP: TIM6 TRGO. Trigger edge set to rising edge (default setting). */
Kojto 122:f9eeca106725 828 #define LL_ADC_REG_TRIG_EXT_TIM8_TRGO (ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_1 | ADC_CFGR_EXTSEL_0 | ADC_REG_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group regular conversion trigger from external IP: TIM8 TRGO. Trigger edge set to rising edge (default setting). */
Kojto 122:f9eeca106725 829 #define LL_ADC_REG_TRIG_EXT_TIM8_TRGO2 (ADC_CFGR_EXTSEL_3 | ADC_REG_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group regular conversion trigger from external IP: TIM8 TRGO2. Trigger edge set to rising edge (default setting). */
Kojto 122:f9eeca106725 830 #define LL_ADC_REG_TRIG_EXT_TIM15_TRGO (ADC_CFGR_EXTSEL_3 | ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_1 | ADC_REG_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group regular conversion trigger from external IP: TIM15 TRGO. Trigger edge set to rising edge (default setting). */
Kojto 122:f9eeca106725 831 #define LL_ADC_REG_TRIG_EXT_EXTI_LINE11 (ADC_CFGR_EXTSEL_2 | ADC_CFGR_EXTSEL_1 | ADC_REG_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group regular conversion trigger from external IP: external interrupt line 11. Trigger edge set to rising edge (default setting). */
Kojto 122:f9eeca106725 832 /**
Kojto 122:f9eeca106725 833 * @}
Kojto 122:f9eeca106725 834 */
Kojto 122:f9eeca106725 835
Kojto 122:f9eeca106725 836 /** @defgroup ADC_LL_EC_REG_TRIGGER_EDGE ADC group regular - Trigger edge
Kojto 122:f9eeca106725 837 * @{
Kojto 122:f9eeca106725 838 */
Kojto 122:f9eeca106725 839 #define LL_ADC_REG_TRIG_EXT_RISING ( ADC_CFGR_EXTEN_0) /*!< ADC group regular conversion trigger polarity set to rising edge */
Kojto 122:f9eeca106725 840 #define LL_ADC_REG_TRIG_EXT_FALLING (ADC_CFGR_EXTEN_1 ) /*!< ADC group regular conversion trigger polarity set to falling edge */
Kojto 122:f9eeca106725 841 #define LL_ADC_REG_TRIG_EXT_RISINGFALLING (ADC_CFGR_EXTEN_1 | ADC_CFGR_EXTEN_0) /*!< ADC group regular conversion trigger polarity set to both rising and falling edges */
Kojto 122:f9eeca106725 842 /**
Kojto 122:f9eeca106725 843 * @}
Kojto 122:f9eeca106725 844 */
Kojto 122:f9eeca106725 845
Kojto 122:f9eeca106725 846 /** @defgroup ADC_LL_EC_REG_CONTINUOUS_MODE ADC group regular - Continuous mode
Kojto 122:f9eeca106725 847 * @{
Kojto 122:f9eeca106725 848 */
AnnaBridge 145:64910690c574 849 #define LL_ADC_REG_CONV_SINGLE (0x00000000U) /*!< ADC conversions are performed in single mode: one conversion per trigger */
Kojto 122:f9eeca106725 850 #define LL_ADC_REG_CONV_CONTINUOUS (ADC_CFGR_CONT) /*!< ADC conversions are performed in continuous mode: after the first trigger, following conversions launched successively automatically */
Kojto 122:f9eeca106725 851 /**
Kojto 122:f9eeca106725 852 * @}
Kojto 122:f9eeca106725 853 */
Kojto 122:f9eeca106725 854
Kojto 122:f9eeca106725 855 /** @defgroup ADC_LL_EC_REG_DMA_TRANSFER ADC group regular - DMA transfer of ADC conversion data
Kojto 122:f9eeca106725 856 * @{
Kojto 122:f9eeca106725 857 */
AnnaBridge 145:64910690c574 858 #define LL_ADC_REG_DMA_TRANSFER_NONE (0x00000000U) /*!< ADC conversions are not transferred by DMA */
Kojto 122:f9eeca106725 859 #define LL_ADC_REG_DMA_TRANSFER_LIMITED ( ADC_CFGR_DMAEN) /*!< ADC conversion data are transferred by DMA, in limited mode (one shot mode): DMA transfer requests are stopped when number of DMA data transfers (number of ADC conversions) is reached. This ADC mode is intended to be used with DMA mode non-circular. */
Kojto 122:f9eeca106725 860 #define LL_ADC_REG_DMA_TRANSFER_UNLIMITED (ADC_CFGR_DMACFG | ADC_CFGR_DMAEN) /*!< ADC conversion data are transferred by DMA, in unlimited mode: DMA transfer requests are unlimited, whatever number of DMA data transferred (number of ADC conversions). This ADC mode is intended to be used with DMA mode circular. */
Kojto 122:f9eeca106725 861 /**
Kojto 122:f9eeca106725 862 * @}
Kojto 122:f9eeca106725 863 */
Kojto 122:f9eeca106725 864
AnnaBridge 145:64910690c574 865 #if defined(ADC_CFGR_DFSDMCFG)
AnnaBridge 145:64910690c574 866 /** @defgroup ADC_LL_EC_REG_DFSDM_TRANSFER ADC group regular - DFSDM transfer of ADC conversion data
AnnaBridge 145:64910690c574 867 * @{
AnnaBridge 145:64910690c574 868 */
AnnaBridge 145:64910690c574 869 #define LL_ADC_REG_DFSDM_TRANSFER_NONE (0x00000000U) /*!< ADC conversions are not transferred by DFSDM. */
AnnaBridge 145:64910690c574 870 #define LL_ADC_REG_DFSDM_TRANSFER_ENABLE (ADC_CFGR_DFSDMCFG) /*!< ADC conversion data are transfered to DFSDM for post processing. The ADC conversion data format must be 16-bit signed and right aligned, refer to reference manual. DFSDM transfer cannot be used if DMA transfer is enabled. */
AnnaBridge 145:64910690c574 871 /**
AnnaBridge 145:64910690c574 872 * @}
AnnaBridge 145:64910690c574 873 */
AnnaBridge 145:64910690c574 874 #endif /* ADC_CFGR_DFSDMCFG */
AnnaBridge 145:64910690c574 875
AnnaBridge 145:64910690c574 876 #if defined(ADC_SMPR1_SMPPLUS)
AnnaBridge 145:64910690c574 877 /** @defgroup ADC_LL_EC_SAMPLINGTIME_COMMON_CONFIG ADC instance - ADC sampling time common configuration
AnnaBridge 145:64910690c574 878 * @{
AnnaBridge 145:64910690c574 879 */
AnnaBridge 145:64910690c574 880 #define LL_ADC_SAMPLINGTIME_COMMON_DEFAULT (0x00000000U) /*!< ADC sampling time let to default settings. */
AnnaBridge 145:64910690c574 881 #define LL_ADC_SAMPLINGTIME_COMMON_3C5_REPL_2C5 (ADC_SMPR1_SMPPLUS) /*!< ADC additional sampling time 3.5 ADC clock cycles replacing 2.5 ADC clock cycles (this applies to all channels mapped with selection sampling time 2.5 ADC clock cycles, whatever channels mapped on ADC groups regular or injected). */
AnnaBridge 145:64910690c574 882 /**
AnnaBridge 145:64910690c574 883 * @}
AnnaBridge 145:64910690c574 884 */
AnnaBridge 145:64910690c574 885 #endif /* ADC_SMPR1_SMPPLUS */
AnnaBridge 145:64910690c574 886
Kojto 122:f9eeca106725 887 /** @defgroup ADC_LL_EC_REG_OVR_DATA_BEHAVIOR ADC group regular - Overrun behavior on conversion data
Kojto 122:f9eeca106725 888 * @{
Kojto 122:f9eeca106725 889 */
AnnaBridge 145:64910690c574 890 #define LL_ADC_REG_OVR_DATA_PRESERVED (0x00000000U)/*!< ADC group regular behavior in case of overrun: data preserved */
Kojto 122:f9eeca106725 891 #define LL_ADC_REG_OVR_DATA_OVERWRITTEN (ADC_CFGR_OVRMOD) /*!< ADC group regular behavior in case of overrun: data overwritten */
Kojto 122:f9eeca106725 892 /**
Kojto 122:f9eeca106725 893 * @}
Kojto 122:f9eeca106725 894 */
Kojto 122:f9eeca106725 895
Kojto 122:f9eeca106725 896 /** @defgroup ADC_LL_EC_REG_SEQ_SCAN_LENGTH ADC group regular - Sequencer scan length
Kojto 122:f9eeca106725 897 * @{
Kojto 122:f9eeca106725 898 */
AnnaBridge 145:64910690c574 899 #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) */
Kojto 122:f9eeca106725 900 #define LL_ADC_REG_SEQ_SCAN_ENABLE_2RANKS ( ADC_SQR1_L_0) /*!< ADC group regular sequencer enable with 2 ranks in the sequence */
Kojto 122:f9eeca106725 901 #define LL_ADC_REG_SEQ_SCAN_ENABLE_3RANKS ( ADC_SQR1_L_1 ) /*!< ADC group regular sequencer enable with 3 ranks in the sequence */
Kojto 122:f9eeca106725 902 #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 */
Kojto 122:f9eeca106725 903 #define LL_ADC_REG_SEQ_SCAN_ENABLE_5RANKS ( ADC_SQR1_L_2 ) /*!< ADC group regular sequencer enable with 5 ranks in the sequence */
Kojto 122:f9eeca106725 904 #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 */
Kojto 122:f9eeca106725 905 #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 */
Kojto 122:f9eeca106725 906 #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 */
Kojto 122:f9eeca106725 907 #define LL_ADC_REG_SEQ_SCAN_ENABLE_9RANKS (ADC_SQR1_L_3 ) /*!< ADC group regular sequencer enable with 9 ranks in the sequence */
Kojto 122:f9eeca106725 908 #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 */
Kojto 122:f9eeca106725 909 #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 */
Kojto 122:f9eeca106725 910 #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 */
Kojto 122:f9eeca106725 911 #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 */
Kojto 122:f9eeca106725 912 #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 */
Kojto 122:f9eeca106725 913 #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 */
Kojto 122:f9eeca106725 914 #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 */
Kojto 122:f9eeca106725 915 /**
Kojto 122:f9eeca106725 916 * @}
Kojto 122:f9eeca106725 917 */
Kojto 122:f9eeca106725 918
Kojto 122:f9eeca106725 919 /** @defgroup ADC_LL_EC_REG_SEQ_DISCONT_MODE ADC group regular - Sequencer discontinuous mode
Kojto 122:f9eeca106725 920 * @{
Kojto 122:f9eeca106725 921 */
AnnaBridge 145:64910690c574 922 #define LL_ADC_REG_SEQ_DISCONT_DISABLE (0x00000000U) /*!< ADC group regular sequencer discontinuous mode disable */
Kojto 122:f9eeca106725 923 #define LL_ADC_REG_SEQ_DISCONT_1RANK ( ADC_CFGR_DISCEN) /*!< ADC group regular sequencer discontinuous mode enable with sequence interruption every rank */
Kojto 122:f9eeca106725 924 #define LL_ADC_REG_SEQ_DISCONT_2RANKS ( ADC_CFGR_DISCNUM_0 | ADC_CFGR_DISCEN) /*!< ADC group regular sequencer discontinuous mode enabled with sequence interruption every 2 ranks */
Kojto 122:f9eeca106725 925 #define LL_ADC_REG_SEQ_DISCONT_3RANKS ( ADC_CFGR_DISCNUM_1 | ADC_CFGR_DISCEN) /*!< ADC group regular sequencer discontinuous mode enable with sequence interruption every 3 ranks */
Kojto 122:f9eeca106725 926 #define LL_ADC_REG_SEQ_DISCONT_4RANKS ( ADC_CFGR_DISCNUM_1 | ADC_CFGR_DISCNUM_0 | ADC_CFGR_DISCEN) /*!< ADC group regular sequencer discontinuous mode enable with sequence interruption every 4 ranks */
Kojto 122:f9eeca106725 927 #define LL_ADC_REG_SEQ_DISCONT_5RANKS (ADC_CFGR_DISCNUM_2 | ADC_CFGR_DISCEN) /*!< ADC group regular sequencer discontinuous mode enable with sequence interruption every 5 ranks */
Kojto 122:f9eeca106725 928 #define LL_ADC_REG_SEQ_DISCONT_6RANKS (ADC_CFGR_DISCNUM_2 | ADC_CFGR_DISCNUM_0 | ADC_CFGR_DISCEN) /*!< ADC group regular sequencer discontinuous mode enable with sequence interruption every 6 ranks */
Kojto 122:f9eeca106725 929 #define LL_ADC_REG_SEQ_DISCONT_7RANKS (ADC_CFGR_DISCNUM_2 | ADC_CFGR_DISCNUM_1 | ADC_CFGR_DISCEN) /*!< ADC group regular sequencer discontinuous mode enable with sequence interruption every 7 ranks */
Kojto 122:f9eeca106725 930 #define LL_ADC_REG_SEQ_DISCONT_8RANKS (ADC_CFGR_DISCNUM_2 | ADC_CFGR_DISCNUM_1 | ADC_CFGR_DISCNUM_0 | ADC_CFGR_DISCEN) /*!< ADC group regular sequencer discontinuous mode enable with sequence interruption every 8 ranks */
Kojto 122:f9eeca106725 931 /**
Kojto 122:f9eeca106725 932 * @}
Kojto 122:f9eeca106725 933 */
Kojto 122:f9eeca106725 934
Kojto 122:f9eeca106725 935 /** @defgroup ADC_LL_EC_REG_SEQ_RANKS ADC group regular - Sequencer ranks
Kojto 122:f9eeca106725 936 * @{
Kojto 122:f9eeca106725 937 */
Kojto 122:f9eeca106725 938 #define LL_ADC_REG_RANK_1 (ADC_SQR1_REGOFFSET | ADC_REG_RANK_1_SQRX_BITOFFSET_POS) /*!< ADC group regular sequencer rank 1 */
Kojto 122:f9eeca106725 939 #define LL_ADC_REG_RANK_2 (ADC_SQR1_REGOFFSET | ADC_REG_RANK_2_SQRX_BITOFFSET_POS) /*!< ADC group regular sequencer rank 2 */
Kojto 122:f9eeca106725 940 #define LL_ADC_REG_RANK_3 (ADC_SQR1_REGOFFSET | ADC_REG_RANK_3_SQRX_BITOFFSET_POS) /*!< ADC group regular sequencer rank 3 */
Kojto 122:f9eeca106725 941 #define LL_ADC_REG_RANK_4 (ADC_SQR1_REGOFFSET | ADC_REG_RANK_4_SQRX_BITOFFSET_POS) /*!< ADC group regular sequencer rank 4 */
Kojto 122:f9eeca106725 942 #define LL_ADC_REG_RANK_5 (ADC_SQR2_REGOFFSET | ADC_REG_RANK_5_SQRX_BITOFFSET_POS) /*!< ADC group regular sequencer rank 5 */
Kojto 122:f9eeca106725 943 #define LL_ADC_REG_RANK_6 (ADC_SQR2_REGOFFSET | ADC_REG_RANK_6_SQRX_BITOFFSET_POS) /*!< ADC group regular sequencer rank 6 */
Kojto 122:f9eeca106725 944 #define LL_ADC_REG_RANK_7 (ADC_SQR2_REGOFFSET | ADC_REG_RANK_7_SQRX_BITOFFSET_POS) /*!< ADC group regular sequencer rank 7 */
Kojto 122:f9eeca106725 945 #define LL_ADC_REG_RANK_8 (ADC_SQR2_REGOFFSET | ADC_REG_RANK_8_SQRX_BITOFFSET_POS) /*!< ADC group regular sequencer rank 8 */
Kojto 122:f9eeca106725 946 #define LL_ADC_REG_RANK_9 (ADC_SQR2_REGOFFSET | ADC_REG_RANK_9_SQRX_BITOFFSET_POS) /*!< ADC group regular sequencer rank 9 */
Kojto 122:f9eeca106725 947 #define LL_ADC_REG_RANK_10 (ADC_SQR3_REGOFFSET | ADC_REG_RANK_10_SQRX_BITOFFSET_POS) /*!< ADC group regular sequencer rank 10 */
Kojto 122:f9eeca106725 948 #define LL_ADC_REG_RANK_11 (ADC_SQR3_REGOFFSET | ADC_REG_RANK_11_SQRX_BITOFFSET_POS) /*!< ADC group regular sequencer rank 11 */
Kojto 122:f9eeca106725 949 #define LL_ADC_REG_RANK_12 (ADC_SQR3_REGOFFSET | ADC_REG_RANK_12_SQRX_BITOFFSET_POS) /*!< ADC group regular sequencer rank 12 */
Kojto 122:f9eeca106725 950 #define LL_ADC_REG_RANK_13 (ADC_SQR3_REGOFFSET | ADC_REG_RANK_13_SQRX_BITOFFSET_POS) /*!< ADC group regular sequencer rank 13 */
Kojto 122:f9eeca106725 951 #define LL_ADC_REG_RANK_14 (ADC_SQR3_REGOFFSET | ADC_REG_RANK_14_SQRX_BITOFFSET_POS) /*!< ADC group regular sequencer rank 14 */
Kojto 122:f9eeca106725 952 #define LL_ADC_REG_RANK_15 (ADC_SQR4_REGOFFSET | ADC_REG_RANK_15_SQRX_BITOFFSET_POS) /*!< ADC group regular sequencer rank 15 */
Kojto 122:f9eeca106725 953 #define LL_ADC_REG_RANK_16 (ADC_SQR4_REGOFFSET | ADC_REG_RANK_16_SQRX_BITOFFSET_POS) /*!< ADC group regular sequencer rank 16 */
Kojto 122:f9eeca106725 954 /**
Kojto 122:f9eeca106725 955 * @}
Kojto 122:f9eeca106725 956 */
Kojto 122:f9eeca106725 957
Kojto 122:f9eeca106725 958 /** @defgroup ADC_LL_EC_INJ_TRIGGER_SOURCE ADC group injected - Trigger source
Kojto 122:f9eeca106725 959 * @{
Kojto 122:f9eeca106725 960 */
AnnaBridge 145:64910690c574 961 #define LL_ADC_INJ_TRIG_SOFTWARE (0x00000000U) /*!< ADC group injected conversion trigger internal: SW start.. Trigger edge set to rising edge (default setting). */
Kojto 122:f9eeca106725 962 #define LL_ADC_INJ_TRIG_EXT_TIM1_TRGO (ADC_INJ_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group injected conversion trigger from external IP: TIM1 TRGO. Trigger edge set to rising edge (default setting). */
Kojto 122:f9eeca106725 963 #define LL_ADC_INJ_TRIG_EXT_TIM1_TRGO2 (ADC_JSQR_JEXTSEL_3 | ADC_INJ_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group injected conversion trigger from external IP: TIM1 TRGO2. Trigger edge set to rising edge (default setting). */
Kojto 122:f9eeca106725 964 #define LL_ADC_INJ_TRIG_EXT_TIM1_CH4 (ADC_JSQR_JEXTSEL_0 | ADC_INJ_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group injected conversion trigger from external IP: TIM1 channel 4 event (capture compare: input capture or output capture). Trigger edge set to rising edge (default setting). */
Kojto 122:f9eeca106725 965 #define LL_ADC_INJ_TRIG_EXT_TIM2_TRGO (ADC_JSQR_JEXTSEL_1 | ADC_INJ_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group injected conversion trigger from external IP: TIM2 TRGO. Trigger edge set to rising edge (default setting). */
Kojto 122:f9eeca106725 966 #define LL_ADC_INJ_TRIG_EXT_TIM2_CH1 (ADC_JSQR_JEXTSEL_1 | ADC_JSQR_JEXTSEL_0 | ADC_INJ_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group injected conversion trigger from external IP: TIM2 channel 1 event (capture compare: input capture or output capture). Trigger edge set to rising edge (default setting). */
Kojto 122:f9eeca106725 967 #define LL_ADC_INJ_TRIG_EXT_TIM3_TRGO (ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_2 | ADC_INJ_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group injected conversion trigger from external IP: TIM3 TRGO. Trigger edge set to rising edge (default setting). */
Kojto 122:f9eeca106725 968 #define LL_ADC_INJ_TRIG_EXT_TIM3_CH1 (ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_0 | ADC_INJ_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group injected conversion trigger from external IP: TIM3 channel 1 event (capture compare: input capture or output capture). Trigger edge set to rising edge (default setting). */
Kojto 122:f9eeca106725 969 #define LL_ADC_INJ_TRIG_EXT_TIM3_CH3 (ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_1 | ADC_JSQR_JEXTSEL_0 | ADC_INJ_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group injected conversion trigger from external IP: TIM3 channel 3 event (capture compare: input capture or output capture). Trigger edge set to rising edge (default setting). */
Kojto 122:f9eeca106725 970 #define LL_ADC_INJ_TRIG_EXT_TIM3_CH4 (ADC_JSQR_JEXTSEL_2 | ADC_INJ_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group injected conversion trigger from external IP: TIM3 channel 4 event (capture compare: input capture or output capture). Trigger edge set to rising edge (default setting). */
Kojto 122:f9eeca106725 971 #define LL_ADC_INJ_TRIG_EXT_TIM4_TRGO (ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_0 | ADC_INJ_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group injected conversion trigger from external IP: TIM4 TRGO. Trigger edge set to rising edge (default setting). */
Kojto 122:f9eeca106725 972 #define LL_ADC_INJ_TRIG_EXT_TIM6_TRGO (ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_1 | ADC_INJ_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group injected conversion trigger from external IP: TIM6 TRGO. Trigger edge set to rising edge (default setting). */
Kojto 122:f9eeca106725 973 #define LL_ADC_INJ_TRIG_EXT_TIM8_CH4 (ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_1 | ADC_JSQR_JEXTSEL_0 | ADC_INJ_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group injected conversion trigger from external IP: TIM8 channel 4 event (capture compare: input capture or output capture). Trigger edge set to rising edge (default setting). */
Kojto 122:f9eeca106725 974 #define LL_ADC_INJ_TRIG_EXT_TIM8_TRGO (ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_0 | ADC_INJ_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group injected conversion trigger from external IP: TIM8 TRGO. Trigger edge set to rising edge (default setting). */
Kojto 122:f9eeca106725 975 #define LL_ADC_INJ_TRIG_EXT_TIM8_TRGO2 (ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_1 | ADC_INJ_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group injected conversion trigger from external IP: TIM8 TRGO2. Trigger edge set to rising edge (default setting). */
Kojto 122:f9eeca106725 976 #define LL_ADC_INJ_TRIG_EXT_TIM15_TRGO (ADC_JSQR_JEXTSEL_3 | ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_1 | ADC_JSQR_JEXTSEL_0 | ADC_INJ_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group injected conversion trigger from external IP: TIM15 TRGO. Trigger edge set to rising edge (default setting). */
Kojto 122:f9eeca106725 977 #define LL_ADC_INJ_TRIG_EXT_EXTI_LINE15 (ADC_JSQR_JEXTSEL_2 | ADC_JSQR_JEXTSEL_1 | ADC_INJ_TRIG_EXT_EDGE_DEFAULT) /*!< ADC group injected conversion trigger from external IP: external interrupt line 15. Trigger edge set to rising edge (default setting). */
Kojto 122:f9eeca106725 978 /**
Kojto 122:f9eeca106725 979 * @}
Kojto 122:f9eeca106725 980 */
Kojto 122:f9eeca106725 981
Kojto 122:f9eeca106725 982 /** @defgroup ADC_LL_EC_INJ_TRIGGER_EDGE ADC group injected - Trigger edge
Kojto 122:f9eeca106725 983 * @{
Kojto 122:f9eeca106725 984 */
Kojto 122:f9eeca106725 985 #define LL_ADC_INJ_TRIG_EXT_RISING ( ADC_JSQR_JEXTEN_0) /*!< ADC group injected conversion trigger polarity set to rising edge */
Kojto 122:f9eeca106725 986 #define LL_ADC_INJ_TRIG_EXT_FALLING (ADC_JSQR_JEXTEN_1 ) /*!< ADC group injected conversion trigger polarity set to falling edge */
Kojto 122:f9eeca106725 987 #define LL_ADC_INJ_TRIG_EXT_RISINGFALLING (ADC_JSQR_JEXTEN_1 | ADC_JSQR_JEXTEN_0) /*!< ADC group injected conversion trigger polarity set to both rising and falling edges */
Kojto 122:f9eeca106725 988 /**
Kojto 122:f9eeca106725 989 * @}
Kojto 122:f9eeca106725 990 */
Kojto 122:f9eeca106725 991
Kojto 122:f9eeca106725 992 /** @defgroup ADC_LL_EC_INJ_TRIG_AUTO ADC group injected - Automatic trigger mode
Kojto 122:f9eeca106725 993 * @{
Kojto 122:f9eeca106725 994 */
AnnaBridge 145:64910690c574 995 #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. */
Kojto 122:f9eeca106725 996 #define LL_ADC_INJ_TRIG_FROM_GRP_REGULAR (ADC_CFGR_JAUTO) /*!< ADC group injected conversion trigger from ADC group regular. Setting compliant only with group injected trigger source set to SW start, without any further action on ADC group injected conversion start or stop: in this case, ADC group injected is controlled only from ADC group regular. */
Kojto 122:f9eeca106725 997 /**
Kojto 122:f9eeca106725 998 * @}
Kojto 122:f9eeca106725 999 */
Kojto 122:f9eeca106725 1000
Kojto 122:f9eeca106725 1001 /** @defgroup ADC_LL_EC_INJ_CONTEXT_QUEUE ADC group injected - Context queue mode
Kojto 122:f9eeca106725 1002 * @{
Kojto 122:f9eeca106725 1003 */
AnnaBridge 145:64910690c574 1004 #define LL_ADC_INJ_QUEUE_2CONTEXTS_LAST_ACTIVE (0x00000000U)/* Group injected sequence context queue is enabled and can contain up to 2 contexts. When all contexts have been processed, the queue maintains the last context active perpetually. */
Kojto 122:f9eeca106725 1005 #define LL_ADC_INJ_QUEUE_2CONTEXTS_END_EMPTY (ADC_CFGR_JQM) /* Group injected sequence context queue is enabled and can contain up to 2 contexts. When all contexts have been processed, the queue is empty and injected group triggers are disabled. */
Kojto 122:f9eeca106725 1006 #define LL_ADC_INJ_QUEUE_DISABLE (ADC_CFGR_JQDIS) /* Group injected sequence context queue is disabled: only 1 sequence can be configured and is active perpetually. */
Kojto 122:f9eeca106725 1007 /**
Kojto 122:f9eeca106725 1008 * @}
Kojto 122:f9eeca106725 1009 */
Kojto 122:f9eeca106725 1010
Kojto 122:f9eeca106725 1011 /** @defgroup ADC_LL_EC_INJ_SEQ_SCAN_LENGTH ADC group injected - Sequencer scan length
Kojto 122:f9eeca106725 1012 * @{
Kojto 122:f9eeca106725 1013 */
AnnaBridge 145:64910690c574 1014 #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) */
Kojto 122:f9eeca106725 1015 #define LL_ADC_INJ_SEQ_SCAN_ENABLE_2RANKS ( ADC_JSQR_JL_0) /*!< ADC group injected sequencer enable with 2 ranks in the sequence */
Kojto 122:f9eeca106725 1016 #define LL_ADC_INJ_SEQ_SCAN_ENABLE_3RANKS (ADC_JSQR_JL_1 ) /*!< ADC group injected sequencer enable with 3 ranks in the sequence */
Kojto 122:f9eeca106725 1017 #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 */
Kojto 122:f9eeca106725 1018 /**
Kojto 122:f9eeca106725 1019 * @}
Kojto 122:f9eeca106725 1020 */
Kojto 122:f9eeca106725 1021
Kojto 122:f9eeca106725 1022 /** @defgroup ADC_LL_EC_INJ_SEQ_DISCONT_MODE ADC group injected - Sequencer discontinuous mode
Kojto 122:f9eeca106725 1023 * @{
Kojto 122:f9eeca106725 1024 */
AnnaBridge 145:64910690c574 1025 #define LL_ADC_INJ_SEQ_DISCONT_DISABLE (0x00000000U)/*!< ADC group injected sequencer discontinuous mode disable */
Kojto 122:f9eeca106725 1026 #define LL_ADC_INJ_SEQ_DISCONT_1RANK (ADC_CFGR_JDISCEN) /*!< ADC group injected sequencer discontinuous mode enable with sequence interruption every rank */
Kojto 122:f9eeca106725 1027 /**
Kojto 122:f9eeca106725 1028 * @}
Kojto 122:f9eeca106725 1029 */
Kojto 122:f9eeca106725 1030
Kojto 122:f9eeca106725 1031 /** @defgroup ADC_LL_EC_INJ_SEQ_RANKS ADC group injected - Sequencer ranks
Kojto 122:f9eeca106725 1032 * @{
Kojto 122:f9eeca106725 1033 */
Kojto 122:f9eeca106725 1034 #define LL_ADC_INJ_RANK_1 (ADC_JDR1_REGOFFSET | ADC_INJ_RANK_1_JSQR_BITOFFSET_POS) /*!< ADC group injected sequencer rank 1 */
Kojto 122:f9eeca106725 1035 #define LL_ADC_INJ_RANK_2 (ADC_JDR2_REGOFFSET | ADC_INJ_RANK_2_JSQR_BITOFFSET_POS) /*!< ADC group injected sequencer rank 2 */
Kojto 122:f9eeca106725 1036 #define LL_ADC_INJ_RANK_3 (ADC_JDR3_REGOFFSET | ADC_INJ_RANK_3_JSQR_BITOFFSET_POS) /*!< ADC group injected sequencer rank 3 */
Kojto 122:f9eeca106725 1037 #define LL_ADC_INJ_RANK_4 (ADC_JDR4_REGOFFSET | ADC_INJ_RANK_4_JSQR_BITOFFSET_POS) /*!< ADC group injected sequencer rank 4 */
Kojto 122:f9eeca106725 1038 /**
Kojto 122:f9eeca106725 1039 * @}
Kojto 122:f9eeca106725 1040 */
Kojto 122:f9eeca106725 1041
Kojto 122:f9eeca106725 1042 /** @defgroup ADC_LL_EC_CHANNEL_SAMPLINGTIME Channel - Sampling time
Kojto 122:f9eeca106725 1043 * @{
Kojto 122:f9eeca106725 1044 */
Kojto 122:f9eeca106725 1045 #define LL_ADC_SAMPLINGTIME_2CYCLES_5 (0x00000000U) /*!< Sampling time 2.5 ADC clock cycles */
Kojto 122:f9eeca106725 1046 #define LL_ADC_SAMPLINGTIME_6CYCLES_5 ( ADC_SMPR2_SMP10_0) /*!< Sampling time 6.5 ADC clock cycles */
Kojto 122:f9eeca106725 1047 #define LL_ADC_SAMPLINGTIME_12CYCLES_5 ( ADC_SMPR2_SMP10_1 ) /*!< Sampling time 12.5 ADC clock cycles */
Kojto 122:f9eeca106725 1048 #define LL_ADC_SAMPLINGTIME_24CYCLES_5 ( ADC_SMPR2_SMP10_1 | ADC_SMPR2_SMP10_0) /*!< Sampling time 24.5 ADC clock cycles */
Kojto 122:f9eeca106725 1049 #define LL_ADC_SAMPLINGTIME_47CYCLES_5 (ADC_SMPR2_SMP10_2 ) /*!< Sampling time 47.5 ADC clock cycles */
Kojto 122:f9eeca106725 1050 #define LL_ADC_SAMPLINGTIME_92CYCLES_5 (ADC_SMPR2_SMP10_2 | ADC_SMPR2_SMP10_0) /*!< Sampling time 92.5 ADC clock cycles */
Kojto 122:f9eeca106725 1051 #define LL_ADC_SAMPLINGTIME_247CYCLES_5 (ADC_SMPR2_SMP10_2 | ADC_SMPR2_SMP10_1 ) /*!< Sampling time 247.5 ADC clock cycles */
Kojto 122:f9eeca106725 1052 #define LL_ADC_SAMPLINGTIME_640CYCLES_5 (ADC_SMPR2_SMP10_2 | ADC_SMPR2_SMP10_1 | ADC_SMPR2_SMP10_0) /*!< Sampling time 640.5 ADC clock cycles */
Kojto 122:f9eeca106725 1053 /**
Kojto 122:f9eeca106725 1054 * @}
Kojto 122:f9eeca106725 1055 */
Kojto 122:f9eeca106725 1056
Kojto 122:f9eeca106725 1057 /** @defgroup ADC_LL_EC_CHANNEL_SINGLE_DIFF_ENDING Channel - Single or differential ending
Kojto 122:f9eeca106725 1058 * @{
Kojto 122:f9eeca106725 1059 */
Kojto 122:f9eeca106725 1060 #define LL_ADC_SINGLE_ENDED ( ADC_CALFACT_CALFACT_S) /*!< ADC channel ending set to single ended (literal also used to set calibration mode) */
Kojto 122:f9eeca106725 1061 #define LL_ADC_DIFFERENTIAL_ENDED (ADC_CR_ADCALDIF | ADC_CALFACT_CALFACT_D) /*!< ADC channel ending set to differential (literal also used to set calibration mode) */
Kojto 122:f9eeca106725 1062 #define LL_ADC_BOTH_SINGLE_DIFF_ENDED (LL_ADC_SINGLE_ENDED | LL_ADC_DIFFERENTIAL_ENDED) /*!< ADC channel ending set to both single ended and differential (literal used only to set calibration factors) */
Kojto 122:f9eeca106725 1063 /**
Kojto 122:f9eeca106725 1064 * @}
Kojto 122:f9eeca106725 1065 */
Kojto 122:f9eeca106725 1066
Kojto 122:f9eeca106725 1067 /** @defgroup ADC_LL_EC_AWD_NUMBER Analog watchdog - Analog watchdog number
Kojto 122:f9eeca106725 1068 * @{
Kojto 122:f9eeca106725 1069 */
Kojto 122:f9eeca106725 1070 #define LL_ADC_AWD1 (ADC_AWD_CR1_CHANNEL_MASK | ADC_AWD_CR1_REGOFFSET) /*!< ADC analog watchdog number 1 */
Kojto 122:f9eeca106725 1071 #define LL_ADC_AWD2 (ADC_AWD_CR23_CHANNEL_MASK | ADC_AWD_CR2_REGOFFSET) /*!< ADC analog watchdog number 2 */
Kojto 122:f9eeca106725 1072 #define LL_ADC_AWD3 (ADC_AWD_CR23_CHANNEL_MASK | ADC_AWD_CR3_REGOFFSET) /*!< ADC analog watchdog number 3 */
Kojto 122:f9eeca106725 1073 /**
Kojto 122:f9eeca106725 1074 * @}
Kojto 122:f9eeca106725 1075 */
Kojto 122:f9eeca106725 1076
Kojto 122:f9eeca106725 1077 /** @defgroup ADC_LL_EC_AWD_CHANNELS Analog watchdog - Monitored channels
Kojto 122:f9eeca106725 1078 * @{
Kojto 122:f9eeca106725 1079 */
AnnaBridge 145:64910690c574 1080 #define LL_ADC_AWD_DISABLE (0x00000000U) /*!< ADC analog watchdog monitoring disabled */
Kojto 122:f9eeca106725 1081 #define LL_ADC_AWD_ALL_CHANNELS_REG (ADC_AWD_CR23_CHANNEL_MASK | ADC_CFGR_AWD1EN ) /*!< ADC analog watchdog monitoring of all channels, converted by group regular only */
Kojto 122:f9eeca106725 1082 #define LL_ADC_AWD_ALL_CHANNELS_INJ (ADC_AWD_CR23_CHANNEL_MASK | ADC_CFGR_JAWD1EN ) /*!< ADC analog watchdog monitoring of all channels, converted by group injected only */
Kojto 122:f9eeca106725 1083 #define LL_ADC_AWD_ALL_CHANNELS_REG_INJ (ADC_AWD_CR23_CHANNEL_MASK | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN ) /*!< ADC analog watchdog monitoring of all channels, converted by either group regular or injected */
Kojto 122:f9eeca106725 1084 #define LL_ADC_AWD_CHANNEL_0_REG ((LL_ADC_CHANNEL_0 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN0, converted by group regular only */
Kojto 122:f9eeca106725 1085 #define LL_ADC_AWD_CHANNEL_0_INJ ((LL_ADC_CHANNEL_0 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN0, converted by group injected only */
Kojto 122:f9eeca106725 1086 #define LL_ADC_AWD_CHANNEL_0_REG_INJ ((LL_ADC_CHANNEL_0 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN0, converted by either group regular or injected */
Kojto 122:f9eeca106725 1087 #define LL_ADC_AWD_CHANNEL_1_REG ((LL_ADC_CHANNEL_1 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN1, converted by group regular only */
Kojto 122:f9eeca106725 1088 #define LL_ADC_AWD_CHANNEL_1_INJ ((LL_ADC_CHANNEL_1 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN1, converted by group injected only */
Kojto 122:f9eeca106725 1089 #define LL_ADC_AWD_CHANNEL_1_REG_INJ ((LL_ADC_CHANNEL_1 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN1, converted by either group regular or injected */
Kojto 122:f9eeca106725 1090 #define LL_ADC_AWD_CHANNEL_2_REG ((LL_ADC_CHANNEL_2 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN2, converted by group regular only */
Kojto 122:f9eeca106725 1091 #define LL_ADC_AWD_CHANNEL_2_INJ ((LL_ADC_CHANNEL_2 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN2, converted by group injected only */
Kojto 122:f9eeca106725 1092 #define LL_ADC_AWD_CHANNEL_2_REG_INJ ((LL_ADC_CHANNEL_2 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN2, converted by either group regular or injected */
Kojto 122:f9eeca106725 1093 #define LL_ADC_AWD_CHANNEL_3_REG ((LL_ADC_CHANNEL_3 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN3, converted by group regular only */
Kojto 122:f9eeca106725 1094 #define LL_ADC_AWD_CHANNEL_3_INJ ((LL_ADC_CHANNEL_3 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN3, converted by group injected only */
Kojto 122:f9eeca106725 1095 #define LL_ADC_AWD_CHANNEL_3_REG_INJ ((LL_ADC_CHANNEL_3 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN3, converted by either group regular or injected */
Kojto 122:f9eeca106725 1096 #define LL_ADC_AWD_CHANNEL_4_REG ((LL_ADC_CHANNEL_4 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN4, converted by group regular only */
Kojto 122:f9eeca106725 1097 #define LL_ADC_AWD_CHANNEL_4_INJ ((LL_ADC_CHANNEL_4 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN4, converted by group injected only */
Kojto 122:f9eeca106725 1098 #define LL_ADC_AWD_CHANNEL_4_REG_INJ ((LL_ADC_CHANNEL_4 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN4, converted by either group regular or injected */
Kojto 122:f9eeca106725 1099 #define LL_ADC_AWD_CHANNEL_5_REG ((LL_ADC_CHANNEL_5 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN5, converted by group regular only */
Kojto 122:f9eeca106725 1100 #define LL_ADC_AWD_CHANNEL_5_INJ ((LL_ADC_CHANNEL_5 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN5, converted by group injected only */
Kojto 122:f9eeca106725 1101 #define LL_ADC_AWD_CHANNEL_5_REG_INJ ((LL_ADC_CHANNEL_5 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN5, converted by either group regular or injected */
Kojto 122:f9eeca106725 1102 #define LL_ADC_AWD_CHANNEL_6_REG ((LL_ADC_CHANNEL_6 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN6, converted by group regular only */
Kojto 122:f9eeca106725 1103 #define LL_ADC_AWD_CHANNEL_6_INJ ((LL_ADC_CHANNEL_6 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN6, converted by group injected only */
Kojto 122:f9eeca106725 1104 #define LL_ADC_AWD_CHANNEL_6_REG_INJ ((LL_ADC_CHANNEL_6 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN6, converted by either group regular or injected */
Kojto 122:f9eeca106725 1105 #define LL_ADC_AWD_CHANNEL_7_REG ((LL_ADC_CHANNEL_7 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN7, converted by group regular only */
Kojto 122:f9eeca106725 1106 #define LL_ADC_AWD_CHANNEL_7_INJ ((LL_ADC_CHANNEL_7 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN7, converted by group injected only */
Kojto 122:f9eeca106725 1107 #define LL_ADC_AWD_CHANNEL_7_REG_INJ ((LL_ADC_CHANNEL_7 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN7, converted by either group regular or injected */
Kojto 122:f9eeca106725 1108 #define LL_ADC_AWD_CHANNEL_8_REG ((LL_ADC_CHANNEL_8 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN8, converted by group regular only */
Kojto 122:f9eeca106725 1109 #define LL_ADC_AWD_CHANNEL_8_INJ ((LL_ADC_CHANNEL_8 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN8, converted by group injected only */
Kojto 122:f9eeca106725 1110 #define LL_ADC_AWD_CHANNEL_8_REG_INJ ((LL_ADC_CHANNEL_8 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN8, converted by either group regular or injected */
Kojto 122:f9eeca106725 1111 #define LL_ADC_AWD_CHANNEL_9_REG ((LL_ADC_CHANNEL_9 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN9, converted by group regular only */
Kojto 122:f9eeca106725 1112 #define LL_ADC_AWD_CHANNEL_9_INJ ((LL_ADC_CHANNEL_9 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN9, converted by group injected only */
Kojto 122:f9eeca106725 1113 #define LL_ADC_AWD_CHANNEL_9_REG_INJ ((LL_ADC_CHANNEL_9 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN9, converted by either group regular or injected */
Kojto 122:f9eeca106725 1114 #define LL_ADC_AWD_CHANNEL_10_REG ((LL_ADC_CHANNEL_10 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN10, converted by group regular only */
Kojto 122:f9eeca106725 1115 #define LL_ADC_AWD_CHANNEL_10_INJ ((LL_ADC_CHANNEL_10 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN10, converted by group injected only */
Kojto 122:f9eeca106725 1116 #define LL_ADC_AWD_CHANNEL_10_REG_INJ ((LL_ADC_CHANNEL_10 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN10, converted by either group regular or injected */
Kojto 122:f9eeca106725 1117 #define LL_ADC_AWD_CHANNEL_11_REG ((LL_ADC_CHANNEL_11 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN11, converted by group regular only */
Kojto 122:f9eeca106725 1118 #define LL_ADC_AWD_CHANNEL_11_INJ ((LL_ADC_CHANNEL_11 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN11, converted by group injected only */
Kojto 122:f9eeca106725 1119 #define LL_ADC_AWD_CHANNEL_11_REG_INJ ((LL_ADC_CHANNEL_11 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN11, converted by either group regular or injected */
Kojto 122:f9eeca106725 1120 #define LL_ADC_AWD_CHANNEL_12_REG ((LL_ADC_CHANNEL_12 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN12, converted by group regular only */
Kojto 122:f9eeca106725 1121 #define LL_ADC_AWD_CHANNEL_12_INJ ((LL_ADC_CHANNEL_12 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN12, converted by group injected only */
Kojto 122:f9eeca106725 1122 #define LL_ADC_AWD_CHANNEL_12_REG_INJ ((LL_ADC_CHANNEL_12 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN12, converted by either group regular or injected */
Kojto 122:f9eeca106725 1123 #define LL_ADC_AWD_CHANNEL_13_REG ((LL_ADC_CHANNEL_13 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN13, converted by group regular only */
Kojto 122:f9eeca106725 1124 #define LL_ADC_AWD_CHANNEL_13_INJ ((LL_ADC_CHANNEL_13 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN13, converted by group injected only */
Kojto 122:f9eeca106725 1125 #define LL_ADC_AWD_CHANNEL_13_REG_INJ ((LL_ADC_CHANNEL_13 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN13, converted by either group regular or injected */
Kojto 122:f9eeca106725 1126 #define LL_ADC_AWD_CHANNEL_14_REG ((LL_ADC_CHANNEL_14 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN14, converted by group regular only */
Kojto 122:f9eeca106725 1127 #define LL_ADC_AWD_CHANNEL_14_INJ ((LL_ADC_CHANNEL_14 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN14, converted by group injected only */
Kojto 122:f9eeca106725 1128 #define LL_ADC_AWD_CHANNEL_14_REG_INJ ((LL_ADC_CHANNEL_14 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN14, converted by either group regular or injected */
Kojto 122:f9eeca106725 1129 #define LL_ADC_AWD_CHANNEL_15_REG ((LL_ADC_CHANNEL_15 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN15, converted by group regular only */
Kojto 122:f9eeca106725 1130 #define LL_ADC_AWD_CHANNEL_15_INJ ((LL_ADC_CHANNEL_15 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN15, converted by group injected only */
Kojto 122:f9eeca106725 1131 #define LL_ADC_AWD_CHANNEL_15_REG_INJ ((LL_ADC_CHANNEL_15 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN15, converted by either group regular or injected */
Kojto 122:f9eeca106725 1132 #define LL_ADC_AWD_CHANNEL_16_REG ((LL_ADC_CHANNEL_16 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN16, converted by group regular only */
Kojto 122:f9eeca106725 1133 #define LL_ADC_AWD_CHANNEL_16_INJ ((LL_ADC_CHANNEL_16 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN16, converted by group injected only */
Kojto 122:f9eeca106725 1134 #define LL_ADC_AWD_CHANNEL_16_REG_INJ ((LL_ADC_CHANNEL_16 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN16, converted by either group regular or injected */
Kojto 122:f9eeca106725 1135 #define LL_ADC_AWD_CHANNEL_17_REG ((LL_ADC_CHANNEL_17 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN17, converted by group regular only */
Kojto 122:f9eeca106725 1136 #define LL_ADC_AWD_CHANNEL_17_INJ ((LL_ADC_CHANNEL_17 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN17, converted by group injected only */
Kojto 122:f9eeca106725 1137 #define LL_ADC_AWD_CHANNEL_17_REG_INJ ((LL_ADC_CHANNEL_17 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN17, converted by either group regular or injected */
Kojto 122:f9eeca106725 1138 #define LL_ADC_AWD_CHANNEL_18_REG ((LL_ADC_CHANNEL_18 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN18, converted by group regular only */
Kojto 122:f9eeca106725 1139 #define LL_ADC_AWD_CHANNEL_18_INJ ((LL_ADC_CHANNEL_18 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN18, converted by group injected only */
Kojto 122:f9eeca106725 1140 #define LL_ADC_AWD_CHANNEL_18_REG_INJ ((LL_ADC_CHANNEL_18 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC external channel (channel connected to GPIO pin) ADCx_IN18, converted by either group regular or injected */
Kojto 122:f9eeca106725 1141 #define LL_ADC_AWD_CH_VREFINT_REG ((LL_ADC_CHANNEL_VREFINT & ADC_CHANNEL_ID_MASK) | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC internal channel connected to VrefInt: Internal voltage reference, converted by group regular only */
Kojto 122:f9eeca106725 1142 #define LL_ADC_AWD_CH_VREFINT_INJ ((LL_ADC_CHANNEL_VREFINT & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC internal channel connected to VrefInt: Internal voltage reference, converted by group injected only */
Kojto 122:f9eeca106725 1143 #define LL_ADC_AWD_CH_VREFINT_REG_INJ ((LL_ADC_CHANNEL_VREFINT & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC internal channel connected to VrefInt: Internal voltage reference, converted by either group regular or injected */
Kojto 122:f9eeca106725 1144 #define LL_ADC_AWD_CH_TEMPSENSOR_REG ((LL_ADC_CHANNEL_TEMPSENSOR & ADC_CHANNEL_ID_MASK) | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC internal channel connected to Temperature sensor, converted by group regular only */
Kojto 122:f9eeca106725 1145 #define LL_ADC_AWD_CH_TEMPSENSOR_INJ ((LL_ADC_CHANNEL_TEMPSENSOR & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC internal channel connected to Temperature sensor, converted by group injected only */
Kojto 122:f9eeca106725 1146 #define LL_ADC_AWD_CH_TEMPSENSOR_REG_INJ ((LL_ADC_CHANNEL_TEMPSENSOR & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC internal channel connected to Temperature sensor, converted by either group regular or injected */
Kojto 122:f9eeca106725 1147 #define LL_ADC_AWD_CH_VBAT_REG ((LL_ADC_CHANNEL_VBAT & ADC_CHANNEL_ID_MASK) | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC internal channel connected to Vbat/3: Vbat voltage through a divider ladder of factor 1/3 to have Vbat always below Vdda, converted by group regular only */
Kojto 122:f9eeca106725 1148 #define LL_ADC_AWD_CH_VBAT_INJ ((LL_ADC_CHANNEL_VBAT & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC internal channel connected to Vbat/3: Vbat voltage through a divider ladder of factor 1/3 to have Vbat always below Vdda, converted by group injected only */
Kojto 122:f9eeca106725 1149 #define LL_ADC_AWD_CH_VBAT_REG_INJ ((LL_ADC_CHANNEL_VBAT & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC internal channel connected to Vbat/3: Vbat voltage through a divider ladder of factor 1/3 to have Vbat always below Vdda */
Kojto 122:f9eeca106725 1150 #if defined(ADC1) && !defined(ADC2)
Kojto 122:f9eeca106725 1151 #define LL_ADC_AWD_CH_DAC1CH1_REG ((LL_ADC_CHANNEL_DAC1CH1 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC internal channel connected to DAC1 channel 1, channel specific to ADC1, converted by group regular only */
Kojto 122:f9eeca106725 1152 #define LL_ADC_AWD_CH_DAC1CH1_INJ ((LL_ADC_CHANNEL_DAC1CH1 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC internal channel connected to DAC1 channel 1, channel specific to ADC1, converted by group injected only */
Kojto 122:f9eeca106725 1153 #define LL_ADC_AWD_CH_DAC1CH1_REG_INJ ((LL_ADC_CHANNEL_DAC1CH1 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC internal channel connected to DAC1 channel 1, channel specific to ADC1, converted by either group regular or injected */
Kojto 122:f9eeca106725 1154 #define LL_ADC_AWD_CH_DAC1CH2_REG ((LL_ADC_CHANNEL_DAC1CH2 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC internal channel connected to DAC1 channel 1, channel specific to ADC1, converted by group regular only */
Kojto 122:f9eeca106725 1155 #define LL_ADC_AWD_CH_DAC1CH2_INJ ((LL_ADC_CHANNEL_DAC1CH2 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC internal channel connected to DAC1 channel 1, channel specific to ADC1, converted by group injected only */
Kojto 122:f9eeca106725 1156 #define LL_ADC_AWD_CH_DAC1CH2_REG_INJ ((LL_ADC_CHANNEL_DAC1CH2 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC internal channel connected to DAC1 channel 1, channel specific to ADC1, converted by either group regular or injected */
Kojto 122:f9eeca106725 1157 #elif defined(ADC2)
Kojto 122:f9eeca106725 1158 #define LL_ADC_AWD_CH_DAC1CH1_ADC2_REG ((LL_ADC_CHANNEL_DAC1CH1_ADC2 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC internal channel connected to DAC1 channel 1, channel specific to ADC2, converted by group regular only */
Kojto 122:f9eeca106725 1159 #define LL_ADC_AWD_CH_DAC1CH1_ADC2_INJ ((LL_ADC_CHANNEL_DAC1CH1_ADC2 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC internal channel connected to DAC1 channel 1, channel specific to ADC2, converted by group injected only */
Kojto 122:f9eeca106725 1160 #define LL_ADC_AWD_CH_DAC1CH1_ADC2_REG_INJ ((LL_ADC_CHANNEL_DAC1CH1_ADC2 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC internal channel connected to DAC1 channel 1, channel specific to ADC2, converted by either group regular or injected */
Kojto 122:f9eeca106725 1161 #define LL_ADC_AWD_CH_DAC1CH2_ADC2_REG ((LL_ADC_CHANNEL_DAC1CH2_ADC2 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC internal channel connected to DAC1 channel 1, channel specific to ADC2, converted by group regular only */
Kojto 122:f9eeca106725 1162 #define LL_ADC_AWD_CH_DAC1CH2_ADC2_INJ ((LL_ADC_CHANNEL_DAC1CH2_ADC2 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC internal channel connected to DAC1 channel 1, channel specific to ADC2, converted by group injected only */
Kojto 122:f9eeca106725 1163 #define LL_ADC_AWD_CH_DAC1CH2_ADC2_REG_INJ ((LL_ADC_CHANNEL_DAC1CH2_ADC2 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC internal channel connected to DAC1 channel 1, channel specific to ADC2, converted by either group regular or injected */
Kojto 122:f9eeca106725 1164 #if defined(ADC3)
Kojto 122:f9eeca106725 1165 #define LL_ADC_AWD_CH_DAC1CH1_ADC3_REG ((LL_ADC_CHANNEL_DAC1CH1_ADC3 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC internal channel connected to DAC1 channel 1, channel specific to ADC3, converted by group regular only */
Kojto 122:f9eeca106725 1166 #define LL_ADC_AWD_CH_DAC1CH1_ADC3_INJ ((LL_ADC_CHANNEL_DAC1CH1_ADC3 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC internal channel connected to DAC1 channel 1, channel specific to ADC3, converted by group injected only */
Kojto 122:f9eeca106725 1167 #define LL_ADC_AWD_CH_DAC1CH1_ADC3_REG_INJ ((LL_ADC_CHANNEL_DAC1CH1_ADC3 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC internal channel connected to DAC1 channel 1, channel specific to ADC3, converted by either group regular or injected */
Kojto 122:f9eeca106725 1168 #define LL_ADC_AWD_CH_DAC1CH2_ADC3_REG ((LL_ADC_CHANNEL_DAC1CH2_ADC3 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC internal channel connected to DAC1 channel 1, channel specific to ADC3, converted by group regular only */
Kojto 122:f9eeca106725 1169 #define LL_ADC_AWD_CH_DAC1CH2_ADC3_INJ ((LL_ADC_CHANNEL_DAC1CH2_ADC3 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC internal channel connected to DAC1 channel 1, channel specific to ADC3, converted by group injected only */
Kojto 122:f9eeca106725 1170 #define LL_ADC_AWD_CH_DAC1CH2_ADC3_REG_INJ ((LL_ADC_CHANNEL_DAC1CH2_ADC3 & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) /*!< ADC analog watchdog monitoring of ADC internal channel connected to DAC1 channel 1, channel specific to ADC3, converted by either group regular or injected */
Kojto 122:f9eeca106725 1171 #endif
Kojto 122:f9eeca106725 1172 #endif
Kojto 122:f9eeca106725 1173 /**
Kojto 122:f9eeca106725 1174 * @}
Kojto 122:f9eeca106725 1175 */
Kojto 122:f9eeca106725 1176
Kojto 122:f9eeca106725 1177 /** @defgroup ADC_LL_EC_AWD_THRESHOLDS Analog watchdog - Thresholds
Kojto 122:f9eeca106725 1178 * @{
Kojto 122:f9eeca106725 1179 */
Kojto 122:f9eeca106725 1180 #define LL_ADC_AWD_THRESHOLD_HIGH (ADC_TR1_HT1 ) /*!< ADC analog watchdog threshold high */
Kojto 122:f9eeca106725 1181 #define LL_ADC_AWD_THRESHOLD_LOW ( ADC_TR1_LT1) /*!< ADC analog watchdog threshold low */
Kojto 122:f9eeca106725 1182 #define LL_ADC_AWD_THRESHOLDS_HIGH_LOW (ADC_TR1_HT1 | ADC_TR1_LT1) /*!< ADC analog watchdog both thresholds high and low concatenated into the same data */
Kojto 122:f9eeca106725 1183 /**
Kojto 122:f9eeca106725 1184 * @}
Kojto 122:f9eeca106725 1185 */
Kojto 122:f9eeca106725 1186
Kojto 122:f9eeca106725 1187 /** @defgroup ADC_LL_EC_OVS_SCOPE Oversampling - Oversampling scope
Kojto 122:f9eeca106725 1188 * @{
Kojto 122:f9eeca106725 1189 */
AnnaBridge 145:64910690c574 1190 #define LL_ADC_OVS_DISABLE (0x00000000U) /*!< ADC oversampling disabled. */
Kojto 122:f9eeca106725 1191 #define LL_ADC_OVS_GRP_REGULAR_CONTINUED ( ADC_CFGR2_ROVSE) /*!< ADC oversampling on conversions of ADC group regular. If group injected interrupts group regular: when ADC group injected is triggered, the oversampling on ADC group regular is temporary stopped and continued afterwards. */
Kojto 122:f9eeca106725 1192 #define LL_ADC_OVS_GRP_REGULAR_RESUMED (ADC_CFGR2_ROVSM | ADC_CFGR2_ROVSE) /*!< ADC oversampling on conversions of ADC group regular. If group injected interrupts group regular: when ADC group injected is triggered, the oversampling on ADC group regular is resumed from start (oversampler buffer reset). */
Kojto 122:f9eeca106725 1193 #define LL_ADC_OVS_GRP_INJECTED ( ADC_CFGR2_JOVSE ) /*!< ADC oversampling on conversions of ADC group injected. */
Kojto 122:f9eeca106725 1194 #define LL_ADC_OVS_GRP_INJ_REG_RESUMED ( ADC_CFGR2_JOVSE | ADC_CFGR2_ROVSE) /*!< ADC oversampling on conversions of both ADC groups regular and injected. If group injected interrupting group regular: when ADC group injected is triggered, the oversampling on ADC group regular is resumed from start (oversampler buffer reset). */
Kojto 122:f9eeca106725 1195 /**
Kojto 122:f9eeca106725 1196 * @}
Kojto 122:f9eeca106725 1197 */
Kojto 122:f9eeca106725 1198
Kojto 122:f9eeca106725 1199 /** @defgroup ADC_LL_EC_OVS_DISCONT_MODE Oversampling - Discontinuous mode
Kojto 122:f9eeca106725 1200 * @{
Kojto 122:f9eeca106725 1201 */
AnnaBridge 145:64910690c574 1202 #define LL_ADC_OVS_REG_CONT (0x00000000U)/*!< ADC oversampling discontinuous mode: continuous mode (all conversions of oversampling ratio are done from 1 trigger) */
Kojto 122:f9eeca106725 1203 #define LL_ADC_OVS_REG_DISCONT (ADC_CFGR2_TROVS) /*!< ADC oversampling discontinuous mode: discontinuous mode (each conversion of oversampling ratio needs a trigger) */
Kojto 122:f9eeca106725 1204 /**
Kojto 122:f9eeca106725 1205 * @}
Kojto 122:f9eeca106725 1206 */
Kojto 122:f9eeca106725 1207
Kojto 122:f9eeca106725 1208 /** @defgroup ADC_LL_EC_OVS_RATIO Oversampling - Ratio
Kojto 122:f9eeca106725 1209 * @{
Kojto 122:f9eeca106725 1210 */
AnnaBridge 145:64910690c574 1211 #define LL_ADC_OVS_RATIO_2 (0x00000000U) /*!< ADC oversampling ratio of 2 (2 ADC conversions are performed, sum of these conversions data is computed to result as the ADC oversampling conversion data (before potential shift) */
Kojto 122:f9eeca106725 1212 #define LL_ADC_OVS_RATIO_4 ( ADC_CFGR2_OVSR_0) /*!< ADC oversampling ratio of 4 (4 ADC conversions are performed, sum of these conversions data is computed to result as the ADC oversampling conversion data (before potential shift) */
Kojto 122:f9eeca106725 1213 #define LL_ADC_OVS_RATIO_8 ( ADC_CFGR2_OVSR_1 ) /*!< ADC oversampling ratio of 8 (8 ADC conversions are performed, sum of these conversions data is computed to result as the ADC oversampling conversion data (before potential shift) */
Kojto 122:f9eeca106725 1214 #define LL_ADC_OVS_RATIO_16 ( ADC_CFGR2_OVSR_1 | ADC_CFGR2_OVSR_0) /*!< ADC oversampling ratio of 16 (16 ADC conversions are performed, sum of these conversions data is computed to result as the ADC oversampling conversion data (before potential shift) */
Kojto 122:f9eeca106725 1215 #define LL_ADC_OVS_RATIO_32 (ADC_CFGR2_OVSR_2 ) /*!< ADC oversampling ratio of 32 (32 ADC conversions are performed, sum of these conversions data is computed to result as the ADC oversampling conversion data (before potential shift) */
Kojto 122:f9eeca106725 1216 #define LL_ADC_OVS_RATIO_64 (ADC_CFGR2_OVSR_2 | ADC_CFGR2_OVSR_0) /*!< ADC oversampling ratio of 64 (64 ADC conversions are performed, sum of these conversions data is computed to result as the ADC oversampling conversion data (before potential shift) */
Kojto 122:f9eeca106725 1217 #define LL_ADC_OVS_RATIO_128 (ADC_CFGR2_OVSR_2 | ADC_CFGR2_OVSR_1 ) /*!< ADC oversampling ratio of 128 (128 ADC conversions are performed, sum of these conversions data is computed to result as the ADC oversampling conversion data (before potential shift) */
Kojto 122:f9eeca106725 1218 #define LL_ADC_OVS_RATIO_256 (ADC_CFGR2_OVSR_2 | ADC_CFGR2_OVSR_1 | ADC_CFGR2_OVSR_0) /*!< ADC oversampling ratio of 256 (256 ADC conversions are performed, sum of these conversions data is computed to result as the ADC oversampling conversion data (before potential shift) */
Kojto 122:f9eeca106725 1219 /**
Kojto 122:f9eeca106725 1220 * @}
Kojto 122:f9eeca106725 1221 */
Kojto 122:f9eeca106725 1222
Kojto 122:f9eeca106725 1223 /** @defgroup ADC_LL_EC_OVS_SHIFT Oversampling - Data shift
Kojto 122:f9eeca106725 1224 * @{
Kojto 122:f9eeca106725 1225 */
AnnaBridge 145:64910690c574 1226 #define LL_ADC_OVS_SHIFT_NONE (0x00000000U) /*!< ADC oversampling no shift (sum of the ADC conversions data is not divided to result as the ADC oversampling conversion data) */
Kojto 122:f9eeca106725 1227 #define LL_ADC_OVS_SHIFT_RIGHT_1 ( ADC_CFGR2_OVSS_0) /*!< ADC oversampling shift of 1 (sum of the ADC conversions data is divided by 2 to result as the ADC oversampling conversion data) */
Kojto 122:f9eeca106725 1228 #define LL_ADC_OVS_SHIFT_RIGHT_2 ( ADC_CFGR2_OVSS_1 ) /*!< ADC oversampling shift of 2 (sum of the ADC conversions data is divided by 4 to result as the ADC oversampling conversion data) */
Kojto 122:f9eeca106725 1229 #define LL_ADC_OVS_SHIFT_RIGHT_3 ( ADC_CFGR2_OVSS_1 | ADC_CFGR2_OVSS_0) /*!< ADC oversampling shift of 3 (sum of the ADC conversions data is divided by 8 to result as the ADC oversampling conversion data) */
Kojto 122:f9eeca106725 1230 #define LL_ADC_OVS_SHIFT_RIGHT_4 ( ADC_CFGR2_OVSS_2 ) /*!< ADC oversampling shift of 4 (sum of the ADC conversions data is divided by 16 to result as the ADC oversampling conversion data) */
Kojto 122:f9eeca106725 1231 #define LL_ADC_OVS_SHIFT_RIGHT_5 ( ADC_CFGR2_OVSS_2 | ADC_CFGR2_OVSS_0) /*!< ADC oversampling shift of 5 (sum of the ADC conversions data is divided by 32 to result as the ADC oversampling conversion data) */
Kojto 122:f9eeca106725 1232 #define LL_ADC_OVS_SHIFT_RIGHT_6 ( ADC_CFGR2_OVSS_2 | ADC_CFGR2_OVSS_1 ) /*!< ADC oversampling shift of 6 (sum of the ADC conversions data is divided by 64 to result as the ADC oversampling conversion data) */
Kojto 122:f9eeca106725 1233 #define LL_ADC_OVS_SHIFT_RIGHT_7 ( ADC_CFGR2_OVSS_2 | ADC_CFGR2_OVSS_1 | ADC_CFGR2_OVSS_0) /*!< ADC oversampling shift of 7 (sum of the ADC conversions data is divided by 128 to result as the ADC oversampling conversion data) */
Kojto 122:f9eeca106725 1234 #define LL_ADC_OVS_SHIFT_RIGHT_8 (ADC_CFGR2_OVSS_3 ) /*!< ADC oversampling shift of 8 (sum of the ADC conversions data is divided by 256 to result as the ADC oversampling conversion data) */
Kojto 122:f9eeca106725 1235 /**
Kojto 122:f9eeca106725 1236 * @}
Kojto 122:f9eeca106725 1237 */
Kojto 122:f9eeca106725 1238
Kojto 122:f9eeca106725 1239 #if defined(ADC_MULTIMODE_SUPPORT)
Kojto 122:f9eeca106725 1240 /** @defgroup ADC_LL_EC_MULTI_MODE Multimode - Mode
Kojto 122:f9eeca106725 1241 * @{
Kojto 122:f9eeca106725 1242 */
AnnaBridge 145:64910690c574 1243 #define LL_ADC_MULTI_INDEPENDENT (0x00000000U) /*!< ADC dual mode disabled (ADC independent mode) */
Kojto 122:f9eeca106725 1244 #define LL_ADC_MULTI_DUAL_REG_SIMULT ( ADC_CCR_DUAL_2 | ADC_CCR_DUAL_1 ) /*!< ADC dual mode enabled: group regular simultaneous */
Kojto 122:f9eeca106725 1245 #define LL_ADC_MULTI_DUAL_REG_INTERL ( ADC_CCR_DUAL_2 | ADC_CCR_DUAL_1 | ADC_CCR_DUAL_0) /*!< ADC dual mode enabled: Combined group regular interleaved */
Kojto 122:f9eeca106725 1246 #define LL_ADC_MULTI_DUAL_INJ_SIMULT ( ADC_CCR_DUAL_2 | ADC_CCR_DUAL_0) /*!< ADC dual mode enabled: group injected simultaneous */
Kojto 122:f9eeca106725 1247 #define LL_ADC_MULTI_DUAL_INJ_ALTERN (ADC_CCR_DUAL_3 | ADC_CCR_DUAL_0) /*!< ADC dual mode enabled: group injected alternate trigger. Works only with external triggers (not internal SW start) */
Kojto 122:f9eeca106725 1248 #define LL_ADC_MULTI_DUAL_REG_SIM_INJ_SIM ( ADC_CCR_DUAL_0) /*!< ADC dual mode enabled: Combined group regular simultaneous + group injected simultaneous */
Kojto 122:f9eeca106725 1249 #define LL_ADC_MULTI_DUAL_REG_SIM_INJ_ALT ( ADC_CCR_DUAL_1 ) /*!< ADC dual mode enabled: Combined group regular simultaneous + group injected alternate trigger */
Kojto 122:f9eeca106725 1250 #define LL_ADC_MULTI_DUAL_REG_INT_INJ_SIM ( ADC_CCR_DUAL_1 | ADC_CCR_DUAL_0) /*!< ADC dual mode enabled: Combined group regular interleaved + group injected simultaneous */
Kojto 122:f9eeca106725 1251 /**
Kojto 122:f9eeca106725 1252 * @}
Kojto 122:f9eeca106725 1253 */
Kojto 122:f9eeca106725 1254
Kojto 122:f9eeca106725 1255 /** @defgroup ADC_LL_EC_MULTI_DMA_TRANSFER Multimode - DMA transfer
Kojto 122:f9eeca106725 1256 * @{
Kojto 122:f9eeca106725 1257 */
AnnaBridge 145:64910690c574 1258 #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 */
Kojto 122:f9eeca106725 1259 #define LL_ADC_MULTI_REG_DMA_LIMIT_RES12_10B ( ADC_CCR_MDMA_1 ) /*!< ADC multimode group regular conversions are transferred by DMA, one DMA channel for both ADC (DMA of ADC master), in limited mode (one shot mode): DMA transfer requests are stopped when number of DMA data transfers (number of ADC conversions) is reached. This ADC mode is intended to be used with DMA mode non-circular. Setting for ADC resolution of 12 and 10 bits */
Kojto 122:f9eeca106725 1260 #define LL_ADC_MULTI_REG_DMA_LIMIT_RES8_6B ( ADC_CCR_MDMA_1 | ADC_CCR_MDMA_0) /*!< ADC multimode group regular conversions are transferred by DMA, one DMA channel for both ADC (DMA of ADC master), in limited mode (one shot mode): DMA transfer requests are stopped when number of DMA data transfers (number of ADC conversions) is reached. This ADC mode is intended to be used with DMA mode non-circular. Setting for ADC resolution of 8 and 6 bits */
Kojto 122:f9eeca106725 1261 #define LL_ADC_MULTI_REG_DMA_UNLMT_RES12_10B (ADC_CCR_DMACFG | ADC_CCR_MDMA_1 ) /*!< ADC multimode group regular conversions are transferred by DMA, one DMA channel for both ADC (DMA of ADC master), in unlimited mode: DMA transfer requests are unlimited, whatever number of DMA data transferred (number of ADC conversions). This ADC mode is intended to be used with DMA mode circular. Setting for ADC resolution of 12 and 10 bits */
Kojto 122:f9eeca106725 1262 #define LL_ADC_MULTI_REG_DMA_UNLMT_RES8_6B (ADC_CCR_DMACFG | ADC_CCR_MDMA_1 | ADC_CCR_MDMA_0) /*!< ADC multimode group regular conversions are transferred by DMA, one DMA channel for both ADC (DMA of ADC master), in unlimited mode: DMA transfer requests are unlimited, whatever number of DMA data transferred (number of ADC conversions). This ADC mode is intended to be used with DMA mode circular. Setting for ADC resolution of 8 and 6 bits */
Kojto 122:f9eeca106725 1263 /**
Kojto 122:f9eeca106725 1264 * @}
Kojto 122:f9eeca106725 1265 */
Kojto 122:f9eeca106725 1266
Kojto 122:f9eeca106725 1267 /** @defgroup ADC_LL_EC_MULTI_TWOSMP_DELAY Multimode - Delay between two sampling phases
Kojto 122:f9eeca106725 1268 * @{
Kojto 122:f9eeca106725 1269 */
AnnaBridge 145:64910690c574 1270 #define LL_ADC_MULTI_TWOSMP_DELAY_1CYCLE (0x00000000U) /*!< ADC multimode delay between two sampling phases: 1 ADC clock cycle */
Kojto 122:f9eeca106725 1271 #define LL_ADC_MULTI_TWOSMP_DELAY_2CYCLES ( ADC_CCR_DELAY_0) /*!< ADC multimode delay between two sampling phases: 2 ADC clock cycles */
Kojto 122:f9eeca106725 1272 #define LL_ADC_MULTI_TWOSMP_DELAY_3CYCLES ( ADC_CCR_DELAY_1 ) /*!< ADC multimode delay between two sampling phases: 3 ADC clock cycles */
Kojto 122:f9eeca106725 1273 #define LL_ADC_MULTI_TWOSMP_DELAY_4CYCLES ( ADC_CCR_DELAY_1 | ADC_CCR_DELAY_0) /*!< ADC multimode delay between two sampling phases: 4 ADC clock cycles */
Kojto 122:f9eeca106725 1274 #define LL_ADC_MULTI_TWOSMP_DELAY_5CYCLES ( ADC_CCR_DELAY_2 ) /*!< ADC multimode delay between two sampling phases: 5 ADC clock cycles */
Kojto 122:f9eeca106725 1275 #define LL_ADC_MULTI_TWOSMP_DELAY_6CYCLES ( ADC_CCR_DELAY_2 | ADC_CCR_DELAY_0) /*!< ADC multimode delay between two sampling phases: 6 ADC clock cycles */
Kojto 122:f9eeca106725 1276 #define LL_ADC_MULTI_TWOSMP_DELAY_7CYCLES ( ADC_CCR_DELAY_2 | ADC_CCR_DELAY_1 ) /*!< ADC multimode delay between two sampling phases: 7 ADC clock cycles */
Kojto 122:f9eeca106725 1277 #define LL_ADC_MULTI_TWOSMP_DELAY_8CYCLES ( ADC_CCR_DELAY_2 | ADC_CCR_DELAY_1 | ADC_CCR_DELAY_0) /*!< ADC multimode delay between two sampling phases: 8 ADC clock cycles */
Kojto 122:f9eeca106725 1278 #define LL_ADC_MULTI_TWOSMP_DELAY_9CYCLES (ADC_CCR_DELAY_3 ) /*!< ADC multimode delay between two sampling phases: 9 ADC clock cycles */
Kojto 122:f9eeca106725 1279 #define LL_ADC_MULTI_TWOSMP_DELAY_10CYCLES (ADC_CCR_DELAY_3 | ADC_CCR_DELAY_0) /*!< ADC multimode delay between two sampling phases: 10 ADC clock cycles */
Kojto 122:f9eeca106725 1280 #define LL_ADC_MULTI_TWOSMP_DELAY_11CYCLES (ADC_CCR_DELAY_3 | ADC_CCR_DELAY_1 ) /*!< ADC multimode delay between two sampling phases: 11 ADC clock cycles */
Kojto 122:f9eeca106725 1281 #define LL_ADC_MULTI_TWOSMP_DELAY_12CYCLES (ADC_CCR_DELAY_3 | ADC_CCR_DELAY_1 | ADC_CCR_DELAY_0) /*!< ADC multimode delay between two sampling phases: 12 ADC clock cycles */
Kojto 122:f9eeca106725 1282 /**
Kojto 122:f9eeca106725 1283 * @}
Kojto 122:f9eeca106725 1284 */
Kojto 122:f9eeca106725 1285
Kojto 122:f9eeca106725 1286 /** @defgroup ADC_LL_EC_MULTI_MASTER_SLAVE Multimode - ADC master or slave
Kojto 122:f9eeca106725 1287 * @{
Kojto 122:f9eeca106725 1288 */
Kojto 122:f9eeca106725 1289 #define LL_ADC_MULTI_MASTER ( ADC_CDR_RDATA_MST) /*!< In multimode, selection among several ADC instances: ADC master */
Kojto 122:f9eeca106725 1290 #define LL_ADC_MULTI_SLAVE (ADC_CDR_RDATA_SLV ) /*!< In multimode, selection among several ADC instances: ADC slave */
Kojto 122:f9eeca106725 1291 #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 */
Kojto 122:f9eeca106725 1292 /**
Kojto 122:f9eeca106725 1293 * @}
Kojto 122:f9eeca106725 1294 */
Kojto 122:f9eeca106725 1295
Kojto 122:f9eeca106725 1296 #endif /* ADC_MULTIMODE_SUPPORT */
Kojto 122:f9eeca106725 1297
Kojto 122:f9eeca106725 1298 /** @defgroup ADC_LL_EC_LEGACY ADC literals legacy naming
Kojto 122:f9eeca106725 1299 * @{
Kojto 122:f9eeca106725 1300 */
Kojto 122:f9eeca106725 1301 #define LL_ADC_REG_TRIG_SW_START (LL_ADC_REG_TRIG_SOFTWARE)
Kojto 122:f9eeca106725 1302 #define LL_ADC_REG_TRIG_EXT_TIM1_CC1 (LL_ADC_REG_TRIG_EXT_TIM1_CH1)
Kojto 122:f9eeca106725 1303 #define LL_ADC_REG_TRIG_EXT_TIM1_CC2 (LL_ADC_REG_TRIG_EXT_TIM1_CH2)
Kojto 122:f9eeca106725 1304 #define LL_ADC_REG_TRIG_EXT_TIM1_CC3 (LL_ADC_REG_TRIG_EXT_TIM1_CH3)
Kojto 122:f9eeca106725 1305 #define LL_ADC_REG_TRIG_EXT_TIM2_CC2 (LL_ADC_REG_TRIG_EXT_TIM2_CH2)
Kojto 122:f9eeca106725 1306 #define LL_ADC_REG_TRIG_EXT_TIM3_CC4 (LL_ADC_REG_TRIG_EXT_TIM3_CH4)
Kojto 122:f9eeca106725 1307 #define LL_ADC_REG_TRIG_EXT_TIM4_CC4 (LL_ADC_REG_TRIG_EXT_TIM4_CH4)
Kojto 122:f9eeca106725 1308
Kojto 122:f9eeca106725 1309 #define LL_ADC_INJ_TRIG_SW_START (LL_ADC_INJ_TRIG_SOFTWARE)
Kojto 122:f9eeca106725 1310 #define LL_ADC_INJ_TRIG_EXT_TIM1_CC4 (LL_ADC_INJ_TRIG_EXT_TIM1_CH4)
Kojto 122:f9eeca106725 1311 #define LL_ADC_INJ_TRIG_EXT_TIM2_CC1 (LL_ADC_INJ_TRIG_EXT_TIM2_CH1)
Kojto 122:f9eeca106725 1312 #define LL_ADC_INJ_TRIG_EXT_TIM3_CC1 (LL_ADC_INJ_TRIG_EXT_TIM3_CH1)
Kojto 122:f9eeca106725 1313 #define LL_ADC_INJ_TRIG_EXT_TIM3_CC3 (LL_ADC_INJ_TRIG_EXT_TIM3_CH3)
Kojto 122:f9eeca106725 1314 #define LL_ADC_INJ_TRIG_EXT_TIM3_CC4 (LL_ADC_INJ_TRIG_EXT_TIM3_CH4)
Kojto 122:f9eeca106725 1315 #define LL_ADC_INJ_TRIG_EXT_TIM8_CC4 (LL_ADC_INJ_TRIG_EXT_TIM8_CH4)
Kojto 122:f9eeca106725 1316
Kojto 122:f9eeca106725 1317 #define LL_ADC_OVS_DATA_SHIFT_NONE (LL_ADC_OVS_SHIFT_NONE)
Kojto 122:f9eeca106725 1318 #define LL_ADC_OVS_DATA_SHIFT_1 (LL_ADC_OVS_SHIFT_RIGHT_1)
Kojto 122:f9eeca106725 1319 #define LL_ADC_OVS_DATA_SHIFT_2 (LL_ADC_OVS_SHIFT_RIGHT_2)
Kojto 122:f9eeca106725 1320 #define LL_ADC_OVS_DATA_SHIFT_3 (LL_ADC_OVS_SHIFT_RIGHT_3)
Kojto 122:f9eeca106725 1321 #define LL_ADC_OVS_DATA_SHIFT_4 (LL_ADC_OVS_SHIFT_RIGHT_4)
Kojto 122:f9eeca106725 1322 #define LL_ADC_OVS_DATA_SHIFT_5 (LL_ADC_OVS_SHIFT_RIGHT_5)
Kojto 122:f9eeca106725 1323 #define LL_ADC_OVS_DATA_SHIFT_6 (LL_ADC_OVS_SHIFT_RIGHT_6)
Kojto 122:f9eeca106725 1324 #define LL_ADC_OVS_DATA_SHIFT_7 (LL_ADC_OVS_SHIFT_RIGHT_7)
Kojto 122:f9eeca106725 1325 #define LL_ADC_OVS_DATA_SHIFT_8 (LL_ADC_OVS_SHIFT_RIGHT_8)
Kojto 122:f9eeca106725 1326
Kojto 122:f9eeca106725 1327 /**
Kojto 122:f9eeca106725 1328 * @}
Kojto 122:f9eeca106725 1329 */
Kojto 122:f9eeca106725 1330
Kojto 122:f9eeca106725 1331
Kojto 122:f9eeca106725 1332 /** @defgroup ADC_LL_EC_HW_DELAYS Definitions of ADC hardware constraints delays
Kojto 122:f9eeca106725 1333 * @note Only ADC IP HW delays are defined in ADC LL driver driver,
Kojto 122:f9eeca106725 1334 * not timeout values.
Kojto 122:f9eeca106725 1335 * For details on delays values, refer to descriptions in source code
Kojto 122:f9eeca106725 1336 * above each literal definition.
Kojto 122:f9eeca106725 1337 * @{
Kojto 122:f9eeca106725 1338 */
Kojto 122:f9eeca106725 1339
Kojto 122:f9eeca106725 1340 /* Note: Only ADC IP HW delays are defined in ADC LL driver driver, */
Kojto 122:f9eeca106725 1341 /* not timeout values. */
Kojto 122:f9eeca106725 1342 /* Timeout values for ADC operations are dependent to device clock */
Kojto 122:f9eeca106725 1343 /* configuration (system clock versus ADC clock), */
Kojto 122:f9eeca106725 1344 /* and therefore must be defined in user application. */
Kojto 122:f9eeca106725 1345 /* Indications for estimation of ADC timeout delays, for this */
Kojto 122:f9eeca106725 1346 /* STM32 serie: */
Kojto 122:f9eeca106725 1347 /* - ADC calibration time: maximum delay is 112/fADC. */
Kojto 122:f9eeca106725 1348 /* (refer to device datasheet, parameter "tCAL") */
Kojto 122:f9eeca106725 1349 /* - ADC enable time: maximum delay is 1 conversion cycle. */
Kojto 122:f9eeca106725 1350 /* (refer to device datasheet, parameter "tSTAB") */
Kojto 122:f9eeca106725 1351 /* - ADC disable time: maximum delay should be a few ADC clock cycles */
Kojto 122:f9eeca106725 1352 /* - ADC stop conversion time: maximum delay should be a few ADC clock */
Kojto 122:f9eeca106725 1353 /* cycles */
Kojto 122:f9eeca106725 1354 /* - ADC conversion time: duration depending on ADC clock and ADC */
Kojto 122:f9eeca106725 1355 /* configuration. */
Kojto 122:f9eeca106725 1356 /* (refer to device reference manual, section "Timing") */
Kojto 122:f9eeca106725 1357
Kojto 122:f9eeca106725 1358 /* Delay for ADC stabilization time (ADC voltage regulator start-up time) */
Kojto 122:f9eeca106725 1359 /* Delay set to maximum value (refer to device datasheet, */
Kojto 122:f9eeca106725 1360 /* parameter "tADCVREG_STUP"). */
Kojto 122:f9eeca106725 1361 /* Unit: us */
AnnaBridge 145:64910690c574 1362 #define LL_ADC_DELAY_INTERNAL_REGUL_STAB_US ( 10U) /*!< Delay for ADC stabilization time (ADC voltage regulator start-up time) */
Kojto 122:f9eeca106725 1363
Kojto 122:f9eeca106725 1364 /* Delay for internal voltage reference stabilization time. */
Kojto 122:f9eeca106725 1365 /* Delay set to maximum value (refer to device datasheet, */
Kojto 122:f9eeca106725 1366 /* parameter "tstart_vrefint"). */
Kojto 122:f9eeca106725 1367 /* Unit: us */
AnnaBridge 145:64910690c574 1368 #define LL_ADC_DELAY_VREFINT_STAB_US ( 12U) /*!< Delay for internal voltage reference stabilization time */
Kojto 122:f9eeca106725 1369
Kojto 122:f9eeca106725 1370 /* Delay for temperature sensor stabilization time. */
Kojto 122:f9eeca106725 1371 /* Literal set to maximum value (refer to device datasheet, */
Kojto 122:f9eeca106725 1372 /* parameter "tSTART"). */
Kojto 122:f9eeca106725 1373 /* Unit: us */
AnnaBridge 145:64910690c574 1374 #define LL_ADC_DELAY_TEMPSENSOR_STAB_US ( 120U) /*!< Delay for temperature sensor stabilization time */
Kojto 122:f9eeca106725 1375
Kojto 122:f9eeca106725 1376 /* Delay required between ADC end of calibration and ADC enable. */
Kojto 122:f9eeca106725 1377 /* Note: On this STM32 serie, a minimum number of ADC clock cycles */
Kojto 122:f9eeca106725 1378 /* are required between ADC end of calibration and ADC enable. */
Kojto 122:f9eeca106725 1379 /* Wait time can be computed in user application by waiting for the */
Kojto 122:f9eeca106725 1380 /* equivalent number of CPU cycles, by taking into account */
Kojto 122:f9eeca106725 1381 /* ratio of CPU clock versus ADC clock prescalers. */
Kojto 122:f9eeca106725 1382 /* Unit: ADC clock cycles. */
AnnaBridge 145:64910690c574 1383 #define LL_ADC_DELAY_CALIB_ENABLE_ADC_CYCLES ( 4U) /*!< Delay required between ADC end of calibration and ADC enable */
Kojto 122:f9eeca106725 1384
Kojto 122:f9eeca106725 1385 /**
Kojto 122:f9eeca106725 1386 * @}
Kojto 122:f9eeca106725 1387 */
Kojto 122:f9eeca106725 1388
Kojto 122:f9eeca106725 1389 /**
Kojto 122:f9eeca106725 1390 * @}
Kojto 122:f9eeca106725 1391 */
Kojto 122:f9eeca106725 1392
Kojto 122:f9eeca106725 1393
Kojto 122:f9eeca106725 1394 /* Exported macro ------------------------------------------------------------*/
Kojto 122:f9eeca106725 1395 /** @defgroup ADC_LL_Exported_Macros ADC Exported Macros
Kojto 122:f9eeca106725 1396 * @{
Kojto 122:f9eeca106725 1397 */
Kojto 122:f9eeca106725 1398
Kojto 122:f9eeca106725 1399 /** @defgroup ADC_LL_EM_WRITE_READ Common write and read registers Macros
Kojto 122:f9eeca106725 1400 * @{
Kojto 122:f9eeca106725 1401 */
Kojto 122:f9eeca106725 1402
Kojto 122:f9eeca106725 1403 /**
Kojto 122:f9eeca106725 1404 * @brief Write a value in ADC register
Kojto 122:f9eeca106725 1405 * @param __INSTANCE__ ADC Instance
Kojto 122:f9eeca106725 1406 * @param __REG__ Register to be written
Kojto 122:f9eeca106725 1407 * @param __VALUE__ Value to be written in the register
Kojto 122:f9eeca106725 1408 * @retval None
Kojto 122:f9eeca106725 1409 */
Kojto 122:f9eeca106725 1410 #define LL_ADC_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
Kojto 122:f9eeca106725 1411
Kojto 122:f9eeca106725 1412 /**
Kojto 122:f9eeca106725 1413 * @brief Read a value in ADC register
Kojto 122:f9eeca106725 1414 * @param __INSTANCE__ ADC Instance
Kojto 122:f9eeca106725 1415 * @param __REG__ Register to be read
Kojto 122:f9eeca106725 1416 * @retval Register value
Kojto 122:f9eeca106725 1417 */
Kojto 122:f9eeca106725 1418 #define LL_ADC_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
Kojto 122:f9eeca106725 1419 /**
Kojto 122:f9eeca106725 1420 * @}
Kojto 122:f9eeca106725 1421 */
Kojto 122:f9eeca106725 1422
Kojto 122:f9eeca106725 1423 /** @defgroup ADC_LL_EM_HELPER_MACRO ADC helper macro
Kojto 122:f9eeca106725 1424 * @{
Kojto 122:f9eeca106725 1425 */
Kojto 122:f9eeca106725 1426
Kojto 122:f9eeca106725 1427 /**
Kojto 122:f9eeca106725 1428 * @brief Helper macro to get ADC channel number in decimal format
Kojto 122:f9eeca106725 1429 * from literals LL_ADC_CHANNEL_x.
Kojto 122:f9eeca106725 1430 * @note Example:
Kojto 122:f9eeca106725 1431 * __LL_ADC_CHANNEL_TO_DECIMAL_NB(LL_ADC_CHANNEL_4)
Kojto 122:f9eeca106725 1432 * will return decimal number "4".
Kojto 122:f9eeca106725 1433 * @note The input can be a value from functions where a channel
Kojto 122:f9eeca106725 1434 * number is returned, either defined with number
Kojto 122:f9eeca106725 1435 * or with bitfield (only one bit must be set).
Kojto 122:f9eeca106725 1436 * @param __CHANNEL__ This parameter can be one of the following values:
Kojto 122:f9eeca106725 1437 * @arg @ref LL_ADC_CHANNEL_0
Kojto 122:f9eeca106725 1438 * @arg @ref LL_ADC_CHANNEL_1 (7)
Kojto 122:f9eeca106725 1439 * @arg @ref LL_ADC_CHANNEL_2 (7)
Kojto 122:f9eeca106725 1440 * @arg @ref LL_ADC_CHANNEL_3 (7)
Kojto 122:f9eeca106725 1441 * @arg @ref LL_ADC_CHANNEL_4 (7)
Kojto 122:f9eeca106725 1442 * @arg @ref LL_ADC_CHANNEL_5 (7)
Kojto 122:f9eeca106725 1443 * @arg @ref LL_ADC_CHANNEL_6
Kojto 122:f9eeca106725 1444 * @arg @ref LL_ADC_CHANNEL_7
Kojto 122:f9eeca106725 1445 * @arg @ref LL_ADC_CHANNEL_8
Kojto 122:f9eeca106725 1446 * @arg @ref LL_ADC_CHANNEL_9
Kojto 122:f9eeca106725 1447 * @arg @ref LL_ADC_CHANNEL_10
Kojto 122:f9eeca106725 1448 * @arg @ref LL_ADC_CHANNEL_11
Kojto 122:f9eeca106725 1449 * @arg @ref LL_ADC_CHANNEL_12
Kojto 122:f9eeca106725 1450 * @arg @ref LL_ADC_CHANNEL_13
Kojto 122:f9eeca106725 1451 * @arg @ref LL_ADC_CHANNEL_14
Kojto 122:f9eeca106725 1452 * @arg @ref LL_ADC_CHANNEL_15
Kojto 122:f9eeca106725 1453 * @arg @ref LL_ADC_CHANNEL_16
Kojto 122:f9eeca106725 1454 * @arg @ref LL_ADC_CHANNEL_17
Kojto 122:f9eeca106725 1455 * @arg @ref LL_ADC_CHANNEL_18
Kojto 122:f9eeca106725 1456 * @arg @ref LL_ADC_CHANNEL_VREFINT (1)
Kojto 122:f9eeca106725 1457 * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR (4)
Kojto 122:f9eeca106725 1458 * @arg @ref LL_ADC_CHANNEL_VBAT (4)
Kojto 122:f9eeca106725 1459 * @arg @ref LL_ADC_CHANNEL_DAC1CH1 (5)
Kojto 122:f9eeca106725 1460 * @arg @ref LL_ADC_CHANNEL_DAC1CH2 (5)
Kojto 122:f9eeca106725 1461 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)(6)
Kojto 122:f9eeca106725 1462 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)(6)
Kojto 122:f9eeca106725 1463 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC3 (3)(6)
Kojto 122:f9eeca106725 1464 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC3 (3)(6)
Kojto 122:f9eeca106725 1465 *
Kojto 122:f9eeca106725 1466 * (1) On STM32L4, parameter available only on ADC instance: ADC1.\n
Kojto 122:f9eeca106725 1467 * (2) On STM32L4, parameter available only on ADC instance: ADC2.\n
Kojto 122:f9eeca106725 1468 * (3) On STM32L4, parameter available only on ADC instance: ADC3.\n
Kojto 122:f9eeca106725 1469 * (4) On STM32L4, parameter available only on ADC instances: ADC1, ADC3.\n
Kojto 122:f9eeca106725 1470 * (5) On STM32L4, parameter available on devices with only 1 ADC instance.\n
Kojto 122:f9eeca106725 1471 * (6) On STM32L4, parameter available on devices with several ADC instances.\n
Kojto 122:f9eeca106725 1472 * (7) On STM32L4, fast channel (0.188 us for 12-bit resolution (ADC conversion rate up to 5.33 Ms/s)).
Kojto 122:f9eeca106725 1473 * Other channels are slow channels (0.238 us for 12-bit resolution (ADC conversion rate up to 4.21 Ms/s)).
Kojto 122:f9eeca106725 1474 * @retval Value between Min_Data=0 and Max_Data=18
Kojto 122:f9eeca106725 1475 */
Kojto 122:f9eeca106725 1476 #define __LL_ADC_CHANNEL_TO_DECIMAL_NB(__CHANNEL__) \
Kojto 122:f9eeca106725 1477 ((((__CHANNEL__) & ADC_CHANNEL_ID_BITFIELD_MASK) == 0U) \
Kojto 122:f9eeca106725 1478 ? ( \
Kojto 122:f9eeca106725 1479 ((__CHANNEL__) & ADC_CHANNEL_ID_NUMBER_MASK) >> ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS \
Kojto 122:f9eeca106725 1480 ) \
Kojto 122:f9eeca106725 1481 : \
Kojto 122:f9eeca106725 1482 ( \
Kojto 122:f9eeca106725 1483 POSITION_VAL((__CHANNEL__)) \
Kojto 122:f9eeca106725 1484 ) \
Kojto 122:f9eeca106725 1485 )
Kojto 122:f9eeca106725 1486
Kojto 122:f9eeca106725 1487 /**
Kojto 122:f9eeca106725 1488 * @brief Helper macro to get ADC channel in literal format LL_ADC_CHANNEL_x
Kojto 122:f9eeca106725 1489 * from number in decimal format.
Kojto 122:f9eeca106725 1490 * @note Example:
Kojto 122:f9eeca106725 1491 * __LL_ADC_DECIMAL_NB_TO_CHANNEL(4)
Kojto 122:f9eeca106725 1492 * will return a data equivalent to "LL_ADC_CHANNEL_4".
Kojto 122:f9eeca106725 1493 * @param __DECIMAL_NB__: Value between Min_Data=0 and Max_Data=18
Kojto 122:f9eeca106725 1494 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 1495 * @arg @ref LL_ADC_CHANNEL_0
Kojto 122:f9eeca106725 1496 * @arg @ref LL_ADC_CHANNEL_1 (7)
Kojto 122:f9eeca106725 1497 * @arg @ref LL_ADC_CHANNEL_2 (7)
Kojto 122:f9eeca106725 1498 * @arg @ref LL_ADC_CHANNEL_3 (7)
Kojto 122:f9eeca106725 1499 * @arg @ref LL_ADC_CHANNEL_4 (7)
Kojto 122:f9eeca106725 1500 * @arg @ref LL_ADC_CHANNEL_5 (7)
Kojto 122:f9eeca106725 1501 * @arg @ref LL_ADC_CHANNEL_6
Kojto 122:f9eeca106725 1502 * @arg @ref LL_ADC_CHANNEL_7
Kojto 122:f9eeca106725 1503 * @arg @ref LL_ADC_CHANNEL_8
Kojto 122:f9eeca106725 1504 * @arg @ref LL_ADC_CHANNEL_9
Kojto 122:f9eeca106725 1505 * @arg @ref LL_ADC_CHANNEL_10
Kojto 122:f9eeca106725 1506 * @arg @ref LL_ADC_CHANNEL_11
Kojto 122:f9eeca106725 1507 * @arg @ref LL_ADC_CHANNEL_12
Kojto 122:f9eeca106725 1508 * @arg @ref LL_ADC_CHANNEL_13
Kojto 122:f9eeca106725 1509 * @arg @ref LL_ADC_CHANNEL_14
Kojto 122:f9eeca106725 1510 * @arg @ref LL_ADC_CHANNEL_15
Kojto 122:f9eeca106725 1511 * @arg @ref LL_ADC_CHANNEL_16
Kojto 122:f9eeca106725 1512 * @arg @ref LL_ADC_CHANNEL_17
Kojto 122:f9eeca106725 1513 * @arg @ref LL_ADC_CHANNEL_18
Kojto 122:f9eeca106725 1514 * @arg @ref LL_ADC_CHANNEL_VREFINT (1)
Kojto 122:f9eeca106725 1515 * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR (4)
Kojto 122:f9eeca106725 1516 * @arg @ref LL_ADC_CHANNEL_VBAT (4)
Kojto 122:f9eeca106725 1517 * @arg @ref LL_ADC_CHANNEL_DAC1CH1 (5)
Kojto 122:f9eeca106725 1518 * @arg @ref LL_ADC_CHANNEL_DAC1CH2 (5)
Kojto 122:f9eeca106725 1519 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)(6)
Kojto 122:f9eeca106725 1520 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)(6)
Kojto 122:f9eeca106725 1521 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC3 (3)(6)
Kojto 122:f9eeca106725 1522 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC3 (3)(6)
Kojto 122:f9eeca106725 1523 *
Kojto 122:f9eeca106725 1524 * (1) On STM32L4, parameter available only on ADC instance: ADC1.\n
Kojto 122:f9eeca106725 1525 * (2) On STM32L4, parameter available only on ADC instance: ADC2.\n
Kojto 122:f9eeca106725 1526 * (3) On STM32L4, parameter available only on ADC instance: ADC3.\n
Kojto 122:f9eeca106725 1527 * (4) On STM32L4, parameter available only on ADC instances: ADC1, ADC3.\n
Kojto 122:f9eeca106725 1528 * (5) On STM32L4, parameter available on devices with only 1 ADC instance.\n
Kojto 122:f9eeca106725 1529 * (6) On STM32L4, parameter available on devices with several ADC instances.\n
Kojto 122:f9eeca106725 1530 * (7) On STM32L4, fast channel (0.188 us for 12-bit resolution (ADC conversion rate up to 5.33 Ms/s)).
Kojto 122:f9eeca106725 1531 * Other channels are slow channels (0.238 us for 12-bit resolution (ADC conversion rate up to 4.21 Ms/s)).\n
Kojto 122:f9eeca106725 1532 * (1, 2, 3, 4) For ADC channel read back from ADC register,
Kojto 122:f9eeca106725 1533 * comparison with internal channel parameter to be done
Kojto 122:f9eeca106725 1534 * using helper macro @ref __LL_ADC_CHANNEL_INTERNAL_TO_EXTERNAL().
Kojto 122:f9eeca106725 1535 */
Kojto 122:f9eeca106725 1536 #define __LL_ADC_DECIMAL_NB_TO_CHANNEL(__DECIMAL_NB__) \
Kojto 122:f9eeca106725 1537 (((__DECIMAL_NB__) <= 9U) \
Kojto 122:f9eeca106725 1538 ? ( \
Kojto 122:f9eeca106725 1539 ((__DECIMAL_NB__) << ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS) | \
Kojto 122:f9eeca106725 1540 (ADC_AWD2CR_AWD2CH_0 << (__DECIMAL_NB__)) | \
Kojto 122:f9eeca106725 1541 (ADC_SMPR1_REGOFFSET | (((uint32_t) (3U * (__DECIMAL_NB__))) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) \
Kojto 122:f9eeca106725 1542 ) \
Kojto 122:f9eeca106725 1543 : \
Kojto 122:f9eeca106725 1544 ( \
Kojto 122:f9eeca106725 1545 ((__DECIMAL_NB__) << ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS) | \
Kojto 122:f9eeca106725 1546 (ADC_AWD2CR_AWD2CH_0 << (__DECIMAL_NB__)) | \
Kojto 122:f9eeca106725 1547 (ADC_SMPR2_REGOFFSET | (((uint32_t) (3U * ((__DECIMAL_NB__) - 10U))) << ADC_CHANNEL_SMPx_BITOFFSET_POS)) \
Kojto 122:f9eeca106725 1548 ) \
Kojto 122:f9eeca106725 1549 )
Kojto 122:f9eeca106725 1550
Kojto 122:f9eeca106725 1551 /**
Kojto 122:f9eeca106725 1552 * @brief Helper macro to determine whether the selected channel
Kojto 122:f9eeca106725 1553 * corresponds to literal definitions of driver.
Kojto 122:f9eeca106725 1554 * @note The different literal definitions of ADC channels are:
Kojto 122:f9eeca106725 1555 * - ADC internal channel:
Kojto 122:f9eeca106725 1556 * LL_ADC_CHANNEL_VREFINT, LL_ADC_CHANNEL_TEMPSENSOR, ...
Kojto 122:f9eeca106725 1557 * - ADC external channel (channel connected to a GPIO pin):
Kojto 122:f9eeca106725 1558 * LL_ADC_CHANNEL_1, LL_ADC_CHANNEL_2, ...
Kojto 122:f9eeca106725 1559 * @note The channel parameter must be a value defined from literal
Kojto 122:f9eeca106725 1560 * definition of a ADC internal channel (LL_ADC_CHANNEL_VREFINT,
Kojto 122:f9eeca106725 1561 * LL_ADC_CHANNEL_TEMPSENSOR, ...),
Kojto 122:f9eeca106725 1562 * ADC external channel (LL_ADC_CHANNEL_1, LL_ADC_CHANNEL_2, ...),
Kojto 122:f9eeca106725 1563 * must not be a value from functions where a channel number is
Kojto 122:f9eeca106725 1564 * returned from ADC registers,
Kojto 122:f9eeca106725 1565 * because internal and external channels share the same channel
Kojto 122:f9eeca106725 1566 * number in ADC registers. The differentiation is made only with
Kojto 122:f9eeca106725 1567 * parameters definitions of driver.
Kojto 122:f9eeca106725 1568 * @param __CHANNEL__ This parameter can be one of the following values:
Kojto 122:f9eeca106725 1569 * @arg @ref LL_ADC_CHANNEL_0
Kojto 122:f9eeca106725 1570 * @arg @ref LL_ADC_CHANNEL_1 (7)
Kojto 122:f9eeca106725 1571 * @arg @ref LL_ADC_CHANNEL_2 (7)
Kojto 122:f9eeca106725 1572 * @arg @ref LL_ADC_CHANNEL_3 (7)
Kojto 122:f9eeca106725 1573 * @arg @ref LL_ADC_CHANNEL_4 (7)
Kojto 122:f9eeca106725 1574 * @arg @ref LL_ADC_CHANNEL_5 (7)
Kojto 122:f9eeca106725 1575 * @arg @ref LL_ADC_CHANNEL_6
Kojto 122:f9eeca106725 1576 * @arg @ref LL_ADC_CHANNEL_7
Kojto 122:f9eeca106725 1577 * @arg @ref LL_ADC_CHANNEL_8
Kojto 122:f9eeca106725 1578 * @arg @ref LL_ADC_CHANNEL_9
Kojto 122:f9eeca106725 1579 * @arg @ref LL_ADC_CHANNEL_10
Kojto 122:f9eeca106725 1580 * @arg @ref LL_ADC_CHANNEL_11
Kojto 122:f9eeca106725 1581 * @arg @ref LL_ADC_CHANNEL_12
Kojto 122:f9eeca106725 1582 * @arg @ref LL_ADC_CHANNEL_13
Kojto 122:f9eeca106725 1583 * @arg @ref LL_ADC_CHANNEL_14
Kojto 122:f9eeca106725 1584 * @arg @ref LL_ADC_CHANNEL_15
Kojto 122:f9eeca106725 1585 * @arg @ref LL_ADC_CHANNEL_16
Kojto 122:f9eeca106725 1586 * @arg @ref LL_ADC_CHANNEL_17
Kojto 122:f9eeca106725 1587 * @arg @ref LL_ADC_CHANNEL_18
Kojto 122:f9eeca106725 1588 * @arg @ref LL_ADC_CHANNEL_VREFINT (1)
Kojto 122:f9eeca106725 1589 * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR (4)
Kojto 122:f9eeca106725 1590 * @arg @ref LL_ADC_CHANNEL_VBAT (4)
Kojto 122:f9eeca106725 1591 * @arg @ref LL_ADC_CHANNEL_DAC1CH1 (5)
Kojto 122:f9eeca106725 1592 * @arg @ref LL_ADC_CHANNEL_DAC1CH2 (5)
Kojto 122:f9eeca106725 1593 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)(6)
Kojto 122:f9eeca106725 1594 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)(6)
Kojto 122:f9eeca106725 1595 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC3 (3)(6)
Kojto 122:f9eeca106725 1596 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC3 (3)(6)
Kojto 122:f9eeca106725 1597 *
Kojto 122:f9eeca106725 1598 * (1) On STM32L4, parameter available only on ADC instance: ADC1.\n
Kojto 122:f9eeca106725 1599 * (2) On STM32L4, parameter available only on ADC instance: ADC2.\n
Kojto 122:f9eeca106725 1600 * (3) On STM32L4, parameter available only on ADC instance: ADC3.\n
Kojto 122:f9eeca106725 1601 * (4) On STM32L4, parameter available only on ADC instances: ADC1, ADC3.\n
Kojto 122:f9eeca106725 1602 * (5) On STM32L4, parameter available on devices with only 1 ADC instance.\n
Kojto 122:f9eeca106725 1603 * (6) On STM32L4, parameter available on devices with several ADC instances.\n
Kojto 122:f9eeca106725 1604 * (7) On STM32L4, fast channel (0.188 us for 12-bit resolution (ADC conversion rate up to 5.33 Ms/s)).
Kojto 122:f9eeca106725 1605 * Other channels are slow channels (0.238 us for 12-bit resolution (ADC conversion rate up to 4.21 Ms/s)).
Kojto 122:f9eeca106725 1606 * @retval Value "0" if the channel corresponds to a parameter definition of a ADC external channel (channel connected to a GPIO pin).
Kojto 122:f9eeca106725 1607 * Value "1" if the channel corresponds to a parameter definition of a ADC internal channel.
Kojto 122:f9eeca106725 1608 */
Kojto 122:f9eeca106725 1609 #define __LL_ADC_IS_CHANNEL_INTERNAL(__CHANNEL__) \
Kojto 122:f9eeca106725 1610 (((__CHANNEL__) & ADC_CHANNEL_ID_INTERNAL_CH_MASK) != 0U)
Kojto 122:f9eeca106725 1611
Kojto 122:f9eeca106725 1612 /**
Kojto 122:f9eeca106725 1613 * @brief Helper macro to convert a channel defined from parameter
Kojto 122:f9eeca106725 1614 * definition of a ADC internal channel (LL_ADC_CHANNEL_VREFINT,
Kojto 122:f9eeca106725 1615 * LL_ADC_CHANNEL_TEMPSENSOR, ...),
Kojto 122:f9eeca106725 1616 * to its equivalent parameter definition of a ADC external channel
Kojto 122:f9eeca106725 1617 * (LL_ADC_CHANNEL_1, LL_ADC_CHANNEL_2, ...).
Kojto 122:f9eeca106725 1618 * @note The channel parameter can be, additionally to a value
Kojto 122:f9eeca106725 1619 * defined from parameter definition of a ADC internal channel
Kojto 122:f9eeca106725 1620 * (LL_ADC_CHANNEL_VREFINT, LL_ADC_CHANNEL_TEMPSENSOR, ...),
Kojto 122:f9eeca106725 1621 * a value defined from parameter definition of
Kojto 122:f9eeca106725 1622 * ADC external channel (LL_ADC_CHANNEL_1, LL_ADC_CHANNEL_2, ...)
Kojto 122:f9eeca106725 1623 * or a value from functions where a channel number is returned
Kojto 122:f9eeca106725 1624 * from ADC registers.
Kojto 122:f9eeca106725 1625 * @param __CHANNEL__ This parameter can be one of the following values:
Kojto 122:f9eeca106725 1626 * @arg @ref LL_ADC_CHANNEL_0
Kojto 122:f9eeca106725 1627 * @arg @ref LL_ADC_CHANNEL_1 (7)
Kojto 122:f9eeca106725 1628 * @arg @ref LL_ADC_CHANNEL_2 (7)
Kojto 122:f9eeca106725 1629 * @arg @ref LL_ADC_CHANNEL_3 (7)
Kojto 122:f9eeca106725 1630 * @arg @ref LL_ADC_CHANNEL_4 (7)
Kojto 122:f9eeca106725 1631 * @arg @ref LL_ADC_CHANNEL_5 (7)
Kojto 122:f9eeca106725 1632 * @arg @ref LL_ADC_CHANNEL_6
Kojto 122:f9eeca106725 1633 * @arg @ref LL_ADC_CHANNEL_7
Kojto 122:f9eeca106725 1634 * @arg @ref LL_ADC_CHANNEL_8
Kojto 122:f9eeca106725 1635 * @arg @ref LL_ADC_CHANNEL_9
Kojto 122:f9eeca106725 1636 * @arg @ref LL_ADC_CHANNEL_10
Kojto 122:f9eeca106725 1637 * @arg @ref LL_ADC_CHANNEL_11
Kojto 122:f9eeca106725 1638 * @arg @ref LL_ADC_CHANNEL_12
Kojto 122:f9eeca106725 1639 * @arg @ref LL_ADC_CHANNEL_13
Kojto 122:f9eeca106725 1640 * @arg @ref LL_ADC_CHANNEL_14
Kojto 122:f9eeca106725 1641 * @arg @ref LL_ADC_CHANNEL_15
Kojto 122:f9eeca106725 1642 * @arg @ref LL_ADC_CHANNEL_16
Kojto 122:f9eeca106725 1643 * @arg @ref LL_ADC_CHANNEL_17
Kojto 122:f9eeca106725 1644 * @arg @ref LL_ADC_CHANNEL_18
Kojto 122:f9eeca106725 1645 * @arg @ref LL_ADC_CHANNEL_VREFINT (1)
Kojto 122:f9eeca106725 1646 * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR (4)
Kojto 122:f9eeca106725 1647 * @arg @ref LL_ADC_CHANNEL_VBAT (4)
Kojto 122:f9eeca106725 1648 * @arg @ref LL_ADC_CHANNEL_DAC1CH1 (5)
Kojto 122:f9eeca106725 1649 * @arg @ref LL_ADC_CHANNEL_DAC1CH2 (5)
Kojto 122:f9eeca106725 1650 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)(6)
Kojto 122:f9eeca106725 1651 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)(6)
Kojto 122:f9eeca106725 1652 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC3 (3)(6)
Kojto 122:f9eeca106725 1653 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC3 (3)(6)
Kojto 122:f9eeca106725 1654 *
Kojto 122:f9eeca106725 1655 * (1) On STM32L4, parameter available only on ADC instance: ADC1.\n
Kojto 122:f9eeca106725 1656 * (2) On STM32L4, parameter available only on ADC instance: ADC2.\n
Kojto 122:f9eeca106725 1657 * (3) On STM32L4, parameter available only on ADC instance: ADC3.\n
Kojto 122:f9eeca106725 1658 * (4) On STM32L4, parameter available only on ADC instances: ADC1, ADC3.\n
Kojto 122:f9eeca106725 1659 * (5) On STM32L4, parameter available on devices with only 1 ADC instance.\n
Kojto 122:f9eeca106725 1660 * (6) On STM32L4, parameter available on devices with several ADC instances.\n
Kojto 122:f9eeca106725 1661 * (7) On STM32L4, fast channel (0.188 us for 12-bit resolution (ADC conversion rate up to 5.33 Ms/s)).
Kojto 122:f9eeca106725 1662 * Other channels are slow channels (0.238 us for 12-bit resolution (ADC conversion rate up to 4.21 Ms/s)).
Kojto 122:f9eeca106725 1663 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 1664 * @arg @ref LL_ADC_CHANNEL_0
Kojto 122:f9eeca106725 1665 * @arg @ref LL_ADC_CHANNEL_1
Kojto 122:f9eeca106725 1666 * @arg @ref LL_ADC_CHANNEL_2
Kojto 122:f9eeca106725 1667 * @arg @ref LL_ADC_CHANNEL_3
Kojto 122:f9eeca106725 1668 * @arg @ref LL_ADC_CHANNEL_4
Kojto 122:f9eeca106725 1669 * @arg @ref LL_ADC_CHANNEL_5
Kojto 122:f9eeca106725 1670 * @arg @ref LL_ADC_CHANNEL_6
Kojto 122:f9eeca106725 1671 * @arg @ref LL_ADC_CHANNEL_7
Kojto 122:f9eeca106725 1672 * @arg @ref LL_ADC_CHANNEL_8
Kojto 122:f9eeca106725 1673 * @arg @ref LL_ADC_CHANNEL_9
Kojto 122:f9eeca106725 1674 * @arg @ref LL_ADC_CHANNEL_10
Kojto 122:f9eeca106725 1675 * @arg @ref LL_ADC_CHANNEL_11
Kojto 122:f9eeca106725 1676 * @arg @ref LL_ADC_CHANNEL_12
Kojto 122:f9eeca106725 1677 * @arg @ref LL_ADC_CHANNEL_13
Kojto 122:f9eeca106725 1678 * @arg @ref LL_ADC_CHANNEL_14
Kojto 122:f9eeca106725 1679 * @arg @ref LL_ADC_CHANNEL_15
Kojto 122:f9eeca106725 1680 * @arg @ref LL_ADC_CHANNEL_16
Kojto 122:f9eeca106725 1681 * @arg @ref LL_ADC_CHANNEL_17
Kojto 122:f9eeca106725 1682 * @arg @ref LL_ADC_CHANNEL_18
Kojto 122:f9eeca106725 1683 */
Kojto 122:f9eeca106725 1684 #define __LL_ADC_CHANNEL_INTERNAL_TO_EXTERNAL(__CHANNEL__) \
Kojto 122:f9eeca106725 1685 ((__CHANNEL__) & ~ADC_CHANNEL_ID_INTERNAL_CH_MASK)
Kojto 122:f9eeca106725 1686
Kojto 122:f9eeca106725 1687 /**
Kojto 122:f9eeca106725 1688 * @brief Helper macro to determine whether the internal channel
Kojto 122:f9eeca106725 1689 * selected is available on the ADC instance selected.
Kojto 122:f9eeca106725 1690 * @note The channel parameter must be a value defined from parameter
Kojto 122:f9eeca106725 1691 * definition of a ADC internal channel (LL_ADC_CHANNEL_VREFINT,
Kojto 122:f9eeca106725 1692 * LL_ADC_CHANNEL_TEMPSENSOR, ...),
Kojto 122:f9eeca106725 1693 * must not be a value defined from parameter definition of
Kojto 122:f9eeca106725 1694 * ADC external channel (LL_ADC_CHANNEL_1, LL_ADC_CHANNEL_2, ...)
Kojto 122:f9eeca106725 1695 * or a value from functions where a channel number is
Kojto 122:f9eeca106725 1696 * returned from ADC registers,
Kojto 122:f9eeca106725 1697 * because internal and external channels share the same channel
Kojto 122:f9eeca106725 1698 * number in ADC registers. The differentiation is made only with
Kojto 122:f9eeca106725 1699 * parameters definitions of driver.
Kojto 122:f9eeca106725 1700 * @param __ADC_INSTANCE__ ADC instance
Kojto 122:f9eeca106725 1701 * @param __CHANNEL__ This parameter can be one of the following values:
Kojto 122:f9eeca106725 1702 * @arg @ref LL_ADC_CHANNEL_VREFINT (1)
Kojto 122:f9eeca106725 1703 * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR (4)
Kojto 122:f9eeca106725 1704 * @arg @ref LL_ADC_CHANNEL_VBAT (4)
Kojto 122:f9eeca106725 1705 * @arg @ref LL_ADC_CHANNEL_DAC1CH1 (5)
Kojto 122:f9eeca106725 1706 * @arg @ref LL_ADC_CHANNEL_DAC1CH2 (5)
Kojto 122:f9eeca106725 1707 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)(6)
Kojto 122:f9eeca106725 1708 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)(6)
Kojto 122:f9eeca106725 1709 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC3 (3)(6)
Kojto 122:f9eeca106725 1710 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC3 (3)(6)
Kojto 122:f9eeca106725 1711 *
Kojto 122:f9eeca106725 1712 * (1) On STM32L4, parameter available only on ADC instance: ADC1.\n
Kojto 122:f9eeca106725 1713 * (2) On STM32L4, parameter available only on ADC instance: ADC2.\n
Kojto 122:f9eeca106725 1714 * (3) On STM32L4, parameter available only on ADC instance: ADC3.\n
Kojto 122:f9eeca106725 1715 * (4) On STM32L4, parameter available only on ADC instances: ADC1, ADC3.\n
Kojto 122:f9eeca106725 1716 * (5) On STM32L4, parameter available on devices with only 1 ADC instance.\n
AnnaBridge 145:64910690c574 1717 * (6) On STM32L4, parameter available on devices with several ADC instances.
Kojto 122:f9eeca106725 1718 * @retval Value "0" if the internal channel selected is not available on the ADC instance selected.
Kojto 122:f9eeca106725 1719 * Value "1" if the internal channel selected is available on the ADC instance selected.
Kojto 122:f9eeca106725 1720 */
Kojto 122:f9eeca106725 1721 #if defined (ADC1) && defined (ADC2) && defined (ADC3)
Kojto 122:f9eeca106725 1722 #define __LL_ADC_IS_CHANNEL_INTERNAL_AVAILABLE(__ADC_INSTANCE__, __CHANNEL__) \
Kojto 122:f9eeca106725 1723 (((__ADC_INSTANCE__) == ADC1) \
Kojto 122:f9eeca106725 1724 ? ( \
Kojto 122:f9eeca106725 1725 ((__CHANNEL__) == LL_ADC_CHANNEL_VREFINT) || \
Kojto 122:f9eeca106725 1726 ((__CHANNEL__) == LL_ADC_CHANNEL_TEMPSENSOR) || \
Kojto 122:f9eeca106725 1727 ((__CHANNEL__) == LL_ADC_CHANNEL_VBAT) \
Kojto 122:f9eeca106725 1728 ) \
Kojto 122:f9eeca106725 1729 : \
Kojto 122:f9eeca106725 1730 ((__ADC_INSTANCE__) == ADC2) \
Kojto 122:f9eeca106725 1731 ? ( \
Kojto 122:f9eeca106725 1732 ((__CHANNEL__) == LL_ADC_CHANNEL_VREFINT) || \
Kojto 122:f9eeca106725 1733 ((__CHANNEL__) == LL_ADC_CHANNEL_DAC1CH1_ADC2) || \
Kojto 122:f9eeca106725 1734 ((__CHANNEL__) == LL_ADC_CHANNEL_DAC1CH2_ADC2) \
Kojto 122:f9eeca106725 1735 ) \
Kojto 122:f9eeca106725 1736 : \
Kojto 122:f9eeca106725 1737 ((__ADC_INSTANCE__) == ADC3) \
Kojto 122:f9eeca106725 1738 ? ( \
Kojto 122:f9eeca106725 1739 ((__CHANNEL__) == LL_ADC_CHANNEL_VREFINT) || \
Kojto 122:f9eeca106725 1740 ((__CHANNEL__) == LL_ADC_CHANNEL_TEMPSENSOR) || \
Kojto 122:f9eeca106725 1741 ((__CHANNEL__) == LL_ADC_CHANNEL_VBAT) || \
Kojto 122:f9eeca106725 1742 ((__CHANNEL__) == LL_ADC_CHANNEL_DAC1CH1_ADC3) || \
Kojto 122:f9eeca106725 1743 ((__CHANNEL__) == LL_ADC_CHANNEL_DAC1CH2_ADC3) \
Kojto 122:f9eeca106725 1744 ) \
Kojto 122:f9eeca106725 1745 : \
Kojto 122:f9eeca106725 1746 (0U) \
Kojto 122:f9eeca106725 1747 )
Kojto 122:f9eeca106725 1748 #elif defined (ADC1) && defined (ADC2)
Kojto 122:f9eeca106725 1749 #define __LL_ADC_IS_CHANNEL_INTERNAL_AVAILABLE(__ADC_INSTANCE__, __CHANNEL__) \
Kojto 122:f9eeca106725 1750 (((__ADC_INSTANCE__) == ADC1) \
Kojto 122:f9eeca106725 1751 ? ( \
Kojto 122:f9eeca106725 1752 ((__CHANNEL__) == LL_ADC_CHANNEL_VREFINT) || \
Kojto 122:f9eeca106725 1753 ((__CHANNEL__) == LL_ADC_CHANNEL_TEMPSENSOR) || \
Kojto 122:f9eeca106725 1754 ((__CHANNEL__) == LL_ADC_CHANNEL_VBAT) \
Kojto 122:f9eeca106725 1755 ) \
Kojto 122:f9eeca106725 1756 : \
Kojto 122:f9eeca106725 1757 ((__ADC_INSTANCE__) == ADC2) \
Kojto 122:f9eeca106725 1758 ? ( \
Kojto 122:f9eeca106725 1759 ((__CHANNEL__) == LL_ADC_CHANNEL_VREFINT) || \
Kojto 122:f9eeca106725 1760 ((__CHANNEL__) == LL_ADC_CHANNEL_DAC1CH1_ADC2) || \
Kojto 122:f9eeca106725 1761 ((__CHANNEL__) == LL_ADC_CHANNEL_DAC1CH2_ADC2) \
Kojto 122:f9eeca106725 1762 ) \
Kojto 122:f9eeca106725 1763 : \
Kojto 122:f9eeca106725 1764 (0U) \
Kojto 122:f9eeca106725 1765 )
Kojto 122:f9eeca106725 1766 #elif defined (ADC1)
Kojto 122:f9eeca106725 1767 #define __LL_ADC_IS_CHANNEL_INTERNAL_AVAILABLE(__ADC_INSTANCE__, __CHANNEL__) \
Kojto 122:f9eeca106725 1768 ( \
Kojto 122:f9eeca106725 1769 ((__CHANNEL__) == LL_ADC_CHANNEL_VREFINT) || \
Kojto 122:f9eeca106725 1770 ((__CHANNEL__) == LL_ADC_CHANNEL_TEMPSENSOR) || \
Kojto 122:f9eeca106725 1771 ((__CHANNEL__) == LL_ADC_CHANNEL_VBAT) || \
Kojto 122:f9eeca106725 1772 ((__CHANNEL__) == LL_ADC_CHANNEL_DAC1CH1) || \
Kojto 122:f9eeca106725 1773 ((__CHANNEL__) == LL_ADC_CHANNEL_DAC1CH2) \
Kojto 122:f9eeca106725 1774 )
Kojto 122:f9eeca106725 1775 #endif
Kojto 122:f9eeca106725 1776
Kojto 122:f9eeca106725 1777 /**
Kojto 122:f9eeca106725 1778 * @brief Helper macro to define ADC analog watchdog parameter:
Kojto 122:f9eeca106725 1779 * define a single channel to monitor with analog watchdog
Kojto 122:f9eeca106725 1780 * from sequencer channel and groups definition.
Kojto 122:f9eeca106725 1781 * @note To be used with function @ref LL_ADC_SetAnalogWDMonitChannels().
Kojto 122:f9eeca106725 1782 * Example:
Kojto 122:f9eeca106725 1783 * LL_ADC_SetAnalogWDMonitChannels(
Kojto 122:f9eeca106725 1784 * ADC1, LL_ADC_AWD1,
Kojto 122:f9eeca106725 1785 * __LL_ADC_ANALOGWD_CHANNEL_GROUP(LL_ADC_CHANNEL4, LL_ADC_GROUP_REGULAR))
Kojto 122:f9eeca106725 1786 * @param __CHANNEL__ This parameter can be one of the following values:
Kojto 122:f9eeca106725 1787 * @arg @ref LL_ADC_CHANNEL_0
Kojto 122:f9eeca106725 1788 * @arg @ref LL_ADC_CHANNEL_1 (7)
Kojto 122:f9eeca106725 1789 * @arg @ref LL_ADC_CHANNEL_2 (7)
Kojto 122:f9eeca106725 1790 * @arg @ref LL_ADC_CHANNEL_3 (7)
Kojto 122:f9eeca106725 1791 * @arg @ref LL_ADC_CHANNEL_4 (7)
Kojto 122:f9eeca106725 1792 * @arg @ref LL_ADC_CHANNEL_5 (7)
Kojto 122:f9eeca106725 1793 * @arg @ref LL_ADC_CHANNEL_6
Kojto 122:f9eeca106725 1794 * @arg @ref LL_ADC_CHANNEL_7
Kojto 122:f9eeca106725 1795 * @arg @ref LL_ADC_CHANNEL_8
Kojto 122:f9eeca106725 1796 * @arg @ref LL_ADC_CHANNEL_9
Kojto 122:f9eeca106725 1797 * @arg @ref LL_ADC_CHANNEL_10
Kojto 122:f9eeca106725 1798 * @arg @ref LL_ADC_CHANNEL_11
Kojto 122:f9eeca106725 1799 * @arg @ref LL_ADC_CHANNEL_12
Kojto 122:f9eeca106725 1800 * @arg @ref LL_ADC_CHANNEL_13
Kojto 122:f9eeca106725 1801 * @arg @ref LL_ADC_CHANNEL_14
Kojto 122:f9eeca106725 1802 * @arg @ref LL_ADC_CHANNEL_15
Kojto 122:f9eeca106725 1803 * @arg @ref LL_ADC_CHANNEL_16
Kojto 122:f9eeca106725 1804 * @arg @ref LL_ADC_CHANNEL_17
Kojto 122:f9eeca106725 1805 * @arg @ref LL_ADC_CHANNEL_18
Kojto 122:f9eeca106725 1806 * @arg @ref LL_ADC_CHANNEL_VREFINT (1)
Kojto 122:f9eeca106725 1807 * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR (4)
Kojto 122:f9eeca106725 1808 * @arg @ref LL_ADC_CHANNEL_VBAT (4)
Kojto 122:f9eeca106725 1809 * @arg @ref LL_ADC_CHANNEL_DAC1CH1 (5)
Kojto 122:f9eeca106725 1810 * @arg @ref LL_ADC_CHANNEL_DAC1CH2 (5)
Kojto 122:f9eeca106725 1811 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)(6)
Kojto 122:f9eeca106725 1812 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)(6)
Kojto 122:f9eeca106725 1813 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC3 (3)(6)
Kojto 122:f9eeca106725 1814 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC3 (3)(6)
Kojto 122:f9eeca106725 1815 *
Kojto 122:f9eeca106725 1816 * (1) On STM32L4, parameter available only on ADC instance: ADC1.\n
Kojto 122:f9eeca106725 1817 * (2) On STM32L4, parameter available only on ADC instance: ADC2.\n
Kojto 122:f9eeca106725 1818 * (3) On STM32L4, parameter available only on ADC instance: ADC3.\n
Kojto 122:f9eeca106725 1819 * (4) On STM32L4, parameter available only on ADC instances: ADC1, ADC3.\n
Kojto 122:f9eeca106725 1820 * (5) On STM32L4, parameter available on devices with only 1 ADC instance.\n
Kojto 122:f9eeca106725 1821 * (6) On STM32L4, parameter available on devices with several ADC instances.\n
Kojto 122:f9eeca106725 1822 * (7) On STM32L4, fast channel (0.188 us for 12-bit resolution (ADC conversion rate up to 5.33 Ms/s)).
Kojto 122:f9eeca106725 1823 * Other channels are slow channels (0.238 us for 12-bit resolution (ADC conversion rate up to 4.21 Ms/s)).\n
Kojto 122:f9eeca106725 1824 * (1, 2, 3, 4) For ADC channel read back from ADC register,
Kojto 122:f9eeca106725 1825 * comparison with internal channel parameter to be done
Kojto 122:f9eeca106725 1826 * using helper macro @ref __LL_ADC_CHANNEL_INTERNAL_TO_EXTERNAL().
Kojto 122:f9eeca106725 1827 * @param __GROUP__ This parameter can be one of the following values:
Kojto 122:f9eeca106725 1828 * @arg @ref LL_ADC_GROUP_REGULAR
Kojto 122:f9eeca106725 1829 * @arg @ref LL_ADC_GROUP_INJECTED
Kojto 122:f9eeca106725 1830 * @arg @ref LL_ADC_GROUP_REGULAR_INJECTED
Kojto 122:f9eeca106725 1831 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 1832 * @arg @ref LL_ADC_AWD_DISABLE
Kojto 122:f9eeca106725 1833 * @arg @ref LL_ADC_AWD_ALL_CHANNELS_REG (0)
Kojto 122:f9eeca106725 1834 * @arg @ref LL_ADC_AWD_ALL_CHANNELS_INJ (0)
Kojto 122:f9eeca106725 1835 * @arg @ref LL_ADC_AWD_ALL_CHANNELS_REG_INJ
Kojto 122:f9eeca106725 1836 * @arg @ref LL_ADC_AWD_CHANNEL_0_REG (0)
Kojto 122:f9eeca106725 1837 * @arg @ref LL_ADC_AWD_CHANNEL_0_INJ (0)
Kojto 122:f9eeca106725 1838 * @arg @ref LL_ADC_AWD_CHANNEL_0_REG_INJ
Kojto 122:f9eeca106725 1839 * @arg @ref LL_ADC_AWD_CHANNEL_1_REG (0)
Kojto 122:f9eeca106725 1840 * @arg @ref LL_ADC_AWD_CHANNEL_1_INJ (0)
Kojto 122:f9eeca106725 1841 * @arg @ref LL_ADC_AWD_CHANNEL_1_REG_INJ
Kojto 122:f9eeca106725 1842 * @arg @ref LL_ADC_AWD_CHANNEL_2_REG (0)
Kojto 122:f9eeca106725 1843 * @arg @ref LL_ADC_AWD_CHANNEL_2_INJ (0)
Kojto 122:f9eeca106725 1844 * @arg @ref LL_ADC_AWD_CHANNEL_2_REG_INJ
Kojto 122:f9eeca106725 1845 * @arg @ref LL_ADC_AWD_CHANNEL_3_REG (0)
Kojto 122:f9eeca106725 1846 * @arg @ref LL_ADC_AWD_CHANNEL_3_INJ (0)
Kojto 122:f9eeca106725 1847 * @arg @ref LL_ADC_AWD_CHANNEL_3_REG_INJ
Kojto 122:f9eeca106725 1848 * @arg @ref LL_ADC_AWD_CHANNEL_4_REG (0)
Kojto 122:f9eeca106725 1849 * @arg @ref LL_ADC_AWD_CHANNEL_4_INJ (0)
Kojto 122:f9eeca106725 1850 * @arg @ref LL_ADC_AWD_CHANNEL_4_REG_INJ
Kojto 122:f9eeca106725 1851 * @arg @ref LL_ADC_AWD_CHANNEL_5_REG (0)
Kojto 122:f9eeca106725 1852 * @arg @ref LL_ADC_AWD_CHANNEL_5_INJ (0)
Kojto 122:f9eeca106725 1853 * @arg @ref LL_ADC_AWD_CHANNEL_5_REG_INJ
Kojto 122:f9eeca106725 1854 * @arg @ref LL_ADC_AWD_CHANNEL_6_REG (0)
Kojto 122:f9eeca106725 1855 * @arg @ref LL_ADC_AWD_CHANNEL_6_INJ (0)
Kojto 122:f9eeca106725 1856 * @arg @ref LL_ADC_AWD_CHANNEL_6_REG_INJ
Kojto 122:f9eeca106725 1857 * @arg @ref LL_ADC_AWD_CHANNEL_7_REG (0)
Kojto 122:f9eeca106725 1858 * @arg @ref LL_ADC_AWD_CHANNEL_7_INJ (0)
Kojto 122:f9eeca106725 1859 * @arg @ref LL_ADC_AWD_CHANNEL_7_REG_INJ
Kojto 122:f9eeca106725 1860 * @arg @ref LL_ADC_AWD_CHANNEL_8_REG (0)
Kojto 122:f9eeca106725 1861 * @arg @ref LL_ADC_AWD_CHANNEL_8_INJ (0)
Kojto 122:f9eeca106725 1862 * @arg @ref LL_ADC_AWD_CHANNEL_8_REG_INJ
Kojto 122:f9eeca106725 1863 * @arg @ref LL_ADC_AWD_CHANNEL_9_REG (0)
Kojto 122:f9eeca106725 1864 * @arg @ref LL_ADC_AWD_CHANNEL_9_INJ (0)
Kojto 122:f9eeca106725 1865 * @arg @ref LL_ADC_AWD_CHANNEL_9_REG_INJ
Kojto 122:f9eeca106725 1866 * @arg @ref LL_ADC_AWD_CHANNEL_10_REG (0)
Kojto 122:f9eeca106725 1867 * @arg @ref LL_ADC_AWD_CHANNEL_10_INJ (0)
Kojto 122:f9eeca106725 1868 * @arg @ref LL_ADC_AWD_CHANNEL_10_REG_INJ
Kojto 122:f9eeca106725 1869 * @arg @ref LL_ADC_AWD_CHANNEL_11_REG (0)
Kojto 122:f9eeca106725 1870 * @arg @ref LL_ADC_AWD_CHANNEL_11_INJ (0)
Kojto 122:f9eeca106725 1871 * @arg @ref LL_ADC_AWD_CHANNEL_11_REG_INJ
Kojto 122:f9eeca106725 1872 * @arg @ref LL_ADC_AWD_CHANNEL_12_REG (0)
Kojto 122:f9eeca106725 1873 * @arg @ref LL_ADC_AWD_CHANNEL_12_INJ (0)
Kojto 122:f9eeca106725 1874 * @arg @ref LL_ADC_AWD_CHANNEL_12_REG_INJ
Kojto 122:f9eeca106725 1875 * @arg @ref LL_ADC_AWD_CHANNEL_13_REG (0)
Kojto 122:f9eeca106725 1876 * @arg @ref LL_ADC_AWD_CHANNEL_13_INJ (0)
Kojto 122:f9eeca106725 1877 * @arg @ref LL_ADC_AWD_CHANNEL_13_REG_INJ
Kojto 122:f9eeca106725 1878 * @arg @ref LL_ADC_AWD_CHANNEL_14_REG (0)
Kojto 122:f9eeca106725 1879 * @arg @ref LL_ADC_AWD_CHANNEL_14_INJ (0)
Kojto 122:f9eeca106725 1880 * @arg @ref LL_ADC_AWD_CHANNEL_14_REG_INJ
Kojto 122:f9eeca106725 1881 * @arg @ref LL_ADC_AWD_CHANNEL_15_REG (0)
Kojto 122:f9eeca106725 1882 * @arg @ref LL_ADC_AWD_CHANNEL_15_INJ (0)
Kojto 122:f9eeca106725 1883 * @arg @ref LL_ADC_AWD_CHANNEL_15_REG_INJ
Kojto 122:f9eeca106725 1884 * @arg @ref LL_ADC_AWD_CHANNEL_16_REG (0)
Kojto 122:f9eeca106725 1885 * @arg @ref LL_ADC_AWD_CHANNEL_16_INJ (0)
Kojto 122:f9eeca106725 1886 * @arg @ref LL_ADC_AWD_CHANNEL_16_REG_INJ
Kojto 122:f9eeca106725 1887 * @arg @ref LL_ADC_AWD_CHANNEL_17_REG (0)
Kojto 122:f9eeca106725 1888 * @arg @ref LL_ADC_AWD_CHANNEL_17_INJ (0)
Kojto 122:f9eeca106725 1889 * @arg @ref LL_ADC_AWD_CHANNEL_17_REG_INJ
Kojto 122:f9eeca106725 1890 * @arg @ref LL_ADC_AWD_CHANNEL_18_REG (0)
Kojto 122:f9eeca106725 1891 * @arg @ref LL_ADC_AWD_CHANNEL_18_INJ (0)
Kojto 122:f9eeca106725 1892 * @arg @ref LL_ADC_AWD_CHANNEL_18_REG_INJ
Kojto 122:f9eeca106725 1893 * @arg @ref LL_ADC_AWD_CH_VREFINT_REG (0)(1)
Kojto 122:f9eeca106725 1894 * @arg @ref LL_ADC_AWD_CH_VREFINT_INJ (0)(1)
Kojto 122:f9eeca106725 1895 * @arg @ref LL_ADC_AWD_CH_VREFINT_REG_INJ (1)
Kojto 122:f9eeca106725 1896 * @arg @ref LL_ADC_AWD_CH_TEMPSENSOR_REG (0)(4)
Kojto 122:f9eeca106725 1897 * @arg @ref LL_ADC_AWD_CH_TEMPSENSOR_INJ (0)(4)
Kojto 122:f9eeca106725 1898 * @arg @ref LL_ADC_AWD_CH_TEMPSENSOR_REG_INJ (4)
Kojto 122:f9eeca106725 1899 * @arg @ref LL_ADC_AWD_CH_VBAT_REG (0)(4)
Kojto 122:f9eeca106725 1900 * @arg @ref LL_ADC_AWD_CH_VBAT_INJ (0)(4)
Kojto 122:f9eeca106725 1901 * @arg @ref LL_ADC_AWD_CH_VBAT_REG_INJ (4)
Kojto 122:f9eeca106725 1902 * @arg @ref LL_ADC_AWD_CH_DAC1CH1_REG (0)(2)(5)
Kojto 122:f9eeca106725 1903 * @arg @ref LL_ADC_AWD_CH_DAC1CH1_INJ (0)(2)(5)
Kojto 122:f9eeca106725 1904 * @arg @ref LL_ADC_AWD_CH_DAC1CH1_REG_INJ (2)(5)
Kojto 122:f9eeca106725 1905 * @arg @ref LL_ADC_AWD_CH_DAC1CH2_REG (0)(2)(5)
Kojto 122:f9eeca106725 1906 * @arg @ref LL_ADC_AWD_CH_DAC1CH2_INJ (0)(2)(5)
Kojto 122:f9eeca106725 1907 * @arg @ref LL_ADC_AWD_CH_DAC1CH2_REG_INJ (2)(5)
Kojto 122:f9eeca106725 1908 * @arg @ref LL_ADC_AWD_CH_DAC1CH1_ADC2_REG (0)(2)(6)
Kojto 122:f9eeca106725 1909 * @arg @ref LL_ADC_AWD_CH_DAC1CH1_ADC2_INJ (0)(2)(6)
Kojto 122:f9eeca106725 1910 * @arg @ref LL_ADC_AWD_CH_DAC1CH1_ADC2_REG_INJ (2)(6)
Kojto 122:f9eeca106725 1911 * @arg @ref LL_ADC_AWD_CH_DAC1CH2_ADC2_REG (0)(2)(6)
Kojto 122:f9eeca106725 1912 * @arg @ref LL_ADC_AWD_CH_DAC1CH2_ADC2_INJ (0)(2)(6)
Kojto 122:f9eeca106725 1913 * @arg @ref LL_ADC_AWD_CH_DAC1CH2_ADC2_REG_INJ (2)(6)
Kojto 122:f9eeca106725 1914 * @arg @ref LL_ADC_AWD_CH_DAC1CH1_ADC3_REG (0)(3)(6)
Kojto 122:f9eeca106725 1915 * @arg @ref LL_ADC_AWD_CH_DAC1CH1_ADC3_INJ (0)(3)(6)
Kojto 122:f9eeca106725 1916 * @arg @ref LL_ADC_AWD_CH_DAC1CH1_ADC3_REG_INJ (3)(6)
Kojto 122:f9eeca106725 1917 * @arg @ref LL_ADC_AWD_CH_DAC1CH2_ADC3_REG (0)(3)(6)
Kojto 122:f9eeca106725 1918 * @arg @ref LL_ADC_AWD_CH_DAC1CH2_ADC3_INJ (0)(3)(6)
Kojto 122:f9eeca106725 1919 * @arg @ref LL_ADC_AWD_CH_DAC1CH2_ADC3_REG_INJ (3)(6)
Kojto 122:f9eeca106725 1920 *
Kojto 122:f9eeca106725 1921 * (0) On STM32L4, parameter available only on analog watchdog number: AWD1.\n
Kojto 122:f9eeca106725 1922 * (1) On STM32L4, parameter available only on ADC instance: ADC1.\n
Kojto 122:f9eeca106725 1923 * (2) On STM32L4, parameter available only on ADC instance: ADC2.\n
Kojto 122:f9eeca106725 1924 * (3) On STM32L4, parameter available only on ADC instance: ADC3.\n
Kojto 122:f9eeca106725 1925 * (4) On STM32L4, parameter available only on ADC instances: ADC1, ADC3.
Kojto 122:f9eeca106725 1926 * (5) On STM32L4, parameter available on devices with only 1 ADC instance.\n
Kojto 122:f9eeca106725 1927 * (6) On STM32L4, parameter available on devices with several ADC instances.
Kojto 122:f9eeca106725 1928 */
Kojto 122:f9eeca106725 1929 #define __LL_ADC_ANALOGWD_CHANNEL_GROUP(__CHANNEL__, __GROUP__) \
Kojto 122:f9eeca106725 1930 (((__GROUP__) == LL_ADC_GROUP_REGULAR) \
Kojto 122:f9eeca106725 1931 ? (((__CHANNEL__) & ADC_CHANNEL_ID_MASK) | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) \
Kojto 122:f9eeca106725 1932 : \
Kojto 122:f9eeca106725 1933 ((__GROUP__) == LL_ADC_GROUP_INJECTED) \
Kojto 122:f9eeca106725 1934 ? (((__CHANNEL__) & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1SGL) \
Kojto 122:f9eeca106725 1935 : \
Kojto 122:f9eeca106725 1936 (((__CHANNEL__) & ADC_CHANNEL_ID_MASK) | ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN | ADC_CFGR_AWD1SGL) \
Kojto 122:f9eeca106725 1937 )
Kojto 122:f9eeca106725 1938
Kojto 122:f9eeca106725 1939 /**
Kojto 122:f9eeca106725 1940 * @brief Helper macro to set the value of ADC analog watchdog threshold high
Kojto 122:f9eeca106725 1941 * or low in function of ADC resolution, when ADC resolution is
Kojto 122:f9eeca106725 1942 * different of 12 bits.
Kojto 122:f9eeca106725 1943 * @note To be used with function @ref LL_ADC_ConfigAnalogWDThresholds()
Kojto 122:f9eeca106725 1944 * or @ref LL_ADC_SetAnalogWDThresholds().
Kojto 122:f9eeca106725 1945 * Example, with a ADC resolution of 8 bits, to set the value of
Kojto 122:f9eeca106725 1946 * analog watchdog threshold high (on 8 bits):
Kojto 122:f9eeca106725 1947 * LL_ADC_SetAnalogWDThresholds
Kojto 122:f9eeca106725 1948 * (< ADCx param >,
Kojto 122:f9eeca106725 1949 * __LL_ADC_ANALOGWD_SET_THRESHOLD_RESOLUTION(LL_ADC_RESOLUTION_8B, <threshold_value_8_bits>)
Kojto 122:f9eeca106725 1950 * );
Kojto 122:f9eeca106725 1951 * @param __ADC_RESOLUTION__ This parameter can be one of the following values:
Kojto 122:f9eeca106725 1952 * @arg @ref LL_ADC_RESOLUTION_12B
Kojto 122:f9eeca106725 1953 * @arg @ref LL_ADC_RESOLUTION_10B
Kojto 122:f9eeca106725 1954 * @arg @ref LL_ADC_RESOLUTION_8B
Kojto 122:f9eeca106725 1955 * @arg @ref LL_ADC_RESOLUTION_6B
Kojto 122:f9eeca106725 1956 * @param __AWD_THRESHOLD__ Value between Min_Data=0x000 and Max_Data=0xFFF
Kojto 122:f9eeca106725 1957 * @retval Value between Min_Data=0x000 and Max_Data=0xFFF
Kojto 122:f9eeca106725 1958 */
Kojto 122:f9eeca106725 1959 #define __LL_ADC_ANALOGWD_SET_THRESHOLD_RESOLUTION(__ADC_RESOLUTION__, __AWD_THRESHOLD__) \
Kojto 122:f9eeca106725 1960 ((__AWD_THRESHOLD__) << ((__ADC_RESOLUTION__) >> (ADC_CFGR_RES_BITOFFSET_POS - 1U )))
Kojto 122:f9eeca106725 1961
Kojto 122:f9eeca106725 1962 /**
Kojto 122:f9eeca106725 1963 * @brief Helper macro to get the value of ADC analog watchdog threshold high
Kojto 122:f9eeca106725 1964 * or low in function of ADC resolution, when ADC resolution is
Kojto 122:f9eeca106725 1965 * different of 12 bits.
Kojto 122:f9eeca106725 1966 * @note To be used with function @ref LL_ADC_GetAnalogWDThresholds().
Kojto 122:f9eeca106725 1967 * Example, with a ADC resolution of 8 bits, to get the value of
Kojto 122:f9eeca106725 1968 * analog watchdog threshold high (on 8 bits):
Kojto 122:f9eeca106725 1969 * < threshold_value_6_bits > = __LL_ADC_ANALOGWD_GET_THRESHOLD_RESOLUTION
Kojto 122:f9eeca106725 1970 * (LL_ADC_RESOLUTION_8B,
Kojto 122:f9eeca106725 1971 * LL_ADC_GetAnalogWDThresholds(<ADCx param>, LL_ADC_AWD_THRESHOLD_HIGH)
Kojto 122:f9eeca106725 1972 * );
Kojto 122:f9eeca106725 1973 * @param __ADC_RESOLUTION__ This parameter can be one of the following values:
Kojto 122:f9eeca106725 1974 * @arg @ref LL_ADC_RESOLUTION_12B
Kojto 122:f9eeca106725 1975 * @arg @ref LL_ADC_RESOLUTION_10B
Kojto 122:f9eeca106725 1976 * @arg @ref LL_ADC_RESOLUTION_8B
Kojto 122:f9eeca106725 1977 * @arg @ref LL_ADC_RESOLUTION_6B
Kojto 122:f9eeca106725 1978 * @param __AWD_THRESHOLD_12_BITS__ Value between Min_Data=0x000 and Max_Data=0xFFF
Kojto 122:f9eeca106725 1979 * @retval Value between Min_Data=0x000 and Max_Data=0xFFF
Kojto 122:f9eeca106725 1980 */
Kojto 122:f9eeca106725 1981 #define __LL_ADC_ANALOGWD_GET_THRESHOLD_RESOLUTION(__ADC_RESOLUTION__, __AWD_THRESHOLD_12_BITS__) \
Kojto 122:f9eeca106725 1982 ((__AWD_THRESHOLD_12_BITS__) >> ((__ADC_RESOLUTION__) >> (ADC_CFGR_RES_BITOFFSET_POS - 1U )))
Kojto 122:f9eeca106725 1983
Kojto 122:f9eeca106725 1984 /**
Kojto 122:f9eeca106725 1985 * @brief Helper macro to get the ADC analog watchdog threshold high
Kojto 122:f9eeca106725 1986 * or low from raw value containing both thresholds concatenated.
Kojto 122:f9eeca106725 1987 * @note To be used with function @ref LL_ADC_GetAnalogWDThresholds().
Kojto 122:f9eeca106725 1988 * Example, to get analog watchdog threshold high from the register raw value:
Kojto 122:f9eeca106725 1989 * __LL_ADC_ANALOGWD_THRESHOLDS_HIGH_LOW(LL_ADC_AWD_THRESHOLD_HIGH, <raw_value_with_both_thresholds>);
Kojto 122:f9eeca106725 1990 * @param __AWD_THRESHOLD_TYPE__ This parameter can be one of the following values:
Kojto 122:f9eeca106725 1991 * @arg @ref LL_ADC_AWD_THRESHOLD_HIGH
Kojto 122:f9eeca106725 1992 * @arg @ref LL_ADC_AWD_THRESHOLD_LOW
Kojto 122:f9eeca106725 1993 * @param __AWD_THRESHOLDS__ Value between Min_Data=0x00000000 and Max_Data=0xFFFFFFFF
Kojto 122:f9eeca106725 1994 * @retval Value between Min_Data=0x000 and Max_Data=0xFFF
Kojto 122:f9eeca106725 1995 */
Kojto 122:f9eeca106725 1996 #define __LL_ADC_ANALOGWD_THRESHOLDS_HIGH_LOW(__AWD_THRESHOLD_TYPE__, __AWD_THRESHOLDS__) \
Kojto 122:f9eeca106725 1997 (((__AWD_THRESHOLDS__) >> POSITION_VAL((__AWD_THRESHOLD_TYPE__))) & LL_ADC_AWD_THRESHOLD_LOW)
Kojto 122:f9eeca106725 1998
Kojto 122:f9eeca106725 1999 /**
Kojto 122:f9eeca106725 2000 * @brief Helper macro to set the ADC calibration value with both single ended
Kojto 122:f9eeca106725 2001 * and differential modes calibration factors concatenated.
Kojto 122:f9eeca106725 2002 * @note To be used with function @ref LL_ADC_SetCalibrationFactor().
Kojto 122:f9eeca106725 2003 * Example, to set calibration factors single ended to 0x55
Kojto 122:f9eeca106725 2004 * and differential ended to 0x2A:
Kojto 122:f9eeca106725 2005 * LL_ADC_SetCalibrationFactor(
Kojto 122:f9eeca106725 2006 * ADC1,
Kojto 122:f9eeca106725 2007 * __LL_ADC_CALIB_FACTOR_SINGLE_DIFF(0x55, 0x2A))
Kojto 122:f9eeca106725 2008 * @param __CALIB_FACTOR_SINGLE_ENDED__ Value between Min_Data=0x00 and Max_Data=0x7F
Kojto 122:f9eeca106725 2009 * @param __CALIB_FACTOR_DIFFERENTIAL__ Value between Min_Data=0x00 and Max_Data=0x7F
Kojto 122:f9eeca106725 2010 * @retval Value between Min_Data=0x00000000 and Max_Data=0xFFFFFFFF
Kojto 122:f9eeca106725 2011 */
Kojto 122:f9eeca106725 2012 #define __LL_ADC_CALIB_FACTOR_SINGLE_DIFF(__CALIB_FACTOR_SINGLE_ENDED__, __CALIB_FACTOR_DIFFERENTIAL__) \
Kojto 122:f9eeca106725 2013 (((__CALIB_FACTOR_DIFFERENTIAL__) << POSITION_VAL(ADC_CALFACT_CALFACT_D)) | (__CALIB_FACTOR_SINGLE_ENDED__))
Kojto 122:f9eeca106725 2014
Kojto 122:f9eeca106725 2015 #if defined(ADC_MULTIMODE_SUPPORT)
Kojto 122:f9eeca106725 2016 /**
Kojto 122:f9eeca106725 2017 * @brief Helper macro to get the ADC multimode conversion data of ADC master
Kojto 122:f9eeca106725 2018 * or ADC slave from raw value with both ADC conversion data concatenated.
Kojto 122:f9eeca106725 2019 * @note This macro is intended to be used when multimode transfer by DMA
Kojto 122:f9eeca106725 2020 * is enabled: refer to function @ref LL_ADC_SetMultiDMATransfer().
Kojto 122:f9eeca106725 2021 * In this case the transferred data need to processed with this macro
Kojto 122:f9eeca106725 2022 * to separate the conversion data of ADC master and ADC slave.
Kojto 122:f9eeca106725 2023 * @param __ADC_MULTI_MASTER_SLAVE__ This parameter can be one of the following values:
Kojto 122:f9eeca106725 2024 * @arg @ref LL_ADC_MULTI_MASTER
Kojto 122:f9eeca106725 2025 * @arg @ref LL_ADC_MULTI_SLAVE
Kojto 122:f9eeca106725 2026 * @param __ADC_MULTI_CONV_DATA__ Value between Min_Data=0x000 and Max_Data=0xFFF
Kojto 122:f9eeca106725 2027 * @retval Value between Min_Data=0x000 and Max_Data=0xFFF
Kojto 122:f9eeca106725 2028 */
Kojto 122:f9eeca106725 2029 #define __LL_ADC_MULTI_CONV_DATA_MASTER_SLAVE(__ADC_MULTI_MASTER_SLAVE__, __ADC_MULTI_CONV_DATA__) \
Kojto 122:f9eeca106725 2030 (((__ADC_MULTI_CONV_DATA__) >> POSITION_VAL((__ADC_MULTI_MASTER_SLAVE__))) & ADC_CDR_RDATA_MST)
Kojto 122:f9eeca106725 2031 #endif
Kojto 122:f9eeca106725 2032
Kojto 122:f9eeca106725 2033 /**
Kojto 122:f9eeca106725 2034 * @brief Helper macro to select the ADC common instance
Kojto 122:f9eeca106725 2035 * to which is belonging the selected ADC instance.
Kojto 122:f9eeca106725 2036 * @note ADC common register instance can be used for:
Kojto 122:f9eeca106725 2037 * - Set parameters common to several ADC instances
Kojto 122:f9eeca106725 2038 * - Multimode (for devices with several ADC instances)
Kojto 122:f9eeca106725 2039 * Refer to functions having argument "ADCxy_COMMON" as parameter.
Kojto 122:f9eeca106725 2040 * @param __ADCx__ ADC instance
Kojto 122:f9eeca106725 2041 * @retval ADC common register instance
Kojto 122:f9eeca106725 2042 */
Kojto 122:f9eeca106725 2043 #if defined(ADC1) && defined(ADC2) && defined(ADC3)
Kojto 122:f9eeca106725 2044 #define __LL_ADC_COMMON_INSTANCE(__ADCx__) \
Kojto 122:f9eeca106725 2045 (ADC123_COMMON)
Kojto 122:f9eeca106725 2046 #elif defined(ADC1) && defined(ADC2)
Kojto 122:f9eeca106725 2047 #define __LL_ADC_COMMON_INSTANCE(__ADCx__) \
Kojto 122:f9eeca106725 2048 (ADC12_COMMON)
Kojto 122:f9eeca106725 2049 #else
Kojto 122:f9eeca106725 2050 #define __LL_ADC_COMMON_INSTANCE(__ADCx__) \
Kojto 122:f9eeca106725 2051 (ADC1_COMMON)
Kojto 122:f9eeca106725 2052 #endif
Kojto 122:f9eeca106725 2053
Kojto 122:f9eeca106725 2054 /**
Kojto 122:f9eeca106725 2055 * @brief Helper macro to check if all ADC instances sharing the same
Kojto 122:f9eeca106725 2056 * ADC common instance are disabled.
Kojto 122:f9eeca106725 2057 * @note This check is required by functions with setting conditioned to
Kojto 122:f9eeca106725 2058 * ADC state:
Kojto 122:f9eeca106725 2059 * All ADC instances of the ADC common group must be disabled.
Kojto 122:f9eeca106725 2060 * Refer to functions having argument "ADCxy_COMMON" as parameter.
Kojto 122:f9eeca106725 2061 * @note On devices with only 1 ADC common instance, parameter of this macro
Kojto 122:f9eeca106725 2062 * is useless and can be ignored (parameter kept for compatibility
Kojto 122:f9eeca106725 2063 * with devices featuring several ADC common instances).
Kojto 122:f9eeca106725 2064 * @param __ADCXY_COMMON__ ADC common instance
Kojto 122:f9eeca106725 2065 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 2066 * @retval Value "0" if all ADC instances sharing the same ADC common instance
Kojto 122:f9eeca106725 2067 * are disabled.
Kojto 122:f9eeca106725 2068 * Value "1" if at least one ADC instance sharing the same ADC common instance
Kojto 122:f9eeca106725 2069 * is enabled.
Kojto 122:f9eeca106725 2070 */
Kojto 122:f9eeca106725 2071 #if defined(ADC1) && defined(ADC2) && defined(ADC3)
Kojto 122:f9eeca106725 2072 #define __LL_ADC_IS_ENABLED_ALL_COMMON_INSTANCE(__ADCXY_COMMON__) \
Kojto 122:f9eeca106725 2073 (LL_ADC_IsEnabled(ADC1) | \
Kojto 122:f9eeca106725 2074 LL_ADC_IsEnabled(ADC2) | \
Kojto 122:f9eeca106725 2075 LL_ADC_IsEnabled(ADC3) )
Kojto 122:f9eeca106725 2076 #elif defined(ADC1) && defined(ADC2)
Kojto 122:f9eeca106725 2077 #define __LL_ADC_IS_ENABLED_ALL_COMMON_INSTANCE(__ADCXY_COMMON__) \
Kojto 122:f9eeca106725 2078 (LL_ADC_IsEnabled(ADC1) | \
Kojto 122:f9eeca106725 2079 LL_ADC_IsEnabled(ADC2) )
Kojto 122:f9eeca106725 2080 #else
Kojto 122:f9eeca106725 2081 #define __LL_ADC_IS_ENABLED_ALL_COMMON_INSTANCE(__ADCXY_COMMON__) \
Kojto 122:f9eeca106725 2082 (LL_ADC_IsEnabled(ADC1))
Kojto 122:f9eeca106725 2083 #endif
Kojto 122:f9eeca106725 2084
Kojto 122:f9eeca106725 2085 /**
Kojto 122:f9eeca106725 2086 * @brief Helper macro to define the ADC conversion data full-scale digital
Kojto 122:f9eeca106725 2087 * value corresponding to the selected ADC resolution.
Kojto 122:f9eeca106725 2088 * @note ADC conversion data full-scale corresponds to voltage range
Kojto 122:f9eeca106725 2089 * determined by analog voltage references Vref+ and Vref-
Kojto 122:f9eeca106725 2090 * (refer to reference manual).
Kojto 122:f9eeca106725 2091 * @param __ADC_RESOLUTION__ This parameter can be one of the following values:
Kojto 122:f9eeca106725 2092 * @arg @ref LL_ADC_RESOLUTION_12B
Kojto 122:f9eeca106725 2093 * @arg @ref LL_ADC_RESOLUTION_10B
Kojto 122:f9eeca106725 2094 * @arg @ref LL_ADC_RESOLUTION_8B
Kojto 122:f9eeca106725 2095 * @arg @ref LL_ADC_RESOLUTION_6B
Kojto 122:f9eeca106725 2096 * @retval ADC conversion data equivalent voltage value (unit: mVolt)
Kojto 122:f9eeca106725 2097 */
Kojto 122:f9eeca106725 2098 #define __LL_ADC_DIGITAL_SCALE(__ADC_RESOLUTION__) \
AnnaBridge 145:64910690c574 2099 (0xFFFU >> ((__ADC_RESOLUTION__) >> (ADC_CFGR_RES_BITOFFSET_POS - 1U)))
Kojto 122:f9eeca106725 2100
Kojto 122:f9eeca106725 2101 /**
Kojto 122:f9eeca106725 2102 * @brief Helper macro to convert the ADC conversion data from
Kojto 122:f9eeca106725 2103 * a resolution to another resolution.
Kojto 122:f9eeca106725 2104 * @param __DATA__ ADC conversion data to be converted
Kojto 122:f9eeca106725 2105 * @param __ADC_RESOLUTION_CURRENT__ Resolution of to the data to be converted
Kojto 122:f9eeca106725 2106 * This parameter can be one of the following values:
Kojto 122:f9eeca106725 2107 * @arg @ref LL_ADC_RESOLUTION_12B
Kojto 122:f9eeca106725 2108 * @arg @ref LL_ADC_RESOLUTION_10B
Kojto 122:f9eeca106725 2109 * @arg @ref LL_ADC_RESOLUTION_8B
Kojto 122:f9eeca106725 2110 * @arg @ref LL_ADC_RESOLUTION_6B
Kojto 122:f9eeca106725 2111 * @param __ADC_RESOLUTION_TARGET__ Resolution of the data after conversion
Kojto 122:f9eeca106725 2112 * This parameter can be one of the following values:
Kojto 122:f9eeca106725 2113 * @arg @ref LL_ADC_RESOLUTION_12B
Kojto 122:f9eeca106725 2114 * @arg @ref LL_ADC_RESOLUTION_10B
Kojto 122:f9eeca106725 2115 * @arg @ref LL_ADC_RESOLUTION_8B
Kojto 122:f9eeca106725 2116 * @arg @ref LL_ADC_RESOLUTION_6B
Kojto 122:f9eeca106725 2117 * @retval ADC conversion data to the requested resolution
Kojto 122:f9eeca106725 2118 */
Kojto 122:f9eeca106725 2119 #define __LL_ADC_CONVERT_DATA_RESOLUTION(__DATA__,\
Kojto 122:f9eeca106725 2120 __ADC_RESOLUTION_CURRENT__,\
Kojto 122:f9eeca106725 2121 __ADC_RESOLUTION_TARGET__) \
Kojto 122:f9eeca106725 2122 (((__DATA__) \
Kojto 122:f9eeca106725 2123 << ((__ADC_RESOLUTION_CURRENT__) >> (ADC_CFGR_RES_BITOFFSET_POS - 1U))) \
Kojto 122:f9eeca106725 2124 >> ((__ADC_RESOLUTION_TARGET__) >> (ADC_CFGR_RES_BITOFFSET_POS - 1U)) \
Kojto 122:f9eeca106725 2125 )
Kojto 122:f9eeca106725 2126
Kojto 122:f9eeca106725 2127 /**
Kojto 122:f9eeca106725 2128 * @brief Helper macro to calculate the voltage (unit: mVolt)
Kojto 122:f9eeca106725 2129 * corresponding to a ADC conversion data (unit: digital value).
Kojto 122:f9eeca106725 2130 * @note Analog reference voltage (Vref+) must be either known from
Kojto 122:f9eeca106725 2131 * user board environment or can be calculated using ADC measurement
Kojto 122:f9eeca106725 2132 * and ADC helper macro @ref __LL_ADC_CALC_VREFANALOG_VOLTAGE().
Kojto 122:f9eeca106725 2133 * @param __VREFANALOG_VOLTAGE__ Analog reference voltage (unit: mV)
Kojto 122:f9eeca106725 2134 * @param __ADC_DATA__ ADC conversion data (resolution 12 bits)
Kojto 122:f9eeca106725 2135 * (unit: digital value).
Kojto 122:f9eeca106725 2136 * @param __ADC_RESOLUTION__ This parameter can be one of the following values:
Kojto 122:f9eeca106725 2137 * @arg @ref LL_ADC_RESOLUTION_12B
Kojto 122:f9eeca106725 2138 * @arg @ref LL_ADC_RESOLUTION_10B
Kojto 122:f9eeca106725 2139 * @arg @ref LL_ADC_RESOLUTION_8B
Kojto 122:f9eeca106725 2140 * @arg @ref LL_ADC_RESOLUTION_6B
Kojto 122:f9eeca106725 2141 * @retval ADC conversion data equivalent voltage value (unit: mVolt)
Kojto 122:f9eeca106725 2142 */
Kojto 122:f9eeca106725 2143 #define __LL_ADC_CALC_DATA_TO_VOLTAGE(__VREFANALOG_VOLTAGE__,\
Kojto 122:f9eeca106725 2144 __ADC_DATA__,\
Kojto 122:f9eeca106725 2145 __ADC_RESOLUTION__) \
Kojto 122:f9eeca106725 2146 ((__ADC_DATA__) * (__VREFANALOG_VOLTAGE__) \
Kojto 122:f9eeca106725 2147 / __LL_ADC_DIGITAL_SCALE(__ADC_RESOLUTION__) \
Kojto 122:f9eeca106725 2148 )
Kojto 122:f9eeca106725 2149
Kojto 122:f9eeca106725 2150 /* Legacy define */
Kojto 122:f9eeca106725 2151 #define __LL_ADC_CALC_DATA_VOLTAGE() __LL_ADC_CALC_DATA_TO_VOLTAGE()
Kojto 122:f9eeca106725 2152
Kojto 122:f9eeca106725 2153 /**
Kojto 122:f9eeca106725 2154 * @brief Helper macro to calculate analog reference voltage (Vref+)
Kojto 122:f9eeca106725 2155 * (unit: mVolt) from ADC conversion data of internal voltage
Kojto 122:f9eeca106725 2156 * reference VrefInt.
Kojto 122:f9eeca106725 2157 * @note Computation is using VrefInt calibration value
Kojto 122:f9eeca106725 2158 * stored in system memory for each device during production.
Kojto 122:f9eeca106725 2159 * @note This voltage depends on user board environment: voltage level
Kojto 122:f9eeca106725 2160 * connected to pin Vref+.
Kojto 122:f9eeca106725 2161 * On devices with small package, the pin Vref+ is not present
Kojto 122:f9eeca106725 2162 * and internally bonded to pin Vdda.
Kojto 122:f9eeca106725 2163 * @note On this STM32 serie, calibration data of internal voltage reference
Kojto 122:f9eeca106725 2164 * VrefInt corresponds to a resolution of 12 bits,
Kojto 122:f9eeca106725 2165 * this is the recommended ADC resolution to convert voltage of
Kojto 122:f9eeca106725 2166 * internal voltage reference VrefInt.
Kojto 122:f9eeca106725 2167 * Otherwise, this macro performs the processing to scale
Kojto 122:f9eeca106725 2168 * ADC conversion data to 12 bits.
Kojto 122:f9eeca106725 2169 * @param __VREFINT_ADC_DATA__: ADC conversion data (resolution 12 bits)
Kojto 122:f9eeca106725 2170 * of internal voltage reference VrefInt (unit: digital value).
Kojto 122:f9eeca106725 2171 * @param __ADC_RESOLUTION__ This parameter can be one of the following values:
Kojto 122:f9eeca106725 2172 * @arg @ref LL_ADC_RESOLUTION_12B
Kojto 122:f9eeca106725 2173 * @arg @ref LL_ADC_RESOLUTION_10B
Kojto 122:f9eeca106725 2174 * @arg @ref LL_ADC_RESOLUTION_8B
Kojto 122:f9eeca106725 2175 * @arg @ref LL_ADC_RESOLUTION_6B
Kojto 122:f9eeca106725 2176 * @retval Analog reference voltage (unit: mV)
Kojto 122:f9eeca106725 2177 */
Kojto 122:f9eeca106725 2178 #define __LL_ADC_CALC_VREFANALOG_VOLTAGE(__VREFINT_ADC_DATA__,\
Kojto 122:f9eeca106725 2179 __ADC_RESOLUTION__) \
Kojto 122:f9eeca106725 2180 (((uint32_t)(*VREFINT_CAL_ADDR) * VREFINT_CAL_VREF) \
Kojto 122:f9eeca106725 2181 / __LL_ADC_CONVERT_DATA_RESOLUTION((__VREFINT_ADC_DATA__), \
Kojto 122:f9eeca106725 2182 (__ADC_RESOLUTION__), \
Kojto 122:f9eeca106725 2183 LL_ADC_RESOLUTION_12B) \
Kojto 122:f9eeca106725 2184 )
Kojto 122:f9eeca106725 2185
Kojto 122:f9eeca106725 2186 /**
Kojto 122:f9eeca106725 2187 * @brief Helper macro to calculate the temperature (unit: degree Celsius)
Kojto 122:f9eeca106725 2188 * from ADC conversion data of internal temperature sensor.
Kojto 122:f9eeca106725 2189 * @note Computation is using temperature sensor calibration values
Kojto 122:f9eeca106725 2190 * stored in system memory for each device during production.
Kojto 122:f9eeca106725 2191 * @note Calculation formula:
Kojto 122:f9eeca106725 2192 * Temperature = ((TS_ADC_DATA - TS_CAL1)
Kojto 122:f9eeca106725 2193 * * (TS_CAL2_TEMP - TS_CAL1_TEMP))
Kojto 122:f9eeca106725 2194 * / (TS_CAL2 - TS_CAL1) + TS_CAL1_TEMP
Kojto 122:f9eeca106725 2195 * with TS_ADC_DATA = temperature sensor raw data measured by ADC
Kojto 122:f9eeca106725 2196 * Avg_Slope = (TS_CAL2 - TS_CAL1)
Kojto 122:f9eeca106725 2197 * / (TS_CAL2_TEMP - TS_CAL1_TEMP)
Kojto 122:f9eeca106725 2198 * TS_CAL1 = equivalent TS_ADC_DATA at temperature
Kojto 122:f9eeca106725 2199 * TEMP_DEGC_CAL1 (calibrated in factory)
Kojto 122:f9eeca106725 2200 * TS_CAL2 = equivalent TS_ADC_DATA at temperature
Kojto 122:f9eeca106725 2201 * TEMP_DEGC_CAL2 (calibrated in factory)
Kojto 122:f9eeca106725 2202 * Caution: Calculation relevancy under reserve that calibration
Kojto 122:f9eeca106725 2203 * parameters are correct (address and data).
Kojto 122:f9eeca106725 2204 * To calculate temperature using temperature sensor
Kojto 122:f9eeca106725 2205 * datasheet typical values (generic values less, therefore
Kojto 122:f9eeca106725 2206 * less accurate than calibrated values),
Kojto 122:f9eeca106725 2207 * use helper macro @ref __LL_ADC_CALC_TEMPERATURE_TYP_PARAMS().
Kojto 122:f9eeca106725 2208 * @note As calculation input, the analog reference voltage (Vref+) must be
Kojto 122:f9eeca106725 2209 * defined as it impacts the ADC LSB equivalent voltage.
Kojto 122:f9eeca106725 2210 * @note Analog reference voltage (Vref+) must be either known from
Kojto 122:f9eeca106725 2211 * user board environment or can be calculated using ADC measurement
Kojto 122:f9eeca106725 2212 * and ADC helper macro @ref __LL_ADC_CALC_VREFANALOG_VOLTAGE().
Kojto 122:f9eeca106725 2213 * @note On this STM32 serie, calibration data of temperature sensor
Kojto 122:f9eeca106725 2214 * corresponds to a resolution of 12 bits,
Kojto 122:f9eeca106725 2215 * this is the recommended ADC resolution to convert voltage of
Kojto 122:f9eeca106725 2216 * temperature sensor.
Kojto 122:f9eeca106725 2217 * Otherwise, this macro performs the processing to scale
Kojto 122:f9eeca106725 2218 * ADC conversion data to 12 bits.
Kojto 122:f9eeca106725 2219 * @param __VREFANALOG_VOLTAGE__ Analog reference voltage (unit: mV)
Kojto 122:f9eeca106725 2220 * @param __TEMPSENSOR_ADC_DATA__ ADC conversion data of internal
Kojto 122:f9eeca106725 2221 * temperature sensor (unit: digital value).
Kojto 122:f9eeca106725 2222 * @param __ADC_RESOLUTION__ ADC resolution at which internal temperature
Kojto 122:f9eeca106725 2223 * sensor voltage has been measured.
Kojto 122:f9eeca106725 2224 * This parameter can be one of the following values:
Kojto 122:f9eeca106725 2225 * @arg @ref LL_ADC_RESOLUTION_12B
Kojto 122:f9eeca106725 2226 * @arg @ref LL_ADC_RESOLUTION_10B
Kojto 122:f9eeca106725 2227 * @arg @ref LL_ADC_RESOLUTION_8B
Kojto 122:f9eeca106725 2228 * @arg @ref LL_ADC_RESOLUTION_6B
Kojto 122:f9eeca106725 2229 * @retval Temperature (unit: degree Celsius)
Kojto 122:f9eeca106725 2230 */
Kojto 122:f9eeca106725 2231 #define __LL_ADC_CALC_TEMPERATURE(__VREFANALOG_VOLTAGE__,\
Kojto 122:f9eeca106725 2232 __TEMPSENSOR_ADC_DATA__,\
Kojto 122:f9eeca106725 2233 __ADC_RESOLUTION__) \
Kojto 122:f9eeca106725 2234 (((( ((int32_t)((__LL_ADC_CONVERT_DATA_RESOLUTION((__TEMPSENSOR_ADC_DATA__), \
Kojto 122:f9eeca106725 2235 (__ADC_RESOLUTION__), \
Kojto 122:f9eeca106725 2236 LL_ADC_RESOLUTION_12B) \
Kojto 122:f9eeca106725 2237 * (__VREFANALOG_VOLTAGE__)) \
Kojto 122:f9eeca106725 2238 / TEMPSENSOR_CAL_VREFANALOG) \
Kojto 122:f9eeca106725 2239 - (int32_t) *TEMPSENSOR_CAL1_ADDR) \
Kojto 122:f9eeca106725 2240 ) * (int32_t)(TEMPSENSOR_CAL2_TEMP - TEMPSENSOR_CAL1_TEMP) \
Kojto 122:f9eeca106725 2241 ) / (int32_t)((int32_t)*TEMPSENSOR_CAL2_ADDR - (int32_t)*TEMPSENSOR_CAL1_ADDR) \
Kojto 122:f9eeca106725 2242 ) + TEMPSENSOR_CAL1_TEMP \
Kojto 122:f9eeca106725 2243 )
Kojto 122:f9eeca106725 2244
Kojto 122:f9eeca106725 2245 /**
Kojto 122:f9eeca106725 2246 * @brief Helper macro to calculate the temperature (unit: degree Celsius)
Kojto 122:f9eeca106725 2247 * from ADC conversion data of internal temperature sensor.
Kojto 122:f9eeca106725 2248 * @note Computation is using temperature sensor typical values
Kojto 122:f9eeca106725 2249 * (refer to device datasheet).
Kojto 122:f9eeca106725 2250 * @note Calculation formula:
Kojto 122:f9eeca106725 2251 * Temperature = (TS_TYP_CALx_VOLT(uV) - TS_ADC_DATA * Conversion_uV)
Kojto 122:f9eeca106725 2252 * / Avg_Slope + CALx_TEMP
Kojto 122:f9eeca106725 2253 * with TS_ADC_DATA = temperature sensor raw data measured by ADC
Kojto 122:f9eeca106725 2254 * (unit: digital value)
Kojto 122:f9eeca106725 2255 * Avg_Slope = temperature sensor slope
Kojto 122:f9eeca106725 2256 * (unit: uV/Degree Celsius)
Kojto 122:f9eeca106725 2257 * TS_TYP_CALx_VOLT = temperature sensor digital value at
Kojto 122:f9eeca106725 2258 * temperature CALx_TEMP (unit: mV)
Kojto 122:f9eeca106725 2259 * Caution: Calculation relevancy under reserve the temperature sensor
Kojto 122:f9eeca106725 2260 * of the current device has characteristics in line with
Kojto 122:f9eeca106725 2261 * datasheet typical values.
Kojto 122:f9eeca106725 2262 * If temperature sensor calibration values are available on
Kojto 122:f9eeca106725 2263 * on this device (presence of macro __LL_ADC_CALC_TEMPERATURE()),
Kojto 122:f9eeca106725 2264 * temperature calculation will be more accurate using
Kojto 122:f9eeca106725 2265 * helper macro @ref __LL_ADC_CALC_TEMPERATURE().
Kojto 122:f9eeca106725 2266 * @note As calculation input, the analog reference voltage (Vref+) must be
Kojto 122:f9eeca106725 2267 * defined as it impacts the ADC LSB equivalent voltage.
Kojto 122:f9eeca106725 2268 * @note Analog reference voltage (Vref+) must be either known from
Kojto 122:f9eeca106725 2269 * user board environment or can be calculated using ADC measurement
Kojto 122:f9eeca106725 2270 * and ADC helper macro @ref __LL_ADC_CALC_VREFANALOG_VOLTAGE().
Kojto 122:f9eeca106725 2271 * @note ADC measurement data must correspond to a resolution of 12bits
Kojto 122:f9eeca106725 2272 * (full scale digital value 4095). If not the case, the data must be
Kojto 122:f9eeca106725 2273 * preliminarily rescaled to an equivalent resolution of 12 bits.
Kojto 122:f9eeca106725 2274 * @param __TEMPSENSOR_TYP_AVGSLOPE__ Device datasheet data: Temperature sensor slope typical value (unit: uV/DegCelsius).
Kojto 122:f9eeca106725 2275 * On STM32L4, refer to device datasheet parameter "Avg_Slope".
Kojto 122:f9eeca106725 2276 * @param __TEMPSENSOR_TYP_CALX_V__ Device datasheet data: Temperature sensor voltage typical value (at temperature and Vref+ defined in parameters below) (unit: mV).
Kojto 122:f9eeca106725 2277 * On STM32L4, refer to device datasheet parameter "V30" (corresponding to TS_CAL1).
Kojto 122:f9eeca106725 2278 * @param __TEMPSENSOR_CALX_TEMP__ Device datasheet data: Temperature at which temperature sensor voltage (see parameter above) is corresponding (unit: mV)
Kojto 122:f9eeca106725 2279 * @param __VREFANALOG_VOLTAGE__ Analog voltage reference (Vref+) voltage (unit: mV)
Kojto 122:f9eeca106725 2280 * @param __TEMPSENSOR_ADC_DATA__ ADC conversion data of internal temperature sensor (unit: digital value).
Kojto 122:f9eeca106725 2281 * @param __ADC_RESOLUTION__ ADC resolution at which internal temperature sensor voltage has been measured.
Kojto 122:f9eeca106725 2282 * This parameter can be one of the following values:
Kojto 122:f9eeca106725 2283 * @arg @ref LL_ADC_RESOLUTION_12B
Kojto 122:f9eeca106725 2284 * @arg @ref LL_ADC_RESOLUTION_10B
Kojto 122:f9eeca106725 2285 * @arg @ref LL_ADC_RESOLUTION_8B
Kojto 122:f9eeca106725 2286 * @arg @ref LL_ADC_RESOLUTION_6B
Kojto 122:f9eeca106725 2287 * @retval Temperature (unit: degree Celsius)
Kojto 122:f9eeca106725 2288 */
Kojto 122:f9eeca106725 2289 #define __LL_ADC_CALC_TEMPERATURE_TYP_PARAMS(__TEMPSENSOR_TYP_AVGSLOPE__,\
Kojto 122:f9eeca106725 2290 __TEMPSENSOR_TYP_CALX_V__,\
Kojto 122:f9eeca106725 2291 __TEMPSENSOR_CALX_TEMP__,\
Kojto 122:f9eeca106725 2292 __VREFANALOG_VOLTAGE__,\
Kojto 122:f9eeca106725 2293 __TEMPSENSOR_ADC_DATA__,\
Kojto 122:f9eeca106725 2294 __ADC_RESOLUTION__) \
Kojto 122:f9eeca106725 2295 ((( ( \
Kojto 122:f9eeca106725 2296 (int32_t)((((__TEMPSENSOR_ADC_DATA__) * (__VREFANALOG_VOLTAGE__)) \
Kojto 122:f9eeca106725 2297 / __LL_ADC_DIGITAL_SCALE(__ADC_RESOLUTION__)) \
Kojto 122:f9eeca106725 2298 * 1000) \
Kojto 122:f9eeca106725 2299 - \
Kojto 122:f9eeca106725 2300 (int32_t)(((__TEMPSENSOR_TYP_CALX_V__)) \
Kojto 122:f9eeca106725 2301 * 1000) \
Kojto 122:f9eeca106725 2302 ) \
Kojto 122:f9eeca106725 2303 ) / (__TEMPSENSOR_TYP_AVGSLOPE__) \
Kojto 122:f9eeca106725 2304 ) + (__TEMPSENSOR_CALX_TEMP__) \
Kojto 122:f9eeca106725 2305 )
Kojto 122:f9eeca106725 2306
Kojto 122:f9eeca106725 2307 /**
Kojto 122:f9eeca106725 2308 * @}
Kojto 122:f9eeca106725 2309 */
Kojto 122:f9eeca106725 2310
Kojto 122:f9eeca106725 2311 /**
Kojto 122:f9eeca106725 2312 * @}
Kojto 122:f9eeca106725 2313 */
Kojto 122:f9eeca106725 2314
Kojto 122:f9eeca106725 2315
Kojto 122:f9eeca106725 2316 /* Exported functions --------------------------------------------------------*/
Kojto 122:f9eeca106725 2317 /** @defgroup ADC_LL_Exported_Functions ADC Exported Functions
Kojto 122:f9eeca106725 2318 * @{
Kojto 122:f9eeca106725 2319 */
Kojto 122:f9eeca106725 2320
Kojto 122:f9eeca106725 2321 /** @defgroup ADC_LL_EF_DMA_Management ADC DMA management
Kojto 122:f9eeca106725 2322 * @{
Kojto 122:f9eeca106725 2323 */
Kojto 122:f9eeca106725 2324 /* Note: LL ADC functions to set DMA transfer are located into sections of */
Kojto 122:f9eeca106725 2325 /* configuration of ADC instance, groups and multimode (if available): */
Kojto 122:f9eeca106725 2326 /* @ref LL_ADC_REG_SetDMATransfer(), ... */
Kojto 122:f9eeca106725 2327
Kojto 122:f9eeca106725 2328 /**
Kojto 122:f9eeca106725 2329 * @brief Function to help to configure DMA transfer from ADC: retrieve the
Kojto 122:f9eeca106725 2330 * ADC register address from ADC instance and a list of ADC registers
Kojto 122:f9eeca106725 2331 * intended to be used (most commonly) with DMA transfer.
Kojto 122:f9eeca106725 2332 * @note These ADC registers are data registers:
Kojto 122:f9eeca106725 2333 * when ADC conversion data is available in ADC data registers,
Kojto 122:f9eeca106725 2334 * ADC generates a DMA transfer request.
Kojto 122:f9eeca106725 2335 * @note This macro is intended to be used with LL DMA driver, refer to
Kojto 122:f9eeca106725 2336 * function "LL_DMA_ConfigAddresses()".
Kojto 122:f9eeca106725 2337 * Example:
Kojto 122:f9eeca106725 2338 * LL_DMA_ConfigAddresses(DMA1,
Kojto 122:f9eeca106725 2339 * LL_DMA_CHANNEL_1,
Kojto 122:f9eeca106725 2340 * LL_ADC_DMA_GetRegAddr(ADC1, LL_ADC_DMA_REG_REGULAR_DATA),
Kojto 122:f9eeca106725 2341 * (uint32_t)&< array or variable >,
Kojto 122:f9eeca106725 2342 * LL_DMA_DIRECTION_PERIPH_TO_MEMORY);
Kojto 122:f9eeca106725 2343 * @note For devices with several ADC: in multimode, some devices
Kojto 122:f9eeca106725 2344 * use a different data register outside of ADC instance scope
Kojto 122:f9eeca106725 2345 * (common data register). This macro manages this register difference,
Kojto 122:f9eeca106725 2346 * only ADC instance has to be set as parameter.
Kojto 122:f9eeca106725 2347 * @rmtoll DR RDATA LL_ADC_DMA_GetRegAddr\n
Kojto 122:f9eeca106725 2348 * CDR RDATA_MST LL_ADC_DMA_GetRegAddr\n
Kojto 122:f9eeca106725 2349 * CDR RDATA_SLV LL_ADC_DMA_GetRegAddr
Kojto 122:f9eeca106725 2350 * @param ADCx ADC instance
Kojto 122:f9eeca106725 2351 * @param Register This parameter can be one of the following values:
Kojto 122:f9eeca106725 2352 * @arg @ref LL_ADC_DMA_REG_REGULAR_DATA
Kojto 122:f9eeca106725 2353 * @arg @ref LL_ADC_DMA_REG_REGULAR_DATA_MULTI (1)
Kojto 122:f9eeca106725 2354 *
Kojto 122:f9eeca106725 2355 * (1) Available on devices with several ADC instances.
Kojto 122:f9eeca106725 2356 * @retval ADC register address
Kojto 122:f9eeca106725 2357 */
Kojto 122:f9eeca106725 2358 #if defined(ADC_MULTIMODE_SUPPORT)
Kojto 122:f9eeca106725 2359 __STATIC_INLINE uint32_t LL_ADC_DMA_GetRegAddr(ADC_TypeDef *ADCx, uint32_t Register)
Kojto 122:f9eeca106725 2360 {
Kojto 122:f9eeca106725 2361 register uint32_t data_reg_addr = 0U;
Kojto 122:f9eeca106725 2362
Kojto 122:f9eeca106725 2363 if (Register == LL_ADC_DMA_REG_REGULAR_DATA)
Kojto 122:f9eeca106725 2364 {
Kojto 122:f9eeca106725 2365 /* Retrieve address of register DR */
Kojto 122:f9eeca106725 2366 data_reg_addr = (uint32_t)&(ADCx->DR);
Kojto 122:f9eeca106725 2367 }
Kojto 122:f9eeca106725 2368 else /* (Register == LL_ADC_DMA_REG_REGULAR_DATA_MULTI) */
Kojto 122:f9eeca106725 2369 {
Kojto 122:f9eeca106725 2370 /* Retrieve address of register CDR */
Kojto 122:f9eeca106725 2371 data_reg_addr = (uint32_t)&((__LL_ADC_COMMON_INSTANCE(ADCx))->CDR);
Kojto 122:f9eeca106725 2372 }
Kojto 122:f9eeca106725 2373
Kojto 122:f9eeca106725 2374 return data_reg_addr;
Kojto 122:f9eeca106725 2375 }
Kojto 122:f9eeca106725 2376 #else
Kojto 122:f9eeca106725 2377 __STATIC_INLINE uint32_t LL_ADC_DMA_GetRegAddr(ADC_TypeDef *ADCx, uint32_t Register)
Kojto 122:f9eeca106725 2378 {
Kojto 122:f9eeca106725 2379 /* Retrieve address of register DR */
Kojto 122:f9eeca106725 2380 return (uint32_t)&(ADCx->DR);
Kojto 122:f9eeca106725 2381 }
Kojto 122:f9eeca106725 2382 #endif
Kojto 122:f9eeca106725 2383
Kojto 122:f9eeca106725 2384 /**
Kojto 122:f9eeca106725 2385 * @}
Kojto 122:f9eeca106725 2386 */
Kojto 122:f9eeca106725 2387
Kojto 122:f9eeca106725 2388 /** @defgroup ADC_LL_EF_Configuration_ADC_Common Configuration of ADC hierarchical scope: common to several ADC instances
Kojto 122:f9eeca106725 2389 * @{
Kojto 122:f9eeca106725 2390 */
Kojto 122:f9eeca106725 2391
Kojto 122:f9eeca106725 2392 /**
Kojto 122:f9eeca106725 2393 * @brief Set parameter common to several ADC: Clock source and prescaler.
Kojto 122:f9eeca106725 2394 * @note On this STM32 serie, if ADC group injected is used, some
Kojto 122:f9eeca106725 2395 * clock ratio constraints between ADC clock and AHB clock
Kojto 122:f9eeca106725 2396 * must be respected.
Kojto 122:f9eeca106725 2397 * Refer to reference manual.
Kojto 122:f9eeca106725 2398 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 2399 * ADC state:
Kojto 122:f9eeca106725 2400 * All ADC instances of the ADC common group must be disabled.
Kojto 122:f9eeca106725 2401 * This check can be done with function @ref LL_ADC_IsEnabled() for each
Kojto 122:f9eeca106725 2402 * ADC instance or by using helper macro helper macro
Kojto 122:f9eeca106725 2403 * @ref __LL_ADC_IS_ENABLED_ALL_COMMON_INSTANCE().
Kojto 122:f9eeca106725 2404 * @rmtoll CCR CKMODE LL_ADC_SetCommonClock\n
Kojto 122:f9eeca106725 2405 * CCR PRESC LL_ADC_SetCommonClock
Kojto 122:f9eeca106725 2406 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 2407 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 2408 * @param CommonClock This parameter can be one of the following values:
Kojto 122:f9eeca106725 2409 * @arg @ref LL_ADC_CLOCK_SYNC_PCLK_DIV1
Kojto 122:f9eeca106725 2410 * @arg @ref LL_ADC_CLOCK_SYNC_PCLK_DIV2
Kojto 122:f9eeca106725 2411 * @arg @ref LL_ADC_CLOCK_SYNC_PCLK_DIV4
Kojto 122:f9eeca106725 2412 * @arg @ref LL_ADC_CLOCK_ASYNC_DIV1
Kojto 122:f9eeca106725 2413 * @arg @ref LL_ADC_CLOCK_ASYNC_DIV2
Kojto 122:f9eeca106725 2414 * @arg @ref LL_ADC_CLOCK_ASYNC_DIV4
Kojto 122:f9eeca106725 2415 * @arg @ref LL_ADC_CLOCK_ASYNC_DIV6
Kojto 122:f9eeca106725 2416 * @arg @ref LL_ADC_CLOCK_ASYNC_DIV8
Kojto 122:f9eeca106725 2417 * @arg @ref LL_ADC_CLOCK_ASYNC_DIV10
Kojto 122:f9eeca106725 2418 * @arg @ref LL_ADC_CLOCK_ASYNC_DIV12
Kojto 122:f9eeca106725 2419 * @arg @ref LL_ADC_CLOCK_ASYNC_DIV16
Kojto 122:f9eeca106725 2420 * @arg @ref LL_ADC_CLOCK_ASYNC_DIV32
Kojto 122:f9eeca106725 2421 * @arg @ref LL_ADC_CLOCK_ASYNC_DIV64
Kojto 122:f9eeca106725 2422 * @arg @ref LL_ADC_CLOCK_ASYNC_DIV128
Kojto 122:f9eeca106725 2423 * @arg @ref LL_ADC_CLOCK_ASYNC_DIV256
Kojto 122:f9eeca106725 2424 * @retval None
Kojto 122:f9eeca106725 2425 */
Kojto 122:f9eeca106725 2426 __STATIC_INLINE void LL_ADC_SetCommonClock(ADC_Common_TypeDef *ADCxy_COMMON, uint32_t CommonClock)
Kojto 122:f9eeca106725 2427 {
Kojto 122:f9eeca106725 2428 MODIFY_REG(ADCxy_COMMON->CCR, ADC_CCR_CKMODE | ADC_CCR_PRESC, CommonClock);
Kojto 122:f9eeca106725 2429 }
Kojto 122:f9eeca106725 2430
Kojto 122:f9eeca106725 2431 /**
Kojto 122:f9eeca106725 2432 * @brief Get parameter common to several ADC: Clock source and prescaler.
Kojto 122:f9eeca106725 2433 * @rmtoll CCR CKMODE LL_ADC_GetCommonClock\n
Kojto 122:f9eeca106725 2434 * CCR PRESC LL_ADC_GetCommonClock
Kojto 122:f9eeca106725 2435 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 2436 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 2437 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 2438 * @arg @ref LL_ADC_CLOCK_SYNC_PCLK_DIV1
Kojto 122:f9eeca106725 2439 * @arg @ref LL_ADC_CLOCK_SYNC_PCLK_DIV2
Kojto 122:f9eeca106725 2440 * @arg @ref LL_ADC_CLOCK_SYNC_PCLK_DIV4
Kojto 122:f9eeca106725 2441 * @arg @ref LL_ADC_CLOCK_ASYNC_DIV1
Kojto 122:f9eeca106725 2442 * @arg @ref LL_ADC_CLOCK_ASYNC_DIV2
Kojto 122:f9eeca106725 2443 * @arg @ref LL_ADC_CLOCK_ASYNC_DIV4
Kojto 122:f9eeca106725 2444 * @arg @ref LL_ADC_CLOCK_ASYNC_DIV6
Kojto 122:f9eeca106725 2445 * @arg @ref LL_ADC_CLOCK_ASYNC_DIV8
Kojto 122:f9eeca106725 2446 * @arg @ref LL_ADC_CLOCK_ASYNC_DIV10
Kojto 122:f9eeca106725 2447 * @arg @ref LL_ADC_CLOCK_ASYNC_DIV12
Kojto 122:f9eeca106725 2448 * @arg @ref LL_ADC_CLOCK_ASYNC_DIV16
Kojto 122:f9eeca106725 2449 * @arg @ref LL_ADC_CLOCK_ASYNC_DIV32
Kojto 122:f9eeca106725 2450 * @arg @ref LL_ADC_CLOCK_ASYNC_DIV64
Kojto 122:f9eeca106725 2451 * @arg @ref LL_ADC_CLOCK_ASYNC_DIV128
Kojto 122:f9eeca106725 2452 * @arg @ref LL_ADC_CLOCK_ASYNC_DIV256
Kojto 122:f9eeca106725 2453 */
Kojto 122:f9eeca106725 2454 __STATIC_INLINE uint32_t LL_ADC_GetCommonClock(ADC_Common_TypeDef *ADCxy_COMMON)
Kojto 122:f9eeca106725 2455 {
Kojto 122:f9eeca106725 2456 return (uint32_t)(READ_BIT(ADCxy_COMMON->CCR, ADC_CCR_CKMODE | ADC_CCR_PRESC));
Kojto 122:f9eeca106725 2457 }
Kojto 122:f9eeca106725 2458
Kojto 122:f9eeca106725 2459 /**
Kojto 122:f9eeca106725 2460 * @brief Set parameter common to several ADC: measurement path to internal
Kojto 122:f9eeca106725 2461 * channels (VrefInt, temperature sensor, ...).
Kojto 122:f9eeca106725 2462 * @note One or several values can be selected.
Kojto 122:f9eeca106725 2463 * Example: (LL_ADC_PATH_INTERNAL_VREFINT |
Kojto 122:f9eeca106725 2464 * LL_ADC_PATH_INTERNAL_TEMPSENSOR)
Kojto 122:f9eeca106725 2465 * @note Stabilization time of measurement path to internal channel:
Kojto 122:f9eeca106725 2466 * After enabling internal paths, before starting ADC conversion,
Kojto 122:f9eeca106725 2467 * a delay is required for internal voltage reference and
Kojto 122:f9eeca106725 2468 * temperature sensor stabilization time.
Kojto 122:f9eeca106725 2469 * Refer to device datasheet.
Kojto 122:f9eeca106725 2470 * Refer to literal @ref LL_ADC_DELAY_VREFINT_STAB_US.
Kojto 122:f9eeca106725 2471 * Refer to literal @ref LL_ADC_DELAY_TEMPSENSOR_STAB_US.
Kojto 122:f9eeca106725 2472 * @note ADC internal channel sampling time constraint:
Kojto 122:f9eeca106725 2473 * For ADC conversion of internal channels,
Kojto 122:f9eeca106725 2474 * a sampling time minimum value is required.
Kojto 122:f9eeca106725 2475 * Refer to device datasheet.
Kojto 122:f9eeca106725 2476 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 2477 * ADC state:
Kojto 122:f9eeca106725 2478 * All ADC instances of the ADC common group must be disabled.
Kojto 122:f9eeca106725 2479 * This check can be done with function @ref LL_ADC_IsEnabled() for each
Kojto 122:f9eeca106725 2480 * ADC instance or by using helper macro helper macro
Kojto 122:f9eeca106725 2481 * @ref __LL_ADC_IS_ENABLED_ALL_COMMON_INSTANCE().
Kojto 122:f9eeca106725 2482 * @rmtoll CCR VREFEN LL_ADC_SetCommonPathInternalCh\n
Kojto 122:f9eeca106725 2483 * CCR TSEN LL_ADC_SetCommonPathInternalCh\n
Kojto 122:f9eeca106725 2484 * CCR VBATEN LL_ADC_SetCommonPathInternalCh
Kojto 122:f9eeca106725 2485 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 2486 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 2487 * @param PathInternal This parameter can be a combination of the following values:
Kojto 122:f9eeca106725 2488 * @arg @ref LL_ADC_PATH_INTERNAL_NONE
Kojto 122:f9eeca106725 2489 * @arg @ref LL_ADC_PATH_INTERNAL_VREFINT
Kojto 122:f9eeca106725 2490 * @arg @ref LL_ADC_PATH_INTERNAL_TEMPSENSOR
Kojto 122:f9eeca106725 2491 * @arg @ref LL_ADC_PATH_INTERNAL_VBAT
Kojto 122:f9eeca106725 2492 * @retval None
Kojto 122:f9eeca106725 2493 */
Kojto 122:f9eeca106725 2494 __STATIC_INLINE void LL_ADC_SetCommonPathInternalCh(ADC_Common_TypeDef *ADCxy_COMMON, uint32_t PathInternal)
Kojto 122:f9eeca106725 2495 {
Kojto 122:f9eeca106725 2496 MODIFY_REG(ADCxy_COMMON->CCR, ADC_CCR_VREFEN | ADC_CCR_TSEN | ADC_CCR_VBATEN, PathInternal);
Kojto 122:f9eeca106725 2497 }
Kojto 122:f9eeca106725 2498
Kojto 122:f9eeca106725 2499 /**
Kojto 122:f9eeca106725 2500 * @brief Get parameter common to several ADC: measurement path to internal
Kojto 122:f9eeca106725 2501 * channels (VrefInt, temperature sensor, ...).
Kojto 122:f9eeca106725 2502 * @note One or several values can be selected.
Kojto 122:f9eeca106725 2503 * Example: (LL_ADC_PATH_INTERNAL_VREFINT |
Kojto 122:f9eeca106725 2504 * LL_ADC_PATH_INTERNAL_TEMPSENSOR)
Kojto 122:f9eeca106725 2505 * @rmtoll CCR VREFEN LL_ADC_GetCommonPathInternalCh\n
Kojto 122:f9eeca106725 2506 * CCR TSEN LL_ADC_GetCommonPathInternalCh\n
Kojto 122:f9eeca106725 2507 * CCR VBATEN LL_ADC_GetCommonPathInternalCh
Kojto 122:f9eeca106725 2508 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 2509 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 2510 * @retval Returned value can be a combination of the following values:
Kojto 122:f9eeca106725 2511 * @arg @ref LL_ADC_PATH_INTERNAL_NONE
Kojto 122:f9eeca106725 2512 * @arg @ref LL_ADC_PATH_INTERNAL_VREFINT
Kojto 122:f9eeca106725 2513 * @arg @ref LL_ADC_PATH_INTERNAL_TEMPSENSOR
Kojto 122:f9eeca106725 2514 * @arg @ref LL_ADC_PATH_INTERNAL_VBAT
Kojto 122:f9eeca106725 2515 */
Kojto 122:f9eeca106725 2516 __STATIC_INLINE uint32_t LL_ADC_GetCommonPathInternalCh(ADC_Common_TypeDef *ADCxy_COMMON)
Kojto 122:f9eeca106725 2517 {
Kojto 122:f9eeca106725 2518 return (uint32_t)(READ_BIT(ADCxy_COMMON->CCR, ADC_CCR_VREFEN | ADC_CCR_TSEN | ADC_CCR_VBATEN));
Kojto 122:f9eeca106725 2519 }
Kojto 122:f9eeca106725 2520
Kojto 122:f9eeca106725 2521 /**
Kojto 122:f9eeca106725 2522 * @}
Kojto 122:f9eeca106725 2523 */
Kojto 122:f9eeca106725 2524
Kojto 122:f9eeca106725 2525 /** @defgroup ADC_LL_EF_Configuration_ADC_Instance Configuration of ADC hierarchical scope: ADC instance
Kojto 122:f9eeca106725 2526 * @{
Kojto 122:f9eeca106725 2527 */
Kojto 122:f9eeca106725 2528
Kojto 122:f9eeca106725 2529 /**
Kojto 122:f9eeca106725 2530 * @brief Set ADC calibration factor in the mode single-ended
Kojto 122:f9eeca106725 2531 * or differential (for devices with differential mode available).
Kojto 122:f9eeca106725 2532 * @note This function is intended to set calibration parameters
Kojto 122:f9eeca106725 2533 * without having to perform a new calibration using
Kojto 122:f9eeca106725 2534 * @ref LL_ADC_StartCalibration().
Kojto 122:f9eeca106725 2535 * @note For devices with differential mode available:
Kojto 122:f9eeca106725 2536 * Calibration of offset is specific to each of
Kojto 122:f9eeca106725 2537 * single-ended and differential modes
Kojto 122:f9eeca106725 2538 * (calibration factor must be specified for each of these
Kojto 122:f9eeca106725 2539 * differential modes, if used afterwards and if the application
Kojto 122:f9eeca106725 2540 * requires their calibration).
Kojto 122:f9eeca106725 2541 * @note In case of setting calibration factors of both modes single ended
Kojto 122:f9eeca106725 2542 * and differential (parameter LL_ADC_BOTH_SINGLE_DIFF_ENDED):
Kojto 122:f9eeca106725 2543 * both calibration factors must be concatenated.
Kojto 122:f9eeca106725 2544 * To perform this processing, use helper macro
Kojto 122:f9eeca106725 2545 * @ref __LL_ADC_CALIB_FACTOR_SINGLE_DIFF().
Kojto 122:f9eeca106725 2546 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 2547 * ADC state:
Kojto 122:f9eeca106725 2548 * ADC must be enabled, without calibration on going, without conversion
Kojto 122:f9eeca106725 2549 * on going on group regular.
Kojto 122:f9eeca106725 2550 * @rmtoll CALFACT CALFACT_S LL_ADC_SetCalibrationFactor\n
Kojto 122:f9eeca106725 2551 * CALFACT CALFACT_D LL_ADC_SetCalibrationFactor
Kojto 122:f9eeca106725 2552 * @param ADCx ADC instance
Kojto 122:f9eeca106725 2553 * @param SingleDiff This parameter can be one of the following values:
Kojto 122:f9eeca106725 2554 * @arg @ref LL_ADC_SINGLE_ENDED
Kojto 122:f9eeca106725 2555 * @arg @ref LL_ADC_DIFFERENTIAL_ENDED
Kojto 122:f9eeca106725 2556 * @arg @ref LL_ADC_BOTH_SINGLE_DIFF_ENDED
Kojto 122:f9eeca106725 2557 * @param CalibrationFactor Value between Min_Data=0x00 and Max_Data=0x7F
Kojto 122:f9eeca106725 2558 * @retval None
Kojto 122:f9eeca106725 2559 */
Kojto 122:f9eeca106725 2560 __STATIC_INLINE void LL_ADC_SetCalibrationFactor(ADC_TypeDef *ADCx, uint32_t SingleDiff, uint32_t CalibrationFactor)
Kojto 122:f9eeca106725 2561 {
Kojto 122:f9eeca106725 2562 MODIFY_REG(ADCx->CALFACT,
Kojto 122:f9eeca106725 2563 SingleDiff & ADC_SINGLEDIFF_CALIB_FACTOR_MASK,
Kojto 122:f9eeca106725 2564 CalibrationFactor << POSITION_VAL(SingleDiff & ADC_SINGLEDIFF_CALIB_FACTOR_MASK));
Kojto 122:f9eeca106725 2565 }
Kojto 122:f9eeca106725 2566
Kojto 122:f9eeca106725 2567 /**
Kojto 122:f9eeca106725 2568 * @brief Get ADC calibration factor in the mode single-ended
Kojto 122:f9eeca106725 2569 * or differential (for devices with differential mode available).
Kojto 122:f9eeca106725 2570 * @note Calibration factors are set by hardware after performing
Kojto 122:f9eeca106725 2571 * a calibration run using function @ref LL_ADC_StartCalibration().
Kojto 122:f9eeca106725 2572 * @note For devices with differential mode available:
Kojto 122:f9eeca106725 2573 * Calibration of offset is specific to each of
Kojto 122:f9eeca106725 2574 * single-ended and differential modes
Kojto 122:f9eeca106725 2575 * @rmtoll CALFACT CALFACT_S LL_ADC_GetCalibrationFactor\n
Kojto 122:f9eeca106725 2576 * CALFACT CALFACT_D LL_ADC_GetCalibrationFactor
Kojto 122:f9eeca106725 2577 * @param ADCx ADC instance
Kojto 122:f9eeca106725 2578 * @param SingleDiff This parameter can be one of the following values:
Kojto 122:f9eeca106725 2579 * @arg @ref LL_ADC_SINGLE_ENDED
Kojto 122:f9eeca106725 2580 * @arg @ref LL_ADC_DIFFERENTIAL_ENDED
Kojto 122:f9eeca106725 2581 * @retval Value between Min_Data=0x00 and Max_Data=0x7F
Kojto 122:f9eeca106725 2582 */
Kojto 122:f9eeca106725 2583 __STATIC_INLINE uint32_t LL_ADC_GetCalibrationFactor(ADC_TypeDef *ADCx, uint32_t SingleDiff)
Kojto 122:f9eeca106725 2584 {
Kojto 122:f9eeca106725 2585 /* Retrieve bits with position in register depending on parameter */
Kojto 122:f9eeca106725 2586 /* "SingleDiff". */
Kojto 122:f9eeca106725 2587 /* Parameter used with mask "ADC_SINGLEDIFF_CALIB_FACTOR_MASK" because */
Kojto 122:f9eeca106725 2588 /* containing other bits reserved for other purpose. */
Kojto 122:f9eeca106725 2589 return (uint32_t)(READ_BIT(ADCx->CALFACT, (SingleDiff & ADC_SINGLEDIFF_CALIB_FACTOR_MASK)) >> POSITION_VAL(SingleDiff & ADC_SINGLEDIFF_CALIB_FACTOR_MASK));
Kojto 122:f9eeca106725 2590 }
Kojto 122:f9eeca106725 2591
Kojto 122:f9eeca106725 2592 /**
Kojto 122:f9eeca106725 2593 * @brief Set ADC resolution.
Kojto 122:f9eeca106725 2594 * Refer to reference manual for alignments formats
Kojto 122:f9eeca106725 2595 * dependencies to ADC resolutions.
Kojto 122:f9eeca106725 2596 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 2597 * ADC state:
Kojto 122:f9eeca106725 2598 * ADC must be disabled or enabled without conversion on going
Kojto 122:f9eeca106725 2599 * on either groups regular or injected.
Kojto 122:f9eeca106725 2600 * @rmtoll CFGR RES LL_ADC_SetResolution
Kojto 122:f9eeca106725 2601 * @param ADCx ADC instance
Kojto 122:f9eeca106725 2602 * @param Resolution This parameter can be one of the following values:
Kojto 122:f9eeca106725 2603 * @arg @ref LL_ADC_RESOLUTION_12B
Kojto 122:f9eeca106725 2604 * @arg @ref LL_ADC_RESOLUTION_10B
Kojto 122:f9eeca106725 2605 * @arg @ref LL_ADC_RESOLUTION_8B
Kojto 122:f9eeca106725 2606 * @arg @ref LL_ADC_RESOLUTION_6B
Kojto 122:f9eeca106725 2607 * @retval None
Kojto 122:f9eeca106725 2608 */
Kojto 122:f9eeca106725 2609 __STATIC_INLINE void LL_ADC_SetResolution(ADC_TypeDef *ADCx, uint32_t Resolution)
Kojto 122:f9eeca106725 2610 {
Kojto 122:f9eeca106725 2611 MODIFY_REG(ADCx->CFGR, ADC_CFGR_RES, Resolution);
Kojto 122:f9eeca106725 2612 }
Kojto 122:f9eeca106725 2613
Kojto 122:f9eeca106725 2614 /**
Kojto 122:f9eeca106725 2615 * @brief Get ADC resolution.
Kojto 122:f9eeca106725 2616 * Refer to reference manual for alignments formats
Kojto 122:f9eeca106725 2617 * dependencies to ADC resolutions.
Kojto 122:f9eeca106725 2618 * @rmtoll CFGR RES LL_ADC_GetResolution
Kojto 122:f9eeca106725 2619 * @param ADCx ADC instance
Kojto 122:f9eeca106725 2620 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 2621 * @arg @ref LL_ADC_RESOLUTION_12B
Kojto 122:f9eeca106725 2622 * @arg @ref LL_ADC_RESOLUTION_10B
Kojto 122:f9eeca106725 2623 * @arg @ref LL_ADC_RESOLUTION_8B
Kojto 122:f9eeca106725 2624 * @arg @ref LL_ADC_RESOLUTION_6B
Kojto 122:f9eeca106725 2625 */
Kojto 122:f9eeca106725 2626 __STATIC_INLINE uint32_t LL_ADC_GetResolution(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 2627 {
Kojto 122:f9eeca106725 2628 return (uint32_t)(READ_BIT(ADCx->CFGR, ADC_CFGR_RES));
Kojto 122:f9eeca106725 2629 }
Kojto 122:f9eeca106725 2630
Kojto 122:f9eeca106725 2631 /**
Kojto 122:f9eeca106725 2632 * @brief Set ADC conversion data alignment.
Kojto 122:f9eeca106725 2633 * @note Refer to reference manual for alignments formats
Kojto 122:f9eeca106725 2634 * dependencies to ADC resolutions.
Kojto 122:f9eeca106725 2635 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 2636 * ADC state:
Kojto 122:f9eeca106725 2637 * ADC must be disabled or enabled without conversion on going
Kojto 122:f9eeca106725 2638 * on either groups regular or injected.
Kojto 122:f9eeca106725 2639 * @rmtoll CFGR ALIGN LL_ADC_SetDataAlignment
Kojto 122:f9eeca106725 2640 * @param ADCx ADC instance
Kojto 122:f9eeca106725 2641 * @param DataAlignment This parameter can be one of the following values:
Kojto 122:f9eeca106725 2642 * @arg @ref LL_ADC_DATA_ALIGN_RIGHT
Kojto 122:f9eeca106725 2643 * @arg @ref LL_ADC_DATA_ALIGN_LEFT
Kojto 122:f9eeca106725 2644 * @retval None
Kojto 122:f9eeca106725 2645 */
Kojto 122:f9eeca106725 2646 __STATIC_INLINE void LL_ADC_SetDataAlignment(ADC_TypeDef *ADCx, uint32_t DataAlignment)
Kojto 122:f9eeca106725 2647 {
Kojto 122:f9eeca106725 2648 MODIFY_REG(ADCx->CFGR, ADC_CFGR_ALIGN, DataAlignment);
Kojto 122:f9eeca106725 2649 }
Kojto 122:f9eeca106725 2650
Kojto 122:f9eeca106725 2651 /**
Kojto 122:f9eeca106725 2652 * @brief Get ADC conversion data alignment.
Kojto 122:f9eeca106725 2653 * @note Refer to reference manual for alignments formats
Kojto 122:f9eeca106725 2654 * dependencies to ADC resolutions.
Kojto 122:f9eeca106725 2655 * @rmtoll CFGR ALIGN LL_ADC_GetDataAlignment
Kojto 122:f9eeca106725 2656 * @param ADCx ADC instance
Kojto 122:f9eeca106725 2657 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 2658 * @arg @ref LL_ADC_DATA_ALIGN_RIGHT
Kojto 122:f9eeca106725 2659 * @arg @ref LL_ADC_DATA_ALIGN_LEFT
Kojto 122:f9eeca106725 2660 */
Kojto 122:f9eeca106725 2661 __STATIC_INLINE uint32_t LL_ADC_GetDataAlignment(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 2662 {
Kojto 122:f9eeca106725 2663 return (uint32_t)(READ_BIT(ADCx->CFGR, ADC_CFGR_ALIGN));
Kojto 122:f9eeca106725 2664 }
Kojto 122:f9eeca106725 2665
Kojto 122:f9eeca106725 2666 /**
Kojto 122:f9eeca106725 2667 * @brief Set ADC low power mode.
Kojto 122:f9eeca106725 2668 * @note Description of ADC low power modes:
Kojto 122:f9eeca106725 2669 * - ADC low power mode "auto wait": Dynamic low power mode,
Kojto 122:f9eeca106725 2670 * ADC conversions occurrences are limited to the minimum necessary
Kojto 122:f9eeca106725 2671 * in order to reduce power consumption.
Kojto 122:f9eeca106725 2672 * New ADC conversion starts only when the previous
Kojto 122:f9eeca106725 2673 * unitary conversion data (for ADC group regular)
Kojto 122:f9eeca106725 2674 * or previous sequence conversions data (for ADC group injected)
Kojto 122:f9eeca106725 2675 * has been retrieved by user software.
Kojto 122:f9eeca106725 2676 * In the meantime, ADC remains idle: does not performs any
Kojto 122:f9eeca106725 2677 * other conversion.
Kojto 122:f9eeca106725 2678 * This mode allows to automatically adapt the ADC conversions
Kojto 122:f9eeca106725 2679 * triggers to the speed of the software that reads the data.
Kojto 122:f9eeca106725 2680 * Moreover, this avoids risk of overrun for low frequency
Kojto 122:f9eeca106725 2681 * applications.
Kojto 122:f9eeca106725 2682 * How to use this low power mode:
Kojto 122:f9eeca106725 2683 * - Do not use with interruption or DMA since these modes
Kojto 122:f9eeca106725 2684 * have to clear immediately the EOC flag to free the
Kojto 122:f9eeca106725 2685 * IRQ vector sequencer.
Kojto 122:f9eeca106725 2686 * - Do use with polling: 1. Start conversion,
Kojto 122:f9eeca106725 2687 * 2. Later on, when conversion data is needed: poll for end of
Kojto 122:f9eeca106725 2688 * conversion to ensure that conversion is completed and
Kojto 122:f9eeca106725 2689 * retrieve ADC conversion data. This will trig another
Kojto 122:f9eeca106725 2690 * ADC conversion start.
Kojto 122:f9eeca106725 2691 * - ADC low power mode "auto power-off" (feature available on
Kojto 122:f9eeca106725 2692 * this device if parameter LL_ADC_LP_MODE_AUTOOFF is available):
Kojto 122:f9eeca106725 2693 * the ADC automatically powers-off after a conversion and
Kojto 122:f9eeca106725 2694 * automatically wakes up when a new conversion is triggered
Kojto 122:f9eeca106725 2695 * (with startup time between trigger and start of sampling).
Kojto 122:f9eeca106725 2696 * This feature can be combined with low power mode "auto wait".
Kojto 122:f9eeca106725 2697 * @note With ADC low power mode "auto wait", the ADC conversion data read
Kojto 122:f9eeca106725 2698 * is corresponding to previous ADC conversion start, independently
Kojto 122:f9eeca106725 2699 * of delay during which ADC was idle.
Kojto 122:f9eeca106725 2700 * Therefore, the ADC conversion data may be outdated: does not
Kojto 122:f9eeca106725 2701 * correspond to the current voltage level on the selected
Kojto 122:f9eeca106725 2702 * ADC channel.
Kojto 122:f9eeca106725 2703 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 2704 * ADC state:
Kojto 122:f9eeca106725 2705 * ADC must be disabled or enabled without conversion on going
Kojto 122:f9eeca106725 2706 * on either groups regular or injected.
Kojto 122:f9eeca106725 2707 * @rmtoll CFGR AUTDLY LL_ADC_SetLowPowerMode
Kojto 122:f9eeca106725 2708 * @param ADCx ADC instance
Kojto 122:f9eeca106725 2709 * @param LowPowerMode This parameter can be one of the following values:
Kojto 122:f9eeca106725 2710 * @arg @ref LL_ADC_LP_MODE_NONE
Kojto 122:f9eeca106725 2711 * @arg @ref LL_ADC_LP_AUTOWAIT
Kojto 122:f9eeca106725 2712 * @retval None
Kojto 122:f9eeca106725 2713 */
Kojto 122:f9eeca106725 2714 __STATIC_INLINE void LL_ADC_SetLowPowerMode(ADC_TypeDef *ADCx, uint32_t LowPowerMode)
Kojto 122:f9eeca106725 2715 {
Kojto 122:f9eeca106725 2716 MODIFY_REG(ADCx->CFGR, ADC_CFGR_AUTDLY, LowPowerMode);
Kojto 122:f9eeca106725 2717 }
Kojto 122:f9eeca106725 2718
Kojto 122:f9eeca106725 2719 /**
Kojto 122:f9eeca106725 2720 * @brief Get ADC low power mode:
Kojto 122:f9eeca106725 2721 * @note Description of ADC low power modes:
Kojto 122:f9eeca106725 2722 * - ADC low power mode "auto wait": Dynamic low power mode,
Kojto 122:f9eeca106725 2723 * ADC conversions occurrences are limited to the minimum necessary
Kojto 122:f9eeca106725 2724 * in order to reduce power consumption.
Kojto 122:f9eeca106725 2725 * New ADC conversion starts only when the previous
Kojto 122:f9eeca106725 2726 * unitary conversion data (for ADC group regular)
Kojto 122:f9eeca106725 2727 * or previous sequence conversions data (for ADC group injected)
Kojto 122:f9eeca106725 2728 * has been retrieved by user software.
Kojto 122:f9eeca106725 2729 * In the meantime, ADC remains idle: does not performs any
Kojto 122:f9eeca106725 2730 * other conversion.
Kojto 122:f9eeca106725 2731 * This mode allows to automatically adapt the ADC conversions
Kojto 122:f9eeca106725 2732 * triggers to the speed of the software that reads the data.
Kojto 122:f9eeca106725 2733 * Moreover, this avoids risk of overrun for low frequency
Kojto 122:f9eeca106725 2734 * applications.
Kojto 122:f9eeca106725 2735 * How to use this low power mode:
Kojto 122:f9eeca106725 2736 * - Do not use with interruption or DMA since these modes
Kojto 122:f9eeca106725 2737 * have to clear immediately the EOC flag to free the
Kojto 122:f9eeca106725 2738 * IRQ vector sequencer.
Kojto 122:f9eeca106725 2739 * - Do use with polling: 1. Start conversion,
Kojto 122:f9eeca106725 2740 * 2. Later on, when conversion data is needed: poll for end of
Kojto 122:f9eeca106725 2741 * conversion to ensure that conversion is completed and
Kojto 122:f9eeca106725 2742 * retrieve ADC conversion data. This will trig another
Kojto 122:f9eeca106725 2743 * ADC conversion start.
Kojto 122:f9eeca106725 2744 * - ADC low power mode "auto power-off" (feature available on
Kojto 122:f9eeca106725 2745 * this device if parameter LL_ADC_LP_MODE_AUTOOFF is available):
Kojto 122:f9eeca106725 2746 * the ADC automatically powers-off after a conversion and
Kojto 122:f9eeca106725 2747 * automatically wakes up when a new conversion is triggered
Kojto 122:f9eeca106725 2748 * (with startup time between trigger and start of sampling).
Kojto 122:f9eeca106725 2749 * This feature can be combined with low power mode "auto wait".
Kojto 122:f9eeca106725 2750 * @note With ADC low power mode "auto wait", the ADC conversion data read
Kojto 122:f9eeca106725 2751 * is corresponding to previous ADC conversion start, independently
Kojto 122:f9eeca106725 2752 * of delay during which ADC was idle.
Kojto 122:f9eeca106725 2753 * Therefore, the ADC conversion data may be outdated: does not
Kojto 122:f9eeca106725 2754 * correspond to the current voltage level on the selected
Kojto 122:f9eeca106725 2755 * ADC channel.
Kojto 122:f9eeca106725 2756 * @rmtoll CFGR AUTDLY LL_ADC_GetLowPowerMode
Kojto 122:f9eeca106725 2757 * @param ADCx ADC instance
Kojto 122:f9eeca106725 2758 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 2759 * @arg @ref LL_ADC_LP_MODE_NONE
Kojto 122:f9eeca106725 2760 * @arg @ref LL_ADC_LP_AUTOWAIT
Kojto 122:f9eeca106725 2761 */
Kojto 122:f9eeca106725 2762 __STATIC_INLINE uint32_t LL_ADC_GetLowPowerMode(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 2763 {
Kojto 122:f9eeca106725 2764 return (uint32_t)(READ_BIT(ADCx->CFGR, ADC_CFGR_AUTDLY));
Kojto 122:f9eeca106725 2765 }
Kojto 122:f9eeca106725 2766
Kojto 122:f9eeca106725 2767 /**
Kojto 122:f9eeca106725 2768 * @brief Set ADC selected offset number 1, 2, 3 or 4.
Kojto 122:f9eeca106725 2769 * @note This function set the 2 items of offset configuration:
Kojto 122:f9eeca106725 2770 * - ADC channel to which the offset programmed will be applied
Kojto 122:f9eeca106725 2771 * (independently of channel mapped on ADC group regular
Kojto 122:f9eeca106725 2772 * or group injected)
Kojto 122:f9eeca106725 2773 * - Offset level (offset to be subtracted from the raw
Kojto 122:f9eeca106725 2774 * converted data).
Kojto 122:f9eeca106725 2775 * @note Caution: Offset format is dependent to ADC resolution:
Kojto 122:f9eeca106725 2776 * offset has to be left-aligned on bit 11, the LSB (right bits)
Kojto 122:f9eeca106725 2777 * are set to 0.
Kojto 122:f9eeca106725 2778 * @note This function enables the offset, by default. It can be forced
Kojto 122:f9eeca106725 2779 * to disable state using function LL_ADC_SetOffsetState().
Kojto 122:f9eeca106725 2780 * @note If a channel is mapped on several offsets numbers, only the offset
Kojto 122:f9eeca106725 2781 * with the lowest value is considered for the subtraction.
Kojto 122:f9eeca106725 2782 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 2783 * ADC state:
Kojto 122:f9eeca106725 2784 * ADC must be disabled or enabled without conversion on going
Kojto 122:f9eeca106725 2785 * on either groups regular or injected.
Kojto 122:f9eeca106725 2786 * @note On STM32L4, some fast channels are available: fast analog inputs
Kojto 122:f9eeca106725 2787 * coming from GPIO pads (ADC_IN1..5).
Kojto 122:f9eeca106725 2788 * @rmtoll OFR1 OFFSET1_CH LL_ADC_SetOffset\n
Kojto 122:f9eeca106725 2789 * OFR1 OFFSET1 LL_ADC_SetOffset\n
Kojto 122:f9eeca106725 2790 * OFR1 OFFSET1_EN LL_ADC_SetOffset\n
Kojto 122:f9eeca106725 2791 * OFR2 OFFSET2_CH LL_ADC_SetOffset\n
Kojto 122:f9eeca106725 2792 * OFR2 OFFSET2 LL_ADC_SetOffset\n
Kojto 122:f9eeca106725 2793 * OFR2 OFFSET2_EN LL_ADC_SetOffset\n
Kojto 122:f9eeca106725 2794 * OFR3 OFFSET3_CH LL_ADC_SetOffset\n
Kojto 122:f9eeca106725 2795 * OFR3 OFFSET3 LL_ADC_SetOffset\n
Kojto 122:f9eeca106725 2796 * OFR3 OFFSET3_EN LL_ADC_SetOffset\n
Kojto 122:f9eeca106725 2797 * OFR4 OFFSET4_CH LL_ADC_SetOffset\n
Kojto 122:f9eeca106725 2798 * OFR4 OFFSET4 LL_ADC_SetOffset\n
Kojto 122:f9eeca106725 2799 * OFR4 OFFSET4_EN LL_ADC_SetOffset
Kojto 122:f9eeca106725 2800 * @param ADCx ADC instance
Kojto 122:f9eeca106725 2801 * @param Offsety This parameter can be one of the following values:
Kojto 122:f9eeca106725 2802 * @arg @ref LL_ADC_OFFSET_1
Kojto 122:f9eeca106725 2803 * @arg @ref LL_ADC_OFFSET_2
Kojto 122:f9eeca106725 2804 * @arg @ref LL_ADC_OFFSET_3
Kojto 122:f9eeca106725 2805 * @arg @ref LL_ADC_OFFSET_4
Kojto 122:f9eeca106725 2806 * @param Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 2807 * @arg @ref LL_ADC_CHANNEL_0
Kojto 122:f9eeca106725 2808 * @arg @ref LL_ADC_CHANNEL_1 (7)
Kojto 122:f9eeca106725 2809 * @arg @ref LL_ADC_CHANNEL_2 (7)
Kojto 122:f9eeca106725 2810 * @arg @ref LL_ADC_CHANNEL_3 (7)
Kojto 122:f9eeca106725 2811 * @arg @ref LL_ADC_CHANNEL_4 (7)
Kojto 122:f9eeca106725 2812 * @arg @ref LL_ADC_CHANNEL_5 (7)
Kojto 122:f9eeca106725 2813 * @arg @ref LL_ADC_CHANNEL_6
Kojto 122:f9eeca106725 2814 * @arg @ref LL_ADC_CHANNEL_7
Kojto 122:f9eeca106725 2815 * @arg @ref LL_ADC_CHANNEL_8
Kojto 122:f9eeca106725 2816 * @arg @ref LL_ADC_CHANNEL_9
Kojto 122:f9eeca106725 2817 * @arg @ref LL_ADC_CHANNEL_10
Kojto 122:f9eeca106725 2818 * @arg @ref LL_ADC_CHANNEL_11
Kojto 122:f9eeca106725 2819 * @arg @ref LL_ADC_CHANNEL_12
Kojto 122:f9eeca106725 2820 * @arg @ref LL_ADC_CHANNEL_13
Kojto 122:f9eeca106725 2821 * @arg @ref LL_ADC_CHANNEL_14
Kojto 122:f9eeca106725 2822 * @arg @ref LL_ADC_CHANNEL_15
Kojto 122:f9eeca106725 2823 * @arg @ref LL_ADC_CHANNEL_16
Kojto 122:f9eeca106725 2824 * @arg @ref LL_ADC_CHANNEL_17
Kojto 122:f9eeca106725 2825 * @arg @ref LL_ADC_CHANNEL_18
Kojto 122:f9eeca106725 2826 * @arg @ref LL_ADC_CHANNEL_VREFINT (1)
Kojto 122:f9eeca106725 2827 * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR (4)
Kojto 122:f9eeca106725 2828 * @arg @ref LL_ADC_CHANNEL_VBAT (4)
Kojto 122:f9eeca106725 2829 * @arg @ref LL_ADC_CHANNEL_DAC1CH1 (5)
Kojto 122:f9eeca106725 2830 * @arg @ref LL_ADC_CHANNEL_DAC1CH2 (5)
Kojto 122:f9eeca106725 2831 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)(6)
Kojto 122:f9eeca106725 2832 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)(6)
Kojto 122:f9eeca106725 2833 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC3 (3)(6)
Kojto 122:f9eeca106725 2834 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC3 (3)(6)
Kojto 122:f9eeca106725 2835 *
Kojto 122:f9eeca106725 2836 * (1) On STM32L4, parameter available only on ADC instance: ADC1.\n
Kojto 122:f9eeca106725 2837 * (2) On STM32L4, parameter available only on ADC instance: ADC2.\n
Kojto 122:f9eeca106725 2838 * (3) On STM32L4, parameter available only on ADC instance: ADC3.\n
Kojto 122:f9eeca106725 2839 * (4) On STM32L4, parameter available only on ADC instances: ADC1, ADC3.\n
Kojto 122:f9eeca106725 2840 * (5) On STM32L4, parameter available on devices with only 1 ADC instance.\n
Kojto 122:f9eeca106725 2841 * (6) On STM32L4, parameter available on devices with several ADC instances.\n
Kojto 122:f9eeca106725 2842 * (7) On STM32L4, fast channel (0.188 us for 12-bit resolution (ADC conversion rate up to 5.33 Ms/s)).
Kojto 122:f9eeca106725 2843 * Other channels are slow channels (0.238 us for 12-bit resolution (ADC conversion rate up to 4.21 Ms/s)).
Kojto 122:f9eeca106725 2844 * @param OffsetLevel Value between Min_Data=0x000 and Max_Data=0xFFF
Kojto 122:f9eeca106725 2845 * @retval None
Kojto 122:f9eeca106725 2846 */
Kojto 122:f9eeca106725 2847 __STATIC_INLINE void LL_ADC_SetOffset(ADC_TypeDef *ADCx, uint32_t Offsety, uint32_t Channel, uint32_t OffsetLevel)
Kojto 122:f9eeca106725 2848 {
Kojto 122:f9eeca106725 2849 register uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->OFR1, Offsety);
Kojto 122:f9eeca106725 2850
Kojto 122:f9eeca106725 2851 MODIFY_REG(*preg,
Kojto 122:f9eeca106725 2852 ADC_OFR1_OFFSET1_EN | ADC_OFR1_OFFSET1_CH | ADC_OFR1_OFFSET1,
Kojto 122:f9eeca106725 2853 ADC_OFR1_OFFSET1_EN | (Channel & ADC_CHANNEL_ID_NUMBER_MASK) | OffsetLevel);
Kojto 122:f9eeca106725 2854 }
Kojto 122:f9eeca106725 2855
Kojto 122:f9eeca106725 2856 /**
Kojto 122:f9eeca106725 2857 * @brief Get for the ADC selected offset number 1, 2, 3 or 4:
Kojto 122:f9eeca106725 2858 * Channel to which the offset programmed will be applied
Kojto 122:f9eeca106725 2859 * (independently of channel mapped on ADC group regular
Kojto 122:f9eeca106725 2860 * or group injected)
Kojto 122:f9eeca106725 2861 * @note Usage of the returned channel number:
Kojto 122:f9eeca106725 2862 * - To reinject this channel into another function LL_ADC_xxx:
Kojto 122:f9eeca106725 2863 * the returned channel number is only partly formatted on definition
Kojto 122:f9eeca106725 2864 * of literals LL_ADC_CHANNEL_x. Therefore, it has to be compared
Kojto 122:f9eeca106725 2865 * with parts of literals LL_ADC_CHANNEL_x or using
Kojto 122:f9eeca106725 2866 * helper macro @ref __LL_ADC_CHANNEL_TO_DECIMAL_NB().
Kojto 122:f9eeca106725 2867 * Then the selected literal LL_ADC_CHANNEL_x can be used
Kojto 122:f9eeca106725 2868 * as parameter for another function.
Kojto 122:f9eeca106725 2869 * - To get the channel number in decimal format:
Kojto 122:f9eeca106725 2870 * process the returned value with the helper macro
Kojto 122:f9eeca106725 2871 * @ref __LL_ADC_CHANNEL_TO_DECIMAL_NB().
Kojto 122:f9eeca106725 2872 * @note On STM32L4, some fast channels are available: fast analog inputs
Kojto 122:f9eeca106725 2873 * coming from GPIO pads (ADC_IN1..5).
Kojto 122:f9eeca106725 2874 * @rmtoll OFR1 OFFSET1_CH LL_ADC_GetOffsetChannel\n
Kojto 122:f9eeca106725 2875 * OFR2 OFFSET2_CH LL_ADC_GetOffsetChannel\n
Kojto 122:f9eeca106725 2876 * OFR3 OFFSET3_CH LL_ADC_GetOffsetChannel\n
Kojto 122:f9eeca106725 2877 * OFR4 OFFSET4_CH LL_ADC_GetOffsetChannel
Kojto 122:f9eeca106725 2878 * @param ADCx ADC instance
Kojto 122:f9eeca106725 2879 * @param Offsety This parameter can be one of the following values:
Kojto 122:f9eeca106725 2880 * @arg @ref LL_ADC_OFFSET_1
Kojto 122:f9eeca106725 2881 * @arg @ref LL_ADC_OFFSET_2
Kojto 122:f9eeca106725 2882 * @arg @ref LL_ADC_OFFSET_3
Kojto 122:f9eeca106725 2883 * @arg @ref LL_ADC_OFFSET_4
Kojto 122:f9eeca106725 2884 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 2885 * @arg @ref LL_ADC_CHANNEL_0
Kojto 122:f9eeca106725 2886 * @arg @ref LL_ADC_CHANNEL_1 (7)
Kojto 122:f9eeca106725 2887 * @arg @ref LL_ADC_CHANNEL_2 (7)
Kojto 122:f9eeca106725 2888 * @arg @ref LL_ADC_CHANNEL_3 (7)
Kojto 122:f9eeca106725 2889 * @arg @ref LL_ADC_CHANNEL_4 (7)
Kojto 122:f9eeca106725 2890 * @arg @ref LL_ADC_CHANNEL_5 (7)
Kojto 122:f9eeca106725 2891 * @arg @ref LL_ADC_CHANNEL_6
Kojto 122:f9eeca106725 2892 * @arg @ref LL_ADC_CHANNEL_7
Kojto 122:f9eeca106725 2893 * @arg @ref LL_ADC_CHANNEL_8
Kojto 122:f9eeca106725 2894 * @arg @ref LL_ADC_CHANNEL_9
Kojto 122:f9eeca106725 2895 * @arg @ref LL_ADC_CHANNEL_10
Kojto 122:f9eeca106725 2896 * @arg @ref LL_ADC_CHANNEL_11
Kojto 122:f9eeca106725 2897 * @arg @ref LL_ADC_CHANNEL_12
Kojto 122:f9eeca106725 2898 * @arg @ref LL_ADC_CHANNEL_13
Kojto 122:f9eeca106725 2899 * @arg @ref LL_ADC_CHANNEL_14
Kojto 122:f9eeca106725 2900 * @arg @ref LL_ADC_CHANNEL_15
Kojto 122:f9eeca106725 2901 * @arg @ref LL_ADC_CHANNEL_16
Kojto 122:f9eeca106725 2902 * @arg @ref LL_ADC_CHANNEL_17
Kojto 122:f9eeca106725 2903 * @arg @ref LL_ADC_CHANNEL_18
Kojto 122:f9eeca106725 2904 * @arg @ref LL_ADC_CHANNEL_VREFINT (1)
Kojto 122:f9eeca106725 2905 * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR (4)
Kojto 122:f9eeca106725 2906 * @arg @ref LL_ADC_CHANNEL_VBAT (4)
Kojto 122:f9eeca106725 2907 * @arg @ref LL_ADC_CHANNEL_DAC1CH1 (5)
Kojto 122:f9eeca106725 2908 * @arg @ref LL_ADC_CHANNEL_DAC1CH2 (5)
Kojto 122:f9eeca106725 2909 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)(6)
Kojto 122:f9eeca106725 2910 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)(6)
Kojto 122:f9eeca106725 2911 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC3 (3)(6)
Kojto 122:f9eeca106725 2912 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC3 (3)(6)
Kojto 122:f9eeca106725 2913 *
Kojto 122:f9eeca106725 2914 * (1) On STM32L4, parameter available only on ADC instance: ADC1.\n
Kojto 122:f9eeca106725 2915 * (2) On STM32L4, parameter available only on ADC instance: ADC2.\n
Kojto 122:f9eeca106725 2916 * (3) On STM32L4, parameter available only on ADC instance: ADC3.\n
Kojto 122:f9eeca106725 2917 * (4) On STM32L4, parameter available only on ADC instances: ADC1, ADC3.\n
Kojto 122:f9eeca106725 2918 * (5) On STM32L4, parameter available on devices with only 1 ADC instance.\n
Kojto 122:f9eeca106725 2919 * (6) On STM32L4, parameter available on devices with several ADC instances.\n
Kojto 122:f9eeca106725 2920 * (7) On STM32L4, fast channel (0.188 us for 12-bit resolution (ADC conversion rate up to 5.33 Ms/s)).
Kojto 122:f9eeca106725 2921 * Other channels are slow channels (0.238 us for 12-bit resolution (ADC conversion rate up to 4.21 Ms/s)).\n
Kojto 122:f9eeca106725 2922 * (1, 2, 3, 4) For ADC channel read back from ADC register,
Kojto 122:f9eeca106725 2923 * comparison with internal channel parameter to be done
Kojto 122:f9eeca106725 2924 * using helper macro @ref __LL_ADC_CHANNEL_INTERNAL_TO_EXTERNAL().
Kojto 122:f9eeca106725 2925 */
Kojto 122:f9eeca106725 2926 __STATIC_INLINE uint32_t LL_ADC_GetOffsetChannel(ADC_TypeDef *ADCx, uint32_t Offsety)
Kojto 122:f9eeca106725 2927 {
Kojto 122:f9eeca106725 2928 register uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->OFR1, Offsety);
Kojto 122:f9eeca106725 2929
Kojto 122:f9eeca106725 2930 return (uint32_t) READ_BIT(*preg, ADC_OFR1_OFFSET1_CH);
Kojto 122:f9eeca106725 2931 }
Kojto 122:f9eeca106725 2932
Kojto 122:f9eeca106725 2933 /**
Kojto 122:f9eeca106725 2934 * @brief Get for the ADC selected offset number 1, 2, 3 or 4:
Kojto 122:f9eeca106725 2935 * Offset level (offset to be subtracted from the raw
Kojto 122:f9eeca106725 2936 * converted data).
Kojto 122:f9eeca106725 2937 * @note Caution: Offset format is dependent to ADC resolution:
Kojto 122:f9eeca106725 2938 * offset has to be left-aligned on bit 11, the LSB (right bits)
Kojto 122:f9eeca106725 2939 * are set to 0.
Kojto 122:f9eeca106725 2940 * @rmtoll OFR1 OFFSET1 LL_ADC_GetOffsetLevel\n
Kojto 122:f9eeca106725 2941 * OFR2 OFFSET2 LL_ADC_GetOffsetLevel\n
Kojto 122:f9eeca106725 2942 * OFR3 OFFSET3 LL_ADC_GetOffsetLevel\n
Kojto 122:f9eeca106725 2943 * OFR4 OFFSET4 LL_ADC_GetOffsetLevel
Kojto 122:f9eeca106725 2944 * @param ADCx ADC instance
Kojto 122:f9eeca106725 2945 * @param Offsety This parameter can be one of the following values:
Kojto 122:f9eeca106725 2946 * @arg @ref LL_ADC_OFFSET_1
Kojto 122:f9eeca106725 2947 * @arg @ref LL_ADC_OFFSET_2
Kojto 122:f9eeca106725 2948 * @arg @ref LL_ADC_OFFSET_3
Kojto 122:f9eeca106725 2949 * @arg @ref LL_ADC_OFFSET_4
Kojto 122:f9eeca106725 2950 * @retval Value between Min_Data=0x000 and Max_Data=0xFFF
Kojto 122:f9eeca106725 2951 */
Kojto 122:f9eeca106725 2952 __STATIC_INLINE uint32_t LL_ADC_GetOffsetLevel(ADC_TypeDef *ADCx, uint32_t Offsety)
Kojto 122:f9eeca106725 2953 {
Kojto 122:f9eeca106725 2954 register uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->OFR1, Offsety);
Kojto 122:f9eeca106725 2955
Kojto 122:f9eeca106725 2956 return (uint32_t) READ_BIT(*preg, ADC_OFR1_OFFSET1);
Kojto 122:f9eeca106725 2957 }
Kojto 122:f9eeca106725 2958
Kojto 122:f9eeca106725 2959 /**
Kojto 122:f9eeca106725 2960 * @brief Set for the ADC selected offset number 1, 2, 3 or 4:
Kojto 122:f9eeca106725 2961 * force offset state disable or enable
Kojto 122:f9eeca106725 2962 * without modifying offset channel or offset value.
Kojto 122:f9eeca106725 2963 * @note This function should be needed only in case of offset to be
Kojto 122:f9eeca106725 2964 * enabled-disabled dynamically, and should not be needed in other cases:
Kojto 122:f9eeca106725 2965 * function LL_ADC_SetOffset() automatically enables the offset.
Kojto 122:f9eeca106725 2966 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 2967 * ADC state:
Kojto 122:f9eeca106725 2968 * ADC must be disabled or enabled without conversion on going
Kojto 122:f9eeca106725 2969 * on either groups regular or injected.
Kojto 122:f9eeca106725 2970 * @rmtoll OFR1 OFFSET1_EN LL_ADC_SetOffsetState\n
Kojto 122:f9eeca106725 2971 * OFR2 OFFSET2_EN LL_ADC_SetOffsetState\n
Kojto 122:f9eeca106725 2972 * OFR3 OFFSET3_EN LL_ADC_SetOffsetState\n
Kojto 122:f9eeca106725 2973 * OFR4 OFFSET4_EN LL_ADC_SetOffsetState
Kojto 122:f9eeca106725 2974 * @param ADCx ADC instance
Kojto 122:f9eeca106725 2975 * @param Offsety This parameter can be one of the following values:
Kojto 122:f9eeca106725 2976 * @arg @ref LL_ADC_OFFSET_1
Kojto 122:f9eeca106725 2977 * @arg @ref LL_ADC_OFFSET_2
Kojto 122:f9eeca106725 2978 * @arg @ref LL_ADC_OFFSET_3
Kojto 122:f9eeca106725 2979 * @arg @ref LL_ADC_OFFSET_4
Kojto 122:f9eeca106725 2980 * @param OffsetState This parameter can be one of the following values:
Kojto 122:f9eeca106725 2981 * @arg @ref LL_ADC_OFFSET_DISABLE
Kojto 122:f9eeca106725 2982 * @arg @ref LL_ADC_OFFSET_ENABLE
Kojto 122:f9eeca106725 2983 * @retval None
Kojto 122:f9eeca106725 2984 */
Kojto 122:f9eeca106725 2985 __STATIC_INLINE void LL_ADC_SetOffsetState(ADC_TypeDef *ADCx, uint32_t Offsety, uint32_t OffsetState)
Kojto 122:f9eeca106725 2986 {
Kojto 122:f9eeca106725 2987 register uint32_t *preg = (uint32_t *)((uint32_t)
Kojto 122:f9eeca106725 2988 ((uint32_t)(&ADCx->OFR1) + (Offsety*4U)));
Kojto 122:f9eeca106725 2989
Kojto 122:f9eeca106725 2990 MODIFY_REG(*preg,
Kojto 122:f9eeca106725 2991 ADC_OFR1_OFFSET1_EN,
Kojto 122:f9eeca106725 2992 OffsetState);
Kojto 122:f9eeca106725 2993 }
Kojto 122:f9eeca106725 2994
Kojto 122:f9eeca106725 2995 /**
Kojto 122:f9eeca106725 2996 * @brief Get for the ADC selected offset number 1, 2, 3 or 4:
Kojto 122:f9eeca106725 2997 * offset state disabled or enabled.
Kojto 122:f9eeca106725 2998 * @rmtoll OFR1 OFFSET1_EN LL_ADC_GetOffsetState\n
Kojto 122:f9eeca106725 2999 * OFR2 OFFSET2_EN LL_ADC_GetOffsetState\n
Kojto 122:f9eeca106725 3000 * OFR3 OFFSET3_EN LL_ADC_GetOffsetState\n
Kojto 122:f9eeca106725 3001 * OFR4 OFFSET4_EN LL_ADC_GetOffsetState
Kojto 122:f9eeca106725 3002 * @param ADCx ADC instance
Kojto 122:f9eeca106725 3003 * @param Offsety This parameter can be one of the following values:
Kojto 122:f9eeca106725 3004 * @arg @ref LL_ADC_OFFSET_1
Kojto 122:f9eeca106725 3005 * @arg @ref LL_ADC_OFFSET_2
Kojto 122:f9eeca106725 3006 * @arg @ref LL_ADC_OFFSET_3
Kojto 122:f9eeca106725 3007 * @arg @ref LL_ADC_OFFSET_4
Kojto 122:f9eeca106725 3008 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 3009 * @arg @ref LL_ADC_OFFSET_DISABLE
Kojto 122:f9eeca106725 3010 * @arg @ref LL_ADC_OFFSET_ENABLE
Kojto 122:f9eeca106725 3011 */
Kojto 122:f9eeca106725 3012 __STATIC_INLINE uint32_t LL_ADC_GetOffsetState(ADC_TypeDef *ADCx, uint32_t Offsety)
Kojto 122:f9eeca106725 3013 {
Kojto 122:f9eeca106725 3014 register uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->OFR1, Offsety);
Kojto 122:f9eeca106725 3015
Kojto 122:f9eeca106725 3016 return (uint32_t) READ_BIT(*preg, ADC_OFR1_OFFSET1_EN);
Kojto 122:f9eeca106725 3017 }
Kojto 122:f9eeca106725 3018
AnnaBridge 145:64910690c574 3019 #if defined(ADC_SMPR1_SMPPLUS)
AnnaBridge 145:64910690c574 3020 /**
AnnaBridge 145:64910690c574 3021 * @brief Set ADC sampling time common configuration impacting
AnnaBridge 145:64910690c574 3022 * settings of sampling time channel wise.
AnnaBridge 145:64910690c574 3023 * @note On this STM32 serie, setting of this feature is conditioned to
AnnaBridge 145:64910690c574 3024 * ADC state:
AnnaBridge 145:64910690c574 3025 * ADC must be disabled or enabled without conversion on going
AnnaBridge 145:64910690c574 3026 * on either groups regular or injected.
AnnaBridge 145:64910690c574 3027 * @rmtoll SMPR1 SMPPLUS LL_ADC_SetSamplingTimeCommonConfig
AnnaBridge 145:64910690c574 3028 * @param ADCx ADC instance
AnnaBridge 145:64910690c574 3029 * @param SamplingTimeCommonConfig This parameter can be one of the following values:
AnnaBridge 145:64910690c574 3030 * @arg @ref LL_ADC_SAMPLINGTIME_COMMON_DEFAULT
AnnaBridge 145:64910690c574 3031 * @arg @ref LL_ADC_SAMPLINGTIME_COMMON_3C5_REPL_2C5
AnnaBridge 145:64910690c574 3032 * @retval None
AnnaBridge 145:64910690c574 3033 */
AnnaBridge 145:64910690c574 3034 __STATIC_INLINE void LL_ADC_SetSamplingTimeCommonConfig(ADC_TypeDef *ADCx, uint32_t SamplingTimeCommonConfig)
AnnaBridge 145:64910690c574 3035 {
AnnaBridge 145:64910690c574 3036 MODIFY_REG(ADCx->SMPR1, ADC_SMPR1_SMPPLUS, SamplingTimeCommonConfig);
AnnaBridge 145:64910690c574 3037 }
AnnaBridge 145:64910690c574 3038
AnnaBridge 145:64910690c574 3039 /**
AnnaBridge 145:64910690c574 3040 * @brief Get ADC sampling time common configuration impacting
AnnaBridge 145:64910690c574 3041 * settings of sampling time channel wise.
AnnaBridge 145:64910690c574 3042 * @rmtoll SMPR1 SMPPLUS LL_ADC_GetSamplingTimeCommonConfig
AnnaBridge 145:64910690c574 3043 * @param ADCx ADC instance
AnnaBridge 145:64910690c574 3044 * @retval Returned value can be one of the following values:
AnnaBridge 145:64910690c574 3045 * @arg @ref LL_ADC_SAMPLINGTIME_COMMON_DEFAULT
AnnaBridge 145:64910690c574 3046 * @arg @ref LL_ADC_SAMPLINGTIME_COMMON_3C5_REPL_2C5
AnnaBridge 145:64910690c574 3047 */
AnnaBridge 145:64910690c574 3048 __STATIC_INLINE uint32_t LL_ADC_GetSamplingTimeCommonConfig(ADC_TypeDef *ADCx)
AnnaBridge 145:64910690c574 3049 {
AnnaBridge 145:64910690c574 3050 return (uint32_t)(READ_BIT(ADCx->SMPR1, ADC_SMPR1_SMPPLUS));
AnnaBridge 145:64910690c574 3051 }
AnnaBridge 145:64910690c574 3052 #endif /* ADC_SMPR1_SMPPLUS */
AnnaBridge 145:64910690c574 3053
Kojto 122:f9eeca106725 3054 /**
Kojto 122:f9eeca106725 3055 * @}
Kojto 122:f9eeca106725 3056 */
Kojto 122:f9eeca106725 3057
Kojto 122:f9eeca106725 3058 /** @defgroup ADC_LL_EF_Configuration_ADC_Group_Regular Configuration of ADC hierarchical scope: group regular
Kojto 122:f9eeca106725 3059 * @{
Kojto 122:f9eeca106725 3060 */
Kojto 122:f9eeca106725 3061
Kojto 122:f9eeca106725 3062 /**
Kojto 122:f9eeca106725 3063 * @brief Set ADC group regular conversion trigger source:
Kojto 122:f9eeca106725 3064 * internal (SW start) or from external IP (timer event,
Kojto 122:f9eeca106725 3065 * external interrupt line).
Kojto 122:f9eeca106725 3066 * @note On this STM32 serie, setting trigger source to external trigger
Kojto 122:f9eeca106725 3067 * also set trigger polarity to rising edge
Kojto 122:f9eeca106725 3068 * (default setting for compatibility with some ADC on other
Kojto 122:f9eeca106725 3069 * STM32 families having this setting set by HW default value).
Kojto 122:f9eeca106725 3070 * In case of need to modify trigger edge, use
Kojto 122:f9eeca106725 3071 * function @ref LL_ADC_REG_SetTriggerEdge().
Kojto 122:f9eeca106725 3072 * @note Availability of parameters of trigger sources from timer
Kojto 122:f9eeca106725 3073 * depends on timers availability on the selected device.
Kojto 122:f9eeca106725 3074 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 3075 * ADC state:
Kojto 122:f9eeca106725 3076 * ADC must be disabled or enabled without conversion on going
Kojto 122:f9eeca106725 3077 * on group regular.
Kojto 122:f9eeca106725 3078 * @rmtoll CFGR EXTSEL LL_ADC_REG_SetTriggerSource\n
Kojto 122:f9eeca106725 3079 * CFGR EXTEN LL_ADC_REG_SetTriggerSource
Kojto 122:f9eeca106725 3080 * @param ADCx ADC instance
Kojto 122:f9eeca106725 3081 * @param TriggerSource This parameter can be one of the following values:
Kojto 122:f9eeca106725 3082 * @arg @ref LL_ADC_REG_TRIG_SOFTWARE
Kojto 122:f9eeca106725 3083 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM1_TRGO
Kojto 122:f9eeca106725 3084 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM1_TRGO2
Kojto 122:f9eeca106725 3085 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM1_CH1
Kojto 122:f9eeca106725 3086 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM1_CH2
Kojto 122:f9eeca106725 3087 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM1_CH3
Kojto 122:f9eeca106725 3088 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM2_TRGO
Kojto 122:f9eeca106725 3089 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM2_CH2
Kojto 122:f9eeca106725 3090 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM3_TRGO
Kojto 122:f9eeca106725 3091 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM3_CH4
Kojto 122:f9eeca106725 3092 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM4_TRGO
Kojto 122:f9eeca106725 3093 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM4_CH4
Kojto 122:f9eeca106725 3094 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM6_TRGO
Kojto 122:f9eeca106725 3095 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM8_TRGO
Kojto 122:f9eeca106725 3096 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM8_TRGO2
Kojto 122:f9eeca106725 3097 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM15_TRGO
Kojto 122:f9eeca106725 3098 * @arg @ref LL_ADC_REG_TRIG_EXT_EXTI_LINE11
Kojto 122:f9eeca106725 3099 * @retval None
Kojto 122:f9eeca106725 3100 */
Kojto 122:f9eeca106725 3101 __STATIC_INLINE void LL_ADC_REG_SetTriggerSource(ADC_TypeDef *ADCx, uint32_t TriggerSource)
Kojto 122:f9eeca106725 3102 {
Kojto 122:f9eeca106725 3103 MODIFY_REG(ADCx->CFGR, ADC_CFGR_EXTEN | ADC_CFGR_EXTSEL, TriggerSource);
Kojto 122:f9eeca106725 3104 }
Kojto 122:f9eeca106725 3105
Kojto 122:f9eeca106725 3106 /**
Kojto 122:f9eeca106725 3107 * @brief Get ADC group regular conversion trigger source:
Kojto 122:f9eeca106725 3108 * internal (SW start) or from external IP (timer event,
Kojto 122:f9eeca106725 3109 * external interrupt line).
Kojto 122:f9eeca106725 3110 * @note To determine whether group regular trigger source is
Kojto 122:f9eeca106725 3111 * internal (SW start) or external, without detail
Kojto 122:f9eeca106725 3112 * of which peripheral is selected as external trigger,
Kojto 122:f9eeca106725 3113 * (equivalent to
Kojto 122:f9eeca106725 3114 * "if(LL_ADC_REG_GetTriggerSource(ADC1) == LL_ADC_REG_TRIG_SOFTWARE)")
Kojto 122:f9eeca106725 3115 * use function @ref LL_ADC_REG_IsTriggerSourceSWStart.
Kojto 122:f9eeca106725 3116 * @note Availability of parameters of trigger sources from timer
Kojto 122:f9eeca106725 3117 * depends on timers availability on the selected device.
Kojto 122:f9eeca106725 3118 * @rmtoll CFGR EXTSEL LL_ADC_REG_GetTriggerSource\n
Kojto 122:f9eeca106725 3119 * CFGR EXTEN LL_ADC_REG_GetTriggerSource
Kojto 122:f9eeca106725 3120 * @param ADCx ADC instance
Kojto 122:f9eeca106725 3121 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 3122 * @arg @ref LL_ADC_REG_TRIG_SOFTWARE
Kojto 122:f9eeca106725 3123 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM1_TRGO
Kojto 122:f9eeca106725 3124 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM1_TRGO2
Kojto 122:f9eeca106725 3125 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM1_CH1
Kojto 122:f9eeca106725 3126 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM1_CH2
Kojto 122:f9eeca106725 3127 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM1_CH3
Kojto 122:f9eeca106725 3128 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM2_TRGO
Kojto 122:f9eeca106725 3129 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM2_CH2
Kojto 122:f9eeca106725 3130 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM3_TRGO
Kojto 122:f9eeca106725 3131 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM3_CH4
Kojto 122:f9eeca106725 3132 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM4_TRGO
Kojto 122:f9eeca106725 3133 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM4_CH4
Kojto 122:f9eeca106725 3134 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM6_TRGO
Kojto 122:f9eeca106725 3135 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM8_TRGO
Kojto 122:f9eeca106725 3136 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM8_TRGO2
Kojto 122:f9eeca106725 3137 * @arg @ref LL_ADC_REG_TRIG_EXT_TIM15_TRGO
Kojto 122:f9eeca106725 3138 * @arg @ref LL_ADC_REG_TRIG_EXT_EXTI_LINE11
Kojto 122:f9eeca106725 3139 */
Kojto 122:f9eeca106725 3140 __STATIC_INLINE uint32_t LL_ADC_REG_GetTriggerSource(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 3141 {
Kojto 122:f9eeca106725 3142 register uint32_t TriggerSource = READ_BIT(ADCx->CFGR, ADC_CFGR_EXTSEL | ADC_CFGR_EXTEN);
Kojto 122:f9eeca106725 3143
Kojto 122:f9eeca106725 3144 /* Value for shift of {0; 4; 8; 12} depending on value of bitfield */
Kojto 122:f9eeca106725 3145 /* corresponding to ADC_CFGR_EXTEN {0; 1; 2; 3}. */
Kojto 122:f9eeca106725 3146 register uint32_t ShiftExten = ((TriggerSource & ADC_CFGR_EXTEN) >> (ADC_REG_TRIG_EXTEN_BITOFFSET_POS - 2U));
Kojto 122:f9eeca106725 3147
Kojto 122:f9eeca106725 3148 /* Set bitfield corresponding to ADC_CFGR_EXTEN and ADC_CFGR_EXTSEL */
Kojto 122:f9eeca106725 3149 /* to match with triggers literals definition. */
Kojto 122:f9eeca106725 3150 return ((TriggerSource
Kojto 122:f9eeca106725 3151 & (ADC_REG_TRIG_SOURCE_MASK >> ShiftExten) & ADC_CFGR_EXTSEL)
Kojto 122:f9eeca106725 3152 | ((ADC_REG_TRIG_EDGE_MASK >> ShiftExten) & ADC_CFGR_EXTEN)
Kojto 122:f9eeca106725 3153 );
Kojto 122:f9eeca106725 3154 }
Kojto 122:f9eeca106725 3155
Kojto 122:f9eeca106725 3156 /**
Kojto 122:f9eeca106725 3157 * @brief Get ADC group regular conversion trigger source internal (SW start)
Kojto 122:f9eeca106725 3158 or external.
Kojto 122:f9eeca106725 3159 * @note In case of group regular trigger source set to external trigger,
Kojto 122:f9eeca106725 3160 * to determine which peripheral is selected as external trigger,
Kojto 122:f9eeca106725 3161 * use function @ref LL_ADC_REG_GetTriggerSource().
Kojto 122:f9eeca106725 3162 * @rmtoll CFGR EXTEN LL_ADC_REG_IsTriggerSourceSWStart
Kojto 122:f9eeca106725 3163 * @param ADCx ADC instance
Kojto 122:f9eeca106725 3164 * @retval Value "0" if trigger source external trigger
Kojto 122:f9eeca106725 3165 * Value "1" if trigger source SW start.
Kojto 122:f9eeca106725 3166 */
Kojto 122:f9eeca106725 3167 __STATIC_INLINE uint32_t LL_ADC_REG_IsTriggerSourceSWStart(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 3168 {
Kojto 122:f9eeca106725 3169 return (READ_BIT(ADCx->CFGR, ADC_CFGR_EXTEN) == (LL_ADC_REG_TRIG_SOFTWARE & ADC_CFGR_EXTEN));
Kojto 122:f9eeca106725 3170 }
Kojto 122:f9eeca106725 3171
Kojto 122:f9eeca106725 3172 /**
Kojto 122:f9eeca106725 3173 * @brief Set ADC group regular conversion trigger polarity.
Kojto 122:f9eeca106725 3174 * @note Applicable only for trigger source set to external trigger.
Kojto 122:f9eeca106725 3175 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 3176 * ADC state:
Kojto 122:f9eeca106725 3177 * ADC must be disabled or enabled without conversion on going
Kojto 122:f9eeca106725 3178 * on group regular.
Kojto 122:f9eeca106725 3179 * @rmtoll CFGR EXTEN LL_ADC_REG_SetTriggerEdge
Kojto 122:f9eeca106725 3180 * @param ADCx ADC instance
Kojto 122:f9eeca106725 3181 * @param ExternalTriggerEdge This parameter can be one of the following values:
Kojto 122:f9eeca106725 3182 * @arg @ref LL_ADC_REG_TRIG_EXT_RISING
Kojto 122:f9eeca106725 3183 * @arg @ref LL_ADC_REG_TRIG_EXT_FALLING
Kojto 122:f9eeca106725 3184 * @arg @ref LL_ADC_REG_TRIG_EXT_RISINGFALLING
Kojto 122:f9eeca106725 3185 * @retval None
Kojto 122:f9eeca106725 3186 */
Kojto 122:f9eeca106725 3187 __STATIC_INLINE void LL_ADC_REG_SetTriggerEdge(ADC_TypeDef *ADCx, uint32_t ExternalTriggerEdge)
Kojto 122:f9eeca106725 3188 {
Kojto 122:f9eeca106725 3189 MODIFY_REG(ADCx->CFGR, ADC_CFGR_EXTEN, ExternalTriggerEdge);
Kojto 122:f9eeca106725 3190 }
Kojto 122:f9eeca106725 3191
Kojto 122:f9eeca106725 3192 /**
Kojto 122:f9eeca106725 3193 * @brief Get ADC group regular conversion trigger polarity.
Kojto 122:f9eeca106725 3194 * @note Applicable only for trigger source set to external trigger.
Kojto 122:f9eeca106725 3195 * @rmtoll CFGR EXTEN LL_ADC_REG_GetTriggerEdge
Kojto 122:f9eeca106725 3196 * @param ADCx ADC instance
Kojto 122:f9eeca106725 3197 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 3198 * @arg @ref LL_ADC_REG_TRIG_EXT_RISING
Kojto 122:f9eeca106725 3199 * @arg @ref LL_ADC_REG_TRIG_EXT_FALLING
Kojto 122:f9eeca106725 3200 * @arg @ref LL_ADC_REG_TRIG_EXT_RISINGFALLING
Kojto 122:f9eeca106725 3201 */
Kojto 122:f9eeca106725 3202 __STATIC_INLINE uint32_t LL_ADC_REG_GetTriggerEdge(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 3203 {
Kojto 122:f9eeca106725 3204 return (uint32_t)(READ_BIT(ADCx->CFGR, ADC_CFGR_EXTEN));
Kojto 122:f9eeca106725 3205 }
Kojto 122:f9eeca106725 3206
Kojto 122:f9eeca106725 3207
Kojto 122:f9eeca106725 3208 /**
Kojto 122:f9eeca106725 3209 * @brief Set ADC group regular sequencer length and scan direction.
Kojto 122:f9eeca106725 3210 * @note Description of ADC group regular sequencer features:
Kojto 122:f9eeca106725 3211 * - For devices with sequencer fully configurable
Kojto 122:f9eeca106725 3212 * (function "LL_ADC_REG_SetSequencerRanks()" available):
Kojto 122:f9eeca106725 3213 * sequencer length and each rank affectation to a channel
Kojto 122:f9eeca106725 3214 * are configurable.
Kojto 122:f9eeca106725 3215 * This function performs configuration of:
Kojto 122:f9eeca106725 3216 * - Sequence length: Number of ranks in the scan sequence.
Kojto 122:f9eeca106725 3217 * - Sequence direction: Unless specified in parameters, sequencer
Kojto 122:f9eeca106725 3218 * scan direction is forward (from rank 1 to rank n).
Kojto 122:f9eeca106725 3219 * Sequencer ranks are selected using
Kojto 122:f9eeca106725 3220 * function "LL_ADC_REG_SetSequencerRanks()".
Kojto 122:f9eeca106725 3221 * - For devices with sequencer not fully configurable
Kojto 122:f9eeca106725 3222 * (function "LL_ADC_REG_SetSequencerChannels()" available):
Kojto 122:f9eeca106725 3223 * sequencer length and each rank affectation to a channel
Kojto 122:f9eeca106725 3224 * are defined by channel number.
Kojto 122:f9eeca106725 3225 * This function performs configuration of:
Kojto 122:f9eeca106725 3226 * - Sequence length: Number of ranks in the scan sequence is
Kojto 122:f9eeca106725 3227 * defined by number of channels set in the sequence,
Kojto 122:f9eeca106725 3228 * rank of each channel is fixed by channel HW number.
Kojto 122:f9eeca106725 3229 * (channel 0 fixed on rank 0, channel 1 fixed on rank1, ...).
Kojto 122:f9eeca106725 3230 * - Sequence direction: Unless specified in parameters, sequencer
Kojto 122:f9eeca106725 3231 * scan direction is forward (from lowest channel number to
Kojto 122:f9eeca106725 3232 * highest channel number).
Kojto 122:f9eeca106725 3233 * Sequencer ranks are selected using
Kojto 122:f9eeca106725 3234 * function "LL_ADC_REG_SetSequencerChannels()".
Kojto 122:f9eeca106725 3235 * @note Sequencer disabled is equivalent to sequencer of 1 rank:
Kojto 122:f9eeca106725 3236 * ADC conversion on only 1 channel.
Kojto 122:f9eeca106725 3237 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 3238 * ADC state:
Kojto 122:f9eeca106725 3239 * ADC must be disabled or enabled without conversion on going
Kojto 122:f9eeca106725 3240 * on group regular.
Kojto 122:f9eeca106725 3241 * @rmtoll SQR1 L LL_ADC_REG_SetSequencerLength
Kojto 122:f9eeca106725 3242 * @param ADCx ADC instance
Kojto 122:f9eeca106725 3243 * @param SequencerNbRanks This parameter can be one of the following values:
Kojto 122:f9eeca106725 3244 * @arg @ref LL_ADC_REG_SEQ_SCAN_DISABLE
Kojto 122:f9eeca106725 3245 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_2RANKS
Kojto 122:f9eeca106725 3246 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_3RANKS
Kojto 122:f9eeca106725 3247 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_4RANKS
Kojto 122:f9eeca106725 3248 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_5RANKS
Kojto 122:f9eeca106725 3249 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_6RANKS
Kojto 122:f9eeca106725 3250 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_7RANKS
Kojto 122:f9eeca106725 3251 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_8RANKS
Kojto 122:f9eeca106725 3252 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_9RANKS
Kojto 122:f9eeca106725 3253 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_10RANKS
Kojto 122:f9eeca106725 3254 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_11RANKS
Kojto 122:f9eeca106725 3255 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_12RANKS
Kojto 122:f9eeca106725 3256 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_13RANKS
Kojto 122:f9eeca106725 3257 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_14RANKS
Kojto 122:f9eeca106725 3258 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_15RANKS
Kojto 122:f9eeca106725 3259 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_16RANKS
Kojto 122:f9eeca106725 3260 * @retval None
Kojto 122:f9eeca106725 3261 */
Kojto 122:f9eeca106725 3262 __STATIC_INLINE void LL_ADC_REG_SetSequencerLength(ADC_TypeDef *ADCx, uint32_t SequencerNbRanks)
Kojto 122:f9eeca106725 3263 {
Kojto 122:f9eeca106725 3264 MODIFY_REG(ADCx->SQR1, ADC_SQR1_L, SequencerNbRanks);
Kojto 122:f9eeca106725 3265 }
Kojto 122:f9eeca106725 3266
Kojto 122:f9eeca106725 3267 /**
Kojto 122:f9eeca106725 3268 * @brief Get ADC group regular sequencer length and scan direction.
Kojto 122:f9eeca106725 3269 * @note Description of ADC group regular sequencer features:
Kojto 122:f9eeca106725 3270 * - For devices with sequencer fully configurable
Kojto 122:f9eeca106725 3271 * (function "LL_ADC_REG_SetSequencerRanks()" available):
Kojto 122:f9eeca106725 3272 * sequencer length and each rank affectation to a channel
Kojto 122:f9eeca106725 3273 * are configurable.
Kojto 122:f9eeca106725 3274 * This function retrieves:
Kojto 122:f9eeca106725 3275 * - Sequence length: Number of ranks in the scan sequence.
Kojto 122:f9eeca106725 3276 * - Sequence direction: Unless specified in parameters, sequencer
Kojto 122:f9eeca106725 3277 * scan direction is forward (from rank 1 to rank n).
Kojto 122:f9eeca106725 3278 * Sequencer ranks are selected using
Kojto 122:f9eeca106725 3279 * function "LL_ADC_REG_SetSequencerRanks()".
Kojto 122:f9eeca106725 3280 * - For devices with sequencer not fully configurable
Kojto 122:f9eeca106725 3281 * (function "LL_ADC_REG_SetSequencerChannels()" available):
Kojto 122:f9eeca106725 3282 * sequencer length and each rank affectation to a channel
Kojto 122:f9eeca106725 3283 * are defined by channel number.
Kojto 122:f9eeca106725 3284 * This function retrieves:
Kojto 122:f9eeca106725 3285 * - Sequence length: Number of ranks in the scan sequence is
Kojto 122:f9eeca106725 3286 * defined by number of channels set in the sequence,
Kojto 122:f9eeca106725 3287 * rank of each channel is fixed by channel HW number.
Kojto 122:f9eeca106725 3288 * (channel 0 fixed on rank 0, channel 1 fixed on rank1, ...).
Kojto 122:f9eeca106725 3289 * - Sequence direction: Unless specified in parameters, sequencer
Kojto 122:f9eeca106725 3290 * scan direction is forward (from lowest channel number to
Kojto 122:f9eeca106725 3291 * highest channel number).
Kojto 122:f9eeca106725 3292 * Sequencer ranks are selected using
Kojto 122:f9eeca106725 3293 * function "LL_ADC_REG_SetSequencerChannels()".
Kojto 122:f9eeca106725 3294 * @note Sequencer disabled is equivalent to sequencer of 1 rank:
Kojto 122:f9eeca106725 3295 * ADC conversion on only 1 channel.
Kojto 122:f9eeca106725 3296 * @rmtoll SQR1 L LL_ADC_REG_GetSequencerLength
Kojto 122:f9eeca106725 3297 * @param ADCx ADC instance
Kojto 122:f9eeca106725 3298 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 3299 * @arg @ref LL_ADC_REG_SEQ_SCAN_DISABLE
Kojto 122:f9eeca106725 3300 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_2RANKS
Kojto 122:f9eeca106725 3301 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_3RANKS
Kojto 122:f9eeca106725 3302 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_4RANKS
Kojto 122:f9eeca106725 3303 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_5RANKS
Kojto 122:f9eeca106725 3304 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_6RANKS
Kojto 122:f9eeca106725 3305 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_7RANKS
Kojto 122:f9eeca106725 3306 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_8RANKS
Kojto 122:f9eeca106725 3307 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_9RANKS
Kojto 122:f9eeca106725 3308 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_10RANKS
Kojto 122:f9eeca106725 3309 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_11RANKS
Kojto 122:f9eeca106725 3310 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_12RANKS
Kojto 122:f9eeca106725 3311 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_13RANKS
Kojto 122:f9eeca106725 3312 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_14RANKS
Kojto 122:f9eeca106725 3313 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_15RANKS
Kojto 122:f9eeca106725 3314 * @arg @ref LL_ADC_REG_SEQ_SCAN_ENABLE_16RANKS
Kojto 122:f9eeca106725 3315 */
Kojto 122:f9eeca106725 3316 __STATIC_INLINE uint32_t LL_ADC_REG_GetSequencerLength(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 3317 {
Kojto 122:f9eeca106725 3318 return (uint32_t)(READ_BIT(ADCx->SQR1, ADC_SQR1_L));
Kojto 122:f9eeca106725 3319 }
Kojto 122:f9eeca106725 3320
Kojto 122:f9eeca106725 3321 /**
Kojto 122:f9eeca106725 3322 * @brief Set ADC group regular sequencer discontinuous mode:
Kojto 122:f9eeca106725 3323 * sequence subdivided and scan conversions interrupted every selected
Kojto 122:f9eeca106725 3324 * number of ranks.
Kojto 122:f9eeca106725 3325 * @note It is not possible to enable both ADC group regular
Kojto 122:f9eeca106725 3326 * continuous mode and sequencer discontinuous mode.
Kojto 122:f9eeca106725 3327 * @note It is not possible to enable both ADC auto-injected mode
Kojto 122:f9eeca106725 3328 * and ADC group regular sequencer discontinuous mode.
Kojto 122:f9eeca106725 3329 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 3330 * ADC state:
Kojto 122:f9eeca106725 3331 * ADC must be disabled or enabled without conversion on going
Kojto 122:f9eeca106725 3332 * on group regular.
Kojto 122:f9eeca106725 3333 * @rmtoll CFGR DISCEN LL_ADC_REG_SetSequencerDiscont\n
Kojto 122:f9eeca106725 3334 * CFGR DISCNUM LL_ADC_REG_SetSequencerDiscont
Kojto 122:f9eeca106725 3335 * @param ADCx ADC instance
Kojto 122:f9eeca106725 3336 * @param SeqDiscont This parameter can be one of the following values:
Kojto 122:f9eeca106725 3337 * @arg @ref LL_ADC_REG_SEQ_DISCONT_DISABLE
Kojto 122:f9eeca106725 3338 * @arg @ref LL_ADC_REG_SEQ_DISCONT_1RANK
Kojto 122:f9eeca106725 3339 * @arg @ref LL_ADC_REG_SEQ_DISCONT_2RANKS
Kojto 122:f9eeca106725 3340 * @arg @ref LL_ADC_REG_SEQ_DISCONT_3RANKS
Kojto 122:f9eeca106725 3341 * @arg @ref LL_ADC_REG_SEQ_DISCONT_4RANKS
Kojto 122:f9eeca106725 3342 * @arg @ref LL_ADC_REG_SEQ_DISCONT_5RANKS
Kojto 122:f9eeca106725 3343 * @arg @ref LL_ADC_REG_SEQ_DISCONT_6RANKS
Kojto 122:f9eeca106725 3344 * @arg @ref LL_ADC_REG_SEQ_DISCONT_7RANKS
Kojto 122:f9eeca106725 3345 * @arg @ref LL_ADC_REG_SEQ_DISCONT_8RANKS
Kojto 122:f9eeca106725 3346 * @retval None
Kojto 122:f9eeca106725 3347 */
Kojto 122:f9eeca106725 3348 __STATIC_INLINE void LL_ADC_REG_SetSequencerDiscont(ADC_TypeDef *ADCx, uint32_t SeqDiscont)
Kojto 122:f9eeca106725 3349 {
Kojto 122:f9eeca106725 3350 MODIFY_REG(ADCx->CFGR, ADC_CFGR_DISCEN | ADC_CFGR_DISCNUM, SeqDiscont);
Kojto 122:f9eeca106725 3351 }
Kojto 122:f9eeca106725 3352
Kojto 122:f9eeca106725 3353 /**
Kojto 122:f9eeca106725 3354 * @brief Get ADC group regular sequencer discontinuous mode:
Kojto 122:f9eeca106725 3355 * sequence subdivided and scan conversions interrupted every selected
Kojto 122:f9eeca106725 3356 * number of ranks.
Kojto 122:f9eeca106725 3357 * @rmtoll CFGR DISCEN LL_ADC_REG_GetSequencerDiscont\n
Kojto 122:f9eeca106725 3358 * CFGR DISCNUM LL_ADC_REG_GetSequencerDiscont
Kojto 122:f9eeca106725 3359 * @param ADCx ADC instance
Kojto 122:f9eeca106725 3360 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 3361 * @arg @ref LL_ADC_REG_SEQ_DISCONT_DISABLE
Kojto 122:f9eeca106725 3362 * @arg @ref LL_ADC_REG_SEQ_DISCONT_1RANK
Kojto 122:f9eeca106725 3363 * @arg @ref LL_ADC_REG_SEQ_DISCONT_2RANKS
Kojto 122:f9eeca106725 3364 * @arg @ref LL_ADC_REG_SEQ_DISCONT_3RANKS
Kojto 122:f9eeca106725 3365 * @arg @ref LL_ADC_REG_SEQ_DISCONT_4RANKS
Kojto 122:f9eeca106725 3366 * @arg @ref LL_ADC_REG_SEQ_DISCONT_5RANKS
Kojto 122:f9eeca106725 3367 * @arg @ref LL_ADC_REG_SEQ_DISCONT_6RANKS
Kojto 122:f9eeca106725 3368 * @arg @ref LL_ADC_REG_SEQ_DISCONT_7RANKS
Kojto 122:f9eeca106725 3369 * @arg @ref LL_ADC_REG_SEQ_DISCONT_8RANKS
Kojto 122:f9eeca106725 3370 */
Kojto 122:f9eeca106725 3371 __STATIC_INLINE uint32_t LL_ADC_REG_GetSequencerDiscont(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 3372 {
Kojto 122:f9eeca106725 3373 return (uint32_t)(READ_BIT(ADCx->CFGR, ADC_CFGR_DISCEN | ADC_CFGR_DISCNUM));
Kojto 122:f9eeca106725 3374 }
Kojto 122:f9eeca106725 3375
Kojto 122:f9eeca106725 3376 /**
Kojto 122:f9eeca106725 3377 * @brief Set ADC group regular sequence: channel on the selected
Kojto 122:f9eeca106725 3378 * scan sequence rank.
Kojto 122:f9eeca106725 3379 * @note This function performs configuration of:
Kojto 122:f9eeca106725 3380 * - Channels ordering into each rank of scan sequence:
Kojto 122:f9eeca106725 3381 * whatever channel can be placed into whatever rank.
Kojto 122:f9eeca106725 3382 * @note On this STM32 serie, ADC group regular sequencer is
Kojto 122:f9eeca106725 3383 * fully configurable: sequencer length and each rank
Kojto 122:f9eeca106725 3384 * affectation to a channel are configurable.
Kojto 122:f9eeca106725 3385 * Refer to description of function @ref LL_ADC_REG_SetSequencerLength().
Kojto 122:f9eeca106725 3386 * @note Depending on devices and packages, some channels may not be available.
Kojto 122:f9eeca106725 3387 * Refer to device datasheet for channels availability.
Kojto 122:f9eeca106725 3388 * @note On this STM32 serie, to measure internal channels (VrefInt,
Kojto 122:f9eeca106725 3389 * TempSensor, ...), measurement paths to internal channels must be
Kojto 122:f9eeca106725 3390 * enabled separately.
Kojto 122:f9eeca106725 3391 * This can be done using function @ref LL_ADC_SetCommonPathInternalCh().
Kojto 122:f9eeca106725 3392 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 3393 * ADC state:
Kojto 122:f9eeca106725 3394 * ADC must be disabled or enabled without conversion on going
Kojto 122:f9eeca106725 3395 * on group regular.
Kojto 122:f9eeca106725 3396 * @rmtoll SQR1 SQ1 LL_ADC_REG_SetSequencerRanks\n
Kojto 122:f9eeca106725 3397 * SQR1 SQ2 LL_ADC_REG_SetSequencerRanks\n
Kojto 122:f9eeca106725 3398 * SQR1 SQ3 LL_ADC_REG_SetSequencerRanks\n
Kojto 122:f9eeca106725 3399 * SQR1 SQ4 LL_ADC_REG_SetSequencerRanks\n
Kojto 122:f9eeca106725 3400 * SQR2 SQ5 LL_ADC_REG_SetSequencerRanks\n
Kojto 122:f9eeca106725 3401 * SQR2 SQ6 LL_ADC_REG_SetSequencerRanks\n
Kojto 122:f9eeca106725 3402 * SQR2 SQ7 LL_ADC_REG_SetSequencerRanks\n
Kojto 122:f9eeca106725 3403 * SQR2 SQ8 LL_ADC_REG_SetSequencerRanks\n
Kojto 122:f9eeca106725 3404 * SQR2 SQ9 LL_ADC_REG_SetSequencerRanks\n
Kojto 122:f9eeca106725 3405 * SQR3 SQ10 LL_ADC_REG_SetSequencerRanks\n
Kojto 122:f9eeca106725 3406 * SQR3 SQ11 LL_ADC_REG_SetSequencerRanks\n
Kojto 122:f9eeca106725 3407 * SQR3 SQ12 LL_ADC_REG_SetSequencerRanks\n
Kojto 122:f9eeca106725 3408 * SQR3 SQ13 LL_ADC_REG_SetSequencerRanks\n
Kojto 122:f9eeca106725 3409 * SQR3 SQ14 LL_ADC_REG_SetSequencerRanks\n
Kojto 122:f9eeca106725 3410 * SQR4 SQ15 LL_ADC_REG_SetSequencerRanks\n
Kojto 122:f9eeca106725 3411 * SQR4 SQ16 LL_ADC_REG_SetSequencerRanks
Kojto 122:f9eeca106725 3412 * @param ADCx ADC instance
Kojto 122:f9eeca106725 3413 * @param Rank This parameter can be one of the following values:
Kojto 122:f9eeca106725 3414 * @arg @ref LL_ADC_REG_RANK_1
Kojto 122:f9eeca106725 3415 * @arg @ref LL_ADC_REG_RANK_2
Kojto 122:f9eeca106725 3416 * @arg @ref LL_ADC_REG_RANK_3
Kojto 122:f9eeca106725 3417 * @arg @ref LL_ADC_REG_RANK_4
Kojto 122:f9eeca106725 3418 * @arg @ref LL_ADC_REG_RANK_5
Kojto 122:f9eeca106725 3419 * @arg @ref LL_ADC_REG_RANK_6
Kojto 122:f9eeca106725 3420 * @arg @ref LL_ADC_REG_RANK_7
Kojto 122:f9eeca106725 3421 * @arg @ref LL_ADC_REG_RANK_8
Kojto 122:f9eeca106725 3422 * @arg @ref LL_ADC_REG_RANK_9
Kojto 122:f9eeca106725 3423 * @arg @ref LL_ADC_REG_RANK_10
Kojto 122:f9eeca106725 3424 * @arg @ref LL_ADC_REG_RANK_11
Kojto 122:f9eeca106725 3425 * @arg @ref LL_ADC_REG_RANK_12
Kojto 122:f9eeca106725 3426 * @arg @ref LL_ADC_REG_RANK_13
Kojto 122:f9eeca106725 3427 * @arg @ref LL_ADC_REG_RANK_14
Kojto 122:f9eeca106725 3428 * @arg @ref LL_ADC_REG_RANK_15
Kojto 122:f9eeca106725 3429 * @arg @ref LL_ADC_REG_RANK_16
Kojto 122:f9eeca106725 3430 * @param Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 3431 * @arg @ref LL_ADC_CHANNEL_0
Kojto 122:f9eeca106725 3432 * @arg @ref LL_ADC_CHANNEL_1 (7)
Kojto 122:f9eeca106725 3433 * @arg @ref LL_ADC_CHANNEL_2 (7)
Kojto 122:f9eeca106725 3434 * @arg @ref LL_ADC_CHANNEL_3 (7)
Kojto 122:f9eeca106725 3435 * @arg @ref LL_ADC_CHANNEL_4 (7)
Kojto 122:f9eeca106725 3436 * @arg @ref LL_ADC_CHANNEL_5 (7)
Kojto 122:f9eeca106725 3437 * @arg @ref LL_ADC_CHANNEL_6
Kojto 122:f9eeca106725 3438 * @arg @ref LL_ADC_CHANNEL_7
Kojto 122:f9eeca106725 3439 * @arg @ref LL_ADC_CHANNEL_8
Kojto 122:f9eeca106725 3440 * @arg @ref LL_ADC_CHANNEL_9
Kojto 122:f9eeca106725 3441 * @arg @ref LL_ADC_CHANNEL_10
Kojto 122:f9eeca106725 3442 * @arg @ref LL_ADC_CHANNEL_11
Kojto 122:f9eeca106725 3443 * @arg @ref LL_ADC_CHANNEL_12
Kojto 122:f9eeca106725 3444 * @arg @ref LL_ADC_CHANNEL_13
Kojto 122:f9eeca106725 3445 * @arg @ref LL_ADC_CHANNEL_14
Kojto 122:f9eeca106725 3446 * @arg @ref LL_ADC_CHANNEL_15
Kojto 122:f9eeca106725 3447 * @arg @ref LL_ADC_CHANNEL_16
Kojto 122:f9eeca106725 3448 * @arg @ref LL_ADC_CHANNEL_17
Kojto 122:f9eeca106725 3449 * @arg @ref LL_ADC_CHANNEL_18
Kojto 122:f9eeca106725 3450 * @arg @ref LL_ADC_CHANNEL_VREFINT (1)
Kojto 122:f9eeca106725 3451 * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR (4)
Kojto 122:f9eeca106725 3452 * @arg @ref LL_ADC_CHANNEL_VBAT (4)
Kojto 122:f9eeca106725 3453 * @arg @ref LL_ADC_CHANNEL_DAC1CH1 (5)
Kojto 122:f9eeca106725 3454 * @arg @ref LL_ADC_CHANNEL_DAC1CH2 (5)
Kojto 122:f9eeca106725 3455 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)(6)
Kojto 122:f9eeca106725 3456 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)(6)
Kojto 122:f9eeca106725 3457 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC3 (3)(6)
Kojto 122:f9eeca106725 3458 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC3 (3)(6)
Kojto 122:f9eeca106725 3459 *
Kojto 122:f9eeca106725 3460 * (1) On STM32L4, parameter available only on ADC instance: ADC1.\n
Kojto 122:f9eeca106725 3461 * (2) On STM32L4, parameter available only on ADC instance: ADC2.\n
Kojto 122:f9eeca106725 3462 * (3) On STM32L4, parameter available only on ADC instance: ADC3.\n
Kojto 122:f9eeca106725 3463 * (4) On STM32L4, parameter available only on ADC instances: ADC1, ADC3.\n
Kojto 122:f9eeca106725 3464 * (5) On STM32L4, parameter available on devices with only 1 ADC instance.\n
Kojto 122:f9eeca106725 3465 * (6) On STM32L4, parameter available on devices with several ADC instances.\n
Kojto 122:f9eeca106725 3466 * (7) On STM32L4, fast channel (0.188 us for 12-bit resolution (ADC conversion rate up to 5.33 Ms/s)).
Kojto 122:f9eeca106725 3467 * Other channels are slow channels (0.238 us for 12-bit resolution (ADC conversion rate up to 4.21 Ms/s)).
Kojto 122:f9eeca106725 3468 * @retval None
Kojto 122:f9eeca106725 3469 */
Kojto 122:f9eeca106725 3470 __STATIC_INLINE void LL_ADC_REG_SetSequencerRanks(ADC_TypeDef *ADCx, uint32_t Rank, uint32_t Channel)
Kojto 122:f9eeca106725 3471 {
Kojto 122:f9eeca106725 3472 /* Set bits with content of parameter "Channel" with bits position */
Kojto 122:f9eeca106725 3473 /* in register and register position depending on parameter "Rank". */
Kojto 122:f9eeca106725 3474 /* Parameters "Rank" and "Channel" are used with masks because containing */
Kojto 122:f9eeca106725 3475 /* other bits reserved for other purpose. */
Kojto 122:f9eeca106725 3476 register uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->SQR1, __ADC_MASK_SHIFT(Rank, ADC_REG_SQRX_REGOFFSET_MASK));
Kojto 122:f9eeca106725 3477
Kojto 122:f9eeca106725 3478 MODIFY_REG(*preg,
Kojto 122:f9eeca106725 3479 ADC_CHANNEL_ID_NUMBER_MASK_POSBIT0 << (Rank & ADC_REG_RANK_ID_SQRX_MASK),
Kojto 122:f9eeca106725 3480 (Channel & ADC_CHANNEL_ID_NUMBER_MASK) >> (ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS - (Rank & ADC_REG_RANK_ID_SQRX_MASK)));
Kojto 122:f9eeca106725 3481 }
Kojto 122:f9eeca106725 3482
Kojto 122:f9eeca106725 3483 /**
Kojto 122:f9eeca106725 3484 * @brief Get ADC group regular sequence: channel on the selected
Kojto 122:f9eeca106725 3485 * scan sequence rank.
Kojto 122:f9eeca106725 3486 * @note On this STM32 serie, ADC group regular sequencer is
Kojto 122:f9eeca106725 3487 * fully configurable: sequencer length and each rank
Kojto 122:f9eeca106725 3488 * affectation to a channel are configurable.
Kojto 122:f9eeca106725 3489 * Refer to description of function @ref LL_ADC_REG_SetSequencerLength().
Kojto 122:f9eeca106725 3490 * @note Depending on devices and packages, some channels may not be available.
Kojto 122:f9eeca106725 3491 * Refer to device datasheet for channels availability.
Kojto 122:f9eeca106725 3492 * @note Usage of the returned channel number:
Kojto 122:f9eeca106725 3493 * - To reinject this channel into another function LL_ADC_xxx:
Kojto 122:f9eeca106725 3494 * the returned channel number is only partly formatted on definition
Kojto 122:f9eeca106725 3495 * of literals LL_ADC_CHANNEL_x. Therefore, it has to be compared
Kojto 122:f9eeca106725 3496 * with parts of literals LL_ADC_CHANNEL_x or using
Kojto 122:f9eeca106725 3497 * helper macro @ref __LL_ADC_CHANNEL_TO_DECIMAL_NB().
Kojto 122:f9eeca106725 3498 * Then the selected literal LL_ADC_CHANNEL_x can be used
Kojto 122:f9eeca106725 3499 * as parameter for another function.
Kojto 122:f9eeca106725 3500 * - To get the channel number in decimal format:
Kojto 122:f9eeca106725 3501 * process the returned value with the helper macro
Kojto 122:f9eeca106725 3502 * @ref __LL_ADC_CHANNEL_TO_DECIMAL_NB().
Kojto 122:f9eeca106725 3503 * @rmtoll SQR1 SQ1 LL_ADC_REG_GetSequencerRanks\n
Kojto 122:f9eeca106725 3504 * SQR1 SQ2 LL_ADC_REG_GetSequencerRanks\n
Kojto 122:f9eeca106725 3505 * SQR1 SQ3 LL_ADC_REG_GetSequencerRanks\n
Kojto 122:f9eeca106725 3506 * SQR1 SQ4 LL_ADC_REG_GetSequencerRanks\n
Kojto 122:f9eeca106725 3507 * SQR2 SQ5 LL_ADC_REG_GetSequencerRanks\n
Kojto 122:f9eeca106725 3508 * SQR2 SQ6 LL_ADC_REG_GetSequencerRanks\n
Kojto 122:f9eeca106725 3509 * SQR2 SQ7 LL_ADC_REG_GetSequencerRanks\n
Kojto 122:f9eeca106725 3510 * SQR2 SQ8 LL_ADC_REG_GetSequencerRanks\n
Kojto 122:f9eeca106725 3511 * SQR2 SQ9 LL_ADC_REG_GetSequencerRanks\n
Kojto 122:f9eeca106725 3512 * SQR3 SQ10 LL_ADC_REG_GetSequencerRanks\n
Kojto 122:f9eeca106725 3513 * SQR3 SQ11 LL_ADC_REG_GetSequencerRanks\n
Kojto 122:f9eeca106725 3514 * SQR3 SQ12 LL_ADC_REG_GetSequencerRanks\n
Kojto 122:f9eeca106725 3515 * SQR3 SQ13 LL_ADC_REG_GetSequencerRanks\n
Kojto 122:f9eeca106725 3516 * SQR3 SQ14 LL_ADC_REG_GetSequencerRanks\n
Kojto 122:f9eeca106725 3517 * SQR4 SQ15 LL_ADC_REG_GetSequencerRanks\n
Kojto 122:f9eeca106725 3518 * SQR4 SQ16 LL_ADC_REG_GetSequencerRanks
Kojto 122:f9eeca106725 3519 * @param ADCx ADC instance
Kojto 122:f9eeca106725 3520 * @param Rank This parameter can be one of the following values:
Kojto 122:f9eeca106725 3521 * @arg @ref LL_ADC_REG_RANK_1
Kojto 122:f9eeca106725 3522 * @arg @ref LL_ADC_REG_RANK_2
Kojto 122:f9eeca106725 3523 * @arg @ref LL_ADC_REG_RANK_3
Kojto 122:f9eeca106725 3524 * @arg @ref LL_ADC_REG_RANK_4
Kojto 122:f9eeca106725 3525 * @arg @ref LL_ADC_REG_RANK_5
Kojto 122:f9eeca106725 3526 * @arg @ref LL_ADC_REG_RANK_6
Kojto 122:f9eeca106725 3527 * @arg @ref LL_ADC_REG_RANK_7
Kojto 122:f9eeca106725 3528 * @arg @ref LL_ADC_REG_RANK_8
Kojto 122:f9eeca106725 3529 * @arg @ref LL_ADC_REG_RANK_9
Kojto 122:f9eeca106725 3530 * @arg @ref LL_ADC_REG_RANK_10
Kojto 122:f9eeca106725 3531 * @arg @ref LL_ADC_REG_RANK_11
Kojto 122:f9eeca106725 3532 * @arg @ref LL_ADC_REG_RANK_12
Kojto 122:f9eeca106725 3533 * @arg @ref LL_ADC_REG_RANK_13
Kojto 122:f9eeca106725 3534 * @arg @ref LL_ADC_REG_RANK_14
Kojto 122:f9eeca106725 3535 * @arg @ref LL_ADC_REG_RANK_15
Kojto 122:f9eeca106725 3536 * @arg @ref LL_ADC_REG_RANK_16
Kojto 122:f9eeca106725 3537 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 3538 * @arg @ref LL_ADC_CHANNEL_0
Kojto 122:f9eeca106725 3539 * @arg @ref LL_ADC_CHANNEL_1 (7)
Kojto 122:f9eeca106725 3540 * @arg @ref LL_ADC_CHANNEL_2 (7)
Kojto 122:f9eeca106725 3541 * @arg @ref LL_ADC_CHANNEL_3 (7)
Kojto 122:f9eeca106725 3542 * @arg @ref LL_ADC_CHANNEL_4 (7)
Kojto 122:f9eeca106725 3543 * @arg @ref LL_ADC_CHANNEL_5 (7)
Kojto 122:f9eeca106725 3544 * @arg @ref LL_ADC_CHANNEL_6
Kojto 122:f9eeca106725 3545 * @arg @ref LL_ADC_CHANNEL_7
Kojto 122:f9eeca106725 3546 * @arg @ref LL_ADC_CHANNEL_8
Kojto 122:f9eeca106725 3547 * @arg @ref LL_ADC_CHANNEL_9
Kojto 122:f9eeca106725 3548 * @arg @ref LL_ADC_CHANNEL_10
Kojto 122:f9eeca106725 3549 * @arg @ref LL_ADC_CHANNEL_11
Kojto 122:f9eeca106725 3550 * @arg @ref LL_ADC_CHANNEL_12
Kojto 122:f9eeca106725 3551 * @arg @ref LL_ADC_CHANNEL_13
Kojto 122:f9eeca106725 3552 * @arg @ref LL_ADC_CHANNEL_14
Kojto 122:f9eeca106725 3553 * @arg @ref LL_ADC_CHANNEL_15
Kojto 122:f9eeca106725 3554 * @arg @ref LL_ADC_CHANNEL_16
Kojto 122:f9eeca106725 3555 * @arg @ref LL_ADC_CHANNEL_17
Kojto 122:f9eeca106725 3556 * @arg @ref LL_ADC_CHANNEL_18
Kojto 122:f9eeca106725 3557 * @arg @ref LL_ADC_CHANNEL_VREFINT (1)
Kojto 122:f9eeca106725 3558 * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR (4)
Kojto 122:f9eeca106725 3559 * @arg @ref LL_ADC_CHANNEL_VBAT (4)
Kojto 122:f9eeca106725 3560 * @arg @ref LL_ADC_CHANNEL_DAC1CH1 (5)
Kojto 122:f9eeca106725 3561 * @arg @ref LL_ADC_CHANNEL_DAC1CH2 (5)
Kojto 122:f9eeca106725 3562 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)(6)
Kojto 122:f9eeca106725 3563 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)(6)
Kojto 122:f9eeca106725 3564 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC3 (3)(6)
Kojto 122:f9eeca106725 3565 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC3 (3)(6)
Kojto 122:f9eeca106725 3566 *
Kojto 122:f9eeca106725 3567 * (1) On STM32L4, parameter available only on ADC instance: ADC1.\n
Kojto 122:f9eeca106725 3568 * (2) On STM32L4, parameter available only on ADC instance: ADC2.\n
Kojto 122:f9eeca106725 3569 * (3) On STM32L4, parameter available only on ADC instance: ADC3.\n
Kojto 122:f9eeca106725 3570 * (4) On STM32L4, parameter available only on ADC instances: ADC1, ADC3.\n
Kojto 122:f9eeca106725 3571 * (5) On STM32L4, parameter available on devices with only 1 ADC instance.\n
Kojto 122:f9eeca106725 3572 * (6) On STM32L4, parameter available on devices with several ADC instances.\n
Kojto 122:f9eeca106725 3573 * (7) On STM32L4, fast channel (0.188 us for 12-bit resolution (ADC conversion rate up to 5.33 Ms/s)).
Kojto 122:f9eeca106725 3574 * Other channels are slow channels (0.238 us for 12-bit resolution (ADC conversion rate up to 4.21 Ms/s)).\n
Kojto 122:f9eeca106725 3575 * (1, 2, 3, 4) For ADC channel read back from ADC register,
Kojto 122:f9eeca106725 3576 * comparison with internal channel parameter to be done
Kojto 122:f9eeca106725 3577 * using helper macro @ref __LL_ADC_CHANNEL_INTERNAL_TO_EXTERNAL().
Kojto 122:f9eeca106725 3578 */
Kojto 122:f9eeca106725 3579 __STATIC_INLINE uint32_t LL_ADC_REG_GetSequencerRanks(ADC_TypeDef *ADCx, uint32_t Rank)
Kojto 122:f9eeca106725 3580 {
Kojto 122:f9eeca106725 3581 register uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->SQR1, __ADC_MASK_SHIFT(Rank, ADC_REG_SQRX_REGOFFSET_MASK));
Kojto 122:f9eeca106725 3582
Kojto 122:f9eeca106725 3583 return (uint32_t) (READ_BIT(*preg,
Kojto 122:f9eeca106725 3584 ADC_CHANNEL_ID_NUMBER_MASK_POSBIT0 << (Rank & ADC_REG_RANK_ID_SQRX_MASK))
Kojto 122:f9eeca106725 3585 << (ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS - (Rank & ADC_REG_RANK_ID_SQRX_MASK))
Kojto 122:f9eeca106725 3586 );
Kojto 122:f9eeca106725 3587 }
Kojto 122:f9eeca106725 3588
Kojto 122:f9eeca106725 3589 /**
Kojto 122:f9eeca106725 3590 * @brief Set ADC continuous conversion mode on ADC group regular.
Kojto 122:f9eeca106725 3591 * @note Description of ADC continuous conversion mode:
Kojto 122:f9eeca106725 3592 * - single mode: one conversion per trigger
Kojto 122:f9eeca106725 3593 * - continuous mode: after the first trigger, following
Kojto 122:f9eeca106725 3594 * conversions launched successively automatically.
Kojto 122:f9eeca106725 3595 * @note It is not possible to enable both ADC group regular
Kojto 122:f9eeca106725 3596 * continuous mode and sequencer discontinuous mode.
Kojto 122:f9eeca106725 3597 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 3598 * ADC state:
Kojto 122:f9eeca106725 3599 * ADC must be disabled or enabled without conversion on going
Kojto 122:f9eeca106725 3600 * on group regular.
Kojto 122:f9eeca106725 3601 * @rmtoll CFGR CONT LL_ADC_REG_SetContinuousMode
Kojto 122:f9eeca106725 3602 * @param ADCx ADC instance
Kojto 122:f9eeca106725 3603 * @param Continuous This parameter can be one of the following values:
Kojto 122:f9eeca106725 3604 * @arg @ref LL_ADC_REG_CONV_SINGLE
Kojto 122:f9eeca106725 3605 * @arg @ref LL_ADC_REG_CONV_CONTINUOUS
Kojto 122:f9eeca106725 3606 * @retval None
Kojto 122:f9eeca106725 3607 */
Kojto 122:f9eeca106725 3608 __STATIC_INLINE void LL_ADC_REG_SetContinuousMode(ADC_TypeDef *ADCx, uint32_t Continuous)
Kojto 122:f9eeca106725 3609 {
Kojto 122:f9eeca106725 3610 MODIFY_REG(ADCx->CFGR, ADC_CFGR_CONT, Continuous);
Kojto 122:f9eeca106725 3611 }
Kojto 122:f9eeca106725 3612
Kojto 122:f9eeca106725 3613 /**
Kojto 122:f9eeca106725 3614 * @brief Get ADC continuous conversion mode on ADC group regular.
Kojto 122:f9eeca106725 3615 * @note Description of ADC continuous conversion mode:
Kojto 122:f9eeca106725 3616 * - single mode: one conversion per trigger
Kojto 122:f9eeca106725 3617 * - continuous mode: after the first trigger, following
Kojto 122:f9eeca106725 3618 * conversions launched successively automatically.
Kojto 122:f9eeca106725 3619 * @rmtoll CFGR CONT LL_ADC_REG_GetContinuousMode
Kojto 122:f9eeca106725 3620 * @param ADCx ADC instance
Kojto 122:f9eeca106725 3621 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 3622 * @arg @ref LL_ADC_REG_CONV_SINGLE
Kojto 122:f9eeca106725 3623 * @arg @ref LL_ADC_REG_CONV_CONTINUOUS
Kojto 122:f9eeca106725 3624 */
Kojto 122:f9eeca106725 3625 __STATIC_INLINE uint32_t LL_ADC_REG_GetContinuousMode(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 3626 {
Kojto 122:f9eeca106725 3627 return (uint32_t)(READ_BIT(ADCx->CFGR, ADC_CFGR_CONT));
Kojto 122:f9eeca106725 3628 }
Kojto 122:f9eeca106725 3629
Kojto 122:f9eeca106725 3630 /**
Kojto 122:f9eeca106725 3631 * @brief Set ADC group regular conversion data transfer: no transfer or
Kojto 122:f9eeca106725 3632 * transfer by DMA, and DMA requests mode.
Kojto 122:f9eeca106725 3633 * @note If transfer by DMA selected, specifies the DMA requests
Kojto 122:f9eeca106725 3634 * mode:
Kojto 122:f9eeca106725 3635 * - Limited mode (One shot mode): DMA transfer requests are stopped
Kojto 122:f9eeca106725 3636 * when number of DMA data transfers (number of
Kojto 122:f9eeca106725 3637 * ADC conversions) is reached.
Kojto 122:f9eeca106725 3638 * This ADC mode is intended to be used with DMA mode non-circular.
Kojto 122:f9eeca106725 3639 * - Unlimited mode: DMA transfer requests are unlimited,
Kojto 122:f9eeca106725 3640 * whatever number of DMA data transfers (number of
Kojto 122:f9eeca106725 3641 * ADC conversions).
Kojto 122:f9eeca106725 3642 * This ADC mode is intended to be used with DMA mode circular.
Kojto 122:f9eeca106725 3643 * @note If ADC DMA requests mode is set to unlimited and DMA is set to
Kojto 122:f9eeca106725 3644 * mode non-circular:
Kojto 122:f9eeca106725 3645 * when DMA transfers size will be reached, DMA will stop transfers of
Kojto 122:f9eeca106725 3646 * ADC conversions data ADC will raise an overrun error
Kojto 122:f9eeca106725 3647 * (overrun flag and interruption if enabled).
Kojto 122:f9eeca106725 3648 * @note For devices with several ADC instances: ADC multimode DMA
Kojto 122:f9eeca106725 3649 * settings are available using function @ref LL_ADC_SetMultiDMATransfer().
Kojto 122:f9eeca106725 3650 * @note To configure DMA source address (peripheral address),
Kojto 122:f9eeca106725 3651 * use function @ref LL_ADC_DMA_GetRegAddr().
Kojto 122:f9eeca106725 3652 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 3653 * ADC state:
Kojto 122:f9eeca106725 3654 * ADC must be disabled or enabled without conversion on going
Kojto 122:f9eeca106725 3655 * on either groups regular or injected.
Kojto 122:f9eeca106725 3656 * @rmtoll CFGR DMAEN LL_ADC_REG_SetDMATransfer\n
Kojto 122:f9eeca106725 3657 * CFGR DMACFG LL_ADC_REG_SetDMATransfer
Kojto 122:f9eeca106725 3658 * @param ADCx ADC instance
Kojto 122:f9eeca106725 3659 * @param DMATransfer This parameter can be one of the following values:
Kojto 122:f9eeca106725 3660 * @arg @ref LL_ADC_REG_DMA_TRANSFER_NONE
Kojto 122:f9eeca106725 3661 * @arg @ref LL_ADC_REG_DMA_TRANSFER_LIMITED
Kojto 122:f9eeca106725 3662 * @arg @ref LL_ADC_REG_DMA_TRANSFER_UNLIMITED
Kojto 122:f9eeca106725 3663 * @retval None
Kojto 122:f9eeca106725 3664 */
Kojto 122:f9eeca106725 3665 __STATIC_INLINE void LL_ADC_REG_SetDMATransfer(ADC_TypeDef *ADCx, uint32_t DMATransfer)
Kojto 122:f9eeca106725 3666 {
Kojto 122:f9eeca106725 3667 MODIFY_REG(ADCx->CFGR, ADC_CFGR_DMAEN | ADC_CFGR_DMACFG, DMATransfer);
Kojto 122:f9eeca106725 3668 }
Kojto 122:f9eeca106725 3669
Kojto 122:f9eeca106725 3670 /**
Kojto 122:f9eeca106725 3671 * @brief Get ADC group regular conversion data transfer: no transfer or
Kojto 122:f9eeca106725 3672 * transfer by DMA, and DMA requests mode.
Kojto 122:f9eeca106725 3673 * @note If transfer by DMA selected, specifies the DMA requests
Kojto 122:f9eeca106725 3674 * mode:
Kojto 122:f9eeca106725 3675 * - Limited mode (One shot mode): DMA transfer requests are stopped
Kojto 122:f9eeca106725 3676 * when number of DMA data transfers (number of
Kojto 122:f9eeca106725 3677 * ADC conversions) is reached.
Kojto 122:f9eeca106725 3678 * This ADC mode is intended to be used with DMA mode non-circular.
Kojto 122:f9eeca106725 3679 * - Unlimited mode: DMA transfer requests are unlimited,
Kojto 122:f9eeca106725 3680 * whatever number of DMA data transfers (number of
Kojto 122:f9eeca106725 3681 * ADC conversions).
Kojto 122:f9eeca106725 3682 * This ADC mode is intended to be used with DMA mode circular.
Kojto 122:f9eeca106725 3683 * @note If ADC DMA requests mode is set to unlimited and DMA is set to
Kojto 122:f9eeca106725 3684 * mode non-circular:
Kojto 122:f9eeca106725 3685 * when DMA transfers size will be reached, DMA will stop transfers of
Kojto 122:f9eeca106725 3686 * ADC conversions data ADC will raise an overrun error
Kojto 122:f9eeca106725 3687 * (overrun flag and interruption if enabled).
Kojto 122:f9eeca106725 3688 * @note For devices with several ADC instances: ADC multimode DMA
Kojto 122:f9eeca106725 3689 * settings are available using function @ref LL_ADC_GetMultiDMATransfer().
Kojto 122:f9eeca106725 3690 * @note To configure DMA source address (peripheral address),
Kojto 122:f9eeca106725 3691 * use function @ref LL_ADC_DMA_GetRegAddr().
Kojto 122:f9eeca106725 3692 * @rmtoll CFGR DMAEN LL_ADC_REG_GetDMATransfer\n
Kojto 122:f9eeca106725 3693 * CFGR DMACFG LL_ADC_REG_GetDMATransfer
Kojto 122:f9eeca106725 3694 * @param ADCx ADC instance
Kojto 122:f9eeca106725 3695 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 3696 * @arg @ref LL_ADC_REG_DMA_TRANSFER_NONE
Kojto 122:f9eeca106725 3697 * @arg @ref LL_ADC_REG_DMA_TRANSFER_LIMITED
Kojto 122:f9eeca106725 3698 * @arg @ref LL_ADC_REG_DMA_TRANSFER_UNLIMITED
Kojto 122:f9eeca106725 3699 */
Kojto 122:f9eeca106725 3700 __STATIC_INLINE uint32_t LL_ADC_REG_GetDMATransfer(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 3701 {
Kojto 122:f9eeca106725 3702 return (uint32_t)(READ_BIT(ADCx->CFGR, ADC_CFGR_DMAEN | ADC_CFGR_DMACFG));
Kojto 122:f9eeca106725 3703 }
Kojto 122:f9eeca106725 3704
AnnaBridge 145:64910690c574 3705 #if defined(ADC_CFGR_DFSDMCFG)
AnnaBridge 145:64910690c574 3706 /**
AnnaBridge 145:64910690c574 3707 * @brief Set ADC group regular conversion data transfer to DFSDM.
AnnaBridge 145:64910690c574 3708 * @note DFSDM transfer cannot be used if DMA transfer is enabled.
AnnaBridge 145:64910690c574 3709 * @note To configure DFSDM source address (peripheral address),
AnnaBridge 145:64910690c574 3710 * use the same function as for DMA transfer:
AnnaBridge 145:64910690c574 3711 * function @ref LL_ADC_DMA_GetRegAddr().
AnnaBridge 145:64910690c574 3712 * @note On this STM32 serie, setting of this feature is conditioned to
AnnaBridge 145:64910690c574 3713 * ADC state:
AnnaBridge 145:64910690c574 3714 * ADC must be disabled or enabled without conversion on going
AnnaBridge 145:64910690c574 3715 * on either groups regular or injected.
AnnaBridge 145:64910690c574 3716 * @rmtoll CFGR DFSDMCFG LL_ADC_REG_GetDFSDMTransfer
AnnaBridge 145:64910690c574 3717 * @param ADCx ADC instance
AnnaBridge 145:64910690c574 3718 * @param DFSDMTransfer This parameter can be one of the following values:
AnnaBridge 145:64910690c574 3719 * @arg @ref LL_ADC_REG_DFSDM_TRANSFER_NONE
AnnaBridge 145:64910690c574 3720 * @arg @ref LL_ADC_REG_DFSDM_TRANSFER_ENABLE
AnnaBridge 145:64910690c574 3721 * @retval None
AnnaBridge 145:64910690c574 3722 */
AnnaBridge 145:64910690c574 3723 __STATIC_INLINE void LL_ADC_REG_SetDFSDMTransfer(ADC_TypeDef *ADCx, uint32_t DFSDMTransfer)
AnnaBridge 145:64910690c574 3724 {
AnnaBridge 145:64910690c574 3725 MODIFY_REG(ADCx->CFGR, ADC_CFGR_DFSDMCFG, DFSDMTransfer);
AnnaBridge 145:64910690c574 3726 }
AnnaBridge 145:64910690c574 3727
AnnaBridge 145:64910690c574 3728 /**
AnnaBridge 145:64910690c574 3729 * @brief Get ADC group regular conversion data transfer to DFSDM.
AnnaBridge 145:64910690c574 3730 * @rmtoll CFGR DFSDMCFG LL_ADC_REG_GetDFSDMTransfer
AnnaBridge 145:64910690c574 3731 * @param ADCx ADC instance
AnnaBridge 145:64910690c574 3732 * @retval Returned value can be one of the following values:
AnnaBridge 145:64910690c574 3733 * @arg @ref LL_ADC_REG_DFSDM_TRANSFER_NONE
AnnaBridge 145:64910690c574 3734 * @arg @ref LL_ADC_REG_DFSDM_TRANSFER_ENABLE
AnnaBridge 145:64910690c574 3735 */
AnnaBridge 145:64910690c574 3736 __STATIC_INLINE uint32_t LL_ADC_REG_GetDFSDMTransfer(ADC_TypeDef *ADCx)
AnnaBridge 145:64910690c574 3737 {
AnnaBridge 145:64910690c574 3738 return (uint32_t)(READ_BIT(ADCx->CFGR, ADC_CFGR_DFSDMCFG));
AnnaBridge 145:64910690c574 3739 }
AnnaBridge 145:64910690c574 3740 #endif /* ADC_CFGR_DFSDMCFG */
Kojto 122:f9eeca106725 3741
Kojto 122:f9eeca106725 3742 /**
Kojto 122:f9eeca106725 3743 * @brief Set ADC group regular behavior in case of overrun:
Kojto 122:f9eeca106725 3744 * data preserved or overwritten.
Kojto 122:f9eeca106725 3745 * @note Compatibility with devices without feature overrun:
Kojto 122:f9eeca106725 3746 * other devices without this feature have a behavior
Kojto 122:f9eeca106725 3747 * equivalent to data overwritten.
Kojto 122:f9eeca106725 3748 * The default setting of overrun is data preserved.
Kojto 122:f9eeca106725 3749 * Therefore, for compatibility with all devices, parameter
Kojto 122:f9eeca106725 3750 * overrun should be set to data overwritten.
Kojto 122:f9eeca106725 3751 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 3752 * ADC state:
Kojto 122:f9eeca106725 3753 * ADC must be disabled or enabled without conversion on going
Kojto 122:f9eeca106725 3754 * on group regular.
Kojto 122:f9eeca106725 3755 * @rmtoll CFGR OVRMOD LL_ADC_REG_SetOverrun
Kojto 122:f9eeca106725 3756 * @param ADCx ADC instance
Kojto 122:f9eeca106725 3757 * @param Overrun This parameter can be one of the following values:
Kojto 122:f9eeca106725 3758 * @arg @ref LL_ADC_REG_OVR_DATA_PRESERVED
Kojto 122:f9eeca106725 3759 * @arg @ref LL_ADC_REG_OVR_DATA_OVERWRITTEN
Kojto 122:f9eeca106725 3760 * @retval None
Kojto 122:f9eeca106725 3761 */
Kojto 122:f9eeca106725 3762 __STATIC_INLINE void LL_ADC_REG_SetOverrun(ADC_TypeDef *ADCx, uint32_t Overrun)
Kojto 122:f9eeca106725 3763 {
Kojto 122:f9eeca106725 3764 MODIFY_REG(ADCx->CFGR, ADC_CFGR_OVRMOD, Overrun);
Kojto 122:f9eeca106725 3765 }
Kojto 122:f9eeca106725 3766
Kojto 122:f9eeca106725 3767 /**
Kojto 122:f9eeca106725 3768 * @brief Get ADC group regular behavior in case of overrun:
Kojto 122:f9eeca106725 3769 * data preserved or overwritten.
Kojto 122:f9eeca106725 3770 * @rmtoll CFGR OVRMOD LL_ADC_REG_GetOverrun
Kojto 122:f9eeca106725 3771 * @param ADCx ADC instance
Kojto 122:f9eeca106725 3772 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 3773 * @arg @ref LL_ADC_REG_OVR_DATA_PRESERVED
Kojto 122:f9eeca106725 3774 * @arg @ref LL_ADC_REG_OVR_DATA_OVERWRITTEN
Kojto 122:f9eeca106725 3775 */
Kojto 122:f9eeca106725 3776 __STATIC_INLINE uint32_t LL_ADC_REG_GetOverrun(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 3777 {
Kojto 122:f9eeca106725 3778 return (uint32_t)(READ_BIT(ADCx->CFGR, ADC_CFGR_OVRMOD));
Kojto 122:f9eeca106725 3779 }
Kojto 122:f9eeca106725 3780
Kojto 122:f9eeca106725 3781 /**
Kojto 122:f9eeca106725 3782 * @}
Kojto 122:f9eeca106725 3783 */
Kojto 122:f9eeca106725 3784
Kojto 122:f9eeca106725 3785 /** @defgroup ADC_LL_EF_Configuration_ADC_Group_Injected Configuration of ADC hierarchical scope: group injected
Kojto 122:f9eeca106725 3786 * @{
Kojto 122:f9eeca106725 3787 */
Kojto 122:f9eeca106725 3788
Kojto 122:f9eeca106725 3789 /**
Kojto 122:f9eeca106725 3790 * @brief Set ADC group injected conversion trigger source:
Kojto 122:f9eeca106725 3791 * internal (SW start) or from external IP (timer event,
Kojto 122:f9eeca106725 3792 * external interrupt line).
Kojto 122:f9eeca106725 3793 * @note On this STM32 serie, setting trigger source to external trigger
Kojto 122:f9eeca106725 3794 * also set trigger polarity to rising edge
Kojto 122:f9eeca106725 3795 * (default setting for compatibility with some ADC on other
Kojto 122:f9eeca106725 3796 * STM32 families having this setting set by HW default value).
Kojto 122:f9eeca106725 3797 * In case of need to modify trigger edge, use
Kojto 122:f9eeca106725 3798 * function @ref LL_ADC_INJ_SetTriggerEdge().
Kojto 122:f9eeca106725 3799 * @note Availability of parameters of trigger sources from timer
Kojto 122:f9eeca106725 3800 * depends on timers availability on the selected device.
Kojto 122:f9eeca106725 3801 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 3802 * ADC state:
Kojto 122:f9eeca106725 3803 * ADC must not be disabled. Can be enabled with or without conversion
Kojto 122:f9eeca106725 3804 * on going on either groups regular or injected.
Kojto 122:f9eeca106725 3805 * @rmtoll JSQR JEXTSEL LL_ADC_INJ_SetTriggerSource\n
Kojto 122:f9eeca106725 3806 * JSQR JEXTEN LL_ADC_INJ_SetTriggerSource
Kojto 122:f9eeca106725 3807 * @param ADCx ADC instance
Kojto 122:f9eeca106725 3808 * @param TriggerSource This parameter can be one of the following values:
Kojto 122:f9eeca106725 3809 * @arg @ref LL_ADC_INJ_TRIG_SOFTWARE
Kojto 122:f9eeca106725 3810 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM1_TRGO
Kojto 122:f9eeca106725 3811 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM1_TRGO2
Kojto 122:f9eeca106725 3812 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM1_CH4
Kojto 122:f9eeca106725 3813 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM2_TRGO
Kojto 122:f9eeca106725 3814 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM2_CH1
Kojto 122:f9eeca106725 3815 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM3_TRGO
Kojto 122:f9eeca106725 3816 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM3_CH1
Kojto 122:f9eeca106725 3817 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM3_CH3
Kojto 122:f9eeca106725 3818 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM3_CH4
Kojto 122:f9eeca106725 3819 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM4_TRGO
Kojto 122:f9eeca106725 3820 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM6_TRGO
Kojto 122:f9eeca106725 3821 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM8_CH4
Kojto 122:f9eeca106725 3822 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM8_TRGO
Kojto 122:f9eeca106725 3823 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM8_TRGO2
Kojto 122:f9eeca106725 3824 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM15_TRGO
Kojto 122:f9eeca106725 3825 * @arg @ref LL_ADC_INJ_TRIG_EXT_EXTI_LINE15
Kojto 122:f9eeca106725 3826 * @retval None
Kojto 122:f9eeca106725 3827 */
Kojto 122:f9eeca106725 3828 __STATIC_INLINE void LL_ADC_INJ_SetTriggerSource(ADC_TypeDef *ADCx, uint32_t TriggerSource)
Kojto 122:f9eeca106725 3829 {
Kojto 122:f9eeca106725 3830 MODIFY_REG(ADCx->JSQR, ADC_JSQR_JEXTSEL | ADC_JSQR_JEXTEN, TriggerSource);
Kojto 122:f9eeca106725 3831 }
Kojto 122:f9eeca106725 3832
Kojto 122:f9eeca106725 3833 /**
Kojto 122:f9eeca106725 3834 * @brief Get ADC group injected conversion trigger source:
Kojto 122:f9eeca106725 3835 * internal (SW start) or from external IP (timer event,
Kojto 122:f9eeca106725 3836 * external interrupt line).
Kojto 122:f9eeca106725 3837 * @note To determine whether group injected trigger source is
Kojto 122:f9eeca106725 3838 * internal (SW start) or external, without detail
Kojto 122:f9eeca106725 3839 * of which peripheral is selected as external trigger,
Kojto 122:f9eeca106725 3840 * (equivalent to
Kojto 122:f9eeca106725 3841 * "if(LL_ADC_INJ_GetTriggerSource(ADC1) == LL_ADC_INJ_TRIG_SOFTWARE)")
Kojto 122:f9eeca106725 3842 * use function @ref LL_ADC_INJ_IsTriggerSourceSWStart.
Kojto 122:f9eeca106725 3843 * @note Availability of parameters of trigger sources from timer
Kojto 122:f9eeca106725 3844 * depends on timers availability on the selected device.
Kojto 122:f9eeca106725 3845 * @rmtoll JSQR JEXTSEL LL_ADC_INJ_GetTriggerSource\n
Kojto 122:f9eeca106725 3846 * JSQR JEXTEN LL_ADC_INJ_GetTriggerSource
Kojto 122:f9eeca106725 3847 * @param ADCx ADC instance
Kojto 122:f9eeca106725 3848 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 3849 * @arg @ref LL_ADC_INJ_TRIG_SOFTWARE
Kojto 122:f9eeca106725 3850 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM1_TRGO
Kojto 122:f9eeca106725 3851 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM1_TRGO2
Kojto 122:f9eeca106725 3852 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM1_CH4
Kojto 122:f9eeca106725 3853 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM2_TRGO
Kojto 122:f9eeca106725 3854 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM2_CH1
Kojto 122:f9eeca106725 3855 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM3_TRGO
Kojto 122:f9eeca106725 3856 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM3_CH1
Kojto 122:f9eeca106725 3857 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM3_CH3
Kojto 122:f9eeca106725 3858 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM3_CH4
Kojto 122:f9eeca106725 3859 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM4_TRGO
Kojto 122:f9eeca106725 3860 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM6_TRGO
Kojto 122:f9eeca106725 3861 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM8_CH4
Kojto 122:f9eeca106725 3862 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM8_TRGO
Kojto 122:f9eeca106725 3863 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM8_TRGO2
Kojto 122:f9eeca106725 3864 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM15_TRGO
Kojto 122:f9eeca106725 3865 * @arg @ref LL_ADC_INJ_TRIG_EXT_EXTI_LINE15
Kojto 122:f9eeca106725 3866 */
Kojto 122:f9eeca106725 3867 __STATIC_INLINE uint32_t LL_ADC_INJ_GetTriggerSource(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 3868 {
Kojto 122:f9eeca106725 3869 register uint32_t TriggerSource = READ_BIT(ADCx->JSQR, ADC_JSQR_JEXTSEL | ADC_JSQR_JEXTEN);
Kojto 122:f9eeca106725 3870
Kojto 122:f9eeca106725 3871 /* Value for shift of {0; 4; 8; 12} depending on value of bitfield */
Kojto 122:f9eeca106725 3872 /* corresponding to ADC_JSQR_JEXTEN {0; 1; 2; 3}. */
Kojto 122:f9eeca106725 3873 register uint32_t ShiftJexten = ((TriggerSource & ADC_JSQR_JEXTEN) >> (ADC_INJ_TRIG_EXTEN_BITOFFSET_POS - 2U));
Kojto 122:f9eeca106725 3874
Kojto 122:f9eeca106725 3875 /* Set bitfield corresponding to ADC_JSQR_JEXTEN and ADC_JSQR_JEXTSEL */
Kojto 122:f9eeca106725 3876 /* to match with triggers literals definition. */
Kojto 122:f9eeca106725 3877 return ((TriggerSource
Kojto 122:f9eeca106725 3878 & (ADC_INJ_TRIG_SOURCE_MASK >> ShiftJexten) & ADC_JSQR_JEXTSEL)
Kojto 122:f9eeca106725 3879 | ((ADC_INJ_TRIG_EDGE_MASK >> ShiftJexten) & ADC_JSQR_JEXTEN)
Kojto 122:f9eeca106725 3880 );
Kojto 122:f9eeca106725 3881 }
Kojto 122:f9eeca106725 3882
Kojto 122:f9eeca106725 3883 /**
Kojto 122:f9eeca106725 3884 * @brief Get ADC group injected conversion trigger source internal (SW start)
Kojto 122:f9eeca106725 3885 or external
Kojto 122:f9eeca106725 3886 * @note In case of group injected trigger source set to external trigger,
Kojto 122:f9eeca106725 3887 * to determine which peripheral is selected as external trigger,
Kojto 122:f9eeca106725 3888 * use function @ref LL_ADC_INJ_GetTriggerSource.
Kojto 122:f9eeca106725 3889 * @rmtoll JSQR JEXTEN LL_ADC_INJ_IsTriggerSourceSWStart
Kojto 122:f9eeca106725 3890 * @param ADCx ADC instance
Kojto 122:f9eeca106725 3891 * @retval Value "0" if trigger source external trigger
Kojto 122:f9eeca106725 3892 * Value "1" if trigger source SW start.
Kojto 122:f9eeca106725 3893 */
Kojto 122:f9eeca106725 3894 __STATIC_INLINE uint32_t LL_ADC_INJ_IsTriggerSourceSWStart(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 3895 {
Kojto 122:f9eeca106725 3896 return (READ_BIT(ADCx->JSQR, ADC_JSQR_JEXTEN) == (LL_ADC_INJ_TRIG_SOFTWARE & ADC_JSQR_JEXTEN));
Kojto 122:f9eeca106725 3897 }
Kojto 122:f9eeca106725 3898
Kojto 122:f9eeca106725 3899 /**
Kojto 122:f9eeca106725 3900 * @brief Set ADC group injected conversion trigger polarity.
Kojto 122:f9eeca106725 3901 * Applicable only for trigger source set to external trigger.
Kojto 122:f9eeca106725 3902 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 3903 * ADC state:
Kojto 122:f9eeca106725 3904 * ADC must not be disabled. Can be enabled with or without conversion
Kojto 122:f9eeca106725 3905 * on going on either groups regular or injected.
Kojto 122:f9eeca106725 3906 * @rmtoll JSQR JEXTEN LL_ADC_INJ_SetTriggerEdge
Kojto 122:f9eeca106725 3907 * @param ADCx ADC instance
Kojto 122:f9eeca106725 3908 * @param ExternalTriggerEdge This parameter can be one of the following values:
Kojto 122:f9eeca106725 3909 * @arg @ref LL_ADC_INJ_TRIG_EXT_RISING
Kojto 122:f9eeca106725 3910 * @arg @ref LL_ADC_INJ_TRIG_EXT_FALLING
Kojto 122:f9eeca106725 3911 * @arg @ref LL_ADC_INJ_TRIG_EXT_RISINGFALLING
Kojto 122:f9eeca106725 3912 * @retval None
Kojto 122:f9eeca106725 3913 */
Kojto 122:f9eeca106725 3914 __STATIC_INLINE void LL_ADC_INJ_SetTriggerEdge(ADC_TypeDef *ADCx, uint32_t ExternalTriggerEdge)
Kojto 122:f9eeca106725 3915 {
Kojto 122:f9eeca106725 3916 MODIFY_REG(ADCx->JSQR, ADC_JSQR_JEXTEN, ExternalTriggerEdge);
Kojto 122:f9eeca106725 3917 }
Kojto 122:f9eeca106725 3918
Kojto 122:f9eeca106725 3919 /**
Kojto 122:f9eeca106725 3920 * @brief Get ADC group injected conversion trigger polarity.
Kojto 122:f9eeca106725 3921 * Applicable only for trigger source set to external trigger.
Kojto 122:f9eeca106725 3922 * @rmtoll JSQR JEXTEN LL_ADC_INJ_GetTriggerEdge
Kojto 122:f9eeca106725 3923 * @param ADCx ADC instance
Kojto 122:f9eeca106725 3924 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 3925 * @arg @ref LL_ADC_INJ_TRIG_EXT_RISING
Kojto 122:f9eeca106725 3926 * @arg @ref LL_ADC_INJ_TRIG_EXT_FALLING
Kojto 122:f9eeca106725 3927 * @arg @ref LL_ADC_INJ_TRIG_EXT_RISINGFALLING
Kojto 122:f9eeca106725 3928 */
Kojto 122:f9eeca106725 3929 __STATIC_INLINE uint32_t LL_ADC_INJ_GetTriggerEdge(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 3930 {
Kojto 122:f9eeca106725 3931 return (uint32_t)(READ_BIT(ADCx->JSQR, ADC_JSQR_JEXTEN));
Kojto 122:f9eeca106725 3932 }
Kojto 122:f9eeca106725 3933
Kojto 122:f9eeca106725 3934 /**
Kojto 122:f9eeca106725 3935 * @brief Set ADC group injected sequencer length and scan direction.
Kojto 122:f9eeca106725 3936 * @note This function performs configuration of:
Kojto 122:f9eeca106725 3937 * - Sequence length: Number of ranks in the scan sequence.
Kojto 122:f9eeca106725 3938 * - Sequence direction: Unless specified in parameters, sequencer
Kojto 122:f9eeca106725 3939 * scan direction is forward (from rank 1 to rank n).
Kojto 122:f9eeca106725 3940 * @note Sequencer disabled is equivalent to sequencer of 1 rank:
Kojto 122:f9eeca106725 3941 * ADC conversion on only 1 channel.
Kojto 122:f9eeca106725 3942 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 3943 * ADC state:
Kojto 122:f9eeca106725 3944 * ADC must not be disabled. Can be enabled with or without conversion
Kojto 122:f9eeca106725 3945 * on going on either groups regular or injected.
Kojto 122:f9eeca106725 3946 * @rmtoll JSQR JL LL_ADC_INJ_SetSequencerLength
Kojto 122:f9eeca106725 3947 * @param ADCx ADC instance
Kojto 122:f9eeca106725 3948 * @param SequencerNbRanks This parameter can be one of the following values:
Kojto 122:f9eeca106725 3949 * @arg @ref LL_ADC_INJ_SEQ_SCAN_DISABLE
Kojto 122:f9eeca106725 3950 * @arg @ref LL_ADC_INJ_SEQ_SCAN_ENABLE_2RANKS
Kojto 122:f9eeca106725 3951 * @arg @ref LL_ADC_INJ_SEQ_SCAN_ENABLE_3RANKS
Kojto 122:f9eeca106725 3952 * @arg @ref LL_ADC_INJ_SEQ_SCAN_ENABLE_4RANKS
Kojto 122:f9eeca106725 3953 * @retval None
Kojto 122:f9eeca106725 3954 */
Kojto 122:f9eeca106725 3955 __STATIC_INLINE void LL_ADC_INJ_SetSequencerLength(ADC_TypeDef *ADCx, uint32_t SequencerNbRanks)
Kojto 122:f9eeca106725 3956 {
Kojto 122:f9eeca106725 3957 MODIFY_REG(ADCx->JSQR, ADC_JSQR_JL, SequencerNbRanks);
Kojto 122:f9eeca106725 3958 }
Kojto 122:f9eeca106725 3959
Kojto 122:f9eeca106725 3960 /**
Kojto 122:f9eeca106725 3961 * @brief Get ADC group injected sequencer length and scan direction.
Kojto 122:f9eeca106725 3962 * @note This function retrieves:
Kojto 122:f9eeca106725 3963 * - Sequence length: Number of ranks in the scan sequence.
Kojto 122:f9eeca106725 3964 * - Sequence direction: Unless specified in parameters, sequencer
Kojto 122:f9eeca106725 3965 * scan direction is forward (from rank 1 to rank n).
Kojto 122:f9eeca106725 3966 * @note Sequencer disabled is equivalent to sequencer of 1 rank:
Kojto 122:f9eeca106725 3967 * ADC conversion on only 1 channel.
Kojto 122:f9eeca106725 3968 * @rmtoll JSQR JL LL_ADC_INJ_GetSequencerLength
Kojto 122:f9eeca106725 3969 * @param ADCx ADC instance
Kojto 122:f9eeca106725 3970 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 3971 * @arg @ref LL_ADC_INJ_SEQ_SCAN_DISABLE
Kojto 122:f9eeca106725 3972 * @arg @ref LL_ADC_INJ_SEQ_SCAN_ENABLE_2RANKS
Kojto 122:f9eeca106725 3973 * @arg @ref LL_ADC_INJ_SEQ_SCAN_ENABLE_3RANKS
Kojto 122:f9eeca106725 3974 * @arg @ref LL_ADC_INJ_SEQ_SCAN_ENABLE_4RANKS
Kojto 122:f9eeca106725 3975 */
Kojto 122:f9eeca106725 3976 __STATIC_INLINE uint32_t LL_ADC_INJ_GetSequencerLength(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 3977 {
Kojto 122:f9eeca106725 3978 return (uint32_t)(READ_BIT(ADCx->JSQR, ADC_JSQR_JL));
Kojto 122:f9eeca106725 3979 }
Kojto 122:f9eeca106725 3980
Kojto 122:f9eeca106725 3981 /**
Kojto 122:f9eeca106725 3982 * @brief Set ADC group injected sequencer discontinuous mode:
Kojto 122:f9eeca106725 3983 * sequence subdivided and scan conversions interrupted every selected
Kojto 122:f9eeca106725 3984 * number of ranks.
Kojto 122:f9eeca106725 3985 * @note It is not possible to enable both ADC group injected
Kojto 122:f9eeca106725 3986 * auto-injected mode and sequencer discontinuous mode.
Kojto 122:f9eeca106725 3987 * @rmtoll CFGR JDISCEN LL_ADC_INJ_SetSequencerDiscont
Kojto 122:f9eeca106725 3988 * @param ADCx ADC instance
Kojto 122:f9eeca106725 3989 * @param SeqDiscont This parameter can be one of the following values:
Kojto 122:f9eeca106725 3990 * @arg @ref LL_ADC_INJ_SEQ_DISCONT_DISABLE
Kojto 122:f9eeca106725 3991 * @arg @ref LL_ADC_INJ_SEQ_DISCONT_1RANK
Kojto 122:f9eeca106725 3992 * @retval None
Kojto 122:f9eeca106725 3993 */
Kojto 122:f9eeca106725 3994 __STATIC_INLINE void LL_ADC_INJ_SetSequencerDiscont(ADC_TypeDef *ADCx, uint32_t SeqDiscont)
Kojto 122:f9eeca106725 3995 {
Kojto 122:f9eeca106725 3996 MODIFY_REG(ADCx->CFGR, ADC_CFGR_JDISCEN, SeqDiscont);
Kojto 122:f9eeca106725 3997 }
Kojto 122:f9eeca106725 3998
Kojto 122:f9eeca106725 3999 /**
Kojto 122:f9eeca106725 4000 * @brief Get ADC group injected sequencer discontinuous mode:
Kojto 122:f9eeca106725 4001 * sequence subdivided and scan conversions interrupted every selected
Kojto 122:f9eeca106725 4002 * number of ranks.
Kojto 122:f9eeca106725 4003 * @rmtoll CFGR JDISCEN LL_ADC_INJ_GetSequencerDiscont
Kojto 122:f9eeca106725 4004 * @param ADCx ADC instance
Kojto 122:f9eeca106725 4005 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 4006 * @arg @ref LL_ADC_INJ_SEQ_DISCONT_DISABLE
Kojto 122:f9eeca106725 4007 * @arg @ref LL_ADC_INJ_SEQ_DISCONT_1RANK
Kojto 122:f9eeca106725 4008 */
Kojto 122:f9eeca106725 4009 __STATIC_INLINE uint32_t LL_ADC_INJ_GetSequencerDiscont(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 4010 {
Kojto 122:f9eeca106725 4011 return (uint32_t)(READ_BIT(ADCx->CFGR, ADC_CFGR_JDISCEN));
Kojto 122:f9eeca106725 4012 }
Kojto 122:f9eeca106725 4013
Kojto 122:f9eeca106725 4014 /**
Kojto 122:f9eeca106725 4015 * @brief Set ADC group injected sequence: channel on the selected
Kojto 122:f9eeca106725 4016 * sequence rank.
Kojto 122:f9eeca106725 4017 * @note Depending on devices and packages, some channels may not be available.
Kojto 122:f9eeca106725 4018 * Refer to device datasheet for channels availability.
Kojto 122:f9eeca106725 4019 * @note On this STM32 serie, to measure internal channels (VrefInt,
Kojto 122:f9eeca106725 4020 * TempSensor, ...), measurement paths to internal channels must be
Kojto 122:f9eeca106725 4021 * enabled separately.
Kojto 122:f9eeca106725 4022 * This can be done using function @ref LL_ADC_SetCommonPathInternalCh().
Kojto 122:f9eeca106725 4023 * @note On this STM32 serie, some fast channels are available: fast analog inputs
Kojto 122:f9eeca106725 4024 * coming from GPIO pads (ADC_IN1..5).
Kojto 122:f9eeca106725 4025 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 4026 * ADC state:
Kojto 122:f9eeca106725 4027 * ADC must not be disabled. Can be enabled with or without conversion
Kojto 122:f9eeca106725 4028 * on going on either groups regular or injected.
Kojto 122:f9eeca106725 4029 * @rmtoll JSQR JSQ1 LL_ADC_INJ_SetSequencerRanks\n
Kojto 122:f9eeca106725 4030 * JSQR JSQ2 LL_ADC_INJ_SetSequencerRanks\n
Kojto 122:f9eeca106725 4031 * JSQR JSQ3 LL_ADC_INJ_SetSequencerRanks\n
Kojto 122:f9eeca106725 4032 * JSQR JSQ4 LL_ADC_INJ_SetSequencerRanks
Kojto 122:f9eeca106725 4033 * @param ADCx ADC instance
Kojto 122:f9eeca106725 4034 * @param Rank This parameter can be one of the following values:
Kojto 122:f9eeca106725 4035 * @arg @ref LL_ADC_INJ_RANK_1
Kojto 122:f9eeca106725 4036 * @arg @ref LL_ADC_INJ_RANK_2
Kojto 122:f9eeca106725 4037 * @arg @ref LL_ADC_INJ_RANK_3
Kojto 122:f9eeca106725 4038 * @arg @ref LL_ADC_INJ_RANK_4
Kojto 122:f9eeca106725 4039 * @param Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 4040 * @arg @ref LL_ADC_CHANNEL_0
Kojto 122:f9eeca106725 4041 * @arg @ref LL_ADC_CHANNEL_1 (7)
Kojto 122:f9eeca106725 4042 * @arg @ref LL_ADC_CHANNEL_2 (7)
Kojto 122:f9eeca106725 4043 * @arg @ref LL_ADC_CHANNEL_3 (7)
Kojto 122:f9eeca106725 4044 * @arg @ref LL_ADC_CHANNEL_4 (7)
Kojto 122:f9eeca106725 4045 * @arg @ref LL_ADC_CHANNEL_5 (7)
Kojto 122:f9eeca106725 4046 * @arg @ref LL_ADC_CHANNEL_6
Kojto 122:f9eeca106725 4047 * @arg @ref LL_ADC_CHANNEL_7
Kojto 122:f9eeca106725 4048 * @arg @ref LL_ADC_CHANNEL_8
Kojto 122:f9eeca106725 4049 * @arg @ref LL_ADC_CHANNEL_9
Kojto 122:f9eeca106725 4050 * @arg @ref LL_ADC_CHANNEL_10
Kojto 122:f9eeca106725 4051 * @arg @ref LL_ADC_CHANNEL_11
Kojto 122:f9eeca106725 4052 * @arg @ref LL_ADC_CHANNEL_12
Kojto 122:f9eeca106725 4053 * @arg @ref LL_ADC_CHANNEL_13
Kojto 122:f9eeca106725 4054 * @arg @ref LL_ADC_CHANNEL_14
Kojto 122:f9eeca106725 4055 * @arg @ref LL_ADC_CHANNEL_15
Kojto 122:f9eeca106725 4056 * @arg @ref LL_ADC_CHANNEL_16
Kojto 122:f9eeca106725 4057 * @arg @ref LL_ADC_CHANNEL_17
Kojto 122:f9eeca106725 4058 * @arg @ref LL_ADC_CHANNEL_18
Kojto 122:f9eeca106725 4059 * @arg @ref LL_ADC_CHANNEL_VREFINT (1)
Kojto 122:f9eeca106725 4060 * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR (4)
Kojto 122:f9eeca106725 4061 * @arg @ref LL_ADC_CHANNEL_VBAT (4)
Kojto 122:f9eeca106725 4062 * @arg @ref LL_ADC_CHANNEL_DAC1CH1 (5)
Kojto 122:f9eeca106725 4063 * @arg @ref LL_ADC_CHANNEL_DAC1CH2 (5)
Kojto 122:f9eeca106725 4064 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)(6)
Kojto 122:f9eeca106725 4065 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)(6)
Kojto 122:f9eeca106725 4066 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC3 (3)(6)
Kojto 122:f9eeca106725 4067 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC3 (3)(6)
Kojto 122:f9eeca106725 4068 *
Kojto 122:f9eeca106725 4069 * (1) On STM32L4, parameter available only on ADC instance: ADC1.\n
Kojto 122:f9eeca106725 4070 * (2) On STM32L4, parameter available only on ADC instance: ADC2.\n
Kojto 122:f9eeca106725 4071 * (3) On STM32L4, parameter available only on ADC instance: ADC3.\n
Kojto 122:f9eeca106725 4072 * (4) On STM32L4, parameter available only on ADC instances: ADC1, ADC3.\n
Kojto 122:f9eeca106725 4073 * (5) On STM32L4, parameter available on devices with only 1 ADC instance.\n
Kojto 122:f9eeca106725 4074 * (6) On STM32L4, parameter available on devices with several ADC instances.\n
Kojto 122:f9eeca106725 4075 * (7) On STM32L4, fast channel (0.188 us for 12-bit resolution (ADC conversion rate up to 5.33 Ms/s)).
Kojto 122:f9eeca106725 4076 * Other channels are slow channels (0.238 us for 12-bit resolution (ADC conversion rate up to 4.21 Ms/s)).
Kojto 122:f9eeca106725 4077 * @retval None
Kojto 122:f9eeca106725 4078 */
Kojto 122:f9eeca106725 4079 __STATIC_INLINE void LL_ADC_INJ_SetSequencerRanks(ADC_TypeDef *ADCx, uint32_t Rank, uint32_t Channel)
Kojto 122:f9eeca106725 4080 {
Kojto 122:f9eeca106725 4081 /* Set bits with content of parameter "Channel" with bits position */
Kojto 122:f9eeca106725 4082 /* in register depending on parameter "Rank". */
Kojto 122:f9eeca106725 4083 /* Parameters "Rank" and "Channel" are used with masks because containing */
Kojto 122:f9eeca106725 4084 /* other bits reserved for other purpose. */
Kojto 122:f9eeca106725 4085 MODIFY_REG(ADCx->JSQR,
Kojto 122:f9eeca106725 4086 ADC_CHANNEL_ID_NUMBER_MASK >> (ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS - (Rank & ADC_INJ_RANK_ID_JSQR_MASK)),
Kojto 122:f9eeca106725 4087 (Channel & ADC_CHANNEL_ID_NUMBER_MASK) >> (ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS - (Rank & ADC_INJ_RANK_ID_JSQR_MASK)));
Kojto 122:f9eeca106725 4088 }
Kojto 122:f9eeca106725 4089
Kojto 122:f9eeca106725 4090 /**
Kojto 122:f9eeca106725 4091 * @brief Get ADC group injected sequence: channel on the selected
Kojto 122:f9eeca106725 4092 * sequence rank.
Kojto 122:f9eeca106725 4093 * @note Depending on devices and packages, some channels may not be available.
Kojto 122:f9eeca106725 4094 * Refer to device datasheet for channels availability.
Kojto 122:f9eeca106725 4095 * @note Usage of the returned channel number:
Kojto 122:f9eeca106725 4096 * - To reinject this channel into another function LL_ADC_xxx:
Kojto 122:f9eeca106725 4097 * the returned channel number is only partly formatted on definition
Kojto 122:f9eeca106725 4098 * of literals LL_ADC_CHANNEL_x. Therefore, it has to be compared
Kojto 122:f9eeca106725 4099 * with parts of literals LL_ADC_CHANNEL_x or using
Kojto 122:f9eeca106725 4100 * helper macro @ref __LL_ADC_CHANNEL_TO_DECIMAL_NB().
Kojto 122:f9eeca106725 4101 * Then the selected literal LL_ADC_CHANNEL_x can be used
Kojto 122:f9eeca106725 4102 * as parameter for another function.
Kojto 122:f9eeca106725 4103 * - To get the channel number in decimal format:
Kojto 122:f9eeca106725 4104 * process the returned value with the helper macro
Kojto 122:f9eeca106725 4105 * @ref __LL_ADC_CHANNEL_TO_DECIMAL_NB().
Kojto 122:f9eeca106725 4106 * @rmtoll JSQR JSQ1 LL_ADC_INJ_GetSequencerRanks\n
Kojto 122:f9eeca106725 4107 * JSQR JSQ2 LL_ADC_INJ_GetSequencerRanks\n
Kojto 122:f9eeca106725 4108 * JSQR JSQ3 LL_ADC_INJ_GetSequencerRanks\n
Kojto 122:f9eeca106725 4109 * JSQR JSQ4 LL_ADC_INJ_GetSequencerRanks
Kojto 122:f9eeca106725 4110 * @param ADCx ADC instance
Kojto 122:f9eeca106725 4111 * @param Rank This parameter can be one of the following values:
Kojto 122:f9eeca106725 4112 * @arg @ref LL_ADC_INJ_RANK_1
Kojto 122:f9eeca106725 4113 * @arg @ref LL_ADC_INJ_RANK_2
Kojto 122:f9eeca106725 4114 * @arg @ref LL_ADC_INJ_RANK_3
Kojto 122:f9eeca106725 4115 * @arg @ref LL_ADC_INJ_RANK_4
Kojto 122:f9eeca106725 4116 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 4117 * @arg @ref LL_ADC_CHANNEL_0
Kojto 122:f9eeca106725 4118 * @arg @ref LL_ADC_CHANNEL_1 (7)
Kojto 122:f9eeca106725 4119 * @arg @ref LL_ADC_CHANNEL_2 (7)
Kojto 122:f9eeca106725 4120 * @arg @ref LL_ADC_CHANNEL_3 (7)
Kojto 122:f9eeca106725 4121 * @arg @ref LL_ADC_CHANNEL_4 (7)
Kojto 122:f9eeca106725 4122 * @arg @ref LL_ADC_CHANNEL_5 (7)
Kojto 122:f9eeca106725 4123 * @arg @ref LL_ADC_CHANNEL_6
Kojto 122:f9eeca106725 4124 * @arg @ref LL_ADC_CHANNEL_7
Kojto 122:f9eeca106725 4125 * @arg @ref LL_ADC_CHANNEL_8
Kojto 122:f9eeca106725 4126 * @arg @ref LL_ADC_CHANNEL_9
Kojto 122:f9eeca106725 4127 * @arg @ref LL_ADC_CHANNEL_10
Kojto 122:f9eeca106725 4128 * @arg @ref LL_ADC_CHANNEL_11
Kojto 122:f9eeca106725 4129 * @arg @ref LL_ADC_CHANNEL_12
Kojto 122:f9eeca106725 4130 * @arg @ref LL_ADC_CHANNEL_13
Kojto 122:f9eeca106725 4131 * @arg @ref LL_ADC_CHANNEL_14
Kojto 122:f9eeca106725 4132 * @arg @ref LL_ADC_CHANNEL_15
Kojto 122:f9eeca106725 4133 * @arg @ref LL_ADC_CHANNEL_16
Kojto 122:f9eeca106725 4134 * @arg @ref LL_ADC_CHANNEL_17
Kojto 122:f9eeca106725 4135 * @arg @ref LL_ADC_CHANNEL_18
Kojto 122:f9eeca106725 4136 * @arg @ref LL_ADC_CHANNEL_VREFINT (1)
Kojto 122:f9eeca106725 4137 * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR (4)
Kojto 122:f9eeca106725 4138 * @arg @ref LL_ADC_CHANNEL_VBAT (4)
Kojto 122:f9eeca106725 4139 * @arg @ref LL_ADC_CHANNEL_DAC1CH1 (5)
Kojto 122:f9eeca106725 4140 * @arg @ref LL_ADC_CHANNEL_DAC1CH2 (5)
Kojto 122:f9eeca106725 4141 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)(6)
Kojto 122:f9eeca106725 4142 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)(6)
Kojto 122:f9eeca106725 4143 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC3 (3)(6)
Kojto 122:f9eeca106725 4144 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC3 (3)(6)
Kojto 122:f9eeca106725 4145 *
Kojto 122:f9eeca106725 4146 * (1) On STM32L4, parameter available only on ADC instance: ADC1.\n
Kojto 122:f9eeca106725 4147 * (2) On STM32L4, parameter available only on ADC instance: ADC2.\n
Kojto 122:f9eeca106725 4148 * (3) On STM32L4, parameter available only on ADC instance: ADC3.\n
Kojto 122:f9eeca106725 4149 * (4) On STM32L4, parameter available only on ADC instances: ADC1, ADC3.\n
Kojto 122:f9eeca106725 4150 * (5) On STM32L4, parameter available on devices with only 1 ADC instance.\n
Kojto 122:f9eeca106725 4151 * (6) On STM32L4, parameter available on devices with several ADC instances.\n
Kojto 122:f9eeca106725 4152 * (7) On STM32L4, fast channel (0.188 us for 12-bit resolution (ADC conversion rate up to 5.33 Ms/s)).
Kojto 122:f9eeca106725 4153 * Other channels are slow channels (0.238 us for 12-bit resolution (ADC conversion rate up to 4.21 Ms/s)).\n
Kojto 122:f9eeca106725 4154 * (1, 2, 3, 4) For ADC channel read back from ADC register,
Kojto 122:f9eeca106725 4155 * comparison with internal channel parameter to be done
Kojto 122:f9eeca106725 4156 * using helper macro @ref __LL_ADC_CHANNEL_INTERNAL_TO_EXTERNAL().
Kojto 122:f9eeca106725 4157 */
Kojto 122:f9eeca106725 4158 __STATIC_INLINE uint32_t LL_ADC_INJ_GetSequencerRanks(ADC_TypeDef *ADCx, uint32_t Rank)
Kojto 122:f9eeca106725 4159 {
Kojto 122:f9eeca106725 4160 return (uint32_t)(READ_BIT(ADCx->JSQR,
Kojto 122:f9eeca106725 4161 ADC_CHANNEL_ID_NUMBER_MASK >> (ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS - (Rank & ADC_INJ_RANK_ID_JSQR_MASK)))
Kojto 122:f9eeca106725 4162 << (ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS - (Rank & ADC_INJ_RANK_ID_JSQR_MASK))
Kojto 122:f9eeca106725 4163 );
Kojto 122:f9eeca106725 4164 }
Kojto 122:f9eeca106725 4165
Kojto 122:f9eeca106725 4166 /**
Kojto 122:f9eeca106725 4167 * @brief Set ADC group injected conversion trigger:
Kojto 122:f9eeca106725 4168 * independent or from ADC group regular.
Kojto 122:f9eeca106725 4169 * @note This mode can be used to extend number of data registers
Kojto 122:f9eeca106725 4170 * updated after one ADC conversion trigger and with data
Kojto 122:f9eeca106725 4171 * permanently kept (not erased by successive conversions of scan of
Kojto 122:f9eeca106725 4172 * ADC sequencer ranks), up to 5 data registers:
Kojto 122:f9eeca106725 4173 * 1 data register on ADC group regular, 4 data registers
Kojto 122:f9eeca106725 4174 * on ADC group injected.
Kojto 122:f9eeca106725 4175 * @note If ADC group injected injected trigger source is set to an
Kojto 122:f9eeca106725 4176 * external trigger, this feature must be must be set to
Kojto 122:f9eeca106725 4177 * independent trigger.
Kojto 122:f9eeca106725 4178 * ADC group injected automatic trigger is compliant only with
Kojto 122:f9eeca106725 4179 * group injected trigger source set to SW start, without any
Kojto 122:f9eeca106725 4180 * further action on ADC group injected conversion start or stop:
Kojto 122:f9eeca106725 4181 * in this case, ADC group injected is controlled only
Kojto 122:f9eeca106725 4182 * from ADC group regular.
Kojto 122:f9eeca106725 4183 * @note It is not possible to enable both ADC group injected
Kojto 122:f9eeca106725 4184 * auto-injected mode and sequencer discontinuous mode.
Kojto 122:f9eeca106725 4185 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 4186 * ADC state:
Kojto 122:f9eeca106725 4187 * ADC must be disabled or enabled without conversion on going
Kojto 122:f9eeca106725 4188 * on either groups regular or injected.
Kojto 122:f9eeca106725 4189 * @rmtoll CFGR JAUTO LL_ADC_INJ_SetTrigAuto
Kojto 122:f9eeca106725 4190 * @param ADCx ADC instance
Kojto 122:f9eeca106725 4191 * @param TrigAuto This parameter can be one of the following values:
Kojto 122:f9eeca106725 4192 * @arg @ref LL_ADC_INJ_TRIG_INDEPENDENT
Kojto 122:f9eeca106725 4193 * @arg @ref LL_ADC_INJ_TRIG_FROM_GRP_REGULAR
Kojto 122:f9eeca106725 4194 * @retval None
Kojto 122:f9eeca106725 4195 */
Kojto 122:f9eeca106725 4196 __STATIC_INLINE void LL_ADC_INJ_SetTrigAuto(ADC_TypeDef *ADCx, uint32_t TrigAuto)
Kojto 122:f9eeca106725 4197 {
Kojto 122:f9eeca106725 4198 MODIFY_REG(ADCx->CFGR, ADC_CFGR_JAUTO, TrigAuto);
Kojto 122:f9eeca106725 4199 }
Kojto 122:f9eeca106725 4200
Kojto 122:f9eeca106725 4201 /**
Kojto 122:f9eeca106725 4202 * @brief Get ADC group injected conversion trigger:
Kojto 122:f9eeca106725 4203 * independent or from ADC group regular.
Kojto 122:f9eeca106725 4204 * @rmtoll CFGR JAUTO LL_ADC_INJ_GetTrigAuto
Kojto 122:f9eeca106725 4205 * @param ADCx ADC instance
Kojto 122:f9eeca106725 4206 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 4207 * @arg @ref LL_ADC_INJ_TRIG_INDEPENDENT
Kojto 122:f9eeca106725 4208 * @arg @ref LL_ADC_INJ_TRIG_FROM_GRP_REGULAR
Kojto 122:f9eeca106725 4209 */
Kojto 122:f9eeca106725 4210 __STATIC_INLINE uint32_t LL_ADC_INJ_GetTrigAuto(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 4211 {
Kojto 122:f9eeca106725 4212 return (uint32_t)(READ_BIT(ADCx->CFGR, ADC_CFGR_JAUTO));
Kojto 122:f9eeca106725 4213 }
Kojto 122:f9eeca106725 4214
Kojto 122:f9eeca106725 4215 /**
Kojto 122:f9eeca106725 4216 * @brief Set ADC group injected contexts queue mode.
Kojto 122:f9eeca106725 4217 * @note A context is a setting of group injected sequencer:
Kojto 122:f9eeca106725 4218 * - group injected trigger
Kojto 122:f9eeca106725 4219 * - sequencer length
Kojto 122:f9eeca106725 4220 * - sequencer ranks
Kojto 122:f9eeca106725 4221 * If contexts queue is disabled:
Kojto 122:f9eeca106725 4222 * - only 1 sequence can be configured
Kojto 122:f9eeca106725 4223 * and is active perpetually.
Kojto 122:f9eeca106725 4224 * If contexts queue is enabled:
Kojto 122:f9eeca106725 4225 * - up to 2 contexts can be queued
Kojto 122:f9eeca106725 4226 * and are checked in and out as a FIFO stack (first-in, first-out).
Kojto 122:f9eeca106725 4227 * - If a new context is set when queues is full, error is triggered
Kojto 122:f9eeca106725 4228 * by interruption "Injected Queue Overflow".
Kojto 122:f9eeca106725 4229 * - Two behaviors are possible when all contexts have been processed:
Kojto 122:f9eeca106725 4230 * the contexts queue can maintain the last context active perpetually
Kojto 122:f9eeca106725 4231 * or can be empty and injected group triggers are disabled.
Kojto 122:f9eeca106725 4232 * - Triggers can be only external (not internal SW start)
Kojto 122:f9eeca106725 4233 * - Caution: The sequence must be fully configured in one time
Kojto 122:f9eeca106725 4234 * (one write of register JSQR makes a check-in of a new context
Kojto 122:f9eeca106725 4235 * into the queue).
Kojto 122:f9eeca106725 4236 * Therefore functions to set separately injected trigger and
Kojto 122:f9eeca106725 4237 * sequencer channels cannot be used, register JSQR must be set
Kojto 122:f9eeca106725 4238 * using function @ref LL_ADC_INJ_ConfigQueueContext().
Kojto 122:f9eeca106725 4239 * @note This parameter can be modified only when no conversion is on going
Kojto 122:f9eeca106725 4240 * on either groups regular or injected.
Kojto 122:f9eeca106725 4241 * @note A modification of the context mode (bit JQDIS) causes the contexts
Kojto 122:f9eeca106725 4242 * queue to be flushed and the register JSQR is cleared.
Kojto 122:f9eeca106725 4243 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 4244 * ADC state:
Kojto 122:f9eeca106725 4245 * ADC must be disabled or enabled without conversion on going
Kojto 122:f9eeca106725 4246 * on either groups regular or injected.
Kojto 122:f9eeca106725 4247 * @rmtoll CFGR JQM LL_ADC_INJ_SetQueueMode\n
Kojto 122:f9eeca106725 4248 * CFGR JQDIS LL_ADC_INJ_SetQueueMode
Kojto 122:f9eeca106725 4249 * @param ADCx ADC instance
Kojto 122:f9eeca106725 4250 * @param QueueMode This parameter can be one of the following values:
Kojto 122:f9eeca106725 4251 * @arg @ref LL_ADC_INJ_QUEUE_DISABLE
Kojto 122:f9eeca106725 4252 * @arg @ref LL_ADC_INJ_QUEUE_2CONTEXTS_LAST_ACTIVE
Kojto 122:f9eeca106725 4253 * @arg @ref LL_ADC_INJ_QUEUE_2CONTEXTS_END_EMPTY
Kojto 122:f9eeca106725 4254 * @retval None
Kojto 122:f9eeca106725 4255 */
Kojto 122:f9eeca106725 4256 __STATIC_INLINE void LL_ADC_INJ_SetQueueMode(ADC_TypeDef *ADCx, uint32_t QueueMode)
Kojto 122:f9eeca106725 4257 {
Kojto 122:f9eeca106725 4258 MODIFY_REG(ADCx->CFGR, ADC_CFGR_JQM | ADC_CFGR_JQDIS, QueueMode);
Kojto 122:f9eeca106725 4259 }
Kojto 122:f9eeca106725 4260
Kojto 122:f9eeca106725 4261 /**
Kojto 122:f9eeca106725 4262 * @brief Get ADC group injected context queue mode.
Kojto 122:f9eeca106725 4263 * @rmtoll CFGR JQM LL_ADC_INJ_GetQueueMode\n
Kojto 122:f9eeca106725 4264 * CFGR JQDIS LL_ADC_INJ_GetQueueMode
Kojto 122:f9eeca106725 4265 * @param ADCx ADC instance
Kojto 122:f9eeca106725 4266 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 4267 * @arg @ref LL_ADC_INJ_QUEUE_DISABLE
Kojto 122:f9eeca106725 4268 * @arg @ref LL_ADC_INJ_QUEUE_2CONTEXTS_LAST_ACTIVE
Kojto 122:f9eeca106725 4269 * @arg @ref LL_ADC_INJ_QUEUE_2CONTEXTS_END_EMPTY
Kojto 122:f9eeca106725 4270 */
Kojto 122:f9eeca106725 4271 __STATIC_INLINE uint32_t LL_ADC_INJ_GetQueueMode(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 4272 {
Kojto 122:f9eeca106725 4273 return (uint32_t)(READ_BIT(ADCx->CFGR, ADC_CFGR_JQM | ADC_CFGR_JQDIS));
Kojto 122:f9eeca106725 4274 }
Kojto 122:f9eeca106725 4275
Kojto 122:f9eeca106725 4276 /**
Kojto 122:f9eeca106725 4277 * @brief Set one context on ADC group injected that will be checked in
Kojto 122:f9eeca106725 4278 * contexts queue.
Kojto 122:f9eeca106725 4279 * @note A context is a setting of group injected sequencer:
Kojto 122:f9eeca106725 4280 * - group injected trigger
Kojto 122:f9eeca106725 4281 * - sequencer length
Kojto 122:f9eeca106725 4282 * - sequencer ranks
Kojto 122:f9eeca106725 4283 * This function is intended to be used when contexts queue is enabled,
Kojto 122:f9eeca106725 4284 * because the sequence must be fully configured in one time
Kojto 122:f9eeca106725 4285 * (functions to set separately injected trigger and sequencer channels
Kojto 122:f9eeca106725 4286 * cannot be used):
Kojto 122:f9eeca106725 4287 * Refer to function @ref LL_ADC_INJ_SetQueueMode().
Kojto 122:f9eeca106725 4288 * @note In the contexts queue, only the active context can be read.
Kojto 122:f9eeca106725 4289 * The parameters of this function can be read using functions:
Kojto 122:f9eeca106725 4290 * @arg @ref LL_ADC_INJ_GetTriggerSource()
Kojto 122:f9eeca106725 4291 * @arg @ref LL_ADC_INJ_GetTriggerEdge()
Kojto 122:f9eeca106725 4292 * @arg @ref LL_ADC_INJ_GetSequencerRanks()
Kojto 122:f9eeca106725 4293 * @note On this STM32 serie, to measure internal channels (VrefInt,
Kojto 122:f9eeca106725 4294 * TempSensor, ...), measurement paths to internal channels must be
Kojto 122:f9eeca106725 4295 * enabled separately.
Kojto 122:f9eeca106725 4296 * This can be done using function @ref LL_ADC_SetCommonPathInternalCh().
Kojto 122:f9eeca106725 4297 * @note On this STM32 serie, some fast channels are available: fast analog inputs
Kojto 122:f9eeca106725 4298 * coming from GPIO pads (ADC_IN1..5).
Kojto 122:f9eeca106725 4299 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 4300 * ADC state:
Kojto 122:f9eeca106725 4301 * ADC must not be disabled. Can be enabled with or without conversion
Kojto 122:f9eeca106725 4302 * on going on either groups regular or injected.
Kojto 122:f9eeca106725 4303 * @rmtoll JSQR JEXTSEL LL_ADC_INJ_ConfigQueueContext\n
Kojto 122:f9eeca106725 4304 * JSQR JEXTEN LL_ADC_INJ_ConfigQueueContext\n
Kojto 122:f9eeca106725 4305 * JSQR JL LL_ADC_INJ_ConfigQueueContext\n
Kojto 122:f9eeca106725 4306 * JSQR JSQ1 LL_ADC_INJ_ConfigQueueContext\n
Kojto 122:f9eeca106725 4307 * JSQR JSQ2 LL_ADC_INJ_ConfigQueueContext\n
Kojto 122:f9eeca106725 4308 * JSQR JSQ3 LL_ADC_INJ_ConfigQueueContext\n
Kojto 122:f9eeca106725 4309 * JSQR JSQ4 LL_ADC_INJ_ConfigQueueContext
Kojto 122:f9eeca106725 4310 * @param ADCx ADC instance
Kojto 122:f9eeca106725 4311 * @param TriggerSource This parameter can be one of the following values:
Kojto 122:f9eeca106725 4312 * @arg @ref LL_ADC_INJ_TRIG_SOFTWARE
Kojto 122:f9eeca106725 4313 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM1_TRGO
Kojto 122:f9eeca106725 4314 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM1_TRGO2
Kojto 122:f9eeca106725 4315 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM1_CH4
Kojto 122:f9eeca106725 4316 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM2_TRGO
Kojto 122:f9eeca106725 4317 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM2_CH1
Kojto 122:f9eeca106725 4318 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM3_TRGO
Kojto 122:f9eeca106725 4319 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM3_CH1
Kojto 122:f9eeca106725 4320 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM3_CH3
Kojto 122:f9eeca106725 4321 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM3_CH4
Kojto 122:f9eeca106725 4322 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM4_TRGO
Kojto 122:f9eeca106725 4323 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM6_TRGO
Kojto 122:f9eeca106725 4324 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM8_CH4
Kojto 122:f9eeca106725 4325 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM8_TRGO
Kojto 122:f9eeca106725 4326 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM8_TRGO2
Kojto 122:f9eeca106725 4327 * @arg @ref LL_ADC_INJ_TRIG_EXT_TIM15_TRGO
Kojto 122:f9eeca106725 4328 * @arg @ref LL_ADC_INJ_TRIG_EXT_EXTI_LINE15
Kojto 122:f9eeca106725 4329 * @param ExternalTriggerEdge This parameter can be one of the following values:
Kojto 122:f9eeca106725 4330 * @arg @ref LL_ADC_INJ_TRIG_EXT_RISING
Kojto 122:f9eeca106725 4331 * @arg @ref LL_ADC_INJ_TRIG_EXT_FALLING
Kojto 122:f9eeca106725 4332 * @arg @ref LL_ADC_INJ_TRIG_EXT_RISINGFALLING
Kojto 122:f9eeca106725 4333 *
Kojto 122:f9eeca106725 4334 * Note: This parameter is discarded in case of SW start:
Kojto 122:f9eeca106725 4335 * parameter "TriggerSource" set to "LL_ADC_INJ_TRIG_SOFTWARE".
Kojto 122:f9eeca106725 4336 * @param SequencerNbRanks This parameter can be one of the following values:
Kojto 122:f9eeca106725 4337 * @arg @ref LL_ADC_INJ_SEQ_SCAN_DISABLE
Kojto 122:f9eeca106725 4338 * @arg @ref LL_ADC_INJ_SEQ_SCAN_ENABLE_2RANKS
Kojto 122:f9eeca106725 4339 * @arg @ref LL_ADC_INJ_SEQ_SCAN_ENABLE_3RANKS
Kojto 122:f9eeca106725 4340 * @arg @ref LL_ADC_INJ_SEQ_SCAN_ENABLE_4RANKS
Kojto 122:f9eeca106725 4341 * @param Rank1_Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 4342 * @arg @ref LL_ADC_CHANNEL_0
Kojto 122:f9eeca106725 4343 * @arg @ref LL_ADC_CHANNEL_1 (7)
Kojto 122:f9eeca106725 4344 * @arg @ref LL_ADC_CHANNEL_2 (7)
Kojto 122:f9eeca106725 4345 * @arg @ref LL_ADC_CHANNEL_3 (7)
Kojto 122:f9eeca106725 4346 * @arg @ref LL_ADC_CHANNEL_4 (7)
Kojto 122:f9eeca106725 4347 * @arg @ref LL_ADC_CHANNEL_5 (7)
Kojto 122:f9eeca106725 4348 * @arg @ref LL_ADC_CHANNEL_6
Kojto 122:f9eeca106725 4349 * @arg @ref LL_ADC_CHANNEL_7
Kojto 122:f9eeca106725 4350 * @arg @ref LL_ADC_CHANNEL_8
Kojto 122:f9eeca106725 4351 * @arg @ref LL_ADC_CHANNEL_9
Kojto 122:f9eeca106725 4352 * @arg @ref LL_ADC_CHANNEL_10
Kojto 122:f9eeca106725 4353 * @arg @ref LL_ADC_CHANNEL_11
Kojto 122:f9eeca106725 4354 * @arg @ref LL_ADC_CHANNEL_12
Kojto 122:f9eeca106725 4355 * @arg @ref LL_ADC_CHANNEL_13
Kojto 122:f9eeca106725 4356 * @arg @ref LL_ADC_CHANNEL_14
Kojto 122:f9eeca106725 4357 * @arg @ref LL_ADC_CHANNEL_15
Kojto 122:f9eeca106725 4358 * @arg @ref LL_ADC_CHANNEL_16
Kojto 122:f9eeca106725 4359 * @arg @ref LL_ADC_CHANNEL_17
Kojto 122:f9eeca106725 4360 * @arg @ref LL_ADC_CHANNEL_18
Kojto 122:f9eeca106725 4361 * @arg @ref LL_ADC_CHANNEL_VREFINT (1)
Kojto 122:f9eeca106725 4362 * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR (4)
Kojto 122:f9eeca106725 4363 * @arg @ref LL_ADC_CHANNEL_VBAT (4)
Kojto 122:f9eeca106725 4364 * @arg @ref LL_ADC_CHANNEL_DAC1CH1 (5)
Kojto 122:f9eeca106725 4365 * @arg @ref LL_ADC_CHANNEL_DAC1CH2 (5)
Kojto 122:f9eeca106725 4366 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)(6)
Kojto 122:f9eeca106725 4367 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)(6)
Kojto 122:f9eeca106725 4368 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC3 (3)(6)
Kojto 122:f9eeca106725 4369 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC3 (3)(6)
Kojto 122:f9eeca106725 4370 *
Kojto 122:f9eeca106725 4371 * (1) On STM32L4, parameter available only on ADC instance: ADC1.\n
Kojto 122:f9eeca106725 4372 * (2) On STM32L4, parameter available only on ADC instance: ADC2.\n
Kojto 122:f9eeca106725 4373 * (3) On STM32L4, parameter available only on ADC instance: ADC3.\n
Kojto 122:f9eeca106725 4374 * (4) On STM32L4, parameter available only on ADC instances: ADC1, ADC3.\n
Kojto 122:f9eeca106725 4375 * (5) On STM32L4, parameter available on devices with only 1 ADC instance.\n
Kojto 122:f9eeca106725 4376 * (6) On STM32L4, parameter available on devices with several ADC instances.\n
Kojto 122:f9eeca106725 4377 * (7) On STM32L4, fast channel (0.188 us for 12-bit resolution (ADC conversion rate up to 5.33 Ms/s)).
Kojto 122:f9eeca106725 4378 * Other channels are slow channels (0.238 us for 12-bit resolution (ADC conversion rate up to 4.21 Ms/s)).
Kojto 122:f9eeca106725 4379 * @param Rank2_Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 4380 * @arg @ref LL_ADC_CHANNEL_0
Kojto 122:f9eeca106725 4381 * @arg @ref LL_ADC_CHANNEL_1 (7)
Kojto 122:f9eeca106725 4382 * @arg @ref LL_ADC_CHANNEL_2 (7)
Kojto 122:f9eeca106725 4383 * @arg @ref LL_ADC_CHANNEL_3 (7)
Kojto 122:f9eeca106725 4384 * @arg @ref LL_ADC_CHANNEL_4 (7)
Kojto 122:f9eeca106725 4385 * @arg @ref LL_ADC_CHANNEL_5 (7)
Kojto 122:f9eeca106725 4386 * @arg @ref LL_ADC_CHANNEL_6
Kojto 122:f9eeca106725 4387 * @arg @ref LL_ADC_CHANNEL_7
Kojto 122:f9eeca106725 4388 * @arg @ref LL_ADC_CHANNEL_8
Kojto 122:f9eeca106725 4389 * @arg @ref LL_ADC_CHANNEL_9
Kojto 122:f9eeca106725 4390 * @arg @ref LL_ADC_CHANNEL_10
Kojto 122:f9eeca106725 4391 * @arg @ref LL_ADC_CHANNEL_11
Kojto 122:f9eeca106725 4392 * @arg @ref LL_ADC_CHANNEL_12
Kojto 122:f9eeca106725 4393 * @arg @ref LL_ADC_CHANNEL_13
Kojto 122:f9eeca106725 4394 * @arg @ref LL_ADC_CHANNEL_14
Kojto 122:f9eeca106725 4395 * @arg @ref LL_ADC_CHANNEL_15
Kojto 122:f9eeca106725 4396 * @arg @ref LL_ADC_CHANNEL_16
Kojto 122:f9eeca106725 4397 * @arg @ref LL_ADC_CHANNEL_17
Kojto 122:f9eeca106725 4398 * @arg @ref LL_ADC_CHANNEL_18
Kojto 122:f9eeca106725 4399 * @arg @ref LL_ADC_CHANNEL_VREFINT (1)
Kojto 122:f9eeca106725 4400 * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR (4)
Kojto 122:f9eeca106725 4401 * @arg @ref LL_ADC_CHANNEL_VBAT (4)
Kojto 122:f9eeca106725 4402 * @arg @ref LL_ADC_CHANNEL_DAC1CH1 (5)
Kojto 122:f9eeca106725 4403 * @arg @ref LL_ADC_CHANNEL_DAC1CH2 (5)
Kojto 122:f9eeca106725 4404 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)(6)
Kojto 122:f9eeca106725 4405 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)(6)
Kojto 122:f9eeca106725 4406 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC3 (3)(6)
Kojto 122:f9eeca106725 4407 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC3 (3)(6)
Kojto 122:f9eeca106725 4408 *
Kojto 122:f9eeca106725 4409 * (1) On STM32L4, parameter available only on ADC instance: ADC1.\n
Kojto 122:f9eeca106725 4410 * (2) On STM32L4, parameter available only on ADC instance: ADC2.\n
Kojto 122:f9eeca106725 4411 * (3) On STM32L4, parameter available only on ADC instance: ADC3.\n
Kojto 122:f9eeca106725 4412 * (4) On STM32L4, parameter available only on ADC instances: ADC1, ADC3.\n
Kojto 122:f9eeca106725 4413 * (5) On STM32L4, parameter available on devices with only 1 ADC instance.\n
Kojto 122:f9eeca106725 4414 * (6) On STM32L4, parameter available on devices with several ADC instances.\n
Kojto 122:f9eeca106725 4415 * (7) On STM32L4, fast channel (0.188 us for 12-bit resolution (ADC conversion rate up to 5.33 Ms/s)).
Kojto 122:f9eeca106725 4416 * Other channels are slow channels (0.238 us for 12-bit resolution (ADC conversion rate up to 4.21 Ms/s)).
Kojto 122:f9eeca106725 4417 * @param Rank3_Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 4418 * @arg @ref LL_ADC_CHANNEL_0
Kojto 122:f9eeca106725 4419 * @arg @ref LL_ADC_CHANNEL_1 (7)
Kojto 122:f9eeca106725 4420 * @arg @ref LL_ADC_CHANNEL_2 (7)
Kojto 122:f9eeca106725 4421 * @arg @ref LL_ADC_CHANNEL_3 (7)
Kojto 122:f9eeca106725 4422 * @arg @ref LL_ADC_CHANNEL_4 (7)
Kojto 122:f9eeca106725 4423 * @arg @ref LL_ADC_CHANNEL_5 (7)
Kojto 122:f9eeca106725 4424 * @arg @ref LL_ADC_CHANNEL_6
Kojto 122:f9eeca106725 4425 * @arg @ref LL_ADC_CHANNEL_7
Kojto 122:f9eeca106725 4426 * @arg @ref LL_ADC_CHANNEL_8
Kojto 122:f9eeca106725 4427 * @arg @ref LL_ADC_CHANNEL_9
Kojto 122:f9eeca106725 4428 * @arg @ref LL_ADC_CHANNEL_10
Kojto 122:f9eeca106725 4429 * @arg @ref LL_ADC_CHANNEL_11
Kojto 122:f9eeca106725 4430 * @arg @ref LL_ADC_CHANNEL_12
Kojto 122:f9eeca106725 4431 * @arg @ref LL_ADC_CHANNEL_13
Kojto 122:f9eeca106725 4432 * @arg @ref LL_ADC_CHANNEL_14
Kojto 122:f9eeca106725 4433 * @arg @ref LL_ADC_CHANNEL_15
Kojto 122:f9eeca106725 4434 * @arg @ref LL_ADC_CHANNEL_16
Kojto 122:f9eeca106725 4435 * @arg @ref LL_ADC_CHANNEL_17
Kojto 122:f9eeca106725 4436 * @arg @ref LL_ADC_CHANNEL_18
Kojto 122:f9eeca106725 4437 * @arg @ref LL_ADC_CHANNEL_VREFINT (1)
Kojto 122:f9eeca106725 4438 * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR (4)
Kojto 122:f9eeca106725 4439 * @arg @ref LL_ADC_CHANNEL_VBAT (4)
Kojto 122:f9eeca106725 4440 * @arg @ref LL_ADC_CHANNEL_DAC1CH1 (5)
Kojto 122:f9eeca106725 4441 * @arg @ref LL_ADC_CHANNEL_DAC1CH2 (5)
Kojto 122:f9eeca106725 4442 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)(6)
Kojto 122:f9eeca106725 4443 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)(6)
Kojto 122:f9eeca106725 4444 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC3 (3)(6)
Kojto 122:f9eeca106725 4445 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC3 (3)(6)
Kojto 122:f9eeca106725 4446 *
Kojto 122:f9eeca106725 4447 * (1) On STM32L4, parameter available only on ADC instance: ADC1.\n
Kojto 122:f9eeca106725 4448 * (2) On STM32L4, parameter available only on ADC instance: ADC2.\n
Kojto 122:f9eeca106725 4449 * (3) On STM32L4, parameter available only on ADC instance: ADC3.\n
Kojto 122:f9eeca106725 4450 * (4) On STM32L4, parameter available only on ADC instances: ADC1, ADC3.\n
Kojto 122:f9eeca106725 4451 * (5) On STM32L4, parameter available on devices with only 1 ADC instance.\n
Kojto 122:f9eeca106725 4452 * (6) On STM32L4, parameter available on devices with several ADC instances.\n
Kojto 122:f9eeca106725 4453 * (7) On STM32L4, fast channel (0.188 us for 12-bit resolution (ADC conversion rate up to 5.33 Ms/s)).
Kojto 122:f9eeca106725 4454 * Other channels are slow channels (0.238 us for 12-bit resolution (ADC conversion rate up to 4.21 Ms/s)).
Kojto 122:f9eeca106725 4455 * @param Rank4_Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 4456 * @arg @ref LL_ADC_CHANNEL_0
Kojto 122:f9eeca106725 4457 * @arg @ref LL_ADC_CHANNEL_1 (7)
Kojto 122:f9eeca106725 4458 * @arg @ref LL_ADC_CHANNEL_2 (7)
Kojto 122:f9eeca106725 4459 * @arg @ref LL_ADC_CHANNEL_3 (7)
Kojto 122:f9eeca106725 4460 * @arg @ref LL_ADC_CHANNEL_4 (7)
Kojto 122:f9eeca106725 4461 * @arg @ref LL_ADC_CHANNEL_5 (7)
Kojto 122:f9eeca106725 4462 * @arg @ref LL_ADC_CHANNEL_6
Kojto 122:f9eeca106725 4463 * @arg @ref LL_ADC_CHANNEL_7
Kojto 122:f9eeca106725 4464 * @arg @ref LL_ADC_CHANNEL_8
Kojto 122:f9eeca106725 4465 * @arg @ref LL_ADC_CHANNEL_9
Kojto 122:f9eeca106725 4466 * @arg @ref LL_ADC_CHANNEL_10
Kojto 122:f9eeca106725 4467 * @arg @ref LL_ADC_CHANNEL_11
Kojto 122:f9eeca106725 4468 * @arg @ref LL_ADC_CHANNEL_12
Kojto 122:f9eeca106725 4469 * @arg @ref LL_ADC_CHANNEL_13
Kojto 122:f9eeca106725 4470 * @arg @ref LL_ADC_CHANNEL_14
Kojto 122:f9eeca106725 4471 * @arg @ref LL_ADC_CHANNEL_15
Kojto 122:f9eeca106725 4472 * @arg @ref LL_ADC_CHANNEL_16
Kojto 122:f9eeca106725 4473 * @arg @ref LL_ADC_CHANNEL_17
Kojto 122:f9eeca106725 4474 * @arg @ref LL_ADC_CHANNEL_18
Kojto 122:f9eeca106725 4475 * @arg @ref LL_ADC_CHANNEL_VREFINT (1)
Kojto 122:f9eeca106725 4476 * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR (4)
Kojto 122:f9eeca106725 4477 * @arg @ref LL_ADC_CHANNEL_VBAT (4)
Kojto 122:f9eeca106725 4478 * @arg @ref LL_ADC_CHANNEL_DAC1CH1 (5)
Kojto 122:f9eeca106725 4479 * @arg @ref LL_ADC_CHANNEL_DAC1CH2 (5)
Kojto 122:f9eeca106725 4480 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)(6)
Kojto 122:f9eeca106725 4481 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)(6)
Kojto 122:f9eeca106725 4482 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC3 (3)(6)
Kojto 122:f9eeca106725 4483 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC3 (3)(6)
Kojto 122:f9eeca106725 4484 *
Kojto 122:f9eeca106725 4485 * (1) On STM32L4, parameter available only on ADC instance: ADC1.\n
Kojto 122:f9eeca106725 4486 * (2) On STM32L4, parameter available only on ADC instance: ADC2.\n
Kojto 122:f9eeca106725 4487 * (3) On STM32L4, parameter available only on ADC instance: ADC3.\n
Kojto 122:f9eeca106725 4488 * (4) On STM32L4, parameter available only on ADC instances: ADC1, ADC3.\n
Kojto 122:f9eeca106725 4489 * (5) On STM32L4, parameter available on devices with only 1 ADC instance.\n
Kojto 122:f9eeca106725 4490 * (6) On STM32L4, parameter available on devices with several ADC instances.\n
Kojto 122:f9eeca106725 4491 * (7) On STM32L4, fast channel (0.188 us for 12-bit resolution (ADC conversion rate up to 5.33 Ms/s)).
Kojto 122:f9eeca106725 4492 * Other channels are slow channels (0.238 us for 12-bit resolution (ADC conversion rate up to 4.21 Ms/s)).
Kojto 122:f9eeca106725 4493 * @retval None
Kojto 122:f9eeca106725 4494 */
Kojto 122:f9eeca106725 4495 __STATIC_INLINE void LL_ADC_INJ_ConfigQueueContext(ADC_TypeDef *ADCx,
Kojto 122:f9eeca106725 4496 uint32_t TriggerSource,
Kojto 122:f9eeca106725 4497 uint32_t ExternalTriggerEdge,
Kojto 122:f9eeca106725 4498 uint32_t SequencerNbRanks,
Kojto 122:f9eeca106725 4499 uint32_t Rank1_Channel,
Kojto 122:f9eeca106725 4500 uint32_t Rank2_Channel,
Kojto 122:f9eeca106725 4501 uint32_t Rank3_Channel,
Kojto 122:f9eeca106725 4502 uint32_t Rank4_Channel)
Kojto 122:f9eeca106725 4503 {
Kojto 122:f9eeca106725 4504 /* Set bits with content of parameter "Rankx_Channel" with bits position */
Kojto 122:f9eeca106725 4505 /* in register depending on literal "LL_ADC_INJ_RANK_x". */
Kojto 122:f9eeca106725 4506 /* Parameters "Rankx_Channel" and "LL_ADC_INJ_RANK_x" are used with masks */
Kojto 122:f9eeca106725 4507 /* because containing other bits reserved for other purpose. */
Kojto 122:f9eeca106725 4508 /* If parameter "TriggerSource" is set to SW start, then parameter */
Kojto 122:f9eeca106725 4509 /* "ExternalTriggerEdge" is discarded. */
Kojto 122:f9eeca106725 4510 MODIFY_REG(ADCx->JSQR ,
Kojto 122:f9eeca106725 4511 ADC_JSQR_JEXTSEL |
Kojto 122:f9eeca106725 4512 ADC_JSQR_JEXTEN |
Kojto 122:f9eeca106725 4513 ADC_JSQR_JSQ4 |
Kojto 122:f9eeca106725 4514 ADC_JSQR_JSQ3 |
Kojto 122:f9eeca106725 4515 ADC_JSQR_JSQ2 |
Kojto 122:f9eeca106725 4516 ADC_JSQR_JSQ1 |
Kojto 122:f9eeca106725 4517 ADC_JSQR_JL ,
Kojto 122:f9eeca106725 4518 TriggerSource |
Kojto 122:f9eeca106725 4519 (ExternalTriggerEdge * ((TriggerSource != LL_ADC_INJ_TRIG_SOFTWARE))) |
Kojto 122:f9eeca106725 4520 ((Rank4_Channel & ADC_CHANNEL_ID_NUMBER_MASK) >> (ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS - (LL_ADC_INJ_RANK_4 & ADC_INJ_RANK_ID_JSQR_MASK))) |
Kojto 122:f9eeca106725 4521 ((Rank3_Channel & ADC_CHANNEL_ID_NUMBER_MASK) >> (ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS - (LL_ADC_INJ_RANK_3 & ADC_INJ_RANK_ID_JSQR_MASK))) |
Kojto 122:f9eeca106725 4522 ((Rank2_Channel & ADC_CHANNEL_ID_NUMBER_MASK) >> (ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS - (LL_ADC_INJ_RANK_2 & ADC_INJ_RANK_ID_JSQR_MASK))) |
Kojto 122:f9eeca106725 4523 ((Rank1_Channel & ADC_CHANNEL_ID_NUMBER_MASK) >> (ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS - (LL_ADC_INJ_RANK_1 & ADC_INJ_RANK_ID_JSQR_MASK))) |
Kojto 122:f9eeca106725 4524 SequencerNbRanks
Kojto 122:f9eeca106725 4525 );
Kojto 122:f9eeca106725 4526 }
Kojto 122:f9eeca106725 4527
Kojto 122:f9eeca106725 4528 /**
Kojto 122:f9eeca106725 4529 * @}
Kojto 122:f9eeca106725 4530 */
Kojto 122:f9eeca106725 4531
Kojto 122:f9eeca106725 4532 /** @defgroup ADC_LL_EF_Configuration_Channels Configuration of ADC hierarchical scope: channels
Kojto 122:f9eeca106725 4533 * @{
Kojto 122:f9eeca106725 4534 */
Kojto 122:f9eeca106725 4535
Kojto 122:f9eeca106725 4536 /**
Kojto 122:f9eeca106725 4537 * @brief Set sampling time of the selected ADC channel
Kojto 122:f9eeca106725 4538 * Unit: ADC clock cycles.
Kojto 122:f9eeca106725 4539 * @note On this device, sampling time is on channel scope: independently
Kojto 122:f9eeca106725 4540 * of channel mapped on ADC group regular or injected.
Kojto 122:f9eeca106725 4541 * @note In case of internal channel (VrefInt, TempSensor, ...) to be
Kojto 122:f9eeca106725 4542 * converted:
Kojto 122:f9eeca106725 4543 * sampling time constraints must be respected (sampling time can be
Kojto 122:f9eeca106725 4544 * adjusted in function of ADC clock frequency and sampling time
Kojto 122:f9eeca106725 4545 * setting).
Kojto 122:f9eeca106725 4546 * Refer to device datasheet for timings values (parameters TS_vrefint,
Kojto 122:f9eeca106725 4547 * TS_temp, ...).
Kojto 122:f9eeca106725 4548 * @note Conversion time is the addition of sampling time and processing time.
Kojto 122:f9eeca106725 4549 * On this STM32 serie, ADC processing time is:
Kojto 122:f9eeca106725 4550 * - 12.5 ADC clock cycles at ADC resolution 12 bits
Kojto 122:f9eeca106725 4551 * - 10.5 ADC clock cycles at ADC resolution 10 bits
Kojto 122:f9eeca106725 4552 * - 8.5 ADC clock cycles at ADC resolution 8 bits
Kojto 122:f9eeca106725 4553 * - 6.5 ADC clock cycles at ADC resolution 6 bits
Kojto 122:f9eeca106725 4554 * @note In case of ADC conversion of internal channel (VrefInt,
Kojto 122:f9eeca106725 4555 * temperature sensor, ...), a sampling time minimum value
Kojto 122:f9eeca106725 4556 * is required.
Kojto 122:f9eeca106725 4557 * Refer to device datasheet.
Kojto 122:f9eeca106725 4558 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 4559 * ADC state:
Kojto 122:f9eeca106725 4560 * ADC must be disabled or enabled without conversion on going
Kojto 122:f9eeca106725 4561 * on either groups regular or injected.
Kojto 122:f9eeca106725 4562 * @rmtoll SMPR1 SMP0 LL_ADC_SetChannelSamplingTime\n
Kojto 122:f9eeca106725 4563 * SMPR1 SMP1 LL_ADC_SetChannelSamplingTime\n
Kojto 122:f9eeca106725 4564 * SMPR1 SMP2 LL_ADC_SetChannelSamplingTime\n
Kojto 122:f9eeca106725 4565 * SMPR1 SMP3 LL_ADC_SetChannelSamplingTime\n
Kojto 122:f9eeca106725 4566 * SMPR1 SMP4 LL_ADC_SetChannelSamplingTime\n
Kojto 122:f9eeca106725 4567 * SMPR1 SMP5 LL_ADC_SetChannelSamplingTime\n
Kojto 122:f9eeca106725 4568 * SMPR1 SMP6 LL_ADC_SetChannelSamplingTime\n
Kojto 122:f9eeca106725 4569 * SMPR1 SMP7 LL_ADC_SetChannelSamplingTime\n
Kojto 122:f9eeca106725 4570 * SMPR1 SMP8 LL_ADC_SetChannelSamplingTime\n
Kojto 122:f9eeca106725 4571 * SMPR1 SMP9 LL_ADC_SetChannelSamplingTime\n
Kojto 122:f9eeca106725 4572 * SMPR2 SMP10 LL_ADC_SetChannelSamplingTime\n
Kojto 122:f9eeca106725 4573 * SMPR2 SMP11 LL_ADC_SetChannelSamplingTime\n
Kojto 122:f9eeca106725 4574 * SMPR2 SMP12 LL_ADC_SetChannelSamplingTime\n
Kojto 122:f9eeca106725 4575 * SMPR2 SMP13 LL_ADC_SetChannelSamplingTime\n
Kojto 122:f9eeca106725 4576 * SMPR2 SMP14 LL_ADC_SetChannelSamplingTime\n
Kojto 122:f9eeca106725 4577 * SMPR2 SMP15 LL_ADC_SetChannelSamplingTime\n
Kojto 122:f9eeca106725 4578 * SMPR2 SMP16 LL_ADC_SetChannelSamplingTime\n
Kojto 122:f9eeca106725 4579 * SMPR2 SMP17 LL_ADC_SetChannelSamplingTime\n
Kojto 122:f9eeca106725 4580 * SMPR2 SMP18 LL_ADC_SetChannelSamplingTime
Kojto 122:f9eeca106725 4581 * @param ADCx ADC instance
Kojto 122:f9eeca106725 4582 * @param Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 4583 * @arg @ref LL_ADC_CHANNEL_0
Kojto 122:f9eeca106725 4584 * @arg @ref LL_ADC_CHANNEL_1 (7)
Kojto 122:f9eeca106725 4585 * @arg @ref LL_ADC_CHANNEL_2 (7)
Kojto 122:f9eeca106725 4586 * @arg @ref LL_ADC_CHANNEL_3 (7)
Kojto 122:f9eeca106725 4587 * @arg @ref LL_ADC_CHANNEL_4 (7)
Kojto 122:f9eeca106725 4588 * @arg @ref LL_ADC_CHANNEL_5 (7)
Kojto 122:f9eeca106725 4589 * @arg @ref LL_ADC_CHANNEL_6
Kojto 122:f9eeca106725 4590 * @arg @ref LL_ADC_CHANNEL_7
Kojto 122:f9eeca106725 4591 * @arg @ref LL_ADC_CHANNEL_8
Kojto 122:f9eeca106725 4592 * @arg @ref LL_ADC_CHANNEL_9
Kojto 122:f9eeca106725 4593 * @arg @ref LL_ADC_CHANNEL_10
Kojto 122:f9eeca106725 4594 * @arg @ref LL_ADC_CHANNEL_11
Kojto 122:f9eeca106725 4595 * @arg @ref LL_ADC_CHANNEL_12
Kojto 122:f9eeca106725 4596 * @arg @ref LL_ADC_CHANNEL_13
Kojto 122:f9eeca106725 4597 * @arg @ref LL_ADC_CHANNEL_14
Kojto 122:f9eeca106725 4598 * @arg @ref LL_ADC_CHANNEL_15
Kojto 122:f9eeca106725 4599 * @arg @ref LL_ADC_CHANNEL_16
Kojto 122:f9eeca106725 4600 * @arg @ref LL_ADC_CHANNEL_17
Kojto 122:f9eeca106725 4601 * @arg @ref LL_ADC_CHANNEL_18
Kojto 122:f9eeca106725 4602 * @arg @ref LL_ADC_CHANNEL_VREFINT (1)
Kojto 122:f9eeca106725 4603 * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR (4)
Kojto 122:f9eeca106725 4604 * @arg @ref LL_ADC_CHANNEL_VBAT (4)
Kojto 122:f9eeca106725 4605 * @arg @ref LL_ADC_CHANNEL_DAC1CH1 (5)
Kojto 122:f9eeca106725 4606 * @arg @ref LL_ADC_CHANNEL_DAC1CH2 (5)
Kojto 122:f9eeca106725 4607 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)(6)
Kojto 122:f9eeca106725 4608 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)(6)
Kojto 122:f9eeca106725 4609 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC3 (3)(6)
Kojto 122:f9eeca106725 4610 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC3 (3)(6)
Kojto 122:f9eeca106725 4611 *
Kojto 122:f9eeca106725 4612 * (1) On STM32L4, parameter available only on ADC instance: ADC1.\n
Kojto 122:f9eeca106725 4613 * (2) On STM32L4, parameter available only on ADC instance: ADC2.\n
Kojto 122:f9eeca106725 4614 * (3) On STM32L4, parameter available only on ADC instance: ADC3.\n
Kojto 122:f9eeca106725 4615 * (4) On STM32L4, parameter available only on ADC instances: ADC1, ADC3.\n
Kojto 122:f9eeca106725 4616 * (5) On STM32L4, parameter available on devices with only 1 ADC instance.\n
Kojto 122:f9eeca106725 4617 * (6) On STM32L4, parameter available on devices with several ADC instances.\n
Kojto 122:f9eeca106725 4618 * (7) On STM32L4, fast channel (0.188 us for 12-bit resolution (ADC conversion rate up to 5.33 Ms/s)).
Kojto 122:f9eeca106725 4619 * Other channels are slow channels (0.238 us for 12-bit resolution (ADC conversion rate up to 4.21 Ms/s)).
Kojto 122:f9eeca106725 4620 * @param SamplingTime This parameter can be one of the following values:
AnnaBridge 145:64910690c574 4621 * @arg @ref LL_ADC_SAMPLINGTIME_2CYCLES_5 (1)
Kojto 122:f9eeca106725 4622 * @arg @ref LL_ADC_SAMPLINGTIME_6CYCLES_5
Kojto 122:f9eeca106725 4623 * @arg @ref LL_ADC_SAMPLINGTIME_12CYCLES_5
Kojto 122:f9eeca106725 4624 * @arg @ref LL_ADC_SAMPLINGTIME_24CYCLES_5
Kojto 122:f9eeca106725 4625 * @arg @ref LL_ADC_SAMPLINGTIME_47CYCLES_5
Kojto 122:f9eeca106725 4626 * @arg @ref LL_ADC_SAMPLINGTIME_92CYCLES_5
Kojto 122:f9eeca106725 4627 * @arg @ref LL_ADC_SAMPLINGTIME_247CYCLES_5
Kojto 122:f9eeca106725 4628 * @arg @ref LL_ADC_SAMPLINGTIME_640CYCLES_5
AnnaBridge 145:64910690c574 4629 *
AnnaBridge 145:64910690c574 4630 * (1) On some devices, ADC sampling time 2.5 ADC clock cycles
AnnaBridge 145:64910690c574 4631 * can be replaced by 3.5 ADC clock cycles.
AnnaBridge 145:64910690c574 4632 * Refer to function @ref LL_ADC_SetSamplingTimeCommonConfig().
Kojto 122:f9eeca106725 4633 * @retval None
Kojto 122:f9eeca106725 4634 */
Kojto 122:f9eeca106725 4635 __STATIC_INLINE void LL_ADC_SetChannelSamplingTime(ADC_TypeDef *ADCx, uint32_t Channel, uint32_t SamplingTime)
Kojto 122:f9eeca106725 4636 {
Kojto 122:f9eeca106725 4637 /* Set bits with content of parameter "SamplingTime" with bits position */
Kojto 122:f9eeca106725 4638 /* in register and register position depending on parameter "Channel". */
Kojto 122:f9eeca106725 4639 /* Parameter "Channel" is used with masks because containing */
Kojto 122:f9eeca106725 4640 /* other bits reserved for other purpose. */
Kojto 122:f9eeca106725 4641 register uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->SMPR1, __ADC_MASK_SHIFT(Channel, ADC_CHANNEL_SMPRX_REGOFFSET_MASK));
Kojto 122:f9eeca106725 4642
Kojto 122:f9eeca106725 4643 MODIFY_REG(*preg,
Kojto 122:f9eeca106725 4644 ADC_SMPR1_SMP0 << __ADC_MASK_SHIFT(Channel, ADC_CHANNEL_SMPx_BITOFFSET_MASK),
Kojto 122:f9eeca106725 4645 SamplingTime << __ADC_MASK_SHIFT(Channel, ADC_CHANNEL_SMPx_BITOFFSET_MASK));
Kojto 122:f9eeca106725 4646 }
Kojto 122:f9eeca106725 4647
Kojto 122:f9eeca106725 4648 /**
Kojto 122:f9eeca106725 4649 * @brief Get sampling time of the selected ADC channel
Kojto 122:f9eeca106725 4650 * Unit: ADC clock cycles.
Kojto 122:f9eeca106725 4651 * @note On this device, sampling time is on channel scope: independently
Kojto 122:f9eeca106725 4652 * of channel mapped on ADC group regular or injected.
Kojto 122:f9eeca106725 4653 * @note Conversion time is the addition of sampling time and processing time.
Kojto 122:f9eeca106725 4654 * On this STM32 serie, ADC processing time is:
Kojto 122:f9eeca106725 4655 * - 12.5 ADC clock cycles at ADC resolution 12 bits
Kojto 122:f9eeca106725 4656 * - 10.5 ADC clock cycles at ADC resolution 10 bits
Kojto 122:f9eeca106725 4657 * - 8.5 ADC clock cycles at ADC resolution 8 bits
Kojto 122:f9eeca106725 4658 * - 6.5 ADC clock cycles at ADC resolution 6 bits
Kojto 122:f9eeca106725 4659 * @rmtoll SMPR1 SMP0 LL_ADC_GetChannelSamplingTime\n
Kojto 122:f9eeca106725 4660 * SMPR1 SMP1 LL_ADC_GetChannelSamplingTime\n
Kojto 122:f9eeca106725 4661 * SMPR1 SMP2 LL_ADC_GetChannelSamplingTime\n
Kojto 122:f9eeca106725 4662 * SMPR1 SMP3 LL_ADC_GetChannelSamplingTime\n
Kojto 122:f9eeca106725 4663 * SMPR1 SMP4 LL_ADC_GetChannelSamplingTime\n
Kojto 122:f9eeca106725 4664 * SMPR1 SMP5 LL_ADC_GetChannelSamplingTime\n
Kojto 122:f9eeca106725 4665 * SMPR1 SMP6 LL_ADC_GetChannelSamplingTime\n
Kojto 122:f9eeca106725 4666 * SMPR1 SMP7 LL_ADC_GetChannelSamplingTime\n
Kojto 122:f9eeca106725 4667 * SMPR1 SMP8 LL_ADC_GetChannelSamplingTime\n
Kojto 122:f9eeca106725 4668 * SMPR1 SMP9 LL_ADC_GetChannelSamplingTime\n
Kojto 122:f9eeca106725 4669 * SMPR2 SMP10 LL_ADC_GetChannelSamplingTime\n
Kojto 122:f9eeca106725 4670 * SMPR2 SMP11 LL_ADC_GetChannelSamplingTime\n
Kojto 122:f9eeca106725 4671 * SMPR2 SMP12 LL_ADC_GetChannelSamplingTime\n
Kojto 122:f9eeca106725 4672 * SMPR2 SMP13 LL_ADC_GetChannelSamplingTime\n
Kojto 122:f9eeca106725 4673 * SMPR2 SMP14 LL_ADC_GetChannelSamplingTime\n
Kojto 122:f9eeca106725 4674 * SMPR2 SMP15 LL_ADC_GetChannelSamplingTime\n
Kojto 122:f9eeca106725 4675 * SMPR2 SMP16 LL_ADC_GetChannelSamplingTime\n
Kojto 122:f9eeca106725 4676 * SMPR2 SMP17 LL_ADC_GetChannelSamplingTime\n
Kojto 122:f9eeca106725 4677 * SMPR2 SMP18 LL_ADC_GetChannelSamplingTime
Kojto 122:f9eeca106725 4678 * @param ADCx ADC instance
Kojto 122:f9eeca106725 4679 * @param Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 4680 * @arg @ref LL_ADC_CHANNEL_0
Kojto 122:f9eeca106725 4681 * @arg @ref LL_ADC_CHANNEL_1 (7)
Kojto 122:f9eeca106725 4682 * @arg @ref LL_ADC_CHANNEL_2 (7)
Kojto 122:f9eeca106725 4683 * @arg @ref LL_ADC_CHANNEL_3 (7)
Kojto 122:f9eeca106725 4684 * @arg @ref LL_ADC_CHANNEL_4 (7)
Kojto 122:f9eeca106725 4685 * @arg @ref LL_ADC_CHANNEL_5 (7)
Kojto 122:f9eeca106725 4686 * @arg @ref LL_ADC_CHANNEL_6
Kojto 122:f9eeca106725 4687 * @arg @ref LL_ADC_CHANNEL_7
Kojto 122:f9eeca106725 4688 * @arg @ref LL_ADC_CHANNEL_8
Kojto 122:f9eeca106725 4689 * @arg @ref LL_ADC_CHANNEL_9
Kojto 122:f9eeca106725 4690 * @arg @ref LL_ADC_CHANNEL_10
Kojto 122:f9eeca106725 4691 * @arg @ref LL_ADC_CHANNEL_11
Kojto 122:f9eeca106725 4692 * @arg @ref LL_ADC_CHANNEL_12
Kojto 122:f9eeca106725 4693 * @arg @ref LL_ADC_CHANNEL_13
Kojto 122:f9eeca106725 4694 * @arg @ref LL_ADC_CHANNEL_14
Kojto 122:f9eeca106725 4695 * @arg @ref LL_ADC_CHANNEL_15
Kojto 122:f9eeca106725 4696 * @arg @ref LL_ADC_CHANNEL_16
Kojto 122:f9eeca106725 4697 * @arg @ref LL_ADC_CHANNEL_17
Kojto 122:f9eeca106725 4698 * @arg @ref LL_ADC_CHANNEL_18
Kojto 122:f9eeca106725 4699 * @arg @ref LL_ADC_CHANNEL_VREFINT (1)
Kojto 122:f9eeca106725 4700 * @arg @ref LL_ADC_CHANNEL_TEMPSENSOR (4)
Kojto 122:f9eeca106725 4701 * @arg @ref LL_ADC_CHANNEL_VBAT (4)
Kojto 122:f9eeca106725 4702 * @arg @ref LL_ADC_CHANNEL_DAC1CH1 (5)
Kojto 122:f9eeca106725 4703 * @arg @ref LL_ADC_CHANNEL_DAC1CH2 (5)
Kojto 122:f9eeca106725 4704 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)(6)
Kojto 122:f9eeca106725 4705 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)(6)
Kojto 122:f9eeca106725 4706 * @arg @ref LL_ADC_CHANNEL_DAC1CH1_ADC3 (3)(6)
Kojto 122:f9eeca106725 4707 * @arg @ref LL_ADC_CHANNEL_DAC1CH2_ADC3 (3)(6)
Kojto 122:f9eeca106725 4708 *
Kojto 122:f9eeca106725 4709 * (1) On STM32L4, parameter available only on ADC instance: ADC1.\n
Kojto 122:f9eeca106725 4710 * (2) On STM32L4, parameter available only on ADC instance: ADC2.\n
Kojto 122:f9eeca106725 4711 * (3) On STM32L4, parameter available only on ADC instance: ADC3.\n
Kojto 122:f9eeca106725 4712 * (4) On STM32L4, parameter available only on ADC instances: ADC1, ADC3.\n
Kojto 122:f9eeca106725 4713 * (5) On STM32L4, parameter available on devices with only 1 ADC instance.\n
Kojto 122:f9eeca106725 4714 * (6) On STM32L4, parameter available on devices with several ADC instances.\n
Kojto 122:f9eeca106725 4715 * (7) On STM32L4, fast channel (0.188 us for 12-bit resolution (ADC conversion rate up to 5.33 Ms/s)).
Kojto 122:f9eeca106725 4716 * Other channels are slow channels (0.238 us for 12-bit resolution (ADC conversion rate up to 4.21 Ms/s)).
Kojto 122:f9eeca106725 4717 * @retval Returned value can be one of the following values:
AnnaBridge 145:64910690c574 4718 * @arg @ref LL_ADC_SAMPLINGTIME_2CYCLES_5 (1)
Kojto 122:f9eeca106725 4719 * @arg @ref LL_ADC_SAMPLINGTIME_6CYCLES_5
Kojto 122:f9eeca106725 4720 * @arg @ref LL_ADC_SAMPLINGTIME_12CYCLES_5
Kojto 122:f9eeca106725 4721 * @arg @ref LL_ADC_SAMPLINGTIME_24CYCLES_5
Kojto 122:f9eeca106725 4722 * @arg @ref LL_ADC_SAMPLINGTIME_47CYCLES_5
Kojto 122:f9eeca106725 4723 * @arg @ref LL_ADC_SAMPLINGTIME_92CYCLES_5
Kojto 122:f9eeca106725 4724 * @arg @ref LL_ADC_SAMPLINGTIME_247CYCLES_5
Kojto 122:f9eeca106725 4725 * @arg @ref LL_ADC_SAMPLINGTIME_640CYCLES_5
AnnaBridge 145:64910690c574 4726 *
AnnaBridge 145:64910690c574 4727 * (1) On some devices, ADC sampling time 2.5 ADC clock cycles
AnnaBridge 145:64910690c574 4728 * can be replaced by 3.5 ADC clock cycles.
AnnaBridge 145:64910690c574 4729 * Refer to function @ref LL_ADC_SetSamplingTimeCommonConfig().
Kojto 122:f9eeca106725 4730 */
Kojto 122:f9eeca106725 4731 __STATIC_INLINE uint32_t LL_ADC_GetChannelSamplingTime(ADC_TypeDef *ADCx, uint32_t Channel)
Kojto 122:f9eeca106725 4732 {
Kojto 122:f9eeca106725 4733 register uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->SMPR1, __ADC_MASK_SHIFT(Channel, ADC_CHANNEL_SMPRX_REGOFFSET_MASK));
Kojto 122:f9eeca106725 4734
Kojto 122:f9eeca106725 4735 return (uint32_t)(READ_BIT(*preg,
Kojto 122:f9eeca106725 4736 ADC_SMPR1_SMP0 << __ADC_MASK_SHIFT(Channel, ADC_CHANNEL_SMPx_BITOFFSET_MASK))
Kojto 122:f9eeca106725 4737 >> __ADC_MASK_SHIFT(Channel, ADC_CHANNEL_SMPx_BITOFFSET_MASK)
Kojto 122:f9eeca106725 4738 );
Kojto 122:f9eeca106725 4739 }
Kojto 122:f9eeca106725 4740
Kojto 122:f9eeca106725 4741 /**
Kojto 122:f9eeca106725 4742 * @brief Set mode single-ended or differential input of the selected
Kojto 122:f9eeca106725 4743 * ADC channel.
Kojto 122:f9eeca106725 4744 * @note Channel ending is on channel scope: independently of channel mapped
Kojto 122:f9eeca106725 4745 * on ADC group regular or injected.
Kojto 122:f9eeca106725 4746 * In differential mode: Differential measurement is carried out
Kojto 122:f9eeca106725 4747 * between the selected channel 'i' (positive input) and
Kojto 122:f9eeca106725 4748 * channel 'i+1' (negative input). Only channel 'i' has to be
Kojto 122:f9eeca106725 4749 * configured, channel 'i+1' is configured automatically.
Kojto 122:f9eeca106725 4750 * @note Refer to Reference Manual to ensure the selected channel is
Kojto 122:f9eeca106725 4751 * available in differential mode.
Kojto 122:f9eeca106725 4752 * For example, internal channels (VrefInt, TempSensor, ...) are
Kojto 122:f9eeca106725 4753 * not available in differential mode.
Kojto 122:f9eeca106725 4754 * @note When configuring a channel 'i' in differential mode,
Kojto 122:f9eeca106725 4755 * the channel 'i+1' is not usable separately.
Kojto 122:f9eeca106725 4756 * @note On STM32L4, channels 15, 16, 17, 18 of ADC1, ADC2, ADC3 (if available)
Kojto 122:f9eeca106725 4757 * are internally fixed to single-ended inputs configuration.
Kojto 122:f9eeca106725 4758 * @note For ADC channels configured in differential mode, both inputs
Kojto 122:f9eeca106725 4759 * should be biased at (Vref+)/2 +/-200mV.
Kojto 122:f9eeca106725 4760 * (Vref+ is the analog voltage reference)
Kojto 122:f9eeca106725 4761 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 4762 * ADC state:
Kojto 122:f9eeca106725 4763 * ADC must be ADC disabled.
Kojto 122:f9eeca106725 4764 * @note One or several values can be selected.
Kojto 122:f9eeca106725 4765 * Example: (LL_ADC_CHANNEL_4 | LL_ADC_CHANNEL_12 | ...)
Kojto 122:f9eeca106725 4766 * @rmtoll DIFSEL DIFSEL LL_ADC_GetChannelSamplingTime
Kojto 122:f9eeca106725 4767 * @param ADCx ADC instance
Kojto 122:f9eeca106725 4768 * @param Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 4769 * @arg @ref LL_ADC_CHANNEL_1
Kojto 122:f9eeca106725 4770 * @arg @ref LL_ADC_CHANNEL_2
Kojto 122:f9eeca106725 4771 * @arg @ref LL_ADC_CHANNEL_3
Kojto 122:f9eeca106725 4772 * @arg @ref LL_ADC_CHANNEL_4
Kojto 122:f9eeca106725 4773 * @arg @ref LL_ADC_CHANNEL_5
Kojto 122:f9eeca106725 4774 * @arg @ref LL_ADC_CHANNEL_6
Kojto 122:f9eeca106725 4775 * @arg @ref LL_ADC_CHANNEL_7
Kojto 122:f9eeca106725 4776 * @arg @ref LL_ADC_CHANNEL_8
Kojto 122:f9eeca106725 4777 * @arg @ref LL_ADC_CHANNEL_9
Kojto 122:f9eeca106725 4778 * @arg @ref LL_ADC_CHANNEL_10
Kojto 122:f9eeca106725 4779 * @arg @ref LL_ADC_CHANNEL_11
Kojto 122:f9eeca106725 4780 * @arg @ref LL_ADC_CHANNEL_12
Kojto 122:f9eeca106725 4781 * @arg @ref LL_ADC_CHANNEL_13
Kojto 122:f9eeca106725 4782 * @arg @ref LL_ADC_CHANNEL_14
Kojto 122:f9eeca106725 4783 * @param SingleDiff This parameter can be a combination of the following values:
Kojto 122:f9eeca106725 4784 * @arg @ref LL_ADC_SINGLE_ENDED
Kojto 122:f9eeca106725 4785 * @arg @ref LL_ADC_DIFFERENTIAL_ENDED
Kojto 122:f9eeca106725 4786 * @retval None
Kojto 122:f9eeca106725 4787 */
Kojto 122:f9eeca106725 4788 __STATIC_INLINE void LL_ADC_SetChannelSingleDiff(ADC_TypeDef *ADCx, uint32_t Channel, uint32_t SingleDiff)
Kojto 122:f9eeca106725 4789 {
Kojto 122:f9eeca106725 4790 /* Bits of channels in single or differential mode are set only for */
Kojto 122:f9eeca106725 4791 /* differential mode (for single mode, mask of bits allowed to be set is */
Kojto 122:f9eeca106725 4792 /* shifted out of range of bits of channels in single or differential mode. */
Kojto 122:f9eeca106725 4793 MODIFY_REG(ADCx->DIFSEL,
Kojto 122:f9eeca106725 4794 Channel & ADC_SINGLEDIFF_CHANNEL_MASK,
Kojto 122:f9eeca106725 4795 (Channel & ADC_SINGLEDIFF_CHANNEL_MASK) & (ADC_DIFSEL_DIFSEL << (SingleDiff & ADC_SINGLEDIFF_CHANNEL_SHIFT_MASK)));
Kojto 122:f9eeca106725 4796 }
Kojto 122:f9eeca106725 4797
Kojto 122:f9eeca106725 4798 /**
Kojto 122:f9eeca106725 4799 * @brief Get mode single-ended or differential input of the selected
Kojto 122:f9eeca106725 4800 * ADC channel.
Kojto 122:f9eeca106725 4801 * @note When configuring a channel 'i' in differential mode,
Kojto 122:f9eeca106725 4802 * the channel 'i+1' is not usable separately.
Kojto 122:f9eeca106725 4803 * Therefore, to ensure a channel is configured in single-ended mode,
Kojto 122:f9eeca106725 4804 * the configuration of channel itself and the channel 'i-1' must be
Kojto 122:f9eeca106725 4805 * read back (to ensure that the selected channel channel has not been
Kojto 122:f9eeca106725 4806 * configured in differential mode by the previous channel).
Kojto 122:f9eeca106725 4807 * @note Refer to Reference Manual to ensure the selected channel is
Kojto 122:f9eeca106725 4808 * available in differential mode.
Kojto 122:f9eeca106725 4809 * For example, internal channels (VrefInt, TempSensor, ...) are
Kojto 122:f9eeca106725 4810 * not available in differential mode.
Kojto 122:f9eeca106725 4811 * @note When configuring a channel 'i' in differential mode,
Kojto 122:f9eeca106725 4812 * the channel 'i+1' is not usable separately.
Kojto 122:f9eeca106725 4813 * @note On STM32L4, channels 15, 16, 17, 18 of ADC1, ADC2, ADC3 (if available)
Kojto 122:f9eeca106725 4814 * are internally fixed to single-ended inputs configuration.
Kojto 122:f9eeca106725 4815 * @note One or several values can be selected. In this case, the value
Kojto 122:f9eeca106725 4816 * returned is null if all channels are in single ended-mode.
Kojto 122:f9eeca106725 4817 * Example: (LL_ADC_CHANNEL_4 | LL_ADC_CHANNEL_12 | ...)
Kojto 122:f9eeca106725 4818 * @rmtoll DIFSEL DIFSEL LL_ADC_GetChannelSamplingTime
Kojto 122:f9eeca106725 4819 * @param ADCx ADC instance
Kojto 122:f9eeca106725 4820 * @param Channel This parameter can be a combination of the following values:
Kojto 122:f9eeca106725 4821 * @arg @ref LL_ADC_CHANNEL_0
Kojto 122:f9eeca106725 4822 * @arg @ref LL_ADC_CHANNEL_1
Kojto 122:f9eeca106725 4823 * @arg @ref LL_ADC_CHANNEL_2
Kojto 122:f9eeca106725 4824 * @arg @ref LL_ADC_CHANNEL_3
Kojto 122:f9eeca106725 4825 * @arg @ref LL_ADC_CHANNEL_4
Kojto 122:f9eeca106725 4826 * @arg @ref LL_ADC_CHANNEL_5
Kojto 122:f9eeca106725 4827 * @arg @ref LL_ADC_CHANNEL_6
Kojto 122:f9eeca106725 4828 * @arg @ref LL_ADC_CHANNEL_7
Kojto 122:f9eeca106725 4829 * @arg @ref LL_ADC_CHANNEL_8
Kojto 122:f9eeca106725 4830 * @arg @ref LL_ADC_CHANNEL_9
Kojto 122:f9eeca106725 4831 * @arg @ref LL_ADC_CHANNEL_10
Kojto 122:f9eeca106725 4832 * @arg @ref LL_ADC_CHANNEL_11
Kojto 122:f9eeca106725 4833 * @arg @ref LL_ADC_CHANNEL_12
Kojto 122:f9eeca106725 4834 * @arg @ref LL_ADC_CHANNEL_13
Kojto 122:f9eeca106725 4835 * @arg @ref LL_ADC_CHANNEL_14
Kojto 122:f9eeca106725 4836 * @retval 0: channel in single-ended mode, else: channel in differential mode
Kojto 122:f9eeca106725 4837 */
Kojto 122:f9eeca106725 4838 __STATIC_INLINE uint32_t LL_ADC_GetChannelSingleDiff(ADC_TypeDef *ADCx, uint32_t Channel)
Kojto 122:f9eeca106725 4839 {
Kojto 122:f9eeca106725 4840 return (uint32_t)(READ_BIT(ADCx->DIFSEL, (Channel & ADC_SINGLEDIFF_CHANNEL_MASK)));
Kojto 122:f9eeca106725 4841 }
Kojto 122:f9eeca106725 4842
Kojto 122:f9eeca106725 4843 /**
Kojto 122:f9eeca106725 4844 * @}
Kojto 122:f9eeca106725 4845 */
Kojto 122:f9eeca106725 4846
Kojto 122:f9eeca106725 4847 /** @defgroup ADC_LL_EF_Configuration_ADC_AnalogWatchdog Configuration of ADC transversal scope: analog watchdog
Kojto 122:f9eeca106725 4848 * @{
Kojto 122:f9eeca106725 4849 */
Kojto 122:f9eeca106725 4850
Kojto 122:f9eeca106725 4851 /**
Kojto 122:f9eeca106725 4852 * @brief Set ADC analog watchdog monitored channels:
Kojto 122:f9eeca106725 4853 * a single channel, multiple channels or all channels,
Kojto 122:f9eeca106725 4854 * on ADC groups regular and-or injected.
Kojto 122:f9eeca106725 4855 * @note Once monitored channels are selected, analog watchdog
Kojto 122:f9eeca106725 4856 * is enabled.
Kojto 122:f9eeca106725 4857 * @note In case of need to define a single channel to monitor
Kojto 122:f9eeca106725 4858 * with analog watchdog from sequencer channel definition,
Kojto 122:f9eeca106725 4859 * use helper macro @ref __LL_ADC_ANALOGWD_CHANNEL_GROUP().
Kojto 122:f9eeca106725 4860 * @note On this STM32 serie, there are 2 kinds of analog watchdog
Kojto 122:f9eeca106725 4861 * instance:
Kojto 122:f9eeca106725 4862 * - AWD standard (instance AWD1):
Kojto 122:f9eeca106725 4863 * - channels monitored: can monitor 1 channel or all channels.
Kojto 122:f9eeca106725 4864 * - groups monitored: ADC groups regular and-or injected.
Kojto 122:f9eeca106725 4865 * - resolution: resolution is not limited (corresponds to
Kojto 122:f9eeca106725 4866 * ADC resolution configured).
Kojto 122:f9eeca106725 4867 * - AWD flexible (instances AWD2, AWD3):
Kojto 122:f9eeca106725 4868 * - channels monitored: flexible on channels monitored, selection is
Kojto 122:f9eeca106725 4869 * channel wise, from from 1 to all channels.
Kojto 122:f9eeca106725 4870 * Specificity of this analog watchdog: Multiple channels can
Kojto 122:f9eeca106725 4871 * be selected. For example:
Kojto 122:f9eeca106725 4872 * (LL_ADC_AWD_CHANNEL4_REG_INJ | LL_ADC_AWD_CHANNEL5_REG_INJ | ...)
Kojto 122:f9eeca106725 4873 * - groups monitored: not selection possible (monitoring on both
Kojto 122:f9eeca106725 4874 * groups regular and injected).
Kojto 122:f9eeca106725 4875 * Channels selected are monitored on groups regular and injected:
Kojto 122:f9eeca106725 4876 * LL_ADC_AWD_CHANNELxx_REG_INJ (do not use parameters
Kojto 122:f9eeca106725 4877 * LL_ADC_AWD_CHANNELxx_REG and LL_ADC_AWD_CHANNELxx_INJ)
Kojto 122:f9eeca106725 4878 * - resolution: resolution is limited to 8 bits: if ADC resolution is
Kojto 122:f9eeca106725 4879 * 12 bits the 4 LSB are ignored, if ADC resolution is 10 bits
Kojto 122:f9eeca106725 4880 * the 2 LSB are ignored.
Kojto 122:f9eeca106725 4881 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 4882 * ADC state:
Kojto 122:f9eeca106725 4883 * ADC must be disabled or enabled without conversion on going
Kojto 122:f9eeca106725 4884 * on either groups regular or injected.
Kojto 122:f9eeca106725 4885 * @rmtoll CFGR AWD1CH LL_ADC_SetAnalogWDMonitChannels\n
Kojto 122:f9eeca106725 4886 * CFGR AWD1SGL LL_ADC_SetAnalogWDMonitChannels\n
Kojto 122:f9eeca106725 4887 * CFGR AWD1EN LL_ADC_SetAnalogWDMonitChannels\n
Kojto 122:f9eeca106725 4888 * CFGR JAWD1EN LL_ADC_SetAnalogWDMonitChannels\n
Kojto 122:f9eeca106725 4889 * AWD2CR AWD2CH LL_ADC_SetAnalogWDMonitChannels\n
Kojto 122:f9eeca106725 4890 * AWD3CR AWD3CH LL_ADC_SetAnalogWDMonitChannels
Kojto 122:f9eeca106725 4891 * @param ADCx ADC instance
Kojto 122:f9eeca106725 4892 * @param AWDy This parameter can be one of the following values:
Kojto 122:f9eeca106725 4893 * @arg @ref LL_ADC_AWD1
Kojto 122:f9eeca106725 4894 * @arg @ref LL_ADC_AWD2
Kojto 122:f9eeca106725 4895 * @arg @ref LL_ADC_AWD3
Kojto 122:f9eeca106725 4896 * @param AWDChannelGroup This parameter can be one of the following values:
Kojto 122:f9eeca106725 4897 * @arg @ref LL_ADC_AWD_DISABLE
Kojto 122:f9eeca106725 4898 * @arg @ref LL_ADC_AWD_ALL_CHANNELS_REG (0)
Kojto 122:f9eeca106725 4899 * @arg @ref LL_ADC_AWD_ALL_CHANNELS_INJ (0)
Kojto 122:f9eeca106725 4900 * @arg @ref LL_ADC_AWD_ALL_CHANNELS_REG_INJ
Kojto 122:f9eeca106725 4901 * @arg @ref LL_ADC_AWD_CHANNEL_0_REG (0)
Kojto 122:f9eeca106725 4902 * @arg @ref LL_ADC_AWD_CHANNEL_0_INJ (0)
Kojto 122:f9eeca106725 4903 * @arg @ref LL_ADC_AWD_CHANNEL_0_REG_INJ
Kojto 122:f9eeca106725 4904 * @arg @ref LL_ADC_AWD_CHANNEL_1_REG (0)
Kojto 122:f9eeca106725 4905 * @arg @ref LL_ADC_AWD_CHANNEL_1_INJ (0)
Kojto 122:f9eeca106725 4906 * @arg @ref LL_ADC_AWD_CHANNEL_1_REG_INJ
Kojto 122:f9eeca106725 4907 * @arg @ref LL_ADC_AWD_CHANNEL_2_REG (0)
Kojto 122:f9eeca106725 4908 * @arg @ref LL_ADC_AWD_CHANNEL_2_INJ (0)
Kojto 122:f9eeca106725 4909 * @arg @ref LL_ADC_AWD_CHANNEL_2_REG_INJ
Kojto 122:f9eeca106725 4910 * @arg @ref LL_ADC_AWD_CHANNEL_3_REG (0)
Kojto 122:f9eeca106725 4911 * @arg @ref LL_ADC_AWD_CHANNEL_3_INJ (0)
Kojto 122:f9eeca106725 4912 * @arg @ref LL_ADC_AWD_CHANNEL_3_REG_INJ
Kojto 122:f9eeca106725 4913 * @arg @ref LL_ADC_AWD_CHANNEL_4_REG (0)
Kojto 122:f9eeca106725 4914 * @arg @ref LL_ADC_AWD_CHANNEL_4_INJ (0)
Kojto 122:f9eeca106725 4915 * @arg @ref LL_ADC_AWD_CHANNEL_4_REG_INJ
Kojto 122:f9eeca106725 4916 * @arg @ref LL_ADC_AWD_CHANNEL_5_REG (0)
Kojto 122:f9eeca106725 4917 * @arg @ref LL_ADC_AWD_CHANNEL_5_INJ (0)
Kojto 122:f9eeca106725 4918 * @arg @ref LL_ADC_AWD_CHANNEL_5_REG_INJ
Kojto 122:f9eeca106725 4919 * @arg @ref LL_ADC_AWD_CHANNEL_6_REG (0)
Kojto 122:f9eeca106725 4920 * @arg @ref LL_ADC_AWD_CHANNEL_6_INJ (0)
Kojto 122:f9eeca106725 4921 * @arg @ref LL_ADC_AWD_CHANNEL_6_REG_INJ
Kojto 122:f9eeca106725 4922 * @arg @ref LL_ADC_AWD_CHANNEL_7_REG (0)
Kojto 122:f9eeca106725 4923 * @arg @ref LL_ADC_AWD_CHANNEL_7_INJ (0)
Kojto 122:f9eeca106725 4924 * @arg @ref LL_ADC_AWD_CHANNEL_7_REG_INJ
Kojto 122:f9eeca106725 4925 * @arg @ref LL_ADC_AWD_CHANNEL_8_REG (0)
Kojto 122:f9eeca106725 4926 * @arg @ref LL_ADC_AWD_CHANNEL_8_INJ (0)
Kojto 122:f9eeca106725 4927 * @arg @ref LL_ADC_AWD_CHANNEL_8_REG_INJ
Kojto 122:f9eeca106725 4928 * @arg @ref LL_ADC_AWD_CHANNEL_9_REG (0)
Kojto 122:f9eeca106725 4929 * @arg @ref LL_ADC_AWD_CHANNEL_9_INJ (0)
Kojto 122:f9eeca106725 4930 * @arg @ref LL_ADC_AWD_CHANNEL_9_REG_INJ
Kojto 122:f9eeca106725 4931 * @arg @ref LL_ADC_AWD_CHANNEL_10_REG (0)
Kojto 122:f9eeca106725 4932 * @arg @ref LL_ADC_AWD_CHANNEL_10_INJ (0)
Kojto 122:f9eeca106725 4933 * @arg @ref LL_ADC_AWD_CHANNEL_10_REG_INJ
Kojto 122:f9eeca106725 4934 * @arg @ref LL_ADC_AWD_CHANNEL_11_REG (0)
Kojto 122:f9eeca106725 4935 * @arg @ref LL_ADC_AWD_CHANNEL_11_INJ (0)
Kojto 122:f9eeca106725 4936 * @arg @ref LL_ADC_AWD_CHANNEL_11_REG_INJ
Kojto 122:f9eeca106725 4937 * @arg @ref LL_ADC_AWD_CHANNEL_12_REG (0)
Kojto 122:f9eeca106725 4938 * @arg @ref LL_ADC_AWD_CHANNEL_12_INJ (0)
Kojto 122:f9eeca106725 4939 * @arg @ref LL_ADC_AWD_CHANNEL_12_REG_INJ
Kojto 122:f9eeca106725 4940 * @arg @ref LL_ADC_AWD_CHANNEL_13_REG (0)
Kojto 122:f9eeca106725 4941 * @arg @ref LL_ADC_AWD_CHANNEL_13_INJ (0)
Kojto 122:f9eeca106725 4942 * @arg @ref LL_ADC_AWD_CHANNEL_13_REG_INJ
Kojto 122:f9eeca106725 4943 * @arg @ref LL_ADC_AWD_CHANNEL_14_REG (0)
Kojto 122:f9eeca106725 4944 * @arg @ref LL_ADC_AWD_CHANNEL_14_INJ (0)
Kojto 122:f9eeca106725 4945 * @arg @ref LL_ADC_AWD_CHANNEL_14_REG_INJ
Kojto 122:f9eeca106725 4946 * @arg @ref LL_ADC_AWD_CHANNEL_15_REG (0)
Kojto 122:f9eeca106725 4947 * @arg @ref LL_ADC_AWD_CHANNEL_15_INJ (0)
Kojto 122:f9eeca106725 4948 * @arg @ref LL_ADC_AWD_CHANNEL_15_REG_INJ
Kojto 122:f9eeca106725 4949 * @arg @ref LL_ADC_AWD_CHANNEL_16_REG (0)
Kojto 122:f9eeca106725 4950 * @arg @ref LL_ADC_AWD_CHANNEL_16_INJ (0)
Kojto 122:f9eeca106725 4951 * @arg @ref LL_ADC_AWD_CHANNEL_16_REG_INJ
Kojto 122:f9eeca106725 4952 * @arg @ref LL_ADC_AWD_CHANNEL_17_REG (0)
Kojto 122:f9eeca106725 4953 * @arg @ref LL_ADC_AWD_CHANNEL_17_INJ (0)
Kojto 122:f9eeca106725 4954 * @arg @ref LL_ADC_AWD_CHANNEL_17_REG_INJ
Kojto 122:f9eeca106725 4955 * @arg @ref LL_ADC_AWD_CHANNEL_18_REG (0)
Kojto 122:f9eeca106725 4956 * @arg @ref LL_ADC_AWD_CHANNEL_18_INJ (0)
Kojto 122:f9eeca106725 4957 * @arg @ref LL_ADC_AWD_CHANNEL_18_REG_INJ
Kojto 122:f9eeca106725 4958 * @arg @ref LL_ADC_AWD_CH_VREFINT_REG (0)(1)
Kojto 122:f9eeca106725 4959 * @arg @ref LL_ADC_AWD_CH_VREFINT_INJ (0)(1)
Kojto 122:f9eeca106725 4960 * @arg @ref LL_ADC_AWD_CH_VREFINT_REG_INJ (1)
Kojto 122:f9eeca106725 4961 * @arg @ref LL_ADC_AWD_CH_TEMPSENSOR_REG (0)(4)
Kojto 122:f9eeca106725 4962 * @arg @ref LL_ADC_AWD_CH_TEMPSENSOR_INJ (0)(4)
Kojto 122:f9eeca106725 4963 * @arg @ref LL_ADC_AWD_CH_TEMPSENSOR_REG_INJ (4)
Kojto 122:f9eeca106725 4964 * @arg @ref LL_ADC_AWD_CH_VBAT_REG (0)(4)
Kojto 122:f9eeca106725 4965 * @arg @ref LL_ADC_AWD_CH_VBAT_INJ (0)(4)
Kojto 122:f9eeca106725 4966 * @arg @ref LL_ADC_AWD_CH_VBAT_REG_INJ (4)
Kojto 122:f9eeca106725 4967 * @arg @ref LL_ADC_AWD_CH_DAC1CH1_REG (0)(2)(5)
Kojto 122:f9eeca106725 4968 * @arg @ref LL_ADC_AWD_CH_DAC1CH1_INJ (0)(2)(5)
Kojto 122:f9eeca106725 4969 * @arg @ref LL_ADC_AWD_CH_DAC1CH1_REG_INJ (2)(5)
Kojto 122:f9eeca106725 4970 * @arg @ref LL_ADC_AWD_CH_DAC1CH2_REG (0)(2)(5)
Kojto 122:f9eeca106725 4971 * @arg @ref LL_ADC_AWD_CH_DAC1CH2_INJ (0)(2)(5)
Kojto 122:f9eeca106725 4972 * @arg @ref LL_ADC_AWD_CH_DAC1CH2_REG_INJ (2)(5)
Kojto 122:f9eeca106725 4973 * @arg @ref LL_ADC_AWD_CH_DAC1CH1_ADC2_REG (0)(2)(6)
Kojto 122:f9eeca106725 4974 * @arg @ref LL_ADC_AWD_CH_DAC1CH1_ADC2_INJ (0)(2)(6)
Kojto 122:f9eeca106725 4975 * @arg @ref LL_ADC_AWD_CH_DAC1CH1_ADC2_REG_INJ (2)(6)
Kojto 122:f9eeca106725 4976 * @arg @ref LL_ADC_AWD_CH_DAC1CH2_ADC2_REG (0)(2)(6)
Kojto 122:f9eeca106725 4977 * @arg @ref LL_ADC_AWD_CH_DAC1CH2_ADC2_INJ (0)(2)(6)
Kojto 122:f9eeca106725 4978 * @arg @ref LL_ADC_AWD_CH_DAC1CH2_ADC2_REG_INJ (2)(6)
Kojto 122:f9eeca106725 4979 * @arg @ref LL_ADC_AWD_CH_DAC1CH1_ADC3_REG (0)(3)(6)
Kojto 122:f9eeca106725 4980 * @arg @ref LL_ADC_AWD_CH_DAC1CH1_ADC3_INJ (0)(3)(6)
Kojto 122:f9eeca106725 4981 * @arg @ref LL_ADC_AWD_CH_DAC1CH1_ADC3_REG_INJ (3)(6)
Kojto 122:f9eeca106725 4982 * @arg @ref LL_ADC_AWD_CH_DAC1CH2_ADC3_REG (0)(3)(6)
Kojto 122:f9eeca106725 4983 * @arg @ref LL_ADC_AWD_CH_DAC1CH2_ADC3_INJ (0)(3)(6)
Kojto 122:f9eeca106725 4984 * @arg @ref LL_ADC_AWD_CH_DAC1CH2_ADC3_REG_INJ (3)(6)
Kojto 122:f9eeca106725 4985 *
Kojto 122:f9eeca106725 4986 * (0) On STM32L4, parameter available only on analog watchdog number: AWD1.\n
Kojto 122:f9eeca106725 4987 * (1) On STM32L4, parameter available only on ADC instance: ADC1.\n
Kojto 122:f9eeca106725 4988 * (2) On STM32L4, parameter available only on ADC instance: ADC2.\n
Kojto 122:f9eeca106725 4989 * (3) On STM32L4, parameter available only on ADC instance: ADC3.\n
Kojto 122:f9eeca106725 4990 * (4) On STM32L4, parameter available only on ADC instances: ADC1, ADC3.
Kojto 122:f9eeca106725 4991 * (5) On STM32L4, parameter available on devices with only 1 ADC instance.\n
Kojto 122:f9eeca106725 4992 * (6) On STM32L4, parameter available on devices with several ADC instances.
Kojto 122:f9eeca106725 4993 * @retval None
Kojto 122:f9eeca106725 4994 */
Kojto 122:f9eeca106725 4995 __STATIC_INLINE void LL_ADC_SetAnalogWDMonitChannels(ADC_TypeDef *ADCx, uint32_t AWDy, uint32_t AWDChannelGroup)
Kojto 122:f9eeca106725 4996 {
Kojto 122:f9eeca106725 4997 /* Set bits with content of parameter "AWDChannelGroup" with bits position */
Kojto 122:f9eeca106725 4998 /* in register and register position depending on parameter "AWDy". */
Kojto 122:f9eeca106725 4999 /* Parameters "AWDChannelGroup" and "AWDy" are used with masks because */
Kojto 122:f9eeca106725 5000 /* containing other bits reserved for other purpose. */
Kojto 122:f9eeca106725 5001 register uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->CFGR, __ADC_MASK_SHIFT(AWDy, ADC_AWD_CRX_REGOFFSET_MASK)
Kojto 122:f9eeca106725 5002 + ((AWDy & ADC_AWD_CR12_REGOFFSETGAP_MASK) * ADC_AWD_CR12_REGOFFSETGAP_VAL));
Kojto 122:f9eeca106725 5003
Kojto 122:f9eeca106725 5004 MODIFY_REG(*preg,
Kojto 122:f9eeca106725 5005 (AWDy & ADC_AWD_CR_ALL_CHANNEL_MASK),
Kojto 122:f9eeca106725 5006 AWDChannelGroup & AWDy);
Kojto 122:f9eeca106725 5007 }
Kojto 122:f9eeca106725 5008
Kojto 122:f9eeca106725 5009 /**
Kojto 122:f9eeca106725 5010 * @brief Get ADC analog watchdog monitored channel.
Kojto 122:f9eeca106725 5011 * @note Usage of the returned channel number:
Kojto 122:f9eeca106725 5012 * - To reinject this channel into another function LL_ADC_xxx:
Kojto 122:f9eeca106725 5013 * the returned channel number is only partly formatted on definition
Kojto 122:f9eeca106725 5014 * of literals LL_ADC_CHANNEL_x. Therefore, it has to be compared
Kojto 122:f9eeca106725 5015 * with parts of literals LL_ADC_CHANNEL_x or using
Kojto 122:f9eeca106725 5016 * helper macro @ref __LL_ADC_CHANNEL_TO_DECIMAL_NB().
Kojto 122:f9eeca106725 5017 * Then the selected literal LL_ADC_CHANNEL_x can be used
Kojto 122:f9eeca106725 5018 * as parameter for another function.
Kojto 122:f9eeca106725 5019 * - To get the channel number in decimal format:
Kojto 122:f9eeca106725 5020 * process the returned value with the helper macro
Kojto 122:f9eeca106725 5021 * @ref __LL_ADC_CHANNEL_TO_DECIMAL_NB().
Kojto 122:f9eeca106725 5022 * Applicable only when the analog watchdog is set to monitor
Kojto 122:f9eeca106725 5023 * one channel.
Kojto 122:f9eeca106725 5024 * @note On this STM32 serie, there are 2 kinds of analog watchdog
Kojto 122:f9eeca106725 5025 * instance:
Kojto 122:f9eeca106725 5026 * - AWD standard (instance AWD1):
Kojto 122:f9eeca106725 5027 * - channels monitored: can monitor 1 channel or all channels.
Kojto 122:f9eeca106725 5028 * - groups monitored: ADC groups regular and-or injected.
Kojto 122:f9eeca106725 5029 * - resolution: resolution is not limited (corresponds to
Kojto 122:f9eeca106725 5030 * ADC resolution configured).
Kojto 122:f9eeca106725 5031 * - AWD flexible (instances AWD2, AWD3):
Kojto 122:f9eeca106725 5032 * - channels monitored: flexible on channels monitored, selection is
Kojto 122:f9eeca106725 5033 * channel wise, from from 1 to all channels.
Kojto 122:f9eeca106725 5034 * Specificity of this analog watchdog: Multiple channels can
Kojto 122:f9eeca106725 5035 * be selected. For example:
Kojto 122:f9eeca106725 5036 * (LL_ADC_AWD_CHANNEL4_REG_INJ | LL_ADC_AWD_CHANNEL5_REG_INJ | ...)
Kojto 122:f9eeca106725 5037 * - groups monitored: not selection possible (monitoring on both
Kojto 122:f9eeca106725 5038 * groups regular and injected).
Kojto 122:f9eeca106725 5039 * Channels selected are monitored on groups regular and injected:
Kojto 122:f9eeca106725 5040 * LL_ADC_AWD_CHANNELxx_REG_INJ (do not use parameters
Kojto 122:f9eeca106725 5041 * LL_ADC_AWD_CHANNELxx_REG and LL_ADC_AWD_CHANNELxx_INJ)
Kojto 122:f9eeca106725 5042 * - resolution: resolution is limited to 8 bits: if ADC resolution is
Kojto 122:f9eeca106725 5043 * 12 bits the 4 LSB are ignored, if ADC resolution is 10 bits
Kojto 122:f9eeca106725 5044 * the 2 LSB are ignored.
Kojto 122:f9eeca106725 5045 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 5046 * ADC state:
Kojto 122:f9eeca106725 5047 * ADC must be disabled or enabled without conversion on going
Kojto 122:f9eeca106725 5048 * on either groups regular or injected.
Kojto 122:f9eeca106725 5049 * @rmtoll CFGR AWD1CH LL_ADC_GetAnalogWDMonitChannels\n
Kojto 122:f9eeca106725 5050 * CFGR AWD1SGL LL_ADC_GetAnalogWDMonitChannels\n
Kojto 122:f9eeca106725 5051 * CFGR AWD1EN LL_ADC_GetAnalogWDMonitChannels\n
Kojto 122:f9eeca106725 5052 * CFGR JAWD1EN LL_ADC_GetAnalogWDMonitChannels\n
Kojto 122:f9eeca106725 5053 * AWD2CR AWD2CH LL_ADC_GetAnalogWDMonitChannels\n
Kojto 122:f9eeca106725 5054 * AWD3CR AWD3CH LL_ADC_GetAnalogWDMonitChannels
Kojto 122:f9eeca106725 5055 * @param ADCx ADC instance
Kojto 122:f9eeca106725 5056 * @param AWDy This parameter can be one of the following values:
Kojto 122:f9eeca106725 5057 * @arg @ref LL_ADC_AWD1
Kojto 122:f9eeca106725 5058 * @arg @ref LL_ADC_AWD2 (1)
Kojto 122:f9eeca106725 5059 * @arg @ref LL_ADC_AWD3 (1)
Kojto 122:f9eeca106725 5060 *
Kojto 122:f9eeca106725 5061 * (1) On this AWD number, monitored channel can be retrieved
Kojto 122:f9eeca106725 5062 * if only 1 channel is programmed (or none or all channels).
Kojto 122:f9eeca106725 5063 * This function cannot retrieve monitored channel if
Kojto 122:f9eeca106725 5064 * multiple channels are programmed simultaneously
Kojto 122:f9eeca106725 5065 * by bitfield.
Kojto 122:f9eeca106725 5066 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 5067 * @arg @ref LL_ADC_AWD_DISABLE
Kojto 122:f9eeca106725 5068 * @arg @ref LL_ADC_AWD_ALL_CHANNELS_REG (0)
Kojto 122:f9eeca106725 5069 * @arg @ref LL_ADC_AWD_ALL_CHANNELS_INJ (0)
Kojto 122:f9eeca106725 5070 * @arg @ref LL_ADC_AWD_ALL_CHANNELS_REG_INJ
Kojto 122:f9eeca106725 5071 * @arg @ref LL_ADC_AWD_CHANNEL_0_REG (0)
Kojto 122:f9eeca106725 5072 * @arg @ref LL_ADC_AWD_CHANNEL_0_INJ (0)
Kojto 122:f9eeca106725 5073 * @arg @ref LL_ADC_AWD_CHANNEL_0_REG_INJ
Kojto 122:f9eeca106725 5074 * @arg @ref LL_ADC_AWD_CHANNEL_1_REG (0)
Kojto 122:f9eeca106725 5075 * @arg @ref LL_ADC_AWD_CHANNEL_1_INJ (0)
Kojto 122:f9eeca106725 5076 * @arg @ref LL_ADC_AWD_CHANNEL_1_REG_INJ
Kojto 122:f9eeca106725 5077 * @arg @ref LL_ADC_AWD_CHANNEL_2_REG (0)
Kojto 122:f9eeca106725 5078 * @arg @ref LL_ADC_AWD_CHANNEL_2_INJ (0)
Kojto 122:f9eeca106725 5079 * @arg @ref LL_ADC_AWD_CHANNEL_2_REG_INJ
Kojto 122:f9eeca106725 5080 * @arg @ref LL_ADC_AWD_CHANNEL_3_REG (0)
Kojto 122:f9eeca106725 5081 * @arg @ref LL_ADC_AWD_CHANNEL_3_INJ (0)
Kojto 122:f9eeca106725 5082 * @arg @ref LL_ADC_AWD_CHANNEL_3_REG_INJ
Kojto 122:f9eeca106725 5083 * @arg @ref LL_ADC_AWD_CHANNEL_4_REG (0)
Kojto 122:f9eeca106725 5084 * @arg @ref LL_ADC_AWD_CHANNEL_4_INJ (0)
Kojto 122:f9eeca106725 5085 * @arg @ref LL_ADC_AWD_CHANNEL_4_REG_INJ
Kojto 122:f9eeca106725 5086 * @arg @ref LL_ADC_AWD_CHANNEL_5_REG (0)
Kojto 122:f9eeca106725 5087 * @arg @ref LL_ADC_AWD_CHANNEL_5_INJ (0)
Kojto 122:f9eeca106725 5088 * @arg @ref LL_ADC_AWD_CHANNEL_5_REG_INJ
Kojto 122:f9eeca106725 5089 * @arg @ref LL_ADC_AWD_CHANNEL_6_REG (0)
Kojto 122:f9eeca106725 5090 * @arg @ref LL_ADC_AWD_CHANNEL_6_INJ (0)
Kojto 122:f9eeca106725 5091 * @arg @ref LL_ADC_AWD_CHANNEL_6_REG_INJ
Kojto 122:f9eeca106725 5092 * @arg @ref LL_ADC_AWD_CHANNEL_7_REG (0)
Kojto 122:f9eeca106725 5093 * @arg @ref LL_ADC_AWD_CHANNEL_7_INJ (0)
Kojto 122:f9eeca106725 5094 * @arg @ref LL_ADC_AWD_CHANNEL_7_REG_INJ
Kojto 122:f9eeca106725 5095 * @arg @ref LL_ADC_AWD_CHANNEL_8_REG (0)
Kojto 122:f9eeca106725 5096 * @arg @ref LL_ADC_AWD_CHANNEL_8_INJ (0)
Kojto 122:f9eeca106725 5097 * @arg @ref LL_ADC_AWD_CHANNEL_8_REG_INJ
Kojto 122:f9eeca106725 5098 * @arg @ref LL_ADC_AWD_CHANNEL_9_REG (0)
Kojto 122:f9eeca106725 5099 * @arg @ref LL_ADC_AWD_CHANNEL_9_INJ (0)
Kojto 122:f9eeca106725 5100 * @arg @ref LL_ADC_AWD_CHANNEL_9_REG_INJ
Kojto 122:f9eeca106725 5101 * @arg @ref LL_ADC_AWD_CHANNEL_10_REG (0)
Kojto 122:f9eeca106725 5102 * @arg @ref LL_ADC_AWD_CHANNEL_10_INJ (0)
Kojto 122:f9eeca106725 5103 * @arg @ref LL_ADC_AWD_CHANNEL_10_REG_INJ
Kojto 122:f9eeca106725 5104 * @arg @ref LL_ADC_AWD_CHANNEL_11_REG (0)
Kojto 122:f9eeca106725 5105 * @arg @ref LL_ADC_AWD_CHANNEL_11_INJ (0)
Kojto 122:f9eeca106725 5106 * @arg @ref LL_ADC_AWD_CHANNEL_11_REG_INJ
Kojto 122:f9eeca106725 5107 * @arg @ref LL_ADC_AWD_CHANNEL_12_REG (0)
Kojto 122:f9eeca106725 5108 * @arg @ref LL_ADC_AWD_CHANNEL_12_INJ (0)
Kojto 122:f9eeca106725 5109 * @arg @ref LL_ADC_AWD_CHANNEL_12_REG_INJ
Kojto 122:f9eeca106725 5110 * @arg @ref LL_ADC_AWD_CHANNEL_13_REG (0)
Kojto 122:f9eeca106725 5111 * @arg @ref LL_ADC_AWD_CHANNEL_13_INJ (0)
Kojto 122:f9eeca106725 5112 * @arg @ref LL_ADC_AWD_CHANNEL_13_REG_INJ
Kojto 122:f9eeca106725 5113 * @arg @ref LL_ADC_AWD_CHANNEL_14_REG (0)
Kojto 122:f9eeca106725 5114 * @arg @ref LL_ADC_AWD_CHANNEL_14_INJ (0)
Kojto 122:f9eeca106725 5115 * @arg @ref LL_ADC_AWD_CHANNEL_14_REG_INJ
Kojto 122:f9eeca106725 5116 * @arg @ref LL_ADC_AWD_CHANNEL_15_REG (0)
Kojto 122:f9eeca106725 5117 * @arg @ref LL_ADC_AWD_CHANNEL_15_INJ (0)
Kojto 122:f9eeca106725 5118 * @arg @ref LL_ADC_AWD_CHANNEL_15_REG_INJ
Kojto 122:f9eeca106725 5119 * @arg @ref LL_ADC_AWD_CHANNEL_16_REG (0)
Kojto 122:f9eeca106725 5120 * @arg @ref LL_ADC_AWD_CHANNEL_16_INJ (0)
Kojto 122:f9eeca106725 5121 * @arg @ref LL_ADC_AWD_CHANNEL_16_REG_INJ
Kojto 122:f9eeca106725 5122 * @arg @ref LL_ADC_AWD_CHANNEL_17_REG (0)
Kojto 122:f9eeca106725 5123 * @arg @ref LL_ADC_AWD_CHANNEL_17_INJ (0)
Kojto 122:f9eeca106725 5124 * @arg @ref LL_ADC_AWD_CHANNEL_17_REG_INJ
Kojto 122:f9eeca106725 5125 * @arg @ref LL_ADC_AWD_CHANNEL_18_REG (0)
Kojto 122:f9eeca106725 5126 * @arg @ref LL_ADC_AWD_CHANNEL_18_INJ (0)
Kojto 122:f9eeca106725 5127 * @arg @ref LL_ADC_AWD_CHANNEL_18_REG_INJ
Kojto 122:f9eeca106725 5128 *
Kojto 122:f9eeca106725 5129 * (0) On STM32L4, parameter available only on analog watchdog number: AWD1.
Kojto 122:f9eeca106725 5130 */
Kojto 122:f9eeca106725 5131 __STATIC_INLINE uint32_t LL_ADC_GetAnalogWDMonitChannels(ADC_TypeDef *ADCx, uint32_t AWDy)
Kojto 122:f9eeca106725 5132 {
Kojto 122:f9eeca106725 5133 register uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->CFGR, __ADC_MASK_SHIFT(AWDy, ADC_AWD_CRX_REGOFFSET_MASK)
Kojto 122:f9eeca106725 5134 + ((AWDy & ADC_AWD_CR12_REGOFFSETGAP_MASK) * ADC_AWD_CR12_REGOFFSETGAP_VAL));
Kojto 122:f9eeca106725 5135
Kojto 122:f9eeca106725 5136 /* Variable "AWDy" used to retrieve appropriate bitfield corresponding to */
Kojto 122:f9eeca106725 5137 /* ADC_AWD_CR1_CHANNEL_MASK or ADC_AWD_CR23_CHANNEL_MASK. */
Kojto 122:f9eeca106725 5138 register uint32_t AWD123ChannelGroup = READ_BIT(*preg, (AWDy | ADC_AWD_CR_ALL_CHANNEL_MASK));
Kojto 122:f9eeca106725 5139
Kojto 122:f9eeca106725 5140 /* Set variable of AWD1 monitored channel according to AWD1 features */
Kojto 122:f9eeca106725 5141 /* and ADC channel definition: */
Kojto 122:f9eeca106725 5142 /* - channel ID with number */
Kojto 122:f9eeca106725 5143 /* - channel ID with bitfield */
Kojto 122:f9eeca106725 5144 /* - AWD1 single or all channels */
Kojto 122:f9eeca106725 5145 /* - AWD1 enable or disable (also used to discard AWD1 bitfield in case of */
Kojto 122:f9eeca106725 5146 /* AWD2 or AWD3 selected). */
Kojto 122:f9eeca106725 5147 register uint32_t AWD1ChannelSingle = ((AWD123ChannelGroup & ADC_CFGR_AWD1SGL) >> ADC_CFGR_AWD1SGL_BITOFFSET_POS);
Kojto 122:f9eeca106725 5148
Kojto 122:f9eeca106725 5149 register uint32_t AWD1ChannelGroup = ( ( AWD123ChannelGroup
Kojto 122:f9eeca106725 5150 | ((ADC_CHANNEL_0_BITFIELD << ((AWD123ChannelGroup & ADC_CHANNEL_ID_NUMBER_MASK) >> ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS)) * AWD1ChannelSingle)
AnnaBridge 145:64910690c574 5151 | (ADC_CHANNEL_ID_BITFIELD_MASK * (~AWD1ChannelSingle & 0x00000001U))
Kojto 122:f9eeca106725 5152 )
Kojto 122:f9eeca106725 5153 * (((AWD123ChannelGroup & ADC_CFGR_JAWD1EN) >> ADC_CFGR_JAWD1EN_BITOFFSET_POS) | ((AWD123ChannelGroup & ADC_CFGR_AWD1EN) >> ADC_CFGR_AWD1EN_BITOFFSET_POS))
Kojto 122:f9eeca106725 5154 );
Kojto 122:f9eeca106725 5155
Kojto 122:f9eeca106725 5156 /* Set variable of AWD2 and AWD3 monitored channel according to AWD2-3 */
Kojto 122:f9eeca106725 5157 /* features and ADC channel definition: */
Kojto 122:f9eeca106725 5158 /* - channel ID with number */
Kojto 122:f9eeca106725 5159 /* - channel ID with bitfield */
Kojto 122:f9eeca106725 5160 /* - AWD2-3 single or all channels (shift value 32 (0x1 shift 5) used to */
Kojto 122:f9eeca106725 5161 /* shift AWD1 equivalent single-all channels out of register) */
Kojto 122:f9eeca106725 5162 /* - AWD2-3 enable or disable */
Kojto 122:f9eeca106725 5163 /* Note: Use modulo 3 to avoid a shift value too long. On AWD2 and AWD3, */
Kojto 122:f9eeca106725 5164 /* channel can be read back if only 1 channel monitoring */
Kojto 122:f9eeca106725 5165 /* is activated, therefore the channel monitoring value channel "3" */
Kojto 122:f9eeca106725 5166 /* is not not supported by this function, there is no risk of */
Kojto 122:f9eeca106725 5167 /* conflict. */
AnnaBridge 145:64910690c574 5168 register uint32_t AWD23Enabled = ((0x00000001U >> (AWD123ChannelGroup % 3U)) << 6U); /* Value "0" if AWD2-3 is enabled, value "32" if AWD2-3 is disabled */
Kojto 122:f9eeca106725 5169
Kojto 122:f9eeca106725 5170 register uint32_t AWD23ChannelGroup = ((( AWD123ChannelGroup
Kojto 122:f9eeca106725 5171 | ((uint32_t)POSITION_VAL(AWD123ChannelGroup) << ADC_CHANNEL_ID_NUMBER_BITOFFSET_POS)
AnnaBridge 145:64910690c574 5172 | ((ADC_CFGR_AWD1SGL) >> ((0x00000001U >> (ADC_AWD_CR23_CHANNEL_MASK - AWD123ChannelGroup)) << 5U))
Kojto 122:f9eeca106725 5173 | (ADC_CFGR_JAWD1EN | ADC_CFGR_AWD1EN)
Kojto 122:f9eeca106725 5174 ) >> AWD23Enabled
Kojto 122:f9eeca106725 5175 ) >> (((AWDy & ADC_CFGR_AWD1SGL) >> ADC_CFGR_AWD1SGL_BITOFFSET_POS) << 5U));
Kojto 122:f9eeca106725 5176
Kojto 122:f9eeca106725 5177 return (AWD1ChannelGroup | AWD23ChannelGroup);
Kojto 122:f9eeca106725 5178 }
Kojto 122:f9eeca106725 5179
Kojto 122:f9eeca106725 5180 /**
Kojto 122:f9eeca106725 5181 * @brief Set ADC analog watchdog thresholds value of both thresholds
Kojto 122:f9eeca106725 5182 * high and low.
Kojto 122:f9eeca106725 5183 * @note If value of only one threshold high or low must be set,
Kojto 122:f9eeca106725 5184 * use function @ref LL_ADC_SetAnalogWDThresholds().
Kojto 122:f9eeca106725 5185 * @note In case of ADC resolution different of 12 bits,
Kojto 122:f9eeca106725 5186 * analog watchdog thresholds data require a specific shift.
Kojto 122:f9eeca106725 5187 * Use helper macro @ref __LL_ADC_ANALOGWD_SET_THRESHOLD_RESOLUTION().
Kojto 122:f9eeca106725 5188 * @note On this STM32 serie, there are 2 kinds of analog watchdog
Kojto 122:f9eeca106725 5189 * instance:
Kojto 122:f9eeca106725 5190 * - AWD standard (instance AWD1):
Kojto 122:f9eeca106725 5191 * - channels monitored: can monitor 1 channel or all channels.
Kojto 122:f9eeca106725 5192 * - groups monitored: ADC groups regular and-or injected.
Kojto 122:f9eeca106725 5193 * - resolution: resolution is not limited (corresponds to
Kojto 122:f9eeca106725 5194 * ADC resolution configured).
Kojto 122:f9eeca106725 5195 * - AWD flexible (instances AWD2, AWD3):
Kojto 122:f9eeca106725 5196 * - channels monitored: flexible on channels monitored, selection is
Kojto 122:f9eeca106725 5197 * channel wise, from from 1 to all channels.
Kojto 122:f9eeca106725 5198 * Specificity of this analog watchdog: Multiple channels can
Kojto 122:f9eeca106725 5199 * be selected. For example:
Kojto 122:f9eeca106725 5200 * (LL_ADC_AWD_CHANNEL4_REG_INJ | LL_ADC_AWD_CHANNEL5_REG_INJ | ...)
Kojto 122:f9eeca106725 5201 * - groups monitored: not selection possible (monitoring on both
Kojto 122:f9eeca106725 5202 * groups regular and injected).
Kojto 122:f9eeca106725 5203 * Channels selected are monitored on groups regular and injected:
Kojto 122:f9eeca106725 5204 * LL_ADC_AWD_CHANNELxx_REG_INJ (do not use parameters
Kojto 122:f9eeca106725 5205 * LL_ADC_AWD_CHANNELxx_REG and LL_ADC_AWD_CHANNELxx_INJ)
Kojto 122:f9eeca106725 5206 * - resolution: resolution is limited to 8 bits: if ADC resolution is
Kojto 122:f9eeca106725 5207 * 12 bits the 4 LSB are ignored, if ADC resolution is 10 bits
Kojto 122:f9eeca106725 5208 * the 2 LSB are ignored.
Kojto 122:f9eeca106725 5209 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 5210 * ADC state:
Kojto 122:f9eeca106725 5211 * ADC must be disabled or enabled without conversion on going
Kojto 122:f9eeca106725 5212 * on either groups regular or injected.
Kojto 122:f9eeca106725 5213 * @rmtoll TR1 HT1 LL_ADC_ConfigAnalogWDThresholds\n
Kojto 122:f9eeca106725 5214 * TR2 HT2 LL_ADC_ConfigAnalogWDThresholds\n
Kojto 122:f9eeca106725 5215 * TR3 HT3 LL_ADC_ConfigAnalogWDThresholds\n
Kojto 122:f9eeca106725 5216 * TR1 LT1 LL_ADC_ConfigAnalogWDThresholds\n
Kojto 122:f9eeca106725 5217 * TR2 LT2 LL_ADC_ConfigAnalogWDThresholds\n
Kojto 122:f9eeca106725 5218 * TR3 LT3 LL_ADC_ConfigAnalogWDThresholds
Kojto 122:f9eeca106725 5219 * @param ADCx ADC instance
Kojto 122:f9eeca106725 5220 * @param AWDy This parameter can be one of the following values:
Kojto 122:f9eeca106725 5221 * @arg @ref LL_ADC_AWD1
Kojto 122:f9eeca106725 5222 * @arg @ref LL_ADC_AWD2
Kojto 122:f9eeca106725 5223 * @arg @ref LL_ADC_AWD3
Kojto 122:f9eeca106725 5224 * @param AWDThresholdHighValue Value between Min_Data=0x000 and Max_Data=0xFFF
Kojto 122:f9eeca106725 5225 * @param AWDThresholdLowValue Value between Min_Data=0x000 and Max_Data=0xFFF
Kojto 122:f9eeca106725 5226 * @retval None
Kojto 122:f9eeca106725 5227 */
Kojto 122:f9eeca106725 5228 __STATIC_INLINE void LL_ADC_ConfigAnalogWDThresholds(ADC_TypeDef *ADCx, uint32_t AWDy, uint32_t AWDThresholdHighValue, uint32_t AWDThresholdLowValue)
Kojto 122:f9eeca106725 5229 {
Kojto 122:f9eeca106725 5230 /* Set bits with content of parameter "AWDThresholdxxxValue" with bits */
Kojto 122:f9eeca106725 5231 /* position in register and register position depending on parameter */
Kojto 122:f9eeca106725 5232 /* "AWDy". */
Kojto 122:f9eeca106725 5233 /* Parameters "AWDy" and "AWDThresholdxxxValue" are used with masks because */
Kojto 122:f9eeca106725 5234 /* containing other bits reserved for other purpose. */
Kojto 122:f9eeca106725 5235 register uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->TR1, __ADC_MASK_SHIFT(AWDy, ADC_AWD_TRX_REGOFFSET_MASK));
Kojto 122:f9eeca106725 5236
Kojto 122:f9eeca106725 5237 MODIFY_REG(*preg,
Kojto 122:f9eeca106725 5238 ADC_TR1_HT1 | ADC_TR1_LT1,
Kojto 122:f9eeca106725 5239 (AWDThresholdHighValue << ADC_TR1_HT1_BITOFFSET_POS) | AWDThresholdLowValue);
Kojto 122:f9eeca106725 5240 }
Kojto 122:f9eeca106725 5241
Kojto 122:f9eeca106725 5242 /**
Kojto 122:f9eeca106725 5243 * @brief Set ADC analog watchdog threshold value of threshold
Kojto 122:f9eeca106725 5244 * high or low.
Kojto 122:f9eeca106725 5245 * @note If values of both thresholds high or low must be set,
Kojto 122:f9eeca106725 5246 * use function @ref LL_ADC_ConfigAnalogWDThresholds().
Kojto 122:f9eeca106725 5247 * @note In case of ADC resolution different of 12 bits,
Kojto 122:f9eeca106725 5248 * analog watchdog thresholds data require a specific shift.
Kojto 122:f9eeca106725 5249 * Use helper macro @ref __LL_ADC_ANALOGWD_SET_THRESHOLD_RESOLUTION().
Kojto 122:f9eeca106725 5250 * @note On this STM32 serie, there are 2 kinds of analog watchdog
Kojto 122:f9eeca106725 5251 * instance:
Kojto 122:f9eeca106725 5252 * - AWD standard (instance AWD1):
Kojto 122:f9eeca106725 5253 * - channels monitored: can monitor 1 channel or all channels.
Kojto 122:f9eeca106725 5254 * - groups monitored: ADC groups regular and-or injected.
Kojto 122:f9eeca106725 5255 * - resolution: resolution is not limited (corresponds to
Kojto 122:f9eeca106725 5256 * ADC resolution configured).
Kojto 122:f9eeca106725 5257 * - AWD flexible (instances AWD2, AWD3):
Kojto 122:f9eeca106725 5258 * - channels monitored: flexible on channels monitored, selection is
Kojto 122:f9eeca106725 5259 * channel wise, from from 1 to all channels.
Kojto 122:f9eeca106725 5260 * Specificity of this analog watchdog: Multiple channels can
Kojto 122:f9eeca106725 5261 * be selected. For example:
Kojto 122:f9eeca106725 5262 * (LL_ADC_AWD_CHANNEL4_REG_INJ | LL_ADC_AWD_CHANNEL5_REG_INJ | ...)
Kojto 122:f9eeca106725 5263 * - groups monitored: not selection possible (monitoring on both
Kojto 122:f9eeca106725 5264 * groups regular and injected).
Kojto 122:f9eeca106725 5265 * Channels selected are monitored on groups regular and injected:
Kojto 122:f9eeca106725 5266 * LL_ADC_AWD_CHANNELxx_REG_INJ (do not use parameters
Kojto 122:f9eeca106725 5267 * LL_ADC_AWD_CHANNELxx_REG and LL_ADC_AWD_CHANNELxx_INJ)
Kojto 122:f9eeca106725 5268 * - resolution: resolution is limited to 8 bits: if ADC resolution is
Kojto 122:f9eeca106725 5269 * 12 bits the 4 LSB are ignored, if ADC resolution is 10 bits
Kojto 122:f9eeca106725 5270 * the 2 LSB are ignored.
Kojto 122:f9eeca106725 5271 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 5272 * ADC state:
Kojto 122:f9eeca106725 5273 * ADC must be disabled or enabled without conversion on going
Kojto 122:f9eeca106725 5274 * on either groups regular or injected.
Kojto 122:f9eeca106725 5275 * @rmtoll TR1 HT1 LL_ADC_SetAnalogWDThresholds\n
Kojto 122:f9eeca106725 5276 * TR2 HT2 LL_ADC_SetAnalogWDThresholds\n
Kojto 122:f9eeca106725 5277 * TR3 HT3 LL_ADC_SetAnalogWDThresholds\n
Kojto 122:f9eeca106725 5278 * TR1 LT1 LL_ADC_SetAnalogWDThresholds\n
Kojto 122:f9eeca106725 5279 * TR2 LT2 LL_ADC_SetAnalogWDThresholds\n
Kojto 122:f9eeca106725 5280 * TR3 LT3 LL_ADC_SetAnalogWDThresholds
Kojto 122:f9eeca106725 5281 * @param ADCx ADC instance
Kojto 122:f9eeca106725 5282 * @param AWDy This parameter can be one of the following values:
Kojto 122:f9eeca106725 5283 * @arg @ref LL_ADC_AWD1
Kojto 122:f9eeca106725 5284 * @arg @ref LL_ADC_AWD2
Kojto 122:f9eeca106725 5285 * @arg @ref LL_ADC_AWD3
Kojto 122:f9eeca106725 5286 * @param AWDThresholdsHighLow This parameter can be one of the following values:
Kojto 122:f9eeca106725 5287 * @arg @ref LL_ADC_AWD_THRESHOLD_HIGH
Kojto 122:f9eeca106725 5288 * @arg @ref LL_ADC_AWD_THRESHOLD_LOW
Kojto 122:f9eeca106725 5289 * @param AWDThresholdValue: Value between Min_Data=0x000 and Max_Data=0xFFF
Kojto 122:f9eeca106725 5290 * @retval None
Kojto 122:f9eeca106725 5291 */
Kojto 122:f9eeca106725 5292 __STATIC_INLINE void LL_ADC_SetAnalogWDThresholds(ADC_TypeDef *ADCx, uint32_t AWDy, uint32_t AWDThresholdsHighLow, uint32_t AWDThresholdValue)
Kojto 122:f9eeca106725 5293 {
Kojto 122:f9eeca106725 5294 /* Set bits with content of parameter "AWDThresholdValue" with bits */
Kojto 122:f9eeca106725 5295 /* position in register and register position depending on parameters */
Kojto 122:f9eeca106725 5296 /* "AWDThresholdsHighLow" and "AWDy". */
Kojto 122:f9eeca106725 5297 /* Parameters "AWDy" and "AWDThresholdValue" are used with masks because */
Kojto 122:f9eeca106725 5298 /* containing other bits reserved for other purpose. */
Kojto 122:f9eeca106725 5299 register uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->TR1, __ADC_MASK_SHIFT(AWDy, ADC_AWD_TRX_REGOFFSET_MASK));
Kojto 122:f9eeca106725 5300
Kojto 122:f9eeca106725 5301 MODIFY_REG(*preg,
Kojto 122:f9eeca106725 5302 AWDThresholdsHighLow,
Kojto 122:f9eeca106725 5303 AWDThresholdValue << POSITION_VAL(AWDThresholdsHighLow));
Kojto 122:f9eeca106725 5304 }
Kojto 122:f9eeca106725 5305
Kojto 122:f9eeca106725 5306 /**
Kojto 122:f9eeca106725 5307 * @brief Get ADC analog watchdog threshold value of threshold high,
Kojto 122:f9eeca106725 5308 * threshold low or raw data with ADC thresholds high and low
Kojto 122:f9eeca106725 5309 * concatenated.
Kojto 122:f9eeca106725 5310 * @note If raw data with ADC thresholds high and low is retrieved,
Kojto 122:f9eeca106725 5311 * the data of each threshold high or low can be isolated
Kojto 122:f9eeca106725 5312 * using helper macro:
Kojto 122:f9eeca106725 5313 * @ref __LL_ADC_ANALOGWD_THRESHOLDS_HIGH_LOW().
Kojto 122:f9eeca106725 5314 * @note In case of ADC resolution different of 12 bits,
Kojto 122:f9eeca106725 5315 * analog watchdog thresholds data require a specific shift.
Kojto 122:f9eeca106725 5316 * Use helper macro @ref __LL_ADC_ANALOGWD_GET_THRESHOLD_RESOLUTION().
Kojto 122:f9eeca106725 5317 * @rmtoll TR1 HT1 LL_ADC_GetAnalogWDThresholds\n
Kojto 122:f9eeca106725 5318 * TR2 HT2 LL_ADC_GetAnalogWDThresholds\n
Kojto 122:f9eeca106725 5319 * TR3 HT3 LL_ADC_GetAnalogWDThresholds\n
Kojto 122:f9eeca106725 5320 * TR1 LT1 LL_ADC_GetAnalogWDThresholds\n
Kojto 122:f9eeca106725 5321 * TR2 LT2 LL_ADC_GetAnalogWDThresholds\n
Kojto 122:f9eeca106725 5322 * TR3 LT3 LL_ADC_GetAnalogWDThresholds
Kojto 122:f9eeca106725 5323 * @param ADCx ADC instance
Kojto 122:f9eeca106725 5324 * @param AWDy This parameter can be one of the following values:
Kojto 122:f9eeca106725 5325 * @arg @ref LL_ADC_AWD1
Kojto 122:f9eeca106725 5326 * @arg @ref LL_ADC_AWD2
Kojto 122:f9eeca106725 5327 * @arg @ref LL_ADC_AWD3
Kojto 122:f9eeca106725 5328 * @param AWDThresholdsHighLow This parameter can be one of the following values:
Kojto 122:f9eeca106725 5329 * @arg @ref LL_ADC_AWD_THRESHOLD_HIGH
Kojto 122:f9eeca106725 5330 * @arg @ref LL_ADC_AWD_THRESHOLD_LOW
Kojto 122:f9eeca106725 5331 * @arg @ref LL_ADC_AWD_THRESHOLDS_HIGH_LOW
Kojto 122:f9eeca106725 5332 * @retval Value between Min_Data=0x000 and Max_Data=0xFFF
Kojto 122:f9eeca106725 5333 */
Kojto 122:f9eeca106725 5334 __STATIC_INLINE uint32_t LL_ADC_GetAnalogWDThresholds(ADC_TypeDef *ADCx, uint32_t AWDy, uint32_t AWDThresholdsHighLow)
Kojto 122:f9eeca106725 5335 {
Kojto 122:f9eeca106725 5336 register uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->TR1, __ADC_MASK_SHIFT(AWDy, ADC_AWD_TRX_REGOFFSET_MASK));
Kojto 122:f9eeca106725 5337
Kojto 122:f9eeca106725 5338 return (uint32_t)(READ_BIT(*preg,
Kojto 122:f9eeca106725 5339 (AWDThresholdsHighLow | ADC_TR1_LT1))
Kojto 122:f9eeca106725 5340 >> POSITION_VAL(AWDThresholdsHighLow)
Kojto 122:f9eeca106725 5341 );
Kojto 122:f9eeca106725 5342 }
Kojto 122:f9eeca106725 5343
Kojto 122:f9eeca106725 5344 /**
Kojto 122:f9eeca106725 5345 * @}
Kojto 122:f9eeca106725 5346 */
Kojto 122:f9eeca106725 5347
Kojto 122:f9eeca106725 5348 /** @defgroup ADC_LL_EF_Configuration_ADC_oversampling Configuration of ADC transversal scope: oversampling
Kojto 122:f9eeca106725 5349 * @{
Kojto 122:f9eeca106725 5350 */
Kojto 122:f9eeca106725 5351
Kojto 122:f9eeca106725 5352 /**
Kojto 122:f9eeca106725 5353 * @brief Set ADC oversampling scope: ADC groups regular and-or injected
Kojto 122:f9eeca106725 5354 * (availability of ADC group injected depends on STM32 families).
Kojto 122:f9eeca106725 5355 * @note If both groups regular and injected are selected,
Kojto 122:f9eeca106725 5356 * specify behavior of ADC group injected interrupting
Kojto 122:f9eeca106725 5357 * group regular: when ADC group injected is triggered,
Kojto 122:f9eeca106725 5358 * the oversampling on ADC group regular is either
Kojto 122:f9eeca106725 5359 * temporary stopped and continued, or resumed from start
Kojto 122:f9eeca106725 5360 * (oversampler buffer reset).
Kojto 122:f9eeca106725 5361 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 5362 * ADC state:
Kojto 122:f9eeca106725 5363 * ADC must be disabled or enabled without conversion on going
Kojto 122:f9eeca106725 5364 * on either groups regular or injected.
Kojto 122:f9eeca106725 5365 * @rmtoll CFGR2 ROVSE LL_ADC_SetOverSamplingScope\n
Kojto 122:f9eeca106725 5366 * CFGR2 JOVSE LL_ADC_SetOverSamplingScope\n
Kojto 122:f9eeca106725 5367 * CFGR2 ROVSM LL_ADC_SetOverSamplingScope
Kojto 122:f9eeca106725 5368 * @param ADCx ADC instance
Kojto 122:f9eeca106725 5369 * @param OvsScope This parameter can be one of the following values:
Kojto 122:f9eeca106725 5370 * @arg @ref LL_ADC_OVS_DISABLE
Kojto 122:f9eeca106725 5371 * @arg @ref LL_ADC_OVS_GRP_REGULAR_CONTINUED
Kojto 122:f9eeca106725 5372 * @arg @ref LL_ADC_OVS_GRP_REGULAR_RESUMED
Kojto 122:f9eeca106725 5373 * @arg @ref LL_ADC_OVS_GRP_INJECTED
Kojto 122:f9eeca106725 5374 * @arg @ref LL_ADC_OVS_GRP_INJ_REG_RESUMED
Kojto 122:f9eeca106725 5375 * @retval None
Kojto 122:f9eeca106725 5376 */
Kojto 122:f9eeca106725 5377 __STATIC_INLINE void LL_ADC_SetOverSamplingScope(ADC_TypeDef *ADCx, uint32_t OvsScope)
Kojto 122:f9eeca106725 5378 {
Kojto 122:f9eeca106725 5379 MODIFY_REG(ADCx->CFGR2, ADC_CFGR2_ROVSE | ADC_CFGR2_JOVSE | ADC_CFGR2_ROVSM, OvsScope);
Kojto 122:f9eeca106725 5380 }
Kojto 122:f9eeca106725 5381
Kojto 122:f9eeca106725 5382 /**
Kojto 122:f9eeca106725 5383 * @brief Get ADC oversampling scope: ADC groups regular and-or injected
Kojto 122:f9eeca106725 5384 * (availability of ADC group injected depends on STM32 families).
Kojto 122:f9eeca106725 5385 * @note If both groups regular and injected are selected,
Kojto 122:f9eeca106725 5386 * specify behavior of ADC group injected interrupting
Kojto 122:f9eeca106725 5387 * group regular: when ADC group injected is triggered,
Kojto 122:f9eeca106725 5388 * the oversampling on ADC group regular is either
Kojto 122:f9eeca106725 5389 * temporary stopped and continued, or resumed from start
Kojto 122:f9eeca106725 5390 * (oversampler buffer reset).
Kojto 122:f9eeca106725 5391 * @rmtoll CFGR2 ROVSE LL_ADC_GetOverSamplingScope\n
Kojto 122:f9eeca106725 5392 * CFGR2 JOVSE LL_ADC_GetOverSamplingScope\n
Kojto 122:f9eeca106725 5393 * CFGR2 ROVSM LL_ADC_GetOverSamplingScope
Kojto 122:f9eeca106725 5394 * @param ADCx ADC instance
Kojto 122:f9eeca106725 5395 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 5396 * @arg @ref LL_ADC_OVS_DISABLE
Kojto 122:f9eeca106725 5397 * @arg @ref LL_ADC_OVS_GRP_REGULAR_CONTINUED
Kojto 122:f9eeca106725 5398 * @arg @ref LL_ADC_OVS_GRP_REGULAR_RESUMED
Kojto 122:f9eeca106725 5399 * @arg @ref LL_ADC_OVS_GRP_INJECTED
Kojto 122:f9eeca106725 5400 * @arg @ref LL_ADC_OVS_GRP_INJ_REG_RESUMED
Kojto 122:f9eeca106725 5401 */
Kojto 122:f9eeca106725 5402 __STATIC_INLINE uint32_t LL_ADC_GetOverSamplingScope(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 5403 {
Kojto 122:f9eeca106725 5404 return (uint32_t)(READ_BIT(ADCx->CFGR2, ADC_CFGR2_ROVSE | ADC_CFGR2_JOVSE | ADC_CFGR2_ROVSM));
Kojto 122:f9eeca106725 5405 }
Kojto 122:f9eeca106725 5406
Kojto 122:f9eeca106725 5407 /**
Kojto 122:f9eeca106725 5408 * @brief Set ADC oversampling discontinuous mode (triggered mode)
Kojto 122:f9eeca106725 5409 * on the selected ADC group.
Kojto 122:f9eeca106725 5410 * @note Number of oversampled conversions are done either in:
Kojto 122:f9eeca106725 5411 * - continuous mode (all conversions of oversampling ratio
Kojto 122:f9eeca106725 5412 * are done from 1 trigger)
Kojto 122:f9eeca106725 5413 * - discontinuous mode (each conversion of oversampling ratio
Kojto 122:f9eeca106725 5414 * needs a trigger)
Kojto 122:f9eeca106725 5415 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 5416 * ADC state:
Kojto 122:f9eeca106725 5417 * ADC must be disabled or enabled without conversion on going
Kojto 122:f9eeca106725 5418 * on group regular.
Kojto 122:f9eeca106725 5419 * @note On this STM32 serie, oversampling discontinuous mode
Kojto 122:f9eeca106725 5420 * (triggered mode) can be used only when oversampling is
Kojto 122:f9eeca106725 5421 * set on group regular only and in resumed mode.
Kojto 122:f9eeca106725 5422 * @rmtoll CFGR2 TROVS LL_ADC_SetOverSamplingDiscont
Kojto 122:f9eeca106725 5423 * @param ADCx ADC instance
Kojto 122:f9eeca106725 5424 * @param OverSamplingDiscont This parameter can be one of the following values:
Kojto 122:f9eeca106725 5425 * @arg @ref LL_ADC_OVS_REG_CONT
Kojto 122:f9eeca106725 5426 * @arg @ref LL_ADC_OVS_REG_DISCONT
Kojto 122:f9eeca106725 5427 * @retval None
Kojto 122:f9eeca106725 5428 */
Kojto 122:f9eeca106725 5429 __STATIC_INLINE void LL_ADC_SetOverSamplingDiscont(ADC_TypeDef *ADCx, uint32_t OverSamplingDiscont)
Kojto 122:f9eeca106725 5430 {
Kojto 122:f9eeca106725 5431 MODIFY_REG(ADCx->CFGR2, ADC_CFGR2_TROVS, OverSamplingDiscont);
Kojto 122:f9eeca106725 5432 }
Kojto 122:f9eeca106725 5433
Kojto 122:f9eeca106725 5434 /**
Kojto 122:f9eeca106725 5435 * @brief Get ADC oversampling discontinuous mode (triggered mode)
Kojto 122:f9eeca106725 5436 * on the selected ADC group.
Kojto 122:f9eeca106725 5437 * @note Number of oversampled conversions are done either in:
Kojto 122:f9eeca106725 5438 * - continuous mode (all conversions of oversampling ratio
Kojto 122:f9eeca106725 5439 * are done from 1 trigger)
Kojto 122:f9eeca106725 5440 * - discontinuous mode (each conversion of oversampling ratio
Kojto 122:f9eeca106725 5441 * needs a trigger)
Kojto 122:f9eeca106725 5442 * @rmtoll CFGR2 TROVS LL_ADC_GetOverSamplingDiscont
Kojto 122:f9eeca106725 5443 * @param ADCx ADC instance
Kojto 122:f9eeca106725 5444 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 5445 * @arg @ref LL_ADC_OVS_REG_CONT
Kojto 122:f9eeca106725 5446 * @arg @ref LL_ADC_OVS_REG_DISCONT
Kojto 122:f9eeca106725 5447 */
Kojto 122:f9eeca106725 5448 __STATIC_INLINE uint32_t LL_ADC_GetOverSamplingDiscont(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 5449 {
Kojto 122:f9eeca106725 5450 return (uint32_t)(READ_BIT(ADCx->CFGR2, ADC_CFGR2_TROVS));
Kojto 122:f9eeca106725 5451 }
Kojto 122:f9eeca106725 5452
Kojto 122:f9eeca106725 5453 /**
Kojto 122:f9eeca106725 5454 * @brief Set ADC oversampling
Kojto 122:f9eeca106725 5455 * (impacting both ADC groups regular and injected)
Kojto 122:f9eeca106725 5456 * @note This function set the 2 items of oversampling configuration:
Kojto 122:f9eeca106725 5457 * - ratio
Kojto 122:f9eeca106725 5458 * - shift
Kojto 122:f9eeca106725 5459 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 5460 * ADC state:
Kojto 122:f9eeca106725 5461 * ADC must be disabled or enabled without conversion on going
Kojto 122:f9eeca106725 5462 * on either groups regular or injected.
Kojto 122:f9eeca106725 5463 * @rmtoll CFGR2 OVSS LL_ADC_ConfigOverSamplingRatioShift\n
Kojto 122:f9eeca106725 5464 * CFGR2 OVSR LL_ADC_ConfigOverSamplingRatioShift
Kojto 122:f9eeca106725 5465 * @param ADCx ADC instance
Kojto 122:f9eeca106725 5466 * @param Ratio This parameter can be one of the following values:
Kojto 122:f9eeca106725 5467 * @arg @ref LL_ADC_OVS_RATIO_2
Kojto 122:f9eeca106725 5468 * @arg @ref LL_ADC_OVS_RATIO_4
Kojto 122:f9eeca106725 5469 * @arg @ref LL_ADC_OVS_RATIO_8
Kojto 122:f9eeca106725 5470 * @arg @ref LL_ADC_OVS_RATIO_16
Kojto 122:f9eeca106725 5471 * @arg @ref LL_ADC_OVS_RATIO_32
Kojto 122:f9eeca106725 5472 * @arg @ref LL_ADC_OVS_RATIO_64
Kojto 122:f9eeca106725 5473 * @arg @ref LL_ADC_OVS_RATIO_128
Kojto 122:f9eeca106725 5474 * @arg @ref LL_ADC_OVS_RATIO_256
Kojto 122:f9eeca106725 5475 * @param Shift This parameter can be one of the following values:
Kojto 122:f9eeca106725 5476 * @arg @ref LL_ADC_OVS_SHIFT_NONE
Kojto 122:f9eeca106725 5477 * @arg @ref LL_ADC_OVS_SHIFT_RIGHT_1
Kojto 122:f9eeca106725 5478 * @arg @ref LL_ADC_OVS_SHIFT_RIGHT_2
Kojto 122:f9eeca106725 5479 * @arg @ref LL_ADC_OVS_SHIFT_RIGHT_3
Kojto 122:f9eeca106725 5480 * @arg @ref LL_ADC_OVS_SHIFT_RIGHT_4
Kojto 122:f9eeca106725 5481 * @arg @ref LL_ADC_OVS_SHIFT_RIGHT_5
Kojto 122:f9eeca106725 5482 * @arg @ref LL_ADC_OVS_SHIFT_RIGHT_6
Kojto 122:f9eeca106725 5483 * @arg @ref LL_ADC_OVS_SHIFT_RIGHT_7
Kojto 122:f9eeca106725 5484 * @arg @ref LL_ADC_OVS_SHIFT_RIGHT_8
Kojto 122:f9eeca106725 5485 * @retval None
Kojto 122:f9eeca106725 5486 */
Kojto 122:f9eeca106725 5487 __STATIC_INLINE void LL_ADC_ConfigOverSamplingRatioShift(ADC_TypeDef *ADCx, uint32_t Ratio, uint32_t Shift)
Kojto 122:f9eeca106725 5488 {
Kojto 122:f9eeca106725 5489 MODIFY_REG(ADCx->CFGR2, (ADC_CFGR2_OVSS | ADC_CFGR2_OVSR), (Shift | Ratio));
Kojto 122:f9eeca106725 5490 }
Kojto 122:f9eeca106725 5491
Kojto 122:f9eeca106725 5492 /**
Kojto 122:f9eeca106725 5493 * @brief Get ADC oversampling ratio
Kojto 122:f9eeca106725 5494 * (impacting both ADC groups regular and injected)
Kojto 122:f9eeca106725 5495 * @rmtoll CFGR2 OVSR LL_ADC_GetOverSamplingRatio
Kojto 122:f9eeca106725 5496 * @param ADCx ADC instance
Kojto 122:f9eeca106725 5497 * @retval Ratio This parameter can be one of the following values:
Kojto 122:f9eeca106725 5498 * @arg @ref LL_ADC_OVS_RATIO_2
Kojto 122:f9eeca106725 5499 * @arg @ref LL_ADC_OVS_RATIO_4
Kojto 122:f9eeca106725 5500 * @arg @ref LL_ADC_OVS_RATIO_8
Kojto 122:f9eeca106725 5501 * @arg @ref LL_ADC_OVS_RATIO_16
Kojto 122:f9eeca106725 5502 * @arg @ref LL_ADC_OVS_RATIO_32
Kojto 122:f9eeca106725 5503 * @arg @ref LL_ADC_OVS_RATIO_64
Kojto 122:f9eeca106725 5504 * @arg @ref LL_ADC_OVS_RATIO_128
Kojto 122:f9eeca106725 5505 * @arg @ref LL_ADC_OVS_RATIO_256
Kojto 122:f9eeca106725 5506 */
Kojto 122:f9eeca106725 5507 __STATIC_INLINE uint32_t LL_ADC_GetOverSamplingRatio(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 5508 {
Kojto 122:f9eeca106725 5509 return (uint32_t)(READ_BIT(ADCx->CFGR2, ADC_CFGR2_OVSR));
Kojto 122:f9eeca106725 5510 }
Kojto 122:f9eeca106725 5511
Kojto 122:f9eeca106725 5512 /**
Kojto 122:f9eeca106725 5513 * @brief Get ADC oversampling shift
Kojto 122:f9eeca106725 5514 * (impacting both ADC groups regular and injected)
Kojto 122:f9eeca106725 5515 * @rmtoll CFGR2 OVSS LL_ADC_GetOverSamplingShift
Kojto 122:f9eeca106725 5516 * @param ADCx ADC instance
Kojto 122:f9eeca106725 5517 * @retval Shift This parameter can be one of the following values:
Kojto 122:f9eeca106725 5518 * @arg @ref LL_ADC_OVS_SHIFT_NONE
Kojto 122:f9eeca106725 5519 * @arg @ref LL_ADC_OVS_SHIFT_RIGHT_1
Kojto 122:f9eeca106725 5520 * @arg @ref LL_ADC_OVS_SHIFT_RIGHT_2
Kojto 122:f9eeca106725 5521 * @arg @ref LL_ADC_OVS_SHIFT_RIGHT_3
Kojto 122:f9eeca106725 5522 * @arg @ref LL_ADC_OVS_SHIFT_RIGHT_4
Kojto 122:f9eeca106725 5523 * @arg @ref LL_ADC_OVS_SHIFT_RIGHT_5
Kojto 122:f9eeca106725 5524 * @arg @ref LL_ADC_OVS_SHIFT_RIGHT_6
Kojto 122:f9eeca106725 5525 * @arg @ref LL_ADC_OVS_SHIFT_RIGHT_7
Kojto 122:f9eeca106725 5526 * @arg @ref LL_ADC_OVS_SHIFT_RIGHT_8
Kojto 122:f9eeca106725 5527 */
Kojto 122:f9eeca106725 5528 __STATIC_INLINE uint32_t LL_ADC_GetOverSamplingShift(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 5529 {
Kojto 122:f9eeca106725 5530 return (uint32_t)(READ_BIT(ADCx->CFGR2, ADC_CFGR2_OVSS));
Kojto 122:f9eeca106725 5531 }
Kojto 122:f9eeca106725 5532
Kojto 122:f9eeca106725 5533 /**
Kojto 122:f9eeca106725 5534 * @}
Kojto 122:f9eeca106725 5535 */
Kojto 122:f9eeca106725 5536
Kojto 122:f9eeca106725 5537 /** @defgroup ADC_LL_EF_Configuration_ADC_Multimode Configuration of ADC hierarchical scope: multimode
Kojto 122:f9eeca106725 5538 * @{
Kojto 122:f9eeca106725 5539 */
Kojto 122:f9eeca106725 5540
Kojto 122:f9eeca106725 5541 #if defined(ADC_MULTIMODE_SUPPORT)
Kojto 122:f9eeca106725 5542 /**
Kojto 122:f9eeca106725 5543 * @brief Set ADC multimode configuration to operate in independent mode
Kojto 122:f9eeca106725 5544 * or multimode (for devices with several ADC instances).
Kojto 122:f9eeca106725 5545 * @note If multimode configuration: the selected ADC instance is
Kojto 122:f9eeca106725 5546 * either master or slave depending on hardware.
Kojto 122:f9eeca106725 5547 * Refer to reference manual.
Kojto 122:f9eeca106725 5548 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 5549 * ADC state:
Kojto 122:f9eeca106725 5550 * All ADC instances of the ADC common group must be disabled.
Kojto 122:f9eeca106725 5551 * This check can be done with function @ref LL_ADC_IsEnabled() for each
Kojto 122:f9eeca106725 5552 * ADC instance or by using helper macro
Kojto 122:f9eeca106725 5553 * @ref __LL_ADC_IS_ENABLED_ALL_COMMON_INSTANCE().
Kojto 122:f9eeca106725 5554 * @rmtoll CCR DUAL LL_ADC_SetMultimode
Kojto 122:f9eeca106725 5555 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 5556 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 5557 * @param Multimode This parameter can be one of the following values:
Kojto 122:f9eeca106725 5558 * @arg @ref LL_ADC_MULTI_INDEPENDENT
Kojto 122:f9eeca106725 5559 * @arg @ref LL_ADC_MULTI_DUAL_REG_SIMULT
Kojto 122:f9eeca106725 5560 * @arg @ref LL_ADC_MULTI_DUAL_REG_INTERL
Kojto 122:f9eeca106725 5561 * @arg @ref LL_ADC_MULTI_DUAL_INJ_SIMULT
Kojto 122:f9eeca106725 5562 * @arg @ref LL_ADC_MULTI_DUAL_INJ_ALTERN
Kojto 122:f9eeca106725 5563 * @arg @ref LL_ADC_MULTI_DUAL_REG_SIM_INJ_SIM
Kojto 122:f9eeca106725 5564 * @arg @ref LL_ADC_MULTI_DUAL_REG_SIM_INJ_ALT
Kojto 122:f9eeca106725 5565 * @arg @ref LL_ADC_MULTI_DUAL_REG_INT_INJ_SIM
Kojto 122:f9eeca106725 5566 * @retval None
Kojto 122:f9eeca106725 5567 */
Kojto 122:f9eeca106725 5568 __STATIC_INLINE void LL_ADC_SetMultimode(ADC_Common_TypeDef *ADCxy_COMMON, uint32_t Multimode)
Kojto 122:f9eeca106725 5569 {
Kojto 122:f9eeca106725 5570 MODIFY_REG(ADCxy_COMMON->CCR, ADC_CCR_DUAL, Multimode);
Kojto 122:f9eeca106725 5571 }
Kojto 122:f9eeca106725 5572
Kojto 122:f9eeca106725 5573 /**
Kojto 122:f9eeca106725 5574 * @brief Get ADC multimode configuration to operate in independent mode
Kojto 122:f9eeca106725 5575 * or multimode (for devices with several ADC instances).
Kojto 122:f9eeca106725 5576 * @note If multimode configuration: the selected ADC instance is
Kojto 122:f9eeca106725 5577 * either master or slave depending on hardware.
Kojto 122:f9eeca106725 5578 * Refer to reference manual.
Kojto 122:f9eeca106725 5579 * @rmtoll CCR DUAL LL_ADC_GetMultimode
Kojto 122:f9eeca106725 5580 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 5581 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 5582 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 5583 * @arg @ref LL_ADC_MULTI_INDEPENDENT
Kojto 122:f9eeca106725 5584 * @arg @ref LL_ADC_MULTI_DUAL_REG_SIMULT
Kojto 122:f9eeca106725 5585 * @arg @ref LL_ADC_MULTI_DUAL_REG_INTERL
Kojto 122:f9eeca106725 5586 * @arg @ref LL_ADC_MULTI_DUAL_INJ_SIMULT
Kojto 122:f9eeca106725 5587 * @arg @ref LL_ADC_MULTI_DUAL_INJ_ALTERN
Kojto 122:f9eeca106725 5588 * @arg @ref LL_ADC_MULTI_DUAL_REG_SIM_INJ_SIM
Kojto 122:f9eeca106725 5589 * @arg @ref LL_ADC_MULTI_DUAL_REG_SIM_INJ_ALT
Kojto 122:f9eeca106725 5590 * @arg @ref LL_ADC_MULTI_DUAL_REG_INT_INJ_SIM
Kojto 122:f9eeca106725 5591 */
Kojto 122:f9eeca106725 5592 __STATIC_INLINE uint32_t LL_ADC_GetMultimode(ADC_Common_TypeDef *ADCxy_COMMON)
Kojto 122:f9eeca106725 5593 {
Kojto 122:f9eeca106725 5594 return (uint32_t)(READ_BIT(ADCxy_COMMON->CCR, ADC_CCR_DUAL));
Kojto 122:f9eeca106725 5595 }
Kojto 122:f9eeca106725 5596
Kojto 122:f9eeca106725 5597 /**
Kojto 122:f9eeca106725 5598 * @brief Set ADC multimode conversion data transfer: no transfer
Kojto 122:f9eeca106725 5599 * or transfer by DMA.
Kojto 122:f9eeca106725 5600 * @note If ADC multimode transfer by DMA is not selected:
Kojto 122:f9eeca106725 5601 * each ADC uses its own DMA channel, with its individual
Kojto 122:f9eeca106725 5602 * DMA transfer settings.
Kojto 122:f9eeca106725 5603 * If ADC multimode transfer by DMA is selected:
Kojto 122:f9eeca106725 5604 * One DMA channel is used for both ADC (DMA of ADC master)
Kojto 122:f9eeca106725 5605 * Specifies the DMA requests mode:
Kojto 122:f9eeca106725 5606 * - Limited mode (One shot mode): DMA transfer requests are stopped
Kojto 122:f9eeca106725 5607 * when number of DMA data transfers (number of
Kojto 122:f9eeca106725 5608 * ADC conversions) is reached.
Kojto 122:f9eeca106725 5609 * This ADC mode is intended to be used with DMA mode non-circular.
Kojto 122:f9eeca106725 5610 * - Unlimited mode: DMA transfer requests are unlimited,
Kojto 122:f9eeca106725 5611 * whatever number of DMA data transfers (number of
Kojto 122:f9eeca106725 5612 * ADC conversions).
Kojto 122:f9eeca106725 5613 * This ADC mode is intended to be used with DMA mode circular.
Kojto 122:f9eeca106725 5614 * @note If ADC DMA requests mode is set to unlimited and DMA is set to
Kojto 122:f9eeca106725 5615 * mode non-circular:
Kojto 122:f9eeca106725 5616 * when DMA transfers size will be reached, DMA will stop transfers of
Kojto 122:f9eeca106725 5617 * ADC conversions data ADC will raise an overrun error
Kojto 122:f9eeca106725 5618 * (overrun flag and interruption if enabled).
Kojto 122:f9eeca106725 5619 * @note How to retrieve multimode conversion data:
Kojto 122:f9eeca106725 5620 * Whatever multimode transfer by DMA setting: using function
Kojto 122:f9eeca106725 5621 * @ref LL_ADC_REG_ReadMultiConversionData32().
Kojto 122:f9eeca106725 5622 * If ADC multimode transfer by DMA is selected: conversion data
Kojto 122:f9eeca106725 5623 * is a raw data with ADC master and slave concatenated.
Kojto 122:f9eeca106725 5624 * A macro is available to get the conversion data of
Kojto 122:f9eeca106725 5625 * ADC master or ADC slave: see helper macro
Kojto 122:f9eeca106725 5626 * @ref __LL_ADC_MULTI_CONV_DATA_MASTER_SLAVE().
Kojto 122:f9eeca106725 5627 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 5628 * ADC state:
Kojto 122:f9eeca106725 5629 * All ADC instances of the ADC common group must be disabled
Kojto 122:f9eeca106725 5630 * or enabled without conversion on going on group regular.
Kojto 122:f9eeca106725 5631 * @rmtoll CCR MDMA LL_ADC_SetMultiDMATransfer\n
Kojto 122:f9eeca106725 5632 * CCR DMACFG LL_ADC_SetMultiDMATransfer
Kojto 122:f9eeca106725 5633 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 5634 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 5635 * @param MultiDMATransfer This parameter can be one of the following values:
Kojto 122:f9eeca106725 5636 * @arg @ref LL_ADC_MULTI_REG_DMA_EACH_ADC
Kojto 122:f9eeca106725 5637 * @arg @ref LL_ADC_MULTI_REG_DMA_LIMIT_RES12_10B
Kojto 122:f9eeca106725 5638 * @arg @ref LL_ADC_MULTI_REG_DMA_LIMIT_RES8_6B
Kojto 122:f9eeca106725 5639 * @arg @ref LL_ADC_MULTI_REG_DMA_UNLMT_RES12_10B
Kojto 122:f9eeca106725 5640 * @arg @ref LL_ADC_MULTI_REG_DMA_UNLMT_RES8_6B
Kojto 122:f9eeca106725 5641 * @retval None
Kojto 122:f9eeca106725 5642 */
Kojto 122:f9eeca106725 5643 __STATIC_INLINE void LL_ADC_SetMultiDMATransfer(ADC_Common_TypeDef *ADCxy_COMMON, uint32_t MultiDMATransfer)
Kojto 122:f9eeca106725 5644 {
Kojto 122:f9eeca106725 5645 MODIFY_REG(ADCxy_COMMON->CCR, ADC_CCR_MDMA | ADC_CCR_DMACFG, MultiDMATransfer);
Kojto 122:f9eeca106725 5646 }
Kojto 122:f9eeca106725 5647
Kojto 122:f9eeca106725 5648 /**
Kojto 122:f9eeca106725 5649 * @brief Get ADC multimode conversion data transfer: no transfer
Kojto 122:f9eeca106725 5650 * or transfer by DMA.
Kojto 122:f9eeca106725 5651 * @note If ADC multimode transfer by DMA is not selected:
Kojto 122:f9eeca106725 5652 * each ADC uses its own DMA channel, with its individual
Kojto 122:f9eeca106725 5653 * DMA transfer settings.
Kojto 122:f9eeca106725 5654 * If ADC multimode transfer by DMA is selected:
Kojto 122:f9eeca106725 5655 * One DMA channel is used for both ADC (DMA of ADC master)
Kojto 122:f9eeca106725 5656 * Specifies the DMA requests mode:
Kojto 122:f9eeca106725 5657 * - Limited mode (One shot mode): DMA transfer requests are stopped
Kojto 122:f9eeca106725 5658 * when number of DMA data transfers (number of
Kojto 122:f9eeca106725 5659 * ADC conversions) is reached.
Kojto 122:f9eeca106725 5660 * This ADC mode is intended to be used with DMA mode non-circular.
Kojto 122:f9eeca106725 5661 * - Unlimited mode: DMA transfer requests are unlimited,
Kojto 122:f9eeca106725 5662 * whatever number of DMA data transfers (number of
Kojto 122:f9eeca106725 5663 * ADC conversions).
Kojto 122:f9eeca106725 5664 * This ADC mode is intended to be used with DMA mode circular.
Kojto 122:f9eeca106725 5665 * @note If ADC DMA requests mode is set to unlimited and DMA is set to
Kojto 122:f9eeca106725 5666 * mode non-circular:
Kojto 122:f9eeca106725 5667 * when DMA transfers size will be reached, DMA will stop transfers of
Kojto 122:f9eeca106725 5668 * ADC conversions data ADC will raise an overrun error
Kojto 122:f9eeca106725 5669 * (overrun flag and interruption if enabled).
Kojto 122:f9eeca106725 5670 * @note How to retrieve multimode conversion data:
Kojto 122:f9eeca106725 5671 * Whatever multimode transfer by DMA setting: using function
Kojto 122:f9eeca106725 5672 * @ref LL_ADC_REG_ReadMultiConversionData32().
Kojto 122:f9eeca106725 5673 * If ADC multimode transfer by DMA is selected: conversion data
Kojto 122:f9eeca106725 5674 * is a raw data with ADC master and slave concatenated.
Kojto 122:f9eeca106725 5675 * A macro is available to get the conversion data of
Kojto 122:f9eeca106725 5676 * ADC master or ADC slave: see helper macro
Kojto 122:f9eeca106725 5677 * @ref __LL_ADC_MULTI_CONV_DATA_MASTER_SLAVE().
Kojto 122:f9eeca106725 5678 * @rmtoll CCR MDMA LL_ADC_GetMultiDMATransfer\n
Kojto 122:f9eeca106725 5679 * CCR DMACFG LL_ADC_GetMultiDMATransfer
Kojto 122:f9eeca106725 5680 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 5681 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 5682 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 5683 * @arg @ref LL_ADC_MULTI_REG_DMA_EACH_ADC
Kojto 122:f9eeca106725 5684 * @arg @ref LL_ADC_MULTI_REG_DMA_LIMIT_RES12_10B
Kojto 122:f9eeca106725 5685 * @arg @ref LL_ADC_MULTI_REG_DMA_LIMIT_RES8_6B
Kojto 122:f9eeca106725 5686 * @arg @ref LL_ADC_MULTI_REG_DMA_UNLMT_RES12_10B
Kojto 122:f9eeca106725 5687 * @arg @ref LL_ADC_MULTI_REG_DMA_UNLMT_RES8_6B
Kojto 122:f9eeca106725 5688 */
Kojto 122:f9eeca106725 5689 __STATIC_INLINE uint32_t LL_ADC_GetMultiDMATransfer(ADC_Common_TypeDef *ADCxy_COMMON)
Kojto 122:f9eeca106725 5690 {
Kojto 122:f9eeca106725 5691 return (uint32_t)(READ_BIT(ADCxy_COMMON->CCR, ADC_CCR_MDMA | ADC_CCR_DMACFG));
Kojto 122:f9eeca106725 5692 }
Kojto 122:f9eeca106725 5693
Kojto 122:f9eeca106725 5694 /**
Kojto 122:f9eeca106725 5695 * @brief Set ADC multimode delay between 2 sampling phases.
Kojto 122:f9eeca106725 5696 * @note The sampling delay range depends on ADC resolution:
Kojto 122:f9eeca106725 5697 * - ADC resolution 12 bits can have maximum delay of 12 cycles.
Kojto 122:f9eeca106725 5698 * - ADC resolution 10 bits can have maximum delay of 10 cycles.
Kojto 122:f9eeca106725 5699 * - ADC resolution 8 bits can have maximum delay of 8 cycles.
Kojto 122:f9eeca106725 5700 * - ADC resolution 6 bits can have maximum delay of 6 cycles.
Kojto 122:f9eeca106725 5701 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 5702 * ADC state:
Kojto 122:f9eeca106725 5703 * All ADC instances of the ADC common group must be disabled.
Kojto 122:f9eeca106725 5704 * This check can be done with function @ref LL_ADC_IsEnabled() for each
Kojto 122:f9eeca106725 5705 * ADC instance or by using helper macro helper macro
Kojto 122:f9eeca106725 5706 * @ref __LL_ADC_IS_ENABLED_ALL_COMMON_INSTANCE().
Kojto 122:f9eeca106725 5707 * @rmtoll CCR DELAY LL_ADC_SetMultiTwoSamplingDelay
Kojto 122:f9eeca106725 5708 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 5709 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 5710 * @param MultiTwoSamplingDelay This parameter can be one of the following values:
Kojto 122:f9eeca106725 5711 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_1CYCLE
Kojto 122:f9eeca106725 5712 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_2CYCLES
Kojto 122:f9eeca106725 5713 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_3CYCLES
Kojto 122:f9eeca106725 5714 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_4CYCLES
Kojto 122:f9eeca106725 5715 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_5CYCLES
Kojto 122:f9eeca106725 5716 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_6CYCLES (1)
Kojto 122:f9eeca106725 5717 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_7CYCLES (1)
Kojto 122:f9eeca106725 5718 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_8CYCLES (2)
Kojto 122:f9eeca106725 5719 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_9CYCLES (2)
Kojto 122:f9eeca106725 5720 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_10CYCLES (2)
Kojto 122:f9eeca106725 5721 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_11CYCLES (3)
Kojto 122:f9eeca106725 5722 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_12CYCLES (3)
Kojto 122:f9eeca106725 5723 *
Kojto 122:f9eeca106725 5724 * (1) Parameter available only if ADC resolution is 12, 10 or 8 bits.\n
Kojto 122:f9eeca106725 5725 * (2) Parameter available only if ADC resolution is 12 or 10 bits.\n
Kojto 122:f9eeca106725 5726 * (3) Parameter available only if ADC resolution is 12 bits.
Kojto 122:f9eeca106725 5727 * @retval None
Kojto 122:f9eeca106725 5728 */
Kojto 122:f9eeca106725 5729 __STATIC_INLINE void LL_ADC_SetMultiTwoSamplingDelay(ADC_Common_TypeDef *ADCxy_COMMON, uint32_t MultiTwoSamplingDelay)
Kojto 122:f9eeca106725 5730 {
Kojto 122:f9eeca106725 5731 MODIFY_REG(ADCxy_COMMON->CCR, ADC_CCR_DELAY, MultiTwoSamplingDelay);
Kojto 122:f9eeca106725 5732 }
Kojto 122:f9eeca106725 5733
Kojto 122:f9eeca106725 5734 /**
Kojto 122:f9eeca106725 5735 * @brief Get ADC multimode delay between 2 sampling phases.
Kojto 122:f9eeca106725 5736 * @rmtoll CCR DELAY LL_ADC_GetMultiTwoSamplingDelay
Kojto 122:f9eeca106725 5737 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 5738 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 5739 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 5740 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_1CYCLE
Kojto 122:f9eeca106725 5741 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_2CYCLES
Kojto 122:f9eeca106725 5742 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_3CYCLES
Kojto 122:f9eeca106725 5743 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_4CYCLES
Kojto 122:f9eeca106725 5744 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_5CYCLES
Kojto 122:f9eeca106725 5745 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_6CYCLES (1)
Kojto 122:f9eeca106725 5746 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_7CYCLES (1)
Kojto 122:f9eeca106725 5747 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_8CYCLES (2)
Kojto 122:f9eeca106725 5748 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_9CYCLES (2)
Kojto 122:f9eeca106725 5749 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_10CYCLES (2)
Kojto 122:f9eeca106725 5750 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_11CYCLES (3)
Kojto 122:f9eeca106725 5751 * @arg @ref LL_ADC_MULTI_TWOSMP_DELAY_12CYCLES (3)
Kojto 122:f9eeca106725 5752 *
Kojto 122:f9eeca106725 5753 * (1) Parameter available only if ADC resolution is 12, 10 or 8 bits.\n
Kojto 122:f9eeca106725 5754 * (2) Parameter available only if ADC resolution is 12 or 10 bits.\n
Kojto 122:f9eeca106725 5755 * (3) Parameter available only if ADC resolution is 12 bits.
Kojto 122:f9eeca106725 5756 */
Kojto 122:f9eeca106725 5757 __STATIC_INLINE uint32_t LL_ADC_GetMultiTwoSamplingDelay(ADC_Common_TypeDef *ADCxy_COMMON)
Kojto 122:f9eeca106725 5758 {
Kojto 122:f9eeca106725 5759 return (uint32_t)(READ_BIT(ADCxy_COMMON->CCR, ADC_CCR_DELAY));
Kojto 122:f9eeca106725 5760 }
Kojto 122:f9eeca106725 5761 #endif /* ADC_MULTIMODE_SUPPORT */
Kojto 122:f9eeca106725 5762
Kojto 122:f9eeca106725 5763 /**
Kojto 122:f9eeca106725 5764 * @}
Kojto 122:f9eeca106725 5765 */
Kojto 122:f9eeca106725 5766 /** @defgroup ADC_LL_EF_Configuration_Leg_Functions Configuration of ADC alternate functions name
Kojto 122:f9eeca106725 5767 * @{
Kojto 122:f9eeca106725 5768 */
Kojto 122:f9eeca106725 5769 /* Old functions name kept for legacy purpose, to be replaced by the */
Kojto 122:f9eeca106725 5770 /* current functions name. */
Kojto 122:f9eeca106725 5771 __STATIC_INLINE void LL_ADC_REG_SetTrigSource(ADC_TypeDef *ADCx, uint32_t TriggerSource)
Kojto 122:f9eeca106725 5772 {
AnnaBridge 145:64910690c574 5773 LL_ADC_REG_SetTriggerSource(ADCx, TriggerSource);
Kojto 122:f9eeca106725 5774 }
Kojto 122:f9eeca106725 5775 __STATIC_INLINE void LL_ADC_INJ_SetTrigSource(ADC_TypeDef *ADCx, uint32_t TriggerSource)
Kojto 122:f9eeca106725 5776 {
AnnaBridge 145:64910690c574 5777 LL_ADC_INJ_SetTriggerSource(ADCx, TriggerSource);
Kojto 122:f9eeca106725 5778 }
Kojto 122:f9eeca106725 5779
Kojto 122:f9eeca106725 5780 /**
Kojto 122:f9eeca106725 5781 * @}
Kojto 122:f9eeca106725 5782 */
Kojto 122:f9eeca106725 5783
Kojto 122:f9eeca106725 5784 /** @defgroup ADC_LL_EF_Operation_ADC_Instance Operation on ADC hierarchical scope: ADC instance
Kojto 122:f9eeca106725 5785 * @{
Kojto 122:f9eeca106725 5786 */
Kojto 122:f9eeca106725 5787
Kojto 122:f9eeca106725 5788 /**
Kojto 122:f9eeca106725 5789 * @brief Put ADC instance in deep power down state.
Kojto 122:f9eeca106725 5790 * @note In case of ADC calibration necessary: When ADC is in deep-power-down
Kojto 122:f9eeca106725 5791 * state, the internal analog calibration is lost. After exiting from
Kojto 122:f9eeca106725 5792 * deep power down, calibration must be relaunched or calibration factor
Kojto 122:f9eeca106725 5793 * (preliminarily saved) must be set back into calibration register.
Kojto 122:f9eeca106725 5794 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 5795 * ADC state:
Kojto 122:f9eeca106725 5796 * ADC must be ADC disabled.
Kojto 122:f9eeca106725 5797 * @rmtoll CR DEEPPWD LL_ADC_EnableDeepPowerDown
Kojto 122:f9eeca106725 5798 * @param ADCx ADC instance
Kojto 122:f9eeca106725 5799 * @retval None
Kojto 122:f9eeca106725 5800 */
Kojto 122:f9eeca106725 5801 __STATIC_INLINE void LL_ADC_EnableDeepPowerDown(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 5802 {
Kojto 122:f9eeca106725 5803 /* Note: Write register with some additional bits forced to state reset */
Kojto 122:f9eeca106725 5804 /* instead of modifying only the selected bit for this function, */
Kojto 122:f9eeca106725 5805 /* to not interfere with bits with HW property "rs". */
Kojto 122:f9eeca106725 5806 MODIFY_REG(ADCx->CR,
Kojto 122:f9eeca106725 5807 ADC_CR_BITS_PROPERTY_RS,
Kojto 122:f9eeca106725 5808 ADC_CR_DEEPPWD);
Kojto 122:f9eeca106725 5809 }
Kojto 122:f9eeca106725 5810
Kojto 122:f9eeca106725 5811 /**
Kojto 122:f9eeca106725 5812 * @brief Disable ADC deep power down mode.
Kojto 122:f9eeca106725 5813 * @note In case of ADC calibration necessary: When ADC is in deep-power-down
Kojto 122:f9eeca106725 5814 * state, the internal analog calibration is lost. After exiting from
Kojto 122:f9eeca106725 5815 * deep power down, calibration must be relaunched or calibration factor
Kojto 122:f9eeca106725 5816 * (preliminarily saved) must be set back into calibration register.
Kojto 122:f9eeca106725 5817 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 5818 * ADC state:
Kojto 122:f9eeca106725 5819 * ADC must be ADC disabled.
Kojto 122:f9eeca106725 5820 * @rmtoll CR DEEPPWD LL_ADC_DisableDeepPowerDown
Kojto 122:f9eeca106725 5821 * @param ADCx ADC instance
Kojto 122:f9eeca106725 5822 * @retval None
Kojto 122:f9eeca106725 5823 */
Kojto 122:f9eeca106725 5824 __STATIC_INLINE void LL_ADC_DisableDeepPowerDown(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 5825 {
Kojto 122:f9eeca106725 5826 /* Note: Write register with some additional bits forced to state reset */
Kojto 122:f9eeca106725 5827 /* instead of modifying only the selected bit for this function, */
Kojto 122:f9eeca106725 5828 /* to not interfere with bits with HW property "rs". */
Kojto 122:f9eeca106725 5829 CLEAR_BIT(ADCx->CR, (ADC_CR_DEEPPWD | ADC_CR_BITS_PROPERTY_RS));
Kojto 122:f9eeca106725 5830 }
Kojto 122:f9eeca106725 5831
Kojto 122:f9eeca106725 5832 /**
Kojto 122:f9eeca106725 5833 * @brief Get the selected ADC instance deep power down state.
Kojto 122:f9eeca106725 5834 * @rmtoll CR DEEPPWD LL_ADC_IsDeepPowerDownEnabled
Kojto 122:f9eeca106725 5835 * @param ADCx ADC instance
Kojto 122:f9eeca106725 5836 * @retval 0: deep power down is disabled, 1: deep power down is enabled.
Kojto 122:f9eeca106725 5837 */
Kojto 122:f9eeca106725 5838 __STATIC_INLINE uint32_t LL_ADC_IsDeepPowerDownEnabled(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 5839 {
Kojto 122:f9eeca106725 5840 return (READ_BIT(ADCx->CR, ADC_CR_DEEPPWD) == (ADC_CR_DEEPPWD));
Kojto 122:f9eeca106725 5841 }
Kojto 122:f9eeca106725 5842
Kojto 122:f9eeca106725 5843 /**
Kojto 122:f9eeca106725 5844 * @brief Enable ADC instance internal voltage regulator.
Kojto 122:f9eeca106725 5845 * @note On this STM32 serie, after ADC internal voltage regulator enable,
Kojto 122:f9eeca106725 5846 * a delay for ADC internal voltage regulator stabilization
Kojto 122:f9eeca106725 5847 * is required before performing a ADC calibration or ADC enable.
Kojto 122:f9eeca106725 5848 * Refer to device datasheet, parameter tADCVREG_STUP.
Kojto 122:f9eeca106725 5849 * Refer to literal @ref LL_ADC_DELAY_INTERNAL_REGUL_STAB_US.
Kojto 122:f9eeca106725 5850 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 5851 * ADC state:
Kojto 122:f9eeca106725 5852 * ADC must be ADC disabled.
Kojto 122:f9eeca106725 5853 * @rmtoll CR ADVREGEN LL_ADC_EnableInternalRegulator
Kojto 122:f9eeca106725 5854 * @param ADCx ADC instance
Kojto 122:f9eeca106725 5855 * @retval None
Kojto 122:f9eeca106725 5856 */
Kojto 122:f9eeca106725 5857 __STATIC_INLINE void LL_ADC_EnableInternalRegulator(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 5858 {
Kojto 122:f9eeca106725 5859 /* Note: Write register with some additional bits forced to state reset */
Kojto 122:f9eeca106725 5860 /* instead of modifying only the selected bit for this function, */
Kojto 122:f9eeca106725 5861 /* to not interfere with bits with HW property "rs". */
Kojto 122:f9eeca106725 5862 MODIFY_REG(ADCx->CR,
Kojto 122:f9eeca106725 5863 ADC_CR_BITS_PROPERTY_RS,
Kojto 122:f9eeca106725 5864 ADC_CR_ADVREGEN);
Kojto 122:f9eeca106725 5865 }
Kojto 122:f9eeca106725 5866
Kojto 122:f9eeca106725 5867 /**
Kojto 122:f9eeca106725 5868 * @brief Disable ADC internal voltage regulator.
Kojto 122:f9eeca106725 5869 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 5870 * ADC state:
Kojto 122:f9eeca106725 5871 * ADC must be ADC disabled.
Kojto 122:f9eeca106725 5872 * @rmtoll CR ADVREGEN LL_ADC_DisableInternalRegulator
Kojto 122:f9eeca106725 5873 * @param ADCx ADC instance
Kojto 122:f9eeca106725 5874 * @retval None
Kojto 122:f9eeca106725 5875 */
Kojto 122:f9eeca106725 5876 __STATIC_INLINE void LL_ADC_DisableInternalRegulator(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 5877 {
Kojto 122:f9eeca106725 5878 CLEAR_BIT(ADCx->CR, (ADC_CR_ADVREGEN | ADC_CR_BITS_PROPERTY_RS));
Kojto 122:f9eeca106725 5879 }
Kojto 122:f9eeca106725 5880
Kojto 122:f9eeca106725 5881 /**
Kojto 122:f9eeca106725 5882 * @brief Get the selected ADC instance internal voltage regulator state.
Kojto 122:f9eeca106725 5883 * @rmtoll CR ADVREGEN LL_ADC_IsInternalRegulatorEnabled
Kojto 122:f9eeca106725 5884 * @param ADCx ADC instance
Kojto 122:f9eeca106725 5885 * @retval 0: internal regulator is disabled, 1: internal regulator is enabled.
Kojto 122:f9eeca106725 5886 */
Kojto 122:f9eeca106725 5887 __STATIC_INLINE uint32_t LL_ADC_IsInternalRegulatorEnabled(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 5888 {
Kojto 122:f9eeca106725 5889 return (READ_BIT(ADCx->CR, ADC_CR_ADVREGEN) == (ADC_CR_ADVREGEN));
Kojto 122:f9eeca106725 5890 }
Kojto 122:f9eeca106725 5891
Kojto 122:f9eeca106725 5892 /**
Kojto 122:f9eeca106725 5893 * @brief Enable the selected ADC instance.
Kojto 122:f9eeca106725 5894 * @note On this STM32 serie, after ADC enable, a delay for
Kojto 122:f9eeca106725 5895 * ADC internal analog stabilization is required before performing a
Kojto 122:f9eeca106725 5896 * ADC conversion start.
Kojto 122:f9eeca106725 5897 * Refer to device datasheet, parameter tSTAB.
Kojto 122:f9eeca106725 5898 * @note On this STM32 serie, flag LL_ADC_FLAG_ADRDY is raised when the ADC
Kojto 122:f9eeca106725 5899 * is enabled and when conversion clock is active.
Kojto 122:f9eeca106725 5900 * (not only core clock: this ADC has a dual clock domain)
Kojto 122:f9eeca106725 5901 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 5902 * ADC state:
Kojto 122:f9eeca106725 5903 * ADC must be ADC disabled and ADC internal voltage regulator enabled.
Kojto 122:f9eeca106725 5904 * @rmtoll CR ADEN LL_ADC_Enable
Kojto 122:f9eeca106725 5905 * @param ADCx ADC instance
Kojto 122:f9eeca106725 5906 * @retval None
Kojto 122:f9eeca106725 5907 */
Kojto 122:f9eeca106725 5908 __STATIC_INLINE void LL_ADC_Enable(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 5909 {
Kojto 122:f9eeca106725 5910 /* Note: Write register with some additional bits forced to state reset */
Kojto 122:f9eeca106725 5911 /* instead of modifying only the selected bit for this function, */
Kojto 122:f9eeca106725 5912 /* to not interfere with bits with HW property "rs". */
Kojto 122:f9eeca106725 5913 MODIFY_REG(ADCx->CR,
Kojto 122:f9eeca106725 5914 ADC_CR_BITS_PROPERTY_RS,
Kojto 122:f9eeca106725 5915 ADC_CR_ADEN);
Kojto 122:f9eeca106725 5916 }
Kojto 122:f9eeca106725 5917
Kojto 122:f9eeca106725 5918 /**
Kojto 122:f9eeca106725 5919 * @brief Disable the selected ADC instance.
Kojto 122:f9eeca106725 5920 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 5921 * ADC state:
Kojto 122:f9eeca106725 5922 * ADC must be not disabled. Must be enabled without conversion on going
Kojto 122:f9eeca106725 5923 * on either groups regular or injected.
Kojto 122:f9eeca106725 5924 * @rmtoll CR ADDIS LL_ADC_Disable
Kojto 122:f9eeca106725 5925 * @param ADCx ADC instance
Kojto 122:f9eeca106725 5926 * @retval None
Kojto 122:f9eeca106725 5927 */
Kojto 122:f9eeca106725 5928 __STATIC_INLINE void LL_ADC_Disable(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 5929 {
Kojto 122:f9eeca106725 5930 /* Note: Write register with some additional bits forced to state reset */
Kojto 122:f9eeca106725 5931 /* instead of modifying only the selected bit for this function, */
Kojto 122:f9eeca106725 5932 /* to not interfere with bits with HW property "rs". */
Kojto 122:f9eeca106725 5933 MODIFY_REG(ADCx->CR,
Kojto 122:f9eeca106725 5934 ADC_CR_BITS_PROPERTY_RS,
Kojto 122:f9eeca106725 5935 ADC_CR_ADDIS);
Kojto 122:f9eeca106725 5936 }
Kojto 122:f9eeca106725 5937
Kojto 122:f9eeca106725 5938 /**
Kojto 122:f9eeca106725 5939 * @brief Get the selected ADC instance enable state.
Kojto 122:f9eeca106725 5940 * @note On this STM32 serie, flag LL_ADC_FLAG_ADRDY is raised when the ADC
Kojto 122:f9eeca106725 5941 * is enabled and when conversion clock is active.
Kojto 122:f9eeca106725 5942 * (not only core clock: this ADC has a dual clock domain)
Kojto 122:f9eeca106725 5943 * @rmtoll CR ADEN LL_ADC_IsEnabled
Kojto 122:f9eeca106725 5944 * @param ADCx ADC instance
Kojto 122:f9eeca106725 5945 * @retval 0: ADC is disabled, 1: ADC is enabled.
Kojto 122:f9eeca106725 5946 */
Kojto 122:f9eeca106725 5947 __STATIC_INLINE uint32_t LL_ADC_IsEnabled(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 5948 {
Kojto 122:f9eeca106725 5949 return (READ_BIT(ADCx->CR, ADC_CR_ADEN) == (ADC_CR_ADEN));
Kojto 122:f9eeca106725 5950 }
Kojto 122:f9eeca106725 5951
Kojto 122:f9eeca106725 5952 /**
Kojto 122:f9eeca106725 5953 * @brief Get the selected ADC instance disable state.
Kojto 122:f9eeca106725 5954 * @rmtoll CR ADDIS LL_ADC_IsDisableOngoing
Kojto 122:f9eeca106725 5955 * @param ADCx ADC instance
Kojto 122:f9eeca106725 5956 * @retval 0: no ADC disable command on going.
Kojto 122:f9eeca106725 5957 */
Kojto 122:f9eeca106725 5958 __STATIC_INLINE uint32_t LL_ADC_IsDisableOngoing(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 5959 {
Kojto 122:f9eeca106725 5960 return (READ_BIT(ADCx->CR, ADC_CR_ADDIS) == (ADC_CR_ADDIS));
Kojto 122:f9eeca106725 5961 }
Kojto 122:f9eeca106725 5962
Kojto 122:f9eeca106725 5963 /**
Kojto 122:f9eeca106725 5964 * @brief Start ADC calibration in the mode single-ended
Kojto 122:f9eeca106725 5965 * or differential (for devices with differential mode available).
Kojto 122:f9eeca106725 5966 * @note On this STM32 serie, a minimum number of ADC clock cycles
Kojto 122:f9eeca106725 5967 * are required between ADC end of calibration and ADC enable.
Kojto 122:f9eeca106725 5968 * Refer to literal @ref LL_ADC_DELAY_CALIB_ENABLE_ADC_CYCLES.
Kojto 122:f9eeca106725 5969 * @note For devices with differential mode available:
Kojto 122:f9eeca106725 5970 * Calibration of offset is specific to each of
Kojto 122:f9eeca106725 5971 * single-ended and differential modes
Kojto 122:f9eeca106725 5972 * (calibration run must be performed for each of these
Kojto 122:f9eeca106725 5973 * differential modes, if used afterwards and if the application
Kojto 122:f9eeca106725 5974 * requires their calibration).
Kojto 122:f9eeca106725 5975 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 5976 * ADC state:
Kojto 122:f9eeca106725 5977 * ADC must be ADC disabled.
Kojto 122:f9eeca106725 5978 * @rmtoll CR ADCAL LL_ADC_StartCalibration\n
Kojto 122:f9eeca106725 5979 * CR ADCALDIF LL_ADC_StartCalibration
Kojto 122:f9eeca106725 5980 * @param ADCx ADC instance
Kojto 122:f9eeca106725 5981 * @param SingleDiff This parameter can be one of the following values:
Kojto 122:f9eeca106725 5982 * @arg @ref LL_ADC_SINGLE_ENDED
Kojto 122:f9eeca106725 5983 * @arg @ref LL_ADC_DIFFERENTIAL_ENDED
Kojto 122:f9eeca106725 5984 * @retval None
Kojto 122:f9eeca106725 5985 */
Kojto 122:f9eeca106725 5986 __STATIC_INLINE void LL_ADC_StartCalibration(ADC_TypeDef *ADCx, uint32_t SingleDiff)
Kojto 122:f9eeca106725 5987 {
Kojto 122:f9eeca106725 5988 /* Note: Write register with some additional bits forced to state reset */
Kojto 122:f9eeca106725 5989 /* instead of modifying only the selected bit for this function, */
Kojto 122:f9eeca106725 5990 /* to not interfere with bits with HW property "rs". */
Kojto 122:f9eeca106725 5991 MODIFY_REG(ADCx->CR,
Kojto 122:f9eeca106725 5992 ADC_CR_ADCALDIF | ADC_CR_BITS_PROPERTY_RS,
Kojto 122:f9eeca106725 5993 ADC_CR_ADCAL | (SingleDiff & ADC_SINGLEDIFF_CALIB_START_MASK));
Kojto 122:f9eeca106725 5994 }
Kojto 122:f9eeca106725 5995
Kojto 122:f9eeca106725 5996 /**
Kojto 122:f9eeca106725 5997 * @brief Get ADC calibration state.
Kojto 122:f9eeca106725 5998 * @rmtoll CR ADCAL LL_ADC_IsCalibrationOnGoing
Kojto 122:f9eeca106725 5999 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6000 * @retval 0: calibration complete, 1: calibration in progress.
Kojto 122:f9eeca106725 6001 */
Kojto 122:f9eeca106725 6002 __STATIC_INLINE uint32_t LL_ADC_IsCalibrationOnGoing(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6003 {
Kojto 122:f9eeca106725 6004 return (READ_BIT(ADCx->CR, ADC_CR_ADCAL) == (ADC_CR_ADCAL));
Kojto 122:f9eeca106725 6005 }
Kojto 122:f9eeca106725 6006
Kojto 122:f9eeca106725 6007 /**
Kojto 122:f9eeca106725 6008 * @}
Kojto 122:f9eeca106725 6009 */
Kojto 122:f9eeca106725 6010
Kojto 122:f9eeca106725 6011 /** @defgroup ADC_LL_EF_Operation_ADC_Group_Regular Operation on ADC hierarchical scope: group regular
Kojto 122:f9eeca106725 6012 * @{
Kojto 122:f9eeca106725 6013 */
Kojto 122:f9eeca106725 6014
Kojto 122:f9eeca106725 6015 /**
Kojto 122:f9eeca106725 6016 * @brief Start ADC group regular conversion.
Kojto 122:f9eeca106725 6017 * @note On this STM32 serie, this function is relevant for both
Kojto 122:f9eeca106725 6018 * internal trigger (SW start) and external trigger:
Kojto 122:f9eeca106725 6019 * - If ADC trigger has been set to software start, ADC conversion
Kojto 122:f9eeca106725 6020 * starts immediately.
Kojto 122:f9eeca106725 6021 * - If ADC trigger has been set to external trigger, ADC conversion
Kojto 122:f9eeca106725 6022 * will start at next trigger event (on the selected trigger edge)
Kojto 122:f9eeca106725 6023 * following the ADC start conversion command.
Kojto 122:f9eeca106725 6024 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 6025 * ADC state:
Kojto 122:f9eeca106725 6026 * ADC must be enabled without conversion on going on group regular,
AnnaBridge 145:64910690c574 6027 * without conversion stop command on going on group regular,
AnnaBridge 145:64910690c574 6028 * without ADC disable command on going.
Kojto 122:f9eeca106725 6029 * @rmtoll CR ADSTART LL_ADC_REG_StartConversion
Kojto 122:f9eeca106725 6030 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6031 * @retval None
Kojto 122:f9eeca106725 6032 */
Kojto 122:f9eeca106725 6033 __STATIC_INLINE void LL_ADC_REG_StartConversion(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6034 {
Kojto 122:f9eeca106725 6035 /* Note: Write register with some additional bits forced to state reset */
Kojto 122:f9eeca106725 6036 /* instead of modifying only the selected bit for this function, */
Kojto 122:f9eeca106725 6037 /* to not interfere with bits with HW property "rs". */
Kojto 122:f9eeca106725 6038 MODIFY_REG(ADCx->CR,
Kojto 122:f9eeca106725 6039 ADC_CR_BITS_PROPERTY_RS,
Kojto 122:f9eeca106725 6040 ADC_CR_ADSTART);
Kojto 122:f9eeca106725 6041 }
Kojto 122:f9eeca106725 6042
Kojto 122:f9eeca106725 6043 /**
Kojto 122:f9eeca106725 6044 * @brief Stop ADC group regular conversion.
Kojto 122:f9eeca106725 6045 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 6046 * ADC state:
Kojto 122:f9eeca106725 6047 * ADC must be enabled with conversion on going on group regular,
Kojto 122:f9eeca106725 6048 * without ADC disable command on going.
Kojto 122:f9eeca106725 6049 * @rmtoll CR ADSTP LL_ADC_REG_StopConversion
Kojto 122:f9eeca106725 6050 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6051 * @retval None
Kojto 122:f9eeca106725 6052 */
Kojto 122:f9eeca106725 6053 __STATIC_INLINE void LL_ADC_REG_StopConversion(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6054 {
Kojto 122:f9eeca106725 6055 /* Note: Write register with some additional bits forced to state reset */
Kojto 122:f9eeca106725 6056 /* instead of modifying only the selected bit for this function, */
Kojto 122:f9eeca106725 6057 /* to not interfere with bits with HW property "rs". */
Kojto 122:f9eeca106725 6058 MODIFY_REG(ADCx->CR,
Kojto 122:f9eeca106725 6059 ADC_CR_BITS_PROPERTY_RS,
Kojto 122:f9eeca106725 6060 ADC_CR_ADSTP);
Kojto 122:f9eeca106725 6061 }
Kojto 122:f9eeca106725 6062
Kojto 122:f9eeca106725 6063 /**
Kojto 122:f9eeca106725 6064 * @brief Get ADC group regular conversion state.
Kojto 122:f9eeca106725 6065 * @rmtoll CR ADSTART LL_ADC_REG_IsConversionOngoing
Kojto 122:f9eeca106725 6066 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6067 * @retval 0: no conversion is on going on ADC group regular.
Kojto 122:f9eeca106725 6068 */
Kojto 122:f9eeca106725 6069 __STATIC_INLINE uint32_t LL_ADC_REG_IsConversionOngoing(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6070 {
Kojto 122:f9eeca106725 6071 return (READ_BIT(ADCx->CR, ADC_CR_ADSTART) == (ADC_CR_ADSTART));
Kojto 122:f9eeca106725 6072 }
Kojto 122:f9eeca106725 6073
Kojto 122:f9eeca106725 6074 /**
Kojto 122:f9eeca106725 6075 * @brief Get ADC group regular command of conversion stop state
Kojto 122:f9eeca106725 6076 * @rmtoll CR ADSTP LL_ADC_REG_IsStopConversionOngoing
Kojto 122:f9eeca106725 6077 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6078 * @retval 0: no command of conversion stop is on going on ADC group regular.
Kojto 122:f9eeca106725 6079 */
Kojto 122:f9eeca106725 6080 __STATIC_INLINE uint32_t LL_ADC_REG_IsStopConversionOngoing(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6081 {
Kojto 122:f9eeca106725 6082 return (READ_BIT(ADCx->CR, ADC_CR_ADSTP) == (ADC_CR_ADSTP));
Kojto 122:f9eeca106725 6083 }
Kojto 122:f9eeca106725 6084
Kojto 122:f9eeca106725 6085 /**
Kojto 122:f9eeca106725 6086 * @brief Get ADC group regular conversion data, range fit for
Kojto 122:f9eeca106725 6087 * all ADC configurations: all ADC resolutions and
Kojto 122:f9eeca106725 6088 * all oversampling increased data width (for devices
Kojto 122:f9eeca106725 6089 * with feature oversampling).
Kojto 122:f9eeca106725 6090 * @rmtoll DR RDATA LL_ADC_REG_ReadConversionData32
Kojto 122:f9eeca106725 6091 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6092 * @retval Value between Min_Data=0x00000000 and Max_Data=0xFFFFFFFF
Kojto 122:f9eeca106725 6093 */
Kojto 122:f9eeca106725 6094 __STATIC_INLINE uint32_t LL_ADC_REG_ReadConversionData32(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6095 {
Kojto 122:f9eeca106725 6096 return (uint32_t)(READ_BIT(ADCx->DR, ADC_DR_RDATA));
Kojto 122:f9eeca106725 6097 }
Kojto 122:f9eeca106725 6098
Kojto 122:f9eeca106725 6099 /**
Kojto 122:f9eeca106725 6100 * @brief Get ADC group regular conversion data, range fit for
Kojto 122:f9eeca106725 6101 * ADC resolution 12 bits.
Kojto 122:f9eeca106725 6102 * @note For devices with feature oversampling: Oversampling
Kojto 122:f9eeca106725 6103 * can increase data width, function for extended range
Kojto 122:f9eeca106725 6104 * may be needed: @ref LL_ADC_REG_ReadConversionData32.
Kojto 122:f9eeca106725 6105 * @rmtoll DR RDATA LL_ADC_REG_ReadConversionData12
Kojto 122:f9eeca106725 6106 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6107 * @retval Value between Min_Data=0x000 and Max_Data=0xFFF
Kojto 122:f9eeca106725 6108 */
Kojto 122:f9eeca106725 6109 __STATIC_INLINE uint16_t LL_ADC_REG_ReadConversionData12(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6110 {
Kojto 122:f9eeca106725 6111 return (uint16_t)(READ_BIT(ADCx->DR, ADC_DR_RDATA));
Kojto 122:f9eeca106725 6112 }
Kojto 122:f9eeca106725 6113
Kojto 122:f9eeca106725 6114 /**
Kojto 122:f9eeca106725 6115 * @brief Get ADC group regular conversion data, range fit for
Kojto 122:f9eeca106725 6116 * ADC resolution 10 bits.
Kojto 122:f9eeca106725 6117 * @note For devices with feature oversampling: Oversampling
Kojto 122:f9eeca106725 6118 * can increase data width, function for extended range
Kojto 122:f9eeca106725 6119 * may be needed: @ref LL_ADC_REG_ReadConversionData32.
Kojto 122:f9eeca106725 6120 * @rmtoll DR RDATA LL_ADC_REG_ReadConversionData10
Kojto 122:f9eeca106725 6121 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6122 * @retval Value between Min_Data=0x000 and Max_Data=0x3FF
Kojto 122:f9eeca106725 6123 */
Kojto 122:f9eeca106725 6124 __STATIC_INLINE uint16_t LL_ADC_REG_ReadConversionData10(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6125 {
Kojto 122:f9eeca106725 6126 return (uint16_t)(READ_BIT(ADCx->DR, ADC_DR_RDATA));
Kojto 122:f9eeca106725 6127 }
Kojto 122:f9eeca106725 6128
Kojto 122:f9eeca106725 6129 /**
Kojto 122:f9eeca106725 6130 * @brief Get ADC group regular conversion data, range fit for
Kojto 122:f9eeca106725 6131 * ADC resolution 8 bits.
Kojto 122:f9eeca106725 6132 * @note For devices with feature oversampling: Oversampling
Kojto 122:f9eeca106725 6133 * can increase data width, function for extended range
Kojto 122:f9eeca106725 6134 * may be needed: @ref LL_ADC_REG_ReadConversionData32.
Kojto 122:f9eeca106725 6135 * @rmtoll DR RDATA LL_ADC_REG_ReadConversionData8
Kojto 122:f9eeca106725 6136 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6137 * @retval Value between Min_Data=0x00 and Max_Data=0xFF
Kojto 122:f9eeca106725 6138 */
Kojto 122:f9eeca106725 6139 __STATIC_INLINE uint8_t LL_ADC_REG_ReadConversionData8(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6140 {
Kojto 122:f9eeca106725 6141 return (uint8_t)(READ_BIT(ADCx->DR, ADC_DR_RDATA));
Kojto 122:f9eeca106725 6142 }
Kojto 122:f9eeca106725 6143
Kojto 122:f9eeca106725 6144 /**
Kojto 122:f9eeca106725 6145 * @brief Get ADC group regular conversion data, range fit for
Kojto 122:f9eeca106725 6146 * ADC resolution 6 bits.
Kojto 122:f9eeca106725 6147 * @note For devices with feature oversampling: Oversampling
Kojto 122:f9eeca106725 6148 * can increase data width, function for extended range
Kojto 122:f9eeca106725 6149 * may be needed: @ref LL_ADC_REG_ReadConversionData32.
Kojto 122:f9eeca106725 6150 * @rmtoll DR RDATA LL_ADC_REG_ReadConversionData6
Kojto 122:f9eeca106725 6151 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6152 * @retval Value between Min_Data=0x00 and Max_Data=0x3F
Kojto 122:f9eeca106725 6153 */
Kojto 122:f9eeca106725 6154 __STATIC_INLINE uint8_t LL_ADC_REG_ReadConversionData6(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6155 {
Kojto 122:f9eeca106725 6156 return (uint8_t)(READ_BIT(ADCx->DR, ADC_DR_RDATA));
Kojto 122:f9eeca106725 6157 }
Kojto 122:f9eeca106725 6158
Kojto 122:f9eeca106725 6159 #if defined(ADC_MULTIMODE_SUPPORT)
Kojto 122:f9eeca106725 6160 /**
Kojto 122:f9eeca106725 6161 * @brief Get ADC multimode conversion data of ADC master, ADC slave
Kojto 122:f9eeca106725 6162 * or raw data with ADC master and slave concatenated.
Kojto 122:f9eeca106725 6163 * @note If raw data with ADC master and slave concatenated is retrieved,
Kojto 122:f9eeca106725 6164 * a macro is available to get the conversion data of
Kojto 122:f9eeca106725 6165 * ADC master or ADC slave: see helper macro
Kojto 122:f9eeca106725 6166 * @ref __LL_ADC_MULTI_CONV_DATA_MASTER_SLAVE().
Kojto 122:f9eeca106725 6167 * (however this macro is mainly intended for multimode
Kojto 122:f9eeca106725 6168 * transfer by DMA, because this function can do the same
Kojto 122:f9eeca106725 6169 * by getting multimode conversion data of ADC master or ADC slave
Kojto 122:f9eeca106725 6170 * separately).
Kojto 122:f9eeca106725 6171 * @rmtoll CDR RDATA_MST LL_ADC_REG_ReadMultiConversionData32\n
Kojto 122:f9eeca106725 6172 * CDR RDATA_SLV LL_ADC_REG_ReadMultiConversionData32
Kojto 122:f9eeca106725 6173 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 6174 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 6175 * @param ConversionData This parameter can be one of the following values:
Kojto 122:f9eeca106725 6176 * @arg @ref LL_ADC_MULTI_MASTER
Kojto 122:f9eeca106725 6177 * @arg @ref LL_ADC_MULTI_SLAVE
Kojto 122:f9eeca106725 6178 * @arg @ref LL_ADC_MULTI_MASTER_SLAVE
Kojto 122:f9eeca106725 6179 * @retval Value between Min_Data=0x00000000 and Max_Data=0xFFFFFFFF
Kojto 122:f9eeca106725 6180 */
Kojto 122:f9eeca106725 6181 __STATIC_INLINE uint32_t LL_ADC_REG_ReadMultiConversionData32(ADC_Common_TypeDef *ADCxy_COMMON, uint32_t ConversionData)
Kojto 122:f9eeca106725 6182 {
Kojto 122:f9eeca106725 6183 return (uint32_t)(READ_BIT(ADCxy_COMMON->CDR,
Kojto 122:f9eeca106725 6184 ConversionData)
Kojto 122:f9eeca106725 6185 >> POSITION_VAL(ConversionData)
Kojto 122:f9eeca106725 6186 );
Kojto 122:f9eeca106725 6187 }
Kojto 122:f9eeca106725 6188 #endif /* ADC_MULTIMODE_SUPPORT */
Kojto 122:f9eeca106725 6189
Kojto 122:f9eeca106725 6190 /**
Kojto 122:f9eeca106725 6191 * @}
Kojto 122:f9eeca106725 6192 */
Kojto 122:f9eeca106725 6193
Kojto 122:f9eeca106725 6194 /** @defgroup ADC_LL_EF_Operation_ADC_Group_Injected Operation on ADC hierarchical scope: group injected
Kojto 122:f9eeca106725 6195 * @{
Kojto 122:f9eeca106725 6196 */
Kojto 122:f9eeca106725 6197
Kojto 122:f9eeca106725 6198 /**
Kojto 122:f9eeca106725 6199 * @brief Start ADC group injected conversion.
Kojto 122:f9eeca106725 6200 * @note On this STM32 serie, this function is relevant for both
Kojto 122:f9eeca106725 6201 * internal trigger (SW start) and external trigger:
Kojto 122:f9eeca106725 6202 * - If ADC trigger has been set to software start, ADC conversion
Kojto 122:f9eeca106725 6203 * starts immediately.
Kojto 122:f9eeca106725 6204 * - If ADC trigger has been set to external trigger, ADC conversion
Kojto 122:f9eeca106725 6205 * will start at next trigger event (on the selected trigger edge)
Kojto 122:f9eeca106725 6206 * following the ADC start conversion command.
Kojto 122:f9eeca106725 6207 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 6208 * ADC state:
Kojto 122:f9eeca106725 6209 * ADC must be enabled without conversion on going on group injected,
AnnaBridge 145:64910690c574 6210 * without conversion stop command on going on group injected,
AnnaBridge 145:64910690c574 6211 * without ADC disable command on going.
Kojto 122:f9eeca106725 6212 * @rmtoll CR JADSTART LL_ADC_INJ_StartConversion
Kojto 122:f9eeca106725 6213 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6214 * @retval None
Kojto 122:f9eeca106725 6215 */
Kojto 122:f9eeca106725 6216 __STATIC_INLINE void LL_ADC_INJ_StartConversion(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6217 {
Kojto 122:f9eeca106725 6218 /* Note: Write register with some additional bits forced to state reset */
Kojto 122:f9eeca106725 6219 /* instead of modifying only the selected bit for this function, */
Kojto 122:f9eeca106725 6220 /* to not interfere with bits with HW property "rs". */
Kojto 122:f9eeca106725 6221 MODIFY_REG(ADCx->CR,
Kojto 122:f9eeca106725 6222 ADC_CR_BITS_PROPERTY_RS,
Kojto 122:f9eeca106725 6223 ADC_CR_JADSTART);
Kojto 122:f9eeca106725 6224 }
Kojto 122:f9eeca106725 6225
Kojto 122:f9eeca106725 6226 /**
Kojto 122:f9eeca106725 6227 * @brief Stop ADC group injected conversion.
Kojto 122:f9eeca106725 6228 * @note On this STM32 serie, setting of this feature is conditioned to
Kojto 122:f9eeca106725 6229 * ADC state:
Kojto 122:f9eeca106725 6230 * ADC must be enabled with conversion on going on group injected,
Kojto 122:f9eeca106725 6231 * without ADC disable command on going.
Kojto 122:f9eeca106725 6232 * @rmtoll CR JADSTP LL_ADC_INJ_StopConversion
Kojto 122:f9eeca106725 6233 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6234 * @retval None
Kojto 122:f9eeca106725 6235 */
Kojto 122:f9eeca106725 6236 __STATIC_INLINE void LL_ADC_INJ_StopConversion(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6237 {
Kojto 122:f9eeca106725 6238 /* Note: Write register with some additional bits forced to state reset */
Kojto 122:f9eeca106725 6239 /* instead of modifying only the selected bit for this function, */
Kojto 122:f9eeca106725 6240 /* to not interfere with bits with HW property "rs". */
Kojto 122:f9eeca106725 6241 MODIFY_REG(ADCx->CR,
Kojto 122:f9eeca106725 6242 ADC_CR_BITS_PROPERTY_RS,
Kojto 122:f9eeca106725 6243 ADC_CR_JADSTP);
Kojto 122:f9eeca106725 6244 }
Kojto 122:f9eeca106725 6245
Kojto 122:f9eeca106725 6246 /**
Kojto 122:f9eeca106725 6247 * @brief Get ADC group injected conversion state.
Kojto 122:f9eeca106725 6248 * @rmtoll CR JADSTART LL_ADC_INJ_IsConversionOngoing
Kojto 122:f9eeca106725 6249 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6250 * @retval 0: no conversion is on going on ADC group injected.
Kojto 122:f9eeca106725 6251 */
Kojto 122:f9eeca106725 6252 __STATIC_INLINE uint32_t LL_ADC_INJ_IsConversionOngoing(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6253 {
Kojto 122:f9eeca106725 6254 return (READ_BIT(ADCx->CR, ADC_CR_JADSTART) == (ADC_CR_JADSTART));
Kojto 122:f9eeca106725 6255 }
Kojto 122:f9eeca106725 6256
Kojto 122:f9eeca106725 6257 /**
Kojto 122:f9eeca106725 6258 * @brief Get ADC group injected command of conversion stop state
Kojto 122:f9eeca106725 6259 * @rmtoll CR JADSTP LL_ADC_INJ_IsStopConversionOngoing
Kojto 122:f9eeca106725 6260 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6261 * @retval 0: no command of conversion stop is on going on ADC group injected.
Kojto 122:f9eeca106725 6262 */
Kojto 122:f9eeca106725 6263 __STATIC_INLINE uint32_t LL_ADC_INJ_IsStopConversionOngoing(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6264 {
Kojto 122:f9eeca106725 6265 return (READ_BIT(ADCx->CR, ADC_CR_JADSTP) == (ADC_CR_JADSTP));
Kojto 122:f9eeca106725 6266 }
Kojto 122:f9eeca106725 6267
Kojto 122:f9eeca106725 6268 /**
Kojto 122:f9eeca106725 6269 * @brief Get ADC group regular conversion data, range fit for
Kojto 122:f9eeca106725 6270 * all ADC configurations: all ADC resolutions and
Kojto 122:f9eeca106725 6271 * all oversampling increased data width (for devices
Kojto 122:f9eeca106725 6272 * with feature oversampling).
Kojto 122:f9eeca106725 6273 * @rmtoll JDR1 JDATA LL_ADC_INJ_ReadConversionData32\n
Kojto 122:f9eeca106725 6274 * JDR2 JDATA LL_ADC_INJ_ReadConversionData32\n
Kojto 122:f9eeca106725 6275 * JDR3 JDATA LL_ADC_INJ_ReadConversionData32\n
Kojto 122:f9eeca106725 6276 * JDR4 JDATA LL_ADC_INJ_ReadConversionData32
Kojto 122:f9eeca106725 6277 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6278 * @param Rank This parameter can be one of the following values:
Kojto 122:f9eeca106725 6279 * @arg @ref LL_ADC_INJ_RANK_1
Kojto 122:f9eeca106725 6280 * @arg @ref LL_ADC_INJ_RANK_2
Kojto 122:f9eeca106725 6281 * @arg @ref LL_ADC_INJ_RANK_3
Kojto 122:f9eeca106725 6282 * @arg @ref LL_ADC_INJ_RANK_4
Kojto 122:f9eeca106725 6283 * @retval Value between Min_Data=0x00000000 and Max_Data=0xFFFFFFFF
Kojto 122:f9eeca106725 6284 */
Kojto 122:f9eeca106725 6285 __STATIC_INLINE uint32_t LL_ADC_INJ_ReadConversionData32(ADC_TypeDef *ADCx, uint32_t Rank)
Kojto 122:f9eeca106725 6286 {
Kojto 122:f9eeca106725 6287 register uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->JDR1, __ADC_MASK_SHIFT(Rank, ADC_INJ_JDRX_REGOFFSET_MASK));
Kojto 122:f9eeca106725 6288
Kojto 122:f9eeca106725 6289 return (uint32_t)(READ_BIT(*preg,
Kojto 122:f9eeca106725 6290 ADC_JDR1_JDATA)
Kojto 122:f9eeca106725 6291 );
Kojto 122:f9eeca106725 6292 }
Kojto 122:f9eeca106725 6293
Kojto 122:f9eeca106725 6294 /**
Kojto 122:f9eeca106725 6295 * @brief Get ADC group injected conversion data, range fit for
Kojto 122:f9eeca106725 6296 * ADC resolution 12 bits.
Kojto 122:f9eeca106725 6297 * @note For devices with feature oversampling: Oversampling
Kojto 122:f9eeca106725 6298 * can increase data width, function for extended range
Kojto 122:f9eeca106725 6299 * may be needed: @ref LL_ADC_INJ_ReadConversionData32.
Kojto 122:f9eeca106725 6300 * @rmtoll JDR1 JDATA LL_ADC_INJ_ReadConversionData12\n
Kojto 122:f9eeca106725 6301 * JDR2 JDATA LL_ADC_INJ_ReadConversionData12\n
Kojto 122:f9eeca106725 6302 * JDR3 JDATA LL_ADC_INJ_ReadConversionData12\n
Kojto 122:f9eeca106725 6303 * JDR4 JDATA LL_ADC_INJ_ReadConversionData12
Kojto 122:f9eeca106725 6304 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6305 * @param Rank This parameter can be one of the following values:
Kojto 122:f9eeca106725 6306 * @arg @ref LL_ADC_INJ_RANK_1
Kojto 122:f9eeca106725 6307 * @arg @ref LL_ADC_INJ_RANK_2
Kojto 122:f9eeca106725 6308 * @arg @ref LL_ADC_INJ_RANK_3
Kojto 122:f9eeca106725 6309 * @arg @ref LL_ADC_INJ_RANK_4
Kojto 122:f9eeca106725 6310 * @retval Value between Min_Data=0x000 and Max_Data=0xFFF
Kojto 122:f9eeca106725 6311 */
Kojto 122:f9eeca106725 6312 __STATIC_INLINE uint16_t LL_ADC_INJ_ReadConversionData12(ADC_TypeDef *ADCx, uint32_t Rank)
Kojto 122:f9eeca106725 6313 {
Kojto 122:f9eeca106725 6314 register uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->JDR1, __ADC_MASK_SHIFT(Rank, ADC_INJ_JDRX_REGOFFSET_MASK));
Kojto 122:f9eeca106725 6315
Kojto 122:f9eeca106725 6316 return (uint16_t)(READ_BIT(*preg,
Kojto 122:f9eeca106725 6317 ADC_JDR1_JDATA)
Kojto 122:f9eeca106725 6318 );
Kojto 122:f9eeca106725 6319 }
Kojto 122:f9eeca106725 6320
Kojto 122:f9eeca106725 6321 /**
Kojto 122:f9eeca106725 6322 * @brief Get ADC group injected conversion data, range fit for
Kojto 122:f9eeca106725 6323 * ADC resolution 10 bits.
Kojto 122:f9eeca106725 6324 * @note For devices with feature oversampling: Oversampling
Kojto 122:f9eeca106725 6325 * can increase data width, function for extended range
Kojto 122:f9eeca106725 6326 * may be needed: @ref LL_ADC_INJ_ReadConversionData32.
Kojto 122:f9eeca106725 6327 * @rmtoll JDR1 JDATA LL_ADC_INJ_ReadConversionData10\n
Kojto 122:f9eeca106725 6328 * JDR2 JDATA LL_ADC_INJ_ReadConversionData10\n
Kojto 122:f9eeca106725 6329 * JDR3 JDATA LL_ADC_INJ_ReadConversionData10\n
Kojto 122:f9eeca106725 6330 * JDR4 JDATA LL_ADC_INJ_ReadConversionData10
Kojto 122:f9eeca106725 6331 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6332 * @param Rank This parameter can be one of the following values:
Kojto 122:f9eeca106725 6333 * @arg @ref LL_ADC_INJ_RANK_1
Kojto 122:f9eeca106725 6334 * @arg @ref LL_ADC_INJ_RANK_2
Kojto 122:f9eeca106725 6335 * @arg @ref LL_ADC_INJ_RANK_3
Kojto 122:f9eeca106725 6336 * @arg @ref LL_ADC_INJ_RANK_4
Kojto 122:f9eeca106725 6337 * @retval Value between Min_Data=0x000 and Max_Data=0x3FF
Kojto 122:f9eeca106725 6338 */
Kojto 122:f9eeca106725 6339 __STATIC_INLINE uint16_t LL_ADC_INJ_ReadConversionData10(ADC_TypeDef *ADCx, uint32_t Rank)
Kojto 122:f9eeca106725 6340 {
Kojto 122:f9eeca106725 6341 register uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->JDR1, __ADC_MASK_SHIFT(Rank, ADC_INJ_JDRX_REGOFFSET_MASK));
Kojto 122:f9eeca106725 6342
Kojto 122:f9eeca106725 6343 return (uint16_t)(READ_BIT(*preg,
Kojto 122:f9eeca106725 6344 ADC_JDR1_JDATA)
Kojto 122:f9eeca106725 6345 );
Kojto 122:f9eeca106725 6346 }
Kojto 122:f9eeca106725 6347
Kojto 122:f9eeca106725 6348 /**
Kojto 122:f9eeca106725 6349 * @brief Get ADC group injected conversion data, range fit for
Kojto 122:f9eeca106725 6350 * ADC resolution 8 bits.
Kojto 122:f9eeca106725 6351 * @note For devices with feature oversampling: Oversampling
Kojto 122:f9eeca106725 6352 * can increase data width, function for extended range
Kojto 122:f9eeca106725 6353 * may be needed: @ref LL_ADC_INJ_ReadConversionData32.
Kojto 122:f9eeca106725 6354 * @rmtoll JDR1 JDATA LL_ADC_INJ_ReadConversionData8\n
Kojto 122:f9eeca106725 6355 * JDR2 JDATA LL_ADC_INJ_ReadConversionData8\n
Kojto 122:f9eeca106725 6356 * JDR3 JDATA LL_ADC_INJ_ReadConversionData8\n
Kojto 122:f9eeca106725 6357 * JDR4 JDATA LL_ADC_INJ_ReadConversionData8
Kojto 122:f9eeca106725 6358 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6359 * @param Rank This parameter can be one of the following values:
Kojto 122:f9eeca106725 6360 * @arg @ref LL_ADC_INJ_RANK_1
Kojto 122:f9eeca106725 6361 * @arg @ref LL_ADC_INJ_RANK_2
Kojto 122:f9eeca106725 6362 * @arg @ref LL_ADC_INJ_RANK_3
Kojto 122:f9eeca106725 6363 * @arg @ref LL_ADC_INJ_RANK_4
Kojto 122:f9eeca106725 6364 * @retval Value between Min_Data=0x00 and Max_Data=0xFF
Kojto 122:f9eeca106725 6365 */
Kojto 122:f9eeca106725 6366 __STATIC_INLINE uint8_t LL_ADC_INJ_ReadConversionData8(ADC_TypeDef *ADCx, uint32_t Rank)
Kojto 122:f9eeca106725 6367 {
Kojto 122:f9eeca106725 6368 register uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->JDR1, __ADC_MASK_SHIFT(Rank, ADC_INJ_JDRX_REGOFFSET_MASK));
Kojto 122:f9eeca106725 6369
Kojto 122:f9eeca106725 6370 return (uint8_t)(READ_BIT(*preg,
Kojto 122:f9eeca106725 6371 ADC_JDR1_JDATA)
Kojto 122:f9eeca106725 6372 );
Kojto 122:f9eeca106725 6373 }
Kojto 122:f9eeca106725 6374
Kojto 122:f9eeca106725 6375 /**
Kojto 122:f9eeca106725 6376 * @brief Get ADC group injected conversion data, range fit for
Kojto 122:f9eeca106725 6377 * ADC resolution 6 bits.
Kojto 122:f9eeca106725 6378 * @note For devices with feature oversampling: Oversampling
Kojto 122:f9eeca106725 6379 * can increase data width, function for extended range
Kojto 122:f9eeca106725 6380 * may be needed: @ref LL_ADC_INJ_ReadConversionData32.
Kojto 122:f9eeca106725 6381 * @rmtoll JDR1 JDATA LL_ADC_INJ_ReadConversionData6\n
Kojto 122:f9eeca106725 6382 * JDR2 JDATA LL_ADC_INJ_ReadConversionData6\n
Kojto 122:f9eeca106725 6383 * JDR3 JDATA LL_ADC_INJ_ReadConversionData6\n
Kojto 122:f9eeca106725 6384 * JDR4 JDATA LL_ADC_INJ_ReadConversionData6
Kojto 122:f9eeca106725 6385 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6386 * @param Rank This parameter can be one of the following values:
Kojto 122:f9eeca106725 6387 * @arg @ref LL_ADC_INJ_RANK_1
Kojto 122:f9eeca106725 6388 * @arg @ref LL_ADC_INJ_RANK_2
Kojto 122:f9eeca106725 6389 * @arg @ref LL_ADC_INJ_RANK_3
Kojto 122:f9eeca106725 6390 * @arg @ref LL_ADC_INJ_RANK_4
Kojto 122:f9eeca106725 6391 * @retval Value between Min_Data=0x00 and Max_Data=0x3F
Kojto 122:f9eeca106725 6392 */
Kojto 122:f9eeca106725 6393 __STATIC_INLINE uint8_t LL_ADC_INJ_ReadConversionData6(ADC_TypeDef *ADCx, uint32_t Rank)
Kojto 122:f9eeca106725 6394 {
Kojto 122:f9eeca106725 6395 register uint32_t *preg = __ADC_PTR_REG_OFFSET(ADCx->JDR1, __ADC_MASK_SHIFT(Rank, ADC_INJ_JDRX_REGOFFSET_MASK));
Kojto 122:f9eeca106725 6396
Kojto 122:f9eeca106725 6397 return (uint8_t)(READ_BIT(*preg,
Kojto 122:f9eeca106725 6398 ADC_JDR1_JDATA)
Kojto 122:f9eeca106725 6399 );
Kojto 122:f9eeca106725 6400 }
Kojto 122:f9eeca106725 6401
Kojto 122:f9eeca106725 6402 /**
Kojto 122:f9eeca106725 6403 * @}
Kojto 122:f9eeca106725 6404 */
Kojto 122:f9eeca106725 6405
Kojto 122:f9eeca106725 6406 /** @defgroup ADC_LL_EF_FLAG_Management ADC flag management
Kojto 122:f9eeca106725 6407 * @{
Kojto 122:f9eeca106725 6408 */
Kojto 122:f9eeca106725 6409
Kojto 122:f9eeca106725 6410 /**
Kojto 122:f9eeca106725 6411 * @brief Get flag ADC ready.
Kojto 122:f9eeca106725 6412 * @note On this STM32 serie, flag LL_ADC_FLAG_ADRDY is raised when the ADC
Kojto 122:f9eeca106725 6413 * is enabled and when conversion clock is active.
Kojto 122:f9eeca106725 6414 * (not only core clock: this ADC has a dual clock domain)
Kojto 122:f9eeca106725 6415 * @rmtoll ISR ADRDY LL_ADC_IsActiveFlag_ADRDY
Kojto 122:f9eeca106725 6416 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6417 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6418 */
Kojto 122:f9eeca106725 6419 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_ADRDY(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6420 {
Kojto 122:f9eeca106725 6421 return (READ_BIT(ADCx->ISR, LL_ADC_FLAG_ADRDY) == (LL_ADC_FLAG_ADRDY));
Kojto 122:f9eeca106725 6422 }
Kojto 122:f9eeca106725 6423
Kojto 122:f9eeca106725 6424 /**
Kojto 122:f9eeca106725 6425 * @brief Get flag ADC group regular end of unitary conversion.
Kojto 122:f9eeca106725 6426 * @rmtoll ISR EOC LL_ADC_IsActiveFlag_EOC
Kojto 122:f9eeca106725 6427 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6428 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6429 */
Kojto 122:f9eeca106725 6430 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_EOC(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6431 {
Kojto 122:f9eeca106725 6432 return (READ_BIT(ADCx->ISR, ADC_ISR_EOC) == (ADC_ISR_EOC));
Kojto 122:f9eeca106725 6433 }
Kojto 122:f9eeca106725 6434
Kojto 122:f9eeca106725 6435 /**
Kojto 122:f9eeca106725 6436 * @brief Get flag ADC group regular end of sequence conversions.
Kojto 122:f9eeca106725 6437 * @rmtoll ISR EOS LL_ADC_IsActiveFlag_EOS
Kojto 122:f9eeca106725 6438 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6439 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6440 */
Kojto 122:f9eeca106725 6441 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_EOS(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6442 {
Kojto 122:f9eeca106725 6443 return (READ_BIT(ADCx->ISR, LL_ADC_FLAG_EOS) == (LL_ADC_FLAG_EOS));
Kojto 122:f9eeca106725 6444 }
Kojto 122:f9eeca106725 6445
Kojto 122:f9eeca106725 6446 /**
Kojto 122:f9eeca106725 6447 * @brief Get flag ADC group regular overrun.
Kojto 122:f9eeca106725 6448 * @rmtoll ISR OVR LL_ADC_IsActiveFlag_OVR
Kojto 122:f9eeca106725 6449 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6450 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6451 */
Kojto 122:f9eeca106725 6452 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_OVR(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6453 {
Kojto 122:f9eeca106725 6454 return (READ_BIT(ADCx->ISR, LL_ADC_FLAG_OVR) == (LL_ADC_FLAG_OVR));
Kojto 122:f9eeca106725 6455 }
Kojto 122:f9eeca106725 6456
Kojto 122:f9eeca106725 6457 /**
Kojto 122:f9eeca106725 6458 * @brief Get flag ADC group regular end of sampling phase.
Kojto 122:f9eeca106725 6459 * @rmtoll ISR EOSMP LL_ADC_IsActiveFlag_EOSMP
Kojto 122:f9eeca106725 6460 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6461 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6462 */
Kojto 122:f9eeca106725 6463 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_EOSMP(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6464 {
Kojto 122:f9eeca106725 6465 return (READ_BIT(ADCx->ISR, LL_ADC_FLAG_EOSMP) == (LL_ADC_FLAG_EOSMP));
Kojto 122:f9eeca106725 6466 }
Kojto 122:f9eeca106725 6467
Kojto 122:f9eeca106725 6468 /**
Kojto 122:f9eeca106725 6469 * @brief Get flag ADC group injected end of unitary conversion.
Kojto 122:f9eeca106725 6470 * @rmtoll ISR JEOC LL_ADC_IsActiveFlag_JEOC
Kojto 122:f9eeca106725 6471 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6472 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6473 */
Kojto 122:f9eeca106725 6474 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_JEOC(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6475 {
Kojto 122:f9eeca106725 6476 return (READ_BIT(ADCx->ISR, LL_ADC_FLAG_JEOC) == (LL_ADC_FLAG_JEOC));
Kojto 122:f9eeca106725 6477 }
Kojto 122:f9eeca106725 6478
Kojto 122:f9eeca106725 6479 /**
Kojto 122:f9eeca106725 6480 * @brief Get flag ADC group injected end of sequence conversions.
Kojto 122:f9eeca106725 6481 * @rmtoll ISR JEOS LL_ADC_IsActiveFlag_JEOS
Kojto 122:f9eeca106725 6482 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6483 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6484 */
Kojto 122:f9eeca106725 6485 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_JEOS(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6486 {
Kojto 122:f9eeca106725 6487 return (READ_BIT(ADCx->ISR, LL_ADC_FLAG_JEOS) == (LL_ADC_FLAG_JEOS));
Kojto 122:f9eeca106725 6488 }
Kojto 122:f9eeca106725 6489
Kojto 122:f9eeca106725 6490 /**
Kojto 122:f9eeca106725 6491 * @brief Get flag ADC group injected contexts queue overflow.
Kojto 122:f9eeca106725 6492 * @rmtoll ISR JQOVF LL_ADC_IsActiveFlag_JQOVF
Kojto 122:f9eeca106725 6493 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6494 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6495 */
Kojto 122:f9eeca106725 6496 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_JQOVF(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6497 {
Kojto 122:f9eeca106725 6498 return (READ_BIT(ADCx->ISR, LL_ADC_FLAG_JQOVF) == (LL_ADC_FLAG_JQOVF));
Kojto 122:f9eeca106725 6499 }
Kojto 122:f9eeca106725 6500
Kojto 122:f9eeca106725 6501 /**
Kojto 122:f9eeca106725 6502 * @brief Get flag ADC analog watchdog 1 flag
Kojto 122:f9eeca106725 6503 * @rmtoll ISR AWD1 LL_ADC_IsActiveFlag_AWD1
Kojto 122:f9eeca106725 6504 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6505 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6506 */
Kojto 122:f9eeca106725 6507 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_AWD1(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6508 {
Kojto 122:f9eeca106725 6509 return (READ_BIT(ADCx->ISR, LL_ADC_FLAG_AWD1) == (LL_ADC_FLAG_AWD1));
Kojto 122:f9eeca106725 6510 }
Kojto 122:f9eeca106725 6511
Kojto 122:f9eeca106725 6512 /**
Kojto 122:f9eeca106725 6513 * @brief Get flag ADC analog watchdog 2.
Kojto 122:f9eeca106725 6514 * @rmtoll ISR AWD2 LL_ADC_IsActiveFlag_AWD2
Kojto 122:f9eeca106725 6515 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6516 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6517 */
Kojto 122:f9eeca106725 6518 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_AWD2(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6519 {
Kojto 122:f9eeca106725 6520 return (READ_BIT(ADCx->ISR, LL_ADC_FLAG_AWD2) == (LL_ADC_FLAG_AWD2));
Kojto 122:f9eeca106725 6521 }
Kojto 122:f9eeca106725 6522
Kojto 122:f9eeca106725 6523 /**
Kojto 122:f9eeca106725 6524 * @brief Get flag ADC analog watchdog 3.
Kojto 122:f9eeca106725 6525 * @rmtoll ISR AWD3 LL_ADC_IsActiveFlag_AWD3
Kojto 122:f9eeca106725 6526 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6527 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6528 */
Kojto 122:f9eeca106725 6529 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_AWD3(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6530 {
Kojto 122:f9eeca106725 6531 return (READ_BIT(ADCx->ISR, LL_ADC_FLAG_AWD3) == (LL_ADC_FLAG_AWD3));
Kojto 122:f9eeca106725 6532 }
Kojto 122:f9eeca106725 6533
Kojto 122:f9eeca106725 6534 /**
Kojto 122:f9eeca106725 6535 * @brief Clear flag ADC ready.
Kojto 122:f9eeca106725 6536 * @note On this STM32 serie, flag LL_ADC_FLAG_ADRDY is raised when the ADC
Kojto 122:f9eeca106725 6537 * is enabled and when conversion clock is active.
Kojto 122:f9eeca106725 6538 * (not only core clock: this ADC has a dual clock domain)
Kojto 122:f9eeca106725 6539 * @rmtoll ISR ADRDY LL_ADC_ClearFlag_ADRDY
Kojto 122:f9eeca106725 6540 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6541 * @retval None
Kojto 122:f9eeca106725 6542 */
Kojto 122:f9eeca106725 6543 __STATIC_INLINE void LL_ADC_ClearFlag_ADRDY(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6544 {
Kojto 122:f9eeca106725 6545 WRITE_REG(ADCx->ISR, LL_ADC_FLAG_ADRDY);
Kojto 122:f9eeca106725 6546 }
Kojto 122:f9eeca106725 6547
Kojto 122:f9eeca106725 6548 /**
Kojto 122:f9eeca106725 6549 * @brief Clear flag ADC group regular end of unitary conversion.
Kojto 122:f9eeca106725 6550 * @rmtoll ISR EOC LL_ADC_ClearFlag_EOC
Kojto 122:f9eeca106725 6551 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6552 * @retval None
Kojto 122:f9eeca106725 6553 */
Kojto 122:f9eeca106725 6554 __STATIC_INLINE void LL_ADC_ClearFlag_EOC(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6555 {
Kojto 122:f9eeca106725 6556 WRITE_REG(ADCx->ISR, LL_ADC_FLAG_EOC);
Kojto 122:f9eeca106725 6557 }
Kojto 122:f9eeca106725 6558
Kojto 122:f9eeca106725 6559 /**
Kojto 122:f9eeca106725 6560 * @brief Clear flag ADC group regular end of sequence conversions.
Kojto 122:f9eeca106725 6561 * @rmtoll ISR EOS LL_ADC_ClearFlag_EOS
Kojto 122:f9eeca106725 6562 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6563 * @retval None
Kojto 122:f9eeca106725 6564 */
Kojto 122:f9eeca106725 6565 __STATIC_INLINE void LL_ADC_ClearFlag_EOS(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6566 {
Kojto 122:f9eeca106725 6567 WRITE_REG(ADCx->ISR, LL_ADC_FLAG_EOS);
Kojto 122:f9eeca106725 6568 }
Kojto 122:f9eeca106725 6569
Kojto 122:f9eeca106725 6570 /**
Kojto 122:f9eeca106725 6571 * @brief Clear flag ADC group regular overrun.
Kojto 122:f9eeca106725 6572 * @rmtoll ISR OVR LL_ADC_ClearFlag_OVR
Kojto 122:f9eeca106725 6573 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6574 * @retval None
Kojto 122:f9eeca106725 6575 */
Kojto 122:f9eeca106725 6576 __STATIC_INLINE void LL_ADC_ClearFlag_OVR(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6577 {
Kojto 122:f9eeca106725 6578 WRITE_REG(ADCx->ISR, LL_ADC_FLAG_OVR);
Kojto 122:f9eeca106725 6579 }
Kojto 122:f9eeca106725 6580
Kojto 122:f9eeca106725 6581 /**
Kojto 122:f9eeca106725 6582 * @brief Clear flag ADC group regular end of sampling phase.
Kojto 122:f9eeca106725 6583 * @rmtoll ISR EOSMP LL_ADC_ClearFlag_EOSMP
Kojto 122:f9eeca106725 6584 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6585 * @retval None
Kojto 122:f9eeca106725 6586 */
Kojto 122:f9eeca106725 6587 __STATIC_INLINE void LL_ADC_ClearFlag_EOSMP(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6588 {
Kojto 122:f9eeca106725 6589 WRITE_REG(ADCx->ISR, LL_ADC_FLAG_EOSMP);
Kojto 122:f9eeca106725 6590 }
Kojto 122:f9eeca106725 6591
Kojto 122:f9eeca106725 6592 /**
Kojto 122:f9eeca106725 6593 * @brief Clear flag ADC group injected end of unitary conversion.
Kojto 122:f9eeca106725 6594 * @rmtoll ISR JEOC LL_ADC_ClearFlag_JEOC
Kojto 122:f9eeca106725 6595 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6596 * @retval None
Kojto 122:f9eeca106725 6597 */
Kojto 122:f9eeca106725 6598 __STATIC_INLINE void LL_ADC_ClearFlag_JEOC(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6599 {
Kojto 122:f9eeca106725 6600 WRITE_REG(ADCx->ISR, LL_ADC_FLAG_JEOC);
Kojto 122:f9eeca106725 6601 }
Kojto 122:f9eeca106725 6602
Kojto 122:f9eeca106725 6603 /**
Kojto 122:f9eeca106725 6604 * @brief Clear flag ADC group injected end of sequence conversions.
Kojto 122:f9eeca106725 6605 * @rmtoll ISR JEOS LL_ADC_ClearFlag_JEOS
Kojto 122:f9eeca106725 6606 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6607 * @retval None
Kojto 122:f9eeca106725 6608 */
Kojto 122:f9eeca106725 6609 __STATIC_INLINE void LL_ADC_ClearFlag_JEOS(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6610 {
Kojto 122:f9eeca106725 6611 WRITE_REG(ADCx->ISR, LL_ADC_FLAG_JEOS);
Kojto 122:f9eeca106725 6612 }
Kojto 122:f9eeca106725 6613
Kojto 122:f9eeca106725 6614 /**
Kojto 122:f9eeca106725 6615 * @brief Clear flag ADC group injected contexts queue overflow.
Kojto 122:f9eeca106725 6616 * @rmtoll ISR JQOVF LL_ADC_ClearFlag_JQOVF
Kojto 122:f9eeca106725 6617 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6618 * @retval None
Kojto 122:f9eeca106725 6619 */
Kojto 122:f9eeca106725 6620 __STATIC_INLINE void LL_ADC_ClearFlag_JQOVF(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6621 {
Kojto 122:f9eeca106725 6622 WRITE_REG(ADCx->ISR, LL_ADC_FLAG_JQOVF);
Kojto 122:f9eeca106725 6623 }
Kojto 122:f9eeca106725 6624
Kojto 122:f9eeca106725 6625 /**
Kojto 122:f9eeca106725 6626 * @brief Clear flag ADC analog watchdog 1.
Kojto 122:f9eeca106725 6627 * @rmtoll ISR AWD1 LL_ADC_ClearFlag_AWD1
Kojto 122:f9eeca106725 6628 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6629 * @retval None
Kojto 122:f9eeca106725 6630 */
Kojto 122:f9eeca106725 6631 __STATIC_INLINE void LL_ADC_ClearFlag_AWD1(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6632 {
Kojto 122:f9eeca106725 6633 WRITE_REG(ADCx->ISR, LL_ADC_FLAG_AWD1);
Kojto 122:f9eeca106725 6634 }
Kojto 122:f9eeca106725 6635
Kojto 122:f9eeca106725 6636 /**
Kojto 122:f9eeca106725 6637 * @brief Clear flag ADC analog watchdog 2.
Kojto 122:f9eeca106725 6638 * @rmtoll ISR AWD2 LL_ADC_ClearFlag_AWD2
Kojto 122:f9eeca106725 6639 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6640 * @retval None
Kojto 122:f9eeca106725 6641 */
Kojto 122:f9eeca106725 6642 __STATIC_INLINE void LL_ADC_ClearFlag_AWD2(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6643 {
Kojto 122:f9eeca106725 6644 WRITE_REG(ADCx->ISR, LL_ADC_FLAG_AWD2);
Kojto 122:f9eeca106725 6645 }
Kojto 122:f9eeca106725 6646
Kojto 122:f9eeca106725 6647 /**
Kojto 122:f9eeca106725 6648 * @brief Clear flag ADC analog watchdog 3.
Kojto 122:f9eeca106725 6649 * @rmtoll ISR AWD3 LL_ADC_ClearFlag_AWD3
Kojto 122:f9eeca106725 6650 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6651 * @retval None
Kojto 122:f9eeca106725 6652 */
Kojto 122:f9eeca106725 6653 __STATIC_INLINE void LL_ADC_ClearFlag_AWD3(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6654 {
Kojto 122:f9eeca106725 6655 WRITE_REG(ADCx->ISR, LL_ADC_FLAG_AWD3);
Kojto 122:f9eeca106725 6656 }
Kojto 122:f9eeca106725 6657
Kojto 122:f9eeca106725 6658 #if defined(ADC_MULTIMODE_SUPPORT)
Kojto 122:f9eeca106725 6659 /**
Kojto 122:f9eeca106725 6660 * @brief Get flag multimode ADC ready of the ADC master.
Kojto 122:f9eeca106725 6661 * @rmtoll CSR ADRDY_MST LL_ADC_IsActiveFlag_MST_ADRDY
Kojto 122:f9eeca106725 6662 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 6663 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 6664 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6665 */
Kojto 122:f9eeca106725 6666 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_MST_ADRDY(ADC_Common_TypeDef *ADCxy_COMMON)
Kojto 122:f9eeca106725 6667 {
Kojto 122:f9eeca106725 6668 return (READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_ADRDY_MST) == (LL_ADC_FLAG_ADRDY_MST));
Kojto 122:f9eeca106725 6669 }
Kojto 122:f9eeca106725 6670
Kojto 122:f9eeca106725 6671 /**
Kojto 122:f9eeca106725 6672 * @brief Get flag multimode ADC ready of the ADC slave.
Kojto 122:f9eeca106725 6673 * @rmtoll CSR ADRDY_SLV LL_ADC_IsActiveFlag_SLV_ADRDY
Kojto 122:f9eeca106725 6674 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 6675 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 6676 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6677 */
Kojto 122:f9eeca106725 6678 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_SLV_ADRDY(ADC_Common_TypeDef *ADCxy_COMMON)
Kojto 122:f9eeca106725 6679 {
Kojto 122:f9eeca106725 6680 return (READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_ADRDY_SLV) == (LL_ADC_FLAG_ADRDY_SLV));
Kojto 122:f9eeca106725 6681 }
Kojto 122:f9eeca106725 6682
Kojto 122:f9eeca106725 6683 /**
Kojto 122:f9eeca106725 6684 * @brief Get flag multimode ADC group regular end of unitary conversion of the ADC master.
Kojto 122:f9eeca106725 6685 * @rmtoll CSR EOC_MST LL_ADC_IsActiveFlag_MST_EOC
Kojto 122:f9eeca106725 6686 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 6687 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 6688 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6689 */
Kojto 122:f9eeca106725 6690 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_MST_EOC(ADC_Common_TypeDef *ADCxy_COMMON)
Kojto 122:f9eeca106725 6691 {
Kojto 122:f9eeca106725 6692 return (READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_EOC_SLV) == (LL_ADC_FLAG_EOC_SLV));
Kojto 122:f9eeca106725 6693 }
Kojto 122:f9eeca106725 6694
Kojto 122:f9eeca106725 6695 /**
Kojto 122:f9eeca106725 6696 * @brief Get flag multimode ADC group regular end of unitary conversion of the ADC slave.
Kojto 122:f9eeca106725 6697 * @rmtoll CSR EOC_SLV LL_ADC_IsActiveFlag_SLV_EOC
Kojto 122:f9eeca106725 6698 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 6699 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 6700 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6701 */
Kojto 122:f9eeca106725 6702 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_SLV_EOC(ADC_Common_TypeDef *ADCxy_COMMON)
Kojto 122:f9eeca106725 6703 {
Kojto 122:f9eeca106725 6704 return (READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_EOC_SLV) == (LL_ADC_FLAG_EOC_SLV));
Kojto 122:f9eeca106725 6705 }
Kojto 122:f9eeca106725 6706
Kojto 122:f9eeca106725 6707 /**
Kojto 122:f9eeca106725 6708 * @brief Get flag multimode ADC group regular end of sequence conversions of the ADC master.
Kojto 122:f9eeca106725 6709 * @rmtoll CSR EOS_MST LL_ADC_IsActiveFlag_MST_EOS
Kojto 122:f9eeca106725 6710 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 6711 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 6712 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6713 */
Kojto 122:f9eeca106725 6714 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_MST_EOS(ADC_Common_TypeDef *ADCxy_COMMON)
Kojto 122:f9eeca106725 6715 {
Kojto 122:f9eeca106725 6716 return (READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_EOS_MST) == (LL_ADC_FLAG_EOS_MST));
Kojto 122:f9eeca106725 6717 }
Kojto 122:f9eeca106725 6718
Kojto 122:f9eeca106725 6719 /**
Kojto 122:f9eeca106725 6720 * @brief Get flag multimode ADC group regular end of sequence conversions of the ADC slave.
Kojto 122:f9eeca106725 6721 * @rmtoll CSR EOS_SLV LL_ADC_IsActiveFlag_SLV_EOS
Kojto 122:f9eeca106725 6722 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 6723 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 6724 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6725 */
Kojto 122:f9eeca106725 6726 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_SLV_EOS(ADC_Common_TypeDef *ADCxy_COMMON)
Kojto 122:f9eeca106725 6727 {
Kojto 122:f9eeca106725 6728 return (READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_EOS_SLV) == (LL_ADC_FLAG_EOS_SLV));
Kojto 122:f9eeca106725 6729 }
Kojto 122:f9eeca106725 6730
Kojto 122:f9eeca106725 6731 /**
Kojto 122:f9eeca106725 6732 * @brief Get flag multimode ADC group regular overrun of the ADC master.
Kojto 122:f9eeca106725 6733 * @rmtoll CSR OVR_MST LL_ADC_IsActiveFlag_MST_OVR
Kojto 122:f9eeca106725 6734 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 6735 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 6736 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6737 */
Kojto 122:f9eeca106725 6738 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_MST_OVR(ADC_Common_TypeDef *ADCxy_COMMON)
Kojto 122:f9eeca106725 6739 {
Kojto 122:f9eeca106725 6740 return (READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_OVR_MST) == (LL_ADC_FLAG_OVR_MST));
Kojto 122:f9eeca106725 6741 }
Kojto 122:f9eeca106725 6742
Kojto 122:f9eeca106725 6743 /**
Kojto 122:f9eeca106725 6744 * @brief Get flag multimode ADC group regular overrun of the ADC slave.
Kojto 122:f9eeca106725 6745 * @rmtoll CSR OVR_SLV LL_ADC_IsActiveFlag_SLV_OVR
Kojto 122:f9eeca106725 6746 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 6747 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 6748 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6749 */
Kojto 122:f9eeca106725 6750 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_SLV_OVR(ADC_Common_TypeDef *ADCxy_COMMON)
Kojto 122:f9eeca106725 6751 {
Kojto 122:f9eeca106725 6752 return (READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_OVR_SLV) == (LL_ADC_FLAG_OVR_SLV));
Kojto 122:f9eeca106725 6753 }
Kojto 122:f9eeca106725 6754
Kojto 122:f9eeca106725 6755 /**
Kojto 122:f9eeca106725 6756 * @brief Get flag multimode ADC group regular end of sampling of the ADC master.
Kojto 122:f9eeca106725 6757 * @rmtoll CSR EOSMP_MST LL_ADC_IsActiveFlag_MST_EOSMP
Kojto 122:f9eeca106725 6758 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 6759 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 6760 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6761 */
Kojto 122:f9eeca106725 6762 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_MST_EOSMP(ADC_Common_TypeDef *ADCxy_COMMON)
Kojto 122:f9eeca106725 6763 {
Kojto 122:f9eeca106725 6764 return (READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_EOSMP_MST) == (LL_ADC_FLAG_EOSMP_MST));
Kojto 122:f9eeca106725 6765 }
Kojto 122:f9eeca106725 6766
Kojto 122:f9eeca106725 6767 /**
Kojto 122:f9eeca106725 6768 * @brief Get flag multimode ADC group regular end of sampling of the ADC slave.
Kojto 122:f9eeca106725 6769 * @rmtoll CSR EOSMP_SLV LL_ADC_IsActiveFlag_SLV_EOSMP
Kojto 122:f9eeca106725 6770 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 6771 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 6772 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6773 */
Kojto 122:f9eeca106725 6774 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_SLV_EOSMP(ADC_Common_TypeDef *ADCxy_COMMON)
Kojto 122:f9eeca106725 6775 {
Kojto 122:f9eeca106725 6776 return (READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_EOSMP_SLV) == (LL_ADC_FLAG_EOSMP_SLV));
Kojto 122:f9eeca106725 6777 }
Kojto 122:f9eeca106725 6778
Kojto 122:f9eeca106725 6779 /**
Kojto 122:f9eeca106725 6780 * @brief Get flag multimode ADC group injected end of unitary conversion of the ADC master.
Kojto 122:f9eeca106725 6781 * @rmtoll CSR JEOC_MST LL_ADC_IsActiveFlag_MST_JEOC
Kojto 122:f9eeca106725 6782 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 6783 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 6784 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6785 */
Kojto 122:f9eeca106725 6786 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_MST_JEOC(ADC_Common_TypeDef *ADCxy_COMMON)
Kojto 122:f9eeca106725 6787 {
Kojto 122:f9eeca106725 6788 return (READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_JEOC_MST) == (LL_ADC_FLAG_JEOC_MST));
Kojto 122:f9eeca106725 6789 }
Kojto 122:f9eeca106725 6790
Kojto 122:f9eeca106725 6791 /**
Kojto 122:f9eeca106725 6792 * @brief Get flag multimode ADC group injected end of unitary conversion of the ADC slave.
Kojto 122:f9eeca106725 6793 * @rmtoll CSR JEOC_SLV LL_ADC_IsActiveFlag_SLV_JEOC
Kojto 122:f9eeca106725 6794 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 6795 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 6796 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6797 */
Kojto 122:f9eeca106725 6798 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_SLV_JEOC(ADC_Common_TypeDef *ADCxy_COMMON)
Kojto 122:f9eeca106725 6799 {
Kojto 122:f9eeca106725 6800 return (READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_JEOC_SLV) == (LL_ADC_FLAG_JEOC_SLV));
Kojto 122:f9eeca106725 6801 }
Kojto 122:f9eeca106725 6802
Kojto 122:f9eeca106725 6803 /**
Kojto 122:f9eeca106725 6804 * @brief Get flag multimode ADC group injected end of sequence conversions of the ADC master.
Kojto 122:f9eeca106725 6805 * @rmtoll CSR JEOS_MST LL_ADC_IsActiveFlag_MST_JEOS
Kojto 122:f9eeca106725 6806 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 6807 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 6808 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6809 */
Kojto 122:f9eeca106725 6810 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_MST_JEOS(ADC_Common_TypeDef *ADCxy_COMMON)
Kojto 122:f9eeca106725 6811 {
Kojto 122:f9eeca106725 6812 return (READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_JEOS_MST) == (LL_ADC_FLAG_JEOS_MST));
Kojto 122:f9eeca106725 6813 }
Kojto 122:f9eeca106725 6814
Kojto 122:f9eeca106725 6815 /**
Kojto 122:f9eeca106725 6816 * @brief Get flag multimode ADC group injected end of sequence conversions of the ADC slave.
Kojto 122:f9eeca106725 6817 * @rmtoll CSR JEOS_SLV LL_ADC_IsActiveFlag_SLV_JEOS
Kojto 122:f9eeca106725 6818 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 6819 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 6820 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6821 */
Kojto 122:f9eeca106725 6822 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_SLV_JEOS(ADC_Common_TypeDef *ADCxy_COMMON)
Kojto 122:f9eeca106725 6823 {
Kojto 122:f9eeca106725 6824 return (READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_JEOS_SLV) == (LL_ADC_FLAG_JEOS_SLV));
Kojto 122:f9eeca106725 6825 }
Kojto 122:f9eeca106725 6826
Kojto 122:f9eeca106725 6827 /**
Kojto 122:f9eeca106725 6828 * @brief Get flag multimode ADC group injected context queue overflow of the ADC master.
Kojto 122:f9eeca106725 6829 * @rmtoll CSR JQOVF_MST LL_ADC_IsActiveFlag_MST_JQOVF
Kojto 122:f9eeca106725 6830 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 6831 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 6832 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6833 */
Kojto 122:f9eeca106725 6834 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_MST_JQOVF(ADC_Common_TypeDef *ADCxy_COMMON)
Kojto 122:f9eeca106725 6835 {
Kojto 122:f9eeca106725 6836 return (READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_JQOVF_MST) == (LL_ADC_FLAG_JQOVF_MST));
Kojto 122:f9eeca106725 6837 }
Kojto 122:f9eeca106725 6838
Kojto 122:f9eeca106725 6839 /**
Kojto 122:f9eeca106725 6840 * @brief Get flag multimode ADC group injected context queue overflow of the ADC slave.
Kojto 122:f9eeca106725 6841 * @rmtoll CSR JQOVF_SLV LL_ADC_IsActiveFlag_SLV_JQOVF
Kojto 122:f9eeca106725 6842 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 6843 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 6844 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6845 */
Kojto 122:f9eeca106725 6846 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_SLV_JQOVF(ADC_Common_TypeDef *ADCxy_COMMON)
Kojto 122:f9eeca106725 6847 {
Kojto 122:f9eeca106725 6848 return (READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_JQOVF_SLV) == (LL_ADC_FLAG_JQOVF_SLV));
Kojto 122:f9eeca106725 6849 }
Kojto 122:f9eeca106725 6850
Kojto 122:f9eeca106725 6851 /**
Kojto 122:f9eeca106725 6852 * @brief Get flag multimode ADC analog watchdog 1 of the ADC master.
Kojto 122:f9eeca106725 6853 * @rmtoll CSR AWD1_MST LL_ADC_IsActiveFlag_MST_AWD1
Kojto 122:f9eeca106725 6854 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 6855 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 6856 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6857 */
Kojto 122:f9eeca106725 6858 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_MST_AWD1(ADC_Common_TypeDef *ADCxy_COMMON)
Kojto 122:f9eeca106725 6859 {
Kojto 122:f9eeca106725 6860 return (READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_AWD1_MST) == (LL_ADC_FLAG_AWD1_MST));
Kojto 122:f9eeca106725 6861 }
Kojto 122:f9eeca106725 6862
Kojto 122:f9eeca106725 6863 /**
Kojto 122:f9eeca106725 6864 * @brief Get flag multimode analog watchdog 1 of the ADC slave.
Kojto 122:f9eeca106725 6865 * @rmtoll CSR AWD1_SLV LL_ADC_IsActiveFlag_SLV_AWD1
Kojto 122:f9eeca106725 6866 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 6867 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 6868 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6869 */
Kojto 122:f9eeca106725 6870 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_SLV_AWD1(ADC_Common_TypeDef *ADCxy_COMMON)
Kojto 122:f9eeca106725 6871 {
Kojto 122:f9eeca106725 6872 return (READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_AWD1_SLV) == (LL_ADC_FLAG_AWD1_SLV));
Kojto 122:f9eeca106725 6873 }
Kojto 122:f9eeca106725 6874
Kojto 122:f9eeca106725 6875 /**
Kojto 122:f9eeca106725 6876 * @brief Get flag multimode ADC analog watchdog 2 of the ADC master.
Kojto 122:f9eeca106725 6877 * @rmtoll CSR AWD2_MST LL_ADC_IsActiveFlag_MST_AWD2
Kojto 122:f9eeca106725 6878 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 6879 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 6880 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6881 */
Kojto 122:f9eeca106725 6882 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_MST_AWD2(ADC_Common_TypeDef *ADCxy_COMMON)
Kojto 122:f9eeca106725 6883 {
Kojto 122:f9eeca106725 6884 return (READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_AWD2_MST) == (LL_ADC_FLAG_AWD2_MST));
Kojto 122:f9eeca106725 6885 }
Kojto 122:f9eeca106725 6886
Kojto 122:f9eeca106725 6887 /**
Kojto 122:f9eeca106725 6888 * @brief Get flag multimode ADC analog watchdog 2 of the ADC slave.
Kojto 122:f9eeca106725 6889 * @rmtoll CSR AWD2_SLV LL_ADC_IsActiveFlag_SLV_AWD2
Kojto 122:f9eeca106725 6890 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 6891 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 6892 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6893 */
Kojto 122:f9eeca106725 6894 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_SLV_AWD2(ADC_Common_TypeDef *ADCxy_COMMON)
Kojto 122:f9eeca106725 6895 {
Kojto 122:f9eeca106725 6896 return (READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_AWD2_SLV) == (LL_ADC_FLAG_AWD2_SLV));
Kojto 122:f9eeca106725 6897 }
Kojto 122:f9eeca106725 6898
Kojto 122:f9eeca106725 6899 /**
Kojto 122:f9eeca106725 6900 * @brief Get flag multimode ADC analog watchdog 3 of the ADC master.
Kojto 122:f9eeca106725 6901 * @rmtoll CSR AWD3_MST LL_ADC_IsActiveFlag_MST_AWD3
Kojto 122:f9eeca106725 6902 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 6903 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 6904 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6905 */
Kojto 122:f9eeca106725 6906 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_MST_AWD3(ADC_Common_TypeDef *ADCxy_COMMON)
Kojto 122:f9eeca106725 6907 {
Kojto 122:f9eeca106725 6908 return (READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_AWD3_MST) == (LL_ADC_FLAG_AWD3_MST));
Kojto 122:f9eeca106725 6909 }
Kojto 122:f9eeca106725 6910
Kojto 122:f9eeca106725 6911 /**
Kojto 122:f9eeca106725 6912 * @brief Get flag multimode ADC analog watchdog 3 of the ADC slave.
Kojto 122:f9eeca106725 6913 * @rmtoll CSR AWD3_SLV LL_ADC_IsActiveFlag_SLV_AWD3
Kojto 122:f9eeca106725 6914 * @param ADCxy_COMMON ADC common instance
Kojto 122:f9eeca106725 6915 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 6916 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 6917 */
Kojto 122:f9eeca106725 6918 __STATIC_INLINE uint32_t LL_ADC_IsActiveFlag_SLV_AWD3(ADC_Common_TypeDef *ADCxy_COMMON)
Kojto 122:f9eeca106725 6919 {
Kojto 122:f9eeca106725 6920 return (READ_BIT(ADCxy_COMMON->CSR, LL_ADC_FLAG_AWD3_SLV) == (LL_ADC_FLAG_AWD3_SLV));
Kojto 122:f9eeca106725 6921 }
Kojto 122:f9eeca106725 6922 #endif /* ADC_MULTIMODE_SUPPORT */
Kojto 122:f9eeca106725 6923
Kojto 122:f9eeca106725 6924 /**
Kojto 122:f9eeca106725 6925 * @}
Kojto 122:f9eeca106725 6926 */
Kojto 122:f9eeca106725 6927
Kojto 122:f9eeca106725 6928 /** @defgroup ADC_LL_EF_IT_Management ADC IT management
Kojto 122:f9eeca106725 6929 * @{
Kojto 122:f9eeca106725 6930 */
Kojto 122:f9eeca106725 6931
Kojto 122:f9eeca106725 6932 /**
Kojto 122:f9eeca106725 6933 * @brief Enable ADC ready.
Kojto 122:f9eeca106725 6934 * @rmtoll IER ADRDYIE LL_ADC_EnableIT_ADRDY
Kojto 122:f9eeca106725 6935 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6936 * @retval None
Kojto 122:f9eeca106725 6937 */
Kojto 122:f9eeca106725 6938 __STATIC_INLINE void LL_ADC_EnableIT_ADRDY(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6939 {
Kojto 122:f9eeca106725 6940 SET_BIT(ADCx->IER, LL_ADC_IT_ADRDY);
Kojto 122:f9eeca106725 6941 }
Kojto 122:f9eeca106725 6942
Kojto 122:f9eeca106725 6943 /**
Kojto 122:f9eeca106725 6944 * @brief Enable interruption ADC group regular end of unitary conversion.
Kojto 122:f9eeca106725 6945 * @rmtoll IER EOCIE LL_ADC_EnableIT_EOC
Kojto 122:f9eeca106725 6946 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6947 * @retval None
Kojto 122:f9eeca106725 6948 */
Kojto 122:f9eeca106725 6949 __STATIC_INLINE void LL_ADC_EnableIT_EOC(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6950 {
Kojto 122:f9eeca106725 6951 SET_BIT(ADCx->IER, LL_ADC_IT_EOC);
Kojto 122:f9eeca106725 6952 }
Kojto 122:f9eeca106725 6953
Kojto 122:f9eeca106725 6954 /**
Kojto 122:f9eeca106725 6955 * @brief Enable interruption ADC group regular end of sequence conversions.
Kojto 122:f9eeca106725 6956 * @rmtoll IER EOSIE LL_ADC_EnableIT_EOS
Kojto 122:f9eeca106725 6957 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6958 * @retval None
Kojto 122:f9eeca106725 6959 */
Kojto 122:f9eeca106725 6960 __STATIC_INLINE void LL_ADC_EnableIT_EOS(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6961 {
Kojto 122:f9eeca106725 6962 SET_BIT(ADCx->IER, LL_ADC_IT_EOS);
Kojto 122:f9eeca106725 6963 }
Kojto 122:f9eeca106725 6964
Kojto 122:f9eeca106725 6965 /**
Kojto 122:f9eeca106725 6966 * @brief Enable ADC group regular interruption overrun.
Kojto 122:f9eeca106725 6967 * @rmtoll IER OVRIE LL_ADC_EnableIT_OVR
Kojto 122:f9eeca106725 6968 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6969 * @retval None
Kojto 122:f9eeca106725 6970 */
Kojto 122:f9eeca106725 6971 __STATIC_INLINE void LL_ADC_EnableIT_OVR(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6972 {
Kojto 122:f9eeca106725 6973 SET_BIT(ADCx->IER, LL_ADC_IT_OVR);
Kojto 122:f9eeca106725 6974 }
Kojto 122:f9eeca106725 6975
Kojto 122:f9eeca106725 6976 /**
Kojto 122:f9eeca106725 6977 * @brief Enable interruption ADC group regular end of sampling.
Kojto 122:f9eeca106725 6978 * @rmtoll IER EOSMPIE LL_ADC_EnableIT_EOSMP
Kojto 122:f9eeca106725 6979 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6980 * @retval None
Kojto 122:f9eeca106725 6981 */
Kojto 122:f9eeca106725 6982 __STATIC_INLINE void LL_ADC_EnableIT_EOSMP(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6983 {
Kojto 122:f9eeca106725 6984 SET_BIT(ADCx->IER, LL_ADC_IT_EOSMP);
Kojto 122:f9eeca106725 6985 }
Kojto 122:f9eeca106725 6986
Kojto 122:f9eeca106725 6987 /**
Kojto 122:f9eeca106725 6988 * @brief Enable interruption ADC group injected end of unitary conversion.
Kojto 122:f9eeca106725 6989 * @rmtoll IER JEOCIE LL_ADC_EnableIT_JEOC
Kojto 122:f9eeca106725 6990 * @param ADCx ADC instance
Kojto 122:f9eeca106725 6991 * @retval None
Kojto 122:f9eeca106725 6992 */
Kojto 122:f9eeca106725 6993 __STATIC_INLINE void LL_ADC_EnableIT_JEOC(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 6994 {
Kojto 122:f9eeca106725 6995 SET_BIT(ADCx->IER, LL_ADC_IT_JEOC);
Kojto 122:f9eeca106725 6996 }
Kojto 122:f9eeca106725 6997
Kojto 122:f9eeca106725 6998 /**
Kojto 122:f9eeca106725 6999 * @brief Enable interruption ADC group injected end of sequence conversions.
Kojto 122:f9eeca106725 7000 * @rmtoll IER JEOSIE LL_ADC_EnableIT_JEOS
Kojto 122:f9eeca106725 7001 * @param ADCx ADC instance
Kojto 122:f9eeca106725 7002 * @retval None
Kojto 122:f9eeca106725 7003 */
Kojto 122:f9eeca106725 7004 __STATIC_INLINE void LL_ADC_EnableIT_JEOS(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 7005 {
Kojto 122:f9eeca106725 7006 SET_BIT(ADCx->IER, LL_ADC_IT_JEOS);
Kojto 122:f9eeca106725 7007 }
Kojto 122:f9eeca106725 7008
Kojto 122:f9eeca106725 7009 /**
Kojto 122:f9eeca106725 7010 * @brief Enable interruption ADC group injected context queue overflow.
Kojto 122:f9eeca106725 7011 * @rmtoll IER JQOVFIE LL_ADC_EnableIT_JQOVF
Kojto 122:f9eeca106725 7012 * @param ADCx ADC instance
Kojto 122:f9eeca106725 7013 * @retval None
Kojto 122:f9eeca106725 7014 */
Kojto 122:f9eeca106725 7015 __STATIC_INLINE void LL_ADC_EnableIT_JQOVF(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 7016 {
Kojto 122:f9eeca106725 7017 SET_BIT(ADCx->IER, LL_ADC_IT_JQOVF);
Kojto 122:f9eeca106725 7018 }
Kojto 122:f9eeca106725 7019
Kojto 122:f9eeca106725 7020 /**
Kojto 122:f9eeca106725 7021 * @brief Enable interruption ADC analog watchdog 1.
Kojto 122:f9eeca106725 7022 * @rmtoll IER AWD1IE LL_ADC_EnableIT_AWD1
Kojto 122:f9eeca106725 7023 * @param ADCx ADC instance
Kojto 122:f9eeca106725 7024 * @retval None
Kojto 122:f9eeca106725 7025 */
Kojto 122:f9eeca106725 7026 __STATIC_INLINE void LL_ADC_EnableIT_AWD1(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 7027 {
Kojto 122:f9eeca106725 7028 SET_BIT(ADCx->IER, LL_ADC_IT_AWD1);
Kojto 122:f9eeca106725 7029 }
Kojto 122:f9eeca106725 7030
Kojto 122:f9eeca106725 7031 /**
Kojto 122:f9eeca106725 7032 * @brief Enable interruption ADC analog watchdog 2.
Kojto 122:f9eeca106725 7033 * @rmtoll IER AWD2IE LL_ADC_EnableIT_AWD2
Kojto 122:f9eeca106725 7034 * @param ADCx ADC instance
Kojto 122:f9eeca106725 7035 * @retval None
Kojto 122:f9eeca106725 7036 */
Kojto 122:f9eeca106725 7037 __STATIC_INLINE void LL_ADC_EnableIT_AWD2(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 7038 {
Kojto 122:f9eeca106725 7039 SET_BIT(ADCx->IER, LL_ADC_IT_AWD2);
Kojto 122:f9eeca106725 7040 }
Kojto 122:f9eeca106725 7041
Kojto 122:f9eeca106725 7042 /**
Kojto 122:f9eeca106725 7043 * @brief Enable interruption ADC analog watchdog 3.
Kojto 122:f9eeca106725 7044 * @rmtoll IER AWD3IE LL_ADC_EnableIT_AWD3
Kojto 122:f9eeca106725 7045 * @param ADCx ADC instance
Kojto 122:f9eeca106725 7046 * @retval None
Kojto 122:f9eeca106725 7047 */
Kojto 122:f9eeca106725 7048 __STATIC_INLINE void LL_ADC_EnableIT_AWD3(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 7049 {
Kojto 122:f9eeca106725 7050 SET_BIT(ADCx->IER, LL_ADC_IT_AWD3);
Kojto 122:f9eeca106725 7051 }
Kojto 122:f9eeca106725 7052
Kojto 122:f9eeca106725 7053 /**
Kojto 122:f9eeca106725 7054 * @brief Disable interruption ADC ready.
Kojto 122:f9eeca106725 7055 * @rmtoll IER ADRDYIE LL_ADC_DisableIT_ADRDY
Kojto 122:f9eeca106725 7056 * @param ADCx ADC instance
Kojto 122:f9eeca106725 7057 * @retval None
Kojto 122:f9eeca106725 7058 */
Kojto 122:f9eeca106725 7059 __STATIC_INLINE void LL_ADC_DisableIT_ADRDY(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 7060 {
Kojto 122:f9eeca106725 7061 CLEAR_BIT(ADCx->IER, LL_ADC_IT_ADRDY);
Kojto 122:f9eeca106725 7062 }
Kojto 122:f9eeca106725 7063
Kojto 122:f9eeca106725 7064 /**
Kojto 122:f9eeca106725 7065 * @brief Disable interruption ADC group regular end of unitary conversion.
Kojto 122:f9eeca106725 7066 * @rmtoll IER EOCIE LL_ADC_DisableIT_EOC
Kojto 122:f9eeca106725 7067 * @param ADCx ADC instance
Kojto 122:f9eeca106725 7068 * @retval None
Kojto 122:f9eeca106725 7069 */
Kojto 122:f9eeca106725 7070 __STATIC_INLINE void LL_ADC_DisableIT_EOC(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 7071 {
Kojto 122:f9eeca106725 7072 CLEAR_BIT(ADCx->IER, LL_ADC_IT_EOC);
Kojto 122:f9eeca106725 7073 }
Kojto 122:f9eeca106725 7074
Kojto 122:f9eeca106725 7075 /**
Kojto 122:f9eeca106725 7076 * @brief Disable interruption ADC group regular end of sequence conversions.
Kojto 122:f9eeca106725 7077 * @rmtoll IER EOSIE LL_ADC_DisableIT_EOS
Kojto 122:f9eeca106725 7078 * @param ADCx ADC instance
Kojto 122:f9eeca106725 7079 * @retval None
Kojto 122:f9eeca106725 7080 */
Kojto 122:f9eeca106725 7081 __STATIC_INLINE void LL_ADC_DisableIT_EOS(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 7082 {
Kojto 122:f9eeca106725 7083 CLEAR_BIT(ADCx->IER, LL_ADC_IT_EOS);
Kojto 122:f9eeca106725 7084 }
Kojto 122:f9eeca106725 7085
Kojto 122:f9eeca106725 7086 /**
Kojto 122:f9eeca106725 7087 * @brief Disable interruption ADC group regular overrun.
Kojto 122:f9eeca106725 7088 * @rmtoll IER OVRIE LL_ADC_DisableIT_OVR
Kojto 122:f9eeca106725 7089 * @param ADCx ADC instance
Kojto 122:f9eeca106725 7090 * @retval None
Kojto 122:f9eeca106725 7091 */
Kojto 122:f9eeca106725 7092 __STATIC_INLINE void LL_ADC_DisableIT_OVR(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 7093 {
Kojto 122:f9eeca106725 7094 CLEAR_BIT(ADCx->IER, LL_ADC_IT_OVR);
Kojto 122:f9eeca106725 7095 }
Kojto 122:f9eeca106725 7096
Kojto 122:f9eeca106725 7097 /**
Kojto 122:f9eeca106725 7098 * @brief Disable interruption ADC group regular end of sampling.
Kojto 122:f9eeca106725 7099 * @rmtoll IER EOSMPIE LL_ADC_DisableIT_EOSMP
Kojto 122:f9eeca106725 7100 * @param ADCx ADC instance
Kojto 122:f9eeca106725 7101 * @retval None
Kojto 122:f9eeca106725 7102 */
Kojto 122:f9eeca106725 7103 __STATIC_INLINE void LL_ADC_DisableIT_EOSMP(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 7104 {
Kojto 122:f9eeca106725 7105 CLEAR_BIT(ADCx->IER, LL_ADC_IT_EOSMP);
Kojto 122:f9eeca106725 7106 }
Kojto 122:f9eeca106725 7107
Kojto 122:f9eeca106725 7108 /**
Kojto 122:f9eeca106725 7109 * @brief Disable interruption ADC group regular end of unitary conversion.
Kojto 122:f9eeca106725 7110 * @rmtoll IER JEOCIE LL_ADC_DisableIT_JEOC
Kojto 122:f9eeca106725 7111 * @param ADCx ADC instance
Kojto 122:f9eeca106725 7112 * @retval None
Kojto 122:f9eeca106725 7113 */
Kojto 122:f9eeca106725 7114 __STATIC_INLINE void LL_ADC_DisableIT_JEOC(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 7115 {
Kojto 122:f9eeca106725 7116 CLEAR_BIT(ADCx->IER, LL_ADC_IT_JEOC);
Kojto 122:f9eeca106725 7117 }
Kojto 122:f9eeca106725 7118
Kojto 122:f9eeca106725 7119 /**
Kojto 122:f9eeca106725 7120 * @brief Disable interruption ADC group injected end of sequence conversions.
Kojto 122:f9eeca106725 7121 * @rmtoll IER JEOSIE LL_ADC_DisableIT_JEOS
Kojto 122:f9eeca106725 7122 * @param ADCx ADC instance
Kojto 122:f9eeca106725 7123 * @retval None
Kojto 122:f9eeca106725 7124 */
Kojto 122:f9eeca106725 7125 __STATIC_INLINE void LL_ADC_DisableIT_JEOS(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 7126 {
Kojto 122:f9eeca106725 7127 CLEAR_BIT(ADCx->IER, LL_ADC_IT_JEOS);
Kojto 122:f9eeca106725 7128 }
Kojto 122:f9eeca106725 7129
Kojto 122:f9eeca106725 7130 /**
Kojto 122:f9eeca106725 7131 * @brief Disable interruption ADC group injected context queue overflow.
Kojto 122:f9eeca106725 7132 * @rmtoll IER JQOVFIE LL_ADC_DisableIT_JQOVF
Kojto 122:f9eeca106725 7133 * @param ADCx ADC instance
Kojto 122:f9eeca106725 7134 * @retval None
Kojto 122:f9eeca106725 7135 */
Kojto 122:f9eeca106725 7136 __STATIC_INLINE void LL_ADC_DisableIT_JQOVF(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 7137 {
Kojto 122:f9eeca106725 7138 CLEAR_BIT(ADCx->IER, LL_ADC_IT_JQOVF);
Kojto 122:f9eeca106725 7139 }
Kojto 122:f9eeca106725 7140
Kojto 122:f9eeca106725 7141 /**
Kojto 122:f9eeca106725 7142 * @brief Disable interruption ADC analog watchdog 1.
Kojto 122:f9eeca106725 7143 * @rmtoll IER AWD1IE LL_ADC_DisableIT_AWD1
Kojto 122:f9eeca106725 7144 * @param ADCx ADC instance
Kojto 122:f9eeca106725 7145 * @retval None
Kojto 122:f9eeca106725 7146 */
Kojto 122:f9eeca106725 7147 __STATIC_INLINE void LL_ADC_DisableIT_AWD1(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 7148 {
Kojto 122:f9eeca106725 7149 CLEAR_BIT(ADCx->IER, LL_ADC_IT_AWD1);
Kojto 122:f9eeca106725 7150 }
Kojto 122:f9eeca106725 7151
Kojto 122:f9eeca106725 7152 /**
Kojto 122:f9eeca106725 7153 * @brief Disable interruption ADC analog watchdog 2.
Kojto 122:f9eeca106725 7154 * @rmtoll IER AWD2IE LL_ADC_DisableIT_AWD2
Kojto 122:f9eeca106725 7155 * @param ADCx ADC instance
Kojto 122:f9eeca106725 7156 * @retval None
Kojto 122:f9eeca106725 7157 */
Kojto 122:f9eeca106725 7158 __STATIC_INLINE void LL_ADC_DisableIT_AWD2(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 7159 {
Kojto 122:f9eeca106725 7160 CLEAR_BIT(ADCx->IER, LL_ADC_IT_AWD2);
Kojto 122:f9eeca106725 7161 }
Kojto 122:f9eeca106725 7162
Kojto 122:f9eeca106725 7163 /**
Kojto 122:f9eeca106725 7164 * @brief Disable interruption ADC analog watchdog 3.
Kojto 122:f9eeca106725 7165 * @rmtoll IER AWD3IE LL_ADC_DisableIT_AWD3
Kojto 122:f9eeca106725 7166 * @param ADCx ADC instance
Kojto 122:f9eeca106725 7167 * @retval None
Kojto 122:f9eeca106725 7168 */
Kojto 122:f9eeca106725 7169 __STATIC_INLINE void LL_ADC_DisableIT_AWD3(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 7170 {
Kojto 122:f9eeca106725 7171 CLEAR_BIT(ADCx->IER, LL_ADC_IT_AWD3);
Kojto 122:f9eeca106725 7172 }
Kojto 122:f9eeca106725 7173
Kojto 122:f9eeca106725 7174 /**
Kojto 122:f9eeca106725 7175 * @brief Get state of interruption ADC ready
Kojto 122:f9eeca106725 7176 * (0: interrupt disabled, 1: interrupt enabled).
Kojto 122:f9eeca106725 7177 * @rmtoll IER ADRDYIE LL_ADC_IsEnabledIT_ADRDY
Kojto 122:f9eeca106725 7178 * @param ADCx ADC instance
Kojto 122:f9eeca106725 7179 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 7180 */
Kojto 122:f9eeca106725 7181 __STATIC_INLINE uint32_t LL_ADC_IsEnabledIT_ADRDY(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 7182 {
Kojto 122:f9eeca106725 7183 return (READ_BIT(ADCx->IER, LL_ADC_IT_ADRDY) == (LL_ADC_IT_ADRDY));
Kojto 122:f9eeca106725 7184 }
Kojto 122:f9eeca106725 7185
Kojto 122:f9eeca106725 7186 /**
Kojto 122:f9eeca106725 7187 * @brief Get state of interruption ADC group regular end of unitary conversion
Kojto 122:f9eeca106725 7188 * (0: interrupt disabled, 1: interrupt enabled).
Kojto 122:f9eeca106725 7189 * @rmtoll IER EOCIE LL_ADC_IsEnabledIT_EOC
Kojto 122:f9eeca106725 7190 * @param ADCx ADC instance
Kojto 122:f9eeca106725 7191 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 7192 */
Kojto 122:f9eeca106725 7193 __STATIC_INLINE uint32_t LL_ADC_IsEnabledIT_EOC(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 7194 {
Kojto 122:f9eeca106725 7195 return (READ_BIT(ADCx->IER, LL_ADC_IT_EOC) == (LL_ADC_IT_EOC));
Kojto 122:f9eeca106725 7196 }
Kojto 122:f9eeca106725 7197
Kojto 122:f9eeca106725 7198 /**
Kojto 122:f9eeca106725 7199 * @brief Get state of interruption ADC group regular end of sequence conversions
Kojto 122:f9eeca106725 7200 * (0: interrupt disabled, 1: interrupt enabled).
Kojto 122:f9eeca106725 7201 * @rmtoll IER EOSIE LL_ADC_IsEnabledIT_EOS
Kojto 122:f9eeca106725 7202 * @param ADCx ADC instance
Kojto 122:f9eeca106725 7203 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 7204 */
Kojto 122:f9eeca106725 7205 __STATIC_INLINE uint32_t LL_ADC_IsEnabledIT_EOS(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 7206 {
Kojto 122:f9eeca106725 7207 return (READ_BIT(ADCx->IER, LL_ADC_IT_EOS) == (LL_ADC_IT_EOS));
Kojto 122:f9eeca106725 7208 }
Kojto 122:f9eeca106725 7209
Kojto 122:f9eeca106725 7210 /**
Kojto 122:f9eeca106725 7211 * @brief Get state of interruption ADC group regular overrun
Kojto 122:f9eeca106725 7212 * (0: interrupt disabled, 1: interrupt enabled).
Kojto 122:f9eeca106725 7213 * @rmtoll IER OVRIE LL_ADC_IsEnabledIT_OVR
Kojto 122:f9eeca106725 7214 * @param ADCx ADC instance
Kojto 122:f9eeca106725 7215 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 7216 */
Kojto 122:f9eeca106725 7217 __STATIC_INLINE uint32_t LL_ADC_IsEnabledIT_OVR(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 7218 {
Kojto 122:f9eeca106725 7219 return (READ_BIT(ADCx->IER, LL_ADC_IT_OVR) == (LL_ADC_IT_OVR));
Kojto 122:f9eeca106725 7220 }
Kojto 122:f9eeca106725 7221
Kojto 122:f9eeca106725 7222 /**
Kojto 122:f9eeca106725 7223 * @brief Get state of interruption ADC group regular end of sampling
Kojto 122:f9eeca106725 7224 * (0: interrupt disabled, 1: interrupt enabled).
Kojto 122:f9eeca106725 7225 * @rmtoll IER EOSMPIE LL_ADC_IsEnabledIT_EOSMP
Kojto 122:f9eeca106725 7226 * @param ADCx ADC instance
Kojto 122:f9eeca106725 7227 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 7228 */
Kojto 122:f9eeca106725 7229 __STATIC_INLINE uint32_t LL_ADC_IsEnabledIT_EOSMP(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 7230 {
Kojto 122:f9eeca106725 7231 return (READ_BIT(ADCx->IER, LL_ADC_IT_EOSMP) == (LL_ADC_IT_EOSMP));
Kojto 122:f9eeca106725 7232 }
Kojto 122:f9eeca106725 7233
Kojto 122:f9eeca106725 7234 /**
Kojto 122:f9eeca106725 7235 * @brief Get state of interruption ADC group injected end of unitary conversion
Kojto 122:f9eeca106725 7236 * (0: interrupt disabled, 1: interrupt enabled).
Kojto 122:f9eeca106725 7237 * @rmtoll IER JEOCIE LL_ADC_IsEnabledIT_JEOC
Kojto 122:f9eeca106725 7238 * @param ADCx ADC instance
Kojto 122:f9eeca106725 7239 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 7240 */
Kojto 122:f9eeca106725 7241 __STATIC_INLINE uint32_t LL_ADC_IsEnabledIT_JEOC(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 7242 {
Kojto 122:f9eeca106725 7243 return (READ_BIT(ADCx->IER, LL_ADC_IT_JEOC) == (LL_ADC_IT_JEOC));
Kojto 122:f9eeca106725 7244 }
Kojto 122:f9eeca106725 7245
Kojto 122:f9eeca106725 7246 /**
Kojto 122:f9eeca106725 7247 * @brief Get state of interruption ADC group injected end of sequence conversions
Kojto 122:f9eeca106725 7248 * (0: interrupt disabled, 1: interrupt enabled).
Kojto 122:f9eeca106725 7249 * @rmtoll IER JEOSIE LL_ADC_IsEnabledIT_JEOS
Kojto 122:f9eeca106725 7250 * @param ADCx ADC instance
Kojto 122:f9eeca106725 7251 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 7252 */
Kojto 122:f9eeca106725 7253 __STATIC_INLINE uint32_t LL_ADC_IsEnabledIT_JEOS(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 7254 {
Kojto 122:f9eeca106725 7255 return (READ_BIT(ADCx->IER, LL_ADC_IT_JEOS) == (LL_ADC_IT_JEOS));
Kojto 122:f9eeca106725 7256 }
Kojto 122:f9eeca106725 7257
Kojto 122:f9eeca106725 7258 /**
Kojto 122:f9eeca106725 7259 * @brief Get state of interruption ADC group injected context queue overflow interrupt state
Kojto 122:f9eeca106725 7260 * (0: interrupt disabled, 1: interrupt enabled).
Kojto 122:f9eeca106725 7261 * @rmtoll IER JQOVFIE LL_ADC_IsEnabledIT_JQOVF
Kojto 122:f9eeca106725 7262 * @param ADCx ADC instance
Kojto 122:f9eeca106725 7263 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 7264 */
Kojto 122:f9eeca106725 7265 __STATIC_INLINE uint32_t LL_ADC_IsEnabledIT_JQOVF(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 7266 {
Kojto 122:f9eeca106725 7267 return (READ_BIT(ADCx->IER, LL_ADC_IT_JQOVF) == (LL_ADC_IT_JQOVF));
Kojto 122:f9eeca106725 7268 }
Kojto 122:f9eeca106725 7269
Kojto 122:f9eeca106725 7270 /**
Kojto 122:f9eeca106725 7271 * @brief Get state of interruption ADC analog watchdog 1
Kojto 122:f9eeca106725 7272 * (0: interrupt disabled, 1: interrupt enabled).
Kojto 122:f9eeca106725 7273 * @rmtoll IER AWD1IE LL_ADC_IsEnabledIT_AWD1
Kojto 122:f9eeca106725 7274 * @param ADCx ADC instance
Kojto 122:f9eeca106725 7275 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 7276 */
Kojto 122:f9eeca106725 7277 __STATIC_INLINE uint32_t LL_ADC_IsEnabledIT_AWD1(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 7278 {
Kojto 122:f9eeca106725 7279 return (READ_BIT(ADCx->IER, LL_ADC_IT_AWD1) == (LL_ADC_IT_AWD1));
Kojto 122:f9eeca106725 7280 }
Kojto 122:f9eeca106725 7281
Kojto 122:f9eeca106725 7282 /**
Kojto 122:f9eeca106725 7283 * @brief Get state of interruption Get ADC analog watchdog 2
Kojto 122:f9eeca106725 7284 * (0: interrupt disabled, 1: interrupt enabled).
Kojto 122:f9eeca106725 7285 * @rmtoll IER AWD2IE LL_ADC_IsEnabledIT_AWD2
Kojto 122:f9eeca106725 7286 * @param ADCx ADC instance
Kojto 122:f9eeca106725 7287 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 7288 */
Kojto 122:f9eeca106725 7289 __STATIC_INLINE uint32_t LL_ADC_IsEnabledIT_AWD2(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 7290 {
Kojto 122:f9eeca106725 7291 return (READ_BIT(ADCx->IER, LL_ADC_IT_AWD2) == (LL_ADC_IT_AWD2));
Kojto 122:f9eeca106725 7292 }
Kojto 122:f9eeca106725 7293
Kojto 122:f9eeca106725 7294 /**
Kojto 122:f9eeca106725 7295 * @brief Get state of interruption Get ADC analog watchdog 3
Kojto 122:f9eeca106725 7296 * (0: interrupt disabled, 1: interrupt enabled).
Kojto 122:f9eeca106725 7297 * @rmtoll IER AWD3IE LL_ADC_IsEnabledIT_AWD3
Kojto 122:f9eeca106725 7298 * @param ADCx ADC instance
Kojto 122:f9eeca106725 7299 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 7300 */
Kojto 122:f9eeca106725 7301 __STATIC_INLINE uint32_t LL_ADC_IsEnabledIT_AWD3(ADC_TypeDef *ADCx)
Kojto 122:f9eeca106725 7302 {
Kojto 122:f9eeca106725 7303 return (READ_BIT(ADCx->IER, LL_ADC_IT_AWD3) == (LL_ADC_IT_AWD3));
Kojto 122:f9eeca106725 7304 }
Kojto 122:f9eeca106725 7305
Kojto 122:f9eeca106725 7306 /**
Kojto 122:f9eeca106725 7307 * @}
Kojto 122:f9eeca106725 7308 */
Kojto 122:f9eeca106725 7309
Kojto 122:f9eeca106725 7310 #if defined(USE_FULL_LL_DRIVER)
Kojto 122:f9eeca106725 7311 /** @defgroup ADC_LL_EF_Init Initialization and de-initialization functions
Kojto 122:f9eeca106725 7312 * @{
Kojto 122:f9eeca106725 7313 */
Kojto 122:f9eeca106725 7314
Kojto 122:f9eeca106725 7315 /* Initialization of some features of ADC common parameters and multimode */
Kojto 122:f9eeca106725 7316 ErrorStatus LL_ADC_CommonDeInit(ADC_Common_TypeDef *ADCxy_COMMON);
Kojto 122:f9eeca106725 7317 ErrorStatus LL_ADC_CommonInit(ADC_Common_TypeDef *ADCxy_COMMON, LL_ADC_CommonInitTypeDef *ADC_CommonInitStruct);
Kojto 122:f9eeca106725 7318 void LL_ADC_CommonStructInit(LL_ADC_CommonInitTypeDef *ADC_CommonInitStruct);
Kojto 122:f9eeca106725 7319
Kojto 122:f9eeca106725 7320 /* De-initialization of ADC instance, ADC group regular and ADC group injected */
Kojto 122:f9eeca106725 7321 /* (availability of ADC group injected depends on STM32 families) */
Kojto 122:f9eeca106725 7322 ErrorStatus LL_ADC_DeInit(ADC_TypeDef *ADCx);
Kojto 122:f9eeca106725 7323
Kojto 122:f9eeca106725 7324 /* Initialization of some features of ADC instance */
Kojto 122:f9eeca106725 7325 ErrorStatus LL_ADC_Init(ADC_TypeDef *ADCx, LL_ADC_InitTypeDef *ADC_InitStruct);
Kojto 122:f9eeca106725 7326 void LL_ADC_StructInit(LL_ADC_InitTypeDef *ADC_InitStruct);
Kojto 122:f9eeca106725 7327
Kojto 122:f9eeca106725 7328 /* Initialization of some features of ADC instance and ADC group regular */
Kojto 122:f9eeca106725 7329 ErrorStatus LL_ADC_REG_Init(ADC_TypeDef *ADCx, LL_ADC_REG_InitTypeDef *ADC_REG_InitStruct);
Kojto 122:f9eeca106725 7330 void LL_ADC_REG_StructInit(LL_ADC_REG_InitTypeDef *ADC_REG_InitStruct);
Kojto 122:f9eeca106725 7331
Kojto 122:f9eeca106725 7332 /* Initialization of some features of ADC instance and ADC group injected */
Kojto 122:f9eeca106725 7333 ErrorStatus LL_ADC_INJ_Init(ADC_TypeDef *ADCx, LL_ADC_INJ_InitTypeDef *ADC_INJ_InitStruct);
Kojto 122:f9eeca106725 7334 void LL_ADC_INJ_StructInit(LL_ADC_INJ_InitTypeDef *ADC_INJ_InitStruct);
Kojto 122:f9eeca106725 7335
Kojto 122:f9eeca106725 7336 /**
Kojto 122:f9eeca106725 7337 * @}
Kojto 122:f9eeca106725 7338 */
Kojto 122:f9eeca106725 7339 #endif /* USE_FULL_LL_DRIVER */
Kojto 122:f9eeca106725 7340
Kojto 122:f9eeca106725 7341 /**
Kojto 122:f9eeca106725 7342 * @}
Kojto 122:f9eeca106725 7343 */
Kojto 122:f9eeca106725 7344
Kojto 122:f9eeca106725 7345 /**
Kojto 122:f9eeca106725 7346 * @}
Kojto 122:f9eeca106725 7347 */
Kojto 122:f9eeca106725 7348
Kojto 122:f9eeca106725 7349 #endif /* ADC1 || ADC2 || ADC3 */
Kojto 122:f9eeca106725 7350
Kojto 122:f9eeca106725 7351 /**
Kojto 122:f9eeca106725 7352 * @}
Kojto 122:f9eeca106725 7353 */
Kojto 122:f9eeca106725 7354
Kojto 122:f9eeca106725 7355 #ifdef __cplusplus
Kojto 122:f9eeca106725 7356 }
Kojto 122:f9eeca106725 7357 #endif
Kojto 122:f9eeca106725 7358
Kojto 122:f9eeca106725 7359 #endif /* __STM32L4xx_LL_ADC_H */
Kojto 122:f9eeca106725 7360
Kojto 122:f9eeca106725 7361 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/